Index: asp3_wo_tecs/trunk/cfg/GenFile.rb
===================================================================
--- asp3_wo_tecs/trunk/cfg/GenFile.rb	(revision 306)
+++ asp3_wo_tecs/trunk/cfg/GenFile.rb	(revision 306)
@@ -0,0 +1,123 @@
+# -*- coding: utf-8 -*-
+#
+#  TOPPERS Configurator by Ruby
+#
+#  Copyright (C) 2015,2016 by Embedded and Real-Time Systems Laboratory
+#              Graduate School of Information Science, Nagoya Univ., JAPAN
+#  Copyright (C) 2015 by FUJI SOFT INCORPORATED, JAPAN
+#  Copyright (C) 2016 by APTJ Co., Ltd., JAPAN
+#
+#  ä¸è¨èä½æ¨©è
+ã¯ï¼ä»¥ä¸ã®(1)ã(4)ã®æ¡ä»¶ãæºããå ´åã«éãï¼æ¬ã½ããã¦ã§
+#  ã¢ï¼æ¬ã½ããã¦ã§ã¢ãæ¹å¤ãããã®ãå«ãï¼ä»¥ä¸åãï¼ãä½¿ç¨ã»è¤è£½ã»æ¹
+#  å¤ã»åé
+å¸ï¼ä»¥ä¸ï¼å©ç¨ã¨å¼ã¶ï¼ãããã¨ãç¡åã§è¨±è«¾ããï¼
+#  (1) æ¬ã½ããã¦ã§ã¢ãã½ã¼ã¹ã³ã¼ãã®å½¢ã§å©ç¨ããå ´åã«ã¯ï¼ä¸è¨ã®èä½
+#      æ¨©è¡¨ç¤ºï¼ãã®å©ç¨æ¡ä»¶ããã³ä¸è¨ã®ç¡ä¿è¨¼è¦å®ãï¼ãã®ã¾ã¾ã®å½¢ã§ã½ã¼
+#      ã¹ã³ã¼ãä¸­ã«å«ã¾ãã¦ãããã¨ï¼
+#  (2) æ¬ã½ããã¦ã§ã¢ãï¼ã©ã¤ãã©ãªå½¢å¼ãªã©ï¼ä»ã®ã½ããã¦ã§ã¢éçºã«ä½¿
+#      ç¨ã§ããå½¢ã§åé
+å¸ããå ´åã«ã¯ï¼åé
+å¸ã«ä¼´ããã­ã¥ã¡ã³ãï¼å©ç¨
+#      è
+ããã¥ã¢ã«ãªã©ï¼ã«ï¼ä¸è¨ã®èä½æ¨©è¡¨ç¤ºï¼ãã®å©ç¨æ¡ä»¶ããã³ä¸è¨
+#      ã®ç¡ä¿è¨¼è¦å®ãæ²è¼ãããã¨ï¼
+#  (3) æ¬ã½ããã¦ã§ã¢ãï¼æ©å¨ã«çµã¿è¾¼ããªã©ï¼ä»ã®ã½ããã¦ã§ã¢éçºã«ä½¿
+#      ç¨ã§ããªãå½¢ã§åé
+å¸ããå ´åã«ã¯ï¼æ¬¡ã®ããããã®æ¡ä»¶ãæºããã
+#      ã¨ï¼
+#    (a) åé
+å¸ã«ä¼´ããã­ã¥ã¡ã³ãï¼å©ç¨è
+ããã¥ã¢ã«ãªã©ï¼ã«ï¼ä¸è¨ã®è
+#        ä½æ¨©è¡¨ç¤ºï¼ãã®å©ç¨æ¡ä»¶ããã³ä¸è¨ã®ç¡ä¿è¨¼è¦å®ãæ²è¼ãããã¨ï¼
+#    (b) åé
+å¸ã®å½¢æ
+ãï¼å¥ã«å®ããæ¹æ³ã«ãã£ã¦ï¼TOPPERSãã­ã¸ã§ã¯ãã«
+#        å ±åãããã¨ï¼
+#  (4) æ¬ã½ããã¦ã§ã¢ã®å©ç¨ã«ããç´æ¥çã¾ãã¯éæ¥çã«çãããããªãæ
+#      å®³ãããï¼ä¸è¨èä½æ¨©è
+ããã³TOPPERSãã­ã¸ã§ã¯ããå
+è²¬ãããã¨ï¼
+#      ã¾ãï¼æ¬ã½ããã¦ã§ã¢ã®ã¦ã¼ã¶ã¾ãã¯ã¨ã³ãã¦ã¼ã¶ããã®ãããªãç
+#      ç±ã«åºã¥ãè«æ±ãããï¼ä¸è¨èä½æ¨©è
+ããã³TOPPERSãã­ã¸ã§ã¯ãã
+#      å
+è²¬ãããã¨ï¼
+#
+#  æ¬ã½ããã¦ã§ã¢ã¯ï¼ç¡ä¿è¨¼ã§æä¾ããã¦ãããã®ã§ããï¼ä¸è¨èä½æ¨©è
+ã
+#  ãã³TOPPERSãã­ã¸ã§ã¯ãã¯ï¼æ¬ã½ããã¦ã§ã¢ã«é¢ãã¦ï¼ç¹å®ã®ä½¿ç¨ç®ç
+#  ã«å¯¾ããé©åæ§ãå«ãã¦ï¼ãããªãä¿è¨¼ãè¡ããªãï¼ã¾ãï¼æ¬ã½ããã¦ã§
+#  ã¢ã®å©ç¨ã«ããç´æ¥çã¾ãã¯éæ¥çã«çãããããªãæå®³ã«é¢ãã¦ãï¼ã
+#  ã®è²¬ä»»ãè² ããªãï¼
+#
+#  $Id: GenFile.rb 111 2016-03-16 23:50:27Z ertl-hiro $
+#
+
+#
+#		ãã¡ã¤ã«ä½æã¯ã©ã¹
+#
+
+#
+# ãã¡ã¤ã«ã«æ¸ããã¨ããå
+å®¹ãå¤æ°ã«èç©ãï¼ãã­ã°ã©ã ã®çµäºæï¼output
+# ã¡ã½ãããå¼ã°ããæï¼ã«ãã¡ã¤ã«ã«åºåããï¼æ¢ã«ãã¡ã¤ã«ãå­å¨ãï¼å·®
+# åããªãå ´åã¯åºåããªãï¼ã¿ã¤ã ã¹ã¿ã³ããæ´æ°ããªãï¼ï¼
+#
+class GenFile
+  @@fileDataHash = {}
+
+  def initialize(fileName)
+    @selfFileName = fileName
+    if !@@fileDataHash.has_key?(fileName)
+      @@fileDataHash[@selfFileName] = ""
+    end
+  end
+
+  # ãã¡ã¤ã«ãã¼ã¿ã®æ«å°¾ã«æå­åãè¿½å ãã
+  def append(code = "")
+    @@fileDataHash[@selfFileName] << code
+  end
+
+  # ãã¡ã¤ã«ãã¼ã¿ã«1è¡è¿½å ãã
+  def add(code = "")
+    @@fileDataHash[@selfFileName] << code << "\n"
+  end
+
+  # ãã¡ã¤ã«ãã¼ã¿ã«1è¡è¿½å ãã(æ¹è¡2å)
+  def add2(code = "")
+    add(code + "\n")
+  end
+
+  # ã³ã¡ã³ãããããè¿½å ãã
+  def comment_header(comment)
+    add("/*")
+    comment.split("\n").each do |sLine|
+      add(" *  " + sLine)
+    end
+    add2(" */")
+  end
+
+  # ãã¡ã¤ã«ãã¼ã¿ãè¡¨ç¤ºãã
+  def print()
+    puts(@@fileDataHash[@selfFileName])
+  end
+
+  # å
+¨ãã¡ã¤ã«ãåºåãã
+  def self.output()
+    @@fileDataHash.each do |fileName, fileData|
+      # æ¢ã«ãã¡ã¤ã«ãå­å¨ãï¼å·®åããªãå ´åã¯åºåããªã
+      #ï¼ã¿ã¤ã ã¹ã¿ã³ããæ´æ°ããªãï¼
+      if File.exist?(fileName)
+        if fileData == File.read(fileName)
+          next
+        end
+      end
+      File.open(fileName, "w") do |file|
+        puts("[#{File.basename($0)}] Generated #{fileName}")
+        file.puts(fileData)
+      end
+    end
+  end
+end
Index: asp3_wo_tecs/trunk/cfg/MANIFEST
===================================================================
--- asp3_wo_tecs/trunk/cfg/MANIFEST	(revision 305)
+++ asp3_wo_tecs/trunk/cfg/MANIFEST	(revision 306)
@@ -3,6 +3,6 @@
 pass1.rb
 pass2.rb
+GenFile.rb
+SRecord.rb
 
-common/GenFile.rb
-common/StrVal.rb
-common/SRecord.rb
+doc/cfg_user.txt
Index: asp3_wo_tecs/trunk/cfg/SRecord.rb
===================================================================
--- asp3_wo_tecs/trunk/cfg/SRecord.rb	(revision 306)
+++ asp3_wo_tecs/trunk/cfg/SRecord.rb	(revision 306)
@@ -0,0 +1,190 @@
+# -*- coding: utf-8 -*-
+#
+#  TOPPERS Configurator by Ruby
+#
+#  Copyright (C) 2015,2016 by Embedded and Real-Time Systems Laboratory
+#              Graduate School of Information Science, Nagoya Univ., JAPAN
+#  Copyright (C) 2015 by FUJI SOFT INCORPORATED, JAPAN
+#
+#  ä¸è¨èä½æ¨©è
+ã¯ï¼ä»¥ä¸ã®(1)ã(4)ã®æ¡ä»¶ãæºããå ´åã«éãï¼æ¬ã½ããã¦ã§
+#  ã¢ï¼æ¬ã½ããã¦ã§ã¢ãæ¹å¤ãããã®ãå«ãï¼ä»¥ä¸åãï¼ãä½¿ç¨ã»è¤è£½ã»æ¹
+#  å¤ã»åé
+å¸ï¼ä»¥ä¸ï¼å©ç¨ã¨å¼ã¶ï¼ãããã¨ãç¡åã§è¨±è«¾ããï¼
+#  (1) æ¬ã½ããã¦ã§ã¢ãã½ã¼ã¹ã³ã¼ãã®å½¢ã§å©ç¨ããå ´åã«ã¯ï¼ä¸è¨ã®èä½
+#      æ¨©è¡¨ç¤ºï¼ãã®å©ç¨æ¡ä»¶ããã³ä¸è¨ã®ç¡ä¿è¨¼è¦å®ãï¼ãã®ã¾ã¾ã®å½¢ã§ã½ã¼
+#      ã¹ã³ã¼ãä¸­ã«å«ã¾ãã¦ãããã¨ï¼
+#  (2) æ¬ã½ããã¦ã§ã¢ãï¼ã©ã¤ãã©ãªå½¢å¼ãªã©ï¼ä»ã®ã½ããã¦ã§ã¢éçºã«ä½¿
+#      ç¨ã§ããå½¢ã§åé
+å¸ããå ´åã«ã¯ï¼åé
+å¸ã«ä¼´ããã­ã¥ã¡ã³ãï¼å©ç¨
+#      è
+ããã¥ã¢ã«ãªã©ï¼ã«ï¼ä¸è¨ã®èä½æ¨©è¡¨ç¤ºï¼ãã®å©ç¨æ¡ä»¶ããã³ä¸è¨
+#      ã®ç¡ä¿è¨¼è¦å®ãæ²è¼ãããã¨ï¼
+#  (3) æ¬ã½ããã¦ã§ã¢ãï¼æ©å¨ã«çµã¿è¾¼ããªã©ï¼ä»ã®ã½ããã¦ã§ã¢éçºã«ä½¿
+#      ç¨ã§ããªãå½¢ã§åé
+å¸ããå ´åã«ã¯ï¼æ¬¡ã®ããããã®æ¡ä»¶ãæºããã
+#      ã¨ï¼
+#    (a) åé
+å¸ã«ä¼´ããã­ã¥ã¡ã³ãï¼å©ç¨è
+ããã¥ã¢ã«ãªã©ï¼ã«ï¼ä¸è¨ã®è
+#        ä½æ¨©è¡¨ç¤ºï¼ãã®å©ç¨æ¡ä»¶ããã³ä¸è¨ã®ç¡ä¿è¨¼è¦å®ãæ²è¼ãããã¨ï¼
+#    (b) åé
+å¸ã®å½¢æ
+ãï¼å¥ã«å®ããæ¹æ³ã«ãã£ã¦ï¼TOPPERSãã­ã¸ã§ã¯ãã«
+#        å ±åãããã¨ï¼
+#  (4) æ¬ã½ããã¦ã§ã¢ã®å©ç¨ã«ããç´æ¥çã¾ãã¯éæ¥çã«çãããããªãæ
+#      å®³ãããï¼ä¸è¨èä½æ¨©è
+ããã³TOPPERSãã­ã¸ã§ã¯ããå
+è²¬ãããã¨ï¼
+#      ã¾ãï¼æ¬ã½ããã¦ã§ã¢ã®ã¦ã¼ã¶ã¾ãã¯ã¨ã³ãã¦ã¼ã¶ããã®ãããªãç
+#      ç±ã«åºã¥ãè«æ±ãããï¼ä¸è¨èä½æ¨©è
+ããã³TOPPERSãã­ã¸ã§ã¯ãã
+#      å
+è²¬ãããã¨ï¼
+#
+#  æ¬ã½ããã¦ã§ã¢ã¯ï¼ç¡ä¿è¨¼ã§æä¾ããã¦ãããã®ã§ããï¼ä¸è¨èä½æ¨©è
+ã
+#  ãã³TOPPERSãã­ã¸ã§ã¯ãã¯ï¼æ¬ã½ããã¦ã§ã¢ã«é¢ãã¦ï¼ç¹å®ã®ä½¿ç¨ç®ç
+#  ã«å¯¾ããé©åæ§ãå«ãã¦ï¼ãããªãä¿è¨¼ãè¡ããªãï¼ã¾ãï¼æ¬ã½ããã¦ã§
+#  ã¢ã®å©ç¨ã«ããç´æ¥çã¾ãã¯éæ¥çã«çãããããªãæå®³ã«é¢ãã¦ãï¼ã
+#  ã®è²¬ä»»ãè² ããªãï¼
+#
+#  $Id: SRecord.rb 107 2016-03-14 03:29:58Z ertl-hiro $
+#
+
+#
+#		Sã¬ã³ã¼ããã¡ã¤ã«å¦çã¯ã©ã¹
+#
+
+#
+# Sã¬ã³ã¼ããã¡ã¤ã«ãå¤æ°ã«èª­ã¿è¾¼ã¿ï¼è¦æ±ãããçªå°ã®ãã¼ã¿ãè¿ãï¼
+#
+# @sRecDataã¯ï¼å
+é ­çªå°ãã­ã¼ã¨ãï¼ããããã®ãã¼ã¿ï¼ãã­ãµãã³ãå½¢å¼ï¼
+# ãå¤ã¨ãã­ãã¯ãæ ¼ç´ãããããã·ã¥ã§ããï¼é£ç¶ãããã­ãã¯ã¯ï¼1ã¤ã®ã
+# ã­ãã¯ã«ã¾ã¨ãã¦æ ¼ç´ãããã®ã¨ããï¼ããããªãã¨ï¼ãã¼ã¿ã®ååºãããµã¼
+# ããé¢åã«ãªãï¼ï¼
+#
+class SRecord
+  def initialize(fileName)
+    @sRecData = {}
+    File.open(fileName) do |file|
+      prevAddress = 0
+      prevData = ""
+      file.each do |line|
+        # ãã¼ã¿ã¬ã³ã¼ãã«ããåå²
+        case line.slice(0, 2)
+        when "S1"
+          # ãã¼ã¿é·ï¼ã¢ãã¬ã¹å[2byte]+ãã§ãã¯ãµã å1byteãæ¸ç®ï¼
+          length = line.slice(2, 2).hex - 2 - 1
+
+          # ã¢ãã¬ã¹ï¼4æå­=2byteï¼
+          address = line.slice(4, 4).hex
+
+          # ãã¼ã¿ï¼ãã®æç¹ã§ã¯æå­åã§åã£ã¦ããï¼
+          data = line.slice(8, length * 2)
+        when "S2"
+          # ãã¼ã¿é·ï¼ã¢ãã¬ã¹å[3byte]+ãã§ãã¯ãµã å1byteãæ¸ç®ï¼
+          length = line.slice(2, 2).hex - 3 - 1
+
+          # ã¢ãã¬ã¹ï¼6æå­=3byteï¼
+          address = line.slice(4, 6).hex
+
+          # ãã¼ã¿ï¼ãã®æç¹ã§ã¯æå­åã§åã£ã¦ããï¼
+          data = line.slice(10, length * 2)
+        when "S3"
+          # ãã¼ã¿é·ï¼ã¢ãã¬ã¹å[4byte]+ãã§ãã¯ãµã å1byteãæ¸ç®ï¼
+          length = line.slice(2, 2).hex - 4 - 1
+
+          # ã¢ãã¬ã¹ï¼8æå­=4byteï¼
+          address = line.slice(4, 8).hex
+
+          # ãã¼ã¿ï¼ãã®æç¹ã§ã¯æå­åã§åã£ã¦ããï¼
+          data = line.slice(12, length * 2)
+        else
+          address = nil
+        end
+
+        if !address.nil?
+          # ãã¼ã¿ãæ ¼ç´ãã
+          if address == prevAddress + prevData.size / 2
+            prevData << data
+          else
+            set_data(prevAddress, prevData) if prevData.size > 0
+            prevAddress = address
+            prevData = data
+          end
+        end
+      end
+      set_data(prevAddress, prevData) if prevData.size > 0
+    end
+  end
+
+  # ãã¼ã¿åå¾
+  def get_data(address, size)
+    endAddress = address + size
+    @sRecData.each do |block, blockData|
+      if (block <= address && endAddress <= block + blockData.size / 2)
+        offset = (address - block) * 2
+        return(blockData[offset, size * 2])
+      end
+    end
+    return(nil)
+  end
+
+  # ãã¼ã¿æ¸è¾¼ã¿
+  def set_data(address, data)
+    endAddress = address + data.size / 2
+    @sRecData.each do |block, blockData|
+      nEndBlock = block + blockData.size / 2
+
+      if nEndBlock < address || endAddress < block
+        # éãªãããªã
+      elsif address < block
+        # æ°è¦ãã¼ã¿ã®æ¹ãå
+é ­çªå°ãå°ãã
+        # ããã§ã¯ endAddress >= block ãæç«ãã¦ãã
+        offset = (endAddress - block) * 2
+        data << blockData[offset..-1]
+        @sRecData.delete(block)
+      else
+        # ç»é²æ¸ã¿ãã¼ã¿ã®æ¹ãå
+é ­çªå°ãå°ãããåã
+        offset = (address - block) * 2
+        address = block
+        blockData[offset, data.size] = data
+        data = blockData
+        @sRecData.delete(block)
+      end
+    end
+    @sRecData[address] = data
+  end
+
+  # å¤ã¨ãã¦ã®ãã¼ã¿åå¾
+  def get_value(address, size, signed)
+    targetData = get_data(address, size)
+    if targetData.nil?
+      return(nil)
+    else
+      if $endianLittle
+        # ãªãã«ã¨ã³ãã£ã¢ã³ã®å ´åï¼ãã¤ããªã¼ãã¼ãéã«ãã
+        reverseData = ""
+        # å¾ããã2æå­ãã¤æãåºãï¼ä¸¦ã³æ¿ãã
+        while targetData.size > 0
+          reverseData << targetData[-2, 2]
+          targetData.slice!(-2, 2)
+        end
+        returnData = reverseData.hex
+      else
+        returnData = targetData.hex
+      end
+
+      # è² ã®æ°ã®å¦ç
+      if signed && (returnData & (1 << (size * 8 - 1))) != 0
+        returnData -= (1 << (size * 8))
+      end
+      return(returnData)
+    end
+  end
+end
Index: asp3_wo_tecs/trunk/cfg/cfg.rb
===================================================================
--- asp3_wo_tecs/trunk/cfg/cfg.rb	(revision 305)
+++ asp3_wo_tecs/trunk/cfg/cfg.rb	(revision 306)
@@ -52,8 +52,8 @@
 #  ã®è²¬ä»»ãè² ããªãï¼
 #
