diff options
author | Jérémy Zurcher <jeremy@asynk.ch> | 2011-04-20 14:52:36 +0200 |
---|---|---|
committer | Jérémy Zurcher <jeremy@asynk.ch> | 2011-04-20 14:52:36 +0200 |
commit | 192943dadbf35084fa7c6b2e8df81be166eaacb5 (patch) | |
tree | 81f51d8ce96e43fdaec4bb43bc73cb9eac33e870 /tools | |
parent | 73c5fd7139746254cdea89d17ddce4c243bb10aa (diff) | |
download | ffi-efl-192943dadbf35084fa7c6b2e8df81be166eaacb5.zip ffi-efl-192943dadbf35084fa7c6b2e8df81be166eaacb5.tar.gz |
genruby, add typedef for enum pointers if needed
Diffstat (limited to 'tools')
-rwxr-xr-x | tools/genruby.rb | 19 |
1 files changed, 5 insertions, 14 deletions
diff --git a/tools/genruby.rb b/tools/genruby.rb index 763f119..002eb24 100755 --- a/tools/genruby.rb +++ b/tools/genruby.rb @@ -165,6 +165,9 @@ def gen_enums path, indent args = values.split(',').collect { |cst| ':'+cst.strip.downcase }.join(', ').gsub(/=/,',').gsub(/ ,/,',') r << indent+"# #{typedef} {...} #{typename};" r << wrap_text( indent+"enum :#{v}, [ #{args} ]", 150, indent+' '*4 ) + r << [ typename+' *', indent+"typedef :pointer, :#{v}_p" ] + r << [ typename+' **', indent+"typedef :pointer, :#{v}_pp" ] + r << [ typename+' ***', indent+"typedef :pointer, :#{v}_ppp" ] end r end @@ -252,21 +255,9 @@ end.each do |lib, output, module_name, module_base, enums, typedefs, callbacks, f << HEADER.sub(/MNAME/,module_name).sub(/MBASE/,module_base) f << "#{INDENT}#\n#{INDENT}ffi_lib '#{lib}'" f << "\n#{INDENT}#\n#{INDENT}# ENUMS" - f << "\n"+enums.join("\n") unless enums.empty? + f << "\n"+enums.collect { |t| ( t.is_a?(Array) ? ( TYPES_USAGE[t[0]] ? t[1] : nil ) : t ) }.compact.join("\n") unless enums.empty? f << "\n#{INDENT}#\n#{INDENT}# TYPEDEFS" - unless typedefs.empty? - f << "\n"+typedefs.collect { |t| - if t.is_a? Array - if TYPES_USAGE[t[0]] - t[1] - else - nil - end - else - t - end - }.compact.join("\n") - end + f << "\n"+typedefs.collect { |t| ( t.is_a?(Array) ? ( TYPES_USAGE[t[0]] ? t[1] : nil ) : t ) }.compact.join("\n") unless typedefs.empty? f << "\n#{INDENT}#\n#{INDENT}# CALLBACKS" f << "\n"+callbacks.join("\n") unless callbacks.empty? f << "\n#{INDENT}#\n#{INDENT}# FUNCTIONS" |