summaryrefslogtreecommitdiffstats
path: root/tools/sed-enums
diff options
context:
space:
mode:
authorJérémy Zurcher <jeremy@asynk.ch>2011-04-16 09:57:18 +0200
committerJérémy Zurcher <jeremy@asynk.ch>2011-04-16 09:57:18 +0200
commitb8fb8382d1d472199970241900a30384a71b8060 (patch)
tree1cb6b415b98020922bf23f96c1f2967c6cc1eca0 /tools/sed-enums
parent4b845a0950d2e17fa18c36ca3c399b7ca3a70fac (diff)
downloadffi-efl-b8fb8382d1d472199970241900a30384a71b8060.zip
ffi-efl-b8fb8382d1d472199970241900a30384a71b8060.tar.gz
extract-api.sh uses external sed scripts
Diffstat (limited to 'tools/sed-enums')
-rw-r--r--tools/sed-enums24
1 files changed, 24 insertions, 0 deletions
diff --git a/tools/sed-enums b/tools/sed-enums
new file mode 100644
index 0000000..13ce112
--- /dev/null
+++ b/tools/sed-enums
@@ -0,0 +1,24 @@
+s/.*(enum\s+[a-zA-Z0-9_]+).*$/typedef \1 { /
+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
+H;x
+s/\n//g
+s/ {2,}/ /g
+s/, }/ }/p