summaryrefslogtreecommitdiffstats
path: root/tools/sed-callbacks
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-callbacks
parent3a9ae6b9d5f30898ec06819897145efc475a5625 (diff)
downloadffi-efl-961dd6b19e860f3a47c4435f359f7c372cb03084.zip
ffi-efl-961dd6b19e860f3a47c4435f359f7c372cb03084.tar.gz
add comment to sed scripts, fix sed-enum
Diffstat (limited to 'tools/sed-callbacks')
-rw-r--r--tools/sed-callbacks11
1 files changed, 10 insertions, 1 deletions
diff --git a/tools/sed-callbacks b/tools/sed-callbacks
index 4a2e27f..42051ba 100644
--- a/tools/sed-callbacks
+++ b/tools/sed-callbacks
@@ -1,11 +1,20 @@
+# drop if don't start with typedef
+/^\s*typedef/ ! b
+# one line typedef xxx (...); we are done
s/^\s*typedef\s+(.*)(\(\*?\w+\))?\s*(\(.*\));.*$/typedef \1 \2 \3;/
t finish
+# if ends with ,
s/^\s*typedef\s+(.*)(\(\*?\w+\))?\s*(\(.*,)/typedef \1 \2 \3/
+# drop if substitution fail, copy pattern to hold space
T;h
:loop;n
+# append each parameters
/,$/ { H; b loop }
-/;$/ { H;x}
+# when ; reached, append a swap hold space to pattern space
+/;.*$/ { H;x}
:finish
+# drop \n
s/\n//g
+# replace multi spaces with one
s/ {2,}/ /g
p