[BACK]Return to ox.h CVS log [TXT][DIR] Up to [local] / OpenXM_contrib2 / asir2000 / include

Annotation of OpenXM_contrib2/asir2000/include/ox.h, Revision 1.31

1.7       noro        1: /*
                      2:  * Copyright (c) 1994-2000 FUJITSU LABORATORIES LIMITED
                      3:  * All rights reserved.
                      4:  *
                      5:  * FUJITSU LABORATORIES LIMITED ("FLL") hereby grants you a limited,
                      6:  * non-exclusive and royalty-free license to use, copy, modify and
                      7:  * redistribute, solely for non-commercial and non-profit purposes, the
                      8:  * computer program, "Risa/Asir" ("SOFTWARE"), subject to the terms and
                      9:  * conditions of this Agreement. For the avoidance of doubt, you acquire
                     10:  * only a limited right to use the SOFTWARE hereunder, and FLL or any
                     11:  * third party developer retains all rights, including but not limited to
                     12:  * copyrights, in and to the SOFTWARE.
                     13:  *
                     14:  * (1) FLL does not grant you a license in any way for commercial
                     15:  * purposes. You may use the SOFTWARE only for non-commercial and
                     16:  * non-profit purposes only, such as academic, research and internal
                     17:  * business use.
                     18:  * (2) The SOFTWARE is protected by the Copyright Law of Japan and
                     19:  * international copyright treaties. If you make copies of the SOFTWARE,
                     20:  * with or without modification, as permitted hereunder, you shall affix
                     21:  * to all such copies of the SOFTWARE the above copyright notice.
                     22:  * (3) An explicit reference to this SOFTWARE and its copyright owner
                     23:  * shall be made on your publication or presentation in any form of the
                     24:  * results obtained by use of the SOFTWARE.
                     25:  * (4) In the event that you modify the SOFTWARE, you shall notify FLL by
1.8       noro       26:  * e-mail at risa-admin@sec.flab.fujitsu.co.jp of the detailed specification
1.7       noro       27:  * for such modification or the source code of the modified part of the
                     28:  * SOFTWARE.
                     29:  *
                     30:  * THE SOFTWARE IS PROVIDED AS IS WITHOUT ANY WARRANTY OF ANY KIND. FLL
                     31:  * MAKES ABSOLUTELY NO WARRANTIES, EXPRESSED, IMPLIED OR STATUTORY, AND
                     32:  * EXPRESSLY DISCLAIMS ANY IMPLIED WARRANTY OF MERCHANTABILITY, FITNESS
                     33:  * FOR A PARTICULAR PURPOSE OR NONINFRINGEMENT OF THIRD PARTIES'
                     34:  * RIGHTS. NO FLL DEALER, AGENT, EMPLOYEES IS AUTHORIZED TO MAKE ANY
                     35:  * MODIFICATIONS, EXTENSIONS, OR ADDITIONS TO THIS WARRANTY.
                     36:  * UNDER NO CIRCUMSTANCES AND UNDER NO LEGAL THEORY, TORT, CONTRACT,
                     37:  * OR OTHERWISE, SHALL FLL BE LIABLE TO YOU OR ANY OTHER PERSON FOR ANY
                     38:  * DIRECT, INDIRECT, SPECIAL, INCIDENTAL, PUNITIVE OR CONSEQUENTIAL
                     39:  * DAMAGES OF ANY CHARACTER, INCLUDING, WITHOUT LIMITATION, DAMAGES
                     40:  * ARISING OUT OF OR RELATING TO THE SOFTWARE OR THIS AGREEMENT, DAMAGES
                     41:  * FOR LOSS OF GOODWILL, WORK STOPPAGE, OR LOSS OF DATA, OR FOR ANY
                     42:  * DAMAGES, EVEN IF FLL SHALL HAVE BEEN INFORMED OF THE POSSIBILITY OF
                     43:  * SUCH DAMAGES, OR FOR ANY CLAIM BY ANY OTHER PARTY. EVEN IF A PART
                     44:  * OF THE SOFTWARE HAS BEEN DEVELOPED BY A THIRD PARTY, THE THIRD PARTY
                     45:  * DEVELOPER SHALL HAVE NO LIABILITY IN CONNECTION WITH THE USE,
                     46:  * PERFORMANCE OR NON-PERFORMANCE OF THE SOFTWARE.
                     47:  *
1.31    ! noro       48:  * $OpenXM: OpenXM_contrib2/asir2000/include/ox.h,v 1.30 2016/06/29 05:10:14 ohara Exp $
1.7       noro       49: */
1.1       noro       50: #include "com.h"
                     51:
                     52: /* version */
                     53:
