|
Packit |
b27855 |
<HTML>
|
|
Packit |
b27855 |
<HEAD>
|
|
Packit |
b27855 |
|
|
Packit |
b27855 |
from gperf.texi on 2 January 2017 -->
|
|
Packit |
b27855 |
|
|
Packit |
b27855 |
<META HTTP-EQUIV="content-type" CONTENT="text/html; charset=UTF-8">
|
|
Packit |
b27855 |
<TITLE>Perfect Hash Function Generator - 5 Invoking gperf</TITLE>
|
|
Packit |
b27855 |
</HEAD>
|
|
Packit |
b27855 |
<BODY>
|
|
Packit |
b27855 |
Go to the first, previous, next, last section, table of contents.
|
|
Packit |
b27855 |
|
|
Packit |
b27855 |
|
|
Packit |
b27855 |
|
|
Packit |
b27855 |
|
|
Packit |
b27855 |
|
|
Packit |
b27855 |
|
|
Packit |
b27855 |
There are many options to gperf . They were added to make
|
|
Packit |
b27855 |
the program more convenient for use with real applications. “On-line”
|
|
Packit |
b27855 |
help is readily available via the <SAMP>‘--help’</SAMP> option. Here is the
|
|
Packit |
b27855 |
complete list of options.
|
|
Packit |
b27855 |
|
|
Packit |
b27855 |
|
|
Packit |
b27855 |
|
|
Packit |
b27855 |
|
|
Packit |
b27855 |
|
|
Packit |
b27855 |
|
|
Packit |
b27855 |
|
|
Packit |
b27855 |
|
|
Packit |
b27855 |
|
|
Packit |
b27855 |
<SAMP>‘--output-file=file’</SAMP>
|
|
Packit |
b27855 |
|
|
Packit |
b27855 |
Allows you to specify the name of the file to which the output is written to.
|
|
Packit |
b27855 |
|
|
Packit |
b27855 |
|
|
Packit |
b27855 |
|
|
Packit |
b27855 |
The results are written to standard output if no output file is specified
|
|
Packit |
b27855 |
or if it is <SAMP>‘-’</SAMP>.
|
|
Packit |
b27855 |
|
|
Packit |
b27855 |
|
|
Packit |
b27855 |
|
|
Packit |
b27855 |
|
|
Packit |
b27855 |
|
|
Packit |
b27855 |
|
|
Packit |
b27855 |
|
|
Packit |
b27855 |
These options are also available as declarations in the input file
|
|
Packit |
b27855 |
(see section 4.1.1.2 Gperf Declarations).
|
|
Packit |
b27855 |
|
|
Packit |
b27855 |
|
|
Packit |
b27855 |
|
|
Packit |
b27855 |
|
|
Packit |
b27855 |
<SAMP>‘-e keyword-delimiter-list’</SAMP>
|
|
Packit |
b27855 |
|
|
Packit |
b27855 |
<SAMP>‘--delimiters=keyword-delimiter-list’</SAMP>
|
|
Packit |
b27855 |
|
|
Packit |
b27855 |
|
|
Packit |
b27855 |
Allows you to provide a string containing delimiters used to
|
|
Packit |
b27855 |
separate keywords from their attributes. The default is ",". This
|
|
Packit |
b27855 |
option is essential if you want to use keywords that have embedded
|
|
Packit |
b27855 |
commas or newlines. One useful trick is to use -e'TAB', where TAB is
|
|
Packit |
b27855 |
the literal tab character.
|
|
Packit |
b27855 |
|
|
Packit |
b27855 |
<SAMP>‘-t’</SAMP>
|
|
Packit |
b27855 |
|
|
Packit |
b27855 |
<SAMP>‘--struct-type’</SAMP>
|
|
Packit |
b27855 |
|
|
Packit |
b27855 |
Allows you to include a struct type declaration for generated
|
|
Packit |
b27855 |
code. Any text before a pair of consecutive <SAMP>‘%%’</SAMP> is considered
|
|
Packit |
b27855 |
part of the type declaration. Keywords and additional fields may follow
|
|
Packit |
b27855 |
this, one group of fields per line. A set of examples for generating
|
|
Packit |
b27855 |
perfect hash tables and functions for Ada, C, C++, Pascal, Modula 2,
|
|
Packit |
b27855 |
Modula 3 and JavaScript reserved words are distributed with this release.
|
|
Packit |
b27855 |
|
|
Packit |
b27855 |
<SAMP>‘--ignore-case’</SAMP>
|
|
Packit |
b27855 |
|
|
Packit |
b27855 |
Consider upper and lower case ASCII characters as equivalent. The string
|
|
Packit |
b27855 |
comparison will use a case insignificant character comparison. Note that
|
|
Packit |
b27855 |
locale dependent case mappings are ignored. This option is therefore not
|
|
Packit |
b27855 |
suitable if a properly internationalized or locale aware case mapping
|
|
Packit |
b27855 |
should be used. (For example, in a Turkish locale, the upper case equivalent
|
|
Packit |
b27855 |
of the lowercase ASCII letter <SAMP>‘i’</SAMP> is the non-ASCII character
|
|
Packit |
b27855 |
<SAMP>‘capital i with dot above’</SAMP>.) For this case, it is better to apply
|
|
Packit |
b27855 |
an uppercase or lowercase conversion on the string before passing it to
|
|
Packit |
b27855 |
the gperf generated function.
|
|
Packit |
b27855 |
|
|
Packit |
b27855 |
|
|
Packit |
b27855 |
|
|
Packit |
b27855 |
|
|
Packit |
b27855 |
|
|
Packit |
b27855 |
|
|
Packit |
b27855 |
|
|
Packit |
b27855 |
These options are also available as declarations in the input file
|
|
Packit |
b27855 |
(see section 4.1.1.2 Gperf Declarations).
|
|
Packit |
b27855 |
|
|
Packit |
b27855 |
|
|
Packit |
b27855 |
|
|
Packit |
b27855 |
|
|
Packit |
b27855 |
<SAMP>‘-L generated-language-name’</SAMP>
|
|
Packit |
b27855 |
|
|
Packit |
b27855 |
<SAMP>‘--language=generated-language-name’</SAMP>
|
|
Packit |
b27855 |
|
|
Packit |
b27855 |
Instructs gperf to generate code in the language specified by the
|
|
Packit |
b27855 |
option's argument. Languages handled are currently:
|
|
Packit |
b27855 |
|
|
Packit |
b27855 |
|
|
Packit |
b27855 |
|
|
Packit |
b27855 |
<SAMP>‘KR-C’</SAMP>
|
|
Packit |
b27855 |
|
|
Packit |
b27855 |
Old-style K&R C. This language is understood by old-style C compilers and
|
|
Packit |
b27855 |
ANSI C compilers, but ANSI C compilers may flag warnings (or even errors)
|
|
Packit |
b27855 |
because of lacking <SAMP>‘const’</SAMP>.
|
|
Packit |
b27855 |
|
|
Packit |
b27855 |
<SAMP>‘C’</SAMP>
|
|
Packit |
b27855 |
|
|
Packit |
b27855 |
Common C. This language is understood by ANSI C compilers, and also by
|
|
Packit |
b27855 |
old-style C compilers, provided that you #define const to empty
|
|
Packit |
b27855 |
for compilers which don't know about this keyword.
|
|
Packit |
b27855 |
|
|
Packit |
b27855 |
<SAMP>‘ANSI-C’</SAMP>
|
|
Packit |
b27855 |
|
|
Packit |
b27855 |
ANSI C. This language is understood by ANSI C compilers and C++ compilers.
|
|
Packit |
b27855 |
|
|
Packit |
b27855 |
<SAMP>‘C++’</SAMP>
|
|
Packit |
b27855 |
|
|
Packit |
b27855 |
C++. This language is understood by C++ compilers.
|
|
Packit |
b27855 |
|
|
Packit |
b27855 |
|
|
Packit |
b27855 |
The default is ANSI-C.
|
|
Packit |
b27855 |
|
|
Packit |
b27855 |
<SAMP>‘-a’</SAMP>
|
|
Packit |
b27855 |
|
|
Packit |
b27855 |
This option is supported for compatibility with previous releases of
|
|
Packit |
b27855 |
gperf . It does not do anything.
|
|
Packit |
b27855 |
|
|
Packit |
b27855 |
<SAMP>‘-g’</SAMP>
|
|
Packit |
b27855 |
|
|
Packit |
b27855 |
This option is supported for compatibility with previous releases of
|
|
Packit |
b27855 |
gperf . It does not do anything.
|
|
Packit |
b27855 |
|
|
Packit |
b27855 |
|
|
Packit |
b27855 |
|
|
Packit |
b27855 |
|
|
Packit |
b27855 |
|
|
Packit |
b27855 |
|
|
Packit |
b27855 |
|
|
Packit |
b27855 |
Most of these options are also available as declarations in the input file
|
|
Packit |
b27855 |
(see section 4.1.1.2 Gperf Declarations).
|
|
Packit |
b27855 |
|
|
Packit |
b27855 |
|
|
Packit |
b27855 |
|
|
Packit |
b27855 |
|
|
Packit |
b27855 |
<SAMP>‘-K slot-name’</SAMP>
|
|
Packit |
b27855 |
|
|
Packit |
b27855 |
<SAMP>‘--slot-name=slot-name’</SAMP>
|
|
Packit |
b27855 |
|
|
Packit |
b27855 |
|
|
Packit |
b27855 |
This option is only useful when option <SAMP>‘-t’</SAMP> (or, equivalently, the
|
|
Packit |
b27855 |
<SAMP>‘%struct-type’</SAMP> declaration) has been given.
|
|
Packit |
b27855 |
By default, the program assumes the structure component identifier for
|
|
Packit |
b27855 |
the keyword is <SAMP>‘name’</SAMP>. This option allows an arbitrary choice of
|
|
Packit |
b27855 |
identifier for this component, although it still must occur as the first
|
|
Packit |
b27855 |
field in your supplied struct .
|
|
Packit |
b27855 |
|
|
Packit |
b27855 |
<SAMP>‘-F initializers’</SAMP>
|
|
Packit |
b27855 |
|
|
Packit |
b27855 |
<SAMP>‘--initializer-suffix=initializers’</SAMP>
|
|
Packit |
b27855 |
|
|
Packit |
b27855 |
|
|
Packit |
b27855 |
This option is only useful when option <SAMP>‘-t’</SAMP> (or, equivalently, the
|
|
Packit |
b27855 |
<SAMP>‘%struct-type’</SAMP> declaration) has been given.
|
|
Packit |
b27855 |
It permits to specify initializers for the structure members following
|
|
Packit |
b27855 |
slot-name in empty hash table entries. The list of initializers
|
|
Packit |
b27855 |
should start with a comma. By default, the emitted code will
|
|
Packit |
b27855 |
zero-initialize structure members following slot-name.
|
|
Packit |
b27855 |
|
|
Packit |
b27855 |
<SAMP>‘-H hash-function-name’</SAMP>
|
|
Packit |
b27855 |
|
|
Packit |
b27855 |
<SAMP>‘--hash-function-name=hash-function-name’</SAMP>
|
|
Packit |
b27855 |
|
|
Packit |
b27855 |
Allows you to specify the name for the generated hash function. Default
|
|
Packit |
b27855 |
name is <SAMP>‘hash’</SAMP>. This option permits the use of two hash tables in
|
|
Packit |
b27855 |
the same file.
|
|
Packit |
b27855 |
|
|
Packit |
b27855 |
<SAMP>‘-N lookup-function-name’</SAMP>
|
|
Packit |
b27855 |
|
|
Packit |
b27855 |
<SAMP>‘--lookup-function-name=lookup-function-name’</SAMP>
|
|
Packit |
b27855 |
|
|
Packit |
b27855 |
Allows you to specify the name for the generated lookup function.
|
|
Packit |
b27855 |
Default name is <SAMP>‘in_word_set’</SAMP>. This option permits multiple
|
|
Packit |
b27855 |
generated hash functions to be used in the same application.
|
|
Packit |
b27855 |
|
|
Packit |
b27855 |
<SAMP>‘-Z class-name’</SAMP>
|
|
Packit |
b27855 |
|
|
Packit |
b27855 |
<SAMP>‘--class-name=class-name’</SAMP>
|
|
Packit |
b27855 |
|
|
Packit |
b27855 |
|
|
Packit |
b27855 |
This option is only useful when option <SAMP>‘-L C++’</SAMP> (or, equivalently,
|
|
Packit |
b27855 |
the <SAMP>‘%language=C++’</SAMP> declaration) has been given. It
|
|
Packit |
b27855 |
allows you to specify the name of generated C++ class. Default name is
|
|
Packit |
b27855 |
Perfect_Hash .
|
|
Packit |
b27855 |
|
|
Packit |
b27855 |
<SAMP>‘-7’</SAMP>
|
|
Packit |
b27855 |
|
|
Packit |
b27855 |
<SAMP>‘--seven-bit’</SAMP>
|
|
Packit |
b27855 |
|
|
Packit |
b27855 |
This option specifies that all strings that will be passed as arguments
|
|
Packit |
b27855 |
to the generated hash function and the generated lookup function will
|
|
Packit |
b27855 |
solely consist of 7-bit ASCII characters (bytes in the range 0..127).
|
|
Packit |
b27855 |
(Note that the ANSI C functions isalnum and isgraph do
|
|
Packit |
b27855 |
not guarantee that a byte is in this range. Only an explicit
|
|
Packit |
b27855 |
test like <SAMP>‘c >= 'A' && c <= 'Z'’</SAMP> guarantees this.) This was the
|
|
Packit |
b27855 |
default in versions of gperf earlier than 2.7; now the default is
|
|
Packit |
b27855 |
to support 8-bit and multibyte characters.
|
|
Packit |
b27855 |
|
|
Packit |
b27855 |
<SAMP>‘-l’</SAMP>
|
|
Packit |
b27855 |
|
|
Packit |
b27855 |
<SAMP>‘--compare-lengths’</SAMP>
|
|
Packit |
b27855 |
|
|
Packit |
b27855 |
Compare keyword lengths before trying a string comparison. This option
|
|
Packit |
b27855 |
is mandatory for binary comparisons (see section 4.3 Use of NUL bytes). It also might
|
|
Packit |
b27855 |
cut down on the number of string comparisons made during the lookup, since
|
|
Packit |
b27855 |
keywords with different lengths are never compared via strcmp .
|
|
Packit |
b27855 |
However, using <SAMP>‘-l’</SAMP> might greatly increase the size of the
|
|
Packit |
b27855 |
generated C code if the lookup table range is large (which implies that
|
|
Packit |
b27855 |
the switch option <SAMP>‘-S’</SAMP> or <SAMP>‘%switch’</SAMP> is not enabled), since the length
|
|
Packit |
b27855 |
table contains as many elements as there are entries in the lookup table.
|
|
Packit |
b27855 |
|
|
Packit |
b27855 |
<SAMP>‘-c’</SAMP>
|
|
Packit |
b27855 |
|
|
Packit |
b27855 |
<SAMP>‘--compare-strncmp’</SAMP>
|
|
Packit |
b27855 |
|
|
Packit |
b27855 |
Generates C code that uses the strncmp function to perform
|
|
Packit |
b27855 |
string comparisons. The default action is to use strcmp .
|
|
Packit |
b27855 |
|
|
Packit |
b27855 |
<SAMP>‘-C’</SAMP>
|
|
Packit |
b27855 |
|
|
Packit |
b27855 |
<SAMP>‘--readonly-tables’</SAMP>
|
|
Packit |
b27855 |
|
|
Packit |
b27855 |
Makes the contents of all generated lookup tables constant, i.e.,
|
|
Packit |
b27855 |
“readonly”. Many compilers can generate more efficient code for this
|
|
Packit |
b27855 |
by putting the tables in readonly memory.
|
|
Packit |
b27855 |
|
|
Packit |
b27855 |
<SAMP>‘-E’</SAMP>
|
|
Packit |
b27855 |
|
|
Packit |
b27855 |
<SAMP>‘--enum’</SAMP>
|
|
Packit |
b27855 |
|
|
Packit |
b27855 |
|
|
Packit |
b27855 |
Define constant values using an enum local to the lookup function rather
|
|
Packit |
b27855 |
than with #defines. This also means that different lookup functions can
|
|
Packit |
b27855 |
reside in the same file. Thanks to James Clark <jjc@ai.mit.edu> .
|
|
Packit |
b27855 |
|
|
Packit |
b27855 |
<SAMP>‘-I’</SAMP>
|
|
Packit |
b27855 |
|
|
Packit |
b27855 |
<SAMP>‘--includes’</SAMP>
|
|
Packit |
b27855 |
|
|
Packit |
b27855 |
Include the necessary system include file, <string.h> , at the
|
|
Packit |
b27855 |
beginning of the code. By default, this is not done; the user must
|
|
Packit |
b27855 |
include this header file himself to allow compilation of the code.
|
|
Packit |
b27855 |
|
|
Packit |
b27855 |
<SAMP>‘-G’</SAMP>
|
|
Packit |
b27855 |
|
|
Packit |
b27855 |
<SAMP>‘--global-table’</SAMP>
|
|
Packit |
b27855 |
|
|
Packit |
b27855 |
Generate the static table of keywords as a static global variable,
|
|
Packit |
b27855 |
rather than hiding it inside of the lookup function (which is the
|
|
Packit |
b27855 |
default behavior).
|
|
Packit |
b27855 |
|
|
Packit |
b27855 |
<SAMP>‘-P’</SAMP>
|
|
Packit |
b27855 |
|
|
Packit |
b27855 |
<SAMP>‘--pic’</SAMP>
|
|
Packit |
b27855 |
|
|
Packit |
b27855 |
Optimize the generated table for inclusion in shared libraries. This
|
|
Packit |
b27855 |
reduces the startup time of programs using a shared library containing
|
|
Packit |
b27855 |
the generated code. If the option <SAMP>‘-t’</SAMP> (or, equivalently, the
|
|
Packit |
b27855 |
<SAMP>‘%struct-type’</SAMP> declaration) is also given, the first field of the
|
|
Packit |
b27855 |
user-defined struct must be of type <SAMP>‘int’</SAMP>, not <SAMP>‘char *’</SAMP>, because
|
|
Packit |
b27855 |
it will contain offsets into the string pool instead of actual strings.
|
|
Packit |
b27855 |
To convert such an offset to a string, you can use the expression
|
|
Packit |
b27855 |
<SAMP>‘stringpool + o’</SAMP>, where o is the offset. The string pool
|
|
Packit |
b27855 |
name can be changed through the option <SAMP>‘--string-pool-name’</SAMP>.
|
|
Packit |
b27855 |
|
|
Packit |
b27855 |
<SAMP>‘-Q string-pool-name’</SAMP>
|
|
Packit |
b27855 |
|
|
Packit |
b27855 |
<SAMP>‘--string-pool-name=string-pool-name’</SAMP>
|
|
Packit |
b27855 |
|
|
Packit |
b27855 |
Allows you to specify the name of the generated string pool created by
|
|
Packit |
b27855 |
option <SAMP>‘-P’</SAMP>. The default name is <SAMP>‘stringpool’</SAMP>. This option
|
|
Packit |
b27855 |
permits the use of two hash tables in the same file, with <SAMP>‘-P’</SAMP> and
|
|
Packit |
b27855 |
even when the option <SAMP>‘-G’</SAMP> (or, equivalently, the <SAMP>‘%global-table’</SAMP>
|
|
Packit |
b27855 |
declaration) is given.
|
|
Packit |
b27855 |
|
|
Packit |
b27855 |
<SAMP>‘--null-strings’</SAMP>
|
|
Packit |
b27855 |
|
|
Packit |
b27855 |
Use NULL strings instead of empty strings for empty keyword table entries.
|
|
Packit |
b27855 |
This reduces the startup time of programs using a shared library containing
|
|
Packit |
b27855 |
the generated code (but not as much as option <SAMP>‘-P’</SAMP>), at the expense
|
|
Packit |
b27855 |
of one more test-and-branch instruction at run time.
|
|
Packit |
b27855 |
|
|
Packit |
b27855 |
<SAMP>‘--constants-prefix=prefix’</SAMP>
|
|
Packit |
b27855 |
|
|
Packit |
b27855 |
|
|
Packit |
b27855 |
Allows you to specify a prefix for the constants TOTAL_KEYWORDS ,
|
|
Packit |
b27855 |
MIN_WORD_LENGTH , MAX_WORD_LENGTH , and so on. This option
|
|
Packit |
b27855 |
permits the use of two hash tables in the same file, even when the option
|
|
Packit |
b27855 |
<SAMP>‘-E’</SAMP> (or, equivalently, the <SAMP>‘%enum’</SAMP> declaration) is not given or
|
|
Packit |
b27855 |
the option <SAMP>‘-G’</SAMP> (or, equivalently, the <SAMP>‘%global-table’</SAMP> declaration)
|
|
Packit |
b27855 |
is given.
|
|
Packit |
b27855 |
|
|
Packit |
b27855 |
<SAMP>‘-W hash-table-array-name’</SAMP>
|
|
Packit |
b27855 |
|
|
Packit |
b27855 |
<SAMP>‘--word-array-name=hash-table-array-name’</SAMP>
|
|
Packit |
b27855 |
|
|
Packit |
b27855 |
|
|
Packit |
b27855 |
Allows you to specify the name for the generated array containing the
|
|
Packit |
b27855 |
hash table. Default name is <SAMP>‘wordlist’</SAMP>. This option permits the
|
|
Packit |
b27855 |
use of two hash tables in the same file, even when the option <SAMP>‘-G’</SAMP>
|
|
Packit |
b27855 |
(or, equivalently, the <SAMP>‘%global-table’</SAMP> declaration) is given.
|
|
Packit |
b27855 |
|
|
Packit |
b27855 |
<SAMP>‘--length-table-name=length-table-array-name’</SAMP>
|
|
Packit |
b27855 |
|
|
Packit |
b27855 |
|
|
Packit |
b27855 |
Allows you to specify the name for the generated array containing the
|
|
Packit |
b27855 |
length table. Default name is <SAMP>‘lengthtable’</SAMP>. This option permits the
|
|
Packit |
b27855 |
use of two length tables in the same file, even when the option <SAMP>‘-G’</SAMP>
|
|
Packit |
b27855 |
(or, equivalently, the <SAMP>‘%global-table’</SAMP> declaration) is given.
|
|
Packit |
b27855 |
|
|
Packit |
b27855 |
<SAMP>‘-S total-switch-statements’</SAMP>
|
|
Packit |
b27855 |
|
|
Packit |
b27855 |
<SAMP>‘--switch=total-switch-statements’</SAMP>
|
|
Packit |
b27855 |
|
|
Packit |
b27855 |
|
|
Packit |
b27855 |
Causes the generated C code to use a switch statement scheme,
|
|
Packit |
b27855 |
rather than an array lookup table. This can lead to a reduction in both
|
|
Packit |
b27855 |
time and space requirements for some input files. The argument to this
|
|
Packit |
b27855 |
option determines how many switch statements are generated. A
|
|
Packit |
b27855 |
value of 1 generates 1 switch containing all the elements, a
|
|
Packit |
b27855 |
value of 2 generates 2 tables with 1/2 the elements in each
|
|
Packit |
b27855 |
switch , etc. This is useful since many C compilers cannot
|
|
Packit |
b27855 |
correctly generate code for large switch statements. This option
|
|
Packit |
b27855 |
was inspired in part by Keith Bostic's original C program.
|
|
Packit |
b27855 |
|
|
Packit |
b27855 |
<SAMP>‘-T’</SAMP>
|
|
Packit |
b27855 |
|
|
Packit |
b27855 |
<SAMP>‘--omit-struct-type’</SAMP>
|
|
Packit |
b27855 |
|
|
Packit |
b27855 |
Prevents the transfer of the type declaration to the output file. Use
|
|
Packit |
b27855 |
this option if the type is already defined elsewhere.
|
|
Packit |
b27855 |
|
|
Packit |
b27855 |
<SAMP>‘-p’</SAMP>
|
|
Packit |
b27855 |
|
|
Packit |
b27855 |
This option is supported for compatibility with previous releases of
|
|
Packit |
b27855 |
gperf . It does not do anything.
|
|
Packit |
b27855 |
|
|
Packit |
b27855 |
|
|
Packit |
b27855 |
|
|
Packit |
b27855 |
|
|
Packit |
b27855 |
|
|
Packit |
b27855 |
|
|
Packit |
b27855 |
|
|
Packit |
b27855 |
|
|
Packit |
b27855 |
<SAMP>‘-k selected-byte-positions’</SAMP>
|
|
Packit |
b27855 |
|
|
Packit |
b27855 |
<SAMP>‘--key-positions=selected-byte-positions’</SAMP>
|
|
Packit |
b27855 |
|
|
Packit |
b27855 |
Allows selection of the byte positions used in the keywords'
|
|
Packit |
b27855 |
hash function. The allowable choices range between 1-255, inclusive.
|
|
Packit |
b27855 |
The positions are separated by commas, e.g., <SAMP>‘-k 9,4,13,14’</SAMP>;
|
|
Packit |
b27855 |
ranges may be used, e.g., <SAMP>‘-k 2-7’</SAMP>; and positions may occur
|
|
Packit |
b27855 |
in any order. Furthermore, the wildcard '*' causes the generated
|
|
Packit |
b27855 |
hash function to consider all byte positions in each keyword,
|
|
Packit |
b27855 |
whereas '$' instructs the hash function to use the “final byte”
|
|
Packit |
b27855 |
of a keyword (this is the only way to use a byte position greater than
|
|
Packit |
b27855 |
255, incidentally).
|
|
Packit |
b27855 |
|
|
Packit |
b27855 |
For instance, the option <SAMP>‘-k 1,2,4,6-10,'$'’</SAMP> generates a hash
|
|
Packit |
b27855 |
function that considers positions 1,2,4,6,7,8,9,10, plus the last
|
|
Packit |
b27855 |
byte in each keyword (which may be at a different position for each
|
|
Packit |
b27855 |
keyword, obviously). Keywords
|
|
Packit |
b27855 |
with length less than the indicated byte positions work properly, since
|
|
Packit |
b27855 |
selected byte positions exceeding the keyword length are simply not
|
|
Packit |
b27855 |
referenced in the hash function.
|
|
Packit |
b27855 |
|
|
Packit |
b27855 |
This option is not normally needed since version 2.8 of gperf ;
|
|
Packit |
b27855 |
the default byte positions are computed depending on the keyword set,
|
|
Packit |
b27855 |
through a search that minimizes the number of byte positions.
|
|
Packit |
b27855 |
|
|
Packit |
b27855 |
<SAMP>‘-D’</SAMP>
|
|
Packit |
b27855 |
|
|
Packit |
b27855 |
<SAMP>‘--duplicates’</SAMP>
|
|
Packit |
b27855 |
|
|
Packit |
b27855 |
|
|
Packit |
b27855 |
Handle keywords whose selected byte sets hash to duplicate values.
|
|
Packit |
b27855 |
Duplicate hash values can occur if a set of keywords has the same names, but
|
|
Packit |
b27855 |
possesses different attributes, or if the selected byte positions are not well
|
|
Packit |
b27855 |
chosen. With the -D option gperf treats all these keywords as
|
|
Packit |
b27855 |
part of an equivalence class and generates a perfect hash function with
|
|
Packit |
b27855 |
multiple comparisons for duplicate keywords. It is up to you to completely
|
|
Packit |
b27855 |
disambiguate the keywords by modifying the generated C code. However,
|
|
Packit |
b27855 |
gperf helps you out by organizing the output.
|
|
Packit |
b27855 |
|
|
Packit |
b27855 |
Using this option usually means that the generated hash function is no
|
|
Packit |
b27855 |
longer perfect. On the other hand, it permits gperf to work on
|
|
Packit |
b27855 |
keyword sets that it otherwise could not handle.
|
|
Packit |
b27855 |
|
|
Packit |
b27855 |
<SAMP>‘-m iterations’</SAMP>
|
|
Packit |
b27855 |
|
|
Packit |
b27855 |
<SAMP>‘--multiple-iterations=iterations’</SAMP>
|
|
Packit |
b27855 |
|
|
Packit |
b27855 |
Perform multiple choices of the <SAMP>‘-i’</SAMP> and <SAMP>‘-j’</SAMP> values, and
|
|
Packit |
b27855 |
choose the best results. This increases the running time by a factor of
|
|
Packit |
b27855 |
iterations but does a good job minimizing the generated table size.
|
|
Packit |
b27855 |
|
|
Packit |
b27855 |
<SAMP>‘-i initial-value’</SAMP>
|
|
Packit |
b27855 |
|
|
Packit |
b27855 |
<SAMP>‘--initial-asso=initial-value’</SAMP>
|
|
Packit |
b27855 |
|
|
Packit |
b27855 |
Provides an initial value for the associate values array. Default
|
|
Packit |
b27855 |
is 0. Increasing the initial value helps inflate the final table size,
|
|
Packit |
b27855 |
possibly leading to more time efficient keyword lookups. Note that this
|
|
Packit |
b27855 |
option is not particularly useful when <SAMP>‘-S’</SAMP> (or, equivalently,
|
|
Packit |
b27855 |
<SAMP>‘%switch’</SAMP>) is used. Also,
|
|
Packit |
b27855 |
<SAMP>‘-i’</SAMP> is overridden when the <SAMP>‘-r’</SAMP> option is used.
|
|
Packit |
b27855 |
|
|
Packit |
b27855 |
<SAMP>‘-j jump-value’</SAMP>
|
|
Packit |
b27855 |
|
|
Packit |
b27855 |
<SAMP>‘--jump=jump-value’</SAMP>
|
|
Packit |
b27855 |
|
|
Packit |
b27855 |
|
|
Packit |
b27855 |
Affects the “jump value”, i.e., how far to advance the associated
|
|
Packit |
b27855 |
byte value upon collisions. Jump-value is rounded up to an
|
|
Packit |
b27855 |
odd number, the default is 5. If the jump-value is 0 gperf
|
|
Packit |
b27855 |
jumps by random amounts.
|
|
Packit |
b27855 |
|
|
Packit |
b27855 |
<SAMP>‘-n’</SAMP>
|
|
Packit |
b27855 |
|
|
Packit |
b27855 |
<SAMP>‘--no-strlen’</SAMP>
|
|
Packit |
b27855 |
|
|
Packit |
b27855 |
Instructs the generator not to include the length of a keyword when
|
|
Packit |
b27855 |
computing its hash value. This may save a few assembly instructions in
|
|
Packit |
b27855 |
the generated lookup table.
|
|
Packit |
b27855 |
|
|
Packit |
b27855 |
<SAMP>‘-r’</SAMP>
|
|
Packit |
b27855 |
|
|
Packit |
b27855 |
<SAMP>‘--random’</SAMP>
|
|
Packit |
b27855 |
|
|
Packit |
b27855 |
Utilizes randomness to initialize the associated values table. This
|
|
Packit |
b27855 |
frequently generates solutions faster than using deterministic
|
|
Packit |
b27855 |
initialization (which starts all associated values at 0). Furthermore,
|
|
Packit |
b27855 |
using the randomization option generally increases the size of the
|
|
Packit |
b27855 |
table.
|
|
Packit |
b27855 |
|
|
Packit |
b27855 |
<SAMP>‘-s size-multiple’</SAMP>
|
|
Packit |
b27855 |
|
|
Packit |
b27855 |
<SAMP>‘--size-multiple=size-multiple’</SAMP>
|
|
Packit |
b27855 |
|
|
Packit |
b27855 |
Affects the size of the generated hash table. The numeric argument for
|
|
Packit |
b27855 |
this option indicates “how many times larger or smaller” the maximum
|
|
Packit |
b27855 |
associated value range should be, in relationship to the number of keywords.
|
|
Packit |
b27855 |
It can be written as an integer, a floating-point number or a fraction.
|
|
Packit |
b27855 |
For example, a value of 3 means “allow the maximum associated value to be
|
|
Packit |
b27855 |
about 3 times larger than the number of input keywords”.
|
|
Packit |
b27855 |
Conversely, a value of 1/3 means “allow the maximum associated value to
|
|
Packit |
b27855 |
be about 3 times smaller than the number of input keywords”. Values
|
|
Packit |
b27855 |
smaller than 1 are useful for limiting the overall size of the generated hash
|
|
Packit |
b27855 |
table, though the option <SAMP>‘-m’</SAMP> is better at this purpose.
|
|
Packit |
b27855 |
|
|
Packit |
b27855 |
If `generate switch' option <SAMP>‘-S’</SAMP> (or, equivalently, <SAMP>‘%switch’</SAMP>) is
|
|
Packit |
b27855 |
not enabled, the maximum
|
|
Packit |
b27855 |
associated value influences the static array table size, and a larger
|
|
Packit |
b27855 |
table should decrease the time required for an unsuccessful search, at
|
|
Packit |
b27855 |
the expense of extra table space.
|
|
Packit |
b27855 |
|
|
Packit |
b27855 |
The default value is 1, thus the default maximum associated value about
|
|
Packit |
b27855 |
the same size as the number of keywords (for efficiency, the maximum
|
|
Packit |
b27855 |
associated value is always rounded up to a power of 2). The actual
|
|
Packit |
b27855 |
table size may vary somewhat, since this technique is essentially a
|
|
Packit |
b27855 |
heuristic.
|
|
Packit |
b27855 |
|
|
Packit |
b27855 |
|
|
Packit |
b27855 |
|
|
Packit |
b27855 |
|
|
Packit |
b27855 |
|
|
Packit |
b27855 |
|
|
Packit |
b27855 |
|
|
Packit |
b27855 |
|
|
Packit |
b27855 |
<SAMP>‘-h’</SAMP>
|
|
Packit |
b27855 |
|
|
Packit |
b27855 |
<SAMP>‘--help’</SAMP>
|
|
Packit |
b27855 |
|
|
Packit |
b27855 |
Prints a short summary on the meaning of each program option. Aborts
|
|
Packit |
b27855 |
further program execution.
|
|
Packit |
b27855 |
|
|
Packit |
b27855 |
<SAMP>‘-v’</SAMP>
|
|
Packit |
b27855 |
|
|
Packit |
b27855 |
<SAMP>‘--version’</SAMP>
|
|
Packit |
b27855 |
|
|
Packit |
b27855 |
Prints out the current version number.
|
|
Packit |
b27855 |
|
|
Packit |
b27855 |
<SAMP>‘-d’</SAMP>
|
|
Packit |
b27855 |
|
|
Packit |
b27855 |
<SAMP>‘--debug’</SAMP>
|
|
Packit |
b27855 |
|
|
Packit |
b27855 |
Enables the debugging option. This produces verbose diagnostics to
|
|
Packit |
b27855 |
“standard error” when gperf is executing. It is useful both for
|
|
Packit |
b27855 |
maintaining the program and for determining whether a given set of
|
|
Packit |
b27855 |
options is actually speeding up the search for a solution. Some useful
|
|
Packit |
b27855 |
information is dumped at the end of the program when the <SAMP>‘-d’</SAMP>
|
|
Packit |
b27855 |
option is enabled.
|
|
Packit |
b27855 |
|
|
Packit |
b27855 |
|
|
Packit |
b27855 |
|
|
Packit |
b27855 |
Go to the first, previous, next, last section, table of contents.
|
|
Packit |
b27855 |
</BODY>
|
|
Packit |
b27855 |
</HTML>
|