4 typedef PyObject
* identifier
;
5 typedef PyObject
* string
;
6 typedef PyObject
* object
;
8 typedef enum {false, true} bool;
10 /* It would be nice if the code generated by asdl_c.py was completely
11 independent of Python, but it is a goal the requires too much work
12 at this stage. So, for example, I'll represent identifiers as
13 interned Python strings.
16 /* XXX A sequence should be typed so that its use can be typechecked. */
18 /* XXX We shouldn't pay for offset when we don't need APPEND. */
26 asdl_seq
*asdl_seq_new(int size
, PyArena
*arena
);
27 void asdl_seq_free(asdl_seq
*);
30 #define asdl_seq_GET(S, I) (S)->elements[(I)]
31 #define asdl_seq_SET(S, I, V) { \
33 assert((S) && _asdl_i < (S)->size); \
34 (S)->elements[_asdl_i] = (V); \
36 #define asdl_seq_APPEND(S, V) { \
37 assert((S) && (S)->offset < (S)->size); \
38 (S)->elements[(S)->offset++] = (V); \
41 #define asdl_seq_GET(S, I) (S)->elements[(I)]
42 #define asdl_seq_SET(S, I, V) (S)->elements[I] = (V)
43 #define asdl_seq_APPEND(S, V) (S)->elements[(S)->offset++] = (V)
45 #define asdl_seq_LEN(S) ((S) == NULL ? 0 : (S)->size)
47 #endif /* !Py_ASDL_H */