| version 1.4, 1999/12/15 08:04:50 |
version 1.7, 2000/01/14 10:23:34 |
|
|
| # Author: 小原功任 @ 金沢大学理学部計算科学教室 |
# Author: 小原功任 @ 金沢大学理学部計算科学教室 |
| # URI: http://omega.s.kanazawa-u.ac.jp/ohara/ |
# URI: http://omega.s.kanazawa-u.ac.jp/ohara/ |
| # $OpenXM: OpenXM/src/ox_toolkit/README,v 1.3 1999/12/15 02:44:12 ohara Exp $ |
# $OpenXM: OpenXM/src/ox_toolkit/README,v 1.6 1999/12/22 11:29:15 ohara Exp $ |
| |
|
| /*&ja ox_toolkit ユーザガイド |
/*&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 |
/*&ja |
| libox.a を利用するには次のヘッダファイルをインクルードする必要があります。 |
libox.a を利用するには次のヘッダファイルをインクルードする必要があります。 |
| */ |
*/ |
| /*&en |
/*&en |
| How to use OpenXM C library? |
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 |
/*&common |
| |
|
| Line 35 The OpenXM C libraiy has header files: |
|
| Line 42 The OpenXM C libraiy has header files: |
|
| 1. Types |
1. Types |
| |
|
| 1.1 CMO (Common Math Object) |
1.1 CMO (Common Math Object) |
| The following structures is defined in ox.h: |
The following structures are defined in ox.h: |
| */ |
*/ |
| /*&common |
/*&common |
| |
|
|
|
| |
|
| */ |
*/ |
| /*&en |
/*&en |
| The cmo above is similer to abstract base class; |
The cmo above is abstract base class; you never make an object of cmo |
| you never make an object of cmo class. |
class. |
| |
|
| */ |
*/ |
| /*&ja |
/*&ja |
| Line 75 you never make an object of cmo class. |
|
| Line 82 you never make an object of cmo class. |
|
| */ |
*/ |
| /*&en |
/*&en |
| 1.2 OX objects |
1.2 OX objects |
| The following structures is defined in ox.h: |
The following structures are defined in ox.h: |
| */ |
*/ |
| /*&common |
/*&common |
| |
|
| Line 101 The ox above is abstract base class. |
|
| Line 108 The ox above is abstract base class. |
|
| /*&en |
/*&en |
| 2. How to make CMObjects? |
2. How to make CMObjects? |
| |
|
| You may use new functions which generate an object and return its pointer. |
Use the following functions to generate an object. It returns a |
| */ |
pointer to the object. */ /*&common |
| /*&common |
|
| |
|
| new_cmo_null(); |
new_cmo_null(); |
| new_cmo_int32(int i); |
new_cmo_int32(int i); |
| Line 136 new_cmo_error2(cmo* ob); |
|
| Line 142 new_cmo_error2(cmo* ob); |
|
| /*&en |
/*&en |
| 3. High-level API |
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 |
/*&common |
| |
|
| Line 165 portStream は計算サーバとの通信のためのポート番号であ� |
|
| Line 172 portStream は計算サーバとの通信のためのポート番号であ� |
|
| この識別子は高水準 API の各関数で利用される。 |
この識別子は高水準 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 |
/*&ja |
| 3.2 通信の終了 |
3.2 通信の終了 |
| |
|
| Line 172 portStream は計算サーバとの通信のためのポート番号であ� |
|
| Line 188 portStream は計算サーバとの通信のためのポート番号であ� |
|
| |
|
| */ |
*/ |
| /*&en |
/*&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 |
/*&common |
| Line 187 void ox_shutdown(ox_file_t sv); |
|
| Line 204 void ox_shutdown(ox_file_t sv); |
|
| サーバを終了させる。第二の関数は計算サーバに SM_shutdown を送ることに |
サーバを終了させる。第二の関数は計算サーバに SM_shutdown を送ることに |
| よって、サーバを終了させる(予定)。 |
よって、サーバを終了させる(予定)。 |
| |
|
| /* |
*/ |
| /*&ja |
/*&ja |
| 3.3 SM コマンドの送信 |
3.3 SM コマンドの送信 |
| |
|
| */ |
*/ |
| /*&en |
/*&en |
| 3.3 How to command to OpenXM stack machine? |
3.3 How to command to OpenXM stack machines? |
| |
|
| */ |
*/ |
| /*&common |
/*&common |
| |
|
| void ox_push_cmd(ox_file_t sv, int sm_code); |
void ox_push_cmd(ox_file_t sv, int sm_code); |
| |
|
| */ |
*/ |
| Line 205 void ox_push_cmd(ox_file_t sv, int sm_code); |
|
| Line 221 void ox_push_cmd(ox_file_t sv, int sm_code); |
|
| |
|
| */ |
*/ |
| /*&en |
/*&en |
| This function send operation code to an OpenXM stack machine. |
ox_push_cmd() sends an operation code to an OpenXM stack machine. |
| Table of opecode is defined in oxtag.h. |
See OpenXM/src/ox_toolkit/oxtag.h for a list of operation codes. |
| |
|
| */ |
*/ |
| /*&ja |
/*&ja |
| 3.4 CMO の送受信 |
3.4 CMO の送受信 |
| |
*/ |
| |
/*&en |
| |
3.4 How to receive a CMO? |
| |
*/ |
| |
/*&common |
| |
|
| void ox_push_cmo(ox_file_t sv, cmo *c); |
void ox_push_cmo(ox_file_t sv, cmo *c); |
| cmo* ox_pop_cmo(ox_file_t sv); |
cmo* ox_pop_cmo(ox_file_t sv); |
| char* ox_popString(ox_file_t sv); |
char* ox_popString(ox_file_t sv); |
| |
|
| |
*/ |
| |
/*&ja |
| ox_push_cmo は cmo を送信、ox_pop_cmo は cmo を受信する。ox_popString |
ox_push_cmo は cmo を送信、ox_pop_cmo は cmo を受信する。ox_popString |
| は cmo を文字列形式に変換して受信するが、変換の結果はサーバによって異 |
は cmo を文字列形式に変換して受信するが、変換の結果はサーバによって異 |
| なる。 |
なる。 |
| |
|
| |
*/ |
| |
/*&en |
| |
*/ |
| |
/*&ja |
| 3.5 スタック処理 |
3.5 スタック処理 |
| |
*/ |
| |
/*&common |
| |
|
| int ox_pops(ox_file_t sv, int num); |
int ox_pops(ox_file_t sv, int num); |
| |
|
| |
*/ |
| |
/*&ja |
| スタック上の num 個のオブジェクトを廃棄する。 |
スタック上の num 個のオブジェクトを廃棄する。 |
| |
|
| 3.6 |
*/ |
| |
/*&ja |
| |
3.6 通信路のフラッシュ |
| |
*/ |
| |
/*&common |
| |
|
| int ox_flush(ox_file_t sv); |
int ox_flush(ox_file_t sv); |
| |
|
| |
*/ |
| |
/*&ja |
| 通信路を flush する(実際には何もしない)。 |
通信路を flush する(実際には何もしない)。 |
| |
|
| 3.7 |
*/ |
| |
/*&ja |
| |
3.7 通信の中断 |
| |
*/ |
| |
/*&common |
| |
|
| void ox_reset(ox_file_t sv); |
void ox_reset(ox_file_t sv); |
| |
|
| |
*/ |
| |
/*&ja |
| 計算を中断する。 |
計算を中断する。 |
| |
|
| 3.8 |
*/ |
| |
/*&ja |
| |
3.8 ローカル言語で書かれたコマンドの評価 |
| |
*/ |
| |
/*&common |
| |
|
| void ox_execute_string(ox_file_t sv, char* str); |
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], ...) を計算し、結果をスタックに積む。 |
function(argv[1], ...) を計算し、結果をスタックに積む。 |
| |
|
| 3.10 |
*/ |
| |
/*&ja |
| |
3.10 Mathcap の受信 |
| |
|
| |
*/ |
| |
/*&common |
| cmo_mathcap* ox_mathcap(ox_file_t sv); |
cmo_mathcap* ox_mathcap(ox_file_t sv); |
| |
|
| |
*/ |
| |
/*&ja |
| Mathcap を受け取る。現在は Mathcap の処理はユーザプログラムに任されている。 |
Mathcap を受け取る。現在は Mathcap の処理はユーザプログラムに任されている。 |
| いずれこの関数は廃止される予定。 |
いずれこの関数は廃止される予定。 |
| |
|
| */ |
*/ |
| /*&ja |
/*&ja |
| |
|
| 4. 低水準 API |
4. 低水準 API |
| |
|
| 低水準 API はファイルディスクリプタを直接利用する。 |
低水準 API はファイルディスクリプタを直接利用する。 |
| |
|
| 4.1 通信に使われるバイトオーダの決定 |
4.1 通信に使われるバイトオーダの決定 |
| |
|
| */ |
*/ |
| /*&en |
/*&en |
| |
|
| 4. Low-level API. |
4. Low-level API. |
| |
|
| |
In this section, ``fd'' is an identifier of an OpenXM connection. |
| |
|
| 4.1 How to decide a byte order of integers? |
4.1 How to decide a byte order of integers? |
| |
|
| */ |
*/ |
| Line 281 int decideByteOrderServer(int fd, int order); |
|
| Line 345 int decideByteOrderServer(int fd, int order); |
|
| いる。詳しくは、高山-野呂, "OpenXM の設計と実装" を参照せよ。 |
いる。詳しくは、高山-野呂, "OpenXM の設計と実装" を参照せよ。 |
| |
|
| (注意) クライアント側でのバイトオーダの設定は、高水準 API で自動的に行われる。 |
(注意) クライアント側でのバイトオーダの設定は、高水準 API で自動的に行われる。 |
| |
|
| */ |
*/ |
| |
/*&en |
| |
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 |
/*&common |
| |
|
| 4.2 |
4.2 |
| |
|
| int send_int32(int fd, int integer); |
|
| |
|
| */ |
*/ |
| /*&ja |
|
| fd に 32bit 整数を書き込む。 |
|
| |
|
| */ |
|
| /*&common |
/*&common |
| |
int send_int32(int fd, int integer); |
| int receive_int32(int fd); |
int receive_int32(int fd); |
| |
|
| */ |
*/ |
| /*&ja |
/*&ja |
| |
fd に 32bit 整数を書き込む。 |
| fd から 32bit 整数を読み込む。 |
fd から 32bit 整数を読み込む。 |
| |
|
| */ |
*/ |
| |
/*&en |
| |
send_int32() writes 32bits integer to an OpenXM connection. |
| |
receive_int32() reads 32bits integer from an OpenXM connection. |
| |
*/ |
| /*&common |
/*&common |
| |
|
| 4.3 |
4.3 |
| |
|
| |
*/ |
| |
/*&common |
| int send_cmo(int fd, cmo* m); |
int send_cmo(int fd, cmo* m); |
| |
cmo* receive_cmo(int fd); |
| |
|
| */ |
*/ |
| /*&ja |
/*&ja |
| fd に cmo を書き込む。 |
fd に cmo を書き込む。 |
| |
fd から cmo を読み込む。 |
| */ |
*/ |
| |
/*&en |
| |
send_cmo() writes an CMObject to an OpenXM connection. |
| |
receive_cmo() reads an CMObject from an OpenXM connection. |
| |
*/ |
| /*&common |
/*&common |
| cmo* receive_cmo(int fd); |
|
| |
|
| */ |
|
| /*&ja |
|
| fd から cmo を読み込む。 |
|
| |
|
| 4.4 |
4.4 |
| |
|
| |
*/ |
| |
/*&common |
| int next_serial(); |
int next_serial(); |
| |
|
| |
*/ |
| |
/*&ja |
| シリアルナンバを生成する。 |
シリアルナンバを生成する。 |
| |
*/ |
| |
/*&en |
| |
next_serial() generates a serial number for ox message. |
| |
*/ |
| |
/*&common |
| |
|
| 4.5 |
4.5 |
| |
|
| |
*/ |
| |
/*&common |
| int send_ox_tag(int fd, int tag); |
int send_ox_tag(int fd, int tag); |
| |
|
| fd に OX メッセージのヘッダ(tag+id)を書き込む。 |
|
| シリアル番号は自動的に生成される。 |
|
| |
|
| int receive_ox_tag(int fd); |
int receive_ox_tag(int fd); |
| |
|
| fd から OX メッセージのヘッダ(tag+id)を読み込む。 |
*/ |
| |
/*&ja |
| |
fd に OX メッセージのヘッダ(tag+serial#)を書き込む。シリアル番号は |
| |
自動的に生成される。 |
| |
fd から OX メッセージのヘッダ(tag+serial#)を読み込む。 |
| |
*/ |
| |
/*&en |
| |
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 a serial number of an ox message. |
| |
*/ |
| |
/*&common |
| |
|
| 4.6 |
4.6 |
| |
|
| |
*/ |
| |
/*&common |
| int send_ox(int fd, ox* m); |
int send_ox(int fd, ox* m); |
| int send_ox_cmo(int fd, cmo* m); |
int send_ox_cmo(int fd, cmo* m); |
| void send_ox_command(int fd, int sm_command); |
void send_ox_command(int fd, int sm_command); |
| |
|
| |
*/ |
| |
/*&ja |
| ox メッセージを送信する。 |
ox メッセージを送信する。 |
| */ |
|
| |
|
| |
*/ |
| |
|
| |
/*&ja |
| |
|
| |
5. OX expression パーサ |
| |
|
| |
*/ |
| |
/*&ja |
| |
OpenXM C library には 文字列表現された |
| |
OX expression および CMO expression から、 |
| |
ox 構造体または cmo 構造体を生成するためのパーサが付属している。 |
| |
|
| |
ここではこのパーサについて説明する。 |
| |
|
| |
*/ |
| |
/*&common |
| |
int setflag_parse(int flag); |
| |
|
| |
*/ |
| |
/*&ja |
| |
setflag_parse(PFLAG_ADDREV) によって、CMO の短縮表現を許す。 |
| |
|
| |
*/ |
| |
/*&common |
| |
int init_parser(char *str); |
| |
|
| |
*/ |
| |
/*&ja |
| |
パーサが処理すべき文字列をセットする。 |
| |
|
| |
*/ |
| |
/*&common |
| |
cmo *parse(); |
| |
|
| |
*/ |
| |
/*&ja |
| |
Lisp 表現による OX expression, CMO expression の構文解析器。あらかじめ |
| |
設定された文字列を解析して ox 構造体、あるいは cmo 構造体を生成する。 |
| |
*/ |
| |
/*&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 サーバのサンプル。 |
| |
|
| |
*/ |