lib/sfrp/mono/set.rb
def gen_main_func(dest_set)
        dest_set << L.function('main', 'int') do |f|
          f << L.stmt('int c = 0, l = 1')
          used_nodes.each { |node| node.gen_node_var_declaration(self, f) }
          @init_func_strs.each do |func_str|
            f << L.stmt(func(func_str).low_call_exp([]))
          end
          used_nodes.each { |node| node.gen_initialize_stmt(self, f) }
          f << L.while('1') do |wh|
            @type_h.values.each { |type| type.gen_mark_cleanup_stmt(self, wh) }
            used_nodes.each { |node| node.gen_node_var_mark_stmt(self, wh) }
            used_nodes.each { |node| node.gen_evaluate_stmt(self, wh) }
            wh << L.stmt('c ^= 1, l ^= 1')
          end
          f << L.stmt('return 0')
        end
      end
# Generate the main-function.
Generate the main-function.
Generate the main - function .
def gen_main_func(dest_set)
        dest_set << L.function('main', 'int') do |f|
          f << L.stmt('int c = 0, l = 1')
          used_nodes.each { |node| node.gen_node_var_declaration(self, f) }
          @init_func_strs.each do |func_str|
            f << L.stmt(func(func_str).low_call_exp([]))
          end
          used_nodes.each { |node| node.gen_initialize_stmt(self, f) }
          f << L.while('1') do |wh|
            @type_h.values.each { |type| type.gen_mark_cleanup_stmt(self, wh) }
            used_nodes.each { |node| node.gen_node_var_mark_stmt(self, wh) }
            used_nodes.each { |node| node.gen_evaluate_stmt(self, wh) }
            wh << L.stmt('c ^= 1, l ^= 1')
          end
          f << L.stmt('return 0')
        end
      end
def gen_main_func ( dest_set ) dest_set << L . function ( 'main' , 'int' ) do | f | f << L . stmt ( 'int c = 0, l = 1' ) used_nodes . each { | node | node . gen_node_var_declaration ( self , f ) } @init_func_strs . each do | func_str | f << L . stmt ( func ( func_str ) . low_call_exp ( [ ] ) ) end used_nodes . each { | node | node . gen_initialize_stmt ( self , f ) } f << L . while ( '1' ) do | wh | @type_h . values . each { | type | type . gen_mark_cleanup_stmt ( self , wh ) } used_nodes . each { | node | node . gen_node_var_mark_stmt ( self , wh ) } used_nodes . each { | node | node . gen_evaluate_stmt ( self , wh ) } wh << L . stmt ( 'c ^= 1, l ^= 1' ) end f << L . stmt ( 'return 0' ) end end
Generate the main-function.
Generate the main - function .
dest_set