Module: GenTransparentMarshaler

Included in:
HRP2RPCPlugin, RPCPlugin, SharedRPCPlugin
Defined in:
lib/tecsgen/plugin/lib/GenHRP2Marshaler.rb,
lib/tecsgen/plugin/lib/GenTransparentMarshaler.rb

Overview

プラグインオプション用変数

@task_priority

Integer

@channelCelltype

String

@channelCellName

String

@PPAllocatorSize

Integer

Constant Summary collapse

RPCPluginArgProc =

プラグイン引数名と Proc

{
  "taskPriority"    => Proc.new {|obj, rhs| obj.set_taskPriority rhs },
  "channelCelltype" => Proc.new {|obj, rhs| obj.set_channelCelltype rhs },
  "TDRCelltype"     => Proc.new {|obj, rhs| obj.set_TDRCelltype rhs },
  "channelCell"     => Proc.new {|obj, rhs| obj.set_channelCellName rhs },
  "PPAllocatorSize" => Proc.new {|obj, rhs| obj.set_PPAllocatorSize rhs },
}

Instance Method Summary collapse

Instance Method Details

#gen_ep_func_body(file, b_singleton, ct_name, global_ct_name, sig_name, ep_name, func_name, func_global_name, func_type, params) ⇒ Object

受け口関数の本体コードを生成(頭部と末尾は別途出力)

ct_name

Symbol (through プラグインで生成された) セルタイプ名 .Symbol として送られてくる(らしい)



150
151
152
153
154
155
156
157
# File 'lib/tecsgen/plugin/lib/GenHRP2Marshaler.rb', line 150

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)
  # unmarshaler クラスか?
  if ct_name == @unmarshaler_celltype_name.to_sym
    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)
  else
    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)
  end
end

#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) ⇒ Object

marshal コードの生成



160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
# File 'lib/tecsgen/plugin/lib/GenHRP2Marshaler.rb', line 160

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)
  b_void = false
  b_ret_er = false

  # 関数の戻り値の元の型を得る(typedef されている場合)
  type = func_type.get_type.get_original_type

  # 戻り値記憶用の変数を出力(void 型の関数では出力しない)
  if !type.is_a?(VoidType)
    if func_type.get_type.is_a?(DefinedType) && (func_type.get_type.get_type_str == "ER" || func_type.get_type.get_type_str == "ER_INT")
      file.print("    #{func_type.get_type.get_type_str}  retval_ = E_OK;\n")
      b_ret_er = true
    else
      file.print("    #{func_type.get_type.get_type_str}  retval_;\n")
    end
  else
    b_void = true
  end

  file.print("    ER      ercd_;\n")
  file.print("    FLGPTN  flgptn;\n")

  # 呼び先の signature を取り出す
  signature = @signature

  # 関数 ID (整数値)
  func_id = signature.get_id_from_func_name(func_name)
  file.print("    int16_t  func_id_ = #{func_id};    /* id of #{func_name}: #{func_id} */\n")

  file.print("    uint8_t  msg[256];\n")

  # シングルトンでないか?
  if !b_singleton

    # singleton でなければ p_cellcb 取得コードを出力
    file.print <<EOT
  #{ct_name}_CB *p_cellcb;

  if( VALID_IDX( idx ) ){
      p_cellcb = GET_CELLCB(idx);
EOT

    # エラーを返すか?
    if b_ret_er
      file.print <<EOT
  }else{
       return ERCD( E_RPC, E_ID );
  }
EOT
    else
      file.print <<EOT
  }else{
      /* エラー処理コードをここに記述 */
  }
EOT
    end
  end

  # channel lock コード
  file.print <<EOT
  ///* Channel Lock */
  //if( is_cLockChannel_joined() )
  //  cLockChannel_wait();

EOT

=begin
  # SOP を送信
  file.print "    /* SOPの送出 */\n"
  file.print "    if( ( ercd_ = cTDR_sendSOP( true ) ) != E_OK )\n"
  file.print "      goto error_reset;\n"
=end

  # func_id を送信
  file.print "    /* 関数 id の送出 */\n"
