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