Class: Namespace

Inherits:
NSBDNode show all
Defined in:
lib/tecsgen/core/generate.rb,
lib/tecsflow.rb,
lib/tecsgen/core/gen_xml.rb,
lib/tecsgen/core/optimize.rb,
lib/tecsgen/core/tecsinfo.rb,
lib/tecsgen/core/componentobj.rb,
lib/tecsgen/core/unjoin_plugin.rb

Overview

Namespace

root namespace だけ、Region クラスのインスタンスとして生成されるroot namespace は、root region を兼ねるため

Direct Known Subclasses

Region

Constant Summary collapse

@@domain_gen_factory_list =
nil
@@namespace_stack =

namespace 階層用のスタック

[]
@@namespace_sp =

@@namespace_stack = “::” (generator.rb)

-1
@@nest_stack_index =

Generator ネスト用のスタック (namespace 階層用のスタックを対比する)

-1
@@nest_stack =
[]
@@root_namespace =
nil

Class Method Summary collapse

Instance Method Summary collapse

Methods inherited from NSBDNode

#get_namespace, #get_namespace_path, #is_imported?, #set_namespace_path

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) ⇒ Namespace

Returns a new instance of Namespace.



4618
4619
4620
4621
4622
4623
4624
4625
4626
4627
4628
4629
4630
4631
4632
4633
4634
4635
4636
4637
4638
4639
4640
4641
4642
4643
4644
4645
4646
4647
4648
4649
4650
4651
4652
4653
4654
4655
4656
4657
4658
4659
4660
4661
4662
4663
4664
4665
4666
4667
# File 'lib/tecsgen/core/componentobj.rb', line 4618

def initialize(name)
  super()
  @name = name

  if name == "::"
    if !@@root_namespace.nil?
      # root は一回のみ生成できる
      raise "try to re-create root namespace"
    end
    @@root_namespace = self
    @NamespacePath = NamespacePath.new(name, true)
  else
    ns = @@namespace_stack[@@namespace_sp].find(name)
    if ns.is_a? Namespace
      dbgPrint "namespace: re-appear #{@name}\n"
      # 登録済み namespace の再登録
      ns.push ns
      return
    elsif ns
      cdl_error("S1151 $1: not namespace", @name)
      prev_locale = ns.get_locale
      puts "previous: #{prev_locale[0]}: line #{prev_locale[1]} \'#{name}\' defined here"
    end
    dbgPrint "namespace: 1st-appear #{@name}\n"
  end

  if @@namespace_sp >= 0 # root は除外
    @@namespace_stack[@@namespace_sp].new_namespace(self)
  end
  push self

  @global_name = Namespace.get_global_name # stack 登録後取る
  @name_list = NamedList.new(nil, "symbol in namespace '#{@name}'")
  @struct_tag_list = NamedList.new(nil, "struct tag")

  @namespace_list = []
  @signature_list = []
  @celltype_list = []
  @compositecelltype_list = []
  @cell_list = []
  @typedef_list = []
  @decl_list = []
  @const_decl_list = []
  @cache_n_cells = nil
  @cache_generating_region = nil
  if @NamespacePath.nil?
    # root namespace の場合は設定済 (親 namespace が見つからず例外になる)
    set_namespace_path # @NamespacePath の設定
  end
end

Class Method Details

.find(in_path) ⇒ Object

Namespace.find : in_path で示されるオブジェクトを探す

in_path

NamespacePath

in_path

Array : 古い形式

path [ "::", "ns1", "ns2" ]   absolute
path [ "ns1", "ns2" ]         relative


4744
4745
4746
4747
4748
4749
4750
4751
4752
4753
4754
4755
4756
4757
4758
4759
4760
4761
4762
4763
4764
4765
4766
4767
4768
4769
4770
4771
4772
4773
4774
4775
4776
4777
4778
4779
4780
4781
4782
4783
4784
4785
4786
4787
4788
4789
4790
4791
4792
4793
4794
4795
4796
4797
4798
4799
4800
4801
4802
4803
# File 'lib/tecsgen/core/componentobj.rb', line 4744

def self.find(in_path)
  if in_path.instance_of? Array
    # raise "Namespace.find: old fashion"

    path = in_path
    length = path.length
    return self.find_one(path[0]) if length == 1

    name = path[0]
    if name == "::"
      i = 1
      name = path[i] # 構文的に必ず存在
      object = @@root_namespace.find(name) # root
    else
      # 相対パス
      i = 0
      object = @@namespace_stack[@@namespace_sp].find_one(name) # crrent
    end

  elsif in_path.instance_of? NamespacePath
    path = in_path.get_path
    length = path.length

    if length == 0
      if in_path.is_absolute?
        return @@root_namespace
      else
        raise "path length 0, not absolute"
      end
    end

    i = 0
    name = path[0]
    if in_path.is_absolute?
      object = @@root_namespace.find(name)  # root
    else
      bns = in_path.get_base_namespace
      object = bns.find_one(name)           # crrent
    end
  else
    raise "unexpected path"
  end

  i += 1
  while i < length

    unless object.is_a?(Namespace)
      # クラスメソッド内で cdl_error を呼び出すことはできない
      # また、前方参照対応後、正確な行番号が出ない問題も生じる
      # cdl_error( "S1092 \'$1\' not namespace" , name )
      # このメソッドから nil が帰った場合 "not found" が出るので、ここでは出さない
      return nil
    end

    object = object.find(path[i])
    i += 1
  end

  return object
end

.find_one(name) ⇒ Object

Namespace# namespace から探す。見つからなければ親 namespace から探す



4810
4811
4812
# File 'lib/tecsgen/core/componentobj.rb', line 4810

def self.find_one(name)
  return @@namespace_stack[@@namespace_sp].find_one(name)
end

.find_tag(name) ⇒ Object



4832
4833
4834
4835
4836
4837
4838
4839
4840
4841
4842
4843
4844
# File 'lib/tecsgen/core/componentobj.rb', line 4832

def self.find_tag(name)
  # mikan tag : namespace の path に対応しない
  # namespace の中にあっても、root namespace にあるものと見なされる
  # よって カレント namespace から根に向かって探す
  i = @@namespace_sp
  while i >= 0
    res = @@namespace_stack[i].find_tag(name)
    if res
      return res
    end
    i -= 1
  end
end

.gen_XML(root_namespace) ⇒ Object



42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
# File 'lib/tecsgen/core/gen_xml.rb', line 42

def self.gen_XML(root_namespace)
  begin
    file_name = $gen_base + "/" + $target + ".xml"
    dbgPrint "generating XML file:#{file_name}\n"
    file = AppFile.open(file_name)

    file.print <<EOT
<?xml version="1.0" encoding="UTF-8"?>
<GUI_Tool xmlns="http://www.toppers.jp/tecs.html">
EOT
    root_namespace.gen_XML file, 1

    file.print <<EOT
</GUI_Tool>
EOT

    file.close
  rescue => evar
    Generator.error("T2001 fail to create XML file $1", file_name)
    print_exception(evar)
  end
end

.get_currentObject



4828
4829
4830
# File 'lib/tecsgen/core/componentobj.rb', line 4828

def self.get_current
  @@namespace_stack[@@namespace_sp]
end

.get_global_nameObject

Namespace:: global_name を得る

parse 中のみこのメソッドは使えるSTAGE: P



4680
4681
4682
4683
4684
4685
4686
4687
4688
4689
4690
4691
4692
4693
# File 'lib/tecsgen/core/componentobj.rb', line 4680

def self.get_global_name # parse 中有効
  if @@namespace_sp <= 0
    return ""
  end

  path = @@namespace_stack[1].get_name.to_s
  i = 2
  while i <= @@namespace_sp
    path = path + "_" + @@namespace_stack[i].get_name.to_s
    i += 1
  end

  path
end

.get_rootObject

Namespace# ルートを得る

ルートリージョンとルートネームスペースは同じオブジェクト



5120
5121
5122
# File 'lib/tecsgen/core/componentobj.rb', line 5120

def self.get_root
  @@root_namespace
end

.is_typename?(str) ⇒ Boolean

Returns:

  • (Boolean)


5003
5004
5005
5006
5007
5008
5009
5010
5011
5012
# File 'lib/tecsgen/core/componentobj.rb', line 5003

def self.is_typename?(str)
  i = @@namespace_sp
  while i >= 0
    if @@namespace_stack[i].is_typename?(str)
      return true
    end
    i -= 1
  end
  false
end

.new_cell(cell) ⇒ Object

cell (Namespace)



4897
4898
4899
# File 'lib/tecsgen/core/componentobj.rb', line 4897

def self.new_cell(cell)
  @@namespace_stack[@@namespace_sp].new_cell(cell)
end

.new_celltype(celltype) ⇒ Object

celltype



4875
4876
4877
# File 'lib/tecsgen/core/componentobj.rb', line 4875

def self.new_celltype(celltype)
  @@namespace_stack[@@namespace_sp].new_celltype(celltype)
end

.new_compositecelltype(compositecelltype) ⇒ Object

compositecelltype



4886
4887
4888
# File 'lib/tecsgen/core/componentobj.rb', line 4886

def self.new_compositecelltype(compositecelltype)
  @@namespace_stack[@@namespace_sp].new_compositecelltype(compositecelltype)
end

.new_const_decl(decl) ⇒ Object

const_decl



5023
5024
5025
# File 'lib/tecsgen/core/componentobj.rb', line 5023

def self.new_const_decl(decl)
  @@namespace_stack[@@namespace_sp].new_const_decl(decl)
