symtab.h

Go to the documentation of this file.
00001 /****************************************************************************/
00002 /*                                                                          */
00003 /*  This file is part of QSopt_ex.                                          */
00004 /*                                                                          */
00005 /*  (c) Copyright 2006 by David Applegate, William Cook, Sanjeeb Dash,      */
00006 /*  and Daniel Espinoza                                                     */
00007 /*                                                                          */
00008 /*  Sanjeeb Dash ownership of copyright in QSopt_ex is derived from his     */
00009 /*  copyright in QSopt.                                                     */
00010 /*                                                                          */
00011 /*  This code may be used under the terms of the GNU General Public License */
00012 /*  (Version 2.1 or later) as published by the Free Software Foundation.    */
00013 /*                                                                          */
00014 /*  Alternatively, use is granted for research purposes only.               */
00015 /*                                                                          */
00016 /*  It is your choice of which of these two licenses you are operating      */
00017 /*  under.                                                                  */
00018 /*                                                                          */
00019 /*  We make no guarantees about the correctness or usefulness of this code. */
00020 /*                                                                          */
00021 /****************************************************************************/
00022 
00023 /* RCSINFO $Id: symtab.h,v 1.2 2003/11/05 16:47:22 meven Exp $ */
00024 #ifndef ILL_SYMTAB_H
00025 #define ILL_SYMTAB_H
00026 
00027 /* we allow 256KB of buffer space i.e. 2^17*/
00028 #define ILL_namebufsize 0x20000U
00029 
00030 typedef struct ILLsymbolent
00031 {
00032   int symbol;
00033   int index;
00034   int next;
00035 }
00036 ILLsymbolent;
00037 
00038 typedef struct ILLsymboltab
00039 {
00040   int *hashtable;
00041   ILLsymbolent *nametable;
00042   char *namelist;
00043   int tablesize;
00044   int strsize;
00045   int hashspace;
00046   int name_space;
00047   int strspace;
00048   int freedchars;
00049   int the_hash;
00050   int the_index;
00051   int the_prev_index;
00052   int index_ok;
00053 }
00054 ILLsymboltab;
00055 
00056 /* 
00057  * hashtable[stringhash(entry) % hashspace] either NO_INDEX or some hash number
00058  * nametable[hash number] = { next:    another index for nametable 
00059  *                            symbol:  index into namelist where string resides
00060  *                          }
00061  * tablesize:  number of entries   (tablesize <= name_space)
00062  * name_space:  length of nametable and indexlist
00063  * hashspace:  length of hashtable   nextprime(name_space)
00064  * strsize:    number of chars used in namelist 
00065  * strspace:   length of namelist
00066  * indexlist:  LP col/row indices for the table entries
00067  * indexlist_ok:  1 if column indices in indexlist are up-to-date, 0 otherwise
00068  *
00069  * Deletion of entries affects their ordering in symboltab->nametable. 
00070  * Strings may move around within symboltab->namelist. 
00071  */
00072 
00073 
00074 #define ILL_SYM_NOINDEX (-1)
00075 extern void ILLsymboltab_init (
00076   ILLsymboltab * h),
00077   ILLsymboltab_free (
00078   ILLsymboltab * h),
00079   ILLsymboltab_size (
00080   const ILLsymboltab * h,
00081   int *p_size),
00082   ILLsymboltab_prt (
00083   FILE * fd,
00084   ILLsymboltab * h);
00085 
00086 extern int ILLsymboltab_create (
00087   ILLsymboltab * h,
00088   int init_size),
00089   ILLsymboltab_copy (
00090   ILLsymboltab * src,
00091   ILLsymboltab * dst),
00092   ILLsymboltab_register (
00093   ILLsymboltab * h,
00094   const char *s,
00095   int itemindex,
00096   int *p_index,
00097   int *p_existed),
00098   ILLsymboltab_lookup (
00099   ILLsymboltab * h,
00100   const char *s,
00101   int *p_index),
00102   ILLsymboltab_index_ok (
00103   ILLsymboltab * h),
00104   ILLsymboltab_index_reset (
00105   ILLsymboltab * h,
00106   int icount,
00107   char **names),
00108   ILLsymboltab_getindex (
00109   ILLsymboltab * h,
00110   const char *name,
00111   int *hindex),
00112   ILLsymboltab_contains (
00113   ILLsymboltab * h,
00114   const char *s),
00115   ILLsymboltab_delete (
00116   ILLsymboltab * h,
00117   const char *s),
00118   ILLsymboltab_uname (
00119   ILLsymboltab * h,
00120   char name[ILL_namebufsize],
00121   const char *try_prefix1,
00122   const char *try_prefix2);
00123 
00124 extern void ILLsymboltab_unique_name (
00125   ILLsymboltab * tab,
00126   int i,
00127   const char *pref,
00128   char uname[ILL_namebufsize]);
00129 
00130 extern const char *ILLsymboltab_get (
00131   const ILLsymboltab * tab,
00132   int i);
00133 extern int ILLsymboltab_rename (
00134   ILLsymboltab * h,
00135   int i,
00136   const char *new_name);
00137 
00138 #endif /* __SYMTAB_H */

Generated on Thu Mar 29 09:32:33 2012 for QSopt_ex by  doxygen 1.4.7