123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117 |
- #ifndef Py_LIMITED_API
- #ifndef Py_SYMTABLE_H
- #define Py_SYMTABLE_H
- #ifdef __cplusplus
- extern "C" {
- #endif
- typedef enum _block_type { FunctionBlock, ClassBlock, ModuleBlock }
- _Py_block_ty;
- struct _symtable_entry;
- struct symtable {
- PyObject *st_filename;
- struct _symtable_entry *st_cur;
- struct _symtable_entry *st_top;
- PyObject *st_blocks;
- PyObject *st_stack;
- PyObject *st_global;
- int st_nblocks;
- PyObject *st_private;
- PyFutureFeatures *st_future;
- int recursion_depth;
- int recursion_limit;
- };
- typedef struct _symtable_entry {
- PyObject_HEAD
- PyObject *ste_id;
- PyObject *ste_symbols;
- PyObject *ste_name;
- PyObject *ste_varnames;
- PyObject *ste_children;
- PyObject *ste_directives;
- _Py_block_ty ste_type;
- int ste_nested;
- unsigned ste_free : 1;
- unsigned ste_child_free : 1;
- unsigned ste_generator : 1;
- unsigned ste_varargs : 1;
- unsigned ste_varkeywords : 1;
- unsigned ste_returns_value : 1;
- unsigned ste_needs_class_closure : 1;
- int ste_lineno;
- int ste_col_offset;
- int ste_opt_lineno;
- int ste_opt_col_offset;
- int ste_tmpname;
- struct symtable *ste_table;
- } PySTEntryObject;
- PyAPI_DATA(PyTypeObject) PySTEntry_Type;
- #define PySTEntry_Check(op) (Py_TYPE(op) == &PySTEntry_Type)
- PyAPI_FUNC(int) PyST_GetScope(PySTEntryObject *, PyObject *);
- PyAPI_FUNC(struct symtable *) PySymtable_Build(
- mod_ty mod,
- const char *filename,
- PyFutureFeatures *future);
- PyAPI_FUNC(struct symtable *) PySymtable_BuildObject(
- mod_ty mod,
- PyObject *filename,
- PyFutureFeatures *future);
- PyAPI_FUNC(PySTEntryObject *) PySymtable_Lookup(struct symtable *, void *);
- PyAPI_FUNC(void) PySymtable_Free(struct symtable *);
- #define DEF_GLOBAL 1
- #define DEF_LOCAL 2
- #define DEF_PARAM 2<<1
- #define DEF_NONLOCAL 2<<2
- #define USE 2<<3
- #define DEF_FREE 2<<4
- #define DEF_FREE_CLASS 2<<5
- #define DEF_IMPORT 2<<6
- #define DEF_BOUND (DEF_LOCAL | DEF_PARAM | DEF_IMPORT)
- #define SCOPE_OFFSET 11
- #define SCOPE_MASK (DEF_GLOBAL | DEF_LOCAL | DEF_PARAM | DEF_NONLOCAL)
- #define LOCAL 1
- #define GLOBAL_EXPLICIT 2
- #define GLOBAL_IMPLICIT 3
- #define FREE 4
- #define CELL 5
- #define GENERATOR 1
- #define GENERATOR_EXPRESSION 2
- #ifdef __cplusplus
- }
- #endif
- #endif
- #endif
|