Class: Import
Constant Summary
collapse
- @@import_list =
ヘッダの名前文字列のリスト 添字:expand したパス、値:Import
{}
- @@nest_stack_index =
-1
- @@nest_stack =
[]
- @@current_object =
nil
Class Method Summary
collapse
Instance Method Summary
collapse
Methods included from Importable
#find_file, #get_base_dir
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(cdl, b_reuse = false, b_imported = true) ⇒ Import
Import# import を行う
- cdl
-
string cdl へのパス.“” で囲まれていることを仮定
- b_reuse
-
bool true: template を生成しない
7562
7563
7564
7565
7566
7567
7568
7569
7570
7571
7572
7573
7574
7575
7576
7577
7578
7579
7580
7581
7582
7583
7584
7585
7586
7587
7588
7589
7590
7591
7592
7593
7594
7595
7596
7597
7598
7599
7600
7601
7602
7603
7604
7605
7606
7607
7608
7609
7610
7611
7612
7613
7614
7615
7616
7617
7618
7619
7620
7621
7622
7623
|
# File 'lib/tecsgen/core/componentobj.rb', line 7562
def initialize(cdl, b_reuse = false, b_imported = true)
Import.push self
@b_imported = b_imported
super()
@@current_import = self
@cdl = cdl.to_s.gsub(/\A["<](.*)[">]\z/, '\1')
found = false
@cdl_path = ""
@b_reuse = b_reuse
@b_reuse_real = @b_reuse || Generator.is_reuse?
if Generator.get_plugin && (File.exist? "#{$gen}/#{@cdl}")
@cdl_path = "#{$gen}/#{@cdl}"
found = true
else
path = find_file @cdl
if path
found = true
@cdl_path = path
end
end
if found == false
cdl_error("S1148 $1 not found in search path", @cdl)
return
end
prev = @@import_list[File.expand_path(@cdl_path)]
if prev
if prev.is_reuse_real? != @b_reuse_real
cdl_warning("W1008 $1: reuse designation mismatch with previous import", @cdl)
end
return
end
@@import_list[File.expand_path(@cdl_path)] = self
plugin = Generator.get_plugin
parser = Generator.new
parser.set_plugin plugin
parser.set_reuse @b_reuse_real
parser.parse([@cdl_path])
parser.finalize
Import.pop
end
|
Class Method Details
.get_current ⇒ Object
7637
7638
7639
|
# File 'lib/tecsgen/core/componentobj.rb', line 7637
def self.get_current
@@current_object
end
|
7625
7626
7627
|
# File 'lib/tecsgen/core/componentobj.rb', line 7625
def self.get_list
@@import_list
end
|
7551
7552
7553
7554
7555
7556
7557
|
# File 'lib/tecsgen/core/componentobj.rb', line 7551
def self.pop
@@current_object = @@nest_stack[@@nest_stack_index]
@@nest_stack_index -= 1
if @@nest_stack_index < -1
raise "TooManyRestore"
end
end
|
.push(object) ⇒ Object
7545
7546
7547
7548
7549
|
# File 'lib/tecsgen/core/componentobj.rb', line 7545
def self.push(object)
@@nest_stack_index += 1
@@nest_stack[@@nest_stack_index] = @@current_object
@@current_object = object
end
|
Instance Method Details
#get_cdl_name ⇒ Object
cdl の名前を返す
引数で指定されている cdl 名。一部パスを含む可能性がある
7647
7648
7649
|
# File 'lib/tecsgen/core/componentobj.rb', line 7647
def get_cdl_name
@cdl
end
|
#get_cdl_path ⇒ Object
7629
7630
7631
|
# File 'lib/tecsgen/core/componentobj.rb', line 7629
def get_cdl_path
@cdl_path
end
|
#is_imported? ⇒ Boolean
7641
7642
7643
|
# File 'lib/tecsgen/core/componentobj.rb', line 7641
def is_imported?
@b_imported
end
|
#is_reuse_real? ⇒ Boolean
7633
7634
7635
|
# File 'lib/tecsgen/core/componentobj.rb', line 7633
def is_reuse_real?
@b_reuse_real
end
|