=begin
  file.print "    if( ( ercd_ = cTDR_putInt16( func_id_ ) ) != E_OK )\n"
  file.print "        goto error_reset;\n"
=end
  file.print "    *((int16_t *)(&msg[0])) = func_id_;\n"

  # p "celltype_name, sig_name, func_name, func_global_name"
  # p "#{ct_name}, #{sig_name}, #{func_name}, #{func_global_name}"

  b_get = false # marshal なら put
  b_marshal = true # marshal

  # in 方向の入出力を出力
  @index = 2
  file.print "    /* 入力引数送出 */\n"
  print_params(params, file, 1, b_marshal, b_get, true, func_type.is_oneway?)
  print_params(params, file, 1, b_marshal, b_get, false, func_type.is_oneway?)
=begin
  if ! b_void && ! func_type.is_oneway? then
    ret_ptr_type = PtrType.new( func_type.get_type )
    print_param_nc( "retval_", ret_ptr_type, file, 1, :RETURN, "&", nil, b_get )
  end
=end

  file.print "    /* EOPの送出(パケットの掃きだし) */\n"
  if !func_type.is_oneway?
    b_continue = "true"
  else
    b_continue = "false"
  end
=begin
  file.print "    if( (ercd_=cTDR_sendEOP(#{b_continue})) != E_OK )\n"
  file.print "        goto error_reset;\n\n"
=end
  file.print "    if( (ercd_=cMessageBuffer_send(msg, #{@index})) != E_OK )\n"
  file.print "        goto error_reset;\n\n"

  file.print "        cSemaphore_signal();\n\n"

  if !func_type.is_oneway?
    file.print <<EOT
  if( (ercd_=cEventflag_wait( 0x01, TWF_ANDW, &flgptn )) != E_OK ){
    ercd_ = ERCD(E_RPC,ercd_);
    goto error_reset;
  }
  if( (ercd_=cEventflag_clear( 0x00 ) ) != E_OK ){
    ercd_ = ERCD(E_RPC,ercd_);
    goto error_reset;
  }
EOT
  end # ! func_type.is_oneway?

  file.print <<EOT
  ///* Channel Lock */
  //if( is_cLockChannel_joined() )
  //  cLockChannel_signal();
EOT

  if b_void == false
    # 呼び元に戻り値をリターン
    file.print("    cMessageBuffer_receive(&retval_);\n")
    file.print("    return retval_;\n")
  else
    file.print("    return;\n")
  end

  file.print <<EOT

error_reset:
#if 0
  if( ercd_ != ERCD( E_RPC, E_RESET ) )
      (void)cTDR_reset();
#endif
EOT

  # channel lock コード
  file.print <<EOT
  ///* Channel Lock */
  //if( is_cLockChannel_joined() )
  //  cLockChannel_signal();

EOT

  if b_ret_er != false
    # 呼び元に戻り値をリターン
    file.print("    return ercd_;\n")
  else
    file.print("    return;\n")
  end
end

#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) ⇒ Object

unmarshal コードの生成



327
328
329
330
331
332
333
334
335
336
337
338
339
340
341
342
343
344
345
346
347
348
349
350
351
352
353
354
355
356
357
358
359
360
361
362
363
364
365
366
367
368
369
370
371
372
373
374
375
376
377
378
379
380
381
382
383
384
385
386
387
388
389
390
391
392
393
394
395
396
397
398
399
400
401
402
403
404
405
406
407
408
409
410
411
412
413
414
415
416
417
418
419
420
421
422
423
424
425
426
427
428
429
430
431
432
# File 'lib/tecsgen/plugin/lib/GenHRP2Marshaler.rb', line 327

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)
#    b_ret_er = true
  b_ret_er = false

  # func_id を得るコードを生成
  file.print <<EOT

  int16_t   func_id_;
  ER        ercd_;

  #{ct_name}_CB *p_cellcb;

  if( VALID_IDX( idx ) ){
      p_cellcb = GET_CELLCB(idx);
EOT

  if b_ret_er
    file.print <<EOT
  }else{
      return ERCD( E_RPC, E_ID );
  }
