class ClassHDL::DefStruct
Attributes
pre_type[RW]
sdlm[RW]
Public Class Methods
new(sdlm,block)
click to toggle source
# File lib/tdl/class_hdl/hdl_struct.rb, line 52 def initialize(sdlm,block) @sdlm = sdlm @block = block end
Public Instance Methods
-(name)
click to toggle source
# File lib/tdl/class_hdl/hdl_struct.rb, line 57 def -(name) all_var_collect = ClassHDL.Struct(name,@sdlm,@pre_type,&@block) ## 给sdl_module 定义引用 if @sdlm.respond_to? name raise TdlError.new(" Can't define struct in module<#{@sdlm.module_name}>,because #{name} be uesed") end smeta = StructMeta.new(name,@sdlm,all_var_collect) @sdlm.define_singleton_method(name) do smeta end ## _vc = @sdlm.instance_variable_get("@_struct_meta_collect_") || [] # @sdlm.instance_variable_set("@_struct_meta_collect_",[]) unless _vc _vc.push smeta @sdlm.instance_variable_set("@_struct_meta_collect_",_vc) return nil # all_collect end
method_missing(method,*args,&block)
click to toggle source
# File lib/tdl/class_hdl/hdl_struct.rb, line 91 def method_missing(method,*args,&block) @block = block self-(method) end
packed(&block)
click to toggle source
# File lib/tdl/class_hdl/hdl_struct.rb, line 85 def packed(&block) @pre_type = 'packed' @block = block self end
union(&block)
click to toggle source
# File lib/tdl/class_hdl/hdl_struct.rb, line 79 def union(&block) @pre_type = 'union' @block = block self end