Index: asp3_wo_tecs/trunk/cfg/pass2.rb
===================================================================
--- asp3_wo_tecs/trunk/cfg/pass2.rb	(revision 305)
+++ asp3_wo_tecs/trunk/cfg/pass2.rb	(revision 306)
@@ -51,5 +51,5 @@
 #  ã®è²¬ä»»ãè² ããªãï¼
 #
-#  $Id: pass2.rb 32 2016-01-31 14:45:59Z ertl-hiro $
+#  $Id: pass2.rb 105 2016-03-12 07:55:48Z ertl-hiro $
 #
 
@@ -61,204 +61,301 @@
 #  ãã¹1ã®çæç©ã®èª­ã¿è¾¼ã¿
 #
-def ReadCfg1Out
-  # cfg1_out.symsã®èª­ã¿è¾¼ã¿
-  symbolAddress = ReadSymbolFile(CFG1_OUT_SYMS)
-
-  # cfg1_out.srecã®èª­ã¿è¾¼ã¿
-  begin
-    cfg1SRec = SRecord.new(CFG1_OUT_SREC)
-  rescue Errno::ENOENT, Errno::EACCES => ex
-    abort(ex.message)
-  end
-
-  # ãã¸ãã¯ãã³ãã¼ã®åå¾
-  if symbolAddress.has_key?(CFG1_MAGIC_NUM)
-    $asmLabel = ""
-    cfg1_prefix = CFG1_PREFIX
-  elsif symbolAddress.has_key?("_" + CFG1_MAGIC_NUM)
-    $asmLabel = "_"
-    cfg1_prefix = "_" + CFG1_PREFIX
-  else
-    error_exit("`#{CFG1_MAGIC_NUM}' is not found in `#{CFG1_OUT_SYMS}'")
-  end
-
-  magicNumberData = cfg1SRec.get_data(symbolAddress \
-							[$asmLabel + CFG1_MAGIC_NUM], 4)
-  if (magicNumberData == "12345678")
-    $bLittleEndian = false
-  elsif (magicNumberData == "78563412")
-    $bLittleEndian = true
-  else
-    error_exit("`#{CFG1_MAGIC_NUM}' is invalid in `#{CFG1_OUT_SREC}'")
-  end
-
-  # åºå®åºåããå¤æ°ã®åå¾
-  $sizeOfSigned = cfg1SRec.get_value(symbolAddress \
-							[$asmLabel + CFG1_SIZEOF_SIGNED], 4, false)
-
-  # å¤åå¾ã·ã³ãã«ã®åå¾
-  $symbolValueTable.each do |symbolName, symbolData|
-    symbol = cfg1_prefix + symbolName
-    if symbolAddress.has_key?(symbol)
-      value = cfg1SRec.get_value(symbolAddress[symbol], \
-							$sizeOfSigned, symbolData.has_key?(:SIGNED))
-      if !value.nil?
-        symbolData[:VALUE] = value
-      end
-    end
-  end
-
-  #
-  #  IDçªå·å
-¥åãã¡ã¤ã«ã®åãè¾¼ã¿
-  #
-  $inputObjid = {}
-  if !$idInputFileName.nil?
+module Cfg1Out
+  #
+  #  Sã¬ã³ã¼ããã¡ã¤ã«ããã·ã³ãã«ã®å¤ãåãåºã
+  #
+  def self.GetSymbolValue(symbol, size, signed)
+    if @symbolAddress.has_key?(symbol)
+      return(@cfg1SRec.get_value(@symbolAddress[symbol], size, signed))
+    else
+      return(nil)
+    end
+  end
+
+  #
+  #  ãã¹1ã®çæç©ã®èª­ã¿è¾¼ã¿ï¼ã¡ã¤ã³ã®å¦çï¼
+  #
+  def self.Read
+    # cfg1_out.symsã®èª­ã¿è¾¼ã¿
+    @symbolAddress = ReadSymbolFile(CFG1_OUT_SYMS)
+
+    # cfg1_out.srecã®èª­ã¿è¾¼ã¿
     begin
