Class: ClassHDL::HDLFunctionIvoke

Inherits:
Object
  • Object
show all
Includes:
AssignDefOpertor
Defined in:
lib/tdl/class_hdl/hdl_function.rb

Constant Summary

Constants included from AssignDefOpertor

AssignDefOpertor::OP_SYMBOLS

Instance Method Summary collapse

Methods included from AssignDefOpertor

curr_assign_block, curr_assign_block=, curr_assign_block_stack, curr_opertor_stack, included, init_op_methods, use_new_yield_opertors, use_old_cond_opertors, with_new_assign_block, with_new_opertor, with_normal_opertor, with_rollback_opertors

Constructor Details

#initialize(func_inst, *fargvs) ⇒ HDLFunctionIvoke

Returns a new instance of HDLFunctionIvoke.



6
7
8
9
10
# File 'lib/tdl/class_hdl/hdl_function.rb', line 6

def initialize(func_inst,*fargvs)
    @fargvs = fargvs
    @func_inst = func_inst
    inst_strcut_method()
end

Instance Method Details

#inst_strcut_methodObject

例化 struct 方法调用



12
13
14
15
16
17
18
19
20
# File 'lib/tdl/class_hdl/hdl_function.rb', line 12

def inst_strcut_method
    if @func_inst.return_type.is_a? StructMeta
        @func_inst.return_type.struct_slots.each do |e|
            self.define_singleton_method(e.name) do 
                TdlSpace::ArrayChain.new("#{@func_inst.name}.#{e.name}".to_nq)
            end
        end
    end
end

#ivokedObject



22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
# File 'lib/tdl/class_hdl/hdl_function.rb', line 22

def ivoked
    str = @fargvs.map do |e| 
        if e.is_a? OpertorChain
            e.slaver = true 
        end
        
        if e.instance_of? String
            "\"#{e}\""
        else 
            e.to_s 
        end
    end.join(",")

    return "#{@func_inst.name}(#{str})".to_nq
end

#to_sObject

end



42
43
44
45
46
47
48
# File 'lib/tdl/class_hdl/hdl_function.rb', line 42

def to_s 
    if @func_inst.open_ivoke
        ivoked
    else 
        @func_inst.name.to_s.to_nq
    end
end