Ignore:
Timestamp:
May 22, 2019, 10:03:37 PM (5 years ago)
Author:
coas-nagasima
Message:

ビルドが通るよう更新

File:
1 edited

Legend:

Unmodified
Added
Removed
  • azure_iot_hub/trunk/asp3_dcre/tecsgen/tecslib/plugin/lib/GenOpaqueMarshaler.rb

    • Property svn:mime-type changed from text/x-ruby to text/x-ruby;charset=UTF-8
    r388 r389  
    66#   Copyright (C) 2008-2018 by TOPPERS Project
    77#--
    8 #   ä¸Šè¨˜è‘—作権è€
    9 ã¯ï¼Œä»¥ä¸‹ã®(1)~(4)の条件を満たす場合に限り,本ソフトウェ
    10 #   ã‚¢ï¼ˆæœ¬ã‚½ãƒ•ãƒˆã‚¦ã‚§ã‚¢ã‚’改変したものを含む.以下同じ)を使用・複製・改
    11 #   å¤‰ãƒ»å†é
    12 å¸ƒï¼ˆä»¥ä¸‹ï¼Œåˆ©ç”¨ã¨å‘¼ã¶ï¼‰ã™ã‚‹ã“とを無償で許諾する.
    13 #   (1) 本ソフトウェアをソースコードの形で利用する場合には,上記の著作
    14 #       æ¨©è¡¨ç¤ºï¼Œã“の利用条件および下記の無保証規定が,そのままの形でソー
    15 #       ã‚¹ã‚³ãƒ¼ãƒ‰ä¸­ã«å«ã¾ã‚Œã¦ã„ること.
    16 #   (2) 本ソフトウェアを,ライブラリ形式など,他のソフトウェア開発に使
    17 #       ç”¨ã§ãã‚‹å½¢ã§å†é
    18 å¸ƒã™ã‚‹å ´åˆã«ã¯ï¼Œå†é
    19 å¸ƒã«ä¼´ã†ãƒ‰ã‚­ãƒ¥ãƒ¡ãƒ³ãƒˆï¼ˆåˆ©ç”¨
    20 #       è€
    21 ãƒžãƒ‹ãƒ¥ã‚¢ãƒ«ãªã©ï¼‰ã«ï¼Œä¸Šè¨˜ã®è‘—作権表示,この利用条件および下記
    22 #       ã®ç„¡ä¿è¨¼è¦å®šã‚’掲載すること.
    23 #   (3) 本ソフトウェアを,機器に組み込むなど,他のソフトウェア開発に使
    24 #       ç”¨ã§ããªã„形で再é
    25 å¸ƒã™ã‚‹å ´åˆã«ã¯ï¼Œæ¬¡ã®ã„ずれかの条件を満たすこ
    26 #       ã¨ï¼Ž
    27 #     (a) 再é
    28 å¸ƒã«ä¼´ã†ãƒ‰ã‚­ãƒ¥ãƒ¡ãƒ³ãƒˆï¼ˆåˆ©ç”¨è€
    29 ãƒžãƒ‹ãƒ¥ã‚¢ãƒ«ãªã©ï¼‰ã«ï¼Œä¸Šè¨˜ã®è‘—
    30 #         ä½œæ¨©è¡¨ç¤ºï¼Œã“の利用条件および下記の無保証規定を掲載すること.
    31 #     (b) 再é
    32 å¸ƒã®å½¢æ
    33 ‹ã‚’,別に定める方法によって,TOPPERSプロジェクトに
    34 #         å ±å‘Šã™ã‚‹ã“と.
    35 #   (4) 本ソフトウェアの利用により直接的または間接的に生じるいかなる損
    36 #       å®³ã‹ã‚‰ã‚‚,上記著作権è€
    37 ãŠã‚ˆã³TOPPERSプロジェクトをå
    38 è²¬ã™ã‚‹ã“と.
    39 #       ã¾ãŸï¼Œæœ¬ã‚½ãƒ•ãƒˆã‚¦ã‚§ã‚¢ã®ãƒ¦ãƒ¼ã‚¶ã¾ãŸã¯ã‚¨ãƒ³ãƒ‰ãƒ¦ãƒ¼ã‚¶ã‹ã‚‰ã®ã„かなる理
    40 #       ç”±ã«åŸºã¥ãè«‹æ±‚からも,上記著作権è€
    41 ãŠã‚ˆã³TOPPERSプロジェクトを
    42 #       å
    43 è²¬ã™ã‚‹ã“と.
     8#   上記著作権者は,以下の(1)~(4)の条件を満たす場合に限り,本ソフトウェ
     9#   ア(本ソフトウェアを改変したものを含む.以下同じ)を使用・複製・改
     10#   変・再配布(以下,利用と呼ぶ)することを無償で許諾する.
     11#   (1) 本ソフトウェアをソースコードの形で利用する場合には,上記の著作
     12#       権表示,この利用条件および下記の無保証規定が,そのままの形でソー
     13#       スコード中に含まれていること.
     14#   (2) 本ソフトウェアを,ライブラリ形式など,他のソフトウェア開発に使
     15#       用できる形で再配布する場合には,再配布に伴うドキュメント(利用
     16#       者マニュアルなど)に,上記の著作権表示,この利用条件および下記
     17#       の無保証規定を掲載すること.
     18#   (3) 本ソフトウェアを,機器に組み込むなど,他のソフトウェア開発に使
     19#       用できない形で再配布する場合には,次のいずれかの条件を満たすこ
     20#       と.
     21#     (a) 再配布に伴うドキュメント(利用者マニュアルなど)に,上記の著
     22#         作権表示,この利用条件および下記の無保証規定を掲載すること.
     23#     (b) 再配布の形態を,別に定める方法によって,TOPPERSプロジェクトに
     24#         報告すること.
     25#   (4) 本ソフトウェアの利用により直接的または間接的に生じるいかなる損
     26#       害からも,上記著作権者およびTOPPERSプロジェクトを免責すること.
     27#       また,本ソフトウェアのユーザまたはエンドユーザからのいかなる理
     28#       由に基づく請求からも,上記著作権者およびTOPPERSプロジェクトを
     29#       免責すること.
    4430
    45 #   æœ¬ã‚½ãƒ•ãƒˆã‚¦ã‚§ã‚¢ã¯ï¼Œç„¡ä¿è¨¼ã§æä¾›ã•ã‚Œã¦ã„るものである.上記著作権è€
    46 ãŠ
    47 #   ã‚ˆã³TOPPERSプロジェクトは,本ソフトウェアに関して,特定の使用目的
    48 #   ã«å¯¾ã™ã‚‹é©åˆæ€§ã‚‚含めて,いかなる保証も行わない.また,本ソフトウェ
    49 #   ã‚¢ã®åˆ©ç”¨ã«ã‚ˆã‚Šç›´æŽ¥çš„または間接的に生じたいかなる損害に関しても,そ
    50 #   ã®è²¬ä»»ã‚’負わない.
     31#   本ソフトウェアは,無保証で提供されているものである.上記著作権者お
     32#   よびTOPPERSプロジェクトは,本ソフトウェアに関して,特定の使用目的
     33#   に対する適合性も含めて,いかなる保証も行わない.また,本ソフトウェ
     34#   アの利用により直接的または間接的に生じたいかなる損害に関しても,そ
     35#   の責任を負わない.
    5136
    5237#   $Id$
     
    5439
    5540#== GenOpaqueMarshaler
    56 # OpaqueRPCPlugin, sharedOpaqueRPCPlugin å
    57 ±é€šã®è¦ç´ ã‚’集めたモジュール
     41# OpaqueRPCPlugin, sharedOpaqueRPCPlugin 共通の要素を集めたモジュール
    5842module GenOpaqueMarshaler
    5943
    60   # プラグイン引数名と Proc
     44  # プラグイン引数名と Proc
    6145  RPCPluginArgProc = {
    6246    "clientChannelCelltype" => Proc.new { |obj,rhs| obj.set_clientChannelCelltype rhs },
     
    7963  }
    8064
    81   ##### プラグイン引数チェック関数
    82 
    83   #=== プラグイン引数 taskPriority のチェック
     65  ##### プラグイン引数チェック関数
     66
     67  #=== プラグイン引数 taskPriority のチェック
    8468  def set_taskPriority( rhs )
    8569    @taskPriority = rhs
    8670  end
    8771
    88   #=== プラグイン引数 serverChannelCelltype のチェック
     72  #=== プラグイン引数 serverChannelCelltype のチェック
    8973  def set_serverChannelCelltype( rhs )
    9074    @serverChannelCelltype = rhs.to_sym
     
    9882  end
    9983
    100   #=== プラグイン引数 clientChannelCelltype のチェック
     84  #=== プラグイン引数 clientChannelCelltype のチェック
    10185  def set_clientChannelCelltype( rhs )
    10286    @clientChannelCelltype = rhs.to_sym
     
    11094  end
    11195
    112   #=== プラグイン引数 serverChannelCell のチェック
     96  #=== プラグイン引数 serverChannelCell のチェック
    11397  def set_serverChannelCell( rhs )
    11498    @serverChannelCell = rhs.to_sym
    115     # ChannelCell はプラグインで生成されるため、ここではチェックできない
     99    # ChannelCell はプラグインで生成されるため、ここではチェックできない
    116100    # path = [ "::", @serverChannelCell ]
    117101    # obj = Namespace.find( path )
     
    121105  end
    122106
    123   #=== プラグイン引数 clientChannelCell のチェック
     107  #=== プラグイン引数 clientChannelCell のチェック
    124108  def set_clientChannelCell( rhs )
    125109    @clientChannelCell = rhs.to_sym
    126     # ChannelCell はプラグインで生成されるため、ここではチェックできない
     110    # ChannelCell はプラグインで生成されるため、ここではチェックできない
    127111    # path = [ "::", @clientChannelCell ]
    128112    # obj = Namespace.find( path )
     
    132116  end
    133117
    134   #=== プラグイン引数 serverChannelInitializer のチェック
     118  #=== プラグイン引数 serverChannelInitializer のチェック
    135119  def set_serverChannelInitializer( rhs )
    136120    @serverChannelInitializer = rhs.to_sym
    137121  end
    138122
    139   #=== プラグイン引数 clientChannelInitializer のチェック
     123  #=== プラグイン引数 clientChannelInitializer のチェック
    140124  def set_clientChannelInitializer( rhs )
    141125    @clientChannelInitializer = rhs.to_sym
    142126  end
    143127
    144   #=== タスクタイプ taskCellype のチェック
     128  #=== タスクタイプ taskCellype のチェック
    145129  def set_taskCelltype( rhs )
    146130    @taskCelltype = rhs.to_sym
     
    154138  end
    155139
    156   #=== タスクタイプ stack\size のチェック
     140  #=== タスクタイプ stack\size のチェック
    157141  def set_stackSize( rhs )
    158142    @stackSize = rhs
    159143  end
    160144
    161   #=== プラグイン引数 PPAllocatorSize のチェック
     145  #=== プラグイン引数 PPAllocatorSize のチェック
    162146  def set_PPAllocatorSize( rhs )
    163147    @PPAllocatorSize = rhs
    164148  end
    165149
    166   #=== プラグイン引数 TDRCelltype のチェック
     150  #=== プラグイン引数 TDRCelltype のチェック
    167151  def set_TDRCelltype( rhs )
    168152    @TDRCelltype = rhs.to_sym
     
    176160  end
    177161
    178   #=== プラグイン引数 substituteAllocator のチェック
    179   # オプション引数が、以下の形式であることをチェック
     162  #=== プラグイン引数 substituteAllocator のチェック
     163  # オプション引数が、以下の形式であることをチェック
    180164  #     substituteAllocator(Alloc.eAlloc=>Subst.eAlloc,Alloc2.eAlloc=>Subst2.eAlloc)
    181165  def set_substituteAllocator( rhs )
    182     #str::String : 破壊される(マッチした残りになる)。str.empty? で空になったことをチェックできる
    183     #regexp::Regexp : 期å¾
    184 ã™ã‚‹ãƒˆãƒ¼ã‚¯ãƒ³ã«ãƒžãƒƒãƒã™ã‚‹æ­£è¦è¡¨ç¾ã€‚ "\A" 出始める
    185     #expected::String: 期å¾
    186 ã™ã‚‹ãƒˆãƒ¼ã‚¯ãƒ³ã€regexp が出現しなかった場合にエラーメッセージとして表示
     166    #str::String : 破壊される(マッチした残りになる)。str.empty? で空になったことをチェックできる
     167    #regexp::Regexp : 期待するトークンにマッチする正規表現。 "\A" 出始める
     168    #expected::String: 期待するトークン、regexp が出現しなかった場合にエラーメッセージとして表示
    187169    def optparse (str,regexp,expected)
    188170      str.strip!
     
    198180    ident_rexpr = /\A(\w[\w\d]*)/
    199181
    200     # "Alloc.eAlloc=>CAlloc.eAlloc" の形式になっていることをチェック
     182    # "Alloc.eAlloc=>CAlloc.eAlloc" の形式になっていることをチェック
    201183    while true
    202184      lhs_alloc_cell = optparse( opt, ident_rexpr, "allocator cell name" )
     
    221203      break if ! rhs_alloc_ent
    222204
    223 #  ここでは、右辺のチェックはできない。右辺のセルは前方参ç
    224 §ã¨ãªã‚‹
     205#  ここでは、右辺のチェックはできない。右辺のセルは前方参照となる
    225206#      path = [ "::", rhs_alloc_cell.to_sym ]   # mikan namespace
    226207#      obj = Namespace.find( path )
     
    229210#      else
    230211#        ct = obj.get_celltype
    231 #        if ct #  nil なら既にエラー
     212#        if ct #  nil なら既にエラー
    232213#          ent = ct.find rhs_alloc_ent
    233214#          if ! ent.instance_of? Port || ent.get_port_type != :ENTRY || ent.get_signature == nil || ! ent.get_signature.is_allocator?
     
    250231  end
    251232
    252   #=== プラグイン引数 noServerChannelOpenerCode のチェック
     233  #=== プラグイン引数 noServerChannelOpenerCode のチェック
    253234  def set_noServerChannelOpenerCode( rhs )
    254235    rhs = rhs.to_sym
     
    262243  end
    263244
    264   #=== プラグイン引数 clientSemaphoreCelltype のチェック
     245  #=== プラグイン引数 clientSemaphoreCelltype のチェック
    265246  def set_clientSemaphoreCelltype rhs
    266247    @semaphoreCelltype = rhs.to_sym
     
    272253  end
    273254
    274   #=== プラグイン引数 clientSemaphoreInitializer のチェック
     255  #=== プラグイン引数 clientSemaphoreInitializer のチェック
    275256  def set_clientSemaphoreInitializer rhs
    276257    @semaphoreInitializer = rhs.to_sym
    277258  end
    278259
    279   #=== プラグイン引数 clientErrorHandler のチェック
     260  #=== プラグイン引数 clientErrorHandler のチェック
    280261  def set_clientErrorHandler rhs
    281262    @clientErrorHandler = rhs.to_sym
    282263  end
    283264
    284   #=== プラグイン引数 serverErrorHandler のチェック
     265  #=== プラグイン引数 serverErrorHandler のチェック
    285266  def set_serverErrorHandler rhs
    286267    @serverErrorHandler = rhs.to_sym
     
    288269
    289270
    290   #===  セルの名前を得る
    291   # ThroughPlugin::get_cell_name plugin.rb をオーバーライド
     271  #===  セルの名前を得る
     272  # ThroughPlugin::get_cell_name plugin.rb をオーバーライド
    292273  def get_cell_name
    293274    @cell_name
     
    295276  end
    296277
    297   #=== marshaler のセルタイプ名を設定する
     278  #=== marshaler のセルタイプ名を設定する
    298279  def initialize_opaque_marshaler
    299280
    300     # オプション設定される変数のデフォルトを設定
     281    # オプション設定される変数のデフォルトを設定
    301282    @taskPriority = 11
    302283    @stackSize  = 4096
     
    309290    @taskCelltype = :"tTask"
    310291    @PPAllocatorSize = nil
    311     # @TDRCelltype  = :"tTDR"   # "tNBOTDR" に変更の予定
     292    # @TDRCelltype  = :"tTDR"   # "tNBOTDR" に変更の予定
    312293    @TDRCelltype  = :"tNBOTDR"
    313294    @substituteAllocator = {}
     
    324305    @marshaler_celltype_file_name = "#{$gen}/#{@marshaler_celltype_name}.cdl"
    325306
    326     # signature で対応できないものをチェック
     307    # signature で対応できないものをチェック
    327308    @signature.each_param{ |func_decl, param_decl|
    328309      if param_decl.get_direction == :OUT then
     
    337318  end
    338319
    339   #=== GenOpaqueMarshaler# Opener Code の生成時のチェック
     320  #=== GenOpaqueMarshaler# Opener Code の生成時のチェック
    340321  def check_opener_code
    341     # サーバーチャンネルセルタイプが entry sServerChannelOpener eOpener を持つかどうかをチェック
    342     # mikan entry か (call でないか) をチェックしていない
     322    # サーバーチャンネルセルタイプが entry sServerChannelOpener eOpener を持つかどうかをチェック
     323    # mikan entry か (call でないか) をチェックしていない
    343324    # scct = Namespace.find ["::", @serverChannelCelltype] # mikan namespace
    344325    nsp = NamespacePath.analyze( @serverChannelCelltype.to_s )
     
    360341  end
    361342
    362   #=== GenOpaqueMarshaler# PPAllocator のå¿
    363 è¦æ€§ã‚’チェックする
     343  #=== GenOpaqueMarshaler# PPAllocator の必要性をチェックする
    364344  def check_PPAllocator
    365345    if @signature.need_PPAllocator?(true) then
     
    374354  def gen_marshaler_celltype
    375355    f = CFile.open( @marshaler_celltype_file_name, "w" )
    376     # 同じå†
    377 å®¹ã‚’二度書く可能性あり (AppFile は不可)
     356    # 同じ内容を二度書く可能性あり (AppFile は不可)
    378357
    379358    if @PPAllocatorSize then
     
    404383  end
    405384
    406   #===  受け口関数の本体コードを生成(頭部と末尾は別途出力)
    407   #ct_name:: Symbol    (through プラグインで生成された) セルタイプ名 .Symbol として送られてくる(らしい)
     385  #===  受け口関数の本体コードを生成(頭部と末尾は別途出力)
     386  #ct_name:: Symbol    (through プラグインで生成された) セルタイプ名 .Symbol として送られてくる(らしい)
    408387  def gen_ep_func_body( file, b_singleton, ct_name, global_ct_name, sig_name, ep_name, func_name, func_global_name, func_type, params )
    409388
    410     # unmarshaler クラスか?
     389    # unmarshaler クラスか?
    411390    if ct_name == @unmarshaler_celltype_name.to_sym then
    412391      gen_ep_func_body_unmarshal( file, b_singleton, ct_name, global_ct_name, sig_name, ep_name, func_name, func_global_name, func_type, params )
     
    416395  end
    417396
    418   #===  marshal コードの生成
     397  #===  marshal コードの生成
    419398  def gen_ep_func_body_marshal( file, b_singleton, ct_name, global_ct_name, sig_name, ep_name, func_name, func_global_name, func_type, params )
    420399
     
    422401    b_ret_er = false
    423402
    424     # 関数の戻り値のå
    425 ƒã®åž‹ã‚’å¾—ã‚‹(typedef されている場合)
     403    # 関数の戻り値の元の型を得る(typedef されている場合)
    426404    type = func_type.get_type.get_original_type
    427405
    428     # 戻り値記憶用の変数を出力(void 型の関数では出力しない)
     406    # 戻り値記憶用の変数を出力(void 型の関数では出力しない)
    429407    if ! type.is_void? then
    430408      file.print( "\t#{func_type.get_type.get_type_str}\t\tretval_;\n" )
     
    439417    file.print( "\tint16_t\tstate_;\n" )
    440418
    441     # 関数 ID (整数値)
     419    # 関数 ID (整数値)
    442420    func_id = "FUNCID_#{@signature.get_global_name}_#{func_name}".upcase
    443421    fid = @signature.get_id_from_func_name( func_name )
    444422    file.print( "\tint16_t\tfunc_id_ = #{func_id};      /* (id of '#{func_name}') = #{fid}*/\n" )
    445423
    446     # シングルトンでないか?
     424    # シングルトンでないか?
    447425    if ! b_singleton then
    448426
    449       # singleton でなければ p_cellcb 取得コードを出力
     427      # singleton でなければ p_cellcb 取得コードを出力
    450428      file.print <<EOT
    451429        #{ct_name}_CB *p_cellcb;
     
    455433EOT
    456434
    457       # エラーを返すか?
     435      # エラーを返すか?
    458436      if b_ret_er then
    459437        file.print <<EOT
     
    465443        file.print <<EOT
    466444        }else{
    467                 /* エラー処理コードをここに記述 */
     445                /* エラー処理コードをここに記述 */
    468446        }
    469447
     
    481459    end
    482460
    483     # channel lock コード
     461    # channel lock コード
    484462    file.print <<EOT
    485463
     
    492470EOT
    493471
    494     # SOP を送信
    495     file.print "        /* SOPの送出 */\n"
     472    # SOP を送信
     473    file.print "        /* SOPの送出 */\n"
    496474    file.print "        SET_RPC_STATE( state_, RPCSTATE_CLIENT_SEND_SOP );\n"
    497475    file.print "        if( ( ercd_ = cTDR_sendSOP( true ) ) != E_OK )\n"
    498476    file.print "                goto error_reset;\n"
    499477
    500     # func_id を送信
    501     file.print "        /* 関数 id の送出 */\n"
     478    # func_id を送信
     479    file.print "        /* 関数 id の送出 */\n"
    502480    file.print "        if( ( ercd_ = cTDR_putInt16( func_id_ ) ) != E_OK )\n"
    503481    file.print "                goto error_reset;\n"
     
    506484    # p "#{ct_name}, #{sig_name}, #{func_name}, #{func_global_name}"
    507485
    508     b_get = false    # marshal なら put
     486    b_get = false    # marshal なら put
    509487    b_marshal = true  # marshal
    510488
    511     # in 方向のå
    512 ¥å‡ºåŠ›ã‚’出力
     489    # in 方向の入出力を出力
    513490    if func_type.has_inward? then
    514       file.print "      /* å
    515 ¥åŠ›å¼•æ•°é€å‡º */\n"
     491      file.print "      /* 入力引数送出 */\n"
    516492      file.print "      SET_RPC_STATE( state_, RPCSTATE_CLIENT_SEND_BODY );\n"
    517493      print_params( params, file, 1, b_marshal, b_get, true, "eClientEntry", func_name )
     
    525501      b_continue = "false"
    526502    end
    527     file.print "        /* EOPの送出(パケットの掃きだし) */\n"
     503    file.print "        /* EOPの送出(パケットの掃きだし) */\n"
    528504    file.print "        SET_RPC_STATE( state_, RPCSTATE_CLIENT_SEND_EOP );\n"
    529505    file.print "        if( (ercd_=cTDR_sendEOP(#{b_continue})) != E_OK )\n"
    530506    file.print "                goto error_reset;\n\n"
    531507
    532     # send のメモリをデアロケート
     508    # send のメモリをデアロケート
    533509    if func_type.has_send? then
    534510      file.print "      /* dealloc send parameter while executing */\n"
     
    541517    if ! func_type.is_oneway? then
    542518
    543       file.print "      /* パケットの始まりをチェック */\n"
     519      file.print "      /* パケットの始まりをチェック */\n"
    544520      file.print "      SET_RPC_STATE( state_, RPCSTATE_CLIENT_RECV_SOP );\n"
    545521      file.print "      if( (ercd_=cTDR_receiveSOP( true )) != E_OK )\n"
    546522      file.print "              goto error_reset;\n"
    547523
    548       b_get = true     # marshaler は get
    549       file.print "      /* 戻り値の受け取り */\n"
     524      b_get = true     # marshaler get
     525      file.print "      /* 戻り値の受け取り */\n"
    550526      print_param( "retval_", func_type.get_type, file, 1, :RETURN, nil, nil, b_marshal, b_get )
    551527
     
    559535        indent = "      " * indent_level
    560536
    561         file.print "#{indent}/* 出力値の受け取り */\n"
     537        file.print "#{indent}/* 出力値の受け取り */\n"
    562538        file.print "#{indent}SET_RPC_STATE( state_, RPCSTATE_CLIENT_RECV_BODY );\n"
    563539        print_params( params, file, indent_level, b_marshal, b_get, true, "eClientEntry", func_name )
     
    569545      end
    570546
    571       file.print "\n    /* パケットの終わりをチェック */\n"
     547      file.print "\n    /* パケットの終わりをチェック */\n"
    572548      file.print "      SET_RPC_STATE( state_, RPCSTATE_CLIENT_RECV_EOP );\n"
    573549      file.print "      if( (ercd_=cTDR_receiveEOP(false)) != E_OK )\n"  # b_continue = false
     
    576552    end # ! func_type.is_oneway?
    577553
    578     # channel lock コード
     554    # channel lock コード
    579555    file.print <<EOT
    580556        /* Channel Unlock */
     
    593569
    594570    if( b_void == false )then
    595       # 呼びå
    596 ƒã«æˆ»ã‚Šå€¤ã‚’リターン
     571      # 呼び元に戻り値をリターン
    597572      file.print( "     return retval_;\n" )
    598573    else
     
    604579error_reset:
    605580EOT
    606     # send のメモリをデアロケート
     581    # send のメモリをデアロケート
    607582    if func_type.has_send? then
    608583      file.print "      /* dealloc send parameter */\n"
     
    613588    end
    614589
    615     # receive のメモリをデアロケート
     590    # receive のメモリをデアロケート
    616591    if func_type.has_receive? then
    617592      file.print( "     /* receive parameter */\n" )
     
    625600EOT
    626601
    627     # channel lock コード
     602    # channel lock コード
    628603    file.print <<EOT
    629604        /* Channel Unlock */
     
    636611
    637612    if( b_ret_er != false )then
    638       # 呼びå
    639 ƒã«æˆ»ã‚Šå€¤ã‚’リターン
     613      # 呼び元に戻り値をリターン
    640614      file.print( "     return ERCD( E_RPC, MERCD( ercd_ ) );\n" )
    641615    else
     
    645619  end
    646620
    647   #===  unmarshal コードの生成
     621  #===  unmarshal コードの生成
    648622  def gen_ep_func_body_unmarshal( file, b_singleton, ct_name, global_ct_name, sig_name, ep_name, func_name, func_global_name, func_type, params )
    649623
    650624    b_ret_er = true
    651625
    652     # func_id を得るコードを生成
     626    # func_id を得るコードを生成
    653627    file.print <<EOT
    654628
     
    672646        file.print <<EOT
    673647        }else{
    674                 /* エラー処理コードをここに記述 */
     648                /* エラー処理コードをここに記述 */
    675649        }
    676650EOT
     
    683657#endif
    684658
    685         /* SOPのチェック */
     659        /* SOPのチェック */
    686660        SET_RPC_STATE( state_, RPCSTATE_SERVER_RECV_SOP );
    687661        if( (ercd_=cTDR_receiveSOP( false )) != E_OK )
    688662                goto error_reset;
    689         /* func_id の取得 */
     663        /* func_id の取得 */
    690664        if( (ercd_=cTDR_getInt16( &func_id_ )) != E_OK )
    691665                goto error_reset;
     
    697671EOT
    698672
    699     # signature に含まれる すべての関数について
     673    # signature に含まれる すべての関数について
    700674    @signature.get_function_head_array.each { |f|
    701675      f_name = f.get_name
     
    711685
    712686    if @PPAllocatorSize then
    713       ppallocator_dealloc_str = "       /* PPAllocator のすべてを解放 */\n       cPPAllocator_dealloc_all();"
     687      ppallocator_dealloc_str = "       /* PPAllocator のすべてを解放 */\n     cPPAllocator_dealloc_all();"
    714688    else
    715689      ppallocator_dealloc_str = ""
     
    734708  end
    735709
    736   #=== PREAMBLE 部のコード生成
    737   # アンマーシャラセルタイプの場合、アンマーシャラ関数のプロトタイプ宣言を生成
     710  #=== PREAMBLE 部のコード生成
     711  # アンマーシャラセルタイプの場合、アンマーシャラ関数のプロトタイプ宣言を生成
    738712  def gen_preamble file, b_singleton, ct_name, global_name
    739713    if ct_name != @unmarshaler_celltype_name.to_sym then
     
    741715    end
    742716
    743     # string.h の include (memset, strlen のため)
     717    # string.h の include (memset, strlen のため)
    744718    file.print "/* header file (strlen, memset) */\n"
    745719    file.print "#include\t<string.h>\n\n"
    746720
    747     file.print "/* アンマーシャラ関数のプロトタイプ宣言 */\n"
    748     # signature に含まれる すべての関数について
     721    file.print "/* アンマーシャラ関数のプロトタイプ宣言 */\n"
     722    # signature に含まれる すべての関数について
    749723    @signature.get_function_head_array.each { |f|
    750724      f_name = f.get_name
     
    756730  end
    757731
    758   #=== POSTAMBLE 部のコード生成
    759   # アンマーシャラセルタイプの場合、個ã€
    760 ã®ã‚¢ãƒ³ãƒžãƒ¼ã‚·ãƒ£ãƒ©é–¢æ•°ã®ç”Ÿæˆ
     732  #=== POSTAMBLE 部のコード生成
     733  # アンマーシャラセルタイプの場合、個々のアンマーシャラ関数の生成
    761734  def gen_postamble file, b_singleton, ct_name, global_name
    762735    if ct_name != @unmarshaler_celltype_name.to_sym then
     
    764737    end
    765738
    766     file.print "\n/*** アンマーシャラ関数 ***/\n\n"
     739    file.print "\n/*** アンマーシャラ関数 ***/\n\n"
    767740    @signature.get_function_head_array.each { |f|
    768741      f_name = f.get_name
     
    770743      id = @signature.get_id_from_func_name( f_name )
    771744
    772       # 関数は返り値を持つか?
     745      # 関数は返り値を持つか?
    773746      b_ret_er = false
    774747      init_retval = ""
     
    794767      file.print "      ER      ercd_;\n"
    795768
    796       # 引数を受取る変数の定義
     769      # 引数を受取る変数の定義
    797770      params = f.get_declarator.get_type.get_paramlist.get_items
    798771           # FuncHead->  Decl->    FuncType->ParamList
     
    803776        dir = par.get_direction
    804777        if( dir == :RECEIVE )then
    805           # type は PtrType で、それを取り除いた型
     778          # type は PtrType で、それを取り除いた型
    806779          type = type.get_type
    807780        end
     
    821794        end
    822795
    823         type_str = type.get_type_str.gsub( /\bconst\b */, "" ) # "const" を外す
     796        type_str = type.get_type_str.gsub( /\bconst\b */, "" ) # "const" を外す
    824797        file.printf( "  %-12s %s%s%s%s%s;\n", type_str, aster, name, aster2, type.get_type_str_post, init )
    825798
     
    833806      end
    834807
    835       # in 方向のå
    836 ¥å‡ºåŠ›ã‚’å
    837 ¥åŠ›
    838       file.print "\n    /* å
    839 ¥åŠ›å¼•æ•°å—取 */\n"
     808      # in 方向の入出力を入力
     809      file.print "\n    /* 入力引数受取 */\n"
    840810      file.print "      SET_RPC_STATE( *state_, RPCSTATE_SERVER_RECV_BODY );\n"
    841       b_get = true    # unmarshal では get
     811      b_get = true    # unmarshal では get
    842812      b_marshal  = false
    843813      print_params( params, file, 1, b_marshal, b_get, true, "cServerCall", f_name )
     
    846816
    847817
    848       # パケットの受信完了
    849       file.print "      /* パケット終わりをチェック */\n"
     818      # パケットの受信完了
     819      file.print "      /* パケット終わりをチェック */\n"
    850820      file.print "      SET_RPC_STATE( *state_, RPCSTATE_SERVER_RECV_EOP );\n"
    851821      if ! f_type.is_oneway? then
     
    857827      file.print "              goto error_reset;\n\n"
    858828
    859       # out のメモリをアロケート
     829      # out のメモリをアロケート
    860830      dir = :OUT; alloc_cp = "cPPAllocator_alloc"; alloc_cp_extra = nil; nest = 1
    861831      alloc_for_out_params( params, file, nest, dir, alloc_cp, alloc_cp_extra )
    862832
    863       # 対象関数を呼出す
    864       file.print "      /* 対象関数の呼出し */\n"
     833      # 対象関数を呼出す
     834      file.print "      /* 対象関数の呼出し */\n"
    865835      file.print "      SET_RPC_STATE( *state_, RPCSTATE_SERVER_EXEC );\n"
    866836      if b_void then
     
    881851      file.print( " );\n" )
    882852
    883       # 戻り値、出力引数の受取コードの生成
    884 
    885       # oneway の場合出力、戻り値が無く、受取をå¾
    886 ãŸãªã„(非同期な呼出し)
     853      # 戻り値、出力引数の受取コードの生成
     854
     855      # oneway の場合出力、戻り値が無く、受取を待たない(非同期な呼出し)
    887856      if ! f.is_oneway? then
    888857
    889         file.print "\n  /* SOPの送出 */\n"
     858        file.print "\n  /* SOPの送出 */\n"
    890859        file.print "    SET_RPC_STATE( *state_, RPCSTATE_SERVER_SEND_SOP );\n"
    891860
     
    893862        file.print "            goto error_reset;\n"
    894863
    895         b_get = false     # unmarshaler は put
     864        b_get = false     # unmarshaler put
    896865        if( ! b_void )then
    897           file.print "  /* 戻り値の送出 */\n"
     866          file.print "  /* 戻り値の送出 */\n"
    898867          print_param( "retval_", f_type.get_type, file, 1, :RETURN, nil, nil, b_marshal, b_get )
    899868        end
     
    908877          indent = "    " * indent_level
    909878
    910           file.print "#{indent}/* 出力値の送出 */\n"
     879          file.print "#{indent}/* 出力値の送出 */\n"
    911880          file.print "#{indent}SET_RPC_STATE( *state_, RPCSTATE_SERVER_SEND_BODY );\n"
    912881          print_params( params, file, indent_level, b_marshal, b_get, true, "cServerCall", f_name )
    913882          print_params( params, file, indent_level, b_marshal, b_get, false, "cServerCall", f_name )
    914883
    915           # receive のメモリをデアロケート
     884          # receive のメモリをデアロケート
    916885          if f_type.has_receive? then
    917886            file.print "#{indent}/* dealloc receive parameter */\n"
     
    925894        end
    926895
    927         file.print "    /* パケットの終わり(掃きだし) */\n"
     896        file.print "    /* パケットの終わり(掃きだし) */\n"
    928897        file.print "    SET_RPC_STATE( *state_, RPCSTATE_SERVER_SEND_EOP );\n"
    929898        file.print "    if( (ercd_=cTDR_sendEOP(false)) != E_OK )\n"  # b_continue = false
     
    936905error_reset:
    937906EOT
    938       # send のリセット用デアロケート
     907      # send のリセット用デアロケート
    939908      if f_type.has_send? then
    940909        file.print "    /* dealloc send parameter */\n"
     
    945914      end
    946915
    947       # receive のメモリをデアロケート
     916      # receive のメモリをデアロケート
    948917      if f_type.has_receive? && b_ret_er then
    949918        file.print "    /* dealloc receive parameter */\n"
     
    957926      file.print "}\n\n"
    958927
    959       # ここ(個ã€
    960 ã®é–¢æ•°ï¼‰ã§ã¯ã‚¨ãƒ©ãƒ¼ãƒãƒ³ãƒ‰ãƒ©ãƒ¼ã¯å‘¼ã³å‡ºã•ãªã„。呼びå
    961 ƒï¼ˆã‚µãƒ¼ãƒãƒ¼ã®ãƒ¡ã‚¤ãƒ³é–¢æ•°ï¼‰ã§å‘¼ã³å‡ºã™ã€‚
     928      # ここ(個々の関数)ではエラーハンドラーは呼び出さない。呼び元(サーバーのメイン関数)で呼び出す。
    962929    }
    963930  end
     
    966933  #b_marshal:: bool
    967934  #b_get:: bool
    968   #  b_marshal = true  && b_get == false   :  マーシャラでå
    969 ¥åŠ›å¼•æ•°é€å‡º
    970   #  b_marshal = true  && b_get == true    :  マーシャラで出力引数受取
    971   #  b_marshal = false && b_get == false   :  アンマーシャラでå
    972 ¥åŠ›å¼•æ•°å—取
    973   #  b_marshal = false && b_get == true    :  アンマーシャラで出力引数送出
    974   #b_referenced:: size_is, count_is, string で参ç
    975 §ã•ã‚Œã¦ã„るものを出力
     935  #  b_marshal = true  && b_get == false   :  マーシャラで入力引数送出
     936  #  b_marshal = true  && b_get == true    :  マーシャラで出力引数受取
     937  #  b_marshal = false && b_get == false   :  アンマーシャラで入力引数受取
     938  #  b_marshal = false && b_get == true    :  アンマーシャラで出力引数送出
     939  #b_referenced:: size_is, count_is, string で参照されているものを出力
    976940  def print_params( params, file, nest, b_marshal, b_get, b_referenced, port_name, func_name )
    977941    params.each{ |param|
     
    996960        case dir
    997961        when :OUT, :INOUT
    998           alloc_cp = nil        # inout の b_get==true&&b_marsha==true のときアロケータコードは不用
     962          alloc_cp = nil        # inout の b_get==true&&b_marsha==true のときアロケータコードは不用
    999963          alloc_cp_extra = nil
    1000964          print_param( param.get_name, param.get_type, file, nest, dir, nil, nil, b_marshal, b_get, alloc_cp, alloc_cp_extra )
     
    1003967          alloc_cp_extra = nil
    1004968          if b_get then
    1005             outer = "(*"         # マーシャラ側では、ポインタが (send と比べ) 一つ多い
     969            outer = "(*"         # マーシャラ側では、ポインタが (send と比べ) 一つ多い
    1006970            outer2 = ")"
    1007971          else
    1008             outer = nil          # アンマーシャラ側では、ポインタが一つ外されている
     972            outer = nil          # アンマーシャラ側では、ポインタが一つ外されている
    1009973            outer2 = nil
    1010974          end
     
    1016980  end
    1017981
    1018   #=== アロケータコードを生成 (out のアンマーシャラ用)
     982  #=== アロケータコードを生成 (out のアンマーシャラ用)
    1019983  def alloc_for_out_params( params, file, nest, dir, alloc_cp, alloc_cp_extra )
    1020984    params.each{ |param|
     
    1026990  end
    1027991
    1028   #=== アロケータコードを生成 (out のアンマーシャラ用個別パラメータの生成)
     992  #=== アロケータコードを生成 (out のアンマーシャラ用個別パラメータの生成)
    1029993  def alloc_for_out_param( name, type, file, nest, outer, outer2, alloc_cp, alloc_cp_extra )
    1030994    org_type = type.get_original_type
     
    10391003      count = type.get_count; size = type.get_size; string = type.get_string
    10401004      if count || size || string then
    1041         loop_counter_type = IntType.new(16)   # mikan 方を size_is, count_is の引数の型とする
     1005        loop_counter_type = IntType.new(16)   # mikan 方を size_is, count_is の引数の型とする
    10421006        if count then
    10431007          len = type.get_count.to_s
     
    10521016        end
    10531017
    1054         # size_is に max 指定がある場合、length が max をè¶
    1055 ãˆã¦ã„るかチェックするコードを生成
     1018        # size_is に max 指定がある場合、length が max を超えているかチェックするコードを生成
    10561019        if org_type.get_max != nil && string == nil then
    10571020          file.print "#{indent}if( #{len} > #{type.get_max} ){\t/* GenOpaqueMarshaler max check 2 */\n"
     
    10921055  end
    10931056
    1094   #=== 引数の一括デアロケートコードの生成
    1095   # send:マーシャラの最後、receive:アンマーシャラの最後で一括して引数をデアロケートする
     1057  #=== 引数の一括デアロケートコードの生成
     1058  # send:マーシャラの最後、receive:アンマーシャラの最後で一括して引数をデアロケートする
    10961059  def dealloc_for_params( params, file, nest, dir, dealloc_cp, b_reset = false )
    10971060    if b_reset then
     
    11071070        aster = ""
    11081071        if dir == :RECEIVE then
    1109           type = type.get_type.get_original_type   # ポインタを一つ外す
     1072          type = type.get_type.get_original_type   # ポインタを一つ外す
    11101073          if b_reset then
    11111074            aster = "*"
     
    11281091  end
    11291092
    1130   #== out で nullable な引数のæƒ
    1131 å ±ã‚’渡す
    1132   # out nullable の場合、in, send, receive のように、値を渡す直前ではなく、呼出し時に渡す
     1093  #== out で nullable な引数の情報を渡す
     1094  # out nullable の場合、in, send, receive のように、値を渡す直前ではなく、呼出し時に渡す
    11331095  def  print_out_nullable( params, file, nest, b_marshal );
    11341096    indent = "\t" * nest
     
    11401102        file.print "#{indent}\tgoto error_reset;\n"
    11411103      else
    1142         # 呼びå
    1143 ˆã¯ alloc_for_out_param で nullable の対応する
     1104        # 呼び先は alloc_for_out_param で nullable の対応する
    11441105        file.print "#{indent}if( (ercd_=cTDR_getInt8( &b_#{param.get_name}_null_)) != E_OK )\n"
    11451106        file.print "#{indent}\tgoto error_reset;\n"
Note: See TracChangeset for help on using the changeset viewer.