]>
Commit | Line | Data |
---|---|---|
c8042e10 DM |
1 | #ifndef Py_ASDL_H\r |
2 | #define Py_ASDL_H\r | |
3 | \r | |
4 | typedef PyObject * identifier;\r | |
5 | typedef PyObject * string;\r | |
6 | typedef PyObject * object;\r | |
7 | \r | |
8 | #ifndef __cplusplus\r | |
9 | typedef enum {false, true} bool;\r | |
10 | #endif\r | |
11 | \r | |
12 | /* It would be nice if the code generated by asdl_c.py was completely\r | |
13 | independent of Python, but it is a goal the requires too much work\r | |
14 | at this stage. So, for example, I'll represent identifiers as\r | |
15 | interned Python strings.\r | |
16 | */\r | |
17 | \r | |
18 | /* XXX A sequence should be typed so that its use can be typechecked. */\r | |
19 | \r | |
20 | typedef struct {\r | |
21 | int size;\r | |
22 | void *elements[1];\r | |
23 | } asdl_seq;\r | |
24 | \r | |
25 | typedef struct {\r | |
26 | int size;\r | |
27 | int elements[1];\r | |
28 | } asdl_int_seq;\r | |
29 | \r | |
30 | asdl_seq *asdl_seq_new(int size, PyArena *arena);\r | |
31 | asdl_int_seq *asdl_int_seq_new(int size, PyArena *arena);\r | |
32 | \r | |
33 | #define asdl_seq_GET(S, I) (S)->elements[(I)]\r | |
34 | #define asdl_seq_LEN(S) ((S) == NULL ? 0 : (S)->size)\r | |
35 | #ifdef Py_DEBUG\r | |
36 | #define asdl_seq_SET(S, I, V) { \\r | |
37 | int _asdl_i = (I); \\r | |
38 | assert((S) && _asdl_i < (S)->size); \\r | |
39 | (S)->elements[_asdl_i] = (V); \\r | |
40 | }\r | |
41 | #else\r | |
42 | #define asdl_seq_SET(S, I, V) (S)->elements[I] = (V)\r | |
43 | #endif\r | |
44 | \r | |
45 | #endif /* !Py_ASDL_H */\r |