end

.new_namespace(namespace) ⇒ Object

namespace



4851
4852
4853
# File 'lib/tecsgen/core/componentobj.rb', line 4851

def self.new_namespace(namespace)
  @@namespace_stack[@@namespace_sp].new_namespace(namespace)
end

.new_signature(signature) ⇒ Object

signature



4864
4865
4866
# File 'lib/tecsgen/core/componentobj.rb', line 4864

def self.new_signature(signature)
  @@namespace_stack[@@namespace_sp].new_signature(signature)
end

.new_structtype(struct) ⇒ Object

struct



4950
4951
4952
# File 'lib/tecsgen/core/componentobj.rb', line 4950

def self.new_structtype(struct)
  @@namespace_stack[@@namespace_sp].new_structtype(struct)
end

.new_typedef(typedef) ⇒ Object

typedef



4970
4971
4972
# File 'lib/tecsgen/core/componentobj.rb', line 4970

def self.new_typedef(typedef)
  @@namespace_stack[@@namespace_sp].new_typedef(typedef)
end

.popObject



4594
4595
4596
4597
4598
4599
4600
4601
# File 'lib/tecsgen/core/componentobj.rb', line 4594

def self.pop
  dbgPrint "pop Namespace\n"
  @@namespace_stack, @@namespace_sp = @@nest_stack[@@nest_stack_index]
  @@nest_stack_index -= 1
  if @@nest_stack_index < -1
    raise "TooManyRestore"
  end
end


139
140
141
# File 'lib/tecsgen/core/tecsinfo.rb', line 139

def self.print_info(f, indent)
  @@root_namespace.print_info_ns f, indent
end

.pushObject

Generator ネスト用スタックの push, pop (クラスメソッド)



4584
4585
4586
4587
4588
4589
4590
4591
4592
# File 'lib/tecsgen/core/componentobj.rb', line 4584

def self.push
  dbgPrint "push Namespace\n"
  @@nest_stack_index += 1
  @@nest_stack[@@nest_stack_index] = [@@namespace_stack, @@namespace_sp]
  if @@root_namespace
    @@namespace_sp = 0
    @@namespace_stack[@@namespace_sp] = @@root_namespace
  end
end

.set_root(root) ⇒ Object



69
70
71
# File 'lib/tecsflow.rb', line 69

def self.set_root root
  @@root_namespace = root
end

Instance Method Details

#check_joinObject

Namespace# セルの結合をチェックする



5101
5102
5103
5104
5105
5106
5107
5108
5109
5110
# File 'lib/tecsgen/core/componentobj.rb', line 5101

def check_join
  @cell_list.each {|c|
    dbgPrint "check_join #{c.get_name}\n"
    c.check_join
    c.check_reverse_require
  }
  @namespace_list.each{|ns|
    ns.check_join
  }
end

#check_ref_but_undefObject

Namespace# 参照されているが、未定義のセルを探す

プロトタイプ宣言だけで定義されていないケースをエラーとする受動の未結合セルについて警告する



4914
4915
4916
4917
4918
4919
4920
4921
4922
4923
4924
4925
4926
4927
4928
4929
4930
4931
4932
4933
4934
4935
4936
4937
# File 'lib/tecsgen/core/componentobj.rb', line 4914

def check_ref_but_undef
  @cell_list.each {|c|
    if !c.get_f_def # Namespace の @cell_list にはプロトタイプが含まれるケースあり
      if c.get_f_ref
        c.cdl_error("S1093 $1 : undefined cell" , c.get_namespace_path.get_path_str)
      elsif $verbose
        c.cdl_warning("W1006 $1 : only prototype, unused and undefined cell", c.get_namespace_path.get_path_str)
      end
    else
      dbgPrint "check_ref_but_undef: #{c.get_global_name}\n"
      ct = c.get_celltype
      # if c.get_f_ref == false && c.is_generate? && ct && ct.is_inactive? then
      if c.get_f_ref == false && ct && ct.is_inactive?
        c.cdl_warning("W1007 $1 : non-active cell has no entry join and no factory", c.get_namespace_path.get_path_str)
      end
      if c.has_ineffective_restrict_specifier
        c.cdl_warning("W9999: $1 has ineffective restrict specifier", c.get_namespace_path.get_path_str)
      end
    end
  }
  @namespace_list.each {|n|
    n.check_ref_but_undef
  }
end

#end_of_parseObject



4669
4670
4671
# File 'lib/tecsgen/core/componentobj.rb', line 4669

def end_of_parse
  pop
end

#find(name) ⇒ Object



4805
4806
4807
# File 'lib/tecsgen/core/componentobj.rb', line 4805

def find(name)
  @name_list.get_item(name)
end

#find_one(name) ⇒ Object



4814
4815
4816
4817
4818
4819
4820
4821
4822
4823
4824
4825
4826
# File 'lib/tecsgen/core/componentobj.rb', line 4814

def find_one(name)
  object = find(name)
  # これは出すぎ
  # dbgPrint "in '#{@name}' find '#{name}' object #{object ? object.class : "Not found"}\n"

  if !object.nil?
    return object
  elsif @name != "::"
    return @owner.find_one(name)
  else
    return nil
  end
end

#find_tag(name) ⇒ Object



4846
4847
4848
# File 'lib/tecsgen/core/componentobj.rb', line 4846

def find_tag(name)
  @struct_tag_list.get_item(name)
end

#gen_celltype_names(f, prepend, append, b_plugin, b_inline_only_or_proc = true) ⇒ Object

すべてのセルタイプの名前を出力

f

FILE: 出力先ファイル

prepend

string: 前置文字列

append

string: 後置文字列

b_plguin

bool: plugin により生成されたセルタイプを出力

#b_inline_only

bool: true ならば inline の entry port のみのセルタイプを含める

b_inline_only_or_proc

bool|Proc: true ならば inline の entry port のみ、かつインアクティブなセルタイプを含める

Proc ならば Proc を実行した結果 true ならば含める
namespace "::" から呼出される


817
818
819
820
821
822
823
824
825
826
827
828
829
830
831
832
833
# File 'lib/tecsgen/core/generate.rb', line 817

def gen_celltype_names(f, prepend, append, b_plugin, b_inline_only_or_proc = true)
  dbgPrint "gen_celltype_names #{@name}\n"

  @celltype_list.each {|ct|
    next if !ct.need_generate?
#      next if b_inline_only == false && ct.is_all_entry_inline?
    next if b_inline_only_or_proc == false && ct.is_all_entry_inline? && !ct.is_active?
    # print "Proc:", b_inline_only_or_proc.kind_of?( Proc ), b_inline_only_or_proc.class, "\n"
    next if b_inline_only_or_proc.is_a?(Proc) && (b_inline_only_or_proc.call(ct) == false)
    if (b_plugin && ct.get_plugin) || (!b_plugin && !ct.get_plugin)
      f.print " #{prepend}#{ct.get_global_name}#{append}"
    end
  }
  @namespace_list.each {|ns|
    ns.gen_celltype_names(f, prepend, append, b_plugin, b_inline_only_or_proc)
  }
end

#gen_celltype_names_domain(f, prepend, append, domain_type, region, b_plugin, b_inline_only = true) ⇒ Object

すべてのセルタイプの名前を出力

region

Region:

gen_celltype_names とgen_celltype_names_domain の相違:

region  domain_roots に含む場合、出力する.
または、region を含まないが、domain_roots が複数かつルートリージョンの場合、出力する.

それ以外は、gen_celltype_names の説明を参照



841
842
843
844
845
846
847
848
849
850
851
852
853
854
855
856
857
858
859
860
861
862
863
864
865
866
867
868
869
# File 'lib/tecsgen/core/generate.rb', line 841

def gen_celltype_names_domain(f, prepend, append, domain_type, region, b_plugin, b_inline_only = true)
  dbgPrint "gen_celltype_names #{@name}\n"

  @celltype_list.each {|ct|
    next if !ct.need_generate?
#      next if b_inline_only == false && ct.is_all_entry_inline?
    next if b_inline_only == false && ct.is_all_entry_inline? && !ct.is_active?
    if (b_plugin && ct.get_plugin) || (!b_plugin && !ct.get_plugin)
      regions = ct.get_domain_roots[domain_type]
      if regions.include?(region)
        # p "BBB celltype:#{ct.get_name} domain:#{domain_type} append:#{append}"
        if region.is_root?
          nsp = ""
        else
          nsp = "_#{region.get_namespace_path.get_global_name}"
        end
        f.print " #{prepend}#{ct.get_global_name}#{nsp}#{append}"
      elsif region.is_root?
        # the case of domain_roots >= 2 && no cell in root region
        if regions.length > 1
          f.print " #{prepend}#{ct.get_global_name}#{append}"
        end
      end
    end
  }
  @namespace_list.each {|ns|
    ns.gen_celltype_names_domain(f, prepend, append, domain_type, region, b_plugin, b_inline_only)
  }
end

#gen_celltype_names_domain2(f, prepend, append, domain_type, region, b_plugin, b_inline_only = true) ⇒ Object

Namespace#すべてのセルタイプの名前を出力

セルタイプコードのための名前出力gen_celltype_names_domain と gen_celltype_names_domain2 の相違・どれか一つのリージョンにしか出さない

domain_roots が1つだけで、指定リージョンを含む
domain_roots が2つ以上で、指定リージョンがルートリージョン

・ドメイン名を付加しない



