| 1 |
GNU 'gperf' generates perfect hash functions. |
| 2 |
|
| 3 |
Usage: ../src/gperf [OPTION]... [INPUT-FILE] |
| 4 |
|
| 5 |
If a long option shows an argument as mandatory, then it is mandatory |
| 6 |
for the equivalent short option also. |
| 7 |
|
| 8 |
Output file location: |
| 9 |
--output-file=FILE Write output to specified file. |
| 10 |
The results are written to standard output if no output file is specified |
| 11 |
or if it is -. |
| 12 |
|
| 13 |
Input file interpretation: |
| 14 |
-e, --delimiters=DELIMITER-LIST |
| 15 |
Allow user to provide a string containing delimiters |
| 16 |
used to separate keywords from their attributes. |
| 17 |
Default is ",". |
| 18 |
-t, --struct-type Allows the user to include a structured type |
| 19 |
declaration for generated code. Any text before %% |
| 20 |
is considered part of the type declaration. Key |
| 21 |
words and additional fields may follow this, one |
| 22 |
group of fields per line. |
| 23 |
--ignore-case Consider upper and lower case ASCII characters as |
| 24 |
equivalent. Note that locale dependent case mappings |
| 25 |
are ignored. |
| 26 |
|
| 27 |
Language for the output code: |
| 28 |
-L, --language=LANGUAGE-NAME |
| 29 |
Generates code in the specified language. Languages |
| 30 |
handled are currently C++, ANSI-C, C, and KR-C. The |
| 31 |
default is ANSI-C. |
| 32 |
|
| 33 |
Details in the output code: |
| 34 |
-K, --slot-name=NAME Select name of the keyword component in the keyword |
| 35 |
structure. |
| 36 |
-F, --initializer-suffix=INITIALIZERS |
| 37 |
Initializers for additional components in the keyword |
| 38 |
structure. |
| 39 |
-H, --hash-function-name=NAME |
| 40 |
Specify name of generated hash function. Default is |
| 41 |
'hash'. |
| 42 |
-N, --lookup-function-name=NAME |
| 43 |
Specify name of generated lookup function. Default |
| 44 |
name is 'in_word_set'. |
| 45 |
-Z, --class-name=NAME Specify name of generated C++ class. Default name is |
| 46 |
'Perfect_Hash'. |
| 47 |
-7, --seven-bit Assume 7-bit characters. |
| 48 |
-l, --compare-lengths Compare key lengths before trying a string |
| 49 |
comparison. This is necessary if the keywords |
| 50 |
contain NUL bytes. It also helps cut down on the |
| 51 |
number of string comparisons made during the lookup. |
| 52 |
-c, --compare-strncmp Generate comparison code using strncmp rather than |
| 53 |
strcmp. |
| 54 |
-C, --readonly-tables Make the contents of generated lookup tables |
| 55 |
constant, i.e., readonly. |
| 56 |
-E, --enum Define constant values using an enum local to the |
| 57 |
lookup function rather than with defines. |
| 58 |
-I, --includes Include the necessary system include file <string.h> |
| 59 |
at the beginning of the code. |
| 60 |
-G, --global-table Generate the static table of keywords as a static |
| 61 |
global variable, rather than hiding it inside of the |
| 62 |
lookup function (which is the default behavior). |
| 63 |
-P, --pic Optimize the generated table for inclusion in shared |
| 64 |
libraries. This reduces the startup time of programs |
| 65 |
using a shared library containing the generated code. |
| 66 |
-Q, --string-pool-name=NAME |
| 67 |
Specify name of string pool generated by option --pic. |
| 68 |
Default name is 'stringpool'. |
| 69 |
--null-strings Use NULL strings instead of empty strings for empty |
| 70 |
keyword table entries. |
| 71 |
--constants-prefix=PREFIX |
| 72 |
Specify prefix for the constants like TOTAL_KEYWORDS. |
| 73 |
-W, --word-array-name=NAME |
| 74 |
Specify name of word list array. Default name is |
| 75 |
'wordlist'. |
| 76 |
--length-table-name=NAME |
| 77 |
Specify name of length table array. Default name is |
| 78 |
'lengthtable'. |
| 79 |
-S, --switch=COUNT Causes the generated C code to use a switch |
| 80 |
statement scheme, rather than an array lookup table. |
| 81 |
This can lead to a reduction in both time and space |
| 82 |
requirements for some keyfiles. The COUNT argument |
| 83 |
determines how many switch statements are generated. |
| 84 |
A value of 1 generates 1 switch containing all the |
| 85 |
elements, a value of 2 generates 2 tables with 1/2 |
| 86 |
the elements in each table, etc. If COUNT is very |
| 87 |
large, say 1000000, the generated C code does a |
| 88 |
binary search. |
| 89 |
-T, --omit-struct-type |
| 90 |
Prevents the transfer of the type declaration to the |
| 91 |
output file. Use this option if the type is already |
| 92 |
defined elsewhere. |
| 93 |
|
| 94 |
Algorithm employed by gperf: |
| 95 |
-k, --key-positions=KEYS |
| 96 |
Select the key positions used in the hash function. |
| 97 |
The allowable choices range between 1-255, inclusive. |
| 98 |
The positions are separated by commas, ranges may be |
| 99 |
used, and key positions may occur in any order. |
| 100 |
Also, the meta-character '*' causes the generated |
| 101 |
hash function to consider ALL key positions, and $ |
| 102 |
indicates the "final character" of a key, e.g., |
| 103 |
$,1,2,4,6-10. |
| 104 |
-D, --duplicates Handle keywords that hash to duplicate values. This |
| 105 |
is useful for certain highly redundant keyword sets. |
| 106 |
-m, --multiple-iterations=ITERATIONS |
| 107 |
Perform multiple choices of the -i and -j values, |
| 108 |
and choose the best results. This increases the |
| 109 |
running time by a factor of ITERATIONS but does a |
| 110 |
good job minimizing the generated table size. |
| 111 |
-i, --initial-asso=N Provide an initial value for the associate values |
| 112 |
array. Default is 0. Setting this value larger helps |
| 113 |
inflate the size of the final table. |
| 114 |
-j, --jump=JUMP-VALUE Affects the "jump value", i.e., how far to advance |
| 115 |
the associated character value upon collisions. Must |
| 116 |
be an odd number, default is 5. |
| 117 |
-n, --no-strlen Do not include the length of the keyword when |
| 118 |
computing the hash function. |
| 119 |
-r, --random Utilizes randomness to initialize the associated |
| 120 |
values table. |
| 121 |
-s, --size-multiple=N Affects the size of the generated hash table. The |
| 122 |
numeric argument N indicates "how many times larger |
| 123 |
or smaller" the associated value range should be, |
| 124 |
in relationship to the number of keys, e.g. a value |
| 125 |
of 3 means "allow the maximum associated value to |
| 126 |
be about 3 times larger than the number of input |
| 127 |
keys". Conversely, a value of 1/3 means "make the |
| 128 |
maximum associated value about 3 times smaller than |
| 129 |
the number of input keys". A larger table should |
| 130 |
decrease the time required for an unsuccessful |
| 131 |
search, at the expense of extra table space. Default |
| 132 |
value is 1. |
| 133 |
|
| 134 |
Informative output: |
| 135 |
-h, --help Print this message. |
| 136 |
-v, --version Print the gperf version number. |
| 137 |
-d, --debug Enables the debugging option (produces verbose |
| 138 |
output to the standard error). |
| 139 |
|
| 140 |
Report bugs to <[email protected]>. |