Ignore:
Timestamp:
Jun 24, 2012, 7:42:09 PM (12 years ago)
Author:
okuma-top
Message:

totally brush up

Location:
SimpleSample/trunk/SimpleSampleTransparentRPC
Files:
3 edited

Legend:

Unmodified
Added
Removed
  • SimpleSample/trunk/SimpleSampleTransparentRPC/SimpleSample.cdl

    r30 r34  
    99 *  |             |Body       |             |          |             |
    1010 *  +-------------+           +-------------+          +-------------+
     11 *
     12 *  * SimpleSample/SimpleSample.cdl を参照
     13 *  * この例では Transparent プラグインが指定される。以下の※を参照
     14 *  * Tranceparent プラグインのため tSysLog, rpc, tDataqueOWChannel を import
    1115 */
    12 
    1316
    1417// cygwin 用の簡易な型定義
    1518import( <cygwin_kernel.cdl> );
    16   // TECS 対応 TOPPERS/ASP ならば import( <kernel.cdl> ); でよい
     19    // TECS 対応 TOPPERS/ASP ならば import( <kernel.cdl> ); に相当する
    1720
     21// tSysLog の定義
    1822import( <tSysLog.cdl> );
     23
     24// SysLog の定義 (RPC のエラーメッセージ出力)
     25cell tSysLog SysLog {
     26};
     27
     28// RPC 関連のセルタイプの定義
    1929import( <rpc.cdl> );
     30// Transparent RPC に用いる Dataqueue OneWay チャンネルセルタイプの定義
    2031import( <tDataqueueOWChannel.cdl> );
    2132
     33// シグニチャ sSample
    2234signature sSample {
    2335        ER  sayHello( [in]int32_t times );
     
    2537};
    2638
     39// セルタイプ tSample
    2740celltype tSample {
    2841        entry sSample eEnt;
    2942};
    3043
    31 [singleton,active]
     44// セルタイプ tSimple
    3245celltype tSimple {
    3346        call sSample cCall;
     
    3548};
    3649
    37 cell tSysLog SysLog {
    38 };
    39 
     50// セル Sample
    4051cell tSample Sample {
    4152};
    4253
     54// セル Simple
    4355cell tSimple Simple {
    44         [through(RPCPlugin,"")]
     56        [through(RPCPlugin,"")]         // <<<  ※ この行を挿入
    4557                cCall = Sample.eEnt;
    4658};
    4759
     60// セル Task
    4861cell tTask Task {
    4962        cBody = Simple.eBody;
  • SimpleSample/trunk/SimpleSampleTransparentRPC/src/tSample.c

    r30 r34  
    1 /*
    2  * このファイルは tecsgen によりテンプレートとして自動生成されました
    3  * このファイルを編集して使用することが意図されていますが
    4  * tecsgen の再実行により上書きされてしまうため、通常
    5  *   gen/tSample_template.c => src/tSample.c
    6  * のように名前, フォルダを変更してから修正します
    7  */
    81/* #[<PREAMBLE>]#
    92 * #[<...>]# から #[</...>]# で囲まれたコメントは編集しないでください
    103 * tecsmerge によるマージに使用されます
    114 *
     5 * このファイルは tecsgen によりテンプレートとして自動生成されました
     6 * このファイルを編集して使用することが意図されていますが
     7 * tecsgen の再実行により上書きされてしまうため、通常
     8 *   gen/tSimpleServer_template.c => src/tSimpleServer.c
     9 * のように名前, フォルダを変更してから修正します
     10 *
    1211 * #[</PREAMBLE>]# */
    1312
    14 /* プロトタイプ宣言や変数の定義をここに書きます #_PAC_# */
     13#include <stdio.h>
     14#include <string.h>
    1515#include "tSample_tecsgen.h"
    16 #include <stdio.h>
    1716
    1817#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番号 */
    2120#endif
     21
    2222
    2323/* 受け口関数 #_TEPF_# */
     
    2626 * signature:  sSample
    2727 * context:    task
     28 * params:
    2829 * #[</ENTRY_PORT>]# */
    2930
     
    3132 * name:         eEnt_sayHello
    3233 * global_name:  tSample_eEnt_sayHello
    33  * oneway:       false
    34  * #[</ENTRY_FUNC>]# */
     34 * oneway:       
     35 * #[/ENTRY_FUNC>]# */
    3536ER
    3637eEnt_sayHello(CELLIDX idx, int32_t times)
     
    4344        else {
    4445                return(E_ID);
    45         } /* end if VALID_IDX(idx) */
     46        }
    4647
    47         /* ここに処理本体を記述します #_TEFB_# */
     48        /* ここに処理本体を記述します */
     49        printf( "Sample: " );
    4850        while( times-- > 0 )
    49                 printf( "Hello! " );
    50         puts( "" );
     51                printf( "hello " );
     52        printf( "\n" );
    5153
    5254        return(ercd);
     
    5658 * name:         eEnt_howAreYou
    5759 * global_name:  tSample_eEnt_howAreYou
    58  * oneway:       false
    59  * #[</ENTRY_FUNC>]# */
     60 * oneway:       
     61 * #[/ENTRY_FUNC>]# */
    6062ER
    6163eEnt_howAreYou(CELLIDX idx, char_t* buf, int32_t len)
     
    6870        else {
    6971                return(E_ID);
    70         } /* end if VALID_IDX(idx) */
     72        }
    7173
    72         /* ここに処理本体を記述します #_TEFB_# */
    73         strncpy( buf, "I'm fine thank you.", len );
     74        /* ここに処理本体を記述します */
     75        strncpy( buf, "Sample: I'm fine!", len );
    7476
    7577        return(ercd);
    7678}
    7779
    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.c
    6  * のように名前, フォルダを変更してから修正します
    7  */
    81/* #[<PREAMBLE>]#
    92 * #[<...>]# から #[</...>]# で囲まれたコメントは編集しないでください
     
    1710 * #[</PREAMBLE>]# */
    1811
    19 /* プロトタイプ宣言や変数の定義をここに書きます #_PAC_# */
     12#include <stdio.h>
    2013#include "tSimple_tecsgen.h"
    21 #include <stdio.h>
    2214
    2315#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番号 */
    2618#endif
    2719
     
    3830 * #[</ENTRY_FUNC>]# */
    3931void
    40 eBody_main()
     32eBody_main(CELLIDX idx)
    4133{
    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 を呼び出す */
    4849        puts( buf );
    4950}
Note: See TracChangeset for help on using the changeset viewer.