Class: CGenerator::RubyFunction

Inherits:
Function show all
Defined in:
lib/cgen/cgen.rb

Overview

class MethodPrototype

Instance Attribute Summary

Attributes inherited from Accumulator

#name, #parent

Instance Method Summary collapse

Methods inherited from Function

#empty?, #return_type, #scope

Methods inherited from Template

accumulator

Methods inherited from Accumulator

#accept?, #add, #add_one, #add_one_really, #inspect, #inspect_one, #output, #output_one, #separator, #to_s

Constructor Details

#initialize(name, parent) ⇒ RubyFunction

Returns a new instance of RubyFunction.



1882
1883
1884
1885
1886
1887
# File 'lib/cgen/cgen.rb', line 1882

def initialize name, parent
  super   
  return_type 'VALUE'
  arguments 'self'
  returns 'Qnil'
end

Instance Method Details

#arguments(*args, &bl) ⇒ Object



1903
1904
1905
1906
# File 'lib/cgen/cgen.rb', line 1903

def arguments(*args, &bl)
  prototype.arguments(*args, &bl)
  register_args :c_name => @name, :argc => prototype.argc - 1
end

#c_array_args(*args, &bl) ⇒ Object



1893
1894
1895
1896
# File 'lib/cgen/cgen.rb', line 1893

def c_array_args(*args, &bl)
  prototype.c_array_args(*args, &bl)
  register_args :c_name => @name, :argc => -1  # code used by Ruby C API
end

#prototypeObject



1889
1890
1891
# File 'lib/cgen/cgen.rb', line 1889

def prototype
  @prototype ||= MethodPrototype.new(name, self)
end

#rb_array_args(*args, &bl) ⇒ Object



1898
1899
1900
1901
# File 'lib/cgen/cgen.rb', line 1898

def rb_array_args(*args, &bl)
  prototype.rb_array_args(*args, &bl)
  register_args :c_name => @name, :argc => -2  # code used by Ruby C API
end