+++ /dev/null
-#ifndef Py_SYMTABLE_H\r
-#define Py_SYMTABLE_H\r
-\r
-#ifdef __cplusplus\r
-extern "C" {\r
-#endif\r
-\r
-typedef enum _block_type { FunctionBlock, ClassBlock, ModuleBlock }\r
- _Py_block_ty;\r
-\r
-struct _symtable_entry;\r
-\r
-struct symtable {\r
- const char *st_filename; /* name of file being compiled */\r
- struct _symtable_entry *st_cur; /* current symbol table entry */\r
- struct _symtable_entry *st_top; /* module entry */\r
- PyObject *st_symbols; /* dictionary of symbol table entries */\r
- PyObject *st_stack; /* stack of namespace info */\r
- PyObject *st_global; /* borrowed ref to MODULE in st_symbols */\r
- int st_nblocks; /* number of blocks */\r
- PyObject *st_private; /* name of current class or NULL */\r
- PyFutureFeatures *st_future; /* module's future features */\r
-};\r
-\r
-typedef struct _symtable_entry {\r
- PyObject_HEAD\r
- PyObject *ste_id; /* int: key in st_symbols */\r
- PyObject *ste_symbols; /* dict: name to flags */\r
- PyObject *ste_name; /* string: name of block */\r
- PyObject *ste_varnames; /* list of variable names */\r
- PyObject *ste_children; /* list of child ids */\r
- _Py_block_ty ste_type; /* module, class, or function */\r
- int ste_unoptimized; /* false if namespace is optimized */\r
- int ste_nested; /* true if block is nested */\r
- unsigned ste_free : 1; /* true if block has free variables */\r
- unsigned ste_child_free : 1; /* true if a child block has free vars,\r
- including free refs to globals */\r
- unsigned ste_generator : 1; /* true if namespace is a generator */\r
- unsigned ste_varargs : 1; /* true if block has varargs */\r
- unsigned ste_varkeywords : 1; /* true if block has varkeywords */\r
- unsigned ste_returns_value : 1; /* true if namespace uses return with\r
- an argument */\r
- int ste_lineno; /* first line of block */\r
- int ste_opt_lineno; /* lineno of last exec or import * */\r
- int ste_tmpname; /* counter for listcomp temp vars */\r
- struct symtable *ste_table;\r
-} PySTEntryObject;\r
-\r
-PyAPI_DATA(PyTypeObject) PySTEntry_Type;\r
-\r
-#define PySTEntry_Check(op) (Py_TYPE(op) == &PySTEntry_Type)\r
-\r
-PyAPI_FUNC(int) PyST_GetScope(PySTEntryObject *, PyObject *);\r
-\r
-PyAPI_FUNC(struct symtable *) PySymtable_Build(mod_ty, const char *,\r
- PyFutureFeatures *);\r
-PyAPI_FUNC(PySTEntryObject *) PySymtable_Lookup(struct symtable *, void *);\r
-\r
-PyAPI_FUNC(void) PySymtable_Free(struct symtable *);\r
-\r
-/* Flags for def-use information */\r
-\r
-#define DEF_GLOBAL 1 /* global stmt */\r
-#define DEF_LOCAL 2 /* assignment in code block */\r
-#define DEF_PARAM 2<<1 /* formal parameter */\r
-#define USE 2<<2 /* name is used */\r
-#define DEF_FREE 2<<3 /* name used but not defined in nested block */\r
-#define DEF_FREE_CLASS 2<<4 /* free variable from class's method */\r
-#define DEF_IMPORT 2<<5 /* assignment occurred via import */\r
-\r
-#define DEF_BOUND (DEF_LOCAL | DEF_PARAM | DEF_IMPORT)\r
-\r
-/* GLOBAL_EXPLICIT and GLOBAL_IMPLICIT are used internally by the symbol\r
- table. GLOBAL is returned from PyST_GetScope() for either of them.\r
- It is stored in ste_symbols at bits 12-14.\r
-*/\r
-#define SCOPE_OFF 11\r
-#define SCOPE_MASK 7\r
-\r
-#define LOCAL 1\r
-#define GLOBAL_EXPLICIT 2\r
-#define GLOBAL_IMPLICIT 3\r
-#define FREE 4\r
-#define CELL 5\r
-\r
-/* The following three names are used for the ste_unoptimized bit field */\r
-#define OPT_IMPORT_STAR 1\r
-#define OPT_EXEC 2\r
-#define OPT_BARE_EXEC 4\r
-#define OPT_TOPLEVEL 8 /* top-level names, including eval and exec */\r
-\r
-#define GENERATOR 1\r
-#define GENERATOR_EXPRESSION 2\r
-\r
-#ifdef __cplusplus\r
-}\r
-#endif\r
-#endif /* !Py_SYMTABLE_H */\r