From a35e3ca3f168a6baf7749ba38347cc489057475b Mon Sep 17 00:00:00 2001 From: Brendan Kehoe Date: Fri, 13 Jan 2006 15:37:02 +0000 Subject: * doc/gperf.texi (UPDATED): Correct to be today. * doc: Regenerated by doing make in a configured tree. Requires makeinfo, texi2dvi, texi2pdf, and texi2html. --- doc/gperf.html | 358 ++++++++++++++++++++++++++++------------------------- doc/gperf.info | 350 ++++++++++++++++++++++++++------------------------- doc/gperf.pdf | Bin 224738 -> 226713 bytes doc/gperf.texi | 2 +- doc/gperf_1.html | 39 +++--- doc/gperf_10.html | 38 +++--- doc/gperf_2.html | 3 +- doc/gperf_3.html | 11 +- doc/gperf_4.html | 19 +-- doc/gperf_5.html | 119 ++++++++++-------- doc/gperf_6.html | 60 +++++---- doc/gperf_7.html | 9 +- doc/gperf_8.html | 9 +- doc/gperf_9.html | 37 +++--- doc/gperf_toc.html | 58 ++++----- 15 files changed, 590 insertions(+), 522 deletions(-) diff --git a/doc/gperf.html b/doc/gperf.html index d619e68..94de289 100644 --- a/doc/gperf.html +++ b/doc/gperf.html @@ -1,13 +1,14 @@ - + Perfect Hash Function Generator -

User's Guide to gperf 3.0.1

+

User's Guide to gperf 3.0.2

The GNU Perfect Hash Function Generator

-

Edition 3.0.1, 12 June 2003

+

Edition 3.0.2, 13 January 2006

Douglas C. Schmidt
Bruno Haible

