class SFRP::Low::Set
Attributes
functions[R]
includes[R]
macros[R]
meta[R]
structs[R]
typedefs[R]
Public Class Methods
new(&block)
click to toggle source
# File lib/sfrp/low/set.rb, line 9 def initialize(&block) @typedefs = [] @structs = [] @functions = [] @macros = [] @includes = [] block.call(self) if block end
Public Instance Methods
<<(element)
click to toggle source
# File lib/sfrp/low/set.rb, line 24 def <<(element) case element when Typedef @typedefs << element when Structure @structs << element when Function @functions << element when Macro @macros << element when Include @includes << element else raise end end
to_output()
click to toggle source
# File lib/sfrp/low/set.rb, line 18 def to_output Output::Set.new do |dest_set| dest_set.create_file('main', 'c', main_file_content) end end
Private Instance Methods
header_file_content()
click to toggle source
# File lib/sfrp/low/set.rb, line 56 def header_file_content elements = [] elements.join("\n") end
main_file_content()
click to toggle source
# File lib/sfrp/low/set.rb, line 43 def main_file_content elements = [] @includes.each { |x| elements << x.to_s } @macros.each { |x| elements << x.to_s } @typedefs.each { |x| elements << x.to_s } @structs.each { |x| elements << x.to_s } @functions.each do |x| elements << x.pretty_code_prototype end @functions.each { |x| elements << x.to_s } elements.join("\n") end