878
879
880
881
882
883
884
885
886
887
888
889
890
891
892
893
894
895
896
897
898
899
900
901
# File 'lib/tecsgen/core/generate.rb', line 878

def gen_celltype_names_domain2(f, prepend, append, domain_type, region, b_plugin, b_inline_only = true)
  dbgPrint "gen_celltype_names #{@name}\n"

  @celltype_list.each {|ct|
    next if !ct.need_generate?
#      next if b_inline_only == false && ct.is_all_entry_inline?
    next if b_inline_only == false && ct.is_all_entry_inline? && !ct.is_active?
    if (b_plugin && ct.get_plugin) || (!b_plugin && !ct.get_plugin)
      # p "BBB celltype:#{ct.get_name} domain:#{domain_type} append:#{append}"
      regions = ct.get_domain_roots[domain_type]
      if regions.include?(region) && regions.length == 1
        f.print " #{prepend}#{ct.get_global_name}#{append}"
      elsif region.is_root?
        # the case of domain_roots >= 2 && no cell in root region
        if regions.length > 1
          f.print " #{prepend}#{ct.get_global_name}#{append}"
        end
      end
    end
  }
  @namespace_list.each {|ns|
    ns.gen_celltype_names_domain2(f, prepend, append, domain_type, region, b_plugin, b_inline_only)
  }
end

#gen_global_headerObject



206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
# File 'lib/tecsgen/core/generate.rb', line 206

def gen_global_header
  # global_tecs.h の生成
  f = AppFile.open("#{$gen}/global_tecsgen.#{$h_suffix}")

  if @name == "::"
    print_note f

    # ガードコードを出力
    f.print <<EOT
#ifndef GLOBAL_TECSGEN_H
#define GLOBAL_TECSGEN_H

EOT

    # import_C で指定されたヘッダファイルの #include を出力
    if Import_C.get_header_list2.length > 0
      # ヘッダ include の出力
      f.printf TECSMsg.get(:IMP_comment), "#_IMP_#"
      Import_C.get_header_list2.each{|h|
        f.printf("#include \"#{h}\"\n")
      }
      f.printf("/**/\n\n")
    end

    ifndef_macro_only f
  end

  # typedef, struct, enum を生成
  @decl_list.each {|d|

    # d は Typedef, StructType, EnumType のいずれか
    if d.instance_of?(Typedef)

      # Typedef の場合、declarator の @type が CType でないか
      if !d.get_declarator.get_type.is_a?(CType)
        d.gen_gh f
      end
    elsif !d.is_a?(CType)

      # CType ではない (StructType または EnumType)
      d.gen_gh f
#     else
#       ここに該当するのは CStructType, CEnumType
    end
  }

  if @name == "::"

    if $ram_initializer
      # Proc to judge the necessity of CB initializer
      b_inline_only_or_proc = Proc.new{|ct|
        # print ct.get_name, ": ",  ct.need_CB_initializer?, "\n"
        ct.need_CB_initializer?
      }
      gen_celltype_names(f, "extern void ", "_CB_initialize();\n", true, b_inline_only_or_proc)
      gen_celltype_names(f, "extern void ", "_CB_initialize();\n", false, b_inline_only_or_proc)
      f.print "\n#define INITIALIZE_TECS() \\\n"
      gen_celltype_names(f, "\t", "_CB_initialize();\\\n", true, b_inline_only_or_proc)
      gen_celltype_names(f, "\t", "_CB_initialize();\\\n", false, b_inline_only_or_proc)
      f.print("/* INITIALIZE_TECS terminator */\n\n")
    else
      f.print "\n#define INITIALIZE_TECS() \n"
    end
    f.print "#define INITIALZE_TECSGEN() INITIALIZE_TECS()  /* for backward compatibility */\n\n"

    f.print("/* Descriptor for dynamic join */\n")
    f.print("#define Descriptor( signature_global_name )  DynDesc__ ## signature_global_name\n")
    f.print("#define is_descriptor_unjoined( desc )  ((desc).vdes==NULL)\n\n")
    endif_macro_only f
  end

  # const を生成  mikan
  @const_decl_list.each {|d|
    f.printf("#define %-14s ((%s%s)%s)\n", d.get_global_name,
              d.get_type.get_type_str, d.get_type.get_type_str_post,
              d.get_initializer.eval_const2(nil))
  }

  f.close
end

#gen_global_header_postObject



287
288
289
290
291
292
293
294
295
296
297
298
299
# File 'lib/tecsgen/core/generate.rb', line 287

def gen_global_header_post
  # global_tecs.h を開く
  f = AppFile.open("#{$gen}/global_tecsgen.#{$h_suffix}")

  if @name == "::"
    f.print <<EOT

#endif /* GLOBAL_TECSGEN_H */
EOT
  end

  f.close
end

#gen_makefileObject

Makefile.tecsgen, Makefile.templ の出力

全セルタイプ名を出力する部分を出力

(本メソッドは root namespace に対して呼出す)
 個々のセルタイプのメークルールは Celltype クラスで出力


305
306
307
308
# File 'lib/tecsgen/core/generate.rb', line 305

def gen_makefile
  gen_makefile_template
  gen_makefile_tecsgen
end

#gen_makefile_tecsgenObject



534
535
536
537
538
539
540
541
542
543
544
545
546
547
548
549
550
551
552
553
554
555
556
557
558
559
560
561
562
563
564
565
566
567
568
569
570
571
572
573
574
575
576
577
578
579
580
581
582
583
584
585
586
587
588
589
590
591
592
593
594
595
596
597
598
599
600
601
602
603
604
605
606
607
608
609
610
611
612
613
614
615
616
617
618
619
620
621
622
623
624
625
626
627
628
629
630
631
632
633
634
635
636
637
638
639
640
641
642
643
644
645
646
647
648
649
650
651
652
653
654
655
656
657
658
659
660
661
662
663
664
665
666
667
668
669
670
671
672
673
674
675
676
677
678
679
680
681
682
683
684
685
686
687
688
689
690
691
692
693
694
695
696
697
698
699
700
701
702
703
704
705
706
707
708
709
710
711
712
713
714
715
716
717
718
719
720
721
722
723
724
725
726
727
728
729
730
731
732
733
734
735
736
737
738
739
740
741
742
743
744
745
746
747
748
749
750
751
752
753
754
755
756
757
758
759
760
761
762
763
764
765
766
767
768
769
770
771
772
773
774
775
776
777
778
779
780
781
782
783
784
785
786
787
788
789
790
791
792
793
794
795
796
797
798
799
800
801
802
803
804
805
806
# File 'lib/tecsgen/core/generate.rb', line 534

def gen_makefile_tecsgen
  ### Makefile.tecsgen の生成
  f = AppFile.open("#{$gen}/Makefile.tecsgen")

  f.print <<EOT
# generated automatically by tecsgen.
# This file is not intended to modify.
#
# Makefile variables below are defined.
#  TECS_IMPORT_CDLS          .cdl files improted by import statement
#  SIGNATURE_HEADERS         .h files of signature
#  CELLTYPE_TECSGEN_HEADERS  .h files of celltype
#  CELLTYPE_FACTORY_HEADERS  .h files of celltype's factory
#  TECS_HEADERS              summary of .h files above
#  TECS_INLINE_HEADERS       .h files of celltype inline header
#  PLUGIN_INLINE_HEADERS     .h files of plugin generated inline header
#
#  TECS_COBJS                .o files of TECS
#                            = $(TECSGEN_COBJS)+$(PLUGIN_COBJS)+$(CELLTYPE_COBJS)
#                            = $(TECS_KERNEL_COBJS)+$(TECS_KERNEL_COBJS)+$(TECS_OUTOFDOMAIN_COBJS)
#                            = $(TECSGEN_domain_COBJS)+$(PLUGIN_domain_COBJS)+$(CELLTYPE_domain_COBJS) for each domain
#
#  TECSGEN_COBJS             .o files of celltype_tecsgen.c
#  CELLTYPE_COBJS            .o files of celltype.c (celltype code)
#  PLUGIN_COBJS              .o files of plugin generated .c files
#  PLUGIN_CELLTYPE_SRCS      .c files of plugin generated celltype.c (celltype code)
#  PLUGIN_TECSGEN_SRCS       .c files of plugin generated celltype_tecsgen.c
#
#  TECSGEN_SRCS              .c files of celltype_tecsgen.c
#  CELLTYPE_SRCS             .c files of celltype.c (celltype code)
#  PLUGIN_SRCS               .c files of plugin generated
#
# Variables for domain
#  TECS_DOMAINS             domain names
#  TECS_KERNEL_COBJS        .o files of kernel domain (tecsgen, celltype, plugin)
#  TECS_USER_COBJS          .o files of user domain (tecsgen, celltype, plugin)
#  TECS_OUTOFDOMAIN_COBJS   .o files of OutOfDomain (tecsgen, celltype, plugin)
#  TECSGEN_domain_COBJS     .o files of celltype_tecsgen.c files for each domain
#  PLUGIN_domain_COBJS      .o files of plugin generated .c files for each domain
#  CELLTYPE_domain_COBJS    .o files of celltype.c files for each domain
#  TECSGEN_domain_SRCS      .c files of celltype_domain_tecsgen.c
#  PLUGIN_domain_SRCS       .c files of plugin generated .c files for each domain
#  CELLTYPE_domain_SRCS     .c files of celltype.c files for each domain