-      idInputFile = File.open($idInputFileName)
+      @cfg1SRec = SRecord.new(CFG1_OUT_SREC)
     rescue Errno::ENOENT, Errno::EACCES => ex
       abort(ex.message)
     end
 
-    idInputFile.each do |line|
-      ( objidName, objidNumber ) = line.split(/\s+/)
-      $inputObjid[objidName] = objidNumber.to_i
-    end
-
-    idInputFile.close
-  end
-
-  #
-  #  ããã·ã¥ã®åæå
-  #
-  $cfgData = {}
-  objidValue = {}
-  $apiDefinition.each do |apiName, apiDef|
-    if apiDef.has_key?(:API)
-      $cfgData[apiDef[:API].to_sym] = {}
-    end
-    apiDef[:PARAM].each do |apiParam|
-      if apiParam.has_key?(:NAME) && apiParam.has_key?(:ID_DEF)
-        objidValue[apiParam[:NAME]] = {}
-      end
-    end
-  end
-
-  #
-  #  ãªãã¸ã§ã¯ãIDã®å²ãå½ã¦
-  #
-  # IDçªå·å²ãå½ã¦ã®åå¦ç
-  $cfgFileInfo.each do |cfgInfo|
-    # ããªãã­ã»ããµãã£ã¬ã¯ãã£ãã¨æ¶ããéçAPIã¯èª­ã¿é£ã°ã
-    next if (cfgInfo.has_key?(:DIRECTIVE) || !symbolAddress.has_key?( \
-							"#{cfg1_prefix}static_api_#{cfgInfo[:INDEX]}"))
-
-    apiDef = $apiDefinition[cfgInfo[:API]]
-    apiDef[:PARAM].each do |apiParam|
-      if apiParam.has_key?(:NAME) && apiParam.has_key?(:ID_DEF)
-        objidName = apiParam[:NAME]
-        objidData = cfgInfo[objidName]
-        if $inputObjid.has_key?(objidData)
-          objidValue[objidName][objidData] = $inputObjid[objidData]
+    # ãã¸ãã¯ãã³ãã¼ã®åå¾
+    if @symbolAddress.has_key?(CFG1_MAGIC_NUM)
+      $asmLabel = ""
+      $cfg1_prefix = CFG1_PREFIX
+    elsif @symbolAddress.has_key?("_" + CFG1_MAGIC_NUM)
+      $asmLabel = "_"
+      $cfg1_prefix = "_" + CFG1_PREFIX
+    else
+      error_exit("`#{CFG1_MAGIC_NUM}' is not found in `#{CFG1_OUT_SYMS}'")
+    end
+
+    magicNumberData = @cfg1SRec.get_data(@symbolAddress \
+							[$asmLabel + CFG1_MAGIC_NUM], 4)
+    if (magicNumberData == "12345678")
+      $endianLittle = false
+    elsif (magicNumberData == "78563412")
+      $endianLittle = true
+    else
+      error_exit("`#{CFG1_MAGIC_NUM}' is invalid in `#{CFG1_OUT_SREC}'")
+    end
+
+    # åºå®åºåããå¤æ°ã®åå¾
+    $sizeOfSigned = GetSymbolValue($asmLabel + CFG1_SIZEOF_SIGNED, 4, false)
+
+    # å¤åå¾ã·ã³ãã«ã®åå¾
+    $symbolValueTable.each do |symbolName, symbolData|
+      symbol = $cfg1_prefix + symbolName
+      if symbolData.has_key?(:BOOL)
+        value = GetSymbolValue(symbol, $sizeOfSigned, true)
+        if !value.nil?
+          # Cè¨èªã®çå½å¤ãRubyã®çå½å¤ã«å¤æãã¦åãè¾¼ã
+          symbolData[:VALUE] = (value != 0)
+        end
+      else
+        value = GetSymbolValue(symbol, $sizeOfSigned, \
+										symbolData.has_key?(:SIGNED))
+        if !value.nil?
+          symbolData[:VALUE] = value
+        end
+      end
+    end
+
+    #
+    #  ããã·ã¥ã®åæå
+    #
+    $cfgData = {}
+    @objidValues = {}
+    $apiDefinition.each do |apiName, apiDef|
+      if apiDef.has_key?(:API)
+        if !$cfgData.has_key?(apiDef[:API].to_sym)
+          $cfgData[apiDef[:API].to_sym] = {}
+        end
+      end
+      apiDef[:PARAM].each do |apiParam|
+        if apiParam.has_key?(:NAME) && apiParam.has_key?(:ID_DEF)
+          @objidValues[apiParam[:NAME]] = {}
+        end
+      end
+    end
+
+    #
+    #  ãã¡ã¤ã³çæãã¼ã¿ãã³ã³ãã£ã®ã¥ã¬ã¼ã·ã§ã³ãã¼ã¿ï¼$cfgDataï¼ã«æ ¼ç´
+    #
+    $cfgData[:CRE_DOM] = {}
+    $domainId.each do |domainName, domainVal|
+      domid = NumStr.new(domainVal, domainName)
+      $cfgData[:CRE_DOM][domainVal] = { :domid => domid }
+    end
+
+    ReadPhase(nil)
+  end
+
+  #
+  #  ãã©ã¡ã¼ã¿ã®å¤ãåãåºã
+  #
+  def self.GetParamValue(paramName, param, apiIndex, index, apiParam, cfgInfo)
+    if apiParam.has_key?(:ID_DEF)				# ãªãã¸ã§ã¯ãè­å¥åï¼å®ç¾©ï¼
+      value = @objidValues[paramName][param]
+    elsif apiParam.has_key?(:ID_REF)			# ãªãã¸ã§ã¯ãè­å¥åï¼åç
+§ï¼
+      if @objidValues[paramName].has_key?(param)
+        value = @objidValues[paramName][param]
+      else
+        error("#{apiDef.has_key?(:KEYPAR) ? "E_NOEXS" : "E_ID"}: " \
+					"`#{param}' in #{cfgInfo[:APINAME]} is not defined", \
+					"#{cfgInfo[:_FILE_]}:#{cfgInfo[:_LINE_]}:")
+        value = nil
+      end
+    elsif apiParam.has_key?(:EXPTYPE)			# æ´æ°å®æ°å¼ãã©ã¡ã¼ã¿
+      if apiIndex.nil?
+        if param.is_a?(NumStr)
+          return(param)
         else
