blob: a6a5e2f45dab5e17086f9a64869ceef1807669f6 (
plain)
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
|
#!/bin/sh
#printf '/* %s */\n' "$1" >> $2
if grep -q '^#define' $1; then
grep ' *extern.*;$' $1 >> $2
grep -E '^#(if|def|undef|el|end)' $1 >> $2
elif grep -q '^typedef' $1; then
if grep -q '^#ifdef' $1; then
sed -ne '/#ifdef/,/#endif/p' $1 >> $2
elif grep -q '^typedef.*;$' $1; then
grep '^typedef' $1 >> $2
else
sed -ne '/^typedef/,/\}.*;$/p' $1 >> $2
fi
elif grep -Eq '^(struct|union).*{$' $1; then
if grep -q '^struct' $1; then
sed -ne '/^struct/,/\};/p' $1 >> $2
else
sed -ne '/^union/,/\};/p' $1 >> $2
fi
elif grep -q '^[a-zA-Z_].*;$' $1; then
printf 'extern %s' "$(grep '^[a-zA-Z_].*;$' $1)" >> $2
elif grep -q 'TGFN' $1; then
printf '%s;\n' "$(sed -e "/{/q" $1 | tail -n2 | head -n1 | m4 '-DTGFN=$1' -DTYPE=double)" >> $2
else
printf '%s;\n' "$(sed -e "/{/q" $1 | tail -n2 | head -n1)" >> $2
fi
#printf '\n' >> $2
|