[BACK]Return to stackmachine.tex CVS log [TXT][DIR] Up to [local] / OpenXM / doc / OpenXM-specs

Annotation of OpenXM/doc/OpenXM-specs/stackmachine.tex, Revision 1.1

1.1     ! noro        1: %% $OpenXM$
        !             2: //&jp \section{ OX スタックマシン }
        !             3: //&eg \section{ OX stackmachine }  (This section has not yet been translated.)
        !             4:
        !             5: /*&jp
        !             6: この節では, OX スタックマシン operator の説明
        !             7: (TCP/IP ソケット上での標準 encoding 法 を用いる),
        !             8: および, サンプルサーバとリンクする場合または
        !             9: open XM ライブラリとしてリンクして使用する場合の
        !            10: ための C の関数の仕様を説明する.
        !            11:
        !            12: 説明の前に, OX サーバスタックマシンの動作の原則を
        !            13: 説明しておく.
        !            14: サーバスタックマシンは,
        !            15: {\tt SM\_pop*} 系のスタックマシンコマンドがこないかぎり,
        !            16: 自発的にメッセージを送信することはない.
        !            17: この原則に基づいて分散計算のプログラミングをおこなう.
        !            18: イベントドリブンなプログラム法とはちがうことに
        !            19: 注意しよう.
        !            20:
        !            21:
        !            22: \subsection{サーバスタックマシン }
        !            23:
        !            24: サンプルサーバである {\tt oxserver00.c}
        !            25: は以下の仕様の C の関数を用意して,
        !            26: {\tt nullstackmachine.c } を置き換えれば一応動作するはずである.
        !            27:
        !            28:
        !            29: \noindent
        !            30: \subsubsection{サーバスタックマシンのグループ SMobject/Basic0
        !            31: に属するオペレータ}
        !            32:
        !            33:
        !            34: \noindent
        !            35: サーバスタックマシンは最低で1本のスタック
        !            36: \begin{verbatim}
        !            37: Object xxx_OperandStack[SIZE];
        !            38: \end{verbatim}
        !            39: をもつ.
        !            40: ここで, {\tt Object}  はそのシステム固有の Object 型で構わない.
        !            41: CMObject は各サーバ固有のローカルオブジェクトに変換して
        !            42: スタックへプッシュしてよい.
        !            43: ただし変換, 逆変換を合成したものは恒等写像であることがのぞましい.
        !            44: CMObject をどのように (local) Object  に変換するか,
        !            45: Object が受け付けるメッセージの定義は,
        !            46: 各システムが独自にきめて文書化しておくものとする.
        !            47: つまりすべてのメッセージは, private である.
        !            48: たとえば, {\tt add } のような基本的な メッセージにたいしても,
        !            49: OX スタックマシンはなにもきめていない.
        !            50: 将来的には open math \cite{openmath} のように
        !            51: CMObject に対する最大公約数的なメッセージの仕様を
        !            52: content dictionary (CD) の形で定義したい.
        !            53:
        !            54:
        !            55: 以下, \verb+ xxx_ + は誤解の恐れがないときは省略する.
        !            56: \verb+ xxx_ + は local サーバシステムに固有の識別子である.
        !            57: {\tt Asir} の場合は \verb+ Asir_ + を用いる.
        !            58: {\tt kan/sm1} の場合は  \verb+ Sm1_ + を用いる.
        !            59: 関数名, タグ名は長いので省略形を用いてもよい.
        !            60:
        !            61: 以下では次のようにパケットを記述する.
        !            62: 各フィールドは,
        !            63: \fbox{データ型 \quad  データ} なる形式で書く.
        !            64: たとえば,
        !            65: {\tt int32 OX\_DATA}
        !            66: は 32 bit network byte order の数字 {\tt OX\_DATA}
        !            67: という意味である.
        !            68: ``イタリックで書かれているフィールドは,
        !            69: 定義が別のところでなされているか解釈に誤解のないような自然言語
        !            70: で説明されている object を表す.''
        !            71: たとえば,
        !            72: {\it String commandName}
        !            73: は, String データ型の local object  {\it commandName}
        !            74: を意味する.
        !            75: (サーバスタックマシン上の object は, CMO 形式の object
        !            76: とは限らないことに注意.
        !            77: CMO 形式で書いてあっても, それはサーバスタックマシンの
        !            78: local 形式でスタック上にあると解釈して下さい.)
        !            79:
        !            80: すべてのサーバスタックマシンは
        !            81: 以下の関数を実装していないといけない.
        !            82: \begin{enumerate}
        !            83:
        !            84: \item
        !            85: CMObject/Basic0 の CMO データのうち必須のもの,
        !            86: {\tt CMO\_ERROR2}, {\tt CMO\_NULL}, {\tt CMO\_INT32},
        !            87: {\tt CMO\_STRING}, {\tt CMO\_LIST}
        !            88: がおくられて来た場合
        !            89: それをスタックに push する.
        !            90: たとえば, {\tt CMO\_NULL} の場合次のようになる.
        !            91: \\ Request:
        !            92: \begin{tabular}{|c|c|}  \hline
        !            93: {\tt int32 OX\_DATA} & {\tt int32 CMO\_NULL} \\
        !            94: \hline
        !            95: \end{tabular}
        !            96: \\ Stack after the request:
        !            97: \begin{tabular}{|c|}  \hline
        !            98: {\it NULL} \\
        !            99: \hline
        !           100: \end{tabular}
        !           101: \\ Result:  なし.
        !           102:
        !           103: たとえば, {\tt CMO\_String} の場合次のようになる.
        !           104: \\ Request:
        !           105: \begin{tabular}{|c|c|c|c|c|c|}  \hline
        !           106: {\tt int32 OX\_DATA} & {\tt int32 CMO\_String} &{\tt int32} {\rm size}
        !           107: &{\tt byte} {\rm s1} & $\cdots$ &{\tt byte} {\rm ssize}\\
        !           108: \hline
        !           109: \end{tabular}
        !           110: \\ Stack after the request:
        !           111: \begin{tabular}{|c|}  \hline
        !           112: {\it String s} \\
        !           113: \hline
        !           114: \end{tabular}
        !           115: \\ Result:  なし.
        !           116:
        !           117: CMO データの受け取りに失敗した時のみ  \\
        !           118: \begin{tabular}{|c|c|c|}  \hline
        !           119: {\tt int32 OX\_DATA} & {\tt int32 CMO\_ERROR2} & {\it CMObject} ob\\
        !           120: \hline
        !           121: \end{tabular}
        !           122: \\
        !           123: をスタックへ push する.
        !           124: 現在のところ, ob には, \\
        !           125: \centerline{
        !           126: [{\sl Integer32} OX パケット番号, {\sl Integer32} エラー番号,
        !           127: {\sl CMObject} optional 情報]
        !           128: }
        !           129: なるリストを入れる (CMO 形式でかいてあるが, これはサーバ独自の形式でよい.
        !           130: CMO として送出されるときこのような形式でないといけないという意味である.)
        !           131:
        !           132:
        !           133:
        !           134: \item
        !           135: \begin{verbatim}
        !           136: void *xxx_mathCap()
        !           137: \end{verbatim}
        !           138: このサーバの mathcap をもどす (termcap のまね).
        !           139: サーバのタイプ, サーバスタックマシンの能力を知ることができる.
        !           140: C 言語で実装する場合は, mathCap の構造体をシステム毎にきめるものとし,
        !           141: この関数はその構造体へのポインタを戻す.
        !           142: (open sm1 では {\tt struct mathCap} を用いている.
        !           143: @plugin/mathcap.h)
        !           144: \\ Request:
        !           145: \begin{tabular}{|c|c|}  \hline
        !           146: {\tt int32 OX\_COMMAND} & {\tt int32 SM\_mathcap}  \\
        !           147: \hline
        !           148: \end{tabular}
        !           149: \\ Result:
        !           150: \begin{tabular}{|c|c|}  \hline
        !           151: {\tt int32 OX\_DATA} & {\sl Mathcap}  mathCapOb \\
        !           152: \hline
        !           153: \end{tabular}
        !           154:
        !           155: \item
        !           156: \begin{verbatim}
        !           157: xxx_setMathCap(void *m)
        !           158: \end{verbatim}
        !           159: 受け取った Mathcap {\tt m} を
        !           160: 自分のシステムに設定して, 相手側が理解不能な CMO をおくらないように
        !           161: する.
        !           162: C 言語で実装する場合は, mathCap の構造体をシステム毎にきめるものとし,
        !           163: この関数はその構造体へのポインタを引数とする.
        !           164: (open sm1 では {\tt struct mathCap} を用いている.
        !           165: @plugin/mathcap.h)
        !           166: \\ Request:
        !           167: \begin{tabular}{|c|c|}  \hline
        !           168: {\tt int32 OX\_DATA} & {\sl Mathcap} m  \\ \hline
        !           169: {\tt int32 OX\_COMMAND} & {\tt int32 SM\_setMathCap}  \\
        !           170: \hline
        !           171: \end{tabular}
        !           172: \\ Result:  なし. \\
        !           173: 注意: mathcap は一般にクライアント主体で設定する.
        !           174: クライアントがサーバに {\tt SM\_mathcap} をおくり,
        !           175: サーバ側の mathcap を得る.
        !           176: それを, クライアントはそのサーバに付随した mathcap として
        !           177: 設定する.
        !           178: 次に, クライアントはサーバに自分の mathcap を
        !           179: {\tt SM\_setMathCap} でおくり, 自分の mathcap を設定させる.
        !           180:
        !           181:
        !           182: \item
        !           183: \begin{verbatim}
        !           184: int xxx_executeStringByLocalParser(char *s)
        !           185: \end{verbatim}
        !           186: 文字列 $s$ をシステム xxx の文法(サーバスタックマシンの組み込みローカル
        !           187: 言語)にしたがったコマンドとして実行する.
        !           188: ただし, コマンドの実行の結果の最後に戻り値があるときは,
        !           189: {\tt OperandStack} に戻り値を push する.
        !           190: 正常終了なら 0 を, 異常終了なら -1 をもどす.
        !           191: debug モードにはいった場合, -2 を戻す.
        !           192: エラーの時  Error2 Object
        !           193: を stack へ push する.\\
        !           194: {\tt kan/sm1} の場合, サーバスタックマシンの組み込みローカル言語は
        !           195: {\tt sm1} ポストスクリプト言語である.
        !           196: サーバスタックマシンと, {\tt sm1} ポストスクリプト言語はスタックを
        !           197: 共有するように実装されている.
        !           198: 実際の計算は
        !           199: {\tt executeStringByLocalParser} により実行される.
        !           200: open XM では, 現在のところ関数名の標準化はおこなっていない.
        !           201: したがって, 実際の計算コマンドの送出は mathcap をみてクライアントが
        !           202: 正しいコマンドを選択する必要がある.
        !           203: (しかしながら, 共通関数名がないために, 共通仕様のサーバスタックマシンの
        !           204: 実装はきわめて簡単である. 関数名の共通化は将来の課題.) \\
        !           205: 割込みに関しては, -1 を戻すように ハンドラを書く.
        !           206: executeStringByLocalParser() を再帰的に呼んだときも 割り込みのハンドラが
        !           207: 正しく動作するようにこの関数は書かれるべきである.
        !           208: この関数を呼び出したのち, signal, setjmp の再設定を呼び出し側でやらないと
        !           209: いけない. \\
        !           210: この関数および {\tt popString} の機能を実現すれば, 最低限の
        !           211: open XM のサーバになれる.   実装では, まずこの二つの関数の機能を
        !           212: 実現すべきである.
        !           213: \\ Stack before the request:
        !           214: \\
        !           215: \begin{tabular}{|c|}  \hline
        !           216: {\it String commandString} \\
        !           217: \hline
        !           218: \end{tabular}
        !           219: \\Request:
        !           220: \begin{tabular}{|c|c|}  \hline
        !           221: {\tt int32 OX\_COMMAND}& {\tt int32 SM\_executeStringByLocalParser} \\
        !           222: \hline
        !           223: \end{tabular}
        !           224: \\ Result:  なし.
        !           225: \\ 参考: \  実行前のスタックのデータは,
        !           226: {\it String commandString} なる local stackmachine の object として
        !           227: スタック上にあるが, TCP/IP の通信路では, 次のようなデータがまずながれて
        !           228: {\it commandName} がスタックに push される:
        !           229: \\
        !           230: \begin{tabular}{|c|c|c|}  \hline
        !           231: {\tt int32 OX\_DATA} & {\tt int32 CMO\_string} & {\it size and the string commandString} \\
        !           232: \hline
        !           233: \end{tabular}
        !           234:
        !           235: \item
        !           236: \begin{verbatim}
        !           237: int xxx_executeStringByLocalParserInBatchMode(char *s)
        !           238: \end{verbatim}
        !           239: スタックに副作用がない(スタックにたいしてなんの操作もしない)
        !           240: ことを除き上とまったく同じ関数である.
        !           241: エラーの時のみ, Error2 Object をスタックへプッシュする.
        !           242:
        !           243: \item
        !           244: \begin{verbatim}
        !           245: char *xxx_popString(void)
        !           246: void xxx_popString(ox_stream  out)
        !           247: \end{verbatim}
        !           248: 最初の関数はライブラリとしてリンクして使用する場合の関数である.
        !           249: {\tt OperandStack} より Object を pop し, それを xxx の出力
        !           250: 規則にしたがい文字列型に変換して戻す.
        !           251: スタックが空のときは, {\tt (char *)NULL} を戻す.
        !           252: 呼出側の関数は, 戻り値のメモリー領域を操作してはいけない.
        !           253: また, 再度 サーバスタックマシンが呼ばれたときは, 戻り値のメモリ領域
        !           254: は変更されているかもしれない.
        !           255:
        !           256: 2 番目の関数は, TCP/IP を用いて通信する場合の関数である.
        !           257: 変換されてでてきた文字列を値として返すのではなく,
        !           258: {\tt ox\_stream out}
        !           259: へ CMO のデータとして送信する.
        !           260: エラーの場合は {\tt CMO\_ERROR2} を戻すべきである.
        !           261: \\ Stack before the request:
        !           262: \begin{tabular}{|c|}  \hline
        !           263: {\it Object} \\
        !           264: \hline
        !           265: \end{tabular}
        !           266: \\ Request:
        !           267: \begin{tabular}{|c|c|}  \hline
        !           268: {\tt int32 OX\_COMMAND} & {\tt int32 SM\_popString} \\
        !           269: \hline
        !           270: \end{tabular}
        !           271: \\ Result:
        !           272: \begin{tabular}{|c|c|c|}  \hline
        !           273: {\tt int32 OX\_DATA} & {\tt int32 CMO\_STRING} & {\it size and the string s} \\
        !           274: \hline
        !           275: \end{tabular}
        !           276:
        !           277: \item
        !           278: \begin{verbatim}
        !           279: int xxx_getsp(void)
        !           280: \end{verbatim}
        !           281: 現在のスタックポインタの位置をもどす.
        !           282: スタート時点での位置は 0 であり, object が push されたばあい,
        !           283: 1 づつ増えるものとする.
        !           284: \\ Stack before the request:
        !           285: \begin{tabular}{|c|}  \hline
        !           286: {\it Object} \\
        !           287: \hline
        !           288: \end{tabular}
        !           289: \\ Request:
        !           290: \begin{tabular}{|c|c|}  \hline
        !           291: {\tt int32 OX\_COMMAND} & {\tt int32 SM\_getsp} \\
        !           292: \hline
        !           293: \end{tabular}
        !           294: \\ Result:
        !           295: \begin{tabular}{|c|c|c|}  \hline
        !           296: {\tt int32 OX\_DATA} & {\tt int32 CMO\_INT32} & {\it stack pointer value} \\
        !           297: \hline
        !           298: \end{tabular}
        !           299:
        !           300: \item
        !           301: \begin{verbatim}
        !           302: object xxx_dupErrors(void)
        !           303: \end{verbatim}
        !           304: スタック上のエラーオブジェクトをリストにして戻す.
        !           305: スタック自体は変化させない.
        !           306: \\ Stack before the request:
        !           307: \begin{tabular}{|c|}  \hline
        !           308: {\it Object} \\
        !           309: \hline
        !           310: \end{tabular}
        !           311: \\ Request:
        !           312: \begin{tabular}{|c|c|}  \hline
        !           313: {\tt int32 OX\_COMMAND} & {\tt int32 SM\_dupErrors} \\
        !           314: \hline
        !           315: \end{tabular}
        !           316: \\ Result:
        !           317: \begin{tabular}{|c|c|c|}  \hline
        !           318: {\tt int32 OX\_DATA} & {\sl CMObject} \ a list of errors\\
        !           319: \hline
        !           320: \end{tabular}
        !           321:
        !           322: \item
        !           323: \begin{verbatim}
        !           324: int xxx_start()
        !           325: \end{verbatim}
        !           326: xxx の初期化をおこなう.
        !           327:
        !           328: \end{enumerate}
        !           329:
        !           330: \noindent
        !           331: {\bf 例}: \
        !           332: 次は, 標準入力よりの入力を asir に送り評価した結果を表示するプログラム
        !           333: である.
        !           334: \begin{verbatim}
        !           335: #include <stdio.h>
        !           336:
        !           337: main() {
        !           338:   char tmp[1024];
        !           339:   Asir_start();
        !           340:   while (gets(tmp) != NULL) {
        !           341:      if (Asir_executeStringByLocalParser(tmp) != 0) {
        !           342:         printf("%s\n",Asir_popString());
        !           343:      }
        !           344:   }
        !           345: }
        !           346:
        !           347: \end{verbatim}
        !           348:
        !           349: \medbreak
        !           350: \noindent
        !           351: {\bf 例}: \
        !           352: mathcap の問い合わせに対して, {\tt ox\_sm1} は次のように答える.
        !           353: %%Prog: [(cmoMathCap)] extension ::
        !           354: \begin{verbatim}
        !           355: Class.mathcap
        !           356:  [ [199909080 , $Ox_system=ox_sm1.plain$ , $Version=2.990911$ ,
        !           357:     $HOSTTYPE=i386$ ]  ,
        !           358:    [262 , 263 , 264 , 265 , 266 , 268 , 269 , 272 , 273 , 275 , 276 ]  ,
        !           359:    [[514] , [2130706434 , 1 , 2 , 4 , 5 , 17 , 19 , 20 , 22 , 23 , 24 ,
        !           360:              25 , 26 , 30 , 31 , 60 , 61 , 27 , 33 , 40 , 34 ]]]
        !           361: \end{verbatim}
        !           362:
        !           363: mathcap は 3つの要素をもつリストである.
        !           364: まづ, 最初の要素を見よう.
        !           365: Ox\_system は open xxx システム名である.
        !           366: 読み込むライブラリがちがっていて, 関数名(または シンボル)の意味がちがうときは
        !           367: この名前もかえる.
        !           368: たとえば, open math の basic content dictionary 対応の関数定義マクロを
        !           369: 読みこんだ sm1 は,
        !           370: ox\_sm1\_basicCD なる名前にする.
        !           371: HOSTTYPE値は, CPU の種類をあらわし
        !           372: unix では環境変数\verb+$HOSTTYPE+ の値である.
        !           373: 2 番目の要素は 利用可能な SM コマンドをあつめたリストである.
        !           374: 3 番目のリストは, 処理可能な数学データの形式, およびCMOの場合なら
        !           375: 処理可能なCMOのタグのリストが続く.
        !           376: 上の例では, 514 は {\tt OX\_DATA} をあらわし, 数学データのフォマットは
        !           377: (サイズ情報なしの) CMO であることを示す.
        !           378:
        !           379:
        !           380: \medbreak
        !           381: \noindent
        !           382: {\bf 例}: \
        !           383: %%Prog: (ox.sm1) run  sm1connectr  [(oxWatch) ox.ccc] extension
        !           384: %%Prog: ox.ccc (122345; ) oxsubmit ;
        !           385: {\tt message\_body} の実例をあげる.   シリアル番号部は除いてある.
        !           386: \begin{enumerate}
        !           387: \item  {\tt executeStringByLocalParser("12345 ;");}
        !           388: は次のようなパケットに変換される. 各数字は 16進1バイトをあらわす.
        !           389: {\tt xx(yy)} のなかの {\tt (yy)} は対応するアスキーコードをあわらす.
        !           390: \begin{verbatim}
        !           391: 0   0   2   2   0   0   0   4   0   0   0   7
        !           392: 31(1)  32(2)  33(3)  34(4)  35(5)  20  3b(;)
        !           393: 0   0   2   1   0   0   1   c
        !           394: \end{verbatim}
        !           395: ここで,
        !           396: \verb+ 0 0 2 2 0 0 0 4 + は, network byte order で,
        !           397: 順番に {\tt OX\_DATA} それから,
        !           398: CMO のタグの, {\tt CMO\_STRING} を表す.
        !           399: \verb+ 0  0  0  7 + は文字数,
        !           400: 最後に 文字列 {\tt 12345 ;} が来る.
        !           401: ここで, \verb+ 0 0 1 c + は, network byte order で,
        !           402: {\tt OX\_executeString} を表す.
        !           403:
        !           404: まとめると次のようになる.
        !           405: \begin{verbatim}
        !           406: 0   0   2   2  (OX_DATA) 0   0   0   4  (CMO_STRING)
        !           407: 0   0   0   7  (size)
        !           408: 31(1)  32(2)  33(3)  34(4)  35(5)  20  3b(;)   (data)
        !           409: 0   0   2   1  (OX_COMMAND)
        !           410: 0   0   1   c  (SM_executeStringByLocalParser)
        !           411: \end{verbatim}
        !           412: これを OXexpression で表記すると次のようになる.
        !           413: \begin{center}
        !           414: (OX\_DATA, (CMO\_STRING, 7, "12345 ;"))
        !           415: \end{center}
        !           416: \begin{center}
        !           417: (OX\_COMMAND, (SM\_executeStringByLocalParser))
        !           418: \end{center}
        !           419:
        !           420: \item  {\tt popString()}  を要請するメッセージ:
        !           421: \begin{verbatim}
        !           422: 0   0   2   1  (OX_COMMAND)
        !           423: 0   0   1   7  (SM_popString)
        !           424: \end{verbatim}
        !           425: OXexpression では
        !           426: (OX\_COMMAND, (SM\_popString)).
        !           427:
        !           428: \noindent
        !           429: これにたいして次の返答メッセージがくる.
        !           430: \begin{verbatim}
        !           431: 0   0   2   2   (OX_DATA)
        !           432: 0   0   0   4   (CMO_STRING) 0   0   0   5  (size)
        !           433: 31(1)  32(2)  33(3)  34(4)  35(5)
        !           434: \end{verbatim}
        !           435: OXexpression でかくと,
        !           436: (OX\_DATA, (CMO\_STRING, 7, "12345 ;")).
        !           437:
        !           438:
        !           439:
        !           440: \end{enumerate}
        !           441:
        !           442: \subsubsection{グループ SMobject/Basic1 に属するオペレータ}
        !           443:
        !           444:
        !           445: \begin{enumerate}
        !           446:
        !           447: \item
        !           448: \begin{verbatim}
        !           449: void xxx_pops(int n)
        !           450: \end{verbatim}
        !           451: operand stack より, {\it n} 個の元
        !           452: ({\it obj1, obj2, $\ldots$, objn}) を pop して捨てる.
        !           453: \\ Stack before the request: (右が stack のトップである.) \\
        !           454: \begin{tabular}{|c|c|c|c|c|}  \hline
        !           455: {\it obj1} & {\it  obj2}  & $\cdots$ & {\it objn}  &{\it INT32 n} \\
        !           456: \hline
        !           457: \end{tabular}
        !           458: \\ Request:
        !           459: \begin{tabular}{|c|c|}  \hline
        !           460: {\tt int32 OX\_COMMAND} & {\tt int32 SM\_pops } \\
        !           461: \hline
        !           462: \end{tabular}
        !           463: \\ Result:  なし.
        !           464:
        !           465:
        !           466: \item
        !           467: \begin{verbatim}
        !           468: int xxx_setName(char *name)
        !           469: \end{verbatim}
        !           470: (これは本当に必要な関数??)
        !           471: {\tt OperandStack} より {\it name} を pop し, つぎに
        !           472: {\tt OperandStack} より {\it obj} を pop し, それを
        !           473: 現在の名前空間で変数 {\it name} に bind する.
        !           474: 正常終了なら 0 を, 異常終了なら -1 をもどす.
        !           475: TCP/IP による通信では, 異常終了の時のみ, {\tt CMO\_ERROR2} を
        !           476: stack へ push する.
        !           477: \\ Stack before the request: (右が stack の top.)
        !           478: \begin{tabular}{|c|c|}  \hline
        !           479: {\it obj} & {\it String name}  \\
        !           480: \hline
        !           481: \end{tabular}
        !           482: \\ Request:
        !           483: \begin{tabular}{|c|c|}  \hline
        !           484: {\tt int32 OX\_COMMAND} & {\tt int32 SM\_setName} \\
        !           485: \hline
        !           486: \end{tabular}
        !           487: \\ Result: なし.
        !           488:
        !           489: \item
        !           490: \begin{verbatim}
        !           491: int xxx_evalName(char *name)
        !           492: \end{verbatim}
        !           493: (これは本当に必要な関数??)
        !           494: 現在の名前空間で変数 {\it name} を評価する.
        !           495: 評価の結果 {\it resultObj} をスタックへ戻す.
        !           496: 関数自体は正常終了なら 0 を, 異常終了なら -1 をもどす.
        !           497: TCP/IP の場合, 異常終了の場合のみ {\tt CMO\_ERROR2} を stack へ push する.
        !           498: \\ Stack before the request: (右が stack の top.)
        !           499: \begin{tabular}{|c|}  \hline
        !           500: {\it String name}  \\
        !           501: \hline
        !           502: \end{tabular}
        !           503: \\ Request:
        !           504: \begin{tabular}{|c|c|}  \hline
        !           505: {\tt int32 OX\_COMMAND} & {\tt int32 SM\_evalName} \\
        !           506: \hline
        !           507: \end{tabular}
        !           508: \\ Stack after the request: (右が stack の top.)
        !           509: \begin{tabular}{|c|}  \hline
        !           510: {\it resultObj} \\
        !           511: \hline
        !           512: \end{tabular}
        !           513: \\ Result:  なし.
        !           514:
        !           515: \item
        !           516: \begin{verbatim}
        !           517: int xxx_executeFunction(char *s, int n)
        !           518: \end{verbatim}
        !           519: スタックより {\it n} 個のデータを pop して, サーバのローカル関数
        !           520: {\it s} を実行する.
        !           521: エラーのときのみ {\tt CMO\_ERROR2} を stack へ push する.
        !           522: \\ Stack before the request: (右が stack の top.) \\
        !           523: \begin{tabular}{|c|c|c|c|c|}  \hline
        !           524: {\it objn} & $\cdots$ & {\it obj1} & {\it INT32 n} & {\it String s} \\
        !           525: \hline
        !           526: \end{tabular}
        !           527: \\ Request:
        !           528: \begin{tabular}{|c|c|}  \hline
        !           529: {\tt int32 OX\_COMMAND} & {\tt int32 SM\_executeFunction}  \\
        !           530: \hline
        !           531: \end{tabular}
        !           532: \\ Stack after the request:
        !           533: 関数実行の結果.
        !           534: \\ Result: なし.
        !           535:
        !           536:
        !           537:
        !           538:
        !           539:
        !           540: \item
        !           541: \begin{verbatim}
        !           542: bytes *xxx_popSerializedLocalObject(void)
        !           543: void popSerializedLocalObject(ox_stream out)
        !           544: \end{verbatim}
        !           545: 最初の関数はライブラリとしてリンクして使用するための関数である.
        !           546: スタックより pop した object を local 形式の serialization して
        !           547: byte 列で戻す.
        !           548: 2 番目の関数は Socket で通信するための同機能の関数であり,
        !           549: serialization された byte 列を
        !           550: {\tt ox\_stream out} へ出力する.
        !           551: この場合,
        !           552: header
        !           553: {\tt int32 OX\_DATA}, {\tt int32 CMO\_LOCAL\_OBJECT}
        !           554: をつけてから, byte 列を送る.
        !           555: この関数はおもに, homogeneous な分散システムで用いる.
        !           556: 次に, サーバスタックマシンの関数が実行されるまでは,
        !           557: 戻り object の内容は保証されないといけない.
        !           558:
        !           559: \item
        !           560: local serialized object, および サポートする CMO object を
        !           561: {\tt OX\_DATA} として受信した場合, {\tt OperandStack} へ
        !           562: push する.
        !           563: 受信エラーを起こしたときのみ, {\tt CMO\_ERROR2} を stack へ push する.
        !           564:
        !           565:
        !           566: \item
        !           567: \begin{verbatim}
        !           568: bytes *xxx_popCMO(void)
        !           569: void xxx_popCMO(ox_stream out)
        !           570: \end{verbatim}
        !           571:
        !           572: 最初の関数はライブラリとしてリンクして使用するための関数である.
        !           573: {\tt OperandStack} より object を pop し CMO 形式の
        !           574: serialized object を byte 列として戻す.
        !           575: 2 番目の関数は Socket で通信するための同機能の関数であり,
        !           576: {\tt ox\_stream out } へ, そのデータを header
        !           577: {\tt OX\_DATA}  をつけてながす.
        !           578: この関数はおもに, heterotic な分散システムで用いる.
        !           579: 次に, サーバスタックマシンの関数が実行されるまでは,
        !           580: 戻り object の内容は保証されないといけない.
        !           581: \\ Request:
        !           582: \begin{tabular}{|c|c|}  \hline
        !           583: {\tt int32 OX\_COMMAND} & {\tt int32 OX\_popCMO}  \\
        !           584: \hline
        !           585: \end{tabular}
        !           586: \\ Result:
        !           587: \begin{tabular}{|c|c|}  \hline
        !           588: {\tt int32 OX\_DATA} &   {\it Serialized CMO} \\
        !           589: \hline
        !           590: \end{tabular}
        !           591:
        !           592: 以下で, {\tt ox\_stream} はサンプルサーバの場合,
        !           593: \begin{verbatim}
        !           594: typedef FILE2 * ox_stream;
        !           595: \end{verbatim}
        !           596: である (cf. {\tt file2.h}). これは処理系によりちがってよい.
        !           597: {\tt ox\_asir} では, {\tt FILE *} を用いている.
        !           598:
        !           599: \end{enumerate}
        !           600:
        !           601: */
        !           602:

FreeBSD-CVSweb <freebsd-cvsweb@FreeBSD.org>