remove contrib/gperf
gperf was used only as a build tool for GCC, and is not needed after r358454. Sponsored by: The FreeBSD Foundation
This commit is contained in:
parent
fe44c67716
commit
9fdab7a316
Notes:
svn2git
2020-12-20 02:59:44 +00:00
svn path=/head/; revision=358464
@ -1,2 +0,0 @@
|
||||
Douglas C. Schmidt <schmidt@ics.uci.edu>
|
||||
Bruno Haible <bruno@clisp.org>
|
@ -1,340 +0,0 @@
|
||||
GNU GENERAL PUBLIC LICENSE
|
||||
Version 2, June 1991
|
||||
|
||||
Copyright (C) 1989, 1991 Free Software Foundation, Inc.
|
||||
51 Franklin Street, Fifth Floor, Boston, MA 02110-1301,
|
||||
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
|
||||
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
|
||||
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
|
||||
have the freedom to distribute copies of free software (and charge for
|
||||
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
|
||||
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
|
||||
software. If the software is modified by someone else and passed on, we
|
||||
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
|
||||
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.
|
||||
|
||||
GNU GENERAL PUBLIC LICENSE
|
||||
TERMS AND CONDITIONS FOR COPYING, DISTRIBUTION AND MODIFICATION
|
||||
|
||||
0. This License applies to any program or other work which contains
|
||||
a notice placed by the copyright holder saying it may be distributed
|
||||
under the terms of this General Public License. The "Program", below,
|
||||
refers to any such program or work, and a "work based on the Program"
|
||||
means either the Program or any derivative work under copyright law:
|
||||
that is to say, a work containing the Program or a portion of it,
|
||||
either verbatim or with modifications and/or translated into another
|
||||
language. (Hereinafter, translation is included without limitation in
|
||||
the term "modification".) Each licensee is addressed as "you".
|
||||
|
||||
Activities other than copying, distribution and modification are not
|
||||
covered by this License; they are outside its scope. The act of
|
||||
running the Program is not restricted, and the output from the Program
|
||||
is covered only if its contents constitute a work based on the
|
||||
Program (independent of having been made by running the Program).
|
||||
Whether that is true depends on what the Program does.
|
||||
|
||||
1. You may copy and distribute verbatim copies of the Program's
|
||||
source code as you receive it, in any medium, provided that you
|
||||
conspicuously and appropriately publish on each copy an appropriate
|
||||
copyright notice and disclaimer of warranty; keep intact all the
|
||||
notices that refer to this License and to the absence of any warranty;
|
||||
and give any other recipients of the Program a copy of this License
|
||||
along with the Program.
|
||||
|
||||
You may charge a fee for the physical act of transferring a copy, and
|
||||
you may at your option offer warranty protection in exchange for a fee.
|
||||
|
||||
2. You may modify your copy or copies of the Program or any portion
|
||||
of it, thus forming a work based on the Program, and copy and
|
||||
distribute such modifications or work under the terms of Section 1
|
||||
above, provided that you also meet all of these conditions:
|
||||
|
||||
a) You must cause the modified files to carry prominent notices
|
||||
stating that you changed the files and the date of any change.
|
||||
|
||||
b) You must cause any work that you distribute or publish, that in
|
||||
whole or in part contains or is derived from the Program or any
|
||||
part thereof, to be licensed as a whole at no charge to all third
|
||||
parties under the terms of this License.
|
||||
|
||||
c) If the modified program normally reads commands interactively
|
||||
when run, you must cause it, when started running for such
|
||||
interactive use in the most ordinary way, to print or display an
|
||||
announcement including an appropriate copyright notice and a
|
||||
notice that there is no warranty (or else, saying that you provide
|
||||
a warranty) and that users may redistribute the program under
|
||||
these conditions, and telling the user how to view a copy of this
|
||||
License. (Exception: if the Program itself is interactive but
|
||||
does not normally print such an announcement, your work based on
|
||||
the Program is not required to print an announcement.)
|
||||
|
||||
These requirements apply to the modified work as a whole. If
|
||||
identifiable sections of that work are not derived from the Program,
|
||||
and can be reasonably considered independent and separate works in
|
||||
themselves, then this License, and its terms, do not apply to those
|
||||
sections when you distribute them as separate works. But when you
|
||||
distribute the same sections as part of a whole which is a work based
|
||||
on the Program, the distribution of the whole must be on the terms of
|
||||
this License, whose permissions for other licensees extend to the
|
||||
entire whole, and thus to each and every part regardless of who wrote it.
|
||||
|
||||
Thus, it is not the intent of this section to claim rights or contest
|
||||
your rights to work written entirely by you; rather, the intent is to
|
||||
exercise the right to control the distribution of derivative or
|
||||
collective works based on the Program.
|
||||
|
||||
In addition, mere aggregation of another work not based on the Program
|
||||
with the Program (or with a work based on the Program) on a volume of
|
||||
a storage or distribution medium does not bring the other work under
|
||||
the scope of this License.
|
||||
|
||||
3. You may copy and distribute the Program (or a work based on it,
|
||||
under Section 2) in object code or executable form under the terms of
|
||||
Sections 1 and 2 above provided that you also do one of the following:
|
||||
|
||||
a) Accompany it with the complete corresponding machine-readable
|
||||
source code, which must be distributed under the terms of Sections
|
||||
1 and 2 above on a medium customarily used for software interchange; or,
|
||||
|
||||
b) Accompany it with a written offer, valid for at least three
|
||||
years, to give any third party, for a charge no more than your
|
||||
cost of physically performing source distribution, a complete
|
||||
machine-readable copy of the corresponding source code, to be
|
||||
distributed under the terms of Sections 1 and 2 above on a medium
|
||||
customarily used for software interchange; or,
|
||||
|
||||
c) Accompany it with the information you received as to the offer
|
||||
to distribute corresponding source code. (This alternative is
|
||||
allowed only for noncommercial distribution and only if you
|
||||
received the program in object code or executable form with such
|
||||
an offer, in accord with Subsection b above.)
|
||||
|
||||
The source code for a work means the preferred form of the work for
|
||||
making modifications to it. For an executable work, complete source
|
||||
code means all the source code for all modules it contains, plus any
|
||||
associated interface definition files, plus the scripts used to
|
||||
control compilation and installation of the executable. However, as a
|
||||
special exception, the source code distributed need not include
|
||||
anything that is normally distributed (in either source or binary
|
||||
form) with the major components (compiler, kernel, and so on) of the
|
||||
operating system on which the executable runs, unless that component
|
||||
itself accompanies the executable.
|
||||
|
||||
If distribution of executable or object code is made by offering
|
||||
access to copy from a designated place, then offering equivalent
|
||||
access to copy the source code from the same place counts as
|
||||
distribution of the source code, even though third parties are not
|
||||
compelled to copy the source along with the object code.
|
||||
|
||||
4. You may not copy, modify, sublicense, or distribute the Program
|
||||
except as expressly provided under this License. Any attempt
|
||||
otherwise to copy, modify, sublicense or distribute the Program is
|
||||
void, and will automatically terminate your rights under this License.
|
||||
However, parties who have received copies, or rights, from you under
|
||||
this License will not have their licenses terminated so long as such
|
||||
parties remain in full compliance.
|
||||
|
||||
5. You are not required to accept this License, since you have not
|
||||
signed it. However, nothing else grants you permission to modify or
|
||||
distribute the Program or its derivative works. These actions are
|
||||
prohibited by law if you do not accept this License. Therefore, by
|
||||
modifying or distributing the Program (or any work based on the
|
||||
Program), you indicate your acceptance of this License to do so, and
|
||||
all its terms and conditions for copying, distributing or modifying
|
||||
the Program or works based on it.
|
||||
|
||||
6. Each time you redistribute the Program (or any work based on the
|
||||
Program), the recipient automatically receives a license from the
|
||||
original licensor to copy, distribute or modify the Program subject to
|
||||
these terms and conditions. You may not impose any further
|
||||
restrictions on the recipients' exercise of the rights granted herein.
|
||||
You are not responsible for enforcing compliance by third parties to
|
||||
this License.
|
||||
|
||||
7. If, as a consequence of a court judgment or allegation of patent
|
||||
infringement or for any other reason (not limited to patent issues),
|
||||
conditions are imposed on you (whether by court order, agreement or
|
||||
otherwise) that contradict the conditions of this License, they do not
|
||||
excuse you from the conditions of this License. If you cannot
|
||||
distribute so as to satisfy simultaneously your obligations under this
|
||||
License and any other pertinent obligations, then as a consequence you
|
||||
may not distribute the Program at all. For example, if a patent
|
||||
license would not permit royalty-free redistribution of the Program by
|
||||
all those who receive copies directly or indirectly through you, then
|
||||
the only way you could satisfy both it and this License would be to
|
||||
refrain entirely from distribution of the Program.
|
||||
|
||||
If any portion of this section is held invalid or unenforceable under
|
||||
any particular circumstance, the balance of the section is intended to
|
||||
apply and the section as a whole is intended to apply in other
|
||||
circumstances.
|
||||
|
||||
It is not the purpose of this section to induce you to infringe any
|
||||
patents or other property right claims or to contest validity of any
|
||||
such claims; this section has the sole purpose of protecting the
|
||||
integrity of the free software distribution system, which is
|
||||
implemented by public license practices. Many people have made
|
||||
generous contributions to the wide range of software distributed
|
||||
through that system in reliance on consistent application of that
|
||||
system; it is up to the author/donor to decide if he or she is willing
|
||||
to distribute software through any other system and a licensee cannot
|
||||
impose that choice.
|
||||
|
||||
This section is intended to make thoroughly clear what is believed to
|
||||
be a consequence of the rest of this License.
|
||||
|
||||
8. If the distribution and/or use of the Program is restricted in
|
||||
certain countries either by patents or by copyrighted interfaces, the
|
||||
original copyright holder who places the Program under this License
|
||||
may add an explicit geographical distribution limitation excluding
|
||||
those countries, so that distribution is permitted only in or among
|
||||
countries not thus excluded. In such case, this License incorporates
|
||||
the limitation as if written in the body of this License.
|
||||
|
||||
9. The Free Software Foundation may publish revised and/or new versions
|
||||
of the General Public License from time to time. Such new versions will
|
||||
be similar in spirit to the present version, but may differ in detail to
|
||||
address new problems or concerns.
|
||||
|
||||
Each version is given a distinguishing version number. If the Program
|
||||
specifies a version number of this License which applies to it and "any
|
||||
later version", you have the option of following the terms and conditions
|
||||
either of that version or of any later version published by the Free
|
||||
Software Foundation. If the Program does not specify a version number of
|
||||
this License, you may choose any version ever published by the Free Software
|
||||
Foundation.
|
||||
|
||||
10. If you wish to incorporate parts of the Program into other free
|
||||
programs whose distribution conditions are different, write to the author
|
||||
to ask for permission. For software which is copyrighted by the Free
|
||||
Software Foundation, write to the Free Software Foundation; we sometimes
|
||||
make exceptions for this. Our decision will be guided by the two goals
|
||||
of preserving the free status of all derivatives of our free software and
|
||||
of promoting the sharing 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 HOLDERS AND/OR OTHER PARTIES
|
||||
PROVIDE THE PROGRAM "AS IS" WITHOUT WARRANTY OF ANY KIND, EITHER EXPRESSED
|
||||
OR IMPLIED, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF
|
||||
MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE. THE ENTIRE RISK AS
|
||||
TO THE QUALITY AND PERFORMANCE OF THE PROGRAM IS WITH YOU. SHOULD THE
|
||||
PROGRAM PROVE DEFECTIVE, YOU ASSUME THE COST OF ALL NECESSARY SERVICING,
|
||||
REPAIR OR CORRECTION.
|
||||
|
||||
12. IN NO EVENT UNLESS REQUIRED BY APPLICABLE LAW OR AGREED TO IN WRITING
|
||||
WILL ANY COPYRIGHT HOLDER, OR ANY OTHER PARTY WHO MAY MODIFY AND/OR
|
||||
REDISTRIBUTE THE PROGRAM AS PERMITTED ABOVE, BE LIABLE TO YOU FOR DAMAGES,
|
||||
INCLUDING ANY GENERAL, SPECIAL, INCIDENTAL OR CONSEQUENTIAL DAMAGES ARISING
|
||||
OUT OF THE USE OR INABILITY TO USE THE PROGRAM (INCLUDING BUT NOT LIMITED
|
||||
TO LOSS OF DATA OR DATA BEING RENDERED INACCURATE OR LOSSES SUSTAINED BY
|
||||
YOU OR THIRD PARTIES OR A FAILURE OF THE PROGRAM TO OPERATE WITH ANY OTHER
|
||||
PROGRAMS), EVEN IF SUCH HOLDER OR OTHER PARTY HAS BEEN ADVISED OF THE
|
||||
POSSIBILITY OF SUCH DAMAGES.
|
||||
|
||||
END OF TERMS AND CONDITIONS
|
||||
|
||||
Appendix: How to Apply These Terms to Your New Programs
|
||||
|
||||
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.
|
||||
|
||||
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 a brief 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.
|
||||
|
||||
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
|
||||
Gnomovision comes with ABSOLUTELY NO WARRANTY; for details type `show w'.
|
||||
This is free software, and you are welcome to redistribute it
|
||||
under certain conditions; type `show c' for details.
|
||||
|
||||
The hypothetical commands `show w' and `show c' should show the appropriate
|
||||
parts of the General Public License. Of course, the 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 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
|
||||
|
||||
This General Public License does not permit incorporating your program into
|
||||
proprietary programs. If your program is a subroutine library, you may
|
||||
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.
|
File diff suppressed because it is too large
Load Diff
@ -1,12 +0,0 @@
|
||||
$FreeBSD$
|
||||
*/*.dvi
|
||||
*/*.html
|
||||
*/*.info
|
||||
*/*.ps
|
||||
*/texinfo.tex
|
||||
*/tests
|
||||
*/getopt*
|
||||
*/*.pdf
|
||||
*/*.vms
|
||||
*/*.msvc
|
||||
*/*.woe32
|
@ -1,183 +0,0 @@
|
||||
Basic Installation
|
||||
==================
|
||||
|
||||
These are generic installation instructions.
|
||||
|
||||
The `configure' shell script attempts to guess correct values for
|
||||
various system-dependent variables used during compilation. It uses
|
||||
those values to create a `Makefile' in each directory of the package.
|
||||
It may also create one or more `.h' files containing system-dependent
|
||||
definitions. Finally, it creates a shell script `config.status' that
|
||||
you can run in the future to recreate the current configuration, a file
|
||||
`config.cache' that saves the results of its tests to speed up
|
||||
reconfiguring, and a file `config.log' containing compiler output
|
||||
(useful mainly for debugging `configure').
|
||||
|
||||
If you need to do unusual things to compile the package, please try
|
||||
to figure out how `configure' could check whether to do them, and mail
|
||||
diffs or instructions to the address given in the `README' so they can
|
||||
be considered for the next release. If at some point `config.cache'
|
||||
contains results you don't want to keep, you may remove or edit it.
|
||||
|
||||
The file `configure.ac' is used to create `configure' by a program
|
||||
called `autoconf'. You only need `configure.ac' if you want to change
|
||||
it or regenerate `configure' using a newer version of `autoconf'.
|
||||
|
||||
The simplest way to compile this package is:
|
||||
|
||||
1. `cd' to the directory containing the package's source code and type
|
||||
`./configure' to configure the package for your system. If you're
|
||||
using `csh' on an old version of System V, you might need to type
|
||||
`sh ./configure' instead to prevent `csh' from trying to execute
|
||||
`configure' itself.
|
||||
|
||||
Running `configure' takes a while. While running, it prints some
|
||||
messages telling which features it is checking for.
|
||||
|
||||
2. Type `make' to compile the package.
|
||||
|
||||
3. Optionally, type `make check' to run any self-tests that come with
|
||||
the package.
|
||||
|
||||
4. Type `make install' to install the programs and any data files and
|
||||
documentation.
|
||||
|
||||
5. You can remove the program binaries and object files from the
|
||||
source code directory by typing `make clean'. To also remove the
|
||||
files that `configure' created (so you can compile the package for
|
||||
a different kind of computer), type `make distclean'. There is
|
||||
also a `make maintainer-clean' target, but that is intended mainly
|
||||
for the package's developers. If you use it, you may have to get
|
||||
all sorts of other programs in order to regenerate files that came
|
||||
with the distribution.
|
||||
|
||||
Compilers and Options
|
||||
=====================
|
||||
|
||||
Some systems require unusual options for compilation or linking that
|
||||
the `configure' script does not know about. You can give `configure'
|
||||
initial values for variables by setting them in the environment. Using
|
||||
a Bourne-compatible shell, you can do that on the command line like
|
||||
this:
|
||||
CC=c89 CFLAGS=-O2 LIBS=-lposix ./configure
|
||||
|
||||
Or on systems that have the `env' program, you can do it like this:
|
||||
env CPPFLAGS=-I/usr/local/include LDFLAGS=-s ./configure
|
||||
|
||||
Compiling For Multiple Architectures
|
||||
====================================
|
||||
|
||||
You can compile the package for more than one kind of computer at the
|
||||
same time, by placing the object files for each architecture in their
|
||||
own directory. To do this, you must use a version of `make' that
|
||||
supports the `VPATH' variable, such as GNU `make'. `cd' to the
|
||||
directory where you want the object files and executables to go and run
|
||||
the `configure' script. `configure' automatically checks for the
|
||||
source code in the directory that `configure' is in and in `..'.
|
||||
|
||||
If you have to use a `make' that does not supports the `VPATH'
|
||||
variable, you have to compile the package for one architecture at a time
|
||||
in the source code directory. After you have installed the package for
|
||||
one architecture, use `make distclean' before reconfiguring for another
|
||||
architecture.
|
||||
|
||||
Installation Names
|
||||
==================
|
||||
|
||||
By default, `make install' will install the package's files in
|
||||
`/usr/local/bin', `/usr/local/man', etc. You can specify an
|
||||
installation prefix other than `/usr/local' by giving `configure' the
|
||||
option `--prefix=PATH'.
|
||||
|
||||
You can specify separate installation prefixes for
|
||||
architecture-specific files and architecture-independent files. If you
|
||||
give `configure' the option `--exec-prefix=PATH', the package will use
|
||||
PATH as the prefix for installing programs and libraries.
|
||||
Documentation and other data files will still use the regular prefix.
|
||||
|
||||
In addition, if you use an unusual directory layout you can give
|
||||
options like `--bindir=PATH' to specify different values for particular
|
||||
kinds of files. Run `configure --help' for a list of the directories
|
||||
you can set and what kinds of files go in them.
|
||||
|
||||
If the package supports it, you can cause programs to be installed
|
||||
with an extra prefix or suffix on their names by giving `configure' the
|
||||
option `--program-prefix=PREFIX' or `--program-suffix=SUFFIX'.
|
||||
|
||||
Optional Features
|
||||
=================
|
||||
|
||||
Some packages pay attention to `--enable-FEATURE' options to
|
||||
`configure', where FEATURE indicates an optional part of the package.
|
||||
They may also pay attention to `--with-PACKAGE' options, where PACKAGE
|
||||
is something like `gnu-as' or `x' (for the X Window System). The
|
||||
`README' should mention any `--enable-' and `--with-' options that the
|
||||
package recognizes.
|
||||
|
||||
For packages that use the X Window System, `configure' can usually
|
||||
find the X include and library files automatically, but if it doesn't,
|
||||
you can use the `configure' options `--x-includes=DIR' and
|
||||
`--x-libraries=DIR' to specify their locations.
|
||||
|
||||
Specifying the System Type
|
||||
==========================
|
||||
|
||||
There may be some features `configure' can not figure out
|
||||
automatically, but needs to determine by the type of host the package
|
||||
will run on. Usually `configure' can figure that out, but if it prints
|
||||
a message saying it can not guess the host type, give it the
|
||||
`--host=TYPE' option. TYPE can either be a short name for the system
|
||||
type, such as `sun4', or a canonical name with three fields:
|
||||
CPU-COMPANY-SYSTEM
|
||||
|
||||
See the file `config.sub' for the possible values of each field. If
|
||||
`config.sub' isn't included in this package, then this package doesn't
|
||||
need to know the host type.
|
||||
|
||||
If you are building compiler tools for cross-compiling, you can also
|
||||
use the `--target=TYPE' option to select the type of system they will
|
||||
produce code for and the `--build=TYPE' option to select the type of
|
||||
system on which you are compiling the package.
|
||||
|
||||
Sharing Defaults
|
||||
================
|
||||
|
||||
If you want to set default values for `configure' scripts to share,
|
||||
you can create a site shell script called `config.site' that gives
|
||||
default values for variables like `CC', `cache_file', and `prefix'.
|
||||
`configure' looks for `PREFIX/share/config.site' if it exists, then
|
||||
`PREFIX/etc/config.site' if it exists. Or, you can set the
|
||||
`CONFIG_SITE' environment variable to the location of the site script.
|
||||
A warning: not all `configure' scripts look for a site script.
|
||||
|
||||
Operation Controls
|
||||
==================
|
||||
|
||||
`configure' recognizes the following options to control how it
|
||||
operates.
|
||||
|
||||
`--cache-file=FILE'
|
||||
Use and save the results of the tests in FILE instead of
|
||||
`./config.cache'. Set FILE to `/dev/null' to disable caching, for
|
||||
debugging `configure'.
|
||||
|
||||
`--help'
|
||||
Print a summary of the options to `configure', and exit.
|
||||
|
||||
`--quiet'
|
||||
`--silent'
|
||||
`-q'
|
||||
Do not print messages saying which checks are being made. To
|
||||
suppress all normal output, redirect it to `/dev/null' (any error
|
||||
messages will still be shown).
|
||||
|
||||
`--srcdir=DIR'
|
||||
Look for the package's source code in directory DIR. Usually
|
||||
`configure' can determine that directory automatically.
|
||||
|
||||
`--version'
|
||||
Print the version of Autoconf used to generate the `configure'
|
||||
script, and exit.
|
||||
|
||||
`configure' also accepts some other, not widely useful, options.
|
||||
|
@ -1,44 +0,0 @@
|
||||
# This is the developer's makefile, not the user's makefile.
|
||||
# Don't use it unless you know exactly what you do!
|
||||
|
||||
SHELL = /bin/sh
|
||||
MAKE = make
|
||||
|
||||
all : configures src/config.h.in src/config.h.msvc src/config.h_vms doc/gperf.1
|
||||
|
||||
CONFIGURES = configure lib/configure src/configure tests/configure doc/configure
|
||||
|
||||
configures : $(CONFIGURES)
|
||||
|
||||
configure : configure.ac aclocal.m4
|
||||
autoconf -I .
|
||||
|
||||
lib/configure : lib/configure.ac aclocal.m4
|
||||
cd lib && autoconf -I ..
|
||||
|
||||
src/configure : src/configure.ac aclocal.m4
|
||||
cd src && autoconf -I ..
|
||||
|
||||
tests/configure : tests/configure.ac aclocal.m4
|
||||
cd tests && autoconf -I ..
|
||||
|
||||
doc/configure : doc/configure.ac aclocal.m4
|
||||
cd doc && autoconf -I ..
|
||||
|
||||
check-configures : $(CONFIGURES)
|
||||
set -e; for f in $(CONFIGURES); do bash -x -n $$f; done
|
||||
|
||||
src/config.h.in : src/configure.ac aclocal.m4
|
||||
cd src && autoheader -I ..
|
||||
|
||||
src/config.h.msvc : src/config.h.in
|
||||
cp src/config.h.in src/config.h.msvc
|
||||
|
||||
src/config.h_vms : src/config.h.in
|
||||
cp src/config.h.in src/config.h_vms
|
||||
|
||||
doc/gperf.1 : force
|
||||
prog=`PATH=build/src:src:$$PATH which gperf`; if test -n "$$prog"; then doc/help2man --name='generate a perfect hash function from a key set' --section=1 $$prog > doc/gperf.1; fi
|
||||
|
||||
force :
|
||||
|
@ -1,64 +0,0 @@
|
||||
# Makefile for gperf
|
||||
|
||||
# Copyright (C) 1989, 1992, 1993, 1998, 2002 Free Software Foundation, Inc.
|
||||
# Written by Douglas C. Schmidt <schmidt@ics.uci.edu>
|
||||
# and Bruno Haible <bruno@clisp.org>.
|
||||
#
|
||||
# This file is part of GNU GPERF.
|
||||
#
|
||||
# GNU GPERF 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, or (at your option)
|
||||
# any later version.
|
||||
#
|
||||
# GNU GPERF 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; see the file COPYING.
|
||||
# If not, write to the Free Software Foundation, Inc.,
|
||||
# 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. */
|
||||
|
||||
#### Start of system configuration section. ####
|
||||
|
||||
# Programs used by "make":
|
||||
RM = rm -f
|
||||
@SET_MAKE@
|
||||
|
||||
#### End of system configuration section. ####
|
||||
|
||||
SHELL = /bin/sh
|
||||
|
||||
all : force
|
||||
cd @subdir@; $(MAKE) all
|
||||
|
||||
install : force
|
||||
cd @subdir@; $(MAKE) install
|
||||
|
||||
installdirs : force
|
||||
cd @subdir@; $(MAKE) installdirs
|
||||
|
||||
uninstall : force
|
||||
cd @subdir@; $(MAKE) uninstall
|
||||
|
||||
check : force
|
||||
cd @subdir@; $(MAKE) check
|
||||
|
||||
mostlyclean : force
|
||||
cd @subdir@; $(MAKE) mostlyclean
|
||||
|
||||
clean : force
|
||||
cd @subdir@; $(MAKE) clean
|
||||
|
||||
distclean : force
|
||||
cd @subdir@; if test -f Makefile; then $(MAKE) distclean; fi
|
||||
$(RM) config.status config.log config.cache Makefile
|
||||
|
||||
maintainer-clean : force
|
||||
cd @subdir@; if test -f Makefile; then $(MAKE) maintainer-clean; fi
|
||||
$(RM) config.status config.log config.cache Makefile
|
||||
|
||||
force :
|
||||
|
@ -1,91 +0,0 @@
|
||||
New in 3.0.3:
|
||||
|
||||
* The generated C code is compatible with gcc-4.3.x in c99 or gnu99 mode.
|
||||
|
||||
New in 3.0.2:
|
||||
|
||||
* Compiles with g++-4.0.x.
|
||||
* Added option --length-table-name.
|
||||
* Added declaration %define length-table-name.
|
||||
* Fixed #line directives for filenames containing backslashes.
|
||||
|
||||
New in 3.0.1:
|
||||
|
||||
* Bug fix.
|
||||
|
||||
New in 3.0:
|
||||
|
||||
* Added option --output that allows to specify the output file name.
|
||||
* Some options have been renamed:
|
||||
--hash-fn-name=NAME --> --hash-function-name=NAME
|
||||
--lookup-fn-name=NAME --> --lookup-function-name=NAME
|
||||
--compare-strlen --> --compare-lengths
|
||||
--global --> --global-table
|
||||
The older variants are still supported for backward compatibility.
|
||||
* The following options can now be specified inside the input file:
|
||||
%delimiters=DELIMITER-LIST
|
||||
%struct-type
|
||||
%ignore-case
|
||||
%language=LANGUAGE-NAME
|
||||
%define slot-name NAME
|
||||
%define initializer-suffix INITIALIZERS
|
||||
%define hash-function-name NAME
|
||||
%define lookup-function-name NAME
|
||||
%define class-name NAME
|
||||
%7bit
|
||||
%compare-lengths
|
||||
%compare-strncmp
|
||||
%readonly-tables
|
||||
%enum
|
||||
%includes
|
||||
%global-table
|
||||
%pic
|
||||
%define string-pool-name NAME
|
||||
%null-strings
|
||||
%define word-array-name NAME
|
||||
%switch=COUNT
|
||||
%omit-struct-type
|
||||
* When the option -k is not given, the default key positions are now
|
||||
computed depending on the set of keywords.
|
||||
* If the input file is given by name, the output file will now contain
|
||||
#line directives referring to the input file.
|
||||
* Some keyword sets containing permutations, like { "xy", "yx", "xz", "zx" }
|
||||
or { "abc", "acb", "bca", "cab" }, are now handled by gperf without
|
||||
requiring the option -D.
|
||||
* The generated table is usually much smaller than it was with earlier
|
||||
versions of gperf.
|
||||
* Added option -m/--multiple-iterations that allows to further reduce the
|
||||
size of the generated table.
|
||||
* When the search for a good hash function is not immediately successful,
|
||||
the table's size will grow as needed. Earlier versions of gperf bailed
|
||||
out with an "Internal error, duplicate hash code value".
|
||||
* The options -f/--fast and -o/--occurrence-sort have no effect any more.
|
||||
* Added options -P/--pic and --null-strings that optimize the generated code
|
||||
for use in shared libraries. -P/--pic does a perfect optimization but may
|
||||
require some small code changes (see the documentation for details), whereas
|
||||
--null-strings does only a half-hearted optimization but works without
|
||||
needing any change to surrounding code.
|
||||
* Added option --ignore-case that produces a case independent lookup function.
|
||||
* Bug fixes.
|
||||
|
||||
New in 2.7.2:
|
||||
|
||||
* Keywords may now be enclosed in double quotes; this permits the use of
|
||||
'#', ',', space or NUL inside keywords.
|
||||
* Bug fixes.
|
||||
|
||||
New in 2.7.1:
|
||||
|
||||
* Added option "-F" for gcc.
|
||||
|
||||
New in 2.7:
|
||||
|
||||
* gperf is now a stand-alone package, untied from libg++.
|
||||
* Autoconfiguring.
|
||||
* Removed the "-a" and "-g" options, extended the "-L" option instead.
|
||||
* Removed the "-p" option, it is the default.
|
||||
* Added long options ("--help", "--version" etc.).
|
||||
* 8-bit cleanliness is now the default; use "-7" to get the old behaviour.
|
||||
* Compiles with any C++ compiler.
|
||||
* Numerous small improvements.
|
||||
|
@ -1,28 +0,0 @@
|
||||
This is GNU gperf. It is a program that generates perfect hash
|
||||
functions for sets of key words. A perfect hash function is:
|
||||
|
||||
A hash function and a data structure that allows
|
||||
recognition of a key word in a set of words using
|
||||
exactly 1 probe into the data structure.
|
||||
|
||||
The doc/gperf.html file explains how the program works, the form of
|
||||
the input, what options are available, and hints on choosing the best
|
||||
options for particular key words set.
|
||||
|
||||
See the file NEWS for a list of major changes in the current release.
|
||||
|
||||
See the file INSTALL for compilation and installation instructions.
|
||||
|
||||
Output from the GPERF program is used to recognize reserved words in
|
||||
the GNU C, GNU C++, and GNU Pascal compilers, as well as with the GNU
|
||||
indent program.
|
||||
|
||||
For general documentation on the coding and usage standards
|
||||
this distribution follows, see the GNU standards document
|
||||
ftp://ftp.gnu.org/pub/gnu/standards.*, especially the 'Makefile
|
||||
Conventions', 'Configuration', and 'User Interfaces' sections.
|
||||
|
||||
Mail suggestions and bug reports to <bug-gnu-gperf@gnu.org>. When
|
||||
reporting bugs, please include in the subject line the package name
|
||||
and version (output of 'gperf --version') for which you found a problem.
|
||||
|
69
contrib/gperf/aclocal.m4
vendored
69
contrib/gperf/aclocal.m4
vendored
@ -1,69 +0,0 @@
|
||||
AC_PREREQ(2.12)
|
||||
|
||||
AC_DEFUN(CL_PROG_INSTALL,
|
||||
[dnl This is mostly copied from AC_PROG_INSTALL.
|
||||
# Find a good install program. We prefer a C program (faster),
|
||||
# so one script is as good as another. But avoid the broken or
|
||||
# incompatible versions:
|
||||
# SysV /etc/install, /usr/sbin/install
|
||||
# SunOS /usr/etc/install
|
||||
# IRIX /sbin/install
|
||||
# AIX /bin/install
|
||||
# AFS /usr/afsws/bin/install, which mishandles nonexistent args
|
||||
# SVR4 /usr/ucb/install, which tries to use the nonexistent group "staff"
|
||||
# ./install, which can be erroneously created by make from ./install.sh.
|
||||
AC_MSG_CHECKING(for a BSD compatible install)
|
||||
if test -z "$INSTALL"; then
|
||||
AC_CACHE_VAL(cl_cv_path_install,
|
||||
[ IFS="${IFS= }"; ac_save_ifs="$IFS"; IFS="${IFS}:"
|
||||
for ac_dir in $PATH; do
|
||||
# Account for people who put trailing slashes in PATH elements.
|
||||
case "$ac_dir/" in
|
||||
/|./|.//|/etc/*|/usr/sbin/*|/usr/etc/*|/sbin/*|/usr/afsws/bin/*|/usr/ucb/*) ;;
|
||||
*)
|
||||
# OSF1 and SCO ODT 3.0 have their own names for install.
|
||||
for ac_prog in ginstall installbsd scoinst install; do
|
||||
if test -f $ac_dir/$ac_prog; then
|
||||
if test $ac_prog = install &&
|
||||
grep dspmsg $ac_dir/$ac_prog >/dev/null 2>&1; then
|
||||
# AIX install. It has an incompatible calling convention.
|
||||
# OSF/1 installbsd also uses dspmsg, but is usable.
|
||||
:
|
||||
else
|
||||
if test $ac_prog = installbsd &&
|
||||
grep src/bos $ac_dir/$ac_prog >/dev/null 2>&1; then
|
||||
# AIX installbsd doesn't work without option "-g".
|
||||
:
|
||||
else
|
||||
cl_cv_path_install="$ac_dir/$ac_prog -c"
|
||||
break 2
|
||||
fi
|
||||
fi
|
||||
fi
|
||||
done
|
||||
;;
|
||||
esac
|
||||
done
|
||||
IFS="$ac_save_ifs"
|
||||
# As a last resort, use cp.
|
||||
test -z "$cl_cv_path_install" && cl_cv_path_install="cp"
|
||||
])dnl
|
||||
INSTALL="$cl_cv_path_install"
|
||||
fi
|
||||
dnl We do special magic for INSTALL instead of AC_SUBST, to get
|
||||
dnl relative paths right.
|
||||
AC_MSG_RESULT($INSTALL)
|
||||
AC_SUBST(INSTALL)dnl
|
||||
# Use test -z because SunOS4 sh mishandles braces in ${var-val}.
|
||||
# It thinks the first close brace ends the variable substitution.
|
||||
test -z "$INSTALL_PROGRAM" && INSTALL_PROGRAM='$(INSTALL)'
|
||||
AC_SUBST(INSTALL_PROGRAM)dnl
|
||||
if test -z "$INSTALL_DATA"; then
|
||||
case "$INSTALL" in
|
||||
cp | */cp ) INSTALL_DATA='$(INSTALL)' ;;
|
||||
* ) INSTALL_DATA='$(INSTALL) -m 644' ;;
|
||||
esac
|
||||
fi
|
||||
AC_SUBST(INSTALL_DATA)dnl
|
||||
])
|
||||
|
2844
contrib/gperf/configure
vendored
2844
contrib/gperf/configure
vendored
File diff suppressed because it is too large
Load Diff
@ -1,55 +0,0 @@
|
||||
dnl autoconf configuration for gperf
|
||||
|
||||
dnl Copyright (C) 1998, 2002, 2003, 2005-2007 Free Software Foundation, Inc.
|
||||
dnl Written by Douglas C. Schmidt <schmidt@ics.uci.edu>
|
||||
dnl and Bruno Haible <bruno@clisp.org>.
|
||||
dnl
|
||||
dnl This file is part of GNU GPERF.
|
||||
dnl
|
||||
dnl GNU GPERF is free software; you can redistribute it and/or modify
|
||||
dnl it under the terms of the GNU General Public License as published by
|
||||
dnl the Free Software Foundation; either version 2, or (at your option)
|
||||
dnl any later version.
|
||||
dnl
|
||||
dnl GNU GPERF is distributed in the hope that it will be useful,
|
||||
dnl but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
dnl MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
dnl GNU General Public License for more details.
|
||||
dnl
|
||||
dnl You should have received a copy of the GNU General Public License
|
||||
dnl along with this program; see the file COPYING.
|
||||
dnl If not, write to the Free Software Foundation, Inc.,
|
||||
dnl 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
|
||||
|
||||
AC_PREREQ([2.60])
|
||||
AC_INIT(doc/gperf.1)
|
||||
AC_PROG_MAKE_SET
|
||||
AC_OBJEXT
|
||||
AC_EXEEXT
|
||||
|
||||
dnl An autoconf-2.52 bug: AC_CONFIG_SUBDIRS requires AC_CONFIG_AUX_DIR_DEFAULT.
|
||||
ac_aux_dir=$srcdir
|
||||
AC_PROVIDE([AC_CONFIG_AUX_DIR_DEFAULT])
|
||||
AC_CONFIG_SUBDIRS(lib src tests doc)
|
||||
|
||||
dnl This piece of sed script replaces every line containing '@subdir@'
|
||||
dnl by several consecutive lines, each referencing one subdir.
|
||||
extrasub="$extrasub"'
|
||||
/@subdir@/{
|
||||
h
|
||||
g
|
||||
s/@subdir@/lib/
|
||||
p
|
||||
g
|
||||
s/@subdir@/src/
|
||||
p
|
||||
g
|
||||
s/@subdir@/tests/
|
||||
p
|
||||
g
|
||||
s/@subdir@/doc/
|
||||
p
|
||||
d
|
||||
}
|
||||
'
|
||||
AC_OUTPUT(Makefile)
|
@ -1,153 +0,0 @@
|
||||
# Makefile for gperf/doc
|
||||
|
||||
# Copyright (C) 1998, 2000, 2002-2003, 2007 Free Software Foundation, Inc.
|
||||
# Written by Douglas C. Schmidt <schmidt@ics.uci.edu>
|
||||
# and Bruno Haible <bruno@clisp.org>.
|
||||
#
|
||||
# This file is part of GNU GPERF.
|
||||
#
|
||||
# GNU GPERF 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, or (at your option)
|
||||
# any later version.
|
||||
#
|
||||
# GNU GPERF 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; see the file COPYING.
|
||||
# If not, write to the Free Software Foundation, Inc.,
|
||||
# 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. */
|
||||
|
||||
#### Start of system configuration section. ####
|
||||
|
||||
# Directories used by "make":
|
||||
srcdir = @srcdir@
|
||||
|
||||
# Directories used by "make install":
|
||||
prefix = @prefix@
|
||||
local_prefix = /usr/local
|
||||
exec_prefix = @exec_prefix@
|
||||
datarootdir = @datarootdir@
|
||||
datadir = @datadir@
|
||||
infodir = @infodir@
|
||||
mandir = @mandir@
|
||||
man1dir = $(mandir)/man1
|
||||
docdir = @docdir@
|
||||
dvidir = @dvidir@
|
||||
psdir = @psdir@
|
||||
pdfdir = @pdfdir@
|
||||
htmldir = @htmldir@
|
||||
|
||||
# Programs used by "make":
|
||||
RM = rm -f
|
||||
@SET_MAKE@
|
||||
|
||||
# Programs used by "make" if you have changed the documentation files:
|
||||
TEX = tex
|
||||
TEXI2DVI = texi2dvi
|
||||
DVIPS = dvips -D600
|
||||
TEXI2PDF = texi2pdf
|
||||
MAKEINFO = LANG= LC_MESSAGES= LC_ALL= LANGUAGE= makeinfo
|
||||
TEXI2HTML = texi2html
|
||||
|
||||
# Programs used by "make install":
|
||||
INSTALL = @INSTALL@
|
||||
INSTALL_PROGRAM = @INSTALL_PROGRAM@
|
||||
INSTALL_DATA = @INSTALL_DATA@
|
||||
MKINSTALLDIRS = $(SHELL) $(srcdir)/../mkinstalldirs
|
||||
|
||||
#### End of system configuration section. ####
|
||||
|
||||
SHELL = /bin/sh
|
||||
|
||||
VPATH = $(srcdir)
|
||||
|
||||
all : info ps pdf html
|
||||
|
||||
|
||||
info : $(srcdir)/gperf.info
|
||||
|
||||
$(srcdir)/gperf.info : $(srcdir)/gperf.texi $(srcdir)/gpl.texinfo
|
||||
cd $(srcdir) && $(MAKEINFO) --no-split gperf.texi
|
||||
|
||||
|
||||
dvi : $(srcdir)/gperf.dvi
|
||||
|
||||
$(srcdir)/gperf.dvi : $(srcdir)/gperf.texi $(srcdir)/gpl.texinfo
|
||||
cd $(srcdir) && $(RM) gperf.aux gperf.toc gperf.cp gperf.fn gperf.ky gperf.pg gperf.tp gperf.vr gperf.log gperf.cps
|
||||
cd $(srcdir) && $(TEXI2DVI) gperf.texi
|
||||
cd $(srcdir) && $(RM) gperf.aux gperf.toc gperf.cp gperf.fn gperf.ky gperf.pg gperf.tp gperf.vr gperf.log gperf.cps
|
||||
|
||||
|
||||
ps : $(srcdir)/gperf.ps
|
||||
|
||||
$(srcdir)/gperf.ps : $(srcdir)/gperf.dvi
|
||||
$(DVIPS) -o $@ $(srcdir)/gperf.dvi
|
||||
|
||||
|
||||
pdf : $(srcdir)/gperf.pdf
|
||||
|
||||
$(srcdir)/gperf.pdf : $(srcdir)/gperf.texi $(srcdir)/gpl.texinfo
|
||||
cd $(srcdir) && $(RM) gperf.aux gperf.toc gperf.cp gperf.fn gperf.ky gperf.pg gperf.tp gperf.vr gperf.log gperf.cps
|
||||
cd $(srcdir) && $(TEXI2PDF) gperf.texi
|
||||
cd $(srcdir) && $(RM) gperf.aux gperf.toc gperf.cp gperf.fn gperf.ky gperf.pg gperf.tp gperf.vr gperf.log gperf.cps
|
||||
|
||||
|
||||
html : gperf.html gperf_toc.html
|
||||
|
||||
gperf.html : $(srcdir)/gperf.texi $(srcdir)/gpl.texinfo
|
||||
cd $(srcdir) && $(TEXI2HTML) -expandinfo -number -monolithic gperf.texi
|
||||
|
||||
gperf_toc.html : $(srcdir)/gperf.texi $(srcdir)/gpl.texinfo
|
||||
cd $(srcdir) && $(RM) gperf_*.html
|
||||
cd $(srcdir) && $(TEXI2HTML) -expandinfo -number -split_chapter gperf.texi
|
||||
|
||||
|
||||
install : all force
|
||||
$(MKINSTALLDIRS) $(DESTDIR)$(infodir)
|
||||
$(INSTALL_DATA) $(srcdir)/gperf.info $(DESTDIR)$(infodir)/gperf.info
|
||||
$(MKINSTALLDIRS) $(DESTDIR)$(man1dir)
|
||||
$(INSTALL_DATA) $(srcdir)/gperf.1 $(DESTDIR)$(man1dir)/gperf.1
|
||||
# $(MKINSTALLDIRS) $(DESTDIR)$(dvidir)
|
||||
# $(INSTALL_DATA) $(srcdir)/gperf.dvi $(DESTDIR)$(dvidir)/gperf.dvi
|
||||
# $(MKINSTALLDIRS) $(DESTDIR)$(psdir)
|
||||
# $(INSTALL_DATA) $(srcdir)/gperf.ps $(DESTDIR)$(psdir)/gperf.ps
|
||||
# $(MKINSTALLDIRS) $(DESTDIR)$(pdfdir)
|
||||
# $(INSTALL_DATA) $(srcdir)/gperf.pdf $(DESTDIR)$(pdfdir)/gperf.pdf
|
||||
$(MKINSTALLDIRS) $(DESTDIR)$(htmldir)
|
||||
$(INSTALL_DATA) $(srcdir)/gperf.html $(DESTDIR)$(htmldir)/gperf.html
|
||||
|
||||
installdirs : force
|
||||
$(MKINSTALLDIRS) $(DESTDIR)$(infodir)
|
||||
$(MKINSTALLDIRS) $(DESTDIR)$(man1dir)
|
||||
# $(MKINSTALLDIRS) $(DESTDIR)$(dvidir)
|
||||
# $(MKINSTALLDIRS) $(DESTDIR)$(psdir)
|
||||
# $(MKINSTALLDIRS) $(DESTDIR)$(pdfdir)
|
||||
$(MKINSTALLDIRS) $(DESTDIR)$(htmldir)
|
||||
|
||||
uninstall : force
|
||||
$(RM) $(DESTDIR)$(infodir)/gperf.info
|
||||
$(RM) $(DESTDIR)$(man1dir)/gperf.1
|
||||
# $(RM) $(DESTDIR)$(dvidir)/gperf.dvi
|
||||
# $(RM) $(DESTDIR)$(psdir)/gperf.ps
|
||||
# $(RM) $(DESTDIR)$(pdfdir)/gperf.pdf
|
||||
$(RM) $(DESTDIR)$(htmldir)/gperf.html
|
||||
|
||||
check : all
|
||||
|
||||
mostlyclean : clean
|
||||
|
||||
clean : force
|
||||
$(RM) *~ *.aux *.toc *.cp *.fn *.ky *.pg *.tp *.vr *.my *.log *.cps core
|
||||
|
||||
distclean : clean
|
||||
$(RM) config.status config.log config.cache Makefile
|
||||
|
||||
maintainer-clean : distclean
|
||||
$(RM) *.info *.dvi *.ps *.pdf *.html
|
||||
|
||||
force :
|
||||
|
2710
contrib/gperf/doc/configure
vendored
2710
contrib/gperf/doc/configure
vendored
File diff suppressed because it is too large
Load Diff
@ -1,37 +0,0 @@
|
||||
dnl autoconf configuration for gperf/doc
|
||||
|
||||
dnl Copyright (C) 1998, 2000, 2002-2003, 2007 Free Software Foundation, Inc.
|
||||
dnl Written by Douglas C. Schmidt <schmidt@ics.uci.edu>
|
||||
dnl and Bruno Haible <bruno@clisp.org>.
|
||||
dnl
|
||||
dnl This file is part of GNU GPERF.
|
||||
dnl
|
||||
dnl GNU GPERF is free software; you can redistribute it and/or modify
|
||||
dnl it under the terms of the GNU General Public License as published by
|
||||
dnl the Free Software Foundation; either version 2, or (at your option)
|
||||
dnl any later version.
|
||||
dnl
|
||||
dnl GNU GPERF is distributed in the hope that it will be useful,
|
||||
dnl but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
dnl MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
dnl GNU General Public License for more details.
|
||||
dnl
|
||||
dnl You should have received a copy of the GNU General Public License
|
||||
dnl along with this program; see the file COPYING.
|
||||
dnl If not, write to the Free Software Foundation, Inc.,
|
||||
dnl 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. */
|
||||
|
||||
AC_PREREQ([2.60])
|
||||
AC_INIT(gperf.1)
|
||||
PACKAGE=gperf
|
||||
AC_SUBST(PACKAGE)
|
||||
AC_PROG_MAKE_SET
|
||||
dnl
|
||||
dnl checks for programs
|
||||
dnl
|
||||
CL_PROG_INSTALL
|
||||
dnl sets variables INSTALL, INSTALL_DATA, INSTALL_PROGRAM
|
||||
dnl
|
||||
dnl That's it.
|
||||
dnl
|
||||
AC_OUTPUT(Makefile)
|
@ -1,216 +0,0 @@
|
||||
.\" DO NOT MODIFY THIS FILE! It was generated by help2man 1.23.
|
||||
.TH GPERF "1" "May 2007" "GNU gperf 3.0.3" FSF
|
||||
.SH NAME
|
||||
gperf \- generate a perfect hash function from a key set
|
||||
.SH SYNOPSIS
|
||||
.B gperf
|
||||
[\fIOPTION\fR]... [\fIINPUT-FILE\fR]
|
||||
.SH DESCRIPTION
|
||||
GNU 'gperf' generates perfect hash functions.
|
||||
.PP
|
||||
If a long option shows an argument as mandatory, then it is mandatory
|
||||
for the equivalent short option also.
|
||||
.SS "Output file location:"
|
||||
.HP
|
||||
\fB\-\-output\-file\fR=\fIFILE\fR Write output to specified file.
|
||||
.PP
|
||||
The results are written to standard output if no output file is specified
|
||||
or if it is -.
|
||||
.SS "Input file interpretation:"
|
||||
.TP
|
||||
\fB\-e\fR, \fB\-\-delimiters\fR=\fIDELIMITER\-LIST\fR
|
||||
Allow user to provide a string containing delimiters
|
||||
used to separate keywords from their attributes.
|
||||
Default is ",".
|
||||
.TP
|
||||
\fB\-t\fR, \fB\-\-struct\-type\fR
|
||||
Allows the user to include a structured type
|
||||
declaration for generated code. Any text before %%
|
||||
is considered part of the type declaration. Key
|
||||
words and additional fields may follow this, one
|
||||
group of fields per line.
|
||||
.TP
|
||||
\fB\-\-ignore\-case\fR
|
||||
Consider upper and lower case ASCII characters as
|
||||
equivalent. Note that locale dependent case mappings
|
||||
are ignored.
|
||||
.SS "Language for the output code:"
|
||||
.TP
|
||||
\fB\-L\fR, \fB\-\-language\fR=\fILANGUAGE\-NAME\fR
|
||||
Generates code in the specified language. Languages
|
||||
handled are currently C++, ANSI-C, C, and KR-C. The
|
||||
default is C.
|
||||
.SS "Details in the output code:"
|
||||
.TP
|
||||
\fB\-K\fR, \fB\-\-slot\-name\fR=\fINAME\fR
|
||||
Select name of the keyword component in the keyword
|
||||
structure.
|
||||
.TP
|
||||
\fB\-F\fR, \fB\-\-initializer\-suffix\fR=\fIINITIALIZERS\fR
|
||||
Initializers for additional components in the keyword
|
||||
structure.
|
||||
.TP
|
||||
\fB\-H\fR, \fB\-\-hash\-function\-name\fR=\fINAME\fR
|
||||
Specify name of generated hash function. Default is
|
||||
\&'hash'.
|
||||
.TP
|
||||
\fB\-N\fR, \fB\-\-lookup\-function\-name\fR=\fINAME\fR
|
||||
Specify name of generated lookup function. Default
|
||||
name is 'in_word_set'.
|
||||
.TP
|
||||
\fB\-Z\fR, \fB\-\-class\-name\fR=\fINAME\fR
|
||||
Specify name of generated C++ class. Default name is
|
||||
\&'Perfect_Hash'.
|
||||
.TP
|
||||
\fB\-7\fR, \fB\-\-seven\-bit\fR
|
||||
Assume 7-bit characters.
|
||||
.TP
|
||||
\fB\-l\fR, \fB\-\-compare\-lengths\fR
|
||||
Compare key lengths before trying a string
|
||||
comparison. This is necessary if the keywords
|
||||
contain NUL bytes. It also helps cut down on the
|
||||
number of string comparisons made during the lookup.
|
||||
.TP
|
||||
\fB\-c\fR, \fB\-\-compare\-strncmp\fR
|
||||
Generate comparison code using strncmp rather than
|
||||
strcmp.
|
||||
.TP
|
||||
\fB\-C\fR, \fB\-\-readonly\-tables\fR
|
||||
Make the contents of generated lookup tables
|
||||
constant, i.e., readonly.
|
||||
.TP
|
||||
\fB\-E\fR, \fB\-\-enum\fR
|
||||
Define constant values using an enum local to the
|
||||
lookup function rather than with defines.
|
||||
.TP
|
||||
\fB\-I\fR, \fB\-\-includes\fR
|
||||
Include the necessary system include file <string.h>
|
||||
at the beginning of the code.
|
||||
.TP
|
||||
\fB\-G\fR, \fB\-\-global\-table\fR
|
||||
Generate the static table of keywords as a static
|
||||
global variable, rather than hiding it inside of the
|
||||
lookup function (which is the default behavior).
|
||||
.TP
|
||||
\fB\-P\fR, \fB\-\-pic\fR
|
||||
Optimize the generated table for inclusion in shared
|
||||
libraries. This reduces the startup time of programs
|
||||
using a shared library containing the generated code.
|
||||
.TP
|
||||
\fB\-Q\fR, \fB\-\-string\-pool\-name\fR=\fINAME\fR
|
||||
Specify name of string pool generated by option \fB\-\-pic\fR.
|
||||
Default name is 'stringpool'.
|
||||
.TP
|
||||
\fB\-\-null\-strings\fR
|
||||
Use NULL strings instead of empty strings for empty
|
||||
keyword table entries.
|
||||
.TP
|
||||
\fB\-W\fR, \fB\-\-word\-array\-name\fR=\fINAME\fR
|
||||
Specify name of word list array. Default name is
|
||||
\&'wordlist'.
|
||||
.TP
|
||||
\fB\-\-length\-table\-name\fR=\fINAME\fR
|
||||
Specify name of length table array. Default name is
|
||||
\&'lengthtable'.
|
||||
.TP
|
||||
\fB\-S\fR, \fB\-\-switch\fR=\fICOUNT\fR
|
||||
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 keyfiles. The COUNT argument
|
||||
determines how many switch statements are generated.
|
||||
A value of 1 generates 1 switch containing all the
|
||||
elements, a value of 2 generates 2 tables with 1/2
|
||||
the elements in each table, etc. If COUNT is very
|
||||
large, say 1000000, the generated C code does a
|
||||
binary search.
|
||||
.TP
|
||||
\fB\-T\fR, \fB\-\-omit\-struct\-type\fR
|
||||
Prevents the transfer of the type declaration to the
|
||||
output file. Use this option if the type is already
|
||||
defined elsewhere.
|
||||
.SS "Algorithm employed by gperf:"
|
||||
.TP
|
||||
\fB\-k\fR, \fB\-\-key\-positions\fR=\fIKEYS\fR
|
||||
Select the key positions used in the hash function.
|
||||
The allowable choices range between 1-255, inclusive.
|
||||
The positions are separated by commas, ranges may be
|
||||
used, and key positions may occur in any order.
|
||||
Also, the meta-character '*' causes the generated
|
||||
hash function to consider ALL key positions, and $
|
||||
indicates the "final character" of a key, e.g.,
|
||||
$,1,2,4,6-10.
|
||||
.TP
|
||||
\fB\-D\fR, \fB\-\-duplicates\fR
|
||||
Handle keywords that hash to duplicate values. This
|
||||
is useful for certain highly redundant keyword sets.
|
||||
.TP
|
||||
\fB\-m\fR, \fB\-\-multiple\-iterations\fR=\fIITERATIONS\fR
|
||||
Perform multiple choices of the \fB\-i\fR and \fB\-j\fR values,
|
||||
and choose the best results. This increases the
|
||||
running time by a factor of ITERATIONS but does a
|
||||
good job minimizing the generated table size.
|
||||
.TP
|
||||
\fB\-i\fR, \fB\-\-initial\-asso\fR=\fIN\fR
|
||||
Provide an initial value for the associate values
|
||||
array. Default is 0. Setting this value larger helps
|
||||
inflate the size of the final table.
|
||||
.TP
|
||||
\fB\-j\fR, \fB\-\-jump\fR=\fIJUMP\-VALUE\fR
|
||||
Affects the "jump value", i.e., how far to advance
|
||||
the associated character value upon collisions. Must
|
||||
be an odd number, default is 5.
|
||||
.TP
|
||||
\fB\-n\fR, \fB\-\-no\-strlen\fR
|
||||
Do not include the length of the keyword when
|
||||
computing the hash function.
|
||||
.TP
|
||||
\fB\-r\fR, \fB\-\-random\fR
|
||||
Utilizes randomness to initialize the associated
|
||||
values table.
|
||||
.TP
|
||||
\fB\-s\fR, \fB\-\-size\-multiple\fR=\fIN\fR
|
||||
Affects the size of the generated hash table. The
|
||||
numeric argument N indicates "how many times larger
|
||||
or smaller" the associated value range should be,
|
||||
in relationship to the number of keys, e.g. a value
|
||||
of 3 means "allow the maximum associated value to
|
||||
be about 3 times larger than the number of input
|
||||
keys". Conversely, a value of 1/3 means "make the
|
||||
maximum associated value about 3 times smaller than
|
||||
the number of input keys". A larger table should
|
||||
decrease the time required for an unsuccessful
|
||||
search, at the expense of extra table space. Default
|
||||
value is 1.
|
||||
.SS "Informative output:"
|
||||
.TP
|
||||
\fB\-h\fR, \fB\-\-help\fR
|
||||
Print this message.
|
||||
.TP
|
||||
\fB\-v\fR, \fB\-\-version\fR
|
||||
Print the gperf version number.
|
||||
.TP
|
||||
\fB\-d\fR, \fB\-\-debug\fR
|
||||
Enables the debugging option (produces verbose
|
||||
output to the standard error).
|
||||
.SH AUTHOR
|
||||
Written by Douglas C. Schmidt and Bruno Haible.
|
||||
.SH "REPORTING BUGS"
|
||||
Report bugs to <bug-gnu-gperf@gnu.org>.
|
||||
.SH COPYRIGHT
|
||||
Copyright \(co 1989-1998, 2000-2004, 2006-2007 Free Software Foundation, Inc.
|
||||
.br
|
||||
This is free software; see the source for copying conditions. There is NO
|
||||
warranty; not even for MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.
|
||||
.SH "SEE ALSO"
|
||||
The full documentation for
|
||||
.B gperf
|
||||
is maintained as a Texinfo manual. If the
|
||||
.B info
|
||||
and
|
||||
.B gperf
|
||||
programs are properly installed at your site, the command
|
||||
.IP
|
||||
.B info gperf
|
||||
.PP
|
||||
should give you access to the complete manual.
|
File diff suppressed because it is too large
Load Diff
File diff suppressed because it is too large
Load Diff
@ -1,398 +0,0 @@
|
||||
@c This GPL is meant to be included from other files.
|
||||
@c To format a standalone GPL, use license.texi.
|
||||
|
||||
@center Version 2, June 1991
|
||||
|
||||
@display
|
||||
Copyright @copyright{} 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.
|
||||
@end display
|
||||
|
||||
@unnumberedsec 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
|
||||
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
|
||||
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
|
||||
have the freedom to distribute copies of free software (and charge for
|
||||
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
|
||||
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
|
||||
software. If the software is modified by someone else and passed on, we
|
||||
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
|
||||
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.
|
||||
|
||||
@iftex
|
||||
@unnumberedsec TERMS AND CONDITIONS FOR COPYING, DISTRIBUTION AND MODIFICATION
|
||||
@end iftex
|
||||
@ifinfo
|
||||
@center TERMS AND CONDITIONS FOR COPYING, DISTRIBUTION AND MODIFICATION
|
||||
@end ifinfo
|
||||
|
||||
@enumerate 0
|
||||
@item
|
||||
This License applies to any program or other work which contains
|
||||
a notice placed by the copyright holder saying it may be distributed
|
||||
under the terms of this General Public License. The ``Program'', below,
|
||||
refers to any such program or work, and a ``work based on the Program''
|
||||
means either the Program or any derivative work under copyright law:
|
||||
that is to say, a work containing the Program or a portion of it,
|
||||
either verbatim or with modifications and/or translated into another
|
||||
language. (Hereinafter, translation is included without limitation in
|
||||
the term ``modification''.) Each licensee is addressed as ``you''.
|
||||
|
||||
Activities other than copying, distribution and modification are not
|
||||
covered by this License; they are outside its scope. The act of
|
||||
running the Program is not restricted, and the output from the Program
|
||||
is covered only if its contents constitute a work based on the
|
||||
Program (independent of having been made by running the Program).
|
||||
Whether that is true depends on what the Program does.
|
||||
|
||||
@item
|
||||
You may copy and distribute verbatim copies of the Program's
|
||||
source code as you receive it, in any medium, provided that you
|
||||
conspicuously and appropriately publish on each copy an appropriate
|
||||
copyright notice and disclaimer of warranty; keep intact all the
|
||||
notices that refer to this License and to the absence of any warranty;
|
||||
and give any other recipients of the Program a copy of this License
|
||||
along with the Program.
|
||||
|
||||
You may charge a fee for the physical act of transferring a copy, and
|
||||
you may at your option offer warranty protection in exchange for a fee.
|
||||
|
||||
@item
|
||||
You may modify your copy or copies of the Program or any portion
|
||||
of it, thus forming a work based on the Program, and copy and
|
||||
distribute such modifications or work under the terms of Section 1
|
||||
above, provided that you also meet all of these conditions:
|
||||
|
||||
@enumerate a
|
||||
@item
|
||||
You must cause the modified files to carry prominent notices
|
||||
stating that you changed the files and the date of any change.
|
||||
|
||||
@item
|
||||
You must cause any work that you distribute or publish, that in
|
||||
whole or in part contains or is derived from the Program or any
|
||||
part thereof, to be licensed as a whole at no charge to all third
|
||||
parties under the terms of this License.
|
||||
|
||||
@item
|
||||
If the modified program normally reads commands interactively
|
||||
when run, you must cause it, when started running for such
|
||||
interactive use in the most ordinary way, to print or display an
|
||||
announcement including an appropriate copyright notice and a
|
||||
notice that there is no warranty (or else, saying that you provide
|
||||
a warranty) and that users may redistribute the program under
|
||||
these conditions, and telling the user how to view a copy of this
|
||||
License. (Exception: if the Program itself is interactive but
|
||||
does not normally print such an announcement, your work based on
|
||||
the Program is not required to print an announcement.)
|
||||
@end enumerate
|
||||
|
||||
These requirements apply to the modified work as a whole. If
|
||||
identifiable sections of that work are not derived from the Program,
|
||||
and can be reasonably considered independent and separate works in
|
||||
themselves, then this License, and its terms, do not apply to those
|
||||
sections when you distribute them as separate works. But when you
|
||||
distribute the same sections as part of a whole which is a work based
|
||||
on the Program, the distribution of the whole must be on the terms of
|
||||
this License, whose permissions for other licensees extend to the
|
||||
entire whole, and thus to each and every part regardless of who wrote it.
|
||||
|
||||
Thus, it is not the intent of this section to claim rights or contest
|
||||
your rights to work written entirely by you; rather, the intent is to
|
||||
exercise the right to control the distribution of derivative or
|
||||
collective works based on the Program.
|
||||
|
||||
In addition, mere aggregation of another work not based on the Program
|
||||
with the Program (or with a work based on the Program) on a volume of
|
||||
a storage or distribution medium does not bring the other work under
|
||||
the scope of this License.
|
||||
|
||||
@item
|
||||
You may copy and distribute the Program (or a work based on it,
|
||||
under Section 2) in object code or executable form under the terms of
|
||||
Sections 1 and 2 above provided that you also do one of the following:
|
||||
|
||||
@enumerate a
|
||||
@item
|
||||
Accompany it with the complete corresponding machine-readable
|
||||
source code, which must be distributed under the terms of Sections
|
||||
1 and 2 above on a medium customarily used for software interchange; or,
|
||||
|
||||
@item
|
||||
Accompany it with a written offer, valid for at least three
|
||||
years, to give any third party, for a charge no more than your
|
||||
cost of physically performing source distribution, a complete
|
||||
machine-readable copy of the corresponding source code, to be
|
||||
distributed under the terms of Sections 1 and 2 above on a medium
|
||||
customarily used for software interchange; or,
|
||||
|
||||
@item
|
||||
Accompany it with the information you received as to the offer
|
||||
to distribute corresponding source code. (This alternative is
|
||||
allowed only for noncommercial distribution and only if you
|
||||
received the program in object code or executable form with such
|
||||
an offer, in accord with Subsection b above.)
|
||||
@end enumerate
|
||||
|
||||
The source code for a work means the preferred form of the work for
|
||||
making modifications to it. For an executable work, complete source
|
||||
code means all the source code for all modules it contains, plus any
|
||||
associated interface definition files, plus the scripts used to
|
||||
control compilation and installation of the executable. However, as a
|
||||
special exception, the source code distributed need not include
|
||||
anything that is normally distributed (in either source or binary
|
||||
form) with the major components (compiler, kernel, and so on) of the
|
||||
operating system on which the executable runs, unless that component
|
||||
itself accompanies the executable.
|
||||
|
||||
If distribution of executable or object code is made by offering
|
||||
access to copy from a designated place, then offering equivalent
|
||||
access to copy the source code from the same place counts as
|
||||
distribution of the source code, even though third parties are not
|
||||
compelled to copy the source along with the object code.
|
||||
|
||||
@item
|
||||
You may not copy, modify, sublicense, or distribute the Program
|
||||
except as expressly provided under this License. Any attempt
|
||||
otherwise to copy, modify, sublicense or distribute the Program is
|
||||
void, and will automatically terminate your rights under this License.
|
||||
However, parties who have received copies, or rights, from you under
|
||||
this License will not have their licenses terminated so long as such
|
||||
parties remain in full compliance.
|
||||
|
||||
@item
|
||||
You are not required to accept this License, since you have not
|
||||
signed it. However, nothing else grants you permission to modify or
|
||||
distribute the Program or its derivative works. These actions are
|
||||
prohibited by law if you do not accept this License. Therefore, by
|
||||
modifying or distributing the Program (or any work based on the
|
||||
Program), you indicate your acceptance of this License to do so, and
|
||||
all its terms and conditions for copying, distributing or modifying
|
||||
the Program or works based on it.
|
||||
|
||||
@item
|
||||
Each time you redistribute the Program (or any work based on the
|
||||
Program), the recipient automatically receives a license from the
|
||||
original licensor to copy, distribute or modify the Program subject to
|
||||
these terms and conditions. You may not impose any further
|
||||
restrictions on the recipients' exercise of the rights granted herein.
|
||||
You are not responsible for enforcing compliance by third parties to
|
||||
this License.
|
||||
|
||||
@item
|
||||
If, as a consequence of a court judgment or allegation of patent
|
||||
infringement or for any other reason (not limited to patent issues),
|
||||
conditions are imposed on you (whether by court order, agreement or
|
||||
otherwise) that contradict the conditions of this License, they do not
|
||||
excuse you from the conditions of this License. If you cannot
|
||||
distribute so as to satisfy simultaneously your obligations under this
|
||||
License and any other pertinent obligations, then as a consequence you
|
||||
may not distribute the Program at all. For example, if a patent
|
||||
license would not permit royalty-free redistribution of the Program by
|
||||
all those who receive copies directly or indirectly through you, then
|
||||
the only way you could satisfy both it and this License would be to
|
||||
refrain entirely from distribution of the Program.
|
||||
|
||||
If any portion of this section is held invalid or unenforceable under
|
||||
any particular circumstance, the balance of the section is intended to
|
||||
apply and the section as a whole is intended to apply in other
|
||||
circumstances.
|
||||
|
||||
It is not the purpose of this section to induce you to infringe any
|
||||
patents or other property right claims or to contest validity of any
|
||||
such claims; this section has the sole purpose of protecting the
|
||||
integrity of the free software distribution system, which is
|
||||
implemented by public license practices. Many people have made
|
||||
generous contributions to the wide range of software distributed
|
||||
through that system in reliance on consistent application of that
|
||||
system; it is up to the author/donor to decide if he or she is willing
|
||||
to distribute software through any other system and a licensee cannot
|
||||
impose that choice.
|
||||
|
||||
This section is intended to make thoroughly clear what is believed to
|
||||
be a consequence of the rest of this License.
|
||||
|
||||
@item
|
||||
If the distribution and/or use of the Program is restricted in
|
||||
certain countries either by patents or by copyrighted interfaces, the
|
||||
original copyright holder who places the Program under this License
|
||||
may add an explicit geographical distribution limitation excluding
|
||||
those countries, so that distribution is permitted only in or among
|
||||
countries not thus excluded. In such case, this License incorporates
|
||||
the limitation as if written in the body of this License.
|
||||
|
||||
@item
|
||||
The Free Software Foundation may publish revised and/or new versions
|
||||
of the General Public License from time to time. Such new versions will
|
||||
be similar in spirit to the present version, but may differ in detail to
|
||||
address new problems or concerns.
|
||||
|
||||
Each version is given a distinguishing version number. If the Program
|
||||
specifies a version number of this License which applies to it and ``any
|
||||
later version'', you have the option of following the terms and conditions
|
||||
either of that version or of any later version published by the Free
|
||||
Software Foundation. If the Program does not specify a version number of
|
||||
this License, you may choose any version ever published by the Free Software
|
||||
Foundation.
|
||||
|
||||
@item
|
||||
If you wish to incorporate parts of the Program into other free
|
||||
programs whose distribution conditions are different, write to the author
|
||||
to ask for permission. For software which is copyrighted by the Free
|
||||
Software Foundation, write to the Free Software Foundation; we sometimes
|
||||
make exceptions for this. Our decision will be guided by the two goals
|
||||
of preserving the free status of all derivatives of our free software and
|
||||
of promoting the sharing and reuse of software generally.
|
||||
|
||||
@iftex
|
||||
@vskip -@baselineskip
|
||||
@vskip -@baselineskip
|
||||
@heading NO WARRANTY
|
||||
@end iftex
|
||||
@ifinfo
|
||||
@center NO WARRANTY
|
||||
@end ifinfo
|
||||
|
||||
@item
|
||||
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 HOLDERS AND/OR OTHER PARTIES
|
||||
PROVIDE THE PROGRAM ``AS IS'' WITHOUT WARRANTY OF ANY KIND, EITHER EXPRESSED
|
||||
OR IMPLIED, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF
|
||||
MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE. THE ENTIRE RISK AS
|
||||
TO THE QUALITY AND PERFORMANCE OF THE PROGRAM IS WITH YOU. SHOULD THE
|
||||
PROGRAM PROVE DEFECTIVE, YOU ASSUME THE COST OF ALL NECESSARY SERVICING,
|
||||
REPAIR OR CORRECTION.
|
||||
|
||||
@item
|
||||
IN NO EVENT UNLESS REQUIRED BY APPLICABLE LAW OR AGREED TO IN WRITING
|
||||
WILL ANY COPYRIGHT HOLDER, OR ANY OTHER PARTY WHO MAY MODIFY AND/OR
|
||||
REDISTRIBUTE THE PROGRAM AS PERMITTED ABOVE, BE LIABLE TO YOU FOR DAMAGES,
|
||||
INCLUDING ANY GENERAL, SPECIAL, INCIDENTAL OR CONSEQUENTIAL DAMAGES ARISING
|
||||
OUT OF THE USE OR INABILITY TO USE THE PROGRAM (INCLUDING BUT NOT LIMITED
|
||||
TO LOSS OF DATA OR DATA BEING RENDERED INACCURATE OR LOSSES SUSTAINED BY
|
||||
YOU OR THIRD PARTIES OR A FAILURE OF THE PROGRAM TO OPERATE WITH ANY OTHER
|
||||
PROGRAMS), EVEN IF SUCH HOLDER OR OTHER PARTY HAS BEEN ADVISED OF THE
|
||||
POSSIBILITY OF SUCH DAMAGES.
|
||||
@end enumerate
|
||||
|
||||
@iftex
|
||||
@heading END OF TERMS AND CONDITIONS
|
||||
@end iftex
|
||||
@ifinfo
|
||||
@center END OF TERMS AND CONDITIONS
|
||||
@end ifinfo
|
||||
|
||||
@page
|
||||
@unnumberedsec How to Apply These Terms to Your New Programs
|
||||
|
||||
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.
|
||||
|
||||
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.
|
||||
|
||||
@smallexample
|
||||
@var{one line to give the program's name and an idea of what it does.}
|
||||
Copyright (C) @var{year} @var{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.
|
||||
@end smallexample
|
||||
|
||||
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:
|
||||
|
||||
@smallexample
|
||||
Gnomovision version 69, Copyright (C) @var{year} @var{name of author}
|
||||
Gnomovision comes with ABSOLUTELY NO WARRANTY; for details
|
||||
type `show w'. This is free software, and you are welcome
|
||||
to redistribute it under certain conditions; type `show c'
|
||||
for details.
|
||||
@end smallexample
|
||||
|
||||
The hypothetical commands @samp{show w} and @samp{show c} should show
|
||||
the appropriate parts of the General Public License. Of course, the
|
||||
commands you use may be called something other than @samp{show w} and
|
||||
@samp{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:
|
||||
|
||||
@example
|
||||
@group
|
||||
Yoyodyne, Inc., hereby disclaims all copyright
|
||||
interest in the program `Gnomovision'
|
||||
(which makes passes at compilers) written
|
||||
by James Hacker.
|
||||
|
||||
@var{signature of Ty Coon}, 1 April 1989
|
||||
Ty Coon, President of Vice
|
||||
@end group
|
||||
@end example
|
||||
|
||||
This General Public License does not permit incorporating your program into
|
||||
proprietary programs. If your program is a subroutine library, you may
|
||||
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.
|
@ -1,517 +0,0 @@
|
||||
#!/usr/bin/perl -w
|
||||
|
||||
# Generate a short man page from --help and --version output.
|
||||
# Copyright © 1997, 1998, 1999, 2000 Free Software Foundation, Inc.
|
||||
|
||||
# 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, 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., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
|
||||
|
||||
# Written by Brendan O'Dea <bod@compusol.com.au>
|
||||
# Available from ftp://ftp.gnu.org/gnu/help2man/
|
||||
|
||||
use 5.004;
|
||||
use strict;
|
||||
use Getopt::Long;
|
||||
use Text::Tabs qw(expand);
|
||||
use POSIX qw(strftime setlocale LC_TIME);
|
||||
|
||||
my $this_program = 'help2man';
|
||||
my $this_version = '1.23';
|
||||
my $version_info = <<EOT;
|
||||
GNU $this_program $this_version
|
||||
|
||||
Copyright (C) 1997, 1998, 1999, 2000 Free Software Foundation, Inc.
|
||||
This is free software; see the source for copying conditions. There is NO
|
||||
warranty; not even for MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.
|
||||
|
||||
Written by Brendan O'Dea <bod\@compusol.com.au>
|
||||
EOT
|
||||
|
||||
my $help_info = <<EOT;
|
||||
`$this_program' generates a man page out of `--help' and `--version' output.
|
||||
|
||||
Usage: $this_program [OPTION]... EXECUTABLE
|
||||
|
||||
-n, --name=STRING use `STRING' as the description for the NAME paragraph
|
||||
-s, --section=SECTION use `SECTION' as the section for the man page
|
||||
-i, --include=FILE include material from `FILE'
|
||||
-I, --opt-include=FILE include material from `FILE' if it exists
|
||||
-o, --output=FILE send output to `FILE'
|
||||
-N, --no-info suppress pointer to Texinfo manual
|
||||
--help print this help, then exit
|
||||
--version print version number, then exit
|
||||
|
||||
EXECUTABLE should accept `--help' and `--version' options.
|
||||
|
||||
Report bugs to <bug-help2man\@gnu.org>.
|
||||
EOT
|
||||
|
||||
my $section = 1;
|
||||
my ($opt_name, @opt_include, $opt_output, $opt_no_info);
|
||||
|
||||
# Parse options.
|
||||
Getopt::Long::config('bundling');
|
||||
GetOptions (
|
||||
'n|name=s' => \$opt_name,
|
||||
's|section=s' => \$section,
|
||||
'i|include=s' => sub { push @opt_include, [ pop, 1 ] },
|
||||
'I|opt-include=s' => sub { push @opt_include, [ pop, 0 ] },
|
||||
'o|output=s' => \$opt_output,
|
||||
'N|no-info' => \$opt_no_info,
|
||||
help => sub { print $help_info; exit },
|
||||
version => sub { print $version_info; exit },
|
||||
) or die $help_info;
|
||||
|
||||
die $help_info unless @ARGV == 1;
|
||||
|
||||
my %include = ();
|
||||
my %append = ();
|
||||
my @include = (); # retain order given in include file
|
||||
|
||||
# Provide replacement `quote-regex' operator for pre-5.005.
|
||||
BEGIN { eval q(sub qr { '' =~ $_[0]; $_[0] }) if $] < 5.005 }
|
||||
|
||||
# Process include file (if given). Format is:
|
||||
#
|
||||
# [section name]
|
||||
# verbatim text
|
||||
#
|
||||
# or
|
||||
#
|
||||
# /pattern/
|
||||
# verbatim text
|
||||
#
|
||||
|
||||
for (@opt_include)
|
||||
{
|
||||
my ($inc, $required) = @$_;
|
||||
|
||||
next unless -f $inc or $required;
|
||||
die "$this_program: can't open `$inc' ($!)\n"
|
||||
unless open INC, $inc;
|
||||
|
||||
my $key;
|
||||
my $hash = \%include;
|
||||
|
||||
while (<INC>)
|
||||
{
|
||||
# [section]
|
||||
if (/^\[([^]]+)\]/)
|
||||
{
|
||||
$key = uc $1;
|
||||
$key =~ s/^\s+//;
|
||||
$key =~ s/\s+$//;
|
||||
$hash = \%include;
|
||||
push @include, $key unless $include{$key};
|
||||
next;
|
||||
}
|
||||
|
||||
# /pattern/
|
||||
if (m!^/(.*)/([ims]*)!)
|
||||
{
|
||||
my $pat = $2 ? "(?$2)$1" : $1;
|
||||
|
||||
# Check pattern.
|
||||
eval { $key = qr($pat) };
|
||||
if ($@)
|
||||
{
|
||||
$@ =~ s/ at .*? line \d.*//;
|
||||
die "$inc:$.:$@";
|
||||
}
|
||||
|
||||
$hash = \%append;
|
||||
next;
|
||||
}
|
||||
|
||||
# Silently ignore anything before the first
|
||||
# section--allows for comments and revision info.
|
||||
next unless $key;
|
||||
|
||||
$hash->{$key} ||= '';
|
||||
$hash->{$key} .= $_;
|
||||
}
|
||||
|
||||
close INC;
|
||||
|
||||
die "$this_program: no valid information found in `$inc'\n"
|
||||
unless $key;
|
||||
}
|
||||
|
||||
# Compress trailing blank lines.
|
||||
for my $hash (\(%include, %append))
|
||||
{
|
||||
for (keys %$hash) { $hash->{$_} =~ s/\n+$/\n/ }
|
||||
}
|
||||
|
||||
# Turn off localisation of executable's ouput.
|
||||
@ENV{qw(LANGUAGE LANG LC_ALL)} = ('C') x 3;
|
||||
|
||||
# Turn off localisation of date (for strftime).
|
||||
setlocale LC_TIME, 'C';
|
||||
|
||||
# Grab help and version info from executable.
|
||||
my ($help_text, $version_text) = map {
|
||||
join '', map { s/ +$//; expand $_ } `$ARGV[0] --$_ 2>/dev/null`
|
||||
or die "$this_program: can't get `--$_' info from $ARGV[0]\n"
|
||||
} qw(help version);
|
||||
|
||||
my $date = strftime "%B %Y", localtime;
|
||||
(my $program = $ARGV[0]) =~ s!.*/!!;
|
||||
my $package = $program;
|
||||
my $version;
|
||||
|
||||
if ($opt_output)
|
||||
{
|
||||
unlink $opt_output
|
||||
or die "$this_program: can't unlink $opt_output ($!)\n"
|
||||
if -e $opt_output;
|
||||
|
||||
open STDOUT, ">$opt_output"
|
||||
or die "$this_program: can't create $opt_output ($!)\n";
|
||||
}
|
||||
|
||||
# The first line of the --version information is assumed to be in one
|
||||
# of the following formats:
|
||||
#
|
||||
# <version>
|
||||
# <program> <version>
|
||||
# {GNU,Free} <program> <version>
|
||||
# <program> ({GNU,Free} <package>) <version>
|
||||
# <program> - {GNU,Free} <package> <version>
|
||||
#
|
||||
# and seperated from any copyright/author details by a blank line.
|
||||
|
||||
($_, $version_text) = split /\n+/, $version_text, 2;
|
||||
|
||||
if (/^(\S+) +\(((?:GNU|Free) +[^)]+)\) +(.*)/ or
|
||||
/^(\S+) +- *((?:GNU|Free) +\S+) +(.*)/)
|
||||
{
|
||||
$program = $1;
|
||||
$package = $2;
|
||||
$version = $3;
|
||||
}
|
||||
elsif (/^((?:GNU|Free) +)?(\S+) +(.*)/)
|
||||
{
|
||||
$program = $2;
|
||||
$package = $1 ? "$1$2" : $2;
|
||||
$version = $3;
|
||||
}
|
||||
else
|
||||
{
|
||||
$version = $_;
|
||||
}
|
||||
|
||||
$program =~ s!.*/!!;
|
||||
|
||||
# No info for `info' itself.
|
||||
$opt_no_info = 1 if $program eq 'info';
|
||||
|
||||
# --name overrides --include contents.
|
||||
$include{NAME} = "$program \\- $opt_name\n" if $opt_name;
|
||||
|
||||
# Default (useless) NAME paragraph.
|
||||
$include{NAME} ||= "$program \\- manual page for $program $version\n";
|
||||
|
||||
# Man pages traditionally have the page title in caps.
|
||||
my $PROGRAM = uc $program;
|
||||
|
||||
# Extract usage clause(s) [if any] for SYNOPSIS.
|
||||
if ($help_text =~ s/^Usage:( +(\S+))(.*)((?:\n(?: {6}\1| *or: +\S).*)*)//m)
|
||||
{
|
||||
my @syn = $2 . $3;
|
||||
|
||||
if ($_ = $4)
|
||||
{
|
||||
s/^\n//;
|
||||
for (split /\n/) { s/^ *(or: +)?//; push @syn, $_ }
|
||||
}
|
||||
|
||||
my $synopsis = '';
|
||||
for (@syn)
|
||||
{
|
||||
$synopsis .= ".br\n" if $synopsis;
|
||||
s!^\S*/!!;
|
||||
s/^(\S+) *//;
|
||||
$synopsis .= ".B $1\n";
|
||||
s/\s+$//;
|
||||
s/(([][]|\.\.+)+)/\\fR$1\\fI/g;
|
||||
s/^/\\fI/ unless s/^\\fR//;
|
||||
$_ .= '\fR';
|
||||
s/(\\fI)( *)/$2$1/g;
|
||||
s/\\fI\\fR//g;
|
||||
s/^\\fR//;
|
||||
s/\\fI$//;
|
||||
s/^\./\\&./;
|
||||
|
||||
$synopsis .= "$_\n";
|
||||
}
|
||||
|
||||
$include{SYNOPSIS} ||= $synopsis;
|
||||
}
|
||||
|
||||
# Process text, initial section is DESCRIPTION.
|
||||
my $sect = 'DESCRIPTION';
|
||||
$_ = "$help_text\n\n$version_text";
|
||||
|
||||
# Normalise paragraph breaks.
|
||||
s/^\n+//;
|
||||
s/\n*$/\n/;
|
||||
s/\n\n+/\n\n/g;
|
||||
|
||||
# Temporarily exchange leading dots, apostrophes and backslashes for
|
||||
# tokens.
|
||||
s/^\./\x80/mg;
|
||||
s/^'/\x81/mg;
|
||||
s/\\/\x82/g;
|
||||
|
||||
# Start a new paragraph (if required) for these.
|
||||
s/([^\n])\n(Report +bugs|Email +bug +reports +to|Written +by)/$1\n\n$2/g;
|
||||
|
||||
sub convert_option;
|
||||
|
||||
while (length)
|
||||
{
|
||||
# Convert some standard paragraph names.
|
||||
if (s/^(Options|Examples): *\n//)
|
||||
{
|
||||
$sect = uc $1;
|
||||
next;
|
||||
}
|
||||
|
||||
# Copyright section
|
||||
if (/^Copyright +[(\xa9]/)
|
||||
{
|
||||
$sect = 'COPYRIGHT';
|
||||
$include{$sect} ||= '';
|
||||
$include{$sect} .= ".PP\n" if $include{$sect};
|
||||
|
||||
my $copy;
|
||||
($copy, $_) = split /\n\n/, $_, 2;
|
||||
|
||||
for ($copy)
|
||||
{
|
||||
# Add back newline
|
||||
s/\n*$/\n/;
|
||||
|
||||
# Convert iso9959-1 copyright symbol or (c) to nroff
|
||||
# character.
|
||||
s/^Copyright +(?:\xa9|\([Cc]\))/Copyright \\(co/mg;
|
||||
|
||||
# Insert line breaks before additional copyright messages
|
||||
# and the disclaimer.
|
||||
s/(.)\n(Copyright |This +is +free +software)/$1\n.br\n$2/g;
|
||||
|
||||
# Join hyphenated lines.
|
||||
s/([A-Za-z])-\n */$1/g;
|
||||
}
|
||||
|
||||
$include{$sect} .= $copy;
|
||||
$_ ||= '';
|
||||
next;
|
||||
}
|
||||
|
||||
# Catch bug report text.
|
||||
if (/^(Report +bugs|Email +bug +reports +to) /)
|
||||
{
|
||||
$sect = 'REPORTING BUGS';
|
||||
}
|
||||
|
||||
# Author section.
|
||||
elsif (/^Written +by/)
|
||||
{
|
||||
$sect = 'AUTHOR';
|
||||
}
|
||||
|
||||
# Examples, indicated by an indented leading $, % or > are
|
||||
# rendered in a constant width font.
|
||||
if (/^( +)([\$\%>] )\S/)
|
||||
{
|
||||
my $indent = $1;
|
||||
my $prefix = $2;
|
||||
my $break = '.IP';
|
||||
$include{$sect} ||= '';
|
||||
while (s/^$indent\Q$prefix\E(\S.*)\n*//)
|
||||
{
|
||||
$include{$sect} .= "$break\n\\f(CW$prefix$1\\fR\n";
|
||||
$break = '.br';
|
||||
}
|
||||
|
||||
next;
|
||||
}
|
||||
|
||||
my $matched = '';
|
||||
$include{$sect} ||= '';
|
||||
|
||||
# Sub-sections have a trailing colon and the second line indented.
|
||||
if (s/^(\S.*:) *\n / /)
|
||||
{
|
||||
$matched .= $& if %append;
|
||||
$include{$sect} .= qq(.SS "$1"\n);
|
||||
}
|
||||
|
||||
my $indent = 0;
|
||||
my $content = '';
|
||||
|
||||
# Option with description.
|
||||
if (s/^( {1,10}([+-]\S.*?))(?:( +)|\n( {20,}))(\S.*)\n//)
|
||||
{
|
||||
$matched .= $& if %append;
|
||||
$indent = length ($4 || "$1$3");
|
||||
$content = ".TP\n\x83$2\n\x83$5\n";
|
||||
unless ($4)
|
||||
{
|
||||
# Indent may be different on second line.
|
||||
$indent = length $& if /^ {20,}/;
|
||||
}
|
||||
}
|
||||
|
||||
# Option without description.
|
||||
elsif (s/^ {1,10}([+-]\S.*)\n//)
|
||||
{
|
||||
$matched .= $& if %append;
|
||||
$content = ".HP\n\x83$1\n";
|
||||
$indent = 80; # not continued
|
||||
}
|
||||
|
||||
# Indented paragraph with tag.
|
||||
elsif (s/^( +(\S.*?) +)(\S.*)\n//)
|
||||
{
|
||||
$matched .= $& if %append;
|
||||
$indent = length $1;
|
||||
$content = ".TP\n\x83$2\n\x83$3\n";
|
||||
}
|
||||
|
||||
# Indented paragraph.
|
||||
elsif (s/^( +)(\S.*)\n//)
|
||||
{
|
||||
$matched .= $& if %append;
|
||||
$indent = length $1;
|
||||
$content = ".IP\n\x83$2\n";
|
||||
}
|
||||
|
||||
# Left justified paragraph.
|
||||
else
|
||||
{
|
||||
s/(.*)\n//;
|
||||
$matched .= $& if %append;
|
||||
$content = ".PP\n" if $include{$sect};
|
||||
$content .= "$1\n";
|
||||
}
|
||||
|
||||
# Append continuations.
|
||||
while (s/^ {$indent}(\S.*)\n//)
|
||||
{
|
||||
$matched .= $& if %append;
|
||||
$content .= "\x83$1\n"
|
||||
}
|
||||
|
||||
# Move to next paragraph.
|
||||
s/^\n+//;
|
||||
|
||||
for ($content)
|
||||
{
|
||||
# Leading dot and apostrophe protection.
|
||||
s/\x83\./\x80/g;
|
||||
s/\x83'/\x81/g;
|
||||
s/\x83//g;
|
||||
|
||||
# Convert options.
|
||||
s/(^| )(-[][\w=-]+)/$1 . convert_option $2/mge;
|
||||
}
|
||||
|
||||
# Check if matched paragraph contains /pat/.
|
||||
if (%append)
|
||||
{
|
||||
for my $pat (keys %append)
|
||||
{
|
||||
if ($matched =~ $pat)
|
||||
{
|
||||
$content .= ".PP\n" unless $append{$pat} =~ /^\./;
|
||||
$content .= $append{$pat};
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
$include{$sect} .= $content;
|
||||
}
|
||||
|
||||
# Refer to the real documentation.
|
||||
unless ($opt_no_info)
|
||||
{
|
||||
$sect = 'SEE ALSO';
|
||||
$include{$sect} ||= '';
|
||||
$include{$sect} .= ".PP\n" if $include{$sect};
|
||||
$include{$sect} .= <<EOT;
|
||||
The full documentation for
|
||||
.B $program
|
||||
is maintained as a Texinfo manual. If the
|
||||
.B info
|
||||
and
|
||||
.B $program
|
||||
programs are properly installed at your site, the command
|
||||
.IP
|
||||
.B info $program
|
||||
.PP
|
||||
should give you access to the complete manual.
|
||||
EOT
|
||||
}
|
||||
|
||||
# Output header.
|
||||
print <<EOT;
|
||||
.\\" DO NOT MODIFY THIS FILE! It was generated by $this_program $this_version.
|
||||
.TH $PROGRAM "$section" "$date" "$package $version" FSF
|
||||
EOT
|
||||
|
||||
# Section ordering.
|
||||
my @pre = qw(NAME SYNOPSIS DESCRIPTION OPTIONS EXAMPLES);
|
||||
my @post = ('AUTHOR', 'REPORTING BUGS', 'COPYRIGHT', 'SEE ALSO');
|
||||
my $filter = join '|', @pre, @post;
|
||||
|
||||
# Output content.
|
||||
for (@pre, (grep ! /^($filter)$/o, @include), @post)
|
||||
{
|
||||
if ($include{$_})
|
||||
{
|
||||
my $quote = /\W/ ? '"' : '';
|
||||
print ".SH $quote$_$quote\n";
|
||||
|
||||
for ($include{$_})
|
||||
{
|
||||
# Replace leading dot, apostrophe and backslash tokens.
|
||||
s/\x80/\\&./g;
|
||||
s/\x81/\\&'/g;
|
||||
s/\x82/\\e/g;
|
||||
print;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
exit;
|
||||
|
||||
# Convert option dashes to \- to stop nroff from hyphenating 'em, and
|
||||
# embolden. Option arguments get italicised.
|
||||
sub convert_option
|
||||
{
|
||||
local $_ = '\fB' . shift;
|
||||
|
||||
s/-/\\-/g;
|
||||
unless (s/\[=(.*)\]$/\\fR[=\\fI$1\\fR]/)
|
||||
{
|
||||
s/=(.)/\\fR=\\fI$1/;
|
||||
s/ (.)/ \\fI$1/;
|
||||
$_ .= '\fR';
|
||||
}
|
||||
|
||||
$_;
|
||||
}
|
@ -1,116 +0,0 @@
|
||||
# Makefile for gperf/lib
|
||||
|
||||
# Copyright (C) 1989, 1992, 1993, 1998, 2002 Free Software Foundation, Inc.
|
||||
# Written by Douglas C. Schmidt <schmidt@ics.uci.edu>
|
||||
# and Bruno Haible <bruno@clisp.org>.
|
||||
#
|
||||
# This file is part of GNU GPERF.
|
||||
#
|
||||
# GNU GPERF 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, or (at your option)
|
||||
# any later version.
|
||||
#
|
||||
# GNU GPERF 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; see the file COPYING.
|
||||
# If not, write to the Free Software Foundation, Inc.,
|
||||
# 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. */
|
||||
|
||||
#### Start of system configuration section. ####
|
||||
|
||||
# Directories used by "make":
|
||||
srcdir = @srcdir@
|
||||
|
||||
# Directories used by "make install":
|
||||
prefix = @prefix@
|
||||
local_prefix = /usr/local
|
||||
exec_prefix = @exec_prefix@
|
||||
|
||||
# Programs used by "make":
|
||||
# C compiler
|
||||
CC = @CC@
|
||||
CFLAGS = @CFLAGS@
|
||||
CPP = @CPP@
|
||||
# C++ compiler
|
||||
CXX = @CXX@
|
||||
CXXFLAGS = @CXXFLAGS@
|
||||
CXXCPP = @CXXCPP@
|
||||
# Both C and C++ compiler
|
||||
OBJEXT = @OBJEXT@
|
||||
# Other
|
||||
AR = @AR@
|
||||
ARFLAGS = @ARFLAGS@
|
||||
RANLIB = @RANLIB@
|
||||
MV = mv
|
||||
LN = ln
|
||||
RM = rm -f
|
||||
@SET_MAKE@
|
||||
|
||||
# Programs used by "make install":
|
||||
INSTALL = @INSTALL@
|
||||
INSTALL_PROGRAM = @INSTALL_PROGRAM@
|
||||
INSTALL_DATA = @INSTALL_DATA@
|
||||
|
||||
#### End of system configuration section. ####
|
||||
|
||||
SHELL = /bin/sh
|
||||
|
||||
VPATH = $(srcdir)
|
||||
|
||||
OBJECTS = getopt.$(OBJEXT) getopt1.$(OBJEXT) getline.$(OBJEXT) hash.$(OBJEXT)
|
||||
CPPFLAGS = -I$(srcdir)
|
||||
|
||||
TARGETLIB = libgp.a
|
||||
|
||||
all : $(TARGETLIB)
|
||||
|
||||
$(TARGETLIB): $(OBJECTS)
|
||||
$(RM) $@
|
||||
$(AR) $(ARFLAGS) $@ $(OBJECTS)
|
||||
$(RANLIB) $@
|
||||
|
||||
# Don't use implicit rules, since AIX "make" and OSF/1 "make" don't always
|
||||
# expand $< correctly in this context.
|
||||
#
|
||||
#%.o : %.c
|
||||
# $(CC) $(CFLAGS) $(CPPFLAGS) -c $<
|
||||
#
|
||||
#%.o : %.cc
|
||||
# $(CXX) $(CXXFLAGS) $(CPPFLAGS) -c $<
|
||||
|
||||
getopt.o : getopt.c getopt.h
|
||||
$(CC) $(CFLAGS) $(CPPFLAGS) -c $(srcdir)/getopt.c
|
||||
|
||||
getopt1.o : getopt1.c getopt.h
|
||||
$(CC) $(CFLAGS) $(CPPFLAGS) -c $(srcdir)/getopt1.c
|
||||
|
||||
getline.o : getline.cc getline.h
|
||||
$(CXX) $(CXXFLAGS) $(CPPFLAGS) -c $(srcdir)/getline.cc
|
||||
|
||||
hash.o : hash.cc hash.h
|
||||
$(CXX) $(CXXFLAGS) $(CPPFLAGS) -c $(srcdir)/hash.cc
|
||||
|
||||
install : all
|
||||
|
||||
installdirs :
|
||||
|
||||
uninstall :
|
||||
|
||||
check : all
|
||||
|
||||
mostlyclean : clean
|
||||
|
||||
clean : force
|
||||
$(RM) *~ *.s *.o *.a $(TARGETLIB) core
|
||||
|
||||
distclean : clean
|
||||
$(RM) config.status config.log config.cache Makefile
|
||||
|
||||
maintainer-clean : distclean
|
||||
|
||||
force :
|
4593
contrib/gperf/lib/configure
vendored
4593
contrib/gperf/lib/configure
vendored
File diff suppressed because it is too large
Load Diff
@ -1,45 +0,0 @@
|
||||
dnl autoconf configuration for gperf/lib
|
||||
|
||||
dnl Copyright (C) 1998, 2002, 2005, 2007 Free Software Foundation, Inc.
|
||||
dnl Written by Douglas C. Schmidt <schmidt@ics.uci.edu>
|
||||
dnl and Bruno Haible <bruno@clisp.org>.
|
||||
dnl
|
||||
dnl This file is part of GNU GPERF.
|
||||
dnl
|
||||
dnl GNU GPERF is free software; you can redistribute it and/or modify
|
||||
dnl it under the terms of the GNU General Public License as published by
|
||||
dnl the Free Software Foundation; either version 2, or (at your option)
|
||||
dnl any later version.
|
||||
dnl
|
||||
dnl GNU GPERF is distributed in the hope that it will be useful,
|
||||
dnl but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
dnl MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
dnl GNU General Public License for more details.
|
||||
dnl
|
||||
dnl You should have received a copy of the GNU General Public License
|
||||
dnl along with this program; see the file COPYING.
|
||||
dnl If not, write to the Free Software Foundation, Inc.,
|
||||
dnl 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. */
|
||||
|
||||
AC_PREREQ([2.60])
|
||||
AC_INIT(hash.cc)
|
||||
AC_PROG_MAKE_SET
|
||||
dnl
|
||||
dnl checks for programs
|
||||
dnl
|
||||
AC_PROG_CC
|
||||
dnl sets variable CC
|
||||
AC_PROG_CPP
|
||||
dnl sets variable CPP
|
||||
AC_PROG_CXX
|
||||
dnl sets variable CXX
|
||||
AC_PROG_CXXCPP
|
||||
dnl sets variable CXXCPP
|
||||
AC_PROG_RANLIB
|
||||
dnl sets variable RANLIB
|
||||
CL_PROG_INSTALL
|
||||
dnl sets variables INSTALL, INSTALL_DATA, INSTALL_PROGRAM
|
||||
dnl
|
||||
dnl That's it.
|
||||
dnl
|
||||
AC_OUTPUT(Makefile)
|
@ -1,119 +0,0 @@
|
||||
/* getline.c -- Replacement for GNU C library function getline
|
||||
|
||||
Copyright (C) 1993, 1996, 2001-2002 Free Software Foundation, Inc.
|
||||
|
||||
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., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301,
|
||||
USA. */
|
||||
|
||||
/* Written by Jan Brittenson, bson@gnu.ai.mit.edu. */
|
||||
|
||||
/* Specification. */
|
||||
#include "getline.h"
|
||||
|
||||
#include <stddef.h>
|
||||
#include <stdio.h>
|
||||
#include <string.h>
|
||||
#include <assert.h>
|
||||
|
||||
/* Always add at least this many bytes when extending the buffer. */
|
||||
#define MIN_CHUNK 64
|
||||
|
||||
/* Reads up to (and including) a TERMINATOR from STREAM into *LINEPTR + OFFSET
|
||||
(and null-terminate it). *LINEPTR is a pointer returned from new [] (or
|
||||
NULL), pointing to *N characters of space. It is realloc'd as
|
||||
necessary. Returns the number of characters read (not including the
|
||||
null terminator), or -1 on error or immediate EOF.
|
||||
NOTE: There is another getstr() function declared in <curses.h>. */
|
||||
|
||||
static int
|
||||
getstr (char **lineptr, size_t *n, FILE *stream, char terminator, size_t offset)
|
||||
{
|
||||
size_t nchars_avail; /* Allocated but unused chars in *LINEPTR. */
|
||||
char *read_pos; /* Where we're reading into *LINEPTR. */
|
||||
|
||||
if (!lineptr || !n || !stream)
|
||||
return -1;
|
||||
|
||||
if (!*lineptr)
|
||||
{
|
||||
*n = MIN_CHUNK;
|
||||
*lineptr = new char[*n];
|
||||
}
|
||||
|
||||
nchars_avail = *n - offset;
|
||||
read_pos = *lineptr + offset;
|
||||
|
||||
for (;;)
|
||||
{
|
||||
int c = getc (stream);
|
||||
|
||||
/* We always want at least one char left in the buffer, since we
|
||||
always (unless we get an error while reading the first char)
|
||||
NUL-terminate the line buffer. */
|
||||
|
||||
assert (*n - nchars_avail == (size_t) (read_pos - *lineptr));
|
||||
if (nchars_avail < 2)
|
||||
{
|
||||
if (*n > MIN_CHUNK)
|
||||
*n *= 2;
|
||||
else
|
||||
*n += MIN_CHUNK;
|
||||
|
||||
nchars_avail = *n + *lineptr - read_pos;
|
||||
char *new_line = new char[*n];
|
||||
if (*lineptr)
|
||||
{
|
||||
memcpy (new_line, *lineptr, read_pos - *lineptr);
|
||||
delete[] *lineptr;
|
||||
}
|
||||
*lineptr = new_line;
|
||||
read_pos = *n - nchars_avail + *lineptr;
|
||||
assert (*n - nchars_avail == (size_t) (read_pos - *lineptr));
|
||||
}
|
||||
|
||||
if (c == EOF || ferror (stream))
|
||||
{
|
||||
/* Return partial line, if any. */
|
||||
if (read_pos == *lineptr)
|
||||
return -1;
|
||||
else
|
||||
break;
|
||||
}
|
||||
|
||||
*read_pos++ = c;
|
||||
nchars_avail--;
|
||||
|
||||
if (c == terminator)
|
||||
/* Return the line. */
|
||||
break;
|
||||
}
|
||||
|
||||
/* Done - NUL terminate and return the number of chars read. */
|
||||
*read_pos = '\0';
|
||||
|
||||
return read_pos - (*lineptr + offset);
|
||||
}
|
||||
|
||||
int
|
||||
get_line (char **lineptr, size_t *n, FILE *stream)
|
||||
{
|
||||
return getstr (lineptr, n, stream, '\n', 0);
|
||||
}
|
||||
|
||||
int
|
||||
get_delim (char **lineptr, size_t *n, int delimiter, FILE *stream)
|
||||
{
|
||||
return getstr (lineptr, n, stream, delimiter, 0);
|
||||
}
|
@ -1,41 +0,0 @@
|
||||
/* Copyright (C) 1995, 2000-2002 Free Software Foundation, Inc.
|
||||
|
||||
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, 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., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301,
|
||||
USA. */
|
||||
|
||||
#ifndef GETLINE_H_
|
||||
# define GETLINE_H_ 1
|
||||
|
||||
# include <stddef.h>
|
||||
# include <stdio.h>
|
||||
|
||||
/* Like the glibc functions get_line and get_delim, except that the result
|
||||
must be freed using delete[], not free(). */
|
||||
|
||||
/* Reads up to (and including) a newline from STREAM into *LINEPTR
|
||||
(and null-terminate it). *LINEPTR is a pointer returned from new [] (or
|
||||
NULL), pointing to *N characters of space. It is realloc'd as
|
||||
necessary. Returns the number of characters read (not including the
|
||||
null terminator), or -1 on error or immediate EOF. */
|
||||
extern int get_line (char **lineptr, size_t *n, FILE *stream);
|
||||
|
||||
/* Reads up to (and including) a DELIMITER from STREAM into *LINEPTR
|
||||
(and null-terminate it). *LINEPTR is a pointer returned from new [] (or
|
||||
NULL), pointing to *N characters of space. It is realloc'd as
|
||||
necessary. Returns the number of characters read (not including the
|
||||
null terminator), or -1 on error or immediate EOF. */
|
||||
extern int get_delim (char **lineptr, size_t *n, int delimiter, FILE *stream);
|
||||
|
||||
#endif /* not GETLINE_H_ */
|
@ -1,27 +0,0 @@
|
||||
/*
|
||||
Copyright (C) 1990, 2000, 2002 Free Software Foundation
|
||||
written by Doug Lea <dl@rocky.oswego.edu>
|
||||
*/
|
||||
|
||||
#include <hash.h>
|
||||
|
||||
/*
|
||||
Some useful hash function.
|
||||
It's not a particularly good hash function (<< 5 would be better than << 4),
|
||||
but people believe in it because it comes from Dragon book.
|
||||
*/
|
||||
|
||||
unsigned int
|
||||
hashpjw (const unsigned char *x, unsigned int len) // From Dragon book, p436
|
||||
{
|
||||
unsigned int h = 0;
|
||||
unsigned int g;
|
||||
|
||||
for (; len > 0; len--)
|
||||
{
|
||||
h = (h << 4) + *x++;
|
||||
if ((g = h & 0xf0000000) != 0)
|
||||
h = (h ^ (g >> 24)) ^ g;
|
||||
}
|
||||
return h;
|
||||
}
|
@ -1,15 +0,0 @@
|
||||
// This may look like C code, but it is really -*- C++ -*-
|
||||
|
||||
/*
|
||||
Copyright (C) 1988, 1992, 2000, 2002 Free Software Foundation
|
||||
written by Doug Lea <dl@rocky.oswego.edu>
|
||||
*/
|
||||
|
||||
#ifndef _hash_h
|
||||
#define _hash_h 1
|
||||
|
||||
/* a hash function for char[] arrays using the
|
||||
method described in Aho, Sethi, & Ullman, p 436. */
|
||||
extern unsigned int hashpjw (const unsigned char *string, unsigned int len);
|
||||
|
||||
#endif
|
@ -1,40 +0,0 @@
|
||||
#! /bin/sh
|
||||
# mkinstalldirs --- make directory hierarchy
|
||||
# Author: Noah Friedman <friedman@prep.ai.mit.edu>
|
||||
# Created: 1993-05-16
|
||||
# Public domain
|
||||
|
||||
# $Id: mkinstalldirs,v 1.13 1999/01/05 03:18:55 bje Exp $
|
||||
|
||||
errstatus=0
|
||||
|
||||
for file
|
||||
do
|
||||
set fnord `echo ":$file" | sed -ne 's/^:\//#/;s/^://;s/\// /g;s/^#/\//;p'`
|
||||
shift
|
||||
|
||||
pathcomp=
|
||||
for d
|
||||
do
|
||||
pathcomp="$pathcomp$d"
|
||||
case "$pathcomp" in
|
||||
-* ) pathcomp=./$pathcomp ;;
|
||||
esac
|
||||
|
||||
if test ! -d "$pathcomp"; then
|
||||
echo "mkdir $pathcomp"
|
||||
|
||||
mkdir "$pathcomp" || lasterr=$?
|
||||
|
||||
if test ! -d "$pathcomp"; then
|
||||
errstatus=$lasterr
|
||||
fi
|
||||
fi
|
||||
|
||||
pathcomp="$pathcomp/"
|
||||
done
|
||||
done
|
||||
|
||||
exit $errstatus
|
||||
|
||||
# mkinstalldirs ends here
|
@ -1,145 +0,0 @@
|
||||
# Makefile for gperf/src
|
||||
|
||||
# Copyright (C) 1989, 1992, 1993, 1998, 2000, 2002, 2006 Free Software Foundation, Inc.
|
||||
# Written by Douglas C. Schmidt <schmidt@ics.uci.edu>
|
||||
# and Bruno Haible <bruno@clisp.org>.
|
||||
#
|
||||
# This file is part of GNU GPERF.
|
||||
#
|
||||
# GNU GPERF 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, or (at your option)
|
||||
# any later version.
|
||||
#
|
||||
# GNU GPERF 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; see the file COPYING.
|
||||
# If not, write to the Free Software Foundation, Inc.,
|
||||
# 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
|
||||
|
||||
#### Start of system configuration section. ####
|
||||
|
||||
# Directories used by "make":
|
||||
srcdir = @srcdir@
|
||||
|
||||
# Directories used by "make install":
|
||||
prefix = @prefix@
|
||||
local_prefix = /usr/local
|
||||
exec_prefix = @exec_prefix@
|
||||
bindir = @bindir@
|
||||
|
||||
# Programs used by "make":
|
||||
# C compiler
|
||||
CC = @CC@
|
||||
CFLAGS = @CFLAGS@
|
||||
CPP = @CPP@
|
||||
# C++ compiler
|
||||
CXX = @CXX@
|
||||
CXXFLAGS = @CXXFLAGS@
|
||||
CXXCPP = @CXXCPP@
|
||||
# Both C and C++ compiler
|
||||
LDFLAGS = @LDFLAGS@
|
||||
OBJEXT = @OBJEXT@
|
||||
EXEEXT = @EXEEXT@
|
||||
# Other
|
||||
MV = mv
|
||||
LN = ln
|
||||
RM = rm -f
|
||||
@SET_MAKE@
|
||||
|
||||
# Programs used by "make install":
|
||||
INSTALL = @INSTALL@
|
||||
INSTALL_PROGRAM = @INSTALL_PROGRAM@
|
||||
INSTALL_DATA = @INSTALL_DATA@
|
||||
MKINSTALLDIRS = $(SHELL) $(srcdir)/../mkinstalldirs
|
||||
|
||||
#### End of system configuration section. ####
|
||||
|
||||
SHELL = /bin/sh
|
||||
|
||||
VPATH = $(srcdir)
|
||||
|
||||
OBJECTS = version.$(OBJEXT) positions.$(OBJEXT) options.$(OBJEXT) keyword.$(OBJEXT) keyword-list.$(OBJEXT) \
|
||||
input.$(OBJEXT) bool-array.$(OBJEXT) hash-table.$(OBJEXT) search.$(OBJEXT) output.$(OBJEXT) main.$(OBJEXT)
|
||||
LIBS = ../lib/libgp.a @GPERF_LIBM@
|
||||
CPPFLAGS = -I. -I$(srcdir)/../lib
|
||||
|
||||
TARGETPROG = gperf$(EXEEXT)
|
||||
|
||||
all : $(TARGETPROG)
|
||||
|
||||
$(TARGETPROG): $(OBJECTS)
|
||||
$(CXX) $(CXXFLAGS) $(LDFLAGS) -o $@ $(OBJECTS) $(LIBS)
|
||||
|
||||
# Don't use implicit rules, since AIX "make" and OSF/1 "make" don't always
|
||||
# expand $< correctly in this context.
|
||||
#
|
||||
#%.o : %.c
|
||||
# $(CC) $(CFLAGS) $(CPPFLAGS) -c $<
|
||||
#
|
||||
#%.o : %.cc
|
||||
# $(CXX) $(CXXFLAGS) $(CPPFLAGS) -c $<
|
||||
|
||||
# Dependencies.
|
||||
CONFIG_H = config.h
|
||||
VERSION_H = version.h
|
||||
POSITIONS_H = positions.h positions.icc
|
||||
OPTIONS_H = options.h options.icc $(POSITIONS_H)
|
||||
KEYWORD_H = keyword.h keyword.icc
|
||||
KEYWORD_LIST_H = keyword-list.h keyword-list.icc $(KEYWORD_H)
|
||||
INPUT_H = input.h $(KEYWORD_LIST_H)
|
||||
BOOL_ARRAY_H = bool-array.h bool-array.icc $(OPTIONS_H)
|
||||
HASH_TABLE_H = hash-table.h $(KEYWORD_H)
|
||||
SEARCH_H = search.h $(KEYWORD_LIST_H) $(POSITIONS_H) $(BOOL_ARRAY_H)
|
||||
OUTPUT_H = output.h $(KEYWORD_LIST_H) $(POSITIONS_H)
|
||||
|
||||
version.$(OBJEXT): version.cc $(VERSION_H)
|
||||
$(CXX) $(CXXFLAGS) $(CPPFLAGS) -c $(srcdir)/version.cc
|
||||
positions.$(OBJEXT): positions.cc $(POSITIONS_H)
|
||||
$(CXX) $(CXXFLAGS) $(CPPFLAGS) -c $(srcdir)/positions.cc
|
||||
options.$(OBJEXT): options.cc $(OPTIONS_H) $(VERSION_H)
|
||||
$(CXX) $(CXXFLAGS) $(CPPFLAGS) -c $(srcdir)/options.cc
|
||||
keyword.$(OBJEXT): keyword.cc $(KEYWORD_H) $(POSITIONS_H)
|
||||
$(CXX) $(CXXFLAGS) $(CPPFLAGS) -c $(srcdir)/keyword.cc
|
||||
keyword-list.$(OBJEXT): keyword-list.cc $(KEYWORD_LIST_H)
|
||||
$(CXX) $(CXXFLAGS) $(CPPFLAGS) -c $(srcdir)/keyword-list.cc
|
||||
input.$(OBJEXT): input.cc $(INPUT_H) $(OPTIONS_H)
|
||||
$(CXX) $(CXXFLAGS) $(CPPFLAGS) -c $(srcdir)/input.cc
|
||||
bool-array.$(OBJEXT): bool-array.cc $(BOOL_ARRAY_H) $(OPTIONS_H)
|
||||
$(CXX) $(CXXFLAGS) $(CPPFLAGS) -c $(srcdir)/bool-array.cc
|
||||
hash-table.$(OBJEXT): hash-table.cc $(HASH_TABLE_H) $(OPTIONS_H)
|
||||
$(CXX) $(CXXFLAGS) $(CPPFLAGS) -c $(srcdir)/hash-table.cc
|
||||
search.$(OBJEXT): search.cc $(SEARCH_H) $(OPTIONS_H) $(HASH_TABLE_H) $(CONFIG_H)
|
||||
$(CXX) $(CXXFLAGS) $(CPPFLAGS) -c $(srcdir)/search.cc
|
||||
output.$(OBJEXT): output.cc $(OUTPUT_H) $(OPTIONS_H) $(VERSION_H)
|
||||
$(CXX) $(CXXFLAGS) $(CPPFLAGS) -c $(srcdir)/output.cc
|
||||
main.$(OBJEXT): main.cc $(OPTIONS_H) $(INPUT_H) $(SEARCH_H) $(OUTPUT_H)
|
||||
$(CXX) $(CXXFLAGS) $(CPPFLAGS) -c $(srcdir)/main.cc
|
||||
|
||||
install : all force
|
||||
$(MKINSTALLDIRS) $(DESTDIR)$(bindir)
|
||||
$(INSTALL_PROGRAM) $(TARGETPROG) $(DESTDIR)$(bindir)/$(TARGETPROG)
|
||||
|
||||
installdirs : force
|
||||
$(MKINSTALLDIRS) $(DESTDIR)$(bindir)
|
||||
|
||||
uninstall : force
|
||||
$(RM) $(DESTDIR)$(bindir)/$(TARGETPROG)
|
||||
|
||||
check : all
|
||||
|
||||
mostlyclean : clean
|
||||
|
||||
clean : force
|
||||
$(RM) *~ *.s *.$(OBJEXT) *.a $(TARGETPROG) core
|
||||
|
||||
distclean : clean
|
||||
$(RM) config.status config.log config.cache Makefile config.h
|
||||
|
||||
maintainer-clean : distclean
|
||||
|
||||
force :
|
@ -1,47 +0,0 @@
|
||||
/* Fast lookup table abstraction implemented as an Iteration Number Array
|
||||
Copyright (C) 1989-1998, 2002 Free Software Foundation, Inc.
|
||||
Written by Douglas C. Schmidt <schmidt@ics.uci.edu>
|
||||
and Bruno Haible <bruno@clisp.org>.
|
||||
|
||||
This file is part of GNU GPERF.
|
||||
|
||||
GNU GPERF 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, or (at your option)
|
||||
any later version.
|
||||
|
||||
GNU GPERF 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; see the file COPYING.
|
||||
If not, write to the Free Software Foundation, Inc.,
|
||||
51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. */
|
||||
|
||||
/* Specification. */
|
||||
#include "bool-array.h"
|
||||
|
||||
#include <stdio.h>
|
||||
#include <string.h>
|
||||
#include "options.h"
|
||||
|
||||
/* Frees this object. */
|
||||
Bool_Array::~Bool_Array ()
|
||||
{
|
||||
/* Print out debugging diagnostics. */
|
||||
if (option[DEBUG])
|
||||
fprintf (stderr, "\ndumping boolean array information\n"
|
||||
"size = %d\niteration number = %d\nend of array dump\n",
|
||||
_size, _iteration_number);
|
||||
delete[] const_cast<unsigned int *>(_storage_array);
|
||||
}
|
||||
|
||||
#ifndef __OPTIMIZE__
|
||||
|
||||
#define INLINE /* not inline */
|
||||
#include "bool-array.icc"
|
||||
#undef INLINE
|
||||
|
||||
#endif /* not defined __OPTIMIZE__ */
|
@ -1,79 +0,0 @@
|
||||
/* This may look like C code, but it is really -*- C++ -*- */
|
||||
|
||||
/* Simple lookup table abstraction implemented as an Iteration Number Array.
|
||||
|
||||
Copyright (C) 1989-1998, 2002 Free Software Foundation, Inc.
|
||||
Written by Douglas C. Schmidt <schmidt@ics.uci.edu>
|
||||
and Bruno Haible <bruno@clisp.org>.
|
||||
|
||||
This file is part of GNU GPERF.
|
||||
|
||||
GNU GPERF 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, or (at your option)
|
||||
any later version.
|
||||
|
||||
GNU GPERF 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; see the file COPYING.
|
||||
If not, write to the Free Software Foundation, Inc.,
|
||||
51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. */
|
||||
|
||||
#ifndef bool_array_h
|
||||
#define bool_array_h 1
|
||||
|
||||
/* A Bool_Array instance is a bit array of fixed size, optimized for being
|
||||
filled sparsely and cleared frequently. For example, when processing
|
||||
tests/chill.gperf, the array will be:
|
||||
- of size 15391,
|
||||
- clear will be called 3509 times,
|
||||
- set_bit will be called 300394 times.
|
||||
With a conventional bit array implementation, clear would be too slow.
|
||||
With a tree/hash based bit array implementation, set_bit would be slower. */
|
||||
|
||||
class Bool_Array
|
||||
{
|
||||
public:
|
||||
/* Initializes the bit array with room for SIZE bits, numbered from
|
||||
0 to SIZE-1. */
|
||||
Bool_Array (unsigned int size);
|
||||
|
||||
/* Frees this object. */
|
||||
~Bool_Array ();
|
||||
|
||||
/* Resets all bits to zero. */
|
||||
void clear ();
|
||||
|
||||
/* Sets the specified bit to true.
|
||||
Returns its previous value (false or true). */
|
||||
bool set_bit (unsigned int index);
|
||||
|
||||
private:
|
||||
/* Size of array. */
|
||||
unsigned int const _size;
|
||||
|
||||
/* Current iteration number. Always nonzero. Starts out as 1, and is
|
||||
incremented each time clear() is called. */
|
||||
unsigned int _iteration_number;
|
||||
|
||||
/* For each index, we store in storage_array[index] the iteration_number at
|
||||
the time set_bit(index) was last called. */
|
||||
unsigned int * const _storage_array;
|
||||
};
|
||||
|
||||
#ifdef __OPTIMIZE__ /* efficiency hack! */
|
||||
|
||||
#include <stdio.h>
|
||||
#include <string.h>
|
||||
#include "options.h"
|
||||
#define INLINE inline
|
||||
#include "bool-array.icc"
|
||||
#undef INLINE
|
||||
|
||||
#endif
|
||||
|
||||
#endif
|
@ -1,78 +0,0 @@
|
||||
/* Inline Functions for bool-array.{h,cc}.
|
||||
|
||||
Copyright (C) 1989-1998, 2002 Free Software Foundation, Inc.
|
||||
Written by Douglas C. Schmidt <schmidt@ics.uci.edu>
|
||||
and Bruno Haible <bruno@clisp.org>.
|
||||
|
||||
This file is part of GNU GPERF.
|
||||
|
||||
GNU GPERF 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, or (at your option)
|
||||
any later version.
|
||||
|
||||
GNU GPERF 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; see the file COPYING.
|
||||
If not, write to the Free Software Foundation, Inc.,
|
||||
51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. */
|
||||
|
||||
// This needs:
|
||||
//#include <stdio.h>
|
||||
//#include <string.h>
|
||||
//#include "options.h"
|
||||
|
||||
/* Initializes the bit array with room for SIZE bits, numbered from
|
||||
0 to SIZE-1. */
|
||||
INLINE
|
||||
Bool_Array::Bool_Array (unsigned int size)
|
||||
: _size (size),
|
||||
_iteration_number (1),
|
||||
_storage_array (new unsigned int [size])
|
||||
{
|
||||
memset (_storage_array, 0, size * sizeof (_storage_array[0]));
|
||||
if (option[DEBUG])
|
||||
fprintf (stderr, "\nbool array size = %d, total bytes = %d\n",
|
||||
_size,
|
||||
static_cast<unsigned int> (_size * sizeof (_storage_array[0])));
|
||||
}
|
||||
|
||||
/* Sets the specified bit to true.
|
||||
Returns its previous value (false or true). */
|
||||
INLINE bool
|
||||
Bool_Array::set_bit (unsigned int index)
|
||||
{
|
||||
if (_storage_array[index] == _iteration_number)
|
||||
/* The bit was set since the last clear() call. */
|
||||
return true;
|
||||
else
|
||||
{
|
||||
/* The last operation on this bit was clear(). Set it now. */
|
||||
_storage_array[index] = _iteration_number;
|
||||
return false;
|
||||
}
|
||||
}
|
||||
|
||||
/* Resets all bits to zero. */
|
||||
INLINE void
|
||||
Bool_Array::clear ()
|
||||
{
|
||||
/* If we wrap around it's time to zero things out again! However, this only
|
||||
occurs once about every 2^32 iterations, so it will not happen more
|
||||
frequently than once per second. */
|
||||
|
||||
if (++_iteration_number == 0)
|
||||
{
|
||||
_iteration_number = 1;
|
||||
memset (_storage_array, 0, _size * sizeof (_storage_array[0]));
|
||||
if (option[DEBUG])
|
||||
{
|
||||
fprintf (stderr, "(re-initialized bool_array)\n");
|
||||
fflush (stderr);
|
||||
}
|
||||
}
|
||||
}
|
@ -1,20 +0,0 @@
|
||||
/* config.h.in. Generated from configure.ac by autoheader. */
|
||||
|
||||
/* Define if the C++ compiler supports stack-allocated variable-size arrays.
|
||||
*/
|
||||
#undef HAVE_DYNAMIC_ARRAY
|
||||
|
||||
/* Define to the address where bug reports for this package should be sent. */
|
||||
#undef PACKAGE_BUGREPORT
|
||||
|
||||
/* Define to the full name of this package. */
|
||||
#undef PACKAGE_NAME
|
||||
|
||||
/* Define to the full name and version of this package. */
|
||||
#undef PACKAGE_STRING
|
||||
|
||||
/* Define to the one symbol short name of this package. */
|
||||
#undef PACKAGE_TARNAME
|
||||
|
||||
/* Define to the version of this package. */
|
||||
#undef PACKAGE_VERSION
|
@ -1,20 +0,0 @@
|
||||
/* config.h.in. Generated from configure.ac by autoheader. */
|
||||
|
||||
/* Define if the C++ compiler supports stack-allocated variable-size arrays.
|
||||
*/
|
||||
#undef HAVE_DYNAMIC_ARRAY
|
||||
|
||||
/* Define to the address where bug reports for this package should be sent. */
|
||||
#undef PACKAGE_BUGREPORT
|
||||
|
||||
/* Define to the full name of this package. */
|
||||
#undef PACKAGE_NAME
|
||||
|
||||
/* Define to the full name and version of this package. */
|
||||
#undef PACKAGE_STRING
|
||||
|
||||
/* Define to the one symbol short name of this package. */
|
||||
#undef PACKAGE_TARNAME
|
||||
|
||||
/* Define to the version of this package. */
|
||||
#undef PACKAGE_VERSION
|
4725
contrib/gperf/src/configure
vendored
4725
contrib/gperf/src/configure
vendored
File diff suppressed because it is too large
Load Diff
@ -1,68 +0,0 @@
|
||||
dnl autoconf configuration for gperf/src
|
||||
|
||||
dnl Copyright (C) 1998, 2000, 2002-2003, 2007 Free Software Foundation, Inc.
|
||||
dnl Written by Douglas C. Schmidt <schmidt@ics.uci.edu>
|
||||
dnl and Bruno Haible <bruno@clisp.org>.
|
||||
dnl
|
||||
dnl This file is part of GNU GPERF.
|
||||
dnl
|
||||
dnl GNU GPERF is free software; you can redistribute it and/or modify
|
||||
dnl it under the terms of the GNU General Public License as published by
|
||||
dnl the Free Software Foundation; either version 2, or (at your option)
|
||||
dnl any later version.
|
||||
dnl
|
||||
dnl GNU GPERF is distributed in the hope that it will be useful,
|
||||
dnl but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
dnl MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
dnl GNU General Public License for more details.
|
||||
dnl
|
||||
dnl You should have received a copy of the GNU General Public License
|
||||
dnl along with this program; see the file COPYING.
|
||||
dnl If not, write to the Free Software Foundation, Inc.,
|
||||
dnl 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
|
||||
|
||||
AC_PREREQ([2.60])
|
||||
AC_INIT(main.cc)
|
||||
AC_CONFIG_HEADER(config.h)
|
||||
AC_PROG_MAKE_SET
|
||||
dnl
|
||||
dnl checks for programs
|
||||
dnl
|
||||
AC_PROG_CC
|
||||
dnl sets variable CC
|
||||
AC_PROG_CPP
|
||||
dnl sets variable CPP
|
||||
AC_PROG_CXX
|
||||
dnl sets variable CXX
|
||||
AC_PROG_CXXCPP
|
||||
dnl sets variable CXXCPP
|
||||
CL_PROG_INSTALL
|
||||
dnl sets variables INSTALL, INSTALL_DATA, INSTALL_PROGRAM
|
||||
dnl
|
||||
dnl checks for compiler characteristics
|
||||
dnl
|
||||
AC_MSG_CHECKING([for stack-allocated variable-size arrays])
|
||||
AC_CACHE_VAL(gp_cv_cxx_dynamic_array, [
|
||||
AC_LANG_SAVE()
|
||||
AC_LANG_CPLUSPLUS()
|
||||
AC_TRY_COMPILE([int func (int n) { int dynamic_array[n]; }], [],
|
||||
gp_cv_cxx_dynamic_array=yes, gp_cv_cxx_dynamic_array=no)
|
||||
AC_LANG_RESTORE()
|
||||
])
|
||||
AC_MSG_RESULT($gp_cv_cxx_dynamic_array)
|
||||
if test $gp_cv_cxx_dynamic_array = yes; then
|
||||
AC_DEFINE(HAVE_DYNAMIC_ARRAY, 1,
|
||||
[Define if the C++ compiler supports stack-allocated variable-size arrays.])
|
||||
fi
|
||||
dnl
|
||||
dnl checks for functions and declarations
|
||||
dnl
|
||||
dnl
|
||||
dnl checks for libraries
|
||||
dnl
|
||||
AC_CHECK_LIB(m, rand, GPERF_LIBM="-lm", GPERF_LIBM="")
|
||||
AC_SUBST(GPERF_LIBM)
|
||||
dnl
|
||||
dnl That's it.
|
||||
dnl
|
||||
AC_OUTPUT(Makefile)
|
@ -1,167 +0,0 @@
|
||||
/* Hash table for checking keyword links. Implemented using double hashing.
|
||||
Copyright (C) 1989-1998, 2000, 2002 Free Software Foundation, Inc.
|
||||
Written by Douglas C. Schmidt <schmidt@ics.uci.edu>
|
||||
and Bruno Haible <bruno@clisp.org>.
|
||||
|
||||
This file is part of GNU GPERF.
|
||||
|
||||
GNU GPERF 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, or (at your option)
|
||||
any later version.
|
||||
|
||||
GNU GPERF 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; see the file COPYING.
|
||||
If not, write to the Free Software Foundation, Inc.,
|
||||
51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. */
|
||||
|
||||
/* Specification. */
|
||||
#include "hash-table.h"
|
||||
|
||||
#include <stdio.h>
|
||||
#include <string.h> /* declares memset(), strcmp() */
|
||||
#include <hash.h>
|
||||
#include "options.h"
|
||||
|
||||
/* We use a hash table with double hashing. This is the simplest kind of
|
||||
hash table, given that we always only insert and never remove entries
|
||||
from the hash table. */
|
||||
|
||||
/* To make double hashing efficient, there need to be enough spare entries. */
|
||||
static const int size_factor = 10;
|
||||
|
||||
/* We make the size of the hash table a power of 2. This allows for two
|
||||
optimizations: It eliminates the modulo instruction, and allows for an
|
||||
easy secondary hashing function. */
|
||||
|
||||
/* Constructor. */
|
||||
Hash_Table::Hash_Table (unsigned int size, bool ignore_length)
|
||||
: _ignore_length (ignore_length),
|
||||
_collisions (0)
|
||||
{
|
||||
/* There need to be enough spare entries. */
|
||||
size = size * size_factor;
|
||||
|
||||
/* Find smallest power of 2 that is >= size. */
|
||||
unsigned int shift = 0;
|
||||
if ((size >> 16) > 0)
|
||||
{
|
||||
size = size >> 16;
|
||||
shift += 16;
|
||||
}
|
||||
if ((size >> 8) > 0)
|
||||
{
|
||||
size = size >> 8;
|
||||
shift += 8;
|
||||
}
|
||||
if ((size >> 4) > 0)
|
||||
{
|
||||
size = size >> 4;
|
||||
shift += 4;
|
||||
}
|
||||
if ((size >> 2) > 0)
|
||||
{
|
||||
size = size >> 2;
|
||||
shift += 2;
|
||||
}
|
||||
if ((size >> 1) > 0)
|
||||
{
|
||||
size = size >> 1;
|
||||
shift += 1;
|
||||
}
|
||||
_log_size = shift;
|
||||
_size = 1 << shift;
|
||||
|
||||
/* Allocate table. */
|
||||
_table = new KeywordExt*[_size];
|
||||
memset (_table, 0, _size * sizeof (*_table));
|
||||
}
|
||||
|
||||
/* Destructor. */
|
||||
Hash_Table::~Hash_Table ()
|
||||
{
|
||||
delete[] _table;
|
||||
}
|
||||
|
||||
/* Print the table's contents. */
|
||||
void
|
||||
Hash_Table::dump () const
|
||||
{
|
||||
int field_width;
|
||||
|
||||
field_width = 0;
|
||||
{
|
||||
for (int i = _size - 1; i >= 0; i--)
|
||||
if (_table[i])
|
||||
if (field_width < _table[i]->_selchars_length)
|
||||
field_width = _table[i]->_selchars_length;
|
||||
}
|
||||
|
||||
fprintf (stderr,
|
||||
"\ndumping the hash table\n"
|
||||
"total available table slots = %d, total bytes = %d, total collisions = %d\n"
|
||||
"location, %*s, keyword\n",
|
||||
_size, _size * static_cast<unsigned int>(sizeof (*_table)),
|
||||
_collisions, field_width, "keysig");
|
||||
|
||||
for (int i = _size - 1; i >= 0; i--)
|
||||
if (_table[i])
|
||||
{
|
||||
fprintf (stderr, "%8d, ", i);
|
||||
if (field_width > _table[i]->_selchars_length)
|
||||
fprintf (stderr, "%*s", field_width - _table[i]->_selchars_length, "");
|
||||
for (int j = 0; j < _table[i]->_selchars_length; j++)
|
||||
putc (_table[i]->_selchars[j], stderr);
|
||||
fprintf (stderr, ", %.*s\n",
|
||||
_table[i]->_allchars_length, _table[i]->_allchars);
|
||||
}
|
||||
|
||||
fprintf (stderr, "\nend dumping hash table\n\n");
|
||||
}
|
||||
|
||||
/* Compares two items. */
|
||||
inline bool
|
||||
Hash_Table::equal (KeywordExt *item1, KeywordExt *item2) const
|
||||
{
|
||||
return item1->_selchars_length == item2->_selchars_length
|
||||
&& memcmp (item1->_selchars, item2->_selchars,
|
||||
item2->_selchars_length * sizeof (unsigned int))
|
||||
== 0
|
||||
&& (_ignore_length
|
||||
|| item1->_allchars_length == item2->_allchars_length);
|
||||
}
|
||||
|
||||
/* Attempts to insert ITEM in the table. If there is already an equal
|
||||
entry in it, returns it. Otherwise inserts ITEM and returns NULL. */
|
||||
KeywordExt *
|
||||
Hash_Table::insert (KeywordExt *item)
|
||||
{
|
||||
unsigned hash_val =
|
||||
hashpjw (reinterpret_cast<const unsigned char *>(item->_selchars),
|
||||
item->_selchars_length * sizeof (unsigned int));
|
||||
unsigned int probe = hash_val & (_size - 1);
|
||||
unsigned int increment =
|
||||
(((hash_val >> _log_size)
|
||||
^ (_ignore_length ? 0 : item->_allchars_length))
|
||||
<< 1) + 1;
|
||||
/* Note that because _size is a power of 2 and increment is odd,
|
||||
we have gcd(increment,_size) = 1, which guarantees that we'll find
|
||||
an empty entry during the loop. */
|
||||
|
||||
while (_table[probe] != NULL)
|
||||
{
|
||||
if (equal (_table[probe], item))
|
||||
return _table[probe];
|
||||
|
||||
_collisions++;
|
||||
probe = (probe + increment) & (_size - 1);
|
||||
}
|
||||
|
||||
_table[probe] = item;
|
||||
return NULL;
|
||||
}
|
@ -1,66 +0,0 @@
|
||||
/* This may look like C code, but it is really -*- C++ -*- */
|
||||
|
||||
/* Hash table used to check for duplicate keyword entries.
|
||||
|
||||
Copyright (C) 1989-1998, 2000, 2002 Free Software Foundation, Inc.
|
||||
Written by Douglas C. Schmidt <schmidt@ics.uci.edu>
|
||||
and Bruno Haible <bruno@clisp.org>.
|
||||
|
||||
This file is part of GNU GPERF.
|
||||
|
||||
GNU GPERF 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, or (at your option)
|
||||
any later version.
|
||||
|
||||
GNU GPERF 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; see the file COPYING.
|
||||
If not, write to the Free Software Foundation, Inc.,
|
||||
51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. */
|
||||
|
||||
#ifndef hash_table_h
|
||||
#define hash_table_h 1
|
||||
|
||||
#include "keyword.h"
|
||||
|
||||
/* Hash table of KeywordExt* entries.
|
||||
Two entries are considered equal if their _selchars are the same and
|
||||
- if !ignore_length - if their _allchars_length are the same. */
|
||||
|
||||
class Hash_Table
|
||||
{
|
||||
public:
|
||||
/* Constructor.
|
||||
size is the maximum number of entries.
|
||||
ignore_length determines a detail in the comparison function. */
|
||||
Hash_Table (unsigned int size, bool ignore_length);
|
||||
/* Destructor. */
|
||||
~Hash_Table ();
|
||||
/* Attempts to insert ITEM in the table. If there is already an equal
|
||||
entry in it, returns it. Otherwise inserts ITEM and returns NULL. */
|
||||
KeywordExt * insert (KeywordExt *item);
|
||||
/* Print the table's contents. */
|
||||
void dump () const;
|
||||
|
||||
private:
|
||||
/* Vector of entries. */
|
||||
KeywordExt ** _table;
|
||||
/* Size of the vector. */
|
||||
unsigned int _size;
|
||||
/* log2(_size). */
|
||||
unsigned int _log_size;
|
||||
/* A detail of the comparison function. */
|
||||
bool const _ignore_length;
|
||||
/* Statistics: Number of collisions so far. */
|
||||
unsigned int _collisions;
|
||||
|
||||
/* Compares two items. */
|
||||
bool equal (KeywordExt *item1, KeywordExt *item2) const;
|
||||
};
|
||||
|
||||
#endif
|
File diff suppressed because it is too large
Load Diff
@ -1,69 +0,0 @@
|
||||
/* This may look like C code, but it is really -*- C++ -*- */
|
||||
|
||||
/* Input routines.
|
||||
|
||||
Copyright (C) 1989-1998, 2002-2003 Free Software Foundation, Inc.
|
||||
Written by Douglas C. Schmidt <schmidt@ics.uci.edu>
|
||||
and Bruno Haible <bruno@clisp.org>.
|
||||
|
||||
This file is part of GNU GPERF.
|
||||
|
||||
GNU GPERF 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, or (at your option)
|
||||
any later version.
|
||||
|
||||
GNU GPERF 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; see the file COPYING.
|
||||
If not, write to the Free Software Foundation, Inc.,
|
||||
51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. */
|
||||
|
||||
#ifndef input_h
|
||||
#define input_h 1
|
||||
|
||||
#include <stdio.h>
|
||||
#include "keyword-list.h"
|
||||
|
||||
class Input
|
||||
{
|
||||
public:
|
||||
Input (FILE *stream, Keyword_Factory *keyword_factory);
|
||||
~Input ();
|
||||
void read_input ();
|
||||
private:
|
||||
/* Input stream. */
|
||||
FILE * _stream;
|
||||
/* Creates the keywords. */
|
||||
Keyword_Factory * const _factory;
|
||||
public:
|
||||
/* Memory block containing the entire input. */
|
||||
char * _input;
|
||||
char * _input_end;
|
||||
/* The C code from the declarations section. */
|
||||
const char * _verbatim_declarations;
|
||||
const char * _verbatim_declarations_end;
|
||||
unsigned int _verbatim_declarations_lineno;
|
||||
/* The C code from the end of the file. */
|
||||
const char * _verbatim_code;
|
||||
const char * _verbatim_code_end;
|
||||
unsigned int _verbatim_code_lineno;
|
||||
/* Declaration of struct type for a keyword and its attributes. */
|
||||
const char * _struct_decl;
|
||||
unsigned int _struct_decl_lineno;
|
||||
/* Return type of the lookup function. */
|
||||
const char * _return_type;
|
||||
/* Shorthand for user-defined struct tag type. */
|
||||
const char * _struct_tag;
|
||||
/* List of all keywords. */
|
||||
Keyword_List * _head;
|
||||
/* Whether the keyword chars would have different values in a different
|
||||
character set. */
|
||||
bool _charset_dependent;
|
||||
};
|
||||
|
||||
#endif
|
@ -1,175 +0,0 @@
|
||||
/* Keyword list.
|
||||
|
||||
Copyright (C) 2002 Free Software Foundation, Inc.
|
||||
Written by Bruno Haible <bruno@clisp.org>.
|
||||
|
||||
This file is part of GNU GPERF.
|
||||
|
||||
GNU GPERF 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, or (at your option)
|
||||
any later version.
|
||||
|
||||
GNU GPERF 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; see the file COPYING.
|
||||
If not, write to the Free Software Foundation, Inc.,
|
||||
51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. */
|
||||
|
||||
/* Specification. */
|
||||
#include "keyword-list.h"
|
||||
|
||||
#include <stddef.h>
|
||||
|
||||
/* -------------------------- Keyword_List class --------------------------- */
|
||||
|
||||
/* Constructor. */
|
||||
Keyword_List::Keyword_List (Keyword *car)
|
||||
: _cdr (NULL), _car (car)
|
||||
{
|
||||
}
|
||||
|
||||
/* ------------------------- KeywordExt_List class ------------------------- */
|
||||
|
||||
/* Constructor. */
|
||||
KeywordExt_List::KeywordExt_List (KeywordExt *car)
|
||||
: Keyword_List (car)
|
||||
{
|
||||
}
|
||||
|
||||
/* ------------------------ Keyword_List functions ------------------------- */
|
||||
|
||||
/* Copies a linear list, sharing the list elements. */
|
||||
Keyword_List *
|
||||
copy_list (Keyword_List *list)
|
||||
{
|
||||
Keyword_List *result;
|
||||
Keyword_List **lastp = &result;
|
||||
while (list != NULL)
|
||||
{
|
||||
Keyword_List *new_cons = new Keyword_List (list->first());
|
||||
*lastp = new_cons;
|
||||
lastp = &new_cons->rest();
|
||||
list = list->rest();
|
||||
}
|
||||
*lastp = NULL;
|
||||
return result;
|
||||
}
|
||||
|
||||
/* Copies a linear list, sharing the list elements. */
|
||||
KeywordExt_List *
|
||||
copy_list (KeywordExt_List *list)
|
||||
{
|
||||
return static_cast<KeywordExt_List *> (copy_list (static_cast<Keyword_List *> (list)));
|
||||
}
|
||||
|
||||
/* Deletes a linear list, keeping the list elements in memory. */
|
||||
void
|
||||
delete_list (Keyword_List *list)
|
||||
{
|
||||
while (list != NULL)
|
||||
{
|
||||
Keyword_List *rest = list->rest();
|
||||
delete list;
|
||||
list = rest;
|
||||
}
|
||||
}
|
||||
|
||||
/* Type of a comparison function. */
|
||||
typedef bool (*Keyword_Comparison) (Keyword *keyword1, Keyword *keyword2);
|
||||
|
||||
/* Merges two sorted lists together to form one sorted list. */
|
||||
static Keyword_List *
|
||||
merge (Keyword_List *list1, Keyword_List *list2, Keyword_Comparison less)
|
||||
{
|
||||
Keyword_List *result;
|
||||
Keyword_List **resultp = &result;
|
||||
for (;;)
|
||||
{
|
||||
if (!list1)
|
||||
{
|
||||
*resultp = list2;
|
||||
break;
|
||||
}
|
||||
if (!list2)
|
||||
{
|
||||
*resultp = list1;
|
||||
break;
|
||||
}
|
||||
if (less (list2->first(), list1->first()))
|
||||
{
|
||||
*resultp = list2;
|
||||
resultp = &list2->rest();
|
||||
/* We would have a stable sorting if the next line would read:
|
||||
list2 = *resultp; */
|
||||
list2 = list1; list1 = *resultp;
|
||||
}
|
||||
else
|
||||
{
|
||||
*resultp = list1;
|
||||
resultp = &list1->rest();
|
||||
list1 = *resultp;
|
||||
}
|
||||
}
|
||||
return result;
|
||||
}
|
||||
|
||||
/* Sorts a linear list, given a comparison function.
|
||||
Note: This uses a variant of mergesort that is *not* a stable sorting
|
||||
algorithm. */
|
||||
Keyword_List *
|
||||
mergesort_list (Keyword_List *list, Keyword_Comparison less)
|
||||
{
|
||||
if (list == NULL || list->rest() == NULL)
|
||||
/* List of length 0 or 1. Nothing to do. */
|
||||
return list;
|
||||
else
|
||||
{
|
||||
/* Determine a list node in the middle. */
|
||||
Keyword_List *middle = list;
|
||||
for (Keyword_List *temp = list->rest();;)
|
||||
{
|
||||
temp = temp->rest();
|
||||
if (temp == NULL)
|
||||
break;
|
||||
temp = temp->rest();
|
||||
middle = middle->rest();
|
||||
if (temp == NULL)
|
||||
break;
|
||||
}
|
||||
|
||||
/* Cut the list into two halves.
|
||||
If the list has n elements, the left half has ceiling(n/2) elements
|
||||
and the right half has floor(n/2) elements. */
|
||||
Keyword_List *right_half = middle->rest();
|
||||
middle->rest() = NULL;
|
||||
|
||||
/* Sort the two halves, then merge them. */
|
||||
return merge (mergesort_list (list, less),
|
||||
mergesort_list (right_half, less),
|
||||
less);
|
||||
}
|
||||
}
|
||||
|
||||
KeywordExt_List *
|
||||
mergesort_list (KeywordExt_List *list,
|
||||
bool (*less) (KeywordExt *keyword1, KeywordExt *keyword2))
|
||||
{
|
||||
return
|
||||
static_cast<KeywordExt_List *>
|
||||
(mergesort_list (static_cast<Keyword_List *> (list),
|
||||
reinterpret_cast<Keyword_Comparison> (less)));
|
||||
}
|
||||
|
||||
|
||||
#ifndef __OPTIMIZE__
|
||||
|
||||
#define INLINE /* not inline */
|
||||
#include "keyword-list.icc"
|
||||
#undef INLINE
|
||||
|
||||
#endif /* not defined __OPTIMIZE__ */
|
@ -1,85 +0,0 @@
|
||||
/* This may look like C code, but it is really -*- C++ -*- */
|
||||
|
||||
/* Keyword list.
|
||||
|
||||
Copyright (C) 2002 Free Software Foundation, Inc.
|
||||
Written by Bruno Haible <bruno@clisp.org>.
|
||||
|
||||
This file is part of GNU GPERF.
|
||||
|
||||
GNU GPERF 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, or (at your option)
|
||||
any later version.
|
||||
|
||||
GNU GPERF 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; see the file COPYING.
|
||||
If not, write to the Free Software Foundation, Inc.,
|
||||
51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. */
|
||||
|
||||
#ifndef keyword_list_h
|
||||
#define keyword_list_h 1
|
||||
|
||||
#include "keyword.h"
|
||||
|
||||
/* List node of a linear list of Keyword. */
|
||||
class Keyword_List
|
||||
{
|
||||
public:
|
||||
/* Constructor. */
|
||||
Keyword_List (Keyword *car);
|
||||
|
||||
/* Access to first element of list. */
|
||||
Keyword * first () const;
|
||||
/* Access to next element of list. */
|
||||
Keyword_List *& rest ();
|
||||
|
||||
protected:
|
||||
Keyword_List * _cdr;
|
||||
Keyword * const _car;
|
||||
};
|
||||
|
||||
/* List node of a linear list of KeywordExt. */
|
||||
class KeywordExt_List : public Keyword_List
|
||||
{
|
||||
public:
|
||||
/* Constructor. */
|
||||
KeywordExt_List (KeywordExt *car);
|
||||
|
||||
/* Access to first element of list. */
|
||||
KeywordExt * first () const;
|
||||
/* Access to next element of list. */
|
||||
KeywordExt_List *& rest ();
|
||||
};
|
||||
|
||||
/* Copies a linear list, sharing the list elements. */
|
||||
extern Keyword_List * copy_list (Keyword_List *list);
|
||||
extern KeywordExt_List * copy_list (KeywordExt_List *list);
|
||||
|
||||
/* Deletes a linear list, keeping the list elements in memory. */
|
||||
extern void delete_list (Keyword_List *list);
|
||||
|
||||
/* Sorts a linear list, given a comparison function.
|
||||
Note: This uses a variant of mergesort that is *not* a stable sorting
|
||||
algorithm. */
|
||||
extern Keyword_List * mergesort_list (Keyword_List *list,
|
||||
bool (*less) (Keyword *keyword1,
|
||||
Keyword *keyword2));
|
||||
extern KeywordExt_List * mergesort_list (KeywordExt_List *list,
|
||||
bool (*less) (KeywordExt *keyword1,
|
||||
KeywordExt *keyword2));
|
||||
|
||||
#ifdef __OPTIMIZE__
|
||||
|
||||
#define INLINE inline
|
||||
#include "keyword-list.icc"
|
||||
#undef INLINE
|
||||
|
||||
#endif
|
||||
|
||||
#endif
|
@ -1,53 +0,0 @@
|
||||
/* Inline Functions for keyword-list.{h,cc}.
|
||||
|
||||
Copyright (C) 2002-2003 Free Software Foundation, Inc.
|
||||
Written by Bruno Haible <bruno@clisp.org>.
|
||||
|
||||
This file is part of GNU GPERF.
|
||||
|
||||
GNU GPERF 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, or (at your option)
|
||||
any later version.
|
||||
|
||||
GNU GPERF 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; see the file COPYING.
|
||||
If not, write to the Free Software Foundation, Inc.,
|
||||
51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. */
|
||||
|
||||
/* -------------------------- Keyword_List class --------------------------- */
|
||||
|
||||
/* Access to first element of list. */
|
||||
INLINE Keyword *
|
||||
Keyword_List::first () const
|
||||
{
|
||||
return _car;
|
||||
}
|
||||
|
||||
/* Access to next element of list. */
|
||||
INLINE Keyword_List *&
|
||||
Keyword_List::rest ()
|
||||
{
|
||||
return _cdr;
|
||||
}
|
||||
|
||||
/* ------------------------- KeywordExt_List class ------------------------- */
|
||||
|
||||
/* Access to first element of list. */
|
||||
INLINE KeywordExt *
|
||||
KeywordExt_List::first () const
|
||||
{
|
||||
return static_cast<KeywordExt*>(_car);
|
||||
}
|
||||
|
||||
/* Access to next element of list. */
|
||||
INLINE KeywordExt_List *&
|
||||
KeywordExt_List::rest ()
|
||||
{
|
||||
return *reinterpret_cast<KeywordExt_List**>(&_cdr);
|
||||
}
|
@ -1,161 +0,0 @@
|
||||
/* Keyword data.
|
||||
Copyright (C) 1989-1998, 2000, 2002 Free Software Foundation, Inc.
|
||||
Written by Douglas C. Schmidt <schmidt@ics.uci.edu>
|
||||
and Bruno Haible <bruno@clisp.org>.
|
||||
|
||||
This file is part of GNU GPERF.
|
||||
|
||||
GNU GPERF 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, or (at your option)
|
||||
any later version.
|
||||
|
||||
GNU GPERF 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; see the file COPYING.
|
||||
If not, write to the Free Software Foundation, Inc.,
|
||||
51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. */
|
||||
|
||||
/* Specification. */
|
||||
#include "keyword.h"
|
||||
|
||||
#include <stddef.h>
|
||||
#include <stdio.h>
|
||||
#include <stdlib.h>
|
||||
#include "positions.h"
|
||||
|
||||
|
||||
/* --------------------------- KeywordExt class --------------------------- */
|
||||
|
||||
/* Sort a small set of 'unsigned int', base[0..len-1], in place. */
|
||||
static inline void sort_char_set (unsigned int *base, int len)
|
||||
{
|
||||
/* Bubble sort is sufficient here. */
|
||||
for (int i = 1; i < len; i++)
|
||||
{
|
||||
int j;
|
||||
unsigned int tmp;
|
||||
|
||||
for (j = i, tmp = base[j]; j > 0 && tmp < base[j - 1]; j--)
|
||||
base[j] = base[j - 1];
|
||||
|
||||
base[j] = tmp;
|
||||
}
|
||||
}
|
||||
|
||||
/* Initializes selchars and selchars_length.
|
||||
|
||||
General idea:
|
||||
The hash function will be computed as
|
||||
asso_values[allchars[key_pos[0]]] +
|
||||
asso_values[allchars[key_pos[1]]] + ...
|
||||
We compute selchars as the multiset
|
||||
{ allchars[key_pos[0]], allchars[key_pos[1]], ... }
|
||||
so that the hash function becomes
|
||||
asso_values[selchars[0]] + asso_values[selchars[1]] + ...
|
||||
Furthermore we sort the selchars array, to ease detection of duplicates
|
||||
later.
|
||||
|
||||
More in detail: The arguments alpha_unify (used for case-insensitive
|
||||
hash functions) and alpha_inc (used to disambiguate permutations)
|
||||
apply slight modifications. The hash function will be computed as
|
||||
sum (j=0,1,...: k = key_pos[j]:
|
||||
asso_values[alpha_unify[allchars[k]+alpha_inc[k]]])
|
||||
+ (allchars_length if !option[NOLENGTH], 0 otherwise).
|
||||
We compute selchars as the multiset
|
||||
{ alpha_unify[allchars[k]+alpha_inc[k]] : j=0,1,..., k = key_pos[j] }
|
||||
so that the hash function becomes
|
||||
asso_values[selchars[0]] + asso_values[selchars[1]] + ...
|
||||
+ (allchars_length if !option[NOLENGTH], 0 otherwise).
|
||||
*/
|
||||
|
||||
unsigned int *
|
||||
KeywordExt::init_selchars_low (const Positions& positions, const unsigned int *alpha_unify, const unsigned int *alpha_inc)
|
||||
{
|
||||
/* Iterate through the list of positions, initializing selchars
|
||||
(via ptr). */
|
||||
PositionIterator iter = positions.iterator(_allchars_length);
|
||||
|
||||
unsigned int *key_set = new unsigned int[iter.remaining()];
|
||||
unsigned int *ptr = key_set;
|
||||
|
||||
for (int i; (i = iter.next ()) != PositionIterator::EOS; )
|
||||
{
|
||||
unsigned int c;
|
||||
if (i == Positions::LASTCHAR)
|
||||
/* Special notation for last KEY position, i.e. '$'. */
|
||||
c = static_cast<unsigned char>(_allchars[_allchars_length - 1]);
|
||||
else if (i < _allchars_length)
|
||||
{
|
||||
/* Within range of KEY length, so we'll keep it. */
|
||||
c = static_cast<unsigned char>(_allchars[i]);
|
||||
if (alpha_inc)
|
||||
c += alpha_inc[i];
|
||||
}
|
||||
else
|
||||
/* Out of range of KEY length, the iterator should not have
|
||||
produced this. */
|
||||
abort ();
|
||||
if (alpha_unify)
|
||||
c = alpha_unify[c];
|
||||
*ptr = c;
|
||||
ptr++;
|
||||
}
|
||||
|
||||
_selchars = key_set;
|
||||
_selchars_length = ptr - key_set;
|
||||
|
||||
return key_set;
|
||||
}
|
||||
|
||||
void
|
||||
KeywordExt::init_selchars_tuple (const Positions& positions, const unsigned int *alpha_unify)
|
||||
{
|
||||
init_selchars_low (positions, alpha_unify, NULL);
|
||||
}
|
||||
|
||||
void
|
||||
KeywordExt::init_selchars_multiset (const Positions& positions, const unsigned int *alpha_unify, const unsigned int *alpha_inc)
|
||||
{
|
||||
unsigned int *selchars =
|
||||
init_selchars_low (positions, alpha_unify, alpha_inc);
|
||||
|
||||
/* Sort the selchars elements alphabetically. */
|
||||
sort_char_set (selchars, _selchars_length);
|
||||
}
|
||||
|
||||
/* Deletes selchars. */
|
||||
void
|
||||
KeywordExt::delete_selchars ()
|
||||
{
|
||||
delete[] const_cast<unsigned int *>(_selchars);
|
||||
}
|
||||
|
||||
|
||||
/* ------------------------- Keyword_Factory class ------------------------- */
|
||||
|
||||
Keyword_Factory::Keyword_Factory ()
|
||||
{
|
||||
}
|
||||
|
||||
Keyword_Factory::~Keyword_Factory ()
|
||||
{
|
||||
}
|
||||
|
||||
|
||||
/* ------------------------------------------------------------------------- */
|
||||
|
||||
char empty_string[1] = "";
|
||||
|
||||
|
||||
#ifndef __OPTIMIZE__
|
||||
|
||||
#define INLINE /* not inline */
|
||||
#include "keyword.icc"
|
||||
#undef INLINE
|
||||
|
||||
#endif /* not defined __OPTIMIZE__ */
|
@ -1,116 +0,0 @@
|
||||
/* This may look like C code, but it is really -*- C++ -*- */
|
||||
|
||||
/* Keyword data.
|
||||
|
||||
Copyright (C) 1989-1998, 2000, 2002 Free Software Foundation, Inc.
|
||||
Written by Douglas C. Schmidt <schmidt@ics.uci.edu>
|
||||
and Bruno Haible <bruno@clisp.org>.
|
||||
|
||||
This file is part of GNU GPERF.
|
||||
|
||||
GNU GPERF 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, or (at your option)
|
||||
any later version.
|
||||
|
||||
GNU GPERF 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; see the file COPYING.
|
||||
If not, write to the Free Software Foundation, Inc.,
|
||||
51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. */
|
||||
|
||||
#ifndef keyword_h
|
||||
#define keyword_h 1
|
||||
|
||||
/* Class defined in "positions.h". */
|
||||
class Positions;
|
||||
|
||||
/* An instance of this class is a keyword, as specified in the input file. */
|
||||
|
||||
struct Keyword
|
||||
{
|
||||
/* Constructor. */
|
||||
Keyword (const char *allchars, int allchars_length,
|
||||
const char *rest);
|
||||
|
||||
/* Data members defined immediately by the input file. */
|
||||
/* The keyword as a string, possibly containing NUL bytes. */
|
||||
const char *const _allchars;
|
||||
int const _allchars_length;
|
||||
/* Additional stuff seen on the same line of the input file. */
|
||||
const char *const _rest;
|
||||
/* Line number of this keyword in the input file. */
|
||||
unsigned int _lineno;
|
||||
};
|
||||
|
||||
/* A keyword, in the context of a given keyposition list. */
|
||||
|
||||
struct KeywordExt : public Keyword
|
||||
{
|
||||
/* Constructor. */
|
||||
KeywordExt (const char *allchars, int allchars_length,
|
||||
const char *rest);
|
||||
|
||||
/* Data members depending on the keyposition list. */
|
||||
/* The selected characters that participate for the hash function,
|
||||
selected according to the keyposition list, as a canonically reordered
|
||||
multiset. */
|
||||
const unsigned int * _selchars;
|
||||
int _selchars_length;
|
||||
/* Chained list of keywords having the same _selchars and
|
||||
- if !option[NOLENGTH] - also the same _allchars_length.
|
||||
Note that these duplicates are not members of the main keyword list. */
|
||||
KeywordExt * _duplicate_link;
|
||||
|
||||
/* Methods depending on the keyposition list. */
|
||||
/* Initializes selchars and selchars_length, without reordering. */
|
||||
void init_selchars_tuple (const Positions& positions, const unsigned int *alpha_unify);
|
||||
/* Initializes selchars and selchars_length, with reordering. */
|
||||
void init_selchars_multiset (const Positions& positions, const unsigned int *alpha_unify, const unsigned int *alpha_inc);
|
||||
/* Deletes selchars. */
|
||||
void delete_selchars ();
|
||||
|
||||
/* Data members used by the algorithm. */
|
||||
int _hash_value; /* Hash value for the keyword. */
|
||||
|
||||
/* Data members used by the output routines. */
|
||||
int _final_index;
|
||||
|
||||
private:
|
||||
unsigned int * init_selchars_low (const Positions& positions, const unsigned int *alpha_unify, const unsigned int *alpha_inc);
|
||||
};
|
||||
|
||||
/* An abstract factory for creating Keyword instances.
|
||||
This factory is used to make the Input class independent of the concrete
|
||||
class KeywordExt. */
|
||||
|
||||
class Keyword_Factory
|
||||
{
|
||||
public:
|
||||
/* Constructor. */
|
||||
Keyword_Factory ();
|
||||
/* Destructor. */
|
||||
virtual ~Keyword_Factory ();
|
||||
|
||||
/* Creates a new Keyword. */
|
||||
virtual /*abstract*/ Keyword *
|
||||
create_keyword (const char *allchars, int allchars_length,
|
||||
const char *rest) = 0;
|
||||
};
|
||||
|
||||
/* A statically allocated empty string. */
|
||||
extern char empty_string[1];
|
||||
|
||||
#ifdef __OPTIMIZE__
|
||||
|
||||
#define INLINE inline
|
||||
#include "keyword.icc"
|
||||
#undef INLINE
|
||||
|
||||
#endif
|
||||
|
||||
#endif
|
@ -1,42 +0,0 @@
|
||||
/* Inline Functions for keyword.{h,cc}.
|
||||
|
||||
Copyright (C) 1989-1998, 2000, 2002 Free Software Foundation, Inc.
|
||||
Written by Douglas C. Schmidt <schmidt@ics.uci.edu>
|
||||
and Bruno Haible <bruno@clisp.org>.
|
||||
|
||||
This file is part of GNU GPERF.
|
||||
|
||||
GNU GPERF 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, or (at your option)
|
||||
any later version.
|
||||
|
||||
GNU GPERF 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; see the file COPYING.
|
||||
If not, write to the Free Software Foundation, Inc.,
|
||||
51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. */
|
||||
|
||||
/* ----------------------------- Keyword class ----------------------------- */
|
||||
|
||||
/* Constructor. */
|
||||
INLINE
|
||||
Keyword::Keyword (const char *allchars, int allchars_length, const char *rest)
|
||||
: _allchars (allchars), _allchars_length (allchars_length), _rest (rest)
|
||||
{
|
||||
}
|
||||
|
||||
|
||||
/* --------------------------- KeywordExt class --------------------------- */
|
||||
|
||||
/* Constructor. */
|
||||
INLINE
|
||||
KeywordExt::KeywordExt (const char *allchars, int allchars_length, const char *rest)
|
||||
: Keyword (allchars, allchars_length, rest),
|
||||
_final_index (-1)
|
||||
{
|
||||
}
|
@ -1,155 +0,0 @@
|
||||
/* Driver program for the hash function generator
|
||||
Copyright (C) 1989-1998, 2000, 2002-2003 Free Software Foundation, Inc.
|
||||
Written by Douglas C. Schmidt <schmidt@ics.uci.edu>
|
||||
and Bruno Haible <bruno@clisp.org>.
|
||||
|
||||
This file is part of GNU GPERF.
|
||||
|
||||
GNU GPERF 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, or (at your option)
|
||||
any later version.
|
||||
|
||||
GNU GPERF 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; see the file COPYING.
|
||||
If not, write to the Free Software Foundation, Inc.,
|
||||
51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. */
|
||||
|
||||
#include <stdio.h>
|
||||
#include <stdlib.h>
|
||||
#include <string.h>
|
||||
#include "options.h"
|
||||
#include "input.h"
|
||||
#include "search.h"
|
||||
#include "output.h"
|
||||
|
||||
|
||||
/* ------------------------------------------------------------------------- */
|
||||
|
||||
/* This Keyword factory produces KeywordExt instances. */
|
||||
|
||||
class KeywordExt_Factory : public Keyword_Factory
|
||||
{
|
||||
virtual Keyword * create_keyword (const char *allchars, int allchars_length,
|
||||
const char *rest);
|
||||
};
|
||||
|
||||
Keyword *
|
||||
KeywordExt_Factory::create_keyword (const char *allchars, int allchars_length, const char *rest)
|
||||
{
|
||||
return new KeywordExt (allchars, allchars_length, rest);
|
||||
}
|
||||
|
||||
/* ------------------------------------------------------------------------- */
|
||||
|
||||
int
|
||||
main (int argc, char *argv[])
|
||||
{
|
||||
int exitcode;
|
||||
|
||||
/* Set the Options. Open the input file and assign stdin to it. */
|
||||
option.parse_options (argc, argv);
|
||||
|
||||
/* Open the input file. */
|
||||
if (option.get_input_file_name ())
|
||||
if (!freopen (option.get_input_file_name (), "r", stdin))
|
||||
{
|
||||
fprintf (stderr, "Cannot open input file '%s'\n",
|
||||
option.get_input_file_name ());
|
||||
exit (1);
|
||||
}
|
||||
|
||||
{
|
||||
/* Initialize the keyword list. */
|
||||
KeywordExt_Factory factory;
|
||||
Input inputter (stdin, &factory);
|
||||
inputter.read_input ();
|
||||
/* We can cast the keyword list to KeywordExt_List* because its list
|
||||
elements were created by KeywordExt_Factory. */
|
||||
KeywordExt_List* list = static_cast<KeywordExt_List*>(inputter._head);
|
||||
|
||||
{
|
||||
/* Search for a good hash function. */
|
||||
Search searcher (list);
|
||||
searcher.optimize ();
|
||||
list = searcher._head;
|
||||
|
||||
/* Open the output file. */
|
||||
if (option.get_output_file_name ())
|
||||
if (strcmp (option.get_output_file_name (), "-") != 0)
|
||||
if (!freopen (option.get_output_file_name (), "w", stdout))
|
||||
{
|
||||
fprintf (stderr, "Cannot open output file '%s'\n",
|
||||
option.get_output_file_name ());
|
||||
exit (1);
|
||||
}
|
||||
|
||||
{
|
||||
/* Output the hash function code. */
|
||||
Output outputter (searcher._head,
|
||||
inputter._struct_decl,
|
||||
inputter._struct_decl_lineno,
|
||||
inputter._return_type,
|
||||
inputter._struct_tag,
|
||||
inputter._verbatim_declarations,
|
||||
inputter._verbatim_declarations_end,
|
||||
inputter._verbatim_declarations_lineno,
|
||||
inputter._verbatim_code,
|
||||
inputter._verbatim_code_end,
|
||||
inputter._verbatim_code_lineno,
|
||||
inputter._charset_dependent,
|
||||
searcher._total_keys,
|
||||
searcher._max_key_len,
|
||||
searcher._min_key_len,
|
||||
searcher._key_positions,
|
||||
searcher._alpha_inc,
|
||||
searcher._total_duplicates,
|
||||
searcher._alpha_size,
|
||||
searcher._asso_values);
|
||||
outputter.output ();
|
||||
|
||||
/* Check for write error on stdout. */
|
||||
exitcode = 0;
|
||||
if (fflush (stdout) || ferror (stdout))
|
||||
{
|
||||
fprintf (stderr, "error while writing output file\n");
|
||||
exitcode = 1;
|
||||
}
|
||||
|
||||
/* Here we run the Output destructor. */
|
||||
}
|
||||
/* Here we run the Search destructor. */
|
||||
}
|
||||
|
||||
/* Also delete the list that was allocated inside Input and reordered
|
||||
inside Search. */
|
||||
for (KeywordExt_List *ptr = list; ptr; ptr = ptr->rest())
|
||||
{
|
||||
KeywordExt *keyword = ptr->first();
|
||||
do
|
||||
{
|
||||
KeywordExt *next_keyword = keyword->_duplicate_link;
|
||||
delete[] const_cast<unsigned int *>(keyword->_selchars);
|
||||
if (keyword->_rest != empty_string)
|
||||
delete[] const_cast<char*>(keyword->_rest);
|
||||
if (!(keyword->_allchars >= inputter._input
|
||||
&& keyword->_allchars < inputter._input_end))
|
||||
delete[] const_cast<char*>(keyword->_allchars);
|
||||
delete keyword;
|
||||
keyword = next_keyword;
|
||||
}
|
||||
while (keyword != NULL);
|
||||
}
|
||||
delete_list (list);
|
||||
|
||||
/* Here we run the Input destructor. */
|
||||
}
|
||||
|
||||
/* Don't use exit() here, it skips the destructors. */
|
||||
return exitcode;
|
||||
}
|
File diff suppressed because it is too large
Load Diff
@ -1,297 +0,0 @@
|
||||
/* This may look like C code, but it is really -*- C++ -*- */
|
||||
|
||||
/* Handles parsing the Options provided to the user.
|
||||
|
||||
Copyright (C) 1989-1998, 2000, 2002-2004 Free Software Foundation, Inc.
|
||||
Written by Douglas C. Schmidt <schmidt@ics.uci.edu>
|
||||
and Bruno Haible <bruno@clisp.org>.
|
||||
|
||||
This file is part of GNU GPERF.
|
||||
|
||||
GNU GPERF 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, or (at your option)
|
||||
any later version.
|
||||
|
||||
GNU GPERF 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; see the file COPYING.
|
||||
If not, write to the Free Software Foundation, Inc.,
|
||||
51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. */
|
||||
|
||||
/* This module provides a uniform interface to the various options available
|
||||
to a user of the gperf hash function generator. */
|
||||
|
||||
#ifndef options_h
|
||||
#define options_h 1
|
||||
|
||||
#include <stdio.h>
|
||||
#include "positions.h"
|
||||
|
||||
/* Enumeration of the possible boolean options. */
|
||||
|
||||
enum Option_Type
|
||||
{
|
||||
/* --- Input file interpretation --- */
|
||||
|
||||
/* Handle user-defined type structured keyword input. */
|
||||
TYPE = 1 << 0,
|
||||
|
||||
/* Ignore case of ASCII characters. */
|
||||
UPPERLOWER = 1 << 1,
|
||||
|
||||
/* --- Language for the output code --- */
|
||||
|
||||
/* Generate K&R C code: no prototypes, no const. */
|
||||
KRC = 1 << 2,
|
||||
|
||||
/* Generate C code: no prototypes, but const (user can #define it away). */
|
||||
C = 1 << 3,
|
||||
|
||||
/* Generate ISO/ANSI C code: prototypes and const, but no class. */
|
||||
ANSIC = 1 << 4,
|
||||
|
||||
/* Generate C++ code: prototypes, const, class, inline, enum. */
|
||||
CPLUSPLUS = 1 << 5,
|
||||
|
||||
/* --- Details in the output code --- */
|
||||
|
||||
/* Assume 7-bit, not 8-bit, characters. */
|
||||
SEVENBIT = 1 << 6,
|
||||
|
||||
/* Generate a length table for string comparison. */
|
||||
LENTABLE = 1 << 7,
|
||||
|
||||
/* Generate strncmp rather than strcmp. */
|
||||
COMP = 1 << 8,
|
||||
|
||||
/* Make the generated tables readonly (const). */
|
||||
CONST = 1 << 9,
|
||||
|
||||
/* Use enum for constants. */
|
||||
ENUM = 1 << 10,
|
||||
|
||||
/* Generate #include statements. */
|
||||
INCLUDE = 1 << 11,
|
||||
|
||||
/* Make the keyword table a global variable. */
|
||||
GLOBAL = 1 << 12,
|
||||
|
||||
/* Use NULL strings instead of empty strings for empty table entries. */
|
||||
NULLSTRINGS = 1 << 13,
|
||||
|
||||
/* Optimize for position-independent code. */
|
||||
SHAREDLIB = 1 << 14,
|
||||
|
||||
/* Generate switch output to save space. */
|
||||
SWITCH = 1 << 15,
|
||||
|
||||
/* Don't include user-defined type definition in output -- it's already
|
||||
defined elsewhere. */
|
||||
NOTYPE = 1 << 16,
|
||||
|
||||
/* --- Algorithm employed by gperf --- */
|
||||
|
||||
/* Use the given key positions. */
|
||||
POSITIONS = 1 << 17,
|
||||
|
||||
/* Handle duplicate hash values for keywords. */
|
||||
DUP = 1 << 18,
|
||||
|
||||
/* Don't include keyword length in hash computations. */
|
||||
NOLENGTH = 1 << 19,
|
||||
|
||||
/* Randomly initialize the associated values table. */
|
||||
RANDOM = 1 << 20,
|
||||
|
||||
/* --- Informative output --- */
|
||||
|
||||
/* Enable debugging (prints diagnostics to stderr). */
|
||||
DEBUG = 1 << 21
|
||||
};
|
||||
|
||||
/* Class manager for gperf program Options. */
|
||||
|
||||
class Options
|
||||
{
|
||||
public:
|
||||
/* Constructor. */
|
||||
Options ();
|
||||
|
||||
/* Destructor. */
|
||||
~Options ();
|
||||
|
||||
/* Parses the options given in the command-line arguments. */
|
||||
void parse_options (int argc, char *argv[]);
|
||||
|
||||
/* Prints the given options. */
|
||||
void print_options () const;
|
||||
|
||||
/* Accessors. */
|
||||
|
||||
/* Tests a given boolean option. Returns true if set, false otherwise. */
|
||||
bool operator[] (Option_Type option) const;
|
||||
/* Sets a given boolean option. */
|
||||
void set (Option_Type option);
|
||||
|
||||
/* Returns the input file name. */
|
||||
const char * get_input_file_name () const;
|
||||
|
||||
/* Returns the output file name. */
|
||||
const char * get_output_file_name () const;
|
||||
|
||||
/* Sets the output language, if not already set. */
|
||||
void set_language (const char *language);
|
||||
|
||||
/* Returns the jump value. */
|
||||
int get_jump () const;
|
||||
|
||||
/* Returns the initial associated character value. */
|
||||
int get_initial_asso_value () const;
|
||||
|
||||
/* Returns the number of iterations for finding good asso_values. */
|
||||
int get_asso_iterations () const;
|
||||
|
||||
/* Returns the total number of switch statements to generate. */
|
||||
int get_total_switches () const;
|
||||
/* Sets the total number of switch statements, if not already set. */
|
||||
void set_total_switches (int total_switches);
|
||||
|
||||
/* Returns the factor by which to multiply the generated table's size. */
|
||||
float get_size_multiple () const;
|
||||
|
||||
/* Returns the generated function name. */
|
||||
const char * get_function_name () const;
|
||||
/* Sets the generated function name, if not already set. */
|
||||
void set_function_name (const char *name);
|
||||
|
||||
/* Returns the keyword key name. */
|
||||
const char * get_slot_name () const;
|
||||
/* Sets the keyword key name, if not already set. */
|
||||
void set_slot_name (const char *name);
|
||||
|
||||
/* Returns the struct initializer suffix. */
|
||||
const char * get_initializer_suffix () const;
|
||||
/* Sets the struct initializer suffix, if not already set. */
|
||||
void set_initializer_suffix (const char *initializers);
|
||||
|
||||
/* Returns the generated class name. */
|
||||
const char * get_class_name () const;
|
||||
/* Sets the generated class name, if not already set. */
|
||||
void set_class_name (const char *name);
|
||||
|
||||
/* Returns the hash function name. */
|
||||
const char * get_hash_name () const;
|
||||
/* Sets the hash function name, if not already set. */
|
||||
void set_hash_name (const char *name);
|
||||
|
||||
/* Returns the hash table array name. */
|
||||
const char * get_wordlist_name () const;
|
||||
/* Sets the hash table array name, if not already set. */
|
||||
void set_wordlist_name (const char *name);
|
||||
|
||||
/* Returns the length table array name. */
|
||||
const char * get_lengthtable_name () const;
|
||||
/* Sets the length table array name, if not already set. */
|
||||
void set_lengthtable_name (const char *name);
|
||||
|
||||
/* Returns the string pool name. */
|
||||
const char * get_stringpool_name () const;
|
||||
/* Sets the string pool name, if not already set. */
|
||||
void set_stringpool_name (const char *name);
|
||||
|
||||
/* Returns the string used to delimit keywords from other attributes. */
|
||||
const char * get_delimiters () const;
|
||||
/* Sets the delimiters string, if not already set. */
|
||||
void set_delimiters (const char *delimiters);
|
||||
|
||||
/* Returns key positions. */
|
||||
const Positions& get_key_positions () const;
|
||||
|
||||
private:
|
||||
/* Prints program usage to given stream. */
|
||||
static void short_usage (FILE * stream);
|
||||
|
||||
/* Prints program usage to given stream. */
|
||||
static void long_usage (FILE * stream);
|
||||
|
||||
/* Records count of command-line arguments. */
|
||||
int _argument_count;
|
||||
|
||||
/* Stores a pointer to command-line argument vector. */
|
||||
char ** _argument_vector;
|
||||
|
||||
/* Holds the boolean options. */
|
||||
int _option_word;
|
||||
|
||||
/* Name of input file. */
|
||||
char * _input_file_name;
|
||||
|
||||
/* Name of output file. */
|
||||
char * _output_file_name;
|
||||
|
||||
/* The output language. */
|
||||
const char * _language;
|
||||
|
||||
/* Jump length when trying alternative values. */
|
||||
int _jump;
|
||||
|
||||
/* Initial value for asso_values table. */
|
||||
int _initial_asso_value;
|
||||
|
||||
/* Number of attempts at finding good asso_values. */
|
||||
int _asso_iterations;
|
||||
|
||||
/* Number of switch statements to generate. */
|
||||
int _total_switches;
|
||||
|
||||
/* Factor by which to multiply the generated table's size. */
|
||||
float _size_multiple;
|
||||
|
||||
/* Names used for generated lookup function. */
|
||||
const char * _function_name;
|
||||
|
||||
/* Name used for keyword key. */
|
||||
const char * _slot_name;
|
||||
|
||||
/* Suffix for empty struct initializers. */
|
||||
const char * _initializer_suffix;
|
||||
|
||||
/* Name used for generated C++ class. */
|
||||
const char * _class_name;
|
||||
|
||||
/* Name used for generated hash function. */
|
||||
const char * _hash_name;
|
||||
|
||||
/* Name used for hash table array. */
|
||||
const char * _wordlist_name;
|
||||
|
||||
/* Name used for length table array. */
|
||||
const char * _lengthtable_name;
|
||||
|
||||
/* Name used for the string pool. */
|
||||
const char * _stringpool_name;
|
||||
|
||||
/* Separates keywords from other attributes. */
|
||||
const char * _delimiters;
|
||||
|
||||
/* Contains user-specified key choices. */
|
||||
Positions _key_positions;
|
||||
};
|
||||
|
||||
/* Global option coordinator for the entire program. */
|
||||
extern Options option;
|
||||
|
||||
#ifdef __OPTIMIZE__
|
||||
|
||||
#define INLINE inline
|
||||
#include "options.icc"
|
||||
#undef INLINE
|
||||
|
||||
#endif
|
||||
|
||||
#endif
|
@ -1,157 +0,0 @@
|
||||
/* Inline Functions for options.{h,cc}.
|
||||
|
||||
Copyright (C) 1989-1998, 2000, 2002-2004 Free Software Foundation, Inc.
|
||||
Written by Douglas C. Schmidt <schmidt@ics.uci.edu>
|
||||
and Bruno Haible <bruno@clisp.org>.
|
||||
|
||||
This file is part of GNU GPERF.
|
||||
|
||||
GNU GPERF 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, or (at your option)
|
||||
any later version.
|
||||
|
||||
GNU GPERF 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; see the file COPYING.
|
||||
If not, write to the Free Software Foundation, Inc.,
|
||||
51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. */
|
||||
|
||||
/* ----------------------------- Class Options ----------------------------- */
|
||||
|
||||
/* Tests a given boolean option. Returns true if set, false otherwise. */
|
||||
INLINE bool
|
||||
Options::operator[] (Option_Type option) const
|
||||
{
|
||||
return _option_word & option;
|
||||
}
|
||||
|
||||
/* Sets a given boolean option. */
|
||||
INLINE void
|
||||
Options::set (Option_Type option)
|
||||
{
|
||||
_option_word |= option;
|
||||
}
|
||||
|
||||
/* Returns the input file name. */
|
||||
INLINE const char *
|
||||
Options::get_input_file_name () const
|
||||
{
|
||||
return _input_file_name;
|
||||
}
|
||||
|
||||
/* Returns the output file name. */
|
||||
INLINE const char *
|
||||
Options::get_output_file_name () const
|
||||
{
|
||||
return _output_file_name;
|
||||
}
|
||||
|
||||
/* Returns the jump value. */
|
||||
INLINE int
|
||||
Options::get_jump () const
|
||||
{
|
||||
return _jump;
|
||||
}
|
||||
|
||||
/* Returns the initial associated character value. */
|
||||
INLINE int
|
||||
Options::get_initial_asso_value () const
|
||||
{
|
||||
return _initial_asso_value;
|
||||
}
|
||||
|
||||
/* Returns the number of iterations for finding finding good asso_values. */
|
||||
INLINE int
|
||||
Options::get_asso_iterations () const
|
||||
{
|
||||
return _asso_iterations;
|
||||
}
|
||||
|
||||
/* Returns the total number of switch statements to generate. */
|
||||
INLINE int
|
||||
Options::get_total_switches () const
|
||||
{
|
||||
return _total_switches;
|
||||
}
|
||||
|
||||
/* Returns the factor by which to multiply the generated table's size. */
|
||||
INLINE float
|
||||
Options::get_size_multiple () const
|
||||
{
|
||||
return _size_multiple;
|
||||
}
|
||||
|
||||
/* Returns the generated function name. */
|
||||
INLINE const char *
|
||||
Options::get_function_name () const
|
||||
{
|
||||
return _function_name;
|
||||
}
|
||||
|
||||
/* Returns the keyword key name. */
|
||||
INLINE const char *
|
||||
Options::get_slot_name () const
|
||||
{
|
||||
return _slot_name;
|
||||
}
|
||||
|
||||
/* Returns the struct initializer suffix. */
|
||||
INLINE const char *
|
||||
Options::get_initializer_suffix () const
|
||||
{
|
||||
return _initializer_suffix;
|
||||
}
|
||||
|
||||
/* Returns the generated class name. */
|
||||
INLINE const char *
|
||||
Options::get_class_name () const
|
||||
{
|
||||
return _class_name;
|
||||
}
|
||||
|
||||
/* Returns the hash function name. */
|
||||
INLINE const char *
|
||||
Options::get_hash_name () const
|
||||
{
|
||||
return _hash_name;
|
||||
}
|
||||
|
||||
/* Returns the hash table array name. */
|
||||
INLINE const char *
|
||||
Options::get_wordlist_name () const
|
||||
{
|
||||
return _wordlist_name;
|
||||
}
|
||||
|
||||
/* Returns the length table array name. */
|
||||
INLINE const char *
|
||||
Options::get_lengthtable_name () const
|
||||
{
|
||||
return _lengthtable_name;
|
||||
}
|
||||
|
||||
/* Returns the string pool name. */
|
||||
INLINE const char *
|
||||
Options::get_stringpool_name () const
|
||||
{
|
||||
return _stringpool_name;
|
||||
}
|
||||
|
||||
/* Returns the string used to delimit keywords from other attributes. */
|
||||
INLINE const char *
|
||||
Options::get_delimiters () const
|
||||
{
|
||||
return _delimiters;
|
||||
}
|
||||
|
||||
/* Returns key positions. */
|
||||
INLINE const Positions&
|
||||
Options::get_key_positions () const
|
||||
{
|
||||
return _key_positions;
|
||||
}
|
File diff suppressed because it is too large
Load Diff
@ -1,154 +0,0 @@
|
||||
/* This may look like C code, but it is really -*- C++ -*- */
|
||||
|
||||
/* Output routines.
|
||||
|
||||
Copyright (C) 1989-1998, 2000, 2002-2003 Free Software Foundation, Inc.
|
||||
Written by Douglas C. Schmidt <schmidt@ics.uci.edu>
|
||||
and Bruno Haible <bruno@clisp.org>.
|
||||
|
||||
This file is part of GNU GPERF.
|
||||
|
||||
GNU GPERF 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, or (at your option)
|
||||
any later version.
|
||||
|
||||
GNU GPERF 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; see the file COPYING.
|
||||
If not, write to the Free Software Foundation, Inc.,
|
||||
51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. */
|
||||
|
||||
#ifndef output_h
|
||||
#define output_h 1
|
||||
|
||||
#include "keyword-list.h"
|
||||
#include "positions.h"
|
||||
|
||||
/* OSF/1 cxx needs these forward declarations. */
|
||||
struct Output_Constants;
|
||||
struct Output_Compare;
|
||||
|
||||
class Output
|
||||
{
|
||||
public:
|
||||
/* Constructor. */
|
||||
Output (KeywordExt_List *head,
|
||||
const char *struct_decl,
|
||||
unsigned int struct_decl_lineno,
|
||||
const char *return_type,
|
||||
const char *struct_tag,
|
||||
const char *verbatim_declarations,
|
||||
const char *verbatim_declarations_end,
|
||||
unsigned int verbatim_declarations_lineno,
|
||||
const char *verbatim_code,
|
||||
const char *verbatim_code_end,
|
||||
unsigned int verbatim_code_lineno,
|
||||
bool charset_dependent,
|
||||
int total_keys,
|
||||
int max_key_len, int min_key_len,
|
||||
const Positions& positions,
|
||||
const unsigned int *alpha_inc,
|
||||
int total_duplicates,
|
||||
unsigned int alpha_size,
|
||||
const int *asso_values);
|
||||
|
||||
/* Generates the hash function and the key word recognizer function. */
|
||||
void output ();
|
||||
|
||||
private:
|
||||
|
||||
/* Computes the minimum and maximum hash values, and stores them
|
||||
in _min_hash_value and _max_hash_value. */
|
||||
void compute_min_max ();
|
||||
|
||||
/* Returns the number of different hash values. */
|
||||
int num_hash_values () const;
|
||||
|
||||
/* Outputs the maximum and minimum hash values etc. */
|
||||
void output_constants (struct Output_Constants&) const;
|
||||
|
||||
/* Generates a C expression for an asso_values[] reference. */
|
||||
void output_asso_values_ref (int pos) const;
|
||||
|
||||
/* Generates C code for the hash function that returns the
|
||||
proper encoding for each keyword. */
|
||||
void output_hash_function () const;
|
||||
|
||||
/* Prints out a table of keyword lengths, for use with the
|
||||
comparison code in generated function 'in_word_set'. */
|
||||
void output_keylength_table () const;
|
||||
|
||||
/* Prints out the string pool, containing the strings of the keyword table.
|
||||
*/
|
||||
void output_string_pool () const;
|
||||
|
||||
/* Prints out the array containing the keywords for the hash function. */
|
||||
void output_keyword_table () const;
|
||||
|
||||
/* Generates the large, sparse table that maps hash values into
|
||||
the smaller, contiguous range of the keyword table. */
|
||||
void output_lookup_array () const;
|
||||
|
||||
/* Generate all pools needed for the lookup function. */
|
||||
void output_lookup_pools () const;
|
||||
|
||||
/* Generate all the tables needed for the lookup function. */
|
||||
void output_lookup_tables () const;
|
||||
|
||||
/* Generates C code to perform the keyword lookup. */
|
||||
void output_lookup_function_body (const struct Output_Compare&) const;
|
||||
|
||||
/* Generates C code for the lookup function. */
|
||||
void output_lookup_function () const;
|
||||
|
||||
/* Linked list of keywords. */
|
||||
KeywordExt_List * _head;
|
||||
|
||||
/* Declaration of struct type for a keyword and its attributes. */
|
||||
const char * const _struct_decl;
|
||||
unsigned int const _struct_decl_lineno;
|
||||
/* Pointer to return type for lookup function. */
|
||||
const char * _return_type;
|
||||
/* Shorthand for user-defined struct tag type. */
|
||||
const char * _struct_tag;
|
||||
/* Element type of keyword array. */
|
||||
const char * _wordlist_eltype;
|
||||
/* The C code from the declarations section. */
|
||||
const char * const _verbatim_declarations;
|
||||
const char * const _verbatim_declarations_end;
|
||||
unsigned int const _verbatim_declarations_lineno;
|
||||
/* The C code from the end of the file. */
|
||||
const char * const _verbatim_code;
|
||||
const char * const _verbatim_code_end;
|
||||
unsigned int const _verbatim_code_lineno;
|
||||
/* Whether the keyword chars would have different values in a different
|
||||
character set. */
|
||||
bool _charset_dependent;
|
||||
/* Total number of keys, counting duplicates. */
|
||||
int const _total_keys;
|
||||
/* Maximum length of the longest keyword. */
|
||||
int const _max_key_len;
|
||||
/* Minimum length of the shortest keyword. */
|
||||
int const _min_key_len;
|
||||
/* Key positions. */
|
||||
Positions const _key_positions;
|
||||
/* Adjustments to add to bytes add specific key positions. */
|
||||
const unsigned int * const _alpha_inc;
|
||||
/* Total number of duplicate hash values. */
|
||||
int const _total_duplicates;
|
||||
/* Minimum hash value for all keywords. */
|
||||
int _min_hash_value;
|
||||
/* Maximum hash value for all keywords. */
|
||||
int _max_hash_value;
|
||||
/* Size of alphabet. */
|
||||
unsigned int const _alpha_size;
|
||||
/* Value associated with each character. */
|
||||
const int * const _asso_values;
|
||||
};
|
||||
|
||||
#endif
|
@ -1,177 +0,0 @@
|
||||
/* A set of byte positions.
|
||||
Copyright (C) 1989-1998, 2000, 2002 Free Software Foundation, Inc.
|
||||
Written by Douglas C. Schmidt <schmidt@ics.uci.edu>
|
||||
and Bruno Haible <bruno@clisp.org>.
|
||||
|
||||
This file is part of GNU GPERF.
|
||||
|
||||
GNU GPERF 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, or (at your option)
|
||||
any later version.
|
||||
|
||||
GNU GPERF 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; see the file COPYING.
|
||||
If not, write to the Free Software Foundation, Inc.,
|
||||
51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. */
|
||||
|
||||
/* Specification. */
|
||||
#include "positions.h"
|
||||
|
||||
#include <stdio.h>
|
||||
#include <stdlib.h> /* declares exit() */
|
||||
#include <string.h>
|
||||
|
||||
/* ---------------------------- Class Positions ---------------------------- */
|
||||
|
||||
/* Set operations. Assumes the array is in reverse order. */
|
||||
|
||||
bool
|
||||
Positions::contains (int pos) const
|
||||
{
|
||||
unsigned int count = _size;
|
||||
const int *p = _positions + _size - 1;
|
||||
|
||||
for (; count > 0; p--, count--)
|
||||
{
|
||||
if (*p == pos)
|
||||
return true;
|
||||
if (*p > pos)
|
||||
break;
|
||||
}
|
||||
return false;
|
||||
}
|
||||
|
||||
void
|
||||
Positions::add (int pos)
|
||||
{
|
||||
set_useall (false);
|
||||
|
||||
unsigned int count = _size;
|
||||
|
||||
if (count == MAX_SIZE)
|
||||
{
|
||||
fprintf (stderr, "Positions::add internal error: overflow\n");
|
||||
exit (1);
|
||||
}
|
||||
|
||||
int *p = _positions + _size - 1;
|
||||
|
||||
for (; count > 0; p--, count--)
|
||||
{
|
||||
if (*p == pos)
|
||||
{
|
||||
fprintf (stderr, "Positions::add internal error: duplicate\n");
|
||||
exit (1);
|
||||
}
|
||||
if (*p > pos)
|
||||
break;
|
||||
p[1] = p[0];
|
||||
}
|
||||
p[1] = pos;
|
||||
_size++;
|
||||
}
|
||||
|
||||
void
|
||||
Positions::remove (int pos)
|
||||
{
|
||||
set_useall (false);
|
||||
|
||||
unsigned int count = _size;
|
||||
if (count > 0)
|
||||
{
|
||||
int *p = _positions + _size - 1;
|
||||
|
||||
if (*p == pos)
|
||||
{
|
||||
_size--;
|
||||
return;
|
||||
}
|
||||
if (*p < pos)
|
||||
{
|
||||
int prev = *p;
|
||||
|
||||
for (;;)
|
||||
{
|
||||
p--;
|
||||
count--;
|
||||
if (count == 0)
|
||||
break;
|
||||
if (*p == pos)
|
||||
{
|
||||
*p = prev;
|
||||
_size--;
|
||||
return;
|
||||
}
|
||||
if (*p > pos)
|
||||
break;
|
||||
int curr = *p;
|
||||
*p = prev;
|
||||
prev = curr;
|
||||
}
|
||||
}
|
||||
}
|
||||
fprintf (stderr, "Positions::remove internal error: not found\n");
|
||||
exit (1);
|
||||
}
|
||||
|
||||
/* Output in external syntax. */
|
||||
void
|
||||
Positions::print () const
|
||||
{
|
||||
if (_useall)
|
||||
printf ("*");
|
||||
else
|
||||
{
|
||||
bool first = true;
|
||||
bool seen_LASTCHAR = false;
|
||||
unsigned int count = _size;
|
||||
const int *p = _positions + _size - 1;
|
||||
|
||||
for (; count > 0; p--)
|
||||
{
|
||||
count--;
|
||||
if (*p == LASTCHAR)
|
||||
seen_LASTCHAR = true;
|
||||
else
|
||||
{
|
||||
if (!first)
|
||||
printf (",");
|
||||
printf ("%d", *p + 1);
|
||||
if (count > 0 && p[-1] == *p + 1)
|
||||
{
|
||||
printf ("-");
|
||||
do
|
||||
{
|
||||
p--;
|
||||
count--;
|
||||
}
|
||||
while (count > 0 && p[-1] == *p + 1);
|
||||
printf ("%d", *p + 1);
|
||||
}
|
||||
first = false;
|
||||
}
|
||||
}
|
||||
if (seen_LASTCHAR)
|
||||
{
|
||||
if (!first)
|
||||
printf (",");
|
||||
printf ("$");
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
/* ------------------------------------------------------------------------- */
|
||||
|
||||
#ifndef __OPTIMIZE__
|
||||
|
||||
#define INLINE /* not inline */
|
||||
#include "positions.icc"
|
||||
#undef INLINE
|
||||
|
||||
#endif /* not defined __OPTIMIZE__ */
|
@ -1,175 +0,0 @@
|
||||
/* This may look like C code, but it is really -*- C++ -*- */
|
||||
|
||||
/* A set of byte positions.
|
||||
|
||||
Copyright (C) 1989-1998, 2000, 2002, 2005 Free Software Foundation, Inc.
|
||||
Written by Douglas C. Schmidt <schmidt@ics.uci.edu>
|
||||
and Bruno Haible <bruno@clisp.org>.
|
||||
|
||||
This file is part of GNU GPERF.
|
||||
|
||||
GNU GPERF 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, or (at your option)
|
||||
any later version.
|
||||
|
||||
GNU GPERF 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; see the file COPYING.
|
||||
If not, write to the Free Software Foundation, Inc.,
|
||||
51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. */
|
||||
|
||||
#ifndef positions_h
|
||||
#define positions_h 1
|
||||
|
||||
/* Classes defined below. */
|
||||
class PositionIterator;
|
||||
class PositionReverseIterator;
|
||||
|
||||
/* This class denotes a set of byte positions, used to access a keyword. */
|
||||
|
||||
class Positions
|
||||
{
|
||||
friend class PositionIterator;
|
||||
friend class PositionReverseIterator;
|
||||
public:
|
||||
/* Denotes the last char of a keyword, depending on the keyword's length. */
|
||||
enum { LASTCHAR = -1 };
|
||||
|
||||
/* Maximum key position specifiable by the user, 1-based.
|
||||
Note that MAX_KEY_POS-1 must fit into the element type of _positions[],
|
||||
below. */
|
||||
enum { MAX_KEY_POS = 255 };
|
||||
|
||||
/* Maximum possible size. Since duplicates are eliminated and the possible
|
||||
0-based positions are -1 .. MAX_KEY_POS-1, this is: */
|
||||
enum { MAX_SIZE = MAX_KEY_POS + 1 };
|
||||
|
||||
/* Constructors. */
|
||||
Positions ();
|
||||
Positions (int pos1);
|
||||
Positions (int pos1, int pos2);
|
||||
|
||||
/* Copy constructor. */
|
||||
Positions (const Positions& src);
|
||||
|
||||
/* Assignment operator. */
|
||||
Positions& operator= (const Positions& src);
|
||||
|
||||
/* Accessors. */
|
||||
bool is_useall () const;
|
||||
int operator[] (unsigned int index) const;
|
||||
unsigned int get_size () const;
|
||||
|
||||
/* Write access. */
|
||||
void set_useall (bool useall);
|
||||
int * pointer ();
|
||||
void set_size (unsigned int size);
|
||||
|
||||
/* Sorts the array in reverse order.
|
||||
Returns true if there are no duplicates, false otherwise. */
|
||||
bool sort ();
|
||||
|
||||
/* Creates an iterator, returning the positions in descending order. */
|
||||
PositionIterator iterator () const;
|
||||
/* Creates an iterator, returning the positions in descending order,
|
||||
that apply to strings of length <= maxlen. */
|
||||
PositionIterator iterator (int maxlen) const;
|
||||
/* Creates an iterator, returning the positions in ascending order. */
|
||||
PositionReverseIterator reviterator () const;
|
||||
/* Creates an iterator, returning the positions in ascending order,
|
||||
that apply to strings of length <= maxlen. */
|
||||
PositionReverseIterator reviterator (int maxlen) const;
|
||||
|
||||
/* Set operations. Assumes the array is in reverse order. */
|
||||
bool contains (int pos) const;
|
||||
void add (int pos);
|
||||
void remove (int pos);
|
||||
|
||||
/* Output in external syntax. */
|
||||
void print () const;
|
||||
|
||||
private:
|
||||
/* The special case denoted by '*'. */
|
||||
bool _useall;
|
||||
/* Number of positions. */
|
||||
unsigned int _size;
|
||||
/* Array of positions. 0 for the first char, 1 for the second char etc.,
|
||||
LASTCHAR for the last char. */
|
||||
int _positions[MAX_SIZE];
|
||||
};
|
||||
|
||||
/* This class denotes an iterator through a set of byte positions. */
|
||||
|
||||
class PositionIterator
|
||||
{
|
||||
friend class Positions;
|
||||
public:
|
||||
/* Copy constructor. */
|
||||
PositionIterator (const PositionIterator& src);
|
||||
|
||||
/* End of iteration marker. */
|
||||
enum { EOS = -2 };
|
||||
|
||||
/* Retrieves the next position, or EOS past the end. */
|
||||
int next ();
|
||||
|
||||
/* Returns the number of remaining positions, i.e. how often next() will
|
||||
return a value != EOS. */
|
||||
unsigned int remaining () const;
|
||||
|
||||
private:
|
||||
/* Initializes an iterator through POSITIONS. */
|
||||
PositionIterator (Positions const& positions);
|
||||
/* Initializes an iterator through POSITIONS, ignoring positions >= maxlen. */
|
||||
PositionIterator (Positions const& positions, int maxlen);
|
||||
|
||||
const Positions& _set;
|
||||
unsigned int _index;
|
||||
};
|
||||
|
||||
/* This class denotes an iterator in reverse direction through a set of
|
||||
byte positions. */
|
||||
|
||||
class PositionReverseIterator
|
||||
{
|
||||
friend class Positions;
|
||||
public:
|
||||
/* Copy constructor. */
|
||||
PositionReverseIterator (const PositionReverseIterator& src);
|
||||
|
||||
/* End of iteration marker. */
|
||||
enum { EOS = -2 };
|
||||
|
||||
/* Retrieves the next position, or EOS past the end. */
|
||||
int next ();
|
||||
|
||||
/* Returns the number of remaining positions, i.e. how often next() will
|
||||
return a value != EOS. */
|
||||
unsigned int remaining () const;
|
||||
|
||||
private:
|
||||
/* Initializes an iterator through POSITIONS. */
|
||||
PositionReverseIterator (Positions const& positions);
|
||||
/* Initializes an iterator through POSITIONS, ignoring positions >= maxlen. */
|
||||
PositionReverseIterator (Positions const& positions, int maxlen);
|
||||
|
||||
const Positions& _set;
|
||||
unsigned int _index;
|
||||
unsigned int _minindex;
|
||||
};
|
||||
|
||||
#ifdef __OPTIMIZE__
|
||||
|
||||
#include <string.h>
|
||||
#define INLINE inline
|
||||
#include "positions.icc"
|
||||
#undef INLINE
|
||||
|
||||
#endif
|
||||
|
||||
#endif
|
@ -1,285 +0,0 @@
|
||||
/* Inline Functions for positions.{h,cc}.
|
||||
|
||||
Copyright (C) 1989-1998, 2000, 2002 Free Software Foundation, Inc.
|
||||
Written by Douglas C. Schmidt <schmidt@ics.uci.edu>
|
||||
and Bruno Haible <bruno@clisp.org>.
|
||||
|
||||
This file is part of GNU GPERF.
|
||||
|
||||
GNU GPERF 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, or (at your option)
|
||||
any later version.
|
||||
|
||||
GNU GPERF 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; see the file COPYING.
|
||||
If not, write to the Free Software Foundation, Inc.,
|
||||
51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. */
|
||||
|
||||
// This needs:
|
||||
//#include <string.h>
|
||||
|
||||
/* ---------------------------- Class Positions ---------------------------- */
|
||||
|
||||
/* Constructors. */
|
||||
|
||||
INLINE
|
||||
Positions::Positions ()
|
||||
: _useall (false),
|
||||
_size (0)
|
||||
{
|
||||
}
|
||||
|
||||
INLINE
|
||||
Positions::Positions (int pos1)
|
||||
: _useall (false),
|
||||
_size (1)
|
||||
{
|
||||
_positions[0] = pos1;
|
||||
}
|
||||
|
||||
INLINE
|
||||
Positions::Positions (int pos1, int pos2)
|
||||
: _useall (false),
|
||||
_size (2)
|
||||
{
|
||||
_positions[0] = pos1;
|
||||
_positions[1] = pos2;
|
||||
}
|
||||
|
||||
/* Copy constructor. */
|
||||
|
||||
INLINE
|
||||
Positions::Positions (const Positions& src)
|
||||
: _useall (src._useall),
|
||||
_size (src._size)
|
||||
{
|
||||
memcpy (_positions, src._positions, _size * sizeof (_positions[0]));
|
||||
}
|
||||
|
||||
/* Assignment operator. */
|
||||
|
||||
INLINE Positions&
|
||||
Positions::operator= (const Positions& src)
|
||||
{
|
||||
_useall = src._useall;
|
||||
_size = src._size;
|
||||
memcpy (_positions, src._positions, _size * sizeof (_positions[0]));
|
||||
return *this;
|
||||
}
|
||||
|
||||
/* Accessors. */
|
||||
|
||||
INLINE bool
|
||||
Positions::is_useall () const
|
||||
{
|
||||
return _useall;
|
||||
}
|
||||
|
||||
INLINE int
|
||||
Positions::operator[] (unsigned int index) const
|
||||
{
|
||||
return _positions[index];
|
||||
}
|
||||
|
||||
INLINE unsigned int
|
||||
Positions::get_size () const
|
||||
{
|
||||
return _size;
|
||||
}
|
||||
|
||||
/* Write access. */
|
||||
|
||||
INLINE void
|
||||
Positions::set_useall (bool useall)
|
||||
{
|
||||
_useall = useall;
|
||||
if (useall)
|
||||
{
|
||||
/* The positions are 0, 1, ..., MAX_KEY_POS-1, in descending order. */
|
||||
_size = MAX_KEY_POS;
|
||||
int *ptr = _positions;
|
||||
for (int i = MAX_KEY_POS - 1; i >= 0; i--)
|
||||
*ptr++ = i;
|
||||
}
|
||||
}
|
||||
|
||||
INLINE int *
|
||||
Positions::pointer ()
|
||||
{
|
||||
return _positions;
|
||||
}
|
||||
|
||||
INLINE void
|
||||
Positions::set_size (unsigned int size)
|
||||
{
|
||||
_size = size;
|
||||
}
|
||||
|
||||
/* Sorts the array in reverse order.
|
||||
Returns true if there are no duplicates, false otherwise. */
|
||||
INLINE bool
|
||||
Positions::sort ()
|
||||
{
|
||||
if (_useall)
|
||||
return true;
|
||||
|
||||
/* Bubble sort. */
|
||||
bool duplicate_free = true;
|
||||
int *base = _positions;
|
||||
unsigned int len = _size;
|
||||
|
||||
for (unsigned int i = 1; i < len; i++)
|
||||
{
|
||||
unsigned int j;
|
||||
int tmp;
|
||||
|
||||
for (j = i, tmp = base[j]; j > 0 && tmp >= base[j - 1]; j--)
|
||||
if ((base[j] = base[j - 1]) == tmp) /* oh no, a duplicate!!! */
|
||||
duplicate_free = false;
|
||||
|
||||
base[j] = tmp;
|
||||
}
|
||||
|
||||
return duplicate_free;
|
||||
}
|
||||
|
||||
/* Creates an iterator, returning the positions in descending order. */
|
||||
INLINE PositionIterator
|
||||
Positions::iterator () const
|
||||
{
|
||||
return PositionIterator (*this);
|
||||
}
|
||||
|
||||
/* Creates an iterator, returning the positions in descending order,
|
||||
that apply to strings of length <= maxlen. */
|
||||
INLINE PositionIterator
|
||||
Positions::iterator (int maxlen) const
|
||||
{
|
||||
return PositionIterator (*this, maxlen);
|
||||
}
|
||||
|
||||
/* Creates an iterator, returning the positions in ascending order. */
|
||||
INLINE PositionReverseIterator
|
||||
Positions::reviterator () const
|
||||
{
|
||||
return PositionReverseIterator (*this);
|
||||
}
|
||||
|
||||
/* Creates an iterator, returning the positions in ascending order,
|
||||
that apply to strings of length <= maxlen. */
|
||||
INLINE PositionReverseIterator
|
||||
Positions::reviterator (int maxlen) const
|
||||
{
|
||||
return PositionReverseIterator (*this, maxlen);
|
||||
}
|
||||
|
||||
/* ------------------------- Class PositionIterator ------------------------ */
|
||||
|
||||
/* Initializes an iterator through POSITIONS. */
|
||||
INLINE
|
||||
PositionIterator::PositionIterator (Positions const& positions)
|
||||
: _set (positions),
|
||||
_index (0)
|
||||
{
|
||||
}
|
||||
|
||||
/* Initializes an iterator through POSITIONS, ignoring positions >= maxlen. */
|
||||
INLINE
|
||||
PositionIterator::PositionIterator (Positions const& positions, int maxlen)
|
||||
: _set (positions)
|
||||
{
|
||||
if (positions._useall)
|
||||
_index = (maxlen <= Positions::MAX_KEY_POS ? Positions::MAX_KEY_POS - maxlen : 0);
|
||||
else
|
||||
{
|
||||
unsigned int index;
|
||||
for (index = 0;
|
||||
index < positions._size && positions._positions[index] >= maxlen;
|
||||
index++)
|
||||
;
|
||||
_index = index;
|
||||
}
|
||||
}
|
||||
|
||||
/* Retrieves the next position, or EOS past the end. */
|
||||
INLINE int
|
||||
PositionIterator::next ()
|
||||
{
|
||||
return (_index < _set._size ? _set._positions[_index++] : EOS);
|
||||
}
|
||||
|
||||
/* Returns the number of remaining positions, i.e. how often next() will
|
||||
return a value != EOS. */
|
||||
INLINE unsigned int
|
||||
PositionIterator::remaining () const
|
||||
{
|
||||
return _set._size - _index;
|
||||
}
|
||||
|
||||
/* Copy constructor. */
|
||||
INLINE
|
||||
PositionIterator::PositionIterator (const PositionIterator& src)
|
||||
: _set (src._set),
|
||||
_index (src._index)
|
||||
{
|
||||
}
|
||||
|
||||
/* --------------------- Class PositionReverseIterator --------------------- */
|
||||
|
||||
/* Initializes an iterator through POSITIONS. */
|
||||
INLINE
|
||||
PositionReverseIterator::PositionReverseIterator (Positions const& positions)
|
||||
: _set (positions),
|
||||
_index (_set._size),
|
||||
_minindex (0)
|
||||
{
|
||||
}
|
||||
|
||||
/* Initializes an iterator through POSITIONS, ignoring positions >= maxlen. */
|
||||
INLINE
|
||||
PositionReverseIterator::PositionReverseIterator (Positions const& positions, int maxlen)
|
||||
: _set (positions),
|
||||
_index (_set._size)
|
||||
{
|
||||
if (positions._useall)
|
||||
_minindex = (maxlen <= Positions::MAX_KEY_POS ? Positions::MAX_KEY_POS - maxlen : 0);
|
||||
else
|
||||
{
|
||||
unsigned int index;
|
||||
for (index = 0;
|
||||
index < positions._size && positions._positions[index] >= maxlen;
|
||||
index++)
|
||||
;
|
||||
_minindex = index;
|
||||
}
|
||||
}
|
||||
|
||||
/* Retrieves the next position, or EOS past the end. */
|
||||
INLINE int
|
||||
PositionReverseIterator::next ()
|
||||
{
|
||||
return (_index > _minindex ? _set._positions[--_index] : EOS);
|
||||
}
|
||||
|
||||
/* Returns the number of remaining positions, i.e. how often next() will
|
||||
return a value != EOS. */
|
||||
INLINE unsigned int
|
||||
PositionReverseIterator::remaining () const
|
||||
{
|
||||
return _index - _minindex;
|
||||
}
|
||||
|
||||
/* Copy constructor. */
|
||||
INLINE
|
||||
PositionReverseIterator::PositionReverseIterator (const PositionReverseIterator& src)
|
||||
: _set (src._set),
|
||||
_index (src._index),
|
||||
_minindex (src._minindex)
|
||||
{
|
||||
}
|
File diff suppressed because it is too large
Load Diff
@ -1,165 +0,0 @@
|
||||
/* This may look like C code, but it is really -*- C++ -*- */
|
||||
|
||||
/* Search algorithm.
|
||||
|
||||
Copyright (C) 1989-1998, 2000, 2002 Free Software Foundation, Inc.
|
||||
Written by Douglas C. Schmidt <schmidt@ics.uci.edu>
|
||||
and Bruno Haible <bruno@clisp.org>.
|
||||
|
||||
This file is part of GNU GPERF.
|
||||
|
||||
GNU GPERF 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, or (at your option)
|
||||
any later version.
|
||||
|
||||
GNU GPERF 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; see the file COPYING.
|
||||
If not, write to the Free Software Foundation, Inc.,
|
||||
51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. */
|
||||
|
||||
#ifndef search_h
|
||||
#define search_h 1
|
||||
|
||||
#include "keyword-list.h"
|
||||
#include "positions.h"
|
||||
#include "bool-array.h"
|
||||
|
||||
struct EquivalenceClass;
|
||||
|
||||
class Search
|
||||
{
|
||||
public:
|
||||
Search (KeywordExt_List *list);
|
||||
~Search ();
|
||||
void optimize ();
|
||||
private:
|
||||
void prepare ();
|
||||
|
||||
/* Computes the upper bound on the indices passed to asso_values[],
|
||||
assuming no alpha_increments. */
|
||||
unsigned int compute_alpha_size () const;
|
||||
|
||||
/* Computes the unification rules between different asso_values[c],
|
||||
assuming no alpha_increments. */
|
||||
unsigned int * compute_alpha_unify () const;
|
||||
|
||||
/* Initializes each keyword's _selchars array. */
|
||||
void init_selchars_tuple (const Positions& positions, const unsigned int *alpha_unify) const;
|
||||
/* Deletes each keyword's _selchars array. */
|
||||
void delete_selchars () const;
|
||||
|
||||
/* Count the duplicate keywords that occur with a given set of positions. */
|
||||
unsigned int count_duplicates_tuple (const Positions& positions, const unsigned int *alpha_unify) const;
|
||||
|
||||
/* Find good key positions. */
|
||||
void find_positions ();
|
||||
|
||||
/* Count the duplicate keywords that occur with the found set of positions. */
|
||||
unsigned int count_duplicates_tuple () const;
|
||||
|
||||
/* Computes the upper bound on the indices passed to asso_values[]. */
|
||||
unsigned int compute_alpha_size (const unsigned int *alpha_inc) const;
|
||||
|
||||
/* Computes the unification rules between different asso_values[c]. */
|
||||
unsigned int * compute_alpha_unify (const Positions& positions, const unsigned int *alpha_inc) const;
|
||||
|
||||
/* Initializes each keyword's _selchars array. */
|
||||
void init_selchars_multiset (const Positions& positions, const unsigned int *alpha_unify, const unsigned int *alpha_inc) const;
|
||||
|
||||
/* Count the duplicate keywords that occur with the given set of positions
|
||||
and a given alpha_inc[] array. */
|
||||
unsigned int count_duplicates_multiset (const unsigned int *alpha_inc) const;
|
||||
|
||||
/* Find good _alpha_inc[]. */
|
||||
void find_alpha_inc ();
|
||||
|
||||
/* Initializes the asso_values[] related parameters. */
|
||||
void prepare_asso_values ();
|
||||
|
||||
EquivalenceClass * compute_partition (bool *undetermined) const;
|
||||
|
||||
unsigned int count_possible_collisions (EquivalenceClass *partition, unsigned int c) const;
|
||||
|
||||
bool unchanged_partition (EquivalenceClass *partition, unsigned int c) const;
|
||||
|
||||
/* Finds some _asso_values[] that fit. */
|
||||
void find_asso_values ();
|
||||
|
||||
/* Computes a keyword's hash value, relative to the current _asso_values[],
|
||||
and stores it in keyword->_hash_value. */
|
||||
int compute_hash (KeywordExt *keyword) const;
|
||||
|
||||
/* Finds good _asso_values[]. */
|
||||
void find_good_asso_values ();
|
||||
|
||||
/* Sorts the keyword list by hash value. */
|
||||
void sort ();
|
||||
|
||||
public:
|
||||
|
||||
/* Linked list of keywords. */
|
||||
KeywordExt_List * _head;
|
||||
|
||||
/* Total number of keywords, counting duplicates. */
|
||||
int _total_keys;
|
||||
|
||||
/* Maximum length of the longest keyword. */
|
||||
int _max_key_len;
|
||||
|
||||
/* Minimum length of the shortest keyword. */
|
||||
int _min_key_len;
|
||||
|
||||
/* User-specified or computed key positions. */
|
||||
Positions _key_positions;
|
||||
|
||||
/* Adjustments to add to bytes add specific key positions. */
|
||||
unsigned int * _alpha_inc;
|
||||
|
||||
/* Size of alphabet. */
|
||||
unsigned int _alpha_size;
|
||||
|
||||
/* Alphabet character unification, either the identity or a mapping from
|
||||
upper case characters to lower case characters (and maybe more). */
|
||||
unsigned int * _alpha_unify;
|
||||
|
||||
/* Maximum _selchars_length over all keywords. */
|
||||
unsigned int _max_selchars_length;
|
||||
|
||||
/* Total number of duplicates that have been moved to _duplicate_link lists
|
||||
(not counting their representatives which stay on the main list). */
|
||||
int _total_duplicates;
|
||||
|
||||
/* Counts occurrences of each key set character.
|
||||
_occurrences[c] is the number of times that c occurs among the _selchars
|
||||
of a keyword. */
|
||||
int * _occurrences;
|
||||
/* Value associated with each character. */
|
||||
int * _asso_values;
|
||||
|
||||
private:
|
||||
|
||||
/* Length of _head list. Number of keywords, not counting duplicates. */
|
||||
int _list_len;
|
||||
|
||||
/* Exclusive upper bound for every _asso_values[c]. A power of 2. */
|
||||
unsigned int _asso_value_max;
|
||||
|
||||
/* Initial value for asso_values table. -1 means random. */
|
||||
int _initial_asso_value;
|
||||
/* Jump length when trying alternative values. 0 means random. */
|
||||
int _jump;
|
||||
|
||||
/* Maximal possible hash value. */
|
||||
int _max_hash_value;
|
||||
|
||||
/* Sparse bit vector for collision detection. */
|
||||
Bool_Array * _collision_detector;
|
||||
};
|
||||
|
||||
#endif
|
@ -1,28 +0,0 @@
|
||||
/* Current program version number.
|
||||
|
||||
Copyright (C) 1989-1998, 2000, 2002-2003, 2005, 2007 Free Software Foundation, Inc.
|
||||
Written by Douglas C. Schmidt <schmidt@ics.uci.edu>
|
||||
and Bruno Haible <bruno@clisp.org>.
|
||||
|
||||
This file is part of GNU GPERF.
|
||||
|
||||
GNU GPERF 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, or (at your option)
|
||||
any later version.
|
||||
|
||||
GNU GPERF 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; see the file COPYING.
|
||||
If not, write to the Free Software Foundation, Inc.,
|
||||
51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. */
|
||||
|
||||
/* Specification. */
|
||||
#include "version.h"
|
||||
|
||||
/* Current release version. */
|
||||
const char *version_string = "3.0.3";
|
@ -1,25 +0,0 @@
|
||||
/* Current program version number.
|
||||
|
||||
Copyright (C) 1989-1998, 2002 Free Software Foundation, Inc.
|
||||
Written by Douglas C. Schmidt <schmidt@ics.uci.edu>
|
||||
and Bruno Haible <bruno@clisp.org>.
|
||||
|
||||
This file is part of GNU GPERF.
|
||||
|
||||
GNU GPERF 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, or (at your option)
|
||||
any later version.
|
||||
|
||||
GNU GPERF 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; see the file COPYING.
|
||||
If not, write to the Free Software Foundation, Inc.,
|
||||
51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. */
|
||||
|
||||
/* Current release version. */
|
||||
extern const char *version_string;
|
Loading…
Reference in New Issue
Block a user