Annotation of OpenXM_contrib2/asir2000/include/ox.h, Revision 1.16
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.16 ! noro 48: * $OpenXM: OpenXM_contrib2/asir2000/include/ox.h,v 1.15 2001/12/25 02:39:04 noro Exp $
1.7 noro 49: */
1.1 noro 50: #include "com.h"
51:
52: /* version */
53:
54: #define OX_VERSION 199901160
55:
56: /* header */
57:
58: #define OX_COMMAND 513
59: #define OX_DATA 514
60: #define OX_SYNC_BALL 515
61:
62: #define OX_DATA_WITH_SIZE 521
63: #define OX_DATA_ASIR_BINARY_EXPRESSION 522
64:
65: #define OX_LOCAL_OBJECT 0x7fcdef30
66:
67: #define OX_LOCAL_OBJECT_ASIR (OX_LOCAL_OBJECT+0)
68: #define OX_LOCAL_OBJECT_SM1 (OX_LOCAL_OBJECT+1)
69:
70: /* cmo_tags */
71:
72: #define CMO_LARGE_ID 0x7f000000
73:
74: #define CMO_ERROR CMO_LARGE_ID+1
75: #define CMO_ERROR2 CMO_LARGE_ID+2
76:
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
1.6 noro 99:
100: #define CMO_64BIT_MACHINE_DOUBLE 40
101: #define CMO_ARRAY_OF_64BIT_MACHINE_DOUBLE 41
102: #define CMO_128BIT_MACHINE_DOUBLE 42
103: #define CMO_ARRAY_OF_128BIT_MACHINE_DOUBLE 43
104:
105: #define CMO_BIGFLOAT 50
106: #define CMO_IEEE_DOUBLE_FLOAT 51
1.1 noro 107:
108: #define CMO_INDETERMINATE 60
109: #define CMO_TREE 61
110: #define CMO_LAMBDA 62
111:
112: /* asir local object id */
113:
114: #define ASIR_VL 0
115: #define ASIR_OBJ 1
116:
117: /* commands */
118:
119: #define SM_popSerializedLocalObject 258
120: #define SM_popCMO 262
121: #define SM_popString 263
122:
123: #define SM_mathcap 264
124: #define SM_pops 265
125: #define SM_setName 266
126: #define SM_evalName 267
127: #define SM_executeStringByLocalParser 268
128: #define SM_executeFunction 269
129:
130: #define SM_beginBlock 270
131: #define SM_endBlock 271
132: #define SM_shutdown 272
133: #define SM_setMathcap 273
134: #define SM_executeStringByLocalParserInBatchMode 274
135: #define SM_getsp 275
136: #define SM_dupErrors 276
1.9 noro 137: #define SM_pushCMOtag 277
1.1 noro 138:
139: #define SM_nop 300
140:
141: #define SM_control_kill 1024
1.2 noro 142: #define SM_control_intr 1025
1.1 noro 143: #define SM_control_reset_connection 1030
144:
145: typedef FILE *ox_stream;
146:
147: /* a macro to check whether data are available in the read buffer */
148: #if defined(linux)
149: #define FP_DATA_IS_AVAILABLE(fp) ((fp)->_IO_read_ptr < (fp)->_IO_read_end)
1.14 noro 150: #elif defined(__FreeBSD__) || (defined(__MACH__) && defined(__ppc__)) || defined(__CYGWIN__)
1.1 noro 151: #define FP_DATA_IS_AVAILABLE(fp) ((fp)->_r)
1.11 noro 152: #elif defined(sparc) || defined(__alpha) || defined(__SVR4) || defined(mips) || defined(_IBMR2)
1.1 noro 153: #define FP_DATA_IS_AVAILABLE(fp) ((fp)->_cnt)
154: #elif defined(VISUAL)
155: #define FP_DATA_IS_AVAILABLE(fp) ((fp)->p < (fp)->buf_size)
156: #elif defined(hpux)
157: #define FP_DATA_IS_AVAILABLE(fp) ((fp)->__cnt)
158: #else
159: --->FIXIT
160: #endif
161:
1.16 ! noro 162: /* environement is defined in libpari.a */
! 163: extern jmp_buf environnement;
1.15 noro 164:
165: extern JMP_BUF main_env;
1.1 noro 166:
167: extern int *StackBottom;
168: extern int ox_do_copy, ox_do_count, ox_count_length;
169: extern char *ox_copy_bptr;
170:
171: extern struct IOFP iofp[];
172:
173: extern char *parse_strp;
174:
175: #define LBUFSIZ BUFSIZ*10
176:
1.13 noro 177: /* prototypes */
178:
179: void cmoname_to_localname(char *a,char **b);
180: void localname_to_cmoname(char *a,char **b);
181: void read_cmo_tree_as_list(FILE *s,LIST *rp);
182: void read_cmo_upoly(FILE *s,P *rp);
183: void read_cmo_p(FILE *s,P *rp);
184: void read_cmo_monomial(FILE *s,DP *rp);
185: void read_cmo_dp(FILE *s,DP *rp);
186: void read_cmo_list(FILE *s,Obj *rp);
187: void read_cmo_zz(FILE *s,int *sgn,N *rp);
188: void read_cmo_uint(FILE *s,USINT *rp);
189: void read_cmo(FILE *s,Obj *rp);
190: void write_cmo_tree(FILE *s,LIST l);
191: void write_cmo_error(FILE *s,ERR e);
192: void write_cmo_bytearray(FILE *s,BYTEARRAY array);
193: void write_cmo_string(FILE *s,STRING str);
194: void write_cmo_list(FILE *s,LIST list);
195: void write_cmo_monomial(FILE *s,MP m,int n);
196: void write_cmo_dp(FILE *s,DP dp);
197: void write_cmo_r(FILE *s,R f);
198: void write_cmo_upoly(FILE *s,VL vl,P p);
199: void write_cmo_p(FILE *s,P p);
200: void write_cmo_zz(FILE *s,int sgn,N n);
201: void write_cmo_real(FILE *s,Real real);
202: void write_cmo_q(FILE *s,Q q);
203: void write_cmo_uint(FILE *s,USINT ui);
204: void write_cmo_mathcap(FILE *s,MATHCAP mc);
205: int cmo_tag(Obj obj,int *tag);
206: void write_cmo(FILE *s,Obj obj);
207: int valid_as_cmo(Obj obj);
208: void ox_flush_stream_force(int s);
209: void ox_flush_stream(int s);
210: int ox_check_cmo_dp(int s, DP p);
211: int ox_check_cmo_p(int s, P p);
212: void ox_get_serverinfo(int s, LIST *rp);
213: int ox_check_cmo(int s, Obj obj);
214: void ox_write_cmo(int s, Obj obj);
215: void ox_write_int(int s, int n);
216: void ox_read_local(int s, Obj *rp);
217: void ox_read_cmo(int s, Obj *rp);
218: void ox_read_int(int s, int *n);
219: void ox_get_result(int s,Obj *rp);
220: unsigned int ox_recv(int s, int *id, Obj *p);
221: void ox_send_local_ring(int s,VL vl);
222: void ox_send_local_data(int s,Obj p);
223: void ox_send_sync(int s);
224: void ox_send_cmd(int s,int id);
225: void ox_send_data(int s,pointer p);
226: void wait_for_data(int s);
227: int ox_data_is_available(int s);
228: void clear_readbuffer();
229: void end_critical();
230: void begin_critical();
231: int check_by_mc(int s,unsigned int oxtag,unsigned int cmotag);
232: int check_sm_by_mc(int s,unsigned int smtag);
233: void store_remote_mathcap(int s,MATHCAP mc);
234: void create_my_mathcap(char *system);
235: void ox_resetenv(char *s);
236: void cleanup_events();
237: void reset_io();
238: void endian_init();
239: int countobj(Obj p);
240: int count_as_cmo(Obj p);
241: int countvl(VL vl);
242: void ox_copy_init(char *s);
243: void ox_obj_to_buf_as_cmo(Obj p);
244: void ox_buf_to_obj_as_cmo(Obj *p);
245: void ox_vl_to_buf(VL vl);
246: int gen_fread (char *ptr,int size,int nitems,FILE *stream);
247: int gen_fwrite (char *ptr,int size,int nitems,FILE *stream);
248: void write_char(FILE *f,unsigned char *p);
249: void write_short(FILE *f,unsigned short *p);
250: void write_int(FILE *f,unsigned int *p);
251: void init_deskey();
252: void write_intarray(FILE *f,unsigned int *p,int l);
253: void write_longarray(FILE *f,unsigned long *p,int l);
254: void write_double(FILE *f,double *p);
255: void write_string(FILE *f,unsigned char *p,int l);
256: void read_char(FILE *f,unsigned char *p);
257: void read_short(FILE *f,unsigned short *p);
258: void read_int(FILE *f,unsigned int *p);
259: void read_intarray(FILE *f,unsigned int *p,int l);
260: void read_longarray(FILE *f,unsigned long *p,int l);
261: void read_string(FILE *f,unsigned char *p,int l);
262: void read_double(FILE *f,double *p);
263: int getremotesocket(int s);
264: void getremotename(int s,char *name);
265: void generate_port(int use_unix,char *port_str);
266: int try_bind_listen(int use_unix,char *port_str);
267: int try_accept(int af_unix,int s);
268: int try_connect(int use_unix,char *host,char *port_str);
269: void close_allconnections();
270: void free_iofp(int s);
271: int get_iofp(int s1,char *af_sock,int is_server);
272: void init_socket();
273: int get_fd(int index);
274: int get_index(int fd);
275: void ox_launch_generic(char *host,char *launcher,char *server,
276: int use_unix,int use_ssh,int use_x,int conn_to_serv,Q *rp);
277: void spawn_server(char *host,char *launcher,char *server,
278: int use_unix,int use_ssh,int use_x,int conn_to_serv,
279: char *control_port_str,char *server_port_str);
280: void ox_launch_main(int with_x,NODE arg,Obj *p);
281: int register_server(int af_unix,int m,int c);
282: int get_mcindex(int i);
283: void shutdown_all();
1.5 noro 284:
285: /* library functions */
286: void asir_ox_push_cmo(void *);
287: int asir_ox_pop_cmo(void *, int);
288: void asir_ox_push_cmd(int);
289: void asir_ox_execute_string(char *);
290: int asir_ox_peek_cmo_size();
291: int asir_ox_init(int);
1.13 noro 292:
FreeBSD-CVSweb <freebsd-cvsweb@FreeBSD.org>