Changeset 34 for SimpleSample/trunk/SimpleSampleTransparentRPC
- Timestamp:
- Jun 24, 2012, 7:42:09 PM (12 years ago)
- Location:
- SimpleSample/trunk/SimpleSampleTransparentRPC
- Files:
-
- 3 edited
Legend:
- Unmodified
- Added
- Removed
-
SimpleSample/trunk/SimpleSampleTransparentRPC/SimpleSample.cdl
r30 r34 9 9 * | |Body | | | | 10 10 * +-------------+ +-------------+ +-------------+ 11 * 12 * * SimpleSample/SimpleSample.cdl を参照 13 * * この例では Transparent プラグインが指定される。以下の※を参照 14 * * Tranceparent プラグインのため tSysLog, rpc, tDataqueOWChannel を import 11 15 */ 12 13 16 14 17 // cygwin 用の簡易な型定義 15 18 import( <cygwin_kernel.cdl> ); 16 // TECS 対応 TOPPERS/ASP ならば import( <kernel.cdl> ); でよい19 // TECS 対応 TOPPERS/ASP ならば import( <kernel.cdl> ); に相当する 17 20 21 // tSysLog の定義 18 22 import( <tSysLog.cdl> ); 23 24 // SysLog の定義 (RPC のエラーメッセージ出力) 25 cell tSysLog SysLog { 26 }; 27 28 // RPC 関連のセルタイプの定義 19 29 import( <rpc.cdl> ); 30 // Transparent RPC に用いる Dataqueue OneWay チャンネルセルタイプの定義 20 31 import( <tDataqueueOWChannel.cdl> ); 21 32 33 // シグニチャ sSample 22 34 signature sSample { 23 35 ER sayHello( [in]int32_t times ); … … 25 37 }; 26 38 39 // セルタイプ tSample 27 40 celltype tSample { 28 41 entry sSample eEnt; 29 42 }; 30 43 31 [singleton,active] 44 // セルタイプ tSimple 32 45 celltype tSimple { 33 46 call sSample cCall; … … 35 48 }; 36 49 37 cell tSysLog SysLog { 38 }; 39 50 // セル Sample 40 51 cell tSample Sample { 41 52 }; 42 53 54 // セル Simple 43 55 cell tSimple Simple { 44 [through(RPCPlugin,"")] 56 [through(RPCPlugin,"")] // <<< ※ この行を挿入 45 57 cCall = Sample.eEnt; 46 58 }; 47 59 60 // セル Task 48 61 cell tTask Task { 49 62 cBody = Simple.eBody; -
SimpleSample/trunk/SimpleSampleTransparentRPC/src/tSample.c
r30 r34 1 /*2 * このファイルは tecsgen によりテンプレートとして自動生成されました3 * このファイルを編集して使用することが意図されていますが4 * tecsgen の再実行により上書きされてしまうため、通常5 * gen/tSample_template.c => src/tSample.c6 * のように名前, フォルダを変更してから修正します7 */8 1 /* #[<PREAMBLE>]# 9 2 * #[<...>]# から #[</...>]# で囲まれたコメントは編集しないでください 10 3 * tecsmerge によるマージに使用されます 11 4 * 5 * このファイルは tecsgen によりテンプレートとして自動生成されました 6 * このファイルを編集して使用することが意図されていますが 7 * tecsgen の再実行により上書きされてしまうため、通常 8 * gen/tSimpleServer_template.c => src/tSimpleServer.c 9 * のように名前, フォルダを変更してから修正します 10 * 12 11 * #[</PREAMBLE>]# */ 13 12 14 /* プロトタイプ宣言や変数の定義をここに書きます #_PAC_# */ 13 #include <stdio.h> 14 #include <string.h> 15 15 #include "tSample_tecsgen.h" 16 #include <stdio.h>17 16 18 17 #ifndef E_OK 19 #define E_OK 0 /* success*/20 #define E_ID (-18) /* illegal ID*/18 #define E_OK 0 /* 正常終了 */ 19 #define E_ID (-18) /* 不正ID番号 */ 21 20 #endif 21 22 22 23 23 /* 受け口関数 #_TEPF_# */ … … 26 26 * signature: sSample 27 27 * context: task 28 * params: 28 29 * #[</ENTRY_PORT>]# */ 29 30 … … 31 32 * name: eEnt_sayHello 32 33 * global_name: tSample_eEnt_sayHello 33 * oneway: false34 * #[ </ENTRY_FUNC>]# */34 * oneway: 35 * #[/ENTRY_FUNC>]# */ 35 36 ER 36 37 eEnt_sayHello(CELLIDX idx, int32_t times) … … 43 44 else { 44 45 return(E_ID); 45 } /* end if VALID_IDX(idx) */46 } 46 47 47 /* ここに処理本体を記述します #_TEFB_# */ 48 /* ここに処理本体を記述します */ 49 printf( "Sample: " ); 48 50 while( times-- > 0 ) 49 printf( " Hello!" );50 p uts( "" );51 printf( "hello " ); 52 printf( "\n" ); 51 53 52 54 return(ercd); … … 56 58 * name: eEnt_howAreYou 57 59 * global_name: tSample_eEnt_howAreYou 58 * oneway: false59 * #[ </ENTRY_FUNC>]# */60 * oneway: 61 * #[/ENTRY_FUNC>]# */ 60 62 ER 61 63 eEnt_howAreYou(CELLIDX idx, char_t* buf, int32_t len) … … 68 70 else { 69 71 return(E_ID); 70 } /* end if VALID_IDX(idx) */72 } 71 73 72 /* ここに処理本体を記述します #_TEFB_#*/73 strncpy( buf, " I'm fine thank you.", len );74 /* ここに処理本体を記述します */ 75 strncpy( buf, "Sample: I'm fine!", len ); 74 76 75 77 return(ercd); 76 78 } 77 79 78 /* #[<POSTAMBLE>]# 79 * これより下に非受け口関数を書きます 80 * #[</POSTAMBLE>]#*/ 80 -
SimpleSample/trunk/SimpleSampleTransparentRPC/src/tSimple.c
r30 r34 1 /*2 * このファイルは tecsgen によりテンプレートとして自動生成されました3 * このファイルを編集して使用することが意図されていますが4 * tecsgen の再実行により上書きされてしまうため、通常5 * gen/tSimple_template.c => src/tSimple.c6 * のように名前, フォルダを変更してから修正します7 */8 1 /* #[<PREAMBLE>]# 9 2 * #[<...>]# から #[</...>]# で囲まれたコメントは編集しないでください … … 17 10 * #[</PREAMBLE>]# */ 18 11 19 /* プロトタイプ宣言や変数の定義をここに書きます #_PAC_# */ 12 #include <stdio.h> 20 13 #include "tSimple_tecsgen.h" 21 #include <stdio.h>22 14 23 15 #ifndef E_OK 24 #define E_OK 0 /* success*/25 #define E_ID (-18) /* illegal ID*/16 #define E_OK 0 /* 正常終了 */ 17 #define E_ID (-18) /* 不正ID番号 */ 26 18 #endif 27 19 … … 38 30 * #[</ENTRY_FUNC>]# */ 39 31 void 40 eBody_main( )32 eBody_main(CELLIDX idx) 41 33 { 42 #define BUF_LEN 64 43 char_t buf[64]; 44 #define HELLO_TIMES (3) 45 puts( "calling sayHello" ); 46 cCall_sayHello( HELLO_TIMES ); 47 cCall_howAreYou( buf, BUF_LEN ); 34 CELLCB *p_cellcb; 35 char buf[256]; 36 if (VALID_IDX(idx)) { 37 p_cellcb = GET_CELLCB(idx); 38 } 39 else { 40 /* エラー処理コードをここに記述します */ 41 } /* end if VALID_IDX(idx) */ 42 43 #define N_HELLO 3 44 printf( "Simple: Say hello %d times.\n", N_HELLO ); 45 cCall_sayHello( N_HELLO ); /* 呼び口 cCall の sayHello を呼び出す */ 46 47 printf( "Simple: How are you?\n" ); 48 cCall_howAreYou( buf, sizeof buf ); /* 呼び口 cCall の howAreYou を呼び出す */ 48 49 puts( buf ); 49 50 }
Note:
See TracChangeset
for help on using the changeset viewer.