Class: Factory
- Inherits:
-
BDNode
show all
- Defined in:
- lib/tecsgen/core/componentobj.rb
Constant Summary
collapse
- @@f_celltype =
- @f_celltype
-
bool : true: celltype factory, false: cell factory
false
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(name, file_name, format, arg_list) ⇒ Factory
Returns a new instance of Factory.
6586
6587
6588
6589
6590
6591
6592
6593
6594
6595
6596
6597
6598
6599
6600
6601
6602
6603
6604
6605
6606
6607
6608
6609
6610
6611
6612
6613
6614
6615
6616
6617
6618
6619
6620
|
# File 'lib/tecsgen/core/componentobj.rb', line 6586
def initialize(name, file_name, format, arg_list)
super()
@f_celltype = @@f_celltype
case name
when :write
@name = name
@file_name = file_name.eval_const(nil).val if !@file_name.instance_of?(String)
cdl_error("S1132 $1: 1st parameter is not string(file name)", @name)
@file_name = nil
end
@format = format.eval_const(nil).val if !@format.instance_of?(String)
cdl_error("S1133 $1: 2nd parameter is not string(fromat)", @name)
@format = nil
end
@arg_list = arg_list
else
cdl_error("S1134 $1: unknown factory function", name)
end
Celltype.new_factory(self)
end
|
Class Method Details
.set_f_celltype(f_celltype) ⇒ Object
6650
6651
6652
|
# File 'lib/tecsgen/core/componentobj.rb', line 6650
def self.set_f_celltype(f_celltype)
@@f_celltype = f_celltype
end
|
Instance Method Details
#check_arg(celltype) ⇒ Object
6622
6623
6624
6625
6626
6627
6628
6629
6630
6631
6632
6633
6634
6635
6636
6637
6638
6639
6640
6641
6642
6643
6644
6645
6646
6647
6648
|
# File 'lib/tecsgen/core/componentobj.rb', line 6622
def check_arg(celltype)
if !@arg_list
return
end
if @f_celltype
cdl_error("S1135 celltype factory can\'t have parameter(s)")
return
end
@arg_list.each{|elements|
case elements[0]
when :IDENTIFIER obj = celltype.find(elements[1])
if obj.nil?
cdl_error("S1136 \'$1\': not found", elements[1])
elsif !obj.instance_of?(Decl) || obj.get_kind != :ATTRIBUTE
cdl_error("S1137 \'$1\': not attribute", elements[1])
end
when :STRING_LITERAL
else
cdl_error("S1138 internal error Factory.check_arg()")
end
}
end
|
#get_arg_list ⇒ Object
6670
6671
6672
|
# File 'lib/tecsgen/core/componentobj.rb', line 6670
def get_arg_list
@arg_list
end
|
#get_f_celltype ⇒ Object
6654
6655
6656
|
# File 'lib/tecsgen/core/componentobj.rb', line 6654
def get_f_celltype
@f_celltype
end
|
#get_file_name ⇒ Object
6662
6663
6664
|
# File 'lib/tecsgen/core/componentobj.rb', line 6662
def get_file_name
@file_name
end
|
6666
6667
6668
|
# File 'lib/tecsgen/core/componentobj.rb', line 6666
def get_format
@format
end
|
6658
6659
6660
|
# File 'lib/tecsgen/core/componentobj.rb', line 6658
def get_name
@name
end
|
#show_tree(indent) ⇒ Object
6674
6675
6676
6677
6678
6679
6680
6681
6682
6683
6684
6685
|
# File 'lib/tecsgen/core/componentobj.rb', line 6674
def show_tree(indent)
indent.times { print " " }
puts "Factory: name: #{@name}"
if @arg_list
(indent + 1).times { print " " }
puts "argument(s):"
@arg_list.each {|l|
(indent + 2).times { print " " }
print "\"#{l}\"\n"
}
end
end
|