-#  $Id: cfg.rb 32 2016-01-31 14:45:59Z ertl-hiro $
-#
-
-if ($0 == __FILE__)
+#  $Id: cfg.rb 111 2016-03-16 23:50:27Z ertl-hiro $
+#
+
+if $0 == __FILE__
   TOOL_ROOT = File.expand_path(File.dirname(__FILE__)) + "/"
   $LOAD_PATH.unshift(TOOL_ROOT)
@@ -64,7 +64,6 @@
 require "optparse"
 require "pstore"
-require "common/GenFile.rb"
-require "common/StrVal.rb"
-require "common/SRecord.rb"
+require "GenFile.rb"
+require "SRecord.rb"
 
 #
@@ -73,5 +72,5 @@
 # å
 ±é
-VERSION = "1.0.0"
+VERSION = "1.2.1"
 
 # cfg1_outé¢ä¿
@@ -84,7 +83,11 @@
 CFG1_OUT_SYMS      = "cfg1_out.syms"
 CFG1_OUT_TIMESTAMP = "cfg1_out.timestamp"
+CFG1_OUT_TARGET_H  = "target_cfg1_out.h"
 
 # cfg2_outé¢ä¿
 CFG2_OUT_DB        = "cfg2_out.db"
+
+# cfg3_outé¢ä¿
+CFG3_OUT_DB        = "cfg3_out.db"
 
 #
@@ -116,15 +119,51 @@
 
 # ã·ã¹ãã ã³ã³ãã£ã®ã¥ã¬ã¼ã·ã§ã³ãã¡ã¤ã«ã®æ§æè§£ææã®ã¨ã©ã¼
-$no_parse_error = 0
+$noParseError = 0
 def parse_error(cfgFile, message)
   error(message, "#{cfgFile.getFileName()}:#{cfgFile.getLineNo}:")
