Index: asp3_tinet_ecnl_arm/trunk/asp3_dcre/tecsgen/tecslib/plugin/lib/GenHRP2Marshaler.rb
===================================================================
--- asp3_tinet_ecnl_arm/trunk/asp3_dcre/tecsgen/tecslib/plugin/lib/GenHRP2Marshaler.rb	(revision 352)
+++ asp3_tinet_ecnl_arm/trunk/asp3_dcre/tecsgen/tecslib/plugin/lib/GenHRP2Marshaler.rb	(revision 374)
@@ -35,4 +35,5 @@
 #   の責任を負わない．
 #  
+#   $Id$
 #++
 
Index: asp3_tinet_ecnl_arm/trunk/asp3_dcre/tecsgen/tecslib/plugin/lib/GenOpaqueMarshaler.rb
===================================================================
--- asp3_tinet_ecnl_arm/trunk/asp3_dcre/tecsgen/tecslib/plugin/lib/GenOpaqueMarshaler.rb	(revision 352)
+++ asp3_tinet_ecnl_arm/trunk/asp3_dcre/tecsgen/tecslib/plugin/lib/GenOpaqueMarshaler.rb	(revision 374)
@@ -4,5 +4,5 @@
 #      Generator for TOPPERS Embedded Component System
 #  
-#   Copyright (C) 2008-2014 by TOPPERS Project
+#   Copyright (C) 2008-2018 by TOPPERS Project
 #--
 #   上記著作権者は，以下の(1)～(4)の条件を満たす場合に限り，本ソフトウェ
@@ -464,6 +464,8 @@
 	/* Channel Lock */
 	SET_RPC_STATE( state_, RPCSTATE_CLIENT_GET_SEM );
-	if( is_cLockChannel_joined() )
-		cLockChannel_wait();
+	if( is_cLockChannel_joined() ){
+		if( (ercd_=cLockChannel_wait()) != E_OK )
+			goto error_reset;
+	}
 EOT
 
@@ -554,6 +556,14 @@
 	/* Channel Unlock */
 	SET_RPC_STATE( state_, RPCSTATE_CLIENT_RELEASE_SEM );
-	if( is_cLockChannel_joined() )
-		cLockChannel_signal();
+	if( is_cLockChannel_joined() ){
+		if( (ercd_=cLockChannel_signal()) != E_OK )
+			goto error_reset;
+	}
+EOT
+
+    file.print <<EOT
+	/* state_ is not used in normal case */
+  /* below is to avoid 'set but not used' warnning */
+	(void)state_;
 EOT
 
@@ -630,5 +640,5 @@
         file.print <<EOT
 	}else{
-		return;
+		return E_ID;
 	}
 EOT
Index: asp3_tinet_ecnl_arm/trunk/asp3_dcre/tecsgen/tecslib/plugin/lib/GenTransparentMarshaler.rb
===================================================================
--- asp3_tinet_ecnl_arm/trunk/asp3_dcre/tecsgen/tecslib/plugin/lib/GenTransparentMarshaler.rb	(revision 352)
+++ asp3_tinet_ecnl_arm/trunk/asp3_dcre/tecsgen/tecslib/plugin/lib/GenTransparentMarshaler.rb	(revision 374)
@@ -388,5 +388,5 @@
     };
 #{ppallocator_dealloc_str}
-    return;
+    return E_OK;
 
 error_reset:
@@ -394,4 +394,5 @@
         (void)cTDR_reset();
 #{ppallocator_dealloc_str}
+    return E_OK;
 EOT
 