EOT

  f.print("TECS_IMPORT_CDLS =")
  Import.get_list.each{|cdl_expand_path, import|
    path = import.get_cdl_path
    if TECSGEN.is_absolute_path? path
      path = TECSGEN.subst_tecspath path
    end
    f.print " "
    f.print(path)
  }
  f.print("\n")
  f.print("TECS_IMPORT_HEADERS =")
  Import_C.get_header_list.each{|header, path|
    if TECSGEN.is_absolute_path? path
      path = TECSGEN.subst_tecspath path
    end
    f.print " "
    f.print path
  }
  f.print "\n"
  f.print "TECS_IMPORTS = $(TECS_IMPORT_CDLS) $(TECS_IMPORT_HEADERS)\n\n"

  f.print "SIGNATURE_HEADERS = \\\n"
  if $generating_region.get_n_cells != 0
    @signature_list.each{|s|
      f.print "\t$(GEN_DIR)/#{s.get_global_name}_tecsgen.#{$h_suffix} \\\n"
    }
  end
  f.print "# SIGNATURE_HEADERS terminator\n\n"

  b_inline_only_or_proc = Proc.new {|ct| true }
  f.print "CELLTYPE_TECSGEN_HEADERS = \\\n"
  gen_celltype_names(f, "\t$(GEN_DIR)/", "_tecsgen.h \\\n", true, b_inline_only_or_proc)
  gen_celltype_names(f, "\t$(GEN_DIR)/", "_tecsgen.h \\\n", false, b_inline_only_or_proc)
  f.print "# CELLTYPE_TECSGEN_HEADERS terminator\n\n"
  f.print "CELLTYPE_FACTORY_HEADERS = \\\n"
  gen_celltype_names(f, "\t$(GEN_DIR)/", "_factory.h \\\n", true, b_inline_only_or_proc)
  gen_celltype_names(f, "\t$(GEN_DIR)/", "_factory.h \\\n", false, b_inline_only_or_proc)
  f.print "# CELLTYPE_FACTORY_HEADERS terminator\n\n"
  f.print "# TECS_HEADERS:  headers generated by tecsgen\n"
  f.print "TECS_HEADERS = $(SIGNATURE_HEADERS) $(CELLTYPE_TECSGEN_HEADERS) $(CELLTYPE_FACTORY_HEADERS)\n\n"
  b_inline_only_or_proc = true
  f.print "TECS_INLINE_HEADERS = \\\n"
  gen_celltype_names(f, "\t", "_tecsgen.h \\\n", false, b_inline_only_or_proc)
  f.print "# TECS_INLINE_HEADERS terminator\n\n"
  f.print "PLUGIN_INLINE_HEADERS = \\\n"
  gen_celltype_names(f, "\t", "_tecsgen.h \\\n", true, b_inline_only_or_proc)
  f.print "# PLUGIN_INLINE_HEADERS terminator\n\n"

  ### set domain variables ###
  domain_type = nil
  domain_regions = nil
  DomainType.get_domain_regions.each{|dt, regions|
    # domain_type は一つのノードには、一つしかないので、このループは、必ず一回しか回らない
      ###   mikan 複数のノードがあり、異なる domain_type が指定される可能性はある
    domain_regions = regions
    domain_type = dt
  }
  if domain_regions.nil?
    # in case no 'domain' specified at region
    domain_regions = [Region.get_root]
  end

  hasDomainProc = Proc.new{
    if domain_regions.length > 1 || domain_regions[0] != Region.get_root
      true
    else
      false
    end
  }
  decideDomainNameProc = Proc.new {|region|
    if region.is_root?
      if hasDomainProc.call
        dn = "_Root_"
      else
        dn = ""
      end
    else
      dn = "_#{region.get_namespace_path.get_global_name}"
    end
  }

  f.print("# TECS_COBJS: all objects of TECS, include both user written code and tecsgen automatically generated code\n")
  f.print("TECS_COBJS = $(TECSGEN_COBJS) $(PLUGIN_COBJS) $(CELLTYPE_COBJS)\n\n")

  ### in case domain is used ###
  if hasDomainProc.call

    f.print("# TECS_DOMAINS: list of domain names (names of 'domain' spacified region)\n")
    f.print("TECS_DOMAINS = ")
    domain_regions.each{|r|
      if r.get_domain_type.get_option != "OutOfDomain"
        f.print(" #{r.get_namespace_path.get_global_name}")
      end
    }
    f.print("\n\n")

    f.print("# TECS_KERNEL_COBJS: objects belong to kernel domain\n")
    f.print("TECS_KERNEL_COBJS = \\\n")
    domain_regions.each{|r|
      if r.get_domain_type.get_kind == :kernel
        f.print("	$(TECSGEN#{decideDomainNameProc.call r}_COBJS) \\\n")
        f.print("	$(PLUGIN#{decideDomainNameProc.call r}_COBJS) \\\n")
        f.print("	$(CELLTYPE#{decideDomainNameProc.call r}_COBJS) \\\n")
      end
    }
    f.print("# TECS_KERNEL_COBJS terminator\n\n")

    f.print("# TECS_USER_COBJS: objects belong to user domain\n")
    f.print("TECS_USER_COBJS = \\\n")
    domain_regions.each{|r|
      if r.get_domain_type.get_kind == :user
        f.print("	$(TECSGEN#{decideDomainNameProc.call r}_COBJS) \\\n")
        f.print("	$(PLUGIN#{decideDomainNameProc.call r}_COBJS) \\\n")
        f.print("	$(CELLTYPE#{decideDomainNameProc.call r}_COBJS) \\\n")
      end
    }
    f.print("# TECS_USER_COBJS terminator\n\n")

    f.print("# TECS_OUTOFDOMAIN_COBJS: objects belong to OutOfDomain\n")
    f.print("TECS_OUTOFDOMAIN_COBJS = \\\n")
    domain_regions.each{|r|
      if r.get_domain_type.get_kind == :OutOfDomain
        f.print("	$(TECSGEN#{decideDomainNameProc.call r}_COBJS) \\\n")
        f.print("	$(PLUGIN#{decideDomainNameProc.call r}_COBJS) \\\n")
        f.print("	$(CELLTYPE#{decideDomainNameProc.call r}_COBJS) \\\n")
      end
    }
    f.print("# TECS_OUTOFDOMAIN_COBJS terminator\n\n")

    f.print("# TECSGEN_COBJS: objects from sources which are automatically generated by tecsgen\n")
    f.print("TECSGEN_COBJS = \\\n")
    domain_regions.each{|r|
      f.print("	$(TECSGEN#{decideDomainNameProc.call r}_COBJS) \\\n")
    }
    f.print("# TECSGEN_COBJS terminator\n\n")

    f.print("# PLUGIN_COBJS: objects from sources which are automatically generated by plugin(s)\n")
    f.print("PLUGIN_COBJS = \\\n")
    domain_regions.each{|r|
      f.print("	$(PLUGIN#{decideDomainNameProc.call r}_COBJS) \\\n")
    }
    f.print("# PLUGIN_COBJS terminator\n\n")

    f.print("CELLTYPE_COBJS = \\\n")
    domain_regions.each{|r|
      f.print("	$(CELLTYPE#{decideDomainNameProc.call r}_COBJS) \\\n")
    }
    f.print("# CELLTYPE_COBJS terminator\n\n")

    f.print("TECSGEN_SRCS = \\\n")
    domain_regions.each{|r|
      f.print("	$(TECSGEN#{decideDomainNameProc.call r}_SRCS) \\\n")
    }
    f.print("# TECSGEN_SRCS terminator\n\n")

    f.print("PLUGIN_SRCS = \\\n")
    domain_regions.each{|r|
      f.print("	$(PLUGIN#{decideDomainNameProc.call r}_SRCS) \\\n")
    }
    f.print("# PLUGIN#_SRCS terminator\n\n")
  end

  ###
  f.print("# TECSGEN_COBJS: objects from sources which are automatically generated by tecsgen\n")
  domain_regions.each{|r|
    nsp = decideDomainNameProc.call(r)
    f.print("TECSGEN#{nsp}_COBJS = \\\n")
    gen_celltype_names_domain(f, "	$(_TECS_OBJ_DIR)", "_tecsgen.o \\\n", domain_type, r, false)
    f.print("# TECSGEN#{nsp}_COBJS terminator\n\n")
  }

  f.print("# PLUGIN_COBJS: objects from sources which are automatically generated by plugin(s)\n")
  domain_regions.each{|r|
    nsp = decideDomainNameProc.call(r)
    f.print("PLUGIN#{nsp}_COBJS = \\\n")
    gen_celltype_names_domain(f, "	$(_TECS_OBJ_DIR)", "_tecsgen.o \\\n", domain_type, r, true)
    gen_celltype_names_domain2(f, "	$(_TECS_OBJ_DIR)", ".o \\\n", domain_type, r, true, false)
    f.print("# PLUGIN#{nsp}_COBJS terminator\n\n")
  }

  f.print("# CELLTYPE_COBJS: objects of celltype code written by user\n")
  domain_regions.each{|r|
    nsp = decideDomainNameProc.call(r)
    f.print("CELLTYPE#{nsp}_COBJS = \\\n")
    gen_celltype_names_domain2(f, "	$(_TECS_OBJ_DIR)", ".o \\\n", domain_type, r, false, false)
    f.print("# CELLTYPE#{nsp}_COBJS terminator\n\n")
  }

  f.print("# TECSGEN_SRCS: sources automatically generated by tecsgen\n")
  domain_regions.each{|r|
    nsp = decideDomainNameProc.call(r)
    f.print("TECSGEN#{nsp}_SRCS = \\\n")
    gen_celltype_names_domain(f, "	$(GEN_DIR)/", "_tecsgen.#{$c_suffix} \\\n", domain_type, r, false)
    f.print("# TECSGEN#{nsp}_SRCS terminator\n\n")
  }

  f.print("# PLUGIN_SRCS: sources automatically generated by plugin\n")
  f.print( "PLUGIN_CELLTYPE_SRCS = \\\n" )
  domain_regions.each{|r|
    nsp = decideDomainNameProc.call(r)
    f.print( "  $(PLUGIN#{nsp}_CELLTYPE_SRCS)\\\n" )
  }
  f.print( "# PLUGIN_CELLTYPE_SRCS terminator\n\n" )
  f.print( "PLUGIN_TECSGEN_SRCS = \\\n" )
  domain_regions.each{ |r|
    nsp = decideDomainNameProc.call( r )
    f.print( "  $(PLUGIN#{nsp}_TECSGEN_SRCS)\\\n" )
  }
  f.print( "# PLUGIN_TECSGEN_SRCS terminator\n\n" )
  domain_regions.each{ |r|
    nsp = decideDomainNameProc.call( r )
    f.print( "PLUGIN#{nsp}_SRCS = $(PLUGIN#{nsp}_CELLTYPE_SRCS) $(PLUGIN#{nsp}_TECSGEN_SRCS)\n\n" )
    f.print( "PLUGIN#{nsp}_CELLTYPE_SRCS = \\\n" )
    gen_celltype_names_domain2( f, "", ".#{$c_suffix} \\\n", domain_type, r, true, false )
    f.print( "# PLUGIN#{nsp}_CELLTYPE_SRCS terminator\n\n" )
    nsp = decideDomainNameProc.call( r )
    f.print( "PLUGIN#{nsp}_TECSGEN_SRCS = \\\n" )
    gen_celltype_names_domain( f, "", "_tecsgen.#{$c_suffix} \\\n", domain_type, r, true )
    f.print( "# PLUGIN#{nsp}_TECSGEN_SRCS terminator\n\n" )
  }

  f.print( "# CELLTYPE_SRCS: sources of celltype code written by user\n" )
  f.print( "CELLTYPE_SRCS = \\\n" )
  gen_celltype_names( f, "  ", ".#{$c_suffix} \\\n", false, false )
  f.print( "# CELLTYPE_SRCS terminator\n\n" )
  f.close
