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