EOT
  else
    file.print <<EOT
  }else{
      /* エラー処理コードをここに記述 */
  }
EOT
  end

  file.print <<EOT

  cSemaphore_wait();

#if 0
  /* SOPのチェック */
  if( (ercd_=cTDR_receiveSOP( false )) != E_OK )
      goto error_reset;
  /* func_id の取得 */
  if( (ercd_=cTDR_getInt16( &func_id_ )) != E_OK )
      goto error_reset;
#endif

  if( (ercd_ = cMessageBuffer_receive(msg) < 0 ) )
      goto error_reset;
  func_id_ = ((int16_t *)msg)[0];

#ifdef RPC_DEBUG
  syslog(LOG_INFO, "unmarshaler task: func_id: %d", func_id_ );
#endif
  switch( func_id_ ){
EOT

  # 呼び先の signature を取り出す
  # port = @celltype.find( @next_cell_port_name )
  # signature = port.get_signature
  signature = @signature

  # through の signature に含まれる すべての関数について
  signature.get_function_head_array.each {|f|
    f_name = f.get_name
    f_type = f.get_declarator.get_type
    id = signature.get_id_from_func_name(f_name)

    # 関数は返り値を持つか?
    if f_type.get_type.is_a?(VoidType)
      b_void = true
    else
      b_void = false
    end

    # パケットの終わりをチェック(未受け取りのデータが残っていないかチェック)
    file.print "    case #{id}:       /*** #{f_name} ***/ \n"
    file.print "        if( tTransparentUnmarshaler_#{@signature.get_name}_#{f_name}() != E_OK )\n"
    file.print "            goto error_reset;\n"
    file.print "        break;\n"

  } #

  if @PPAllocatorSize
    ppallocator_dealloc_str = "    /* PPAllocator のすべてを解放 */\n    cPPAllocator_dealloc_all();"
  else
    ppallocator_dealloc_str = ""
  end


  file.print <<EOT
  default:
#if 0 // deleted by ishikawa: tSysLogが未実装
      syslog(LOG_INFO, "unmarshaler task: ERROR: unknown func_id: %d", func_id_ );
#endif /* 0 */
      break;
  };
#{ppallocator_dealloc_str}
  return;

error_reset:
#if 0
  if( ercd_ != ERCD( E_RPC, E_RESET ) )
      (void)cTDR_reset();
#else
  return ercd_;
#endif
#{ppallocator_dealloc_str}
EOT
end

#gen_marshaler_celltypeObject



112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
# File 'lib/tecsgen/plugin/lib/GenHRP2Marshaler.rb', line 112

def gen_marshaler_celltype
  if @PPAllocatorSize
    alloc_call_port = "  call sPPAllocator cPPAllocator;\n"
  else
    alloc_call_port = ""
  end

  f = CFile.open(@marshaler_celltype_file_name, "w")
  # 同じ内容を二度書く可能性あり (AppFile は不可)

  # modified by ishikawa
  f.print <<EOT

celltype #{@marshaler_celltype_name} {
entry #{@signature.get_name} eClientEntry;
call sEventflag  cEventflag;
call sSemaphore  cSemaphore;
call sMessageBuffer cMessageBuffer;
//[optional]
//  call sSemaphore cLockChannel;  // this port is eliminated by optimize
};
celltype #{@unmarshaler_celltype_name} {
call #{@signature.get_name} cServerCall;
call sEventflag  cEventflag;
call sSemaphore  cSemaphore;
call sMessageBuffer cMessageBuffer;
entry sTaskBody  eUnmarshalAndCallFunction;
#{alloc_call_port}
FACTORY{
  write("$ct$_factory.h", "#include <t_syslog.h>");
};
};
EOT
  f.close
end

#gen_postamble(file, b_singleton, ct_name, global_name) ⇒ Object

POSTAMBLE 部のコード生成

アンマーシャラセルタイプの場合、アンマーシャラ関数の生成



