comparison CSP2/CSP2_env/env-d9b9114564458d9d-741b3de822f2aaca6c6caa4325c4afce/include/python3.8/asdl.h @ 69:33d812a61356

planemo upload commit 2e9511a184a1ca667c7be0c6321a36dc4e3d116d
author jpayne
date Tue, 18 Mar 2025 17:55:14 -0400
parents
children
comparison
equal deleted inserted replaced
67:0e9998148a16 69:33d812a61356
1 #ifndef Py_ASDL_H
2 #define Py_ASDL_H
3
4 typedef PyObject * identifier;
5 typedef PyObject * string;
6 typedef PyObject * bytes;
7 typedef PyObject * object;
8 typedef PyObject * singleton;
9 typedef PyObject * constant;
10
11 /* It would be nice if the code generated by asdl_c.py was completely
12 independent of Python, but it is a goal the requires too much work
13 at this stage. So, for example, I'll represent identifiers as
14 interned Python strings.
15 */
16
17 /* XXX A sequence should be typed so that its use can be typechecked. */
18
19 typedef struct {
20 Py_ssize_t size;
21 void *elements[1];
22 } asdl_seq;
23
24 typedef struct {
25 Py_ssize_t size;
26 int elements[1];
27 } asdl_int_seq;
28
29 asdl_seq *_Py_asdl_seq_new(Py_ssize_t size, PyArena *arena);
30 asdl_int_seq *_Py_asdl_int_seq_new(Py_ssize_t size, PyArena *arena);
31
32 #define asdl_seq_GET(S, I) (S)->elements[(I)]
33 #define asdl_seq_LEN(S) ((S) == NULL ? 0 : (S)->size)
34 #ifdef Py_DEBUG
35 #define asdl_seq_SET(S, I, V) \
36 do { \
37 Py_ssize_t _asdl_i = (I); \
38 assert((S) != NULL); \
39 assert(0 <= _asdl_i && _asdl_i < (S)->size); \
40 (S)->elements[_asdl_i] = (V); \
41 } while (0)
42 #else
43 #define asdl_seq_SET(S, I, V) (S)->elements[I] = (V)
44 #endif
45
46 #endif /* !Py_ASDL_H */