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

symtable::chain_elem Class Reference

class for the hash collision chains More...

Collaboration diagram for symtable::chain_elem:

Collaboration graph
[legend]
List of all members.

Public Member Functions

 chain_elem (void)
 ~chain_elem (void)
symsearch_list (STRING item)
 Search for a symbol in the hash chain list, using its STRING field as a key.

unsigned int list_len (void)

Public Attributes

LIST< sym * > list

Private Member Functions

 chain_elem (const chain_elem &)

Detailed Description

class for the hash collision chains

Definition at line 64 of file symtable.h.


Constructor & Destructor Documentation

symtable::chain_elem::chain_elem const chain_elem  )  [inline, private]
 

Definition at line 68 of file symtable.h.

00068 {}

symtable::chain_elem::chain_elem void   )  [inline]
 

Definition at line 70 of file symtable.h.

References list.

00070 { list = LIST<sym *>(); }

symtable::chain_elem::~chain_elem void   )  [inline]
 

Definition at line 71 of file symtable.h.

References LIST< sym * >::dealloc(), and list.

00071 { list.dealloc(); }


Member Function Documentation

unsigned int symtable::chain_elem::list_len void   )  [inline]
 

Definition at line 75 of file symtable.h.

References LIST< sym * >::first(), list, LIST< sym * >::next(), and NULL.

00076         {
00077             LIST<sym *>::handle h;
00078             int len = 0;;
00079             
00080             for (h = list.first(); h != NULL; h = list.next(h)) {
00081                 len++;
00082             } // for
00083             return len;
00084         } // list_len

sym * symtable::chain_elem::search_list STRING  item  ) 
 

Search for a symbol in the hash chain list, using its STRING field as a key.

The strings should have been entered in the string table. As a result, an address compare can be used, since all strings are unique in the string table.

Note that there must be a symbol table for each unique scope.

Definition at line 33 of file symtable.C.

References LIST< sym * >::first(), LIST< sym * >::get_item(), sym::get_name(), STRING::GetText(), list, LIST< sym * >::next(), and NULL.

00034 {
00035     LIST<sym *>::handle h;
00036     sym *list_sym, *sym;
00037     
00038     sym = NULL;
00039     for (h = list.first(); h != NULL; h = list.next(h)) {
00040         list_sym = list.get_item( h );
00041         if ( list_sym->get_name().GetText() == item.GetText() ) {
00042             sym = list_sym;
00043             break;
00044         }  // if
00045     } // for
00046     
00047     return sym;
00048 } // search_list


Member Data Documentation

LIST<sym *> symtable::chain_elem::list
 

Definition at line 66 of file symtable.h.

Referenced by chain_elem(), list_len(), search_list(), and ~chain_elem().


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