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