source: asp3_tinet_ecnl_arm/trunk/asp3_dcre/tecsgen/tecslib/plugin/lib/GenTransparentMarshaler.rb@ 352

Last change on this file since 352 was 352, checked in by coas-nagasima, 6 years ago

arm向けASP3版ECNLを追加

  • Property svn:eol-style set to native
  • Property svn:mime-type set to text/x-ruby;charset=UTF-8
File size: 22.4 KB
Line 
1# -*- coding: utf-8 -*-
2#
3# TECS Generator
4# Generator for TOPPERS Embedded Component System
5#
6# Copyright (C) 2008-2014 by TOPPERS Project
7#--
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# 免責すること.
30#
31# 本ソフトウェアは,無保証で提供されているものである.上記著作権者お
32# よびTOPPERSプロジェクトは,本ソフトウェアに関して,特定の使用目的
33# に対する適合性も含めて,いかなる保証も行わない.また,本ソフトウェ
34# アの利用により直接的または間接的に生じたいかなる損害に関しても,そ
35# の責任を負わない.
36#
37# $Id$
38#++
39
40#プラグインオプション用変数
41#@task_priority:: Integer
42#@channelCelltype:: String
43#@channelCellName:: String
44#@PPAllocatorSize:: Integer
45module GenTransparentMarshaler
46
47 # プラグイン引数名と Proc
48 RPCPluginArgProc = {
49 "taskPriority" => Proc.new { |obj,rhs| obj.set_taskPriority rhs },
50 "channelCelltype" => Proc.new { |obj,rhs| obj.set_channelCelltype rhs },
51 "TDRCelltype" => Proc.new { |obj,rhs| obj.set_TDRCelltype rhs },
52 "channelCell" => Proc.new { |obj,rhs| obj.set_channelCellName rhs },
53 "PPAllocatorSize" => Proc.new { |obj,rhs| obj.set_PPAllocatorSize rhs },
54 }
55
56 #=== プラグイン引数 taskPriority のチェック
57 def set_taskPriority( rhs )
58 @task_priority = rhs
59 end
60
61 #=== プラグイン引数 channelCelltype のチェック
62 def set_channelCelltype( rhs )
63 @channelCelltype = rhs.to_sym
64 # path = [ "::", @channelCelltype ]
65 # obj = Namespace.find( path )
66 nsp = NamespacePath.analyze( @channelCelltype.to_s )
67 obj = Namespace.find( nsp )
68 if ! obj.instance_of?( Celltype ) && ! obj.instance_of?( CompositeCelltype ) then
69 cdl_error( "RPCPlugin: channeclCelltype '#{rhs}' not celltype or not found" )
70 end
71 end
72
73 #=== プラグイン引数 TDRCelltype のチェック
74 def set_TDRCelltype( rhs )
75 @TDRCelltype = rhs.to_sym
76 # path = [ "::", @TDRCelltype ]
77 # obj = Namespace.find( path )
78 nsp = NamespacePath.analyze( @TDRCelltype.to_s )
79 obj = Namespace.find( nsp )
80 if ! obj.instance_of?( Celltype ) && ! obj.instance_of?( CompositeCelltype ) then
81 cdl_error( "RPCPlugin: TDRCelltype '#{rhs}' not celltype or not found" )
82 end
83 end
84
85 #=== プラグイン引数 channelCellName のチェック
86 def set_channelCellName( rhs )
87 @channelCellName = rhs
88 if @channelCellName =~ /\A[a-zA-Z_]\w*/ then
89 # OK
90 else
91 cdl_error( "RPCPlugin: channeclCellName '#{rhs}' unsuitable for identifier" )
92 end
93 end
94
95 #=== プラグイン引数 PPAllocatorSize のチェック
96 def set_PPAllocatorSize( rhs )
97 @PPAllocatorSize = rhs
98 end
99
100 #=== marshaler のセルタイプ名を設定する
101 def initialize_transparent_marshaler cell_name
102 @task_priority = 8
103 @channelCelltype = "tDataqueueOWChannel"
104 @TDRCelltype = "tTDR"
105 @channelCellName = "#{cell_name}_Channel"
106 @PPAllocatorSize = nil
107
108 @marshaler_celltype_name = "tMarshaler_#{@signature.get_global_name}"
109 @unmarshaler_celltype_name = "tUnmarshaler_#{@signature.get_global_name}"
110 @marshaler_celltype_file_name = "#{$gen}/#{@marshaler_celltype_name}.cdl"
111 end
112
113 def gen_marshaler_celltype
114
115 if @PPAllocatorSize then
116 alloc_call_port = " call sPPAllocator cPPAllocator;\n"
117 else
118 alloc_call_port = ""
119 end
120
121 f = CFile.open( @marshaler_celltype_file_name, "w" )
122 # 同じ内容を二度書く可能性あり (AppFile は不可)
123
124 f.print <<EOT
125
126celltype #{@marshaler_celltype_name} {
127 entry #{@signature.get_namespace_path} eClientEntry;
128 call sTDR cTDR;
129 call sEventflag cEventflag;
130 [optional]
131 call sSemaphore cLockChannel; // this port is eliminated by optimize
132};
133celltype #{@unmarshaler_celltype_name} {
134 call #{@signature.get_namespace_path} cServerCall;
135 call sTDR cTDR;
136 call sEventflag cEventflag;
137 entry sUnmarshalerMain eUnmarshalAndCallFunction;
138#{alloc_call_port}};
139EOT
140 f.close
141 end
142
143 #=== 受け口関数の本体コードを生成(頭部と末尾は別途出力)
144 #ct_name:: Symbol (through プラグインで生成された) セルタイプ名 .Symbol として送られてくる(らしい)
145 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 )
146
147 # unmarshaler クラスか?
148 if ct_name == @unmarshaler_celltype_name.to_sym then
149 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 )
150 else
151 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 )
152 end
153 end
154
155 #=== marshal コードの生成
156 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 )
157
158 b_void = false
159 b_ret_er = false
160
161 # 関数の戻り値の元の型を得る(typedef されている場合)
162 type = func_type.get_type.get_original_type
163
164 # 戻り値記憶用の変数を出力(void 型の関数では出力しない)
165 if ! type.is_void? then
166 if func_type.get_type.kind_of?( DefinedType ) && ( func_type.get_type.get_type_str == "ER" || func_type.get_type.get_type_str == "ER_INT" ) then
167 file.print( " #{func_type.get_type.get_type_str} retval_ = E_OK;\n" )
168 b_ret_er = true
169 else
170 file.print( " #{func_type.get_type.get_type_str} retval_;\n" )
171 end
172 else
173 b_void = true
174 end
175
176 file.print( " ER ercd_;\n" )
177 file.print( " FLGPTN flgptn;\n" )
178
179 # 呼び先の signature を取り出す
180 signature = @signature
181
182 # 関数 ID (整数値)
183 func_id = signature.get_id_from_func_name( func_name )
184 file.print( " int16_t func_id_ = #{func_id}; /* id of #{func_name}: #{func_id} */\n" )
185
186 # シングルトンでないか?
187 if ! b_singleton then
188
189 # singleton でなければ p_cellcb 取得コードを出力
190 file.print <<EOT
191 #{ct_name}_CB *p_cellcb;
192
193 if( VALID_IDX( idx ) ){
194 p_cellcb = GET_CELLCB(idx);
195EOT
196
197 # エラーを返すか?
198 if b_ret_er then
199 file.print <<EOT
200 }else{
201 return ERCD( E_RPC, E_ID );
202 }
203EOT
204 else
205 file.print <<EOT
206 }else{
207 /* エラー処理コードをここに記述 */
208 }
209EOT
210 end
211 end
212
213 # channel lock コード
214 file.print <<EOT
215 /* Channel Lock */
216 if( is_cLockChannel_joined() )
217 cLockChannel_wait();
218
219EOT
220
221 # SOP を送信
222 file.print " /* SOPの送出 */\n"
223 file.print " if( ( ercd_ = cTDR_sendSOP( true ) ) != E_OK )\n"
224 file.print " goto error_reset;\n"
225
226 # func_id を送信
227 file.print " /* 関数 id の送出 */\n"
228 file.print " if( ( ercd_ = cTDR_putInt16( func_id_ ) ) != E_OK )\n"
229 file.print " goto error_reset;\n"
230
231 # p "celltype_name, sig_name, func_name, func_global_name"
232 # p "#{ct_name}, #{sig_name}, #{func_name}, #{func_global_name}"
233
234 b_get = false # marshal なら put
235 b_marshal = true # marshal
236
237 # in 方向の入出力を出力
238 file.print " /* 入力引数送出 */\n"
239 print_params( params, file, 1, b_marshal, b_get, true, func_type.is_oneway? )
240 print_params( params, file, 1, b_marshal, b_get, false, func_type.is_oneway? )
241 if ! b_void && ! func_type.is_oneway? then
242 ret_ptr_type = PtrType.new( func_type.get_type )
243 print_param_nc( "retval_", ret_ptr_type, file, 1, :RETURN, "&", nil, b_get )
244 end
245
246 file.print " /* EOPの送出(パケットの掃きだし) */\n"
247 if ! func_type.is_oneway? then
248 b_continue = "true"
249 else
250 b_continue = "false"
251 end
252 file.print " if( (ercd_=cTDR_sendEOP(#{b_continue})) != E_OK )\n"
253 file.print " goto error_reset;\n\n"
254
255 if ! func_type.is_oneway? then
256 file.print <<EOT
257 if( (ercd_=cEventflag_wait( 0x01, TWF_ANDW, &flgptn )) != E_OK ){
258 ercd_ = ERCD(E_RPC,ercd_);
259 goto error_reset;
260 }
261 if( (ercd_=cEventflag_clear( 0x00 ) ) != E_OK ){
262 ercd_ = ERCD(E_RPC,ercd_);
263 goto error_reset;
264 }
265EOT
266 end # ! func_type.is_oneway?
267
268 file.print <<EOT
269 /* Channel Lock */
270 if( is_cLockChannel_joined() )
271 cLockChannel_signal();
272EOT
273
274 if( b_void == false )then
275 # 呼び元に戻り値をリターン
276 file.print( " return retval_;\n" )
277 else
278 file.print( " return;\n" )
279 end
280
281 file.print <<EOT
282
283error_reset:
284 if( ercd_ != ERCD( E_RPC, E_RESET ) )
285 (void)cTDR_reset();
286EOT
287
288 # channel lock コード
289 file.print <<EOT
290 /* Channel Lock */
291 if( is_cLockChannel_joined() )
292 cLockChannel_signal();
293
294EOT
295
296 if( b_ret_er != false )then
297 # 呼び元に戻り値をリターン
298 file.print( " return ercd_;\n" )
299 else
300 file.print( " return;\n" )
301 end
302
303 end
304
305 #=== unmarshal コードの生成
306 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 )
307
308# b_ret_er = true
309 b_ret_er = false
310
311 # func_id を得るコードを生成
312 file.print <<EOT
313
314 int16_t func_id_;
315 ER ercd_;
316
317 #{ct_name}_CB *p_cellcb;
318
319 if( VALID_IDX( idx ) ){
320 p_cellcb = GET_CELLCB(idx);
321EOT
322
323 if b_ret_er then
324 file.print <<EOT
325 }else{
326 return ERCD( E_RPC, E_ID );
327 }
328EOT
329 else
330 file.print <<EOT
331 }else{
332 /* エラー処理コードをここに記述 */
333 }
334EOT
335 end
336
337 file.print <<EOT
338
339 /* SOPのチェック */
340 if( (ercd_=cTDR_receiveSOP( false )) != E_OK )
341 goto error_reset;
342 /* func_id の取得 */
343 if( (ercd_=cTDR_getInt16( &func_id_ )) != E_OK )
344 goto error_reset;
345
346#ifdef RPC_DEBUG
347 syslog(LOG_INFO, "unmarshaler task: func_id: %d", func_id_ );
348#endif
349 switch( func_id_ ){
350EOT
351
352 # 呼び先の signature を取り出す
353 # port = @celltype.find( @next_cell_port_name )
354 # signature = port.get_signature
355 signature = @signature
356
357 # through の signature に含まれる すべての関数について
358 signature.get_function_head_array.each { |f|
359 f_name = f.get_name
360 f_type = f.get_declarator.get_type
361 id = signature.get_id_from_func_name( f_name )
362
363 # 関数は返り値を持つか?
364 if f_type.get_type.is_void? then
365 b_void = true
366 else
367 b_void = false
368 end
369
370 # パケットの終わりをチェック(未受け取りのデータが残っていないかチェック)
371 file.print " case #{id}: /*** #{f_name} ***/ \n"
372 file.print " if( tTransparentUnmarshaler_#{@signature.get_global_name}_#{f_name}() != E_OK )\n"
373 file.print " goto error_reset;\n"
374 file.print " break;\n"
375
376 } #
377
378 if @PPAllocatorSize then
379 ppallocator_dealloc_str = " /* PPAllocator のすべてを解放 */\n cPPAllocator_dealloc_all();"
380 else
381 ppallocator_dealloc_str = ""
382 end
383
384
385 file.print <<EOT
386 default:
387 syslog(LOG_INFO, "unmarshaler task: ERROR: unknown func_id: %d", func_id_ );
388 };
389#{ppallocator_dealloc_str}
390 return;
391
392error_reset:
393 if( ercd_ != ERCD( E_RPC, E_RESET ) )
394 (void)cTDR_reset();
395#{ppallocator_dealloc_str}
396EOT
397
398 end
399
400 # IN b_marshal, b_get
401 # b_marshal = true && b_get == false : マーシャラで入力引数送出
402 # b_marshal = true && b_get == true : マーシャラで出力引数受取
403 # b_marshal = false && b_get == true : アンマーシャラで入力引数受取
404 # b_marshal = false && b_get == get : アンマーシャラで出力引数送出
405 def print_params( params, file, nest, b_marshal, b_get, b_referenced, b_oneway = false )
406 params.each{ |param|
407# p "#{param.get_name}: b_marshal: #{b_marshal} b_get: #{b_get}"
408 if ! ( b_referenced == param.is_referenced? ) then
409 next
410 end
411
412 dir = param.get_direction
413 type = param.get_type
414 if b_oneway && dir == :IN && type.get_original_type.kind_of?( PtrType ) || type.get_original_type.kind_of?( ArrayType ) then
415 # oneway, in, PtrType の場合コピー
416 alloc_cp = "cPPAllocator_alloc"
417 alloc_cp_extra = nil
418 print_param( param.get_name, type, file, nest, dir, nil, nil, b_marshal, b_get, alloc_cp, alloc_cp_extra )
419 else
420 if( b_get == false && b_marshal == true || b_get == true && b_marshal == false )then
421 case dir
422# when :IN, :INOUT, :SEND
423 when :IN, :INOUT, :OUT, :SEND, :RECEIVE
424 print_param_nc( param.get_name, type, file, nest, b_marshal, nil, nil, b_get )
425 end
426 else
427# case dir
428# when :OUT, :INOUT, :RECEIVE
429# when :RECEIVE
430# print_param_nc( param.get_name, type, file, nest, b_marshal, nil, nil, b_get )
431# end
432 end
433 end
434 }
435 end
436
437 #=== コピーしない引数渡しコードの出力
438 def print_param_nc( name, type, file, nest, b_marshal, outer, outer2, b_get )
439 indent = " " * ( nest + 1 )
440
441 case type
442 when DefinedType
443 print_param_nc( name, type.get_type, file, nest, b_marshal, outer, outer2, b_get )
444 when BoolType, IntType, FloatType, PtrType, ArrayType
445 case type
446 when BoolType
447 type_str = "Int8"
448 cast_str = "int8_t"
449 when IntType
450 bit_size = type.get_bit_size
451 case type.get_sign
452 when :UNSIGNED
453 signC = "U"
454 sign = "u"
455 when :SIGNED
456 if bit_size == -1 || bit_size == -11 then
457 # signed char の場合、signed を指定する
458 signC = "S"
459 sign = "s"
460 else
461 signC = ""
462 sign = ""
463 end
464 else
465 signC = ""
466 sign = ""
467 end
468
469 # p "pn:: #{name} #{bit_size} #{type.get_type_str}"
470 case bit_size
471 when -1, -11 # -1: char_t, -11: char
472 type_str = "#{signC}Char"
473 cast_str = "#{sign}char_t"
474 when -2
475 type_str = "#{signC}Short"
476 cast_str = "#{sign}short_t"
477 when -3
478 type_str = "#{signC}Int"
479 cast_str = "#{sign}int_t"
480 when -4
481 type_str = "#{signC}Long"
482 cast_str = "#{sign}long_t"
483 when -5
484 type_str = "Intptr"
485 cast_str = "intptr_t"
486 when 8, 16, 32, 64, 128
487 type_str = "#{signC}Int#{bit_size}"
488 cast_str = "#{sign}int#{bit_size}_t"
489 else
490 raise "unknown bit_size '#{bit_size}' for int type "
491 end
492
493 when FloatType
494 bit_size = type.get_bit_size
495 if bit_size == 32 then
496 type_str = "Float32"
497 cast_str = "float32_t"
498 else
499 type_str = "Double64"
500 cast_str = "double64_t"
501 end
502
503 when PtrType
504 type_str = "Intptr"
505 cast_str = "intptr_t"
506 when ArrayType
507 type_str = "Intptr"
508 cast_str = "intptr_t"
509 end
510
511 if type.get_type_str == cast_str then
512 cast_str = ""
513 else
514 cast_str = "(" + cast_str + ")"
515 end
516
517 if( b_get )then
518 cast_str.gsub!( /\)$/, "*)" )
519 file.print " " * nest
520 file.print "if( ( ercd_ = cTDR_get#{type_str}( #{cast_str}&(#{outer}#{name}#{outer2}) ) ) != E_OK )\n"
521 file.print " " * nest
522 file.print " goto error_reset;\n"
523 else
524 file.print " " * nest
525 file.print "if( ( ercd_ = cTDR_put#{type_str}( #{cast_str}#{outer}#{name}#{outer2} ) ) != E_OK )\n"
526 file.print " " * nest
527 file.print " goto error_reset;\n"
528 end
529
530 when StructType
531 members_decl =type.get_members_decl
532 members_decl.get_items.each { |m|
533 if m.is_referenced? then
534 print_param_nc( m.get_name, m.get_type, file, nest, b_marshal, "#{outer}#{name}#{outer2}.", nil, b_get )
535 end
536 }
537 members_decl.get_items.each { |m|
538 if ! m.is_referenced? then
539 print_param_nc( m.get_name, m.get_type, file, nest, b_marshal, "#{outer}#{name}#{outer2}.", nil, b_get )
540 end
541 }
542
543 when VoidType
544 when EnumType # mikan EnumType
545 when FuncType # mikan FuncType
546 end
547 end
548
549
550 #=== PREAMBLE 部のコード生成
551 # アンマーシャラセルタイプの場合、アンマーシャラ関数のプロトタイプ宣言を生成
552 def gen_preamble file, b_singleton, ct_name, global_name
553 if ct_name != @unmarshaler_celltype_name.to_sym then
554 return
555 end
556
557 file.print "/* アンマーシャラ関数のプロトタイプ宣言 */\n"
558 # signature に含まれる すべての関数について
559 @signature.get_function_head_array.each { |f|
560 f_name = f.get_name
561 f_type = f.get_declarator.get_type
562 id = @signature.get_id_from_func_name( f_name )
563 file.print "static ER tTransparentUnmarshaler_#{@signature.get_global_name}_#{f_name}();\t/* func_id: #{id} */\n"
564 }
565 file.print "\n"
566 end
567
568 #=== POSTAMBLE 部のコード生成
569 # アンマーシャラセルタイプの場合、アンマーシャラ関数の生成
570 def gen_postamble file, b_singleton, ct_name, global_name
571 if ct_name != @unmarshaler_celltype_name.to_sym then
572 return
573 end
574
575 file.print "\n/*** アンマーシャラ関数 ***/\n\n"
576 @signature.get_function_head_array.each { |f|
577 f_name = f.get_name
578 f_type = f.get_declarator.get_type
579 id = @signature.get_id_from_func_name( f_name )
580
581 # 関数は返り値を持つか?
582 if f_type.get_type.is_void? then
583 b_void = true
584 else
585 b_void = false
586 end
587
588 file.print <<EOT
589/*
590 * name: #{f_name}
591 * func_id: #{id}
592 */
593EOT
594 file.print "static ER\n"
595 file.print "tTransparentUnmarshaler_#{@signature.get_global_name}_#{f_name}()\n"
596 file.print "{\n"
597 file.print " ER ercd_;\n"
598 file.print " CELLCB *p_cellcb;\n"
599
600 # 引数を受取る変数の定義
601 param_list = f.get_declarator.get_type.get_paramlist.get_items
602 # FuncHead-> Decl-> FuncType->ParamList
603 param_list.each{ |par|
604 name = par.get_name
605 type = par.get_type
606 if type.kind_of? ArrayType then
607 type = type.get_type
608 aster = "(*"
609 aster2 = ")"
610 else
611 aster = ""
612 aster2 = ""
613 end
614
615 type_str = type.get_type_str.gsub( /\bconst\b */, "" ) # "const" を外す
616
617 file.printf( " %-12s %s%s%s%s;\n", type_str, aster, name, aster2, type.get_type_str_post )
618 }
619
620 # 戻り値を受け取る変数の定義
621 if ! b_void then
622 if f.is_oneway? then
623 retval_ptr = "" # oneway の場合、受け取るが捨てられる
624 else
625 retval_ptr = "*"
626 end
627 file.printf( " %-12s #{retval_ptr}retval_%s;\n", f_type.get_type.get_type_str, f_type.get_type.get_type_str_post )
628 end
629
630 # in 方向の入出力を入力
631 file.print "\n /* 入力引数受取 */\n"
632 b_get = true # unmarshal では get
633 b_marshal = false
634 print_params( param_list, file, 1, b_marshal, b_get, true, f.is_oneway? )
635 print_params( param_list, file, 1, b_marshal, b_get, false, f.is_oneway? )
636 if ! b_void && ! f.is_oneway? then
637 ret_ptr_type = PtrType.new( f_type.get_type )
638 print_param_nc( "retval_", ret_ptr_type, file, 2, :RETURN, nil, nil, b_get )
639 end
640
641 # パケットの受信完了
642 # mikan 本当は、対象関数を呼出す後に実施したい.呼出しパケットの使用終わりを宣言する目的として
643 file.print " /* パケット終わりをチェック */\n"
644 if ! f.is_oneway? then
645 b_continue = "true"
646 else
647 b_continue = "false"
648 end
649 file.print " if( (ercd_=cTDR_receiveEOP(#{b_continue})) != E_OK )\n"
650 file.print " goto error_reset;\n\n"
651
652 # 対象関数を呼出す
653 file.print " /* 対象関数の呼出し */\n"
654 if b_void then
655 file.print( " cServerCall_#{f_name}(" )
656 else
657 file.print( " #{retval_ptr}retval_ = cServerCall_#{f_name}(" )
658 end
659
660 delim = " "
661 param_list.each{ |par|
662 file.print delim
663 delim = ", "
664 file.print "#{par.get_name}"
665 }
666 file.print( " );\n" )
667
668 # 戻り値、出力引数の受取コードの生成
669
670 # oneway の場合出力、戻り値が無く、受取を待たない(非同期な呼出し)
671 if ! f.is_oneway? then
672 file.print <<EOT
673 /* 関数処理の終了を通知 */
674 if( ( ercd_ = cEventflag_set( 0x01 ) ) != E_OK ){
675 goto error_reset;
676 }
677EOT
678 end # ! f.is_oneway?
679 file.print <<EOT
680 return E_OK;
681error_reset:
682 return ercd_;
683}
684
685EOT
686
687 }
688
689 end
690
691end
Note: See TracBrowser for help on using the repository browser.