end

#gen_makefile_templateObject



310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
332
333
334
335
336
337
338
339
340
341
342
343
344
345
346
347
348
349
350
351
352
353
354
355
356
357
358
359
360
361
362
363
364
365
366
367
368
369
370
371
372
373
374
375
376
377
378
379
380
381
382
383
384
385
386
387
388
389
390
391
392
393
394
395
396
397
398
399
400
401
402
403
404
405
406
407
408
409
410
411
412
413
414
415
416
417
418
419
420
421
422
423
424
425
426
427
428
429
430
431
432
433
434
435
436
437
438
439
440
441
442
443
444
445
446
447
448
449
450
451
452
453
454
455
456
457
458
459
460
461
462
463
464
465
466
467
468
469
470
471
472
473
474
475
476
477
478
479
480
481
482
483
484
485
486
487
488
489
490
491
492
493
494
495
496
497
498
499
500
501
502
503
504
505
506
507
508
509
510
511
512
513
514
515
516
517
518
519
520
521
522
523
524
525
526
527
528
529
530
531
532
# File 'lib/tecsgen/core/generate.rb', line 310

def gen_makefile_template
  return if $generate_no_template

  ### Makefile.templ の生成
  f = AppFile.open("#{$gen}/Makefile.templ")

  print_Makefile_note f

  # Makefile の変数の出力
  f.printf TECSMsg.get(:MVAR_comment), "#_MVAR_#"
  f.printf "# fixed variable (unchangeable by config or plugin)\n"

  # TARGET の出力 (第一引数 $target に region 名および .exe を付加)
  target = $target
  if $generating_region != @@root_namespace
    # 子 region のリンクターゲットの場合
    target += "-#{$generating_region.get_global_name}"
  end
  f.print "TARGET_BASE = #{target}\n"

  if $generating_region == @@root_namespace
    f.print "BASE_DIR = .\n"
    vpath_lead = ""
  else
    f.print "BASE_DIR = ..\n"
    vpath_lead = "../"
  end

  f.print "GEN_DIR = $(BASE_DIR)/#{$gen}\n"

  f.print "INCLUDES ="
  search_path = $import_path + TECSGEN::Makefile.get_search_path
  search_path.each{|path|
    if TECSGEN.is_absolute_path? path
      f.print(TECSGEN.subst_tecspath " -I #{path}")
    else
      f.print " -I $(BASE_DIR)/#{path}"
    end
  }
  f.print " -I $(GEN_DIR)\n"
  f.print "DEFINES ="
  $define.each{|define| f.print " -D #{define}" }
  f.print "\n\n"
  f.printf "# end of fixed variable (unchangeable by config or plugin)\n"


  vpath_add = ""
  search_path.each{|path|
    if path != "."
      if TECSGEN.is_absolute_path? path
        vpath_add += " " + TECSGEN.subst_tecspath(path)
      else
        vpath_add += " " + vpath_lead + path
      end
    end
  }
  objs_add = ""
  TECSGEN::Makefile.get_objs.each{|obj| objs_add += " " + obj }
  ld_flag_add = TECSGEN::Makefile.get_ldflags
  var_add = ""
  TECSGEN::Makefile.get_vars.each{|var|
    var_add += "#" + TECSGEN::Makefile.get_var_comment(var) + "\n"
    a = TECSGEN::Makefile.get_var_val(var).to_s
    b = var.to_s
    c = var_add.to_s
    var_add += var.to_s + " =" + " " + TECSGEN::Makefile.get_var_val(var).to_s + "\n\n"
  }
  pre_tecsgen_target = ""
  TECSGEN::Makefile.get_pre_tecsgen_target{|target| pre_tecsgen_target += " " + target }
  post_tecsgen_target = ""
  TECSGEN::Makefile.get_post_tecsgen_target{|target| post_tecsgen_target += " " + target }

#
# LD = gcc
# LDFLAGS =#{ld_flag_add}
# SRC_DIR = $(BASE_DIR)/src
# _TECS_OBJ_DIR = $(GEN_DIR)/
# #   _TECS_OBJ_DIR   # should end with '/'

  f.print <<EOT
#{var_add}

# Pre-tecsgen target
PRE_TECSGEN_TARGET =#{pre_tecsgen_target}

# Post-tecsgen target
POST_TECSGEN_TARGET =#{post_tecsgen_target}

# vpath for C sources and headers
vpath %.#{$c_suffix} $(SRC_DIR) $(GEN_DIR) #{vpath_add}
vpath %.#{$h_suffix} $(SRC_DIR) $(GEN_DIR) #{vpath_add}

# Other objects (out of tecsgen)
OTHER_OBJS =#{objs_add}                      # Add objects out of tecs care.
# OTHER_OBJS = $(_TECS_OBJ_DIR)vasyslog.o
EOT

  # make ルールの出力
  f.printf(TECSMsg.get(:MRUL_comment), "#_MRUL_#")

  f.print <<EOT
allall: tecs
\tmake all     # in order to include generated Makefile.tecsgen & Makefile.depend

