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