Class: Rubber::C_Float
Instance Attribute Summary
#child_names, #source_file, #source_line
Instance Method Summary
collapse
#cname, #register_children
Instance Method Details
#code(io) ⇒ Object
5
6
|
# File 'lib/rubber/codegen/float.rb', line 5
def code(io)
end
|
#declare(io) ⇒ Object
7
8
9
|
# File 'lib/rubber/codegen/float.rb', line 7
def declare(io)
end
|
#default_cname ⇒ Object
11
12
13
|
# File 'lib/rubber/codegen/float.rb', line 11
def default_cname
end
|
#doc_rd(io) ⇒ Object
14
15
16
17
|
# File 'lib/rubber/codegen/float.rb', line 14
def doc_rd(io)
depth = (fullname.gsub(/[^:]/,'').size >> 1)
io.puts "=#{'=' * depth} #{fullname}"
end
|
#fullname ⇒ Object
21
22
23
24
25
26
27
|
# File 'lib/rubber/codegen/float.rb', line 21
def fullname()
if parent and parent.respond_to?(:fullname)
"#{parent.fullname}::#{name}"
else
name
end
end
|
#get_root ⇒ Object
18
|
# File 'lib/rubber/codegen/float.rb', line 18
def get_root(); is_root? ? self : parent.get_root; end
|
#is_root? ⇒ Boolean
18
19
20
|
# File 'lib/rubber/codegen/float.rb', line 18
def is_root?()
not parent.respond_to?(:fullname)
end
|
#register(io, already_defined = false) ⇒ Object
32
33
34
35
36
37
38
|
# File 'lib/rubber/codegen/float.rb', line 32
def register(io, already_defined=false)
if parent
io.puts " rb_define_const(#{parent.cname}, #{name.inspect}, rb_float_new(#{number}));"
else
raise "No parent for string constant #{name}"
end
end
|