EOT

  if $generating_region.get_n_cells != 0
    all_target = "$(TARGET)"
  else
    all_target = ""
  end

  if $generating_region == @@root_namespace
    if Region.get_link_roots.length > 1
      all_target += " sub_regions"
    end
    timestamp = " $(TIMESTAMP)"
  else
    timestamp = ""
  end

  f.print "all : #{all_target}\n\n"
  f.printf TECSMsg.get(:MDEP_comment), "#_MDEP_#"
  f.print "-include $(GEN_DIR)/Makefile.tecsgen\n"
  if $generating_region.get_n_cells != 0
    # Makefile.depend の include
    f.print "-include $(GEN_DIR)/Makefile.depend\n\n"

    f.print "$(TARGET) :#{timestamp} $(CELLTYPE_COBJS) $(TECSGEN_COBJS) $(PLUGIN_COBJS) $(OTHER_OBJS)\n"
    f.print "	$(LD) -o $(TARGET) $(TECSGEN_COBJS) $(CELLTYPE_COBJS) $(PLUGIN_COBJS) $(OTHER_OBJS) $(LDFLAGS)\n\n"
  end

  if Region.get_link_roots.length > 1 && $generating_region == @@root_namespace
    f.print "\nsub_regions:$(TIMESTAMP)\n"
    Region.get_link_roots.each {|region|
      if region.get_global_name != "" # Root region: この Makefile 自身
        f.print "\tcd #{region.get_global_name}; make all\n"
      end
    }
    f.print "\n"
  end

  # clean: ターゲット
  f.print "clean :\n"
  if $generating_region == @@root_namespace
    Region.get_link_roots.each {|region|
      if region.get_global_name != "" # Root region: この Makefile 自身
        f.print "\tcd #{region.get_global_name}; make clean\n"
      end
    }
  end
  f.print "	rm -f $(CELLTYPE_COBJS) $(TECSGEN_COBJS) $(PLUGIN_COBJS) $(OTHER_OBJS) $(TARGET) #{timestamp}\n"
  if $generating_region == @@root_namespace
    f.print "	rm -rf $(GEN_DIR)\n"
  end
  f.print "\n"

  # tecs: ターゲット
  if $generating_region == @@root_namespace
    f.print "tecs : $(PRE_TECSGEN_TARGET) $(TIMESTAMP) $(POST_TECSGEN_TARGET)\n\n"
    f.print "$(TIMESTAMP) : $(TECS_IMPORTS)\n"
    f.print "	$(TECSGEN) #{TECSGEN.subst_tecspath($arguments, true)}\n\n"
    # f.print "  touch $(TIMESTAMP)\n\n"

  else
    f.print "tecs:\n"
    f.print "\t@echo \"run 'make tecs' in root region\"\n\n"
  end
  # tecsflow:, tcflow ターゲット
  if $generating_region.get_n_cells != 0 || $generating_region == @@root_namespace then
    f.print "#####  TECSFlow targets  #####\n"
  end

  if Region.get_link_roots.length > 1 && $generating_region == @@root_namespace then
    tecsflow_target = "tecsflow_sub"
    if $generating_region.get_n_cells > 0 then
      f.print "tecsflow: tecs tecsflow_sub\n"
    else
      f.print "tecsflow:\n"
    end
    Region.get_link_roots.each {|region|
      if region.get_n_cells > 0 then
        f.print "\tcd #{region.get_global_name}; make tecsflow\n"
      end
    }
    f.print "\n"
  else
    tecsflow_target = "tecsflow"
  end

  if $generating_region.get_n_cells != 0 then
    f.print "#{tecsflow_target} : $(GEN_DIR)/tecsgen.rbdmp tcflow\n"
    f.print "\ttecsflow -g $(GEN_DIR)\n\n"
    f.print "tecsflow_u : $(GEN_DIR)/tecsgen.rbdmp tcflow\n"
    f.print "\ttecsflow -g $(GEN_DIR) -U\n\n"
    f.print "$(GEN_DIR)/tecsgen.rbdmp : tecs\n\n"
    f.print "tcflow : tecs\n"
    f.print "\tmake tcflow_exec\n\n"
    f.print "tcflow_exec : $(GEN_DIR)/tcflow.rbdmp\n"
    f.print "$(GEN_DIR)/tcflow.rbdmp : $(CELLTYPE_SRCS) $(PLUGIN_CELLTYPE_SRCS)\n"
    f.print "\ttcflow -g $(GEN_DIR) -c '$(CC) -E -DTECSFLOW -DTECSGEN $(CFLAGS) -I ./' $^\n"
  end

  if $generating_region.get_n_cells != 0 || $generating_region == @@root_namespace then
    f.print "#####  end TECSFlow targets  #####\n\n"
  end

  # generic %.o : %.c
  f.print "# generic target for objs\n"
  f.print "$(_TECS_OBJ_DIR)%.o : %.#{$c_suffix}\n"
  f.print "	$(CC) -c $(CFLAGS) -o $@ $<\n\n"

  lines = TECSGEN::Makefile.get_lines
  if lines.length > 0
    f.print("# additional lines\n")
    lines.each{|line|
      f.print line, "\n"
    }
    f.print("# end additional lines\n\n")
  end

  f.close
end

#gen_XML(file, nest) ⇒ Object



65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
# File 'lib/tecsgen/core/gen_xml.rb', line 65

def gen_XML(file, nest)
  # signature のコードを生成
  @signature_list.each {|s|
    s.gen_XML file, nest
  }

  # celltype のコードを生成
  @celltype_list.each {|t|
    t.gen_XML(file, nest)
  }

  # composite のコードを生成
  @compositecelltype_list.each {|t|
    t.gen_XML(file, nest)
  }

  # cell のコードを生成
  @cell_list.each {|t|
    t.gen_XML(file, nest)
  }

  # サブネームスペースのコードを生成
  @namespace_list.each {|n|
    kind = n.instance_of?(Namespace) ? "namespace" : "region"
    file.print <<EOT
#{XML_INDENT * nest}<#{kind}>
#{XML_INDENT * (nest + 1)}<name> #{n.get_name} </name>
EOT
    n.gen_XML(file, nest + 1)
    file.print <<EOT
#{XML_INDENT * nest}</#{kind}>
EOT
  }
end

#generateObject



123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
# File 'lib/tecsgen/core/generate.rb', line 123

def generate
  begin
    # root namespace ならば makefile を出力する(全セルタイプに関わるものだけ)
    # 先に出力する
    if @name == "::"

      gen_makefile_template
      gen_makefile_tecsgen
      if $generating_region.get_n_cells == 0
        dbgPrint "only makefile_template #{@name}\n"
        return
      end
      if instance_of? Region
        @@domain_gen_factory_list = {} # create hash
      end
    end

    dbgPrint "generating region: #{$generating_region.get_name} namespace=#{@name} gen_dir=#{$gen}\n"
    # global_tecsgen.h (typedef, struct, const) の生成
    gen_global_header

    if (instance_of? Region) && !get_domain_type.nil?
      # p "*******************  domain_type: #{get_domain_type.get_name}  ****************"
      domain_type = get_domain_type
      if @@domain_gen_factory_list[domain_type].nil?
        @@domain_gen_factory_list[domain_type] = self
        domain_type.gen_factory
      end
    end

    # signature のコードを生成
    @signature_list.each {|s|
      s.generate
    }

    # celltype のコードを生成
    @celltype_list.each {|t|
      t.generate
    }

    # サブネームスペースのコードを生成
    @namespace_list.each {|n|
      n.generate
    }

  rescue => evar
    # もしスタックトレースが出るまでい時間がかかるようならば、次をコメントアウトしてみるべし
    cdl_error("H1001 tecsgen: fatal internal error during code generation")
    print_exception(evar)
  end
end

#generate_postObject



175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
# File 'lib/tecsgen/core/generate.rb', line 175

def generate_post
  if $generating_region.get_n_cells == 0
    return
  end

  begin
    # global_tecsgen.h (typedef, struct, const) の終わりのガードコード生成
    gen_global_header_post

    # signature のコードを生成
    @signature_list.each {|s|
      s.generate_post
    }

    # celltype のコードを生成
    @celltype_list.each {|t|
      t.generate_post
    }

    # サブネームスペースのコードを生成
    @namespace_list.each {|n|
      n.generate_post
    }

  rescue => evar
    cdl_error("H1002 tecsgen: fatal internal error during post code generation")
    print_exception(evar)
  end
end

#get_global_nameObject



4695
4696
4697
# File 'lib/tecsgen/core/componentobj.rb', line 4695

def get_global_name
  @global_name
end

#get_n_cellsObject

Namespace#セルの個数を得る

子 region が linkunit, node 指定されていれば、含めない(別のリンク単位)プロトタイプ宣言のもののみの個数を含めないmikan namespace 下に cell を置けない仕様になると、このメソッドは Region のものでよいmikan 上記の場合 instance_of? Namespace の条件判定は不要となる



4704
4705
4706
4707
4708
4709
4710
4711
4712
4713
4714
4715
4716
4717
4718
4719
4720
4721
4722
4723
4724
4725
4726
4727
4728
4729
4730
4731
4732
4733
4734
4735
4736
4737
# File 'lib/tecsgen/core/componentobj.rb', line 4704

def get_n_cells
  if @cache_generating_region == $generating_region
    # このメソッドは繰り返し呼び出されるため、結果をキャッシュする
    return @cache_n_cells
  end

  count = 0
  @cell_list.each{|c|
    # 定義かプロトタイプ宣言だけかは、new_cell の段階で判断できないため、カウントしなおす
    if c.get_f_def == true
      # print "get_n_cells: cell: #{c.get_name}\n"
      count += 1
    end
  }

  @namespace_list.each{|ns|
    if ns.instance_of? Namespace
      count += ns.get_n_cells
    else
      # ns は Region である
      rt = ns.get_region_type
      # print "get_n_cells: region: #{ns.get_name}: #{rt}\n"
      if rt == :NODE || rt == :LINKUNIT
        # 別の linkunit なので加算しない
      else
        count += ns.get_n_cells
      end
    end
  }

  @cache_generating_region = $generating_region
  @cache_n_cells = count
  return count
end

#get_nameObject



4673
4674
4675
# File 'lib/tecsgen/core/componentobj.rb', line 4673

def get_name
  @name
end

#is_root?Boolean

Namespace# ルートか?

ルートネームスペース と ルートリージョンは同じ

Returns:

  • (Boolean)


5114
5115
5116
# File 'lib/tecsgen/core/componentobj.rb', line 5114

def is_root?
  @name == "::"
end

#is_typename?(str) ⇒ Boolean

Returns:

  • (Boolean)


5014
5015
5016
5017
5018
5019
5020
# File 'lib/tecsgen/core/componentobj.rb', line 5014

def is_typename?(str)
  if @name_list.get_item(str).instance_of?(Typedef)
    true
  else
    false
  end
end

#new_cell(cell) ⇒ Object



4901
4902
4903
4904
4905
4906
4907
4908
4909
# File 'lib/tecsgen/core/componentobj.rb', line 4901

def new_cell(cell)
  dbgPrint "Namespace.new_cell: #{@NamespacePath.get_path_str}::#{cell.get_name}\n"
  if !is_root? && !(instance_of? Region)
    cdl_error("S9999 '$1' cell cannot be placed under namespace", cell.get_name)
  end
  cell.set_owner self # Cell (Namespace)
  @name_list.add_item(cell)
  @cell_list << cell
end

#new_celltype(celltype) ⇒ Object



4879
4880
4881
4882
4883
# File 'lib/tecsgen/core/componentobj.rb', line 4879

