Changeset 34


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

totally brush up

Location:
SimpleSample/trunk
Files:
4 added
2 deleted
9 edited
2 moved

Legend:

Unmodified
Added
Removed
  • SimpleSample/trunk/README.txt

    r32 r34  
    1 Simple な Sample
     1TECS の Simple な Sample
    22
    33                                                                                2012年 6月17日
     
    99
    1010【概要】
     11
    1112TECS のもっとも単純なサンプルです。 exerb 版の TECS ジェネレータと
    12 cygwin 版の gcc だけで動作します。
    13 
    14 cygwin 上で pthread を用いた tTask 等のセルタイプを用意していますが、
    15 あくまでテスト用であり、完成度はもう一歩です。いろいろ変更して試そうと
    16 すると、期待した動作にならない可能性が高いのでご注意ください。
     13cygwin 版の gcc だけで動作します。Linux などの POSIX 環境でも動作しま
     14す。
     15exerb 版で動作しますので、Ruby や racc のインストールする必要がありま
     16せん。
    1717
    1818【動作環境】
    1919
    20 cygwin 上でビルドし動作します。Linux などで動作させるときは Makefile
    21 の TECSGEN を tecsgen.exe から tecsgen に変更してください。
     20cygwin 上でビルドし動作します。2012.6.2 に発行された tecs_package
     21(TECS ジェネレータ V1.1.0.4 を同梱) を用いてください。exerb 版を用いる
     22ようになっているため、Ruby インタープリターは不要です。
    2223
    23 【使用方法】
     24   exerb 版とは ruby インタプリタと TECS ジェネレータが一体の exe 化さ
     25   れたもので、ruby インタプリタのインストールを必要としません。
     26
     27Linux などの POSIX 環境でも動作させることができます。その場合 Makefile
     28の TECSGEN_EXE を tecsgen.exe から tecsgen に変更してください。Ruby
     291.8 がインストールされている必要があります。Ruby 1.9 には対応しません。
     30
     31【準備】
    2432
    25331) ファイルの展開
    2634
    2735 tecs_package ディレクトリの直下 asp+tecs, tecsgen の並びに
    28  SimpleSample を置いてください。exerb 版
     36 SimpleSample を置いてください。exerb 版を用いる都合上、tecsgen コマン
     37 ド引数に与えるパスは、すべて相対パスで指定しています。
    2938
    3039  tecs_package-+- asp+tecs
     
    3342               |
    3443               +- SimpleSample -+- SimpleSample
    35                                  (※)       |
    36                                                                 +- SimpleSampleOpaqueRPC
    37                                             |
    38                                                                 +- SimpleSampleTransparentRPC
     44                     (※)       |
     45                                +- SimpleSampleTrace
     46                                |
     47                                +- SimpleSampleOpaqueRPC
     48                                |
     49                                +- SimpleSampleTransparentRPC
    3950
    40   svn の trunk のディレクトリの位置に対応します。名前は変更しても構いません。
     51 svn の trunk のディレクトリの位置に対応します。名前は変更しても構いません。
    4152
    42 2) 準備
     532) パスの設定
    4354
    44  cygwin コンソールを開き、以下のような方法で set_env.sh ないの PATH 等
    45  取り込みます。
     55 cygwin コンソールを開き、以下のような方法で set_env.sh 内の PATH 等を
     56 取り込みます。
    4657
    4758  % cd tecs_package/tecsgen
     
    4960
    5061  exerb 版を使用するため、TECS ジェネレータのビルドは不要です。
     62
     63【ビルドと実行】
    5164
    52653) 直接結合版のビルドと実行
     
    6275  % ./SimpleSample.exe
    6376
    64 ・trace ありのビルド
     774) 直接結合の TracePlugin あり版のビルドと実行
    6578
    66   % cd tecs_package/SimpleSample/SimpleSample
    67   % make tecs -f Makefile-trace
    68   % make all -f Makefile-trace
     79  % cd tecs_package/SimpleSample/SimpleSampleTrace
     80  % make tecs
     81  % make all
    6982
    7083・実行
    7184
    72   % ./SimpleSample-trace.exe
     85  % ./SimpleSample.exe
    7386
    74 4) transparent RPC 版のビルドと実行
     875) transparent RPC 版のビルドと実行
    7588
    7689・ビルド
     
    88101  わかりにくいですが、Simple と Sample は異なるタスクで実行されています。
    89102
    90 4) transparent RPC 版のビルドと実行
     1036) opaque RPC 版のビルドと実行
    91104
    92105・ビルド
     
    103116  % ./rSample/SimpleSample-rSample.exe
    104117
    105  2 つ目のコンソールでクライアント側を起動します。
     118 次に 2 つ目のコンソールでクライアント側を起動します。
    106119
    107120  % cd tecs_package/SimpleSample/SimpleSampleOpaqueRPC
     
    113126 が、これは out 引数で返されたものを表示しているためです。
    114127
    115 重要なことは、tSimple.c, tSample.c は、まったく無変更で 4 つのパターンに
    116 対応しています。簡単に再利用が図られることがわかります。
     128【ポイント】
     129
     130ポイントは、各 CDL 内の tSimple, tSample の定義、セルタイプコード
     131tSimple.c, tSample.c は、まったく無変更で 4 つのパターンに対応している
     132ことです。再利用が図られることがわかります。
    117133
    118134【次のステップ】
     
    123139   まずは、これの手順を理解しましょう。
    124140
     141 ・もう一組インスタンスを設ける
    125142
     143【cygwin_kernel について】
     144
     145cygwin 上で pthread を用いた tTask 等のセルタイプを用意していますが、
     146テストドライバーまたはスタブであり、ほとんど機能は備わっていません。
     147
  • SimpleSample/trunk/SimpleSample/Makefile

    r33 r34  
    1 # このファイルは tecsgen により自動生成されました
    2 # Makefile.temp は gen の一つ上のディレクトリに移して使用します
    3 #  % mv Makefile.temp Makefile
    4 #
    5 # clean のデフォルト動作は $(GEN_DIR)/Makefile.* を削除します
    6 #
    7 # このファイルは GNU make で gcc を用い POSIX 環境で動作するモジュールをビルドするのに適切なように生成されています
    8 # vpath, CFLAGS, OTHER_OBJS などを調整する必要があるかもしれません
    9 # 他の環境やターゲットの場合、このファイルを元に変更する必要があります
    10 
    111# 変数 #_MVAR_#
    12 TARGET = SimpleSample-trace.exe
     2TARGET = SimpleSample.exe
    133TIMESTAMP = tecsgen.timestamp
    144TECSGEN_EXE = tecsgen.exe
     
    4939
    5040$(TIMESTAMP) : $(TECS_IMPORTS)
    51         $(TECSGEN_EXE)  -k euc -I src -I gen -I ../../tecsgen/tecs/../test/cygwin -I ../../tecsgen/tecs SimpleSample-trace.cdl
     41        $(TECSGEN_EXE)  -k euc -I src -I gen -I ../../tecsgen/tecs/../test/cygwin -I ../../tecsgen/tecs SimpleSample.cdl
    5242        touch $(TIMESTAMP)
    5343
     
    7161        $(CC) -c $(CFLAGS) -o $@ $<
    7262 
    73 $(_TECS_OBJ_DIR)tTracePlugin_sSample.o : tTracePlugin_sSample.c
    74         $(CC) -c $(CFLAGS) -o $@ $<
    75  
  • SimpleSample/trunk/SimpleSample/SimpleSample.cdl

    r30 r34  
    99 *  |             |Body       |             |          |             |
    1010 *  +-------------+           +-------------+          +-------------+
     11 *
     12 *・シグニチャ記述
     13 *
     14 *   sSample … 関数インタフェースの定義
     15 *              慣習として接頭文字 s を付加する
     16 *
     17 *    シグニチャ sSampleには 2 つの関数 sayHello と howAreYou がある。
     18 *    セルタイプ tSample の提供する機能となるので、sSample という名前にした。
     19 *
     20 *・セルタイプ記述
     21 *
     22 *   tSimple … 呼び元のセルタイプ
     23 *   tSample … 呼び先のセルタイプ
     24 *              慣習として接頭文字 t を付加する
     25 *   tTask   … cygwin 用の tTask は cygwin_kernel.cdl を import することで使用できる
     26 *
     27 *・組上げ記述
     28 *
     29 *   Simple … 呼び元のセル
     30 *   Sample … 呼び先のセル
     31 *   Task   … タスクセル
     32 *
     33 * セルタイプコード:
     34 *   src/tSimple.c  … 呼び元のセルタイプコード
     35 *   src/tSample.c  … 呼び先のセルタイプコード
     36 *
    1137 */
    12 
    1338
    1439// cygwin 用の簡易な型定義
    1540import( <cygwin_kernel.cdl> );
    16   // TECS 対応 TOPPERS/ASP ならば import( <kernel.cdl> ); でよい
     41    // TECS 対応 TOPPERS/ASP ならば import( <kernel.cdl> ); に相当する
    1742
     43// シグニチャ sSample
    1844signature sSample {
    1945        ER  sayHello( [in]int32_t times );
     
    2147};
    2248
     49// セルタイプ tSample
    2350celltype tSample {
    2451        entry sSample eEnt;
    2552};
    2653
    27 [singleton,active]
     54// セルタイプ tSimple
    2855celltype tSimple {
    2956        call sSample cCall;
     
    3158};
    3259
     60// セル Sample
    3361cell tSample Sample {
    3462};
    3563
     64// セル Simple
    3665cell tSimple Simple {
    3766        cCall = Sample.eEnt;
    3867};
    3968
     69// セル Task
    4070cell tTask Task {
    4171        cBody = Simple.eBody;
  • SimpleSample/trunk/SimpleSample/src/tSimple.c

    r30 r34  
    3030 * #[</ENTRY_FUNC>]# */
    3131void
    32 eBody_main()
     32eBody_main(CELLIDX idx)
    3333{
     34        CELLCB  *p_cellcb;
    3435        char   buf[256];
     36        if (VALID_IDX(idx)) {
     37                p_cellcb = GET_CELLCB(idx);
     38        }
     39        else {
     40                /* エラー処理コードをここに記述します */
     41        } /* end if VALID_IDX(idx) */
    3542
    3643#define N_HELLO 3
  • SimpleSample/trunk/SimpleSampleOpaqueRPC/SimpleSample.cdl

    r30 r34  
    1111 *  |             |Body       |             |           |             |          |             |
    1212 *  +-------------+           +-------------+           +-------------+          +-------------+
     13 *
     14 *  * SimpleSample/SimpleSample.cdl を参照
     15 *  * rSimple, rSample リージョンに分割し、それぞれを linkunit (リンク単位) とした
     16 *  * リージョン間には、OpaqueRPCPlugin で OpaqueRPC Channel を挿入する
     17 *  * TaskMain はチャンネルオープン後、 tSimple を呼び出す
    1318 */
    1419
     
    2227import( <tSocketChannel.cdl> );
    2328
     29// シグニチャ sSample
    2430signature sSample {
    2531        ER  sayHello( [in]int32_t times );
     
    2733};
    2834
     35// セルタイプ tSample
    2936celltype tSample {
    3037        entry sSample eEnt;
    3138};
    3239
    33 [singleton,active]
     40// セルタイプ tSimple
    3441celltype tSimple {
    3542        call sSample cCall;
     
    3744};
    3845
     46// セルタイプ tTaskMain (クライアント側チャンネルをオープンするために用いる)
    3947celltype tTaskMain {
    4048        entry sTaskBody eBody;
     
    4553[linkunit]
    4654region rSample {
     55        // セル SysLog
    4756        cell tSysLog SysLog {
    4857        };
     58        // セル Kernel
    4959        cell tKernel Kernel {
    5060        };
     61        // セル Sample
    5162        cell tSample Sample {
    5263        };
     
    5768                         "PPAllocatorSize=1024,"
    5869                         "clientChannelCell= 'ClientChannel', " // クライアント側チャンネルセル名
     70                         // このオプションでは、複数結合に対応できない
     71                         // 複数結合に対応するには、複数結合可能なオプション指定とするか、SharedOpaqueRPCPlugin を用いる
     72                         // 複数結合可能なオプション指定例は test/opaqueRPC 下にサンプルコードがある
    5973)]
    6074region rSimple {
     75        // セル SysLog
    6176        cell tSysLog SysLog {
    6277        };
     78        // セル Simple
    6379        cell tSimple Simple {
    6480                cCall = rSample::Sample.eEnt;
    6581        };
     82        // セル TaskMain
    6683        cell tTaskMain TaskMain {
    6784                cBody = Simple.eBody;
    6885                cOpener = ClientChannel.eOpener;
    6986        };
    70 
     87        // セル Task
    7188        cell tTask Task {
    72                 cBody = TaskMain.eBody;
     89                cBody = TaskMain.eBody;                        //  TaskMain に変更
    7390                priority = 11;
    7491                stackSize = 1024;
  • SimpleSample/trunk/SimpleSampleOpaqueRPC/src/tSimple.c

    r30 r34  
    3030 * #[</ENTRY_FUNC>]# */
    3131void
    32 eBody_main()
     32eBody_main(CELLIDX idx)
    3333{
     34        CELLCB  *p_cellcb;
    3435        char   buf[256];
     36        if (VALID_IDX(idx)) {
     37                p_cellcb = GET_CELLCB(idx);
     38        }
     39        else {
     40                /* エラー処理コードをここに記述します */
     41        } /* end if VALID_IDX(idx) */
    3542
    3643#define N_HELLO 3
  • SimpleSample/trunk/SimpleSampleTrace/Makefile

    r30 r34  
    1 # このファイルは tecsgen により自動生成されました
    2 # Makefile.temp は gen の一つ上のディレクトリに移して使用します
    3 #  % mv Makefile.temp Makefile
    4 #
    5 # clean のデフォルト動作は $(GEN_DIR)/Makefile.* を削除します
    6 #
    7 # このファイルは GNU make で gcc を用い POSIX 環境で動作するモジュールをビルドするのに適切なように生成されています
    8 # vpath, CFLAGS, OTHER_OBJS などを調整する必要があるかもしれません
    9 # 他の環境やターゲットの場合、このファイルを元に変更する必要があります
    10 
    111# 変数 #_MVAR_#
    12 TARGET = SimpleSample-trace.exe
    13 TIMESTAMP = tecsgen.timestamp-trace
    14 TECSGEN_EXE = tecsgen
     2TARGET = SimpleSample.exe
     3TIMESTAMP = tecsgen.timestamp
     4TECSGEN_EXE = tecsgen.exe
    155BASE_DIR = .
    166CC = gcc
     
    188LD = gcc
    199LDFLAGS =
    20 GEN_DIR = $(BASE_DIR)/gen-trace
     10GEN_DIR = $(BASE_DIR)/gen
    2111SRC_DIR = $(BASE_DIR)/src
    2212_TECS_OBJ_DIR = $(GEN_DIR)/
     
    4939
    5040$(TIMESTAMP) : $(TECS_IMPORTS)
    51         $(TECSGEN_EXE)  -g gen-trace -k euc -I src -I gen -I ../../tecsgen/tecs/../test/cygwin -I ../../tecsgen/tecs SimpleSample-trace.cdl
     41        $(TECSGEN_EXE)  -g gen -k euc -I src -I gen -I ../../tecsgen/tecs/../test/cygwin -I ../../tecsgen/tecs SimpleSample.cdl
    5242        touch $(TIMESTAMP)
    5343
  • SimpleSample/trunk/SimpleSampleTrace/SimpleSample.cdl

    r30 r34  
    55 *  |             |           |             |          |             |
    66 *  |   tTask     | sTaskBody |   tSimple   |  sSample |   tSample   |
    7  *  |   Task      |-----------|>  Simple    |----------|>  Sample    |
     7 *  |   Task      |-----------|>  Simple    |==========|>  Sample    |
    88 *  |             |cTask eBody|             |cCall eEnt|             |
    99 *  |             |Body       |             |          |             |
    1010 *  +-------------+           +-------------+          +-------------+
     11 *
     12 *  * SimpleSample/SimpleSample.cdl を参照
     13 *  * この例では Trace プラグインが指定される。以下の※を参照
     14 *  * Trace プラグインのため tSysLog, tKernel を用いる
    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 の定義 (Trace の出力先)
    1822import( <tSysLog.cdl> );
    1923
     24// セル SysLog (Trace の出力先)
    2025cell tSysLog SysLog {
    2126};
     27// セル Kernel (Trace の時刻を得る)
    2228cell tKernel Kernel {
    2329};
    2430
     31// シグニチャ sSample
    2532signature sSample {
    2633        ER  sayHello( [in]int32_t times );
     
    2835};
    2936
     37// セルタイプ tSample
    3038celltype tSample {
    3139        entry sSample eEnt;
    3240};
    3341
    34 [singleton,active]
     42// セルタイプ tSimple
    3543celltype tSimple {
    3644        call sSample cCall;
     
    3846};
    3947
     48// セル Sample
    4049cell tSample Sample {
    4150};
    4251
     52// セル Simple
    4353cell tSimple Simple {
    44         [through(TracePlugin,"")]
     54        [through(TracePlugin,"")]       //  <<< ※ この行を挿入
    4555                cCall = Sample.eEnt;
    4656};
    4757
     58// セル Task
    4859cell tTask Task {
    4960        cBody = Simple.eBody;
     
    5263        taskAttribute = C_EXP( "TA_ACT" );
    5364};
     65
  • 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.