@@ -20,37 +21,37 @@

  • How to Apply These Terms to Your New Programs
  • Contributors to GNU gperf Utility -
  • 1. Introduction -
  • 2. Static search structures and GNU gperf -
  • 3. High-Level Description of GNU gperf +
  • 1 Introduction +
  • 2 Static search structures and GNU gperf +
  • 3 High-Level Description of GNU gperf -
  • 4. Invoking gperf +
  • 4 Invoking gperf -
  • 5. Known Bugs and Limitations with gperf -
  • 6. Things Still Left to Do -
  • 7. Bibliography +
  • 5 Known Bugs and Limitations with gperf +
  • 6 Things Still Left to Do +
  • 7 Bibliography
  • Concept Index


    @@ -61,7 +62,7 @@

    Version 2, June 1991 - +

     Copyright (C) 1989, 1991 Free Software Foundation, Inc.,
    @@ -86,7 +87,7 @@ using it.  (Some other Free Software Foundation software is covered by
     the GNU Library General Public License instead.)  You can apply it to
     your programs, too.
     
    -
    +

    When we speak of free software, we are referring to freedom, not price. Our General Public Licenses are designed to make sure that you @@ -95,14 +96,14 @@ this service if you wish), that you receive source code or can get it if you want it, that you can change the software or use pieces of it in new free programs; and that you know you can do these things. - +

    To protect your rights, we need to make restrictions that forbid anyone to deny you these rights or to ask you to surrender the rights. These restrictions translate to certain responsibilities for you if you distribute copies of the software, or if you modify it. - +

    For example, if you distribute copies of such a program, whether gratis or for a fee, you must give the recipients all the rights that @@ -110,13 +111,13 @@ you have. You must make sure that they, too, receive or can get the source code. And you must show them these terms so they know their rights. - +

    We protect your rights with two steps: (1) copyright the software, and (2) offer you this license which gives you legal permission to copy, distribute and/or modify the software. - +

    Also, for each author's protection and ours, we want to make certain that everyone understands that there is no warranty for this free @@ -125,7 +126,7 @@ want its recipients to know that what they have is not the original, so that any problems introduced by others will not reflect on the original authors' reputations. - +

    Finally, any free program is threatened constantly by software patents. We wish to avoid the danger that redistributors of a free @@ -133,16 +134,16 @@ program will individually obtain patent licenses, in effect making the program proprietary. To prevent this, we have made it clear that any patent must be licensed for everyone's free use or not licensed at all. - +

    The precise terms and conditions for copying, distribution and modification follow. - +

    TERMS AND CONDITIONS FOR COPYING, DISTRIBUTION AND MODIFICATION - +

    1. @@ -411,7 +412,7 @@ POSSIBILITY OF SUCH DAMAGES.

      END OF TERMS AND CONDITIONS - +

      How to Apply These Terms to Your New Programs

      @@ -421,14 +422,14 @@ END OF TERMS AND CONDITIONS possible use to the public, the best way to achieve this is to make it free software which everyone can redistribute and change under these terms. - +

      To do so, attach the following notices to the program. It is safest to attach them to the start of each source file to most effectively convey the exclusion of warranty; and each file should have at least the "copyright" line and a pointer to where the full notice is found. - +

       one line to give the program's name and an idea of what it does.
      @@ -452,12 +453,12 @@ Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307, USA.
       

      Also add information on how to contact you by electronic and paper mail. - +

      If the program is interactive, make it output a short notice like this when it starts in an interactive mode: - +

       Gnomovision version 69, Copyright (C) year  name of author
      @@ -474,13 +475,13 @@ commands you use may be called something other than `show w' and
       `show c'; they could even be mouse-clicks or menu items--whatever
       suits your program.
       
      -
      +

      You should also get your employer (if you work as a programmer) or your school, if any, to sign a "copyright disclaimer" for the program, if necessary. Here is a sample; alter the names: - +

       Yoyodyne, Inc., hereby disclaims all copyright
      @@ -499,7 +500,7 @@ consider it more useful to permit linking proprietary applications with the
       library.  If this is what you want to do, use the GNU Library General
       Public License instead of this License.
       
      -
      +

      Contributors to GNU gperf Utility

      @@ -536,7 +537,7 @@ added a testsuite. -

      1. Introduction

      +

      1 Introduction

      gperf is a perfect hash function generator written in C++. It @@ -549,7 +550,7 @@ pair of C functions. These functions determine whether a given character string s occurs in W, using at most one probe into the lookup table. - +

      gperf currently generates the reserved keyword recognizer for lexical analyzers in several production and research compilers and @@ -560,14 +561,14 @@ A paper describing gperf's design and implementation in greater detail is available in the Second USENIX C++ Conference proceedings or from http://www.cs.wustl.edu/~schmidt/resume.html. +

      - -

      2. Static search structures and GNU gperf

      +

      2 Static search structures and GNU gperf

      - +

      A static search structure is an Abstract Data Type with certain fundamental operations, e.g., initialize, insert, @@ -583,7 +584,7 @@ commands. Search set members, called keywords, are inserted into the structure only once, usually during program initialization, and are not generally modified at run-time. - +

      Numerous static search structure implementations exist, e.g., arrays, linked lists, binary search trees, digital search tries, and @@ -595,14 +596,14 @@ proportional to log n. Conversely, hash table implementations often locate a table entry in constant time, but typically impose additional memory overhead and exhibit poor worst case performance. - +

      Minimal perfect hash functions provide an optimal solution for a particular class of static search sets. A minimal perfect hash function is defined by two properties: - +

      • @@ -628,7 +629,7 @@ behavior generates near-minimal perfect hash functions for keyword sets. However, gperf provides many options that permit user control over the degree of minimality and perfection. - +

        Static search sets often exhibit relative stability over time. For example, Ada's 63 reserved words have remained constant for nearly a @@ -644,10 +645,10 @@ not yet part of the official GNU distribution. Each compiler utilizes gperf to automatically generate static search structures that efficiently identify their respective reserved keywords. +

        - -

        3. High-Level Description of GNU gperf

        +

        3 High-Level Description of GNU gperf

        The perfect hash function generator gperf reads a set of @@ -660,7 +661,7 @@ that perform hashing and table lookup recognition. All generated C code is directed to the standard output. Command-line options described below allow you to modify the input and output format to gperf. - +

        By default, gperf attempts to produce time-efficient code, with less emphasis on efficient space utilization. However, several options @@ -672,7 +673,7 @@ statement scheme that minimizes data space storage size. Furthermore, using a C switch may actually speed up the keyword retrieval time somewhat. Actual results depend on your C compiler, of course. - +

        In general, gperf assigns values to the bytes it is using for hashing until some set of values gives each keyword a unique value. @@ -680,10 +681,10 @@ A helpful heuristic is that the larger the hash value range, the easier it is for gperf to find and generate a perfect hash function. Experimentation is the key to getting the most from gperf. +

        - -

        3.1 Input Format to gperf

        +

        3.1 Input Format to gperf

        @@ -695,7 +696,7 @@ is similar to GNU utilities flex and bison (or UNIX utilities lex and yacc). Here's an outline of the general format: - +

         declarations
        @@ -710,13 +711,14 @@ functions
         the functions section are optional.  The following sections describe the
         input format for each section.
         
        +

        It is possible to omit the declaration section entirely, if the `-t' option is not given. In this case the input file begins directly with the first keyword line, e.g.: - +

         january
        @@ -728,7 +730,7 @@ april
         
         
         
        -

        3.1.1 Declarations

        +

        3.1.1 Declarations

        The keyword input file optionally contains a section for including @@ -736,10 +738,11 @@ arbitrary C declarations and definitions, gperf declarations that act like command-line options, as well as for providing a user-supplied struct. +

        -

        3.1.1.1 User-supplied struct

        +

        3.1.1.1 User-supplied struct

        If the `-t' option (or, equivalently, the `%struct-type' declaration) @@ -752,12 +755,12 @@ This first field must be called `name', although it is possible to its name with the `-K' option (or, equivalently, the `%define slot-name' declaration) described below. - +

        Here is a simple example, using months of the year and their attributes as input: - +

         struct month { char *name; int number; int days; int leap_days; };
        @@ -783,12 +786,12 @@ other fields are a pair of consecutive percent signs, `%%',
         appearing left justified in the first column, as in the UNIX utility
         lex.
         
        -
        +

        If the struct has already been declared in an include file, it can be mentioned in an abbreviated form, like this: - +

         struct month;
        @@ -799,7 +802,7 @@ january,   1, 31, 31
         
         
         
        -

        3.1.1.2 Gperf Declarations

        +

        3.1.1.2 Gperf Declarations

        The declaration section can contain gperf declarations. They @@ -807,7 +810,7 @@ influence the way gperf works, like command line options do. In fact, every such declaration is equivalent to a command line option. There are three forms of declarations: - +

        1. @@ -828,11 +831,11 @@ Declarations of names of entities in the output file, like When a declaration is given both in the input file and as a command line option, the command-line option's value prevails. - +

          The following gperf declarations are available. - +

          `%delimiters=delimiter-list' @@ -943,7 +946,7 @@ test like `c >= 'A' && c <= 'Z'' guarantees this.)
          Compare keyword lengths before trying a string comparison. This option -is mandatory for binary comparisons (see section 3.3 Use of NUL bytes). It also might +is mandatory for binary comparisons (see section 3.3 Use of NUL bytes). It also might cut down on the number of string comparisons made during the lookup, since keywords with different lengths are never compared via strcmp. However, using `%compare-lengths' might greatly increase the size of the @@ -1024,9 +1027,17 @@ hash table. Default name is `wordlist'. This option permits the use of two hash tables in the same file, even when the option `-G' (or, equivalently, the `%global-table' declaration) is given. -
          `%switch=count' +
          `%define length-table-name name'
          +Allows you to specify the name for the generated array containing the +length table. Default name is `lengthtable'. This option permits the +use of two length tables in the same file, even when the option `-G' +(or, equivalently, the `%global-table' declaration) is given. + +
          `%switch=count' +
          + Causes the generated C code to use a switch statement scheme, rather than an array lookup table. This can lead to a reduction in both time and space requirements for some input files. The argument to this @@ -1039,18 +1050,18 @@ was inspired in part by Keith Bostic's original C program.
          `%omit-struct-type'
          - + Prevents the transfer of the type declaration to the output file. Use this option if the type is already defined elsewhere.
          -

          3.1.1.3 C Code Inclusion

          +

          3.1.1.3 C Code Inclusion

          - + Using a syntax similar to GNU utilities flex and bison, it is possible to directly include C source text and comments verbatim into the generated output file. This is accomplished by enclosing the region @@ -1058,7 +1069,7 @@ inside left-justified surrounding `%{', `%}' pairs. H an input fragment based on the previous example that illustrates this feature: - +

           %{
          @@ -1076,7 +1087,7 @@ march,     3, 31, 31
           
           
           
          -

          3.1.2 Format for Keyword Entries

          +

          3.1.2 Format for Keyword Entries

          The second input file format section contains lines of keywords and any @@ -1086,7 +1097,7 @@ in the first column is considered a comment. Everything following the beginning with `%' in the first column is an option declaration and must not occur within the keywords section. - +

          The first field of each non-comment line is always the keyword itself. It can be given in two ways: as a simple name, i.e., without surrounding @@ -1098,7 +1109,7 @@ In this context, a "field" is considered to extend up to, but not include, the first blank, comma, or newline. Here is a simple example taken from a partial list of C reserved words: - +

           # These are a few C reserved words, see the c.gperf file 
          @@ -1118,7 +1129,7 @@ return
           Note that unlike flex or bison the first `%%' marker
           may be elided if the declaration section is empty.
           
          -
          +

          Additional fields may optionally follow the leading keyword. Fields should be separated by commas, and terminate at the end of line. What @@ -1129,10 +1140,10 @@ declaration section. If the `-t' option (or, equivalently, the these fields are simply ignored. All previous examples except the last one contain keyword attributes. +

          - -

          3.1.3 Including Additional C Functions

          +

          3.1.3 Including Additional C Functions

          The optional third section also corresponds closely with conventions @@ -1142,10 +1153,10 @@ file, is included verbatim into the generated output file. Naturally, it is your responsibility to ensure that the code contained in this section is valid C. +

          - -

          3.1.4 Where to place directives for GNU indent.

          +

          3.1.4 Where to place directives for GNU indent.

          If you want to invoke GNU indent on a gperf input file, @@ -1155,7 +1166,7 @@ interpretation of the input file. Therefore you have to insert some directives for GNU indent. More precisely, assuming the most general input file structure - +

           declarations part 1
          @@ -1173,7 +1184,7 @@ functions
           you would insert `*INDENT-OFF*' and `*INDENT-ON*' comments
           as follows:
           
          -
          +

           /* *INDENT-OFF* */
          @@ -1193,11 +1204,11 @@ functions
           
           
           
          -

          3.2 Output Format for Generated C Code with gperf

          +

          3.2 Output Format for Generated C Code with gperf

          - - + +

          Several options control how the generated C code appears on the standard output. Two C function are generated. They are called hash and @@ -1206,11 +1217,11 @@ option. Both functions require two arguments, a string, char * str, and a length parameter, int len. Their default function prototypes are as follows: - +

          Function: unsigned int hash (const char * str, unsigned int len) -
          +
          By default, the generated hash function returns an integer value created by adding len to several user-specified str byte positions indexed into an associated values table stored in a @@ -1218,14 +1229,14 @@ local static array. The associated values table is constructed internally by gperf and later output as a static local C array called `hash_table'. The relevant selected positions (i.e. indices into str) are specified via the `-k' option when running -gperf, as detailed in the Options section below (see section 4. Invoking gperf). +gperf, as detailed in the Options section below (see section 4 Invoking gperf).
          - +

          Function: in_word_set (const char * str, unsigned int len) -
          +
          If str is in the keyword set, returns a pointer to that keyword. More exactly, if the option `-t' (or, equivalently, the `%struct-type' declaration) was given, it returns @@ -1233,7 +1244,7 @@ a pointer to the matching keyword's structure. Otherwise it returns NULL.
          - +

          If the option `-c' (or, equivalently, the `%compare-strncmp' declaration) is not used, str must be a NUL terminated @@ -1242,12 +1253,12 @@ string of exactly length len. If `-c' (or, equivalently simply be an array of len bytes and does not need to be NUL terminated. - +

          The code generated for these two functions is affected by the following options: - +

          `-t' @@ -1260,7 +1271,7 @@ Make use of the user-defined struct.
          `--switch=total-switch-statements'
          - + Generate 1 or more C switch statement rather than use a large, (and potentially sparse) static array. Although the exact time and space savings of this approach vary according to your C compiler's @@ -1278,14 +1289,14 @@ with the various input and output options, and timing the resulting C code, you can determine the best option choices for different keyword set characteristics. +

          - -

          3.3 Use of NUL bytes

          +

          3.3 Use of NUL bytes

          - - + +

          By default, the code generated by gperf operates on zero terminated strings, the usual representation of strings in C. This means @@ -1293,7 +1304,7 @@ that the keywords in the input file must not contain NUL bytes, and the str argument passed to hash or in_word_set must be NUL terminated and have exactly length len. - +

          If option `-c' (or, equivalently, the `%compare-strncmp' declaration) is used, then the str argument does not need @@ -1302,7 +1313,7 @@ access the first len, not len+1, bytes starting at st However, the keywords in the input file still must not contain NUL bytes. - +

          If option `-l' (or, equivalently, the `%compare-lengths' declaration) is used, then the hash table performs binary @@ -1312,10 +1323,10 @@ generated by gperf will treat NUL like any other byte. Also, in this case the `-c' option (or, equivalently, the `%compare-strncmp' declaration) is ignored. +

          - -

          4. Invoking gperf

          +

          4 Invoking gperf

          There are many options to gperf. They were added to make @@ -1323,10 +1334,11 @@ the program more convenient for use with real applications. "On-line" help is readily available via the `--help' option. Here is the complete list of options. +

          -

          4.1 Specifying the Location of the Output File

          +

          4.1 Specifying the Location of the Output File

          @@ -1339,23 +1351,23 @@ Allows you to specify the name of the file to which the output is written to. The results are written to standard output if no output file is specified or if it is `-'. +

          - -

          4.2 Options that affect Interpretation of the Input File

          +

          4.2 Options that affect Interpretation of the Input File

          These options are also available as declarations in the input file -(see section 3.1.1.2 Gperf Declarations). - +(see section 3.1.1.2 Gperf Declarations). +

          `-e keyword-delimiter-list'
          `--delimiters=keyword-delimiter-list'
          - + Allows you to provide a string containing delimiters used to separate keywords from their attributes. The default is ",". This option is essential if you want to use keywords that have embedded @@ -1388,13 +1400,13 @@ the gperf generated function. -

          4.3 Options to specify the Language for the Output Code

          +

          4.3 Options to specify the Language for the Output Code

          These options are also available as declarations in the input file -(see section 3.1.1.2 Gperf Declarations). - +(see section 3.1.1.2 Gperf Declarations). +

          `-L generated-language-name' @@ -1442,20 +1454,20 @@ This option is supported for compatibility with previous releases of -

          4.4 Options for fine tuning Details in the Output Code

          +

          4.4 Options for fine tuning Details in the Output Code

          Most of these options are also available as declarations in the input file -(see section 3.1.1.2 Gperf Declarations). - +(see section 3.1.1.2 Gperf Declarations). +

          `-K slot-name'
          `--slot-name=slot-name'
          - + This option is only useful when option `-t' (or, equivalently, the `%struct-type' declaration) has been given. By default, the program assumes the structure component identifier for @@ -1467,7 +1479,7 @@ field in your supplied struct.
          `--initializer-suffix=initializers'
          - + This option is only useful when option `-t' (or, equivalently, the `%struct-type' declaration) has been given. It permits to specify initializers for the structure members following @@ -1495,7 +1507,7 @@ generated hash functions to be used in the same application.
          `--class-name=class-name'
          - + This option is only useful when option `-L C++' (or, equivalently, the `%language=C++' declaration) has been given. It allows you to specify the name of generated C++ class. Default name is @@ -1519,7 +1531,7 @@ to support 8-bit and multibyte characters.
          `--compare-lengths'
          Compare keyword lengths before trying a string comparison. This option -is mandatory for binary comparisons (see section 3.3 Use of NUL bytes). It also might +is mandatory for binary comparisons (see section 3.3 Use of NUL bytes). It also might cut down on the number of string comparisons made during the lookup, since keywords with different lengths are never compared via strcmp. However, using `-l' might greatly increase the size of the @@ -1601,17 +1613,25 @@ of one more test-and-branch instruction at run time.
          `--word-array-name=hash-table-array-name'
          - + Allows you to specify the name for the generated array containing the hash table. Default name is `wordlist'. This option permits the use of two hash tables in the same file, even when the option `-G' (or, equivalently, the `%global-table' declaration) is given. +
          `--length-table-name=length-table-array-name' +
          + +Allows you to specify the name for the generated array containing the +length table. Default name is `lengthtable'. This option permits the +use of two length tables in the same file, even when the option `-G' +(or, equivalently, the `%global-table' declaration) is given. +
          `-S total-switch-statements'
          `--switch=total-switch-statements'
          - + Causes the generated C code to use a switch statement scheme, rather than an array lookup table. This can lead to a reduction in both time and space requirements for some input files. The argument to this @@ -1637,7 +1657,7 @@ This option is supported for compatibility with previous releases of -

          4.5 Options for changing the Algorithms employed by gperf

          +

          4.5 Options for changing the Algorithms employed by gperf

          @@ -1671,7 +1691,7 @@ through a search that minimizes the number of byte positions.
          `--duplicates'
          - + Handle keywords whose selected byte sets hash to duplicate values. Duplicate hash values can occur if a set of keywords has the same names, but possesses different attributes, or if the selected byte positions are not well @@ -1708,7 +1728,7 @@ option is not particularly useful when `-S' (or, equivalently,
          `--jump=jump-value'
          - + Affects the "jump value", i.e., how far to advance the associated byte value upon collisions. Jump-value is rounded up to an odd number, the default is 5. If the jump-value is 0 gperf @@ -1762,7 +1782,7 @@ heuristic. -

          4.6 Informative Output

          +

          4.6 Informative Output

          @@ -1793,13 +1813,13 @@ option is enabled. -

          5. Known Bugs and Limitations with gperf

          +

          5 Known Bugs and Limitations with gperf

          The following are some limitations with the current release of gperf: - +

          • @@ -1835,7 +1855,7 @@ the constraint. -

            6. Things Still Left to Do

            +

            6 Things Still Left to Do

            It should be "relatively" easy to replace the current perfect hash @@ -1843,7 +1863,7 @@ function algorithm with a more exhaustive approach; the perfect hash module is essential independent from other program modules. Additional worthwhile improvements include: - +

            • @@ -1866,85 +1886,85 @@ C and C++ routines. -

              7. Bibliography

              +

              7 Bibliography

              [1] Chang, C.C.: A Scheme for Constructing Ordered Minimal Perfect Hashing Functions Information Sciences 39(1986), 187-195. - +

              [2] Cichelli, Richard J. Author's Response to "On Cichelli's Minimal Perfect Hash Functions Method" Communications of the ACM, 23, 12(December 1980), 729. - +

              [3] Cichelli, Richard J. Minimal Perfect Hash Functions Made Simple Communications of the ACM, 23, 1(January 1980), 17-19. - +

              [4] Cook, C. R. and Oldehoeft, R.R. A Letter Oriented Minimal Perfect Hashing Function SIGPLAN Notices, 17, 9(September 1982), 18-27. - +

              [5] Cormack, G. V. and Horspool, R. N. S. and Kaiserwerth, M. Practical Perfect Hashing Computer Journal, 28, 1(January 1985), 54-58. - +

              [6] Jaeschke, G. Reciprocal Hashing: A Method for Generating Minimal Perfect Hashing Functions Communications of the ACM, 24, 12(December 1981), 829-833. - +

              [7] Jaeschke, G. and Osterburg, G. On Cichelli's Minimal Perfect Hash Functions Method Communications of the ACM, 23, 12(December 1980), 728-729. - +

              [8] Sager, Thomas J. A Polynomial Time Generator for Minimal Perfect Hash Functions Communications of the ACM, 28, 5(December 1985), 523-532 - +

              [9] Schmidt, Douglas C. GPERF: A Perfect Hash Function Generator Second USENIX C++ Conference Proceedings, April 1990. - +

              [10] Schmidt, Douglas C. GPERF: A Perfect Hash Function Generator C++ Report, SIGS 10 10 (November/December 1998). - +

              [11] Sebesta, R.W. and Taylor, M.A. Minimal Perfect Hash Functions for Reserved Word Lists SIGPLAN Notices, 20, 12(September 1985), 47-53. - +

              [12] Sprugnoli, R. Perfect Hashing Functions: A Single Probe Retrieving Method for Static Sets Communications of the ACM, 20 11(November 1977), 841-850. - +

              [13] Stallman, Richard M. Using and Porting GNU CC Free Software Foundation, 1988. - +

              [14] Stroustrup, Bjarne The C++ Programming Language. Addison-Wesley, 1986. - +

              [15] Tiemann, Michael D. User's Guide to GNU C++ Free Software Foundation, 1989. - +

              Concept Index

              @@ -1986,6 +2006,7 @@ Jump to:
            • `%define class-name'
            • `%define hash-function-name'
            • `%define initializer-suffix' +
            • `%define length-table-name'
            • `%define lookup-function-name'
            • `%define slot-name'
            • `%define string-pool-name' @@ -1997,17 +2018,17 @@ Jump to:
            • `%includes'
            • `%language'
            • `%null-strings' -
            • `%omit-struct-type' +
            • `%omit-struct-type'
            • `%pic'
            • `%readonly-tables'
            • `%struct-type' -
            • `%switch' -
            • `%{' -
            • `%}' +
            • `%switch' +
            • `%{' +
            • `%}'

              a

              -
            • Array name +
            • Array name, Array name
            • b

              @@ -2015,13 +2036,13 @@ Jump to:

              c

              -
            • Class name +
            • Class name
            • d

            • Declaration section -
            • Delimiters -
            • Duplicates +
            • Delimiters +
            • Duplicates
            • f

              @@ -2030,17 +2051,17 @@ Jump to:

              h

              -
            • hash -
            • hash table +
            • hash +
            • hash table
            • i

              -
            • in_word_set -
            • Initializers +
            • in_word_set +
            • Initializers
            • j

              -
            • Jump value +
            • Jump value
            • k

              @@ -2052,18 +2073,19 @@ Jump to:

              n

              -
            • NUL +
            • NUL
            • s

              -
            • Slot name +
            • Slot name
            • Static search structure -
            • switch, switch +
            • switch, switch
            • - +


              -This document was generated on 12 June 2003 using -texi2html 1.56k. +This document was generated on 13 January 2006 using the +texi2html +translator version 1.52.

              diff --git a/doc/gperf.info b/doc/gperf.info index 821e884..007cd48 100644 --- a/doc/gperf.info +++ b/doc/gperf.info @@ -1,5 +1,4 @@ -Dies ist gperf.info, hergestellt von Makeinfo Version 4.3 aus -gperf.texi. +This is gperf.info, produced by makeinfo version 4.8 from gperf.texi. INFO-DIR-SECTION Programming Tools START-INFO-DIR-ENTRY @@ -7,9 +6,9 @@ START-INFO-DIR-ENTRY END-INFO-DIR-ENTRY This file documents the features of the GNU Perfect Hash Function -Generator 3.0.1. +Generator 3.0.2. - Copyright (C) 1989-2003 Free Software Foundation, Inc. + Copyright (C) 1989-2004 Free Software Foundation, Inc. Permission is granted to make and distribute verbatim copies of this manual provided the copyright notice and this permission notice are @@ -34,7 +33,7 @@ File: gperf.info, Node: Top, Next: Copying, Prev: (dir), Up: (dir) Introduction ************ - This manual documents the GNU `gperf' perfect hash function generator +This manual documents the GNU `gperf' perfect hash function generator utility, focusing on its features and how to use them, and how to report bugs. @@ -88,18 +87,19 @@ GNU GENERAL PUBLIC LICENSE ************************** Version 2, June 1991 + Copyright (C) 1989, 1991 Free Software Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307, USA. - + Everyone is permitted to copy and distribute verbatim copies of this license document, but changing it is not allowed. Preamble ======== - The licenses for most software are designed to take away your -freedom to share and change it. By contrast, the GNU General Public -License is intended to guarantee your freedom to share and change free +The licenses for most software are designed to take away your freedom +to share and change it. By contrast, the GNU General Public License is +intended to guarantee your freedom to share and change free software--to make sure the software is free for all its users. This General Public License applies to most of the Free Software Foundation's software and to any other program whose authors commit to @@ -352,7 +352,6 @@ modification follow. and reuse of software generally. NO WARRANTY - 11. BECAUSE THE PROGRAM IS LICENSED FREE OF CHARGE, THERE IS NO WARRANTY FOR THE PROGRAM, TO THE EXTENT PERMITTED BY APPLICABLE LAW. EXCEPT WHEN OTHERWISE STATED IN WRITING THE COPYRIGHT @@ -376,11 +375,10 @@ modification follow. ADVISED OF THE POSSIBILITY OF SUCH DAMAGES. END OF TERMS AND CONDITIONS - How to Apply These Terms to Your New Programs ============================================= - If you develop a new program, and you want it to be of the greatest +If you develop a new program, and you want it to be of the greatest possible use to the public, the best way to achieve this is to make it free software which everyone can redistribute and change under these terms. @@ -392,17 +390,17 @@ the "copyright" line and a pointer to where the full notice is found. ONE LINE TO GIVE THE PROGRAM'S NAME AND AN IDEA OF WHAT IT DOES. Copyright (C) YEAR NAME OF AUTHOR - + This program is free software; you can redistribute it and/or modify it under the terms of the GNU General Public License as published by the Free Software Foundation; either version 2 of the License, or (at your option) any later version. - + This program is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for more details. - + You should have received a copy of the GNU General Public License along with this program; if not, write to the Free Software Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307, USA. @@ -433,7 +431,7 @@ if necessary. Here is a sample; alter the names: interest in the program `Gnomovision' (which makes passes at compilers) written by James Hacker. - + SIGNATURE OF TY COON, 1 April 1989 Ty Coon, President of Vice @@ -473,10 +471,10 @@ Contributors to GNU `gperf' Utility  File: gperf.info, Node: Motivation, Next: Search Structures, Prev: Contributors, Up: Top -Introduction -************ +1 Introduction +************** - `gperf' is a perfect hash function generator written in C++. It +`gperf' is a perfect hash function generator written in C++. It transforms an N element user-specified keyword set W into a perfect hash function F. F uniquely maps keywords in W onto the range 0..K, where K >= N-1. If K = N-1 then F is a _minimal_ perfect hash function. @@ -496,10 +494,10 @@ available in the Second USENIX C++ Conference proceedings or from  File: gperf.info, Node: Search Structures, Next: Description, Prev: Motivation, Up: Top -Static search structures and GNU `gperf' -**************************************** +2 Static search structures and GNU `gperf' +****************************************** - A "static search structure" is an Abstract Data Type with certain +A "static search structure" is an Abstract Data Type with certain fundamental operations, e.g., _initialize_, _insert_, and _retrieve_. Conceptually, all insertions occur before any retrievals. In practice, `gperf' generates a _static_ array containing search set keywords and @@ -562,8 +560,8 @@ efficiently identify their respective reserved keywords.  File: gperf.info, Node: Description, Next: Options, Prev: Search Structures, Up: Top -High-Level Description of GNU `gperf' -************************************* +3 High-Level Description of GNU `gperf' +*************************************** * Menu: @@ -600,10 +598,10 @@ Experimentation is the key to getting the most from `gperf'.  File: gperf.info, Node: Input Format, Next: Output Format, Prev: Description, Up: Description -Input Format to `gperf' -======================= +3.1 Input Format to `gperf' +=========================== - You can control the input file format by varying certain command-line +You can control the input file format by varying certain command-line arguments, in particular the `-t' option. The input's appearance is similar to GNU utilities `flex' and `bison' (or UNIX utilities `lex' and `yacc'). Here's an outline of the general format: @@ -638,10 +636,10 @@ the first keyword line, e.g.:  File: gperf.info, Node: Declarations, Next: Keywords, Prev: Input Format, Up: Input Format -Declarations ------------- +3.1.1 Declarations +------------------ - The keyword input file optionally contains a section for including +The keyword input file optionally contains a section for including arbitrary C declarations and definitions, `gperf' declarations that act like command-line options, as well as for providing a user-supplied `struct'. @@ -655,10 +653,10 @@ like command-line options, as well as for providing a user-supplied  File: gperf.info, Node: User-supplied Struct, Next: Gperf Declarations, Prev: Declarations, Up: Declarations -User-supplied `struct' -...................... +3.1.1.1 User-supplied `struct' +.............................. - If the `-t' option (or, equivalently, the `%struct-type' declaration) +If the `-t' option (or, equivalently, the `%struct-type' declaration) _is_ enabled, you _must_ provide a C `struct' as the last component in the declaration section from the input file. The first field in this struct must be of type `char *' or `const char *' if the `-P' option is @@ -700,10 +698,10 @@ be mentioned in an abbreviated form, like this:  File: gperf.info, Node: Gperf Declarations, Next: C Code Inclusion, Prev: User-supplied Struct, Up: Declarations -Gperf Declarations -.................. +3.1.1.2 Gperf Declarations +.......................... - The declaration section can contain `gperf' declarations. They +The declaration section can contain `gperf' declarations. They influence the way `gperf' works, like command line options do. In fact, every such declaration is equivalent to a command line option. There are three forms of declarations: @@ -869,6 +867,13 @@ line option, the command-line option's value prevails. the use of two hash tables in the same file, even when the option `-G' (or, equivalently, the `%global-table' declaration) is given. +`%define length-table-name NAME' + Allows you to specify the name for the generated array containing + the length table. Default name is `lengthtable'. This option + permits the use of two length tables in the same file, even when + the option `-G' (or, equivalently, the `%global-table' + declaration) is given. + `%switch=COUNT' Causes the generated C code to use a `switch' statement scheme, rather than an array lookup table. This can lead to a reduction @@ -888,10 +893,10 @@ line option, the command-line option's value prevails.  File: gperf.info, Node: C Code Inclusion, Prev: Gperf Declarations, Up: Declarations -C Code Inclusion -................ +3.1.1.3 C Code Inclusion +........................ - Using a syntax similar to GNU utilities `flex' and `bison', it is +Using a syntax similar to GNU utilities `flex' and `bison', it is possible to directly include C source text and comments verbatim into the generated output file. This is accomplished by enclosing the region inside left-justified surrounding `%{', `%}' pairs. Here is an input @@ -912,13 +917,13 @@ fragment based on the previous example that illustrates this feature:  File: gperf.info, Node: Keywords, Next: Functions, Prev: Declarations, Up: Input Format -Format for Keyword Entries --------------------------- +3.1.2 Format for Keyword Entries +-------------------------------- - The second input file format section contains lines of keywords and -any associated attributes you might supply. A line beginning with `#' -in the first column is considered a comment. Everything following the -`#' is ignored, up to and including the following newline. A line +The second input file format section contains lines of keywords and any +associated attributes you might supply. A line beginning with `#' in +the first column is considered a comment. Everything following the `#' +is ignored, up to and including the following newline. A line beginning with `%' in the first column is an option declaration and must not occur within the keywords section. @@ -959,10 +964,10 @@ attributes.  File: gperf.info, Node: Functions, Next: Controls for GNU indent, Prev: Keywords, Up: Input Format -Including Additional C Functions --------------------------------- +3.1.3 Including Additional C Functions +-------------------------------------- - The optional third section also corresponds closely with conventions +The optional third section also corresponds closely with conventions found in `flex' and `bison'. All text in this section, starting at the final `%%' and extending to the end of the input file, is included verbatim into the generated output file. Naturally, it is your @@ -972,10 +977,10 @@ valid C.  File: gperf.info, Node: Controls for GNU indent, Prev: Functions, Up: Input Format -Where to place directives for GNU `indent'. -------------------------------------------- +3.1.4 Where to place directives for GNU `indent'. +------------------------------------------------- - If you want to invoke GNU `indent' on a `gperf' input file, you will +If you want to invoke GNU `indent' on a `gperf' input file, you will see that GNU `indent' doesn't understand the `%%', `%{' and `%}' directives that control `gperf''s interpretation of the input file. Therefore you have to insert some directives for GNU `indent'. More @@ -1010,17 +1015,17 @@ you would insert `*INDENT-OFF*' and `*INDENT-ON*' comments as follows:  File: gperf.info, Node: Output Format, Next: Binary Strings, Prev: Input Format, Up: Description -Output Format for Generated C Code with `gperf' -=============================================== +3.2 Output Format for Generated C Code with `gperf' +=================================================== - Several options control how the generated C code appears on the -standard output. Two C function are generated. They are called `hash' -and `in_word_set', although you may modify their names with a -command-line option. Both functions require two arguments, a string, -`char *' STR, and a length parameter, `int' LEN. Their default -function prototypes are as follows: +Several options control how the generated C code appears on the standard +output. Two C function are generated. They are called `hash' and +`in_word_set', although you may modify their names with a command-line +option. Both functions require two arguments, a string, `char *' STR, +and a length parameter, `int' LEN. Their default function prototypes +are as follows: - - Funktion: unsigned int hash (const char * STR, unsigned int LEN) + -- Function: unsigned int hash (const char * STR, unsigned int LEN) By default, the generated `hash' function returns an integer value created by adding LEN to several user-specified STR byte positions indexed into an "associated values" table stored in a local static @@ -1030,7 +1035,7 @@ function prototypes are as follows: STR) are specified via the `-k' option when running `gperf', as detailed in the _Options_ section below (*note Options::). - - Funktion: in_word_set (const char * STR, unsigned int LEN) + -- Function: in_word_set (const char * STR, unsigned int LEN) If STR is in the keyword set, returns a pointer to that keyword. More exactly, if the option `-t' (or, equivalently, the `%struct-type' declaration) was given, it returns a pointer to the @@ -1068,14 +1073,14 @@ set characteristics.  File: gperf.info, Node: Binary Strings, Prev: Output Format, Up: Description -Use of NUL bytes -================ +3.3 Use of NUL bytes +==================== - By default, the code generated by `gperf' operates on zero -terminated strings, the usual representation of strings in C. This -means that the keywords in the input file must not contain NUL bytes, -and the STR argument passed to `hash' or `in_word_set' must be NUL -terminated and have exactly length LEN. +By default, the code generated by `gperf' operates on zero terminated +strings, the usual representation of strings in C. This means that the +keywords in the input file must not contain NUL bytes, and the STR +argument passed to `hash' or `in_word_set' must be NUL terminated and +have exactly length LEN. If option `-c' (or, equivalently, the `%compare-strncmp' declaration) is used, then the STR argument does not need to be NUL @@ -1093,10 +1098,10 @@ equivalently, the `%compare-strncmp' declaration) is ignored.  File: gperf.info, Node: Options, Next: Bugs, Prev: Description, Up: Top -Invoking `gperf' -**************** +4 Invoking `gperf' +****************** - There are _many_ options to `gperf'. They were added to make the +There are _many_ options to `gperf'. They were added to make the program more convenient for use with real applications. "On-line" help is readily available via the `--help' option. Here is the complete list of options. @@ -1113,8 +1118,8 @@ list of options.  File: gperf.info, Node: Output File, Next: Input Details, Prev: Options, Up: Options -Specifying the Location of the Output File -========================================== +4.1 Specifying the Location of the Output File +============================================== `--output-file=FILE' Allows you to specify the name of the file to which the output is @@ -1126,10 +1131,10 @@ specified or if it is `-'.  File: gperf.info, Node: Input Details, Next: Output Language, Prev: Output File, Up: Options -Options that affect Interpretation of the Input File -==================================================== +4.2 Options that affect Interpretation of the Input File +======================================================== - These options are also available as declarations in the input file +These options are also available as declarations in the input file (*note Gperf Declarations::). `-e KEYWORD-DELIMITER-LIST' @@ -1165,10 +1170,10 @@ Options that affect Interpretation of the Input File  File: gperf.info, Node: Output Language, Next: Output Details, Prev: Input Details, Up: Options -Options to specify the Language for the Output Code -=================================================== +4.3 Options to specify the Language for the Output Code +======================================================= - These options are also available as declarations in the input file +These options are also available as declarations in the input file (*note Gperf Declarations::). `-L GENERATED-LANGUAGE-NAME' @@ -1207,11 +1212,11 @@ Options to specify the Language for the Output Code  File: gperf.info, Node: Output Details, Next: Algorithmic Details, Prev: Output Language, Up: Options -Options for fine tuning Details in the Output Code -================================================== +4.4 Options for fine tuning Details in the Output Code +====================================================== - Most of these options are also available as declarations in the -input file (*note Gperf Declarations::). +Most of these options are also available as declarations in the input +file (*note Gperf Declarations::). `-K SLOT-NAME' `--slot-name=SLOT-NAME' @@ -1338,6 +1343,13 @@ input file (*note Gperf Declarations::). the use of two hash tables in the same file, even when the option `-G' (or, equivalently, the `%global-table' declaration) is given. +`--length-table-name=LENGTH-TABLE-ARRAY-NAME' + Allows you to specify the name for the generated array containing + the length table. Default name is `lengthtable'. This option + permits the use of two length tables in the same file, even when + the option `-G' (or, equivalently, the `%global-table' + declaration) is given. + `-S TOTAL-SWITCH-STATEMENTS' `--switch=TOTAL-SWITCH-STATEMENTS' Causes the generated C code to use a `switch' statement scheme, @@ -1363,8 +1375,8 @@ input file (*note Gperf Declarations::).  File: gperf.info, Node: Algorithmic Details, Next: Verbosity, Prev: Output Details, Up: Options -Options for changing the Algorithms employed by `gperf' -======================================================= +4.5 Options for changing the Algorithms employed by `gperf' +=========================================================== `-k SELECTED-BYTE-POSITIONS' `--key-positions=SELECTED-BYTE-POSITIONS' @@ -1472,8 +1484,8 @@ Options for changing the Algorithms employed by `gperf'  File: gperf.info, Node: Verbosity, Prev: Algorithmic Details, Up: Options -Informative Output -================== +4.6 Informative Output +====================== `-h' `--help' @@ -1496,11 +1508,10 @@ Informative Output  File: gperf.info, Node: Bugs, Next: Projects, Prev: Options, Up: Top -Known Bugs and Limitations with `gperf' -*************************************** +5 Known Bugs and Limitations with `gperf' +***************************************** - The following are some limitations with the current release of -`gperf': +The following are some limitations with the current release of `gperf': * The `gperf' utility is tuned to execute quickly, and works quickly for small to medium size data sets (around 1000 keywords). It is @@ -1529,10 +1540,10 @@ Known Bugs and Limitations with `gperf'  File: gperf.info, Node: Projects, Next: Bibliography, Prev: Bugs, Up: Top -Things Still Left to Do -*********************** +6 Things Still Left to Do +************************* - It should be "relatively" easy to replace the current perfect hash +It should be "relatively" easy to replace the current perfect hash function algorithm with a more exhaustive approach; the perfect hash module is essential independent from other program modules. Additional worthwhile improvements include: @@ -1554,10 +1565,10 @@ worthwhile improvements include:  File: gperf.info, Node: Bibliography, Next: Concept Index, Prev: Projects, Up: Top -Bibliography -************ +7 Bibliography +************** - [1] Chang, C.C.: A Scheme for Constructing Ordered Minimal Perfect +[1] Chang, C.C.: A Scheme for Constructing Ordered Minimal Perfect Hashing Functions Information Sciences 39(1986), 187-195. [2] Cichelli, Richard J. Author's Response to "On Cichelli's Minimal @@ -1612,83 +1623,86 @@ File: gperf.info, Node: Concept Index, Prev: Bibliography, Up: Top Concept Index ************* +[index] * Menu: * %%: User-supplied Struct. -* %7bit: Gperf Declarations. -* %compare-lengths: Gperf Declarations. -* %compare-strncmp: Gperf Declarations. -* %define class-name: Gperf Declarations. -* %define hash-function-name: Gperf Declarations. -* %define initializer-suffix: Gperf Declarations. -* %define lookup-function-name: Gperf Declarations. -* %define slot-name: Gperf Declarations. -* %define string-pool-name: Gperf Declarations. -* %define word-array-name: Gperf Declarations. -* %delimiters: Gperf Declarations. -* %enum: Gperf Declarations. -* %global-table: Gperf Declarations. -* %ignore-case: Gperf Declarations. -* %includes: Gperf Declarations. -* %language: Gperf Declarations. -* %null-strings: Gperf Declarations. -* %omit-struct-type: Gperf Declarations. -* %pic: Gperf Declarations. -* %readonly-tables: Gperf Declarations. -* %struct-type: Gperf Declarations. -* %switch: Gperf Declarations. -* %{: C Code Inclusion. -* %}: C Code Inclusion. -* Array name: Output Details. -* Bugs: Contributors. -* Class name: Output Details. -* Declaration section: Input Format. -* Delimiters: Input Details. -* Duplicates: Algorithmic Details. -* Format: Input Format. -* Functions section: Input Format. -* hash: Output Format. -* hash table: Output Format. -* in_word_set: Output Format. -* Initializers: Output Details. -* Jump value: Algorithmic Details. -* Keywords section: Input Format. -* Minimal perfect hash functions: Search Structures. -* NUL: Binary Strings. -* Slot name: Output Details. -* Static search structure: Search Structures. -* switch <1>: Output Details. -* switch: Output Format. + (line 33) +* %7bit: Gperf Declarations. (line 95) +* %compare-lengths: Gperf Declarations. (line 103) +* %compare-strncmp: Gperf Declarations. (line 115) +* %define class-name: Gperf Declarations. (line 89) +* %define hash-function-name: Gperf Declarations. (line 79) +* %define initializer-suffix: Gperf Declarations. (line 71) +* %define length-table-name: Gperf Declarations. (line 173) +* %define lookup-function-name: Gperf Declarations. (line 84) +* %define slot-name: Gperf Declarations. (line 63) +* %define string-pool-name: Gperf Declarations. (line 152) +* %define word-array-name: Gperf Declarations. (line 167) +* %delimiters: Gperf Declarations. (line 24) +* %enum: Gperf Declarations. (line 124) +* %global-table: Gperf Declarations. (line 135) +* %ignore-case: Gperf Declarations. (line 34) +* %includes: Gperf Declarations. (line 130) +* %language: Gperf Declarations. (line 39) +* %null-strings: Gperf Declarations. (line 160) +* %omit-struct-type: Gperf Declarations. (line 192) +* %pic: Gperf Declarations. (line 140) +* %readonly-tables: Gperf Declarations. (line 119) +* %struct-type: Gperf Declarations. (line 30) +* %switch: Gperf Declarations. (line 180) +* %{: C Code Inclusion. (line 6) +* %}: C Code Inclusion. (line 6) +* Array name: Output Details. (line 129) +* Bugs: Contributors. (line 6) +* Class name: Output Details. (line 41) +* Declaration section: Input Format. (line 6) +* Delimiters: Input Details. (line 11) +* Duplicates: Algorithmic Details. (line 32) +* Format: Input Format. (line 6) +* Functions section: Input Format. (line 6) +* hash: Output Format. (line 14) +* hash table: Output Format. (line 6) +* in_word_set: Output Format. (line 24) +* Initializers: Output Details. (line 20) +* Jump value: Algorithmic Details. (line 63) +* Keywords section: Input Format. (line 6) +* Minimal perfect hash functions: Search Structures. (line 30) +* NUL: Binary Strings. (line 6) +* Slot name: Output Details. (line 11) +* Static search structure: Search Structures. (line 6) +* switch <1>: Output Details. (line 143) +* switch: Output Format. (line 44)  Tag Table: -Node: Top1240 -Node: Copying3324 -Node: Contributors22513 -Node: Motivation23706 -Node: Search Structures24834 -Node: Description28389 -Node: Input Format30282 -Node: Declarations31419 -Node: User-supplied Struct31995 -Node: Gperf Declarations33594 -Node: C Code Inclusion42004 -Node: Keywords42831 -Node: Functions44767 -Node: Controls for GNU indent45293 -Node: Output Format46232 -Node: Binary Strings49016 -Node: Options50159 -Node: Output File50944 -Node: Input Details51328 -Node: Output Language53159 -Node: Output Details54570 -Node: Algorithmic Details61485 -Node: Verbosity66734 -Node: Bugs67437 -Node: Projects69029 -Node: Bibliography70157 -Node: Concept Index72213 +Node: Top1236 +Node: Copying3317 +Node: Contributors22474 +Node: Motivation23667 +Node: Search Structures24796 +Node: Description28352 +Node: Input Format30249 +Node: Declarations31391 +Node: User-supplied Struct31976 +Node: Gperf Declarations33588 +Node: C Code Inclusion42342 +Node: Keywords43182 +Node: Functions45127 +Node: Controls for GNU indent45662 +Node: Output Format46610 +Node: Binary Strings49401 +Node: Options50549 +Node: Output File51335 +Node: Input Details51727 +Node: Output Language53563 +Node: Output Details54979 +Node: Algorithmic Details62243 +Node: Verbosity67500 +Node: Bugs68211 +Node: Projects69804 +Node: Bibliography70933 +Node: Concept Index72990  End Tag Table diff --git a/doc/gperf.pdf b/doc/gperf.pdf index 43b6b33..1838169 100644 Binary files a/doc/gperf.pdf and b/doc/gperf.pdf differ diff --git a/doc/gperf.texi b/doc/gperf.texi index 8978e15..4c57cfe 100644 --- a/doc/gperf.texi +++ b/doc/gperf.texi @@ -7,7 +7,7 @@ @c some day we should @include version.texi instead of defining @c these values at hand. -@set UPDATED 30 July 2005 +@set UPDATED 13 January 2006 @set EDITION 3.0.2 @set VERSION 3.0.2 @c --------------------- diff --git a/doc/gperf_1.html b/doc/gperf_1.html index c937fc8..fbd9b45 100644 --- a/doc/gperf_1.html +++ b/doc/gperf_1.html @@ -1,6 +1,7 @@ - + Perfect Hash Function Generator - GNU GENERAL PUBLIC LICENSE @@ -14,7 +15,7 @@ Go to the first, previous, next, How to Apply These Terms to Your New Programs @@ -374,14 +375,14 @@ END OF TERMS AND CONDITIONS possible use to the public, the best way to achieve this is to make it free software which everyone can redistribute and change under these terms. - +

              To do so, attach the following notices to the program. It is safest to attach them to the start of each source file to most effectively convey the exclusion of warranty; and each file should have at least the "copyright" line and a pointer to where the full notice is found. - +

               one line to give the program's name and an idea of what it does.
              @@ -405,12 +406,12 @@ Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307, USA.
               

              Also add information on how to contact you by electronic and paper mail. - +

              If the program is interactive, make it output a short notice like this when it starts in an interactive mode: - +

               Gnomovision version 69, Copyright (C) year  name of author
              @@ -427,13 +428,13 @@ commands you use may be called something other than `show w' and
               `show c'; they could even be mouse-clicks or menu items--whatever
               suits your program.
               
              -
              +

              You should also get your employer (if you work as a programmer) or your school, if any, to sign a "copyright disclaimer" for the program, if necessary. Here is a sample; alter the names: - +

               Yoyodyne, Inc., hereby disclaims all copyright
              @@ -452,7 +453,7 @@ consider it more useful to permit linking proprietary applications with the
               library.  If this is what you want to do, use the GNU Library General
               Public License instead of this License.
               
              -
              +


              Go to the first, previous, next, last section, table of contents. diff --git a/doc/gperf_10.html b/doc/gperf_10.html index 39a2630..aa5e374 100644 --- a/doc/gperf_10.html +++ b/doc/gperf_10.html @@ -1,6 +1,7 @@ - + Perfect Hash Function Generator - Concept Index @@ -48,6 +49,7 @@ Jump to:

            • `%define class-name'
            • `%define hash-function-name'
            • `%define initializer-suffix' +
            • `%define length-table-name'
            • `%define lookup-function-name'
            • `%define slot-name'
            • `%define string-pool-name' @@ -59,17 +61,17 @@ Jump to:
            • `%includes'
            • `%language'
            • `%null-strings' -
            • `%omit-struct-type' +
            • `%omit-struct-type'
            • `%pic'
            • `%readonly-tables'
            • `%struct-type' -
            • `%switch' -
            • `%{' -
            • `%}' +
            • `%switch' +
            • `%{' +
            • `%}'

              a

              -
            • Array name +
            • Array name, Array name
            • b

              @@ -77,13 +79,13 @@ Jump to:

              c

              -
            • Class name +
            • Class name
            • d

            • Declaration section -
            • Delimiters -
            • Duplicates +
            • Delimiters +
            • Duplicates
            • f

              @@ -92,17 +94,17 @@ Jump to:

              h

              -
            • hash -
            • hash table +
            • hash +
            • hash table
            • i

              -
            • in_word_set -
            • Initializers +
            • in_word_set +
            • Initializers
            • j

              -
            • Jump value +
            • Jump value
            • k

              @@ -114,16 +116,16 @@ Jump to:

              n

              -
            • NUL +
            • NUL
            • s

              -
            • Slot name +
            • Slot name
            • Static search structure -
            • switch, switch +
            • switch, switch
            • - +


              Go to the first, previous, next, last section, table of contents. diff --git a/doc/gperf_2.html b/doc/gperf_2.html index d416b38..c30185e 100644 --- a/doc/gperf_2.html +++ b/doc/gperf_2.html @@ -1,6 +1,7 @@ - + Perfect Hash Function Generator - Contributors to GNU gperf Utility diff --git a/doc/gperf_3.html b/doc/gperf_3.html index 75c03ad..52c5915 100644 --- a/doc/gperf_3.html +++ b/doc/gperf_3.html @@ -1,15 +1,16 @@ - + -Perfect Hash Function Generator - 1. Introduction +Perfect Hash Function Generator - 1 Introduction Go to the first, previous, next, last section, table of contents.


              -

              1. Introduction

              +

              1 Introduction

              gperf is a perfect hash function generator written in C++. It @@ -22,7 +23,7 @@ pair of C functions. These functions determine whether a given character string s occurs in W, using at most one probe into the lookup table. - +

              gperf currently generates the reserved keyword recognizer for lexical analyzers in several production and research compilers and @@ -33,7 +34,7 @@ A paper describing gperf's design and implementation in greater detail is available in the Second USENIX C++ Conference proceedings or from http://www.cs.wustl.edu/~schmidt/resume.html. - +


              Go to the first, previous, next, last section, table of contents. diff --git a/doc/gperf_4.html b/doc/gperf_4.html index 2c7bf70..2a26ae1 100644 --- a/doc/gperf_4.html +++ b/doc/gperf_4.html @@ -1,19 +1,20 @@ - + -Perfect Hash Function Generator - 2. Static search structures and GNU gperf +Perfect Hash Function Generator - 2 Static search structures and GNU gperf Go to the first, previous, next, last section, table of contents.


              -

              2. Static search structures and GNU gperf

              +

              2 Static search structures and GNU gperf

              - +

              A static search structure is an Abstract Data Type with certain fundamental operations, e.g., initialize, insert, @@ -29,7 +30,7 @@ commands. Search set members, called keywords, are inserted into the structure only once, usually during program initialization, and are not generally modified at run-time. - +

              Numerous static search structure implementations exist, e.g., arrays, linked lists, binary search trees, digital search tries, and @@ -41,14 +42,14 @@ proportional to log n. Conversely, hash table implementations often locate a table entry in constant time, but typically impose additional memory overhead and exhibit poor worst case performance. - +

              Minimal perfect hash functions provide an optimal solution for a particular class of static search sets. A minimal perfect hash function is defined by two properties: - +

              • @@ -74,7 +75,7 @@ behavior generates near-minimal perfect hash functions for keyword sets. However, gperf provides many options that permit user control over the degree of minimality and perfection. - +

                Static search sets often exhibit relative stability over time. For example, Ada's 63 reserved words have remained constant for nearly a @@ -90,7 +91,7 @@ not yet part of the official GNU distribution. Each compiler utilizes gperf to automatically generate static search structures that efficiently identify their respective reserved keywords. - +


                Go to the first, previous, next, last section, table of contents. diff --git a/doc/gperf_5.html b/doc/gperf_5.html index 8b6fd53..a190e02 100644 --- a/doc/gperf_5.html +++ b/doc/gperf_5.html @@ -1,15 +1,16 @@ - + -Perfect Hash Function Generator - 3. High-Level Description of GNU gperf +Perfect Hash Function Generator - 3 High-Level Description of GNU gperf Go to the first, previous, next, last section, table of contents.


                -

                3. High-Level Description of GNU gperf

                +

                3 High-Level Description of GNU gperf

                The perfect hash function generator gperf reads a set of @@ -22,7 +23,7 @@ that perform hashing and table lookup recognition. All generated C code is directed to the standard output. Command-line options described below allow you to modify the input and output format to gperf. - +

                By default, gperf attempts to produce time-efficient code, with less emphasis on efficient space utilization. However, several options @@ -34,7 +35,7 @@ statement scheme that minimizes data space storage size. Furthermore, using a C switch may actually speed up the keyword retrieval time somewhat. Actual results depend on your C compiler, of course. - +

                In general, gperf assigns values to the bytes it is using for hashing until some set of values gives each keyword a unique value. @@ -42,10 +43,10 @@ A helpful heuristic is that the larger the hash value range, the easier it is for gperf to find and generate a perfect hash function. Experimentation is the key to getting the most from gperf. +

                - -

                3.1 Input Format to gperf

                +

                3.1 Input Format to gperf

                @@ -57,7 +58,7 @@ is similar to GNU utilities flex and bison (or UNIX utilities lex and yacc). Here's an outline of the general format: - +

                 declarations
                @@ -72,13 +73,14 @@ functions
                 the functions section are optional.  The following sections describe the
                 input format for each section.
                 
                +

                It is possible to omit the declaration section entirely, if the `-t' option is not given. In this case the input file begins directly with the first keyword line, e.g.: - +

                 january
                @@ -90,7 +92,7 @@ april
                 
                 
                 
                -

                3.1.1 Declarations

                +

                3.1.1 Declarations

                The keyword input file optionally contains a section for including @@ -98,10 +100,11 @@ arbitrary C declarations and definitions, gperf declarations that act like command-line options, as well as for providing a user-supplied struct. +

                -

                3.1.1.1 User-supplied struct

                +

                3.1.1.1 User-supplied struct

                If the `-t' option (or, equivalently, the `%struct-type' declaration) @@ -114,12 +117,12 @@ This first field must be called `name', although it is possible to its name with the `-K' option (or, equivalently, the `%define slot-name' declaration) described below. - +

                Here is a simple example, using months of the year and their attributes as input: - +

                 struct month { char *name; int number; int days; int leap_days; };
                @@ -145,12 +148,12 @@ other fields are a pair of consecutive percent signs, `%%',
                 appearing left justified in the first column, as in the UNIX utility
                 lex.
                 
                -
                +

                If the struct has already been declared in an include file, it can be mentioned in an abbreviated form, like this: - +

                 struct month;
                @@ -161,7 +164,7 @@ january,   1, 31, 31
                 
                 
                 
                -

                3.1.1.2 Gperf Declarations

                +

                3.1.1.2 Gperf Declarations

                The declaration section can contain gperf declarations. They @@ -169,7 +172,7 @@ influence the way gperf works, like command line options do. In fact, every such declaration is equivalent to a command line option. There are three forms of declarations: - +

                1. @@ -190,11 +193,11 @@ Declarations of names of entities in the output file, like When a declaration is given both in the input file and as a command line option, the command-line option's value prevails. - +

                  The following gperf declarations are available. - +

                  `%delimiters=delimiter-list' @@ -305,7 +308,7 @@ test like `c >= 'A' && c <= 'Z'' guarantees this.)
                  Compare keyword lengths before trying a string comparison. This option -is mandatory for binary comparisons (see section 3.3 Use of NUL bytes). It also might +is mandatory for binary comparisons (see section 3.3 Use of NUL bytes). It also might cut down on the number of string comparisons made during the lookup, since keywords with different lengths are never compared via strcmp. However, using `%compare-lengths' might greatly increase the size of the @@ -386,9 +389,17 @@ hash table. Default name is `wordlist'. This option permits the use of two hash tables in the same file, even when the option `-G' (or, equivalently, the `%global-table' declaration) is given. -
                  `%switch=count' +
                  `%define length-table-name name'
                  +Allows you to specify the name for the generated array containing the +length table. Default name is `lengthtable'. This option permits the +use of two length tables in the same file, even when the option `-G' +(or, equivalently, the `%global-table' declaration) is given. + +
                  `%switch=count' +
                  + Causes the generated C code to use a switch statement scheme, rather than an array lookup table. This can lead to a reduction in both time and space requirements for some input files. The argument to this @@ -401,18 +412,18 @@ was inspired in part by Keith Bostic's original C program.
                  `%omit-struct-type'
                  - + Prevents the transfer of the type declaration to the output file. Use this option if the type is already defined elsewhere.
                  -

                  3.1.1.3 C Code Inclusion

                  +

                  3.1.1.3 C Code Inclusion

                  - + Using a syntax similar to GNU utilities flex and bison, it is possible to directly include C source text and comments verbatim into the generated output file. This is accomplished by enclosing the region @@ -420,7 +431,7 @@ inside left-justified surrounding `%{', `%}' pairs. H an input fragment based on the previous example that illustrates this feature: - +

                   %{
                  @@ -438,7 +449,7 @@ march,     3, 31, 31
                   
                   
                   
                  -

                  3.1.2 Format for Keyword Entries

                  +

                  3.1.2 Format for Keyword Entries

                  The second input file format section contains lines of keywords and any @@ -448,7 +459,7 @@ in the first column is considered a comment. Everything following the beginning with `%' in the first column is an option declaration and must not occur within the keywords section. - +

                  The first field of each non-comment line is always the keyword itself. It can be given in two ways: as a simple name, i.e., without surrounding @@ -460,7 +471,7 @@ In this context, a "field" is considered to extend up to, but not include, the first blank, comma, or newline. Here is a simple example taken from a partial list of C reserved words: - +

                   # These are a few C reserved words, see the c.gperf file 
                  @@ -480,7 +491,7 @@ return
                   Note that unlike flex or bison the first `%%' marker
                   may be elided if the declaration section is empty.
                   
                  -
                  +

                  Additional fields may optionally follow the leading keyword. Fields should be separated by commas, and terminate at the end of line. What @@ -491,10 +502,10 @@ declaration section. If the `-t' option (or, equivalently, the these fields are simply ignored. All previous examples except the last one contain keyword attributes. +

                  - -

                  3.1.3 Including Additional C Functions

                  +

                  3.1.3 Including Additional C Functions

                  The optional third section also corresponds closely with conventions @@ -504,10 +515,10 @@ file, is included verbatim into the generated output file. Naturally, it is your responsibility to ensure that the code contained in this section is valid C. +

                  - -

                  3.1.4 Where to place directives for GNU indent.

                  +

                  3.1.4 Where to place directives for GNU indent.

                  If you want to invoke GNU indent on a gperf input file, @@ -517,7 +528,7 @@ interpretation of the input file. Therefore you have to insert some directives for GNU indent. More precisely, assuming the most general input file structure - +

                   declarations part 1
                  @@ -535,7 +546,7 @@ functions
                   you would insert `*INDENT-OFF*' and `*INDENT-ON*' comments
                   as follows:
                   
                  -
                  +

                   /* *INDENT-OFF* */
                  @@ -555,11 +566,11 @@ functions
                   
                   
                   
                  -

                  3.2 Output Format for Generated C Code with gperf

                  +

                  3.2 Output Format for Generated C Code with gperf

                  - - + +

                  Several options control how the generated C code appears on the standard output. Two C function are generated. They are called hash and @@ -568,11 +579,11 @@ option. Both functions require two arguments, a string, char * str, and a length parameter, int len. Their default function prototypes are as follows: - +

                  Function: unsigned int hash (const char * str, unsigned int len) -
                  +
                  By default, the generated hash function returns an integer value created by adding len to several user-specified str byte positions indexed into an associated values table stored in a @@ -580,14 +591,14 @@ local static array. The associated values table is constructed internally by gperf and later output as a static local C array called `hash_table'. The relevant selected positions (i.e. indices into str) are specified via the `-k' option when running -gperf, as detailed in the Options section below (see section 4. Invoking gperf). +gperf, as detailed in the Options section below (see section 4 Invoking gperf).
                  - +

                  Function: in_word_set (const char * str, unsigned int len) -
                  +
                  If str is in the keyword set, returns a pointer to that keyword. More exactly, if the option `-t' (or, equivalently, the `%struct-type' declaration) was given, it returns @@ -595,7 +606,7 @@ a pointer to the matching keyword's structure. Otherwise it returns NULL.
                  - +

                  If the option `-c' (or, equivalently, the `%compare-strncmp' declaration) is not used, str must be a NUL terminated @@ -604,12 +615,12 @@ string of exactly length len. If `-c' (or, equivalently simply be an array of len bytes and does not need to be NUL terminated. - +

                  The code generated for these two functions is affected by the following options: - +

                  `-t' @@ -622,7 +633,7 @@ Make use of the user-defined struct.
                  `--switch=total-switch-statements'
                  - + Generate 1 or more C switch statement rather than use a large, (and potentially sparse) static array. Although the exact time and space savings of this approach vary according to your C compiler's @@ -640,14 +651,14 @@ with the various input and output options, and timing the resulting C code, you can determine the best option choices for different keyword set characteristics. +

                  - -

                  3.3 Use of NUL bytes

                  +

                  3.3 Use of NUL bytes

                  - - + +

                  By default, the code generated by gperf operates on zero terminated strings, the usual representation of strings in C. This means @@ -655,7 +666,7 @@ that the keywords in the input file must not contain NUL bytes, and the str argument passed to hash or in_word_set must be NUL terminated and have exactly length len. - +

                  If option `-c' (or, equivalently, the `%compare-strncmp' declaration) is used, then the str argument does not need @@ -664,7 +675,7 @@ access the first len, not len+1, bytes starting at st However, the keywords in the input file still must not contain NUL bytes. - +

                  If option `-l' (or, equivalently, the `%compare-lengths' declaration) is used, then the hash table performs binary @@ -674,7 +685,7 @@ generated by gperf will treat NUL like any other byte. Also, in this case the `-c' option (or, equivalently, the `%compare-strncmp' declaration) is ignored. - +


                  Go to the first, previous, next, last section, table of contents. diff --git a/doc/gperf_6.html b/doc/gperf_6.html index 05b48cd..06af523 100644 --- a/doc/gperf_6.html +++ b/doc/gperf_6.html @@ -1,15 +1,16 @@ - + -Perfect Hash Function Generator - 4. Invoking gperf +Perfect Hash Function Generator - 4 Invoking gperf Go to the first, previous, next, last section, table of contents.


                  -

                  4. Invoking gperf

                  +

                  4 Invoking gperf

                  There are many options to gperf. They were added to make @@ -17,10 +18,11 @@ the program more convenient for use with real applications. "On-line" help is readily available via the `--help' option. Here is the complete list of options. +

                  -

                  4.1 Specifying the Location of the Output File

                  +

                  4.1 Specifying the Location of the Output File

                  @@ -33,23 +35,23 @@ Allows you to specify the name of the file to which the output is written to. The results are written to standard output if no output file is specified or if it is `-'. +

                  - -

                  4.2 Options that affect Interpretation of the Input File

                  +

                  4.2 Options that affect Interpretation of the Input File

                  These options are also available as declarations in the input file -(see section 3.1.1.2 Gperf Declarations). - +(see section 3.1.1.2 Gperf Declarations). +

                  `-e keyword-delimiter-list'
                  `--delimiters=keyword-delimiter-list'
                  - + Allows you to provide a string containing delimiters used to separate keywords from their attributes. The default is ",". This option is essential if you want to use keywords that have embedded @@ -82,13 +84,13 @@ the gperf generated function. -

                  4.3 Options to specify the Language for the Output Code

                  +

                  4.3 Options to specify the Language for the Output Code

                  These options are also available as declarations in the input file -(see section 3.1.1.2 Gperf Declarations). - +(see section 3.1.1.2 Gperf Declarations). +

                  `-L generated-language-name' @@ -136,20 +138,20 @@ This option is supported for compatibility with previous releases of -

                  4.4 Options for fine tuning Details in the Output Code

                  +

                  4.4 Options for fine tuning Details in the Output Code

                  Most of these options are also available as declarations in the input file -(see section 3.1.1.2 Gperf Declarations). - +(see section 3.1.1.2 Gperf Declarations). +

                  `-K slot-name'
                  `--slot-name=slot-name'
                  - + This option is only useful when option `-t' (or, equivalently, the `%struct-type' declaration) has been given. By default, the program assumes the structure component identifier for @@ -161,7 +163,7 @@ field in your supplied struct.
                  `--initializer-suffix=initializers'
                  - + This option is only useful when option `-t' (or, equivalently, the `%struct-type' declaration) has been given. It permits to specify initializers for the structure members following @@ -189,7 +191,7 @@ generated hash functions to be used in the same application.
                  `--class-name=class-name'
                  - + This option is only useful when option `-L C++' (or, equivalently, the `%language=C++' declaration) has been given. It allows you to specify the name of generated C++ class. Default name is @@ -213,7 +215,7 @@ to support 8-bit and multibyte characters.
                  `--compare-lengths'
                  Compare keyword lengths before trying a string comparison. This option -is mandatory for binary comparisons (see section 3.3 Use of NUL bytes). It also might +is mandatory for binary comparisons (see section 3.3 Use of NUL bytes). It also might cut down on the number of string comparisons made during the lookup, since keywords with different lengths are never compared via strcmp. However, using `-l' might greatly increase the size of the @@ -295,17 +297,25 @@ of one more test-and-branch instruction at run time.
                  `--word-array-name=hash-table-array-name'
                  - + Allows you to specify the name for the generated array containing the hash table. Default name is `wordlist'. This option permits the use of two hash tables in the same file, even when the option `-G' (or, equivalently, the `%global-table' declaration) is given. +
                  `--length-table-name=length-table-array-name' +
                  + +Allows you to specify the name for the generated array containing the +length table. Default name is `lengthtable'. This option permits the +use of two length tables in the same file, even when the option `-G' +(or, equivalently, the `%global-table' declaration) is given. +
                  `-S total-switch-statements'
                  `--switch=total-switch-statements'
                  - + Causes the generated C code to use a switch statement scheme, rather than an array lookup table. This can lead to a reduction in both time and space requirements for some input files. The argument to this @@ -331,7 +341,7 @@ This option is supported for compatibility with previous releases of -

                  4.5 Options for changing the Algorithms employed by gperf

                  +

                  4.5 Options for changing the Algorithms employed by gperf

                  @@ -365,7 +375,7 @@ through a search that minimizes the number of byte positions.
                  `--duplicates'
                  - + Handle keywords whose selected byte sets hash to duplicate values. Duplicate hash values can occur if a set of keywords has the same names, but possesses different attributes, or if the selected byte positions are not well @@ -402,7 +412,7 @@ option is not particularly useful when `-S' (or, equivalently,
                  `--jump=jump-value'
                  - + Affects the "jump value", i.e., how far to advance the associated byte value upon collisions. Jump-value is rounded up to an odd number, the default is 5. If the jump-value is 0 gperf @@ -456,7 +466,7 @@ heuristic. -

                  4.6 Informative Output

                  +

                  4.6 Informative Output

                  diff --git a/doc/gperf_7.html b/doc/gperf_7.html index 0f470e5..46218f1 100644 --- a/doc/gperf_7.html +++ b/doc/gperf_7.html @@ -1,21 +1,22 @@ - + -Perfect Hash Function Generator - 5. Known Bugs and Limitations with gperf +Perfect Hash Function Generator - 5 Known Bugs and Limitations with gperf Go to the first, previous, next, last section, table of contents.


                  -

                  5. Known Bugs and Limitations with gperf

                  +

                  5 Known Bugs and Limitations with gperf

                  The following are some limitations with the current release of gperf: - +


                  -This document was generated on 12 June 2003 using -texi2html 1.56k. +This document was generated on 13 January 2006 using the +texi2html +translator version 1.52.

                  -- cgit v1.2.1