1.31    ! noro       54: #define OX_VERSION    199901160
1.1       noro       55:
                     56: /* header */
                     57:
1.31    ! noro       58: #define OX_COMMAND    513
        !            59: #define OX_DATA      514
        !            60: #define OX_SYNC_BALL  515
1.1       noro       61:
1.31    ! noro       62: #define OX_DATA_WITH_SIZE    521
        !            63: #define OX_DATA_ASIR_BINARY_EXPRESSION    522
1.1       noro       64:
1.31    ! noro       65: #define OX_LOCAL_OBJECT  0x7fcdef30
1.1       noro       66:
                     67: #define OX_LOCAL_OBJECT_ASIR (OX_LOCAL_OBJECT+0)
1.31    ! noro       68: #define OX_LOCAL_OBJECT_SM1  (OX_LOCAL_OBJECT+1)
1.1       noro       69:
                     70: /* cmo_tags */
                     71:
1.31    ! noro       72: #define CMO_LARGE_ID  0x7f000000
1.1       noro       73:
1.31    ! noro       74: #define CMO_ERROR      CMO_LARGE_ID+1
        !            75: #define CMO_ERROR2      CMO_LARGE_ID+2
1.1       noro       76:
1.31    ! noro       77: #define CMO_NULL      1
        !            78: #define CMO_INT32      2
        !            79: #define CMO_DATUM      3
        !            80: #define CMO_STRING      4
        !            81: #define CMO_MATHCAP      5
        !            82:
        !            83: #define CMO_ARRAY        16
        !            84: #define CMO_LIST        17
        !            85: #define CMO_ATOM        18
        !            86: #define CMO_MONOMIAL32      19
        !            87: #define CMO_ZZ          20
        !            88: #define CMO_QQ          21
        !            89: #define CMO_ZERO        22
        !            90:
        !            91: #define CMO_DMS_GENERIC      24
        !            92: #define CMO_DMS_OF_N_VARIABLES  25
        !            93: #define CMO_RING_BY_NAME    26
        !            94: #define CMO_RECURSIVE_POLYNOMIAL    27
        !            95:
        !            96: #define CMO_DISTRIBUTED_POLYNOMIAL    31
        !            97: #define CMO_UNIVARIATE_POLYNOMIAL    33
        !            98: #define CMO_RATIONAL    34
        !            99: #define CMO_COMPLEX    35
1.6       noro      100:
                    101: #define CMO_64BIT_MACHINE_DOUBLE   40
                    102: #define CMO_ARRAY_OF_64BIT_MACHINE_DOUBLE  41
                    103: #define CMO_128BIT_MACHINE_DOUBLE   42
                    104: #define CMO_ARRAY_OF_128BIT_MACHINE_DOUBLE  43
                    105:
1.31    ! noro      106: #define CMO_BIGFLOAT        50
        !           107: #define CMO_IEEE_DOUBLE_FLOAT    51
        !           108: #define CMO_BIGFLOAT32        52
        !           109:
        !           110: #define CMO_INDETERMINATE    60
        !           111: #define CMO_TREE        61
        !           112: #define CMO_LAMBDA        62
1.1       noro      113:
                    114: /* asir local object id */
                    115:
1.31    ! noro      116: #define ASIR_VL          0
        !           117: #define ASIR_OBJ        1
