[Python-checkins] python/dist/src/Include symtable.h,2.9,2.9.18.1
jhylton@users.sourceforge.net
jhylton@users.sourceforge.net
Sun, 07 Jul 2002 10:47:44 -0700
Update of /cvsroot/python/python/dist/src/Include
In directory usw-pr-cvs1:/tmp/cvs-serv579/Include
Modified Files:
Tag: ast-branch
symtable.h
Log Message:
checkin of partial progress:
Revise symtable to use AST.
Move the code to symtable.c in the process.
Haven't yet nuked the old code in compile.c.
Note that this code doesn't even compile.
Index: symtable.h
===================================================================
RCS file: /cvsroot/python/python/dist/src/Include/symtable.h,v
retrieving revision 2.9
retrieving revision 2.9.18.1
diff -C2 -d -r2.9 -r2.9.18.1
*** symtable.h 11 Aug 2001 21:51:17 -0000 2.9
--- symtable.h 7 Jul 2002 17:47:41 -0000 2.9.18.1
***************
*** 5,19 ****
#endif
! /* A symbol table is constructed each time PyNode_Compile() is
! called. The table walks the entire parse tree and identifies each
! use or definition of a variable.
!
! The symbol table contains a dictionary for each code block in a
! module: The symbol dictionary for the block. They keys of these
! dictionaries are the name of all variables used or defined in the
! block; the integer values are used to store several flags,
! e.g. DEF_PARAM indicates that a variable is a parameter to a
! function.
! */
struct _symtable_entry;
--- 5,10 ----
#endif
! typedef enum _scope_type { FunctionScope, ClassScope, ModuleScope }
! scope_ty;
struct _symtable_entry;
***************
*** 21,25 ****
struct symtable {
int st_pass; /* pass == 1 or 2 */
! char *st_filename; /* name of file being compiled */
struct _symtable_entry *st_cur; /* current symbol table entry */
PyObject *st_symbols; /* dictionary of symbol table entries */
--- 12,16 ----
struct symtable {
int st_pass; /* pass == 1 or 2 */
! const char *st_filename; /* name of file being compiled */
struct _symtable_entry *st_cur; /* current symbol table entry */
PyObject *st_symbols; /* dictionary of symbol table entries */
***************
*** 40,44 ****
PyObject *ste_varnames; /* list of variable names */
PyObject *ste_children; /* list of child ids */
! int ste_type; /* module, class, or function */
int ste_lineno; /* first line of scope */
int ste_optimized; /* true if namespace can't be optimized */
--- 31,35 ----
PyObject *ste_varnames; /* list of variable names */
PyObject *ste_children; /* list of child ids */
! scope_ty ste_type; /* module, class, or function */
int ste_lineno; /* first line of scope */
int ste_optimized; /* true if namespace can't be optimized */
***************
*** 55,67 ****
#define PySymtableEntry_Check(op) ((op)->ob_type == &PySymtableEntry_Type)
! extern DL_IMPORT(PyObject *) PySymtableEntry_New(struct symtable *,
! char *, int, int);
DL_IMPORT(struct symtable *) PyNode_CompileSymtable(struct _node *, char *);
DL_IMPORT(void) PySymtable_Free(struct symtable *);
-
- #define TOP "global"
-
/* Flags for def-use information */
--- 46,56 ----
#define PySymtableEntry_Check(op) ((op)->ob_type == &PySymtableEntry_Type)
! extern DL_IMPORT(PySymtableEntryObject *) \
! PySymtableEntry_New(struct symtable *, identifier, scope_ty, void *,
! int);
DL_IMPORT(struct symtable *) PyNode_CompileSymtable(struct _node *, char *);
DL_IMPORT(void) PySymtable_Free(struct symtable *);
/* Flags for def-use information */
***************
*** 79,86 ****
#define DEF_BOUND (DEF_LOCAL | DEF_PARAM | DEF_IMPORT)
-
- #define TYPE_FUNCTION 1
- #define TYPE_CLASS 2
- #define TYPE_MODULE 3
#define LOCAL 1
--- 68,71 ----