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.



1905
1906
1907
1908
1909
1910
# File 'lib/cgen/cgen.rb', line 1905

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

Instance Method Details

#arguments(*args, &bl) ⇒ Object



1926
1927
1928
1929
# File 'lib/cgen/cgen.rb', line 1926

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

#c_array_args(*args, &bl) ⇒ Object



1916
1917
1918
1919
# File 'lib/cgen/cgen.rb', line 1916

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



1912
1913
1914
# File 'lib/cgen/cgen.rb', line 1912

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

#rb_array_args(*args, &bl) ⇒ Object



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

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