-  if ($no_parse_error += 1) >= 10
-    error_exit("too many errors emitted, stopping now")
-  end
+  if ($noParseError += 1) >= 10
+    abort("too many errors emitted, stopping now")
+  end
+end
+
+# ã·ã¹ãã ã³ã³ãã£ã®ã¥ã¬ã¼ã·ã§ã³ãã¡ã¤ã«ã®æ§æè§£ææã®è­¦å
+def parse_warning(cfgFile, message)
+  warning(message, "#{cfgFile.getFileName()}:#{cfgFile.getLineNo}:")
+end
+
+#
+#  éçAPIå¦çæã®ã¨ã©ã¼ï¼è­¦åè¡¨ç¤ºé¢æ°
+#
+# éçAPIå¦çæã®ã¨ã©ã¼ï¼è­¦åãç­ãè¨è¿°ã§ããããã«ï¼ã¡ãã»ã¼ã¸ä¸­ã®%ã¾
+# ãã¯%%ã§å§ã¾ãè¨è¿°ãä»¥ä¸ã®ããã«å±éããï¼
+#	%label â #{params[:label]}
+#	%%label â label `#{params[:label]}'
+#
+# ã¨ã©ã¼ï¼è­¦åã¡ãã»ã¼ã¸ã®å±é
+def expand_message(message, params)
+  result = message.dup
+  while /%%(\w+)\b/ =~ result
+    param = $1
+    paramVal = params[param.to_sym].to_s
+    result.sub!(/%%#{param}\b/, "#{param} `#{paramVal}'")
+  end
+  while /%(\w+)\b/ =~ result
+    param = $1
+    paramVal = params[param.to_sym].to_s
+    result.sub!(/%#{param}\b/, paramVal)
+  end
+  return(result)
 end
 
 # éçAPIå¦çæã®ã¨ã©ã¼
 def error_api(params, message)
-  error(message, "#{params[:_file_]}:#{params[:_line_]}:")
+  error(expand_message(message, params), \
+			"#{params[:_file_]}:#{params[:_line_]}:")
+end
+
+# éçAPIå¦çæã®è­¦å
+def warning_api(params, message)
+  warning(expand_message(message, params), \
+			"#{params[:_file_]}:#{params[:_line_]}:")
 end
 
@@ -134,40 +173,37 @@
 end
 
-# éçAPIå¦çæã®è­¦å
-def warning_api(params, message)
-  warning(message, "#{params[:_file_]}:#{params[:_line_]}:")
+# éçAPIå¦çæã®è­¦åï¼ã¨ã©ã¼ã³ã¼ãä»ãï¼
+def warning_ercd(errorCode, params, message)
+  warning_api(params, "#{errorCode}: #{message}")
 end
 
 # ãã©ã¡ã¼ã¿ã®ã¨ã©ã¼
 def error_wrong(errorCode, params, symbol, wrong)
-  error_ercd(errorCode, params, "#{symbol.to_s} `#{params[symbol]}'" \
-									" is #{wrong} in #{params[:apiname]}")
+  error_ercd(errorCode, params, "%%#{symbol} is #{wrong} in %apiname")
 end
 
 def error_wrong_id(errorCode, params, symbol, objid, wrong)
-  error_ercd(errorCode, params, "#{symbol.to_s} `#{params[symbol]}'" \
-				" is #{wrong} in #{params[:apiname]} of #{params[objid]}")
+  error_ercd(errorCode, params, "%%#{symbol} is #{wrong} " \
+	             					"in %apiname of %#{objid}")
 end
 
 def error_wrong_sym(errorCode, params, symbol, symbol2, wrong)
-  error_ercd(errorCode, params, "#{symbol.to_s} `#{params[symbol]}'" \
-								" is #{wrong} in #{params[:apiname]}" \
-								" of #{symbol2.to_s} `#{params[symbol2]}'")
+  error_ercd(errorCode, params, "%%#{symbol} is #{wrong} " \
+									"in %apiname of %%#{symbol2}")
 end
 
 # ãã©ã¡ã¼ã¿ä¸æ­£ã®ã¨ã©ã¼
 def error_illegal(errorCode, params, symbol)
-  error_ercd(errorCode, params, "illegal #{symbol.to_s} `#{params[symbol]}'" \
-													" in #{params[:apiname]}")
+  error_ercd(errorCode, params, "illegal %%#{symbol} in %apiname")
 end
 
 def error_illegal_id(errorCode, params, symbol, objid)
-  error_ercd(errorCode, params, "illegal #{symbol.to_s} `#{params[symbol]}'" \
-								" in #{params[:apiname]} of #{params[objid]}")
+  error_ercd(errorCode, params, "illegal %%#{symbol} " \
+	             					"in %apiname of %#{objid}")
 end
 
 def error_illegal_sym(errorCode, params, symbol, symbol2)
-  error_ercd(errorCode, params, "illegal #{symbol.to_s} `#{params[symbol]}'" \
-			" in #{params[:apiname]} of #{symbol2.to_s} `#{params[symbol2]}'")
+  error_ercd(errorCode, params, "illegal %%#{symbol} " \
+									"in %apiname of %%#{symbol2}")
 end
 
@@ -263,4 +299,82 @@
 
 #
+#  NumStrã¯ã©ã¹ï¼æ°å¤ã«æå­åãä»å ãããã®ï¼ã®å®ç¾©
+#
+class NumStr
+  def initialize(val, str = val.to_s)
+    @val = val
+    @str = str
+  end
+
+  # æ°å¤æ
+å ±ãè¿ã
+  def val
+    return @val
+  end
+  alias_method :to_i, :val
+
+  # æå­åæ
+å ±ãè¿ã
+  def str
+    return @str
+  end
+  alias_method :to_s, :str
+
+  # æ¯è¼ã¯æ°å¤æ
+å ±ã§è¡ã
+  def ==(other)
+    @val == other
+  end
+  def !=(other)
+    @val != other
+  end
+  def <=>(other)
+    @val <=> other
+  end
+
+  # ããã·ã¥ã®ã­ã¼ã¨ãã¦ä½¿ãæã®æ¯è¼ãæ°å¤æ
+å ±ã§è¡ã
+  def eql?(other)
+    @val == other.val
+  end
+
+  # ããã·ã¥å¤ã®å®ç¾©ãä¸æ¸ããã
+  def hash
+    return @val.hash
+  end
+
+  # æ°å¤ã¯ã©ã¹ã¨æ¼ç®ã§ããããã«ãã
+  def coerce(other)
+    if other.kind_of?(Numeric)
+      return other, @val
+    else
+      raise
+    end
+  end
+
+  # äºéå¼ç¨ç¬¦ã§å²ã¾ããæå­åã®ä½æ
+  def quote
+    str.quote
+  end
+
+  # äºéå¼ç¨ç¬¦ã§å²ã¾ããæå­åã®å±é
+  def unquote
+    str.unquote
+  end
+
+  # ppæã®è¡¨ç¤º
+  def pretty_print(q)
+    q.text("[#{@val}(=0x#{@val.to_s(16)}),")
+    @str.pretty_print(q)
+    q.text("]")
+  end
+
+  # æªå®ç¾©ã®ã¡ã½ããã¯@valã«éã
+  def method_missing(*method)
+    @val.send(*method)
+  end
+end
+
+#
 #  ã·ã³ãã«ãã¡ã¤ã«ã®èª­ã¿è¾¼ã¿
 #
@@ -281,5 +395,5 @@
 
     # 3åã«ãªã£ã¦ããªãè¡ã¯é¤å¤
-    if (fields.size == 3)
+    if fields.size == 3
       symbolAddress[fields[2]] = fields[0].hex
     end
@@ -295,8 +409,7 @@
   $symbolValueTable.each do |symbolName, symbolData|
     if symbolData.has_key?(:VALUE)
-        eval("$#{symbolName} = " \
-				"StrVal.new(\"#{symbolName}\", #{symbolData[:VALUE]})")
+      eval("$#{symbolName} = #{symbolData[:VALUE]}")
     end
- end
+  end
 end
 
@@ -314,6 +427,6 @@
   else
     # åã¤ã³ã¯ã«ã¼ããã¹ãããã¡ã¤ã«å­å¨ãã§ãã¯
-    $includePaths.each do |includePath|
-      path = includePath + "/" + fileName
+    $includeDirectories.each do |includeDirectory|
+      path = includeDirectory + "/" + fileName
       # è¦ã¤ãã£ããç¸å¯¾ãã¹ãè¿ã
       if File.exist?(path)
@@ -353,5 +466,58 @@
     $cfgData = db[:cfgData]
     $asmLabel = db[:asmLabel]
-    $bLittleEndian = db[:bLittleEndian]
+    $endianLittle = db[:endianLittle]
+    $cfg2Data = db[:cfg2Data]
+  end
+  $cfg3Data = {}
+
+  #
+  #  å¤åå¾ã·ã³ãã«ãã°ã­ã¼ãã«å¤æ°ã¨ãã¦å®ç¾©ãã
+  #
+  DefineSymbolValue()
+
+  #
+  #  çæã¹ã¯ãªããï¼trbãã¡ã¤ã«ï¼ãå®è¡ãã
+  #
+  $trbFileNames.each do |trbFileName|
+    IncludeTrb(trbFileName)
+  end
+
+  #
+  #  ãã¹4ã«å¼ãæ¸¡ãæ
+å ±ããã¡ã¤ã«ã«çæ
+  #
+  if $omitOutputDb.nil?
+    db = PStore.new(CFG3_OUT_DB)
+    db.transaction do
+      db[:apiDefinition] = $apiDefinition
+      db[:symbolValueTable] = $symbolValueTable
+      db[:cfgFileInfo] = $cfgFileInfo
+      db[:includeFiles] = $includeFiles
+      db[:cfgData] = $cfgData
+      db[:asmLabel] = $asmLabel
+      db[:endianLittle] = $endianLittle
+      db[:cfg3Data] = $cfg3Data
+    end
+  end
+end
+
+#
+#  ãã¹4ã®å¦ç
+#
+def Pass4
+  #
+  #  ãã¹3ããå¼ãæ¸¡ãããæ
+å ±ããã¡ã¤ã«ããèª­ã¿è¾¼ã
+  #
+  db = PStore.new(CFG3_OUT_DB)
+  db.transaction(true) do
+    $apiDefinition = db[:apiDefinition]
+    $symbolValueTable = db[:symbolValueTable]
+    $cfgFileInfo = db[:cfgFileInfo]
+    $includeFiles = db[:includeFiles]
+    $cfgData = db[:cfgData]
+    $asmLabel = db[:asmLabel]
+    $endianLittle = db[:endianLittle]
+    $cfg3Data = db[:cfg3Data] || db[:cfg2Data]
   end
 
@@ -380,14 +546,14 @@
 end
 
-def BCOPY(startIData, startData, size)
+def BCOPY(fromAddress, toAddress, size)
   if !$romImage.nil?
-    copyData = $romImage.get_data(startIData, size)
-    $romImage.set_data(startData, copyData)
-  end
-end
-
-def PEEK(address, size)
+    copyData = $romImage.get_data(fromAddress, size)
+    $romImage.set_data(toAddress, copyData)
+  end
+end
+
+def PEEK(address, size, signed=false)
   if !$romImage.nil?
-    return $romImage.get_value(address, size, false)
+    return $romImage.get_value(address, size, signed)
   else
     return nil
@@ -400,5 +566,5 @@
 $kernel = nil
 $pass = nil
-$includePaths = []
+$includeDirectories = []
 $trbFileNames = []
 $apiTableFileNames = []
@@ -413,72 +579,64 @@
 #  ãªãã·ã§ã³ã®å¦ç
 #
-opt = OptionParser.new(banner="Usage: cfg.rb [options] CONFIG-FILE", 40)
-opt.version = VERSION
-opt.on("-k KERNEL", "--kernel KERNEL", "kernel profile name") do |val|
-  $kernel = val
-end
-opt.on("-p NUM", "--pass NUM", "processing pass number") do |val|
-  $pass = val
-end
-opt.on("-I PATH", "--include-path PATH", "include directory path") do |val|
-  $includePaths.push(val)
-end
-opt.on("-T TRB-FILE", "--trb-file TRB-FILE",
-								"generation script (trb file)") do |val|
-  $trbFileNames.push(val)
-end
-opt.on("--api-table API-TABLE-FILE", "static API table file") do |val|
-  $apiTableFileNames.push(val)
-end
-opt.on("--symval-table SYMVAL-TABLE-FILE", "symbol-value table file") do |val|
-  $symvalTableFileNames.push(val)
-end
-opt.on("--rom-image SREC-FILE", "rom image file (s-record)") do |val|
-  $romImageFileName = val
-end
-opt.on("--rom-symbol SYMS-FILE", "rom symbol table file (nm)") do |val|
-  $romSymbolFileName = val
-end
-opt.on("--id-input-file ID-FILE", "ID input file") do |val|
-  $idInputFileName = val
-end
-opt.on("--id-output-file ID-FILE", "ID output file") do |val|
-  $idOutputFileName = val
-end
-opt.on("--external-id", "generate object ID variables") do
-  $USE_EXTERNAL_ID = true
-end
-opt.on("-M [DEPEND-FILE]", "--print-dependencies [DEPEND-FILE]",
-										"dependency file") do |val|
-  $dependencyFileName = val.nil? ? "" : val
-end
-opt.on("-O", "--omit-output-db", "omit DB file output") do
-  $omitOutputDb = true
-end
-opt.on("-v", "--version", "show version number") do
-  abort(opt.ver)
-end
-opt.on("-h", "--help", "show help (this)") do
-  abort(opt.help)
-end
-
-begin
-  $configFileNames = opt.parse(ARGV)
-rescue OptionParser::ParseError
-  abort(opt.help)
-end
+OptionParser.new(banner="Usage: cfg.rb [options] CONFIG-FILE", 40) do |opt|
+  opt.version = VERSION
+  opt.on("-k KERNEL", "--kernel KERNEL", "kernel profile name") do |val|
+    $kernel = val
+  end
+  opt.on("-p NUM", "--pass NUM", "processing pass number") do |val|
+    $pass = val
+  end
+  opt.on("-I DIRECTORY", "--include-directory DIRECTORY",
+										 "include directory") do |val|
+    $includeDirectories.push(val)
+  end
+  opt.on("-T TRB-FILE", "--trb-file TRB-FILE",
+         "generation script (trb file)") do |val|
+    $trbFileNames.push(val)
+  end
+  opt.on("--api-table API-TABLE-FILE", "static API table file") do |val|
+    $apiTableFileNames.push(val)
+  end
+  opt.on("--symval-table SYMVAL-TABLE-FILE", "symbol-value table file") do |val|
+    $symvalTableFileNames.push(val)
+  end
+  opt.on("--rom-image SREC-FILE", "rom image file (s-record)") do |val|
+    $romImageFileName = val
+  end
+  opt.on("--rom-symbol SYMS-FILE", "rom symbol table file (nm)") do |val|
+    $romSymbolFileName = val
+  end
+  opt.on("--id-input-file ID-FILE", "ID input file") do |val|
+    $idInputFileName = val
+  end
+  opt.on("--id-output-file ID-FILE", "ID output file") do |val|
+    $idOutputFileName = val
+  end
+  opt.on("-M [DEPEND-FILE]", "--print-dependencies [DEPEND-FILE]",
+         "dependency file") do |val|
+    $dependencyFileName = val.nil? ? "" : val
+  end
+  opt.on("-O", "--omit-output-db", "omit DB file output") do
+    $omitOutputDb = true
+  end
+  opt.on("-v", "--version", "show version number") do
+    abort(opt.ver)
+  end
+  opt.on("-h", "--help", "show help (this)") do
+    abort(opt.help)
+  end
+  opt.parse!(ARGV)
+end
+$configFileNames = ARGV
 
 #
 #  ãªãã·ã§ã³ã®ãã§ãã¯
 #
-# ä¾å­é¢ä¿åºåã¢ã¼ã
 if $pass.nil?
   # ãã¹ã®æå®ã¯å¿
 é 
-  STDERR.puts("`--pass' option is mandatory")
-  abort(opt.help)
-elsif /^[123]$/ !~ $pass
-  STDERR.puts("pass number `#{$pass}' is not valid")
-  abort(opt.help)
+  abort("`--pass' option is mandatory")
+elsif /^[1234]$/ !~ $pass
+  abort("pass number `#{$pass}' is not valid")
 end
 
@@ -486,6 +644,5 @@
 é 
 if ($pass == "1" && $apiTableFileNames.empty?)
-  STDERR.puts("`--api-table' option must be specified in pass 1")
-  abort(opt.help)
+  abort("`--api-table' option must be specified in pass 1")
 end
 
@@ -493,6 +650,35 @@
 é 
 if ($pass != "1" && $trbFileNames.empty?)
-  STDERR.puts("`--trb-file' must be specified except in pass 1")
-  abort(opt.help)
+  abort("`--trb-file' must be specified except in pass 1")
+end
+
+#
+#  ã«ã¼ãã«ãªãã·ã§ã³ã®å¦ç
+#
+case $kernel
+when /^hrp/
+	$supportDomain = true
+when /^fmp/
+	$supportClass = true
+end
+
+#
+#  IDçªå·å
+¥åãã¡ã¤ã«ã®åãè¾¼ã¿
+#
+$inputObjid = {}
+if !$idInputFileName.nil?
+  begin
+    idInputFile = File.open($idInputFileName)
+  rescue Errno::ENOENT, Errno::EACCES => ex
+    abort(ex.message)
+  end
+
+  idInputFile.each do |line|
+    ( objName, objidNumber ) = line.split(/\s+/)
+    $inputObjid[objName] = objidNumber.to_i
+  end
+
+  idInputFile.close
 end
 
@@ -531,4 +717,6 @@
 when "3"
   Pass3()
+when "4"
+  Pass4()
 else
   error_exit("invalid pass: #{$pass}")
Index: asp3_wo_tecs/trunk/cfg/doc/cfg_user.txt
===================================================================
--- asp3_wo_tecs/trunk/cfg/doc/cfg_user.txt	(revision 306)
+++ asp3_wo_tecs/trunk/cfg/doc/cfg_user.txt	(revision 306)
@@ -0,0 +1,905 @@
+
+		TOPPERSç¬¬3ä¸ä»£ã«ã¼ãã«åã Rubyçã³ã³ãã£ã®ã¥ã¬ã¼ã¿
+		ã¦ã¼ã¶ã¼ãºããã¥ã¢ã«
+
+		å¯¾å¿ãã¼ã¸ã§ã³: Release 1.2.1
+		æçµæ´æ°: 2016å¹´3æ17æ¥
+
+ãã®ãã­ã¥ã¡ã³ãã¯ï¼TOPPERSç¬¬3ä¸ä»£ã«ã¼ãã«åãRubyçã³ã³ãã£ã®ã¥ã¬ã¼ã¿
+ãä½¿ç¨ããããã«å¿
+è¦ãªäºé 
+ãèª¬æãããã®ã§ããï¼Rubyã«ã¤ãã¦ã®ç¥è­ãã
+ããã¨ãåæã«è¨è¿°ãã¦ããï¼
+
+----------------------------------------------------------------------
+ TOPPERS Configurator by Ruby
+
+ Copyright (C) 2015 by FUJI SOFT INCORPORATED, JAPAN
+ Copyright (C) 2015,2016 by Embedded and Real-Time Systems Laboratory
+             Graduate School of Information Science, Nagoya Univ., JAPAN
+
+ ä¸è¨èä½æ¨©è
+ã¯ï¼ä»¥ä¸ã®(1)ã(4)ã®æ¡ä»¶ãæºããå ´åã«éãï¼æ¬ã½ããã¦ã§
+ ã¢ï¼æ¬ã½ããã¦ã§ã¢ãæ¹å¤ãããã®ãå«ãï¼ä»¥ä¸åãï¼ãä½¿ç¨ã»è¤è£½ã»æ¹
+ å¤ã»åé
+å¸ï¼ä»¥ä¸ï¼å©ç¨ã¨å¼ã¶ï¼ãããã¨ãç¡åã§è¨±è«¾ããï¼
+ (1) æ¬ã½ããã¦ã§ã¢ãã½ã¼ã¹ã³ã¼ãã®å½¢ã§å©ç¨ããå ´åã«ã¯ï¼ä¸è¨ã®èä½
+     æ¨©è¡¨ç¤ºï¼ãã®å©ç¨æ¡ä»¶ããã³ä¸è¨ã®ç¡ä¿è¨¼è¦å®ãï¼ãã®ã¾ã¾ã®å½¢ã§ã½ã¼
+     ã¹ã³ã¼ãä¸­ã«å«ã¾ãã¦ãããã¨ï¼
+ (2) æ¬ã½ããã¦ã§ã¢ãï¼ã©ã¤ãã©ãªå½¢å¼ãªã©ï¼ä»ã®ã½ããã¦ã§ã¢éçºã«ä½¿
+     ç¨ã§ããå½¢ã§åé
+å¸ããå ´åã«ã¯ï¼åé
+å¸ã«ä¼´ããã­ã¥ã¡ã³ãï¼å©ç¨
+     è
+ããã¥ã¢ã«ãªã©ï¼ã«ï¼ä¸è¨ã®èä½æ¨©è¡¨ç¤ºï¼ãã®å©ç¨æ¡ä»¶ããã³ä¸è¨
+     ã®ç¡ä¿è¨¼è¦å®ãæ²è¼ãããã¨ï¼
+ (3) æ¬ã½ããã¦ã§ã¢ãï¼æ©å¨ã«çµã¿è¾¼ããªã©ï¼ä»ã®ã½ããã¦ã§ã¢éçºã«ä½¿
+     ç¨ã§ããªãå½¢ã§åé
+å¸ããå ´åã«ã¯ï¼æ¬¡ã®ããããã®æ¡ä»¶ãæºããã
+     ã¨ï¼
+   (a) åé
+å¸ã«ä¼´ããã­ã¥ã¡ã³ãï¼å©ç¨è
+ããã¥ã¢ã«ãªã©ï¼ã«ï¼ä¸è¨ã®è
+       ä½æ¨©è¡¨ç¤ºï¼ãã®å©ç¨æ¡ä»¶ããã³ä¸è¨ã®ç¡ä¿è¨¼è¦å®ãæ²è¼ãããã¨ï¼
+   (b) åé
+å¸ã®å½¢æ
+ãï¼å¥ã«å®ããæ¹æ³ã«ãã£ã¦ï¼TOPPERSãã­ã¸ã§ã¯ãã«
+       å ±åãããã¨ï¼
+ (4) æ¬ã½ããã¦ã§ã¢ã®å©ç¨ã«ããç´æ¥çã¾ãã¯éæ¥çã«çãããããªãæ
+     å®³ãããï¼ä¸è¨èä½æ¨©è
+ããã³TOPPERSãã­ã¸ã§ã¯ããå
+è²¬ãããã¨ï¼
+     ã¾ãï¼æ¬ã½ããã¦ã§ã¢ã®ã¦ã¼ã¶ã¾ãã¯ã¨ã³ãã¦ã¼ã¶ããã®ãããªãç
+     ç±ã«åºã¥ãè«æ±ãããï¼ä¸è¨èä½æ¨©è
+ããã³TOPPERSãã­ã¸ã§ã¯ãã
+     å
+è²¬ãããã¨ï¼
+ 
+ æ¬ã½ããã¦ã§ã¢ã¯ï¼ç¡ä¿è¨¼ã§æä¾ããã¦ãããã®ã§ããï¼ä¸è¨èä½æ¨©è
+ã
+ ãã³TOPPERSãã­ã¸ã§ã¯ãã¯ï¼æ¬ã½ããã¦ã§ã¢ã«é¢ãã¦ï¼ç¹å®ã®ä½¿ç¨ç®ç
+ ã«å¯¾ããé©åæ§ãå«ãã¦ï¼ãããªãä¿è¨¼ãè¡ããªãï¼ã¾ãï¼æ¬ã½ããã¦ã§
+ ã¢ã®å©ç¨ã«ããç´æ¥çã¾ãã¯éæ¥çã«çãããããªãæå®³ã«é¢ãã¦ãï¼ã
+ ã®è²¬ä»»ãè² ããªãï¼
+ 
+ $Id: cfg_user.txt 128 2016-05-14 14:49:32Z ertl-hiro $
+----------------------------------------------------------------------
+
+âç®æ¬¡
+
+ï¼ï¼Rubyçã³ã³ãã£ã®ã¥ã¬ã¼ã¿ã®æ¦è¦
+	1.1 ä½ç½®ä»ãã¨æ¦è¦
+	1.2 ãã¹1ã®å¦çã®æ¦è¦
+	1.3 ãã¹2ã®å¦çã®æ¦è¦
+	1.4 ãã¹3ã®å¦çã®æ¦è¦
+	1.5 ãã¹4ã®å¦çã®æ¦è¦
+ï¼ï¼ã³ã³ãã£ã®ã¥ã¬ã¼ã¿ã®èµ·å
+ï¼ï¼éçAPIãã¼ãã«
+	3.1 éçAPIãã¼ãã«ã®ææ³
+	3.2 éçAPIãã¼ãã«ã®è¨è¿°ä¾
+ï¼ï¼å¤åå¾ã·ã³ãã«ãã¼ãã«
+	4.1 å¤åå¾ã·ã³ãã«ãã¼ãã«ã®ææ³
+	4.2 å¤åå¾ã·ã³ãã«ãã¼ãã«ã®è¨è¿°ä¾
+ï¼ï¼çæã¹ã¯ãªãã
+	5.1 NumStrã¯ã©ã¹
+	5.2 ã³ã³ãã£ã®ã¥ã¬ã¼ã¿ããçæã¹ã¯ãªããã«æ¸¡ãããå¤æ°
+	5.3 çæã¹ã¯ãªããããã³ã³ãã£ã®ã¥ã¬ã¼ã¿ã«æ¸¡ãå¤æ°
+	5.4 ãã¹éã§å¼ãæ¸¡ãå¤æ°
+	5.5 ã¨ã©ã¼åºåé¢æ°
+	5.6 GenFileã¯ã©ã¹
+	5.7 ãã®ä»ã®ã©ã¤ãã©ãª
+ï¼ï¼ãã®ä»
+	6.1 ãªãã¸ã§ã¯ãIDã®æå®
+	6.2 ã·ã¹ãã ãµã¼ãã¹ã¸ã®å¯¾å¿ï¼ãã¹2ã«ãããå¦çãã§ã¼ãºï¼
+ï¼ï¼ãã¼ã¸ã§ã³å±¥æ­´
+
+
+ï¼ï¼Rubyçã³ã³ãã£ã®ã¥ã¬ã¼ã¿ã®æ¦è¦
+
+1.1 ä½ç½®ä»ãã¨æ¦è¦
+
+TOPPERSç¬¬3ä¸ä»£ã«ã¼ãã«åã Rubyçã³ã³ãã£ã®ã¥ã¬ã¼ã¿ï¼ä»¥ä¸ï¼åã«ã³ã³ãã£
+ã®ã¥ã¬ã¼ã¿ã¨ããï¼ã¯ï¼ã¦ã¼ã¶ãè¨è¿°ããã·ã¹ãã ã³ã³ãã£ã®ã¥ã¬ã¼ã·ã§ã³ãã¡
+ã¤ã«ããï¼ã«ã¼ãã«ãã·ã¹ãã ãµã¼ãã¹ã®æ§æã»åæåæ
+å ±ãå«ããã¡ã¤ã«ãª
+ã©ãçæãããã¼ã«ã§ããï¼TOPPERSç¬¬3ä¸ä»£ã«ã¼ãã«ã«ãããã·ã¹ãã ã³ã³ãã£
+ã®ã¥ã¬ã¼ã·ã§ã³æé ã«ã¤ãã¦ã¯ï¼ãTOPPERSç¬¬3ä¸ä»£ã«ã¼ãã«ï¼ITRONç³»ï¼çµ±åä»
+æ§æ¸ãã®ã2.12 ã·ã¹ãã ã³ã³ãã£ã®ã¥ã¬ã¼ã·ã§ã³æé ãã®ç¯ãåç
+§ãããã¨ï¼
+
+ã³ã³ãã£ã®ã¥ã¬ã¼ã¿ã¯ï¼TOPPERSç¬¬3ä¸ä»£ã«ã¼ãã«ã«å±ããåç¨®ã®ã«ã¼ãã«ãã
+ã®ä¸ã§åä½ããã·ã¹ãã ãµã¼ãã¹ã«é©ç¨ã§ããããã«ï¼åã«ã¼ãã«ï¼ã·ã¹ãã 
+ãµã¼ãã¹ã§å
+±éã«å©ç¨ã§ããã³ã³ãã£ã®ã¥ã¬ã¼ã¿æ¬ä½ã¨ï¼ã«ã¼ãã«ï¼ã·ã¹ãã 
+ãµã¼ãã¹æ¯ã®è¨­å®ãã¡ã¤ã«ã§æ§æãããï¼çæãã¹ãã«ã¼ãã«ãã·ã¹ãã ãµã¼
+ãã¹ã®æ§æã»åæåæ
+å ±ãï¼ã¿ã¼ã²ããã·ã¹ãã ã«ãã£ã¦ç°ãªãå ´åã«ã¯ï¼ã¿ã¼
+ã²ããæ¯ã®è¨­å®ãã¡ã¤ã«ãç¨æããï¼ãã®ããã¥ã¢ã«ã§ã¯ï¼ã«ã¼ãã«ï¼ã¿ã¼ã²ã
+ãæ¯ã®è¨­å®ãã¡ã¤ã«ã®è¨è¿°æ¹æ³ã«ã¤ãã¦èª¬æããï¼
+
+ãTOPPERSç¬¬3ä¸ä»£ã«ã¼ãã«ï¼ITRONç³»ï¼çµ±åä»æ§æ¸ãã®ã2.12.5 ã³ã³ãã£ã®ã¥
+ã¬ã¼ã¿ã®å¦çã¢ãã«ãã®ç¯ã«èª¬æãããéãï¼ã³ã³ãã£ã®ã¥ã¬ã¼ã¿ã¯ï¼3ã¤ãªã
+ãã¯4ã¤ã®ãã¹ã«ããå¦çãè¡ãï¼ä»¥ä¸ã§ã¯ï¼åãã¹ã®å¦çæ¦è¦ãèª¬æããï¼
+
+1.2 ãã¹1ã®å¦çã®æ¦è¦
+
+ã³ã³ãã£ã®ã¥ã¬ã¼ã¿ã®ãã¹1ã¯ï¼ã·ã¹ãã ã³ã³ãã£ã®ã¥ã¬ã¼ã·ã§ã³ãã¡ã¤ã«ãè§£
+éãï¼ããã«å«ã¾ããéçAPIã®æ´æ°å®æ°å¼ãã©ã¡ã¼ã¿ã®å¤ãªã©ãCã³ã³ãã¤ã©
+ãç¨ãã¦æ±ããããã«ï¼ãã©ã¡ã¼ã¿è¨ç®ç¨Cè¨èªãã¡ã¤ã«ï¼cfg1_out.cï¼ãçæ
+ããï¼ã¾ãï¼ãã¹2ã«å¼ãæ¸¡ãæ
+å ±ãï¼ãã¹1ãã¼ã¿ãã¡ã¤ã«ï¼cfg1_out.dbï¼ã«
+åºåããï¼
+
+ãã¹1ã¯ï¼éçAPIãã¼ãã«ï¼xxx_api.defï¼ã¨å¤åå¾ã·ã³ãã«ãã¼ãã«
+ï¼xxx_sym.defï¼ã®2ã¤ã®è¨­å®ãã¡ã¤ã«ãç¨ããï¼éçAPIãã¼ãã«ã«ã¯ï¼éç
+APIã®ä¸è¦§ã¨ï¼åéçAPIã®ãã©ã¡ã¼ã¿ã«é¢ããæ
+å ±ãè¨è¿°ããï¼å¤åå¾ã·ã³ã
+ã«ãã¼ãã«ã«ã¯ï¼éçAPIã®æ´æ°å®æ°å¼ãã©ã¡ã¼ã¿ä»¥å¤ã§ï¼ãã©ã¡ã¼ã¿è¨ç®ç¨C
+è¨èªãã¡ã¤ã«ã«åºåãã¦å¤ãæ±ãããã·ã³ãã«ï¼ä¸è¬ã«ã¯å¼ï¼ãè¨è¿°ããï¼é
+çAPIãã¼ãã«ã®è¨è¿°æ¹æ³ã¯ï¼ç« ã§ï¼å¤åå¾ã·ã³ãã«ãã¼ãã«ã®è¨è¿°æ¹æ³ã¯ï¼ç« 
+ã§èª¬æããï¼
+
+ãã¹1ãçæãããã©ã¡ã¼ã¿è¨ç®ç¨Cè¨èªãã¡ã¤ã«ã¯ï¼Cã³ã³ãã¤ã©ããã³é¢é£ãã¼
+ã«ãç¨ãã¦ã³ã³ãã¤ã«ãï¼ã­ã¼ãã¢ã¸ã¥ã¼ã«ãçæããï¼ã¾ãï¼ãããSã¬ã³ã¼
+ããã©ã¼ãããã®å½¢ã«å¤æããSã¬ã³ã¼ããã¡ã¤ã«ï¼cfg1_out.srecï¼ã¨ï¼ãã®
+ä¸­ã®åã·ã³ãã«ã¨ã¢ãã¬ã¹ã®å¯¾å¿è¡¨ãå«ãã·ã³ãã«ãã¡ã¤ã«ï¼cfg1_out.symsï¼
+ãçæããï¼
+
+1.3 ãã¹2ã®å¦çã®æ¦è¦
+
+ã³ã³ãã£ã®ã¥ã¬ã¼ã¿ã®ãã¹2ã¯ï¼ãã¹1ã§çæãããã­ã¼ãã¢ã¸ã¥ã¼ã«ã®Sã¬ã³ã¼
+ããã¡ã¤ã«ï¼cfg1_out.srecï¼ã¨ã·ã³ãã«ãã¡ã¤ã«ï¼cfg1_out.symsï¼ããï¼éç
+APIã®æ´æ°å®æ°å¼ãã©ã¡ã¼ã¿ã®å¤ã¨ï¼å¤åå¾ã·ã³ãã«ãã¼ãã«ã«è¨è¿°ããã·ã³ã
+ã«ï¼ä¸è¬ã«ã¯å¼ï¼ã®å¤ãåãåºãï¼ã¾ãï¼ãã¹1ãã¼ã¿ãã¡ã¤ã«ï¼cfg1_out.dbï¼
+ãèª­ã¿ï¼ãã¹1ããã®æ
+å ±ãåãåãï¼
+
+ãã¹2ã§ã¯ï¼ãããã®æ
+å ±ããï¼ã«ã¼ãã«ï¼ã·ã¹ãã ãµã¼ãã¹ã®æ§æã»åæåãã¡
+ã¤ã«ï¼ã«ã¼ãã«ã®å ´åã¯ï¼kernel_cfg.cï¼ã¨æ§æã»åæåããããã¡ã¤ã«ï¼ã«ã¼
+ãã«ã®å ´åã¯ï¼kernel_cfg.hï¼ãçæããï¼ã¾ãï¼ãã¹3ã«å¼ãæ¸¡ãæ
+å ±ãï¼ã
+ã¹2ãã¼ã¿ãã¡ã¤ã«ï¼cfg2_out.dbï¼ã«åºåããï¼ã«ã¼ãã«ï¼ã·ã¹ãã ãµã¼ãã¹ï¼
+ã¿ã¼ã²ããã«ãã£ã¦ã¯ï¼ãã®ä»ã®ãã¡ã¤ã«ãçæããå ´åãããï¼å
+·ä½çã«ã¯ï¼
+ä¿è­·æ©è½å¯¾å¿ã«ã¼ãã«ã§ã¯ï¼ä»®ã®ã¡ã¢ãªæ§æã»åæåãã¡ã¤ã«ï¼kernel_mem2.cï¼
+ã¨ä»®ã®ãªã³ã«ã¹ã¯ãªããï¼èªåã¡ã¢ãªé
+ç½®ã®å ´åã®ã¿ï¼ãçæããï¼
+
+ãã¹2ã«ããããã¡ã¤ã«çæã®æ¹æ³ã¯ï¼ãã¹2ã®è¨­å®ãã¡ã¤ã«ã§ããçæã¹ã¯ãª
+ããï¼ã«ã¼ãã«ã§ããã°ï¼target_kernel.trbï¼ã«è¨è¿°ããï¼çæã¹ã¯ãªããã®
+è¨è¿°æ¹æ³ã¯ï¼ç« ã§èª¬æããï¼
+
+ãã¹2ã§çæããããã¡ã¤ã«ãï¼ä»ã®ã½ã¼ã¹ãã¡ã¤ã«ã¨ãããã¦ã³ã³ãã¤ã«ãï¼
+ã¢ããªã±ã¼ã·ã§ã³ã®ã­ã¼ãã¢ã¸ã¥ã¼ã«ãçæããï¼ã¾ãï¼ãããSã¬ã³ã¼ããã©ã¼
+ãããã®å½¢ã«å¤æããSã¬ã³ã¼ããã¡ã¤ã«ï¼ASP3ã«ã¼ãã«ã®å ´åã¯ï¼asp.srecï¼
+ã¨ï¼ãã®ä¸­ã®åã·ã³ãã«ã¨ã¢ãã¬ã¹ã®å¯¾å¿è¡¨ãå«ãã·ã³ãã«ãã¡ã¤ã«ï¼ASP3ã«ã¼
+ãã«ã®å ´åã¯ï¼asp.symsï¼ãçæããï¼
+
+1.4 ãã¹3ã®å¦çã®æ¦è¦
+
+ä¿è­·æ©è½å¯¾å¿ã§ãªãã«ã¼ãã«ã®å ´åãï¼ä¿è­·æ©è½å¯¾å¿ã«ã¼ãã«ã§æåã¡ã¢ãªé
+
+ç½®ã®å ´åã«ã¯ï¼ã³ã³ãã£ã®ã¥ã¬ã¼ã¿ã®ãã¹3ã§ã¯ï¼ãã¹2ã§çæãããã­ã¼ãã¢
+ã¸ã¥ã¼ã«ã®Sã¬ã³ã¼ããã¡ã¤ã«ã¨ã·ã³ãã«ãã¡ã¤ã«ããï¼éçAPIã®ãã©ã¡ã¼ã¿
+ã®å¤ãªã©ãåãåºãï¼å¦¥å½æ§ã®ãã§ãã¯ãè¡ãï¼
+
+ãã¹3ã«ãããå¦¥å½æ§ãã§ãã¯ã®æ¹æ³ã¯ï¼ãã¹3ã®è¨­å®ãã¡ã¤ã«ã§ããçæã¹ã¯
+ãªããï¼ã«ã¼ãã«ã§ããã°ï¼target_check.trbï¼ã«è¨è¿°ããï¼çæã¹ã¯ãªãã
+ã®è¨è¿°æ¹æ³ã¯ï¼ç« ã§èª¬æããï¼
+
+ä¿è­·æ©è½å¯¾å¿ã«ã¼ãã«ã§èªåã¡ã¢ãªé
+ç½®ã®å ´åã«ã¯ï¼ãã¹3ã¯æé©åã®ããã®ã
+ã¹ã§ï¼ãªãã·ã§ã³ã§ããï¼
+
+ãã¹3ãä½¿ç¨ããå ´åï¼ãã¹2ã§çæãããã­ã¼ãã¢ã¸ã¥ã¼ã«ã®Sã¬ã³ã¼ããã¡ã¤
+ã«ã¨ã·ã³ãã«ãã¡ã¤ã«ããï¼éçAPIã®ãã©ã¡ã¼ã¿ã®å¤ãã¡ã¢ãªãªãã¸ã§ã¯ãã
+é
+ç½®ãããçªå°ããµã¤ãºãªã©ãåãåºãï¼ä»®ã®ã¡ã¢ãªæ§æã»åæåãã¡ã¤ã«
+ï¼kernel_mem3.cï¼ãçæããï¼ã¿ã¼ã²ããã«ãã£ã¦ã¯ï¼ä»®ã®ãªã³ã«ã¹ã¯ãªãã
+ãçæããï¼ã¾ãï¼ãã¹4ã«å¼ãæ¸¡ãæ
+å ±ãï¼ãã¹3ãã¼ã¿ãã¡ã¤ã«
+ï¼cfg3_out.dbï¼ã«åºåããï¼
+
+1.5 ãã¹4ã®å¦çã®æ¦è¦
+
+ä¿è­·æ©è½å¯¾å¿ã«ã¼ãã«ã§èªåã¡ã¢ãªé
+ç½®ã®å ´åã«ã¯ï¼ãã¹4ã«ããã¦ï¼ãã¹3ã§
+çæãããã­ã¼ãã¢ã¸ã¥ã¼ã«ã®Sã¬ã³ã¼ããã¡ã¤ã«ã¨ã·ã³ãã«ãã¡ã¤ã«ï¼ãã¹3
+ãçãå ´åã«ã¯ï¼ãã¹2ã®çæç©ãä½¿ãï¼ããï¼ã¡ã¢ãªãªãã¸ã§ã¯ããé
+ç½®ãã
+ãçªå°ããµã¤ãºãªã©ãåãåºãï¼ã¡ã¢ãªæ§æã»åæåãã¡ã¤ã«ï¼kernel_mem.cï¼
+ãçæããï¼ã¿ã¼ã²ããã«ãã£ã¦ã¯ï¼ãªã³ã«ã¹ã¯ãªãããçæããï¼
+
+
+ï¼ï¼ã³ã³ãã£ã®ã¥ã¬ã¼ã¿ã®èµ·å
+
+ã³ã³ãã£ã®ã¥ã¬ã¼ã¿ã¯ï¼ã·ã¹ãã ã³ã³ãã£ã®ã¥ã¬ã¼ã·ã§ã³ãã¡ã¤ã«åï¼ãã¹1ã§
+ã®ã¿æå¹ï¼ããã©ã¡ã¼ã¿ã«åãï¼ä»¥ä¸ã®ãªãã·ã§ã³ãæã¤ï¼
+
+	-kï¼»--kernelï¼½<ã«ã¼ãã«å>
+		ã«ã¼ãã«ã®åç§°ãæå®ããï¼
+
+	-pï¼»--passï¼½<ãã¹çªå·>
+		ãã¹çªå·ãæå®ããï¼1ã4ã®ããããï¼
+
+	-Iï¼»--include-directoryï¼½<ã¤ã³ã¯ã«ã¼ããã£ã¬ã¯ããªå>
+		INCLUDEãã£ã¬ã¯ãã£ãã«ããã¤ã³ã¯ã«ã¼ãããã³ã³ãã£ã®ã¥ã¬ã¼ã·ã§
+		ã³ãã¡ã¤ã«ãæ¢ããã£ã¬ã¯ããªåãæå®ããï¼çæã¹ã¯ãªããï¼trbãã¡
+		ã¤ã«ï¼ãæ¢ãå ´åã«ãç¨ããï¼
+
+	-Tï¼»--trb-fileï¼½<çæã¹ã¯ãªããå>
+		çæã¹ã¯ãªããï¼trbãã¡ã¤ã«ï¼ã®åç§°ãæå®ããï¼ãã¹2ä»¥éã§æå¹ï¼
+		ãã¹2ã«ããã¦å¦çãã§ã¼ãºã®æ©è½ï¼6.2ç¯åç
+§ï¼ãç¨ããå ´åã«ã¯ï¼
+		<çæã¹ã¯ãªããå>ã¨ãã¦ï¼ãã¡ã¤ã«åã«":"ã¨å¦çãã§ã¼ãºåãä»å 
+		ãããã®ï¼éä¸­ã«ç©ºç½ãå
+¥ãã¦ã¯ãªããªãï¼ãæå®ããï¼
+
+	--api-table <éçAPIãã¼ãã«ãã¡ã¤ã«å>
+		éçAPIãã¼ãã«ã®ãã¡ã¤ã«åãæå®ããï¼ãã¹1ã§ã®ã¿æå¹ï¼
+		ãã¹2ã«ããã¦å¦çãã§ã¼ãºã®æ©è½ï¼6.2ç¯åç
+§ï¼ãç¨ããå ´åã«ã¯ï¼
+		<éçAPIãã¼ãã«ãã¡ã¤ã«å>ã¨ãã¦ï¼ãã¡ã¤ã«åã«":"ã¨å¦çãã§ã¼
+		ãºåãä»å ãããã®ï¼éä¸­ã«ç©ºç½ãå
+¥ãã¦ã¯ãªããªãï¼ãæå®ããï¼
+
+	--symval-table <å¤åå¾ã·ã³ãã«ãã¼ãã«ãã¡ã¤ã«å>
+		å¤åå¾ã·ã³ãã«ãã¼ãã«ã®ãã¡ã¤ã«åãæå®ããï¼ãã¹1ã§ã®ã¿æå¹ï¼
+
+	-rï¼»--rom-imageï¼½<ã­ã¼ãã¢ã¸ã¥ã¼ã«ã®Sã¬ã³ã¼ããã¡ã¤ã«å>
+		ã­ã¼ãã¢ã¸ã¥ã¼ã«ãSã¬ã³ã¼ããã©ã¼ãããã®å½¢ã«å¤æãããã¡ã¤ã«ã®
+		åç§°ãæå®ããï¼çæã¹ã¯ãªããã®ããã®BCOPYé¢æ°ã¨PEEKé¢æ°ã¯ï¼ã
+		ã®ãªãã·ã§ã³ã§æå®ããSã¬ã³ã¼ããã¡ã¤ã«ãæä½å¯¾è±¡ã¨ããï¼ãã¹2
+		ä»¥éã§æå¹ï¼
+
+	-s [--rom-symbol] <ã­ã¼ãã¢ã¸ã¥ã¼ã«ã®ã·ã³ãã«ãã¡ã¤ã«å>
+		ã­ã¼ãã¢ã¸ã¥ã¼ã«ä¸­ã®åã·ã³ãã«ã¨ã¢ãã¬ã¹ã®å¯¾å¿è¡¨ãå«ãã·ã³ãã«
+		ãã¡ã¤ã«ã®åç§°ãæå®ããï¼çæã¹ã¯ãªããã®ããã®SYMBOLé¢æ°ã¯ï¼
+		ãã®ãªãã·ã§ã³ã§æå®ããã·ã³ãã«ãã¡ã¤ã«ãæä½å¯¾è±¡ã¨ããï¼ãã¹
+		2ä»¥éã§æå¹ï¼
+
+	--id-output-file <IDçªå·åºåãã¡ã¤ã«å>
+		ãªãã¸ã§ã¯ãã®IDçªå·ã®å²ä»ãçµæãï¼æå®ããååã®ãã¡ã¤ã«ã«æ¸
+		ãåºãï¼ãã¹2ã§ã®ã¿æå¹ï¼
+
+	--id-input-file <IDçªå·å
+¥åãã¡ã¤ã«å>
+		ãªãã¸ã§ã¯ãã®IDçªå·ã®å²ä»ããï¼æå®ããååã®ãã¡ã¤ã«ããåã
+		è¾¼ãï¼ãã¹1ã¨ãã¹2ã§æå¹ï¼ãã¹1ã§ã¯ãã¡ã¤ã³ã®IDçªå·ï¼ãã¹2ã§ã¯
+		ãã®ä»ã®ãªãã¸ã§ã¯ãã®IDçªå·ãç¨ããï¼
+
+	-Mï¼»--print-dependenciesï¼½<ä¾å­é¢ä¿ãã¡ã¤ã«å>
+		ã·ã¹ãã ã³ã³ãã£ã®ã¥ã¬ã¼ã·ã§ã³ãã¡ã¤ã«ã®ä¾å­é¢ä¿ãåºåããï¼ã
+		ã¹1ã§ã®ã¿æå¹ï¼GCCã®-Mãªãã·ã§ã³ã¨ç°ãªãï¼-Mãªãã·ã§ã³ãä»ãã
+		å ´åãï¼ã³ã³ãã£ã®ã¥ã¬ã¼ã¿ã¯éå¸¸ã®å¦çãè¡ãï¼ä¾å­é¢ä¿ãåºåã
+		ãã ãã¨ããä½¿ãæ¹ã¯ã§ããªãï¼ï¼ä¾å­é¢ä¿ãã¡ã¤ã«åãæå®ããªã
+		å ´åï¼æ¨æºåºåã«åºåããï¼
+
+	-O [--omit-output-db]
+		æ¬¡ã®ãã¹ã«æ
+å ±ãå¼ãæ¸¡ãããã®ãã¼ã¿ãã¡ã¤ã«ãä½æããªãï¼
+
+	-vï¼»--versionï¼½
+		ã³ã³ãã£ã®ã¥ã¬ã¼ã¿ã®ãã¼ã¸ã§ã³ãè¡¨ç¤ºããï¼
+
+	-h [--help]
+		ãªãã·ã§ã³ã®ãªã¹ãã¨èª¬æãè¡¨ç¤ºããï¼
+
+
+ï¼ï¼éçAPIãã¼ãã«
+
+éçAPIãã¼ãã«ã¯ï¼éçAPIã®ä¸è¦§ã¨ï¼åéçAPIã®ãã©ã¡ã¼ã¿ã«é¢ããæ
+å ±ã
+è¨è¿°ãããã¡ã¤ã«ã§ï¼ã³ã³ãã£ã®ã¥ã¬ã¼ã¿ã®ãã¹1ã§ç¨ããï¼
+
+3.1 éçAPIãã¼ãã«ã®ææ³
+
+éçAPIãã¼ãã«ã®åè¡ã«ã¯ï¼éçAPIåã«ç¶ãã¦ï¼ãã©ã¡ã¼ã¿ãªã¹ããè¨è¿°ã
+ãï¼éçAPIåã¨åãã©ã¡ã¼ã¿ã¯ï¼ç©ºç½æå­ã§åºåãï¼
+
+éçAPIåãï¼ä»¥ä¸ã®å½¢å¼ã§è¨è¿°ããã¨ï¼æ´¾çéçAPIã¯ï¼å
+éçAPIã¨ãã©ã¡ã¼
+ã¿ãªã¹ããç°ãªãã ãã®åãéçAPIã§ããã¨æ±ãããï¼
+
+	<æ´¾çéçAPIå>[<å
+éçAPIå>]
+
+ãã©ã¡ã¼ã¿ãªã¹ãã«ã¯ï¼éçAPIã®åãã©ã¡ã¼ã¿ã®æå­åè¨è¿°ãåæããï¼ã¾ãï¼
+"{"ããã³"}"ããã©ã¡ã¼ã¿ã¨åæ§ã«æ±ãï¼ãã©ã¡ã¼ã¿ãªã¹ãã«åæããï¼"{"ã
+ãã³"}"ã¯ï¼éçAPIã®æ§æè§£æã®ããã«å¿
+è¦ã¨ãªãï¼
+
+åãã©ã¡ã¼ã¿ã®æå­åè¨è¿°ã¯ï¼ãã©ã¡ã¼ã¿ã®ç¨®å¥ãè¡¨ãæå­ã«ç¶ãã¦ï¼ãã©ã¡ã¼
+ã¿åãè¨è¿°ããï¼å¿
+è¦ãªå ´åã«ã¯ï¼ããã«ç¶ãã¦ï¼ãã©ã¡ã¼ã¿ã®å±æ§ãè¡¨ãæ
+å­åï¼ã¾ãã¯æå­ï¼ãè¨è¿°ããï¼
+
+ãã©ã¡ã¼ã¿ã®ç¨®å¥ãè¡¨ãæå­ã¯æ¬¡ã®éãï¼
+
+	#		ãªãã¸ã§ã¯ãè­å¥åï¼å®ç¾©ï¼
+	%		ãªãã¸ã§ã¯ãè­å¥åï¼åç
+§ï¼
+	.		ç¬¦å·ç¡ãæ´æ°å®æ°å¼ãã©ã¡ã¼ã¿
+	+		ç¬¦å·ä»ãæ´æ°å®æ°å¼ãã©ã¡ã¼ã¿
+	&		ä¸è¬å®æ°å¼ãã©ã¡ã¼ã¿
+	$		æå­åãã©ã¡ã¼ã¿
+
+ãã©ã¡ã¼ã¿ã®å±æ§ãè¡¨ãæå­åï¼ã¾ãã¯æå­ï¼ã¯æ¬¡ã®éãï¼
+
+	*		ã­ã¼ãã©ã¡ã¼ã¿
+	?		ãªãã·ã§ã³ãã©ã¡ã¼ã¿ï¼ãã©ã¡ã¼ã¿ãç¡ãã¦ãè¯ãï¼
+	...		ãªã¹ããã©ã¡ã¼ã¿ï¼ãã©ã¡ã¼ã¿ãè¤æ°ï¼0åä»¥ä¸ï¼ãã£ã¦ãè¯ãï¼
+
+ã­ã¼ãã©ã¡ã¼ã¿ï¼*å±æ§ï¼ã¨ã¯ï¼ãã®éçAPIã«é¢ãããã©ã¡ã¼ã¿æ
+å ±ãã³ã³ãã£
+ã®ã¥ã¬ã¼ã·ã§ã³ãã¼ã¿ï¼$cfgDataï¼ã«æ ¼ç´ããéã«ï¼ãã®ãã©ã¡ã¼ã¿ãããã·ã¥
+ã®ã­ã¼ã¨ãã¦ä½¿ç¨ãããã¨ãç¤ºãï¼ãã©ã¡ã¼ã¿ãªã¹ãä¸­ã®0ã¾ãã¯1ã¤ã®ãã©ã¡ã¼
+ã¿ãï¼ã­ã¼ãã©ã¡ã¼ã¿ã«æå®ããï¼è¤æ°ã®ãã©ã¡ã¼ã¿ãã­ã¼ãã©ã¡ã¼ã¿ã«æå®
+ããå ´åï¼ãã®ä¸­ã§æå¾ã®ãã©ã¡ã¼ã¿ãã­ã¼ãã©ã¡ã¼ã¿ã¨ãã¦ä½¿ãããï¼ï¼è©³
+ããã¯ï¼ã5.2.2 ã³ã³ãã£ã®ã¥ã¬ã¼ã·ã§ã³ãã¼ã¿ãã®ç¯ãåç
+§ãããã¨ï¼
+
+ãã©ã¡ã¼ã¿ãªã¹ãã«è¨è¿°ãã"{"ã«"?"ãä»å ããã¨ï¼ã¤ã¾ãï¼"{?"ã¨è¨è¿°ãã
+ã¨ï¼ï¼"{?"ã¨"}"ã§å²ã¾ãããã©ã¡ã¼ã¿ç¾¤ããªãã·ã§ã³ã§ããï¼ç¡ãã¦ãè¯ãï¼
+ãã¨ãç¤ºãï¼
+
+3.2 éçAPIãã¼ãã«ã®è¨è¿°ä¾
+
+----------------------------------------
+CRE_SEM #semid* { .sematr .isemcnt .maxsem }
+CFG_INT .intno* { .intatr +intpri }
+DEF_ICS { .istksz &istk }
+ATT_MEM { .mematr &base .size } {? .acptn1 .acptn2 .acptn3 .acptn4 }
+ATT_PMA[ATT_MEM] { .mematr &base .size .paddr } {? .acptn1 .acptn2 .acptn3 .acptn4 }
+----------------------------------------
+
+ãã®è¨è¿°ã§ï¼ATT_PMAã®æ
+å ±ã¯ï¼ã³ã³ãã£ã®ã¥ã¬ã¼ã·ã§ã³ãã¼ã¿ï¼$cfgDataï¼ã«
+æ ¼ç´ããéã«ï¼ATT_MEMã®æ
+å ±ã«çµ±åãããï¼
+
+
+ï¼ï¼å¤åå¾ã·ã³ãã«ãã¼ãã«
+
+4.1 å¤åå¾ã·ã³ãã«ãã¼ãã«ã®ææ³
+
+å¤åå¾ã·ã³ãã«ãã¼ãã«ã®åè¡ã®ææ³ã¨ï¼åãã©ã¡ã¼ã¿ã®æå³ã¯æ¬¡ã®éãï¼
+
+----------------------------------------
+<å¤æ°å>, <å¼>, <å¼ã®å>, <æ¡ä»¶>, <æ¡ä»¶ãæç«ããªãæã®å¼>
+----------------------------------------
+
+<å¤æ°å>
+	å¤ãåå¾ããå¤æ°ã®ååï¼ã°ã­ã¼ãã«å¤æ°ã§ãããã¨ãç¤ºã$ã¯è¨è¿°ããªãï¼
+	ãè¨è¿°ããï¼<å¤æ°å>ã®è¨è¿°ã¯çç¥ãããã¨ãã§ããªãï¼
+
+<å¼>
+	å¤ãè¡¨ãå¼ãè¨è¿°ããï¼<å¼>ã®è¨è¿°ãçç¥ããå ´åã«ã¯ï¼<å¤æ°å>ã®è¨è¿°
+	ãå¼ã¨ãã¦ä½¿ãããï¼å¼ã®ä¸­ã«","ãå«ãå ´åã«ã¯ï¼å¼å
+¨ä½ã"ã§å²ãï¼
+
+<å¼ã®å>
+	å¤ãçå½å¤ã§åå¾ãããå ´åã¯"bool"ï¼ç¬¦å·ä»ãæ´æ°å¤ã§åå¾ãããå ´å
+	ã«ã¯"signed"ï¼ç¬¦å·ç¡ãæ´æ°å¤ã§åå¾ãããå ´åã«ã¯"unsigned"ãè¨è¿°ã
+	ãï¼è¨è¿°ãçç¥ããå ´åã«ã¯ï¼ç¬¦å·ç¡ãæ´æ°å¤ã¨æ±ãããï¼
+
+<æ¡ä»¶>
+	å¤ãåå¾ããæ¡ä»¶ãè¨è¿°ããï¼<æ¡ä»¶>ä¸­ã§ã¯ï¼ããã·ã³ãã«ããã¯ã­å®ç¾©
+	ããã¦ãããã©ãããå¤å¥ããããã«ï¼defined(<ã·ã³ãã«>)ãä½¿ç¨ããã
+	ã¨ãã§ããï¼
+
+<æ¡ä»¶ãæç«ããªãæã®å¼>
+	<æ¡ä»¶>ãæç«ããªãã£ãå ´åã«ï¼å¤æ°ã«è¨­å®ããå¤ãè¡¨ãå¼ãè¨è¿°ããï¼
+	è¨è¿°ãçç¥ããã¨ï¼<æ¡ä»¶>ãæç«ããªãã£ãå ´åã«ï¼å¤æ°ã«ã¯å¤ãè¨­å®ã
+	ããªãï¼å¤æ°ãåç
+§ããã¨nilã¨ãªãï¼ï¼
+
+4.2 å¤åå¾ã·ã³ãã«ãã¼ãã«ã®è¨è¿°ä¾
+
+å¤åå¾ã·ã³ãã«ãã¼ãã«ã®è¨è¿°ä¾ã¨ï¼åè¨è¿°ã®æå³ã¯æ¬¡ã®éãï¼
+
+(è¨è¿°ä¾1) åç´ãªå®æ°å¤ã®åå¾
+
+----------------------------------------
+TA_ACT
+----------------------------------------
+
+å¤æ°$TA_ACTã«ï¼TA_ACTã®å¤ãåå¾ããï¼
+
+(è¨è¿°ä¾2) å¼ã®å¤ã®åå¾
+
+----------------------------------------
+sizeof_uint_t,sizeof(uint_t)
+----------------------------------------
+
+å¤æ°$sizeof_uint_tã«ï¼sizeof(uint_t)ã®å¤ãåå¾ããï¼
+
+(è¨è¿°ä¾3) ç¬¦å·ã®æå®
+
+----------------------------------------
+TMAX_TPRI,,signed
+----------------------------------------
+
+å¤æ°$TMAX_TPRIã«ï¼TMAX_TPRIã®å¤ãç¬¦å·ä»ãã§åå¾ããï¼
+
+(è¨è¿°ä¾4) å¤ãåå¾ããæ¡ä»¶ã®è¨è¿°
+
+----------------------------------------
+SIL_ENDIAN_BIG,1,,defined(SIL_ENDIAN_BIG)
+----------------------------------------
+
+SIL_ENDIAN_BIGããã¯ã­å®ç¾©ããã¦ããå ´åï¼å¤æ°$SIL_ENDIAN_BIGã«1ãè¨­å®
+ããï¼å®ç¾©ããã¦ããªãã£ãå ´åï¼å¤æ°$SIL_ENDIAN_BIGã¯å®ç¾©ãããªãï¼åç
+§
+ããã¨nilã¨ãªãï¼ï¼
+
+(è¨è¿°ä¾5) æ¡ä»¶ãæç«ããªãæã®å¼ã®è¨è¿°
+
+----------------------------------------
+TARGET_TSKATR,,,defined(TARGET_TSKATR),0
+----------------------------------------
+
+TARGET_TSKATRããã¯ã­å®ç¾©ããã¦ããå ´åï¼å¤æ°$TARGET_TSKATRã«
+TARGET_TSKATRã®å¤ãåå¾ããï¼å®ç¾©ããã¦ããªãã£ãå ´åï¼å¤æ°
+$TARGET_TSKATRã¯0ã¨ããï¼
+
+
+ï¼ï¼çæã¹ã¯ãªãã
+
+ãã®ç« ã§ã¯ï¼çæã¹ã¯ãªãããè¨è¿°ããã«ããã£ã¦å¿
+è¦ãªäºé 
+ãèª¬æããï¼
+
+5.1 NumStrã¯ã©ã¹
+
+ã³ã³ãã£ã®ã¥ã¬ã¼ã¿ã¯ï¼éçAPIã®æ´æ°å®æ°å¼ãã©ã¡ã¼ã¿ãè©ä¾¡ãï¼å¤ãæ±ããï¼
+çæã¹ã¯ãªããã§æ¡ä»¶åå²ãã¨ã©ã¼ãã§ãã¯ãè¡ãéã«ã¯ï¼æ±ããå¤ãåç
+§ã
+ããï¼ä¸æ¹ï¼ãã©ã¡ã¼ã¿ãkernel_cfg.cãªã©ã®ãã¡ã¤ã«ã«åºåããéã«ã¯ï¼ã
+ã©ã¡ã¼ã¿ãè©ä¾¡ãã¦æ±ããå¤ã§ã¯ãªãï¼å
+ã«ãªã£ãæå­åãåºåããæ¹ãå¯èª­
+æ§ãé«ãï¼ã¤ã¾ãï¼åãã©ã¡ã¼ã¿ã«å¯¾ãã¦ï¼å¤ã¨æå­åã®ä¸¡æ¹ãä¿æãããï¼
+
+ãããå®ç¾ããããã«ï¼å¤ã¨æå­åã®çµãç®¡çããNumStrã¯ã©ã¹ãç¨æãã¦ã
+ãï¼ã³ã³ãã£ã®ã¥ã¬ã¼ã¿ã¯ï¼éçAPIã®åãã©ã¡ã¼ã¿ã«å¯¾ãã¦ï¼ä¸ããæå­åã¨
+ãããè©ä¾¡ãã¦æ±ããå¤ããï¼NumStrã¯ã©ã¹ã®ãªãã¸ã§ã¯ããçæããï¼
+
+NumStrã¯ã©ã¹ã¯ï¼ããªã³ããããªã©æå­åã«å¤æããå ´åä»¥å¤ã¯ï¼æ°å¤ã¨ãã¦
+æ±ããã¨ãã§ããï¼å
+·ä½çã«ã¯ï¼ååæ¼ç®ãªã©ã®æ°å¤ã«å¯¾ããã¡ã½ããã«ã¤ã
+ã¦ã¯ï¼NumStrãªãã¸ã§ã¯ãã®å¤ã«å¯¾ãã¦é©ç¨ãããï¼ããªã³ããããªã©æå­å
+ã«å¤æããå ´åã«ã¯ï¼NumStrãªãã¸ã§ã¯ãã®æå­åãç¨ããããï¼
+
+5.2 ã³ã³ãã£ã®ã¥ã¬ã¼ã¿ããçæã¹ã¯ãªããã«æ¸¡ãããå¤æ°
+
+ãã®ç¯ã§ã¯ï¼ã³ã³ãã£ã®ã¥ã¬ã¼ã¿æ¬ä½ãå®ç¾©ãï¼çæã¹ã¯ãªããã«æ¸¡ãããå¤
+æ°ã«ã¤ãã¦èª¬æããï¼
+
+5.2.1 å¤åå¾ã·ã³ãã«
+
+å¤ãæ±ãããã·ã³ãã«ï¼ä¸è¬ã«ã¯å¼ï¼ã¨ãã¦ï¼å¤åå¾ã·ã³ãã«ãã¼ãã«ã«è¨è¿°
+ããã·ã³ãã«ã«å¯¾å¿ããå¤æ°ï¼
+
+5.2.2 ã³ã³ãã£ã®ã¥ã¬ã¼ã·ã§ã³ãã¼ã¿ï¼$cfgDataï¼
+
+ã·ã¹ãã ã³ã³ãã£ã®ã¥ã¬ã¼ã·ã§ã³ãã¡ã¤ã«ã«è¨è¿°ããï¼æ¡ä»¶ãã£ã¬ã¯ãã£ãã«
+ãã£ã¦é¤å¤ãããªãã£ãéçAPIã¨ãã®ãã©ã¡ã¼ã¿ã¯ï¼$cfgDataã«æ ¼ç´ãã¦çæ
+ã¹ã¯ãªããã«æ¸¡ãããï¼$cfgDataã¯ï¼3éã®ããã·ã¥ï¼ããã·ã¥ã®ããã·ã¥ã®ãã
+ã·ã¥ï¼ã§ï¼å
+·ä½çãªæ§é ã¯ä»¥ä¸ã®éãã§ããï¼
+
+$cfgDataã¯ï¼éçAPIåãã·ã³ãã«åãããã®ï¼ä¾ãã°ï¼éçAPIåãCRE_SEMã§
+ããã°ï¼:CRE_SEMï¼ãã­ã¼ã¨ãï¼åä¸ç¨®é¡ã®ãã¹ã¦ã®éçAPIï¼ä¾ãã°ï¼ã·ã¹ã
+ã ã³ã³ãã£ã®ã¥ã¬ã¼ã·ã§ã³ãã¡ã¤ã«ä¸­ã«CRE_SEMã5ã¤ããã°ï¼ãã®ãã¹ã¦ï¼ã®
+æ
+å ±ãå¤ã¨ããããã·ã¥ã§ããï¼
+
+åä¸ç¨®é¡ã®ãã¹ã¦ã®éçAPIã®æ
+å ±ã¯ï¼åã
+ã®éçAPIã®è­å¥çªå·ãã­ã¼ã¨ãï¼
+ãã©ã¡ã¼ã¿æ
+å ±ãå¤ã¨ããããã·ã¥ã§ããï¼ããã·ã¥ã®ã­ã¼ã¨ãªãéçAPIã®è­
+å¥çªå·ã«ã¯ï¼éçAPIãã¼ãã«ä¸­ã§ã­ã¼ãã©ã¡ã¼ã¿ã«æå®ãããã©ã¡ã¼ã¿ã®å¤ã
+ä½¿ãããï¼ã­ã¼ãã©ã¡ã¼ã¿ããªãã¸ã§ã¯ãè­å¥åã§ããå ´åï¼ãã®IDçªå·ãã­ã¼
+ã¨ãªãï¼ã¾ãï¼æ´æ°å®æ°å¼ãã©ã¡ã¼ã¿ã§ããå ´åã«ã¯ï¼ãã®å¤ãã­ã¼ã¨ãªãï¼
+ã­ã¼ãã©ã¡ã¼ã¿ãæå®ããã¦ããªãå ´åã«ã¯ï¼åä¸ç¨®é¡ã®éçAPIã®ä¸­ã§ã®åºç¾
+é åºï¼1ããéå§ï¼ãã­ã¼ã¨ãªãï¼åãã­ã¼ãæã£ãéçAPIãè¤æ°è¨è¿°ããã¦
+ããå ´åã«ã¯ï¼ã³ã³ãã£ã®ã¥ã¬ã¼ã¿æ¬ä½ã§ã¨ã©ã¼ãæ¤åºããï¼ãã®ããã·ã¥ã¯ï¼
+ã·ã¹ãã ã³ã³ãã£ã®ã¥ã¬ã¼ã·ã§ã³ãã¡ã¤ã«ä¸­ã§ã®éçAPIã®åºç¾é ã«æ ¼ç´ããã¦
+ããï¼
+
+ãã©ã¡ã¼ã¿æ
+å ±ã¯ï¼ãã©ã¡ã¼ã¿åãã·ã³ãã«åãããã®ï¼ä¾ãã°ï¼ãã©ã¡ã¼ã¿
+åãisemcntã§ããã°ï¼:isemcntï¼ãã­ã¼ã¨ãï¼ãã©ã¡ã¼ã¿å¤ãå¤ã¨ããããã·ã¥
+ã§ããï¼ãã©ã¡ã¼ã¿å¤ã¯ï¼ãªãã¸ã§ã¯ãè­å¥åãæ´æ°å®æ°å¼ãã©ã¡ã¼ã¿ã®å ´å
+ã«ã¯NumStrã¯ã©ã¹ã®ãªãã¸ã§ã¯ãï¼ä¸è¬å®æ°å¼ãã©ã¡ã¼ã¿ãæå­åãã©ã¡ã¼ã¿
+ã®å ´åã¯æå­åï¼Stringã¯ã©ã¹ã®ãªãã¸ã§ã¯ãï¼ã§è¡¨ãï¼ãã©ã¡ã¼ã¿ããªã¹ã
+ãã©ã¡ã¼ã¿ã§ããå ´åã«ã¯ï¼åãã©ã¡ã¼ã¿ãNumStrã¯ã©ã¹ã®ãªãã¸ã§ã¯ãã¾ã
+ã¯æå­åã§è¡¨ãããã®ã®é
+åãå¤ã¨ããï¼
+
+éçAPIããã¡ã¤ã³ã®å²ã¿ã«å«ã¾ãã¦ããå ´åã«ã¯ï¼:domainãã­ã¼ã¨ãã¦ï¼ã
+ã¡ã¤ã³IDã®æ°å¤ãå¤ã¨ããããã·ã¥ã¨ã³ããªãï¼ãã©ã¡ã¼ã¿æ
+å ±ã«è¿½å ããï¼
+ã¾ãï¼ã¯ã©ã¹ã®å²ã¿ã«å«ã¾ãã¦ããå ´åã«ã¯ï¼:classãã­ã¼ã¨ãã¦ï¼ã¯ã©ã¹ID
+ãNumStrã¯ã©ã¹ã®ãªãã¸ã§ã¯ãã¨ããããã·ã¥ã¨ã³ããªãï¼ãã©ã¡ã¼ã¿æ
+å ±ã«
+è¿½å ããï¼
+
+ããã«ï¼ãã®éçAPIã«é¢ããã¨ã©ã¼ã¡ãã»ã¼ã¸åºåã®ããã«ï¼ãã©ã¡ã¼ã¿æ
+å ±
+ã«ã¯ï¼:apinameãã­ã¼ã¨ãã¦éçAPIåãï¼:_file_ã¨:_line_ãã­ã¼ã¨ãã¦ï¼ã
+ãããï¼ãã®éçAPIãè¨è¿°ããã¦ãããã¡ã¤ã«åã¨è¡çªå·ãæ ¼ç´ãã¦ããï¼
+
+$cfgDataã®ä¾ã¨ãã¦ï¼éçAPIãã¼ãã«ãã3.2 éçAPIãã¼ãã«ã®è¨è¿°ä¾ãã®
+ç¯ã«æããä¾ã®éãã§ï¼ã·ã¹ãã ã³ã³ãã£ã®ã¥ã¬ã¼ã·ã§ã³ãã¡ã¤ã«ã®å
+å®¹ãï¼
+
+----------------------------------------
+CRE_SEM(SEM1, { TA_TPRI, 0, 1 });
+CFG_INT(INTNO1, { TA_NULL, INTPRI1 });
+DEF_ICS { I_STACK_SIZE, i_stack }
+----------------------------------------
+
+ã§ããæï¼$cfgDataã¯æ¬¡ã®å
+å®¹ã¨ãªãï¼TA_TPRIã¯1ï¼INTNO1ã¯10ï¼TA_NULLã¯0ï¼
+INTPRI1ã¯-2ï¼I_STACK_SIZEã¯4196ã«å®ç¾©ããã¦ãããã¨ãä»®å®ãã¦ããï¼ï¼
+
+----------------------------------------
+{:CRE_SEM=>
+  {1=>
+    {:semid=>NumStr(1,"SEM1"),
+     :sematr=>NumStr(1,"TA_TPRI"),
+     :isemcnt=>NumStr(0,"0"),
+     :maxsem=>NumStr(1,"1"),
+     :apiname=>"CRE_SEM",
+     :_file_=>"sample.cfg",
+     :_line_=>1}},
+ :CFG_INT=>
+  {10=>
+    {:intno=>NumStr(10,"INTNO1"),
+     :intatr=>NumStr(0,"TA_NULL"),
+     :intpri=>NumStr(-2,"INTPRI1"),
+     :apiname=>"CFG_INT",
+     :_file_=>"sample.cfg",
+     :_line_=>2}},
+ :DEF_ICS=>
+  {1=>
+    {:istksz=>NumStr(4196,"I_STACK_SIZE"),
+     :istk=>"i_stack",
+     :apiname=>"DEF_ICS",
+     :_file_=>"sample.cfg",
+     :_line_=>3}}}
+----------------------------------------
+
+åä¸ç¨®é¡ã®ãã¹ã¦ã®éçAPIã«å¯¾ãã¦å¦çãè¡ãããå ´åã«ã¯ï¼æ¬¡ã®ããã«ã«ã¼
+ããä½ãã¨ããï¼CRE_SEMã®ä¾ï¼ï¼
+
+----------------------------------------
+$cfgData[:CRE_SEM].each do |key, params|
+	<åã
+ã®éçAPIã«å¯¾ããå¦ç>
+end
+----------------------------------------
+
+ããã§ï¼åä¸ç¨®é¡ã®éçAPIã¯ï¼ã·ã¹ãã ã³ã³ãã£ã®ã¥ã¬ã¼ã·ã§ã³ãã¡ã¤ã«ä¸­ã§
+ã®åºç¾é åºã§æ ¼ç´ããã¦ããããï¼ä¸ã®ã«ã¼ãå
+ã®å¦çã¯ï¼éçAPIã®åºç¾é ã§
+è¡ãããï¼
+
+ä¸æ¹ï¼6.1ç¯ã§ç¤ºãããã«IDçªå·ã®å²ä»ããæåã§è¡ã£ãå ´åï¼éçAPIã®åºç¾
+é ã¯ï¼IDçªå·é ã«ä¸è´ãã¦ããã¨ã¯éããªãï¼ãã®ããï¼ãªãã¸ã§ã¯ãã®åæ
+åãã­ãã¯ãçæããå ´åãªã©ï¼IDçªå·é ã«å¦çããããå ´åã«ã¯ï¼ããã·ã¥
+ãã½ã¼ãããå¿
+è¦ãããï¼å
+·ä½çã«ã¯ï¼æ¬¡ã®ããã«ã«ã¼ããä½ãã¨ãã
+ï¼CRE_SEMã®ä¾ï¼ï¼
+
+----------------------------------------
+$cfgData[:CRE_SEM].sort.each do |key, params|
+	<åã
+ã®éçAPIã«å¯¾ããå¦ç>
+end
+----------------------------------------
+
+ãã®ã«ã¼ãã®ä¸­ã§ã¯ï¼éçAPIã®ãã©ã¡ã¼ã¿ã®å¤ã¨æå­åã¯ï¼NumStrã¯ã©ã¹ã®ãª
+ãã¸ã§ã¯ãã¨ãã¦ï¼params[:maxcnt]ã®å½¢ã§åãåºããã¨ãã§ããï¼CRE_SEMã®
+maxcntãã©ã¡ã¼ã¿ã®ä¾ï¼ï¼
+
+5.2.3 ã¤ã³ã¯ã«ã¼ããã¡ã¤ã«ã®ãªã¹ãï¼$includeFilesï¼
+
+ã·ã¹ãã ã³ã³ãã£ã®ã¥ã¬ã¼ã·ã§ã³ãã¡ã¤ã«ã«è¨è¿°ãããCè¨èªããªãã­ã»ããµã®
+ã¤ã³ã¯ã«ã¼ããã£ã¬ã¯ãã£ãï¼#includeï¼ã§æå®ãããã¡ã¤ã«åã®ãªã¹ãã¯ï¼
+$includeFilesã«æ ¼ç´ãã¦çæã¹ã¯ãªããã«æ¸¡ãããï¼$includeFilesã¯ï¼
+#includeã®å¾ã«è¨è¿°ãããæå­åï¼""ã<>ãå«ãæå­åï¼ãè¦ç´ ã¨ããé
+åã§
+ããï¼
+
+5.2.4 ãã®ä»ã®å¤æ°
+
+(5-2-4-1) $asmLabel
+
+ã³ã³ãã¤ã©ãCè¨èªã®è­å¥åããã¢ã»ã³ãã©ã®ã©ãã«ãä½ãéã«ï¼å
+é ­ã«"_"ã
+ä»ãå ´åã«ã¯ï¼$asmLabelã¯"_"ã«è¨­å®ãããï¼ããã§ãªãå ´åã«ã¯ï¼""ã«è¨­å®
+ãããï¼
+
+(5-2-4-2) $endianLittle
+
+$endianLittleã¯ï¼ã¿ã¼ã²ãããã­ã»ããµããªãã«ã¨ã³ãã£ã¢ã³ã®å ´åã«ã¯
+trueï¼ããã°ã¨ã³ãã£ã¢ã³ã®å ´åã«ã¯falseã«è¨­å®ãããï¼
+
+5.3 çæã¹ã¯ãªããããã³ã³ãã£ã®ã¥ã¬ã¼ã¿ã«æ¸¡ãå¤æ°
+
+ãã®ç¯ã§ã¯ï¼çæã¹ã¯ãªãããå®ç¾©ãï¼ã³ã³ãã£ã®ã¥ã¬ã¼ã¿æ¬ä½ã«æ¸¡ãããå¤
+æ°ã«ã¤ãã¦èª¬æããï¼
+
+(5-3-1) ã¿ã¤ã ã¹ã¿ã³ããã¡ã¤ã«åï¼$timeStampFileNameï¼
+
+çæã¹ã¯ãªããã«ããã¦$timeStampFileNameã«ãã¡ã¤ã«åãè¨­å®ããã¨ï¼ã³ã³
+ãã£ã®ã¥ã¬ã¼ã¿æ¬ä½ã¯ï¼ã³ã³ãã£ã®ã¥ã¬ã¼ã¿ã®æ­£å¸¸çµäºæã«ï¼è¨­å®ãããã¡ã¤
+ã«åã§å
+å®¹ã®ç©ºã®ãã¡ã¤ã«ãä½ãããï¼
+
+5.4 ãã¹éã§å¼ãæ¸¡ãå¤æ°
+
+ãã®ç¯ã§ã¯ï¼ç°ãªããã¹ã®çæã¹ã¯ãªããéã§ãã¼ã¿ãåãæ¸¡ãããæã«ç¨ã
+ãå¤æ°ã«ã¤ãã¦èª¬æããï¼
+
+(5-4-1) ãã¹2ãããã¹3ã«å¼ãæ¸¡ããã¼ã¿ï¼$cfg2Dataï¼
+
+ãã¹2ã®çæã¹ã¯ãªãããããã¹3ã®çæã¹ã¯ãªããã«ãã¼ã¿ãå¼ãæ¸¡ãããå ´
+åã«ã¯ï¼å¼ãæ¸¡ããããã¼ã¿ã$cfg2Dataï¼ããã·ã¥ï¼ã«è¨­å®ããï¼
+
+(5-4-2) ãã¹3ãããã¹4ã«å¼ãæ¸¡ããã¼ã¿ï¼$cfg3Dataï¼
+
+ãã¹3ã®çæã¹ã¯ãªãããããã¹4ã®çæã¹ã¯ãªããã«ãã¼ã¿ãå¼ãæ¸¡ãããå ´
+åã«ã¯ï¼å¼ãæ¸¡ããããã¼ã¿ã$cfg3Dataï¼ããã·ã¥ï¼ã«è¨­å®ããï¼
+
+5.5 ã¨ã©ã¼åºåé¢æ°
+
+ãã®ç¯ã§ã¯ï¼çæã¹ã¯ãªããä¸­ã§ã¨ã©ã¼ãæ¤åºããå ´åã«å¼ã³åºãã¹ãã¨ã©ã¼
+åºåé¢æ°ã«ã¤ãã¦èª¬æããï¼
+
+(5-5-1) error_exit(message, location="")
+(5-5-2) error(message, location="")
+(5-5-3) warning(message, location="")
+
+messageã¨locationããä½æããã¨ã©ã¼ã¡ãã»ã¼ã¸ãåºåããï¼error_exitã¯ï¼
+ã¡ãã»ã¼ã¸ã®åºåå¾ã«ã³ã³ãã£ã®ã¥ã¬ã¼ã¿ã®å¦çãä¸­æ­ããï¼errorã¯ï¼ã¡ãã»ã¼
+ã¸ã®åºåå¾ãå¦çãç¶ç¶ãï¼ãã¡ã¤ã«ã®çæå¦çåã«ã³ã³ãã£ã®ã¥ã¬ã¼ã¿ã®å¦
+çãä¸­æ­ããï¼warningã¯ï¼ãã®ã¾ã¾å¦çãç¶ç¶ããï¼locationãçç¥ããå ´å
+ã«ã¯ï¼ã¨ã©ã¼çºçç®æã¯åºåãããªãï¼
+
+(5-5-4) def error_api(params, message)
+(5-5-5) def warning_api(params, message)
+
+paramsã«éçAPIã®ãã©ã¡ã¼ã¿æ
+å ±ãæ¸¡ãã¨ï¼éçAPIãè¨è¿°ããã¦ãããã¡ã¤
+ã«åã¨è¡çªå·ã¨ï¼messageã«æ¸¡ããã¡ãã»ã¼ã¸ãåºåããï¼
+
+(5-5-6) def error_ercd(errorCode, params, message)
+
+errorCodeã«ã¨ã©ã¼ã³ã¼ãã®æå­åï¼paramsã«éçAPIã®ãã©ã¡ã¼ã¿æ
+å ±ãæ¸¡ã
+ã¨ï¼éçAPIãè¨è¿°ããã¦ãããã¡ã¤ã«åã¨è¡çªå·ã¨ï¼ã¨ã©ã¼ã³ã¼ãï¼message
+ã«æ¸¡ããã¡ãã»ã¼ã¸ãåºåããï¼
+
+(5-5-7) def error_wrong(errorCode, params, symbol, wrong)
+(5-5-8) def error_wrong_id(errorCode, params, symbol, objid, wrong)
+(5-5-9) def error_wrong_sym(errorCode, params, symbol, symbol2, wrong)
+
+ãã©ã¡ã¼ã¿ã«é¢ããã¨ã©ã¼ã¡ãã»ã¼ã¸ãåºåããï¼errorCodeã«ã¨ã©ã¼ã³ã¼ãã®
+æå­åï¼paramsã«éçAPIã®ãã©ã¡ã¼ã¿æ
+å ±ï¼symbolã«ã¨ã©ã¼ãèµ·ããããã©ã¡ã¼
+ã¿åãã·ã³ãã«åãããã®ï¼wrongã«ã¨ã©ã¼ã®çç±ãæ¸¡ãï¼
+
+ã¨ã©ã¼ãèµ·ãããéçAPIãè­å¥ããããã«ï¼ãªãã¸ã§ã¯ãIDãåºåãããå ´å
+ã«ã¯ï¼error_wrong_idãç¨ãï¼objidã«ãªãã¸ã§ã¯ãIDãè¡¨ããã©ã¡ã¼ã¿åãã·
+ã³ãã«åãããã®ãæ¸¡ãï¼ãªãã¸ã§ã¯ãçªå·ãåºåãããå ´åã«ã¯ï¼
+error_wrong_symãç¨ãï¼symbol2ã«ãªãã¸ã§ã¯ãçªå·ãè¡¨ããã©ã¡ã¼ã¿åãã·
+ã³ãã«åãããã®ãæ¸¡ãï¼
+
+(5-5-10) def error_illegal(errorCode, params, symbol)
+(5-5-11) def error_illegal_id(errorCode, params, symbol, objid)
+(5-5-12) def error_illegal_sym(errorCode, params, symbol, symbol2)
+
+ä¸æ­£ãã©ã¡ã¼ã¿ã®ã¨ã©ã¼ã¡ãã»ã¼ã¸ãåºåããï¼errorCodeã«ã¨ã©ã¼ã³ã¼ãã®æ
+å­åï¼paramsã«éçAPIã®ãã©ã¡ã¼ã¿æ
+å ±ï¼symbolã«ä¸æ­£ãªãã©ã¡ã¼ã¿åãã·ã³
+ãã«åãããã®ãæ¸¡ãï¼
+
+ã¨ã©ã¼ãèµ·ãããéçAPIãè­å¥ããããã«ï¼ãªãã¸ã§ã¯ãIDãåºåãããå ´å
+ã«ã¯ï¼error_illegal_idãç¨ãï¼objidã«ãªãã¸ã§ã¯ãIDãè¡¨ããã©ã¡ã¼ã¿åã
+ã·ã³ãã«åãããã®ãæ¸¡ãï¼ãªãã¸ã§ã¯ãçªå·ãåºåãããå ´åã«ã¯ï¼
+error_illegal_symãç¨ãï¼symbol2ã«ãªãã¸ã§ã¯ãçªå·ãè¡¨ããã©ã¡ã¼ã¿åã
+ã·ã³ãã«åãããã®ãæ¸¡ãï¼
+
+5.6 GenFileã¯ã©ã¹
+
+GenFileã¯ã©ã¹ã¯ï¼çæã¹ã¯ãªããã«ãã£ã¦ãã¡ã¤ã«ãä½æããããã«ç¨ããã¯
+ã©ã¹ã§ããï¼çæã¹ã¯ãªããã«ããã¦GenFileã¯ã©ã¹ãç¨ãã¦ä½æãããã¡ã¤ã«
+ã¯ï¼ããã«ã¯ãã¡ã¤ã«ã«æ¸ãåºãããï¼çæã¹ã¯ãªããã«ãã£ã¦ã¨ã©ã¼ãå ±å
+ãããªãã£ãå ´åã«ã®ã¿ï¼ã³ã³ãã£ã®ã¥ã¬ã¼ã¿æ¬ä½ããã¡ã¤ã«ã«æ¸ãåºãï¼
+
+GenFileã¯ã©ã¹ãç¨ãã¦ãã¡ã¤ã«ãä½æããå ´åï¼åä¸ãã¡ã¤ã«åã®ãã¡ã¤ã«ã
+ãã§ã«å­å¨ãï¼æ°ããä½æãããã¡ã¤ã«ãããã¨åãå
+å®¹ã§ããã°ï¼ãã¡ã¤ã«
+ãæ¸ãåºããªãï¼ãã®ããï¼ã¿ã¤ã ã¹ã¿ã³ããæ´æ°ãããªãï¼ï¼
+
+GenFileã¯ã©ã¹ã®ä¸»ãªã¡ã½ããã¯ï¼ä»¥ä¸ã®éãã§ããï¼
+
+(5-6-1) new(<ãã¡ã¤ã«å>)
+
+æ°ãããã¡ã¤ã«ãä½æããï¼åä¸ã®ãã¡ã¤ã«åã®ãã¡ã¤ã«ãä½ææ¸ã¿ã®å ´åã«
+ã¯ï¼ä½ææ¸ã¿ã®ãã¡ã¤ã«ã®å
+å®¹ã«ï¼ããä»¥éã®å
+å®¹ãè¿½å ããï¼
+
+(5-6-2) add(<æå­å>)
+(5-6-3) add2(<æå­å>)
+(5-6-4) append(<æå­å>)
+
+ãã¡ã¤ã«ã«æå­åãæ¸ãåºãï¼è¿½è¨ããï¼ï¼æå­åãæ¸ãåºããå¾ã«ï¼addã¯æ¹
+è¡1ã¤ãï¼add2ã¯æ¹è¡2ã¤ãæ¸ãåºãï¼
+
+(5-6-5) comment_header(<æå­å>)
+
+ãã¡ã¤ã«ã«ã³ã¡ã³ãããããæ¸ãåºãï¼è¿½è¨ããï¼ï¼
+
+5.7 ãã®ä»ã®ã©ã¤ãã©ãª
+
+5.7.1 IncludeTrb(<çæã¹ã¯ãªããå>)
+
+æå®ããçæã¹ã¯ãªãããå¦çããï¼çæã¹ã¯ãªããã¯ï¼ã³ã³ãã£ã®ã¥ã¬ã¼ã¿
+ã«å¯¾ãã--include-directoryãªãã·ã§ã³ã§æå®ãããã£ã¬ã¯ããªããæ¢ãï¼
+
+5.7.2 Stringã¯ã©ã¹ã®æ¡å¼µ
+
+Stringã¯ã©ã¹ã«æ¬¡ã®2ã¤ã®ã¡ã½ãããè¿½å ãã¦ããï¼ã¾ãï¼NumStrã¯ã©ã¹ããã
+ãã®ã¡ã½ãããæã¤ï¼
+
+(5-7-2-1) quote
+
+äºéå¼ç¨ç¬¦ã§å²ã¾ããæå­åãè¿ãï¼
+
+(5-7-2-2) unquote
+
+äºéå¼ç¨ç¬¦ã§å²ã¾ããæå­åãå±éããæå­åãè¿ãï¼æå­åãäºéå¼ç¨ç¬¦ã§
+å²ã¾ãã¦ããªãå ´åã«ã¯ï¼æå­åããã®ã¾ã¾è¿ãï¼
+
+5.7.3 ã­ã¼ãã¢ã¸ã¥ã¼ã«æä½ã©ã¤ãã©ãª
+
+--rom-imageãªãã·ã§ã³ã¨--rom-symbolãªãã·ã§ã³ã§æå®ããã­ã¼ãã¢ã¸ã¥ã¼ã«
+ãæä½ããããã®ã©ã¤ãã©ãªé¢æ°ãç¨æãã¦ããï¼
+
+(5-7-3-1) SYMBOL(<ã·ã³ãã«>)
+
+--rom-symbolãªãã·ã§ã³ã§æå®ããã·ã³ãã«ãã¡ã¤ã«ããï¼æå®ããã·ã³ãã«
+ã®ã¢ãã¬ã¹ãè¿ãï¼ã·ã³ãã«ãã¡ã¤ã«ä¸­ã«æå®ããã·ã³ãã«ããªãå ´åã«ã¯
+nilãè¿ãï¼
+
+(5-7-3-2) BCOPY(<ã³ãã¼å
+å
+é ­ã¢ãã¬ã¹>, <ã³ãã¼å
+å
+é ­ã¢ãã¬ã¹>, <ãµã¤ãº>)
+
+--rom-imageãªãã·ã§ã³ã§æå®ããSã¬ã³ã¼ããã¡ã¤ã«ä¸­ã§ï¼æå®ãããã©ã¡ã¼
+ã¿ã«å¾ã£ã¦ãã¼ã¿ãã³ãã¼ããï¼ãã¼ã¿ã¯ï¼ã³ã³ãã£ã®ã¥ã¬ã¼ã¿ã®ã¡ã¢ãªä¸­ã§
+ã³ãã¼ããã ãã§ï¼Sã¬ã³ã¼ããã¡ã¤ã«ãæ¸ãæããããã§ã¯ãªãï¼
+
+(5-7-3-3) PEEK(<å
+é ­ã¢ãã¬ã¹>, <ãµã¤ãº>[, <ç¬¦å·ä»ããã©ã°>])
+
+--rom-imageãªãã·ã§ã³ã§æå®ããSã¬ã³ã¼ããã¡ã¤ã«ããï¼æå®ããå
+é ­ã¢ã
+ã¬ã¹ããã³ãµã¤ãºã§ãã¼ã¿ãåãåºãï¼å¤ã«å¤æãã¦è¿ãï¼<ç¬¦å·ä»ããã©ã°>
+ãçç¥ãããfalseã«ããå ´åã«ã¯ç¬¦å·ãªãã®å¤ã«ï¼<ç¬¦å·ä»ããã©ã°>ãtrueã«
+ããå ´åã«ã¯ç¬¦å·ä»ãã®å¤ã«å¤æããï¼Sã¬ã³ã¼ããã¡ã¤ã«ã«æå®ããå
+é ­ã¢ã
+ã¬ã¹ããã³ãµã¤ãºã®ãã¼ã¿ãå«ã¾ãã¦ããªãå ´åã«ã¯nilãè¿ãï¼
+
+
+ï¼ï¼ãã®ä»
+
+6.1 ãªãã¸ã§ã¯ãIDã®æå®
+
+TOPPERSç¬¬3ä¸ä»£ã«ã¼ãã«ã§ã¯ï¼ãªãã¸ã§ã¯ãã®IDçªå·ãï¼ã³ã³ãã£ã®ã¥ã¬ã¼ã¿
+ãå²ãä»ããæ¹æ³ãåºæ¬ã¨ãªã£ã¦ãããï¼IDçªå·ã®å²ä»ããæåã§è¨­å®ããã
+å ´åã®ããã«ï¼ã³ã³ãã£ã®ã¥ã¬ã¼ã¿ã¯ï¼IDçªå·ã®å²ä»ãããã¡ã¤ã«ããåãè¾¼
+ãæ©è½ãæã£ã¦ããï¼
+
+å
+·ä½çã«ã¯ï¼IDçªå·ã®å²ä»ããè¨è¿°ãããã¡ã¤ã«ãç¨æãï¼ã³ã³ãã£ã®ã¥ã¬ã¼
+ã¿ã®ãã¹2ã«å¯¾ãã--id-input-fileãªãã·ã§ã³ã«ããæå®ãããã¨ã§ï¼ã³ã³ãã£
+ã®ã¥ã¬ã¼ã¿ã¯ããã«å¾ã£ã¦ãªãã¸ã§ã¯ãã«IDçªå·ãå²ãä»ããï¼ãã ãï¼
+TOPPERSç¬¬3ä¸ä»£ã«ã¼ãã«ã§ã¯ï¼IDçªå·ãé£ç¶ãã¦ããªããã°ãªããªãã¨ããå¶
+ç´ãããããï¼ãã®å¶ç´ãæºãããªãå²ä»ãããããã¨ããå ´åã«ã¯ï¼ã³ã³ãã£
+ã®ã¥ã¬ã¼ã¿æ¬ä½ãã¨ã©ã¼ãå ±åããï¼
+
+ã¾ãï¼ã³ã³ãã£ã®ã¥ã¬ã¼ã¿ã®ãã¹2ã«å¯¾ãã--id-output-fileãªãã·ã§ã³ãç¨ã
+ããã¨ã§ï¼å²ä»ãçµæããã¡ã¤ã«ã«æ¸ãåºããã¨ãã§ããï¼ååã®ã³ã³ãã£ã®ã¥
+ã¬ã¼ã·ã§ã³æã«ãã¡ã¤ã«ã«æ¸ãåºããå²ä»ãçµæãï¼æ¬¡åã®ã³ã³ãã£ã®ã¥ã¬ã¼
+ã·ã§ã³æã«èª­ã¿è¾¼ããã¨ã§ï¼ã·ã¹ãã ã³ã³ãã£ã®ã¥ã¬ã¼ã·ã§ã³ãã¡ã¤ã«ã®ä¿®æ­£
+ã«ããIDçªå·ã®å²ä»ããå¤åãããªããã¨ãã§ããï¼
+
+6.2 ã·ã¹ãã ãµã¼ãã¹ã¸ã®å¯¾å¿ï¼ãã¹2ã«ãããå¦çãã§ã¼ãºï¼
+
+TCP/IPããã«ã¦ã§ã¢ãªã©ã®ã·ã¹ãã ãµã¼ãã¹ã®ã³ã³ãã£ã®ã¥ã¬ã¼ã·ã§ã³ã«å¯¾å¿
+ããããã«ï¼ãã¹2ã«ãããå¦çãã§ã¼ãºã®æ©è½ãè¨­ãã¦ããï¼
+
+ã·ã¹ãã ãµã¼ãã¹ã«ãã£ã¦ã¯ï¼ãã®ã³ã³ãã£ã®ã¥ã¬ã¼ã·ã§ã³å
+å®¹ã«å¿ãã¦ï¼ã«ã¼
+ãã«ãªãã¸ã§ã¯ãã®ç»é²ãå¿
+è¦ã«ãªãå ´åãããï¼ä¾ãã°ï¼TCP/IPã®éä¿¡ç«¯ç¹
+ãçæãããã¨ã«ï¼ã»ããã©ãçæãããå ´åãèããããï¼ãã®ãããªå ´åï¼
+ã¾ãã·ã¹ãã ãµã¼ãã¹ã®ã³ã³ãã£ã®ã¥ã¬ã¼ã·ã§ã³å¦çãè¡ãï¼ãã®ä¸­ã§ã«ã¼ã
+ã«ãªãã¸ã§ã¯ãã®ç»é²æ
+å ±ãçæããå¾ã§ï¼ã«ã¼ãã«ã®ã³ã³ãã£ã®ã¥ã¬ã¼ã·ã§
+ã³å¦çãè¡ãããï¼ãããå¯è½ã«ããããã«è¨­ããæ©è½ãï¼ãã¹2ã«ãããå¦ç
+ãã§ã¼ãºã®æ©è½ã§ããï¼
+
+å¦çãã§ã¼ãºã®æ©è½ãç¨ããå ´åã«ã¯ï¼éçAPIãã¼ãã«ãã¡ã¤ã«ã¨çæã¹ã¯ãª
+ããããã§ã¼ãºæ¯ã«ä½æããï¼ã¾ãï¼ã³ã³ãã£ã®ã¥ã¬ã¼ã¿ã®ãªãã·ã§ã³ã§ãã
+ãã®ãã¡ã¤ã«ãæå®ããéã«ï¼ãã¡ã¤ã«åã«":"ã¨å¦çãã§ã¼ãºåãä»å ããã
+ã®ãæå®ããï¼
+
+ä¾ãã°ï¼TCP/IPããã«ã¦ã§ã¢ã®ã³ã³ãã£ã®ã¥ã¬ã¼ã·ã§ã³ï¼å¦çãã§ã¼ãºåã
+tcpipã¨ããï¼ã¨ã«ã¼ãã«ã®ã³ã³ãã£ã®ã¥ã¬ã¼ã·ã§ã³ï¼å¦çãã§ã¼ãºåã
+kernelã¨ããï¼ããã®é åºã§è¡ãå ´åï¼ãã¹1ã«æ¸¡ããªãã·ã§ã³ãï¼
+
+	--api-table tinet_api.def:tcpip --api-table kernel_api.def:kernel
+
+ã®ããã«ãï¼ãã¹2ã«æ¸¡ããªãã·ã§ã³ãï¼
+
+	-T tinet.trb:tcpip -T target_kernel.trb:kernel
+
+ã®ããã«ããï¼-Tãªãã·ã§ã³ã®æå®é åºã¯ï¼å¦çãã§ã¼ãºã®å¦çé åºã«ä¸è´ã
+ããï¼
+
+ã·ã¹ãã ãµã¼ãã¹ã®çæã¹ã¯ãªããããã«ã¼ãã«ãªãã¸ã§ã¯ããç»é²ããå ´å
+ã«ã¯ï¼éçAPIã®æ
+å ±ãæ ¼ç´ããããã·ã¥ã§ãã$cfgFileInfoã«ï¼ã«ã¼ãã«ãªã
+ã¸ã§å®åãçæããéçAPIã®æ
+å ±ãè¿½å ããï¼ä¾ãã°ï¼ã»ããã©ãè¿½å ç»é²ã
+ããå ´åã«ã¯ï¼æ¬¡ã®ãããªå¦çãè¡ãï¼
+
+----------------------------------------
+cfgInfo = { APINAME: "CRE_SEM" }
+cfgInfo["semid"] = "SEM1_FOR_SYSSVC1"
+cfgInfo["sematr"] = NumStr.new($TA_TPRI, "TA_TPRI")
+cfgInfo["isemcnt"] = 1
+cfgInfo["maxsem"] = 1
+$cfgFileInfo.push(cfgInfo)
+----------------------------------------
+
+ä¸ã®å¦çã§cfgInfoã«ç»é²ããæ
+å ±ã¯ï¼ãªãã¸ã§ã¯ãè­å¥åã«ã¤ãã¦ã¯æå­å
+ï¼ä¸ã®ä¾ã§ã¯"semid"ï¼ï¼æ´æ°å®æ°å¼ãã©ã¡ã¼ã¿ã«ã¤ãã¦ã¯æ°å¤ï¼ä¸ã®ä¾ã§ã¯
+"isemcnt"ã¨"maxsem"ï¼ã¾ãã¯NumStrã¯ã©ã¹ã®ãªãã¸ã§ã¯ãï¼ä¸ã®ä¾ã§ã¯
+"sematr"ï¼ï¼ä¸è¬å®æ°å¼ãã©ã¡ã¼ã¿ã¨æå­åãã©ã¡ã¼ã¿ã«ã¤ãã¦ã¯æå­åã¨ã
+ãï¼æ´æ°å®æ°å¼ãã©ã¡ã¼ã¿ãNumStrã¯ã©ã¹ã®ãªãã¸ã§ã¯ãã§ä¸ããå ´åã«ã¯ï¼
+ã³ã³ãã£ã®ã¥ã¬ã¼ã¿ãçæãããã¡ã¤ã«ä¸­ã«æå­åã§åºåãããï¼
+
+ãªãï¼ãã®æ¹æ³ã§éçAPIã®æ
+å ±ãç»é²ã§ããã®ã¯ï¼å¾ç¶ã®å¦çãã§ã¼ãºã§å¦ç
+ãããéçAPIã®ã¿ã§ããï¼
+
+ã¾ãï¼è¿½å ç»é²ããæ
+å ±ãæ­£ãããªãå ´åã®ã¨ã©ã¼ã¡ãã»ã¼ã¸ã¯ï¼ã¨ã©ã¼ã®çº
+çç®æãè¡¨ç¤ºãããªããªã©ä¸è¦ªåã§ããããï¼æ³¨æãããã¨ï¼Rubyãã¨ã©ã¼ã
+èµ·ããå¯è½æ§ãããï¼ï¼
+
+
+ï¼ï¼ãã¼ã¸ã§ã³å±¥æ­´
+
+	2016å¹´2æ8æ¥	Release	1.0.0		æåã®ä¸è¬å
+¬é
+	2016å¹´2æ14æ¥	Release	1.1.0		ãã¡ã¤ã³ã¨ã¯ã©ã¹ããµãã¼ã
+	2016å¹´3æ14æ¥	Release	1.2.0		æ§ã
+ãªæ¹è¯ï¼HRP3ã«ã¼ãã«ã«å¯¾å¿
+	2016å¹´5æ15æ¥	Release	1.2.1		ASP3 R3.1.0ã«åæ¢±ãã¦ãªãªã¼ã¹
+
+ä»¥ä¸
Index: asp3_wo_tecs/trunk/cfg/pass1.rb
===================================================================
--- asp3_wo_tecs/trunk/cfg/pass1.rb	(revision 305)
+++ asp3_wo_tecs/trunk/cfg/pass1.rb	(revision 306)
@@ -51,5 +51,5 @@
 #  ã®è²¬ä»»ãè² ããªãï¼
 #
-#  $Id: pass1.rb 32 2016-01-31 14:45:59Z ertl-hiro $
+#  $Id: pass1.rb 126 2016-05-03 06:53:08Z ertl-hiro $
 #
 
@@ -62,19 +62,19 @@
 #
 $symbolValueTable = {
-  "CHAR_BIT" => { :EXPR => "CHAR_BIT" },
-  "SCHAR_MAX" => { :EXPR => "SCHAR_MAX", :SIGNED => true },
-  "SCHAR_MIN" => { :EXPR => "SCHAR_MIN", :SIGNED => true },
-  "UCHAR_MAX" => { :EXPR => "UCHAR_MAX" },
-  "CHAR_MAX" => { :EXPR => "CHAR_MAX", :SIGNED => true },
-  "CHAR_MIN" => { :EXPR => "CHAR_MIN", :SIGNED => true },
-  "SHRT_MAX" => { :EXPR => "SHRT_MAX", :SIGNED => true },
-  "SHRT_MIN" => { :EXPR => "SHRT_MIN", :SIGNED => true },
-  "USHRT_MAX" => { :EXPR => "USHRT_MAX" },
-  "INT_MAX" => { :EXPR => "INT_MAX", :SIGNED => true },
-  "INT_MIN" => { :EXPR => "INT_MIN", :SIGNED => true },
-  "UINT_MAX" => { :EXPR => "UINT_MAX" },
-  "LONG_MAX" => { :EXPR => "LONG_MAX", :SIGNED => true },
-  "LONG_MIN" => { :EXPR => "LONG_MIN", :SIGNED => true },
-  "ULONG_MAX" => { :EXPR => "ULONG_MAX" }
+  "CHAR_BIT"  => { EXPR: "CHAR_BIT" },
+  "SCHAR_MAX" => { EXPR: "SCHAR_MAX", SIGNED: true },
+  "SCHAR_MIN" => { EXPR: "SCHAR_MIN", SIGNED: true },
+  "UCHAR_MAX" => { EXPR: "UCHAR_MAX" },
+  "CHAR_MAX"  => { EXPR: "CHAR_MAX",  SIGNED: true },
+  "CHAR_MIN"  => { EXPR: "CHAR_MIN",  SIGNED: true },
+  "SHRT_MAX"  => { EXPR: "SHRT_MAX",  SIGNED: true },
+  "SHRT_MIN"  => { EXPR: "SHRT_MIN",  SIGNED: true },
+  "USHRT_MAX" => { EXPR: "USHRT_MAX" },
+  "INT_MAX"   => { EXPR: "INT_MAX",   SIGNED: true },
+  "INT_MIN"   => { EXPR: "INT_MIN",   SIGNED: true },
+  "UINT_MAX"  => { EXPR: "UINT_MAX" },
+  "LONG_MAX"  => { EXPR: "LONG_MAX",  SIGNED: true },
+  "LONG_MIN"  => { EXPR: "LONG_MIN",  SIGNED: true },
+  "ULONG_MAX" => { EXPR: "ULONG_MAX" }
 }
 
@@ -90,4 +90,9 @@
 def ReadApiTableFile
   $apiTableFileNames.each do |apiTableFileName|
+    if /^(.+):(\w+)$/ =~ apiTableFileName
+      apiTableFileName = $1
+      apiPhase = $2.to_sym
+    end
+
     if !File.exist?(apiTableFileName)
       error_exit("`#{apiTableFileName}' not found")
@@ -99,7 +104,17 @@
       next if /^#/ =~ line			# ã³ã¡ã³ããã¹ã­ãã
 
-      fields = line.split(/\s+/)
-      staticApi = fields.shift
-      apiDef = { :API => staticApi }
+      fields = line.split(/\s+/)	# ãã£ã¼ã«ãã«åè§£
+
+      apiName = fields.shift		# APIåã®åãåºã
+      if /^(.+)\[(.+)\]$/ =~ apiName
+        apiName = $1
+        apiDef = { APINAME: apiName, API: $2 }
+      else
+        apiDef = { APINAME: apiName, API: apiName }
+      end
+      if !apiPhase.nil?
+        apiDef[:PHASE] = apiPhase
+      end
+
       apiParams = []
       fields.each do |param|
@@ -118,6 +133,7 @@
             apiParam[:ID_REF] = true
           when "."					# ç¬¦å·ç¡ãæ´æ°å®æ°å¼ãã©ã¡ã¼ã¿
-            apiParam[:UNSIGNED] = true
+            apiParam[:EXPTYPE] = "unsigned_t"
           when "+"					# ç¬¦å·ä»ãæ´æ°å®æ°å¼ãã©ã¡ã¼ã¿
+            apiParam[:EXPTYPE] = "signed_t"
             apiParam[:SIGNED] = true
           when "&"					# ä¸è¬æ´æ°å®æ°å¼ãã©ã¡ã¼ã¿
@@ -138,6 +154,11 @@
           end
         
-        when /^([{}])$/				# {ã¨}
-          apiParam = { :BRACE => $1 }
+        when "{"					# {
+          apiParam = { :BRACE => "{" }
+        when "{?"					# {?
+          apiParam = { :BRACE => "{", :OPTBRACE => true }
+
+        when "}"					# }
+          apiParam = { :BRACE => "}" }
 
         else
@@ -147,5 +168,5 @@
       end
       apiDef[:PARAM] = apiParams
-      $apiDefinition[staticApi] = apiDef
+      $apiDefinition[apiName] = apiDef
     end
     apiFile.close
@@ -174,5 +195,5 @@
 
       # å¼
-      if record[1].nil? || record[1] == ""
+      if record[1].nil? || record[1].empty?
         symbol[:EXPR] = variable
       else
@@ -180,14 +201,25 @@
       end
 
-      # ç¬¦å·ãã©ã°
-      if !(record[2].nil? || record[2] == "" || /^[uU]/ =~ record[2])
-        symbol[:SIGNED] = true
+      # å¼ã®å
+      if !record[2].nil? && !record[2].empty?
+        case record[2]
+        when /^[bB]/				# çå½å¤
+          symbol[:BOOL] = true
+        when /^[uU]/				# ç¬¦å·ç¡ãæ´æ°å¤
+          # ä½ãè¨­å®ããªã
+        else						# ç¬¦å·ä»ãæ´æ°å¤
+          symbol[:SIGNED] = true
+        end
       end
 
       # ã³ã³ãã¤ã«æ¡ä»¶
-      symbol[:CONDITION] = record[3]
-
-      # ã³ã³ãã¤ã«æ¡ä»¶ãæºããããªãæã®ããã©ã«ãå¤
-      symbol[:DEFAULT] = record[4]
+      if !record[3].nil? && !record[3].empty?
+        symbol[:CONDITION] = record[3]
+      end
+
+      # æ¡ä»¶ãæç«ããªãæã®å¼
+      if !record[4].nil? && !record[4].empty?
+        symbol[:ELSE_EXPR] = record[4]
+      end
 
       $symbolValueTable[variable] = symbol
@@ -218,5 +250,5 @@
   def getNextLine(withinApi)
     line = @cfgFile.gets
-    return nil if line.nil?
+    return(nil) if line.nil?
     @lineNo += 1
 
@@ -265,4 +297,7 @@
 class CfgParser
   @@lastApiIndex = 0
+  @@currentDomain = nil
+  @@currentClass = nil
+  @@nestDC = []
 
   def initialize
@@ -324,4 +359,27 @@
 
   #
+  #  æ¹è¡ã¨ç©ºç½æå­ãèª­ã¿é£ã°ã
+  #
+  def skipSpace(cfgFile, withinApi)
+    loop do
+      return if @line.nil?						# ãã¡ã¤ã«æ«ã§ããã°ãªã¿ã¼ã³
+      @line.lstrip!								# å
+é ­ã®ç©ºç½ãåé¤
+      return if @line != ""						# ç©ºè¡ã§ãªããã°ãªã¿ã¼ã³
+      @line = cfgFile.getNextLine(withinApi)	# æ¬¡ã®è¡ãèª­ã
+    end
+  end
+
+  #
+  #  æ¬¡ã®æå­ã¾ã§èª­ã¿é£ã°ã
+  #
+  def skipToToken(cfgFile, withinApi=true)
+    skipSpace(cfgFile, withinApi)
+    if @line.nil?							# ãã¡ã¤ã«æ«ã§ããã°ã¨ã©ã¼çµäº
+      error_exit("unexpexced end-of-file")
+    end
+  end
+
+  #
   #  ãã©ã¡ã¼ã¿ã1ã¤èª­ã
   #
@@ -334,17 +392,8 @@
     param = ""								# èª­ãã æå­å
     parenLevel = 0							# æ¬å¼§ã®ãã¹ãã¬ãã«
-  
     skipComma = @skipComma
     @skipComma = false
 
-    @line.lstrip!							# å
-é ­ã®ç©ºç½ãåé¤
-    while @line == ""						# ç©ºè¡ãèª­ã¿é£ã°ã
-      @line = cfgFile.getNextLine(true)
-      return nil if @line.nil?				# ãã¡ã¤ã«æ«ã§ããã°ãªã¿ã¼ã³
-      @line.lstrip!							# å
-é ­ã®ç©ºç½ãåé¤
-    end
-
+    skipToToken(cfgFile)					# æ¬¡ã®æå­ã¾ã§èª­ã¿é£ã°ã
     begin
       if parenLevel == 0
@@ -356,9 +405,9 @@
             return(parseParam(cfgFile))		# åå¸°å¼ã³åºã
           else
-            return(param)
+            return(param.strip)
           end
         when /^(\s*{)(.*)$/					# {
           if param != ""
-            return(param)
+            return(param.strip)
           else
             @line = $2
@@ -371,5 +420,5 @@
         when /^(\s*([)}]))(.*)$/			# }ã)
           if param != ""
-            return(param)
+            return(param.strip)
           else
             @line = $3
@@ -387,5 +436,5 @@
           @line = $2
         else								# è¡æ«
-          param += "\n"
+          param += " "
           @line = cfgFile.getNextLine(true)
         end
@@ -412,70 +461,137 @@
           @line = $2
         else								# è¡æ«
-          param += "\n"
+          param += " "
           @line = cfgFile.getNextLine(true)
         end
       end
     end while (@line)
-    return(param)
-  end
-
-  def parseApi(cfgFile)
+    return(param.strip)
+  end
+
+  def getParam(apiParam, param, cfgFile)
+    if param == ""
+      if !apiParam.has_key?(:OPTIONAL)
+        parse_error(cfgFile, "unexpected `,'")
+      end
+      return(param)
+    end
+
+    if apiParam.has_key?(:ID_DEF) || apiParam.has_key?(:ID_REF)
+      if (/^[A-Za-z_]\w*$/ !~ param)
+        parse_error(cfgFile, "`#{param}' is illegal object ID")
+      end
+      return(param)
+    end
+
+    if apiParam.has_key?(:STRING)
+      return(param.unquote)
+    else
+      return(param)
+    end
+  end
+
+  def parseApi(cfgFile, apiName)
     # éçAPIã®èª­ã¿è¾¼ã¿
     staticApi = {}
-    if (/^([A-Z_]+)\s*\((.*)$/ =~ @line)
-      apiName = $1
-      @line = $2
-
-      if $apiDefinition.has_key?(apiName)
-        staticApi[:API] = apiName
-        staticApi[:_FILE_] = cfgFile.getFileName
-        staticApi[:_LINE_] = cfgFile.getLineNo
-		apiDef = $apiDefinition[apiName]
-        param = parseParam(cfgFile)
-
-        apiDef[:PARAM].each do |apiParam|
-          if param.nil?						# ãã¡ã¤ã«æ«ã§ããã°ãªã¿ã¼ã³
-            error_exit("unexpexced end-of-file")
-            return(staticApi)
-          end
+    tooFewParams = false
+    skipUntilBrace = 0
+
+    skipToToken(cfgFile)					# æ¬¡ã®æå­ã¾ã§èª­ã¿é£ã°ã
+    if (/^\((.*)$/ =~ @line)
+      @line = $1
+
+      staticApi[:APINAME] = apiName
+      staticApi[:_FILE_] = cfgFile.getFileName
+      staticApi[:_LINE_] = cfgFile.getLineNo
+      apiDef = $apiDefinition[apiName]
+      param = parseParam(cfgFile)
+
+      apiDef[:PARAM].each do |apiParam|
+        return(staticApi) if param.nil?		# ãã¡ã¤ã«æ«ã§ããã°ãªã¿ã¼ã³
+
+        if skipUntilBrace > 0
+          # APIå®ç¾©ã}ã¾ã§ã¹ã­ããä¸­
           if apiParam.has_key?(:BRACE)
-            if param != apiParam[:BRACE]
-              parse_error(cfgFile, "'#{apiParam[:BRACE]}' expected")
+            case apiParam[:BRACE]
+            when "{"
+              skipUntilBrace += 1
+            when "}"
+              skipUntilBrace -= 1
+            end
+          end
+        elsif apiParam.has_key?(:OPTIONAL)
+          if /^([{})])$/ !~ param
+            store_param = getParam(apiParam, param, cfgFile)
+            if store_param != ""
+              staticApi[apiParam[:NAME]] = store_param
             end
             param = parseParam(cfgFile)
-          elsif apiParam.has_key?(:LIST)
-            staticApi[apiParam[:NAME]] = []
-            while /^([{})])$/ !~ param
-              if apiParam.has_key?(:STRING)
-                staticApi[apiParam[:NAME]].push(param.unquote)
-              else
-                staticApi[apiParam[:NAME]].push(param)
-              end
+          end
+        elsif apiParam.has_key?(:LIST)
+          staticApi[apiParam[:NAME]] = []
+          while /^([{})])$/ !~ param
+            staticApi[apiParam[:NAME]].push(getParam(apiParam, param, cfgFile))
+            param = parseParam(cfgFile)
+            break if param.nil?				# ãã¡ã¤ã«æ«ã®å ´å
+          end
+        elsif apiParam.has_key?(:OPTBRACE)
+          if param == apiParam[:BRACE]
+            param = parseParam(cfgFile)
+            break if param.nil?				# ãã¡ã¤ã«æ«ã®å ´å
+          else
+            if param == ""
               param = parseParam(cfgFile)