-          objidValue[objidName][objidData] = nil
-        end
-      end
-    end
-  end
-
-  # IDçªå·ã®å²ãå½ã¦å¦ç
-  objidValue.each do |objidName, objidList|
-    # æªä½¿ç¨ã®IDçªå·ã®ãªã¹ãï¼ä½¿ç¨ãããã®ããæ¶ãã¦ããï¼
-    unusedObjidList = (1.upto(objidList.keys.size)).to_a
-
-    # å²ãå½ã¦æ¸ã¿ã®IDçªå·ã®å¦ç
-    objidList.each do |objidData, objidNumber|
-      if $inputObjid.has_key?(objidData)
-        objidIndex = unusedObjidList.index($inputObjid[objidData])
-        if objidIndex.nil?
-          # IDçªå·å
+          return(NumStr.new(param))
+        end
+      else
+        symbol = "#{$cfg1_prefix}valueof_#{paramName}_#{apiIndex}#{index}"
+        value = GetSymbolValue(symbol, $sizeOfSigned, \
+									apiParam.has_key?(:SIGNED))
+      end
+    else										# ä¸è¬å®æ°å¼ï¼æå­åãã©ã¡ã¼ã¿
+      return(param)
+    end
+    return(NumStr.new(value, param))
+  end
+
+  #
+  #  æå®ãããã§ã¼ãºã®ããã®ãã¹1ã®çæç©ã®èª­ã¿è¾¼ã¿
+  #
+  def self.ReadPhase(phase)
+    #
+    #  ãªãã¸ã§ã¯ãIDã®å²å½ã¦
+    #
+    # å²ãå½ã¦ããªãã¸ã§ã¯ãIDã¯ï¼@objidValuesã«ä¿æããï¼@objidValuesã¯ï¼
+    # 2éã®ããã·ã¥ï¼ããã·ã¥ã®ããã·ã¥ï¼ã§ããï¼
+    #
+    # å
+·ä½çã«ã¯ï¼@objidValuesã¯ï¼ãªãã¸ã§ã¯ãIDã®ãã©ã¡ã¼ã¿åï¼ä¾ãã°ï¼ã»
+    # ããã©IDã§ããã°"semid"ï¼ãããä¿æããå¤æ°åã¯ï¼objidParamNameã¨ã
+    # ãï¼ãã­ã¼ã¨ãï¼ãã®ãªãã¸ã§ã¯ãIDã®å²å½ã¦è¡¨ï¼ãããä¿æããå¤æ°å
+    # ã¯ï¼objidListã¨ããï¼ãå¤ã¨ããããã·ã¥ã§ããï¼ãªãã¸ã§ã¯ãIDã®å²å½
+    # ã¦è¡¨ã¯ï¼ãªãã¸ã§ã¯ãåï¼ãããä¿æããå¤æ°åã¯ï¼objNameã¨ããï¼ãã­ã¼
+    # ã¨ãï¼ãã®IDçªå·ï¼ãããä¿æããå¤æ°åã¯ï¼objidNumberã¨ããï¼ãå¤ã¨
+    # ããããã·ã¥ã§ããï¼
+    #
+    # ä¾ãã°ï¼ã»ããã©SEM1ã®IDçªå·ã1ã®å ´åã«ã¯ï¼æ¬¡ã®ããã«è¨­å®ãããï¼
+    #   @objidValues["semid"]["SEM1"] == 1
+    #
+
+    # IDçªå·å²ãå½ã¦ã®åå¦ç
+    objidParamNameList = []
+    $cfgFileInfo.each do |cfgInfo|
+      # ããªãã­ã»ããµãã£ã¬ã¯ãã£ãã¯èª­ã¿é£ã°ã
+      next if cfgInfo.has_key?(:DIRECTIVE)
+
+      apiDef = $apiDefinition[cfgInfo[:APINAME]]
+      # ç°ãªããã§ã¼ãºã®éçAPIã¯èª­ã¿é£ã°ã
+      next if apiDef[:PHASE] != phase
+
+      apiIndex = cfgInfo[:INDEX]
+      if !apiIndex.nil?
+        # ã·ã³ãã«ãã¡ã¤ã«ã«éçAPIã®ã¤ã³ããã¯ã¹ãå­å¨ããªããã°èª­ã¿é£
+        # ã°ãï¼ifdefç­ã§æ¶ããéçAPIï¼
+        symbol = "#{$cfg1_prefix}static_api_#{apiIndex}"
+        next unless @symbolAddress.has_key?(symbol)
+      end
+
+      apiDef[:PARAM].each do |apiParam|
+        if apiParam.has_key?(:NAME) && apiParam.has_key?(:ID_DEF)
+          objidParamName = apiParam[:NAME]
+          objName = cfgInfo[objidParamName]
+          if $inputObjid.has_key?(objName)
+            # IDçªå·å
+¥åãã¡ã¤ã«ã«å®ç¾©ããã¦ããå ´å
+            @objidValues[objidParamName][objName] = $inputObjid[objName]
+          else
+            @objidValues[objidParamName][objName] = nil
+          end
+          objidParamNameList.push(objidParamName)
+        end
+      end
+    end
+
+    # IDçªå·ã®å²å½ã¦å¦ç
+    objidParamNameList.each do |objidParamName|
+      objidList = @objidValues[objidParamName]
+
+      # æªä½¿ç¨ã®IDçªå·ã®ãªã¹ãï¼ä½¿ç¨ãããã®ããæ¶ãã¦ããï¼
+      unusedObjidList = (1.upto(objidList.keys.size)).to_a
+
+      # å²ãå½ã¦æ¸ã¿ã®IDçªå·ã®å¦ç
+      objidList.each do |objName, objidNumber|
+        if $inputObjid.has_key?(objName)
+          objidIndex = unusedObjidList.index($inputObjid[objName])
+          if objidIndex.nil?
+            # IDçªå·å
 ¥åãã¡ã¤ã«ã§æå®ãããå¤ãä¸æ­£