def new_celltype(celltype)
  celltype.set_owner self # Celltype (Namespace)
  @name_list.add_item(celltype)
  @celltype_list << celltype
end

#new_compositecelltype(compositecelltype) ⇒ Object



4890
4891
4892
4893
4894
# File 'lib/tecsgen/core/componentobj.rb', line 4890

def new_compositecelltype(compositecelltype)
  compositecelltype.set_owner self # CompositeCelltype (Namespace)
  @name_list.add_item(compositecelltype)
  @compositecelltype_list << compositecelltype
end

#new_const_decl(decl) ⇒ Object



5027
5028
5029
5030
5031
5032
5033
5034
5035
5036
5037
5038
5039
5040
5041
5042
5043
5044
5045
5046
5047
5048
5049
# File 'lib/tecsgen/core/componentobj.rb', line 5027

def new_const_decl(decl)
  decl.set_owner self # Decl (Namespace:const)
  if !decl.is_const? # const 修飾さていること
    if decl.is_type?(PtrType)
      cdl_error("S1094 $1: pointer is not constant. check \'const\'", decl.get_name)
    else
      cdl_error("S1095 $1: not constant", decl.get_name)
    end
  elsif !decl.is_type?(IntType) && !decl.is_type?(FloatType) &&
      !decl.is_type?(BoolType) && !decl.is_type?(PtrType)
                                          # IntType, FloatType であること
    cdl_error("S1096 $1: should be int, float, bool or pointer type", decl.get_name)
  elsif decl.get_initializer.nil? # 初期値を持つこと
    cdl_error("S1097 $1: has no initializer", decl.get_name)
#    elsif decl.get_initializer.eval_const(nil) == nil then  #eval_const は check_init で呼出されるので二重チェック
#                                            # mikan 初期値が型に対し適切であること
#      cdl_error( "S1098 $1: has unsuitable initializer" , decl.get_name )
  else
    decl.get_type.check_init(@locale, decl.get_name, decl.get_initializer, :CONSTANT)
    @name_list.add_item(decl)
    @const_decl_list << decl
  end
end

#new_namespace(namespace) ⇒ Object



4855
4856
4857
4858
4859
4860
4861
# File 'lib/tecsgen/core/componentobj.rb', line 4855

def new_namespace(namespace)
  dbgPrint "new_namespace: #{@name}:#{self} #{namespace.get_name}:#{namespace} \n"
  namespace.set_owner self # Namespace (Namespace)

  @name_list.add_item(namespace)
  @namespace_list << namespace
end

#new_signature(signature) ⇒ Object



4868
4869
4870
4871
4872
# File 'lib/tecsgen/core/componentobj.rb', line 4868

def new_signature(signature)
  signature.set_owner self # Signature (Namespace)
  @name_list.add_item(signature)
  @signature_list << signature
end

#new_structtype(struct) ⇒ Object



4954
4955
4956
4957
4958
4959
4960
4961
4962
4963
4964
4965
4966
4967
# File 'lib/tecsgen/core/componentobj.rb', line 4954

def new_structtype(struct)
  # struct.set_owner self   # StructType (Namespace) # StructType は BDNode ではない
  dup = @struct_tag_list.get_item(struct.get_name)
  if !dup.nil?
    if struct.same? dup
      # 同じものが typedef された
      # p "#{struct.get_name}"
      return
    end
  end

  @struct_tag_list.add_item(struct)
  @decl_list << struct
end

#new_typedef(typedef) ⇒ Object



4974
4975
4976
4977
4978
4979
4980
4981
4982
4983
4984
4985
4986
4987
4988
4989
4990
4991
4992
4993
4994
4995
4996
4997
4998
4999
5000
5001
# File 'lib/tecsgen/core/componentobj.rb', line 4974

def new_typedef(typedef)
  typedef.set_owner self # TypeDef (Namespace)
  dup = @name_list.get_item(typedef.get_name)
  if !dup.nil?
    typedef_type = typedef.get_declarator.get_type.get_original_type
    dup_type = dup.get_declarator.get_type.get_original_type
    # print "typedef: #{typedef.get_name} = #{typedef_type.get_type_str} #{typedef_type.get_type_str_post}\n"
    if typedef_type.get_type_str == dup_type.get_type_str &&
        typedef_type.get_type_str_post == dup_type.get_type_str_post
      # 同じものが typedef された
      # ここへ来るのは C で関数ポインタを typedef しているケース
      # 以下のように二重に定義されている場合は type_specifier_qualifier_list として扱われる
      #    typedef long LONG;
      #    typedef long LONG;
      # bnf.y.rb では declarator に TYPE_NAME を許さないので、ここへ来ることはない
      # p "#{typedef.get_declarator.get_type.get_type_str} #{typedef.get_name} #{typedef.get_declarator.get_type.get_type_str_post}"
      return
    end
    # p "prev: #{dup.get_declarator.get_type.get_type_str}#{dup.get_declarator.get_type.get_type_str_post} current:#{typedef.get_declarator.get_type.get_type_str} #{typedef.get_declarator.get_type.get_type_str_post}"
  end

  # p "typedef: #{typedef.get_name}  #{typedef.get_declarator.get_type.get_original_type.get_type_str}#{typedef.get_declarator.get_type.get_original_type.get_type_str_post}"
  # typedef.show_tree 0

  @name_list.add_item(typedef)
  @typedef_list << typedef
  @decl_list << typedef
end

#optimizeObject



64
65
66
67
68
69
70
71
72
73
74
# File 'lib/tecsgen/core/optimize.rb', line 64

def optimize
  # celltype の最適化
  @celltype_list.each {|t|
    t.optimize
  }

  # サブネームスペースの最適化
  @namespace_list.each {|n|
    n.optimize
  }
end

#popObject



4610
4611
4612
4613
4614
4615
4616
# File 'lib/tecsgen/core/componentobj.rb', line 4610

def pop
  dbgPrint "Namespace.POP #{@@namespace_sp} #{@name}\n"
  @@namespace_sp -= 1
  if @@namespace_sp < 0
    raise "StackUnderflow"
  end
end

print_all_cells

print all call flow beginning with active cell’s call port function



75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
# File 'lib/tecsflow.rb', line 75

def print_all_cells
  # for each active cell
	@cell_list.each{|cell|
		celltype = cell.get_celltype
		call_funcs = {}
		if celltype.is_active? then
			if ! celltype.kind_of? CompositeCelltype then
  		print "[active cell] #{cell.get_namespace_path}\n"
  		cell.get_join_list.get_items.each{ |j|
  			if j.get_definition.kind_of? Port then
  				port = j.get_definition
	  			port.get_signature.get_function_head_array.each{ |f|
	  			  func_name = "->#{port.get_name}.#{f.get_name}__T".to_sym
	  			  call_funcs[ func_name ] = false
  				}
  			end
  		}
        # isn't the call port function called from entry port function ?
        #  if called, it's not actually active (task main, handler main is not called from entry function)
				celltype.get_port_list.each{ |ep|
					if ep.get_port_type == :ENTRY then
						ep.get_signature.get_function_head_array.each{ |f|
							ep_func = "#{celltype.get_global_name}_#{ep.get_name}_#{f.get_name}".to_sym
 						if $tcflow_funclist[ ep_func ] then
 							$tcflow_funclist[ ep_func ].get_call_funcs.each{ |cf, cff|
                  if call_funcs[cf] == false then
                    # printf "#{ep_func} calls #{cf}\n"
                    call_funcs[cf] = true
                  end
 							}
 						else
 							print "ep_func #{ep_func} not found. why not defined ?\n"
 						end
						}
					end
				}
        call_funcs.each{ |call_func_name, v|
          if v == false then   # not called from entry port func
            # print " #{f} \n"
            # decompose
            indent_level = 1
            no_caller_cell = true
            cell.print_call_func_flow no_caller_cell, call_func_name, indent_level
          end
        }
  	end
 	end
	}
	@namespace_list.each{|ns|
		ns.print_all_cells
	}
	if false then
		$tcflow_funclist.each{|name, func|
			print name, "\n"
			if func.kind_of? TCFlow::Function then
 			func.get_call_funcs.each{ |cname,cfunc|
					print "  -> ", cname, "\n"
				}
			end
		}
	end
end


185
186
187
188
189
190
191
192
193
194
195
196
# File 'lib/tecsgen/core/tecsinfo.rb', line 185

def print_call_define(f)
  @celltype_list.each {|ct|
    if ct.get_cell_list.length > 0
      ct.print_call_define f
    end
  }
  @namespace_list.each {|ns|
    if ns.instance_of? Namespace   # region を含めない
      ns.print_call_define f
    end
  }
end


172
173
174
175
176
177
178
179
180
181
182
183
# File 'lib/tecsgen/core/tecsinfo.rb', line 172

def print_celltype_define(f)
  @celltype_list.each {|ct|
    if ct.get_cell_list.length > 0
      ct.print_celltype_define f
    end
  }
  @namespace_list.each {|ns|
    if ns.instance_of? Namespace   # region を含めない
      ns.print_celltype_define f
    end
  }
end


159
160
161
162
163
164
165
166
167
168
169
170
# File 'lib/tecsgen/core/tecsinfo.rb', line 159

def print_celltype_define_offset(f)
  @celltype_list.each {|ct|
    if ct.get_cell_list.length > 0
      ct.print_define_offset f
    end
  }
  @namespace_list.each {|ns|
    if ns.instance_of? Namespace   # region を含めない
      ns.print_celltype_define_offset f
    end
  }
end

