lib/sfrp/mono/function.rb
def gen(src_set, dest_set)
        return if @ffi_str
        env = Environment.new
        type = src_set.type(@ftype.return_type_str)
        dest_set << L.function(@str, type.low_type_str) do |f|
          @param_strs.zip(@ftype.param_type_strs).map do |p_str, t_str|
            f.append_param(src_set.type(t_str).low_type_str, p_str)
          end
          stmt = L.stmt("return #{@exp.to_low(src_set, env)}")
          env.each_declared_vars do |var_str, type_str|
            f << L.stmt("#{src_set.type(type_str).low_type_str} #{var_str}")
          end
          f << stmt
        end
      end
# Generate function in C for this function.
Generate function in C for this function.
Generate function in C for this function .
def gen(src_set, dest_set)
        return if @ffi_str
        env = Environment.new
        type = src_set.type(@ftype.return_type_str)
        dest_set << L.function(@str, type.low_type_str) do |f|
          @param_strs.zip(@ftype.param_type_strs).map do |p_str, t_str|
            f.append_param(src_set.type(t_str).low_type_str, p_str)
          end
          stmt = L.stmt("return #{@exp.to_low(src_set, env)}")
          env.each_declared_vars do |var_str, type_str|
            f << L.stmt("#{src_set.type(type_str).low_type_str} #{var_str}")
          end
          f << stmt
        end
      end
def gen ( src_set , dest_set ) return if @ffi_str env = Environment . new type = src_set . type ( @ftype . return_type_str ) dest_set << L . function ( @str , type . low_type_str ) do | f | @param_strs . zip ( @ftype . param_type_strs ) . map do | p_str , t_str | f . append_param ( src_set . type ( t_str ) . low_type_str , p_str ) end stmt = L . stmt ( "return #{@exp.to_low(src_set, env)}" ) env . each_declared_vars do | var_str , type_str | f << L . stmt ( "#{src_set.type(type_str).low_type_str} #{var_str}" ) end f << stmt end end
Generate function in C for this function.
Generate function in C for this function .
src_set
dest_set