-          error_exit("value of `#{objidData}' in ID input file is illegal")
+            error_exit("value of `#{objName}' in ID input file is illegal")
+          else
+            # æªä½¿ç¨ã®IDçªå·ã®ãªã¹ãããåé¤
+            unusedObjidList.delete_at(objidIndex)
+          end
+        end
+      end
+
+      # IDçªå·ã®å²å½ã¦
+      objidList.each do |objName, objidNumber|
+        if objidList[objName].nil?
+          # ä»¥ä¸ã§ï¼@objidValuesãæ¸ãæãã¦ãã
+          objidList[objName] = unusedObjidList.shift
+        end
+      end
+    end
+
+    #
+    #  éçAPIãã¼ã¿ãã³ã³ãã£ã®ã¥ã¬ã¼ã·ã§ã³ãã¼ã¿ï¼$cfgDataï¼ã«æ ¼ç´
+    #
+    $cfgFileInfo.each do |cfgInfo|
+      # ããªãã­ã»ããµãã£ã¬ã¯ãã£ãã¯èª­ã¿é£ã°ã
+      next if cfgInfo.has_key?(:DIRECTIVE)
+
+      apiDef = $apiDefinition[cfgInfo[:APINAME]]
+      # ç°ãªããã§ã¼ãºã®éçAPIã¯èª­ã¿é£ã°ã
+      next if apiDef[:PHASE] != phase
+
+      apiSym = apiDef[:API].to_sym
+      apiIndex = cfgInfo[:INDEX]
+      if !apiIndex.nil?
+        # ã·ã³ãã«ãã¡ã¤ã«ã«éçAPIã®ã¤ã³ããã¯ã¹ãå­å¨ããªããã°èª­ã¿é£
+        # ã°ãï¼ifdefç­ã§æ¶ããéçAPIï¼
+        symbol = "#{$cfg1_prefix}static_api_#{apiIndex}"
+        next unless @symbolAddress.has_key?(symbol)
+      end
+
+      # ãã©ã¡ã¼ã¿ã®å¤ãããã·ã¥å½¢å¼ã«æ ¼ç´
+      params = {}
+      apiDef[:PARAM].each do |apiParam|
+        next unless apiParam.has_key?(:NAME)
+        paramName = apiParam[:NAME]
+        next unless cfgInfo.has_key?(paramName)		# ãã©ã¡ã¼ã¿ããªãå ´å
+        paramData = cfgInfo[paramName]
+
+        if apiParam.has_key?(:LIST)
+          params[paramName.to_sym] = []
+          paramData.each.with_index(1) do |param, index|
+            params[paramName.to_sym].push(GetParamValue(paramName, param, \
+								apiIndex, "_#{index}", apiParam, cfgInfo))
+          end
         else
