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