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

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

1.1     ! ohara       1: /* -*- mode: C -*- */
        !             2: /* $OpenXM$ */
        !             3:
        !             4: #ifndef _OX_TOOLKIT_H_
        !             5:
        !             6: #define _OX_TOOLKIT_H_
        !             7:
        !             8: #include <gmp.h>
        !             9: #include "ox_toolkit_tags.h"
        !            10:
        !            11: /* functions related to ox.c */
        !            12:
        !            13: #define LOGFILE  "/tmp/oxtk.XXXXXX"
        !            14:
        !            15: /* Open Xm File Descripter */
        !            16: typedef int oxfd;
        !            17:
        !            18: #if 0
        !            19: typedef struct {
        !            20:     int fd;
        !            21:     int byteorder;
        !            22: } oxfile;
        !            23: typedef oxfile *oxfd;
        !            24: #endif
        !            25:
        !            26: /* descripter pair. (needed by a client) */
        !            27: typedef struct {
        !            28:     oxfd stream;
        !            29:     oxfd control;
        !            30: } __ox_file_struct;
        !            31:
        !            32: typedef __ox_file_struct *ox_file_t;
        !            33:
        !            34: typedef struct {
        !            35:     int tag;
        !            36: } cmo;
        !            37:
        !            38: typedef cmo cmo_null;
        !            39: typedef cmo cmo_zero;
        !            40: typedef cmo cmo_dms_generic;
        !            41:
        !            42: typedef struct {
        !            43:     int tag;
        !            44:     int i;
        !            45: } cmo_int32;
        !            46:
        !            47: typedef struct {
        !            48:     int tag;
        !            49:     int size;
        !            50:     char *body;
        !            51: } cmo_datum;
        !            52:
        !            53: typedef struct {
        !            54:     int tag;
        !            55:     char *s;
        !            56: } cmo_string;
        !            57:
        !            58: typedef struct {
        !            59:     int tag;
        !            60:     cmo *ob;
        !            61: } cmo_mathcap;
        !            62:
        !            63: typedef cmo_mathcap cmo_error2;
        !            64: typedef cmo_mathcap cmo_ring_by_name;
        !            65: typedef cmo_mathcap cmo_indeterminate;
        !            66:
        !            67: typedef struct cell {
        !            68:     struct cell *next;
        !            69:     cmo *cmo;
        !            70: } cell;
        !            71:
        !            72: typedef struct {
        !            73:     int tag;
        !            74:     int length;   /* length of this list (unnecessary) */
        !            75:     cell head[1];
        !            76: } cmo_list;
        !            77:
        !            78:
        !            79: typedef struct {
        !            80:     int tag;
        !            81:     int length;
        !            82:     int *exps;
        !            83:     cmo *coef;
        !            84: } cmo_monomial32;
        !            85:
        !            86: typedef struct {
        !            87:     int tag;
        !            88:     mpz_t mpz;
        !            89: } cmo_zz;
        !            90:
        !            91: typedef struct {
        !            92:     int tag;
        !            93:     cmo *num;  /* Bunshi (cmo_zz) */
        !            94:     cmo *den;  /* Bunbo (cmo_zz) */
        !            95: } cmo_qq;
        !            96:
        !            97: /* The following is a derived class from cmo_list.
        !            98:    that is, append_cmo_list can be used. */
        !            99: typedef struct {
        !           100:     int tag;
        !           101:     int length;    /* number of monomials */
        !           102:     cell head[1];  /* a list of monomials */
        !           103:     cmo *ringdef;
        !           104: } cmo_distributed_polynomial;
        !           105:
        !           106: typedef cmo ox;
        !           107:
        !           108: typedef ox ox_sync_ball;
        !           109:
        !           110: typedef struct {
        !           111:     int tag;
        !           112:     int command;
        !           113: } ox_command;
        !           114:
        !           115: typedef struct {
        !           116:     int tag;
        !           117:     cmo *cmo;
        !           118: } ox_data;
        !           119:
        !           120: cmo_null*          new_cmo_null();
        !           121: cmo_int32*         new_cmo_int32(int i);
        !           122: cmo_string*        new_cmo_string(char* s);
        !           123: cmo_mathcap*       new_cmo_mathcap(cmo* ob);
        !           124: cmo_list*          new_cmo_list();
        !           125: cmo_monomial32*    new_cmo_monomial32();
        !           126: cmo_monomial32*    new_cmo_monomial32_size(int size);
        !           127: cmo_zz*            new_cmo_zz();
        !           128: cmo_zz*            new_cmo_zz_size(int size);
        !           129: cmo_zz*            new_cmo_zz_set_si(int integer);
        !           130: cmo_zz*            new_cmo_zz_set_mpz(mpz_ptr z);
        !           131: cmo_zz*            new_cmo_zz_noinit();
        !           132: cmo_zz*            new_cmo_zz_set_string(char* s);
        !           133: cmo_zero*          new_cmo_zero();
        !           134: cmo_distributed_polynomial* new_cmo_distributed_polynomial();
        !           135: cmo_dms_generic*   new_cmo_dms_generic();
        !           136: cmo_ring_by_name*  new_cmo_ring_by_name(cmo* ob);
        !           137: cmo_indeterminate* new_cmo_indeterminate(cmo* ob);
        !           138: cmo_error2*        new_cmo_error2(cmo* ob);
        !           139:
        !           140: ox_data*           new_ox_data(cmo* c);
        !           141: ox_command*        new_ox_command(int sm_code);
        !           142: ox_sync_ball*      new_ox_sync_ball();
        !           143:
        !           144: char*              new_string_set_cmo(cmo* m);
        !           145:
        !           146: cmo_error2*        make_error_object(int err_code, cmo* ob);
        !           147: cmo*               make_mathcap_object(int version, char *id_string);
        !           148:
        !           149: /* Low level API */
        !           150: cmo*               receive_cmo(int fd);
        !           151: int                receive_int32(int fd);
        !           152: int                receive_ox_tag(int fd);
        !           153:
        !           154: int                send_cmo(int fd, cmo* m);
        !           155: int                send_int32(int fd, int integer);
        !           156: int                send_ox(int fd, ox* m);
        !           157: int                send_ox_cmo(int fd, cmo* m);
        !           158: void               send_ox_command(int fd, int sm_command);
        !           159: int                send_ox_tag(int fd, int tag);
        !           160:
        !           161: int                decideByteOrderClient(int fd, int order);
        !           162: int                decideByteOrderServer(int fd, int order);
        !           163: int                next_serial();
        !           164: void               setCmotypeDisable(int type);
        !           165: cell*              new_cell();
        !           166: cmo*               nth_cmo_list(cmo_list* this, int n);
        !           167: int                set_current_fd(int fd);
        !           168:
        !           169: /* High level API */
        !           170: ox_file_t          ox_start(char* host, char* prog1, char* prog2);
        !           171: ox_file_t          ox_start_insecure_nonreverse(char* host, short portControl, short portStream);
        !           172: ox_file_t          ox_start_remote_with_ssh(char *dat_prog, char* host);
        !           173:
        !           174: void               ox_close(ox_file_t sv);
        !           175: void               ox_shutdown(ox_file_t sv);
        !           176: void               ox_reset(ox_file_t sv);
        !           177: void               ox_execute_string(ox_file_t sv, char* str);
        !           178: cmo_mathcap*       ox_mathcap(ox_file_t sv);
        !           179: char*              ox_popString(ox_file_t sv);
        !           180: int                ox_pops(ox_file_t sv, int num);
        !           181: cmo*               ox_pop_cmo(ox_file_t sv);
        !           182: void               ox_push_cmo(ox_file_t sv, cmo *c);
        !           183: void               ox_push_cmd(ox_file_t sv, int sm_code);
        !           184: int                ox_cmo_rpc(ox_file_t sv, char *function, int argc, cmo *argv[]);
        !           185: int                ox_flush(ox_file_t sv);
        !           186:
        !           187: int                append_cmo_list(cmo_list* this, cmo *ob);
        !           188: int                length_cmo_list(cmo_list* this);
        !           189: cell*              next_cell(cell *this);
        !           190: int                cmolen_cmo(cmo* m);
        !           191: int                init_dump_buff(char *buff);
        !           192: int                dump_cmo(cmo* m);
        !           193: int                dump_ox_command(ox_command* m);
        !           194: int                dump_ox_data(ox_data* m);
        !           195:
        !           196: int                print_cmo(cmo* c);
        !           197:
        !           198: typedef cmo *(*hook_t)(int, cmo *);
        !           199:
        !           200: int add_hook_before_send_cmo(hook_t func);
        !           201: int add_hook_after_send_cmo(hook_t func);
        !           202:
        !           203: /* functions related to parse.c */
        !           204:
        !           205: #define PFLAG_ADDREV   1
        !           206:
        !           207: typedef struct symbol *symbol_t;
        !           208:
        !           209: int setflag_parse(int flag);
        !           210: cmo *parse();
        !           211: int init_parser(char *s);
        !           212:
        !           213: symbol_t lookup_by_symbol(char *key);
        !           214: symbol_t lookup_by_token(int tok);
        !           215: symbol_t lookup_by_tag(int tag);
        !           216: symbol_t lookup(int i);
        !           217: char *symbol_get_key(symbol_t sp);
        !           218:
        !           219: #endif /* _OX_TOOLKIT_H_ */

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