Annotation of OpenXM_contrib2/asir2000/include/ca-27.h, Revision 1.1.1.1
1.1 noro 1: /* $OpenXM: OpenXM/src/asir99/include/ca-27.h,v 1.1.1.1 1999/11/10 08:12:30 noro Exp $ */
2: #if LONG_IS_32BIT
3: #if defined(VISUAL)
4: typedef _int64 L;
5: typedef unsigned _int64 UL;
6: #else
7: typedef long long L;
8: typedef unsigned long long UL;
9: #endif
10: #else
11: typedef long L;
12: typedef unsigned long UL;
13: #endif
14: /* data structures */
15:
16: #define O_N 1
17:
18: #define N_Q 0
19:
20: struct oN {
21: int p;
22: int b[1];
23: };
24:
25: typedef struct oN *N;
26:
27: #if defined(VISUAL)
28: #include <string.h>
29: #define index(s,c) strchr(s,c)
30: #define bzero(s,len) memset(s,0,len)
31: #define bcopy(x,y,len) memcpy(y,x,len)
32: #endif
33:
34: /* general macros */
35: #define MAX(a,b) ((a) > (b) ? (a) : (b) )
36: #define MIN(a,b) ((a) > (b) ? (b) : (a) )
37: #ifdef ABS
38: #undef ABS
39: #endif
40: #define ABS(a) ((a)>0?(a):-(a))
41: #define ID(p) ((p)->id)
42: #define OID(p) (((Obj)(p))->id)
43: #define NID(p) (((Num)(p))->nid)
44: #define BDY(p) ((p)->body)
45: #define VR(p) ((p)->v)
46: #define NAME(p) ((p)->name)
47: #define NEXT(p) ((p)->next)
48: #define NM(q) ((q)->nm)
49: #define DN(q) ((q)->dn)
50: #define SGN(q) ((q)->sgn)
51: #define DC(p) ((p)->dc)
52: #define COEF(p) ((p)->c)
53: #define DEG(p) ((p)->d)
54: #define PL(n) ((n)->p)
55: #define BD(n) ((n)->b)
56: #define CONT(a) ((a)->cont)
57: #define UDEG(f) BD(NM(DEG(DC(f))))[0]
58: #define UCOEF(f) (COEF(DC(f)))
59: #define LC(f) (NUM(f)?(f):COEF(DC(f)))
60:
61: #if defined(__GNUC__) || defined(vax) || defined(apollo) || defined(alloca)
62: #define ALLOCA(d) alloca(d)
63: #else
64: #define ALLOCA(d) GC_malloc(d)
65: #endif
66:
67: #define MALLOC(d) GC_malloc(d)
68: #define MALLOC_ATOMIC(d) GC_malloc_atomic(d)
69: #define CALLOC(d,e) GC_malloc((d)*(e))
70:
71: #define TRUESIZE(type,n,atype) (sizeof(struct type)+MAX((n),0)*sizeof(atype))
72: #define NALLOC(d) ((N)MALLOC_ATOMIC(TRUESIZE(oN,(d)-1,int)))
73:
74: #define W_ALLOC(d) ((int *)ALLOCA(((d)+1)*sizeof(int)))
75: #define W_CALLOC(n,type,p) \
76: ((p)=(type *)ALLOCA(((n)+1)*sizeof(type)),\
77: bzero((char *)(p),(int)(((n)+1)*sizeof(type))))
78:
79: /* cell allocators */
80:
81: #define STON(i,n)\
82: (i?((n)=NALLOC(1),PL(n)=1,BD(n)[0]=ABS(i),(n)):((n)=(N)0))
83:
84: /* predicates */
85: #define NUM(p) (OID(p)==O_N)
86: #define UNIN(n) ((n)&&(PL(n)==1)&&(BD(n)[0]==1))
87: #define EVENN(n) ((!(n))||(!(BD(n)[0]%2)))
88:
89: /* externals */
90: extern struct oN oUNIN;
91: extern N ONEN;
92:
93: void *GC_malloc(int);
94: void *GC_malloc_atomic(int);
95: int cmpn(N,N);
96:
97: void divn_27(N,N,N *,N *);
98: void divnmain_27(int,int,int *,int *,int *);
99: void mulin_27(N,int,int *);
100: int divin_27(N,int,N *);
101:
102: void error(char *);
FreeBSD-CVSweb <freebsd-cvsweb@FreeBSD.org>