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