gentab.sh revision 3f54fd611f536639ec30dd53c48e5ec1897cc7d9
########################################################################
# #
# This software is part of the ast package #
# Copyright (c) 1986-2011 AT&T Intellectual Property #
# and is licensed under the #
# Eclipse Public License, Version 1.0 #
# by AT&T Intellectual Property #
# #
# A copy of the License is available at #
# (with md5 checksum b35adb5213ca9657e911e9befb180842) #
# #
# Information and Software Systems Research #
# AT&T Research #
# Florham Park NJ #
# #
# Glenn Fowler <gsf@research.att.com> #
# #
########################################################################
:
# Glenn Fowler
# AT&T Bell Laboratories
#
# @(#)gentab (gsf@research.att.com) 07/17/94
#
# C table generator
#
# %flags [ prefix=<prefix> ] [ index=<index> ] [ init=<init> ]
#
# %keyword <name> [ prefix=<prefix> ] [ index=<index> ] [ init=<init> ] [ first=<id> ] [ last=<id> ]
#
# %sequence [ prefix=<prefix> ] [ index=<index> ] [ init=<init> ]
#
typeset -u ID
;;
;;
esac
command=$0
counter=0
define=1
err_line=0
type=""
index=""
first=""
last=""
table=1
while :
do case $1 in
-d) table=0 ;;
-t) define=0 ;;
*) break ;;
esac
shift
done
case $1 in
;;
*) exec <$1
err_file="\"$1\", "
;;
esac
while read line
esac
set '' $line
shift
case $1 in
[#]*) echo "/*"
while :
do case $1 in
[#]*) shift
echo " * $*"
read line
set '' $line
shift
;;
*) break
;;
esac
done
echo " */"
echo
;;
esac
eval set '""' $line
shift
case $1 in
"") ;;
esac
;;
esac
if test $define = 1
then echo
fi
;;
%keywords)
if test $table = 1
then echo " 0, 0"
echo "};"
echo
elif test $define = 1
then echo
fi
;;
esac
esac
type=$1
shift
name=""
prefix=""
index=""
init=""
first=""
last=""
%keywords)
case $1 in
exit 1
;;
esac
name=$1
shift
if test $table = 1
then echo "$name"'[] ='
echo "{"
fi
;;
esac
eval "$@"
init=0
;;
*) init=1
;;
esac
;;
esac
;;
esac
;;
esac
esac
;;
exit 1
;;
*) while :
do case $1 in
"") break
;;
*) ID=`echo $1 | tr abcdefghijklmnopqrstuvwxyz ABCDEFGHIJKLMNOPQRSTUVWXYZ | sed 's/^[^ABCDEFGHIJKLMNOPQRSTUVWXYZ_]//'` ;;
esac
1[56789]|[23][0123456789]) long=L ;;
*) long= ;;
esac
fi
;;
%keywords)
if test $define = 1
fi
if test $table = 1
fi
;;
%sequence)
if test $define = 1
fi
;;
esac
esac
shift
;;
esac
done
;;
esac
done
esac
;;
esac
%keywords)
if test $table = 1
then echo " 0, 0"
echo "};"
fi
;;
esac
exit 0