1.1       noro      118:
                    119: /* commands */
                    120:
                    121: #define SM_popSerializedLocalObject 258
                    122: #define SM_popCMO 262
                    123: #define SM_popString 263
                    124:
                    125: #define SM_mathcap 264
                    126: #define SM_pops 265
                    127: #define SM_setName 266
                    128: #define SM_evalName 267
                    129: #define SM_executeStringByLocalParser 268
                    130: #define SM_executeFunction 269
                    131:
                    132: #define SM_beginBlock 270
                    133: #define SM_endBlock 271
                    134: #define SM_shutdown 272
                    135: #define SM_setMathcap 273
                    136: #define SM_executeStringByLocalParserInBatchMode 274
                    137: #define SM_getsp 275
                    138: #define SM_dupErrors 276
1.9       noro      139: #define SM_pushCMOtag 277
1.1       noro      140:
1.18      noro      141: #define SM_set_rank_102 278
                    142: #define SM_tcp_accept_102 279
                    143: #define SM_tcp_connect_102 280
                    144: #define SM_reset_102 281
1.20      noro      145: #define SM_bcast_102 282
                    146: #define SM_reduce_102 283
1.18      noro      147:
1.1       noro      148: #define SM_nop 300
                    149:
1.23      noro      150: /* local SM command in ox_asir */
                    151: #define SM_executeFunctionSync 400
                    152:
1.31    ! noro      153: #define SM_control_kill         1024
        !           154: #define SM_control_intr         1025
        !           155: #define SM_control_reset_connection    1030
1.1       noro      156:
                    157: typedef FILE *ox_stream;
                    158:
                    159: /* a macro to check whether data are available in the read buffer */
                    160: #if defined(linux)
                    161: #define FP_DATA_IS_AVAILABLE(fp) ((fp)->_IO_read_ptr < (fp)->_IO_read_end)
1.22      ohara     162: #elif defined(__FreeBSD__) || defined(__DARWIN__) || (defined(__MACH__) && defined(__ppc__)) || defined(__CYGWIN__) || defined(__INTERIX)
1.1       noro      163: #define FP_DATA_IS_AVAILABLE(fp) ((fp)->_r)
1.11      noro      164: #elif defined(sparc) || defined(__alpha) || defined(__SVR4) || defined(mips) || defined(_IBMR2)
1.1       noro      165: #define FP_DATA_IS_AVAILABLE(fp) ((fp)->_cnt)
1.28      fujimoto  166: #elif defined(VISUAL) || defined(__MINGW32__)
1.1       noro      167: #define FP_DATA_IS_AVAILABLE(fp) ((fp)->p < (fp)->buf_size)
                    168: #elif defined(hpux)
                    169: #define FP_DATA_IS_AVAILABLE(fp) ((fp)->__cnt)
                    170: #else
                    171: --->FIXIT
                    172: #endif
                    173:
1.16      noro      174: /* environement is defined in libpari.a */
                    175: extern jmp_buf environnement;
1.15      noro      176:
                    177: extern JMP_BUF main_env;
1.1       noro      178:
                    179: extern int *StackBottom;
                    180: extern int ox_do_copy, ox_do_count, ox_count_length;
                    181: extern char *ox_copy_bptr;
                    182:
                    183: extern struct IOFP iofp[];
1.18      noro      184: extern struct IOFP iofp_102[];
1.1       noro      185:
                    186: extern char *parse_strp;
                    187:
1.17      noro      188: #if 0
1.1       noro      189: #define LBUFSIZ BUFSIZ*10
1.17      noro      190: #else
                    191: #define LBUFSIZ BUFSIZ
                    192: #endif
1.1       noro      193:
1.13      noro      194: /* prototypes */
                    195:
                    196: void cmoname_to_localname(char *a,char **b);
                    197: void localname_to_cmoname(char *a,char **b);
                    198: void read_cmo_tree_as_list(FILE *s,LIST *rp);
                    199: void read_cmo_upoly(FILE *s,P *rp);
                    200: void read_cmo_p(FILE *s,P *rp);
                    201: void read_cmo_monomial(FILE *s,DP *rp);
                    202: void read_cmo_dp(FILE *s,DP *rp);
                    203: void read_cmo_list(FILE *s,Obj *rp);
                    204: void read_cmo_zz(FILE *s,int *sgn,N *rp);
                    205: void read_cmo_uint(FILE *s,USINT *rp);
