diff options
author | Jérémy Zurcher <jeremy@asynk.ch> | 2012-02-25 21:46:19 +0100 |
---|---|---|
committer | Jérémy Zurcher <jeremy@asynk.ch> | 2012-02-25 21:46:19 +0100 |
commit | eb03438c8f94a57cf8b1f80fb87949bcfc68884f (patch) | |
tree | c6d6332d756290f35a519c45a21a2338bf12f11e /tools | |
parent | db1aef572c6f6772bc39a3d02a362ad60a0885f1 (diff) | |
download | ffi-efl-eb03438c8f94a57cf8b1f80fb87949bcfc68884f.zip ffi-efl-eb03438c8f94a57cf8b1f80fb87949bcfc68884f.tar.gz |
tools/genruby.rb: do not output what is not necessary
Diffstat (limited to 'tools')
-rwxr-xr-x | tools/genruby.rb | 30 |
1 files changed, 20 insertions, 10 deletions
diff --git a/tools/genruby.rb b/tools/genruby.rb index 8bb4513..7347a1d 100755 --- a/tools/genruby.rb +++ b/tools/genruby.rb @@ -354,21 +354,31 @@ libs.each do |lib| reqs = ( lib[:requires].nil? ? '' : lib[:requires].inject('') {|s,e| s+="\nrequire '#{e}'"}) f << HEADER.gsub(/MNAME/,lib[:modname]).sub(/MY_FCT_PREFIX/,lib[:prefix]).sub(/REQUIRES/,reqs) f << "#{INDENT}#\n#{INDENT}ffi_lib '#{lib[:lib]}'" - f << "\n#{INDENT}#\n#{INDENT}# ENUMS" print "enums, " - f << "\n"+lib[:enums].collect { |t| ( t.is_a?(Array) ? t[1] : t ) }.compact.join("\n") unless lib[:enums].empty? - f << "\n#{INDENT}#\n#{INDENT}# TYPEDEFS" + if not lib[:enums].empty? + f << "\n#{INDENT}#\n#{INDENT}# ENUMS" + f << "\n"+lib[:enums].collect { |t| ( t.is_a?(Array) ? t[1] : t ) }.compact.join("\n") + end print "typedefs, " - f << "\n"+lib[:typedefs].collect { |t| ( t.is_a?(Array) ? t[1] : t ) }.compact.join("\n") unless lib[:typedefs].empty? - f << "\n#{INDENT}#\n#{INDENT}# CALLBACKS" + if not lib[:typedefs].empty? + f << "\n#{INDENT}#\n#{INDENT}# TYPEDEFS" + f << "\n"+lib[:typedefs].collect { |t| ( t.is_a?(Array) ? t[1] : t ) }.compact.join("\n") + end print "callbacks, " - f << "\n"+lib[:callbacks].join("\n") unless lib[:callbacks].empty? - f << "\n#{INDENT}#\n#{INDENT}# VARIABLES" + if not lib[:callbacks].empty? + f << "\n#{INDENT}#\n#{INDENT}# CALLBACKS" + f << "\n"+lib[:callbacks].join("\n") + end print "variables, " - f << "\n"+lib[:variables].join("\n") unless lib[:variables].empty? - f << "\n#{INDENT}#\n#{INDENT}# FUNCTIONS" + if not lib[:variables].empty? + f << "\n#{INDENT}#\n#{INDENT}# VARIABLES" + f << "\n"+lib[:variables].join("\n") + end puts "functions." - f << "\n"+lib[:functions].join("\n") unless lib[:functions].empty? + if not lib[:functions].empty? + f << "\n#{INDENT}#\n#{INDENT}# FUNCTIONS" + f << "\n"+lib[:functions].join("\n") + end f << "\n#{INDENT}#\n#{INDENT}attach_fcts fcts\n#{INDENT}#\n" f << FOOTER end |