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

dynamic_symbol.h

Go to the documentation of this file.
00001 /*****************************************************************************\
00002  *      File:   dynamic_symbol.h
00003  *      Author: John C. Gyllenhaal
00004  *      Creation Date:  1995
00005  *      Copyright (c) 1995 John C. Gyllenhaal, Wen-mei Hwu and
00006  *                         The Board of Trustees of the University of Illinois.
00007  *                         All rights reserved.
00008  *      The University of Illinois software License Agreement
00009  *      specifies the terms and conditions for redistribution.
00010 \*****************************************************************************/
00011 #ifndef DYNAMIC_SYMBOL_H
00012 #define DYNAMIC_SYMBOL_H
00013 
00014 /*
00015  * STRING symbol table structures and prototypes
00016  */
00017 typedef struct STRING_Symbol
00018 {
00019     char                        *name;          /* Name of symbol */
00020     unsigned int                hash_val;       /* Hashed value of name */
00021     void                        *data;          /* Data struct pointed to */
00022     struct STRING_Symbol_Table  *table;         /* For deletion of symbol */
00023     struct STRING_Symbol        *next_hash;     /* For table's hash table */
00024     struct STRING_Symbol        *prev_hash;
00025     struct STRING_Symbol        *next_symbol;   /* For table's contents list */
00026     struct STRING_Symbol        *prev_symbol;
00027 } STRING_Symbol;
00028 
00029 typedef struct STRING_Symbol_Table
00030 {
00031     char                *name;          /* For error messages */
00032     STRING_Symbol       **hash;         /* Array of size hash_size */
00033     int                 hash_size;      /* Must be power of 2 */
00034     int                 hash_mask;      /* AND mask, (hash_size - 1) */
00035     int                 resize_size;    /* When reached, resize hash table */
00036     STRING_Symbol       *head_symbol;   /* Contents list */
00037     STRING_Symbol       *tail_symbol;
00038     int                 symbol_count;
00039 } STRING_Symbol_Table;
00040 
00041 #ifdef __cplusplus
00042 extern "C" {
00043 #endif
00044 
00045 extern STRING_Symbol_Table *STRING_new_symbol_table (char *name, 
00046                                                      int expected_size);
00047 extern void STRING_delete_symbol_table (STRING_Symbol_Table *table, 
00048                                         void (*free_routine)(void *));
00049 extern STRING_Symbol *STRING_add_symbol (STRING_Symbol_Table *table, 
00050                                          char *name, void *data);
00051 extern STRING_Symbol *STRING_find_symbol (STRING_Symbol_Table *table, 
00052                                           char *name);
00053 extern void *STRING_find_symbol_data (STRING_Symbol_Table *table, char *name);
00054 extern void STRING_delete_symbol (STRING_Symbol *symbol, 
00055                                   void (*free_routine)(void *));
00056 
00057 /* For debugging hashing function only */
00058 extern void STRING_print_symbol_table_hash (FILE *out, 
00059                                             STRING_Symbol_Table *table);
00060 
00061 #ifdef __cplusplus
00062 }
00063 #endif
00064 
00065 /*
00066  * INT symbol table structures and prototypes
00067  */
00068 typedef struct INT_Symbol
00069 {
00070     int                         value;          /* Int value of symbol */
00071     void                        *data;          /* Data struct pointed to */
00072     struct INT_Symbol_Table     *table;         /* For deletion of symbol */
00073     struct INT_Symbol           *next_hash;     /* For table's hash table */
00074     struct INT_Symbol           *prev_hash;
00075     struct INT_Symbol           *next_symbol;   /* For table's contents list */
00076     struct INT_Symbol           *prev_symbol;
00077 
00078 } INT_Symbol;
00079 
00080 typedef struct INT_Symbol_Table
00081 {
00082     char                *name;          /* For error messages */
00083     INT_Symbol          **hash;         /* Array of size hash_size */
00084     int                 hash_size;      /* Must be power of 2 */
00085     int                 hash_mask;      /* AND mask, (hash_size - 1) */
00086     int                 resize_size;    /* When reached, resize hash table */
00087     INT_Symbol          *head_symbol;   /* Contents list */
00088     INT_Symbol          *tail_symbol;
00089     int                 symbol_count;
00090 } INT_Symbol_Table;
00091 
00092 #ifdef __cplusplus
00093 extern "C" {
00094 #endif
00095 
00096 extern INT_Symbol_Table *INT_new_symbol_table (char *name, int expected_size);
00097 extern void INT_delete_symbol_table (INT_Symbol_Table *table, 
00098                                      void (*free_routine)(void *));
00099 extern INT_Symbol *INT_add_symbol (INT_Symbol_Table *table, int value, 
00100                                    void *data);
00101 extern INT_Symbol *INT_find_symbol (INT_Symbol_Table *table, int value);
00102 extern void *INT_find_symbol_data (INT_Symbol_Table *table, int value);
00103 extern void INT_delete_symbol (INT_Symbol *symbol, 
00104                                void (*free_routine)(void *));
00105 
00106 /* For debugging hashing function only */
00107 extern void INT_print_symbol_table_hash (FILE *out, INT_Symbol_Table *table);
00108 
00109 #ifdef __cplusplus
00110 }
00111 #endif
00112 
00113 #endif
00114 
00115 
00116 
00117 
00118 

Generated on Mon Jul 21 20:24:10 2003 for TINKER LEGO DOC by doxygen 1.3.2