#print_entry_define(f) ⇒ Object



198
199
200
201
202
203
204
205
206
207
208
209
# File 'lib/tecsgen/core/tecsinfo.rb', line 198

def print_entry_define(f)
  @celltype_list.each {|ct|
    if ct.get_cell_list.length > 0
      ct.print_entry_define f
    end
  }
  @namespace_list.each {|ns|
    if ns.instance_of? Namespace   # region を含めない
      ns.print_entry_define f
    end
  }
end


121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
# File 'lib/tecsgen/core/tecsinfo.rb', line 121

def print_info_ns(f, indent)
  # p "print_info: #{self.get_global_name}"
  print_info_ns_sub f, indent
  @signature_list.each {|sig|
    sig.print_info f, indent
  }
  @celltype_list.each {|ct|
    if ct.get_cell_list.length > 0
      ct.print_info f, indent
    end
  }
  @namespace_list.each {|ns|
    if ns.instance_of? Namespace # region を含めない
      ns.print_info_ns f, indent
    end
  }
end

RootRegion と LinkRegion は同じ Region クラスのオブジェクトである子ネームスペースは Namespace クラスの、子リージョンは Region クラスのオブジェクトであるこれは、意味解析段階で呼び出されるため、リンクユニットごとに出しわけることができない出しわけるには、2パスにする必要がある



77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
# File 'lib/tecsgen/core/tecsinfo.rb', line 77

def print_info_ns_sub(f, indent)
  if @name == "::"
    name = "_Root"
  else
    name = @global_name
  end
  f.print "\n#{indent}/*** #{get_namespace_path} namespace information cell ***/\n"
  f.print <<EOT
#{indent}cell nTECSInfo::tNamespaceInfo #{name}NamespaceInfo{
#{indent}    name = "#{@name}";
EOT
  if @signature_list.length > 0
    f.print "\n#{indent}    /* SIGNATURE info */\n"
  end
  @signature_list.each{|sig|
    f.print <<EOT
#{indent}    cSignatureInfo[] = #{sig.get_global_name}SignatureInfo.eSignatureInfo;
EOT
  }
  if @celltype_list.length > 0
    f.print "\n#{indent}    /* CELLTYPE info */\n"
  end
  @celltype_list.each{|ct|
    if ct.get_cell_list.length > 0
      f.print <<EOT
#{indent}    cCelltypeInfo[] = #{ct.get_global_name}CelltypeInfo.eCelltypeInfo;
EOT
    end
  }
  if @namespace_list.length > 0
    f.print "\n#{indent}    /* NAMESPACE info */\n"
  end
  @namespace_list.each{|ns|
    if ns.instance_of? Namespace
      f.print <<EOT
#{indent}    cNamespaceInfo[] = #{ns.get_global_name}NamespaceInfo.eNamespaceInfo;
EOT
    end
  }
  f.print <<EOT
#{indent}};   /* cell nTECSInfo::tNamespaceInfo #{name}NamespaceInfo */
EOT
end

Namespace# 構造体メンバーのオフセット定義



144
145
146
147
148
149
150
151
152
153
154
155
156
157
# File 'lib/tecsgen/core/tecsinfo.rb', line 144

def print_struct_define(f)
  f.print "\n/***** Offset of members of structures  *****/\n"
  @struct_tag_list.get_items.each{|tag, sttype|
    # print "sttype: #{tag.get_name} #{sttype}\n"
    tag.get_members_decl.get_items.each{|decl|
      f.printf "#define OFFSET_OF_%-30s  (%s)\n",
               "#{tag.get_ID_str}_#{decl.get_name}",
               "(uint32_t)(intptr_t)&(((#{tag.get_type_str}#{tag.get_type_str_post}*)0)->#{decl.get_name})"
      f.printf "#define PLACE_OF_%-30s  (%s)\n",
               "#{tag.get_ID_str}_#{decl.get_name}",
               "VARDECL_PLACE_STRUCT"
    }
  }
end

#push(ns) ⇒ Object

namespace 階層用スタックの push, pop (インスタンスメソッド)



4604
4605
4606
4607
4608
# File 'lib/tecsgen/core/componentobj.rb', line 4604

def push(ns)
  @@namespace_sp += 1
  @@namespace_stack[@@namespace_sp] = self
  dbgPrint "Namespace.PUSH #{@@namespace_sp} #{@name}\n"
end

#reset_optimizeObject



76
77
78
79
80
81
82
83
84
85
86
# File 'lib/tecsgen/core/optimize.rb', line 76

def reset_optimize
  # celltype の最適化
  @celltype_list.each {|t|
    t.reset_optimize
  }

  # サブネームスペースの最適化
  @namespace_list.each {|n|
    n.reset_optimize
  }
end

#set_cell_id_and_domainObject

各セルに ID (整数値)を割付ける



52
53
54
55
56
57
58
59
60
61
62
# File 'lib/tecsgen/core/optimize.rb', line 52

def set_cell_id_and_domain
  # celltype の各セルに ID を割付ける
  @celltype_list.each {|t|
    t.set_cell_id_and_domain
  }

  # サブネームスペースの各セルに ID を割付ける
  @namespace_list.each {|n|
    n.set_cell_id_and_domain
  }
end

#set_definition_joinObject

Namespace# Join への definition の設定とチェック

セルタイプに属するすべてのセルに対して実施



5077
5078
5079
5080
5081
5082
5083
5084
5085
5086
# File 'lib/tecsgen/core/componentobj.rb', line 5077

def set_definition_join
  # celltype のコードを生成
  @cell_list.each {|c|
    dbgPrint "set_definition_join #{c.get_name}\n"
    c.set_definition_join
  }
  @namespace_list.each{|ns|
    ns.set_definition_join
  }
end

#set_max_entry_port_inner_cellObject

Namespace# set_max_entry_port_inner_cell

セルタイプに属するすべてのセルに対して実施



5090
5091
5092
5093
5094
5095
5096
5097
5098
# File 'lib/tecsgen/core/componentobj.rb', line 5090

def set_max_entry_port_inner_cell
  # celltype のコードを生成
  @cell_list.each {|c|
    c.set_max_entry_port_inner_cell
  }
  @namespace_list.each{|ns|
    ns.set_max_entry_port_inner_cell
  }
end

#set_port_reference_countObject

Namespace# セルの受け口の参照カウントを設定する



4940
4941
4942
4943
4944
4945
4946
4947
# File 'lib/tecsgen/core/componentobj.rb', line 4940

def set_port_reference_count
  @cell_list.each {|c|
    c.set_port_reference_count
  }
  @namespace_list.each {|n|
    n.set_port_reference_count
  }
end

#set_require_joinObject

Namespace# すべてのセルの require ポートを設定

STAGE: S



5065
5066
5067
5068
5069
5070
5071
5072
5073
# File 'lib/tecsgen/core/componentobj.rb', line 5065

def set_require_join
  @celltype_list.each{|ct|
    ct.set_require_join
  }
  # すべての namespace について require ポートをセット
  @namespace_list.each{|ns|
    ns.set_require_join
  }
end

#show_tree(indent) ⇒ Object



5124
5125
5126
5127
5128
5129
# File 'lib/tecsgen/core/componentobj.rb', line 5124

def show_tree(indent)
  indent.times { print "  " }
  puts "#{self.class}: name: #{@name} path: #{get_namespace_path.get_path_str}"
  @struct_tag_list.show_tree(indent + 1)
  @name_list.show_tree(indent + 1)
end

#travers_all_celltypeObject

Namespace#すべてのセルタイプをたどる



924
925
926
927
928
929
930
931
932
# File 'lib/tecsgen/core/generate.rb', line 924

def travers_all_celltype # ブロック引数 { |celltype|  }
  proc = Proc.new # このメソッドのブロック引数
  @celltype_list.each{|ct|
    proc.call ct
  }
  @namespace_list.each{|ns|
    ns.travers_all_celltype_proc proc
  }
end

#travers_all_celltype_proc(proc) ⇒ Object



934
935
936
937
938
939
940
941
# File 'lib/tecsgen/core/generate.rb', line 934

def travers_all_celltype_proc(proc)
  @celltype_list.each{|ct|
    proc.call ct
  }
  @namespace_list.each{|ns|
    ns.travers_all_celltype_proc proc
  }
end

#travers_all_signatureObject

Namespace#すべてのシグニチャをたどる



904
905
906
907
908
909
910
911
912
# File 'lib/tecsgen/core/generate.rb', line 904

def travers_all_signature # ブロック引数 { |signature|  }
  proc = Proc.new # このメソッドのブロック引数
  @signature_list.each{|sig|
    proc.call sig
  }
  @namespace_list.each{|ns|
    ns.travers_all_signature_proc proc
  }
end

#travers_all_signature_proc(proc) ⇒ Object



914
915
916
917
918
919
920
921
# File 'lib/tecsgen/core/generate.rb', line 914

def travers_all_signature_proc(proc)
  @signature_list.each{|sig|
    proc.call sig
  }
  @namespace_list.each{|ns|
    ns.travers_all_signature_proc proc
  }
end

#unjoin_pluginObject



127
128
129
130
131
132
# File 'lib/tecsgen/core/unjoin_plugin.rb', line 127

def unjoin_plugin
  @signature_list.each{ |sig| sig.unjoin_plugin }
  @celltype_list.each{ |ct| ct.unjoin_plugin }
  @cell_list.each{ |cell| cell.unjoin_plugin }
  @namespace_list.each{ |ns| ns.unjoin_plugin}
end