+              break if param.nil?			# ãã¡ã¤ã«æ«ã®å ´å
+            elsif /^([})])$/ !~ param
+              parse_error(cfgFile, "`{...}' expected before #{param}")
             end
-          elsif /^([{}])$/ =~ param
-            if !apiParam.has_key?(:OPTIONAL)
-              parse_error(cfgFile, "#{$1} unexpected")
-            end
-          else
-            if apiParam.has_key?(:STRING)
-              staticApi[apiParam[:NAME]] = param.unquote
-            else
-              staticApi[apiParam[:NAME]] = param
-            end
+            skipUntilBrace += 1          	# APIå®ç¾©ã}ã¾ã§ã¹ã­ãã
+          end
+        elsif !apiParam.has_key?(:BRACE)
+          if /^([{})])$/ !~ param
+            staticApi[apiParam[:NAME]] = getParam(apiParam, param, cfgFile)
             param = parseParam(cfgFile)
-          end
-        end
-        if param != ")"
-          parse_error(cfgFile, "')' expected")
-        end
-      else
-        parse_error(cfgFile, "unknown static API: #{apiName}")
+          elsif !tooFewParams
+            parse_error(cfgFile, "too few parameters before `#{$1}'")
+            tooFewParams = true
+          end
+        elsif param == apiParam[:BRACE]
+          param = parseParam(cfgFile)
+          tooFewParams = false
+        else
+          parse_error(cfgFile, "`#{apiParam[:BRACE]}' expected before #{param}")
+          # )ããã¡ã¤ã«æ«ã¾ã§èª­ã¿é£ã°ã
+          loop do
+            param = parseParam(cfgFile)
+            break if (param.nil? || param == ")")
+          end
+          break
+        end
+      end
+
+      # æå¾
+ããããã©ã¡ã¼ã¿ããã¹ã¦èª­ãã å¾ã®å¦ç
+      if param != ")"
+        begin
+          param = parseParam(cfgFile)
+          return(staticApi) if param.nil?	# ãã¡ã¤ã«æ«ã§ããã°ãªã¿ã¼ã³
+        end while param != ")"
+        parse_error(cfgFile, "too many parameters before `)'")
       end
     else