631
632
633
634
635
636
637
638
639
640
641
642
643
644
645
646
647
648
649
650
651
652
653
654
655
656
657
658
659
660
661
662
663
664
665
666
667
668
669
670
671
672
673
674
675
676
677
678
679
680
681
682
683
684
685
686
687
688
689
690
691
692
693
694
695
696
697
698
699
700
701
702
703
704
705
706
707
708
709
710
711
712
713
714
715
716
717
718
719
720
721
722
723
724
725
726
727
728
729
730
731
732
733
734
735
736
737
738
739
740
741
742
743
744
745
746
747
748
749
750
751
752
753
754
755
756
757
758
759
# File 'lib/tecsgen/plugin/lib/GenHRP2Marshaler.rb', line 631

def gen_postamble(file, b_singleton, ct_name, global_name)
  if ct_name != @unmarshaler_celltype_name.to_sym
    return
  end

  file.print "\n/*** アンマーシャラ関数 ***/\n\n"
  @signature.get_function_head_array.each {|f|
    f_name = f.get_name
    f_type = f.get_declarator.get_type
    id = @signature.get_id_from_func_name(f_name)

    # 関数は返り値を持つか?
    if f_type.get_type.is_a?(VoidType)
      b_void = true
    else
      b_void = false
    end

    file.print <<EOT
/*
 * name:    #{f_name}
 * func_id: #{id}
 */
EOT
    file.print "static ER\n"
    file.print "tTransparentUnmarshaler_#{@signature.get_name}_#{f_name}()\n"
    file.print "{\n"
    file.print "	ER  ercd_;\n"

    # 引数を受取る変数の定義
    param_list = f.get_declarator.get_type.get_paramlist.get_items
         # FuncHead->  Decl->    FuncType->ParamList
    param_list.each{|par|
      name = par.get_name
      type = par.get_type
      if type.is_a? ArrayType
        type = type.get_type
        aster = "(*"
        aster2 = ")"
      else
        aster = ""
        aster2 = ""
      end

      type_str = type.get_type_str.gsub(/\bconst\b */, "") # "const" を外す

      file.printf("    %-12s %s%s%s%s;\n", type_str, aster, name, aster2, type.get_type_str_post)
    }

    # 戻り値を受け取る変数の定義
    if !b_void
      if f.is_oneway?
        retval_ptr = "" # oneway の場合、受け取るが捨てられる
      else
        # =begin ishikawa modified
        # retval_ptr = "*"
        retval_ptr = ""
        # =end ishikawa modified
      end
      file.printf("    %-12s #{retval_ptr}retval_%s;\n", f_type.get_type.get_type_str, f_type.get_type.get_type_str_post)
    end

    # in 方向の入出力を入力
    file.print "\n        /* 入力引数受取 */\n"
    b_get = true # unmarshal では get
    b_marshal = false
    @index = 2
    print_params(param_list, file, 1, b_marshal, b_get, true, f.is_oneway?)
    print_params(param_list, file, 1, b_marshal, b_get, false, f.is_oneway?)
=begin
    if ! b_void && ! f.is_oneway? then
      ret_ptr_type = PtrType.new( f_type.get_type )
      print_param_nc( "retval_", ret_ptr_type, file, 2, :RETURN, nil, nil, b_get )
    end
=end
    # パケットの受信完了
    # mikan 本当は、対象関数を呼出す後に実施したい.呼出しパケットの使用終わりを宣言する目的として
    file.print "        /* パケット終わりをチェック */\n"
    if !f.is_oneway?
      b_continue = "true"
    else
      b_continue = "false"
    end
=begin
    file.print "    if( (ercd_=cTDR_receiveEOP(#{b_continue})) != E_OK )\n"
    file.print "        goto error_reset;\n\n"
=end
    # 対象関数を呼出す
    file.print "    /* 対象関数の呼出し */\n"
    if b_void
      file.print("    cServerCall_#{f_name}(")
    else
      file.print("    #{retval_ptr}retval_ = cServerCall_#{f_name}(")
    end

    delim = " "
    param_list.each{|par|
      file.print delim
      delim = ", "
      file.print par.get_name.to_s
    }
    file.print(" );\n")

    # 戻り値、出力引数の受取コードの生成

    if !b_void && !f.is_oneway?
      file.print "    if( (ercd_ = cMessageBuffer_send(&retval_, sizeof(#{f_type.get_type.get_type_str})) != E_OK ) )\n"
      file.print "        goto error_reset;\n"

    end
    # oneway の場合出力、戻り値が無く、受取を待たない(非同期な呼出し)
    if !f.is_oneway?
      file.print <<EOT
  /* 関数処理の終了を通知 */
  if( ( ercd_ = cEventflag_set( 0x01 ) ) != E_OK ){
    goto error_reset;
  }
EOT
    end # ! f.is_oneway?
    file.print <<EOT
  return E_OK;
error_reset:
  return ercd_;
}

