Changeset 388 for python/vendor/current/Include/symtable.h
- Timestamp:
- Mar 19, 2014, 11:11:30 AM (11 years ago)
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
python/vendor/current/Include/symtable.h
r2 r388 12 12 13 13 struct symtable { 14 const char *st_filename; /* name of file being compiled */ 15 struct _symtable_entry *st_cur; /* current symbol table entry */ 16 struct _symtable_entry *st_top; /* module entry */ 17 PyObject *st_symbols; /* dictionary of symbol table entries */ 18 PyObject *st_stack; /* stack of namespace info */ 19 PyObject *st_global; /* borrowed ref to MODULE in st_symbols */ 20 int st_nblocks; /* number of blocks */ 21 PyObject *st_private; /* name of current class or NULL */ 22 int st_tmpname; /* temporary name counter */ 23 PyFutureFeatures *st_future; /* module's future features */ 14 const char *st_filename; /* name of file being compiled */ 15 struct _symtable_entry *st_cur; /* current symbol table entry */ 16 struct _symtable_entry *st_top; /* module entry */ 17 PyObject *st_symbols; /* dictionary of symbol table entries */ 18 PyObject *st_stack; /* stack of namespace info */ 19 PyObject *st_global; /* borrowed ref to MODULE in st_symbols */ 20 int st_nblocks; /* number of blocks */ 21 PyObject *st_private; /* name of current class or NULL */ 22 PyFutureFeatures *st_future; /* module's future features */ 24 23 }; 25 24 26 25 typedef struct _symtable_entry { 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 26 PyObject_HEAD 27 PyObject *ste_id; /* int: key in st_symbols */ 28 PyObject *ste_symbols; /* dict: name to flags */ 29 PyObject *ste_name; /* string: name of block */ 30 PyObject *ste_varnames; /* list of variable names */ 31 PyObject *ste_children; /* list of child ids */ 32 _Py_block_ty ste_type; /* module, class, or function */ 33 int ste_unoptimized; /* false if namespace is optimized */ 34 int ste_nested; /* true if block is nested */ 35 unsigned ste_free : 1; /* true if block has free variables */ 36 unsigned ste_child_free : 1; /* true if a child block has free vars, 37 including free refs to globals */ 38 unsigned ste_generator : 1; /* true if namespace is a generator */ 39 unsigned ste_varargs : 1; /* true if block has varargs */ 40 unsigned ste_varkeywords : 1; /* true if block has varkeywords */ 41 unsigned ste_returns_value : 1; /* true if namespace uses return with 42 an argument */ 43 int ste_lineno; /* first line of block */ 44 int ste_opt_lineno; /* lineno of last exec or import * */ 45 int ste_tmpname; /* counter for listcomp temp vars */ 46 struct symtable *ste_table; 48 47 } PySTEntryObject; 49 48 … … 54 53 PyAPI_FUNC(int) PyST_GetScope(PySTEntryObject *, PyObject *); 55 54 56 PyAPI_FUNC(struct symtable *) PySymtable_Build(mod_ty, const char *, 57 55 PyAPI_FUNC(struct symtable *) PySymtable_Build(mod_ty, const char *, 56 PyFutureFeatures *); 58 57 PyAPI_FUNC(PySTEntryObject *) PySymtable_Lookup(struct symtable *, void *); 59 58 … … 66 65 #define DEF_PARAM 2<<1 /* formal parameter */ 67 66 #define USE 2<<2 /* name is used */ 68 #define DEF_STAR 2<<3 /* parameter is star arg */ 69 #define DEF_DOUBLESTAR 2<<4 /* parameter is star-star arg */ 70 #define DEF_INTUPLE 2<<5 /* name defined in tuple in parameters */ 71 #define DEF_FREE 2<<6 /* name used but not defined in nested block */ 72 #define DEF_FREE_GLOBAL 2<<7 /* free variable is actually implicit global */ 73 #define DEF_FREE_CLASS 2<<8 /* free variable from class's method */ 74 #define DEF_IMPORT 2<<9 /* assignment occurred via import */ 67 #define DEF_FREE 2<<3 /* name used but not defined in nested block */ 68 #define DEF_FREE_CLASS 2<<4 /* free variable from class's method */ 69 #define DEF_IMPORT 2<<5 /* assignment occurred via import */ 75 70 76 71 #define DEF_BOUND (DEF_LOCAL | DEF_PARAM | DEF_IMPORT) 77 72 78 73 /* GLOBAL_EXPLICIT and GLOBAL_IMPLICIT are used internally by the symbol 79 table. GLOBAL is returned from PyST_GetScope() for either of them. 74 table. GLOBAL is returned from PyST_GetScope() for either of them. 80 75 It is stored in ste_symbols at bits 12-14. 81 76 */
Note:
See TracChangeset
for help on using the changeset viewer.