-        parse_error(cfgFile, "syntax error: #{@line}")
-    end
-    @line = ""
+      parse_error(cfgFile, "syntax error: #{@line}")
+      @line = ""
+    end
     return(staticApi)
+  end
+
+  def parseOpenBrace(cfgFile)
+    # {ã®èª­ã¿è¾¼ã¿
+    skipToToken(cfgFile)					# æ¬¡ã®æå­ã¾ã§èª­ã¿é£ã°ã
+    if (/^\{(.*)$/ =~ @line)
+      @line = $1
+    else
+      parse_error(cfgFile, "`{' expected before #{@line}")
+    end
   end
 
@@ -483,12 +599,8 @@
     cfgFiles = [ ConfigFile.new(cfgFileName) ]
     @line = ""
-    begin
+    loop do
       cfgFile = cfgFiles.last
-      while @line == ""									# ç©ºè¡ãèª­ã¿é£ã°ã
-        @line = cfgFile.getNextLine(false)
-        @line.sub!(/^[\s;]*/, "") unless @line.nil?		# å
-é ­ã®ç©ºç½ã¨";"ãåé¤
-      end
-
+
+      skipSpace(cfgFile, false)				# æ¹è¡ã¨ç©ºç½æå­ãèª­ã¿é£ã°ã
       if @line.nil?
         # ãã¡ã¤ã«æ«ã®å¦ç
@@ -497,11 +609,11 @@
           break								# ãã¼ã¹å¦ççµäº
         else
-          @line = ""
-          next								# å
+          @line = ""						# å
 ã®ãã¡ã¤ã«ã«æ»ã£ã¦ç¶ãã
         end
-      end
-
-      if /^#/ =~ @line
+      elsif /^;(.*)$/ =~ @line
+        # ;ã¯èª­ã¿é£ã°ã
+        @line = $1
+      elsif /^#/ =~ @line
         # ããªãã­ã»ããµãã£ã¬ã¯ãã£ããèª­ã
         case @line
@@ -509,5 +621,5 @@
           $includeFiles.push($1.strip)
         when /^#(ifdef|ifndef|if|endif|else|elif)\b/
-          directive = {:DIRECTIVE => @line.strip}
+          directive = { :DIRECTIVE => @line.strip }
           $cfgFileInfo.push(directive)
         else
@@ -515,25 +627,108 @@
         end
         @line = ""
+      elsif (/^([A-Z_][A-Z0-9_]*)\b(.*)$/ =~ @line)
+        apiName = $1
+        @line = $2
+
+        case apiName
+        when "KERNEL_DOMAIN"
+          if $supportDomain.nil?
+            parse_warning(cfgFile, "`KERNEL_DOMAIN' is not supported")
+          end
+          if !@@currentDomain.nil?
+            parse_error(cfgFile, "`DOMAIN' must not be nested")
+          end
+          @@currentDomain = "TDOM_KERNEL"
+          parseOpenBrace(cfgFile)
+          @@nestDC.push("domain")
+        when "DOMAIN"
+          if $supportDomain.nil?
+            parse_warning(cfgFile, "`DOMAIN' is not supported")
+          end
+          if !@@currentDomain.nil?
+            parse_error(cfgFile, "`DOMAIN' must not be nested")
+          end
+          domid = parseParam(cfgFile).sub(/^\((.+)\)$/m, "\\1").strip
+          if (/^[A-Za-z_]\w*$/ !~ domid)
+            parse_error(cfgFile, "`#{domid}' is illegal domain ID")
+          else
+            if !$domainId.has_key?(domid)
+              if $inputObjid.has_key?(domid)
+                # IDçªå·å
+¥åãã¡ã¤ã«ã«å®ç¾©ããã¦ããå ´å
+                $domainId[domid] = $inputObjid[domid]
+                if $domainId[domid] > 32
+                  error_exit("domain ID for `#{domid}' is too large")
+                end
+              else
+                $domainId[domid] = nil
+              end
+            end
+            @@currentDomain = domid
+          end
+          parseOpenBrace(cfgFile)
+          @@nestDC.push("domain")
+        when "CLASS"
+          if $supportClass.nil?
+            parse_warning(cfgFile, "`CLASS' is not supported")
+          end
+          if !@@currentClass.nil?
+            parse_error(cfgFile, "`CLASS' must not be nested")
+          end
+          @@currentClass = parseParam(cfgFile).sub(/^\((.+)\)$/m, "\\1").strip
+          @@classFile = cfgFile.getFileName
+          @@classLine = cfgFile.getLineNo
+          parseOpenBrace(cfgFile)
+          @@nestDC.push("class")
+        else
+          if $apiDefinition.has_key?(apiName)
+            # éçAPIã1ã¤èª­ã
+            staticApi = parseApi(cfgFile, apiName)
+            if staticApi.empty?
+              # ãã¡ã¤ã«æ«ãææ³ã¨ã©ã¼
+            elsif (staticApi[:APINAME] == "INCLUDE")
+              # INCLUDEã®å¦ç
+              includeFilePath = SearchFilePath(staticApi[:file])
+              if includeFilePath.nil?
+                parse_error(cfgFile, "`#{staticApi[:file]}' not found")
+              else
+                $dependencyFiles.push(includeFilePath)
+                cfgFiles.push(ConfigFile.new(includeFilePath))
+              end
+            else
+              # éçAPIã®å¦ç
+              if !@@currentDomain.nil?
+                staticApi[:DOMAIN] = @@currentDomain
+              end
+              if !@@currentClass.nil?
+                staticApi[:CLASS] = @@currentClass
+                staticApi[:CLASS_FILE_] = @@classFile
+                staticApi[:CLASS_LINE_] = @@classLine
+              end
+              staticApi[:INDEX] = (@@lastApiIndex += 1)
+              $cfgFileInfo.push(staticApi)
+            end
+          else
+            parse_error(cfgFile, "unknown static API: #{apiName}")
+          end
+        end
+      elsif (/^\}(.*)$/ =~ @line)
+        # }ã®å¦ç
+        if @@nestDC.size > 0
+          case @@nestDC.pop
+          when "domain"
+            @@currentDomain = nil
+          when "class"
+            @@currentClass = nil
+          end
+        else
+          error_exit("unexpected `}'")
+        end
+        @line = $1
       else
