root/trunk/orca/internal.h

Revision 144, 1.3 kB (checked in by krobillard, 2 years ago)

Native arguments are now kept on the stack until after the call and the
result is now always put into a1.

Line 
1 #ifndef INTERNAL_H
2 #define INTERNAL_H
3
4
5 #define MAX_WORD_LEN        32      /* LIMIT: word length */
6
7 #define BIN_ATOM_NAMES      0
8
9 #define GLOBAL_CTXN         0
10 #define GLOBAL_WORDS_BLKN   1
11
12 #define orGlobalCtx(c) \
13     c.wblkN = GLOBAL_WORDS_BLKN; \
14     c.vblkN = GLOBAL_CTXN
15
16
17 #define orStackGrow(n)      orEnv->dataStack.used += n
18 #define orStackDrop(n)      orEnv->dataStack.used -= n
19
20 #define OA_EXPAND1(type,arr,newptr) \
21     orArrayReserve(arr, sizeof(type), arr->used+1); \
22     newptr = ((type*) arr->buf) + arr->used; \
23     ++arr->used
24
25
26 // Spec type fields.
27 #define LAST_ARG    argc
28 #define TYPE_INDEX  refc
29
30
31 // Evaluator Op-Codes
32 #define OC_SETWORD         1
33 #define OC_CALLINFIX       2
34 #define OC_CALLOP2         3
35 #define OC_SETPATH         4
36
37
38 typedef struct
39 {
40     short argc;
41     short refc;
42 }
43 CallArgs;
44
45
46 typedef struct
47 {
48     union
49     {
50         OValue*     value;
51         int         offset;
52         CallArgs    arg;
53     };
54     short   opcode;
55     short   count;
56 }
57 CallRecord;
58
59
60 #define LIST_HEAD       0
61 #define LIST_TAIL       1
62
63 #define LIST_PREV       index
64 #define LIST_NEXT       func.bodyBlk
65 #define LIST_FREE       func.context
66 #define LIST_LINKED     argc
67
68 #define LIST_REMOVED_ERROR  "list has been removed"
69
70 #define orListNextNode(blk,it) \
71     it = blk->values + it->LIST_NEXT
72
73
74 #endif  /* INTERNAL_H */
Note: See TracBrowser for help on using the browser.