EOT

  }
end

#gen_preamble(file, b_singleton, ct_name, global_name) ⇒ Object

PREAMBLE 部のコード生成

アンマーシャラセルタイプの場合、アンマーシャラ関数のプロトタイプ宣言を生成



611
612
613
614
615
616
617
618
619
620
621
622
623
624
625
626
627
# File 'lib/tecsgen/plugin/lib/GenHRP2Marshaler.rb', line 611

def gen_preamble(file, b_singleton, ct_name, global_name)
  if ct_name != @unmarshaler_celltype_name.to_sym
    return
  end

  file.print "/* アンマーシャラ関数のプロトタイプ宣言 */\n"
  # signature に含まれる すべての関数について
  @signature.get_function_head_array.each {|f|
    f_name = f.get_name
    f_type = f.get_declarator.get_type
    id = @signature.get_id_from_func_name(f_name)
    file.print "static ER  tTransparentUnmarshaler_#{@signature.get_name}_#{f_name}();\t/* func_id: #{id} */\n"
  }
  file.print "\n"
  file.print "static uint8_t msg[256];\n"
  file.print "\n"
end

#initialize_transparent_marshaler(cell_name) ⇒ Object

marshaler のセルタイプ名を設定する



100
101
102
103
104
105
106
107
108
109
110
# File 'lib/tecsgen/plugin/lib/GenHRP2Marshaler.rb', line 100

def initialize_transparent_marshaler(cell_name)
  @task_priority = 8
  @channelCelltype = "tDataqueueOWChannel"
  @TDRCelltype     = "tTDR"
  @channelCellName = "#{cell_name}_Channel"
  @PPAllocatorSize = nil

  @marshaler_celltype_name = "tMarshaler_#{@signature.get_name}"
  @unmarshaler_celltype_name = "tUnmarshaler_#{@signature.get_name}"
  @marshaler_celltype_file_name = "#{$gen}/#{@marshaler_celltype_name}.cdl"
end

コピーしない引数渡しコードの出力



472
473
474
475
476
477
478
479
480
481
482
483
484
485
486
487
488
489
490
491
492
493
494
495
496
497
498
499
500
501
502
503
504
505
506
507
508
509
510
511
512
513
514
515
516
517
518
519
520
521
522
523
524
525
526
527
528
529
530
531
532
533
534
535
536
537
538
539
540
541
542
543
544
545
546
547
548
549
550
551
552
553
554
555
556
557
558
559
560
561
562
563
564
565
566
567
568
569
570
571
572
573
574
575
576
577
578
579
580
581
582
583
584
585
586
587
588
589
590
591
592
593
594
595
596
597
598
599
600
601
602
603
604
605
606
607
# File 'lib/tecsgen/plugin/lib/GenHRP2Marshaler.rb', line 472