-        # éçAPIã1ã¤èª­ã
-        staticApi = parseApi(cfgFile)
-        if staticApi.empty?
-          # ææ³ã¨ã©ã¼
-        elsif (staticApi[:API] == "INCLUDE")
-          # INCLUDEã®å¦ç
-          includeFilePath = SearchFilePath(staticApi[:file])
-          if includeFilePath.nil?
-            parse_error(cfgFile, "`#{staticApi["file"]}' not found")
-          else
-            $dependencyFiles.push(includeFilePath)
-            cfgFiles.push(ConfigFile.new(includeFilePath))
-          end
-        else
-          # éçAPIã®å¦ç
-          staticApi[:INDEX] = (@@lastApiIndex += 1)
-          $cfgFileInfo.push(staticApi)
-        end
-      end
-    end while true
+        parse_error(cfgFile, "syntax error: #{@line}")
+        @line = ""
+      end
+    end
   end
 end
@@ -542,8 +737,40 @@
 #  cfg1_out.cã®çæ
 #
-def GenerateCfg1OutC
-  cfg1Out = GenFile.new(CFG1_OUT_C)
-
-  cfg1Out.append(<<EOS)
+module Cfg1OutC
+  #
+  #  éçAPIã®ãã¡ã¤ã«åã¨è¡çªå·ã®åºå
+  #
+  def self.OutLineNumber(cfgInfo)
+    @cfg1Out.add("#line #{cfgInfo[:_LINE_]} \"#{cfgInfo[:_FILE_]}\"")
+  end
+
+  #
+  #  ã¯ã©ã¹è¨è¿°ã®ãã¡ã¤ã«åã¨è¡çªå·ã®åºå
+  #
+  def self.OutClassLineNumber(cfgInfo)
+    @cfg1Out.add("#line #{cfgInfo[:CLASS_LINE_]} \"#{cfgInfo[:CLASS_FILE_]}\"")
+  end
+
+  #
+  #  ãã©ã¡ã¼ã¿ã«é¢ããå®ç¾©ã®åºå
+  #
+  def self.OutParamDef(param, index, apiParam, cfgInfo)
+    if apiParam.has_key?(:ID_DEF)
+      @cfg1Out.add("#define #{param}\t(<>)")
+    elsif apiParam.has_key?(:EXPTYPE)
+      OutLineNumber(cfgInfo)
+      @cfg1Out.add("const #{apiParam[:EXPTYPE]} #{CFG1_PREFIX}valueof_" \
+								"#{apiParam[:NAME]}_#{index} = " \
+								"(#{apiParam[:EXPTYPE]})(#{param});")
+    end
+  end
+
+  #
+  #  cfg1_out.cã®çæï¼ã¡ã¤ã³ã®å¦çï¼
+  #
+  def self.Generate
+    @cfg1Out = GenFile.new(CFG1_OUT_C)
+
+    @cfg1Out.append(<<EOS)
 /* #{CFG1_OUT_C} */
 #define TOPPERS_CFG1_OUT
