Debian Codegraph @

doc/gperf_6.html

raw
1 <HTML>
2 <HEAD>
3 <!-- This HTML file has been created by texi2html 1.52b
4 from gperf.texi on 16 April 2025 -->
5
6 <META HTTP-EQUIV="content-type" CONTENT="text/html; charset=UTF-8">
7 <TITLE>Perfect Hash Function Generator - 5 Invoking gperf</TITLE>
8 </HEAD>
9 <BODY>
10 Go to the <A HREF="gperf_1.html">first</A>, <A HREF="gperf_5.html">previous</A>, <A HREF="gperf_7.html">next</A>, <A HREF="gperf_10.html">last</A> section, <A HREF="gperf_toc.html">table of contents</A>.
11 <P><HR><P>
12
13
14 <H1><A NAME="SEC18" HREF="gperf_toc.html#TOC18">5 Invoking <CODE>gperf</CODE></A></H1>
15
16 <P>
17 There are <EM>many</EM> options to <CODE>gperf</CODE>. They were added to make
18 the program more convenient for use with real applications. “On-line”
19 help is readily available via the <SAMP>&lsquo;--help&rsquo;</SAMP> option. Here is the
20 complete list of options.
21
22 </P>
23
24
25
26 <H2><A NAME="SEC19" HREF="gperf_toc.html#TOC19">5.1 Specifying the Location of the Output File</A></H2>
27
28 <DL COMPACT>
29
30 <DT><SAMP>&lsquo;--output-file=<VAR>file</VAR>&rsquo;</SAMP>
31 <DD>
32 Allows you to specify the name of the file to which the output is written to.
33 </DL>
34
35 <P>
36 The results are written to standard output if no output file is specified
37 or if it is <SAMP>&lsquo;-&rsquo;</SAMP>.
38
39 </P>
40
41
42 <H2><A NAME="SEC20" HREF="gperf_toc.html#TOC20">5.2 Options that affect Interpretation of the Input File</A></H2>
43
44 <P>
45 These options are also available as declarations in the input file
46 (see section <A HREF="gperf_5.html#SEC9">4.1.1.2 Gperf Declarations</A>).
47
48 </P>
49 <DL COMPACT>
50
51 <DT><SAMP>&lsquo;-e <VAR>keyword-delimiter-list</VAR>&rsquo;</SAMP>
52 <DD>
53 <DT><SAMP>&lsquo;--delimiters=<VAR>keyword-delimiter-list</VAR>&rsquo;</SAMP>
54 <DD>
55 <A NAME="IDX41"></A>
56 Allows you to provide a string containing delimiters used to
57 separate keywords from their attributes. The default is ",". This
58 option is essential if you want to use keywords that have embedded
59 commas or newlines. One useful trick is to use -e'TAB', where TAB is
60 the literal tab character.
61
62 <DT><SAMP>&lsquo;-t&rsquo;</SAMP>
63 <DD>
64 <DT><SAMP>&lsquo;--struct-type&rsquo;</SAMP>
65 <DD>
66 Allows you to include a <CODE>struct</CODE> type declaration for generated
67 code. Any text before a pair of consecutive <SAMP>&lsquo;%%&rsquo;</SAMP> is considered
68 part of the type declaration. Keywords and additional fields may follow
69 this, one group of fields per line. A set of examples for generating
70 perfect hash tables and functions for Ada, C, C++, Pascal, Modula 2,
71 Modula 3 and JavaScript reserved words are distributed with this release.
72
73 <DT><SAMP>&lsquo;--ignore-case&rsquo;</SAMP>
74 <DD>
75 Consider upper and lower case ASCII characters as equivalent. The string
76 comparison will use a case insignificant character comparison. Note that
77 locale dependent case mappings are ignored. This option is therefore not
78 suitable if a properly internationalized or locale aware case mapping
79 should be used. (For example, in a Turkish locale, the upper case equivalent
80 of the lowercase ASCII letter <SAMP>&lsquo;i&rsquo;</SAMP> is the non-ASCII character
81 <SAMP>&lsquo;capital i with dot above&rsquo;</SAMP>.) For this case, it is better to apply
82 an uppercase or lowercase conversion on the string before passing it to
83 the <CODE>gperf</CODE> generated function.
84 </DL>
85
86
87
88 <H2><A NAME="SEC21" HREF="gperf_toc.html#TOC21">5.3 Options to specify the Language for the Output Code</A></H2>
89
90 <P>
91 These options are also available as declarations in the input file
92 (see section <A HREF="gperf_5.html#SEC9">4.1.1.2 Gperf Declarations</A>).
93
94 </P>
95 <DL COMPACT>
96
97 <DT><SAMP>&lsquo;-L <VAR>generated-language-name</VAR>&rsquo;</SAMP>
98 <DD>
99 <DT><SAMP>&lsquo;--language=<VAR>generated-language-name</VAR>&rsquo;</SAMP>
100 <DD>
101 Instructs <CODE>gperf</CODE> to generate code in the language specified by the
102 option's argument. Languages handled are currently:
103
104 <DL COMPACT>
105
106 <DT><SAMP>&lsquo;KR-C&rsquo;</SAMP>
107 <DD>
108 Old-style K&#38;R C. This language is understood by old-style C compilers and
109 ANSI C compilers, but ANSI C compilers may flag warnings (or even errors)
110 because of lacking <SAMP>&lsquo;const&rsquo;</SAMP>.
111
112 <DT><SAMP>&lsquo;C&rsquo;</SAMP>
113 <DD>
114 Common C. This language is understood by ANSI C compilers, and also by
115 old-style C compilers, provided that you <CODE>#define const</CODE> to empty
116 for compilers which don't know about this keyword.
117
118 <DT><SAMP>&lsquo;ANSI-C&rsquo;</SAMP>
119 <DD>
120 ANSI C. This language is understood by ANSI C compilers and C++ compilers.
121
122 <DT><SAMP>&lsquo;C++&rsquo;</SAMP>
123 <DD>
124 C++. This language is understood by C++ compilers.
125 </DL>
126
127 The default is ANSI-C.
128
129 <DT><SAMP>&lsquo;-a&rsquo;</SAMP>
130 <DD>
131 This option is supported for compatibility with previous releases of
132 <CODE>gperf</CODE>. It does not do anything.
133
134 <DT><SAMP>&lsquo;-g&rsquo;</SAMP>
135 <DD>
136 This option is supported for compatibility with previous releases of
137 <CODE>gperf</CODE>. It does not do anything.
138 </DL>
139
140
141
142 <H2><A NAME="SEC22" HREF="gperf_toc.html#TOC22">5.4 Options for fine tuning Details in the Output Code</A></H2>
143
144 <P>
145 Most of these options are also available as declarations in the input file
146 (see section <A HREF="gperf_5.html#SEC9">4.1.1.2 Gperf Declarations</A>).
147
148 </P>
149 <DL COMPACT>
150
151 <DT><SAMP>&lsquo;-K <VAR>slot-name</VAR>&rsquo;</SAMP>
152 <DD>
153 <DT><SAMP>&lsquo;--slot-name=<VAR>slot-name</VAR>&rsquo;</SAMP>
154 <DD>
155 <A NAME="IDX42"></A>
156 This option is only useful when option <SAMP>&lsquo;-t&rsquo;</SAMP> (or, equivalently, the
157 <SAMP>&lsquo;%struct-type&rsquo;</SAMP> declaration) has been given.
158 By default, the program assumes the structure component identifier for
159 the keyword is <SAMP>&lsquo;name&rsquo;</SAMP>. This option allows an arbitrary choice of
160 identifier for this component, although it still must occur as the first
161 field in your supplied <CODE>struct</CODE>.
162
163 <DT><SAMP>&lsquo;-F <VAR>initializers</VAR>&rsquo;</SAMP>
164 <DD>
165 <DT><SAMP>&lsquo;--initializer-suffix=<VAR>initializers</VAR>&rsquo;</SAMP>
166 <DD>
167 <A NAME="IDX43"></A>
168 This option is only useful when option <SAMP>&lsquo;-t&rsquo;</SAMP> (or, equivalently, the
169 <SAMP>&lsquo;%struct-type&rsquo;</SAMP> declaration) has been given.
170 It permits to specify initializers for the structure members following
171 <VAR>slot-name</VAR> in empty hash table entries. The list of initializers
172 should start with a comma. By default, the emitted code will
173 zero-initialize structure members following <VAR>slot-name</VAR>.
174
175 <DT><SAMP>&lsquo;-H <VAR>hash-function-name</VAR>&rsquo;</SAMP>
176 <DD>
177 <DT><SAMP>&lsquo;--hash-function-name=<VAR>hash-function-name</VAR>&rsquo;</SAMP>
178 <DD>
179 Allows you to specify the name for the generated hash function. Default
180 name is <SAMP>&lsquo;hash&rsquo;</SAMP>. This option permits the use of two hash tables in
181 the same file.
182
183 <DT><SAMP>&lsquo;-N <VAR>lookup-function-name</VAR>&rsquo;</SAMP>
184 <DD>
185 <DT><SAMP>&lsquo;--lookup-function-name=<VAR>lookup-function-name</VAR>&rsquo;</SAMP>
186 <DD>
187 Allows you to specify the name for the generated lookup function.
188 Default name is <SAMP>&lsquo;in_word_set&rsquo;</SAMP>. This option permits multiple
189 generated hash functions to be used in the same application.
190
191 <DT><SAMP>&lsquo;-Z <VAR>class-name</VAR>&rsquo;</SAMP>
192 <DD>
193 <DT><SAMP>&lsquo;--class-name=<VAR>class-name</VAR>&rsquo;</SAMP>
194 <DD>
195 <A NAME="IDX44"></A>
196 This option is only useful when option <SAMP>&lsquo;-L C++&rsquo;</SAMP> (or, equivalently,
197 the <SAMP>&lsquo;%language=C++&rsquo;</SAMP> declaration) has been given. It
198 allows you to specify the name of generated C++ class. Default name is
199 <CODE>Perfect_Hash</CODE>.
200
201 <DT><SAMP>&lsquo;-7&rsquo;</SAMP>
202 <DD>
203 <DT><SAMP>&lsquo;--seven-bit&rsquo;</SAMP>
204 <DD>
205 This option specifies that all strings that will be passed as arguments
206 to the generated hash function and the generated lookup function will
207 solely consist of 7-bit ASCII characters (bytes in the range 0..127).
208 (Note that the ANSI C functions <CODE>isalnum</CODE> and <CODE>isgraph</CODE> do
209 <EM>not</EM> guarantee that a byte is in this range. Only an explicit
210 test like <SAMP>&lsquo;c &#62;= 'A' &#38;&#38; c &#60;= 'Z'&rsquo;</SAMP> guarantees this.) This was the
211 default in versions of <CODE>gperf</CODE> earlier than 2.7; now the default is
212 to support 8-bit and multibyte characters.
213
214 <DT><SAMP>&lsquo;-l&rsquo;</SAMP>
215 <DD>
216 <DT><SAMP>&lsquo;--compare-lengths&rsquo;</SAMP>
217 <DD>
218 Compare keyword lengths before trying a string comparison. This option
219 is mandatory for binary comparisons (see section <A HREF="gperf_5.html#SEC15">4.3 Use of NUL bytes</A>). It also might
220 cut down on the number of string comparisons made during the lookup, since
221 keywords with different lengths are never compared via <CODE>strcmp</CODE>.
222 However, using <SAMP>&lsquo;-l&rsquo;</SAMP> might greatly increase the size of the
223 generated C code if the lookup table range is large (which implies that
224 the switch option <SAMP>&lsquo;-S&rsquo;</SAMP> or <SAMP>&lsquo;%switch&rsquo;</SAMP> is not enabled), since the length
225 table contains as many elements as there are entries in the lookup table.
226
227 <DT><SAMP>&lsquo;-c&rsquo;</SAMP>
228 <DD>
229 <DT><SAMP>&lsquo;--compare-strncmp&rsquo;</SAMP>
230 <DD>
231 Generates C code that uses the <CODE>strncmp</CODE> function to perform
232 string comparisons. The default action is to use <CODE>strcmp</CODE>.
233
234 <DT><SAMP>&lsquo;-C&rsquo;</SAMP>
235 <DD>
236 <DT><SAMP>&lsquo;--readonly-tables&rsquo;</SAMP>
237 <DD>
238 Makes the contents of all generated lookup tables constant, i.e.,
239 “readonly”. Many compilers can generate more efficient code for this
240 by putting the tables in readonly memory.
241
242 <DT><SAMP>&lsquo;-E&rsquo;</SAMP>
243 <DD>
244 <DT><SAMP>&lsquo;--enum&rsquo;</SAMP>
245 <DD>
246 <A NAME="IDX45"></A>
247 Define constant values using an enum local to the lookup function rather
248 than with #defines. This also means that different lookup functions can
249 reside in the same file. Thanks to James Clark <CODE>&#60;[email protected]&#62;</CODE>.
250
251 <DT><SAMP>&lsquo;-I&rsquo;</SAMP>
252 <DD>
253 <DT><SAMP>&lsquo;--includes&rsquo;</SAMP>
254 <DD>
255 Include the necessary system include file, <CODE>&#60;string.h&#62;</CODE>, at the
256 beginning of the code. By default, this is not done; the user must
257 include this header file himself to allow compilation of the code.
258
259 <DT><SAMP>&lsquo;-G&rsquo;</SAMP>
260 <DD>
261 <DT><SAMP>&lsquo;--global-table&rsquo;</SAMP>
262 <DD>
263 Generate the static table of keywords as a static global variable,
264 rather than hiding it inside of the lookup function (which is the
265 default behavior).
266
267 <DT><SAMP>&lsquo;-P&rsquo;</SAMP>
268 <DD>
269 <DT><SAMP>&lsquo;--pic&rsquo;</SAMP>
270 <DD>
271 Optimize the generated table for inclusion in shared libraries. This
272 reduces the startup time of programs using a shared library containing
273 the generated code. If the option <SAMP>&lsquo;-t&rsquo;</SAMP> (or, equivalently, the
274 <SAMP>&lsquo;%struct-type&rsquo;</SAMP> declaration) is also given, the first field of the
275 user-defined struct must be of type <SAMP>&lsquo;int&rsquo;</SAMP>, not <SAMP>&lsquo;char *&rsquo;</SAMP>, because
276 it will contain offsets into the string pool instead of actual strings.
277 To convert such an offset to a string, you can use the expression
278 <SAMP>&lsquo;stringpool + <VAR>o</VAR>&rsquo;</SAMP>, where <VAR>o</VAR> is the offset. The string pool
279 name can be changed through the option <SAMP>&lsquo;--string-pool-name&rsquo;</SAMP>.
280
281 <DT><SAMP>&lsquo;-Q <VAR>string-pool-name</VAR>&rsquo;</SAMP>
282 <DD>
283 <DT><SAMP>&lsquo;--string-pool-name=<VAR>string-pool-name</VAR>&rsquo;</SAMP>
284 <DD>
285 Allows you to specify the name of the generated string pool created by
286 option <SAMP>&lsquo;-P&rsquo;</SAMP>. The default name is <SAMP>&lsquo;stringpool&rsquo;</SAMP>. This option
287 permits the use of two hash tables in the same file, with <SAMP>&lsquo;-P&rsquo;</SAMP> and
288 even when the option <SAMP>&lsquo;-G&rsquo;</SAMP> (or, equivalently, the <SAMP>&lsquo;%global-table&rsquo;</SAMP>
289 declaration) is given.
290
291 <DT><SAMP>&lsquo;--null-strings&rsquo;</SAMP>
292 <DD>
293 Use NULL strings instead of empty strings for empty keyword table entries.
294 This reduces the startup time of programs using a shared library containing
295 the generated code (but not as much as option <SAMP>&lsquo;-P&rsquo;</SAMP>), at the expense
296 of one more test-and-branch instruction at run time.
297
298 <DT><SAMP>&lsquo;--constants-prefix=<VAR>prefix</VAR>&rsquo;</SAMP>
299 <DD>
300 <A NAME="IDX46"></A>
301 Allows you to specify a prefix for the constants <CODE>TOTAL_KEYWORDS</CODE>,
302 <CODE>MIN_WORD_LENGTH</CODE>, <CODE>MAX_WORD_LENGTH</CODE>, and so on. This option
303 permits the use of two hash tables in the same file, even when the option
304 <SAMP>&lsquo;-E&rsquo;</SAMP> (or, equivalently, the <SAMP>&lsquo;%enum&rsquo;</SAMP> declaration) is not given or
305 the option <SAMP>&lsquo;-G&rsquo;</SAMP> (or, equivalently, the <SAMP>&lsquo;%global-table&rsquo;</SAMP> declaration)
306 is given.
307
308 <DT><SAMP>&lsquo;-W <VAR>hash-table-array-name</VAR>&rsquo;</SAMP>
309 <DD>
310 <DT><SAMP>&lsquo;--word-array-name=<VAR>hash-table-array-name</VAR>&rsquo;</SAMP>
311 <DD>
312 <A NAME="IDX47"></A>
313 Allows you to specify the name for the generated array containing the
314 hash table. Default name is <SAMP>&lsquo;wordlist&rsquo;</SAMP>. This option permits the
315 use of two hash tables in the same file, even when the option <SAMP>&lsquo;-G&rsquo;</SAMP>
316 (or, equivalently, the <SAMP>&lsquo;%global-table&rsquo;</SAMP> declaration) is given.
317
318 <DT><SAMP>&lsquo;--length-table-name=<VAR>length-table-array-name</VAR>&rsquo;</SAMP>
319 <DD>
320 <A NAME="IDX48"></A>
321 Allows you to specify the name for the generated array containing the
322 length table. Default name is <SAMP>&lsquo;lengthtable&rsquo;</SAMP>. This option permits the
323 use of two length tables in the same file, even when the option <SAMP>&lsquo;-G&rsquo;</SAMP>
324 (or, equivalently, the <SAMP>&lsquo;%global-table&rsquo;</SAMP> declaration) is given.
325
326 <DT><SAMP>&lsquo;-S <VAR>total-switch-statements</VAR>&rsquo;</SAMP>
327 <DD>
328 <DT><SAMP>&lsquo;--switch=<VAR>total-switch-statements</VAR>&rsquo;</SAMP>
329 <DD>
330 <A NAME="IDX49"></A>
331 Causes the generated C code to use a <CODE>switch</CODE> statement scheme,
332 rather than an array lookup table. This can lead to a reduction in both
333 time and space requirements for some input files. The argument to this
334 option determines how many <CODE>switch</CODE> statements are generated. A
335 value of 1 generates 1 <CODE>switch</CODE> containing all the elements, a
336 value of 2 generates 2 tables with 1/2 the elements in each
337 <CODE>switch</CODE>, etc. This is useful since many C compilers cannot
338 correctly generate code for large <CODE>switch</CODE> statements. This option
339 was inspired in part by Keith Bostic's original C program.
340
341 <DT><SAMP>&lsquo;-T&rsquo;</SAMP>
342 <DD>
343 <DT><SAMP>&lsquo;--omit-struct-type&rsquo;</SAMP>
344 <DD>
345 Prevents the transfer of the type declaration to the output file. Use
346 this option if the type is already defined elsewhere.
347
348 <DT><SAMP>&lsquo;-p&rsquo;</SAMP>
349 <DD>
350 This option is supported for compatibility with previous releases of
351 <CODE>gperf</CODE>. It does not do anything.
352 </DL>
353
354
355
356 <H2><A NAME="SEC23" HREF="gperf_toc.html#TOC23">5.5 Options for changing the Algorithms employed by <CODE>gperf</CODE></A></H2>
357
358 <DL COMPACT>
359
360 <DT><SAMP>&lsquo;-k <VAR>selected-byte-positions</VAR>&rsquo;</SAMP>
361 <DD>
362 <DT><SAMP>&lsquo;--key-positions=<VAR>selected-byte-positions</VAR>&rsquo;</SAMP>
363 <DD>
364 Allows selection of the byte positions used in the keywords'
365 hash function. The allowable choices range between 1-255, inclusive.
366 The positions are separated by commas, e.g., <SAMP>&lsquo;-k 9,4,13,14&rsquo;</SAMP>;
367 ranges may be used, e.g., <SAMP>&lsquo;-k 2-7&rsquo;</SAMP>; and positions may occur
368 in any order. Furthermore, the wildcard '*' causes the generated
369 hash function to consider <STRONG>all</STRONG> byte positions in each keyword,
370 whereas '$' instructs the hash function to use the “final byte”
371 of a keyword (this is the only way to use a byte position greater than
372 255, incidentally).
373
374 For instance, the option <SAMP>&lsquo;-k 1,2,4,6-10,'$'&rsquo;</SAMP> generates a hash
375 function that considers positions 1,2,4,6,7,8,9,10, plus the last
376 byte in each keyword (which may be at a different position for each
377 keyword, obviously). Keywords
378 with length less than the indicated byte positions work properly, since
379 selected byte positions exceeding the keyword length are simply not
380 referenced in the hash function.
381
382 This option is not normally needed since version 2.8 of <CODE>gperf</CODE>;
383 the default byte positions are computed depending on the keyword set,
384 through a search that minimizes the number of byte positions.
385
386 <DT><SAMP>&lsquo;-D&rsquo;</SAMP>
387 <DD>
388 <DT><SAMP>&lsquo;--duplicates&rsquo;</SAMP>
389 <DD>
390 <A NAME="IDX50"></A>
391 Handle keywords whose selected byte sets hash to duplicate values.
392 Duplicate hash values can occur if a set of keywords has the same names, but
393 possesses different attributes, or if the selected byte positions are not well
394 chosen. With the -D option <CODE>gperf</CODE> treats all these keywords as
395 part of an equivalence class and generates a perfect hash function with
396 multiple comparisons for duplicate keywords. It is up to you to completely
397 disambiguate the keywords by modifying the generated C code. However,
398 <CODE>gperf</CODE> helps you out by organizing the output.
399
400 Using this option usually means that the generated hash function is no
401 longer perfect. On the other hand, it permits <CODE>gperf</CODE> to work on
402 keyword sets that it otherwise could not handle.
403
404 <DT><SAMP>&lsquo;-m <VAR>iterations</VAR>&rsquo;</SAMP>
405 <DD>
406 <DT><SAMP>&lsquo;--multiple-iterations=<VAR>iterations</VAR>&rsquo;</SAMP>
407 <DD>
408 Perform multiple choices of the <SAMP>&lsquo;-i&rsquo;</SAMP> and <SAMP>&lsquo;-j&rsquo;</SAMP> values, and
409 choose the best results. This increases the running time by a factor of
410 <VAR>iterations</VAR> but does a good job minimizing the generated table size.
411
412 <DT><SAMP>&lsquo;-i <VAR>initial-value</VAR>&rsquo;</SAMP>
413 <DD>
414 <DT><SAMP>&lsquo;--initial-asso=<VAR>initial-value</VAR>&rsquo;</SAMP>
415 <DD>
416 Provides an initial <VAR>value</VAR> for the associate values array. Default
417 is 0. Increasing the initial value helps inflate the final table size,
418 possibly leading to more time efficient keyword lookups. Note that this
419 option is not particularly useful when <SAMP>&lsquo;-S&rsquo;</SAMP> (or, equivalently,
420 <SAMP>&lsquo;%switch&rsquo;</SAMP>) is used. Also,
421 <SAMP>&lsquo;-i&rsquo;</SAMP> is overridden when the <SAMP>&lsquo;-r&rsquo;</SAMP> option is used.
422
423 <DT><SAMP>&lsquo;-j <VAR>jump-value</VAR>&rsquo;</SAMP>
424 <DD>
425 <DT><SAMP>&lsquo;--jump=<VAR>jump-value</VAR>&rsquo;</SAMP>
426 <DD>
427 <A NAME="IDX51"></A>
428 Affects the “jump value”, i.e., how far to advance the associated
429 byte value upon collisions. <VAR>Jump-value</VAR> is rounded up to an
430 odd number, the default is 5. If the <VAR>jump-value</VAR> is 0 <CODE>gperf</CODE>
431 jumps by random amounts.
432
433 <DT><SAMP>&lsquo;-n&rsquo;</SAMP>
434 <DD>
435 <DT><SAMP>&lsquo;--no-strlen&rsquo;</SAMP>
436 <DD>
437 Instructs the generator not to include the length of a keyword when
438 computing its hash value. This may save a few assembly instructions in
439 the generated lookup table.
440
441 <DT><SAMP>&lsquo;-r&rsquo;</SAMP>
442 <DD>
443 <DT><SAMP>&lsquo;--random&rsquo;</SAMP>
444 <DD>
445 Utilizes randomness to initialize the associated values table. This
446 frequently generates solutions faster than using deterministic
447 initialization (which starts all associated values at 0). Furthermore,
448 using the randomization option generally increases the size of the
449 table.
450
451 <DT><SAMP>&lsquo;-s <VAR>size-multiple</VAR>&rsquo;</SAMP>
452 <DD>
453 <DT><SAMP>&lsquo;--size-multiple=<VAR>size-multiple</VAR>&rsquo;</SAMP>
454 <DD>
455 Affects the size of the generated hash table. The numeric argument for
456 this option indicates “how many times larger or smaller” the maximum
457 associated value range should be, in relationship to the number of keywords.
458 It can be written as an integer, a floating-point number or a fraction.
459 For example, a value of 3 means “allow the maximum associated value to be
460 about 3 times larger than the number of input keywords”.
461 Conversely, a value of 1/3 means “allow the maximum associated value to
462 be about 3 times smaller than the number of input keywords”. Values
463 smaller than 1 are useful for limiting the overall size of the generated hash
464 table, though the option <SAMP>&lsquo;-m&rsquo;</SAMP> is better at this purpose.
465
466 If `generate switch' option <SAMP>&lsquo;-S&rsquo;</SAMP> (or, equivalently, <SAMP>&lsquo;%switch&rsquo;</SAMP>) is
467 <EM>not</EM> enabled, the maximum
468 associated value influences the static array table size, and a larger
469 table should decrease the time required for an unsuccessful search, at
470 the expense of extra table space.
471
472 The default value is 1, thus the default maximum associated value is about
473 the same size as the number of keywords. (For efficiency, the maximum
474 associated value is always rounded up to a power of 2.) The actual
475 table size may vary somewhat, since this technique is essentially a
476 heuristic.
477 </DL>
478
479
480
481 <H2><A NAME="SEC24" HREF="gperf_toc.html#TOC24">5.6 Informative Output</A></H2>
482
483 <DL COMPACT>
484
485 <DT><SAMP>&lsquo;-h&rsquo;</SAMP>
486 <DD>
487 <DT><SAMP>&lsquo;--help&rsquo;</SAMP>
488 <DD>
489 Prints a short summary on the meaning of each program option. Aborts
490 further program execution.
491
492 <DT><SAMP>&lsquo;-v&rsquo;</SAMP>
493 <DD>
494 <DT><SAMP>&lsquo;--version&rsquo;</SAMP>
495 <DD>
496 Prints out the current version number.
497
498 <DT><SAMP>&lsquo;-d&rsquo;</SAMP>
499 <DD>
500 <DT><SAMP>&lsquo;--debug&rsquo;</SAMP>
501 <DD>
502 Enables the debugging option. This produces verbose diagnostics to
503 “standard error” when <CODE>gperf</CODE> is executing. It is useful both for
504 maintaining the program and for determining whether a given set of
505 options is actually speeding up the search for a solution. Some useful
506 information is dumped at the end of the program when the <SAMP>&lsquo;-d&rsquo;</SAMP>
507 option is enabled.
508 </DL>
509
510 <P><HR><P>
511 Go to the <A HREF="gperf_1.html">first</A>, <A HREF="gperf_5.html">previous</A>, <A HREF="gperf_7.html">next</A>, <A HREF="gperf_10.html">last</A> section, <A HREF="gperf_toc.html">table of contents</A>.
512 </BODY>
513 </HTML>