summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-rwxr-xr-xtools/extract-api.sh1
-rw-r--r--tools/sed-enums21
-rw-r--r--tools/sed-structs14
3 files changed, 22 insertions, 14 deletions
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