1.25      noro      206: void read_cmo_bf(FILE *s,BF *q);
1.29      noro      207: void read_cmo_complex(FILE *s,C *q);
1.13      noro      208: void read_cmo(FILE *s,Obj *rp);
                    209: void write_cmo_tree(FILE *s,LIST l);
                    210: void write_cmo_error(FILE *s,ERR e);
                    211: void write_cmo_bytearray(FILE *s,BYTEARRAY array);
                    212: void write_cmo_string(FILE *s,STRING str);
                    213: void write_cmo_list(FILE *s,LIST list);
                    214: void write_cmo_monomial(FILE *s,MP m,int n);
                    215: void write_cmo_dp(FILE *s,DP dp);
                    216: void write_cmo_r(FILE *s,R f);
                    217: void write_cmo_upoly(FILE *s,VL vl,P p);
                    218: void write_cmo_p(FILE *s,P p);
                    219: void write_cmo_zz(FILE *s,int sgn,N n);
                    220: void write_cmo_real(FILE *s,Real real);
                    221: void write_cmo_q(FILE *s,Q q);
1.25      noro      222: void write_cmo_bf(FILE *s,BF q);
1.29      noro      223: void write_cmo_complex(FILE *s,C q);
1.13      noro      224: void write_cmo_uint(FILE *s,USINT ui);
1.27      noro      225: void write_cmo_matrix_as_list(FILE *s,MAT m);
1.13      noro      226: void write_cmo_mathcap(FILE *s,MATHCAP mc);
                    227: int cmo_tag(Obj obj,int *tag);
                    228: void write_cmo(FILE *s,Obj obj);
                    229: int valid_as_cmo(Obj obj);
                    230: void ox_flush_stream_force(int s);
1.18      noro      231: void ox_flush_stream_force_102(int s);
1.13      noro      232: void ox_flush_stream(int s);
1.18      noro      233: void ox_flush_stream_102(int s);
1.13      noro      234: int ox_check_cmo_dp(int s, DP p);
                    235: int ox_check_cmo_p(int s, P p);
                    236: void ox_get_serverinfo(int s, LIST *rp);
                    237: int ox_check_cmo(int s, Obj obj);
                    238: void ox_write_cmo(int s, Obj obj);
1.18      noro      239: void ox_write_cmo_102(int s, Obj obj);
1.13      noro      240: void ox_write_int(int s, int n);
1.18      noro      241: void ox_write_int_102(int s, int n);
1.13      noro      242: void ox_read_local(int s, Obj *rp);
1.18      noro      243: void ox_read_local_102(int s, Obj *rp);
1.13      noro      244: void ox_read_cmo(int s, Obj *rp);
1.18      noro      245: void ox_read_cmo_102(int s, Obj *rp);
1.13      noro      246: void ox_read_int(int s, int *n);
1.18      noro      247: void ox_read_int_102(int s, int *n);
1.13      noro      248: void ox_get_result(int s,Obj *rp);
                    249: unsigned int ox_recv(int s, int *id, Obj *p);
1.19      noro      250: unsigned int ox_recv_102(int s, int *id, Obj *p);
1.13      noro      251: void ox_send_local_ring(int s,VL vl);
1.19      noro      252: void ox_send_local_ring_102(int s,VL vl);
1.13      noro      253: void ox_send_local_data(int s,Obj p);
1.19      noro      254: void ox_send_local_data_102(int s,Obj p);
1.13      noro      255: void ox_send_sync(int s);
1.19      noro      256: void ox_send_sync_102(int s);
1.13      noro      257: void ox_send_cmd(int s,int id);
                    258: void ox_send_data(int s,pointer p);
