Annotation of OpenXM_contrib2/asir2000/parse/parse.h, Revision 1.34
1.3 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.4 noro 26: * e-mail at risa-admin@sec.flab.fujitsu.co.jp of the detailed specification
1.3 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.34 ! noro 48: * $OpenXM: OpenXM_contrib2/asir2000/parse/parse.h,v 1.33 2004/10/27 08:21:47 noro Exp $
1.3 noro 49: */
1.6 noro 50: # if defined(VISUAL)
1.1 noro 51: #include <time.h>
52: #else
53: #include <sys/time.h>
54: #include <sys/resource.h>
55: #endif
56: #include <setjmp.h>
57: #ifdef ABS
58: #undef ABS
59: #define ABS(a) ((a)>0?(a):-(a))
60: #endif
61:
62: /* identifiers for expressions */
63:
64: typedef enum {
65: I_BOP, I_COP, I_AND, I_OR, I_NOT, I_CE,
66: I_PRESELF, I_POSTSELF,
1.10 noro 67: I_FUNC, I_FUNC_OPT, I_IFUNC, I_MAP, I_RECMAP, I_PFDERIV,
1.1 noro 68: I_ANS, I_PVAR, I_ASSPVAR,
69: I_FORMULA, I_LIST, I_STR, I_NEWCOMP, I_CAR, I_CDR, I_CAST,
1.31 noro 70: I_INDEX, I_EV, I_TIMER, I_GF2NGEN, I_GFPNGEN, I_GFSNGEN,
71: I_LOP, I_OPT, I_GETOPT, I_POINT, I_PAREN, I_MINUS,
72: I_NARYOP
1.1 noro 73: } fid;
74:
75: /* identifiers for statements */
76:
77: typedef enum {
78: S_BP, S_PFDEF,
79: S_SINGLE, S_CPLX,
80: S_IFELSE, S_FOR, S_DO,
81: S_BREAK, S_RETURN, S_CONTINUE
82: } sid;
83:
84: /* identifiers for comparison operators */
85:
86: typedef enum { C_LT, C_GT, C_LE, C_GE, C_EQ, C_NE } cid;
87:
88: /* identifiers for logical operators */
89:
90: typedef enum { L_LT, L_GT, L_LE, L_GE, L_EQ, L_NE, L_AND, L_OR, L_NOT, L_IMPL, L_REPL, L_EQUIV } lid;
91:
92: /* identifiers for functions */
93:
94: typedef enum { A_UNDEF, A_BIN, A_USR, A_PURE, A_PARI } aid;
95:
96: /* identifiers for indeterminates */
97:
98: typedef enum { V_IND, V_UC, V_PF, V_SR } vid;
99:
1.18 noro 100: typedef struct oVS {
1.1 noro 101: unsigned int n;
102: unsigned int asize;
103: unsigned int at;
104: unsigned int level;
105: struct oFUNC *usrf;
106: struct oPV *va;
107: NODE opt;
1.18 noro 108: } *VS;
1.1 noro 109:
1.18 noro 110: typedef struct oMODULE {
111: char *name;
112: VS pvs;
1.20 noro 113: NODE usrf_list;
1.18 noro 114: } *MODULE;
1.1 noro 115:
1.18 noro 116: typedef struct oPV {
1.1 noro 117: char *name;
118: short attr,type;
119: pointer priv;
1.18 noro 120: } *PV;
1.1 noro 121:
1.18 noro 122: typedef struct oINFILE {
1.1 noro 123: char *name;
124: FILE *fp;
125: int ln;
1.15 noro 126: struct oINFILE *next;
1.1 noro 127: char *tname;
128: int encoded;
129: short vol;
1.18 noro 130: } *INFILE;
1.1 noro 131:
132: struct oTKWD {
133: char *name;
134: int token;
135: };
1.32 noro 136:
137: typedef struct fid_spec {
138: fid id;
139: farg_type type[10];
140: } *fid_spec_p;
1.1 noro 141:
1.18 noro 142: typedef struct oARF {
1.1 noro 143: char *name;
144: void (*fp)();
1.18 noro 145: } *ARF;
1.1 noro 146:
1.18 noro 147: typedef struct oFUNC {
1.20 noro 148: char *name,*fullname;
1.1 noro 149: int argc;
150: int type;
1.33 noro 151: int secure;
1.1 noro 152: aid id;
153: union {
154: void (*binf)();
155: struct oUSRF *usrf;
156: struct oPF *puref;
157: } f;
1.18 noro 158: } *FUNC;
1.1 noro 159:
1.18 noro 160: typedef struct oUSRF {
1.1 noro 161: char *fname;
1.18 noro 162: MODULE module;
1.1 noro 163: int startl,endl;
164: NODE args;
165: VS pvs;
166: char *desc;
167: struct oSNODE *body;
1.18 noro 168: } *USRF;
1.1 noro 169:
1.18 noro 170: typedef struct oPF {
1.1 noro 171: char *name;
172: int argc;
173: Obj body;
174: V *args;
175: Obj *deriv;
176: NODE ins;
177: int (*pari)();
178: double (*libm)();
179: int (*simplify)();
1.18 noro 180: } *PF;
1.1 noro 181:
1.18 noro 182: typedef struct oPFAD {
1.1 noro 183: Obj arg;
184: int d;
1.18 noro 185: } *PFAD;
1.1 noro 186:
1.18 noro 187: typedef struct oPFINS {
1.1 noro 188: struct oPF *pf;
189: struct oPFAD ad[1];
1.18 noro 190: } *PFINS;
1.1 noro 191:
192: #define NEWPF(p) ((p)=(PF)MALLOC(sizeof(struct oPF)))
193:
1.18 noro 194: typedef struct oFNODE {
1.1 noro 195: fid id;
196: pointer arg[1];
1.18 noro 197: } *FNODE;
1.1 noro 198:
199: #define NEWFNODE(a,b) \
200: ((a)=(FNODE)MALLOC(sizeof(struct oFNODE)+sizeof(pointer)*(b-1)))
201:
1.18 noro 202: typedef struct oSNODE {
1.1 noro 203: sid id;
204: int ln;
205: pointer arg[1];
1.18 noro 206: } *SNODE;
1.1 noro 207:
208: #define NEWSNODE(a,b) \
209: ((a)=(SNODE)MALLOC(sizeof(struct oSNODE)+sizeof(pointer)*(b-1)),(a)->ln=asir_infile->ln)
210:
1.18 noro 211: typedef struct oPVI {
1.1 noro 212: int pv;
213: NODE index;
1.18 noro 214: } *PVI;
1.1 noro 215:
1.18 noro 216: typedef struct oNODE2 {
1.1 noro 217: pointer body1,body2;
218: struct oNODE2 *next;
1.18 noro 219: } *NODE2;
1.1 noro 220:
221: struct ftab {
222: char *name;
223: void (*f)();
224: int argc;
225: };
226:
227: #define MKPVI(a,b,c)\
228: ((a)=(pointer)MALLOC(sizeof(struct oPVI)),((PVI)(a))->pv=(b),((PVI)(a))->index=(c))
229:
230: #define FA0(f) ((f)->arg[0])
231: #define FA1(f) ((f)->arg[1])
232: #define FA2(f) ((f)->arg[2])
233: #define FA3(f) ((f)->arg[3])
234: #define FA4(f) ((f)->arg[4])
235: #define FA5(f) ((f)->arg[5])
236: #define FA6(f) ((f)->arg[6])
237:
238: #define ARG0(a) ((a)->body)
239: #define ARG1(a) (NEXT(a)->body)
240: #define ARG2(a) (NEXT(NEXT(a))->body)
241: #define ARG3(a) (NEXT(NEXT(NEXT(a)))->body)
242: #define ARG4(a) (NEXT(NEXT(NEXT(NEXT((a)))))->body)
243: #define ARG5(a) (NEXT(NEXT(NEXT(NEXT(NEXT((a))))))->body)
244: #define ARG6(a) (NEXT(NEXT(NEXT(NEXT(NEXT(NEXT((a)))))))->body)
245: #define ARG7(a) (NEXT(NEXT(NEXT(NEXT(NEXT(NEXT(NEXT((a))))))))->body)
246: #define ARG8(a) (NEXT(NEXT(NEXT(NEXT(NEXT(NEXT(NEXT(NEXT((a)))))))))->body)
247: #define ARG9(a) (NEXT(NEXT(NEXT(NEXT(NEXT(NEXT(NEXT(NEXT(NEXT((a))))))))))->body)
248: #define ARG10(a) (NEXT(NEXT(NEXT(NEXT(NEXT(NEXT(NEXT(NEXT(NEXT(NEXT((a)))))))))))->body)
249:
250: #define asir_assert(ptr,id,message)\
251: switch ( id ) {\
252: case O_N: case O_P: case O_R:\
253: if( (ptr) && (OID(ptr) > (id)) ) {\
254: fprintf(stderr,message);\
255: error(" : invalid argument");\
256: }\
257: break;\
258: case O_DP:\
259: if( (ptr) && (OID(ptr) != (id)) ) {\
260: fprintf(stderr,message);\
261: error(" : invalid argument");\
262: }\
263: break;\
264: default:\
265: if( !(ptr) || (OID(ptr) != (id)) ) {\
266: fprintf(stderr,message);\
267: error(" : invalid argument");\
268: }\
269: break;\
270: }
271:
272: #define DEFSIZE 32
1.18 noro 273: #define PVGLOBAL(i) (((unsigned int)(i))|(1<<30))
274: #define PVMGLOBAL(i) (((unsigned int)(i))|(3<<30))
275: #define PVATTR(i) (((unsigned int)(i))>>30)
276: #define PVIND(i) (((unsigned int)(i))&0x3fffffff)
1.1 noro 277: #define GETPV(i,p) \
1.18 noro 278: (PVATTR(i)==0?(int)((p)=CPVS->va[(unsigned int)(i)].priv)\
279: :PVATTR(i)==1?(int)((p)=GPVS->va[PVIND(i)].priv)\
280: :(int)((p)=MPVS->va[PVIND(i)].priv))
281: #define GETPVREF(i,p) \
282: (PVATTR(i)==0?(int)((p)=&(CPVS->va[(unsigned int)(i)].priv))\
283: :PVATTR(i)==1?(int)((p)=&(GPVS->va[PVIND(i)].priv))\
284: :(int)((p)=&(MPVS->va[PVIND(i)].priv)))
1.13 noro 285: #define GETPVNAME(i,p) \
1.18 noro 286: (PVATTR(i)==0?(int)((p)=CPVS->va[(unsigned int)(i)].name)\
287: :PVATTR(i)==1?(int)((p)=GPVS->va[PVIND(i)].name)\
288: :(int)((p)=MPVS->va[PVIND(i)].name))
1.1 noro 289: #define ASSPV(i,p) \
1.18 noro 290: (PVATTR(i)==0?(int)(CPVS->va[(unsigned int)(i)].priv=(pointer)(p))\
291: :PVATTR(i)==1?(int)(GPVS->va[PVIND(i)].priv=(pointer)(p))\
292: :(int)(MPVS->va[PVIND(i)].priv=(pointer)(p)))
1.1 noro 293:
294: #define NEWNODE2(a) ((a)=(NODE2)MALLOC(sizeof(struct oNODE2)))
295: #define MKNODE2(a,b,c,d) \
296: (NEWNODE2(a),(a)->body1=(pointer)b,(a)->body2=(pointer)c,NEXT(a)=(NODE2)(d))
297: #define BDY1(a) ((a)->body1)
298: #define BDY2(a) ((a)->body2)
299:
1.18 noro 300: extern VS GPVS,CPVS,EPVS,APVS,MPVS;
301: extern MODULE CUR_MODULE;
302: extern NODE MODULE_LIST;
1.19 noro 303: extern char *CUR_FUNC;
1.1 noro 304: extern ARF addfs, subfs, mulfs, divfs, remfs, pwrfs;
1.15 noro 305: extern INFILE asir_infile;
1.1 noro 306: extern NODE usrf,sysf,noargsysf,ubinf,parif,ONENODE;
307: extern int nextbp,nextbplevel;
308: extern int Verbose;
1.23 ohara 309: extern int do_quiet;
1.27 noro 310: extern SYMBOL Symbol_grlex, Symbol_glex, Symbol_lex;
1.30 noro 311: extern NODE current_option;
1.1 noro 312:
313: #if defined(VISUAL_LIB)
314: #include <w_stdio.h>
315: #undef getc
316: #define getc w_fgetc
317: #undef putc
318: #define putc w_fputc
319: #define fputc w_fputc
320: #define ungetc w_ungetc
321: #define fgets w_fgets
322: #define fputs w_fputs
323: #define printf w_printf
324: #define fprintf w_fprintf
325: #define fflush w_fflush
326: #endif
327:
1.22 noro 328: #if defined(__GNUC__) || defined(VISUAL) || (defined(__MACH__) && defined(__ppc__)) || defined(__FreeBSD__)
1.1 noro 329: NODE mknode(int,...);
330: FNODE mkfnode(int,fid,...);
331: SNODE mksnode(int,sid,...);
332: void call_usrf(FUNC f,...);
333: #else
334: NODE mknode();
335: FNODE mkfnode();
336: SNODE mksnode();
337: void call_usrf();
338: #endif
339:
340: /* prototypes */
341:
1.7 noro 342: void dp_ptozp2_d(DP,DP,DP *,DP *);
343: void dp_ptozp_d(DP,DP *);
1.1 noro 344: void dp_vtod(Q *,DP,DP *);
345: void dp_idivv_hist(Q,DP *);
346: void dp_igcdv_hist(DP,Q *);
347: void dp_ptozp2(DP,DP,DP *,DP *);
348: void dp_ptozp(DP,DP *);
349: void dp_nf_tab_mod(DP,LIST *,int,DP *);
350: void dp_lnf_mod(DP,DP,NODE,int,DP *,DP *);
351: void insert_to_node(DL,NODE *,int);
352: int _dl_redble(DL,DL,int);
353: void dp_mbase(NODE,NODE *);
354: void dp_dtov(DP,VECT *);
355: void dp_cont(DP,Q *);
356: void dp_idiv(DP,Q,DP *);
357:
358: int dp_nt(DP);
359: void dp_dehomo(DP,DP *);
360: void dp_homo(DP,DP *);
361: DL lcm_of_DL(int,DL,DL,DL);
362: void dp_rest(DP,DP *);
363: void dp_hm(DP,DP *);
364: void dp_sp_mod(DP,DP,int,DP *);
365: void dp_sp(DP,DP,DP *);
1.2 noro 366: void dp_red(DP,DP,DP,DP *,DP *,P *,DP *);
1.1 noro 367: void dp_subd(DP,DP,DP *);
368: void dp_red_mod(DP,DP,DP,int,DP *,DP *,P *);
369: int dp_redble(DP,DP);
370: int comp_nm(Q *,Q *);
371: void dp_true_nf_mod(NODE,DP,DP *,int,int,DP *,P *);
372: void dp_nf_mod(NODE,DP,DP *,int,int,DP *);
373: void dp_nf_mod_qindex(NODE,DP,DP *,int,int,DP *);
374: void dp_nf_ptozp(NODE,DP,DP *,int,int,DP *);
375: void dp_true_nf(NODE,DP,DP *,int,DP *,P *);
376: void dp_nf(NODE,DP,DP *,int,DP *);
377: void dp_rat(DP,DP *);
378: void dp_mod(DP,int,NODE,DP *);
379: void dp_prim_mod(DP,int,DP *);
380: void dp_prim(DP,DP *);
381: void heu_nezgcdnpz(VL,P *,int,P *);
1.24 noro 382: void homogenize_order(struct order_spec *,int,struct order_spec **);
383: int create_order_spec(VL,Obj,struct order_spec **);
1.1 noro 384:
385: int dl_equal(int,DL,DL);
386: void qltozl(Q *,int,Q *);
387: int cmpdl_matrix(int,DL,DL);
388: int cmpdl_order_pair(int,DL,DL);
389: int cmpdl_elim(int,DL,DL);
390: int cmpdl_blexrev(int,DL,DL);
391: int cmpdl_bgradrev(int,DL,DL);
392: int cmpdl_brevrev(int,DL,DL);
393: int cmpdl_brevgradlex(int,DL,DL);
394: int cmpdl_bgradlex(int,DL,DL);
395: int cmpdl_blex(int,DL,DL);
396: int cmpdl_revgradlex(int,DL,DL);
397: int cmpdl_gradlex(int,DL,DL);
398: int cmpdl_revlex(int,DL,DL);
399: int cmpdl_lex(int,DL,DL);
400: int compd(VL,DP,DP);
401: void adddl(int,DL,DL,DL *);
402: void divsdc(VL,DP,P,DP *);
403: void muldc(VL,DP,P,DP *);
404: void muldm(VL,DP,MP,DP *);
405: void muld(VL,DP,DP,DP *);
406: void chsgnd(DP,DP *);
407: void subd(VL,DP,DP,DP *);
408: void addd(VL,DP,DP,DP *);
409: int sugard(MP);
410: void nodetod(NODE,DP *);
411: void dtop(VL,VL,DP,P *);
412: void ptod(VL,VL,P,DP *);
413: void initd(struct order_spec *);
414:
415: int mainparse(SNODE *);
416: int exprparse(FUNC,char *,FNODE *);
417: void output_init(void);
418: void GC_init(void);
419: void env_init(void);
420: void soutput_init(char *);
421: void appendparif(NODE *,char *,int (*)(),int);
422: int mmono(P);
423: void mkpow(VL,Obj,Obj,Obj *);
424: void _printdp(DP);
425: int mt_save(char *);
426: int mt_load(char *);
427: void sortbynm(Q *,int);
428: void iqrv(VECT,Q,LIST *);
429: void igcdv(VECT,Q *);
430: void igcdv_estimate(VECT,Q *);
431: void cpp_main(int,char **);
432: int afternl(void);
433: void glob_init();
434: void input_init(FILE *,char *);
435: void asir_terminate(int);
436: void param_init(void);
437: void sprompt(char *);
1.17 ohara 438: void cppname_init();
1.1 noro 439: void process_args(int,char **);
440: void sig_init(void);
441: void asir_save_handler(void);
442: void asir_set_handler(void);
443: void asir_reset_handler(void);
444: void resetenv(char *);
445: void fatal(int);
446: void restore_handler(void);
447: void resize_buffer(void);
448: void tty_init(void);
449: void tty_reset(void);
450: void set_timer(int);
451: void reset_timer(void);
452: void int_handler(int);
453: void int_handler(int);
454: void segv_handler(int);
455: void bus_handler(int);
456: void fpe_handler(int);
457: void ill_handler(int);
458: void winch_handler(int);
459: void pipe_handler(int);
460: void usr1_handler(int);
461: void alrm_handler(int);
462: void copyright(void);
463: void kan_init(void);
464: void pushpvs(FUNC);
465: void read_eval_loop(void);
466: void prompt(void);
467: void storeans(pointer);
468: int yyparse(void);
469: void nodetod(NODE,DP *);
470: void poppvs(void);
471: int length(NODE);
472: int get_heapsize(void);
473: int searchpvar(char *);
474: void mkparif(char *,FUNC *);
475: void makevar(char *,P *);
1.19 noro 476: void mkpvs(char *);
477: MODULE mkmodule(char *);
1.1 noro 478: void stoarg(char *,int *,char **);
479: void yyerror(char *);
480: void closecurrentinput(void);
481: void asir_terminate(int);
482: void searchasirpath(char *,char **);
483: void get_vars(Obj,VL *);
484: void appendbinf(NODE *,char *,void(*)(),int);
485: void appendubinf(char *,void(*)(),int);
486: void parif_init(void);
487: void sysf_init(void);
488: void makesrvar(FUNC, P *);
489: void sprintexpr(VL,Obj);
490: void printexpr(VL,Obj);
491: void appendvar(VL,V);
492: void change_mvar(VL,P,V,P *);
493: void restore_mvar(VL,P,V,P *);
494: int argc(NODE);
495: void printn(N);
496: void sprintn(N);
497: void printv(VL,V);
498: void sprintv(VL,V);
499: int arf_comp(VL, Obj, Obj);
500: int complist(VL, LIST, LIST);
501: int complist(VL, LIST, LIST);
502: int getcompsize(int);
503: int getpvar(VS,char *,int);
504: int getpvar(VS,char *,int);
505: int gettype(unsigned int);
506: int indextotype(int,int);
507: int loadfile(char *);
508: int loadfiles(NODE);
1.18 noro 509: unsigned int makepvar(char *);
1.1 noro 510: int membertoindex(int,char *);
511: int qcoefp(Obj);
512: int qcoefr(Obj);
513: int rangecheck(Obj,int);
514: int structtoindex(char *);
515: pointer eval(FNODE);
516: pointer evalf(FUNC,FNODE,FNODE);
1.15 noro 517: pointer bevalf(FUNC,NODE);
1.1 noro 518: pointer evalif(FNODE,FNODE);
519: pointer evalnode(NODE node);
520: pointer evalpf(PF,NODE);
521: pointer evalparif(FUNC,NODE);
522: pointer evalpv(int,FNODE,pointer);
523: pointer evalstat(SNODE f);
524: void _mkpfins(PF ,Obj *,V *);
525: void appendpfins(V ,V *);
526: void appenduf(char *,FUNC *);
527: void arf_add(VL, Obj, Obj, Obj *);
528: void arf_chsgn(Obj, Obj *);
529: void arf_div(VL, Obj, Obj, Obj *);
530: void arf_init(void);
531: void arf_mul(VL, Obj, Obj, Obj *);
532: void arf_pwr(VL, Obj, Obj, Obj *);
533: void arf_remain(VL, Obj, Obj, Obj *);
534: void arf_sub(VL, Obj, Obj, Obj *);
535: void bp(SNODE);
536: void clearbp(FUNC);
537: void debug(SNODE);
538: void debug_init(void);
539: void delbp(int, char **);
540: void derivr(VL ,Obj ,V ,Obj *);
541: void derivvar(VL ,V ,V ,Obj *);
542: void duppfins(V ,V *);
543: void error(char *);
544: void evalins(PFINS ,int ,Obj *);
545: void evalnodebody(NODE,NODE *);
546: void evalp(VL ,P ,int ,P *);
547: void evalr(VL ,Obj ,int ,Obj *);
548: void evalv(VL ,V ,int ,Obj *);
549: void getarrayp(Obj,NODE,Obj **);
550: void getmember(FNODE,Obj *);
551: void getmemberp(FNODE,Obj **);
552: void help(char *);
553: void instov(PFINS ,V *);
1.5 noro 554: Obj memberofstruct(COMP,char *);
1.1 noro 555: void mkpf(char *,Obj ,int ,V *,int (*)(),double (*)(),int (*)(),PF *);
556: void mkpfins(PF ,V *,V *);
1.18 noro 557: void mkuf(char *,char *,NODE,SNODE,int,int,char *,MODULE);
1.1 noro 558: void newstruct(int,struct oCOMP **);
559: void optobj(Obj *);
560: void println(int, char **, int);
561: void printvars(char *,VS);
562: void resetpvs(void);
563: void searchc(char *,FUNC *);
564: void searchf(NODE,char *,FUNC *);
565: void searchpf(char *,FUNC *);
566: void searchsn(SNODE *, int, SNODE **);
567: void setbp(char *);
568: void setf(int, char **);
569: void setstruct(char *,NODE);
570: void showbp(int);
571: void showbps(void);
572: void showpos(void);
573: void simplify_ins(PFINS ,Obj *);
574: void sprintvars(char *,VS);
1.5 noro 575: int structdef(char *,NODE);
1.1 noro 576: void substfp(VL ,Obj ,PF ,PF ,Obj *);
577: void substfr(VL ,Obj ,PF ,PF ,Obj *);
578: void substfv(VL ,V ,PF ,PF ,Obj *);
579: void substpr(VL ,int ,Obj ,V ,Obj ,Obj *);
580: void substr(VL ,int ,Obj ,V ,Obj ,Obj *);
581: void appendtonode(NODE,pointer, NODE *);
582: void getarray(pointer,NODE,pointer *);
583: void putarray(pointer,NODE,pointer);
584:
585: void addcomp(VL,COMP,COMP,COMP *);
586: void subcomp(VL,COMP,COMP,COMP *);
587: void mulcomp(VL,COMP,COMP,COMP *);
588: void divcomp(VL,COMP,COMP,COMP *);
589: void chsgncomp(COMP,COMP *);
590: void pwrcomp(VL,COMP,Obj,COMP *);
591: int compcomp(VL,COMP,COMP);
1.15 noro 592:
593: void mergedeglist(NODE d0,NODE d1,NODE *dr);
594: void getdeglist(P p,V v,NODE *d);
595: void restore_mvar(VL vl,P p,V v,P *r);
596: void change_mvar(VL vl,P p,V v,P *r);
597: void getcoef(VL vl,P p,V v,Q d,P *r);
598: void ranp(int n,UP *nr);
599:
600: void _print_mp(int nv,MP m);
601: int dp_homogeneous(DP p);
602: int dp_nt(DP p);
603: int dl_equal(int nv,DL dl1,DL dl2);
604: DL lcm_of_DL(int nv,DL dl1,DL dl2,DL dl);
605: void dp_rest(DP p,DP *rp);
606: void dp_hm(DP p,DP *rp);
607: void dltod(DL d,int n,DP *rp);
608: void dp_subd(DP p1,DP p2,DP *rp);
609: int dp_redble(DP p1,DP p2);
610: void sortbynm(Q *w,int n);
611: int comp_nm(Q *a,Q *b);
612: void qltozl(Q *w,int n,Q *dvr);
613: void dp_rat(DP p,DP *rp);
614: void dp_mod(DP p,int mod,NODE subst,DP *rp);
615: void dp_dehomo(DP p,DP *rp);
616: void dp_homo(DP p,DP *rp);
617: void dp_nf_tab_mod(DP p,LIST *tab,int mod,DP *rp);
618: void dp_lnf_mod(DP p1,DP p2,NODE g,int mod,DP *r1p,DP *r2p);
619: void dp_lnf_f(DP p1,DP p2,NODE g,DP *r1p,DP *r2p);
620: void _dp_nf_mod_destructive(NODE b,DP g,DP *ps,int mod,int full,DP *rp);
621: void dp_true_nf_mod(NODE b,DP g,DP *ps,int mod,int full,DP *rp,P *dnp);
622: void dp_nf_mod(NODE b,DP g,DP *ps,int mod,int full,DP *rp);
623: void dp_nf_f(NODE b,DP g,DP *ps,int full,DP *rp);
624: void dp_nf_z(NODE b,DP g,DP *ps,int full,int multiple,DP *rp);
625: void dp_true_nf(NODE b,DP g,DP *ps,int full,DP *rp,P *dnp);
626: void _dp_red_mod_destructive(DP p1,DP p2,int mod,DP *rp);
627: void dp_red_mod(DP p0,DP p1,DP p2,int mod,DP *head,DP *rest,P *dnp);
628: void dp_red_f(DP p1,DP p2,DP *rest);
629: void dp_red(DP p0,DP p1,DP p2,DP *head,DP *rest,P *dnp,DP *multp);
630: void _dp_sp_mod(DP p1,DP p2,int mod,DP *rp);
631: void _dp_sp_mod_dup(DP p1,DP p2,int mod,DP *rp);
632: void dp_sp_mod(DP p1,DP p2,int mod,DP *rp);
633: void _dp_sp_dup(DP p1,DP p2,DP *rp);
634: void dp_sp(DP p1,DP p2,DP *rp);
635: void dp_dtov(DP dp,VECT *rp);
636: void dp_cont(DP p,Q *rp);
637: void dp_prim_mod(DP p,int mod,DP *rp);
638: void heu_nezgcdnpz(VL vl,P *pl,int m,P *pr);
639: void dp_prim(DP p,DP *rp);
640: void dp_ptozp2_d(DP p0,DP p1,DP *hp,DP *rp);
641: void dp_ptozp_d(DP p,DP *rp);
642: void dp_vtod(Q *c,DP p,DP *rp);
643: void insert_to_node(DL d,NODE *n,int nvar);
644: int _dl_redble(DL d1,DL d2,int nvar);
645: void dp_mbase(NODE hlist,NODE *mbase);
646: void dp_idiv(DP p,Q c,DP *rp);
647: void dp_ptozp2(DP p0,DP p1,DP *hp,DP *rp);
648: void dp_ptozp(DP p,DP *rp);
649: int eqdl(int nv,DL dl1,DL dl2);
650: void _dpmod_to_vect(DP f,DL *at,int *b);
651: void _tf_to_vect_compress(NODE tf,DL *at,CDP *b);
652: void dp_to_vect(DP f,DL *at,Q *b);
653: NODE dp_dllist(DP f);
654: NODE mul_dllist(DL d,DP f);
655: void pdl(NODE f);
656: void dp_gr_main(LIST f,LIST v,Num homo,int modular,int field,struct order_spec *ord,LIST *rp);
657: void dp_gr_mod_main(LIST f,LIST v,Num homo,int m,struct order_spec *ord,LIST *rp);
658: void dp_f4_main(LIST f,LIST v,struct order_spec *ord,LIST *rp);
659: void dp_f4_mod_main(LIST f,LIST v,int m,struct order_spec *ord,LIST *rp);
660: NODE gb_f4(NODE f);
661: NODE gb_f4_mod(NODE f,int m);
662: NODE gb_f4_mod_old(NODE f,int m);
663: int DPPlength(DP_pairs n);
664: void printdl(DL dl);
665: void pltovl(LIST l,VL *vl);
666: void makesubst(VL v,NODE *s);
667: void printsubst(NODE s);
668: void vlminus(VL v,VL w,VL *d);
669: int validhc(P a,int m,NODE s);
670: void setup_arrays(NODE f,int m,NODE *r);
671: void prim_part(DP f,int m,DP *r);
672: NODE /* of DP */ NODE_sortb_insert( DP newdp, NODE /* of DP */ nd, int dec );
673: NODE NODE_sortb( NODE node, int dec );
674: NODE /* of index */ NODE_sortbi_insert( int newdpi, NODE /* of index */ nd, int dec );
675: NODE NODE_sortbi( NODE node, int dec );
676: void reduceall(NODE in,NODE *h);
677: void reduceall_mod(NODE in,int m,NODE *h);
678: int newps(DP a,int m,NODE subst);
679: int newps_nosave(DP a,int m,NODE subst);
680: int newps_mod(DP a,int m);
681: void reducebase_dehomo(NODE f,NODE *g);
682: NODE append_one(NODE f,int n);
683: DP_pairs minp( DP_pairs d, DP_pairs *prest );
684: void minsugar(DP_pairs d,DP_pairs *dm,DP_pairs *dr);
685: NODE gb(NODE f,int m,NODE subst);
686: NODE gb_mod(NODE f,int m);
687: DP_pairs updpairs( DP_pairs d, NODE /* of index */ g, int t);
688: DP_pairs newpairs( NODE /* of index */ g, int t );
689: DP_pairs criterion_B( DP_pairs d, int s );
690: DP_pairs criterion_M( DP_pairs d1 );
691: int criterion_2( int dp1, int dp2 );
692: DP_pairs criterion_F( DP_pairs d1 );
693: NODE updbase(NODE g,int t);
694: NODE /* of index */ remove_reducibles(NODE /* of index */ nd, int newdp );
695: int dl_redble(DL dl1,DL dl2);
1.16 noro 696: int dl_weyl_weight(DL dl);
1.15 noro 697: int gbcheck(NODE f);
698: int membercheck(NODE f,NODE x);
699: void dp_set_flag(Obj name,Obj value);
700: void dp_make_flaglist(LIST *list);
701: void dp_save(int index,Obj p,char *prefix);
702: void dp_load(int index,DP *p);
703: int dp_load_t(int index,DP *p);
704: void init_stat();
705: void print_stat();
706: void dp_mulc_d(DP p,P c,DP *r);
707: void _dp_nf(NODE b,DP g,DP *ps,int full,DP *rp);
708: void _dp_nf_z(NODE b,DP g,DP *ps,int full,int multiple,DP *r);
709: void dp_imul_d(DP p,Q q,DP *rp);
710: void imulv(VECT w,Q c,VECT *rp);
711: void dptoca(DP p,unsigned int **rp);
712: int yylex();
713: void purge_stdin();
714: int afternl();
715: int aftercomment();
716: int myatoi(char *s);
717: void yyerror(char *s);
718: int Egetc(FILE *fp);
719: void Eungetc(int c,FILE *fp);
720: int readline_getc();
721: void readline_ungetc();
722: char *readline_console(char *prompt);
723: void ox_usr1_handler(int sig);
724: void env_init();
725: void loadasirfile(char *name0);
726: void execasirfile(char *name);
727: void load_and_execfile(char *name);
728: int loadfile(char *s);
729: int loadfiles(NODE node);
730: unsigned char encrypt_char(unsigned char c);
731: unsigned char decrypt_char(unsigned char c);
732: void encrypt_file(char *in,char *out);
733: void decrypt_file(char *in,char *out);
734: void get_vars(Obj t,VL *vlp);
735: void get_vars_recursive(Obj obj,VL *vlp);
736: int comp_obj(Obj *a,Obj *b);
737: int generic_comp_obj(Obj *a,Obj *b);
738: void sepvect(VECT v,int d,VECT *rp);
739: int gauss_elim_mod(int **mat,int row,int col,int md);
740: int generic_gauss_elim(MAT mat,MAT *nm,Q *dn,int **rindp,int **cindp);
741: int generic_gauss_elim_hensel(MAT mat,MAT *nmmat,Q *dn,int **rindp,int **cindp);
742: int gensolve_check(MAT mat,MAT nm,Q dn,int *rind,int *cind);
743: int inttorat(N c,N m,N b,int *sgnp,N *nmp,N *dnp);
744: int intmtoratm(MAT mat,N md,MAT nm,Q *dn);
745: int intmtoratm_q(MAT mat,N md,MAT nm,Q *dn);
746: void reduce_reducers_mod(int **mat,int row,int col,int md);
747: void pre_reduce_mod(int **mat,int row,int col,int nred,int md);
748: void reduce_sp_by_red_mod(int *sp,int **redmat,int *ind,int nred,int col,int md);
749: void red_by_compress(int m,unsigned int *p,unsigned int *r,
750: unsigned int *ri,unsigned int hc,int len);
751: void red_by_vect(int m,unsigned int *p,unsigned int *r,unsigned int hc,int len);
752: void reduce_sp_by_red_mod_compress (int *sp,CDP *redmat,int *ind,
753: int nred,int col,int md);
754: int generic_gauss_elim_mod(int **mat0,int row,int col,int md,int *colstat);
755: int lu_gfmmat(GFMMAT mat,unsigned int md,int *perm);
756: int find_lhs_and_lu_mod(unsigned int **a,int row,int col,
757: unsigned int md,int **rinfo,int **cinfo);
1.34 ! noro 758: void solve_by_lu_mod(int **a,int n,int md,int **b,int l,int normalize);
1.15 noro 759: int gauss_elim_mod1(int **mat,int row,int col,int md);
760: int gauss_elim_geninv_mod(unsigned int **mat,int row,int col,int md);
761: void solve_by_lu_gfmmat(GFMMAT lu,unsigned int md,unsigned int *b,unsigned int *x);
762: void mat_to_gfmmat(MAT m,unsigned int md,GFMMAT *rp);
763: int gauss_elim_geninv_mod_swap(unsigned int **mat,int row,int col,
764: unsigned int md,unsigned int ***invmatp,int **indexp);
765: void inner_product_int(Q *a,Q *b,int n,Q *r);
766: void inner_product_mat_int_mod(Q **a,int **b,int n,int k,int l,Q *r);
767: int generate_ONB_polynomial(UP2 *rp,int m,int type);
768: int _generate_irreducible_polynomial(UP2 f,int d);
769: int _generate_good_irreducible_polynomial(UP2 f,int d);
770: void printqmat(Q **mat,int row,int col);
771: void printimat(int **mat,int row,int col);
772: void ixor(N n1,N n2,N *r);
773: void ior(N n1,N n2,N *r);
774: void iand(N n1,N n2,N *r);
775: void isqrt(N a,N *r);
776: void igcd_cofactor(Q a,Q b,Q *gcd,Q *ca,Q *cb);
777: int comp_n(N *a,N *b);
778: int TypeT_NB_check(unsigned int m, unsigned int t);
779: int small_jacobi(int a,int m);
780: void pushpvs(FUNC f);
781: void poppvs();
1.18 noro 782: unsigned int makepvar(char *str);
1.15 noro 783: int searchpvar(char *str);
784: int getpvar(VS pvs,char *str,int searchonly);
785: void closecurrentinput();
786: void resetpvs();
787: void savepvs();
788: void restorepvs();
789: void storeans(pointer p);
790: void get_rootdir(char *name,int len);
791: void set_rootdir(char *name);
792: int process_id();
793: void call_exe(char *name,char **av);
794: void addquote(VL vl,QUOTE a,QUOTE b,QUOTE *c);
795: void subquote(VL vl,QUOTE a,QUOTE b,QUOTE *c);
796: void mulquote(VL vl,QUOTE a,QUOTE b,QUOTE *c);
797: void divquote(VL vl,QUOTE a,QUOTE b,QUOTE *c);
798: void pwrquote(VL vl,QUOTE a,QUOTE b,QUOTE *c);
799: void chsgnquote(QUOTE a,QUOTE *c);
800: void objtoquote(Obj a,QUOTE *c);
801: void polytoquote(P a,QUOTE *c);
802: void dptoquote(DP a,QUOTE *c);
1.28 noro 803: void dctoquote(DCP dc,QUOTE v,QUOTE *c,int *sgn);
1.29 noro 804: void mptoquote(MP m,int n,QUOTE *c,int *sgn);
1.15 noro 805: void vartoquote(V v,QUOTE *c);
806: void fnodetotree(FNODE f,LIST *rp);
807: FNODE eval_pvar_in_fnode(FNODE f);
808: FNODE subst_in_fnode(FNODE f,V v,FNODE g);
809: char *get_attribute(char *key,LIST attr);
810: void treetofnode(Obj obj,FNODE *f);
811: void glob_init() ;
812: void input_init(FILE *fp,char *name);
813: void notdef(VL vl,Obj a,Obj b,Obj *c);
814: void ExitAsir() ;
815: void asir_terminate(int status);
816: void param_init() ;
817: void prompt() ;
818: void sprompt(char *ptr);
819: void process_args(int ac,char **av);
820: void sig_init() ;
821: static void (*old_int)(int);;
822: void asir_save_handler() ;
823: void asir_set_handler() ;
824: void asir_reset_handler() ;
825: void resetenv(char *s);
826: void fatal(int n);
827: void int_handler(int sig);
828: void restore_handler() ;
829: void segv_handler(int sig);
830: void ill_handler(int sig);
831: void alrm_handler(int sig);
832: void bus_handler(int sig);
833: void fpe_handler(int sig);
834: void pipe_handler(int sig);
835: void resize_buffer();
836: void tty_init() ;
837: void tty_reset() ;
838: void set_lasterror(char *s);
839: void error(char *s);
840: void set_timer(int interval);
841: void reset_timer();
842: void copyright() ;
843: void show_debug_window(int on);
844: void init_cmdwin();
845: void searchpf(char *name,FUNC *fp);
846: void searchc(char *name,FUNC *fp);
847: void mkpf(char *name,Obj body,int argc,V *args,
848: int (*parif)(),double (*libmf)(), int (*simp)(),PF *pfp);
849: void mkpfins(PF pf,V *args,V *vp);
850: void _mkpfins(PF pf,Obj *args,V *vp);
851: void _mkpfins_with_darray(PF pf,Obj *args,int *darray,V *vp);
852: void appendpfins(V v,V *vp);
853: void duppfins(V v,V *vp);
854: void derivvar(VL vl,V pf,V v,Obj *a);
855: void derivr(VL vl,Obj a,V v,Obj *b);
856: void substr(VL vl,int partial,Obj a,V v,Obj b,Obj *c);
857: void substpr(VL vl,int partial,Obj p,V v0,Obj p0,Obj *pr);
858: void evalr(VL vl,Obj a,int prec,Obj *c);
859: void evalp(VL vl,P p,int prec,P *pr);
860: void evalv(VL vl,V v,int prec,Obj *rp);
861: void evalins(PFINS ins,int prec,Obj *rp);
862: void devalr(VL vl,Obj a,Obj *c);
863: void devalp(VL vl,P p,P *pr);
864: void devalv(VL vl,V v,Obj *rp);
865: void devalins(PFINS ins,Obj *rp);
866: void simplify_ins(PFINS ins,Obj *rp);
867: void instov(PFINS ins,V *vp);
868: void substfr(VL vl,Obj a,PF u,PF f,Obj *c);
869: void substfp(VL vl,Obj p,PF u,PF f,Obj *pr);
870: void substfv(VL vl,V v,PF u,PF f,Obj *c);
871: int structdef(char *name,NODE member);
872: void newstruct(int type,COMP *rp);
873: int structtoindex(char *name);
874: int membertoindex(int type,char *name);
875: int getcompsize(int type);
876: Obj memberofstruct(COMP a,char *name);
877: void assign_to_member(COMP a,char *name,Obj obj);
878: void node_concat_dup(NODE n1,NODE n2,NODE *nr);
879: pointer evall(lid id,Obj a1,Obj a2);
880: pointer eval(FNODE f);
881: pointer evalstat(SNODE f);
882: pointer evalnode(NODE node);
883: pointer evalf(FUNC f,FNODE a,FNODE opt);
884: pointer evalmapf(FUNC f,FNODE a);
885: pointer eval_rec_mapf(FUNC f,FNODE a);
886: pointer beval_rec_mapf(FUNC f,NODE node);
887: pointer bevalf(FUNC f,NODE a);
888: pointer evalif(FNODE f,FNODE a);
889: pointer evalpf(PF pf,NODE args);
890: void evalnodebody(NODE sn,NODE *dnp);
891: void gen_searchf(char *name,FUNC *r);
892: void searchf(NODE fn,char *name,FUNC *r);
893: void appenduf(char *name,FUNC *r);
894: void mkparif(char *name,FUNC *r);
1.18 noro 895: void mkuf(char *name,char *fname,NODE args,SNODE body,int startl,int endl,char *desc,MODULE module);
1.15 noro 896: Obj getopt_from_cpvs(char *key);
897: void des_enc(unsigned long *, unsigned char *, unsigned long *);
898: unsigned long round_func(unsigned long , unsigned char *);
899: unsigned long s_box_func(unsigned char *);
900: void des_dec(unsigned long *, unsigned char *, unsigned long *);
901: void key_schedule(unsigned char *,unsigned char *);
902: void debug_init();
903: void add_alias(char *com,char *alias);
904: void show_alias(char *alias);
905: void debug(SNODE f);
906: void setf(int ac,char **av);
907: void setbp(char *p);
908: void settp(char *p);
909: void clearbp(FUNC f);
910: int searchbp();
911: void delbp(int ac,char **av);
912: void showbps();
913: void showbp(int n);
914: void searchsn(SNODE *fp,int n,SNODE **fpp);
915: void bp(SNODE f);
916: void println(int ac,char **av,int l);
917: void printvars(char *s,VS vs);
918: void showpos();
919: void showpos_to_string(char *buf);
920: void change_stack(int level,NODE *pvss);
921: void show_stack(VS vs);
922: int estimate_length(VL vl,pointer p);
923: void send_progress(short per,char *msg);
924: void set_error(int code,char *reason,char *action);
925: double get_current_time();
FreeBSD-CVSweb <freebsd-cvsweb@FreeBSD.org>