[BACK]Return to ox.h CVS log [TXT][DIR] Up to [local] / OpenXM / src / ox_math

Annotation of OpenXM/src/ox_math/ox.h, Revision 1.1

1.1     ! ohara       1: /* -*- mode: C; coding: euc-japan -*- */
        !             2: /* $OpenXM$ */
        !             3: /* $Id: ox.h,v 1.4 1999/10/14 10:18:35 ohara Exp ohara $ */
        !             4:
        !             5: #ifndef _OX_H_
        !             6:
        !             7: #define _OX_H_
        !             8:
        !             9: #include <gmp.h>
        !            10: #include "oxtag.h"
        !            11:
        !            12: /*
        !            13: 関数の名前付け規約(その2)
        !            14: (1) receive_cmo 関数はCMOタグとデータ本体を受信する. この関数は CMOタグの
        !            15: 値が事前に分からないときに使用する. 返り値として、cmo へのポインタを返す。
        !            16: (2) receive_cmo_XXX 関数は, CMOタグを親の関数で受信してから呼び出される関
        !            17: 数で、データ本体のみを受信し、cmo_XXX へのポインタを返す。しかも、
        !            18: 関数内部で new_cmo_XXX 関数を呼び出す。
        !            19: (3) send_cmo 関数はCMOタグとデータ本体を送信する.
        !            20: (4) send_cmo_XXX 関数はCMOタグを親の関数で送信してから呼び出される関数で、
        !            21: データ本体のみを送信する.
        !            22:
        !            23: ----
        !            24: (5) receive_ox_XXX 関数は存在しない(作らない).  receive_cmo を利用する.
        !            25: (6) send_ox_XXX 関数は OX タグを含めて送信する.
        !            26: (7) ox_XXX 関数は一連の送受信を含むより抽象的な操作を表現する.
        !            27: ox_XXX 関数は、第一引数として、ox_file_t型の変数 sv をとる.
        !            28:
        !            29: (8) YYY_cmo 関数と YYY_cmo_XXX 関数の関係は次の通り:
        !            30: まず YYY_cmo 関数で cmo のタグを処理し、タグを除いた残りの部分を
        !            31: YYY_cmo_XXX 関数が処理する。cmo の内部に cmo_ZZZ へのポインタが
        !            32: あるときには、その種類によらずに YYY_cmo 関数を呼び出す
        !            33: */
        !            34:
        !            35:
        !            36: #define DEFAULT_LOGFILE  "/tmp/result"
        !            37:
        !            38: /* サーバーとの通信路に用いるファイルディスクリプタのペア. */
        !            39: typedef struct {
        !            40:     int stream;
        !            41:     int control;
        !            42: } __ox_file_struct;
        !            43:
        !            44: typedef __ox_file_struct *ox_file_t;
        !            45:
        !            46: /*
        !            47: 警告:
        !            48: cmo_list 型のリストには破壊的な代入をしてはいけない.
        !            49: cmo_list の各メンバに直接アクセスしてはいけない.
        !            50: メソッド(..._cmo_list 関数)を用いること.
        !            51: */
        !            52:
        !            53: /* ここからは新しい定義 */
        !            54: typedef struct {
        !            55:     int tag;
        !            56: } cmo;
        !            57:
        !            58: typedef cmo cmo_null;
        !            59:
        !            60: typedef struct {
        !            61:     int tag;
        !            62:     int i;
        !            63: } cmo_int32;
        !            64:
        !            65: typedef struct {
        !            66:     int tag;
        !            67:     char *s;
        !            68: } cmo_string;
        !            69:
        !            70: typedef struct {
        !            71:     int tag;
        !            72:     mpz_t mpz;
        !            73: } cmo_zz;
        !            74:
        !            75: typedef struct cell {
        !            76:     struct cell *next;
        !            77:     cmo *cmo;
        !            78: } cell;
        !            79:
        !            80: typedef struct {
        !            81:     int tag;
        !            82:     int length;   /* リストの長さ(必要??) */
        !            83:     cell *head;
        !            84: } cmo_list;
        !            85:
        !            86: typedef struct {
        !            87:     int tag;
        !            88:     cmo_list *li;
        !            89: } cmo_mathcap;
        !            90:
        !            91: typedef cmo_mathcap cmo_error;
        !            92:
        !            93: /*
        !            94: typedef struct {
        !            95:     int tag;
        !            96: } ox;
        !            97: */
        !            98:
        !            99: typedef cmo ox;
        !           100:
        !           101: typedef struct {
        !           102:     int tag;
        !           103:     int command;
        !           104: } ox_command;
        !           105:
        !           106: typedef struct {
        !           107:     int tag;
        !           108:     cmo *cmo;
        !           109: } ox_data;
        !           110:
        !           111: cell*         new_cell(cmo* newcmo);
        !           112: cmo_int32*    new_cmo_int32(int i);
        !           113: cmo_list*     new_cmo_list();
        !           114: cmo_string*   new_cmo_string(char* s);
        !           115: cmo_zz*       new_cmo_zz();
        !           116: cmo_zz*       new_cmo_zz_size(int size);
        !           117: cmo_zz*       new_cmo_zz_set_si(int integer);
        !           118: cmo_zz*       new_cmo_zz_noinit();
        !           119: cmo_null*     new_cmo_null();
        !           120: cmo_mathcap*  new_cmo_mathcap(cmo_list* li);
        !           121: cmo_error*    new_cmo_error(cmo_list* li);
        !           122: ox_data*      new_ox_data(cmo* c);
        !           123: ox_command*   new_ox_command(int sm_code);
        !           124:
        !           125: cmo_error*    gen_error_object(int err_code);
        !           126: cmo*          make_mathcap_object(int version, char *id_string);
        !           127:
        !           128: void          resize_mpz(mpz_ptr mpz, int size);
        !           129: cmo*          receive_cmo(int fd);
        !           130: cmo*          receive_cmo2(int fd);
        !           131: int           receive_int32(int fd);
        !           132: int           receive_ox_tag(int fd);
        !           133:
        !           134: int           send_cmo(int fd, cmo* m);
        !           135: int           send_int32(int fd, int integer);
        !           136: int           send_ox(ox_file_t s, ox* m);
        !           137: int           send_ox_cmo(int fd, cmo* m);
        !           138: void          send_ox_command(int fd, int sm_command);
        !           139: int           send_ox_tag(int fd, int tag);
        !           140:
        !           141: int           append_cmo_list(cmo_list* this, cmo *newcmo);
        !           142: int           length_cmo_list(cmo_list* this);
        !           143: cell*         next_cell(cell *this);
        !           144: int           cmolen_cmo(cmo* m);
        !           145:
        !           146: void          ox_close(ox_file_t sv);
        !           147: void          ox_executeStringByLocalParser(ox_file_t sv, char* str);
        !           148: cmo_mathcap*  ox_mathcap(ox_file_t sv);
        !           149: char*         ox_popString(ox_file_t sv, int fd);
        !           150: cmo*          ox_pop_cmo(ox_file_t sv, int fd);
        !           151: void          ox_reset(ox_file_t sv);
        !           152: ox_file_t     ox_start(char* host, char* prog1, char* prog2);
        !           153:
        !           154: char*         dump_cmo(char* array, cmo* m);
        !           155: char*         dump_ox_command(char* array, ox_command* m);
        !           156: char*         dump_ox_data(char* array, ox_data* m);
        !           157:
        !           158: int           print_cmo(cmo* c);
        !           159: int           print_cmo_int32(cmo_int32* c);
        !           160: int           print_cmo_list(cmo_list* li);
        !           161: int           print_cmo_mathcap(cmo_mathcap* c);
        !           162: int           print_cmo_string(cmo_string* c);
        !           163:
        !           164: int           decideByteOrder(int fd_read, int fd_write, int order);
        !           165: int           decideByteOrder2(int fd_read, int fd_write, int order);
        !           166: int           next_serial();
        !           167: void          setCmotypeDisable(int type);
        !           168:
        !           169: cmo_zz*       new_cmo_zz_set_string(char *s);
        !           170: char*         CONVERT_ZZ_TO_CSTRING(cmo_zz *c);
        !           171: char*         CONVERT_CMO_TO_CSTRING(cmo *m);
        !           172: char*         CONVERT_NULL_TO_CSTRING();
        !           173: char*         CONVERT_INT_TO_CSTRING(int integer);
        !           174:
        !           175: #endif /* _OX_H_ */

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