Method: CShadow::CShadowClassMethods#shadow_struct

Defined in:
lib/cgen/cshadow.rb

#shadow_structObject

Return the object for managing the shadow struct.



598
599
600
601
602
603
604
605
606
607
608
609
610
611
612
613
614
615
616
617
618
619
620
621
# File 'lib/cgen/cshadow.rb', line 598

def shadow_struct
  unless defined?(@shadow_struct) and @shadow_struct
    raise if @inherited_shadow_struct
    sf = shadow_library_source_file
    ssn = shadow_struct_name
    @shadow_struct = sf.declare_extern_struct(ssn)
    if self == base_class
      @shadow_struct.declare :self => "VALUE self"
    else
      sss = superclass.shadow_struct
      shadow_struct.inherit\
        sss.inherit!,
        "/* #{superclass.shadow_struct_name} members */",
        sss.declare!, " "

      unless superclass.shadow_library_source_file ==
             shadow_library_source_file
        shadow_library_include_file.include(
          superclass.shadow_library_include_file)
      end
    end
  end
  @shadow_struct
end