1.19      noro      259: void ox_send_data_102(int s,pointer p);
1.13      noro      260: void wait_for_data(int s);
1.19      noro      261: void wait_for_data_102(int s);
1.13      noro      262: int ox_data_is_available(int s);
                    263: void clear_readbuffer();
                    264: void end_critical();
                    265: void begin_critical();
                    266: int check_by_mc(int s,unsigned int oxtag,unsigned int cmotag);
                    267: int check_sm_by_mc(int s,unsigned int smtag);
                    268: void store_remote_mathcap(int s,MATHCAP mc);
                    269: void create_my_mathcap(char *system);
                    270: void ox_resetenv(char *s);
                    271: void cleanup_events();
                    272: void reset_io();
                    273: void endian_init();
                    274: int countobj(Obj p);
                    275: int count_as_cmo(Obj p);
                    276: int countvl(VL vl);
                    277: void ox_copy_init(char *s);
                    278: void ox_obj_to_buf_as_cmo(Obj p);
                    279: void ox_buf_to_obj_as_cmo(Obj *p);
                    280: void ox_vl_to_buf(VL vl);
                    281: int gen_fread (char *ptr,int size,int nitems,FILE *stream);
                    282: int gen_fwrite (char *ptr,int size,int nitems,FILE *stream);
                    283: void write_char(FILE *f,unsigned char *p);
                    284: void write_short(FILE *f,unsigned short *p);
                    285: void write_int(FILE *f,unsigned int *p);
1.25      noro      286: void write_int64(FILE *f,UL *p);
1.13      noro      287: void init_deskey();
                    288: void write_intarray(FILE *f,unsigned int *p,int l);
                    289: void write_longarray(FILE *f,unsigned long *p,int l);
                    290: void write_double(FILE *f,double *p);
                    291: void write_string(FILE *f,unsigned char *p,int l);
                    292: void read_char(FILE *f,unsigned char *p);
                    293: void read_short(FILE *f,unsigned short *p);
                    294: void read_int(FILE *f,unsigned int *p);
1.25      noro      295: void read_int64(FILE *f,UL *p);
1.13      noro      296: void read_intarray(FILE *f,unsigned int *p,int l);
                    297: void read_longarray(FILE *f,unsigned long *p,int l);
                    298: void read_string(FILE *f,unsigned char *p,int l);
                    299: void read_double(FILE *f,double *p);
                    300: int getremotesocket(int s);
                    301: void getremotename(int s,char *name);
                    302: void generate_port(int use_unix,char *port_str);
                    303: int try_bind_listen(int use_unix,char *port_str);
                    304: int try_accept(int af_unix,int s);
                    305: int try_connect(int use_unix,char *host,char *port_str);
                    306: void close_allconnections();
                    307: void free_iofp(int s);
                    308: int get_iofp(int s1,char *af_sock,int is_server);
                    309: void init_socket();
                    310: int get_fd(int index);
                    311: int get_index(int fd);
                    312: void ox_launch_generic(char *host,char *launcher,char *server,
1.31    ! noro      313:     int use_unix,int use_ssh,int use_x,int conn_to_serv,Q *rp);
1.13      noro      314: void spawn_server(char *host,char *launcher,char *server,
1.31    ! noro      315:   int use_unix,int use_ssh,int use_x,int conn_to_serv,
        !           316:   char *control_port_str,char *server_port_str);
1.13      noro      317: void ox_launch_main(int with_x,NODE arg,Obj *p);
1.24      ohara     318: int register_server(int af_unix,int m,int c,int fd);
1.13      noro      319: int get_mcindex(int i);
                    320: void shutdown_all();
1.5       noro      321:
                    322: /* library functions */
                    323: void asir_ox_push_cmo(void *);
                    324: int asir_ox_pop_cmo(void *, int);
                    325: void asir_ox_push_cmd(int);
                    326: void asir_ox_execute_string(char *);
                    327: int asir_ox_peek_cmo_size();
                    328: int asir_ox_init(int);
1.13      noro      329:

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