summaryrefslogtreecommitdiffstats
path: root/tools/sed-types
diff options
context:
space:
mode:
authorJérémy Zurcher <jeremy@asynk.ch>2011-10-21 11:18:11 +0200
committerJérémy Zurcher <jeremy@asynk.ch>2011-10-21 11:18:11 +0200
commit961dd6b19e860f3a47c4435f359f7c372cb03084 (patch)
treeeb744dedc67c8acf6d5e135c115b7428e8b49da6 /tools/sed-types
parent3a9ae6b9d5f30898ec06819897145efc475a5625 (diff)
downloadffi-efl-961dd6b19e860f3a47c4435f359f7c372cb03084.zip
ffi-efl-961dd6b19e860f3a47c4435f359f7c372cb03084.tar.gz
add comment to sed scripts, fix sed-enum
Diffstat (limited to 'tools/sed-types')
-rw-r--r--tools/sed-types18
1 files changed, 13 insertions, 5 deletions
diff --git a/tools/sed-types b/tools/sed-types
index 7ac79a2..52a7252 100644
--- a/tools/sed-types
+++ b/tools/sed-types
@@ -1,14 +1,22 @@
+# drop if don't start with typedef
+/^\s*typedef/ ! b
+# read one line typedef (struct)? (word*)? (*)? word;
s/^\s*typedef\s+(struct\s+)?((\w+\**\s+)*)(\w+)\s*;.*$/typedef \1 \2 \4;/
t finish
+# read multi line
s/^\s*typedef\s+(struct.*[^;].*)/typedef \1/
-T
-h
-:loop
-n
+# leave if substitution fails, or copy pattern to hold space
+T; h
+:loop; n
+# read till } is reached
/^\s*\}/ ! b loop
+# take care of the last } word;
s/^\s*\}\s*(\w+)\s*;.*$/\1;/
+# append pattern to hold space, then swap
H;x
-s/\n/ /g
:finish
+# remove \n
+s/\n/ /g
+# replace multi spaces with one ...
s/ {2,}/ /g
p