-
Notifications
You must be signed in to change notification settings - Fork 4
/
macros.h
55 lines (51 loc) · 2.02 KB
/
macros.h
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
/*
* module : macros.h
* version : 1.2
* date : 10/18/24
*/
#define POP(X) X = nextnode1(X)
#define USR_NEWNODE(u, r) \
(env->bucket.ent = u, newnode(env, USR_, env->bucket, r))
#define ANON_FUNCT_NEWNODE(u, r) \
(env->bucket.proc = u, newnode(env, ANON_FUNCT_, env->bucket, r))
#define BOOLEAN_NEWNODE(u, r) \
(env->bucket.num = u, newnode(env, BOOLEAN_, env->bucket, r))
#define CHAR_NEWNODE(u, r) \
(env->bucket.num = u, newnode(env, CHAR_, env->bucket, r))
#define INTEGER_NEWNODE(u, r) \
(env->bucket.num = u, newnode(env, INTEGER_, env->bucket, r))
#define SET_NEWNODE(u, r) \
(env->bucket.set = u, newnode(env, SET_, env->bucket, r))
#define STRING_NEWNODE(u, r) \
(env->bucket.str = u, newnode(env, STRING_, env->bucket, r))
#define LIST_NEWNODE(u, r) \
(env->bucket.lis = u, newnode(env, LIST_, env->bucket, r))
#define FLOAT_NEWNODE(u, r) \
(env->bucket.dbl = u, newnode(env, FLOAT_, env->bucket, r))
#define FILE_NEWNODE(u, r) \
(env->bucket.fil = u, newnode(env, FILE_, env->bucket, r))
#define BIGNUM_NEWNODE(u, r) \
(env->bucket.str = u, newnode(env, BIGNUM_, env->bucket, r))
#define NULLARY(CONSTRUCTOR, VALUE) \
env->stck = CONSTRUCTOR(VALUE, env->stck)
#define UNARY(CONSTRUCTOR, VALUE) \
env->stck = CONSTRUCTOR(VALUE, nextnode1(env->stck))
#define BINARY(CONSTRUCTOR, VALUE) \
env->stck = CONSTRUCTOR(VALUE, nextnode2(env->stck))
#define GNULLARY(NODE) \
env->stck = newnode2(env, NODE, env->stck)
#define GUNARY(NODE) \
env->stck = newnode2(env, NODE, nextnode1(env->stck))
#define GBINARY(NODE) \
env->stck = newnode2(env, NODE, nextnode2(env->stck))
#define GTERNARY(NODE) \
env->stck = newnode2(env, NODE, nextnode3(env->stck))
/*
* Strings are stored in consecutive nodes in the NOBDW version; the BDW
* version stores them somewhere else.
*/
#ifdef NOBDW
#define GETSTRING(NODE) (char *)&nodevalue(NODE)
#else
#define GETSTRING(NODE) nodevalue(NODE).str
#endif