Main Page | Class Hierarchy | Compound List | File List | Compound Members | File Members

sym_scope Class Reference

This class is used for a named item that has scope information (for example, a procedure or a function). More...

#include <dsym.h>

Inheritance diagram for sym_scope:

Inheritance graph
[legend]
Collaboration diagram for sym_scope:

Collaboration graph
[legend]
List of all members.

Public Member Functions

 sym_scope (STRING n)
 sym_scope ()
void dealloc (void)
symLookupFromScope (STRING s)
 Start in the local scope and search upward toward the component scope.

symLookupFromScope (const char *pChar)
symtableget_symtab (void)
typetableget_typtab (void)
Boolean has_scope ()
 Return true when the symbol has associated scope (e.g., a symbol table.


Protected Attributes

symtable symtab
typetable typtab

Private Member Functions

symfind_in_scope (sym *pSym, STRING sym_name)
 Recursively search the symbol scope for the symbol with the name str.

 sym_scope (const sym_scope &s)
 Don't allow copying of sym_scope objects via copy constructor.


Detailed Description

This class is used for a named item that has scope information (for example, a procedure or a function).

These objects also exist in a scope, so the object is derived from sym_scoped. However, for some scope objects, like components (an elaborated entity architecture pair) there is no parent scope.

Definition at line 223 of file dsym.h.


Constructor & Destructor Documentation

sym_scope::sym_scope const sym_scope s  )  [inline, private]
 

Don't allow copying of sym_scope objects via copy constructor.

Definition at line 229 of file dsym.h.

References FALSE.

00230     {
00231         assert( FALSE );
00232     }

sym_scope::sym_scope STRING  n  )  [inline]
 

Definition at line 242 of file dsym.h.

00242                          : sym_scoped( n )
00243     {
00244     }

sym_scope::sym_scope  )  [inline]
 

Definition at line 246 of file dsym.h.

00247     {
00248     }


Member Function Documentation

void sym_scope::dealloc void   )  [inline, virtual]
 

Reimplemented from sym.

Reimplemented in sym_component.

Definition at line 250 of file dsym.h.

References symtable::dealloc(), symtab, and typtab.

Referenced by sym_component::dealloc().

00251     {
00252         symtab.dealloc();
00253         typtab.~typetable();
00254     }

sym * sym_scope::find_in_scope sym pSym,
STRING  sym_name
[private]
 

Recursively search the symbol scope for the symbol with the name str.

Definition at line 26 of file sym.C.

References sym::get_parent_scope(), sym::has_scope(), NULL, and pSym.

Referenced by LookupFromScope().

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

symtable* sym_scope::get_symtab void   )  [inline, virtual]
 

Reimplemented from sym.

Definition at line 266 of file dsym.h.

References symtab.

00267     {
00268         return &symtab;
00269     }

typetable* sym_scope::get_typtab void   )  [inline, virtual]
 

Reimplemented from sym.

Definition at line 271 of file dsym.h.

References typtab.

00272     {
00273         return &typtab;
00274     }

Boolean sym_scope::has_scope  )  [inline, virtual]
 

Return true when the symbol has associated scope (e.g., a symbol table.

Reimplemented from sym.

Definition at line 279 of file dsym.h.

References Boolean, and TRUE.

00280     {
00281         return TRUE;
00282     }

sym* sym_scope::LookupFromScope const char *  pChar  )  [inline, virtual]
 

Reimplemented from sym.

Definition at line 258 of file dsym.h.

References LookupFromScope(), pChar, and STRING::SetText().

00259     {
00260         STRING local_str;
00261 
00262         local_str.SetText( pChar );
00263         return LookupFromScope( local_str );
00264     }

sym * sym_scope::LookupFromScope STRING  str  )  [virtual]
 

Start in the local scope and search upward toward the component scope.

Reimplemented from sym.

Definition at line 47 of file sym.C.

References FALSE, find_in_scope(), strtable::find_string(), STRING::GetText(), NULL, and strtab.

Referenced by LookupFromScope().

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


Member Data Documentation

symtable sym_scope::symtab [protected]
 

Definition at line 235 of file dsym.h.

Referenced by dealloc(), get_symtab(), and sym_component::init().

typetable sym_scope::typtab [protected]
 

Definition at line 236 of file dsym.h.

Referenced by dealloc(), get_typtab(), and sym_component::init().


The documentation for this class was generated from the following files:
Generated on Wed Mar 31 21:16:11 2004 for Data Structures for a VHDL Compiler by doxygen 1.3.3