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