3 <!-- This HTML file has been created by texi2html 1.54
4 from suif1.texi on 28 April 1999 -->
6 <TITLE>The SUIF Version
1 Library - Lexicon
</TITLE>
7 <link href=
"suif1_103.html" rel=Next
>
8 <link href=
"suif1_101.html" rel=Previous
>
9 <link href=
"suif1_toc.html" rel=ToC
>
13 <p>Go to the
<A HREF=
"suif1_1.html">first
</A>,
<A HREF=
"suif1_101.html">previous
</A>,
<A HREF=
"suif1_103.html">next
</A>,
<A HREF=
"suif1_113.html">last
</A> section,
<A HREF=
"suif1_toc.html">table of contents
</A>.
17 <H2><A NAME=
"SEC102" HREF=
"suif1_toc.html#TOC102">Lexicon
</A></H2>
26 Almost all character strings in SUIF are entered in a hash table called
27 the
<CODE>lexicon
</CODE>. This table removes duplicate strings so that string
28 comparisons can be reduced to simple pointer comparisons. The
29 <CODE>lexicon
</CODE> is an object of the
<CODE>string_table
</CODE> class defined in
30 the
<TT>`stringtable.h'
</TT> and
<TT>`stringtable.cc'
</TT> files.
36 A
<CODE>string_table
</CODE> is an open hash table; each bucket is a linked
37 list of string entries represented by objects of the
<CODE>string_e
</CODE>
38 class. The only public method in the
<CODE>string_table
</CODE> class is
39 called
<CODE>enter
</CODE>. This method searches the table for a specified
40 string. If the string is found,
<CODE>enter
</CODE> returns a pointer to the
41 existing
<CODE>string_e
</CODE> entry. Otherwise, it creates a new entry and
42 adds it to the table. In either case, the actual character string
43 pointer can be retrieved directly from the
<CODE>sp
</CODE> field of the
44 resulting
<CODE>string_e
</CODE> entry.
48 None of the strings in the
<CODE>lexicon
</CODE> are deallocated until a SUIF
49 program terminates. Consequently, when adding a new string to the
50 table, it is copied to the heap in case the original string is stored on
51 the stack. If the string is known to be allocated on the heap and will
52 never be modified or deallocated, this string copy can be avoided by
53 setting the optional
<CODE>fixed
</CODE> flag when calling
<CODE>enter
</CODE>.
58 <p>Go to the
<A HREF=
"suif1_1.html">first
</A>,
<A HREF=
"suif1_101.html">previous
</A>,
<A HREF=
"suif1_103.html">next
</A>,
<A HREF=
"suif1_113.html">last
</A> section,
<A HREF=
"suif1_toc.html">table of contents
</A>.