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.



1913
1914
1915
1916
1917
1918
# File 'lib/cgen/cgen.rb', line 1913

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

Instance Method Details

#arguments(*args, &bl) ⇒ Object



1934
1935
1936
1937
# File 'lib/cgen/cgen.rb', line 1934

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

#c_array_args(*args, &bl) ⇒ Object



1924
1925
1926
1927
# File 'lib/cgen/cgen.rb', line 1924

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



1920
1921
1922
# File 'lib/cgen/cgen.rb', line 1920

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

#rb_array_args(*args, &bl) ⇒ Object



1929
1930
1931
1932
# File 'lib/cgen/cgen.rb', line 1929

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