-          # æªä½¿ç¨ã®IDçªå·ã®ãªã¹ãããåé¤
-          unusedObjidList.delete_at(objidIndex)
-        end
-      end
-    end
-
-    # IDçªå·ã®å²ãå½ã¦
-    objidList.each do |objidData, objidNumber|
-      if objidList[objidData].nil?
-        # ä»¥ä¸ã§ï¼objidValueãæ¸ãæãã¦ãã
-        objidList[objidData] = unusedObjidList.shift
-      end
-    end
-  end
-
-  #
-  #  éçAPIãã¼ã¿ãããã·ã¥å½¢å¼ã¸å¤æ
-  #
-  $cfgFileInfo.each do |cfgInfo|
-    # ããªãã­ã»ããµãã£ã¬ã¯ãã£ãã¯èª­ã¿é£ã°ã
-    next if cfgInfo.has_key?(:DIRECTIVE)
-
-    apiDef = $apiDefinition[cfgInfo[:API]]
-    apiSym = apiDef[:API].to_sym
-    apiIndex = cfgInfo[:INDEX]
-
-    # ã·ã³ãã«ãã¡ã¤ã«ã«éçAPIã®ã¤ã³ããã¯ã¹ãå­å¨ããªããã°èª­ã¿é£ã°ã
-    #ï¼ifdefç­ã§æ¶ããéçAPIï¼
-    next unless symbolAddress.has_key?("#{cfg1_prefix}static_api_#{apiIndex}")
-
-    # ãã©ã¡ã¼ã¿ã®å¤ãããã·ã¥å½¢å¼ã«æ ¼ç´
-    params = {}
-    apiDef[:PARAM].each do |apiParam|
-      if apiParam.has_key?(:NAME)
-        paramName = apiParam[:NAME]
-        if cfgInfo.has_key?(paramName)
-          paramData = cfgInfo[paramName]
-          value = nil
-          if apiParam.has_key?(:ID_DEF)			# ãªãã¸ã§ã¯ãè­å¥åï¼å®ç¾©ï¼
-            value = objidValue[paramName][paramData]
-          elsif apiParam.has_key?(:ID_REF)		# ãªãã¸ã§ã¯ãè­å¥åï¼åç
-§ï¼
-            if objidValue[paramName].has_key?(paramData)
-              value = objidValue[paramName][paramData]
-            else
-              error("E_OBJ: `#{paramData}' in #{cfgInfo[:API]} is not defined",
+          params[paramName.to_sym] = GetParamValue(paramName, paramData, \
+										apiIndex, "", apiParam, cfgInfo)
+        end
+      end
+
+      # ãã¡ã¤ã³IDãè¿½å 
+      if cfgInfo.has_key?(:DOMAIN)
+        domainName = cfgInfo[:DOMAIN]
+        params[:domain] = $domainId[domainName]
+      end
+
+      # ã¯ã©ã¹IDãè¿½å 
+      if cfgInfo.has_key?(:CLASS)
+        if apiIndex.nil?
+          params[:class] = cfgInfo[:CLASS]
+        else
+          symbol = "#{$cfg1_prefix}valueof_CLASS_#{apiIndex}"
+          value = GetSymbolValue(symbol, $sizeOfSigned, true)
+          params[:class] = NumStr.new(value, cfgInfo[:CLASS])
+        end
+      end
+
+      # APIåï¼ãã¡ã¤ã«åï¼è¡çªå·ãè¿½å 
+      params[:apiname] = cfgInfo[:APINAME]
+      params[:_file_] = cfgInfo[:_FILE_]
+      params[:_line_] = cfgInfo[:_LINE_]
+
+      # ç»é²ã­ã¼ãæ±ºå®ãã
+      if apiDef.has_key?(:KEYPAR)
+        keyParam = params[apiDef[:KEYPAR].to_sym]
+        key = keyParam.val
+        if $cfgData[apiSym].has_key?(key)
+          # ç»é²ã­ã¼ã®éè¤
+          error("E_OBJ: #{apiDef[:KEYPAR]} `#{keyParam}' " \
+								"is duplicated in #{cfgInfo[:APINAME]}",
 								"#{cfgInfo[:_FILE_]}:#{cfgInfo[:_LINE_]}:")
-            end
-          elsif apiParam.has_key?(:SIGNED) || apiParam.has_key?(:UNSIGNED)
-            symbol = "#{cfg1_prefix}valueof_#{paramName}_#{apiIndex}"
-            if (symbolAddress.has_key?(symbol))
-              value = cfg1SRec.get_value(symbolAddress[symbol], \
-							$sizeOfSigned, apiParam.has_key?(:SIGNED))
-            end
-          end
-          params[paramName.to_sym] = StrVal.new(paramData, value)
-        end
-      end
-    end
-
-	# ç»é²ã­ã¼ãæ±ºå®ãã
-    if apiDef.has_key?(:KEYPAR)
-      keyParam = params[apiDef[:KEYPAR].to_sym]
-      key = keyParam.val
-      if $cfgData[apiSym].has_key?(key)
-		# ç»é²ã­ã¼ã®éè¤
-        error("E_OBJ: #{apiDef[:KEYPAR]} `#{keyParam}'" \
-								" is duplicaed in #{cfgInfo[:API]}",
-								"#{cfgInfo[:_FILE_]}:#{cfgInfo[:_LINE_]}:")
-      end
-    else
-      key = $cfgData[apiSym].count + 1
-    end
-
-    # APIåï¼ãã¡ã¤ã«åï¼è¡çªå·ãè¿½å 
-    params[:apiname] = cfgInfo[:API]
-    params[:_file_] = cfgInfo[:_FILE_]
-    params[:_line_] = cfgInfo[:_LINE_]
-    $cfgData[apiSym][key] = params
+        end
+      else
+        key = $cfgData[apiSym].count + 1
+      end
+      $cfgData[apiSym][key] = params
+    end
   end
 
@@ -266,9 +363,9 @@
   #  IDçªå·åºåãã¡ã¤ã«ã®çæ
   #
-  if !$idOutputFileName.nil?
-    idOutputFile = GenFile.new($idOutputFileName)
-    objidValue.each do |objidName, objidList|
-      objidList.each do |objidData, objidNumber|
-        idOutputFile.add("#{objidData} #{objidNumber}")
+  def self.OutputId(fileName)
+    idOutputFile = GenFile.new(fileName)
+    @objidValues.each do |objidParamName, objidList|
+      objidList.each do |objName, objidNumber|
+        idOutputFile.add("#{objName} #{objidNumber}")
       end
     end
@@ -290,10 +387,12 @@
     $cfgFileInfo = db[:cfgFileInfo]
     $includeFiles = db[:includeFiles]
-  end
+    $domainId = db[:domainId]
+  end
+  $cfg2Data = {}
 
   #
   #  ãã¹1ã®çæç©ãèª­ã¿è¾¼ã
   #
-  ReadCfg1Out()
+  Cfg1Out.Read()
   abort if $errorFlag					# ã¨ã©ã¼çºçæã¯abortãã
 
@@ -307,5 +406,16 @@
   #
   $trbFileNames.each do |trbFileName|
+    if /^(.+):(\w+)$/ =~ trbFileName
+      trbFileName = $1
+      Cfg1Out.ReadPhase($2.to_sym)
+    end
     IncludeTrb(trbFileName)
+  end
+
+  #
+  #  IDçªå·åºåãã¡ã¤ã«ã®çæ
+  #
+  if !$idOutputFileName.nil?
+    Cfg1Out.OutputId($idOutputFileName)
   end
 
@@ -323,5 +433,6 @@
       db[:cfgData] = $cfgData
       db[:asmLabel] = $asmLabel
-      db[:bLittleEndian] = $bLittleEndian
+      db[:endianLittle] = $endianLittle
+      db[:cfg2Data] = $cfg2Data
     end
   end
