diff options
| author | Jakob Kaivo <jkk@ung.org> | 2019-01-26 22:41:05 -0500 |
|---|---|---|
| committer | Jakob Kaivo <jkk@ung.org> | 2019-01-26 22:41:05 -0500 |
| commit | 8c6d4505329f94446084ca93eae10cd796d79a8d (patch) | |
| tree | c00c6a990c81bd771ebcac72b38fd3ce2382c42e /nonstd/addefs | |
new framework for building sources after gitlab migration
Diffstat (limited to 'nonstd/addefs')
| -rw-r--r-- | nonstd/addefs | 35 |
1 files changed, 35 insertions, 0 deletions
diff --git a/nonstd/addefs b/nonstd/addefs new file mode 100644 index 00000000..a6a5e2f4 --- /dev/null +++ b/nonstd/addefs @@ -0,0 +1,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 |
