00001
00002
00003
00004
00005
00006
00007
00008
00009
00010
00011
00012
00013
00014
00015
00016
00017
00018
00019
00020
00021
00022
00023
00024 #ifndef ILL_SYMTAB_H
00025 #define ILL_SYMTAB_H
00026
00027
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
00058
00059
00060
00061
00062
00063
00064
00065
00066
00067
00068
00069
00070
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