From: Enlightenment C. <no...@cv...> - 2006-08-31 21:55:07
|
Enlightenment CVS committal Author : nerochiaro Project : e17 Module : proto Dir : e17/proto/ruby-efl/src Modified Files: autobindings.rb Log Message: fixed bug when parsing a function prototype with no parameters at all. =================================================================== RCS file: /cvs/e/e17/proto/ruby-efl/src/autobindings.rb,v retrieving revision 1.1 retrieving revision 1.2 diff -u -3 -r1.1 -r1.2 --- autobindings.rb 11 Aug 2006 11:47:06 -0000 1.1 +++ autobindings.rb 31 Aug 2006 21:55:04 -0000 1.2 @@ -116,7 +116,7 @@ @types = [] @synon = {} @decls = [] - @structs = {} + @structs = [] @protos = {} tree.entities.each { |e| @@ -177,6 +177,7 @@ # -- STRUCTURE (todo: not yet implemented) elsif C::Struct === e.type then @types << 'struct ' + e.type.name + @structs << [e.type.name, []] # st = (@structs[e.type.name] = []) # e.type.members.each { |mem| # #todo: nested structures, initializers, etc @@ -249,12 +250,13 @@ ftype = dec.indirect_type.type f.ret = node.type.to_s # return type without any pointer qualifier f.ret << FunctionPtr.pointers(ftype.type) - + + f.params = [] ftype.params.each { |par| p = FunctionPtr.parse(par) f.params << (( p.nil? ) ? par.type.to_s : p) - } + } unless ftype.params.nil? return f end @@ -355,6 +357,9 @@ } enumpool << "\tend\n" + struct_aliases = '' + @structs.each { |struct| struct_aliases << "\ttypealias '#{struct}*', 'void*'\n" } + base_class = nil classes = "" @@ -411,6 +416,10 @@ # #{enum_aliases} + # Type aliases (from structures) + # +#{struct_aliases} + # Function declarations # #{declarations} @@ -453,7 +462,7 @@ o += title "#{@synon.length} Type aliases:" @synon.each { |syn,syn_to| - o += "#{syn} => #{syn_to}\n" + o += "#{syn} => #{syn_to}\n" } o += "\n" @@ -467,21 +476,22 @@ o += title "#{@enums.length} Enumerations:" @enums.each { |name,mem| - o += name + "{\n" - mem.each { |k,v| - o += "\t\t#{k} => #{v}\n" - } - o += "}\n" + o += name + "{\n" + mem.each { |k,v| + o += "\t\t#{k} => #{v}\n" + } + o += "}\n" } o += "\n" o += title "#{@structs.length} Structures:" @structs.each { |name, str| - o += name + '{ ' - str.each { |mem| - o += "\t\t#{mem[0]} => #{mem[1]}\n" - } - o += "}\n" + o += name + "\n" + #~ o += name + '{ ' + #~ str.each { |mem| + #~ o += "\t\t#{mem[0]} => #{mem[1]}\n" + #~ } + #~ o += "}\n" } o += "\n" @@ -490,14 +500,14 @@ def classgraph(k = nil, lev = 0) if k.nil? - k = @config[:classes][0] - puts title('Class tree') + k = @config[:classes][0] + puts title('Class tree') end puts "#{''.pad(lev-1,' ')} #{k[:name]} " + ((!k[:wraps].nil?) ? "(#{k[:wraps]})" : '') @config[:classes].each { |sub| - classgraph(sub, lev+1) if (sub[:child_of] == k[:name]) + classgraph(sub, lev+1) if (sub[:child_of] == k[:name]) } end |