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