forked from AdaCore/PolyORB
-
Notifications
You must be signed in to change notification settings - Fork 0
/
gentexifile
executable file
·49 lines (35 loc) · 935 Bytes
/
gentexifile
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
#!/bin/sh
if [ $# = 0 ]; then
echo "Usage: $0 <file to translate>"
exit 0
fi
SOURCE=$1
case ${SOURCE} in
*.idl)
SEDFILE=idl.sed;;
*.ad[bs])
SEDFILE=ada.sed;;
*.cfg)
SEDFILE=cfg.sed;;
*)
echo "Cannot translate file";
exit 1;;
esac
TARGET=${SOURCE}.texi
TMPTAR=${TARGET}.tmp
${AWK:-awk} 'BEGIN{out=1}$1=="end"&&substr($0,1,1)=="e"{out=1}out==1{print}$1=="private"&&out==1{out=0; print " -- implementation removed"}' ${SOURCE} > genout
echo "@smallexample" >${TMPTAR}
if [ $# = 1 ]; then
echo "@cartouche" >>${TMPTAR}
echo "@group" >>${TMPTAR}
fi
echo "" >>${TMPTAR}
${SED:-sed} -f ${SEDFILE} genout >>${TMPTAR}
echo "" >>${TMPTAR}
if [ $# = 1 ]; then
echo "@end group" >>${TMPTAR}
echo "@end cartouche" >>${TMPTAR}
fi
echo "@end smallexample" >>${TMPTAR}
cat ${TMPTAR} | tr -d '\r' > ${TARGET}
rm -f ${TMPTAR} genout