Ignore:
Timestamp:
Apr 5, 2019, 9:26:53 PM (5 years ago)
Author:
coas-nagasima
Message:

mbed関連を更新
シリアルドライバをmbedのHALを使うよう変更
ファイルディスクリプタの処理を更新

File:
1 edited

Legend:

Unmodified
Added
Removed
  • asp3_tinet_ecnl_arm/trunk/asp3_dcre/tecsgen/tecslib/core/generate.rb

    r352 r374  
    44#      Generator for TOPPERS Embedded Component System
    55
    6 #   Copyright (C) 2008-2017 by TOPPERS Project
     6#   Copyright (C) 2008-2019 by TOPPERS Project
    77#--
    88#   上記著作権者は,以下の(1)~(4)の条件を満たす場合に限り,本ソフトウェ
     
    122122
    123123class Namespace
     124  @@domain_gen_factory_list = nil
    124125  def generate
    125126
     
    135136          return
    136137        end
     138        if instance_of? Region then
     139          @@domain_gen_factory_list = {}   # create hash
     140        end
    137141      end
    138142
     
    141145      gen_global_header
    142146
     147      if ( instance_of? Region ) && get_domain_type != nil then
     148        # p "*******************  domain_type: #{get_domain_type.get_name}  ****************"
     149        domain_type = get_domain_type
     150        if @@domain_gen_factory_list[ domain_type ] == nil then
     151          @@domain_gen_factory_list[ domain_type ] = self
     152          domain_type.gen_factory
     153        end
     154      end
     155     
    143156      # signature のコードを生成
    144157      @signature_list.each { |s|
     
    455468      }
    456469    end
    457         f.print "       rm -f $(CELLTYPE_COBJS) $(TECSGEN_COBJS) $(PLUGIN_COBJS) $(OTHER_OBJS) $(TARGET) #{timestamp}\n"
     470          f.print "     rm -f $(CELLTYPE_COBJS) $(TECSGEN_COBJS) $(PLUGIN_COBJS) $(OTHER_OBJS) $(TARGET) #{timestamp}\n"
    458471    if $generating_region == @@root_namespace then
    459472      f.print " rm -rf $(GEN_DIR)\n"
     
    465478      f.print "tecs : $(PRE_TECSGEN_TARGET) $(TIMESTAMP) $(POST_TECSGEN_TARGET)\n\n"
    466479      f.print "$(TIMESTAMP) : $(TECS_IMPORTS)\n"
    467       f.print " $(TECSGEN) #{TECSGEN.subst_tecspath( $arguments, true )}\n"
     480      f.print " $(TECSGEN) #{TECSGEN.subst_tecspath( $arguments, true )}\n\n"
    468481      # f.print "       touch $(TIMESTAMP)\n\n"
    469 
    470482    else
    471483      f.print "tecs:\n"
     
    473485    end
    474486
     487    # tecsflow:, tcflow ターゲット
     488    if $generating_region.get_n_cells != 0 || $generating_region == @@root_namespace then
     489      f.print "#####  TECSFlow targets  #####\n"
     490    end
     491
     492    if Region.get_link_roots.length > 1 && $generating_region == @@root_namespace then
     493      tecsflow_target = "tecsflow_sub"
     494      if $generating_region.get_n_cells > 0 then
     495        f.print "tecsflow: tecs tecsflow_sub\n"
     496      else
     497        f.print "tecsflow:\n"
     498      end
     499      Region.get_link_roots.each {|region|
     500        if region.get_n_cells > 0 then
     501          f.print "\tcd #{region.get_global_name}; make tecsflow\n"
     502        end
     503      }
     504      f.print "\n"
     505    else
     506      tecsflow_target = "tecsflow"
     507    end
     508
     509    if $generating_region.get_n_cells != 0 then
     510      f.print "#{tecsflow_target} : $(GEN_DIR)/tecsgen.rbdmp tcflow\n"
     511      f.print "\ttecsflow -g $(GEN_DIR)\n\n"
     512      f.print "tecsflow_u : $(GEN_DIR)/tecsgen.rbdmp tcflow\n"
     513      f.print "\ttecsflow -g $(GEN_DIR) -U\n\n"
     514      f.print "$(GEN_DIR)/tecsgen.rbdmp : tecs\n\n"
     515      f.print "tcflow : tecs\n"
     516      f.print "\tmake tcflow_exec\n\n"
     517      f.print "tcflow_exec : $(GEN_DIR)/tcflow.rbdmp\n"
     518      f.print "$(GEN_DIR)/tcflow.rbdmp : $(CELLTYPE_SRCS) $(PLUGIN_CELLTYPE_SRCS)\n"
     519      f.print "\ttcflow -g $(GEN_DIR) -c '$(CC) -E -DTECSFLOW -DTECSGEN $(CFLAGS) -I ./' $^\n"
     520    end
     521
     522    if $generating_region.get_n_cells != 0 || $generating_region == @@root_namespace then
     523      f.print "#####  end TECSFlow targets  #####\n\n"
     524    end
     525
     526    # generic %.o : %.c
    475527    f.print "# generic target for objs\n"
    476528    f.print "$(_TECS_OBJ_DIR)%.o : %.#{$c_suffix}\n"
     
    492544    ### Makefile.tecsgen の生成
    493545    f = AppFile.open( "#{$gen}/Makefile.tecsgen" )
     546
     547    f.print <<EOT
     548# generated automatically by tecsgen.
     549# This file is not intended to modify.
     550#
     551# Makefile variables below are defined.
     552#  TECS_IMPORT_CDLS          .cdl files improted by import statement
     553#  SIGNATURE_HEADERS         .h files of signature
     554#  CELLTYPE_TECSGEN_HEADERS  .h files of celltype
     555#  CELLTYPE_FACTORY_HEADERS  .h files of celltype's factory
     556#  TECS_HEADERS              summary of .h files above
     557#  TECS_INLINE_HEADERS       .h files of celltype inline header
     558#  PLUGIN_INLINE_HEADERS     .h files of plugin generated inline header
     559#
     560#  TECS_COBJS                .o files of TECS
     561#                            = $(TECSGEN_COBJS)+$(PLUGIN_COBJS)+$(CELLTYPE_COBJS)
     562#                            = $(TECS_KERNEL_COBJS)+$(TECS_KERNEL_COBJS)+$(TECS_OUTOFDOMAIN_COBJS)
     563#                            = $(TECSGEN_domain_COBJS)+$(PLUGIN_domain_COBJS)+$(CELLTYPE_domain_COBJS) for each domain
     564#
     565#  TECSGEN_COBJS             .o files of celltype_tecsgen.c
     566#  CELLTYPE_COBJS            .o files of celltype.c (celltype code)
     567#  PLUGIN_COBJS              .o files of plugin generated .c files
     568#
     569#  TECSGEN_SRCS              .c files of celltype_tecsgen.c
     570#  CELLTYPE_SRCS             .c files of celltype.c (celltype code)
     571#  PLUGIN_SRCS               .c files of plugin generated
     572#  PLUGIN_CELLTYPE_SRCS      .c files of plugin generated celltype.c (celltype code)
     573#  PLUGIN_TECSGEN_SRCS       .c files of plugin generated celltype_tecsgen.c
     574#
     575# Variables for domain
     576#  TECS_DOMAINS             domain names
     577#  TECS_KERNEL_COBJS        .o files of kernel domain (tecsgen, celltype, plugin)
     578#  TECS_USER_COBJS          .o files of user domain (tecsgen, celltype, plugin)
     579#  TECS_OUTOFDOMAIN_COBJS   .o files of OutOfDomain (tecsgen, celltype, plugin)
     580#  TECSGEN_domain_COBJS     .o files of celltype_tecsgen.c files for each domain
     581#  PLUGIN_domain_COBJS      .o files of plugin generated .c files for each domain
     582#  CELLTYPE_domain_COBJS    .o files of celltype.c files for each domain
     583#  TECSGEN_domain_SRCS      .c files of celltype_domain_tecsgen.c
     584#  PLUGIN_domain_SRCS       .c files of plugin generated .c files for each domain
     585#  CELLTYPE_domain_SRCS     .c files of celltype.c files for each domain
     586
     587EOT
    494588
    495589    f.print( "TECS_IMPORT_CDLS =" )
     
    546640    DomainType.get_domain_regions.each{ |dt, regions|
    547641      # domain_type は一つのノードには、一つしかないので、このループは、必ず一回しか回らない
     642        ###   mikan 複数のノードがあり、異なる domain_type が指定される可能性はある
    548643      domain_regions = regions
    549644      domain_type = dt
     
    588683      f.print( "\n\n" )
    589684
    590       f.print( "# TECS_COBJS: objects from sources which are automatically generated by tecsgen\n" )
     685      f.print( "# TECS_KERNEL_COBJS: objects belong to kernel domain\n" )
     686      f.print( "TECS_KERNEL_COBJS = \\\n" )
     687      domain_regions.each{ |r|
     688        if r.get_domain_type.get_kind == :kernel then
     689          f.print( "    $(TECSGEN#{decideDomainNameProc.call r}_COBJS) \\\n" )
     690          f.print( "    $(PLUGIN#{decideDomainNameProc.call r}_COBJS) \\\n" )
     691          f.print( "    $(CELLTYPE#{decideDomainNameProc.call r}_COBJS) \\\n" )
     692        end
     693      }
     694      f.print( "# TECS_KERNEL_COBJS terminator\n\n" )
     695
     696      f.print( "# TECS_USER_COBJS: objects belong to user domain\n" )
     697      f.print( "TECS_USER_COBJS = \\\n" )
     698      domain_regions.each{ |r|
     699        if r.get_domain_type.get_kind == :user then
     700          f.print( "    $(TECSGEN#{decideDomainNameProc.call r}_COBJS) \\\n" )
     701          f.print( "    $(PLUGIN#{decideDomainNameProc.call r}_COBJS) \\\n" )
     702          f.print( "    $(CELLTYPE#{decideDomainNameProc.call r}_COBJS) \\\n" )
     703        end
     704      }
     705      f.print( "# TECS_USER_COBJS terminator\n\n" )
     706
     707      f.print( "# TECS_OUTOFDOMAIN_COBJS: objects belong to OutOfDomain\n" )
     708      f.print( "TECS_OUTOFDOMAIN_COBJS = \\\n" )
     709      domain_regions.each{ |r|
     710        if r.get_domain_type.get_kind == :OutOfDomain then
     711          f.print( "    $(TECSGEN#{decideDomainNameProc.call r}_COBJS) \\\n" )
     712          f.print( "    $(PLUGIN#{decideDomainNameProc.call r}_COBJS) \\\n" )
     713          f.print( "    $(CELLTYPE#{decideDomainNameProc.call r}_COBJS) \\\n" )
     714        end
     715      }
     716      f.print( "# TECS_OUTOFDOMAIN_COBJS terminator\n\n" )
     717     
     718      f.print( "# TECSGEN_COBJS: objects from sources which are automatically generated by tecsgen\n" )
    591719      f.print( "TECSGEN_COBJS = \\\n" )
    592720      domain_regions.each{ |r|
     
    622750
    623751    ###
    624     f.print( "# TECS_COBJS: objects from sources which are automatically generated by tecsgen\n" )
     752    f.print( "# TECSGEN_COBJS: objects from sources which are automatically generated by tecsgen\n" )
    625753    domain_regions.each{ |r|
    626754      nsp = decideDomainNameProc.call( r )
     
    656784
    657785    f.print( "# PLUGIN_SRCS: sources automatically generated by plugin\n" )
     786    f.print( "PLUGIN_CELLTYPE_SRCS = \\\n" )
    658787    domain_regions.each{ |r|
    659788      nsp = decideDomainNameProc.call( r )
    660       f.print( "PLUGIN#{nsp}_SRCS = \\\n" )
    661       gen_celltype_names_domain( f, "   $(GEN_DIR)/", "_tecsgen.#{$c_suffix} \\\n", domain_type, r, true )
    662       gen_celltype_names_domain2( f, "  $(GEN_DIR)/", ".#{$c_suffix} \\\n", domain_type, r, true, false )
    663       f.print( "# PLUGIN#{nsp}_SRCS terminator\n\n" )
    664     }
    665 
     789      f.print( "  $(PLUGIN#{nsp}_CELLTYPE_SRCS)\\\n" )
     790    }
     791    f.print( "# PLUGIN_CELLTYPE_SRCS terminator\n\n" )
     792    f.print( "PLUGIN_TECSGEN_SRCS = \\\n" )
     793    domain_regions.each{ |r|
     794      nsp = decideDomainNameProc.call( r )
     795      f.print( "  $(PLUGIN#{nsp}_TECSGEN_SRCS)\\\n" )
     796    }
     797    f.print( "# PLUGIN_TECSGEN_SRCS terminator\n\n" )
     798    domain_regions.each{ |r|
     799      nsp = decideDomainNameProc.call( r )
     800      f.print( "PLUGIN#{nsp}_SRCS = $(PLUGIN#{nsp}_CELLTYPE_SRCS) $(PLUGIN#{nsp}_TECSGEN_SRCS)\n\n" )
     801      f.print( "PLUGIN#{nsp}_CELLTYPE_SRCS = \\\n" )
     802      gen_celltype_names_domain2( f, "", ".#{$c_suffix} \\\n", domain_type, r, true, false )
     803      f.print( "# PLUGIN#{nsp}_CELLTYPE_SRCS terminator\n\n" )
     804      nsp = decideDomainNameProc.call( r )
     805      f.print( "PLUGIN#{nsp}_TECSGEN_SRCS = \\\n" )
     806      gen_celltype_names_domain( f, "", "_tecsgen.#{$c_suffix} \\\n", domain_type, r, true )
     807      f.print( "# PLUGIN#{nsp}_TECSGEN_SRCS terminator\n\n" )
     808    }
     809
     810    f.print( "# CELLTYPE_SRCS: sources of celltype code written by user\n" )
     811     f.print( "CELLTYPE_SRCS = \\\n" )
     812     gen_celltype_names( f, "   ", ".#{$c_suffix} \\\n", false, false )
     813      f.print( "# CELLTYPE_SRCS terminator\n\n" )
    666814    f.close
    667815
     
    779927    @namespace_list.each{ |ns|
    780928      ns.travers_all_signature_proc proc
     929    }
     930  end
     931
     932  #=== Namespace#すべてのセルタイプをたどる
     933  def travers_all_celltype # ブロック引数 { |celltype|  }
     934    proc = Proc.new    # このメソッドのブロック引数
     935    @celltype_list.each{ |ct|
     936      proc.call ct
     937    }
     938    @namespace_list.each{ |ns|
     939      ns.travers_all_celltype_proc proc
     940    }
     941  end
     942  def travers_all_celltype_proc proc
     943    @celltype_list.each{ |ct|
     944      proc.call ct
     945    }
     946    @namespace_list.each{ |ns|
     947      ns.travers_all_celltype_proc proc
    781948    }
    782949  end
     
    10231190    gen_ph_get_cellcb f
    10241191    gen_ph_attr_access f          if @n_attribute_rw > 0 || @n_attribute_ro > 0 || @n_var > 0
    1025     gen_ph_cp_fun_macro f         if @n_call_port > 0
     1192    f.print "#ifndef TECSFLOW\n"
     1193    gen_ph_cp_fun_macro f, false  if @n_call_port > 0
     1194    f.print "#else  /* TECSFLOW */\n"
     1195    gen_ph_cp_fun_macro f, true   if @n_call_port > 0
     1196    f.print "#endif /* TECSFLOW */\n"
    10261197#    gen_ph_abstract_ep_des_type f
    10271198
     
    12471418  def gen_ph_info f
    12481419
     1420    yn_multi_domain = "no"
     1421    yn_multi_domain = "yes" if multi_domain?
    12491422    yn_idx_is_id = "no"
    12501423    yn_idx_is_id = "yes"  if @idx_is_id
     
    12551428    yn_rom       = "no"
    12561429    yn_rom       = "yes"  if $rom
     1430    yn_has_CB    = "no"
     1431    yn_has_CB    = "yes"  if has_CB?
     1432    yn_has_INIB  = "no"
     1433    yn_has_INIB  = "yes"  if has_INIB?
    12571434    yn_cb_init   = "no"
    12581435    yn_cb_init   = "yes"  if need_CB_initializer?
     
    12631440 * celltype          :  #{@name}
    12641441 * global name       :  #{@global_name}
     1442 * multi-domain      :  #{yn_multi_domain}
    12651443 * idx_is_id(actual) :  #{yn_idx_is_id}(#{yn_idx_is_id_act})
    12661444 * singleton         :  #{yn_singleton}
    1267  * has_CB            :  #{has_CB?}
    1268  * has_INIB          :  #{has_INIB?}
     1445 * has_CB            :  #{yn_has_CB}
     1446 * has_INIB          :  #{yn_has_INIB}
    12691447 * rom               :  #{yn_rom}
    12701448 * CB initializer    :  #{yn_cb_init}
     
    15951773      f.print( "#define #{@global_name}_GET_CELLCB(idx) ((void *)0)\n" )
    15961774    elsif @idx_is_id_act then   # mikan 単一のセルの場合の最適化, idx_is_id でない場合
    1597       f.print( "#define #{@global_name}_GET_CELLCB(idx) (#{@global_name}_CB_tab[(idx) - #{@global_name}_ID_BASE])\n" )
     1775      f.print( "#define #{@global_name}_GET_CELLCB(idx) (#{@global_name}_CB_ptab[(idx) - #{@global_name}_ID_BASE])\n" )
    15981776    else
    15991777      f.print( "#define #{@global_name}_GET_CELLCB(idx) (idx)\n" )
     
    17991977  end
    18001978
    1801   def gen_ph_cp_fun_macro f
    1802     if @n_call_port >0 then
     1979  def gen_ph_cp_fun_macro f, b_flow
     1980    if @n_call_port >0 && b_flow == false then
    18031981      f.printf( TECSMsg.get( :CPM_comment ) , "#_CPM_#" )
    18041982    end
     
    18562034
    18572035        # 関数名の出力(標準:受け口ディスクリプタから VMT の関数名、最適化:受け口関数 or 受け口ディスクリプタ)
    1858         if ! p.is_VMT_useless? then
     2036        if b_flow then
     2037          f.print( "\t  (p_that)->#{p.get_name}#{subsc}.#{fun.get_name}__T( \\\n" )
     2038        elsif ! p.is_VMT_useless? then
    18592039          # 標準コード
    18602040          if @singleton then
     
    18912071
    18922072        # 受け口情報の出力(標準:受け口ディスクリプタ、最適化:IDX など)
    1893         if ! p.is_skelton_useless? && ! p.is_cell_unique? then
     2073        if b_flow then
     2074        elsif ! p.is_skelton_useless? && ! p.is_cell_unique? then
    18942075          # 標準コード
    18952076          if @singleton then
     
    19692150        p_cellcb = "    #{@global_name}_CB *p_cellcb = p_that;\n"
    19702151        delim = ", "
    1971         cb = "p_that#{inib}->"
     2152        cb = "p_cellcb#{inib}->"
    19722153      end
    19732154
     
    26162797        f.print "extern  #{@global_name}_INIB  #{@global_name}_SINGLE_CELL_INIB;\n"
    26172798      end
    2618 
    2619 #     @ordered_cell_list.each{ |c|
    2620 #        f.print "extern  #{@global_name}_CB  #{@global_name}_#{c.get_name}_CB;\n"
    2621 #      }
    2622 
    26232799      f.print "\n"
    2624     elsif @idx_is_id_act then
    2625       f.print "extern #{@global_name}_CB  *#{@global_name}_CB_tab[];\n"
     2800    elsif @b_need_ptab then
     2801      f.printf( TECSMsg.get( :SCP_comment ),  "#_MCPP_#" )
     2802      if has_CB? then
     2803        f.print "extern #{@global_name}_CB  *const #{@global_name}_CB_ptab[];\n"
     2804        @ordered_cell_list.each{ |c|
     2805          if c.is_generate? then                           # 生成対象か?
     2806            name_array = get_name_array c
     2807            f.print "extern #{@global_name}_CB  #{name_array[4]};\n"
     2808          end
     2809        }
     2810      elsif has_INIB?
     2811        f.print "extern #{@global_name}_INIB  *const #{@global_name}_INIB_ptab[];\n"
     2812        @ordered_cell_list.each{ |c|
     2813          if c.is_generate? then                           # 生成対象か?
     2814            name_array = get_name_array c
     2815            f.print "extern #{@global_name}_INIB  #{name_array[11]};\n"
     2816          end
     2817        }
     2818      end
    26262819    else
    2627       f.print "extern #{@global_name}_CB  #{@global_name}_CB_tab[];\n"
     2820      f.printf( TECSMsg.get( :SCP_comment ),  "#_MCPB_#" )
     2821      if has_CB? then
     2822        f.print "extern #{@global_name}_CB  #{@global_name}_CB_tab[];\n"
     2823      elsif has_INIB?
     2824        f.print "extern #{@global_name}_INIB  #{@global_name}_INIB_tab[];\n"
     2825      end
    26282826    end
    26292827  end
    26302828
    26312829  def gen_ph_INIB_as_CB f
    2632 
     2830    # ここは、手抜きである。本来なら INIB を出力すべき
    26332831    if ! has_CB? && has_INIB? then
    26342832      f.printf( TECSMsg.get( :DCI_comment ),  "#_DCI_#" )
    2635       f.print "#define #{@global_name}_CB_tab           #{@global_name}_INIB_tab\n"
    2636       f.print "#define #{@global_name}_SINGLE_CELL_CB   #{@global_name}_SINGLE_CELL_INIB\n"
     2833      if @singleton then
     2834        f.print "#define #{@global_name}_SINGLE_CELL_CB   #{@global_name}_SINGLE_CELL_INIB\n"
     2835      elsif @b_need_ptab then
     2836        f.print "#define #{@global_name}_CB_ptab           #{@global_name}_INIB_ptab\n"
     2837      else
     2838        f.print "#define #{@global_name}_CB_tab           #{@global_name}_INIB_tab\n"
     2839      end
    26372840      f.print "#define #{@global_name}_CB               #{@global_name}_INIB\n"
    26382841      f.print "#define tag_#{@global_name}_CB           tag_#{@global_name}_INIB\n"
     
    26582861      f.printf( TECSMsg.get( :FEC_comment ), "#_FEC_#" )
    26592862
    2660       if @idx_is_id_act then
     2863      if @b_need_ptab then
    26612864        amp = ''
     2865        tab = 'ptab'
    26622866      else
    26632867        amp = '&'
     2868        tab = 'tab'
    26642869      end
    26652870      f.print <<EOT
    26662871#define FOREACH_CELL(i,p_cb)   \\
    26672872    for( (i) = 0; (i) < #{@global_name}_N_CELL; (i)++ ){ \\
    2668        #{necessity}(p_cb) = #{amp}#{@global_name}_CB_tab[i];
     2873       #{necessity}(p_cb) = #{amp}#{@global_name}_CB_#{tab}[i];
    26692874
    26702875#define END_FOREACH_CELL   }
     
    27993004        if @singleton then
    28003005          f.print "\t#{that}_inib = &#{@global_name}_SINGLE_CELL_INIB;\n\n"
    2801         elsif @idx_is_id_act
    2802           f.print "\t#{that}_inib = #{@global_name}_INIB_tab[(i)];\n\n"
     3006        elsif @b_need_ptab then
     3007          f.print "\t#{that}_inib = #{@global_name}_INIB_ptab[(i)];\n\n"
    28033008        else
    28043009          f.print "\t#{that}_inib = &#{@global_name}_INIB_tab[(i)];\n\n"
     
    33973602        fs.each{ |r, f| f.print "#{@global_name}_INIB #{@global_name}_SINGLE_CELL_INIB = \n" }
    33983603        indent = 0
    3399       elsif ! @idx_is_id_act then
     3604      elsif ! @b_need_ptab then
    34003605        fs.each{ |r, f| f.print "#{@global_name}_INIB #{@global_name}_INIB_tab[] = {\n" }
    34013606        indent = 1
     
    34183623
    34193624        print_indent( f, indent )
    3420         if @idx_is_id_act then
     3625        if @b_need_ptab then
    34213626          f.print "const #{@global_name}_INIB #{name_array[5]} = "
    34223627        end
     
    34283633        unless @singleton then
    34293634          # 1 つの cell INIB の終わり
    3430           if @idx_is_id_act then
     3635          if @b_need_ptab then
    34313636            f.print( "};\n\n" )
    34323637          else
     
    34353640        end
    34363641      }
    3437       if ! @idx_is_id_act then
     3642      if ! @b_need_ptab then
    34383643        fs.each{ |r, f| f.print( "};\n\n" ) }
    34393644      end
     
    34503655          fs.each{ |r, f| f.print "struct tag_#{@global_name}_CB #{@global_name}_SINGLE_CELL_CB = \n" }
    34513656          indent = 0
    3452         elsif ! @idx_is_id_act then
     3657        elsif ! @b_need_ptab then
    34533658          fs.each{ |r, f| f.print "struct tag_#{@global_name}_CB #{@global_name}_CB_tab[] = {\n" }
    34543659          indent = 1
     
    34713676
    34723677          print_indent( f, indent )
    3473           if @idx_is_id_act then
     3678          if @b_need_ptab then
    34743679            f.print "#{@global_name}_CB #{name_array[2]} = "
    34753680          end
     
    34933698          unless @singleton then
    34943699            # 1 つの cell CB の終わり
    3495             if @idx_is_id_act then
     3700            if @b_need_ptab then
    34963701              f.print( "};\n\n" )
    34973702            else
     
    35003705          end
    35013706        }
    3502         if ! @idx_is_id_act then
     3707        if ! @b_need_ptab then
    35033708          fs.each{ |r, f| f.print( "};\n\n" ) }
    35043709        end
     
    35073712          fs.each{ |r, f| f.print "struct tag_#{@global_name}_CB #{@global_name}_SINGLE_CELL_CB;\n" }
    35083713          indent = 0
    3509         elsif @idx_is_id_act then
     3714        elsif @b_need_ptab then
    35103715          @ordered_cell_list.each{ |c|
    35113716            next if ! c.is_generate?
     
    35263731  def gen_cell_cb_tab f
    35273732    indent = 0
    3528     if @idx_is_id_act then
     3733    if @b_need_ptab then
    35293734      if has_INIB? && ( $ram_initializer || ! has_CB? ) then
    35303735        f.print "/* ID to INIB table #_INTAB_# */\n"
     
    35373742        }
    35383743
    3539         f.print "#{@global_name}_INIB *#{@global_name}_INIB_tab[] ={\n"
     3744        f.print "#{@global_name}_INIB *const #{@global_name}_INIB_ptab[] ={\n"
    35403745        @ordered_cell_list.each{ |c|
    35413746          if c.is_generate? then                           # 生成対象か?
     
    35573762        }
    35583763
    3559         f.print "#{@global_name}_CB *#{@global_name}_CB_tab[] ={\n"
     3764        f.print "#{@global_name}_CB *const #{@global_name}_CB_ptab[] ={\n"
    35603765        @ordered_cell_list.each{ |c|
    35613766          if c.is_generate? then                           # 生成対象か?
     
    35983803      cell_ID = 0
    35993804    else
    3600       if ! @idx_is_id_act then
     3805      if ! @b_need_ptab then
    36013806        index = cell.get_id - cell.get_celltype.get_id_base
    36023807        cell_CB_name = "#{@global_name}_CB_tab[#{index}]"
     
    36143819      cell_ID = cell.get_id
    36153820    end
    3616     if @idx_is_id_act then
    3617       cell_IDX = cell_ID
    3618     else
    3619       cell_IDX = "&#{cell_CB_name}"
    3620     end
    36213821
    36223822    if has_CB? then
     
    36263826    else
    36273827      cell_CBP = "NULL"    # CB も INIB もなければ NULL に置換
     3828    end
     3829
     3830    if @idx_is_id_act then
     3831      cell_IDX = cell_ID
     3832    else
     3833      cell_IDX = cell_CBP
    36283834    end
    36293835
     
    38254031              c = j.get_rhs_cell                    # 呼び先セル
    38264032              ct = c.get_celltype                   # 呼び先セルタイプ
     4033              name_array = ct.get_name_array( c )   # 呼び先セルタイプで name_array を得る
    38274034              if ct.has_INIB? || ct.has_CB? then
    3828                 name_array = ct.get_name_array( c )   # 呼び先セルタイプで name_array を得る
    38294035                f.printf( "%-40s /* %s #_CCP2_# */\n", "#{name_array[7]},", p.get_name )
    38304036              else
     
    41124318      f = fs[ c.get_region.get_domain_root ]
    41134319
    4114       ct = c.get_celltype
     4320      ct = c.get_celltype     # ct = self でも同じ
    41154321      jl = c.get_join_list
     4322      name_array = get_name_array( c )
    41164323
    41174324      port = ct.get_port_list
     
    41484355              else
    41494356                if has_CB? then
    4150                   if @singleton then
    4151                     f.print "    &#{@global_name}_SINGLE_CELL_CB,        /* CB */\n"
    4152                   else
    4153                     # f.print "    &#{@global_name}_#{c.get_name}_CB,\n"
    4154                     f.print "    &#{@global_name}_CB_tab[#{index}],      /* CB */\n"
    4155                   end
     4357                  # if @singleton then
     4358                  #   f.print "    &#{@global_name}_SINGLE_CELL_CB,        /* CB 1 */\n"
     4359                  # else
     4360                  #   # f.print "    &#{@global_name}_#{c.get_name}_CB,\n"
     4361                  #   f.print "    &#{@global_name}_CB_tab[#{index}],      /* CB 2 */\n"
     4362                  # end
     4363                  f.print "    #{name_array[8]},      /* CB 1 */\n"
    41564364                elsif has_INIB? then
    4157                   if @singleton then
    4158                     f.print "    &#{@global_name}_SINGLE_CELL_INIB,      /* INIB */\n"
    4159                   else
    4160                     f.print "    &#{@global_name}_INIB_tab[#{index}],    /* INIB */\n"
    4161                   end
     4365                  # if @singleton then
     4366                  #   f.print "    &#{@global_name}_SINGLE_CELL_INIB,      /* INIB 1 */\n"
     4367                  # else
     4368                  #   f.print "    &#{@global_name}_INIB_tab[#{index}],    /* INIB 2 */\n"
     4369                  # end
     4370                  f.print "    &#{name_array[5]},      /* INIB 1 */\n"
    41624371                else
    41634372                  f.print "    0,\n"
     
    41834392            else
    41844393              if has_CB? then
    4185                 if @singleton then
    4186                   f.print "    &#{@global_name}_SINGLE_CELL_CB,       /* CB */\n"
    4187                 else
    4188                   f.print "    &#{@global_name}_CB_tab[#{index}],     /* CB */\n"
    4189                   # f.print "    &#{@global_name}_#{c.get_name}_CB,\n"
    4190                 end
     4394                # if @singleton then
     4395                #   f.print "    &#{@global_name}_SINGLE_CELL_CB,       /* CB 3 */\n"
     4396                # else
     4397                #   f.print "    &#{@global_name}_CB_tab[#{index}],     /* CB 4 */\n"
     4398                #   # f.print "    &#{@global_name}_#{c.get_name}_CB,\n"
     4399                # end
     4400                f.print "    #{name_array[8]},      /* CB 3 */\n"
    41914401              elsif has_INIB? then
    4192                 if @singleton then
    4193                   f.print "    &#{@global_name}_SINGLE_CELL_INIB,     /* INIB */\n"
    4194                 else
    4195                   f.print "    &#{@global_name}_INIB_tab[#{index}],   /* INIB */\n"
    4196                 end
     4402                # if @singleton then
     4403                #   f.print "    &#{@global_name}_SINGLE_CELL_INIB,     /* INIB 3 */\n"
     4404                # else
     4405                #   # f.print "    &#{@global_name}_INIB_tab[#{index}],   /* INIB 4 */\n"
     4406                # end
     4407                f.print "    &#{name_array[5]},      /* INIB 3 */\n"
    41974408              else
    41984409                f.print "    0,\n"
     
    45554766  def generate_inline_template_code
    45564767    return if @n_entry_port_inline == 0
     4768    return if @b_reuse && ! $generate_all_template
    45574769    if ! ( @plugin && @plugin.gen_ep_func? ) then
    45584770      return if @b_reuse && ! $generate_all_template
     
    49325144  #  str に以下の置換を行う
    49335145  #-   $ct$ ⇒ セルタイプ名(ct)
    4934   #-   $cell$ ⇒ セル名(cell)   cell が nil ならば3つの置換は行われない
     5146  #-   $cell$ ⇒ セル名(cell)   cell が nil ならば以下の置換は行われない
    49355147  #-   $cb$ ⇒ CB の C 言語名(cb)
    49365148  #-   $cbp$ ⇒ CB へのポインタ(cbp)
    49375149  #-   $cb_proto$ ⇒ CB の C 言語名プロトタイプ宣言用(cb_proto)
    4938   #-   $id$ ⇒ ct_cell
     5150  #-   $id$ ⇒ $ct$_$cell_global$    # ct_cell  before or same V1.5.2
    49395151  #-   $idx$ ⇒ idx
    49405152  #-   $ID$ ⇒ id (整数の番号)
    49415153  #-   $ct_global$ ⇒ セルタイプ名(ct)
    4942   #-   $cell_global$ ⇒ セル名(cell)   cell が nil ならば3つの置換は行われない
     5154  #-   $cell_global$ ⇒ セル名(cell)
    49435155  #-   $$   ⇒ $
    49445156  def subst_name( str, name_array )
     
    49555167
    49565168    str = str.gsub( /(^|[^\$])\$ct\$/, "\\1#{ct}" )
     5169    str = str.gsub( /(^|[^\$])\$ct_global\$/, "\\1#{ct_global}" )
    49575170    if cell then
    49585171      str = str.gsub( /(^|[^\$])\$cell\$/, "\\1#{cell}" )
    49595172      str = str.gsub( /(^|[^\$])\$cb\$/, "\\1#{cb}" )
    4960       str = str.gsub( /(^|[^\$])\$id\$/, "\\1#{ct}_#{cell}" )
     5173      # str = str.gsub( /(^|[^\$])\$id\$/, "\\1#{ct}_#{cell}" )
     5174      str = str.gsub( /(^|[^\$])\$id\$/, "\\1#{ct}_#{cell_global}" )
    49615175      str = str.gsub( /(^|[^\$])\$cb_proto\$/, "\\1#{cb_proto}" )
    49625176      str = str.gsub( /(^|[^\$])\$ID\$/, "\\1#{id}" )
    49635177      str = str.gsub( /(^|[^\$])\$idx\$/, "\\1#{idx}" )
    49645178      str = str.gsub( /(^|[^\$])\$cbp\$/, "\\1#{cbp}" )
    4965       str = str.gsub( /(^|[^\$])\$ct_global\$/, "\\1#{ct_global}" )
    49665179      str = str.gsub( /(^|[^\$])\$cell_global\$/, "\\1#{cell_global}" )
    49675180    end
     
    50835296  end
    50845297end
     5298
     5299class DomainType < Node
     5300  def gen_factory
     5301    # p "DomainType: gen_factory"
     5302    @plugin.gen_factory
     5303  end
     5304end
Note: See TracChangeset for help on using the changeset viewer.