From bf681e9e90adf99357f754284703ea2c6dc3ff4e Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?J=C3=A9r=C3=A9my=20Zurcher?= Date: Sat, 16 Apr 2011 10:19:20 +0200 Subject: update sed scripts, add sed-structs --- tools/extract-api.sh | 1 + tools/sed-enums | 21 +++++++-------------- tools/sed-structs | 14 ++++++++++++++ 3 files changed, 22 insertions(+), 14 deletions(-) create mode 100644 tools/sed-structs diff --git a/tools/extract-api.sh b/tools/extract-api.sh index ecf3edd..9fa7320 100755 --- a/tools/extract-api.sh +++ b/tools/extract-api.sh @@ -26,6 +26,7 @@ for header in \ # cat $header | sed -n -f sed-functions > $FILE cat $header | sed -r -n -f sed-enums > $FILE-enum + cat $header | sed -r -n -f sed-structs > $FILE-structs # if [ -f $FILE.prev ]; then diff -u0 $FILE.prev $FILE > $FILE-diff diff --git a/tools/sed-enums b/tools/sed-enums index 13ce112..ea7c5f7 100644 --- a/tools/sed-enums +++ b/tools/sed-enums @@ -1,23 +1,16 @@ s/.*(enum\s+[a-zA-Z0-9_]+).*$/typedef \1 { / -T -h -:attrs -n +T;h +:attrs;n s/^\s*([A-Z0-9_]+).*$/\1, / T next;H;b attrs :next /^\s*\}/ ! b attrs s/^\s*}\s*([a-zA-Z0-9_]+).*$/ } \1;/ -t end -# TODO fix above !! -/^\s*\}\s*;.*$/ { - :loop2 - n - /typedef/ ! b loop2 - s/^\s*typedef\s+enum\s+[a-zA-Z0-9_]+\s+([a-zA-Z0-9_]+)/ } \1/ - t end -} -:end +t finish +:close +s/^\s*typedef\s+enum\s+[a-zA-Z0-9_]+\s+([a-zA-Z0-9_]+)\s+;/ } \1/ +t finish;n;T close +:finish H;x s/\n//g s/ {2,}/ /g diff --git a/tools/sed-structs b/tools/sed-structs new file mode 100644 index 0000000..1b7afdf --- /dev/null +++ b/tools/sed-structs @@ -0,0 +1,14 @@ + +s/^\s*typedef\s+struct\s+(\w+)\s+(\w+)\s*;.*$/typedef struct \1 \2;/ +t finish +/^\s*typedef\s+struct.*[^;].*/ ! b +h +:loop +n +/^\s*\}/ ! b loop +s/^\s*\}\s*(\w+)\s*;.*$/\1;/ +H;x +s/\n/ /g +:finish +s/ {2,}/ /g +p -- cgit v1.1-2-g2b99