@@ -551,10 +778,10 @@
 EOS
 
-  # ã¤ã³ã¯ã«ã¼ãããããã¡ã¤ã«
-  $includeFiles.each do |file|
-    cfg1Out.add("#include #{file}")
-  end
-
-  cfg1Out.append(<<EOS)
+    # ã¤ã³ã¯ã«ã¼ãããããã¡ã¤ã«
+    $includeFiles.each do |file|
+      @cfg1Out.add("#include #{file}")
+    end
+
+    @cfg1Out.add(<<EOS)
 
 #ifdef INT64_MAX
@@ -566,53 +793,74 @@
 #endif
 
-#include "target_cfg1_out.h"
+#include "#{CFG1_OUT_TARGET_H}"
 #include <limits.h>
 
 const uint32_t #{CFG1_MAGIC_NUM} = 0x12345678;
 const uint32_t #{CFG1_SIZEOF_SIGNED} = sizeof(signed_t);
-
 EOS
 
-  # å¤åå¾ã·ã³ãã«ã®å¦ç
-  $symbolValueTable.each do |symbolName, symbolData|
-    type = symbolData.has_key?(:SIGNED) ? "signed_t" : "unsigned_t"
-    if !symbolData[:CONDITION].nil?
-      cfg1Out.add("#if #{symbolData[:CONDITION]}")
-    end
-    cfg1Out.add("const #{type} #{CFG1_PREFIX}#{symbolName} = " \
-							"(#{type})(#{symbolData[:EXPR]});")
-    if !symbolData[:DEFAULT].nil?
-      cfg1Out.add("#else")
-      cfg1Out.add("const #{type} #{CFG1_PREFIX}#{symbolName} = " \
-							"(#{type})(#{symbolData[:DEFAULT]});")
-    end
-    if !symbolData[:CONDITION].nil?
-      cfg1Out.add("#endif")
-    end
-  end
-
-  # éçAPIï¼ããªãã­ã»ããµãã£ã¬ã¯ãã£ãã®å¦ç
-  $cfgFileInfo.each do |cfgInfo|
-    if cfgInfo.has_key?(:DIRECTIVE)
-      cfg1Out.add2(cfgInfo[:DIRECTIVE])
-    else
-      apiDef = $apiDefinition[cfgInfo[:API]]
-      apiIndex = cfgInfo[:INDEX]
-      cfg1Out.add("#line #{cfgInfo[:_LINE_]} \"#{cfgInfo[:_FILE_]}\"")
-      cfg1Out.add("const unsigned_t #{CFG1_PREFIX}static_api_" \
+    # å¤åå¾ã·ã³ãã«ã®å¦ç
+    $symbolValueTable.each do |symbolName, symbolData|
+      if symbolData.has_key?(:BOOL) || symbolData.has_key?(:SIGNED)
+        type = "signed_t"
+      else
+        type = "unsigned_t"
+      end
+      if symbolData.has_key?(:CONDITION)
+        @cfg1Out.add("#if #{symbolData[:CONDITION]}")
+      end
+      @cfg1Out.add("const #{type} #{CFG1_PREFIX}#{symbolName} = " \
+								"(#{type})(#{symbolData[:EXPR]});")
+      if symbolData.has_key?(:ELSE_EXPR)
+        @cfg1Out.add("#else")
+        @cfg1Out.add("const #{type} #{CFG1_PREFIX}#{symbolName} = " \
+								"(#{type})(#{symbolData[:ELSE_EXPR]});")
+      end
+      if symbolData.has_key?(:CONDITION)
+        @cfg1Out.add("#endif")
+      end
+    end
+    @cfg1Out.add
+
+    # ãã¡ã¤ã³IDã®å®ç¾©ã®çæ
+    $domainId.each do |domainName, domainVal|
+      if domainVal > 0
+        @cfg1Out.add("#define #{domainName} #{domainVal}")
+      end
+    end
+    @cfg1Out.add
+
+    # éçAPIï¼ããªãã­ã»ããµãã£ã¬ã¯ãã£ãã®å¦ç
+    $cfgFileInfo.each do |cfgInfo|
+      if cfgInfo.has_key?(:DIRECTIVE)
+        @cfg1Out.add2(cfgInfo[:DIRECTIVE])
+      else
+        apiDef = $apiDefinition[cfgInfo[:APINAME]]
+        apiIndex = cfgInfo[:INDEX]
+        OutLineNumber(cfgInfo)
+        @cfg1Out.add("const unsigned_t #{CFG1_PREFIX}static_api_" \
 										"#{apiIndex} = #{apiIndex};")
-      apiDef[:PARAM].each do |apiParam|
-        if apiParam.has_key?(:ID_DEF)
-          cfg1Out.add("#define #{cfgInfo[apiParam[:NAME]]}\t(<>)")
-        elsif (apiParam.has_key?(:SIGNED) || apiParam.has_key?(:UNSIGNED)) \
-										&& !cfgInfo[apiParam[:NAME]].nil?
-          type = apiParam.has_key?(:SIGNED) ? "signed_t" : "unsigned_t"
-          cfg1Out.add("#line #{cfgInfo[:_LINE_]} \"#{cfgInfo[:_FILE_]}\"")
-          cfg1Out.add("const #{type} #{CFG1_PREFIX}valueof_" \
-							"#{apiParam[:NAME]}_#{apiIndex} = " \
-							"(#{type})(#{cfgInfo[apiParam[:NAME]]});")
-        end
-      end
-      cfg1Out.add
+        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)
+            paramData.each.with_index(1) do |param, index|
+              OutParamDef(param, "#{apiIndex}_#{index}", apiParam, cfgInfo)
+            end
+          else
+            OutParamDef(paramData, "#{apiIndex}", apiParam, cfgInfo)
+          end
+        end
+        if cfgInfo.has_key?(:CLASS)
+          # ã¯ã©ã¹IDã®åå¾ã®ããã®å¦ç
+          OutClassLineNumber(cfgInfo)
+          @cfg1Out.add("const signed_t #{CFG1_PREFIX}valueof_CLASS_" \
+                      "#{apiIndex} = (signed_t)(#{cfgInfo[:CLASS]});")
+        end
+        @cfg1Out.add
+      end
     end
   end
