FFI::Generator::Callback

Public Class Methods

new(params = { }) click to toggle source
    # File lib/generator/function.rb, line 37
37:       def initialize(params = { })
38:         super(params)
39:         @inline = true if params[:inline] == true
40:       end

Public Instance Methods

to_s() click to toggle source
    # File lib/generator/function.rb, line 41
41:       def to_s
42:         unless @inline
43:           @indent_str + "callback(:#{@symname}, [ #{get_params.join(', ')} ], #{get_rtype})"
44:         else
45:           @indent_str + "callback([ #{get_params.join(', ')} ], #{get_rtype})"
46:         end
47:       end

Private Instance Methods

get_params() click to toggle source
    # File lib/generator/function.rb, line 49
49:       def get_params
50:         params = (@node / './attributelist/parmlist/parm')
51:         declaration = decl
52:         unless params.empty?
53:           result = params.inject([]) do |array, node|
54:             declaration.gsub!(/#{Regexp.escape(Type.new(:node => node, :typedefs => @typedefs).get_attr('type'))}/, '')
55:             array << Argument.new(:node => node, :typedefs => @typedefs).to_s
56:           end
57:         else
58:           result = @full_decl.scan(/p.f\((.*)\)/).flatten[0].split(',').inject([]) do |array, type|
59:             array << (type == 'void' ? '' : Type.new(:declaration => type, :typedefs => @typedefs).to_s)
60:           end
61:         end
62:         @full_decl = declaration + type
63:         result
64:       end
get_rtype() click to toggle source
    # File lib/generator/function.rb, line 65
65:       def get_rtype
66:         Type.new(:declaration => @full_decl.scan(/f\([a-zA-z0-9,.\s\(\)]*\)\.([a-zA-Z0-9\.,\s\(\)]+)/).flatten[0], :typedefs => @typedefs).to_s
67:       end

Disabled; run with --debug to generate this.

[Validate]

Generated with the Darkfish Rdoc Generator 1.1.6.