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 |
Zesstra | edb2734 | 2021-04-08 20:05:58 +0200 | [diff] [blame] | 18 | #define TYPE_BYTES 12 |
| 19 | #define TYPE_LWOBJECT 13 |
Zesstra | fc4026d | 2025-07-09 22:12:48 +0200 | [diff] [blame] | 20 | #define TYPE_COROUTINE 14 |
| 21 | #define TYPE_LPCTYPE 15 |
MG Mud User | 88f1247 | 2016-06-24 23:31:02 +0200 | [diff] [blame] | 22 | |
| 23 | #define TYPE_MOD_POINTER 0x0040 /* Pointer to a basic type */ |
| 24 | |
| 25 | /* runtime types, from typeof() */ |
| 26 | |
| 27 | #define T_INVALID 0x0 |
| 28 | #define T_LVALUE 0x1 |
| 29 | #define T_NUMBER 0x2 |
| 30 | #define T_STRING 0x3 |
| 31 | #define T_POINTER 0x4 |
| 32 | #define T_OBJECT 0x5 |
| 33 | #define T_MAPPING 0x6 |
| 34 | #define T_FLOAT 0x7 |
| 35 | #define T_CLOSURE 0x8 |
| 36 | #define T_SYMBOL 0x9 |
| 37 | #define T_QUOTED_ARRAY 0xa |
| 38 | #define T_STRUCT 0xb |
Zesstra | ffb18e9 | 2019-09-27 16:17:09 +0200 | [diff] [blame] | 39 | #define T_BYTES 0xc |
Zesstra | edb2734 | 2021-04-08 20:05:58 +0200 | [diff] [blame] | 40 | #define T_LWOBJECT 0xd |
Zesstra | fc4026d | 2025-07-09 22:12:48 +0200 | [diff] [blame] | 41 | #define T_COROUTINE 0xe |
| 42 | #define T_PYTHON 0xf |
| 43 | #define T_LPCTYPE 0x10 |
MG Mud User | 88f1247 | 2016-06-24 23:31:02 +0200 | [diff] [blame] | 44 | |
| 45 | /* Closure types, stored as secondary type info */ |
| 46 | |
| 47 | #ifndef __DRIVER_SOURCE__ |
| 48 | |
| 49 | #define CLOSURE_LFUN 0 /* lfun in an object */ |
| 50 | /* Code 1: currently unused, used to be CLOSURE_ALIEN_LFUN */ |
| 51 | #define CLOSURE_IDENTIFIER 2 /* variable in this object */ |
| 52 | #define CLOSURE_PRELIMINARY 3 |
| 53 | /* Efun closure used in a static initialization */ |
| 54 | #define CLOSURE_BOUND_LAMBDA 4 /* Bound unbound-lambda closure */ |
| 55 | #define CLOSURE_LAMBDA 5 /* normal lambda closure */ |
| 56 | #define CLOSURE_UNBOUND_LAMBDA 6 /* unbound lambda closure. */ |
| 57 | |
Zesstra | 5f7e49b | 2017-06-18 15:30:41 +0200 | [diff] [blame] | 58 | #ifdef __PYTHON__ |
| 59 | # define CLOSURE_OPERATOR (0xe000) |
| 60 | # define CLOSURE_PYTHON_EFUN (0xe800) |
| 61 | #else |
| 62 | # define CLOSURE_OPERATOR (0xe800) |
| 63 | #endif |
MG Mud User | 88f1247 | 2016-06-24 23:31:02 +0200 | [diff] [blame] | 64 | #define CLOSURE_EFUN (0xf000) |
| 65 | #define CLOSURE_SIMUL_EFUN (0xf800) |
| 66 | |
| 67 | #define CLOSURE_IS_LFUN(x) (((x)&~1) == 0) |
| 68 | #define CLOSURE_IS_IDENTIFIER(x) ((x) == CLOSURE_IDENTIFIER) |
| 69 | #define CLOSURE_IS_BOUND_LAMBDA(x) ((x) == CLOSURE_BOUND_LAMBDA) |
| 70 | #define CLOSURE_IS_LAMBDA(x) ((x) == CLOSURE_LAMBDA) |
| 71 | #define CLOSURE_IS_UNBOUND_LAMBDA(x) ((x) == CLOSURE_UNBOUND_LAMBDA) |
| 72 | #define CLOSURE_IS_SIMUL_EFUN(x) (((x) & 0xf800) == CLOSURE_SIMUL_EFUN) |
| 73 | #define CLOSURE_IS_EFUN(x) (((x) & 0xf800) == CLOSURE_EFUN) |
| 74 | #define CLOSURE_IS_OPERATOR(x) (((x) & 0xf800) == CLOSURE_OPERATOR) |
Zesstra | 5f7e49b | 2017-06-18 15:30:41 +0200 | [diff] [blame] | 75 | #ifdef __PYTHON__ |
| 76 | # define CLOSURE_IS_PYTHON_EFUN(x) (((x) & 0xf800) == CLOSURE_PYTHON_EFUN) |
| 77 | #endif |
MG Mud User | 88f1247 | 2016-06-24 23:31:02 +0200 | [diff] [blame] | 78 | |
| 79 | #endif /* __DRIVER_SOURCE__ */ |
| 80 | |
| 81 | #endif /* LPC_LPCTYPES_H */ |