| 1 |
<HTML> |
| 2 |
<HEAD> |
| 3 |
<!-- This HTML file has been created by texi2html 1.52b |
| 4 |
from gperf.texi on 16 April 2025 --> |
| 5 |
|
| 6 |
<META HTTP-EQUIV="content-type" CONTENT="text/html; charset=UTF-8"> |
| 7 |
<TITLE>Perfect Hash Function Generator</TITLE> |
| 8 |
</HEAD> |
| 9 |
<BODY> |
| 10 |
<H1>User's Guide to <CODE>gperf</CODE> 3.2</H1> |
| 11 |
<H2>The GNU Perfect Hash Function Generator</H2> |
| 12 |
<H2>Edition 3.2, 28 October 2024</H2> |
| 13 |
<ADDRESS>Douglas C. Schmidt</ADDRESS> |
| 14 |
<ADDRESS>Bruno Haible</ADDRESS> |
| 15 |
<P> |
| 16 |
<P><HR><P> |
| 17 |
<H1>Table of Contents</H1> |
| 18 |
<UL> |
| 19 |
<LI><A NAME="TOC1" HREF="gperf.html#SEC1">GNU GENERAL PUBLIC LICENSE</A> |
| 20 |
<LI><A NAME="TOC2" HREF="gperf.html#SEC2">Contributors to GNU <CODE>gperf</CODE> Utility</A> |
| 21 |
<LI><A NAME="TOC3" HREF="gperf.html#SEC3">2 Introduction</A> |
| 22 |
<LI><A NAME="TOC4" HREF="gperf.html#SEC4">3 Static search structures and GNU <CODE>gperf</CODE></A> |
| 23 |
<LI><A NAME="TOC5" HREF="gperf.html#SEC5">4 High-Level Description of GNU <CODE>gperf</CODE></A> |
| 24 |
<UL> |
| 25 |
<LI><A NAME="TOC6" HREF="gperf.html#SEC6">4.1 Input Format to <CODE>gperf</CODE></A> |
| 26 |
<UL> |
| 27 |
<LI><A NAME="TOC7" HREF="gperf.html#SEC7">4.1.1 Declarations</A> |
| 28 |
<UL> |
| 29 |
<LI><A NAME="TOC8" HREF="gperf.html#SEC8">4.1.1.1 User-supplied <CODE>struct</CODE></A> |
| 30 |
<LI><A NAME="TOC9" HREF="gperf.html#SEC9">4.1.1.2 Gperf Declarations</A> |
| 31 |
<LI><A NAME="TOC10" HREF="gperf.html#SEC10">4.1.1.3 C Code Inclusion</A> |
| 32 |
</UL> |
| 33 |
<LI><A NAME="TOC11" HREF="gperf.html#SEC11">4.1.2 Format for Keyword Entries</A> |
| 34 |
<LI><A NAME="TOC12" HREF="gperf.html#SEC12">4.1.3 Including Additional C Functions</A> |
| 35 |
<LI><A NAME="TOC13" HREF="gperf.html#SEC13">4.1.4 Where to place directives for GNU <CODE>indent</CODE>.</A> |
| 36 |
</UL> |
| 37 |
<LI><A NAME="TOC14" HREF="gperf.html#SEC14">4.2 Output Format for Generated C Code with <CODE>gperf</CODE></A> |
| 38 |
<LI><A NAME="TOC15" HREF="gperf.html#SEC15">4.3 Use of NUL bytes</A> |
| 39 |
<LI><A NAME="TOC16" HREF="gperf.html#SEC16">4.4 Controlling Identifiers</A> |
| 40 |
<LI><A NAME="TOC17" HREF="gperf.html#SEC17">4.5 The Copyright of the Output</A> |
| 41 |
</UL> |
| 42 |
<LI><A NAME="TOC18" HREF="gperf.html#SEC18">5 Invoking <CODE>gperf</CODE></A> |
| 43 |
<UL> |
| 44 |
<LI><A NAME="TOC19" HREF="gperf.html#SEC19">5.1 Specifying the Location of the Output File</A> |
| 45 |
<LI><A NAME="TOC20" HREF="gperf.html#SEC20">5.2 Options that affect Interpretation of the Input File</A> |
| 46 |
<LI><A NAME="TOC21" HREF="gperf.html#SEC21">5.3 Options to specify the Language for the Output Code</A> |
| 47 |
<LI><A NAME="TOC22" HREF="gperf.html#SEC22">5.4 Options for fine tuning Details in the Output Code</A> |
| 48 |
<LI><A NAME="TOC23" HREF="gperf.html#SEC23">5.5 Options for changing the Algorithms employed by <CODE>gperf</CODE></A> |
| 49 |
<LI><A NAME="TOC24" HREF="gperf.html#SEC24">5.6 Informative Output</A> |
| 50 |
</UL> |
| 51 |
<LI><A NAME="TOC25" HREF="gperf.html#SEC25">6 Known Bugs and Limitations with <CODE>gperf</CODE></A> |
| 52 |
<LI><A NAME="TOC26" HREF="gperf.html#SEC26">7 Things Still Left to Do</A> |
| 53 |
<LI><A NAME="TOC27" HREF="gperf.html#SEC27">8 Bibliography</A> |
| 54 |
<LI><A NAME="TOC28" HREF="gperf.html#SEC28">Concept Index</A> |
| 55 |
</UL> |
| 56 |
<P><HR><P> |
| 57 |
|
| 58 |
<P> |
| 59 |
Copyright (C) 1989-2024 Free Software Foundation, Inc. |
| 60 |
|
| 61 |
</P> |
| 62 |
|
| 63 |
<P> |
| 64 |
Permission is granted to make and distribute verbatim copies of |
| 65 |
this manual provided the copyright notice and this permission notice |
| 66 |
are preserved on all copies. |
| 67 |
|
| 68 |
</P> |
| 69 |
<P> |
| 70 |
Permission is granted to copy and distribute modified versions of this |
| 71 |
manual under the conditions for verbatim copying, provided also that the |
| 72 |
section entitled “GNU General Public License” is included |
| 73 |
exactly as in the original, and provided that the entire resulting |
| 74 |
derived work is distributed under the terms of a permission notice |
| 75 |
identical to this one. |
| 76 |
|
| 77 |
</P> |
| 78 |
<P> |
| 79 |
Permission is granted to copy and distribute translations of this manual |
| 80 |
into another language, under the above conditions for modified versions, |
| 81 |
except that the section entitled “GNU General Public License” may be |
| 82 |
included in a translation approved by the author instead of in the |
| 83 |
original English. |
| 84 |
|
| 85 |
</P> |
| 86 |
|
| 87 |
|
| 88 |
|
| 89 |
<H1><A NAME="SEC1" HREF="gperf.html#TOC1">GNU GENERAL PUBLIC LICENSE</A></H1> |
| 90 |
<P> |
| 91 |
Version 3, 29 June 2007 |
| 92 |
|
| 93 |
</P> |
| 94 |
|
| 95 |
|
| 96 |
<PRE> |
| 97 |
Copyright (C) 2007 Free Software Foundation, Inc. <A HREF="http://fsf.org/">http://fsf.org/</A> |
| 98 |
|
| 99 |
Everyone is permitted to copy and distribute verbatim copies of this |
| 100 |
license document, but changing it is not allowed. |
| 101 |
</PRE> |
| 102 |
|
| 103 |
|
| 104 |
<H2>1.0 Preamble</H2> |
| 105 |
|
| 106 |
<P> |
| 107 |
The GNU General Public License is a free, copyleft license for |
| 108 |
software and other kinds of works. |
| 109 |
|
| 110 |
</P> |
| 111 |
<P> |
| 112 |
The licenses for most software and other practical works are designed |
| 113 |
to take away your freedom to share and change the works. By contrast, |
| 114 |
the GNU General Public License is intended to guarantee your freedom |
| 115 |
to share and change all versions of a program--to make sure it remains |
| 116 |
free software for all its users. We, the Free Software Foundation, |
| 117 |
use the GNU General Public License for most of our software; it |
| 118 |
applies also to any other work released this way by its authors. You |
| 119 |
can apply it to your programs, too. |
| 120 |
|
| 121 |
</P> |
| 122 |
<P> |
| 123 |
When we speak of free software, we are referring to freedom, not |
| 124 |
price. Our General Public Licenses are designed to make sure that you |
| 125 |
have the freedom to distribute copies of free software (and charge for |
| 126 |
them if you wish), that you receive source code or can get it if you |
| 127 |
want it, that you can change the software or use pieces of it in new |
| 128 |
free programs, and that you know you can do these things. |
| 129 |
|
| 130 |
</P> |
| 131 |
<P> |
| 132 |
To protect your rights, we need to prevent others from denying you |
| 133 |
these rights or asking you to surrender the rights. Therefore, you |
| 134 |
have certain responsibilities if you distribute copies of the |
| 135 |
software, or if you modify it: responsibilities to respect the freedom |
| 136 |
of others. |
| 137 |
|
| 138 |
</P> |
| 139 |
<P> |
| 140 |
For example, if you distribute copies of such a program, whether |
| 141 |
gratis or for a fee, you must pass on to the recipients the same |
| 142 |
freedoms that you received. You must make sure that they, too, |
| 143 |
receive or can get the source code. And you must show them these |
| 144 |
terms so they know their rights. |
| 145 |
|
| 146 |
</P> |
| 147 |
<P> |
| 148 |
Developers that use the GNU GPL protect your rights with two steps: |
| 149 |
(1) assert copyright on the software, and (2) offer you this License |
| 150 |
giving you legal permission to copy, distribute and/or modify it. |
| 151 |
|
| 152 |
</P> |
| 153 |
<P> |
| 154 |
For the developers' and authors' protection, the GPL clearly explains |
| 155 |
that there is no warranty for this free software. For both users' and |
| 156 |
authors' sake, the GPL requires that modified versions be marked as |
| 157 |
changed, so that their problems will not be attributed erroneously to |
| 158 |
authors of previous versions. |
| 159 |
|
| 160 |
</P> |
| 161 |
<P> |
| 162 |
Some devices are designed to deny users access to install or run |
| 163 |
modified versions of the software inside them, although the |
| 164 |
manufacturer can do so. This is fundamentally incompatible with the |
| 165 |
aim of protecting users' freedom to change the software. The |
| 166 |
systematic pattern of such abuse occurs in the area of products for |
| 167 |
individuals to use, which is precisely where it is most unacceptable. |
| 168 |
Therefore, we have designed this version of the GPL to prohibit the |
| 169 |
practice for those products. If such problems arise substantially in |
| 170 |
other domains, we stand ready to extend this provision to those |
| 171 |
domains in future versions of the GPL, as needed to protect the |
| 172 |
freedom of users. |
| 173 |
|
| 174 |
</P> |
| 175 |
<P> |
| 176 |
Finally, every program is threatened constantly by software patents. |
| 177 |
States should not allow patents to restrict development and use of |
| 178 |
software on general-purpose computers, but in those that do, we wish |
| 179 |
to avoid the special danger that patents applied to a free program |
| 180 |
could make it effectively proprietary. To prevent this, the GPL |
| 181 |
assures that patents cannot be used to render the program non-free. |
| 182 |
|
| 183 |
</P> |
| 184 |
<P> |
| 185 |
The precise terms and conditions for copying, distribution and |
| 186 |
modification follow. |
| 187 |
|
| 188 |
</P> |
| 189 |
|
| 190 |
<H2>1.1 TERMS AND CONDITIONS</H2> |
| 191 |
|
| 192 |
|
| 193 |
<OL> |
| 194 |
<LI>Definitions. |
| 195 |
|
| 196 |
“This License” refers to version 3 of the GNU General Public License. |
| 197 |
|
| 198 |
“Copyright” also means copyright-like laws that apply to other kinds |
| 199 |
of works, such as semiconductor masks. |
| 200 |
|
| 201 |
“The Program” refers to any copyrightable work licensed under this |
| 202 |
License. Each licensee is addressed as “you”. “Licensees” and |
| 203 |
“recipients” may be individuals or organizations. |
| 204 |
|
| 205 |
To “modify” a work means to copy from or adapt all or part of the work |
| 206 |
in a fashion requiring copyright permission, other than the making of |
| 207 |
an exact copy. The resulting work is called a “modified version” of |
| 208 |
the earlier work or a work “based on” the earlier work. |
| 209 |
|
| 210 |
A “covered work” means either the unmodified Program or a work based |
| 211 |
on the Program. |
| 212 |
|
| 213 |
To “propagate” a work means to do anything with it that, without |
| 214 |
permission, would make you directly or secondarily liable for |
| 215 |
infringement under applicable copyright law, except executing it on a |
| 216 |
computer or modifying a private copy. Propagation includes copying, |
| 217 |
distribution (with or without modification), making available to the |
| 218 |
public, and in some countries other activities as well. |
| 219 |
|
| 220 |
To “convey” a work means any kind of propagation that enables other |
| 221 |
parties to make or receive copies. Mere interaction with a user |
| 222 |
through a computer network, with no transfer of a copy, is not |
| 223 |
conveying. |
| 224 |
|
| 225 |
An interactive user interface displays “Appropriate Legal Notices” to |
| 226 |
the extent that it includes a convenient and prominently visible |
| 227 |
feature that (1) displays an appropriate copyright notice, and (2) |
| 228 |
tells the user that there is no warranty for the work (except to the |
| 229 |
extent that warranties are provided), that licensees may convey the |
| 230 |
work under this License, and how to view a copy of this License. If |
| 231 |
the interface presents a list of user commands or options, such as a |
| 232 |
menu, a prominent item in the list meets this criterion. |
| 233 |
|
| 234 |
<LI>Source Code. |
| 235 |
|
| 236 |
The “source code” for a work means the preferred form of the work for |
| 237 |
making modifications to it. “Object code” means any non-source form |
| 238 |
of a work. |
| 239 |
|
| 240 |
A “Standard Interface” means an interface that either is an official |
| 241 |
standard defined by a recognized standards body, or, in the case of |
| 242 |
interfaces specified for a particular programming language, one that |
| 243 |
is widely used among developers working in that language. |
| 244 |
|
| 245 |
The “System Libraries” of an executable work include anything, other |
| 246 |
than the work as a whole, that (a) is included in the normal form of |
| 247 |
packaging a Major Component, but which is not part of that Major |
| 248 |
Component, and (b) serves only to enable use of the work with that |
| 249 |
Major Component, or to implement a Standard Interface for which an |
| 250 |
implementation is available to the public in source code form. A |
| 251 |
“Major Component”, in this context, means a major essential component |
| 252 |
(kernel, window system, and so on) of the specific operating system |
| 253 |
(if any) on which the executable work runs, or a compiler used to |
| 254 |
produce the work, or an object code interpreter used to run it. |
| 255 |
|
| 256 |
The “Corresponding Source” for a work in object code form means all |
| 257 |
the source code needed to generate, install, and (for an executable |
| 258 |
work) run the object code and to modify the work, including scripts to |
| 259 |
control those activities. However, it does not include the work's |
| 260 |
System Libraries, or general-purpose tools or generally available free |
| 261 |
programs which are used unmodified in performing those activities but |
| 262 |
which are not part of the work. For example, Corresponding Source |
| 263 |
includes interface definition files associated with source files for |
| 264 |
the work, and the source code for shared libraries and dynamically |
| 265 |
linked subprograms that the work is specifically designed to require, |
| 266 |
such as by intimate data communication or control flow between those |
| 267 |
subprograms and other parts of the work. |
| 268 |
|
| 269 |
The Corresponding Source need not include anything that users can |
| 270 |
regenerate automatically from other parts of the Corresponding Source. |
| 271 |
|
| 272 |
The Corresponding Source for a work in source code form is that same |
| 273 |
work. |
| 274 |
|
| 275 |
<LI>Basic Permissions. |
| 276 |
|
| 277 |
All rights granted under this License are granted for the term of |
| 278 |
copyright on the Program, and are irrevocable provided the stated |
| 279 |
conditions are met. This License explicitly affirms your unlimited |
| 280 |
permission to run the unmodified Program. The output from running a |
| 281 |
covered work is covered by this License only if the output, given its |
| 282 |
content, constitutes a covered work. This License acknowledges your |
| 283 |
rights of fair use or other equivalent, as provided by copyright law. |
| 284 |
|
| 285 |
You may make, run and propagate covered works that you do not convey, |
| 286 |
without conditions so long as your license otherwise remains in force. |
| 287 |
You may convey covered works to others for the sole purpose of having |
| 288 |
them make modifications exclusively for you, or provide you with |
| 289 |
facilities for running those works, provided that you comply with the |
| 290 |
terms of this License in conveying all material for which you do not |
| 291 |
control copyright. Those thus making or running the covered works for |
| 292 |
you must do so exclusively on your behalf, under your direction and |
| 293 |
control, on terms that prohibit them from making any copies of your |
| 294 |
copyrighted material outside their relationship with you. |
| 295 |
|
| 296 |
Conveying under any other circumstances is permitted solely under the |
| 297 |
conditions stated below. Sublicensing is not allowed; section 10 |
| 298 |
makes it unnecessary. |
| 299 |
|
| 300 |
<LI>Protecting Users' Legal Rights From Anti-Circumvention Law. |
| 301 |
|
| 302 |
No covered work shall be deemed part of an effective technological |
| 303 |
measure under any applicable law fulfilling obligations under article |
| 304 |
11 of the WIPO copyright treaty adopted on 20 December 1996, or |
| 305 |
similar laws prohibiting or restricting circumvention of such |
| 306 |
measures. |
| 307 |
|
| 308 |
When you convey a covered work, you waive any legal power to forbid |
| 309 |
circumvention of technological measures to the extent such |
| 310 |
circumvention is effected by exercising rights under this License with |
| 311 |
respect to the covered work, and you disclaim any intention to limit |
| 312 |
operation or modification of the work as a means of enforcing, against |
| 313 |
the work's users, your or third parties' legal rights to forbid |
| 314 |
circumvention of technological measures. |
| 315 |
|
| 316 |
<LI>Conveying Verbatim Copies. |
| 317 |
|
| 318 |
You may convey verbatim copies of the Program's source code as you |
| 319 |
receive it, in any medium, provided that you conspicuously and |
| 320 |
appropriately publish on each copy an appropriate copyright notice; |
| 321 |
keep intact all notices stating that this License and any |
| 322 |
non-permissive terms added in accord with section 7 apply to the code; |
| 323 |
keep intact all notices of the absence of any warranty; and give all |
| 324 |
recipients a copy of this License along with the Program. |
| 325 |
|
| 326 |
You may charge any price or no price for each copy that you convey, |
| 327 |
and you may offer support or warranty protection for a fee. |
| 328 |
|
| 329 |
<LI>Conveying Modified Source Versions. |
| 330 |
|
| 331 |
You may convey a work based on the Program, or the modifications to |
| 332 |
produce it from the Program, in the form of source code under the |
| 333 |
terms of section 4, provided that you also meet all of these |
| 334 |
conditions: |
| 335 |
|
| 336 |
|
| 337 |
<OL> |
| 338 |
<LI> |
| 339 |
|
| 340 |
The work must carry prominent notices stating that you modified it, |
| 341 |
and giving a relevant date. |
| 342 |
|
| 343 |
<LI> |
| 344 |
|
| 345 |
The work must carry prominent notices stating that it is released |
| 346 |
under this License and any conditions added under section 7. This |
| 347 |
requirement modifies the requirement in section 4 to “keep intact all |
| 348 |
notices”. |
| 349 |
|
| 350 |
<LI> |
| 351 |
|
| 352 |
You must license the entire work, as a whole, under this License to |
| 353 |
anyone who comes into possession of a copy. This License will |
| 354 |
therefore apply, along with any applicable section 7 additional terms, |
| 355 |
to the whole of the work, and all its parts, regardless of how they |
| 356 |
are packaged. This License gives no permission to license the work in |
| 357 |
any other way, but it does not invalidate such permission if you have |
| 358 |
separately received it. |
| 359 |
|
| 360 |
<LI> |
| 361 |
|
| 362 |
If the work has interactive user interfaces, each must display |
| 363 |
Appropriate Legal Notices; however, if the Program has interactive |
| 364 |
interfaces that do not display Appropriate Legal Notices, your work |
| 365 |
need not make them do so. |
| 366 |
</OL> |
| 367 |
|
| 368 |
A compilation of a covered work with other separate and independent |
| 369 |
works, which are not by their nature extensions of the covered work, |
| 370 |
and which are not combined with it such as to form a larger program, |
| 371 |
in or on a volume of a storage or distribution medium, is called an |
| 372 |
“aggregate” if the compilation and its resulting copyright are not |
| 373 |
used to limit the access or legal rights of the compilation's users |
| 374 |
beyond what the individual works permit. Inclusion of a covered work |
| 375 |
in an aggregate does not cause this License to apply to the other |
| 376 |
parts of the aggregate. |
| 377 |
|
| 378 |
<LI>Conveying Non-Source Forms. |
| 379 |
|
| 380 |
You may convey a covered work in object code form under the terms of |
| 381 |
sections 4 and 5, provided that you also convey the machine-readable |
| 382 |
Corresponding Source under the terms of this License, in one of these |
| 383 |
ways: |
| 384 |
|
| 385 |
|
| 386 |
<OL> |
| 387 |
<LI> |
| 388 |
|
| 389 |
Convey the object code in, or embodied in, a physical product |
| 390 |
(including a physical distribution medium), accompanied by the |
| 391 |
Corresponding Source fixed on a durable physical medium customarily |
| 392 |
used for software interchange. |
| 393 |
|
| 394 |
<LI> |
| 395 |
|
| 396 |
Convey the object code in, or embodied in, a physical product |
| 397 |
(including a physical distribution medium), accompanied by a written |
| 398 |
offer, valid for at least three years and valid for as long as you |
| 399 |
offer spare parts or customer support for that product model, to give |
| 400 |
anyone who possesses the object code either (1) a copy of the |
| 401 |
Corresponding Source for all the software in the product that is |
| 402 |
covered by this License, on a durable physical medium customarily used |
| 403 |
for software interchange, for a price no more than your reasonable |
| 404 |
cost of physically performing this conveying of source, or (2) access |
| 405 |
to copy the Corresponding Source from a network server at no charge. |
| 406 |
|
| 407 |
<LI> |
| 408 |
|
| 409 |
Convey individual copies of the object code with a copy of the written |
| 410 |
offer to provide the Corresponding Source. This alternative is |
| 411 |
allowed only occasionally and noncommercially, and only if you |
| 412 |
received the object code with such an offer, in accord with subsection |
| 413 |
6b. |
| 414 |
|
| 415 |
<LI> |
| 416 |
|
| 417 |
Convey the object code by offering access from a designated place |
| 418 |
(gratis or for a charge), and offer equivalent access to the |
| 419 |
Corresponding Source in the same way through the same place at no |
| 420 |
further charge. You need not require recipients to copy the |
| 421 |
Corresponding Source along with the object code. If the place to copy |
| 422 |
the object code is a network server, the Corresponding Source may be |
| 423 |
on a different server (operated by you or a third party) that supports |
| 424 |
equivalent copying facilities, provided you maintain clear directions |
| 425 |
next to the object code saying where to find the Corresponding Source. |
| 426 |
Regardless of what server hosts the Corresponding Source, you remain |
| 427 |
obligated to ensure that it is available for as long as needed to |
| 428 |
satisfy these requirements. |
| 429 |
|
| 430 |
<LI> |
| 431 |
|
| 432 |
Convey the object code using peer-to-peer transmission, provided you |
| 433 |
inform other peers where the object code and Corresponding Source of |
| 434 |
the work are being offered to the general public at no charge under |
| 435 |
subsection 6d. |
| 436 |
|
| 437 |
</OL> |
| 438 |
|
| 439 |
A separable portion of the object code, whose source code is excluded |
| 440 |
from the Corresponding Source as a System Library, need not be |
| 441 |
included in conveying the object code work. |
| 442 |
|
| 443 |
A “User Product” is either (1) a “consumer product”, which means any |
| 444 |
tangible personal property which is normally used for personal, |
| 445 |
family, or household purposes, or (2) anything designed or sold for |
| 446 |
incorporation into a dwelling. In determining whether a product is a |
| 447 |
consumer product, doubtful cases shall be resolved in favor of |
| 448 |
coverage. For a particular product received by a particular user, |
| 449 |
“normally used” refers to a typical or common use of that class of |
| 450 |
product, regardless of the status of the particular user or of the way |
| 451 |
in which the particular user actually uses, or expects or is expected |
| 452 |
to use, the product. A product is a consumer product regardless of |
| 453 |
whether the product has substantial commercial, industrial or |
| 454 |
non-consumer uses, unless such uses represent the only significant |
| 455 |
mode of use of the product. |
| 456 |
|
| 457 |
“Installation Information” for a User Product means any methods, |
| 458 |
procedures, authorization keys, or other information required to |
| 459 |
install and execute modified versions of a covered work in that User |
| 460 |
Product from a modified version of its Corresponding Source. The |
| 461 |
information must suffice to ensure that the continued functioning of |
| 462 |
the modified object code is in no case prevented or interfered with |
| 463 |
solely because modification has been made. |
| 464 |
|
| 465 |
If you convey an object code work under this section in, or with, or |
| 466 |
specifically for use in, a User Product, and the conveying occurs as |
| 467 |
part of a transaction in which the right of possession and use of the |
| 468 |
User Product is transferred to the recipient in perpetuity or for a |
| 469 |
fixed term (regardless of how the transaction is characterized), the |
| 470 |
Corresponding Source conveyed under this section must be accompanied |
| 471 |
by the Installation Information. But this requirement does not apply |
| 472 |
if neither you nor any third party retains the ability to install |
| 473 |
modified object code on the User Product (for example, the work has |
| 474 |
been installed in ROM). |
| 475 |
|
| 476 |
The requirement to provide Installation Information does not include a |
| 477 |
requirement to continue to provide support service, warranty, or |
| 478 |
updates for a work that has been modified or installed by the |
| 479 |
recipient, or for the User Product in which it has been modified or |
| 480 |
installed. Access to a network may be denied when the modification |
| 481 |
itself materially and adversely affects the operation of the network |
| 482 |
or violates the rules and protocols for communication across the |
| 483 |
network. |
| 484 |
|
| 485 |
Corresponding Source conveyed, and Installation Information provided, |
| 486 |
in accord with this section must be in a format that is publicly |
| 487 |
documented (and with an implementation available to the public in |
| 488 |
source code form), and must require no special password or key for |
| 489 |
unpacking, reading or copying. |
| 490 |
|
| 491 |
<LI>Additional Terms. |
| 492 |
|
| 493 |
“Additional permissions” are terms that supplement the terms of this |
| 494 |
License by making exceptions from one or more of its conditions. |
| 495 |
Additional permissions that are applicable to the entire Program shall |
| 496 |
be treated as though they were included in this License, to the extent |
| 497 |
that they are valid under applicable law. If additional permissions |
| 498 |
apply only to part of the Program, that part may be used separately |
| 499 |
under those permissions, but the entire Program remains governed by |
| 500 |
this License without regard to the additional permissions. |
| 501 |
|
| 502 |
When you convey a copy of a covered work, you may at your option |
| 503 |
remove any additional permissions from that copy, or from any part of |
| 504 |
it. (Additional permissions may be written to require their own |
| 505 |
removal in certain cases when you modify the work.) You may place |
| 506 |
additional permissions on material, added by you to a covered work, |
| 507 |
for which you have or can give appropriate copyright permission. |
| 508 |
|
| 509 |
Notwithstanding any other provision of this License, for material you |
| 510 |
add to a covered work, you may (if authorized by the copyright holders |
| 511 |
of that material) supplement the terms of this License with terms: |
| 512 |
|
| 513 |
|
| 514 |
<OL> |
| 515 |
<LI> |
| 516 |
|
| 517 |
Disclaiming warranty or limiting liability differently from the terms |
| 518 |
of sections 15 and 16 of this License; or |
| 519 |
|
| 520 |
<LI> |
| 521 |
|
| 522 |
Requiring preservation of specified reasonable legal notices or author |
| 523 |
attributions in that material or in the Appropriate Legal Notices |
| 524 |
displayed by works containing it; or |
| 525 |
|
| 526 |
<LI> |
| 527 |
|
| 528 |
Prohibiting misrepresentation of the origin of that material, or |
| 529 |
requiring that modified versions of such material be marked in |
| 530 |
reasonable ways as different from the original version; or |
| 531 |
|
| 532 |
<LI> |
| 533 |
|
| 534 |
Limiting the use for publicity purposes of names of licensors or |
| 535 |
authors of the material; or |
| 536 |
|
| 537 |
<LI> |
| 538 |
|
| 539 |
Declining to grant rights under trademark law for use of some trade |
| 540 |
names, trademarks, or service marks; or |
| 541 |
|
| 542 |
<LI> |
| 543 |
|
| 544 |
Requiring indemnification of licensors and authors of that material by |
| 545 |
anyone who conveys the material (or modified versions of it) with |
| 546 |
contractual assumptions of liability to the recipient, for any |
| 547 |
liability that these contractual assumptions directly impose on those |
| 548 |
licensors and authors. |
| 549 |
</OL> |
| 550 |
|
| 551 |
All other non-permissive additional terms are considered “further |
| 552 |
restrictions” within the meaning of section 10. If the Program as you |
| 553 |
received it, or any part of it, contains a notice stating that it is |
| 554 |
governed by this License along with a term that is a further |
| 555 |
restriction, you may remove that term. If a license document contains |
| 556 |
a further restriction but permits relicensing or conveying under this |
| 557 |
License, you may add to a covered work material governed by the terms |
| 558 |
of that license document, provided that the further restriction does |
| 559 |
not survive such relicensing or conveying. |
| 560 |
|
| 561 |
If you add terms to a covered work in accord with this section, you |
| 562 |
must place, in the relevant source files, a statement of the |
| 563 |
additional terms that apply to those files, or a notice indicating |
| 564 |
where to find the applicable terms. |
| 565 |
|
| 566 |
Additional terms, permissive or non-permissive, may be stated in the |
| 567 |
form of a separately written license, or stated as exceptions; the |
| 568 |
above requirements apply either way. |
| 569 |
|
| 570 |
<LI>Termination. |
| 571 |
|
| 572 |
You may not propagate or modify a covered work except as expressly |
| 573 |
provided under this License. Any attempt otherwise to propagate or |
| 574 |
modify it is void, and will automatically terminate your rights under |
| 575 |
this License (including any patent licenses granted under the third |
| 576 |
paragraph of section 11). |
| 577 |
|
| 578 |
However, if you cease all violation of this License, then your license |
| 579 |
from a particular copyright holder is reinstated (a) provisionally, |
| 580 |
unless and until the copyright holder explicitly and finally |
| 581 |
terminates your license, and (b) permanently, if the copyright holder |
| 582 |
fails to notify you of the violation by some reasonable means prior to |
| 583 |
60 days after the cessation. |
| 584 |
|
| 585 |
Moreover, your license from a particular copyright holder is |
| 586 |
reinstated permanently if the copyright holder notifies you of the |
| 587 |
violation by some reasonable means, this is the first time you have |
| 588 |
received notice of violation of this License (for any work) from that |
| 589 |
copyright holder, and you cure the violation prior to 30 days after |
| 590 |
your receipt of the notice. |
| 591 |
|
| 592 |
Termination of your rights under this section does not terminate the |
| 593 |
licenses of parties who have received copies or rights from you under |
| 594 |
this License. If your rights have been terminated and not permanently |
| 595 |
reinstated, you do not qualify to receive new licenses for the same |
| 596 |
material under section 10. |
| 597 |
|
| 598 |
<LI>Acceptance Not Required for Having Copies. |
| 599 |
|
| 600 |
You are not required to accept this License in order to receive or run |
| 601 |
a copy of the Program. Ancillary propagation of a covered work |
| 602 |
occurring solely as a consequence of using peer-to-peer transmission |
| 603 |
to receive a copy likewise does not require acceptance. However, |
| 604 |
nothing other than this License grants you permission to propagate or |
| 605 |
modify any covered work. These actions infringe copyright if you do |
| 606 |
not accept this License. Therefore, by modifying or propagating a |
| 607 |
covered work, you indicate your acceptance of this License to do so. |
| 608 |
|
| 609 |
<LI>Automatic Licensing of Downstream Recipients. |
| 610 |
|
| 611 |
Each time you convey a covered work, the recipient automatically |
| 612 |
receives a license from the original licensors, to run, modify and |
| 613 |
propagate that work, subject to this License. You are not responsible |
| 614 |
for enforcing compliance by third parties with this License. |
| 615 |
|
| 616 |
An “entity transaction” is a transaction transferring control of an |
| 617 |
organization, or substantially all assets of one, or subdividing an |
| 618 |
organization, or merging organizations. If propagation of a covered |
| 619 |
work results from an entity transaction, each party to that |
| 620 |
transaction who receives a copy of the work also receives whatever |
| 621 |
licenses to the work the party's predecessor in interest had or could |
| 622 |
give under the previous paragraph, plus a right to possession of the |
| 623 |
Corresponding Source of the work from the predecessor in interest, if |
| 624 |
the predecessor has it or can get it with reasonable efforts. |
| 625 |
|
| 626 |
You may not impose any further restrictions on the exercise of the |
| 627 |
rights granted or affirmed under this License. For example, you may |
| 628 |
not impose a license fee, royalty, or other charge for exercise of |
| 629 |
rights granted under this License, and you may not initiate litigation |
| 630 |
(including a cross-claim or counterclaim in a lawsuit) alleging that |
| 631 |
any patent claim is infringed by making, using, selling, offering for |
| 632 |
sale, or importing the Program or any portion of it. |
| 633 |
|
| 634 |
<LI>Patents. |
| 635 |
|
| 636 |
A “contributor” is a copyright holder who authorizes use under this |
| 637 |
License of the Program or a work on which the Program is based. The |
| 638 |
work thus licensed is called the contributor's “contributor version”. |
| 639 |
|
| 640 |
A contributor's “essential patent claims” are all patent claims owned |
| 641 |
or controlled by the contributor, whether already acquired or |
| 642 |
hereafter acquired, that would be infringed by some manner, permitted |
| 643 |
by this License, of making, using, or selling its contributor version, |
| 644 |
but do not include claims that would be infringed only as a |
| 645 |
consequence of further modification of the contributor version. For |
| 646 |
purposes of this definition, “control” includes the right to grant |
| 647 |
patent sublicenses in a manner consistent with the requirements of |
| 648 |
this License. |
| 649 |
|
| 650 |
Each contributor grants you a non-exclusive, worldwide, royalty-free |
| 651 |
patent license under the contributor's essential patent claims, to |
| 652 |
make, use, sell, offer for sale, import and otherwise run, modify and |
| 653 |
propagate the contents of its contributor version. |
| 654 |
|
| 655 |
In the following three paragraphs, a “patent license” is any express |
| 656 |
agreement or commitment, however denominated, not to enforce a patent |
| 657 |
(such as an express permission to practice a patent or covenant not to |
| 658 |
sue for patent infringement). To “grant” such a patent license to a |
| 659 |
party means to make such an agreement or commitment not to enforce a |
| 660 |
patent against the party. |
| 661 |
|
| 662 |
If you convey a covered work, knowingly relying on a patent license, |
| 663 |
and the Corresponding Source of the work is not available for anyone |
| 664 |
to copy, free of charge and under the terms of this License, through a |
| 665 |
publicly available network server or other readily accessible means, |
| 666 |
then you must either (1) cause the Corresponding Source to be so |
| 667 |
available, or (2) arrange to deprive yourself of the benefit of the |
| 668 |
patent license for this particular work, or (3) arrange, in a manner |
| 669 |
consistent with the requirements of this License, to extend the patent |
| 670 |
license to downstream recipients. “Knowingly relying” means you have |
| 671 |
actual knowledge that, but for the patent license, your conveying the |
| 672 |
covered work in a country, or your recipient's use of the covered work |
| 673 |
in a country, would infringe one or more identifiable patents in that |
| 674 |
country that you have reason to believe are valid. |
| 675 |
|
| 676 |
If, pursuant to or in connection with a single transaction or |
| 677 |
arrangement, you convey, or propagate by procuring conveyance of, a |
| 678 |
covered work, and grant a patent license to some of the parties |
| 679 |
receiving the covered work authorizing them to use, propagate, modify |
| 680 |
or convey a specific copy of the covered work, then the patent license |
| 681 |
you grant is automatically extended to all recipients of the covered |
| 682 |
work and works based on it. |
| 683 |
|
| 684 |
A patent license is “discriminatory” if it does not include within the |
| 685 |
scope of its coverage, prohibits the exercise of, or is conditioned on |
| 686 |
the non-exercise of one or more of the rights that are specifically |
| 687 |
granted under this License. You may not convey a covered work if you |
| 688 |
are a party to an arrangement with a third party that is in the |
| 689 |
business of distributing software, under which you make payment to the |
| 690 |
third party based on the extent of your activity of conveying the |
| 691 |
work, and under which the third party grants, to any of the parties |
| 692 |
who would receive the covered work from you, a discriminatory patent |
| 693 |
license (a) in connection with copies of the covered work conveyed by |
| 694 |
you (or copies made from those copies), or (b) primarily for and in |
| 695 |
connection with specific products or compilations that contain the |
| 696 |
covered work, unless you entered into that arrangement, or that patent |
| 697 |
license was granted, prior to 28 March 2007. |
| 698 |
|
| 699 |
Nothing in this License shall be construed as excluding or limiting |
| 700 |
any implied license or other defenses to infringement that may |
| 701 |
otherwise be available to you under applicable patent law. |
| 702 |
|
| 703 |
<LI>No Surrender of Others' Freedom. |
| 704 |
|
| 705 |
If conditions are imposed on you (whether by court order, agreement or |
| 706 |
otherwise) that contradict the conditions of this License, they do not |
| 707 |
excuse you from the conditions of this License. If you cannot convey |
| 708 |
a covered work so as to satisfy simultaneously your obligations under |
| 709 |
this License and any other pertinent obligations, then as a |
| 710 |
consequence you may not convey it at all. For example, if you agree |
| 711 |
to terms that obligate you to collect a royalty for further conveying |
| 712 |
from those to whom you convey the Program, the only way you could |
| 713 |
satisfy both those terms and this License would be to refrain entirely |
| 714 |
from conveying the Program. |
| 715 |
|
| 716 |
<LI>Use with the GNU Affero General Public License. |
| 717 |
|
| 718 |
Notwithstanding any other provision of this License, you have |
| 719 |
permission to link or combine any covered work with a work licensed |
| 720 |
under version 3 of the GNU Affero General Public License into a single |
| 721 |
combined work, and to convey the resulting work. The terms of this |
| 722 |
License will continue to apply to the part which is the covered work, |
| 723 |
but the special requirements of the GNU Affero General Public License, |
| 724 |
section 13, concerning interaction through a network will apply to the |
| 725 |
combination as such. |
| 726 |
|
| 727 |
<LI>Revised Versions of this License. |
| 728 |
|
| 729 |
The Free Software Foundation may publish revised and/or new versions |
| 730 |
of the GNU General Public License from time to time. Such new |
| 731 |
versions will be similar in spirit to the present version, but may |
| 732 |
differ in detail to address new problems or concerns. |
| 733 |
|
| 734 |
Each version is given a distinguishing version number. If the Program |
| 735 |
specifies that a certain numbered version of the GNU General Public |
| 736 |
License “or any later version” applies to it, you have the option of |
| 737 |
following the terms and conditions either of that numbered version or |
| 738 |
of any later version published by the Free Software Foundation. If |
| 739 |
the Program does not specify a version number of the GNU General |
| 740 |
Public License, you may choose any version ever published by the Free |
| 741 |
Software Foundation. |
| 742 |
|
| 743 |
If the Program specifies that a proxy can decide which future versions |
| 744 |
of the GNU General Public License can be used, that proxy's public |
| 745 |
statement of acceptance of a version permanently authorizes you to |
| 746 |
choose that version for the Program. |
| 747 |
|
| 748 |
Later license versions may give you additional or different |
| 749 |
permissions. However, no additional obligations are imposed on any |
| 750 |
author or copyright holder as a result of your choosing to follow a |
| 751 |
later version. |
| 752 |
|
| 753 |
<LI>Disclaimer of Warranty. |
| 754 |
|
| 755 |
THERE IS NO WARRANTY FOR THE PROGRAM, TO THE EXTENT PERMITTED BY |
| 756 |
APPLICABLE LAW. EXCEPT WHEN OTHERWISE STATED IN WRITING THE COPYRIGHT |
| 757 |
HOLDERS AND/OR OTHER PARTIES PROVIDE THE PROGRAM “AS IS” WITHOUT |
| 758 |
WARRANTY OF ANY KIND, EITHER EXPRESSED OR IMPLIED, INCLUDING, BUT NOT |
| 759 |
LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR |
| 760 |
A PARTICULAR PURPOSE. THE ENTIRE RISK AS TO THE QUALITY AND |
| 761 |
PERFORMANCE OF THE PROGRAM IS WITH YOU. SHOULD THE PROGRAM PROVE |
| 762 |
DEFECTIVE, YOU ASSUME THE COST OF ALL NECESSARY SERVICING, REPAIR OR |
| 763 |
CORRECTION. |
| 764 |
|
| 765 |
<LI>Limitation of Liability. |
| 766 |
|
| 767 |
IN NO EVENT UNLESS REQUIRED BY APPLICABLE LAW OR AGREED TO IN WRITING |
| 768 |
WILL ANY COPYRIGHT HOLDER, OR ANY OTHER PARTY WHO MODIFIES AND/OR |
| 769 |
CONVEYS THE PROGRAM AS PERMITTED ABOVE, BE LIABLE TO YOU FOR DAMAGES, |
| 770 |
INCLUDING ANY GENERAL, SPECIAL, INCIDENTAL OR CONSEQUENTIAL DAMAGES |
| 771 |
ARISING OUT OF THE USE OR INABILITY TO USE THE PROGRAM (INCLUDING BUT |
| 772 |
NOT LIMITED TO LOSS OF DATA OR DATA BEING RENDERED INACCURATE OR |
| 773 |
LOSSES SUSTAINED BY YOU OR THIRD PARTIES OR A FAILURE OF THE PROGRAM |
| 774 |
TO OPERATE WITH ANY OTHER PROGRAMS), EVEN IF SUCH HOLDER OR OTHER |
| 775 |
PARTY HAS BEEN ADVISED OF THE POSSIBILITY OF SUCH DAMAGES. |
| 776 |
|
| 777 |
<LI>Interpretation of Sections 15 and 16. |
| 778 |
|
| 779 |
If the disclaimer of warranty and limitation of liability provided |
| 780 |
above cannot be given local legal effect according to their terms, |
| 781 |
reviewing courts shall apply local law that most closely approximates |
| 782 |
an absolute waiver of all civil liability in connection with the |
| 783 |
Program, unless a warranty or assumption of liability accompanies a |
| 784 |
copy of the Program in return for a fee. |
| 785 |
|
| 786 |
</OL> |
| 787 |
|
| 788 |
|
| 789 |
<H2>1.2 END OF TERMS AND CONDITIONS</H2> |
| 790 |
|
| 791 |
|
| 792 |
<H2>1.3 How to Apply These Terms to Your New Programs</H2> |
| 793 |
|
| 794 |
<P> |
| 795 |
If you develop a new program, and you want it to be of the greatest |
| 796 |
possible use to the public, the best way to achieve this is to make it |
| 797 |
free software which everyone can redistribute and change under these |
| 798 |
terms. |
| 799 |
|
| 800 |
</P> |
| 801 |
<P> |
| 802 |
To do so, attach the following notices to the program. It is safest |
| 803 |
to attach them to the start of each source file to most effectively |
| 804 |
state the exclusion of warranty; and each file should have at least |
| 805 |
the “copyright” line and a pointer to where the full notice is found. |
| 806 |
|
| 807 |
</P> |
| 808 |
|
| 809 |
<PRE> |
| 810 |
<VAR>one line to give the program's name and a brief idea of what it does.</VAR> |
| 811 |
Copyright (C) <VAR>year</VAR> <VAR>name of author</VAR> |
| 812 |
|
| 813 |
This program is free software: you can redistribute it and/or modify |
| 814 |
it under the terms of the GNU General Public License as published by |
| 815 |
the Free Software Foundation, either version 3 of the License, or (at |
| 816 |
your option) any later version. |
| 817 |
|
| 818 |
This program is distributed in the hope that it will be useful, but |
| 819 |
WITHOUT ANY WARRANTY; without even the implied warranty of |
| 820 |
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU |
| 821 |
General Public License for more details. |
| 822 |
|
| 823 |
You should have received a copy of the GNU General Public License |
| 824 |
along with this program. If not, see <A HREF="http://www.gnu.org/licenses/">http://www.gnu.org/licenses/</A>. |
| 825 |
</PRE> |
| 826 |
|
| 827 |
<P> |
| 828 |
Also add information on how to contact you by electronic and paper mail. |
| 829 |
|
| 830 |
</P> |
| 831 |
<P> |
| 832 |
If the program does terminal interaction, make it output a short |
| 833 |
notice like this when it starts in an interactive mode: |
| 834 |
|
| 835 |
</P> |
| 836 |
|
| 837 |
<PRE> |
| 838 |
<VAR>program</VAR> Copyright (C) <VAR>year</VAR> <VAR>name of author</VAR> |
| 839 |
This program comes with ABSOLUTELY NO WARRANTY; for details type <SAMP>‘show w’</SAMP>. |
| 840 |
This is free software, and you are welcome to redistribute it |
| 841 |
under certain conditions; type <SAMP>‘show c’</SAMP> for details. |
| 842 |
</PRE> |
| 843 |
|
| 844 |
<P> |
| 845 |
The hypothetical commands <SAMP>‘show w’</SAMP> and <SAMP>‘show c’</SAMP> should show |
| 846 |
the appropriate parts of the General Public License. Of course, your |
| 847 |
program's commands might be different; for a GUI interface, you would |
| 848 |
use an “about box”. |
| 849 |
|
| 850 |
</P> |
| 851 |
<P> |
| 852 |
You should also get your employer (if you work as a programmer) or school, |
| 853 |
if any, to sign a “copyright disclaimer” for the program, if necessary. |
| 854 |
For more information on this, and how to apply and follow the GNU GPL, see |
| 855 |
<A HREF="http://www.gnu.org/licenses/">http://www.gnu.org/licenses/</A>. |
| 856 |
|
| 857 |
</P> |
| 858 |
<P> |
| 859 |
The GNU General Public License does not permit incorporating your |
| 860 |
program into proprietary programs. If your program is a subroutine |
| 861 |
library, you may consider it more useful to permit linking proprietary |
| 862 |
applications with the library. If this is what you want to do, use |
| 863 |
the GNU Lesser General Public License instead of this License. But |
| 864 |
first, please read <A HREF="http://www.gnu.org/philosophy/why-not-lgpl.html">http://www.gnu.org/philosophy/why-not-lgpl.html</A>. |
| 865 |
|
| 866 |
</P> |
| 867 |
|
| 868 |
|
| 869 |
<H1><A NAME="SEC2" HREF="gperf.html#TOC2">Contributors to GNU <CODE>gperf</CODE> Utility</A></H1> |
| 870 |
|
| 871 |
|
| 872 |
<UL> |
| 873 |
<LI> |
| 874 |
|
| 875 |
<A NAME="IDX1"></A> |
| 876 |
The GNU <CODE>gperf</CODE> perfect hash function generator utility was |
| 877 |
written in GNU C++ by Douglas C. Schmidt. The general |
| 878 |
idea for the perfect hash function generator was inspired by Keith |
| 879 |
Bostic's algorithm written in C, and distributed to net.sources around |
| 880 |
1984. The current program is a heavily modified, enhanced, and extended |
| 881 |
implementation of Keith's basic idea, created at the University of |
| 882 |
California, Irvine. Bugs, patches, and suggestions should be reported |
| 883 |
to <CODE><[email protected]></CODE>. |
| 884 |
|
| 885 |
<LI> |
| 886 |
|
| 887 |
Special thanks is extended to Michael Tiemann and Doug Lea, for |
| 888 |
providing a useful compiler, and for giving me a forum to exhibit my |
| 889 |
creation. |
| 890 |
|
| 891 |
In addition, Adam de Boor and Nels Olson provided many tips and insights |
| 892 |
that greatly helped improve the quality and functionality of <CODE>gperf</CODE>. |
| 893 |
|
| 894 |
<LI> |
| 895 |
|
| 896 |
Bruno Haible enhanced and optimized the search algorithm. He also rewrote |
| 897 |
the input routines and the output routines for better reliability, and |
| 898 |
added a testsuite. |
| 899 |
</UL> |
| 900 |
|
| 901 |
|
| 902 |
|
| 903 |
<H1><A NAME="SEC3" HREF="gperf.html#TOC3">2 Introduction</A></H1> |
| 904 |
|
| 905 |
<P> |
| 906 |
<CODE>gperf</CODE> is a perfect hash function generator written in C++. It |
| 907 |
transforms an <VAR>n</VAR> element user-specified keyword set <VAR>W</VAR> into a |
| 908 |
perfect hash function <VAR>F</VAR>. <VAR>F</VAR> uniquely maps keywords in |
| 909 |
<VAR>W</VAR> onto the range 0..<VAR>k</VAR>, where <VAR>k</VAR> >= <VAR>n-1</VAR>. If <VAR>k</VAR> |
| 910 |
= <VAR>n-1</VAR> then <VAR>F</VAR> is a <EM>minimal</EM> perfect hash function. |
| 911 |
<CODE>gperf</CODE> generates a 0..<VAR>k</VAR> element static lookup table and a |
| 912 |
pair of C functions. These functions determine whether a given |
| 913 |
character string <VAR>s</VAR> occurs in <VAR>W</VAR>, using at most one probe into |
| 914 |
the lookup table. |
| 915 |
|
| 916 |
</P> |
| 917 |
<P> |
| 918 |
<CODE>gperf</CODE> currently generates the reserved keyword recognizer for |
| 919 |
lexical analyzers in several production and research compilers and |
| 920 |
language processing tools, including GNU C, GNU C++, GNU Java, GNU Pascal, |
| 921 |
GNU Modula 3, and GNU indent. Complete C++ source code for <CODE>gperf</CODE> is |
| 922 |
available from <CODE>https://ftp.gnu.org/pub/gnu/gperf/</CODE>. |
| 923 |
A paper describing <CODE>gperf</CODE>'s design and implementation in greater |
| 924 |
detail is available in the Second USENIX C++ Conference proceedings |
| 925 |
or from <CODE>http://www.cs.wustl.edu/~schmidt/resume.html</CODE>. |
| 926 |
|
| 927 |
</P> |
| 928 |
|
| 929 |
|
| 930 |
<H1><A NAME="SEC4" HREF="gperf.html#TOC4">3 Static search structures and GNU <CODE>gperf</CODE></A></H1> |
| 931 |
<P> |
| 932 |
<A NAME="IDX2"></A> |
| 933 |
|
| 934 |
</P> |
| 935 |
<P> |
| 936 |
A <EM>static search structure</EM> is an Abstract Data Type with certain |
| 937 |
fundamental operations, e.g., <EM>initialize</EM>, <EM>insert</EM>, |
| 938 |
and <EM>retrieve</EM>. Conceptually, all insertions occur before any |
| 939 |
retrievals. In practice, <CODE>gperf</CODE> generates a <EM>static</EM> array |
| 940 |
containing search set keywords and any associated attributes specified |
| 941 |
by the user. Thus, there is essentially no execution-time cost for the |
| 942 |
insertions. It is a useful data structure for representing <EM>static |
| 943 |
search sets</EM>. Static search sets occur frequently in software system |
| 944 |
applications. Typical static search sets include compiler reserved |
| 945 |
words, assembler instruction opcodes, and built-in shell interpreter |
| 946 |
commands. Search set members, called <EM>keywords</EM>, are inserted into |
| 947 |
the structure only once, usually during program initialization, and are |
| 948 |
not generally modified at run-time. |
| 949 |
|
| 950 |
</P> |
| 951 |
<P> |
| 952 |
Numerous static search structure implementations exist, e.g., |
| 953 |
arrays, linked lists, binary search trees, digital search tries, and |
| 954 |
hash tables. Different approaches offer trade-offs between space |
| 955 |
utilization and search time efficiency. For example, an <VAR>n</VAR> element |
| 956 |
sorted array is space efficient, though the average-case time |
| 957 |
complexity for retrieval operations using binary search is |
| 958 |
proportional to log <VAR>n</VAR>. Conversely, hash table implementations |
| 959 |
often locate a table entry in constant time, but typically impose |
| 960 |
additional memory overhead and exhibit poor worst case performance. |
| 961 |
|
| 962 |
</P> |
| 963 |
<P> |
| 964 |
<A NAME="IDX3"></A> |
| 965 |
<EM>Minimal perfect hash functions</EM> provide an optimal solution for a |
| 966 |
particular class of static search sets. A minimal perfect hash |
| 967 |
function is defined by two properties: |
| 968 |
|
| 969 |
</P> |
| 970 |
|
| 971 |
<UL> |
| 972 |
<LI> |
| 973 |
|
| 974 |
It allows keyword recognition in a static search set using at most |
| 975 |
<EM>one</EM> probe into the hash table. This represents the “perfect” |
| 976 |
property. |
| 977 |
<LI> |
| 978 |
|
| 979 |
The actual memory allocated to store the keywords is precisely large |
| 980 |
enough for the keyword set, and <EM>no larger</EM>. This is the |
| 981 |
“minimal” property. |
| 982 |
</UL> |
| 983 |
|
| 984 |
<P> |
| 985 |
For most applications it is far easier to generate <EM>perfect</EM> hash |
| 986 |
functions than <EM>minimal perfect</EM> hash functions. Moreover, |
| 987 |
non-minimal perfect hash functions frequently execute faster than |
| 988 |
minimal ones in practice. This phenomena occurs since searching a |
| 989 |
sparse keyword table increases the probability of locating a “null” |
| 990 |
entry, thereby reducing string comparisons. <CODE>gperf</CODE>'s default |
| 991 |
behavior generates <EM>near-minimal</EM> perfect hash functions for |
| 992 |
keyword sets. However, <CODE>gperf</CODE> provides many options that permit |
| 993 |
user control over the degree of minimality and perfection. |
| 994 |
|
| 995 |
</P> |
| 996 |
<P> |
| 997 |
Static search sets often exhibit relative stability over time. For |
| 998 |
example, Ada's 63 reserved words have remained constant for nearly a |
| 999 |
decade. It is therefore frequently worthwhile to expend concerted |
| 1000 |
effort building an optimal search structure <EM>once</EM>, if it |
| 1001 |
subsequently receives heavy use multiple times. <CODE>gperf</CODE> removes |
| 1002 |
the drudgery associated with constructing time- and space-efficient |
| 1003 |
search structures by hand. It has proven a useful and practical tool |
| 1004 |
for serious programming projects. Output from <CODE>gperf</CODE> is currently |
| 1005 |
used in several production and research compilers, including GNU C, GNU |
| 1006 |
C++, GNU Java, GNU Pascal, and GNU Modula 3. The latter two compilers are |
| 1007 |
not yet part of the official GNU distribution. Each compiler utilizes |
| 1008 |
<CODE>gperf</CODE> to automatically generate static search structures that |
| 1009 |
efficiently identify their respective reserved keywords. |
| 1010 |
|
| 1011 |
</P> |
| 1012 |
|
| 1013 |
|
| 1014 |
<H1><A NAME="SEC5" HREF="gperf.html#TOC5">4 High-Level Description of GNU <CODE>gperf</CODE></A></H1> |
| 1015 |
|
| 1016 |
<P> |
| 1017 |
The perfect hash function generator <CODE>gperf</CODE> reads a set of |
| 1018 |
“keywords” from an input file (or from the standard input by |
| 1019 |
default). It attempts to derive a perfect hashing function that |
| 1020 |
recognizes a member of the <EM>static keyword set</EM> with at most a |
| 1021 |
single probe into the lookup table. If <CODE>gperf</CODE> succeeds in |
| 1022 |
generating such a function it produces a pair of C source code routines |
| 1023 |
that perform hashing and table lookup recognition. All generated C code |
| 1024 |
is directed to the standard output. Command-line options described |
| 1025 |
below allow you to modify the input and output format to <CODE>gperf</CODE>. |
| 1026 |
|
| 1027 |
</P> |
| 1028 |
<P> |
| 1029 |
By default, <CODE>gperf</CODE> attempts to produce time-efficient code, with |
| 1030 |
less emphasis on efficient space utilization. However, several options |
| 1031 |
exist that permit trading-off execution time for storage space and vice |
| 1032 |
versa. In particular, expanding the generated table size produces a |
| 1033 |
sparse search structure, generally yielding faster searches. |
| 1034 |
Conversely, you can direct <CODE>gperf</CODE> to utilize a C <CODE>switch</CODE> |
| 1035 |
statement scheme that minimizes data space storage size. Furthermore, |
| 1036 |
using a C <CODE>switch</CODE> may actually speed up the keyword retrieval time |
| 1037 |
somewhat. Actual results depend on your C compiler, of course. |
| 1038 |
|
| 1039 |
</P> |
| 1040 |
<P> |
| 1041 |
In general, <CODE>gperf</CODE> assigns values to the bytes it is using |
| 1042 |
for hashing until some set of values gives each keyword a unique value. |
| 1043 |
A helpful heuristic is that the larger the hash value range, the easier |
| 1044 |
it is for <CODE>gperf</CODE> to find and generate a perfect hash function. |
| 1045 |
Experimentation is the key to getting the most from <CODE>gperf</CODE>. |
| 1046 |
|
| 1047 |
</P> |
| 1048 |
|
| 1049 |
|
| 1050 |
<H2><A NAME="SEC6" HREF="gperf.html#TOC6">4.1 Input Format to <CODE>gperf</CODE></A></H2> |
| 1051 |
<P> |
| 1052 |
<A NAME="IDX4"></A> |
| 1053 |
<A NAME="IDX5"></A> |
| 1054 |
<A NAME="IDX6"></A> |
| 1055 |
<A NAME="IDX7"></A> |
| 1056 |
You can control the input file format by varying certain command-line |
| 1057 |
arguments, in particular the <SAMP>‘-t’</SAMP> option. The input's appearance |
| 1058 |
is similar to GNU utilities <CODE>flex</CODE> and <CODE>bison</CODE> (or UNIX |
| 1059 |
utilities <CODE>lex</CODE> and <CODE>yacc</CODE>). Here's an outline of the general |
| 1060 |
format: |
| 1061 |
|
| 1062 |
</P> |
| 1063 |
|
| 1064 |
<PRE> |
| 1065 |
declarations |
| 1066 |
%% |
| 1067 |
keywords |
| 1068 |
%% |
| 1069 |
functions |
| 1070 |
</PRE> |
| 1071 |
|
| 1072 |
<P> |
| 1073 |
<EM>Unlike</EM> <CODE>flex</CODE> or <CODE>bison</CODE>, the declarations section and |
| 1074 |
the functions section are optional. The following sections describe the |
| 1075 |
input format for each section. |
| 1076 |
|
| 1077 |
</P> |
| 1078 |
|
| 1079 |
<P> |
| 1080 |
It is possible to omit the declaration section entirely, if the <SAMP>‘-t’</SAMP> |
| 1081 |
option is not given. In this case the input file begins directly with the |
| 1082 |
first keyword line, e.g.: |
| 1083 |
|
| 1084 |
</P> |
| 1085 |
|
| 1086 |
<PRE> |
| 1087 |
january |
| 1088 |
february |
| 1089 |
march |
| 1090 |
april |
| 1091 |
... |
| 1092 |
</PRE> |
| 1093 |
|
| 1094 |
|
| 1095 |
|
| 1096 |
<H3><A NAME="SEC7" HREF="gperf.html#TOC7">4.1.1 Declarations</A></H3> |
| 1097 |
|
| 1098 |
<P> |
| 1099 |
The keyword input file optionally contains a section for including |
| 1100 |
arbitrary C declarations and definitions, <CODE>gperf</CODE> declarations that |
| 1101 |
act like command-line options, as well as for providing a user-supplied |
| 1102 |
<CODE>struct</CODE>. |
| 1103 |
|
| 1104 |
</P> |
| 1105 |
|
| 1106 |
|
| 1107 |
|
| 1108 |
<H4><A NAME="SEC8" HREF="gperf.html#TOC8">4.1.1.1 User-supplied <CODE>struct</CODE></A></H4> |
| 1109 |
|
| 1110 |
<P> |
| 1111 |
If the <SAMP>‘-t’</SAMP> option (or, equivalently, the <SAMP>‘%struct-type’</SAMP> declaration) |
| 1112 |
<EM>is</EM> enabled, you <EM>must</EM> provide a C <CODE>struct</CODE> as the last |
| 1113 |
component in the declaration section from the input file. The first |
| 1114 |
field in this struct must be of type <CODE>char *</CODE> or <CODE>const char *</CODE> |
| 1115 |
if the <SAMP>‘-P’</SAMP> option is not given, or of type <CODE>int</CODE> if the option |
| 1116 |
<SAMP>‘-P’</SAMP> (or, equivalently, the <SAMP>‘%pic’</SAMP> declaration) is enabled. |
| 1117 |
This first field must be called <SAMP>‘name’</SAMP>, although it is possible to modify |
| 1118 |
its name with the <SAMP>‘-K’</SAMP> option (or, equivalently, the |
| 1119 |
<SAMP>‘%define slot-name’</SAMP> declaration) described below. |
| 1120 |
|
| 1121 |
</P> |
| 1122 |
<P> |
| 1123 |
Here is a simple example, using months of the year and their attributes as |
| 1124 |
input: |
| 1125 |
|
| 1126 |
</P> |
| 1127 |
|
| 1128 |
<PRE> |
| 1129 |
struct month { char *name; int number; int days; int leap_days; }; |
| 1130 |
%% |
| 1131 |
january, 1, 31, 31 |
| 1132 |
february, 2, 28, 29 |
| 1133 |
march, 3, 31, 31 |
| 1134 |
april, 4, 30, 30 |
| 1135 |
may, 5, 31, 31 |
| 1136 |
june, 6, 30, 30 |
| 1137 |
july, 7, 31, 31 |
| 1138 |
august, 8, 31, 31 |
| 1139 |
september, 9, 30, 30 |
| 1140 |
october, 10, 31, 31 |
| 1141 |
november, 11, 30, 30 |
| 1142 |
december, 12, 31, 31 |
| 1143 |
</PRE> |
| 1144 |
|
| 1145 |
<P> |
| 1146 |
<A NAME="IDX8"></A> |
| 1147 |
Separating the <CODE>struct</CODE> declaration from the list of keywords and |
| 1148 |
other fields are a pair of consecutive percent signs, <SAMP>‘%%’</SAMP>, |
| 1149 |
appearing left justified in the first column, as in the UNIX utility |
| 1150 |
<CODE>lex</CODE>. |
| 1151 |
|
| 1152 |
</P> |
| 1153 |
<P> |
| 1154 |
If the <CODE>struct</CODE> has already been declared in an include file, it can |
| 1155 |
be mentioned in an abbreviated form, like this: |
| 1156 |
|
| 1157 |
</P> |
| 1158 |
|
| 1159 |
<PRE> |
| 1160 |
struct month; |
| 1161 |
%% |
| 1162 |
january, 1, 31, 31 |
| 1163 |
... |
| 1164 |
</PRE> |
| 1165 |
|
| 1166 |
|
| 1167 |
|
| 1168 |
<H4><A NAME="SEC9" HREF="gperf.html#TOC9">4.1.1.2 Gperf Declarations</A></H4> |
| 1169 |
|
| 1170 |
<P> |
| 1171 |
The declaration section can contain <CODE>gperf</CODE> declarations. They |
| 1172 |
influence the way <CODE>gperf</CODE> works, like command line options do. |
| 1173 |
In fact, every such declaration is equivalent to a command line option. |
| 1174 |
There are three forms of declarations: |
| 1175 |
|
| 1176 |
</P> |
| 1177 |
|
| 1178 |
<OL> |
| 1179 |
<LI> |
| 1180 |
|
| 1181 |
Declarations without argument, like <SAMP>‘%compare-lengths’</SAMP>. |
| 1182 |
|
| 1183 |
<LI> |
| 1184 |
|
| 1185 |
Declarations with an argument, like <SAMP>‘%switch=<VAR>count</VAR>’</SAMP>. |
| 1186 |
|
| 1187 |
<LI> |
| 1188 |
|
| 1189 |
Declarations of names of entities in the output file, like |
| 1190 |
<SAMP>‘%define lookup-function-name <VAR>name</VAR>’</SAMP>. |
| 1191 |
</OL> |
| 1192 |
|
| 1193 |
<P> |
| 1194 |
When a declaration is given both in the input file and as a command line |
| 1195 |
option, the command-line option's value prevails. |
| 1196 |
|
| 1197 |
</P> |
| 1198 |
<P> |
| 1199 |
The following <CODE>gperf</CODE> declarations are available. |
| 1200 |
|
| 1201 |
</P> |
| 1202 |
<DL COMPACT> |
| 1203 |
|
| 1204 |
<DT><SAMP>‘%delimiters=<VAR>delimiter-list</VAR>’</SAMP> |
| 1205 |
<DD> |
| 1206 |
<A NAME="IDX9"></A> |
| 1207 |
Allows you to provide a string containing delimiters used to |
| 1208 |
separate keywords from their attributes. The default is ",". This |
| 1209 |
option is essential if you want to use keywords that have embedded |
| 1210 |
commas or newlines. |
| 1211 |
|
| 1212 |
<DT><SAMP>‘%struct-type’</SAMP> |
| 1213 |
<DD> |
| 1214 |
<A NAME="IDX10"></A> |
| 1215 |
Allows you to include a <CODE>struct</CODE> type declaration for generated |
| 1216 |
code; see above for an example. |
| 1217 |
|
| 1218 |
<DT><SAMP>‘%ignore-case’</SAMP> |
| 1219 |
<DD> |
| 1220 |
<A NAME="IDX11"></A> |
| 1221 |
Consider upper and lower case ASCII characters as equivalent. The string |
| 1222 |
comparison will use a case insignificant character comparison. Note that |
| 1223 |
locale dependent case mappings are ignored. |
| 1224 |
|
| 1225 |
<DT><SAMP>‘%language=<VAR>language-name</VAR>’</SAMP> |
| 1226 |
<DD> |
| 1227 |
<A NAME="IDX12"></A> |
| 1228 |
Instructs <CODE>gperf</CODE> to generate code in the language specified by the |
| 1229 |
option's argument. Languages handled are currently: |
| 1230 |
|
| 1231 |
<DL COMPACT> |
| 1232 |
|
| 1233 |
<DT><SAMP>‘KR-C’</SAMP> |
| 1234 |
<DD> |
| 1235 |
Old-style K&R C. This language is understood by old-style C compilers and |
| 1236 |
ANSI C compilers, but ANSI C compilers may flag warnings (or even errors) |
| 1237 |
because of lacking <SAMP>‘const’</SAMP>. |
| 1238 |
|
| 1239 |
<DT><SAMP>‘C’</SAMP> |
| 1240 |
<DD> |
| 1241 |
Common C. This language is understood by ANSI C compilers, and also by |
| 1242 |
old-style C compilers, provided that you <CODE>#define const</CODE> to empty |
| 1243 |
for compilers which don't know about this keyword. |
| 1244 |
|
| 1245 |
<DT><SAMP>‘ANSI-C’</SAMP> |
| 1246 |
<DD> |
| 1247 |
ANSI C. This language is understood by ANSI C (C89, ISO C90) compilers, |
| 1248 |
ISO C99 compilers, and C++ compilers. |
| 1249 |
|
| 1250 |
<DT><SAMP>‘C++’</SAMP> |
| 1251 |
<DD> |
| 1252 |
C++. This language is understood by C++ compilers. |
| 1253 |
</DL> |
| 1254 |
|
| 1255 |
The default is ANSI-C. |
| 1256 |
|
| 1257 |
<DT><SAMP>‘%define slot-name <VAR>name</VAR>’</SAMP> |
| 1258 |
<DD> |
| 1259 |
<A NAME="IDX13"></A> |
| 1260 |
This declaration is only useful when option <SAMP>‘-t’</SAMP> (or, equivalently, the |
| 1261 |
<SAMP>‘%struct-type’</SAMP> declaration) has been given. |
| 1262 |
By default, the program assumes the structure component identifier for |
| 1263 |
the keyword is <SAMP>‘name’</SAMP>. This option allows an arbitrary choice of |
| 1264 |
identifier for this component, although it still must occur as the first |
| 1265 |
field in your supplied <CODE>struct</CODE>. |
| 1266 |
|
| 1267 |
<DT><SAMP>‘%define initializer-suffix <VAR>initializers</VAR>’</SAMP> |
| 1268 |
<DD> |
| 1269 |
<A NAME="IDX14"></A> |
| 1270 |
This declaration is only useful when option <SAMP>‘-t’</SAMP> (or, equivalently, the |
| 1271 |
<SAMP>‘%struct-type’</SAMP> declaration) has been given. |
| 1272 |
It permits to specify initializers for the structure members following |
| 1273 |
<VAR>slot-name</VAR> in empty hash table entries. The list of initializers |
| 1274 |
should start with a comma. By default, the emitted code will |
| 1275 |
zero-initialize structure members following <VAR>slot-name</VAR>. |
| 1276 |
|
| 1277 |
<DT><SAMP>‘%define hash-function-name <VAR>name</VAR>’</SAMP> |
| 1278 |
<DD> |
| 1279 |
<A NAME="IDX15"></A> |
| 1280 |
Allows you to specify the name for the generated hash function. Default |
| 1281 |
name is <SAMP>‘hash’</SAMP>. This option permits the use of two hash tables in |
| 1282 |
the same file. |
| 1283 |
|
| 1284 |
<DT><SAMP>‘%define lookup-function-name <VAR>name</VAR>’</SAMP> |
| 1285 |
<DD> |
| 1286 |
<A NAME="IDX16"></A> |
| 1287 |
Allows you to specify the name for the generated lookup function. |
| 1288 |
Default name is <SAMP>‘in_word_set’</SAMP>. This option permits multiple |
| 1289 |
generated hash functions to be used in the same application. |
| 1290 |
|
| 1291 |
<DT><SAMP>‘%define class-name <VAR>name</VAR>’</SAMP> |
| 1292 |
<DD> |
| 1293 |
<A NAME="IDX17"></A> |
| 1294 |
This option is only useful when option <SAMP>‘-L C++’</SAMP> (or, equivalently, |
| 1295 |
the <SAMP>‘%language=C++’</SAMP> declaration) has been given. It |
| 1296 |
allows you to specify the name of generated C++ class. Default name is |
| 1297 |
<CODE>Perfect_Hash</CODE>. |
| 1298 |
|
| 1299 |
<DT><SAMP>‘%7bit’</SAMP> |
| 1300 |
<DD> |
| 1301 |
<A NAME="IDX18"></A> |
| 1302 |
This option specifies that all strings that will be passed as arguments |
| 1303 |
to the generated hash function and the generated lookup function will |
| 1304 |
solely consist of 7-bit ASCII characters (bytes in the range 0..127). |
| 1305 |
(Note that the ANSI C functions <CODE>isalnum</CODE> and <CODE>isgraph</CODE> do |
| 1306 |
<EM>not</EM> guarantee that a byte is in this range. Only an explicit |
| 1307 |
test like <SAMP>‘c >= 'A' && c <= 'Z'’</SAMP> guarantees this.) |
| 1308 |
|
| 1309 |
<DT><SAMP>‘%compare-lengths’</SAMP> |
| 1310 |
<DD> |
| 1311 |
<A NAME="IDX19"></A> |
| 1312 |
Compare keyword lengths before trying a string comparison. This option |
| 1313 |
is mandatory for binary comparisons (see section <A HREF="gperf.html#SEC15">4.3 Use of NUL bytes</A>). It also might |
| 1314 |
cut down on the number of string comparisons made during the lookup, since |
| 1315 |
keywords with different lengths are never compared via <CODE>strcmp</CODE>. |
| 1316 |
However, using <SAMP>‘%compare-lengths’</SAMP> might greatly increase the size of the |
| 1317 |
generated C code if the lookup table range is large (which implies that |
| 1318 |
the switch option <SAMP>‘-S’</SAMP> or <SAMP>‘%switch’</SAMP> is not enabled), since the length |
| 1319 |
table contains as many elements as there are entries in the lookup table. |
| 1320 |
|
| 1321 |
<DT><SAMP>‘%compare-strncmp’</SAMP> |
| 1322 |
<DD> |
| 1323 |
<A NAME="IDX20"></A> |
| 1324 |
Generates C code that uses the <CODE>strncmp</CODE> function to perform |
| 1325 |
string comparisons. The default action is to use <CODE>strcmp</CODE>. |
| 1326 |
|
| 1327 |
<DT><SAMP>‘%readonly-tables’</SAMP> |
| 1328 |
<DD> |
| 1329 |
<A NAME="IDX21"></A> |
| 1330 |
Makes the contents of all generated lookup tables constant, i.e., |
| 1331 |
“readonly”. Many compilers can generate more efficient code for this |
| 1332 |
by putting the tables in readonly memory. |
| 1333 |
|
| 1334 |
<DT><SAMP>‘%enum’</SAMP> |
| 1335 |
<DD> |
| 1336 |
<A NAME="IDX22"></A> |
| 1337 |
Define constant values using an enum local to the lookup function rather |
| 1338 |
than with #defines. This also means that different lookup functions can |
| 1339 |
reside in the same file. Thanks to James Clark <CODE><[email protected]></CODE>. |
| 1340 |
|
| 1341 |
<DT><SAMP>‘%includes’</SAMP> |
| 1342 |
<DD> |
| 1343 |
<A NAME="IDX23"></A> |
| 1344 |
Include the necessary system include file, <CODE><string.h></CODE>, at the |
| 1345 |
beginning of the code. By default, this is not done; the user must |
| 1346 |
include this header file himself to allow compilation of the code. |
| 1347 |
|
| 1348 |
<DT><SAMP>‘%global-table’</SAMP> |
| 1349 |
<DD> |
| 1350 |
<A NAME="IDX24"></A> |
| 1351 |
Generate the static table of keywords as a static global variable, |
| 1352 |
rather than hiding it inside of the lookup function (which is the |
| 1353 |
default behavior). |
| 1354 |
|
| 1355 |
<DT><SAMP>‘%pic’</SAMP> |
| 1356 |
<DD> |
| 1357 |
<A NAME="IDX25"></A> |
| 1358 |
Optimize the generated table for inclusion in shared libraries. This |
| 1359 |
reduces the startup time of programs using a shared library containing |
| 1360 |
the generated code. If the <SAMP>‘%struct-type’</SAMP> declaration (or, |
| 1361 |
equivalently, the option <SAMP>‘-t’</SAMP>) is also given, the first field of the |
| 1362 |
user-defined struct must be of type <SAMP>‘int’</SAMP>, not <SAMP>‘char *’</SAMP>, because |
| 1363 |
it will contain offsets into the string pool instead of actual strings. |
| 1364 |
To convert such an offset to a string, you can use the expression |
| 1365 |
<SAMP>‘stringpool + <VAR>o</VAR>’</SAMP>, where <VAR>o</VAR> is the offset. The string pool |
| 1366 |
name can be changed through the <SAMP>‘%define string-pool-name’</SAMP> declaration. |
| 1367 |
|
| 1368 |
<DT><SAMP>‘%define string-pool-name <VAR>name</VAR>’</SAMP> |
| 1369 |
<DD> |
| 1370 |
<A NAME="IDX26"></A> |
| 1371 |
Allows you to specify the name of the generated string pool created by |
| 1372 |
the declaration <SAMP>‘%pic’</SAMP> (or, equivalently, the option <SAMP>‘-P’</SAMP>). |
| 1373 |
The default name is <SAMP>‘stringpool’</SAMP>. This declaration permits the use of |
| 1374 |
two hash tables in the same file, with <SAMP>‘%pic’</SAMP> and even when the |
| 1375 |
<SAMP>‘%global-table’</SAMP> declaration (or, equivalently, the option <SAMP>‘-G’</SAMP>) |
| 1376 |
is given. |
| 1377 |
|
| 1378 |
<DT><SAMP>‘%null-strings’</SAMP> |
| 1379 |
<DD> |
| 1380 |
<A NAME="IDX27"></A> |
| 1381 |
Use NULL strings instead of empty strings for empty keyword table entries. |
| 1382 |
This reduces the startup time of programs using a shared library containing |
| 1383 |
the generated code (but not as much as the declaration <SAMP>‘%pic’</SAMP>), at the |
| 1384 |
expense of one more test-and-branch instruction at run time. |
| 1385 |
|
| 1386 |
<DT><SAMP>‘%define constants-prefix <VAR>prefix</VAR>’</SAMP> |
| 1387 |
<DD> |
| 1388 |
<A NAME="IDX28"></A> |
| 1389 |
Allows you to specify a prefix for the constants <CODE>TOTAL_KEYWORDS</CODE>, |
| 1390 |
<CODE>MIN_WORD_LENGTH</CODE>, <CODE>MAX_WORD_LENGTH</CODE>, and so on. This option |
| 1391 |
permits the use of two hash tables in the same file, even when the option |
| 1392 |
<SAMP>‘-E’</SAMP> (or, equivalently, the <SAMP>‘%enum’</SAMP> declaration) is not given or |
| 1393 |
the option <SAMP>‘-G’</SAMP> (or, equivalently, the <SAMP>‘%global-table’</SAMP> declaration) |
| 1394 |
is given. |
| 1395 |
|
| 1396 |
<DT><SAMP>‘%define word-array-name <VAR>name</VAR>’</SAMP> |
| 1397 |
<DD> |
| 1398 |
<A NAME="IDX29"></A> |
| 1399 |
Allows you to specify the name for the generated array containing the |
| 1400 |
hash table. Default name is <SAMP>‘wordlist’</SAMP>. This option permits the |
| 1401 |
use of two hash tables in the same file, even when the option <SAMP>‘-G’</SAMP> |
| 1402 |
(or, equivalently, the <SAMP>‘%global-table’</SAMP> declaration) is given. |
| 1403 |
|
| 1404 |
<DT><SAMP>‘%define length-table-name <VAR>name</VAR>’</SAMP> |
| 1405 |
<DD> |
| 1406 |
<A NAME="IDX30"></A> |
| 1407 |
Allows you to specify the name for the generated array containing the |
| 1408 |
length table. Default name is <SAMP>‘lengthtable’</SAMP>. This option permits the |
| 1409 |
use of two length tables in the same file, even when the option <SAMP>‘-G’</SAMP> |
| 1410 |
(or, equivalently, the <SAMP>‘%global-table’</SAMP> declaration) is given. |
| 1411 |
|
| 1412 |
<DT><SAMP>‘%switch=<VAR>count</VAR>’</SAMP> |
| 1413 |
<DD> |
| 1414 |
<A NAME="IDX31"></A> |
| 1415 |
Causes the generated C code to use a <CODE>switch</CODE> statement scheme, |
| 1416 |
rather than an array lookup table. This can lead to a reduction in both |
| 1417 |
time and space requirements for some input files. The argument to this |
| 1418 |
option determines how many <CODE>switch</CODE> statements are generated. A |
| 1419 |
value of 1 generates 1 <CODE>switch</CODE> containing all the elements, a |
| 1420 |
value of 2 generates 2 tables with 1/2 the elements in each |
| 1421 |
<CODE>switch</CODE>, etc. This is useful since many C compilers cannot |
| 1422 |
correctly generate code for large <CODE>switch</CODE> statements. This option |
| 1423 |
was inspired in part by Keith Bostic's original C program. |
| 1424 |
|
| 1425 |
<DT><SAMP>‘%omit-struct-type’</SAMP> |
| 1426 |
<DD> |
| 1427 |
<A NAME="IDX32"></A> |
| 1428 |
Prevents the transfer of the type declaration to the output file. Use |
| 1429 |
this option if the type is already defined elsewhere. |
| 1430 |
</DL> |
| 1431 |
|
| 1432 |
|
| 1433 |
|
| 1434 |
<H4><A NAME="SEC10" HREF="gperf.html#TOC10">4.1.1.3 C Code Inclusion</A></H4> |
| 1435 |
|
| 1436 |
<P> |
| 1437 |
<A NAME="IDX33"></A> |
| 1438 |
<A NAME="IDX34"></A> |
| 1439 |
Using a syntax similar to GNU utilities <CODE>flex</CODE> and <CODE>bison</CODE>, it |
| 1440 |
is possible to directly include C source text and comments verbatim into |
| 1441 |
the generated output file. This is accomplished by enclosing the region |
| 1442 |
inside left-justified surrounding <SAMP>‘%{’</SAMP>, <SAMP>‘%}’</SAMP> pairs. Here is |
| 1443 |
an input fragment based on the previous example that illustrates this |
| 1444 |
feature: |
| 1445 |
|
| 1446 |
</P> |
| 1447 |
|
| 1448 |
<PRE> |
| 1449 |
%{ |
| 1450 |
#include <assert.h> |
| 1451 |
/* This section of code is inserted directly into the output. */ |
| 1452 |
int return_month_days (struct month *months, int is_leap_year); |
| 1453 |
%} |
| 1454 |
struct month { char *name; int number; int days; int leap_days; }; |
| 1455 |
%% |
| 1456 |
january, 1, 31, 31 |
| 1457 |
february, 2, 28, 29 |
| 1458 |
march, 3, 31, 31 |
| 1459 |
... |
| 1460 |
</PRE> |
| 1461 |
|
| 1462 |
|
| 1463 |
|
| 1464 |
<H3><A NAME="SEC11" HREF="gperf.html#TOC11">4.1.2 Format for Keyword Entries</A></H3> |
| 1465 |
|
| 1466 |
<P> |
| 1467 |
The second input file format section contains lines of keywords and any |
| 1468 |
associated attributes you might supply. A line beginning with <SAMP>‘#’</SAMP> |
| 1469 |
in the first column is considered a comment. Everything following the |
| 1470 |
<SAMP>‘#’</SAMP> is ignored, up to and including the following newline. A line |
| 1471 |
beginning with <SAMP>‘%’</SAMP> in the first column is an option declaration and |
| 1472 |
must not occur within the keywords section. |
| 1473 |
|
| 1474 |
</P> |
| 1475 |
<P> |
| 1476 |
The first field of each non-comment line is always the keyword itself. It |
| 1477 |
can be given in two ways: as a simple name, i.e., without surrounding |
| 1478 |
string quotation marks, or as a string enclosed in double-quotes, in |
| 1479 |
C syntax, possibly with backslash escapes like <CODE>\"</CODE> or <CODE>\234</CODE> |
| 1480 |
or <CODE>\xa8</CODE>. In either case, it must start right at the beginning |
| 1481 |
of the line, without leading whitespace. |
| 1482 |
In this context, a “field” is considered to extend up to, but |
| 1483 |
not include, the first blank, comma, or newline. Here is a simple |
| 1484 |
example taken from a partial list of C reserved words: |
| 1485 |
|
| 1486 |
</P> |
| 1487 |
|
| 1488 |
<PRE> |
| 1489 |
# These are a few C reserved words, see the c.gperf file |
| 1490 |
# for a complete list of ANSI C reserved words. |
| 1491 |
unsigned |
| 1492 |
sizeof |
| 1493 |
switch |
| 1494 |
signed |
| 1495 |
if |
| 1496 |
default |
| 1497 |
for |
| 1498 |
while |
| 1499 |
return |
| 1500 |
</PRE> |
| 1501 |
|
| 1502 |
<P> |
| 1503 |
Note that unlike <CODE>flex</CODE> or <CODE>bison</CODE> the first <SAMP>‘%%’</SAMP> marker |
| 1504 |
may be elided if the declaration section is empty. |
| 1505 |
|
| 1506 |
</P> |
| 1507 |
<P> |
| 1508 |
Additional fields may optionally follow the leading keyword. Fields |
| 1509 |
should be separated by commas, and terminate at the end of line. What |
| 1510 |
these fields mean is entirely up to you; they are used to initialize the |
| 1511 |
elements of the user-defined <CODE>struct</CODE> provided by you in the |
| 1512 |
declaration section. If the <SAMP>‘-t’</SAMP> option (or, equivalently, the |
| 1513 |
<SAMP>‘%struct-type’</SAMP> declaration) is <EM>not</EM> enabled |
| 1514 |
these fields are simply ignored. All previous examples except the last |
| 1515 |
one contain keyword attributes. |
| 1516 |
|
| 1517 |
</P> |
| 1518 |
|
| 1519 |
|
| 1520 |
<H3><A NAME="SEC12" HREF="gperf.html#TOC12">4.1.3 Including Additional C Functions</A></H3> |
| 1521 |
|
| 1522 |
<P> |
| 1523 |
The optional third section also corresponds closely with conventions |
| 1524 |
found in <CODE>flex</CODE> and <CODE>bison</CODE>. All text in this section, |
| 1525 |
starting at the final <SAMP>‘%%’</SAMP> and extending to the end of the input |
| 1526 |
file, is included verbatim into the generated output file. Naturally, |
| 1527 |
it is your responsibility to ensure that the code contained in this |
| 1528 |
section is valid C. |
| 1529 |
|
| 1530 |
</P> |
| 1531 |
|
| 1532 |
|
| 1533 |
<H3><A NAME="SEC13" HREF="gperf.html#TOC13">4.1.4 Where to place directives for GNU <CODE>indent</CODE>.</A></H3> |
| 1534 |
|
| 1535 |
<P> |
| 1536 |
If you want to invoke GNU <CODE>indent</CODE> on a <CODE>gperf</CODE> input file, |
| 1537 |
you will see that GNU <CODE>indent</CODE> doesn't understand the <SAMP>‘%%’</SAMP>, |
| 1538 |
<SAMP>‘%{’</SAMP> and <SAMP>‘%}’</SAMP> directives that control <CODE>gperf</CODE>'s |
| 1539 |
interpretation of the input file. Therefore you have to insert some |
| 1540 |
directives for GNU <CODE>indent</CODE>. More precisely, assuming the most |
| 1541 |
general input file structure |
| 1542 |
|
| 1543 |
</P> |
| 1544 |
|
| 1545 |
<PRE> |
| 1546 |
declarations part 1 |
| 1547 |
%{ |
| 1548 |
verbatim code |
| 1549 |
%} |
| 1550 |
declarations part 2 |
| 1551 |
%% |
| 1552 |
keywords |
| 1553 |
%% |
| 1554 |
functions |
| 1555 |
</PRE> |
| 1556 |
|
| 1557 |
<P> |
| 1558 |
you would insert <SAMP>‘*INDENT-OFF*’</SAMP> and <SAMP>‘*INDENT-ON*’</SAMP> comments |
| 1559 |
as follows: |
| 1560 |
|
| 1561 |
</P> |
| 1562 |
|
| 1563 |
<PRE> |
| 1564 |
/* *INDENT-OFF* */ |
| 1565 |
declarations part 1 |
| 1566 |
%{ |
| 1567 |
/* *INDENT-ON* */ |
| 1568 |
verbatim code |
| 1569 |
/* *INDENT-OFF* */ |
| 1570 |
%} |
| 1571 |
declarations part 2 |
| 1572 |
%% |
| 1573 |
keywords |
| 1574 |
%% |
| 1575 |
/* *INDENT-ON* */ |
| 1576 |
functions |
| 1577 |
</PRE> |
| 1578 |
|
| 1579 |
|
| 1580 |
|
| 1581 |
<H2><A NAME="SEC14" HREF="gperf.html#TOC14">4.2 Output Format for Generated C Code with <CODE>gperf</CODE></A></H2> |
| 1582 |
<P> |
| 1583 |
<A NAME="IDX35"></A> |
| 1584 |
|
| 1585 |
</P> |
| 1586 |
<P> |
| 1587 |
Several options control how the generated C code appears on the standard |
| 1588 |
output. Two C functions are generated. They are called <CODE>hash</CODE> and |
| 1589 |
<CODE>in_word_set</CODE>, although you may modify their names with a command-line |
| 1590 |
option. Both functions require two arguments, a string, <CODE>char *</CODE> |
| 1591 |
<VAR>str</VAR>, and a length parameter, <CODE>int</CODE> <VAR>len</VAR>. Their default |
| 1592 |
function prototypes are as follows: |
| 1593 |
|
| 1594 |
</P> |
| 1595 |
<P> |
| 1596 |
<DL> |
| 1597 |
<DT><U>Function:</U> unsigned int <B>hash</B> <I>(const char * <VAR>str</VAR>, size_t <VAR>len</VAR>)</I> |
| 1598 |
<DD><A NAME="IDX36"></A> |
| 1599 |
By default, the generated <CODE>hash</CODE> function returns an integer value |
| 1600 |
created by adding <VAR>len</VAR> to several user-specified <VAR>str</VAR> byte |
| 1601 |
positions indexed into an <EM>associated values</EM> table stored in a |
| 1602 |
local static array. The associated values table is constructed |
| 1603 |
internally by <CODE>gperf</CODE> and later output as a static local C array |
| 1604 |
called <SAMP>‘hash_table’</SAMP>. The relevant selected positions (i.e. indices |
| 1605 |
into <VAR>str</VAR>) are specified via the <SAMP>‘-k’</SAMP> option when running |
| 1606 |
<CODE>gperf</CODE>, as detailed in the <EM>Options</EM> section below (see section <A HREF="gperf.html#SEC18">5 Invoking <CODE>gperf</CODE></A>). |
| 1607 |
</DL> |
| 1608 |
|
| 1609 |
</P> |
| 1610 |
<P> |
| 1611 |
<DL> |
| 1612 |
<DT><U>Function:</U> <B>in_word_set</B> <I>(const char * <VAR>str</VAR>, size_t <VAR>len</VAR>)</I> |
| 1613 |
<DD><A NAME="IDX37"></A> |
| 1614 |
If <VAR>str</VAR> is in the keyword set, returns a pointer to that |
| 1615 |
keyword. More exactly, if the option <SAMP>‘-t’</SAMP> (or, equivalently, the |
| 1616 |
<SAMP>‘%struct-type’</SAMP> declaration) was given, it returns |
| 1617 |
a pointer to the matching keyword's structure. Otherwise it returns |
| 1618 |
<CODE>NULL</CODE>. |
| 1619 |
</DL> |
| 1620 |
|
| 1621 |
</P> |
| 1622 |
<P> |
| 1623 |
If the option <SAMP>‘-c’</SAMP> (or, equivalently, the <SAMP>‘%compare-strncmp’</SAMP> |
| 1624 |
declaration) is not used, <VAR>str</VAR> must be a NUL terminated |
| 1625 |
string of exactly length <VAR>len</VAR>. If <SAMP>‘-c’</SAMP> (or, equivalently, the |
| 1626 |
<SAMP>‘%compare-strncmp’</SAMP> declaration) is used, <VAR>str</VAR> must |
| 1627 |
simply be an array of <VAR>len</VAR> bytes and does not need to be NUL |
| 1628 |
terminated. |
| 1629 |
|
| 1630 |
</P> |
| 1631 |
<P> |
| 1632 |
The code generated for these two functions is affected by the following |
| 1633 |
options: |
| 1634 |
|
| 1635 |
</P> |
| 1636 |
<DL COMPACT> |
| 1637 |
|
| 1638 |
<DT><SAMP>‘-t’</SAMP> |
| 1639 |
<DD> |
| 1640 |
<DT><SAMP>‘--struct-type’</SAMP> |
| 1641 |
<DD> |
| 1642 |
Make use of the user-defined <CODE>struct</CODE>. |
| 1643 |
|
| 1644 |
<DT><SAMP>‘-S <VAR>total-switch-statements</VAR>’</SAMP> |
| 1645 |
<DD> |
| 1646 |
<DT><SAMP>‘--switch=<VAR>total-switch-statements</VAR>’</SAMP> |
| 1647 |
<DD> |
| 1648 |
<A NAME="IDX38"></A> |
| 1649 |
Generate 1 or more C <CODE>switch</CODE> statement rather than use a large, |
| 1650 |
(and potentially sparse) static array. Although the exact time and |
| 1651 |
space savings of this approach vary according to your C compiler's |
| 1652 |
degree of optimization, this method often results in smaller and faster |
| 1653 |
code. |
| 1654 |
</DL> |
| 1655 |
|
| 1656 |
<P> |
| 1657 |
If the <SAMP>‘-t’</SAMP> and <SAMP>‘-S’</SAMP> options (or, equivalently, the |
| 1658 |
<SAMP>‘%struct-type’</SAMP> and <SAMP>‘%switch’</SAMP> declarations) are omitted, the default |
| 1659 |
action |
| 1660 |
is to generate a <CODE>char *</CODE> array containing the keywords, together with |
| 1661 |
additional empty strings used for padding the array. By experimenting |
| 1662 |
with the various input and output options, and timing the resulting C |
| 1663 |
code, you can determine the best option choices for different keyword |
| 1664 |
set characteristics. |
| 1665 |
|
| 1666 |
</P> |
| 1667 |
|
| 1668 |
|
| 1669 |
<H2><A NAME="SEC15" HREF="gperf.html#TOC15">4.3 Use of NUL bytes</A></H2> |
| 1670 |
<P> |
| 1671 |
<A NAME="IDX39"></A> |
| 1672 |
|
| 1673 |
</P> |
| 1674 |
<P> |
| 1675 |
By default, the code generated by <CODE>gperf</CODE> operates on zero |
| 1676 |
terminated strings, the usual representation of strings in C. This means |
| 1677 |
that the keywords in the input file must not contain NUL bytes, |
| 1678 |
and the <VAR>str</VAR> argument passed to <CODE>hash</CODE> or <CODE>in_word_set</CODE> |
| 1679 |
must be NUL terminated and have exactly length <VAR>len</VAR>. |
| 1680 |
|
| 1681 |
</P> |
| 1682 |
<P> |
| 1683 |
If option <SAMP>‘-c’</SAMP> (or, equivalently, the <SAMP>‘%compare-strncmp’</SAMP> |
| 1684 |
declaration) is used, then the <VAR>str</VAR> argument does not need |
| 1685 |
to be NUL terminated. The code generated by <CODE>gperf</CODE> will only |
| 1686 |
access the first <VAR>len</VAR>, not <VAR>len+1</VAR>, bytes starting at <VAR>str</VAR>. |
| 1687 |
However, the keywords in the input file still must not contain NUL |
| 1688 |
bytes. |
| 1689 |
|
| 1690 |
</P> |
| 1691 |
<P> |
| 1692 |
If option <SAMP>‘-l’</SAMP> (or, equivalently, the <SAMP>‘%compare-lengths’</SAMP> |
| 1693 |
declaration) is used, then the hash table performs binary |
| 1694 |
comparison. The keywords in the input file may contain NUL bytes, |
| 1695 |
written in string syntax as <CODE>\000</CODE> or <CODE>\x00</CODE>, and the code |
| 1696 |
generated by <CODE>gperf</CODE> will treat NUL like any other byte. |
| 1697 |
Also, in this case the <SAMP>‘-c’</SAMP> option (or, equivalently, the |
| 1698 |
<SAMP>‘%compare-strncmp’</SAMP> declaration) is ignored. |
| 1699 |
|
| 1700 |
</P> |
| 1701 |
|
| 1702 |
|
| 1703 |
<H2><A NAME="SEC16" HREF="gperf.html#TOC16">4.4 Controlling Identifiers</A></H2> |
| 1704 |
|
| 1705 |
<P> |
| 1706 |
The identifiers of the functions, tables, and constants defined by the code |
| 1707 |
generated by <CODE>gperf</CODE> can be controlled through <CODE>gperf</CODE> declarations |
| 1708 |
or the equivalent command-line options. This is useful for three purposes: |
| 1709 |
|
| 1710 |
</P> |
| 1711 |
|
| 1712 |
<UL> |
| 1713 |
<LI> |
| 1714 |
|
| 1715 |
Esthetics of the generated code. |
| 1716 |
|
| 1717 |
For this purpose, just use the available declarations or options at will. |
| 1718 |
|
| 1719 |
<LI> |
| 1720 |
|
| 1721 |
Controlling the exported identifiers of a library. |
| 1722 |
|
| 1723 |
Assume you include code generated by <CODE>gperf</CODE> in a library, and to |
| 1724 |
avoid collisions with other libraries, you want to ensure that all exported |
| 1725 |
identifiers of this library start with a certain prefix. |
| 1726 |
|
| 1727 |
By default, the only exported identifier is the lookup function. You can |
| 1728 |
therefore use the option <SAMP>‘-N’</SAMP> (or, equivalently, the |
| 1729 |
<SAMP>‘%define lookup-function-name’</SAMP> declaration). |
| 1730 |
|
| 1731 |
When you use the option <SAMP>‘-L C++’</SAMP> (or, equivalently, the |
| 1732 |
<SAMP>‘%language=C++’</SAMP> declaration), the only exported entity is a class. |
| 1733 |
You control its name through the option <SAMP>‘-Z’</SAMP> (or, equivalently, the |
| 1734 |
<SAMP>‘%define class-name’</SAMP> declaration). |
| 1735 |
|
| 1736 |
<LI> |
| 1737 |
|
| 1738 |
Allowing multiple <CODE>gperf</CODE> generated codes in a single compilation unit. |
| 1739 |
|
| 1740 |
Assume you invoke <CODE>gperf</CODE> multiple times, with different input files, |
| 1741 |
and want the generated code to be included from the same source file. In this |
| 1742 |
case, you have to customize not only the exported identifiers, but also the |
| 1743 |
names of functions with <SAMP>‘static’</SAMP> scope, types, and constants. |
| 1744 |
|
| 1745 |
By default, you will have to deal with the lookup function, the hash |
| 1746 |
function, and the constants. You should therefore use the option <SAMP>‘-N’</SAMP> |
| 1747 |
(or, equivalently, the <SAMP>‘%define lookup-function-name’</SAMP> declaration), |
| 1748 |
the option <SAMP>‘-H’</SAMP> (or, equivalently, the |
| 1749 |
<SAMP>‘%define hash-function-name’</SAMP> declaration), and the option |
| 1750 |
<SAMP>‘--constants-prefix’</SAMP> (or, equivalently, the |
| 1751 |
<SAMP>‘%define constants-prefix’</SAMP> declaration). |
| 1752 |
|
| 1753 |
If you use the option <SAMP>‘-G’</SAMP> (or, equivalently, the <SAMP>‘%global-table’</SAMP> |
| 1754 |
declaration), you will also have to deal with the word array, the length |
| 1755 |
table if present, and the string pool if present. This means: You should |
| 1756 |
use the option <SAMP>‘-W’</SAMP> (or, equivalently, the |
| 1757 |
<SAMP>‘%define word-array-name’</SAMP> declaration). If you use the option |
| 1758 |
<SAMP>‘-l’</SAMP> (or, equivalently, the <SAMP>‘%compare-lengths’</SAMP> declaration), you |
| 1759 |
should use the option <SAMP>‘--length-table-name’</SAMP> (or, equivalently, the |
| 1760 |
<SAMP>‘%define length-table-name’</SAMP> declaration). If you use the option |
| 1761 |
<SAMP>‘-P’</SAMP> (or, equivalently, the <SAMP>‘%pic’</SAMP> declaration), you should use |
| 1762 |
the option <SAMP>‘-Q’</SAMP> (or, equivalently, the <SAMP>‘%define string-pool-name’</SAMP> |
| 1763 |
declaration). |
| 1764 |
</UL> |
| 1765 |
|
| 1766 |
|
| 1767 |
|
| 1768 |
<H2><A NAME="SEC17" HREF="gperf.html#TOC17">4.5 The Copyright of the Output</A></H2> |
| 1769 |
<P> |
| 1770 |
<A NAME="IDX40"></A> |
| 1771 |
|
| 1772 |
</P> |
| 1773 |
<P> |
| 1774 |
<CODE>gperf</CODE> is under GPL, but that does not cause the output produced |
| 1775 |
by <CODE>gperf</CODE> to be under GPL. The reason is that the output contains |
| 1776 |
only small pieces of text that come directly from <CODE>gperf</CODE>'s source |
| 1777 |
code -- only about 7 lines long, too small for being significant --, and |
| 1778 |
therefore the output is not a “work based on <CODE>gperf</CODE>” (in the |
| 1779 |
sense of the GPL version 3). |
| 1780 |
|
| 1781 |
</P> |
| 1782 |
<P> |
| 1783 |
On the other hand, the output produced by <CODE>gperf</CODE> contains |
| 1784 |
essentially all of the input file. Therefore the output is a |
| 1785 |
“derivative work” of the input (in the sense of U.S. copyright law); |
| 1786 |
and its copyright status depends on the copyright of the input. For most |
| 1787 |
software licenses, the result is that the output is under the same |
| 1788 |
license, with the same copyright holder, as the input that was passed to |
| 1789 |
<CODE>gperf</CODE>. |
| 1790 |
|
| 1791 |
</P> |
| 1792 |
|
| 1793 |
|
| 1794 |
<H1><A NAME="SEC18" HREF="gperf.html#TOC18">5 Invoking <CODE>gperf</CODE></A></H1> |
| 1795 |
|
| 1796 |
<P> |
| 1797 |
There are <EM>many</EM> options to <CODE>gperf</CODE>. They were added to make |
| 1798 |
the program more convenient for use with real applications. “On-line” |
| 1799 |
help is readily available via the <SAMP>‘--help’</SAMP> option. Here is the |
| 1800 |
complete list of options. |
| 1801 |
|
| 1802 |
</P> |
| 1803 |
|
| 1804 |
|
| 1805 |
|
| 1806 |
<H2><A NAME="SEC19" HREF="gperf.html#TOC19">5.1 Specifying the Location of the Output File</A></H2> |
| 1807 |
|
| 1808 |
<DL COMPACT> |
| 1809 |
|
| 1810 |
<DT><SAMP>‘--output-file=<VAR>file</VAR>’</SAMP> |
| 1811 |
<DD> |
| 1812 |
Allows you to specify the name of the file to which the output is written to. |
| 1813 |
</DL> |
| 1814 |
|
| 1815 |
<P> |
| 1816 |
The results are written to standard output if no output file is specified |
| 1817 |
or if it is <SAMP>‘-’</SAMP>. |
| 1818 |
|
| 1819 |
</P> |
| 1820 |
|
| 1821 |
|
| 1822 |
<H2><A NAME="SEC20" HREF="gperf.html#TOC20">5.2 Options that affect Interpretation of the Input File</A></H2> |
| 1823 |
|
| 1824 |
<P> |
| 1825 |
These options are also available as declarations in the input file |
| 1826 |
(see section <A HREF="gperf.html#SEC9">4.1.1.2 Gperf Declarations</A>). |
| 1827 |
|
| 1828 |
</P> |
| 1829 |
<DL COMPACT> |
| 1830 |
|
| 1831 |
<DT><SAMP>‘-e <VAR>keyword-delimiter-list</VAR>’</SAMP> |
| 1832 |
<DD> |
| 1833 |
<DT><SAMP>‘--delimiters=<VAR>keyword-delimiter-list</VAR>’</SAMP> |
| 1834 |
<DD> |
| 1835 |
<A NAME="IDX41"></A> |
| 1836 |
Allows you to provide a string containing delimiters used to |
| 1837 |
separate keywords from their attributes. The default is ",". This |
| 1838 |
option is essential if you want to use keywords that have embedded |
| 1839 |
commas or newlines. One useful trick is to use -e'TAB', where TAB is |
| 1840 |
the literal tab character. |
| 1841 |
|
| 1842 |
<DT><SAMP>‘-t’</SAMP> |
| 1843 |
<DD> |
| 1844 |
<DT><SAMP>‘--struct-type’</SAMP> |
| 1845 |
<DD> |
| 1846 |
Allows you to include a <CODE>struct</CODE> type declaration for generated |
| 1847 |
code. Any text before a pair of consecutive <SAMP>‘%%’</SAMP> is considered |
| 1848 |
part of the type declaration. Keywords and additional fields may follow |
| 1849 |
this, one group of fields per line. A set of examples for generating |
| 1850 |
perfect hash tables and functions for Ada, C, C++, Pascal, Modula 2, |
| 1851 |
Modula 3 and JavaScript reserved words are distributed with this release. |
| 1852 |
|
| 1853 |
<DT><SAMP>‘--ignore-case’</SAMP> |
| 1854 |
<DD> |
| 1855 |
Consider upper and lower case ASCII characters as equivalent. The string |
| 1856 |
comparison will use a case insignificant character comparison. Note that |
| 1857 |
locale dependent case mappings are ignored. This option is therefore not |
| 1858 |
suitable if a properly internationalized or locale aware case mapping |
| 1859 |
should be used. (For example, in a Turkish locale, the upper case equivalent |
| 1860 |
of the lowercase ASCII letter <SAMP>‘i’</SAMP> is the non-ASCII character |
| 1861 |
<SAMP>‘capital i with dot above’</SAMP>.) For this case, it is better to apply |
| 1862 |
an uppercase or lowercase conversion on the string before passing it to |
| 1863 |
the <CODE>gperf</CODE> generated function. |
| 1864 |
</DL> |
| 1865 |
|
| 1866 |
|
| 1867 |
|
| 1868 |
<H2><A NAME="SEC21" HREF="gperf.html#TOC21">5.3 Options to specify the Language for the Output Code</A></H2> |
| 1869 |
|
| 1870 |
<P> |
| 1871 |
These options are also available as declarations in the input file |
| 1872 |
(see section <A HREF="gperf.html#SEC9">4.1.1.2 Gperf Declarations</A>). |
| 1873 |
|
| 1874 |
</P> |
| 1875 |
<DL COMPACT> |
| 1876 |
|
| 1877 |
<DT><SAMP>‘-L <VAR>generated-language-name</VAR>’</SAMP> |
| 1878 |
<DD> |
| 1879 |
<DT><SAMP>‘--language=<VAR>generated-language-name</VAR>’</SAMP> |
| 1880 |
<DD> |
| 1881 |
Instructs <CODE>gperf</CODE> to generate code in the language specified by the |
| 1882 |
option's argument. Languages handled are currently: |
| 1883 |
|
| 1884 |
<DL COMPACT> |
| 1885 |
|
| 1886 |
<DT><SAMP>‘KR-C’</SAMP> |
| 1887 |
<DD> |
| 1888 |
Old-style K&R C. This language is understood by old-style C compilers and |
| 1889 |
ANSI C compilers, but ANSI C compilers may flag warnings (or even errors) |
| 1890 |
because of lacking <SAMP>‘const’</SAMP>. |
| 1891 |
|
| 1892 |
<DT><SAMP>‘C’</SAMP> |
| 1893 |
<DD> |
| 1894 |
Common C. This language is understood by ANSI C compilers, and also by |
| 1895 |
old-style C compilers, provided that you <CODE>#define const</CODE> to empty |
| 1896 |
for compilers which don't know about this keyword. |
| 1897 |
|
| 1898 |
<DT><SAMP>‘ANSI-C’</SAMP> |
| 1899 |
<DD> |
| 1900 |
ANSI C. This language is understood by ANSI C compilers and C++ compilers. |
| 1901 |
|
| 1902 |
<DT><SAMP>‘C++’</SAMP> |
| 1903 |
<DD> |
| 1904 |
C++. This language is understood by C++ compilers. |
| 1905 |
</DL> |
| 1906 |
|
| 1907 |
The default is ANSI-C. |
| 1908 |
|
| 1909 |
<DT><SAMP>‘-a’</SAMP> |
| 1910 |
<DD> |
| 1911 |
This option is supported for compatibility with previous releases of |
| 1912 |
<CODE>gperf</CODE>. It does not do anything. |
| 1913 |
|
| 1914 |
<DT><SAMP>‘-g’</SAMP> |
| 1915 |
<DD> |
| 1916 |
This option is supported for compatibility with previous releases of |
| 1917 |
<CODE>gperf</CODE>. It does not do anything. |
| 1918 |
</DL> |
| 1919 |
|
| 1920 |
|
| 1921 |
|
| 1922 |
<H2><A NAME="SEC22" HREF="gperf.html#TOC22">5.4 Options for fine tuning Details in the Output Code</A></H2> |
| 1923 |
|
| 1924 |
<P> |
| 1925 |
Most of these options are also available as declarations in the input file |
| 1926 |
(see section <A HREF="gperf.html#SEC9">4.1.1.2 Gperf Declarations</A>). |
| 1927 |
|
| 1928 |
</P> |
| 1929 |
<DL COMPACT> |
| 1930 |
|
| 1931 |
<DT><SAMP>‘-K <VAR>slot-name</VAR>’</SAMP> |
| 1932 |
<DD> |
| 1933 |
<DT><SAMP>‘--slot-name=<VAR>slot-name</VAR>’</SAMP> |
| 1934 |
<DD> |
| 1935 |
<A NAME="IDX42"></A> |
| 1936 |
This option is only useful when option <SAMP>‘-t’</SAMP> (or, equivalently, the |
| 1937 |
<SAMP>‘%struct-type’</SAMP> declaration) has been given. |
| 1938 |
By default, the program assumes the structure component identifier for |
| 1939 |
the keyword is <SAMP>‘name’</SAMP>. This option allows an arbitrary choice of |
| 1940 |
identifier for this component, although it still must occur as the first |
| 1941 |
field in your supplied <CODE>struct</CODE>. |
| 1942 |
|
| 1943 |
<DT><SAMP>‘-F <VAR>initializers</VAR>’</SAMP> |
| 1944 |
<DD> |
| 1945 |
<DT><SAMP>‘--initializer-suffix=<VAR>initializers</VAR>’</SAMP> |
| 1946 |
<DD> |
| 1947 |
<A NAME="IDX43"></A> |
| 1948 |
This option is only useful when option <SAMP>‘-t’</SAMP> (or, equivalently, the |
| 1949 |
<SAMP>‘%struct-type’</SAMP> declaration) has been given. |
| 1950 |
It permits to specify initializers for the structure members following |
| 1951 |
<VAR>slot-name</VAR> in empty hash table entries. The list of initializers |
| 1952 |
should start with a comma. By default, the emitted code will |
| 1953 |
zero-initialize structure members following <VAR>slot-name</VAR>. |
| 1954 |
|
| 1955 |
<DT><SAMP>‘-H <VAR>hash-function-name</VAR>’</SAMP> |
| 1956 |
<DD> |
| 1957 |
<DT><SAMP>‘--hash-function-name=<VAR>hash-function-name</VAR>’</SAMP> |
| 1958 |
<DD> |
| 1959 |
Allows you to specify the name for the generated hash function. Default |
| 1960 |
name is <SAMP>‘hash’</SAMP>. This option permits the use of two hash tables in |
| 1961 |
the same file. |
| 1962 |
|
| 1963 |
<DT><SAMP>‘-N <VAR>lookup-function-name</VAR>’</SAMP> |
| 1964 |
<DD> |
| 1965 |
<DT><SAMP>‘--lookup-function-name=<VAR>lookup-function-name</VAR>’</SAMP> |
| 1966 |
<DD> |
| 1967 |
Allows you to specify the name for the generated lookup function. |
| 1968 |
Default name is <SAMP>‘in_word_set’</SAMP>. This option permits multiple |
| 1969 |
generated hash functions to be used in the same application. |
| 1970 |
|
| 1971 |
<DT><SAMP>‘-Z <VAR>class-name</VAR>’</SAMP> |
| 1972 |
<DD> |
| 1973 |
<DT><SAMP>‘--class-name=<VAR>class-name</VAR>’</SAMP> |
| 1974 |
<DD> |
| 1975 |
<A NAME="IDX44"></A> |
| 1976 |
This option is only useful when option <SAMP>‘-L C++’</SAMP> (or, equivalently, |
| 1977 |
the <SAMP>‘%language=C++’</SAMP> declaration) has been given. It |
| 1978 |
allows you to specify the name of generated C++ class. Default name is |
| 1979 |
<CODE>Perfect_Hash</CODE>. |
| 1980 |
|
| 1981 |
<DT><SAMP>‘-7’</SAMP> |
| 1982 |
<DD> |
| 1983 |
<DT><SAMP>‘--seven-bit’</SAMP> |
| 1984 |
<DD> |
| 1985 |
This option specifies that all strings that will be passed as arguments |
| 1986 |
to the generated hash function and the generated lookup function will |
| 1987 |
solely consist of 7-bit ASCII characters (bytes in the range 0..127). |
| 1988 |
(Note that the ANSI C functions <CODE>isalnum</CODE> and <CODE>isgraph</CODE> do |
| 1989 |
<EM>not</EM> guarantee that a byte is in this range. Only an explicit |
| 1990 |
test like <SAMP>‘c >= 'A' && c <= 'Z'’</SAMP> guarantees this.) This was the |
| 1991 |
default in versions of <CODE>gperf</CODE> earlier than 2.7; now the default is |
| 1992 |
to support 8-bit and multibyte characters. |
| 1993 |
|
| 1994 |
<DT><SAMP>‘-l’</SAMP> |
| 1995 |
<DD> |
| 1996 |
<DT><SAMP>‘--compare-lengths’</SAMP> |
| 1997 |
<DD> |
| 1998 |
Compare keyword lengths before trying a string comparison. This option |
| 1999 |
is mandatory for binary comparisons (see section <A HREF="gperf.html#SEC15">4.3 Use of NUL bytes</A>). It also might |
| 2000 |
cut down on the number of string comparisons made during the lookup, since |
| 2001 |
keywords with different lengths are never compared via <CODE>strcmp</CODE>. |
| 2002 |
However, using <SAMP>‘-l’</SAMP> might greatly increase the size of the |
| 2003 |
generated C code if the lookup table range is large (which implies that |
| 2004 |
the switch option <SAMP>‘-S’</SAMP> or <SAMP>‘%switch’</SAMP> is not enabled), since the length |
| 2005 |
table contains as many elements as there are entries in the lookup table. |
| 2006 |
|
| 2007 |
<DT><SAMP>‘-c’</SAMP> |
| 2008 |
<DD> |
| 2009 |
<DT><SAMP>‘--compare-strncmp’</SAMP> |
| 2010 |
<DD> |
| 2011 |
Generates C code that uses the <CODE>strncmp</CODE> function to perform |
| 2012 |
string comparisons. The default action is to use <CODE>strcmp</CODE>. |
| 2013 |
|
| 2014 |
<DT><SAMP>‘-C’</SAMP> |
| 2015 |
<DD> |
| 2016 |
<DT><SAMP>‘--readonly-tables’</SAMP> |
| 2017 |
<DD> |
| 2018 |
Makes the contents of all generated lookup tables constant, i.e., |
| 2019 |
“readonly”. Many compilers can generate more efficient code for this |
| 2020 |
by putting the tables in readonly memory. |
| 2021 |
|
| 2022 |
<DT><SAMP>‘-E’</SAMP> |
| 2023 |
<DD> |
| 2024 |
<DT><SAMP>‘--enum’</SAMP> |
| 2025 |
<DD> |
| 2026 |
<A NAME="IDX45"></A> |
| 2027 |
Define constant values using an enum local to the lookup function rather |
| 2028 |
than with #defines. This also means that different lookup functions can |
| 2029 |
reside in the same file. Thanks to James Clark <CODE><[email protected]></CODE>. |
| 2030 |
|
| 2031 |
<DT><SAMP>‘-I’</SAMP> |
| 2032 |
<DD> |
| 2033 |
<DT><SAMP>‘--includes’</SAMP> |
| 2034 |
<DD> |
| 2035 |
Include the necessary system include file, <CODE><string.h></CODE>, at the |
| 2036 |
beginning of the code. By default, this is not done; the user must |
| 2037 |
include this header file himself to allow compilation of the code. |
| 2038 |
|
| 2039 |
<DT><SAMP>‘-G’</SAMP> |
| 2040 |
<DD> |
| 2041 |
<DT><SAMP>‘--global-table’</SAMP> |
| 2042 |
<DD> |
| 2043 |
Generate the static table of keywords as a static global variable, |
| 2044 |
rather than hiding it inside of the lookup function (which is the |
| 2045 |
default behavior). |
| 2046 |
|
| 2047 |
<DT><SAMP>‘-P’</SAMP> |
| 2048 |
<DD> |
| 2049 |
<DT><SAMP>‘--pic’</SAMP> |
| 2050 |
<DD> |
| 2051 |
Optimize the generated table for inclusion in shared libraries. This |
| 2052 |
reduces the startup time of programs using a shared library containing |
| 2053 |
the generated code. If the option <SAMP>‘-t’</SAMP> (or, equivalently, the |
| 2054 |
<SAMP>‘%struct-type’</SAMP> declaration) is also given, the first field of the |
| 2055 |
user-defined struct must be of type <SAMP>‘int’</SAMP>, not <SAMP>‘char *’</SAMP>, because |
| 2056 |
it will contain offsets into the string pool instead of actual strings. |
| 2057 |
To convert such an offset to a string, you can use the expression |
| 2058 |
<SAMP>‘stringpool + <VAR>o</VAR>’</SAMP>, where <VAR>o</VAR> is the offset. The string pool |
| 2059 |
name can be changed through the option <SAMP>‘--string-pool-name’</SAMP>. |
| 2060 |
|
| 2061 |
<DT><SAMP>‘-Q <VAR>string-pool-name</VAR>’</SAMP> |
| 2062 |
<DD> |
| 2063 |
<DT><SAMP>‘--string-pool-name=<VAR>string-pool-name</VAR>’</SAMP> |
| 2064 |
<DD> |
| 2065 |
Allows you to specify the name of the generated string pool created by |
| 2066 |
option <SAMP>‘-P’</SAMP>. The default name is <SAMP>‘stringpool’</SAMP>. This option |
| 2067 |
permits the use of two hash tables in the same file, with <SAMP>‘-P’</SAMP> and |
| 2068 |
even when the option <SAMP>‘-G’</SAMP> (or, equivalently, the <SAMP>‘%global-table’</SAMP> |
| 2069 |
declaration) is given. |
| 2070 |
|
| 2071 |
<DT><SAMP>‘--null-strings’</SAMP> |
| 2072 |
<DD> |
| 2073 |
Use NULL strings instead of empty strings for empty keyword table entries. |
| 2074 |
This reduces the startup time of programs using a shared library containing |
| 2075 |
the generated code (but not as much as option <SAMP>‘-P’</SAMP>), at the expense |
| 2076 |
of one more test-and-branch instruction at run time. |
| 2077 |
|
| 2078 |
<DT><SAMP>‘--constants-prefix=<VAR>prefix</VAR>’</SAMP> |
| 2079 |
<DD> |
| 2080 |
<A NAME="IDX46"></A> |
| 2081 |
Allows you to specify a prefix for the constants <CODE>TOTAL_KEYWORDS</CODE>, |
| 2082 |
<CODE>MIN_WORD_LENGTH</CODE>, <CODE>MAX_WORD_LENGTH</CODE>, and so on. This option |
| 2083 |
permits the use of two hash tables in the same file, even when the option |
| 2084 |
<SAMP>‘-E’</SAMP> (or, equivalently, the <SAMP>‘%enum’</SAMP> declaration) is not given or |
| 2085 |
the option <SAMP>‘-G’</SAMP> (or, equivalently, the <SAMP>‘%global-table’</SAMP> declaration) |
| 2086 |
is given. |
| 2087 |
|
| 2088 |
<DT><SAMP>‘-W <VAR>hash-table-array-name</VAR>’</SAMP> |
| 2089 |
<DD> |
| 2090 |
<DT><SAMP>‘--word-array-name=<VAR>hash-table-array-name</VAR>’</SAMP> |
| 2091 |
<DD> |
| 2092 |
<A NAME="IDX47"></A> |
| 2093 |
Allows you to specify the name for the generated array containing the |
| 2094 |
hash table. Default name is <SAMP>‘wordlist’</SAMP>. This option permits the |
| 2095 |
use of two hash tables in the same file, even when the option <SAMP>‘-G’</SAMP> |
| 2096 |
(or, equivalently, the <SAMP>‘%global-table’</SAMP> declaration) is given. |
| 2097 |
|
| 2098 |
<DT><SAMP>‘--length-table-name=<VAR>length-table-array-name</VAR>’</SAMP> |
| 2099 |
<DD> |
| 2100 |
<A NAME="IDX48"></A> |
| 2101 |
Allows you to specify the name for the generated array containing the |
| 2102 |
length table. Default name is <SAMP>‘lengthtable’</SAMP>. This option permits the |
| 2103 |
use of two length tables in the same file, even when the option <SAMP>‘-G’</SAMP> |
| 2104 |
(or, equivalently, the <SAMP>‘%global-table’</SAMP> declaration) is given. |
| 2105 |
|
| 2106 |
<DT><SAMP>‘-S <VAR>total-switch-statements</VAR>’</SAMP> |
| 2107 |
<DD> |
| 2108 |
<DT><SAMP>‘--switch=<VAR>total-switch-statements</VAR>’</SAMP> |
| 2109 |
<DD> |
| 2110 |
<A NAME="IDX49"></A> |
| 2111 |
Causes the generated C code to use a <CODE>switch</CODE> statement scheme, |
| 2112 |
rather than an array lookup table. This can lead to a reduction in both |
| 2113 |
time and space requirements for some input files. The argument to this |
| 2114 |
option determines how many <CODE>switch</CODE> statements are generated. A |
| 2115 |
value of 1 generates 1 <CODE>switch</CODE> containing all the elements, a |
| 2116 |
value of 2 generates 2 tables with 1/2 the elements in each |
| 2117 |
<CODE>switch</CODE>, etc. This is useful since many C compilers cannot |
| 2118 |
correctly generate code for large <CODE>switch</CODE> statements. This option |
| 2119 |
was inspired in part by Keith Bostic's original C program. |
| 2120 |
|
| 2121 |
<DT><SAMP>‘-T’</SAMP> |
| 2122 |
<DD> |
| 2123 |
<DT><SAMP>‘--omit-struct-type’</SAMP> |
| 2124 |
<DD> |
| 2125 |
Prevents the transfer of the type declaration to the output file. Use |
| 2126 |
this option if the type is already defined elsewhere. |
| 2127 |
|
| 2128 |
<DT><SAMP>‘-p’</SAMP> |
| 2129 |
<DD> |
| 2130 |
This option is supported for compatibility with previous releases of |
| 2131 |
<CODE>gperf</CODE>. It does not do anything. |
| 2132 |
</DL> |
| 2133 |
|
| 2134 |
|
| 2135 |
|
| 2136 |
<H2><A NAME="SEC23" HREF="gperf.html#TOC23">5.5 Options for changing the Algorithms employed by <CODE>gperf</CODE></A></H2> |
| 2137 |
|
| 2138 |
<DL COMPACT> |
| 2139 |
|
| 2140 |
<DT><SAMP>‘-k <VAR>selected-byte-positions</VAR>’</SAMP> |
| 2141 |
<DD> |
| 2142 |
<DT><SAMP>‘--key-positions=<VAR>selected-byte-positions</VAR>’</SAMP> |
| 2143 |
<DD> |
| 2144 |
Allows selection of the byte positions used in the keywords' |
| 2145 |
hash function. The allowable choices range between 1-255, inclusive. |
| 2146 |
The positions are separated by commas, e.g., <SAMP>‘-k 9,4,13,14’</SAMP>; |
| 2147 |
ranges may be used, e.g., <SAMP>‘-k 2-7’</SAMP>; and positions may occur |
| 2148 |
in any order. Furthermore, the wildcard '*' causes the generated |
| 2149 |
hash function to consider <STRONG>all</STRONG> byte positions in each keyword, |
| 2150 |
whereas '$' instructs the hash function to use the “final byte” |
| 2151 |
of a keyword (this is the only way to use a byte position greater than |
| 2152 |
255, incidentally). |
| 2153 |
|
| 2154 |
For instance, the option <SAMP>‘-k 1,2,4,6-10,'$'’</SAMP> generates a hash |
| 2155 |
function that considers positions 1,2,4,6,7,8,9,10, plus the last |
| 2156 |
byte in each keyword (which may be at a different position for each |
| 2157 |
keyword, obviously). Keywords |
| 2158 |
with length less than the indicated byte positions work properly, since |
| 2159 |
selected byte positions exceeding the keyword length are simply not |
| 2160 |
referenced in the hash function. |
| 2161 |
|
| 2162 |
This option is not normally needed since version 2.8 of <CODE>gperf</CODE>; |
| 2163 |
the default byte positions are computed depending on the keyword set, |
| 2164 |
through a search that minimizes the number of byte positions. |
| 2165 |
|
| 2166 |
<DT><SAMP>‘-D’</SAMP> |
| 2167 |
<DD> |
| 2168 |
<DT><SAMP>‘--duplicates’</SAMP> |
| 2169 |
<DD> |
| 2170 |
<A NAME="IDX50"></A> |
| 2171 |
Handle keywords whose selected byte sets hash to duplicate values. |
| 2172 |
Duplicate hash values can occur if a set of keywords has the same names, but |
| 2173 |
possesses different attributes, or if the selected byte positions are not well |
| 2174 |
chosen. With the -D option <CODE>gperf</CODE> treats all these keywords as |
| 2175 |
part of an equivalence class and generates a perfect hash function with |
| 2176 |
multiple comparisons for duplicate keywords. It is up to you to completely |
| 2177 |
disambiguate the keywords by modifying the generated C code. However, |
| 2178 |
<CODE>gperf</CODE> helps you out by organizing the output. |
| 2179 |
|
| 2180 |
Using this option usually means that the generated hash function is no |
| 2181 |
longer perfect. On the other hand, it permits <CODE>gperf</CODE> to work on |
| 2182 |
keyword sets that it otherwise could not handle. |
| 2183 |
|
| 2184 |
<DT><SAMP>‘-m <VAR>iterations</VAR>’</SAMP> |
| 2185 |
<DD> |
| 2186 |
<DT><SAMP>‘--multiple-iterations=<VAR>iterations</VAR>’</SAMP> |
| 2187 |
<DD> |
| 2188 |
Perform multiple choices of the <SAMP>‘-i’</SAMP> and <SAMP>‘-j’</SAMP> values, and |
| 2189 |
choose the best results. This increases the running time by a factor of |
| 2190 |
<VAR>iterations</VAR> but does a good job minimizing the generated table size. |
| 2191 |
|
| 2192 |
<DT><SAMP>‘-i <VAR>initial-value</VAR>’</SAMP> |
| 2193 |
<DD> |
| 2194 |
<DT><SAMP>‘--initial-asso=<VAR>initial-value</VAR>’</SAMP> |
| 2195 |
<DD> |
| 2196 |
Provides an initial <VAR>value</VAR> for the associate values array. Default |
| 2197 |
is 0. Increasing the initial value helps inflate the final table size, |
| 2198 |
possibly leading to more time efficient keyword lookups. Note that this |
| 2199 |
option is not particularly useful when <SAMP>‘-S’</SAMP> (or, equivalently, |
| 2200 |
<SAMP>‘%switch’</SAMP>) is used. Also, |
| 2201 |
<SAMP>‘-i’</SAMP> is overridden when the <SAMP>‘-r’</SAMP> option is used. |
| 2202 |
|
| 2203 |
<DT><SAMP>‘-j <VAR>jump-value</VAR>’</SAMP> |
| 2204 |
<DD> |
| 2205 |
<DT><SAMP>‘--jump=<VAR>jump-value</VAR>’</SAMP> |
| 2206 |
<DD> |
| 2207 |
<A NAME="IDX51"></A> |
| 2208 |
Affects the “jump value”, i.e., how far to advance the associated |
| 2209 |
byte value upon collisions. <VAR>Jump-value</VAR> is rounded up to an |
| 2210 |
odd number, the default is 5. If the <VAR>jump-value</VAR> is 0 <CODE>gperf</CODE> |
| 2211 |
jumps by random amounts. |
| 2212 |
|
| 2213 |
<DT><SAMP>‘-n’</SAMP> |
| 2214 |
<DD> |
| 2215 |
<DT><SAMP>‘--no-strlen’</SAMP> |
| 2216 |
<DD> |
| 2217 |
Instructs the generator not to include the length of a keyword when |
| 2218 |
computing its hash value. This may save a few assembly instructions in |
| 2219 |
the generated lookup table. |
| 2220 |
|
| 2221 |
<DT><SAMP>‘-r’</SAMP> |
| 2222 |
<DD> |
| 2223 |
<DT><SAMP>‘--random’</SAMP> |
| 2224 |
<DD> |
| 2225 |
Utilizes randomness to initialize the associated values table. This |
| 2226 |
frequently generates solutions faster than using deterministic |
| 2227 |
initialization (which starts all associated values at 0). Furthermore, |
| 2228 |
using the randomization option generally increases the size of the |
| 2229 |
table. |
| 2230 |
|
| 2231 |
<DT><SAMP>‘-s <VAR>size-multiple</VAR>’</SAMP> |
| 2232 |
<DD> |
| 2233 |
<DT><SAMP>‘--size-multiple=<VAR>size-multiple</VAR>’</SAMP> |
| 2234 |
<DD> |
| 2235 |
Affects the size of the generated hash table. The numeric argument for |
| 2236 |
this option indicates “how many times larger or smaller” the maximum |
| 2237 |
associated value range should be, in relationship to the number of keywords. |
| 2238 |
It can be written as an integer, a floating-point number or a fraction. |
| 2239 |
For example, a value of 3 means “allow the maximum associated value to be |
| 2240 |
about 3 times larger than the number of input keywords”. |
| 2241 |
Conversely, a value of 1/3 means “allow the maximum associated value to |
| 2242 |
be about 3 times smaller than the number of input keywords”. Values |
| 2243 |
smaller than 1 are useful for limiting the overall size of the generated hash |
| 2244 |
table, though the option <SAMP>‘-m’</SAMP> is better at this purpose. |
| 2245 |
|
| 2246 |
If `generate switch' option <SAMP>‘-S’</SAMP> (or, equivalently, <SAMP>‘%switch’</SAMP>) is |
| 2247 |
<EM>not</EM> enabled, the maximum |
| 2248 |
associated value influences the static array table size, and a larger |
| 2249 |
table should decrease the time required for an unsuccessful search, at |
| 2250 |
the expense of extra table space. |
| 2251 |
|
| 2252 |
The default value is 1, thus the default maximum associated value is about |
| 2253 |
the same size as the number of keywords. (For efficiency, the maximum |
| 2254 |
associated value is always rounded up to a power of 2.) The actual |
| 2255 |
table size may vary somewhat, since this technique is essentially a |
| 2256 |
heuristic. |
| 2257 |
</DL> |
| 2258 |
|
| 2259 |
|
| 2260 |
|
| 2261 |
<H2><A NAME="SEC24" HREF="gperf.html#TOC24">5.6 Informative Output</A></H2> |
| 2262 |
|
| 2263 |
<DL COMPACT> |
| 2264 |
|
| 2265 |
<DT><SAMP>‘-h’</SAMP> |
| 2266 |
<DD> |
| 2267 |
<DT><SAMP>‘--help’</SAMP> |
| 2268 |
<DD> |
| 2269 |
Prints a short summary on the meaning of each program option. Aborts |
| 2270 |
further program execution. |
| 2271 |
|
| 2272 |
<DT><SAMP>‘-v’</SAMP> |
| 2273 |
<DD> |
| 2274 |
<DT><SAMP>‘--version’</SAMP> |
| 2275 |
<DD> |
| 2276 |
Prints out the current version number. |
| 2277 |
|
| 2278 |
<DT><SAMP>‘-d’</SAMP> |
| 2279 |
<DD> |
| 2280 |
<DT><SAMP>‘--debug’</SAMP> |
| 2281 |
<DD> |
| 2282 |
Enables the debugging option. This produces verbose diagnostics to |
| 2283 |
“standard error” when <CODE>gperf</CODE> is executing. It is useful both for |
| 2284 |
maintaining the program and for determining whether a given set of |
| 2285 |
options is actually speeding up the search for a solution. Some useful |
| 2286 |
information is dumped at the end of the program when the <SAMP>‘-d’</SAMP> |
| 2287 |
option is enabled. |
| 2288 |
</DL> |
| 2289 |
|
| 2290 |
|
| 2291 |
|
| 2292 |
<H1><A NAME="SEC25" HREF="gperf.html#TOC25">6 Known Bugs and Limitations with <CODE>gperf</CODE></A></H1> |
| 2293 |
|
| 2294 |
<P> |
| 2295 |
The following are some limitations with the current release of |
| 2296 |
<CODE>gperf</CODE>: |
| 2297 |
|
| 2298 |
</P> |
| 2299 |
|
| 2300 |
<UL> |
| 2301 |
<LI> |
| 2302 |
|
| 2303 |
The <CODE>gperf</CODE> utility is tuned to execute quickly, and works quickly |
| 2304 |
for small to medium size data sets (around 1000 keywords). It is |
| 2305 |
extremely useful for maintaining perfect hash functions for compiler |
| 2306 |
keyword sets. Since version 3.0, <CODE>gperf</CODE> also works |
| 2307 |
efficiently on much larger keyword sets (over 15,000 keywords). |
| 2308 |
|
| 2309 |
<LI> |
| 2310 |
|
| 2311 |
The size of the generate static keyword array can get <EM>extremely</EM> |
| 2312 |
large if the input keyword file is large or if the keywords are quite |
| 2313 |
similar. This tends to slow down the compilation of the generated C |
| 2314 |
code, and <EM>greatly</EM> inflates the object code size. If this |
| 2315 |
situation occurs, consider using the <SAMP>‘-S’</SAMP> option to reduce data |
| 2316 |
size, potentially increasing the keyword recognition time by a negligible |
| 2317 |
amount. Since many C compilers cannot correctly generate code for |
| 2318 |
large switch statements it is important to qualify the <VAR>-S</VAR> option |
| 2319 |
with an appropriate numerical argument that controls the number of |
| 2320 |
switch statements generated. |
| 2321 |
|
| 2322 |
<LI> |
| 2323 |
|
| 2324 |
The maximum number of selected byte positions has an |
| 2325 |
arbitrary limit of 255. This restriction should be removed, and if |
| 2326 |
anyone considers this a problem write me and let me know so I can remove |
| 2327 |
the constraint. |
| 2328 |
</UL> |
| 2329 |
|
| 2330 |
|
| 2331 |
|
| 2332 |
<H1><A NAME="SEC26" HREF="gperf.html#TOC26">7 Things Still Left to Do</A></H1> |
| 2333 |
|
| 2334 |
<P> |
| 2335 |
It should be “relatively” easy to replace the current perfect hash |
| 2336 |
function algorithm with a more exhaustive approach; the perfect hash |
| 2337 |
module is essential independent from other program modules. Additional |
| 2338 |
worthwhile improvements include: |
| 2339 |
|
| 2340 |
</P> |
| 2341 |
|
| 2342 |
<UL> |
| 2343 |
<LI> |
| 2344 |
|
| 2345 |
Another useful extension involves modifying the program to generate |
| 2346 |
“minimal” perfect hash functions (under certain circumstances, the |
| 2347 |
current version can be rather extravagant in the generated table size). |
| 2348 |
This is mostly of theoretical interest, since a sparse table |
| 2349 |
often produces faster lookups, and use of the <SAMP>‘-S’</SAMP> <CODE>switch</CODE> |
| 2350 |
option can minimize the data size, at the expense of slightly longer |
| 2351 |
lookups (note that the gcc compiler generally produces good code for |
| 2352 |
<CODE>switch</CODE> statements, reducing the need for more complex schemes). |
| 2353 |
|
| 2354 |
<LI> |
| 2355 |
|
| 2356 |
In addition to improving the algorithm, it would also be useful to |
| 2357 |
generate an Ada package as the code output, in addition to the current |
| 2358 |
C and C++ routines. |
| 2359 |
</UL> |
| 2360 |
|
| 2361 |
|
| 2362 |
|
| 2363 |
<H1><A NAME="SEC27" HREF="gperf.html#TOC27">8 Bibliography</A></H1> |
| 2364 |
|
| 2365 |
<P> |
| 2366 |
[1] Chang, C.C.: <I>A Scheme for Constructing Ordered Minimal Perfect |
| 2367 |
Hashing Functions</I> Information Sciences 39(1986), 187-195. |
| 2368 |
|
| 2369 |
</P> |
| 2370 |
<P> |
| 2371 |
[2] Cichelli, Richard J. <I>Author's Response to “On Cichelli's Minimal Perfect Hash |
| 2372 |
Functions Method”</I> Communications of the ACM, 23, 12(December 1980), 729. |
| 2373 |
|
| 2374 |
</P> |
| 2375 |
<P> |
| 2376 |
[3] Cichelli, Richard J. <I>Minimal Perfect Hash Functions Made Simple</I> |
| 2377 |
Communications of the ACM, 23, 1(January 1980), 17-19. |
| 2378 |
|
| 2379 |
</P> |
| 2380 |
<P> |
| 2381 |
[4] Cook, C. R. and Oldehoeft, R.R. <I>A Letter Oriented Minimal |
| 2382 |
Perfect Hashing Function</I> SIGPLAN Notices, 17, 9(September 1982), 18-27. |
| 2383 |
|
| 2384 |
</P> |
| 2385 |
<P> |
| 2386 |
[5] Cormack, G. V. and Horspool, R. N. S. and Kaiserwerth, M. |
| 2387 |
<I>Practical Perfect Hashing</I> Computer Journal, 28, 1(January 1985), 54-58. |
| 2388 |
|
| 2389 |
</P> |
| 2390 |
<P> |
| 2391 |
[6] Jaeschke, G. <I>Reciprocal Hashing: A Method for Generating Minimal |
| 2392 |
Perfect Hashing Functions</I> Communications of the ACM, 24, 12(December |
| 2393 |
1981), 829-833. |
| 2394 |
|
| 2395 |
</P> |
| 2396 |
<P> |
| 2397 |
[7] Jaeschke, G. and Osterburg, G. <I>On Cichelli's Minimal Perfect |
| 2398 |
Hash Functions Method</I> Communications of the ACM, 23, 12(December 1980), |
| 2399 |
728-729. |
| 2400 |
|
| 2401 |
</P> |
| 2402 |
<P> |
| 2403 |
[8] Sager, Thomas J. <I>A Polynomial Time Generator for Minimal Perfect |
| 2404 |
Hash Functions</I> Communications of the ACM, 28, 5(December 1985), 523-532 |
| 2405 |
|
| 2406 |
</P> |
| 2407 |
<P> |
| 2408 |
[9] Schmidt, Douglas C. <I>GPERF: A Perfect Hash Function Generator</I> |
| 2409 |
Second USENIX C++ Conference Proceedings, April 1990. |
| 2410 |
|
| 2411 |
</P> |
| 2412 |
<P> |
| 2413 |
[10] Schmidt, Douglas C. <I>GPERF: A Perfect Hash Function Generator</I> |
| 2414 |
C++ Report, SIGS 10 10 (November/December 1998). |
| 2415 |
|
| 2416 |
</P> |
| 2417 |
<P> |
| 2418 |
[11] Sebesta, R.W. and Taylor, M.A. <I>Minimal Perfect Hash Functions |
| 2419 |
for Reserved Word Lists</I> SIGPLAN Notices, 20, 12(September 1985), 47-53. |
| 2420 |
|
| 2421 |
</P> |
| 2422 |
<P> |
| 2423 |
[12] Sprugnoli, R. <I>Perfect Hashing Functions: A Single Probe |
| 2424 |
Retrieving Method for Static Sets</I> Communications of the ACM, 20 |
| 2425 |
11(November 1977), 841-850. |
| 2426 |
|
| 2427 |
</P> |
| 2428 |
<P> |
| 2429 |
[13] Stallman, Richard M. <I>Using and Porting GNU CC</I> Free Software Foundation, |
| 2430 |
1988. |
| 2431 |
|
| 2432 |
</P> |
| 2433 |
<P> |
| 2434 |
[14] Stroustrup, Bjarne <I>The C++ Programming Language.</I> Addison-Wesley, 1986. |
| 2435 |
|
| 2436 |
</P> |
| 2437 |
<P> |
| 2438 |
[15] Tiemann, Michael D. <I>User's Guide to GNU C++</I> Free Software |
| 2439 |
Foundation, 1989. |
| 2440 |
|
| 2441 |
</P> |
| 2442 |
|
| 2443 |
|
| 2444 |
<H1><A NAME="SEC28" HREF="gperf.html#TOC28">Concept Index</A></H1> |
| 2445 |
|
| 2446 |
<P> |
| 2447 |
Jump to: |
| 2448 |
<A HREF="#cindex_&">&</A> |
| 2449 |
- |
| 2450 |
<A HREF="#cindex_a">a</A> |
| 2451 |
- |
| 2452 |
<A HREF="#cindex_b">b</A> |
| 2453 |
- |
| 2454 |
<A HREF="#cindex_c">c</A> |
| 2455 |
- |
| 2456 |
<A HREF="#cindex_d">d</A> |
| 2457 |
- |
| 2458 |
<A HREF="#cindex_f">f</A> |
| 2459 |
- |
| 2460 |
<A HREF="#cindex_h">h</A> |
| 2461 |
- |
| 2462 |
<A HREF="#cindex_i">i</A> |
| 2463 |
- |
| 2464 |
<A HREF="#cindex_j">j</A> |
| 2465 |
- |
| 2466 |
<A HREF="#cindex_k">k</A> |
| 2467 |
- |
| 2468 |
<A HREF="#cindex_m">m</A> |
| 2469 |
- |
| 2470 |
<A HREF="#cindex_n">n</A> |
| 2471 |
- |
| 2472 |
<A HREF="#cindex_s">s</A> |
| 2473 |
<P> |
| 2474 |
<H2><A NAME="cindex_&">&</A></H2> |
| 2475 |
<DIR> |
| 2476 |
<LI><A HREF="gperf.html#IDX8"><SAMP>‘%%’</SAMP></A> |
| 2477 |
<LI><A HREF="gperf.html#IDX18"><SAMP>‘%7bit’</SAMP></A> |
| 2478 |
<LI><A HREF="gperf.html#IDX19"><SAMP>‘%compare-lengths’</SAMP></A> |
| 2479 |
<LI><A HREF="gperf.html#IDX20"><SAMP>‘%compare-strncmp’</SAMP></A> |
| 2480 |
<LI><A HREF="gperf.html#IDX17"><SAMP>‘%define class-name’</SAMP></A> |
| 2481 |
<LI><A HREF="gperf.html#IDX28"><SAMP>‘%define constants-prefix’</SAMP></A> |
| 2482 |
<LI><A HREF="gperf.html#IDX15"><SAMP>‘%define hash-function-name’</SAMP></A> |
| 2483 |
<LI><A HREF="gperf.html#IDX14"><SAMP>‘%define initializer-suffix’</SAMP></A> |
| 2484 |
<LI><A HREF="gperf.html#IDX30"><SAMP>‘%define length-table-name’</SAMP></A> |
| 2485 |
<LI><A HREF="gperf.html#IDX16"><SAMP>‘%define lookup-function-name’</SAMP></A> |
| 2486 |
<LI><A HREF="gperf.html#IDX13"><SAMP>‘%define slot-name’</SAMP></A> |
| 2487 |
<LI><A HREF="gperf.html#IDX26"><SAMP>‘%define string-pool-name’</SAMP></A> |
| 2488 |
<LI><A HREF="gperf.html#IDX29"><SAMP>‘%define word-array-name’</SAMP></A> |
| 2489 |
<LI><A HREF="gperf.html#IDX9"><SAMP>‘%delimiters’</SAMP></A> |
| 2490 |
<LI><A HREF="gperf.html#IDX22"><SAMP>‘%enum’</SAMP></A> |
| 2491 |
<LI><A HREF="gperf.html#IDX24"><SAMP>‘%global-table’</SAMP></A> |
| 2492 |
<LI><A HREF="gperf.html#IDX11"><SAMP>‘%ignore-case’</SAMP></A> |
| 2493 |
<LI><A HREF="gperf.html#IDX23"><SAMP>‘%includes’</SAMP></A> |
| 2494 |
<LI><A HREF="gperf.html#IDX12"><SAMP>‘%language’</SAMP></A> |
| 2495 |
<LI><A HREF="gperf.html#IDX27"><SAMP>‘%null-strings’</SAMP></A> |
| 2496 |
<LI><A HREF="gperf.html#IDX32"><SAMP>‘%omit-struct-type’</SAMP></A> |
| 2497 |
<LI><A HREF="gperf.html#IDX25"><SAMP>‘%pic’</SAMP></A> |
| 2498 |
<LI><A HREF="gperf.html#IDX21"><SAMP>‘%readonly-tables’</SAMP></A> |
| 2499 |
<LI><A HREF="gperf.html#IDX10"><SAMP>‘%struct-type’</SAMP></A> |
| 2500 |
<LI><A HREF="gperf.html#IDX31"><SAMP>‘%switch’</SAMP></A> |
| 2501 |
<LI><A HREF="gperf.html#IDX33"><SAMP>‘%{’</SAMP></A> |
| 2502 |
<LI><A HREF="gperf.html#IDX34"><SAMP>‘%}’</SAMP></A> |
| 2503 |
</DIR> |
| 2504 |
<H2><A NAME="cindex_a">a</A></H2> |
| 2505 |
<DIR> |
| 2506 |
<LI><A HREF="gperf.html#IDX47">Array name</A>, <A HREF="gperf.html#IDX48">Array name</A> |
| 2507 |
</DIR> |
| 2508 |
<H2><A NAME="cindex_b">b</A></H2> |
| 2509 |
<DIR> |
| 2510 |
<LI><A HREF="gperf.html#IDX1">Bugs</A> |
| 2511 |
</DIR> |
| 2512 |
<H2><A NAME="cindex_c">c</A></H2> |
| 2513 |
<DIR> |
| 2514 |
<LI><A HREF="gperf.html#IDX44">Class name</A> |
| 2515 |
<LI><A HREF="gperf.html#IDX45">Constants definition</A> |
| 2516 |
<LI><A HREF="gperf.html#IDX46">Constants prefix</A> |
| 2517 |
<LI><A HREF="gperf.html#IDX40">Copyright</A> |
| 2518 |
</DIR> |
| 2519 |
<H2><A NAME="cindex_d">d</A></H2> |
| 2520 |
<DIR> |
| 2521 |
<LI><A HREF="gperf.html#IDX5">Declaration section</A> |
| 2522 |
<LI><A HREF="gperf.html#IDX41">Delimiters</A> |
| 2523 |
<LI><A HREF="gperf.html#IDX50">Duplicates</A> |
| 2524 |
</DIR> |
| 2525 |
<H2><A NAME="cindex_f">f</A></H2> |
| 2526 |
<DIR> |
| 2527 |
<LI><A HREF="gperf.html#IDX4">Format</A> |
| 2528 |
<LI><A HREF="gperf.html#IDX7">Functions section</A> |
| 2529 |
</DIR> |
| 2530 |
<H2><A NAME="cindex_h">h</A></H2> |
| 2531 |
<DIR> |
| 2532 |
<LI><A HREF="gperf.html#IDX36">hash</A> |
| 2533 |
<LI><A HREF="gperf.html#IDX35">hash table</A> |
| 2534 |
</DIR> |
| 2535 |
<H2><A NAME="cindex_i">i</A></H2> |
| 2536 |
<DIR> |
| 2537 |
<LI><A HREF="gperf.html#IDX37">in_word_set</A> |
| 2538 |
<LI><A HREF="gperf.html#IDX43">Initializers</A> |
| 2539 |
</DIR> |
| 2540 |
<H2><A NAME="cindex_j">j</A></H2> |
| 2541 |
<DIR> |
| 2542 |
<LI><A HREF="gperf.html#IDX51">Jump value</A> |
| 2543 |
</DIR> |
| 2544 |
<H2><A NAME="cindex_k">k</A></H2> |
| 2545 |
<DIR> |
| 2546 |
<LI><A HREF="gperf.html#IDX6">Keywords section</A> |
| 2547 |
</DIR> |
| 2548 |
<H2><A NAME="cindex_m">m</A></H2> |
| 2549 |
<DIR> |
| 2550 |
<LI><A HREF="gperf.html#IDX3">Minimal perfect hash functions</A> |
| 2551 |
</DIR> |
| 2552 |
<H2><A NAME="cindex_n">n</A></H2> |
| 2553 |
<DIR> |
| 2554 |
<LI><A HREF="gperf.html#IDX39">NUL</A> |
| 2555 |
</DIR> |
| 2556 |
<H2><A NAME="cindex_s">s</A></H2> |
| 2557 |
<DIR> |
| 2558 |
<LI><A HREF="gperf.html#IDX42">Slot name</A> |
| 2559 |
<LI><A HREF="gperf.html#IDX2">Static search structure</A> |
| 2560 |
<LI><A HREF="gperf.html#IDX38"><CODE>switch</CODE></A>, <A HREF="gperf.html#IDX49"><CODE>switch</CODE></A> |
| 2561 |
</DIR> |
| 2562 |
|
| 2563 |
</P> |
| 2564 |
|
| 2565 |
<P><HR><P> |
| 2566 |
This document was generated on 16 April 2025 using the |
| 2567 |
<A HREF="http://wwwinfo.cern.ch/dis/texi2html/">texi2html</A> |
| 2568 |
translator version 1.52b.</P> |
| 2569 |
</BODY> |
| 2570 |
</HTML> |