=================================================================== RCS file: /home/cvs/OpenXM/doc/OpenXM-specs/stackmachine.tex,v retrieving revision 1.3 retrieving revision 1.14 diff -u -p -r1.3 -r1.14 --- OpenXM/doc/OpenXM-specs/stackmachine.tex 2000/01/21 08:44:55 1.3 +++ OpenXM/doc/OpenXM-specs/stackmachine.tex 2020/03/14 01:21:56 1.14 @@ -1,21 +1,22 @@ -//&jp \section{ OX スタックマシン } -//&eg \section{ OX stackmachine } (This section has not yet been translated.) - +%% $OpenXM: OpenXM/doc/OpenXM-specs/stackmachine.tex,v 1.13 2016/08/22 09:08:50 takayama Exp $ +//&jp \section{ OX ��鴻�帥����������激�� } +//&eg \section{ OX stack machine } +\label{sec:stackmachine} /*&jp -この節では, OX スタックマシン operator の説明 -(TCP/IP ソケット上での標準 encoding 法 を用いる), -および, サンプルサーバとリンクする場合または -open XM ライブラリとしてリンクして使用する場合の -ための C の関数の仕様を説明する. +������膀���с��, OX ��鴻�帥����������激�� operator ���茯���� +(TCP/IP ��純�宴�����筝���с��罔�羣� encoding 羈� ������������), +���������, ��泣�潟�������泣�若����������潟����������翫����障����� +open XM �����ゃ����������������������潟��������篏睡����������翫����� +��������� C �����∽�違��篁�罕����茯����������. -説明の前に, OX サーバスタックマシンの動作の原則を -説明しておく. -サーバスタックマシンは, -{\tt SM\_pop*} 系のスタックマシンコマンドがこないかぎり, -自発的にメッセージを送信することはない. -この原則に基づいて分散計算のプログラミングをおこなう. -イベントドリブンなプログラム法とはちがうことに -注意しよう. +茯�������������, OX ��泣�若����鴻�帥����������激�潟�����篏������������� +茯����������������. +��泣�若����鴻�帥����������激�潟��, +{\tt SM\_pop*} 膤祉����鴻�帥����������激�潟�潟����潟�����������������������, +�����榊�������<����祉�若�吾�����篆<��������������������. +�����������������冴�ャ����������h��膊������������違�������潟�違��������������. +��ゃ����潟�������������潟����������違�����羈���������<�������������� +羈�������������. */ /*&eg @@ -27,59 +28,60 @@ that for event-driven programming. that for event-driven programming. */ -//&jp \subsection{サーバスタックマシン } +//&jp \subsection{��泣�若����鴻�帥����������激�� } //&eg \subsection{Server stack machine} /*&jp -サンプルサーバである {\tt oxserver00.c} -は以下の仕様の C の関数を用意して, -{\tt nullstackmachine.c } を置き換えれば一応動作するはずである. +��泣�潟�������泣�若����с����� {\tt oxserver00.c} +���篁ヤ�����篁�罕���� C �����∽�違��������������, +{\tt nullstackmachine.c } ���臀���������������遺��綽����篏���������������с�����. */ /*&eg {\tt oxserver00.c} is implemented as a sample server. If you want to implement you own server, write the following functions and use them instead of -those in {\tt nullstackmachine.c }. +those in {\tt nullstackmachine.c}. */ -//&jp \subsubsection{サーバスタックマシンのグループ SMobject/Basic0 に属するオペレータ} -//&eg \subsubsection{Operators in the group SMobject/Basic0} +//&jp \subsubsection{��泣�若����鴻�帥����������激�潟����違����若�� SMobject/Primitive ���絮������������������若��} +//&eg \subsubsection{Operators in the group SMobject/Primitive} /*&jp \noindent -サーバスタックマシンは最低で1本のスタック +��泣�若����鴻�帥����������激�潟�����篏����1��������鴻�帥����� \begin{verbatim} Object xxx_OperandStack[SIZE]; \end{verbatim} -をもつ. ここで, {\tt Object} はそのシステム固有の Object 型で構わない. -CMObject は各サーバ固有のローカルオブジェクトに変換してスタックへプッ -シュしてよい. ただし変換, 逆変換を合成したものは恒等写像であることが -のぞましい. CMObject をどのように (local) Object に変換するか, Object -が受け付けるメッセージの定義は,各システムが独自にきめて文書化しておく -ものとする. つまりすべてのメッセージは, private である. たとえば, -{\tt add } のような基本的な メッセージにたいしても, OX スタックマシン -はなにもきめていない. 将来的には open math \cite{openmath} のように -CMObject に対する最大公約数的なメッセージの仕様をcontent dictionary -(CD) の形で定義したい. +���������. ���������, {\tt Object} �����������激�鴻�������堺����� Object �����ф�����������. +CMObject ��������泣�若����堺����������若�������������吾�с��������紊������������鴻�帥�������吾����� +��激�ャ�����������. ���������紊����, ���紊�������������������������������膈���������с�������������� +��������障�����. CMObject ������������������ (local) Object ���紊�������������, Object +���������篁���������<����祉�若�吾��絎�臂����,�����激�鴻�������������������������������後�������������� +���������������. ��ゃ�障�������鴻�������<����祉�若�吾��, private ��с�����. ������������, +{\tt add } ��������������堺�������� ��<����祉�若�吾�����������������, OX ��鴻�帥����������激�� +������������������������������. 絨���ョ�������� open math \cite{openmath} ������������ +CMObject ���絲障��������紊у��膣���亥�������<����祉�若�吾��篁�罕����content dictionary +(CD) ���綵≪�у��臂����������. -以下, \verb+ xxx_ + は誤解の恐れがないときは省略する. -\verb+ xxx_ + は local サーバシステムに固有の識別子である. -{\tt Asir} の場合は \verb+ Asir_ + を用いる. {\tt kan/sm1} の場合は -\verb+ Sm1_ + を用いる. 関数名, タグ名は長いので省略形を用いてもよい. +篁ヤ��, \verb+ xxx_ + ���茯よВ��������������������������������ャ�����. +\verb+ xxx_ + ��� local ��泣�若����激�鴻����������堺�����茘���ュ����с�����. +{\tt Asir} �����翫����� \verb+ Asir_ + ������������. {\tt kan/sm1} �����翫����� +\verb+ Sm1_ + ������������. ��∽�医��, ��帥�医�������激�������х����ュ就���������������������. -以下では次のようにパケットを記述する. 各フィールドは, -\fbox{データ型 \quad データ} なる形式 -で書く. たとえば, {\tt int32 OX\_DATA} は 32 bit network byte order -の数字 {\tt OX\_DATA}という意味である. ``イタリックで書かれているフィー -ルドは,定義が別のところでなされているか解釈に誤解のないような自然言語 -で説明されている object を表す.'' たとえば, {\it String commandName} -は, String データ型の local object {\it commandName} を意味する. (サー -バスタックマシン上の object は, CMO 形式の objectとは限らないことに注 -意. CMO 形式で書いてあっても, それはサーバスタックマシンのlocal 形式 -でスタック上にあると解釈して下さい.) +篁ヤ����с��罨<����������������宴��������荐�菴違�����. ��������c�若��������, +\fbox{�����若�水�� \quad �����若��} ������綵√�� +��ф�吾��. ������������, {\tt int32 OX\_DATA} ��� 32 bit network byte order +�����医�� {\tt OX\_DATA}��������������潟�с�����. ``��ゃ�帥����������ф�吾�������������������c�� +���������,絎�臂������ャ�������������с��������������������茹i�����茯よВ�����������������������区��茯� +��ц�������������������� object ���茵����.'' ������������, {\it String commandName} +���, String �����若�水����� local object {\it commandName} ��������潟�����. (��泣�� +�����鴻�帥����������激�割����� object ���, CMO 綵√����� object���������������������������羈� +���. CMO 綵√����ф�吾����������c�����, �����������泣�若����鴻�帥����������激�潟��local 綵√�� +��с�鴻�帥�����筝�������������茹i��������筝�������.) -すべてのサーバスタックマシンは以下の関数を実装していないといけない. - +�����鴻�������泣�若����鴻�帥����������激�潟��篁ヤ��������篏����絎�茖�������������������������������. +������篏����絲障��, ���������緇���������������鴻�帥����������倶�����腓冴��. ��潟�����������, +�勆�������������吾�с����������鴻�帥��������������������絲上��������. */ /*&eg @@ -90,39 +92,44 @@ machine. \end{verbatim} Here {\tt Object} may be local to the system {\tt xxx} wrapped by the stack machine. -That is, the server may translate CMObjects into local its -objects and push them onto the stack. However, it is preferable that +That is, the server may translate CMObjects into its local +objects and push them onto the stack. It is preferable that the composition of such a translation and its inverse is equal to the -identity map. The translation scheme is called the phrase book of the +identity map. The translation scheme is called the {\it phrase book} of the server and it should be documented for each stack machine. In OpenXM, -any message is private. In future we will provide a content +any message is private to a connection. In future we will provide a content dictionary (CD; see OpenMath \cite{openmath}) for basic specifications of CMObjects. In the following, \verb+ xxx_ + may be omitted if no confusion occurs. As the names of functions and tags are long, one may use abbreviated -names. Message packets are represented as follows. Each field is -shown as \fbox{data type \quad data}. For example {\tt int32 -OX\_DATA} denotes a number {\tt OX\_DATA} which is represented by a 32 -bit network byte order. If a field is displayed by italic characters, -it should be defined elsewhere or its meaning should be clear. For -example {\it String commandName} denotes a local object {\it -commandName} whose data type is String. Note that an object on the -stack may have a local data type even if it is represented as CMO. +names. Message packets are represented as follows. +Each field is shown as \fbox{data type \quad data}. For example {\tt +int32 OX\_DATA} denotes a number {\tt OX\_DATA} which is represented +by a 32 bit integer with the network byte order. If a field is +displayed by italic characters, it should be defined elsewhere or its +meaning should be clear. For example {\it String commandName} denotes +a local object {\it commandName} whose data type is String. Note that +an object on the stack may have a local data type even if it is +represented as CMO. + Any server stack machine has to implement the following operations. +For each operation we show the states of the stack before and after +the operation. In the figures the rightmost object corresponds to the +top of the stack. Only the modified part of the stack are shown. */ \begin{enumerate} \item /*&jp -CMObject/Basic0 の CMO データのうち必須のもの, {\tt CMO\_ERROR2}, {\tt -CMO\_NULL}, {\tt CMO\_INT32}, {\tt CMO\_STRING}, {\tt CMO\_LIST}がおく -られて来た場合それをスタックに push する. たとえば, {\tt CMO\_NULL} -あるいは {\tt CMO\_String} の場合次のようになる. +CMObject/Primitive ��� CMO �����若�帥�������≦��������������, {\tt CMO\_ERROR2}, {\tt +CMO\_NULL}, {\tt CMO\_INT32}, {\tt CMO\_STRING}, {\tt CMO\_LIST}��������� +�����������ャ����翫�������������鴻�帥�������� push ������. ������������, {\tt CMO\_NULL} +������������ {\tt CMO\_String} �����翫��罨<�����������������. */ /*&eg -Any server should accept CMObjects in the group CMObject/Basic0. +Any server should accept CMObjects in the group CMObject/Primitive. The server pushes such data onto the stack. The following examples show the states of the stack after receiving {\tt CMO\_NULL} or {\tt CMO\_String} respectively. @@ -140,9 +147,9 @@ Stack after the request: \hline \end{tabular} -Result: none. +Output: none. -Request: +Request:\\ \begin{tabular}{|c|c|c|c|c|c|} \hline {\tt int32 OX\_DATA} & {\tt int32 CMO\_String} &{\tt int32} {\rm size} &{\tt byte} {\rm s1} & $\cdots$ &{\tt byte} {\rm ssize}\\ @@ -155,24 +162,24 @@ Stack after the request: \hline \end{tabular} -Result: none. +Output: none. -//&jp CMO データの受け取りに失敗した時のみ \\ -//&eg If the server fails to receive a CMO data, +//&jp CMO �����若�帥�����������������紊掩����������������� \\ +//&eg If the server fails to receive a CMO data,\\ \begin{tabular}{|c|c|c|} \hline {\tt int32 OX\_DATA} & {\tt int32 CMO\_ERROR2} & {\it CMObject} ob\\ \hline \end{tabular} \\ /*&jp -をスタックへ push する. -現在のところ, ob には, \\ +�����鴻�帥�������� push ������. +�憜��������������, ob ������, \\ \centerline{ -[{\sl Integer32} OX パケット番号, {\sl Integer32} エラー番号, -{\sl CMObject} optional 情報] +[{\sl Integer32} OX �����宴�����������, {\sl Integer32} ��������主�����, +{\sl CMObject} optional ������] } -なるリストを入れる (CMO 形式でかいてあるが, これはサーバ独自の形式でよい. -CMO として送出されるときこのような形式でないといけないという意味である.) +�����������鴻�������ャ����� (CMO 綵√����с�����������������, �����������泣�若�����������綵√����с�����. +CMO ��������������冴�����������������������������綵√����с����������������������������������潟�с�����.) */ /*&eg is pushed onto the stack. @@ -188,10 +195,10 @@ SM_mathcap SM_mathcap \end{verbatim} /*&jp -このサーバの mathcap をもどす (termcap のまね). サーバのタイプ, サー -バスタックマシンの能力を知ることができる. C 言語で実装する場合は, -mathCap の構造体をシステム毎にきめるものとし,この関数はその構造体への -ポインタを戻す. (open sm1 では {\tt struct mathCap} を用いている. +��������泣�若����� mathcap ������������ (termcap �����障��). ��泣�若�������帥�ゃ��, ��泣�� +�����鴻�帥����������激�潟����遵�������ャ�������������с�����. C 荐�茯���у��茖���������翫�����, +mathcap ���罕����篏������激�鴻�����罸�������������������������,��������∽�違��������罕����篏���吾�� +�����ゃ�潟�帥����祉��. (open sm1 ��с�� {\tt struct mathcap} ������������������. */ /*&eg It requests a server to push the mathcap of the server. @@ -212,17 +219,17 @@ Stack after the request: \hline \end{tabular} -Result: none. +Output: none. \item \begin{verbatim} -SM_setMathCap +SM_setMathcap \end{verbatim} /*&jp -受け取った Mathcap {\tt m} を自分のシステムに設定して, 相手側が理解不 -能な CMO をおくらないようにする. C 言語で実装する場合は, mathCap の構 -造体をシステム毎にきめるものとし,この関数はその構造体へのポインタを引 -数とする. (open sm1 では {\tt struct mathCap} を用いている. +�����������c�� Mathcap {\tt m} ��������������激�鴻��������荐�絎�������, ��御����眼�����茹d�� +��純�� CMO ���������������������������������. C 荐�茯���у��茖���������翫�����, mathcap ���罕� +���篏������激�鴻�����罸�������������������������,��������∽�違��������罕����篏���吾�������ゃ�潟�帥��綣� +��違��������. (open sm1 ��с�� {\tt struct mathcap} ������������������. */ /*&eg It requests a server to register the peer's mathcap {\tt m} in the server. @@ -230,30 +237,35 @@ The server can avoid to send OX messages unknown to it */ @plugin/mathcap.h) +Stack before the request: +\begin{tabular}{|c|} \hline +{\it Mathcap m} \\ +\hline +\end{tabular}\\ Request: \begin{tabular}{|c|c|} \hline {\tt int32 OX\_DATA} & {\sl Mathcap} m \\ \hline -{\tt int32 OX\_COMMAND} & {\tt int32 SM\_setMathCap} \\ +{\tt int32 OX\_COMMAND} & {\tt int32 SM\_setMathcap} \\ \hline \end{tabular} -Result: none. +Output: none. /*&jp \noindent -注意: mathcap は一般にクライアント主体で設定する. -クライアントがサーバに {\tt SM\_mathcap} をおくり, -サーバ側の mathcap を得る. -それを, クライアントはそのサーバに付随した mathcap として -設定する. -次に, クライアントはサーバに自分の mathcap を -{\tt SM\_setMathCap} でおくり, 自分の mathcap を設定させる. +羈����: mathcap ���筝���������������ゃ�≪�潟��筝私����ц┃絎�������. +��������ゃ�≪�潟�������泣�若����� {\tt SM\_mathcap} ������������, +��泣�若����眼�� mathcap ���緇����. +���������, ��������ゃ�≪�潟�������������泣�若�����篁���������� mathcap ��������� +荐�絎�������. +罨<��, ��������ゃ�≪�潟�������泣�若�������������� mathcap ��� +{\tt SM\_setMathcap} ��с��������, ��������� mathcap ���荐�絎����������. */ /*&eg \noindent Remark: In general the exchange of mathcaps is triggered by a client. A client sends {\tt SM\_mathcap} to a server and obtains the server's mathcap. Then the client registers the mathcap. Finally the client -sends its own mathcap by {\tt SM\_setMathCap} and the server +sends its own mathcap by {\tt SM\_setMathcap} and the server registers it. */ @@ -262,24 +274,24 @@ SM_executeStringByLocalParser SM_executeStringByLocalParser \end{verbatim} /*&jp -文字列 {\tt s} を stack から pop し, -その文字列をシステム固有の文法(サーバスタックマシンの組み込みローカ -ル言語)にしたがったコマンドとして実行する. コマンドの実行の結 -果の最後に戻り値があるときは, {\tt OperandStack} に戻り値を push する. -OpenXM では, 現在のところ関数名の標準化はおこなっていない. -この関数および {\tt popString} の機能を実現すれば, 最低限の open XM の -サーバになれる. 実装では, まずこの二つの関数の機能を実現すべきである. +���絖���� {\tt s} ��� stack ������ pop ���, +���������絖���������激�鴻�������堺��������羈�(��泣�若����鴻�帥����������激�潟��腟���粋昭��帥����若�� +���荐�茯�)��������������c����潟����潟�����������絎�茵�������. ��潟����潟�����絎�茵����腟� +���������緇������祉����ゃ�����������������, {\tt OperandStack} �����祉����ゃ�� push ������. +OpenXM ��с��, �憜����������������∽�医�����罔�羣������������������c�����������. +��������∽�違�������� {\tt popString} ���罘���純��絎��憗��������, ���篏������� open XM ��� +��泣�若��������������. 絎�茖���с��, ��障��������篋���ゃ����∽�違��罘���純��絎��憗����鴻����с�����. */ /*&eg It requests a server to pop a character string {\tt s}, to parse it by the local parser of the stack machine, and -to interprete by the local interpreter. -If the exececution produces a result, it is pushed onto +to interpret by the local interpreter. +If the execution produces a Output, it is pushed onto {\tt OperandStack}. -If an error has occured, Error2 Object is pushed onto the stack. +If an error has occurred, Error2 Object is pushed onto the stack. OpenXM does not provide standard function names. If this operation and {\tt SM\_popString} is implemented, the stack machine -can be used as an OX server. +is ready to be used as an OX server. */ Stack before the request: @@ -295,13 +307,13 @@ Request: \hline \end{tabular} -Result: none. +Output: none. /*&jp \noindent -参考: \ 実行前のスタックのデータは, -{\it String commandString} なる local stackmachine の object としてス -タック上にあるが, TCP/IP の通信路では, 次のようなデータがまずながれて -{\it commandName} がスタックに push される: +������: \ 絎�茵���������鴻�帥�������������若�帥��, +{\it String commandString} ������ local stack machine ��� object ������������ +��帥�����筝�������������, TCP/IP ������篆∴君��с��, 罨<����������������若�帥����障�������������� +{\it commandName} �����鴻�帥�������� push ���������: */ /*&eg \noindent @@ -318,32 +330,32 @@ SM_executeStringByLocalParserInBatchMode SM_executeStringByLocalParserInBatchMode \end{verbatim} /*&jp -スタックに副作用がない(スタックにたいしてなんの操作もしない)ことを除き -上とまったく同じ関数である. エラーの時のみ, Error2 Object をスタック -へプッシュする. +��鴻�帥�����������篏�������������(��鴻�帥��������������������������������篏�������������)�����������ゃ�� +筝������障�c�������������∽�違�с�����. ��������若�����������, Error2 Object �����鴻�帥����� +��吾�������激�ャ�����. */ /*&eg This is the same request as {\tt SM\_executeStringByLocalParser} except that it does not modify the stack. It pushes an Error2 Object -if an error has occured. +if an error has occurred. */ \item \begin{verbatim} SM_popString \end{verbatim} /*&jp -{\tt OperandStack} より Object を pop し, それを xxx の出力規則にしたがい文 -字列型に変換して送信する. スタックが空のときは, {\tt (char *)NULL} を戻す. -文字列は TCP/IP stream へ CMO のデー -タとして送信する. エラーの場合は {\tt CMO\_ERROR2} を戻すべきである. +{\tt OperandStack} ������ Object ��� pop ���, ��������� xxx �����阪��荀���������������������� +絖����������紊�������������篆<�����. ��鴻�帥��������腥冴�����������, {\tt (char *)NULL} �����祉��. +���絖������� TCP/IP stream ��� CMO ��������� +��帥�����������篆<�����. ��������若����翫����� {\tt CMO\_ERROR2} �����祉����鴻����с�����. */ /*&eg It requests a server to pop an object from {\tt OperandStack}, to convert it into a character string according to the output format of the local system, and to send the character string via TCP/IP stream. {\tt (char *)NULL} is returned when the stack is empty. -The returned strings is sent as a CMO string data. -{\tt CMO\_ERROR2} should be returned if an error has occured. +The returned string is sent as a CMO string data. +{\tt CMO\_ERROR2} should be returned if an error has occurred. */ Stack before the request: @@ -358,7 +370,7 @@ Request: \hline \end{tabular} -Result: +Output: \begin{tabular}{|c|c|c|} \hline {\tt int32 OX\_DATA} & {\tt int32 CMO\_STRING} & {\it size and the string s} \\ \hline @@ -369,8 +381,8 @@ SM_getsp SM_getsp \end{verbatim} /*&jp -現在のスタックポインタの位置をもどす. スタート時点での位置は 0 であり, -object が push されたばあい, 1 づつ増えるものとする. +�憜�������鴻�帥����������ゃ�潟�帥��篏�臀�������������. ��鴻�帥�若�������鴻�с��篏�臀���� 0 ��с�����, +object ��� push �����������違�����, 1 ��ャ�ゅ�����������������������. */ /*&eg It requests a server to push the current stack pointer onto the stack. @@ -397,52 +409,81 @@ Stack after the request: \hline \end{tabular} -Result: none. +Output: none. \item \begin{verbatim} SM_dupErrors \end{verbatim} /*&jp -スタック上のエラーオブジェクトをリストにして戻す. スタック自体は変化 -させない. +��鴻�帥�����筝������������若�������吾�с�������������鴻�������������祉��. ��鴻�帥��������篏����紊���� +������������. */ /*&eg It requests a server to push a list object containing all error objects on the stack. */ -Stack before the request: -\begin{tabular}{|c|} \hline -{\it Object} \\ +Request: +\begin{tabular}{|c|c|} \hline +{\tt int32 OX\_COMMAND} & {\tt int32 SM\_dupErrors} \\ \hline \end{tabular} +Stack after the request: +\begin{tabular}{|c|c|c|} \hline +{\tt int32 OX\_DATA} & {\sl CMObject} \ a list of errors\\ +\hline +\end{tabular} + +Output: none. + +\item +\begin{verbatim} +SM_pushCMOtag +\end{verbatim} +/*&jp +��鴻�帥����������������������吾�с�������� CMO ���紊���������������翫����� CMO tag ��� +{\tt CMO\_INT32} �����������鴻�帥�������� push ������. +��������������吾�с����������鴻�帥�������������障��. +��������������吾�с��������CMO ��後�������������号�������<����翫�����, ��������� object ���腥����. +*/ +/*&eg +It requests a server to push the CMO tag of the top object on the server +stack. The tag is pushed as {\tt CMO\_INT32}. +The top object remains on the stack. +If there is no way to translate the object into CMO, +push an error object. +*/ + Request: \begin{tabular}{|c|c|} \hline -{\tt int32 OX\_COMMAND} & {\tt int32 SM\_dupErrors} \\ +{\tt int32 OX\_COMMAND} & {\tt int32 SM\_pushCMOtag} \\ \hline \end{tabular} Stack after the request: \begin{tabular}{|c|c|c|} \hline -{\tt int32 OX\_DATA} & {\sl CMObject} \ a list of errors\\ +{\tt int32 OX\_DATA} & {\sl CMO\_INT32} \ tag\\ \hline \end{tabular} -Result: none. +Output: none. \end{enumerate} \medbreak \noindent + +//&C \subsubsection{ MathCap } \label{subsubsection:mathcap} + /*&jp -{\bf 例}: \ -mathcap の問い合わせに対して, {\tt ox\_sm1} は次のように答える. +{\bf 箴�}: \ +mathcap ���������������������絲障�����, {\tt ox\_sm1} ���罨<�����������膈�������. */ /*&eg {\bf Example}: \ {\tt ox\_sm1} returns the following data as its mathcap. */ -%%Prog: [(cmoMathCap)] extension :: +%%Prog: [(cmoMathcap)] extension :: \begin{verbatim} Class.mathcap [ [199909080 , $Ox_system=ox_sm1.plain$ , $Version=2.990911$ , @@ -453,45 +494,149 @@ Class.mathcap \end{verbatim} /*&jp -mathcap は 3つの要素をもつリストである. まづ, 最初の要素を見よう. -Ox\_system は open xxx システム名である. 読み込むライブラリがちがって -いて, 関数名(または シンボル)の意味がちがうときはこの名前もかえる. た -とえば, open math の basic content dictionary 対応の関数定義マクロを読 -みこんだ sm1 は, ox\_sm1\_basicCD なる名前にする. HOSTTYPE値は, CPU -の種類をあらわしunix では環境変数\verb+$HOSTTYPE+ の値である. 2 番目 -の要素は 利用可能な SM コマンドをあつめたリストである. 3 番目のリスト -は, 処理可能な数学データの形式, およびCMOの場合なら処理可能なCMOのタグ -のリストが続く. 上の例では, 514 は {\tt OX\_DATA} をあらわし, 数学デー -タのフォマットは(サイズ情報なしの) CMO であることを示す. +mathcap ��� 3��や札筝����荀�膣���������ゃ����鴻����с�����. ��障��, ���������荀�膣�(��������������鴻��)���荀�������. +�����鴻����������������医����� OpenXM �����������潟����������若�吾�с�潟�с�����. +Ox\_system ��� openXM ��激�鴻����������с�����. 茯���粋昭��������ゃ�������������<����c�� +������, ��∽�医��(��障����� ��激�潟�����)��������潟����<��������������������������������������. ��� +���������, open math ��� basic content dictionary 絲上�������∽�医��臂�������������茯� +��帥�������� sm1 ���, ox\_sm1\_basicCD ���������������������. HOSTTYPE ��ゃ��, CPU +���腮�蕁����������������unix ��с����医��紊����\verb+$HOSTTYPE+ �����ゃ�с�����. 2 ������ +���荀�膣���� �����������純�� SM ��潟����潟����������ゃ����������鴻����с�����. 3 ��������������鴻�� +���, �����������純����医�������若�帥��綵√��, ���������CMO�����翫�������������������純��CMO�����帥�� +��������鴻�����膓����. 筝����箴���с��, 514 ��� {\tt OX\_DATA} ���������������, ��医�������� +��帥��������������������(��泣�ゃ�堺����宴��������) CMO ��с��������������腓冴��. +�����������������鴻����� optinal ���, CMO string ��������鴻����с�����. +���絖������� option���, ��障����� option���=���, ������綵√����т��������. +option ��������掩�医����������潟�≪�潟����若����若�ц��菴�. = 篁ヤ����� utf-8 ���絖���潟�若�����������������������. */ /*&eg -A mathcap has three components. The first one contains informations -to identify the system and hosts on which the application runs. -In the above example, Ox\_system denotes the system name. -HOSTTYPE represents the OS type and taken from \verb+$HOSTTYPE+ +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, +the system and hosts on which the application runs. +In the above example, {\tt Ox\_system} denotes the system name. +{\tt HOSTTYPE} represents the OS type and taken from \verb+$HOSTTYPE+ enviroment variable. The second component consists of avaiable SM commands. The third component is a list of pairs. Each pair consists -of an OX message tag and the available message tags. +of an OX message tag and the list of available message tags. Again in the above example, 514 is the value of {\tt OX\_DATA} and it indicates that the server accepts CMO (without size information) as mathematical data messages. In this case the subsequent 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 +\noindent +OpenXM/XML expression of the example above: +\begin{verbatim} + + + + + 4 + 001001003 + Ox_system=ox_sm1.plain + Version=2.990911 + HOSTTYPE=i386 + + + + 11 + 262 + 263 + ... + + + + 2 + + 1 + 514 + + + 21 + 2130706434 + 1 + .... + + + + + +\end{verbatim} +*/ + +/*&C +\noindent +Example of the use of the fourth argument (optional parameter). +\begin{verbatim} + + + + + 4 + 001001003 + Ox_system=ox_sm1.plain + Version=2.990911 + HOSTTYPE=i386 + + + + 11 + 262 + 263 + ... + + + + 2 + + 1 + 514 + + + 21 + 2130706434 + 1 + .... + + + + + 2 + no_ox_reset + opt_sample=Hello world. + + + + +\end{verbatim} +*/ + \medbreak + +//&jp \subsubsection{ 箴� } +//&eg \subsubsection{ Examples } + \noindent -//&jp {\bf 例}: \ +//&jp {\bf 箴�}: \ //&eg {\bf Example}: \ %%Prog: (ox.sm1) run sm1connectr [(oxWatch) ox.ccc] extension %%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. \begin{enumerate} \item {\tt executeStringByLocalParser("12345 ;");} /*&jp -は次のようなパケットに変換される. 各数字は 16進1バイトをあらわす. -{\tt xx(yy)} のなかの {\tt (yy)} は対応するアスキーコードをあわらす. +���罨<����������������宴��������紊�������������. �����医����� 16���1�����ゃ�����������������. +{\tt xx(yy)} ������������ {\tt (yy)} ���絲上����������≪�鴻����若�潟�若�����������������. */ /*&eg is converted into the following packet. Each number denotes @@ -504,7 +649,7 @@ one byte in hexadecimal representation. 0 0 2 1 0 0 1 c \end{verbatim} /*&jp -それぞれのデータの意味は次のとおりである. +��������������������若�帥�������潟��罨<�������������с�����. */ /*&eg Each data has the following meaning. @@ -517,7 +662,7 @@ Each data has the following meaning. 0 0 2 1 (OX_COMMAND) 0 0 1 c (SM_executeStringByLocalParser) \end{verbatim} -//&jp これを OXexpression で表記すると次のようになる. +//&jp ��������� OXexpression ��ц;荐����������罨<�����������������. //&eg This is expressed by OXexpression as follows. \begin{center} (OX\_DATA, (CMO\_STRING, 7, "12345 ;")) @@ -526,31 +671,31 @@ Each data has the following meaning. (OX\_COMMAND, (SM\_executeStringByLocalParser)) \end{center} -//&jp \item {\tt popString()} を要請するメッセージ: +//&jp \item {\tt popString()} ���荀�茫���������<����祉�若��: //&eg \item A message which requests {\tt SM\_popString}: \begin{verbatim} 0 0 2 1 (OX_COMMAND) 0 0 1 7 (SM_popString) \end{verbatim} -//&jp OXexpression では +//&jp OXexpression ��с�� //&eg In OXexpression it is represented as (OX\_COMMAND, (SM\_popString)). \noindent -//&jp これにたいして次の返答メッセージがくる. +//&jp ���������������������罨<��菴�膈���<����祉�若�吾��������. //&eg The server returns the following reply message: \begin{verbatim} 0 0 2 2 (OX_DATA) 0 0 0 4 (CMO_STRING) 0 0 0 5 (size) 31(1) 32(2) 33(3) 34(4) 35(5) \end{verbatim} -//&jp OXexpression でかくと, +//&jp OXexpression ��с��������, //&eg In OXexpression it is represented as (OX\_DATA, (CMO\_STRING, 7, "12345 ;")). \end{enumerate} -//&jp \subsubsection{グループ SMobject/Basic1 に属するオペレータ} -//&eg \subsubsection{Operators in the group SMobject/Basic1} +//&jp \subsubsection{��違����若�� SMobject/Basic ���絮������������������若��} +//&eg \subsubsection{Operators in the group SMobject/Basic} \begin{enumerate} \item @@ -558,18 +703,18 @@ SM_pops SM_pops \end{verbatim} /*&jp -operand stack より, {\it n} 個の元 ({\it obj1, obj2, $\ldots$, objn}) -を pop して捨てる. +operand stack ������, {\it n} ��������� ({\it obj1, obj2, $\ldots$, objn} +��� pop ���������������. */ /*&eg It requests a server to pop {\it n} and to discard elements {\it obj1, obj2, -$\ldots$, objn}) from the stack. +$\ldots$, objn} from the stack. */ -//&jp Stack before the request: (右が stack のトップである.) \\ -//&eg Stack before the request: (The rightmost one is the top of the stack.) \\ +//&jp Stack before the request: \\ +//&eg Stack before the request: \\ \begin{tabular}{|c|c|c|c|c|} \hline -{\it obj1} & {\it obj2} & $\cdots$ & {\it objn} &{\it INT32 n} \\ +{\it obj1} & {\it obj2} & $\cdots$ & {\it objn} &{\it Integer32 n} \\ \hline \end{tabular} @@ -579,7 +724,7 @@ Request: \hline \end{tabular} -Result: none. +Output: none. \item @@ -587,18 +732,19 @@ int SM_setName int SM_setName \end{verbatim} /*&jp -{\tt OperandStack} より {\it name} を pop し, つぎに{\tt OperandStack} -より {\it obj} を pop し, それを現在の名前空間で変数 {\it name} に -bind する. 正常終了なら 0 を, 異常終了なら -1 をもどす. TCP/IP によ -る通信では, 異常終了の時のみ, {\tt CMO\_ERROR2} をstack へ push する. +{\tt OperandStack} ������ {\it name} ��� pop ���, ��ゃ�����{\tt OperandStack} +������ {\it obj} ��� pop ���, ����������憜�����������腥咲����у����� {\it name} ��� +bind ������. 罩e幻腟�篋������� 0 ���, ��医幻腟�篋������� -1 ������������. TCP/IP ������ +������篆<�с��, ��医幻腟�篋�������������, {\tt CMO\_ERROR2} ���stack ��� push ������. */ /*&eg It requests a server to pop {\it name}, to pop {\it obj}, and to -bind {\it obj} to a variable {\it name} in the current name space. -If an error has occured {\tt CMO\_ERROR2} is pushed to the stack. +bind {\it obj} to a variable {\it name} in the current name space +of the server. +If an error has occurred {\tt CMO\_ERROR2} is pushed onto the stack. */ -//&jp Stack before the request: (右が stack の top.) -//&eg Stack before the request: (The rightmost one is the top of the stack.) +//&jp Stack before the request: +//&eg Stack before the request: \begin{tabular}{|c|c|} \hline {\it obj} & {\it String name} \\ \hline @@ -610,7 +756,7 @@ Request: \hline \end{tabular} -Result: none. +Output: none. \item \begin{verbatim} @@ -618,21 +764,21 @@ SM_evalName \end{verbatim} /*&jp -現在の名前空間で変数 {\it name} を評価する. 評価の結果 {\it -resultObj} をスタックへ戻す. 関数自体は正常終了なら 0 を, 異常終了な -ら -1 をもどす. TCP/IP の場合, 異常終了の場合のみ {\tt CMO\_ERROR2} -を stack へ push する. +�憜�����������腥咲����у����� {\it name} ���荅�箴<�����. 荅�箴<��腟���� {\it +OutputObj} �����鴻�帥�������御�祉��. ��∽�域��篏����罩e幻腟�篋������� 0 ���, ��医幻腟�篋���� +��� -1 ������������. TCP/IP �����翫��, ��医幻腟�篋������翫�������� {\tt CMO\_ERROR2} +��� stack ��� push ������. */ /*&eg It requests a server to pop {\it name} and to evaluate a variable -{\it name} in the current name space. The result of the evaluation -{\it resultObj} is pushed to the stack. -If an error has occured {\tt CMO\_ERROR2} is pushed to the stack. +{\it name} in the current name space. The Output of the evaluation +{\it OutputObj} is pushed to the stack. +If an error has occurred {\tt CMO\_ERROR2} is pushed onto the stack. */ -//&jp Stack before the request: (右が stack の top.) -//&eg Stack before the request: (The rightmost one is the top of the stack.) +//&jp Stack before the request: +//&eg Stack before the request: \begin{tabular}{|c|} \hline {\it String name} \\ \hline @@ -644,34 +790,34 @@ Request: \hline \end{tabular} -//&jp Stack after the request: (右が stack の top.) -//&eg Stack after the request: (The rightmost one is the top of the stack.) +//&jp Stack after the request: +//&eg Stack after the request: \begin{tabular}{|c|} \hline -{\it resultObj} \\ +{\it OutputObj} \\ \hline \end{tabular} -Result: none. +Output: none. \item \begin{verbatim} SM_executeFunction \end{verbatim} /*&jp -スタックより {\it n} 個のデータを pop して, サーバのローカル関数{\it -s} を実行する. エラーのときのみ {\tt CMO\_ERROR2} を stack へ push す -る. +��鴻�帥����������� {\it n} �����������若�帥�� pop ������, ��泣�若����������若�������∽��{\it +s} ���絎�茵�������. ��������若�������������� {\tt CMO\_ERROR2} ��� stack ��� push ��� +���. */ /*&eg It requests a server to pop {\it s} as a function name, 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 occured {\tt CMO\_ERROR2} is pushed to the stack. +If an error has occurred {\tt CMO\_ERROR2} is pushed to the stack. */ -//&jp Stack before the request: (右が stack の top.) \\ -//&eg Stack before the request: (右が stack の top.) \\ +//&jp Stack before the request: \\ +//&eg Stack before the request: \\ \begin{tabular}{|c|c|c|c|c|} \hline {\it objn} & $\cdots$ & {\it obj1} & {\it INT32 n} & {\it String s} \\ \hline @@ -683,10 +829,10 @@ Request: \hline \end{tabular} -//&jp Stack after the request: 関数実行の結果. -//&eg Stack after the request: The result of the execution. +//&jp Stack after the request: ��∽�医��茵����腟����. +//&eg Stack after the request: The Output of the execution. -Result: none. +Output: none. \item \begin{verbatim} @@ -694,10 +840,10 @@ SM_popSerializedLocalObject \end{verbatim} /*&jp -スタックより pop した object を local 形式で serialization して -OX message として stream へ出力する. OX message tag としては, -local 形式に対応したものが定義されていることが必要である. -この関数はおもに, homogeneous な分散システムで用いる. +��鴻�帥����������� pop ������ object ��� local 綵√����� serialization ������ +OX message ��������� stream ��後�阪��������. OX message tag ������������, +local 綵√�����絲上�����������������絎�臂�������������������������綽�荀���с�����. +��������∽�違�����������, homogeneous ��������c�激�鴻�������х��������. */ /*&eg It requests a sever to pop an object, to convert it into a @@ -715,8 +861,8 @@ SM_popCMO \end{verbatim} /*&jp -{\tt OperandStack} より object を pop し CMO 形式の serialized object を -stream へ header {\tt OX\_DATA} をつけてながす. +{\tt OperandStack} ������ object ��� pop ��� CMO 綵√����� serialized object ��� +stream ��� header {\tt OX\_DATA} �����ゃ��������������. */ /*&eg It requests a server to pop an object from the stack, to convert @@ -730,11 +876,57 @@ Request: \hline \end{tabular} -Result: +Output: \begin{tabular}{|c|c|} \hline {\tt int32 OX\_DATA} & {\it Serialized CMO} \\ \hline \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}