MG Mud User | 88f1247 | 2016-06-24 23:31:02 +0200 | [diff] [blame^] | 1 | #ifndef LPC_LPCTYPES_H |
| 2 | #define LPC_LPCTYPES_H |
| 3 | |
| 4 | /* compile time types, from functionlist() */ |
| 5 | |
| 6 | #define TYPE_UNKNOWN 0 /* This type must be casted */ |
| 7 | #define TYPE_NUMBER 1 |
| 8 | #define TYPE_STRING 2 |
| 9 | #define TYPE_VOID 3 |
| 10 | #define TYPE_OBJECT 4 |
| 11 | #define TYPE_MAPPING 5 |
| 12 | #define TYPE_FLOAT 6 |
| 13 | #define TYPE_ANY 7 /* Will match any type */ |
| 14 | #define TYPE_CLOSURE 8 |
| 15 | #define TYPE_SYMBOL 9 |
| 16 | #define TYPE_QUOTED_ARRAY 10 |
| 17 | #define TYPE_STRUCT 11 |
| 18 | |
| 19 | #define TYPE_MOD_POINTER 0x0040 /* Pointer to a basic type */ |
| 20 | |
| 21 | /* runtime types, from typeof() */ |
| 22 | |
| 23 | #define T_INVALID 0x0 |
| 24 | #define T_LVALUE 0x1 |
| 25 | #define T_NUMBER 0x2 |
| 26 | #define T_STRING 0x3 |
| 27 | #define T_POINTER 0x4 |
| 28 | #define T_OBJECT 0x5 |
| 29 | #define T_MAPPING 0x6 |
| 30 | #define T_FLOAT 0x7 |
| 31 | #define T_CLOSURE 0x8 |
| 32 | #define T_SYMBOL 0x9 |
| 33 | #define T_QUOTED_ARRAY 0xa |
| 34 | #define T_STRUCT 0xb |
| 35 | |
| 36 | /* Closure types, stored as secondary type info */ |
| 37 | |
| 38 | #ifndef __DRIVER_SOURCE__ |
| 39 | |
| 40 | #define CLOSURE_LFUN 0 /* lfun in an object */ |
| 41 | /* Code 1: currently unused, used to be CLOSURE_ALIEN_LFUN */ |
| 42 | #define CLOSURE_IDENTIFIER 2 /* variable in this object */ |
| 43 | #define CLOSURE_PRELIMINARY 3 |
| 44 | /* Efun closure used in a static initialization */ |
| 45 | #define CLOSURE_BOUND_LAMBDA 4 /* Bound unbound-lambda closure */ |
| 46 | #define CLOSURE_LAMBDA 5 /* normal lambda closure */ |
| 47 | #define CLOSURE_UNBOUND_LAMBDA 6 /* unbound lambda closure. */ |
| 48 | |
| 49 | #define CLOSURE_OPERATOR (0xe800) |
| 50 | #define CLOSURE_EFUN (0xf000) |
| 51 | #define CLOSURE_SIMUL_EFUN (0xf800) |
| 52 | |
| 53 | #define CLOSURE_IS_LFUN(x) (((x)&~1) == 0) |
| 54 | #define CLOSURE_IS_IDENTIFIER(x) ((x) == CLOSURE_IDENTIFIER) |
| 55 | #define CLOSURE_IS_BOUND_LAMBDA(x) ((x) == CLOSURE_BOUND_LAMBDA) |
| 56 | #define CLOSURE_IS_LAMBDA(x) ((x) == CLOSURE_LAMBDA) |
| 57 | #define CLOSURE_IS_UNBOUND_LAMBDA(x) ((x) == CLOSURE_UNBOUND_LAMBDA) |
| 58 | #define CLOSURE_IS_SIMUL_EFUN(x) (((x) & 0xf800) == CLOSURE_SIMUL_EFUN) |
| 59 | #define CLOSURE_IS_EFUN(x) (((x) & 0xf800) == CLOSURE_EFUN) |
| 60 | #define CLOSURE_IS_OPERATOR(x) (((x) & 0xf800) == CLOSURE_OPERATOR) |
| 61 | |
| 62 | #endif /* __DRIVER_SOURCE__ */ |
| 63 | |
| 64 | #endif /* LPC_LPCTYPES_H */ |