Class: Typedef

Inherits:
BDNode show all
Defined in:
lib/tecsgen/core/generate.rb,
lib/tecsgen/core/syntaxobj.rb

Class Method Summary collapse

Instance Method Summary collapse

Methods inherited from BDNode

#get_owner, #set_owner

Methods inherited from Node

#cdl_error, #cdl_error2, #cdl_error3, #cdl_info, #cdl_info2, #cdl_warning, #cdl_warning2, #get_locale, #locale_str, #set_locale

Constructor Details

#initialize(type_spec_qual_list, decl) ⇒ Typedef

Returns a new instance of Typedef.



334
335
336
337
338
339
340
341
# File 'lib/tecsgen/core/syntaxobj.rb', line 334

def initialize(type_spec_qual_list, decl)
  super()
  decl.set_type(type_spec_qual_list)
  @declarator = decl
  decl.set_owner self # Decl(Typedef)

  Namespace.new_typedef(self)
end

Class Method Details

.new_decl_list(type_spec_qual_list, decl_list) ⇒ Object

@declarator

Decl



328
329
330
331
332
# File 'lib/tecsgen/core/syntaxobj.rb', line 328

def self.new_decl_list(type_spec_qual_list, decl_list)
  decl_list.each {|decl|
    Typedef.new(type_spec_qual_list, decl)
  }
end

Instance Method Details

#gen_gh(f) ⇒ Object



945
946
947
948
949
950
951
952
953
# File 'lib/tecsgen/core/generate.rb', line 945

def gen_gh(f)
#    print "Typedef.gen_gh\n"
#    show_tree 1

  f.printf("typedef %-14s %s%s;\n",
    @declarator.get_type.get_type_str,
    @declarator.get_name,
    @declarator.get_type.get_type_str_post)
end

#get_declaratorObject



347
348
349
# File 'lib/tecsgen/core/syntaxobj.rb', line 347

def get_declarator
  @declarator
end

#get_nameObject



343
344
345
# File 'lib/tecsgen/core/syntaxobj.rb', line 343

def get_name
  @declarator.get_name
end

#show_tree(indent) ⇒ Object



351
352
353
354
355
# File 'lib/tecsgen/core/syntaxobj.rb', line 351

def show_tree(indent)
  indent.times { print "  " }
  puts "Typedef: #{locale_str}"
  @declarator.show_tree(indent + 1)
end