blob: 504ba7513cdccbe2e23cc417b6a1bf3ff771fef2 [file] [log] [blame]
MG Mud User88f12472016-06-24 23:31:02 +02001#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
Zesstraedb27342021-04-08 20:05:58 +020018#define TYPE_BYTES 12
19#define TYPE_LWOBJECT 13
MG Mud User88f12472016-06-24 23:31:02 +020020
21#define TYPE_MOD_POINTER 0x0040 /* Pointer to a basic type */
22
23/* runtime types, from typeof() */
24
25#define T_INVALID 0x0
26#define T_LVALUE 0x1
27#define T_NUMBER 0x2
28#define T_STRING 0x3
29#define T_POINTER 0x4
30#define T_OBJECT 0x5
31#define T_MAPPING 0x6
32#define T_FLOAT 0x7
33#define T_CLOSURE 0x8
34#define T_SYMBOL 0x9
35#define T_QUOTED_ARRAY 0xa
36#define T_STRUCT 0xb
Zesstraffb18e92019-09-27 16:17:09 +020037#define T_BYTES 0xc
Zesstraedb27342021-04-08 20:05:58 +020038#define T_LWOBJECT 0xd
MG Mud User88f12472016-06-24 23:31:02 +020039
40/* Closure types, stored as secondary type info */
41
42#ifndef __DRIVER_SOURCE__
43
44#define CLOSURE_LFUN 0 /* lfun in an object */
45 /* Code 1: currently unused, used to be CLOSURE_ALIEN_LFUN */
46#define CLOSURE_IDENTIFIER 2 /* variable in this object */
47#define CLOSURE_PRELIMINARY 3
48 /* Efun closure used in a static initialization */
49#define CLOSURE_BOUND_LAMBDA 4 /* Bound unbound-lambda closure */
50#define CLOSURE_LAMBDA 5 /* normal lambda closure */
51#define CLOSURE_UNBOUND_LAMBDA 6 /* unbound lambda closure. */
52
Zesstra5f7e49b2017-06-18 15:30:41 +020053#ifdef __PYTHON__
54# define CLOSURE_OPERATOR (0xe000)
55# define CLOSURE_PYTHON_EFUN (0xe800)
56#else
57# define CLOSURE_OPERATOR (0xe800)
58#endif
MG Mud User88f12472016-06-24 23:31:02 +020059#define CLOSURE_EFUN (0xf000)
60#define CLOSURE_SIMUL_EFUN (0xf800)
61
62#define CLOSURE_IS_LFUN(x) (((x)&~1) == 0)
63#define CLOSURE_IS_IDENTIFIER(x) ((x) == CLOSURE_IDENTIFIER)
64#define CLOSURE_IS_BOUND_LAMBDA(x) ((x) == CLOSURE_BOUND_LAMBDA)
65#define CLOSURE_IS_LAMBDA(x) ((x) == CLOSURE_LAMBDA)
66#define CLOSURE_IS_UNBOUND_LAMBDA(x) ((x) == CLOSURE_UNBOUND_LAMBDA)
67#define CLOSURE_IS_SIMUL_EFUN(x) (((x) & 0xf800) == CLOSURE_SIMUL_EFUN)
68#define CLOSURE_IS_EFUN(x) (((x) & 0xf800) == CLOSURE_EFUN)
69#define CLOSURE_IS_OPERATOR(x) (((x) & 0xf800) == CLOSURE_OPERATOR)
Zesstra5f7e49b2017-06-18 15:30:41 +020070#ifdef __PYTHON__
71# define CLOSURE_IS_PYTHON_EFUN(x) (((x) & 0xf800) == CLOSURE_PYTHON_EFUN)
72#endif
MG Mud User88f12472016-06-24 23:31:02 +020073
74#endif /* __DRIVER_SOURCE__ */
75
76#endif /* LPC_LPCTYPES_H */