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

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

1.1     ! ohara       1: /* -*- mode: C; coding: euc-japan -*- */
        !             2: /* $OpenXM$ */
        !             3:
        !             4: #ifndef _OX_H_
        !             5:
        !             6: #define _OX_H_
        !             7:
        !             8: #include <gmp.h>
        !             9: #include "oxtag.h"
        !            10:
        !            11: /*
        !            12: 関数の名前付け規約(その2)
        !            13: (1) receive_cmo 関数はCMOタグとデータ本体を受信する. この関数は CMOタグの
        !            14: 値が事前に分からないときに使用する. 返り値として、cmo へのポインタを返す。
        !            15: (2) receive_cmo_XXX 関数は, CMOタグを親の関数で受信してから呼び出される関
        !            16: 数で、データ本体のみを受信し、cmo_XXX へのポインタを返す。しかも、
        !            17: 関数内部で new_cmo_XXX 関数を呼び出す。
        !            18: (3) send_cmo 関数はCMOタグとデータ本体を送信する.
        !            19: (4) send_cmo_XXX 関数はCMOタグを親の関数で送信してから呼び出される関数で、
        !            20: データ本体のみを送信する.
        !            21:
        !            22: ----
        !            23: (5) receive_ox_XXX 関数は存在しない(作らない).  receive_cmo を利用する.
        !            24: (6) send_ox_XXX 関数は OX タグを含めて送信する.
        !            25: (7) ox_XXX 関数は一連の送受信を含むより抽象的な操作を表現する.
        !            26: ox_XXX 関数は、第一引数として、ox_file_t型の変数 sv をとる.
        !            27:
        !            28: (8) YYY_cmo 関数と YYY_cmo_XXX 関数の関係は次の通り:
        !            29: まず YYY_cmo 関数で cmo のタグを処理し、タグを除いた残りの部分を
        !            30: YYY_cmo_XXX 関数が処理する。cmo の内部に cmo_ZZZ へのポインタが
        !            31: あるときには、その種類によらずに YYY_cmo 関数を呼び出す
        !            32: */
        !            33:
        !            34: #define DEFAULT_LOGFILE  "/tmp/result"
        !            35:
        !            36: /* Open Xm File Descripter */
        !            37: typedef int oxfd;
        !            38:
        !            39: #if 0
        !            40: /* そのうちこちらに移行したい... */
        !            41: typedef struct {
        !            42:     int fd_read;
        !            43:     int fd_write;
        !            44:     int byteorder;
        !            45: } oxfile;
        !            46: typedef oxfile *oxfd;
        !            47: #endif
        !            48:
        !            49: /* サーバーとの通信路に用いるファイルディスクリプタのペア. */
        !            50: typedef struct {
        !            51:     oxfd stream;
        !            52:     oxfd control;
        !            53: } __ox_file_struct;
        !            54:
        !            55: typedef __ox_file_struct *ox_file_t;
        !            56:
        !            57: /*
        !            58: 警告:
        !            59: cmo_list 型のリストには破壊的な代入をしてはいけない.
        !            60: cmo_list の各メンバに直接アクセスしてはいけない.
        !            61: メソッド(..._cmo_list 関数)を用いること.
        !            62: */
        !            63:
        !            64: /* ここからは新しい定義 */
        !            65: typedef struct {
        !            66:     int tag;
        !            67: } cmo;
        !            68:
        !            69: typedef cmo cmo_null;
        !            70: typedef cmo cmo_zero;
        !            71: typedef cmo cmo_dms_generic;
        !            72:
        !            73: typedef struct {
        !            74:     int tag;
        !            75:     int i;
        !            76: } cmo_int32;
        !            77:
        !            78: typedef struct {
        !            79:     int tag;
        !            80:     int size;
        !            81:     char *body;
        !            82: } cmo_datum;
        !            83:
        !            84: typedef struct {
        !            85:     int tag;
        !            86:     char *s;
        !            87: } cmo_string;
        !            88:
        !            89: typedef struct {
        !            90:     int tag;
        !            91:     cmo *ob;
        !            92: } cmo_mathcap;
        !            93:
        !            94: typedef cmo_mathcap cmo_error2;
        !            95: typedef cmo_mathcap cmo_ring_by_name;
        !            96: typedef cmo_mathcap cmo_indeterminate;
        !            97:
        !            98: typedef struct cell {
        !            99:     struct cell *next;
        !           100:     cmo *cmo;
        !           101: } cell;
        !           102:
        !           103: typedef struct {
        !           104:     int tag;
        !           105:     int length;   /* リストの長さ(必要??) */
        !           106:     cell head[1];
        !           107: } cmo_list;
        !           108:
        !           109:
        !           110: typedef struct {
        !           111:     int tag;
        !           112:     int length;
        !           113:     int *exps;
        !           114:     cmo *coef;
        !           115: } cmo_monomial32;
        !           116:
        !           117: typedef struct {
        !           118:     int tag;
        !           119:     mpz_t mpz;
        !           120: } cmo_zz;
        !           121:
        !           122: typedef struct {
        !           123:     int tag;
        !           124:     cmo *num;  /* 分子 (cmo_zz) */
        !           125:     cmo *den;  /* 分母 (cmo_zz) */
        !           126: } cmo_qq;
        !           127:
        !           128: /* cmo_list の派生. append_cmo_list を使ってよい. */
        !           129: typedef struct {
        !           130:     int tag;
        !           131:     int length;    /* number of monomials */
        !           132:     cell head[1];  /* a list of monomials */
        !           133:     cmo *ringdef;
        !           134: } cmo_distributed_polynomial;
        !           135:
        !           136: typedef cmo ox;
        !           137:
        !           138: typedef ox ox_sync_ball;
        !           139:
        !           140: typedef struct {
        !           141:     int tag;
        !           142:     int command;
        !           143: } ox_command;
        !           144:
        !           145: typedef struct {
        !           146:     int tag;
        !           147:     cmo *cmo;
        !           148: } ox_data;
        !           149:
        !           150: cmo_null*          new_cmo_null();
        !           151: cmo_int32*         new_cmo_int32(int i);
        !           152: cmo_string*        new_cmo_string(char* s);
        !           153: cmo_mathcap*       new_cmo_mathcap(cmo* ob);
        !           154: cmo_list*          new_cmo_list();
        !           155: cmo_monomial32*    new_cmo_monomial32();
        !           156: cmo_monomial32*    new_cmo_monomial32_size(int size);
        !           157: cmo_zz*            new_cmo_zz();
        !           158: cmo_zz*            new_cmo_zz_size(int size);
        !           159: cmo_zz*            new_cmo_zz_set_si(int integer);
        !           160: cmo_zz*            new_cmo_zz_noinit();
        !           161: cmo_zero*          new_cmo_zero();
        !           162: cmo_distributed_polynomial* new_cmo_distributed_polynomial();
        !           163: cmo_dms_generic*   new_cmo_dms_generic();
        !           164: cmo_ring_by_name*  new_cmo_ring_by_name(cmo* ob);
        !           165: cmo_indeterminate* new_cmo_indeterminate(cmo* ob);
        !           166: cmo_error2*        new_cmo_error2(cmo* ob);
        !           167:
        !           168: ox_data*           new_ox_data(cmo* c);
        !           169: ox_command*        new_ox_command(int sm_code);
        !           170:
        !           171: cmo_error2*        make_error_object(int err_code, cmo *ob);
        !           172: cmo*               make_mathcap_object(int version, char *id_string);
        !           173:
        !           174: cmo*               receive_cmo(int fd);
        !           175: cmo*               receive_cmo2(int fd);
        !           176: int                receive_int32(int fd);
        !           177: int                receive_ox_tag(int fd);
        !           178:
        !           179: int           send_cmo(int fd, cmo* m);
        !           180: int           send_int32(int fd, int integer);
        !           181: int           send_ox(ox_file_t s, ox* m);
        !           182: int           send_ox_cmo(int fd, cmo* m);
        !           183: void          send_ox_command(int fd, int sm_command);
        !           184: int           send_ox_tag(int fd, int tag);
        !           185:
        !           186: int           append_cmo_list(cmo_list* this, cmo *ob);
        !           187: int           length_cmo_list(cmo_list* this);
        !           188: cell*         next_cell(cell *this);
        !           189: int           cmolen_cmo(cmo* m);
        !           190:
        !           191: void          ox_close(ox_file_t sv);
        !           192: void          ox_executeStringByLocalParser(ox_file_t sv, char* str);
        !           193: cmo_mathcap*  ox_mathcap(ox_file_t sv);
        !           194: char*         ox_popString(ox_file_t sv, int fd);
        !           195: cmo*          ox_pop_cmo(ox_file_t sv, int fd);
        !           196: void          ox_reset(ox_file_t sv);
        !           197: ox_file_t     ox_start(char* host, char* prog1, char* prog2);
        !           198: ox_file_t     ox_start_insecure_nonreverse(char* host, short portControl, short portStream);
        !           199:
        !           200: int           init_dump_buff(char *buff);
        !           201: int           dump_cmo(cmo* m);
        !           202: int           dump_ox_command(ox_command* m);
        !           203: int           dump_ox_data(ox_data* m);
        !           204:
        !           205: int           print_cmo(cmo* c);
        !           206: int           print_cmo_int32(cmo_int32* c);
        !           207: int           print_cmo_list(cmo_list* li);
        !           208: int           print_cmo_mathcap(cmo_mathcap* c);
        !           209: int           print_cmo_string(cmo_string* c);
        !           210:
        !           211: int           decideByteOrderClient(oxfd fd, int order);
        !           212: int           decideByteOrderServer(oxfd fd, int order);
        !           213: int           next_serial();
        !           214: void          setCmotypeDisable(int type);
        !           215:
        !           216: cmo_zz*       new_cmo_zz_set_string(char *s);
        !           217: char*         convert_zz_to_string(cmo_zz *c);
        !           218: char*         convert_cmo_to_string(cmo *m);
        !           219: char*         convert_null_to_string();
        !           220: char*         convert_int_to_string(int integer);
        !           221:
        !           222: #endif /* _OX_H_ */

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