version 1.10, 2000/09/11 17:37:28 |
version 1.14, 2020/03/14 01:21:56 |
|
|
%% $OpenXM: OpenXM/doc/OpenXM-specs/stackmachine.tex,v 1.9 2000/09/09 21:59:13 takayama Exp $ |
%% $OpenXM: OpenXM/doc/OpenXM-specs/stackmachine.tex,v 1.13 2016/08/22 09:08:50 takayama Exp $ |
//&jp \section{ OX スタックマシン } |
//&jp \section{ OX 鴻帥激 } |
//&eg \section{ OX stack machine } |
//&eg \section{ OX stack machine } |
\label{sec:stackmachine} |
\label{sec:stackmachine} |
/*&jp |
/*&jp |
この節では, OX スタックマシン operator の説明 |
膀с, OX 鴻帥激 operator 茯 |
(TCP/IP ソケット上での標準 encoding 法 を用いる), |
(TCP/IP 純宴筝с罔羣 encoding 羈 ), |
および, サンプルサーバとリンクする場合または |
, 泣潟泣若潟翫障 |
open XM ライブラリとしてリンクして使用する場合の |
open XM ゃ潟篏睡翫 |
ための C の関数の仕様を説明する. |
C ∽違篁罕茯. |
|
|
説明の前に, OX サーバスタックマシンの動作の原則を |
茯, OX 泣若鴻帥激潟篏 |
説明しておく. |
茯. |
サーバスタックマシンは, |
泣若鴻帥激潟, |
{\tt SM\_pop*} 系のスタックマシンコマンドがこないかぎり, |
{\tt SM\_pop*} 膤祉鴻帥激潟潟潟, |
自発的にメッセージを送信することはない. |
榊<祉若吾篆<. |
この原則に基づいて分散計算のプログラミングをおこなう. |
冴ャh膊違潟違. |
イベントドリブンなプログラム法とはちがうことに |
ゃ潟潟違羈< |
注意しよう. |
羈. |
*/ |
*/ |
|
|
/*&eg |
/*&eg |
Line 28 commands. Note that the programming style should be d |
|
Line 28 commands. Note that the programming style should be d |
|
that for event-driven programming. |
that for event-driven programming. |
*/ |
*/ |
|
|
//&jp \subsection{サーバスタックマシン } |
//&jp \subsection{泣若鴻帥激 } |
//&eg \subsection{Server stack machine} |
//&eg \subsection{Server stack machine} |
|
|
/*&jp |
/*&jp |
サンプルサーバである {\tt oxserver00.c} |
泣潟泣若с {\tt oxserver00.c} |
は以下の仕様の C の関数を用意して, |
篁ヤ篁罕 C ∽違, |
{\tt nullstackmachine.c } を置き換えれば一応動作するはずである. |
{\tt nullstackmachine.c } 臀遺綽篏с. |
*/ |
*/ |
/*&eg |
/*&eg |
{\tt oxserver00.c} is implemented as a sample server. |
{\tt oxserver00.c} is implemented as a sample server. |
Line 43 write the following functions and use them instead of |
|
Line 43 write the following functions and use them instead of |
|
those in {\tt nullstackmachine.c}. |
those in {\tt nullstackmachine.c}. |
*/ |
*/ |
|
|
//&jp \subsubsection{サーバスタックマシンのグループ SMobject/Primitive に属するオペレータ} |
//&jp \subsubsection{泣若鴻帥激潟違若 SMobject/Primitive 絮若} |
//&eg \subsubsection{Operators in the group SMobject/Primitive} |
//&eg \subsubsection{Operators in the group SMobject/Primitive} |
|
|
/*&jp |
/*&jp |
\noindent |
\noindent |
サーバスタックマシンは最低で1本のスタック |
泣若鴻帥激潟篏1鴻帥 |
\begin{verbatim} |
\begin{verbatim} |
Object xxx_OperandStack[SIZE]; |
Object xxx_OperandStack[SIZE]; |
\end{verbatim} |
\end{verbatim} |
をもつ. ここで, {\tt Object} はそのシステム固有の Object 型で構わない. |
. , {\tt Object} 激鴻堺 Object ф. |
CMObject は各サーバ固有のローカルオブジェクトに変換してスタックへプッ |
CMObject 泣若堺若吾с紊鴻帥吾 |
シュしてよい. ただし変換, 逆変換を合成したものは恒等写像であることが |
激ャ. 紊, 紊膈с |
のぞましい. CMObject をどのように (local) Object に変換するか, Object |
障. CMObject (local) Object 紊, Object |
が受け付けるメッセージの定義は,各システムが独自にきめて文書化しておく |
篁<祉若吾絎臂,激鴻後 |
ものとする. つまりすべてのメッセージは, private である. たとえば, |
. ゃ障鴻<祉若吾, private с. , |
{\tt add } のような基本的な メッセージにたいしても, OX スタックマシン |
{\tt add } 堺 <祉若吾, OX 鴻帥激 |
はなにもきめていない. 将来的には open math \cite{openmath} のように |
. 絨ョ open math \cite{openmath} |
CMObject に対する最大公約数的なメッセージの仕様をcontent dictionary |
CMObject 絲障紊у膣亥<祉若吾篁罕content dictionary |
(CD) の形で定義したい. |
(CD) 綵≪у臂. |
|
|
以下, \verb+ xxx_ + は誤解の恐れがないときは省略する. |
篁ヤ, \verb+ xxx_ + 茯よВャ. |
\verb+ xxx_ + は local サーバシステムに固有の識別子である. |
\verb+ xxx_ + local 泣若激鴻堺茘ュс. |
{\tt Asir} の場合は \verb+ Asir_ + を用いる. {\tt kan/sm1} の場合は |
{\tt Asir} 翫 \verb+ Asir_ + . {\tt kan/sm1} 翫 |
\verb+ Sm1_ + を用いる. 関数名, タグ名は長いので省略形を用いてもよい. |
\verb+ Sm1_ + . ∽医, 帥医激хュ就. |
|
|
以下では次のようにパケットを記述する. 各フィールドは, |
篁ヤс罨<宴荐菴違. c若, |
\fbox{データ型 \quad データ} なる形式 |
\fbox{若水 \quad 若} 綵√ |
で書く. たとえば, {\tt int32 OX\_DATA} は 32 bit network byte order |
ф吾. , {\tt int32 OX\_DATA} 32 bit network byte order |
の数字 {\tt OX\_DATA}という意味である. ``イタリックで書かれているフィー |
医 {\tt OX\_DATA}潟с. ``ゃ帥ф吾c |
ルドは,定義が別のところでなされているか解釈に誤解のないような自然言語 |
,絎臂ャс茹i茯よВ区茯 |
で説明されている object を表す.'' たとえば, {\it String commandName} |
ц object 茵.'' , {\it String commandName} |
は, String データ型の local object {\it commandName} を意味する. (サー |
, String 若水 local object {\it commandName} 潟. (泣 |
バスタックマシン上の object は, CMO 形式の objectとは限らないことに注 |
鴻帥激割 object , CMO 綵√ object羈 |
意. CMO 形式で書いてあっても, それはサーバスタックマシンのlocal 形式 |
. CMO 綵√ф吾c, 泣若鴻帥激潟local 綵√ |
でスタック上にあると解釈して下さい.) |
с鴻帥筝茹i筝.) |
|
|
すべてのサーバスタックマシンは以下の操作を実装していないといけない. |
鴻泣若鴻帥激潟篁ヤ篏絎茖. |
各操作に対し, その前後におけるスタックの状態を示す. 図において, |
篏絲障, 緇鴻帥倶腓冴. 潟, |
右端のオブジェクトがスタックのトップに対応する. |
勆吾с鴻帥絲上. |
*/ |
*/ |
|
|
/*&eg |
/*&eg |
Line 123 top of the stack. Only the modified part of the stack |
|
Line 123 top of the stack. Only the modified part of the stack |
|
\begin{enumerate} |
\begin{enumerate} |
\item |
\item |
/*&jp |
/*&jp |
CMObject/Primitive の CMO データのうち必須のもの, {\tt CMO\_ERROR2}, {\tt |
CMObject/Primitive CMO 若帥≦, {\tt CMO\_ERROR2}, {\tt |
CMO\_NULL}, {\tt CMO\_INT32}, {\tt CMO\_STRING}, {\tt CMO\_LIST}がおく |
CMO\_NULL}, {\tt CMO\_INT32}, {\tt CMO\_STRING}, {\tt CMO\_LIST} |
られて来た場合それをスタックに push する. たとえば, {\tt CMO\_NULL} |
ャ翫鴻帥 push . , {\tt CMO\_NULL} |
あるいは {\tt CMO\_String} の場合次のようになる. |
{\tt CMO\_String} 翫罨<. |
*/ |
*/ |
/*&eg |
/*&eg |
Any server should accept CMObjects in the group CMObject/Primitive. |
Any server should accept CMObjects in the group CMObject/Primitive. |
Line 164 Stack after the request: |
|
Line 164 Stack after the request: |
|
|
|
Output: none. |
Output: none. |
|
|
//&jp CMO データの受け取りに失敗した時のみ \\ |
//&jp CMO 若帥紊掩 \\ |
//&eg If the server fails to receive a CMO data,\\ |
//&eg If the server fails to receive a CMO data,\\ |
\begin{tabular}{|c|c|c|} \hline |
\begin{tabular}{|c|c|c|} \hline |
{\tt int32 OX\_DATA} & {\tt int32 CMO\_ERROR2} & {\it CMObject} ob\\ |
{\tt int32 OX\_DATA} & {\tt int32 CMO\_ERROR2} & {\it CMObject} ob\\ |
|
|
\end{tabular} |
\end{tabular} |
\\ |
\\ |
/*&jp |
/*&jp |
をスタックへ push する. |
鴻帥 push . |
現在のところ, ob には, \\ |
憜, ob , \\ |
\centerline{ |
\centerline{ |
[{\sl Integer32} OX パケット番号, {\sl Integer32} エラー番号, |
[{\sl Integer32} OX 宴, {\sl Integer32} 主, |
{\sl CMObject} optional 情報] |
{\sl CMObject} optional ] |
} |
} |
なるリストを入れる (CMO 形式でかいてあるが, これはサーバ独自の形式でよい. |
鴻ャ (CMO 綵√с, 泣若綵√с. |
CMO として送出されるときこのような形式でないといけないという意味である.) |
CMO 冴綵√с潟с.) |
*/ |
*/ |
/*&eg |
/*&eg |
is pushed onto the stack. |
is pushed onto the stack. |
Line 195 Currently ob is a list\\ |
|
Line 195 Currently ob is a list\\ |
|
SM_mathcap |
SM_mathcap |
\end{verbatim} |
\end{verbatim} |
/*&jp |
/*&jp |
このサーバの mathcap をもどす (termcap のまね). サーバのタイプ, サー |
泣若 mathcap (termcap 障). 泣若帥ゃ, 泣 |
バスタックマシンの能力を知ることができる. C 言語で実装する場合は, |
鴻帥激潟遵ャс. C 荐茯у茖翫, |
mathcap の構造体をシステム毎にきめるものとし,この関数はその構造体への |
mathcap 罕篏激鴻罸,∽違罕篏吾 |
ポインタを戻す. (open sm1 では {\tt struct mathcap} を用いている. |
ゃ潟帥祉. (open sm1 с {\tt struct mathcap} . |
*/ |
*/ |
/*&eg |
/*&eg |
It requests a server to push the mathcap of the server. |
It requests a server to push the mathcap of the server. |
|
|
SM_setMathcap |
SM_setMathcap |
\end{verbatim} |
\end{verbatim} |
/*&jp |
/*&jp |
受け取った Mathcap {\tt m} を自分のシステムに設定して, 相手側が理解不 |
c Mathcap {\tt m} 激鴻荐絎, 御眼茹d |
能な CMO をおくらないようにする. C 言語で実装する場合は, mathcap の構 |
純 CMO . C 荐茯у茖翫, mathcap 罕 |
造体をシステム毎にきめるものとし,この関数はその構造体へのポインタを引 |
篏激鴻罸,∽違罕篏吾ゃ潟帥綣 |
数とする. (open sm1 では {\tt struct mathcap} を用いている. |
違. (open sm1 с {\tt struct mathcap} . |
*/ |
*/ |
/*&eg |
/*&eg |
It requests a server to register the peer's mathcap {\tt m} in the server. |
It requests a server to register the peer's mathcap {\tt m} in the server. |
|
|
Output: none. |
Output: none. |
/*&jp |
/*&jp |
\noindent |
\noindent |
注意: mathcap は一般にクライアント主体で設定する. |
羈: mathcap 筝ゃ≪潟筝私ц┃絎. |
クライアントがサーバに {\tt SM\_mathcap} をおくり, |
ゃ≪潟泣若 {\tt SM\_mathcap} , |
サーバ側の mathcap を得る. |
泣若眼 mathcap 緇. |
それを, クライアントはそのサーバに付随した mathcap として |
, ゃ≪潟泣若篁 mathcap |
設定する. |
荐絎. |
次に, クライアントはサーバに自分の mathcap を |
罨<, ゃ≪潟泣若 mathcap |
{\tt SM\_setMathcap} でおくり, 自分の mathcap を設定させる. |
{\tt SM\_setMathcap} с, mathcap 荐絎. |
*/ |
*/ |
/*&eg |
/*&eg |
\noindent |
\noindent |
|
|
SM_executeStringByLocalParser |
SM_executeStringByLocalParser |
\end{verbatim} |
\end{verbatim} |
/*&jp |
/*&jp |
文字列 {\tt s} を stack から pop し, |
絖 {\tt s} stack pop , |
その文字列をシステム固有の文法(サーバスタックマシンの組み込みローカ |
絖激鴻堺羈(泣若鴻帥激潟腟粋昭帥若 |
ル言語)にしたがったコマンドとして実行する. コマンドの実行の結 |
荐茯)c潟潟絎茵. 潟潟絎茵腟 |
果の最後に戻り値があるときは, {\tt OperandStack} に戻り値を push する. |
緇祉ゃ, {\tt OperandStack} 祉ゃ push . |
OpenXM では, 現在のところ関数名の標準化はおこなっていない. |
OpenXM с, 憜∽医罔羣c. |
この関数および {\tt popString} の機能を実現すれば, 最低限の open XM の |
∽違 {\tt popString} 罘純絎憗, 篏 open XM |
サーバになれる. 実装では, まずこの二つの関数の機能を実現すべきである. |
泣若. 絎茖с, 障篋ゃ∽違罘純絎憗鴻с. |
*/ |
*/ |
/*&eg |
/*&eg |
It requests a server to pop a character string {\tt s}, to |
It requests a server to pop a character string {\tt s}, to |
|
|
Output: none. |
Output: none. |
/*&jp |
/*&jp |
\noindent |
\noindent |
参考: \ 実行前のスタックのデータは, |
: \ 絎茵鴻帥若帥, |
{\it String commandString} なる local stack machine の object としてス |
{\it String commandString} local stack machine object |
タック上にあるが, TCP/IP の通信路では, 次のようなデータがまずながれて |
帥筝, TCP/IP 篆∴君с, 罨<若帥障 |
{\it commandName} がスタックに push される: |
{\it commandName} 鴻帥 push : |
*/ |
*/ |
/*&eg |
/*&eg |
\noindent |
\noindent |
Line 330 onto the stack. It is done by sending the following OX |
|
Line 330 onto the stack. It is done by sending the following OX |
|
SM_executeStringByLocalParserInBatchMode |
SM_executeStringByLocalParserInBatchMode |
\end{verbatim} |
\end{verbatim} |
/*&jp |
/*&jp |
スタックに副作用がない(スタックにたいしてなんの操作もしない)ことを除き |
鴻帥篏(鴻帥篏)ゃ |
上とまったく同じ関数である. エラーの時のみ, Error2 Object をスタック |
筝障c∽違с. 若, Error2 Object 鴻帥 |
へプッシュする. |
吾激ャ. |
*/ |
*/ |
/*&eg |
/*&eg |
This is the same request as {\tt SM\_executeStringByLocalParser} |
This is the same request as {\tt SM\_executeStringByLocalParser} |
Line 344 if an error has occurred. |
|
Line 344 if an error has occurred. |
|
SM_popString |
SM_popString |
\end{verbatim} |
\end{verbatim} |
/*&jp |
/*&jp |
{\tt OperandStack} より Object を pop し, それを xxx の出力規則にしたがい文 |
{\tt OperandStack} Object pop , xxx 阪荀 |
字列型に変換して送信する. スタックが空のときは, {\tt (char *)NULL} を戻す. |
絖紊篆<. 鴻帥腥冴, {\tt (char *)NULL} 祉. |
文字列は TCP/IP stream へ CMO のデー |
絖 TCP/IP stream CMO |
タとして送信する. エラーの場合は {\tt CMO\_ERROR2} を戻すべきである. |
帥篆<. 若翫 {\tt CMO\_ERROR2} 祉鴻с. |
*/ |
*/ |
/*&eg |
/*&eg |
It requests a server to pop an object from {\tt OperandStack}, |
It requests a server to pop an object from {\tt OperandStack}, |
|
|
SM_getsp |
SM_getsp |
\end{verbatim} |
\end{verbatim} |
/*&jp |
/*&jp |
現在のスタックポインタの位置をもどす. スタート時点での位置は 0 であり, |
憜鴻帥ゃ潟帥篏臀. 鴻帥若鴻с篏臀 0 с, |
object が push されたばあい, 1 づつ増えるものとする. |
object push 違, 1 ャゅ. |
*/ |
*/ |
/*&eg |
/*&eg |
It requests a server to push the current stack pointer onto the stack. |
It requests a server to push the current stack pointer onto the stack. |
|
|
SM_dupErrors |
SM_dupErrors |
\end{verbatim} |
\end{verbatim} |
/*&jp |
/*&jp |
スタック上のエラーオブジェクトをリストにして戻す. スタック自体は変化 |
鴻帥筝若吾с鴻祉. 鴻帥篏紊 |
させない. |
. |
*/ |
*/ |
/*&eg |
/*&eg |
It requests a server to push a list object containing all error objects on the stack. |
It requests a server to push a list object containing all error objects on the stack. |
|
|
SM_pushCMOtag |
SM_pushCMOtag |
\end{verbatim} |
\end{verbatim} |
/*&jp |
/*&jp |
スタックの先頭オブジェクトが CMO に変換された場合の CMO tag を |
鴻帥吾с CMO 紊翫 CMO tag |
{\tt CMO\_INT32} としてスタックへ push する. |
{\tt CMO\_INT32} 鴻帥 push . |
先頭オブジェクトはスタックに留まる. |
吾с鴻帥障. |
先頭オブジェクトをCMO へ変換する方法が無い場合は, エラー object を積む. |
吾сCMO 後号<翫, object 腥. |
*/ |
*/ |
/*&eg |
/*&eg |
It requests a server to push the CMO tag of the top object on the server |
It requests a server to push the CMO tag of the top object on the server |
|
|
//&C \subsubsection{ MathCap } \label{subsubsection:mathcap} |
//&C \subsubsection{ MathCap } \label{subsubsection:mathcap} |
|
|
/*&jp |
/*&jp |
{\bf 例}: \ |
{\bf 箴}: \ |
mathcap の問い合わせに対して, {\tt ox\_sm1} は次のように答える. |
mathcap 絲障, {\tt ox\_sm1} 罨<膈. |
*/ |
*/ |
/*&eg |
/*&eg |
{\bf Example}: \ |
{\bf Example}: \ |
|
|
\end{verbatim} |
\end{verbatim} |
|
|
/*&jp |
/*&jp |
mathcap は 3つの要素をもつリストである. まづ, 最初の要素を見よう. |
mathcap 3や札筝荀膣ゃ鴻с. 障, 荀膣(鴻)荀. |
最初の数字は OpenXM プロトコルのバージョンである. |
鴻医 OpenXM 潟若吾с潟с. |
現在では 1.1.3 等のバージョンが 001001003 と数字にエンコードされて |
Ox\_system openXM 激鴻с. 茯粋昭ゃ<c |
ここに格納される. |
, ∽医(障 激潟)潟<. |
Ox\_system は openXM システム名である. 読み込むライブラリがちがって |
, open math basic content dictionary 絲上∽医臂茯 |
いて, 関数名(または シンボル)の意味がちがうときはこの名前もかえる. た |
帥 sm1 , ox\_sm1\_basicCD . HOSTTYPE ゃ, CPU |
とえば, open math の basic content dictionary 対応の関数定義マクロを読 |
腮蕁unix с医紊\verb+$HOSTTYPE+ ゃс. 2 |
みこんだ sm1 は, ox\_sm1\_basicCD なる名前にする. HOSTTYPE 値は, CPU |
荀膣 純 SM 潟潟ゃ鴻с. 3 鴻 |
の種類をあらわしunix では環境変数\verb+$HOSTTYPE+ の値である. 2 番目 |
, 純医若帥綵√, CMO翫純CMO帥 |
の要素は 利用可能な SM コマンドをあつめたリストである. 3 番目のリスト |
鴻膓. 筝箴с, 514 {\tt OX\_DATA} , 医 |
は, 処理可能な数学データの形式, およびCMOの場合なら処理可能なCMOのタグ |
帥(泣ゃ堺宴) CMO с腓冴. |
のリストが続く. 上の例では, 514 は {\tt OX\_DATA} をあらわし, 数学デー |
鴻 optinal , CMO string 鴻с. |
タのフォマットは(サイズ情報なしの) CMO であることを示す. |
絖 option, 障 option=, 綵√т. |
|
option 掩医潟≪潟若若ц菴. = 篁ヤ utf-8 絖潟若. |
*/ |
*/ |
/*&eg |
/*&eg |
A mathcap has three components. The first one contains informations |
A mathcap has three or more than three components. |
|
The first one, which is also a list, |
|
contains informations |
to identify the version number of the OpenXM protocol, |
to identify the version number of the OpenXM protocol, |
the system and hosts on which the application runs. |
the system and hosts on which the application runs. |
In the above example, {\tt Ox\_system} denotes the system name. |
In the above example, {\tt Ox\_system} denotes the system name. |
Line 522 Again in the above example, 514 is the value of {\tt O |
|
Line 525 Again in the above example, 514 is the value of {\tt O |
|
and it indicates that the server accepts CMO (without size information) |
and it indicates that the server accepts CMO (without size information) |
as mathematical data messages. In this case the subsequent |
as mathematical data messages. In this case the subsequent |
list represents available CMO tags. |
list represents available CMO tags. |
|
The fourth list is optinal. |
|
This is a list of cmo strings. |
|
Each string has the formats ``an option name'' or ``an optionname=value''. |
|
The option name must consists only of alphabets, numbers, and under bars. |
|
The symbol = may be followed by a string in the utf-8 character codes. |
*/ |
*/ |
|
|
/*&C |
/*&C |
Line 565 OpenXM/XML expression of the example above: |
|
Line 573 OpenXM/XML expression of the example above: |
|
\end{verbatim} |
\end{verbatim} |
*/ |
*/ |
|
|
|
/*&C |
|
\noindent |
|
Example of the use of the fourth argument (optional parameter). |
|
\begin{verbatim} |
|
<cmo_mathcap> |
|
<cmo_list for="mathcap"> |
|
|
|
<cmo_list> |
|
<int32 for="length"> 4 </int32> |
|
<cmo_int32 for="Protocol version"> 001001003 </cmo_int32> |
|
<cmo_string for="system name"> Ox_system=ox_sm1.plain </cmo_string> |
|
<cmo_string for="system version"> Version=2.990911 </cmo_string> |
|
<cmo_string for="hosttype"> HOSTTYPE=i386 </cmo_string> |
|
</cmo_list> |
|
|
|
<cmo_list for="Available SM tags"> |
|
<int32 for="length"> 11 </int32> |
|
<cmo_int32> 262 </cmo_int32> |
|
<cmo_int32> 263 </cmo_int32> |
|
... |
|
</cmo_list> |
|
|
|
<cmo_list for="Available OX_DATA tags"> |
|
<int32 for="length"> 2 </int32> |
|
<cmo_list for="OX_DATA tag"> |
|
<int32 for="length"> 1 </int32> |
|
<cmo_int32 comment="OX_DATA"> 514 </cmo_int32> |
|
</cmo_list> |
|
<cmo_list for="Available CMO tags"> |
|
<int32 for="length"> 21 </int32> |
|
<cmo_int32 comment="CMO_ERROR2"> 2130706434 </cmo_int32> |
|
<cmo_int32 comment="CMO_NULL"> 1 </cmo_int32> |
|
.... |
|
</cmo_list> |
|
</cmo_list> |
|
|
|
<cmo_list for="optional info"> |
|
<int32 for="length"> 2 </int32> |
|
<cmo_string> no_ox_reset </cmo_string> |
|
<cmo_string> opt_sample=Hello world. </cmo_string> |
|
</cmo_list> |
|
|
|
</cmo_list> |
|
</cmo_mathcap> |
|
\end{verbatim} |
|
*/ |
|
|
\medbreak |
\medbreak |
|
|
//&jp \subsubsection{ 例 } |
//&jp \subsubsection{ 箴 } |
//&eg \subsubsection{ Examples } |
//&eg \subsubsection{ Examples } |
|
|
\noindent |
\noindent |
//&jp {\bf 例}: \ |
//&jp {\bf 箴}: \ |
//&eg {\bf Example}: \ |
//&eg {\bf Example}: \ |
%%Prog: (ox.sm1) run sm1connectr [(oxWatch) ox.ccc] extension |
%%Prog: (ox.sm1) run sm1connectr [(oxWatch) ox.ccc] extension |
%%Prog: ox.ccc (122345; ) oxsubmit ; |
%%Prog: ox.ccc (122345; ) oxsubmit ; |
//&jp {\tt message\_body} の実例をあげる. シリアル番号部は除いてある. |
//&jp {\tt message\_body} 絎箴. 激≪埌ゃ. |
//&eg We show examples of {\tt message\_body}. Serial numbers are omitted. |
//&eg We show examples of {\tt message\_body}. Serial numbers are omitted. |
\begin{enumerate} |
\begin{enumerate} |
\item {\tt executeStringByLocalParser("12345 ;");} |
\item {\tt executeStringByLocalParser("12345 ;");} |
/*&jp |
/*&jp |
は次のようなパケットに変換される. 各数字は 16進1バイトをあらわす. |
罨<宴紊. 医 161ゃ. |
{\tt xx(yy)} のなかの {\tt (yy)} は対応するアスキーコードをあわらす. |
{\tt xx(yy)} {\tt (yy)} 絲上≪鴻若潟若. |
*/ |
*/ |
/*&eg |
/*&eg |
is converted into the following packet. Each number denotes |
is converted into the following packet. Each number denotes |
Line 594 one byte in hexadecimal representation. |
|
Line 649 one byte in hexadecimal representation. |
|
0 0 2 1 0 0 1 c |
0 0 2 1 0 0 1 c |
\end{verbatim} |
\end{verbatim} |
/*&jp |
/*&jp |
それぞれのデータの意味は次のとおりである. |
若帥潟罨<с. |
*/ |
*/ |
/*&eg |
/*&eg |
Each data has the following meaning. |
Each data has the following meaning. |
Line 607 Each data has the following meaning. |
|
Line 662 Each data has the following meaning. |
|
0 0 2 1 (OX_COMMAND) |
0 0 2 1 (OX_COMMAND) |
0 0 1 c (SM_executeStringByLocalParser) |
0 0 1 c (SM_executeStringByLocalParser) |
\end{verbatim} |
\end{verbatim} |
//&jp これを OXexpression で表記すると次のようになる. |
//&jp OXexpression ц;荐罨<. |
//&eg This is expressed by OXexpression as follows. |
//&eg This is expressed by OXexpression as follows. |
\begin{center} |
\begin{center} |
(OX\_DATA, (CMO\_STRING, 7, "12345 ;")) |
(OX\_DATA, (CMO\_STRING, 7, "12345 ;")) |
Line 616 Each data has the following meaning. |
|
Line 671 Each data has the following meaning. |
|
(OX\_COMMAND, (SM\_executeStringByLocalParser)) |
(OX\_COMMAND, (SM\_executeStringByLocalParser)) |
\end{center} |
\end{center} |
|
|
//&jp \item {\tt popString()} を要請するメッセージ: |
//&jp \item {\tt popString()} 荀茫<祉若: |
//&eg \item A message which requests {\tt SM\_popString}: |
//&eg \item A message which requests {\tt SM\_popString}: |
\begin{verbatim} |
\begin{verbatim} |
0 0 2 1 (OX_COMMAND) |
0 0 2 1 (OX_COMMAND) |
0 0 1 7 (SM_popString) |
0 0 1 7 (SM_popString) |
\end{verbatim} |
\end{verbatim} |
//&jp OXexpression では |
//&jp OXexpression с |
//&eg In OXexpression it is represented as |
//&eg In OXexpression it is represented as |
(OX\_COMMAND, (SM\_popString)). |
(OX\_COMMAND, (SM\_popString)). |
|
|
\noindent |
\noindent |
//&jp これにたいして次の返答メッセージがくる. |
//&jp 罨<菴膈<祉若吾. |
//&eg The server returns the following reply message: |
//&eg The server returns the following reply message: |
\begin{verbatim} |
\begin{verbatim} |
0 0 2 2 (OX_DATA) |
0 0 2 2 (OX_DATA) |
0 0 0 4 (CMO_STRING) 0 0 0 5 (size) |
0 0 0 4 (CMO_STRING) 0 0 0 5 (size) |
31(1) 32(2) 33(3) 34(4) 35(5) |
31(1) 32(2) 33(3) 34(4) 35(5) |
\end{verbatim} |
\end{verbatim} |
//&jp OXexpression でかくと, |
//&jp OXexpression с, |
//&eg In OXexpression it is represented as |
//&eg In OXexpression it is represented as |
(OX\_DATA, (CMO\_STRING, 7, "12345 ;")). |
(OX\_DATA, (CMO\_STRING, 7, "12345 ;")). |
\end{enumerate} |
\end{enumerate} |
|
|
//&jp \subsubsection{グループ SMobject/Basic に属するオペレータ} |
//&jp \subsubsection{違若 SMobject/Basic 絮若} |
//&eg \subsubsection{Operators in the group SMobject/Basic} |
//&eg \subsubsection{Operators in the group SMobject/Basic} |
|
|
\begin{enumerate} |
\begin{enumerate} |
Line 648 Each data has the following meaning. |
|
Line 703 Each data has the following meaning. |
|
SM_pops |
SM_pops |
\end{verbatim} |
\end{verbatim} |
/*&jp |
/*&jp |
operand stack より, {\it n} 個の元 ({\it obj1, obj2, $\ldots$, objn} |
operand stack , {\it n} ({\it obj1, obj2, $\ldots$, objn} |
を pop して捨てる. |
pop . |
*/ |
*/ |
/*&eg |
/*&eg |
It requests a server to pop {\it n} and to discard elements {\it obj1, obj2, |
It requests a server to pop {\it n} and to discard elements {\it obj1, obj2, |
|
|
int SM_setName |
int SM_setName |
\end{verbatim} |
\end{verbatim} |
/*&jp |
/*&jp |
{\tt OperandStack} より {\it name} を pop し, つぎに{\tt OperandStack} |
{\tt OperandStack} {\it name} pop , ゃ{\tt OperandStack} |
より {\it obj} を pop し, それを現在の名前空間で変数 {\it name} に |
{\it obj} pop , 憜腥咲у {\it name} |
bind する. 正常終了なら 0 を, 異常終了なら -1 をもどす. TCP/IP によ |
bind . 罩e幻腟篋 0 , 医幻腟篋 -1 . TCP/IP |
る通信では, 異常終了の時のみ, {\tt CMO\_ERROR2} をstack へ push する. |
篆<с, 医幻腟篋, {\tt CMO\_ERROR2} stack push . |
*/ |
*/ |
/*&eg |
/*&eg |
It requests a server to pop {\it name}, to pop {\it obj}, and to |
It requests a server to pop {\it name}, to pop {\it obj}, and to |
|
|
\end{verbatim} |
\end{verbatim} |
|
|
/*&jp |
/*&jp |
現在の名前空間で変数 {\it name} を評価する. 評価の結果 {\it |
憜腥咲у {\it name} 荅箴<. 荅箴<腟 {\it |
OutputObj} をスタックへ戻す. 関数自体は正常終了なら 0 を, 異常終了な |
OutputObj} 鴻帥御祉. ∽域篏罩e幻腟篋 0 , 医幻腟篋 |
ら -1 をもどす. TCP/IP の場合, 異常終了の場合のみ {\tt CMO\_ERROR2} |
-1 . TCP/IP 翫, 医幻腟篋翫 {\tt CMO\_ERROR2} |
を stack へ push する. |
stack push . |
*/ |
*/ |
|
|
/*&eg |
/*&eg |
|
|
SM_executeFunction |
SM_executeFunction |
\end{verbatim} |
\end{verbatim} |
/*&jp |
/*&jp |
スタックより {\it n} 個のデータを pop して, サーバのローカル関数{\it |
鴻帥 {\it n} 若帥 pop , 泣若若∽{\it |
s} を実行する. エラーのときのみ {\tt CMO\_ERROR2} を stack へ push す |
s} 絎茵. 若 {\tt CMO\_ERROR2} stack push |
る. |
. |
*/ |
*/ |
/*&eg |
/*&eg |
It requests a server to pop {\it s} as a function name, |
It requests a server to pop {\it s} as a function name, |
|
|
\hline |
\hline |
\end{tabular} |
\end{tabular} |
|
|
//&jp Stack after the request: 関数実行の結果. |
//&jp Stack after the request: ∽医茵腟. |
//&eg Stack after the request: The Output of the execution. |
//&eg Stack after the request: The Output of the execution. |
|
|
Output: none. |
Output: none. |
Line 785 SM_popSerializedLocalObject |
|
Line 840 SM_popSerializedLocalObject |
|
\end{verbatim} |
\end{verbatim} |
|
|
/*&jp |
/*&jp |
スタックより pop した object を local 形式で serialization して |
鴻帥 pop object local 綵√ serialization |
OX message として stream へ出力する. OX message tag としては, |
OX message stream 後阪. OX message tag , |
local 形式に対応したものが定義されていることが必要である. |
local 綵√絲上絎臂綽荀с. |
この関数はおもに, homogeneous な分散システムで用いる. |
∽違, homogeneous c激鴻х. |
*/ |
*/ |
/*&eg |
/*&eg |
It requests a sever to pop an object, to convert it into a |
It requests a sever to pop an object, to convert it into a |
|
|
\end{verbatim} |
\end{verbatim} |
|
|
/*&jp |
/*&jp |
{\tt OperandStack} より object を pop し CMO 形式の serialized object を |
{\tt OperandStack} object pop CMO 綵√ serialized object |
stream へ header {\tt OX\_DATA} をつけてながす. |
stream header {\tt OX\_DATA} ゃ. |
*/ |
*/ |
/*&eg |
/*&eg |
It requests a server to pop an object from the stack, to convert |
It requests a server to pop an object from the stack, to convert |
|
|
{\tt int32 OX\_DATA} & {\it Serialized CMO} \\ |
{\tt int32 OX\_DATA} & {\it Serialized CMO} \\ |
\hline |
\hline |
\end{tabular} |
\end{tabular} |
|
|
|
|
|
\item |
|
\begin{verbatim} |
|
SM_executeFunctionWithOptionalArgument |
|
\end{verbatim} |
|
/*&jp |
|
鴻帥 {\it n} 若帥割ゃ optional 綣 {\it opt} pop , |
|
泣若若∽{\it s} 絎茵. 若 {\tt CMO\_ERROR2} stack push |
|
. |
|
{\it opt} 若若ゃ鴻鴻с. 若若絖с. |
|
*/ |
|
/*&eg |
|
It requests a server to pop {\it s} as a function name, |
|
to pop an optional argument {\it opt}, |
|
to pop {\it n} as the number of arguments and to execute |
|
a local function {\it s} with {\it n} arguments popped from |
|
the stack. |
|
If an error has occurred {\tt CMO\_ERROR2} is pushed to the stack. |
|
{\it opt} is a list of lists of a keyword and a value. |
|
Keywords are strings. |
|
*/ |
|
|
|
//&jp Stack before the request: \\ |
|
//&eg Stack before the request: \\ |
|
\begin{tabular}{|c|c|c|c|c|c|} \hline |
|
{\it objn} & $\cdots$ & {\it obj1} & {\it INT32 n} & {\it Obj opt} & {\it String s} \\ |
|
\hline |
|
\end{tabular} |
|
|
|
Request: |
|
\begin{tabular}{|c|c|} \hline |
|
{\tt int32 OX\_COMMAND} & {\tt int32 SM\_executeFunctionWithOptionalArgument} \\ |
|
\hline |
|
\end{tabular} |
|
|
|
//&jp Stack after the request: ∽医茵腟. |
|
//&eg Stack after the request: The Output of the execution. |
|
|
|
Output: none. |
|
|
|
\noindent |
|
Example of {\it opt} : \verb@ (("p", 13),("vars",("x","y")))@ |
|
|
|
\noindent |
|
[Added in 2004-3-8] |
|
|
\end{enumerate} |
\end{enumerate} |
|
|