def print_param_nc(name, type, file, nest, b_marshal, outer, outer2, b_get)
  indent = "    " * (nest + 1)

  case type
  when DefinedType
    print_param_nc(name, type.get_type, file, nest, b_marshal, outer, outer2, b_get)
  when BoolType, IntType, FloatType, PtrType, ArrayType
    case type
    when BoolType
      type_str = "Int8"
      cast_str = "int8_t"
    when IntType
      bit_size = type.get_bit_size
      case type.get_sign
      when :UNSIGNED
        signC = "U"
        sign  = "u"
      when :SIGNED
        if bit_size == -1 || bit_size == -11
          # signed char の場合、signed を指定する
          signC = "S"
          sign  = "s"
        else
          signC = ""
          sign  = ""
        end
      else
        signC = ""
        sign  = ""
      end

      # p "pn:: #{name} #{bit_size} #{type.get_type_str}"
      case bit_size
      when -1, -11 # -1: char_t, -11: char
        type_str = "#{signC}Char"
        cast_str = "#{sign}char_t"
      when -2
        type_str = "#{signC}Short"
        cast_str = "#{sign}short_t"
      when -3
        type_str = "#{signC}Int"
        cast_str = "#{sign}int_t"
      when -4
        type_str = "#{signC}Long"
        cast_str = "#{sign}long_t"
      when -5
        type_str = "Intptr"
        cast_str = "intptr_t"
      when 8, 16, 32, 64, 128
        type_str = "#{signC}Int#{bit_size}"
        cast_str = "#{sign}int#{bit_size}_t"
      else
        raise "unknown bit_size '#{bit_size}' for int type "
      end

    when FloatType
      bit_size = type.get_bit_size
      if bit_size == 32
        type_str = "Float32"
        cast_str = "float32_t"
      else
        type_str = "Double64"
        cast_str = "double64_t"
      end

    when PtrType
      type_str = "Intptr"
      cast_str = "intptr_t"
    when ArrayType
      type_str = "Intptr"
      cast_str = "intptr_t"
    end

    if type.get_type_str == cast_str
      cast_str = ""
    else
      cast_str = "(" + cast_str + ")"
    end

    if b_get
      cast_str.gsub!(/\)$/, "*)")
      file.print "    " * nest
=begin
      file.print "if( ( ercd_ = cTDR_get#{type_str}( #{cast_str}&(#{outer}#{name}#{outer2}) ) ) != E_OK )\n"
      file.print "    " * nest
      file.print "    goto error_reset;\n"
=end
      file.print "#{name} = *((#{type.get_type_str} *)(&msg[#{@index}]));\n"
      if bit_size.nil?
        raise "HRP2 RPC supports only specified bit_size"
      else
        case bit_size
        when 8, 16, 32, 64, 128
        else
          raise "HRP2 RPC supports only specified bit_size"
        end
      end
      @index += bit_size / 8
    else
      file.print "    " * nest
=begin
      file.print "if( ( ercd_ = cTDR_put#{type_str}( #{cast_str}#{outer}#{name}#{outer2} ) ) != E_OK )\n"
      file.print "    " * nest
      file.print "    goto error_reset;\n"
=end
      file.print "*((#{type.get_type_str} *)(&msg[#{@index}])) = #{name};\n"
      if bit_size.nil?
        raise "HRP2 RPC supports only specified bit_size"
      else
        case bit_size
        when 8, 16, 32, 64, 128
        else
          raise "HRP2 RPC supports only specified bit_size"
        end
      end
      @index += bit_size / 8
    end

  when StructType
    members_decl = type.get_members_decl
    members_decl.get_items.each {|m|
      if m.is_referenced?
        print_param_nc(m.get_name, m.get_type, file, nest, b_marshal, "#{outer}#{name}#{outer2}.", nil, b_get)
      end
    }
    members_decl.get_items.each {|m|
      if !m.is_referenced?
        print_param_nc(m.get_name, m.get_type, file, nest, b_marshal, "#{outer}#{name}#{outer2}.", nil, b_get)
      end
    }

  when VoidType
  when EnumType  # mikan EnumType
  when FuncType  # mikan FuncType
  end
end

IN b_marshal, b_get

b_marshal = true  && b_get == false   :  マーシャラで入力引数送出
b_marshal = true  && b_get == true    :  マーシャラで出力引数受取
b_marshal = false && b_get == true    :  アンマーシャラで入力引数受取
b_marshal = false && b_get == get     :  アンマーシャラで出力引数送出


