class CompileToCHeader
Attributes
gettable[RW]
settable[RW]
Public Class Methods
rewrite(*args)
click to toggle source
# File src/compile/c/compile_to_c_header.rb, line 6 def self.rewrite(*args) self.new.rewrite(*args) end
Public Instance Methods
rewrite(formulae, c_name_for_worksheet_name, output)
click to toggle source
# File src/compile/c/compile_to_c_header.rb, line 10 def rewrite(formulae, c_name_for_worksheet_name, output) self.gettable ||= lambda { |ref| true } self.settable ||= lambda { |ref| false } formulae.each do |ref, ast| begin static_or_not = (gettable.call(ref) || settable.call(ref)) ? "" : "static " worksheet = c_name_for_worksheet_name[ref.first.to_s] || ref.first.to_s ref = ref.last.downcase name = worksheet.length > 0 ? "#{worksheet}_#{ref}" : ref output.puts "#{static_or_not}ExcelValue #{name}();" rescue Exception => e puts "Exception at #{ref} #{ast}" raise end end end