-
Notifications
You must be signed in to change notification settings - Fork 2
/
tabl.sh
55 lines (55 loc) · 881 Bytes
/
tabl.sh
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
#
# module : tabl.sh
# version : 1.7
# date : 03/05/24
#
# Generate tabl.c
# The directory needs to be given as parameter.
#
echo checking tabl.c
todo=0
if [ ! -f $1/tabl.c ]
then
echo creating tabl.c
todo=1
else
for i in $1/src/*.c $1/prim.c $1/prim.h
do
if [ $i -nt $1/tabl.c ]
then
echo updating tabl.c
todo=1
break
fi
done
fi
if [ $todo -eq 0 ]
then
echo tabl.c is up-to-date
exit
fi
rm -f $1/tabl.c
for i in $1/src/*.c
do
j=`basename $i`
j=`expr $j : '\(.*\)\.c'`
sed -n '/\/\*\*/ {
N
N
N
N
N
N
N
N
s/[^\n]*\n\([^ \t]*\)[ \t]*\([^ \t]*\)[ \t]*\([^ \t]*\)[ \t]*\([^ \t]*\)[ \t]*:[ \t]*\([DANUPQ]*\)[ \t]*\([^\n]*\)[ \n]*\([^*]*\)\*\/.*/\/* \3 *\/ { \1, \2, @\4@, '$j'_, @\5@, @\6@, @\7@ },/
s/\n/\\n/g
s/"/\\"/g
s/@/"/g
P
}' <$i
done | sort >$1/tabl.c
if [ -f $1/otab.c ]
then
touch $1/otab.c
fi