version 1.18, 2003/05/14 06:20:12 |
version 1.45, 2006/02/08 02:11:19 |
|
|
* DEVELOPER SHALL HAVE NO LIABILITY IN CONNECTION WITH THE USE, |
* DEVELOPER SHALL HAVE NO LIABILITY IN CONNECTION WITH THE USE, |
* PERFORMANCE OR NON-PERFORMANCE OF THE SOFTWARE. |
* PERFORMANCE OR NON-PERFORMANCE OF THE SOFTWARE. |
* |
* |
* $OpenXM: OpenXM_contrib2/asir2000/parse/parse.h,v 1.17 2003/04/02 09:43:33 ohara Exp $ |
* $OpenXM: OpenXM_contrib2/asir2000/parse/parse.h,v 1.44 2005/12/10 14:14:16 noro Exp $ |
*/ |
*/ |
# if defined(VISUAL) |
# if defined(VISUAL) |
#include <time.h> |
#include <time.h> |
|
|
I_FUNC, I_FUNC_OPT, I_IFUNC, I_MAP, I_RECMAP, I_PFDERIV, |
I_FUNC, I_FUNC_OPT, I_IFUNC, I_MAP, I_RECMAP, I_PFDERIV, |
I_ANS, I_PVAR, I_ASSPVAR, |
I_ANS, I_PVAR, I_ASSPVAR, |
I_FORMULA, I_LIST, I_STR, I_NEWCOMP, I_CAR, I_CDR, I_CAST, |
I_FORMULA, I_LIST, I_STR, I_NEWCOMP, I_CAR, I_CDR, I_CAST, |
I_COM, I_PROC, I_INDEX, I_EV, I_TIMER, I_GF2NGEN, I_GFPNGEN, I_GFSNGEN, |
I_INDEX, I_EV, I_TIMER, I_GF2NGEN, I_GFPNGEN, I_GFSNGEN, |
I_LOP, I_OPT, I_GETOPT, I_POINT, I_QUOTE, I_PAREN, I_MINUS |
I_LOP, I_OPT, I_GETOPT, I_POINT, I_PAREN, I_MINUS, |
|
I_NARYOP, I_CONS, I_FUNC_QARG, I_FUNC_HEAD, |
} fid; |
} fid; |
|
|
/* identifiers for statements */ |
/* identifiers for statements */ |
|
|
S_BP, S_PFDEF, |
S_BP, S_PFDEF, |
S_SINGLE, S_CPLX, |
S_SINGLE, S_CPLX, |
S_IFELSE, S_FOR, S_DO, |
S_IFELSE, S_FOR, S_DO, |
S_BREAK, S_RETURN, S_CONTINUE |
S_BREAK, S_RETURN, S_CONTINUE, |
|
S_MODULE |
} sid; |
} sid; |
|
|
/* identifiers for comparison operators */ |
/* identifiers for comparison operators */ |
Line 121 typedef struct oPV { |
|
Line 123 typedef struct oPV { |
|
typedef struct oINFILE { |
typedef struct oINFILE { |
char *name; |
char *name; |
FILE *fp; |
FILE *fp; |
|
jmp_buf jmpbuf; |
|
int ready_for_longjmp; |
int ln; |
int ln; |
struct oINFILE *next; |
struct oINFILE *next; |
char *tname; |
char *tname; |
|
|
int token; |
int token; |
}; |
}; |
|
|
|
typedef struct fid_spec { |
|
fid id; |
|
farg_type type[10]; |
|
} *fid_spec_p; |
|
|
typedef struct oARF { |
typedef struct oARF { |
char *name; |
char *name; |
void (*fp)(); |
void (*fp)(); |
} *ARF; |
} *ARF; |
|
|
typedef struct oFUNC { |
typedef struct oFUNC { |
char *name; |
char *name,*fullname; |
int argc; |
int argc; |
int type; |
int type; |
|
int secure; |
aid id; |
aid id; |
|
unsigned int quote; |
union { |
union { |
void (*binf)(); |
void (*binf)(); |
struct oUSRF *usrf; |
struct oUSRF *usrf; |
Line 185 typedef struct oPFINS { |
|
Line 196 typedef struct oPFINS { |
|
#define NEWPF(p) ((p)=(PF)MALLOC(sizeof(struct oPF))) |
#define NEWPF(p) ((p)=(PF)MALLOC(sizeof(struct oPF))) |
|
|
typedef struct oFNODE { |
typedef struct oFNODE { |
fid id; |
short id; |
|
unsigned normalized:1; |
|
unsigned expanded:1; |
|
unsigned coef:1; |
pointer arg[1]; |
pointer arg[1]; |
} *FNODE; |
} *FNODE; |
|
|
|
|
char *name; |
char *name; |
void (*f)(); |
void (*f)(); |
int argc; |
int argc; |
|
unsigned int quote; |
}; |
}; |
|
|
#define MKPVI(a,b,c)\ |
#define MKPVI(a,b,c)\ |
Line 264 switch ( id ) {\ |
|
Line 279 switch ( id ) {\ |
|
|
|
#define DEFSIZE 32 |
#define DEFSIZE 32 |
#define PVGLOBAL(i) (((unsigned int)(i))|(1<<30)) |
#define PVGLOBAL(i) (((unsigned int)(i))|(1<<30)) |
#define PVMGLOBAL(i) (((unsigned int)(i))|(3<<30)) |
#define PVMGLOBAL(i) (((unsigned int)(i))|(2<<30)) |
|
#define PVPATTERN(i) (((unsigned int)(i))|(3<<30)) |
#define PVATTR(i) (((unsigned int)(i))>>30) |
#define PVATTR(i) (((unsigned int)(i))>>30) |
#define PVIND(i) (((unsigned int)(i))&0x3fffffff) |
#define PVIND(i) (((unsigned int)(i))&0x3fffffff) |
#define GETPV(i,p) \ |
#define GETPV(i,p) \ |
(PVATTR(i)==0?(int)((p)=CPVS->va[(unsigned int)(i)].priv)\ |
(PVATTR(i)==0?(int)((p)=CPVS->va[(unsigned int)(i)].priv)\ |
:PVATTR(i)==1?(int)((p)=GPVS->va[PVIND(i)].priv)\ |
:PVATTR(i)==1?(int)((p)=GPVS->va[PVIND(i)].priv)\ |
:(int)((p)=MPVS->va[PVIND(i)].priv)) |
:PVATTR(i)==2?(int)((p)=MPVS->va[PVIND(i)].priv)\ |
|
:(int)((p)=PPVS->va[PVIND(i)].priv)) |
|
|
#define GETPVREF(i,p) \ |
#define GETPVREF(i,p) \ |
(PVATTR(i)==0?(int)((p)=&(CPVS->va[(unsigned int)(i)].priv))\ |
(PVATTR(i)==0?(int)((p)=&(CPVS->va[(unsigned int)(i)].priv))\ |
:PVATTR(i)==1?(int)((p)=&(GPVS->va[PVIND(i)].priv))\ |
:PVATTR(i)==1?(int)((p)=&(GPVS->va[PVIND(i)].priv))\ |
:(int)((p)=&(MPVS->va[PVIND(i)].priv))) |
:PVATTR(i)==2?(int)((p)=&(MPVS->va[PVIND(i)].priv))\ |
|
:(int)((p)=&(PPVS->va[PVIND(i)].priv))) |
|
|
#define GETPVNAME(i,p) \ |
#define GETPVNAME(i,p) \ |
(PVATTR(i)==0?(int)((p)=CPVS->va[(unsigned int)(i)].name)\ |
(PVATTR(i)==0?(int)((p)=CPVS->va[(unsigned int)(i)].name)\ |
:PVATTR(i)==1?(int)((p)=GPVS->va[PVIND(i)].name)\ |
:PVATTR(i)==1?(int)((p)=GPVS->va[PVIND(i)].name)\ |
:(int)((p)=MPVS->va[PVIND(i)].name)) |
:PVATTR(i)==2?(int)((p)=MPVS->va[PVIND(i)].name)\ |
|
:(int)((p)=PPVS->va[PVIND(i)].name)) |
|
|
#define ASSPV(i,p) \ |
#define ASSPV(i,p) \ |
(PVATTR(i)==0?(int)(CPVS->va[(unsigned int)(i)].priv=(pointer)(p))\ |
(PVATTR(i)==0?(int)(CPVS->va[(unsigned int)(i)].priv=(pointer)(p))\ |
:PVATTR(i)==1?(int)(GPVS->va[PVIND(i)].priv=(pointer)(p))\ |
:PVATTR(i)==1?(int)(GPVS->va[PVIND(i)].priv=(pointer)(p))\ |
:(int)(MPVS->va[PVIND(i)].priv=(pointer)(p))) |
:PVATTR(i)==2?(int)(MPVS->va[PVIND(i)].priv=(pointer)(p))\ |
|
:(int)(PPVS->va[PVIND(i)].priv=(pointer)(p))) |
|
|
#define NEWNODE2(a) ((a)=(NODE2)MALLOC(sizeof(struct oNODE2))) |
#define NEWNODE2(a) ((a)=(NODE2)MALLOC(sizeof(struct oNODE2))) |
#define MKNODE2(a,b,c,d) \ |
#define MKNODE2(a,b,c,d) \ |
Line 290 switch ( id ) {\ |
|
Line 313 switch ( id ) {\ |
|
#define BDY1(a) ((a)->body1) |
#define BDY1(a) ((a)->body1) |
#define BDY2(a) ((a)->body2) |
#define BDY2(a) ((a)->body2) |
|
|
extern VS GPVS,CPVS,EPVS,APVS,MPVS; |
extern VS GPVS,CPVS,EPVS,APVS,MPVS,PPVS; |
extern MODULE CUR_MODULE; |
extern MODULE CUR_MODULE; |
extern NODE MODULE_LIST; |
extern NODE MODULE_LIST; |
|
extern char *CUR_FUNC; |
extern ARF addfs, subfs, mulfs, divfs, remfs, pwrfs; |
extern ARF addfs, subfs, mulfs, divfs, remfs, pwrfs; |
extern INFILE asir_infile; |
extern INFILE asir_infile; |
extern NODE usrf,sysf,noargsysf,ubinf,parif,ONENODE; |
extern NODE usrf,sysf,noargsysf,ubinf,parif,ONENODE; |
extern int nextbp,nextbplevel; |
extern int nextbp,nextbplevel; |
extern int Verbose; |
extern int Verbose; |
|
extern int do_quiet; |
|
extern SYMBOL Symbol_grlex, Symbol_glex, Symbol_lex; |
|
extern NODE current_option; |
|
|
#if defined(VISUAL_LIB) |
#if defined(VISUAL_LIB) |
#include <w_stdio.h> |
#include <w_stdio.h> |
Line 314 extern int Verbose; |
|
Line 341 extern int Verbose; |
|
#define fflush w_fflush |
#define fflush w_fflush |
#endif |
#endif |
|
|
#if defined(VISUAL) || (defined(__MACH__) && defined(__ppc__)) |
#if defined(__GNUC__) || defined(VISUAL) || (defined(__MACH__) && defined(__ppc__)) || defined(__FreeBSD__) |
NODE mknode(int,...); |
NODE mknode(int,...); |
FNODE mkfnode(int,fid,...); |
FNODE mkfnode(int,fid,...); |
SNODE mksnode(int,sid,...); |
SNODE mksnode(int,sid,...); |
Line 333 void dp_ptozp_d(DP,DP *); |
|
Line 360 void dp_ptozp_d(DP,DP *); |
|
void dp_vtod(Q *,DP,DP *); |
void dp_vtod(Q *,DP,DP *); |
void dp_idivv_hist(Q,DP *); |
void dp_idivv_hist(Q,DP *); |
void dp_igcdv_hist(DP,Q *); |
void dp_igcdv_hist(DP,Q *); |
|
void dp_ptozp3(DP,Q *,DP *); |
void dp_ptozp2(DP,DP,DP *,DP *); |
void dp_ptozp2(DP,DP,DP *,DP *); |
void dp_ptozp(DP,DP *); |
void dp_ptozp(DP,DP *); |
void dp_nf_tab_mod(DP,LIST *,int,DP *); |
void dp_nf_tab_mod(DP,LIST *,int,DP *); |
Line 368 void dp_mod(DP,int,NODE,DP *); |
|
Line 396 void dp_mod(DP,int,NODE,DP *); |
|
void dp_prim_mod(DP,int,DP *); |
void dp_prim_mod(DP,int,DP *); |
void dp_prim(DP,DP *); |
void dp_prim(DP,DP *); |
void heu_nezgcdnpz(VL,P *,int,P *); |
void heu_nezgcdnpz(VL,P *,int,P *); |
void homogenize_order(struct order_spec *,int,struct order_spec *); |
void homogenize_order(struct order_spec *,int,struct order_spec **); |
int create_order_spec(Obj,struct order_spec *); |
int create_order_spec(VL,Obj,struct order_spec **); |
|
|
int dl_equal(int,DL,DL); |
int dl_equal(int,DL,DL); |
void qltozl(Q *,int,Q *); |
void qltozl(Q *,int,Q *); |
Line 462 int get_heapsize(void); |
|
Line 490 int get_heapsize(void); |
|
int searchpvar(char *); |
int searchpvar(char *); |
void mkparif(char *,FUNC *); |
void mkparif(char *,FUNC *); |
void makevar(char *,P *); |
void makevar(char *,P *); |
void mkpvs(void); |
void mkpvs(char *); |
|
MODULE mkmodule(char *); |
void stoarg(char *,int *,char **); |
void stoarg(char *,int *,char **); |
void yyerror(char *); |
void yyerror(char *); |
void closecurrentinput(void); |
void closecurrentinput(void); |
void asir_terminate(int); |
void asir_terminate(int); |
void searchasirpath(char *,char **); |
void searchasirpath(char *,char **); |
void get_vars(Obj,VL *); |
void get_vars(Obj,VL *); |
void appendbinf(NODE *,char *,void(*)(),int); |
void appendbinf(NODE *,char *,void(*)(),int,unsigned int); |
void appendubinf(char *,void(*)(),int); |
void appendubinf(char *,void(*)(),int,unsigned int); |
void parif_init(void); |
void parif_init(void); |
void sysf_init(void); |
void sysf_init(void); |
void makesrvar(FUNC, P *); |
void makesrvar(FUNC, P *); |
Line 500 int qcoefp(Obj); |
|
Line 529 int qcoefp(Obj); |
|
int qcoefr(Obj); |
int qcoefr(Obj); |
int rangecheck(Obj,int); |
int rangecheck(Obj,int); |
int structtoindex(char *); |
int structtoindex(char *); |
pointer eval(FNODE); |
|
pointer evalf(FUNC,FNODE,FNODE); |
|
pointer bevalf(FUNC,NODE); |
|
pointer evalif(FNODE,FNODE); |
|
pointer evalnode(NODE node); |
|
pointer evalpf(PF,NODE); |
|
pointer evalparif(FUNC,NODE); |
|
pointer evalpv(int,FNODE,pointer); |
|
pointer evalstat(SNODE f); |
|
void _mkpfins(PF ,Obj *,V *); |
void _mkpfins(PF ,Obj *,V *); |
void appendpfins(V ,V *); |
void appendpfins(V ,V *); |
void appenduf(char *,FUNC *); |
void appenduf(char *,FUNC *); |
Line 598 int dp_redble(DP p1,DP p2); |
|
Line 618 int dp_redble(DP p1,DP p2); |
|
void sortbynm(Q *w,int n); |
void sortbynm(Q *w,int n); |
int comp_nm(Q *a,Q *b); |
int comp_nm(Q *a,Q *b); |
void qltozl(Q *w,int n,Q *dvr); |
void qltozl(Q *w,int n,Q *dvr); |
void homogenize_order(struct order_spec *old,int n,struct order_spec *new); |
|
void dp_rat(DP p,DP *rp); |
void dp_rat(DP p,DP *rp); |
void dp_mod(DP p,int mod,NODE subst,DP *rp); |
void dp_mod(DP p,int mod,NODE subst,DP *rp); |
void dp_dehomo(DP p,DP *rp); |
void dp_dehomo(DP p,DP *rp); |
void dp_homo(DP p,DP *rp); |
void dp_homo(DP p,DP *rp); |
int create_order_spec(Obj obj,struct order_spec *spec); |
|
void dp_nf_tab_mod(DP p,LIST *tab,int mod,DP *rp); |
void dp_nf_tab_mod(DP p,LIST *tab,int mod,DP *rp); |
void dp_lnf_mod(DP p1,DP p2,NODE g,int mod,DP *r1p,DP *r2p); |
void dp_lnf_mod(DP p1,DP p2,NODE g,int mod,DP *r1p,DP *r2p); |
void dp_lnf_f(DP p1,DP p2,NODE g,DP *r1p,DP *r2p); |
void dp_lnf_f(DP p1,DP p2,NODE g,DP *r1p,DP *r2p); |
Line 745 int generic_gauss_elim_mod(int **mat0,int row,int col, |
|
Line 763 int generic_gauss_elim_mod(int **mat0,int row,int col, |
|
int lu_gfmmat(GFMMAT mat,unsigned int md,int *perm); |
int lu_gfmmat(GFMMAT mat,unsigned int md,int *perm); |
int find_lhs_and_lu_mod(unsigned int **a,int row,int col, |
int find_lhs_and_lu_mod(unsigned int **a,int row,int col, |
unsigned int md,int **rinfo,int **cinfo); |
unsigned int md,int **rinfo,int **cinfo); |
void solve_by_lu_mod(int **a,int n,int md,int **b,int l); |
void solve_by_lu_mod(int **a,int n,int md,int **b,int l,int normalize); |
int gauss_elim_mod1(int **mat,int row,int col,int md); |
int gauss_elim_mod1(int **mat,int row,int col,int md); |
int gauss_elim_geninv_mod(unsigned int **mat,int row,int col,int md); |
int gauss_elim_geninv_mod(unsigned int **mat,int row,int col,int md); |
void solve_by_lu_gfmmat(GFMMAT lu,unsigned int md,unsigned int *b,unsigned int *x); |
void solve_by_lu_gfmmat(GFMMAT lu,unsigned int md,unsigned int *b,unsigned int *x); |
Line 767 void igcd_cofactor(Q a,Q b,Q *gcd,Q *ca,Q *cb); |
|
Line 785 void igcd_cofactor(Q a,Q b,Q *gcd,Q *ca,Q *cb); |
|
int comp_n(N *a,N *b); |
int comp_n(N *a,N *b); |
int TypeT_NB_check(unsigned int m, unsigned int t); |
int TypeT_NB_check(unsigned int m, unsigned int t); |
int small_jacobi(int a,int m); |
int small_jacobi(int a,int m); |
void mkpvs(); |
|
void pushpvs(FUNC f); |
void pushpvs(FUNC f); |
void poppvs(); |
void poppvs(); |
unsigned int makepvar(char *str); |
unsigned int makepvar(char *str); |
Line 791 void chsgnquote(QUOTE a,QUOTE *c); |
|
Line 808 void chsgnquote(QUOTE a,QUOTE *c); |
|
void objtoquote(Obj a,QUOTE *c); |
void objtoquote(Obj a,QUOTE *c); |
void polytoquote(P a,QUOTE *c); |
void polytoquote(P a,QUOTE *c); |
void dptoquote(DP a,QUOTE *c); |
void dptoquote(DP a,QUOTE *c); |
void dctoquote(DCP dc,QUOTE v,QUOTE *c); |
void dctoquote(DCP dc,QUOTE v,QUOTE *c,int *sgn); |
void mptoquote(MP m,int n,QUOTE *c); |
void mptoquote(MP m,int n,QUOTE *c,int *sgn); |
void vartoquote(V v,QUOTE *c); |
void vartoquote(V v,QUOTE *c); |
void fnodetotree(FNODE f,LIST *rp); |
void fnodetotree(FNODE f,LIST *rp); |
FNODE eval_pvar_in_fnode(FNODE f); |
FNODE eval_pvar_in_fnode(FNODE f); |
Line 872 pointer eval(FNODE f); |
|
Line 889 pointer eval(FNODE f); |
|
pointer evalstat(SNODE f); |
pointer evalstat(SNODE f); |
pointer evalnode(NODE node); |
pointer evalnode(NODE node); |
pointer evalf(FUNC f,FNODE a,FNODE opt); |
pointer evalf(FUNC f,FNODE a,FNODE opt); |
|
pointer evalparif(FUNC f,NODE a); |
|
pointer evalf_deriv(FUNC f,FNODE a,FNODE deriv); |
pointer evalmapf(FUNC f,FNODE a); |
pointer evalmapf(FUNC f,FNODE a); |
pointer eval_rec_mapf(FUNC f,FNODE a); |
pointer eval_rec_mapf(FUNC f,FNODE a); |
pointer beval_rec_mapf(FUNC f,NODE node); |
pointer beval_rec_mapf(FUNC f,NODE node); |
pointer bevalf(FUNC f,NODE a); |
pointer bevalf(FUNC f,NODE a); |
pointer evalif(FNODE f,FNODE a); |
pointer evalif(FNODE f,FNODE a); |
pointer evalpf(PF pf,NODE args); |
pointer evalpf(PF pf,NODE args,NODE deriv); |
void evalnodebody(NODE sn,NODE *dnp); |
void evalnodebody(NODE sn,NODE *dnp); |
void gen_searchf(char *name,FUNC *r); |
void gen_searchf(char *name,FUNC *r); |
void searchf(NODE fn,char *name,FUNC *r); |
void searchf(NODE fn,char *name,FUNC *r); |