Index: asp3_tinet_ecnl_arm/trunk/asp3_dcre/tecsgen/tecslib/plugin/lib/MrubyBridgeCelltypePluginModule.rb
===================================================================
--- asp3_tinet_ecnl_arm/trunk/asp3_dcre/tecsgen/tecslib/plugin/lib/MrubyBridgeCelltypePluginModule.rb	(revision 374)
+++ asp3_tinet_ecnl_arm/trunk/asp3_dcre/tecsgen/tecslib/plugin/lib/MrubyBridgeCelltypePluginModule.rb	(revision 374)
@@ -0,0 +1,301 @@
+# -*- coding: utf-8 -*-
+#
+#  TECS Generator
+#      Generator for TOPPERS Embedded Component System
+#  
+#   Copyright (C) 2008-2011 by TOPPERS Project
+#--
+#   ä¸è¨èä½æ¨©è
+ã¯ï¼ä»¥ä¸ã®(1)ï½(4)ã®æ¡ä»¶ãæºããå ´åã«éãï¼æ¬ã½ããã¦ã§
+#   ã¢ï¼æ¬ã½ããã¦ã§ã¢ãæ¹å¤ãããã®ãå«ãï¼ä»¥ä¸åãï¼ãä½¿ç¨ã»è¤è£½ã»æ¹
+#   å¤ã»åé
+å¸ï¼ä»¥ä¸ï¼å©ç¨ã¨å¼ã¶ï¼ãããã¨ãç¡åã§è¨±è«¾ããï¼
+#   (1) æ¬ã½ããã¦ã§ã¢ãã½ã¼ã¹ã³ã¼ãã®å½¢ã§å©ç¨ããå ´åã«ã¯ï¼ä¸è¨ã®èä½
+#       æ¨©è¡¨ç¤ºï¼ãã®å©ç¨æ¡ä»¶ããã³ä¸è¨ã®ç¡ä¿è¨¼è¦å®ãï¼ãã®ã¾ã¾ã®å½¢ã§ã½ã¼
+#       ã¹ã³ã¼ãä¸­ã«å«ã¾ãã¦ãããã¨ï¼
+#   (2) æ¬ã½ããã¦ã§ã¢ãï¼ã©ã¤ãã©ãªå½¢å¼ãªã©ï¼ä»ã®ã½ããã¦ã§ã¢éçºã«ä½¿
+#       ç¨ã§ããå½¢ã§åé
+å¸ããå ´åã«ã¯ï¼åé
+å¸ã«ä¼´ããã­ã¥ã¡ã³ãï¼å©ç¨
+#       è
+ããã¥ã¢ã«ãªã©ï¼ã«ï¼ä¸è¨ã®èä½æ¨©è¡¨ç¤ºï¼ãã®å©ç¨æ¡ä»¶ããã³ä¸è¨
+#       ã®ç¡ä¿è¨¼è¦å®ãæ²è¼ãããã¨ï¼
+#   (3) æ¬ã½ããã¦ã§ã¢ãï¼æ©å¨ã«çµã¿è¾¼ããªã©ï¼ä»ã®ã½ããã¦ã§ã¢éçºã«ä½¿
+#       ç¨ã§ããªãå½¢ã§åé
+å¸ããå ´åã«ã¯ï¼æ¬¡ã®ããããã®æ¡ä»¶ãæºããã
+#       ã¨ï¼
+#     (a) åé
+å¸ã«ä¼´ããã­ã¥ã¡ã³ãï¼å©ç¨è
+ããã¥ã¢ã«ãªã©ï¼ã«ï¼ä¸è¨ã®è
+#         ä½æ¨©è¡¨ç¤ºï¼ãã®å©ç¨æ¡ä»¶ããã³ä¸è¨ã®ç¡ä¿è¨¼è¦å®ãæ²è¼ãããã¨ï¼
+#     (b) åé
+å¸ã®å½¢æ
+ãï¼å¥ã«å®ããæ¹æ³ã«ãã£ã¦ï¼TOPPERSãã­ã¸ã§ã¯ãã«
+#         å ±åãããã¨ï¼
+#   (4) æ¬ã½ããã¦ã§ã¢ã®å©ç¨ã«ããç´æ¥çã¾ãã¯éæ¥çã«çãããããªãæ
+#       å®³ãããï¼ä¸è¨èä½æ¨©è
+ããã³TOPPERSãã­ã¸ã§ã¯ããå
+è²¬ãããã¨ï¼
+#       ã¾ãï¼æ¬ã½ããã¦ã§ã¢ã®ã¦ã¼ã¶ã¾ãã¯ã¨ã³ãã¦ã¼ã¶ããã®ãããªãç
+#       ç±ã«åºã¥ãè«æ±ãããï¼ä¸è¨èä½æ¨©è
+ããã³TOPPERSãã­ã¸ã§ã¯ãã
+#       å
+è²¬ãããã¨ï¼
+#  
+#   æ¬ã½ããã¦ã§ã¢ã¯ï¼ç¡ä¿è¨¼ã§æä¾ããã¦ãããã®ã§ããï¼ä¸è¨èä½æ¨©è
+ã
+#   ãã³TOPPERSãã­ã¸ã§ã¯ãã¯ï¼æ¬ã½ããã¦ã§ã¢ã«é¢ãã¦ï¼ç¹å®ã®ä½¿ç¨ç®ç
+#   ã«å¯¾ããé©åæ§ãå«ãã¦ï¼ãããªãä¿è¨¼ãè¡ããªãï¼ã¾ãï¼æ¬ã½ããã¦ã§
+#   ã¢ã®å©ç¨ã«ããç´æ¥çã¾ãã¯éæ¥çã«çãããããªãæå®³ã«é¢ãã¦ãï¼ã
+#   ã®è²¬ä»»ãè² ããªãï¼
+#  
+#   $Id$
+#++
+
+#== celltype ãã©ã°ã¤ã³ã®å
+±éã®è¦ªã¯ã©ã¹
+module MrubyBridgeCelltypePluginModule
+
+  # ãã©ã°ã¤ã³å¼æ°å => Proc
+  MrubyBridgePluginArgProc = { 
+      "ignoreUnsigned" => Proc.new { |obj,rhs| obj.set_ignoreUnsigned rhs },
+      "include_inner_cell" => Proc.new { |obj,rhs| obj.set_include_inner_cell rhs },
+      "exclude_cell" => Proc.new { |obj,rhs| obj.set_exclude_cell rhs },
+      "exclude_port" => Proc.new { |obj,rhs| obj.set_exclude_port rhs },
+      "exclude_port_func" => Proc.new { |obj,rhs| obj.set_exclude_port_func rhs },
+      "auto_exclude" => Proc.new { |obj,rhs| obj.set_auto_exclude rhs },
+  }
+
+  require_tecsgen_lib( "MrubyBridgeCellPlugin.rb" )
+  @@plugin_list = []
+  @@count = 1
+
+  #celltype::     Celltype        ã»ã«ã¿ã¤ãï¼ã¤ã³ã¹ã¿ã³ã¹ï¼
+  def initialize( celltype, option )
+    dbgPrint "#{self.class.name}: initialzie: #{celltype.get_name}\n"
+
+    super
+    @celltype = celltype
+    @cell_list = []
+    @include_inner_cell = false
+    @exclude_cells = []
+    @exclude_port = []
+    @exclude_port_func = {}
+    @b_ignoreUnsigned = false
+    @b_auto_exclude = true     # auto_exclude = true by default 
+    @@plugin_list << self
+
+    @plugin_arg_check_proc_tab = MrubyBridgePluginArgProc
+    @plugin_arg_str = CDLString.remove_dquote option
+    parse_plugin_arg
+
+    MrubyBridgeCellPlugin.set_gen_post_code_by_dependent
+  end
+
+  #=== æ°ããã»ã«
+  #cell::        Cell            ã»ã«
+  #
+  # celltype ãã©ã°ã¤ã³ãæå®ãããã»ã«ã¿ã¤ãã®ã»ã«ãçæããã
+  # ã»ã«ã¿ã¤ããã©ã°ã¤ã³ã«å¯¾ããæ°ããã»ã«ã®å ±å
+  # generate æã«ããå¼ã³åºãããå ´åãããã¾ã§ã«å®ç¾©ããã cell ã«ã¤ãã¦ã¯ãinitialize ã®ã¿ã¤ãã³ã°ã§å¼ã³åºããã
+  def new_cell( cell )
+    dbgPrint "MrubyBridgeCelltypePluginModule: new_cell: #{cell.get_name}\n"
+
+    return if @cell_list.include? cell   # ãã®è¡ã¯ãæ¬æ¥ä¸è¦ã®ã¯ã
+    if TECSGEN.post_coded?               # post_code ä»¥éã®ã»ã«ã¯å¯¾è±¡ããå¤ã
+      cdl_info( "I9999 MrubyBridgeCelltypePlugin: $1 is excluded because cell generated after post_coded", cell.get_name )
+      return
+    end
+
+    # include_inner_cell option
+    if cell.is_cloned? && @include_inner_cell == false then
+    #   p "#{cell.get_name} excluded"
+      cdl_info( "I9999 MrubyBridgeCelltypePlugin: inner cell $1 is excluded", cell.get_name )
+      return
+    # else
+    #   p "#{cell.get_name} included"
+    end
+
+    # exclude_cell option
+    if @exclude_cells.include?( cell.get_name ) then
+      return
+    end
+
+    opt_str = "ignoreUnsigned=#{@b_ignoreUnsigned}, auto_exclude=#{@b_auto_exclude}"
+    @exclude_port.each{ |port|
+      opt_str += ",exclude_port=#{port}"
+    }
+    @exclude_port_func.each{ |port, funcs|
+      funcs.each{ |func|
+        opt_str += ",exclude_port_func=#{port}.#{func}"
+      }
+    }
+
+    # p "MrubyBridgeCelltypePlugin: opt_str=#{opt_str}"
+
+    fn2 = "#{$gen}/tmp_MrubyBridgeCelltypePluginModule_#{@celltype.get_name}_#{@@count}.cdl"
+    f2 = File.open( fn2, "w" )
+    f2.print <<EOT
+/* MrubyBridgeCelltypePluginModule: celltype=#{@celltype.get_name} */
+generate( MrubyBridgeCellPlugin, #{cell.get_namespace_path}, "#{opt_str}" );
+EOT
+    f2.close
+    dbgPrint "MrubyBridgeCelltypePluginModule new_cell: Import #{fn2}\n"
+    Import.new "#{fn2}"
+    @@count += 1
+  end
+
+### æå³è§£ææ®µéã§å¼ã³åºãããã¡ã½ãã ###
+  #===  CDL ãã¡ã¤ã«ã®çæ
+  #      typedef, signature, celltype, cell ã®ã³ã¼ããçæ
+  #      éè¤ãã¦çæãã¦ã¯ãªããªã
+  #      ãã§ã«çæããã¦ããå ´åã¯åºåããªããã¨ã
+  #      ãããã¯ååã® import ã«ãããéè¤ãé¿ãããã¨ã
+  #file::        FILE       çæãããã¡ã¤ã«
+  def gen_cdl_file file
+#   ãã®æ®µéã§å¼ã³ã ãã¨ generate æãå¼ã³åºãããåã®ã»ã«ã®ã¿ã®åºåã¨ãªã
+    
+#    dbgPrint "MrubyBridgeCelltypePlugin: gen_cdl_file: #{@celltype.get_name}\n"
+#    file.print <<EOT
+#/* MrubyBridgeCelltypePlugin: celltype=#{@celltype.get_name}
+# *
+# *    cell's generate before celltype's generate
+# */
+#
+#EOT
+#    @celltype.get_cell_list.each { |cell|
+#      @cell_list << cell
+#      # mikan option, region
+#      dbgPrint "MrubyBridgeCelltypePlugin: cell=#{cell.get_name}\n"
+#      file.print <<EOT
+#generate( MrubyBridgeCellPlugin, #{cell.get_namespace_path}, "" );
+#EOT
+#    }
+
+  end
+
+  #=== tCelltype_factory.h ã«æ¿å
+¥ããã³ã¼ããçæãã
+  # file ä»¥å¤ã®ä»ã®ãã¡ã¤ã«ã«ãã¡ã¯ããªã³ã¼ããçæãã¦ããã
+  # ã»ã«ã¿ã¤ããã©ã°ã¤ã³ãæå®ãããã»ã«ã¿ã¤ãã®ã¿å¼ã³åºããã
+  def gen_factory file
+  end
+
+  def get_celltype
+    @celltype
+  end
+
+  @@b_gen_post_code_called = false
+  #=== å¾ãã® CDL ã³ã¼ããçæ
+  #ãã©ã°ã¤ã³ã®å¾ãã® CDL ã³ã¼ããçæ
+  #file:: File: 
+  def self.gen_post_code( file )
+    dbgPrint "#{self.name}: gen_post_code_body\n"
+
+    if @@b_gen_post_code_called == false then
+      @@b_gen_post_code_called = true
+      MrubyBridgeCellPlugin.gen_post_code_body file
+    end
+
+#    ãã®æ®µéã§çæããã¨ãåããã¹ãã³ã¼ãã§åºåããã mruby ã®åæåã³ã¼ãã«åæ ãããªã
+    
+#    # MrubyBridgeCelltypePlugin ã®çæãã generate æã¯ã
+#    fn2 = "#{$gen}/tmp_MrubyBridgeCelltypePlugin_post.cdl"
+#    f2 = File.open( fn2, "w" )
+#    # è¤æ°ã®ãã©ã°ã¤ã³ã® post_code ãä¸ã¤ã®ãã¡ã¤ã«ã«å«ã¾ãããããä»¥ä¸ã®ãããªè¦åºããã¤ãããã¨
+#    dbgPrint "MrubyBridgeCelltypePlugin: gen_post_code\n"
+#    f2.print "/* '#{self.name}' post code */\n"
+#    @@plugin_list.each{ |plugin|
+#      plugin.get_celltype.get_cell_list.each{ |cell|
+#        # mikan option, region
+#        f2.print <<EOT
+#generate( MrubyBridgeCellPlugin, #{cell.get_namespace_path}, "" );
+#EOT
+#      }
+#    }
+#    f2.close
+#    p Import
+#    Import.new "#{fn2}"
+  end
+
+  #=== ãã©ã°ã¤ã³å¼æ° 
+
+  #=== ãã©ã°ã¤ã³å¼æ° ignoreUnsigned
+  def set_ignoreUnsigned rhs
+    if rhs == "true" || rhs == nil then
+      @b_ignoreUnsigned = true
+    end
+  end
+
+  def set_include_inner_cell rhs
+    if rhs == "true" || rhs == nil then
+      @include_inner_cell = true
+    end
+  end
+
+  def set_exclude_cell rhs
+    cells = rhs.split ','
+    cells.each{ |rhs_cell|
+      rhs_cell.gsub!( /\s/, "" )
+      @exclude_cells << rhs_cell.to_sym
+    }
+  end
+  def set_exclude_port rhs
+    ports = rhs.split ','
+    ct = @cell.get_celltype
+    return if ct == nil    # error case
+    ports.each{ |rhs_port|
+      obj = ct.find( rhs_port.to_sym )
+      if( ( ! obj.instance_of? Port ) || obj.get_port_type != :ENTRY ) then
+        cdl_error( "MRB9999 exclude_port '$1' not found or not entry in celltype '$2'", rhs_port, ct.get_name )
+      else
+        # print "MRBBridgeCellPlugin: exclude #{rhs_port}\n"
+        @exclude_port << rhs_port
+      end
+    }
+  end
+
+  #=== ãã©ã°ã¤ã³å¼æ° exclude_port_func
+  def set_exclude_port_func rhs
+    port_funcs = rhs.split ','
+    ct = @celltype
+    return if ct == nil    # error case
+    port_funcs.each{ |rhs_port_func|
+      port_func = rhs_port_func.split( '.' )
+      if port_func.length != 2 then
+        cdl_error( "MRB9999 exclude_port_func: '$1' not in 'port.func' form", rhs_port_func )
+      end
+      obj = ct.find( port_func[0].to_sym )
+      if( ( ! obj.instance_of? Port ) || obj.get_port_type != :ENTRY ) then
+        cdl_error( "MRB9999 exclude_port_func: port '$1' not found in celltype '$2'", rhs_port_func, ct.get_name )
+      else
+        signature = obj.get_signature
+        next if signature == nil     # error case
+        if signature.get_function_head port_func[1].to_sym
+          # print "MRBBridgeCellPlugin: #{port_func[0]}.#{port_func[1]} exclude\n"
+          if @exclude_port_func[ port_func[0] ] then
+            @exclude_port_func[ port_func[0] ] <<  port_func[1]
+          else
+            @exclude_port_func[ port_func[0] ] = [ port_func[1] ]
+          end
+        else
+          cdl_error( "MRB9999 include_port_func: func '$1' not found in port '$2' celltype $3",
+                     port_func[1], port_func[0], ct.get_name )
+        end
+      end
+    }
+  end
+
+  #=== ãã©ã°ã¤ã³å¼æ° auto_exclude
+  def set_auto_exclude rhs
+    # print "MrubyBridgeCellPlugin: auto_exclude=#{rhs}\n"
+    if rhs == "false" then
+      @b_auto_exclude = false
+    elsif rhs == "true" then
+      @b_auto_exclude = true     # auto_exclude = true by default 
+    else
+      cdl_warning( "MRB9999 auto_exclude: unknown rhs value ignored. specify true or false" )
+    end
+  end
+end
+
