00001 00002 #include <assert.h> 00003 #include <string.h> 00004 #include <stdio.h> 00005 #include "stdtypes.h" 00006 #include "blockpool.h" 00007 #include "pools.h" 00008 #include "str.h" 00009 #include "list.h" 00010 #include "fifo_list.h" 00011 #include "hash_serv.h" 00012 #include "sparse.h" 00013 #include "strtable.h" 00014 #include "sym.h" 00015 #include "type.h" 00016 #include "const.h" 00017 #include "symtable.h" 00018 #include "typetable.h" 00019 #include "dsym.h" 00020 00021 00026 sym *sym_scope::find_in_scope( sym *pSym, STRING sym_name ) 00027 { 00028 sym *retsym = NULL; 00029 00030 if (pSym != NULL && pSym->has_scope() ) { 00031 retsym = ((sym_scope *)pSym)->symtab.find_sym( sym_name ); 00032 if (retsym == NULL && pSym->get_parent_scope() != NULL) { 00033 // the symbol was not found in the local scope, so go up one 00034 // scope level. 00035 retsym = find_in_scope( pSym->get_parent_scope(), sym_name ); 00036 } 00037 } 00038 00039 return retsym; 00040 } // find_in_scope 00041 00042 00047 sym *sym_scope::LookupFromScope( STRING str ) 00048 { 00049 sym *retsym = NULL; 00050 00051 if (str.GetText() != NULL) { 00052 STRING local_str; 00053 00054 // if its not in the string table, its not in the symbol table 00055 local_str = strtab.find_string( str, FALSE ); // don't enter 00056 if (local_str.GetText() != NULL) { 00057 retsym = find_in_scope( this, local_str ); 00058 } 00059 } 00060 00061 return retsym; 00062 } // LookupFromScope 00063 00064 00065 00069 void sym_component::proc_list_dealloc(void) 00070 { 00071 LIST<sym *>::handle h; 00072 sym *pListSym; 00073 00074 for (h = proc_list.first(); h != NULL; h = proc_list.next( h ) ) { 00075 pListSym = proc_list.get_item( h ); 00076 if (pListSym != NULL && pListSym->has_scope()) { 00077 pListSym->get_symtab()->dealloc_sub_tables(); 00078 pListSym->get_symtab()->dealloc(); 00079 } 00080 } // for 00081 proc_list.dealloc(); 00082 } // proc_list_dealloc