OLD | NEW |
(Empty) | |
| 1 GPERF(1) FSF GPERF(1) |
| 2 |
| 3 |
| 4 |
| 5 |
| 6 |
| 7 NAME |
| 8 gperf - generate a perfect hash function from a key set |
| 9 |
| 10 SYNOPSIS |
| 11 gperf [OPTION]... [INPUT-FILE] |
| 12 |
| 13 DESCRIPTION |
| 14 GNU 'gperf' generates perfect hash functions. |
| 15 |
| 16 If a long option shows an argument as mandatory, then it |
| 17 is mandatory for the equivalent short option also. |
| 18 |
| 19 Output file location: |
| 20 --output-file=FILE Write output to specified file. |
| 21 |
| 22 The results are written to standard output if no output |
| 23 file is specified or if it is -. |
| 24 |
| 25 Input file interpretation: |
| 26 -e, --delimiters=DELIMITER-LIST |
| 27 Allow user to provide a string containing delim- |
| 28 iters used to separate keywords from their |
| 29 attributes. Default is ",". |
| 30 |
| 31 -t, --struct-type |
| 32 Allows the user to include a structured type dec- |
| 33 laration for generated code. Any text before %% |
| 34 is considered part of the type declaration. Key |
| 35 words and additional fields may follow this, one |
| 36 group of fields per line. |
| 37 |
| 38 --ignore-case |
| 39 Consider upper and lower case ASCII characters as |
| 40 equivalent. Note that locale dependent case map- |
| 41 pings are ignored. |
| 42 |
| 43 Language for the output code: |
| 44 -L, --language=LANGUAGE-NAME |
| 45 Generates code in the specified language. Lan- |
| 46 guages handled are currently C++, ANSI-C, C, and |
| 47 KR-C. The default is C. |
| 48 |
| 49 Details in the output code: |
| 50 -K, --slot-name=NAME |
| 51 Select name of the keyword component in the key- |
| 52 word structure. |
| 53 |
| 54 -F, --initializer-suffix=INITIALIZERS |
| 55 Initializers for additional components in the |
| 56 keyword structure. |
| 57 |
| 58 -H, --hash-function-name=NAME |
| 59 Specify name of generated hash function. Default |
| 60 is 'hash'. |
| 61 |
| 62 -N, --lookup-function-name=NAME |
| 63 Specify name of generated lookup function. |
| 64 Default name is 'in_word_set'. |
| 65 |
| 66 -Z, --class-name=NAME |
| 67 Specify name of generated C++ class. Default name |
| 68 is 'Perfect_Hash'. |
| 69 |
| 70 -7, --seven-bit |
| 71 Assume 7-bit characters. |
| 72 |
| 73 -l, --compare-lengths |
| 74 Compare key lengths before trying a string com- |
| 75 parison. This is necessary if the keywords con- |
| 76 tain NUL bytes. It also helps cut down on the |
| 77 number of string comparisons made during the |
| 78 lookup. |
| 79 |
| 80 -c, --compare-strncmp |
| 81 Generate comparison code using strncmp rather |
| 82 than strcmp. |
| 83 |
| 84 -C, --readonly-tables |
| 85 Make the contents of generated lookup tables con- |
| 86 stant, i.e., readonly. |
| 87 |
| 88 -E, --enum |
| 89 Define constant values using an enum local to the |
| 90 lookup function rather than with defines. |
| 91 |
| 92 -I, --includes |
| 93 Include the necessary system include file |
| 94 <string.h> at the beginning of the code. |
| 95 |
| 96 -G, --global-table |
| 97 Generate the static table of keywords as a static |
| 98 global variable, rather than hiding it inside of |
| 99 the lookup function (which is the default behav- |
| 100 ior). |
| 101 |
| 102 -P, --pic |
| 103 Optimize the generated table for inclusion in |
| 104 shared libraries. This reduces the startup time |
| 105 of programs using a shared library containing the |
| 106 generated code. |
| 107 |
| 108 -Q, --string-pool-name=NAME |
| 109 Specify name of string pool generated by option |
| 110 --pic. Default name is 'stringpool'. |
| 111 |
| 112 --null-strings |
| 113 Use NULL strings instead of empty strings for |
| 114 empty keyword table entries. |
| 115 |
| 116 -W, --word-array-name=NAME |
| 117 Specify name of word list array. Default name is |
| 118 'wordlist'. |
| 119 |
| 120 -S, --switch=COUNT |
| 121 Causes the generated C code to use a switch |
| 122 statement scheme, rather than an array lookup ta- |
| 123 ble. This can lead to a reduction in both time |
| 124 and space requirements for some keyfiles. The |
| 125 COUNT argument determines how many switch state- |
| 126 ments are generated. A value of 1 generates 1 |
| 127 switch containing all the elements, a value of 2 |
| 128 generates 2 tables with 1/2 the elements in each |
| 129 table, etc. If COUNT is very large, say 1000000, |
| 130 the generated C code does a binary search. |
| 131 |
| 132 -T, --omit-struct-type |
| 133 Prevents the transfer of the type declaration to |
| 134 the output file. Use this option if the type is |
| 135 already defined elsewhere. |
| 136 |
| 137 Algorithm employed by gperf: |
| 138 -k, --key-positions=KEYS |
| 139 Select the key positions used in the hash func- |
| 140 tion. The allowable choices range between 1-255, |
| 141 inclusive. The positions are separated by com- |
| 142 mas, ranges may be used, and key positions may |
| 143 occur in any order. Also, the meta-character '*' |
| 144 causes the generated hash function to consider |
| 145 ALL key positions, and $ indicates the "final |
| 146 character" of a key, e.g., $,1,2,4,6-10. |
| 147 |
| 148 -D, --duplicates |
| 149 Handle keywords that hash to duplicate values. |
| 150 This is useful for certain highly redundant key- |
| 151 word sets. |
| 152 |
| 153 -m, --multiple-iterations=ITERATIONS |
| 154 Perform multiple choices of the -i and -j values, |
| 155 and choose the best results. This increases the |
| 156 running time by a factor of ITERATIONS but does a |
| 157 good job minimizing the generated table size. |
| 158 |
| 159 -i, --initial-asso=N |
| 160 Provide an initial value for the associate values |
| 161 array. Default is 0. Setting this value larger |
| 162 helps inflate the size of the final table. |
| 163 |
| 164 -j, --jump=JUMP-VALUE |
| 165 Affects the "jump value", i.e., how far to |
| 166 advance the associated character value upon col- |
| 167 lisions. Must be an odd number, default is 5. |
| 168 |
| 169 -n, --no-strlen |
| 170 Do not include the length of the keyword when |
| 171 computing the hash function. |
| 172 |
| 173 -r, --random |
| 174 Utilizes randomness to initialize the associated |
| 175 values table. |
| 176 |
| 177 -s, --size-multiple=N |
| 178 Affects the size of the generated hash table. The |
| 179 numeric argument N indicates "how many times |
| 180 larger or smaller" the associated value range |
| 181 should be, in relationship to the number of keys, |
| 182 e.g. a value of 3 means "allow the maximum asso- |
| 183 ciated value to be about 3 times larger than the |
| 184 number of input keys". Conversely, a value of 1/3 |
| 185 means "make the maximum associated value about 3 |
| 186 times smaller than the number of input keys". A |
| 187 larger table should decrease the time required |
| 188 for an unsuccessful search, at the expense of |
| 189 extra table space. Default value is 1. |
| 190 |
| 191 Informative output: |
| 192 -h, --help |
| 193 Print this message. |
| 194 |
| 195 -v, --version |
| 196 Print the gperf version number. |
| 197 |
| 198 -d, --debug |
| 199 Enables the debugging option (produces verbose |
| 200 output to the standard error). |
| 201 |
| 202 AUTHOR |
| 203 Written by Douglas C. Schmidt and Bruno Haible. |
| 204 |
| 205 REPORTING BUGS |
| 206 Report bugs to <bug-gnu-gperf@gnu.org>. |
| 207 |
| 208 COPYRIGHT |
| 209 Copyright (C) 1989-1998, 2000-2003 Free Software Founda- |
| 210 tion, Inc. |
| 211 This is free software; see the source for copying condi- |
| 212 tions. There is NO warranty; not even for MERCHANTABIL- |
| 213 ITY or FITNESS FOR A PARTICULAR PURPOSE. |
| 214 |
| 215 SEE ALSO |
| 216 The full documentation for gperf is maintained as a Tex- |
| 217 info manual. If the info and gperf programs are prop- |
| 218 erly installed at your site, the command |
| 219 |
| 220 info gperf |
| 221 |
| 222 should give you access to the complete manual. |
| 223 |
| 224 |
| 225 |
| 226 GNU gperf 3.0.1 June 2003 GPERF(1) |
OLD | NEW |