Index: EcnlProtoTool/trunk/asp3_dcre/cfg/cfg.rb
===================================================================
--- EcnlProtoTool/trunk/asp3_dcre/cfg/cfg.rb	(revision 331)
+++ EcnlProtoTool/trunk/asp3_dcre/cfg/cfg.rb	(revision 429)
@@ -1,3 +1,3 @@
-#!/usr/bin/env ruby
+#!/usr/bin/env ruby -Eutf-8 -w
 # -*- coding: utf-8 -*-
 #
@@ -5,5 +5,5 @@
 #
 #  Copyright (C) 2015 by FUJI SOFT INCORPORATED, JAPAN
-#  Copyright (C) 2015,2016 by Embedded and Real-Time Systems Laboratory
+#  Copyright (C) 2015-2019 by Embedded and Real-Time Systems Laboratory
 #              Graduate School of Information Science, Nagoya Univ., JAPAN
 #
@@ -37,5 +37,5 @@
 #  の責任を負わない．
 #
-#  $Id$
+#  $Id: cfg.rb 175 2019-06-19 01:51:58Z ertl-hiro $
 #
 
@@ -56,16 +56,18 @@
 #
 # 共通
-VERSION = "1.2.2"
+VERSION = "1.5.0"
 
 # cfg1_out関係
-CFG1_PREFIX        = "TOPPERS_cfg_"
-CFG1_MAGIC_NUM     = "TOPPERS_magic_number"
-CFG1_SIZEOF_SIGNED = "TOPPERS_sizeof_signed_t"
-CFG1_OUT_C         = "cfg1_out.c"
-CFG1_OUT_DB        = "cfg1_out.db"
-CFG1_OUT_SREC      = "cfg1_out.srec"
-CFG1_OUT_SYMS      = "cfg1_out.syms"
-CFG1_OUT_TIMESTAMP = "cfg1_out.timestamp"
-CFG1_OUT_TARGET_H  = "target_cfg1_out.h"
+CFG1_PREFIX         = "TOPPERS_cfg_"
+CFG1_MAGIC_NUM      = "TOPPERS_magic_number"
+CFG1_SIZEOF_SIGNED  = "TOPPERS_sizeof_signed_t"
+CFG1_SIZEOF_INTPTR  = "TOPPERS_sizeof_intptr_t"
+CFG1_SIZEOF_CHARPTR = "TOPPERS_sizeof_char_ptr_t"
+CFG1_OUT_C          = "cfg1_out.c"
+CFG1_OUT_DB         = "cfg1_out.db"
+CFG1_OUT_SREC       = "cfg1_out.srec"
+CFG1_OUT_SYMS       = "cfg1_out.syms"
+CFG1_OUT_TIMESTAMP  = "cfg1_out.timestamp"
+CFG1_OUT_TARGET_H   = "target_cfg1_out.h"
 
 # cfg2_out関係
@@ -105,5 +107,5 @@
 $noParseError = 0
 def parse_error(cfgFile, message)
-  error(message, "#{cfgFile.getFileName()}:#{cfgFile.getLineNo}:")
+  error(message, "#{cfgFile.getFileName}:#{cfgFile.getLineNo}:")
   if ($noParseError += 1) >= 10
     abort("too many errors emitted, stopping now")
@@ -113,5 +115,5 @@
 # システムコンフィギュレーションファイルの構文解析時の警告
 def parse_warning(cfgFile, message)
-  warning(message, "#{cfgFile.getFileName()}:#{cfgFile.getLineNo}:")
+  warning(message, "#{cfgFile.getFileName}:#{cfgFile.getLineNo}:")
 end
 
@@ -155,9 +157,4 @@
 def error_ercd(errorCode, params, message)
   error_api(params, "#{errorCode}: #{message}")
-end
-
-# 静的API処理時の警告（エラーコード付き）
-def warning_ercd(errorCode, params, message)
-  warning_api(params, "#{errorCode}: #{message}")
 end
 
@@ -316,5 +313,5 @@
   # ハッシュのキーとして使う時の比較も数値情報で行う
   def eql?(other)
-    @val == other.val
+    @val == other
   end
 
@@ -390,4 +387,8 @@
     if symbolData.has_key?(:VALUE)
       eval("$#{symbolName} = #{symbolData[:VALUE]}")
+      if symbolData.has_key?(:NUMSTRVAR)
+        eval("$#{symbolData[:NUMSTRVAR]} = " \
+					"NumStr.new(symbolData[:VALUE], symbolData[:EXPR])")
+      end
     end
   end
@@ -431,4 +432,15 @@
 
 #
+#  インクルードディレクティブ（#include）の生成
+#
+def GenerateIncludes(genFile)
+  $cfgFileInfo.each do |cfgInfo|
+    if cfgInfo.has_key?(:DIRECTIVE)
+      genFile.add(cfgInfo[:DIRECTIVE])
+    end
+  end
+end
+
+#
 #  パス3の処理
 #
@@ -439,14 +451,8 @@
   db = PStore.new(CFG2_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]
-    $cfg2Data = db[:cfg2Data]
-  end
-  $cfg3Data = {}
+    db.roots.each do |var|
+      eval("$#{var} = db[:#{var}]")
+    end
+  end
 
   #
@@ -465,15 +471,10 @@
   #  パス4に引き渡す情報をファイルに生成
   #
-  if $omitOutputDb.nil?
+  if !$omitOutputDb
     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
+      $globalVars.each do |var|
+        eval("db[:#{var}] = $#{var}")
+      end
     end
   end
@@ -489,12 +490,7 @@
   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]
+    db.roots.each do |var|
+      eval("$#{var} = db[:#{var}]")
+    end
   end
 
@@ -557,13 +553,17 @@
 $romImageFileName = nil
 $romSymbolFileName = nil
-$dependencyFileName = nil
 $idInputFileName = nil
 $idOutputFileName = nil
+$dependencyFileName = nil
+$omitOutputDb = false
+$supportDomain = false
+$supportClass = false
 
 #
 #  オプションの処理
 #
-OptionParser.new(banner="Usage: cfg.rb [options] CONFIG-FILE", 40) do |opt|
+OptionParser.new("Usage: cfg.rb [options] CONFIG-FILE", 40) do |opt|
   opt.version = VERSION
+  opt.release = nil
   opt.on("-k KERNEL", "--kernel KERNEL", "kernel profile name") do |val|
     $kernel = val
@@ -605,9 +605,17 @@
     $omitOutputDb = true
   end
+  opt.on("--enable-domain", "enable DOMAIN support") do
+	$supportDomain = true
+  end
+  opt.on("--enable-class", "enable CLASS support") do
+	$supportClass = true
+  end
   opt.on("-v", "--version", "show version number") do
-    abort(opt.ver)
+    puts(opt.ver)
+    exit(0)
   end
   opt.on("-h", "--help", "show help (this)") do
-    abort(opt.help)
+    puts(opt.help)
+    exit(0)
   end
   opt.parse!(ARGV)
@@ -642,4 +650,7 @@
 	$supportDomain = true
 when /^fmp/
+	$supportClass = true
+when /^hrmp/
+	$supportDomain = true
 	$supportClass = true
 end
