1TRIEHASH(1)           User Contributed Perl Documentation          TRIEHASH(1)
2
3
4

NAME

6       triehash - Generate a perfect hash function derived from a trie.
7

SYNOPSIS

9       triehash [option] [input file]
10

DESCRIPTION

12       triehash takes a list of words in input file and generates a function
13       and an enumeration to describe the word
14

INPUT FILE FORMAT

16       The file consists of multiple lines of the form:
17
18           [label ~ ] word [= value]
19
20       This maps word to value, and generates an enumeration with entries of
21       the form:
22
23           label = value
24
25       If label is undefined, the word will be used, the minus character will
26       be replaced by an underscore. If value is undefined it is counted
27       upwards from the last value.
28
29       There may also be one line of the format
30
31           [ label ~] = value
32
33       Which defines the value to be used for non-existing keys. Note that
34       this also changes default value for other keys, as for normal entries.
35       So if you place
36
37           = 0
38
39       at the beginning of the file, unknown strings map to 0, and the other
40       strings map to values starting with 1. If label is not specified, the
41       default is Unknown.
42

OPTIONS

44       -C.c file --code=.c file
45           Generate code in the given file.
46
47       -Hheader file --header=header file
48           Generate a header in the given file, containing a declaration of
49           the hash function and an enumeration.
50
51       --enum-name=word
52           The name of the enumeration.
53
54       --function-name=word
55           The name of the function.
56
57       --label-prefix=word
58           The prefix to use for labels.
59
60       --label-uppercase
61           Uppercase label names when normalizing them.
62
63       --namespace=name
64           Put the function and enum into a namespace (C++)
65
66       --class=name
67           Put the function and enum into a class (C++)
68
69       --enum-class
70           Generate an enum class instead of an enum (C++)
71
72       --counter-name=name
73           Use name for a counter that is set to the latest entry in the
74           enumeration + 1. This can be useful for defining array sizes.
75
76       --ignore-case
77           Ignore case for words.
78
79       --multi-byte=value
80           Generate code reading multiple bytes at once. The value is a string
81           of power of twos to enable. The default value is 320 meaning that
82           8, 4, and single byte reads are enabled. Specify 0 to disable
83           multi-byte completely, or add 2 if you also want to allow 2-byte
84           reads. 2-byte reads are disabled by default because they negatively
85           affect performance on older Intel architectures.
86
87           This generates code for both multiple bytes and single byte reads,
88           but only enables the multiple byte reads of GNU C compatible
89           compilers, as the following extensions are used:
90
91           Byte-aligned integers
92                   We must be able to generate integers that are aligned to a
93                   single byte using:
94
95                       typedef uint64_t __attribute__((aligned (1))) triehash_uu64;
96
97           Byte-order
98                   The macros __BYTE_ORDER__ and __ORDER_LITTLE_ENDIAN__ must
99                   be defined.
100
101           We forcefully disable multi-byte reads on platforms where the
102           variable __ARM_ARCH is defined and __ARM_FEATURE_UNALIGNED is not
103           defined, as there is a measurable overhead from emulating the
104           unaligned reads on ARM.
105
106       --language=language
107           Generate a file in the specified language. Currently known are 'C'
108           and 'tree', the latter generating a tree.
109
110       --include=header
111           Add the header to the include statements of the header file. The
112           value must be surrounded by quotes or angle brackets for C code.
113           May be specified multiple times.
114

LICENSE

116       triehash is available under the MIT/Expat license, see the source code
117       for more information.
118

AUTHOR

120       Julian Andres Klode <jak@jak-linux.org>
121
122
123
124perl v5.30.1                      2020-01-31                       TRIEHASH(1)
Impressum