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