1GPERF(1)                              FSF                             GPERF(1)
2
3
4

NAME

6       gperf - generate a perfect hash function from a key set
7

SYNOPSIS

9       gperf [OPTION]... [INPUT-FILE]
10

DESCRIPTION

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

AUTHOR

186       Written by Douglas C. Schmidt and Bruno Haible.
187

REPORTING BUGS

189       Report bugs to <bug-gperf@gnu.org>.
190
192       Copyright  ©  1989-2017 Free Software Foundation, Inc.  License GPLv3+:
193       GNU GPL version 3 or later <http://gnu.org/licenses/gpl.html>
194       This is free software: you are free  to  change  and  redistribute  it.
195       There is NO WARRANTY, to the extent permitted by law.
196

SEE ALSO

198       The full documentation for gperf is maintained as a Texinfo manual.  If
199       the info and gperf programs are properly installed at  your  site,  the
200       command
201
202              info gperf
203
204       should give you access to the complete manual.
205
206
207
208GNU gperf 3.1                    January 2017                         GPERF(1)
Impressum