=================================================================== RCS file: /home/cvs/OpenXM/src/ox_toolkit/README,v retrieving revision 1.5 retrieving revision 1.10 diff -u -p -r1.5 -r1.10 --- OpenXM/src/ox_toolkit/README 1999/12/15 09:24:46 1.5 +++ OpenXM/src/ox_toolkit/README 2000/03/10 12:24:38 1.10 @@ -1,26 +1,31 @@ # Author: 小原功任 @ 金沢大学理学部計算科学教室 # URI: http://omega.s.kanazawa-u.ac.jp/ohara/ -# $OpenXM: OpenXM/src/ox_toolkit/README,v 1.4 1999/12/15 08:04:50 ohara Exp $ +# $OpenXM: OpenXM/src/ox_toolkit/README,v 1.9 2000/01/20 17:18:55 ohara Exp $ /*&ja ox_toolkit ユーザガイド */ -/*&en A user's guide for ox_toolkit. +/*&en A user's guide for OpenXM C library. */ +/* &ja いきさつ +このライブラリは ox_math および math2ox を開発するために設計された。 +ライブラリ自身には、 Mathematica に依存した部分はない。 +*/ +/* &en Introduction + +*/ /*&ja libox.a を利用するには次のヘッダファイルをインクルードする必要があります。 */ /*&en How to use OpenXM C library? -The OpenXM C libraiy has header files: +In order to use libox.a, you need to include the following header files: */ /*&common -#include -#include -#include +#include */ /*&ja @@ -35,7 +40,7 @@ The OpenXM C libraiy has header files: 1. Types 1.1 CMO (Common Math Object) -The following structures is defined in ox.h: +The following structures are defined in ox_toolkit.h: */ /*&common @@ -65,8 +70,8 @@ cmo_error2 */ /*&en -The cmo above is similer to abstract base class; -you never make an object of cmo class. +The cmo above is abstract base class; you never make an object of cmo +class. */ /*&ja @@ -75,7 +80,7 @@ you never make an object of cmo class. */ /*&en 1.2 OX objects -The following structures is defined in ox.h: +The following structures are defined in ox_toolkit.h: */ /*&common @@ -101,9 +106,8 @@ The ox above is abstract base class. /*&en 2. How to make CMObjects? -You may use new functions which generate an object and return its pointer. -*/ -/*&common +Use the following functions to generate an object. It returns a +pointer to the object. */ /*&common new_cmo_null(); new_cmo_int32(int i); @@ -136,11 +140,12 @@ new_cmo_error2(cmo* ob); /*&en 3. High-level API -High-level API is prepared for implementation of your OpenXM clients. +High-level API is prepared to help an implementation of OpenXM clients. -3.1 How to make connection to OpenXM server? +3.1 How to make connections to OpenXM servers? -You may call ox_start or ox_start_insecure_nonreverse. +In order to open a connection to an OpenXM server, you need to call +ox_start() or to call ox_start_insecure_nonreverse(). */ /*&common @@ -165,6 +170,15 @@ portStream は計算サーバとの通信のためのポート番号であ� この識別子は高水準 API の各関数で利用される。 */ +/*&en +The ox_start() function invoke an OpenXM server on its local machine +and open a connection to the server with "reverse" mode. The client +choose a port number of TCP/IP automatically. + +The ox_start_insecure_nonreverse() function open a connection to an +OpenXM server run on a remote host and you need to provide port numbers. + +*/ /*&ja 3.2 通信の終了 @@ -172,9 +186,10 @@ portStream は計算サーバとの通信のためのポート番号であ� */ /*&en -3.2 How to close connection to OpenXM server? +3.2 How to close connections to OpenXM servers? -You may call ox_close or ox_shutdown. +In order to close a connection to an OpenXM server, you need to call +ox_close() or to call ox_shutdown(). */ /*&common @@ -187,12 +202,12 @@ void ox_shutdown(ox_file_t sv); サーバを終了させる。第二の関数は計算サーバに SM_shutdown を送ることに よって、サーバを終了させる(予定)。 -/* +*/ /*&ja 3.3 SM コマンドの送信 */ /*&en -3.3 How to command to OpenXM stack machine? +3.3 How to command to OpenXM stack machines? */ /*&common @@ -201,57 +216,103 @@ void ox_push_cmd(ox_file_t sv, int sm_code); */ /*&ja サーバにスタックマシンコマンドを送る。コマンドはコマンド番号で与える。 + */ /*&en ox_push_cmd() sends an operation code to an OpenXM stack machine. -Table of opecode is defined in oxtag.h. +See OpenXM/include/ox_toolkit_tags.h for a list of operation codes. + */ /*&ja - 3.4 CMO の送受信 +*/ +/*&en +3.4 How to receive a CMO? +*/ +/*&common void ox_push_cmo(ox_file_t sv, cmo *c); cmo* ox_pop_cmo(ox_file_t sv); char* ox_popString(ox_file_t sv); +*/ +/*&ja ox_push_cmo は cmo を送信、ox_pop_cmo は cmo を受信する。ox_popString は cmo を文字列形式に変換して受信するが、変換の結果はサーバによって異 なる。 +*/ +/*&en +*/ +/*&ja 3.5 スタック処理 +*/ +/*&common int ox_pops(ox_file_t sv, int num); +*/ +/*&ja スタック上の num 個のオブジェクトを廃棄する。 -3.6 +*/ +/*&ja +3.6 通信路のフラッシュ +*/ +/*&common int ox_flush(ox_file_t sv); +*/ +/*&ja 通信路を flush する(実際には何もしない)。 -3.7 +*/ +/*&ja +3.7 通信の中断 +*/ +/*&common void ox_reset(ox_file_t sv); +*/ +/*&ja 計算を中断する。 -3.8 +*/ +/*&ja +3.8 ローカル言語で書かれたコマンドの評価 +*/ +/*&common void ox_execute_string(ox_file_t sv, char* str); +*/ +/*&ja サーバのローカル言語で書かれた命令を評価し、結果をスタックに積む。 -3.9 +*/ +/*&ja +3.9 関数呼び出し +*/ +/*&common -int ox_cmo_rpc(ox_file_t sv, char *function, int argc, cmo *argv[]); +int ox_cmo_rpc(ox_file_t sv, char *function, int argc, cmo *argv[]); +*/ +/*&ja function(argv[1], ...) を計算し、結果をスタックに積む。 -3.10 +*/ +/*&ja +3.10 Mathcap の受信 +*/ +/*&common cmo_mathcap* ox_mathcap(ox_file_t sv); +*/ +/*&ja Mathcap を受け取る。現在は Mathcap の処理はユーザプログラムに任されている。 いずれこの関数は廃止される予定。 */ @@ -270,9 +331,9 @@ In this section, ``fd'' is an identifier of an OpenXM In this section, ``fd'' is an identifier of an OpenXM connection. 4.1 How to decide a byte order of integers? + */ /*&common - int decideByteOrderServer(int fd, int order); */ @@ -284,13 +345,16 @@ int decideByteOrderServer(int fd, int order); (注意) クライアント側でのバイトオーダの設定は、高水準 API で自動的に行われる。 */ /*&en -You must call it when your OpenXM server is initialized. -This function always choose the network byte order for integers. +You need to call it when your OpenXM server is initialized. +This function always choose the network byte order +as an expression for integers. */ /*&common 4.2 +*/ +/*&common int send_int32(int fd, int integer); int receive_int32(int fd); @@ -307,6 +371,8 @@ receive_int32() reads 32bits integer from an OpenXM co 4.3 +*/ +/*&common int send_cmo(int fd, cmo* m); cmo* receive_cmo(int fd); @@ -323,6 +389,8 @@ receive_cmo() reads an CMObject from an OpenXM connect 4.4 +*/ +/*&common int next_serial(); */ @@ -330,12 +398,14 @@ int next_serial(); シリアルナンバを生成する。 */ /*&en -next_serial() generates serial number for ox message. +next_serial() generates a serial number for ox message. */ /*&common 4.5 +*/ +/*&common int send_ox_tag(int fd, int tag); int receive_ox_tag(int fd); @@ -346,19 +416,175 @@ fd から OX メッセージのヘッダ(tag+serial#)を読み込む。 fd から OX メッセージのヘッダ(tag+serial#)を読み込む。 */ /*&en -send_ox_tag() writes a tag and automatically generated serial number +send_ox_tag() writes a tag and an automatically generated serial number of an ox message to an OpenXM conection. -receive_ox_tag() reads a tag and serial number of an ox message. +receive_ox_tag() reads a tag and a serial number of an ox message. */ /*&common -4.6 +4.6 Sending OX messages. +*/ +/*&common int send_ox(int fd, ox* m); int send_ox_cmo(int fd, cmo* m); void send_ox_command(int fd, int sm_command); */ /*&ja -ox メッセージを送信する。 -*/ \ No newline at end of file +OX メッセージを送信する。 +*/ + +/*&ja + +5. OX expression パーサ + +*/ +/*&en + +5. Parser for OX expressions + +*/ +/*&ja +OpenXM C library には 文字列表現された OX expression および CMO +expression から、ox 構造体または cmo 構造体を生成するためのパーサが付 +属している。ここではこのパーサについて説明する。 +*/ +/*&en +We have a parser which generate an OX object or a CMO from a string +encoded OX/CMO expression. In this section, we explain the parser. +*/ +/*&en + +5.1 Setting an option +*/ +/*&ja + +5.1 オプション +*/ +/*&common + +int setflag_parse(int flag); + +*/ +/*&ja +setflag_parse(PFLAG_ADDREV) によって、CMO の短縮表現を許す。 +*/ +/*&en +We set an option for the parser. If we call +setflag_parse(PFLAG_ADDREV), then the parser admits external +expressios. +*/ +/*&en + +5.2 Initializing +*/ +/*&ja + +5.2 初期化 +*/ +/*&common + +int init_parser(char *str); + +*/ +/*&ja +パーサが処理すべき文字列をセットする。 +*/ +/*&en +We give the parser an OX/CMO expression, that is, a Lisp style string. +*/ +/*&en + +5.3 Getting an object +*/ +/*&ja + +5.3 結果を得る +*/ +/*&common + +cmo *parse(); + +*/ +/*&ja +Lisp 表現による OX expression, CMO expression の構文解析器。あらかじめ +設定された文字列を解析して ox 構造体、あるいは cmo 構造体を生成する。 +*/ +/*&en +The parser returns an OX/CMO object. If the given string is illegal, +then the parser returns NULL. +*/ +/*&ja + +7. 付属プログラムについて + +*/ +/*&en + +7. Sample programs. + +*/ +/*&common +testclient + +*/ +/*&ja +テスト用の小さな OpenXM クライアント。OX expression を入力して送信する +ことのみ可能。SM_popCMO, SM_popString を含むメッセージを送信した場合に +は、サーバから送られてくるメッセージを表示する。 + +*/ +/*&en +This is a small OpenXM client. We send an OX message by inputting an +OX expression and display data messages gotten from a server. + +*/ +/*&common +bconv + +*/ +/*&ja +バイトコードエンコーダ。OX expression あるいは CMO expression を入力す +ると、対応するバイト列を表示する。 + +*/ +/*&en +A byte code encoder. It shows a byte stream which corresponds to an +OX expression. + +*/ +/*&common +ox_Xsample + +*/ +/*&ja +GUI 表示する OpenXM サーバのサンプル。 + +*/ +/*&ja +8. 付録 + +8.1 ox.c における関数の命名規則 + +(1) receive_cmo 関数はCMOタグとデータ本体を受信する. この関数は CMOタ +グの値が事前に分からないときに使用する. 返り値として、cmo へのポインタ +を返す. +(2) receive_cmo_X 関数は, CMOタグを親の関数で受信してから呼び出される +関数で、データ本体のみを受信し、cmo_X へのポインタを返す. しかも、関 +数内部で new_cmo_X 関数を呼び出す. +(3) send_cmo 関数はCMOタグとデータ本体を送信する. +(4) send_cmo_X 関数はCMOタグを親の関数で送信してから呼び出される関数で、 +データ本体のみを送信する. +(5) ただし receive_ox_tag を除いて, receive_ox_X 関数は作らない. +receive_cmo を利用する. +(6) send_ox_X 関数は OX タグを含めて送信する. +(7) ox_X 関数は一連の送受信を含むより抽象的な操作を表現する. ox_X 関 +数は、第一引数として、ox_file_t型の変数 sv をとる. +(8) Y_cmo 関数と Y_cmo_X 関数の関係は次の通り: +まず Y_cmo 関数で cmo のタグを処理し、タグを除いた残りの部分をY_cmo_X +関数が処理する. cmo の内部に cmo_Z へのポインタがあるときには、その種 +類によらずに Y_cmo 関数を呼び出す. + +*/ +