439
440
441
442
443
444
445
446
447
448
449
450
451
452
453
454
455
456
457
458
459
460
461
462
463
464
465
466
467
468
469
# File 'lib/tecsgen/plugin/lib/GenHRP2Marshaler.rb', line 439

def print_params(params, file, nest, b_marshal, b_get, b_referenced, b_oneway = false)
  params.each{|param|
# p "#{param.get_name}:  b_marshal: #{b_marshal} b_get: #{b_get}"
    if !(b_referenced == param.is_referenced?)
      next
    end

    dir = param.get_direction
    type = param.get_type
    if b_oneway && dir == :IN && type.get_original_type.is_a?(PtrType) || type.get_original_type.is_a?(ArrayType)
      # oneway, in, PtrType の場合コピー
      alloc_cp = "cPPAllocator_alloc"
      alloc_cp_extra = nil
      print_param(param.get_name, type, file, nest, dir, nil, nil, b_get, alloc_cp, alloc_cp_extra)
    else
      if b_get == false && b_marshal == true || b_get == true && b_marshal == false
        case dir
#          when :IN, :INOUT, :SEND
        when :IN, :INOUT, :OUT, :SEND, :RECEIVE
          print_param_nc(param.get_name, type, file, nest, b_marshal, nil, nil, b_get)
        end
      else
#         case dir
#         when :OUT, :INOUT, :RECEIVE
#         when :RECEIVE
#           print_param_nc( param.get_name, type, file, nest, b_marshal, nil, nil, b_get )
#         end
      end
    end
  }
end

#set_channelCellName(rhs) ⇒ Object

プラグイン引数 channelCellName のチェック



85
86
87
88
89
90
91
92
# File 'lib/tecsgen/plugin/lib/GenHRP2Marshaler.rb', line 85

def set_channelCellName(rhs)
  @channelCellName = rhs
  if @channelCellName =~ /\A[a-zA-Z_]\w*/
    # OK
  else
    cdl_error("RPCPlugin: channeclCellName '#{rhs}' unsuitable for identifier")
  end
end

#set_channelCelltype(rhs) ⇒ Object

プラグイン引数 channelCelltype のチェック



61
62
63
64
65
66
67
68
69
70
# File 'lib/tecsgen/plugin/lib/GenHRP2Marshaler.rb', line 61

def set_channelCelltype(rhs)
  @channelCelltype = rhs.to_sym
  # path = [ "::", @channelCelltype ]
  # obj = Namespace.find( path )
  nsp = NamespacePath.analyze(@channelCelltype.to_s)
  obj = Namespace.find(nsp)
  if !obj.instance_of?(Celltype) && !obj.instance_of?(CompositeCelltype)
    cdl_error("RPCPlugin: channeclCelltype '#{rhs}' not celltype or not found")
  end
end

#set_PPAllocatorSize(rhs) ⇒ Object

プラグイン引数 PPAllocatorSize のチェック



95
96
97
# File 'lib/tecsgen/plugin/lib/GenHRP2Marshaler.rb', line 95

def set_PPAllocatorSize(rhs)
  @PPAllocatorSize = rhs
end

#set_taskPriority(rhs) ⇒ Object

プラグイン引数 taskPriority のチェック



56
57
58
# File 'lib/tecsgen/plugin/lib/GenHRP2Marshaler.rb', line 56

def set_taskPriority(rhs)
  @task_priority = rhs
end

#set_TDRCelltype(rhs) ⇒ Object

プラグイン引数 TDRCelltype のチェック



73
74
75
76
77
78
79
80
81
82
# File 'lib/tecsgen/plugin/lib/GenHRP2Marshaler.rb', line 73

def set_TDRCelltype(rhs)
  @TDRCelltype = rhs.to_sym
  # path = [ "::", @TDRCelltype ]
  # obj = Namespace.find( path )
  nsp = NamespacePath.analyze(@TDRCelltype.to_s)
  obj = Namespace.find(nsp)
  if !obj.instance_of?(Celltype) && !obj.instance_of?(CompositeCelltype)
    cdl_error("RPCPlugin: TDRCelltype '#{rhs}' not celltype or not found")
  end
end