@@ -644,4 +892,5 @@
   $dependencyFiles = $configFileNames.dup
   $includeFiles = []
+  $domainId = { "TDOM_KERNEL" => -1, "TDOM_NONE" => -2 }
   $configFileNames.each do |configFileName|
     CfgParser.new.parseFile(configFileName)
@@ -650,7 +899,24 @@
 
   #
+  #  ãã¡ã¤ã³IDã®å²å½ã¦å¦ç
+  #
+  nextDomainId = 1
+  $domainId.each do |domainName, domainVal|
+    if domainVal.nil?
+      while $domainId.has_value?(nextDomainId)
+        nextDomainId += 1
+      end
+      $domainId[domainName] = nextDomainId
+      if nextDomainId > 32
+        error_exit("too large number of user domains")
+      end
+      nextDomainId += 1
+    end
+  end
+
+  #
   #  cfg1_out.cã®çæ
   #
-  GenerateCfg1OutC()
+  Cfg1OutC::Generate()
 
   #
@@ -668,5 +934,5 @@
     end
 
-    depFile.print("#{CFG1_OUT_C} #{CFG1_OUT_DB}:")
+    depFile.print("#{CFG1_OUT_TIMESTAMP}:")
     $dependencyFiles.each do |fileName|
       depFile.print(" #{fileName}")
@@ -690,4 +956,5 @@
       db[:cfgFileInfo] = $cfgFileInfo
       db[:includeFiles] = $includeFiles
+      db[:domainId] = $domainId
     end
   end
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
