diff options
author | Jérémy Zurcher <jeremy.zurcher@heraeus.com> | 2011-04-19 10:16:41 +0200 |
---|---|---|
committer | Jérémy Zurcher <jeremy.zurcher@heraeus.com> | 2011-04-19 10:16:41 +0200 |
commit | ede482ecb7e7d8199adc9ccb2e3ba9ed46aa33f8 (patch) | |
tree | c99a80752aa3c6b9cf78b9bc8c9b3c9f112be76d /tools/genruby.rb | |
parent | e3c88dd4103413db40df39cb2e315ee0d8416260 (diff) | |
download | ffi-efl-ede482ecb7e7d8199adc9ccb2e3ba9ed46aa33f8.zip ffi-efl-ede482ecb7e7d8199adc9ccb2e3ba9ed46aa33f8.tar.gz |
handle enum constants values
Diffstat (limited to 'tools/genruby.rb')
-rwxr-xr-x | tools/genruby.rb | 4 |
1 files changed, 2 insertions, 2 deletions
diff --git a/tools/genruby.rb b/tools/genruby.rb index 442c59b..7432ffd 100755 --- a/tools/genruby.rb +++ b/tools/genruby.rb @@ -140,7 +140,7 @@ def gen_enums path, indent r = '' open(path+'-enums','r').readlines.each do |l| l.strip! - if not l=~/(typedef enum(?: \w+)?) {([A-Z0-9_ ,]+)} (\w+);/ + if not l=~/(typedef enum(?: \w+)?) {([A-Z0-9_ (\s*=\s*-?[\d+]),]+)} (\w+);/ r << indent+"# #{l}\n#{indent}# FIXME\n" next end @@ -149,7 +149,7 @@ def gen_enums path, indent typename = $3 set_type typename, typename # args = values.split(',').collect { |cst| ':'+cst.strip.downcase }.join ', ' - args = values.split(',').collect { |cst| ':'+cst.strip.downcase.sub(typename.downcase+'_','') }.join ', ' + args = values.split(',').collect { |cst| ':'+cst.strip.downcase.sub(typename.downcase+'_','') }.join(', ').gsub(/=/,',') r << indent+"# #{typedef} {...} #{typename};\n" r << wrap_text( indent+"enum :#{typename.downcase}, [ #{args} ]", 150, indent+' '*4 )+"\n" end |