=================================================================== RCS file: /home/cvs/OpenXM_contrib2/asir2000/include/ca.h,v retrieving revision 1.60 retrieving revision 1.84 diff -u -p -r1.60 -r1.84 --- OpenXM_contrib2/asir2000/include/ca.h 2005/11/12 08:10:56 1.60 +++ OpenXM_contrib2/asir2000/include/ca.h 2013/07/31 00:38:12 1.84 @@ -45,7 +45,7 @@ * DEVELOPER SHALL HAVE NO LIABILITY IN CONNECTION WITH THE USE, * PERFORMANCE OR NON-PERFORMANCE OF THE SOFTWARE. * - * $OpenXM: OpenXM_contrib2/asir2000/include/ca.h,v 1.59 2005/11/06 01:27:28 noro Exp $ + * $OpenXM: OpenXM_contrib2/asir2000/include/ca.h,v 1.83 2013/06/13 18:03:14 ohara Exp $ */ #include #include @@ -57,9 +57,6 @@ #if !defined(VISUAL) #include -#endif - -#if !defined(VISUAL) #include #endif @@ -72,6 +69,7 @@ #endif #if defined(VISUAL) +#include #include #endif @@ -93,6 +91,10 @@ typedef void * pointer; #endif #endif +#define NULLP ((void *)0) + +#define TODO printf("%s: not implemented!\n", __func__) + #define COPY(a,b) ((b)=(a)) #define FREEN(p) #define FREEQ(p) @@ -128,6 +130,7 @@ typedef void * pointer; /* IMAT */ #define O_IMAT 24 /* IMAT */ +#define O_NBP 25 #define N_Q 0 #define N_R 1 @@ -150,18 +153,16 @@ typedef enum { A_end=0,A_fnode,A_arf,A_int,A_str,A_internal,A_node,A_notimpl,A_func } farg_type; -#if defined(LONG_IS_32BIT) -#if defined(VISUAL) -typedef _int64 L; -typedef unsigned _int64 UL; -#else +#if SIZEOF_LONG == 8 +typedef long L; +typedef unsigned long UL; +#elif defined(HAVE_UNSIGNED_LONG_LONG) typedef long long L; typedef unsigned long long UL; +#elif defined(_MSC_VER) +typedef _int64 L; +typedef unsigned _int64 UL; #endif -#else -typedef long L; -typedef unsigned long UL; -#endif typedef struct oN { int p; @@ -444,6 +445,30 @@ typedef struct oTB { char **body; } *TB; +typedef struct oNBP { + short id; + short pad; + struct oNODE *body; +} *NBP; + +/* non-commutative bivariate monomial */ + +typedef struct oNBM { + int d; + P c; + unsigned int *b; +} *NBM; + +#define NEWNBM(p) ((p)=(NBM)MALLOC(sizeof(struct oNBM))) +#define NEWNBMBDY(p,d) \ +((p)->b=(unsigned int *)MALLOC((((d)+31)/32)*sizeof(unsigned int))) +#define NEWNBP(p) ((p)=(NBP)MALLOC(sizeof(struct oNBP)),OID(p)=O_NBP) +#define MKNBP(p,b) (NEWNBP(p),BDY(p)=(b)) + +#define NBM_GET(a,j) (((a)[(j)>>5]&(1<<((j)&31)))?1:0) +#define NBM_SET(a,j) ((a)[(j)>>5]|=(1<<((j)&31))) +#define NBM_CLR(a,j) ((a)[(j)>>5]&=(~(1<<((j)&31)))) + typedef struct oObj { short id; short pad; @@ -598,6 +623,8 @@ struct order_spec { int id; Obj obj; int nv; + int ispot; /* 1 means Position over Term (Pos then Term) */ + int pot_nelim; /* size of positions for pot-elimination order */ union { int simple; struct { @@ -700,15 +727,11 @@ typedef unsigned int ModNum; /* memory allocators (W_... : uses alloca) */ -#if 0 #define MALLOC(d) Risa_GC_malloc(d) #define MALLOC_ATOMIC(d) Risa_GC_malloc_atomic(d) +#define MALLOC_ATOMIC_IGNORE_OFF_PAGE(d) Risa_GC_malloc_atomic_ignore_off_page(d) #define REALLOC(p,d) Risa_GC_realloc(p,d) -#else -#define MALLOC(d) GC_malloc(d) -#define MALLOC_ATOMIC(d) GC_malloc_atomic(d) -#define REALLOC(p,d) GC_realloc(p,d) -#endif +#define GCFREE(p) Risa_GC_free(p) #define CALLOC(d,e) MALLOC((d)*(e)) #if !defined(__CYGWIN__) && (defined(__GNUC__) || defined(vax) || defined(apollo) || defined(alloca) || defined(VISUAL)) @@ -860,7 +883,7 @@ DEG(DC(p))=ONE,COEF(DC(p))=(P)ONEM,NEXT(DC(p))=0) #define MKERR(e,b) (NEWERR(e),(e)->body=(Obj)(b)) #define MKMATHCAP(e,b) (NEWMATHCAP(e),(e)->body=(LIST)(b)) #define MKBYTEARRAY(m,l) \ -(NEWBYTEARRAY(m),(m)->len=(l),(m)->body=(char *)MALLOC_ATOMIC((l)),bzero((m)->body,(l))) +(NEWBYTEARRAY(m),(m)->len=(l),(m)->body=(unsigned char *)MALLOC_ATOMIC((l)),bzero((m)->body,(l))) #define MKQUOTE(q,b) (NEWQUOTE(q),(q)->body=(pointer)(b)) #define MKQUOTEARG(q,t,b) (NEWQUOTEARG(q),(q)->type=(t),(q)->body=(pointer)(b)) @@ -913,7 +936,7 @@ PL(NM(q))=1,BD(NM(q))[0]=(unsigned int)(n),DN(q)=0,(q) #define MKReal(a,b) (!(a)?((b)=0):(NEWReal(b),BDY(b)=(a),(b))) #define MKAlg(b,r) \ (!(b)?((r)=0):NUM(b)?((r)=(Alg)(b)):(NEWAlg(r),BDY(r)=(Obj)(b),(r))) -#define MKDAlg(dp,den,r) (NEWDAlg(r),(r)->nm = (dp),(r)->dn=(den)) +#define MKDAlg(dp,den,r) (!(dp)?(void *)((r)=0):(void *)(NEWDAlg(r),(r)->nm = (dp),(r)->dn=(den))) #define IMM_MAX 1073741823 #define IMM_MIN -1073741823 @@ -931,6 +954,7 @@ PL(NM(q))=1,BD(NM(q))[0]=(unsigned int)(n),DN(q)=0,(q) #define NUM(p) (OID(p)==O_N) #define RAT(p) (OID(p)==O_R) #define RATN(a) (NID(a)==N_Q) +#define POLY(a) (!(a) ||(OID(a)<=O_P)) #define INT(q) (!(q)||(NUM(q)&&RATN((Num)q)&&!DN((Q)q))) #define REAL(a) (NID(a)==N_R) #define BIGFLOAT(a) (NID(a)==N_B) @@ -1293,7 +1317,7 @@ void copyn(N,int,int *); void kmulnmain(N,N,N *); int qcoefp(Obj); int qcoefr(Obj); -long get_allocwords(void); +size_t get_allocwords(void); double get_clock(void); void get_eg(struct oEGT *); void printtime(struct oEGT *,struct oEGT *,double); @@ -1398,9 +1422,13 @@ LUM LUMALLOC(int, int); BM BMALLOC(int, int); Obj ToAlg(Num); UM *berlemain(register int, UM, UM *); +void Risa_GC_set_adj(int,int); +void Risa_GC_get_adj(int *,int *); void *Risa_GC_malloc(size_t); void *Risa_GC_malloc_atomic(size_t); void *Risa_GC_realloc(void *,size_t); +void Risa_GC_free(void *); +void *Risa_GC_malloc_atomic_ignore_off_page(size_t); void *GC_malloc(size_t); void *GC_malloc_atomic(size_t); void *GC_realloc(void *,size_t); @@ -2447,7 +2475,7 @@ void resume_timer() ; void reset_engine() ; unsigned int get_asir_version() ; char *get_asir_distribution(); -void create_error(ERR *err,unsigned int serial,char *msg); +void create_error(ERR *err,unsigned int serial,char *msg,LIST trace); void init_lprime(); int get_lprime(int index); void create_new_lprimes(int index); @@ -2607,3 +2635,10 @@ void bzero(const void *,int); void bcopy(const void *,void *,int); char *index(char *,int); #endif + +void chsgnnbp(NBP p,NBP *rp); +void subnbp(VL vl,NBP p1,NBP p2, NBP *rp); +void addnbp(VL vl,NBP p1,NBP p2, NBP *rp); +void mulnbp(VL vl,NBP p1,NBP p2, NBP *rp); +void pwrnbp(VL vl,NBP p1,Q n, NBP *rp); +int compnbp(VL vl,NBP p1,NBP p2);