pax_global_header00006660000000000000000000000064132604374420014517gustar00rootroot0000000000000052 comment=816c4738b53f28ea456e192e68c4be10c39a1d32 apparix-11-062/000077500000000000000000000000001326043744200132535ustar00rootroot00000000000000apparix-11-062/AUTHORS000066400000000000000000000001461326043744200143240ustar00rootroot00000000000000 apparix was written by Stijn van Dongen apparix's build environment was created by Joost van Baal. apparix-11-062/COPYING000066400000000000000000000431101326043744200143050ustar00rootroot00000000000000 GNU GENERAL PUBLIC LICENSE Version 2, June 1991 Copyright (C) 1989, 1991 Free Software Foundation, Inc. 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA Everyone is permitted to copy and distribute verbatim copies of this license document, but changing it is not allowed. Preamble The licenses for most software are designed to take away your freedom to share and change it. By contrast, the GNU General Public License is intended to guarantee your freedom to share and change free 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 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. Copyright (C) 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. , 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. apparix-11-062/ChangeLog000066400000000000000000000224061326043744200150310ustar00rootroot00000000000000 Thu 3 March 2011 * apparix-11-062 released. * The option -pick was added to support the new bash function 'whence'. Wed 26 Nov 2008 * apparix-08-331 released. * The bash completion code was changed to improve tab completion on subdirectories of the mark. First, a bug was fixed where this completion would include subdirectories of the current directory. Second, patterns with no matching subdirectories will never generate an error but simply stall completion, utilizing the bash nullglob option. * Fixed a bug in the string library - unlikely to affect apparix. Thu 24 Jul 2008 * apparix-08-206 released. * The apparix function 'to' can now be used as a drop-in replacement for cd. * Apparix and its wrappers have been expanded so that they act as a replacement for cd in cases where the mark is not a bookmark but exists as an accessible directory. Bash tab completion acts by default transparently and simultaneously on both bookmarks and accessible directories. * Added options --try-current-first and --try-current-last. These can be used in the 'to' definition, instructing apparix to check whether the mark is also the name of an accessible directory. The definitions of 'to' as shipped with apparix do this, using --try-current-first. * Added option --tell-current. This will notify the user if an entry was found as a regular directory rather than via bookmark lookup. Only meaningful in conjunction with one of the options above. Tue 18 Sep 2007 * apparix-07-261 released. * --squash-mark and --squash-dest have gone. They are now replaced by -sm and -sd . Squashing can no longer be applied globally but must be targeted at a specific bookmark or its destination. This is more in line with expected use. See further below. * apparix -sd MARK squashes all the *other* marks that point to the destination bookmarked under MARK. Only MARK is kept for this destination. * apparix -ld MARK lists all bookmarks MARK (noting that the same bookmark is allowed to point to multiple locations) and additionally lists all other bookmarks that share the destination with one of the MARK bookmarks. This allows one to predict the effect of issuing 'apparix -sd MARK'. * apparix -sm MARK squashes all the distinct destinations under the same bookmark MARK. By default the last destination is taken. * apparix -lm MARK lists all the distinct destinations under the same bookmark MARK. * Apparix squash and purge options now output the dumped bookmarks as command-line statements ready to reimport, rather than the format used in the apparix rc file. A cut and paste will reinstate unwanted removals. Set APPARIXPURGE to 1 to have dumped bookmarks in the apparixrc file format. * The environment variable APPARIXTAG, if set, is incorporated into the names of the apparix resource files. By default these are .apparixrc and .apparixexpand. When APPARIXTAG is set to they become .apparixrc and .apparixexpand. This can be used e.g. to have different resource files on different host machines. * If the environment APPARIXLOG is set its value is interpreted as a log file that has all newly created jumps and portals appended to it. Wed 3 Jul 2007 * apparix-07-184 released. * Apparix is now licensed under the GNU General Public License version 3. * Added --quiet-jump option. By default apparix will emit an error message and set the exit status to 1 when looking up a mark and not finding it. With this option, it is silent. It will still exit with status 1. * For portal expansion apparix would exclude the destination 'CVS', and this was hardcoded. Exclusion behaviour is now specified using the environment variable APPARIXEXCLUDE. This variable has the following syntax: <[:,][]>+ That is, a list of names with each name preceded by a colon or a comma. A colon indicates that triggers exclusion of directory names for which the trailing component is identical to . A comma indicates that triggers exclusion of directory names for which the trailing component contains as a substring. Example: export APPARIXEXCLUDE=:CVS:lib,tmp Curiosity: export APPARIXEXCLUDE=, will exclude everything from expansion, as it specifies the empty string. Fri 10 Nov 2006 * apparix-06-314 released. * Fixed Yet Another Bug that Boggles the Mind. In the last two releases bookmarks could not be added at all, due to the addition of a status check that triggers an erroneous status initialization. This was a bad month. Wed 8 Nov 2006 * apparix-06-312 released. * Fix dumb realloc-related apparix crash (n_old and n_new were in the wrong order) that manifests itself with bookmark nr 100. Fri 20 Oct 2006 * apparix-06-293 released. * Fix dumb apparix crash when .apparixrc is not present. (This bug would occur only once as apparix created .apparixrc before crashing). * Warn when commas are found in mark or target. Tue 23 May 2006 * apparix-06-142 released. * --squash-mark was badly implemented and would generally not work. It now works and preserves newer entries (those occurring later in the file .apparixrc) over older entries by default. To change this behaviour use -favour . * If a new bookmark already exists either as a regular bookmark or as a portal destination apparix will emit a short message when the bookmark is created. * Added -l option for paragraph listing of all available jumps. * Added -d option for dumping the resource file to STDOUT. * Added -u option for undoing the last k bookmarks. * The -favour default in to() functions/macros is set to rOl, implying: 1) regular bookmarks are prefered over expansions 2) younger bookmarks are prefered over older bookmarks 3) paths with fewer components are prefered. With this setting 3) is never reached as 2) will never be a tie. * Added alias -sm for -squash-mark * The -favour default with --squash-mark and -sm is set to Olr implying that younger bookmarks will be preserved. * Squashing and purging currently only works on regular style bookmarks due to finally specified semantics. Edit .apparixrc to do things to portals. They are 'special' and quite likely you have only few. * The output format when simply listing bookmarks has slightly changed. There are now three consecutive sections: portals, expansions, bookmarks. * --add-portal uses the same getcwd/pwd code as --add-jump does (rather than unconditionally using getcwd). * Changed -rid to -purge, -rid-mark to -purge-mark. Thu 5 Jan 2006 * apparix-06-005 released. * Documentation changes. Added GETTING STARTED paragraph. Thu, 10 Nov 2005 * apparix-05-314 released - major new features. * NOTE It is necessary to update your functions or aliases; issue apparix --shell-examples to find the up-to-date default versions. * Integrated bash completion code contributed by Sitaram Chamarty. It is now possible to tab-complete on subdirectories of the directory identified by a mark. Thus to myfoo will give you a menu of or cycle through the subdirectories of the myfoo target directory, depending on your completion settings. It is also possible to do to myfoo PAT This will only select those subdirectories that match the shell-pattern PAT. As a reminder, to to PAT do the same but then on apparix bookmarks. * The to() function/alias reads its input directly from apparix without requiring an intermediate file. So .apparixresult is no longer created. * Fixed stupid copy-code bug in bash bm() and portal(). They would initiate a jump. * The -quo / --quo options were dropped. Simply use apparix without arguments to get the list of bookmarks. * added -favour option to resolve duplicate bookmarks. It is needed in the bash completion code. Typical usage (in the wrapper functions): -favour lro l level (shorter paths prefered) r regular bookmarks prefered (not expansions) o older bookmarks prefered LRO do the opposite. * Added --bu and -bu backup options. * Significant documentation updates. Wed, 2 Nov 2005 * apparix-05-306 released. * apparix --add-jump without any arguments will take the trailing component of the current directory as the bookmark, with the directory itself as the destination. With the shorthand alias/function bm that means simply entering bm does the trick. * The bash to() function was wrongly documented. It would not pass through subdirectory specification. Now updated. * added -v option to show version information. * more documentation. Mon, 10 Oct 2005 * apparix-05-283 released * initial release. apparix-11-062/INSTALL000066400000000000000000000220301326043744200143010ustar00rootroot00000000000000Copyright (C) 1994, 1995, 1996, 1999, 2000, 2001, 2002 Free Software Foundation, Inc. This file is free documentation; the Free Software Foundation gives unlimited permission to copy, distribute and modify it. 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, and a file `config.log' containing compiler output (useful mainly for debugging `configure'). It can also use an optional file (typically called `config.cache' and enabled with `--cache-file=config.cache' or simply `-C') that saves the results of its tests to speed up reconfiguring. (Caching is disabled by default to prevent problems with accidental use of stale cache files.) 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 you are using the cache, and at some point `config.cache' contains results you don't want to keep, you may remove or edit it. The file `configure.ac' (or `configure.in') 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 awhile. 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. Run `./configure --help' for details on some of the pertinent environment variables. You can give `configure' initial values for configuration parameters by setting variables in the command line or in the environment. Here is an example: ./configure CC=c89 CFLAGS=-O2 LIBS=-lposix *Note Defining Variables::, for more details. 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 support 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' cannot figure out automatically, but needs to determine by the type of machine the package will run on. Usually, assuming the package is built to be run on the _same_ architectures, `configure' can figure that out, but if it prints a message saying it cannot guess the machine type, give it the `--build=TYPE' option. TYPE can either be a short name for the system type, such as `sun4', or a canonical name which has the form: CPU-COMPANY-SYSTEM where SYSTEM can have one of these forms: OS KERNEL-OS 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 machine type. If you are _building_ compiler tools for cross-compiling, you should use the `--target=TYPE' option to select the type of system they will produce code for. If you want to _use_ a cross compiler, that generates code for a platform different from the build platform, you should specify the "host" platform (i.e., that on which the generated programs will eventually be run) with `--host=TYPE'. 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. Defining Variables ================== Variables not defined in a site shell script can be set in the environment passed to `configure'. However, some packages may run configure again during the build, and the customized values of these variables may be lost. In order to avoid this problem, you should set them in the `configure' command line, using `VAR=value'. For example: ./configure CC=/usr/local2/bin/gcc will cause the specified gcc to be used as the C compiler (unless it is overridden in the site shell script). `configure' Invocation ====================== `configure' recognizes the following options to control how it operates. `--help' `-h' Print a summary of the options to `configure', and exit. `--version' `-V' Print the version of Autoconf used to generate the `configure' script, and exit. `--cache-file=FILE' Enable the cache: use and save the results of the tests in FILE, traditionally `config.cache'. FILE defaults to `/dev/null' to disable caching. `--config-cache' `-C' Alias for `--cache-file=config.cache'. `--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. `configure' also accepts some other, not widely useful, options. Run `configure --help' for more details. apparix-11-062/LICENSE000066400000000000000000000013221326043744200142560ustar00rootroot00000000000000 These programs are free software; you can redistribute and/or modify them 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. These programs are distributed in the hope that they 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. apparix-11-062/Makefile.am000066400000000000000000000006021326043744200153050ustar00rootroot00000000000000## Process this file with automake to produce Makefile.in ## $Id: Makefile.am,v 1.1 2005/10/09 22:32:36 flux Exp $ ## stuff in shtest should get distributed but not installed SUBDIRS = . util src doc #VERSION: ChangeLog NEWS # ./setversion VERSION = @VERSION@ EXTRA_DIST = \ LICENSE VERSION README COPYING THANKS INSTALL AUTHORS \ bootstrap \ configure.ac \ setversion apparix-11-062/Makefile.in000066400000000000000000000524021326043744200153230ustar00rootroot00000000000000# Makefile.in generated by automake 1.11 from Makefile.am. # @configure_input@ # Copyright (C) 1994, 1995, 1996, 1997, 1998, 1999, 2000, 2001, 2002, # 2003, 2004, 2005, 2006, 2007, 2008, 2009 Free Software Foundation, # Inc. # This Makefile.in is free software; the Free Software Foundation # gives unlimited permission to copy and/or distribute it, # with or without modifications, as long as this notice is preserved. # This program is distributed in the hope that it will be useful, # but WITHOUT ANY WARRANTY, to the extent permitted by law; without # even the implied warranty of MERCHANTABILITY or FITNESS FOR A # PARTICULAR PURPOSE. @SET_MAKE@ VPATH = @srcdir@ pkgdatadir = $(datadir)/@PACKAGE@ pkgincludedir = $(includedir)/@PACKAGE@ pkglibdir = $(libdir)/@PACKAGE@ pkglibexecdir = $(libexecdir)/@PACKAGE@ am__cd = CDPATH="$${ZSH_VERSION+.}$(PATH_SEPARATOR)" && cd install_sh_DATA = $(install_sh) -c -m 644 install_sh_PROGRAM = $(install_sh) -c install_sh_SCRIPT = $(install_sh) -c INSTALL_HEADER = $(INSTALL_DATA) transform = $(program_transform_name) NORMAL_INSTALL = : PRE_INSTALL = : POST_INSTALL = : NORMAL_UNINSTALL = : PRE_UNINSTALL = : POST_UNINSTALL = : subdir = . DIST_COMMON = README $(am__configure_deps) $(srcdir)/Makefile.am \ $(srcdir)/Makefile.in $(srcdir)/config.h.in \ $(top_srcdir)/configure AUTHORS COPYING ChangeLog INSTALL NEWS \ THANKS TODO depcomp install-sh missing ACLOCAL_M4 = $(top_srcdir)/aclocal.m4 am__aclocal_m4_deps = $(top_srcdir)/acinclude.m4 \ $(top_srcdir)/configure.ac am__configure_deps = $(am__aclocal_m4_deps) $(CONFIGURE_DEPENDENCIES) \ $(ACLOCAL_M4) am__CONFIG_DISTCLEAN_FILES = config.status config.cache config.log \ configure.lineno config.status.lineno mkinstalldirs = $(install_sh) -d CONFIG_HEADER = config.h CONFIG_CLEAN_FILES = CONFIG_CLEAN_VPATH_FILES = SOURCES = DIST_SOURCES = RECURSIVE_TARGETS = all-recursive check-recursive dvi-recursive \ html-recursive info-recursive install-data-recursive \ install-dvi-recursive install-exec-recursive \ install-html-recursive install-info-recursive \ install-pdf-recursive install-ps-recursive install-recursive \ installcheck-recursive installdirs-recursive pdf-recursive \ ps-recursive uninstall-recursive RECURSIVE_CLEAN_TARGETS = mostlyclean-recursive clean-recursive \ distclean-recursive maintainer-clean-recursive AM_RECURSIVE_TARGETS = $(RECURSIVE_TARGETS:-recursive=) \ $(RECURSIVE_CLEAN_TARGETS:-recursive=) tags TAGS ctags CTAGS \ distdir dist dist-all distcheck ETAGS = etags CTAGS = ctags DIST_SUBDIRS = $(SUBDIRS) DISTFILES = $(DIST_COMMON) $(DIST_SOURCES) $(TEXINFOS) $(EXTRA_DIST) distdir = $(PACKAGE)-$(VERSION) top_distdir = $(distdir) am__remove_distdir = \ { test ! -d "$(distdir)" \ || { find "$(distdir)" -type d ! -perm -200 -exec chmod u+w {} ';' \ && rm -fr "$(distdir)"; }; } am__relativize = \ dir0=`pwd`; \ sed_first='s,^\([^/]*\)/.*$$,\1,'; \ sed_rest='s,^[^/]*/*,,'; \ sed_last='s,^.*/\([^/]*\)$$,\1,'; \ sed_butlast='s,/*[^/]*$$,,'; \ while test -n "$$dir1"; do \ first=`echo "$$dir1" | sed -e "$$sed_first"`; \ if test "$$first" != "."; then \ if test "$$first" = ".."; then \ dir2=`echo "$$dir0" | sed -e "$$sed_last"`/"$$dir2"; \ dir0=`echo "$$dir0" | sed -e "$$sed_butlast"`; \ else \ first2=`echo "$$dir2" | sed -e "$$sed_first"`; \ if test "$$first2" = "$$first"; then \ dir2=`echo "$$dir2" | sed -e "$$sed_rest"`; \ else \ dir2="../$$dir2"; \ fi; \ dir0="$$dir0"/"$$first"; \ fi; \ fi; \ dir1=`echo "$$dir1" | sed -e "$$sed_rest"`; \ done; \ reldir="$$dir2" DIST_ARCHIVES = $(distdir).tar.gz GZIP_ENV = --best distuninstallcheck_listfiles = find . -type f -print distcleancheck_listfiles = find . -type f -print ACLOCAL = @ACLOCAL@ AMTAR = @AMTAR@ AUTOCONF = @AUTOCONF@ AUTOHEADER = @AUTOHEADER@ AUTOMAKE = @AUTOMAKE@ AWK = @AWK@ CC = @CC@ CCDEPMODE = @CCDEPMODE@ CFLAGS = @CFLAGS@ CPP = @CPP@ CPPFLAGS = @CPPFLAGS@ CYGPATH_W = @CYGPATH_W@ DEFS = @DEFS@ DEPDIR = @DEPDIR@ ECHO_C = @ECHO_C@ ECHO_N = @ECHO_N@ ECHO_T = @ECHO_T@ EGREP = @EGREP@ EXEEXT = @EXEEXT@ GREP = @GREP@ INSTALL = @INSTALL@ INSTALL_DATA = @INSTALL_DATA@ INSTALL_PROGRAM = @INSTALL_PROGRAM@ INSTALL_SCRIPT = @INSTALL_SCRIPT@ INSTALL_STRIP_PROGRAM = @INSTALL_STRIP_PROGRAM@ LDFLAGS = @LDFLAGS@ LIBOBJS = @LIBOBJS@ LIBS = @LIBS@ LN_S = @LN_S@ LTLIBOBJS = @LTLIBOBJS@ MAINT = @MAINT@ MAKEINFO = @MAKEINFO@ MKDIR_P = @MKDIR_P@ OBJEXT = @OBJEXT@ PACKAGE = @PACKAGE@ PACKAGE_BUGREPORT = @PACKAGE_BUGREPORT@ PACKAGE_NAME = @PACKAGE_NAME@ PACKAGE_STRING = @PACKAGE_STRING@ PACKAGE_TARNAME = @PACKAGE_TARNAME@ PACKAGE_URL = @PACKAGE_URL@ PACKAGE_VERSION = @PACKAGE_VERSION@ PATH_SEPARATOR = @PATH_SEPARATOR@ RANLIB = @RANLIB@ SET_MAKE = @SET_MAKE@ SHELL = @SHELL@ STRIP = @STRIP@ #VERSION: ChangeLog NEWS # ./setversion VERSION = @VERSION@ abs_builddir = @abs_builddir@ abs_srcdir = @abs_srcdir@ abs_top_builddir = @abs_top_builddir@ abs_top_srcdir = @abs_top_srcdir@ ac_ct_CC = @ac_ct_CC@ am__include = @am__include@ am__leading_dot = @am__leading_dot@ am__quote = @am__quote@ am__tar = @am__tar@ am__untar = @am__untar@ bindir = @bindir@ build_alias = @build_alias@ builddir = @builddir@ datadir = @datadir@ datarootdir = @datarootdir@ docdir = @docdir@ dvidir = @dvidir@ exec_prefix = @exec_prefix@ host_alias = @host_alias@ htmldir = @htmldir@ includedir = @includedir@ infodir = @infodir@ install_sh = @install_sh@ libdir = @libdir@ libexecdir = @libexecdir@ localedir = @localedir@ localstatedir = @localstatedir@ mandir = @mandir@ mkdir_p = @mkdir_p@ oldincludedir = @oldincludedir@ pdfdir = @pdfdir@ prefix = @prefix@ program_transform_name = @program_transform_name@ psdir = @psdir@ sbindir = @sbindir@ sharedstatedir = @sharedstatedir@ srcdir = @srcdir@ sysconfdir = @sysconfdir@ target_alias = @target_alias@ top_build_prefix = @top_build_prefix@ top_builddir = @top_builddir@ top_srcdir = @top_srcdir@ SUBDIRS = . util src doc EXTRA_DIST = \ LICENSE VERSION README COPYING THANKS INSTALL AUTHORS \ bootstrap \ configure.ac \ setversion all: config.h $(MAKE) $(AM_MAKEFLAGS) all-recursive .SUFFIXES: am--refresh: @: $(srcdir)/Makefile.in: @MAINTAINER_MODE_TRUE@ $(srcdir)/Makefile.am $(am__configure_deps) @for dep in $?; do \ case '$(am__configure_deps)' in \ *$$dep*) \ echo ' cd $(srcdir) && $(AUTOMAKE) --gnu'; \ $(am__cd) $(srcdir) && $(AUTOMAKE) --gnu \ && exit 0; \ exit 1;; \ esac; \ done; \ echo ' cd $(top_srcdir) && $(AUTOMAKE) --gnu Makefile'; \ $(am__cd) $(top_srcdir) && \ $(AUTOMAKE) --gnu Makefile .PRECIOUS: Makefile Makefile: $(srcdir)/Makefile.in $(top_builddir)/config.status @case '$?' in \ *config.status*) \ echo ' $(SHELL) ./config.status'; \ $(SHELL) ./config.status;; \ *) \ echo ' cd $(top_builddir) && $(SHELL) ./config.status $@ $(am__depfiles_maybe)'; \ cd $(top_builddir) && $(SHELL) ./config.status $@ $(am__depfiles_maybe);; \ esac; $(top_builddir)/config.status: $(top_srcdir)/configure $(CONFIG_STATUS_DEPENDENCIES) $(SHELL) ./config.status --recheck $(top_srcdir)/configure: @MAINTAINER_MODE_TRUE@ $(am__configure_deps) $(am__cd) $(srcdir) && $(AUTOCONF) $(ACLOCAL_M4): @MAINTAINER_MODE_TRUE@ $(am__aclocal_m4_deps) $(am__cd) $(srcdir) && $(ACLOCAL) $(ACLOCAL_AMFLAGS) $(am__aclocal_m4_deps): config.h: stamp-h1 @if test ! -f $@; then \ rm -f stamp-h1; \ $(MAKE) $(AM_MAKEFLAGS) stamp-h1; \ else :; fi stamp-h1: $(srcdir)/config.h.in $(top_builddir)/config.status @rm -f stamp-h1 cd $(top_builddir) && $(SHELL) ./config.status config.h $(srcdir)/config.h.in: @MAINTAINER_MODE_TRUE@ $(am__configure_deps) ($(am__cd) $(top_srcdir) && $(AUTOHEADER)) rm -f stamp-h1 touch $@ distclean-hdr: -rm -f config.h stamp-h1 # This directory's subdirectories are mostly independent; you can cd # into them and run `make' without going through this Makefile. # To change the values of `make' variables: instead of editing Makefiles, # (1) if the variable is set in `config.status', edit `config.status' # (which will cause the Makefiles to be regenerated when you run `make'); # (2) otherwise, pass the desired values on the `make' command line. $(RECURSIVE_TARGETS): @failcom='exit 1'; \ for f in x $$MAKEFLAGS; do \ case $$f in \ *=* | --[!k]*);; \ *k*) failcom='fail=yes';; \ esac; \ done; \ dot_seen=no; \ target=`echo $@ | sed s/-recursive//`; \ list='$(SUBDIRS)'; for subdir in $$list; do \ echo "Making $$target in $$subdir"; \ if test "$$subdir" = "."; then \ dot_seen=yes; \ local_target="$$target-am"; \ else \ local_target="$$target"; \ fi; \ ($(am__cd) $$subdir && $(MAKE) $(AM_MAKEFLAGS) $$local_target) \ || eval $$failcom; \ done; \ if test "$$dot_seen" = "no"; then \ $(MAKE) $(AM_MAKEFLAGS) "$$target-am" || exit 1; \ fi; test -z "$$fail" $(RECURSIVE_CLEAN_TARGETS): @failcom='exit 1'; \ for f in x $$MAKEFLAGS; do \ case $$f in \ *=* | --[!k]*);; \ *k*) failcom='fail=yes';; \ esac; \ done; \ dot_seen=no; \ case "$@" in \ distclean-* | maintainer-clean-*) list='$(DIST_SUBDIRS)' ;; \ *) list='$(SUBDIRS)' ;; \ esac; \ rev=''; for subdir in $$list; do \ if test "$$subdir" = "."; then :; else \ rev="$$subdir $$rev"; \ fi; \ done; \ rev="$$rev ."; \ target=`echo $@ | sed s/-recursive//`; \ for subdir in $$rev; do \ echo "Making $$target in $$subdir"; \ if test "$$subdir" = "."; then \ local_target="$$target-am"; \ else \ local_target="$$target"; \ fi; \ ($(am__cd) $$subdir && $(MAKE) $(AM_MAKEFLAGS) $$local_target) \ || eval $$failcom; \ done && test -z "$$fail" tags-recursive: list='$(SUBDIRS)'; for subdir in $$list; do \ test "$$subdir" = . || ($(am__cd) $$subdir && $(MAKE) $(AM_MAKEFLAGS) tags); \ done ctags-recursive: list='$(SUBDIRS)'; for subdir in $$list; do \ test "$$subdir" = . || ($(am__cd) $$subdir && $(MAKE) $(AM_MAKEFLAGS) ctags); \ done ID: $(HEADERS) $(SOURCES) $(LISP) $(TAGS_FILES) list='$(SOURCES) $(HEADERS) $(LISP) $(TAGS_FILES)'; \ unique=`for i in $$list; do \ if test -f "$$i"; then echo $$i; else echo $(srcdir)/$$i; fi; \ done | \ $(AWK) '{ files[$$0] = 1; nonempty = 1; } \ END { if (nonempty) { for (i in files) print i; }; }'`; \ mkid -fID $$unique tags: TAGS TAGS: tags-recursive $(HEADERS) $(SOURCES) config.h.in $(TAGS_DEPENDENCIES) \ $(TAGS_FILES) $(LISP) set x; \ here=`pwd`; \ if ($(ETAGS) --etags-include --version) >/dev/null 2>&1; then \ include_option=--etags-include; \ empty_fix=.; \ else \ include_option=--include; \ empty_fix=; \ fi; \ list='$(SUBDIRS)'; for subdir in $$list; do \ if test "$$subdir" = .; then :; else \ test ! -f $$subdir/TAGS || \ set "$$@" "$$include_option=$$here/$$subdir/TAGS"; \ fi; \ done; \ list='$(SOURCES) $(HEADERS) config.h.in $(LISP) $(TAGS_FILES)'; \ unique=`for i in $$list; do \ if test -f "$$i"; then echo $$i; else echo $(srcdir)/$$i; fi; \ done | \ $(AWK) '{ files[$$0] = 1; nonempty = 1; } \ END { if (nonempty) { for (i in files) print i; }; }'`; \ shift; \ if test -z "$(ETAGS_ARGS)$$*$$unique"; then :; else \ test -n "$$unique" || unique=$$empty_fix; \ if test $$# -gt 0; then \ $(ETAGS) $(ETAGSFLAGS) $(AM_ETAGSFLAGS) $(ETAGS_ARGS) \ "$$@" $$unique; \ else \ $(ETAGS) $(ETAGSFLAGS) $(AM_ETAGSFLAGS) $(ETAGS_ARGS) \ $$unique; \ fi; \ fi ctags: CTAGS CTAGS: ctags-recursive $(HEADERS) $(SOURCES) config.h.in $(TAGS_DEPENDENCIES) \ $(TAGS_FILES) $(LISP) list='$(SOURCES) $(HEADERS) config.h.in $(LISP) $(TAGS_FILES)'; \ unique=`for i in $$list; do \ if test -f "$$i"; then echo $$i; else echo $(srcdir)/$$i; fi; \ done | \ $(AWK) '{ files[$$0] = 1; nonempty = 1; } \ END { if (nonempty) { for (i in files) print i; }; }'`; \ test -z "$(CTAGS_ARGS)$$unique" \ || $(CTAGS) $(CTAGSFLAGS) $(AM_CTAGSFLAGS) $(CTAGS_ARGS) \ $$unique GTAGS: here=`$(am__cd) $(top_builddir) && pwd` \ && $(am__cd) $(top_srcdir) \ && gtags -i $(GTAGS_ARGS) "$$here" distclean-tags: -rm -f TAGS ID GTAGS GRTAGS GSYMS GPATH tags distdir: $(DISTFILES) $(am__remove_distdir) test -d "$(distdir)" || mkdir "$(distdir)" @srcdirstrip=`echo "$(srcdir)" | sed 's/[].[^$$\\*]/\\\\&/g'`; \ topsrcdirstrip=`echo "$(top_srcdir)" | sed 's/[].[^$$\\*]/\\\\&/g'`; \ list='$(DISTFILES)'; \ dist_files=`for file in $$list; do echo $$file; done | \ sed -e "s|^$$srcdirstrip/||;t" \ -e "s|^$$topsrcdirstrip/|$(top_builddir)/|;t"`; \ case $$dist_files in \ */*) $(MKDIR_P) `echo "$$dist_files" | \ sed '/\//!d;s|^|$(distdir)/|;s,/[^/]*$$,,' | \ sort -u` ;; \ esac; \ for file in $$dist_files; do \ if test -f $$file || test -d $$file; then d=.; else d=$(srcdir); fi; \ if test -d $$d/$$file; then \ dir=`echo "/$$file" | sed -e 's,/[^/]*$$,,'`; \ if test -d "$(distdir)/$$file"; then \ find "$(distdir)/$$file" -type d ! -perm -700 -exec chmod u+rwx {} \;; \ fi; \ if test -d $(srcdir)/$$file && test $$d != $(srcdir); then \ cp -fpR $(srcdir)/$$file "$(distdir)$$dir" || exit 1; \ find "$(distdir)/$$file" -type d ! -perm -700 -exec chmod u+rwx {} \;; \ fi; \ cp -fpR $$d/$$file "$(distdir)$$dir" || exit 1; \ else \ test -f "$(distdir)/$$file" \ || cp -p $$d/$$file "$(distdir)/$$file" \ || exit 1; \ fi; \ done @list='$(DIST_SUBDIRS)'; for subdir in $$list; do \ if test "$$subdir" = .; then :; else \ test -d "$(distdir)/$$subdir" \ || $(MKDIR_P) "$(distdir)/$$subdir" \ || exit 1; \ fi; \ done @list='$(DIST_SUBDIRS)'; for subdir in $$list; do \ if test "$$subdir" = .; then :; else \ dir1=$$subdir; dir2="$(distdir)/$$subdir"; \ $(am__relativize); \ new_distdir=$$reldir; \ dir1=$$subdir; dir2="$(top_distdir)"; \ $(am__relativize); \ new_top_distdir=$$reldir; \ echo " (cd $$subdir && $(MAKE) $(AM_MAKEFLAGS) top_distdir="$$new_top_distdir" distdir="$$new_distdir" \\"; \ echo " am__remove_distdir=: am__skip_length_check=: am__skip_mode_fix=: distdir)"; \ ($(am__cd) $$subdir && \ $(MAKE) $(AM_MAKEFLAGS) \ top_distdir="$$new_top_distdir" \ distdir="$$new_distdir" \ am__remove_distdir=: \ am__skip_length_check=: \ am__skip_mode_fix=: \ distdir) \ || exit 1; \ fi; \ done -test -n "$(am__skip_mode_fix)" \ || find "$(distdir)" -type d ! -perm -777 -exec chmod a+rwx {} \; -o \ ! -type d ! -perm -444 -links 1 -exec chmod a+r {} \; -o \ ! -type d ! -perm -400 -exec chmod a+r {} \; -o \ ! -type d ! -perm -444 -exec $(install_sh) -c -m a+r {} {} \; \ || chmod -R a+r "$(distdir)" dist-gzip: distdir tardir=$(distdir) && $(am__tar) | GZIP=$(GZIP_ENV) gzip -c >$(distdir).tar.gz $(am__remove_distdir) dist-bzip2: distdir tardir=$(distdir) && $(am__tar) | bzip2 -9 -c >$(distdir).tar.bz2 $(am__remove_distdir) dist-lzma: distdir tardir=$(distdir) && $(am__tar) | lzma -9 -c >$(distdir).tar.lzma $(am__remove_distdir) dist-xz: distdir tardir=$(distdir) && $(am__tar) | xz -c >$(distdir).tar.xz $(am__remove_distdir) dist-tarZ: distdir tardir=$(distdir) && $(am__tar) | compress -c >$(distdir).tar.Z $(am__remove_distdir) dist-shar: distdir shar $(distdir) | GZIP=$(GZIP_ENV) gzip -c >$(distdir).shar.gz $(am__remove_distdir) dist-zip: distdir -rm -f $(distdir).zip zip -rq $(distdir).zip $(distdir) $(am__remove_distdir) dist dist-all: distdir tardir=$(distdir) && $(am__tar) | GZIP=$(GZIP_ENV) gzip -c >$(distdir).tar.gz $(am__remove_distdir) # This target untars the dist file and tries a VPATH configuration. Then # it guarantees that the distribution is self-contained by making another # tarfile. distcheck: dist case '$(DIST_ARCHIVES)' in \ *.tar.gz*) \ GZIP=$(GZIP_ENV) gunzip -c $(distdir).tar.gz | $(am__untar) ;;\ *.tar.bz2*) \ bunzip2 -c $(distdir).tar.bz2 | $(am__untar) ;;\ *.tar.lzma*) \ unlzma -c $(distdir).tar.lzma | $(am__untar) ;;\ *.tar.xz*) \ xz -dc $(distdir).tar.xz | $(am__untar) ;;\ *.tar.Z*) \ uncompress -c $(distdir).tar.Z | $(am__untar) ;;\ *.shar.gz*) \ GZIP=$(GZIP_ENV) gunzip -c $(distdir).shar.gz | unshar ;;\ *.zip*) \ unzip $(distdir).zip ;;\ esac chmod -R a-w $(distdir); chmod a+w $(distdir) mkdir $(distdir)/_build mkdir $(distdir)/_inst chmod a-w $(distdir) test -d $(distdir)/_build || exit 0; \ dc_install_base=`$(am__cd) $(distdir)/_inst && pwd | sed -e 's,^[^:\\/]:[\\/],/,'` \ && dc_destdir="$${TMPDIR-/tmp}/am-dc-$$$$/" \ && am__cwd=`pwd` \ && $(am__cd) $(distdir)/_build \ && ../configure --srcdir=.. --prefix="$$dc_install_base" \ $(DISTCHECK_CONFIGURE_FLAGS) \ && $(MAKE) $(AM_MAKEFLAGS) \ && $(MAKE) $(AM_MAKEFLAGS) dvi \ && $(MAKE) $(AM_MAKEFLAGS) check \ && $(MAKE) $(AM_MAKEFLAGS) install \ && $(MAKE) $(AM_MAKEFLAGS) installcheck \ && $(MAKE) $(AM_MAKEFLAGS) uninstall \ && $(MAKE) $(AM_MAKEFLAGS) distuninstallcheck_dir="$$dc_install_base" \ distuninstallcheck \ && chmod -R a-w "$$dc_install_base" \ && ({ \ (cd ../.. && umask 077 && mkdir "$$dc_destdir") \ && $(MAKE) $(AM_MAKEFLAGS) DESTDIR="$$dc_destdir" install \ && $(MAKE) $(AM_MAKEFLAGS) DESTDIR="$$dc_destdir" uninstall \ && $(MAKE) $(AM_MAKEFLAGS) DESTDIR="$$dc_destdir" \ distuninstallcheck_dir="$$dc_destdir" distuninstallcheck; \ } || { rm -rf "$$dc_destdir"; exit 1; }) \ && rm -rf "$$dc_destdir" \ && $(MAKE) $(AM_MAKEFLAGS) dist \ && rm -rf $(DIST_ARCHIVES) \ && $(MAKE) $(AM_MAKEFLAGS) distcleancheck \ && cd "$$am__cwd" \ || exit 1 $(am__remove_distdir) @(echo "$(distdir) archives ready for distribution: "; \ list='$(DIST_ARCHIVES)'; for i in $$list; do echo $$i; done) | \ sed -e 1h -e 1s/./=/g -e 1p -e 1x -e '$$p' -e '$$x' distuninstallcheck: @$(am__cd) '$(distuninstallcheck_dir)' \ && test `$(distuninstallcheck_listfiles) | wc -l` -le 1 \ || { echo "ERROR: files left after uninstall:" ; \ if test -n "$(DESTDIR)"; then \ echo " (check DESTDIR support)"; \ fi ; \ $(distuninstallcheck_listfiles) ; \ exit 1; } >&2 distcleancheck: distclean @if test '$(srcdir)' = . ; then \ echo "ERROR: distcleancheck can only run from a VPATH build" ; \ exit 1 ; \ fi @test `$(distcleancheck_listfiles) | wc -l` -eq 0 \ || { echo "ERROR: files left in build directory after distclean:" ; \ $(distcleancheck_listfiles) ; \ exit 1; } >&2 check-am: all-am check: check-recursive all-am: Makefile config.h installdirs: installdirs-recursive installdirs-am: install: install-recursive install-exec: install-exec-recursive install-data: install-data-recursive uninstall: uninstall-recursive install-am: all-am @$(MAKE) $(AM_MAKEFLAGS) install-exec-am install-data-am installcheck: installcheck-recursive install-strip: $(MAKE) $(AM_MAKEFLAGS) INSTALL_PROGRAM="$(INSTALL_STRIP_PROGRAM)" \ install_sh_PROGRAM="$(INSTALL_STRIP_PROGRAM)" INSTALL_STRIP_FLAG=-s \ `test -z '$(STRIP)' || \ echo "INSTALL_PROGRAM_ENV=STRIPPROG='$(STRIP)'"` install mostlyclean-generic: clean-generic: distclean-generic: -test -z "$(CONFIG_CLEAN_FILES)" || rm -f $(CONFIG_CLEAN_FILES) -test . = "$(srcdir)" || test -z "$(CONFIG_CLEAN_VPATH_FILES)" || rm -f $(CONFIG_CLEAN_VPATH_FILES) maintainer-clean-generic: @echo "This command is intended for maintainers to use" @echo "it deletes files that may require special tools to rebuild." clean: clean-recursive clean-am: clean-generic mostlyclean-am distclean: distclean-recursive -rm -f $(am__CONFIG_DISTCLEAN_FILES) -rm -f Makefile distclean-am: clean-am distclean-generic distclean-hdr distclean-tags dvi: dvi-recursive dvi-am: html: html-recursive html-am: info: info-recursive info-am: install-data-am: install-dvi: install-dvi-recursive install-dvi-am: install-exec-am: install-html: install-html-recursive install-html-am: install-info: install-info-recursive install-info-am: install-man: install-pdf: install-pdf-recursive install-pdf-am: install-ps: install-ps-recursive install-ps-am: installcheck-am: maintainer-clean: maintainer-clean-recursive -rm -f $(am__CONFIG_DISTCLEAN_FILES) -rm -rf $(top_srcdir)/autom4te.cache -rm -f Makefile maintainer-clean-am: distclean-am maintainer-clean-generic mostlyclean: mostlyclean-recursive mostlyclean-am: mostlyclean-generic pdf: pdf-recursive pdf-am: ps: ps-recursive ps-am: uninstall-am: .MAKE: $(RECURSIVE_CLEAN_TARGETS) $(RECURSIVE_TARGETS) all \ ctags-recursive install-am install-strip tags-recursive .PHONY: $(RECURSIVE_CLEAN_TARGETS) $(RECURSIVE_TARGETS) CTAGS GTAGS \ all all-am am--refresh check check-am clean clean-generic \ ctags ctags-recursive dist dist-all dist-bzip2 dist-gzip \ dist-lzma dist-shar dist-tarZ dist-xz dist-zip distcheck \ distclean distclean-generic distclean-hdr distclean-tags \ distcleancheck distdir distuninstallcheck dvi dvi-am html \ html-am info info-am install install-am install-data \ install-data-am install-dvi install-dvi-am install-exec \ install-exec-am install-html install-html-am install-info \ install-info-am install-man install-pdf install-pdf-am \ install-ps install-ps-am install-strip installcheck \ installcheck-am installdirs installdirs-am maintainer-clean \ maintainer-clean-generic mostlyclean mostlyclean-generic pdf \ pdf-am ps ps-am tags tags-recursive uninstall uninstall-am # Tell versions [3.59,3.63) of GNU make to not export all variables. # Otherwise a system limit (for SysV at least) may be exceeded. .NOEXPORT: apparix-11-062/NEWS000066400000000000000000000000001326043744200137400ustar00rootroot00000000000000apparix-11-062/README000066400000000000000000000005661326043744200141420ustar00rootroot00000000000000 See LICENSE for copyright and licensing, see THANKS for contributors, see INSTALL for generic installation instructions, see doc/ for documentation. If you get an error message such as util/ting.c:164: undefined reference to `va_copy' Try configuring apparix with CFLAGS=-DHAVE_VA_COPY=0, e.g. ./configure --prefix=$HOME CFLAGS=-DHAVE_VA_COPY=0 apparix-11-062/THANKS000066400000000000000000000006101326043744200141630ustar00rootroot00000000000000 Thanks to: Joost van Baal author of the build environment. Stefan Kamphausen for writing cdargs which begat apparix. Sitaram Chamarty contributed the bash completion mechanism for apparix. It was first modelled after the cdargs equivalent, but then took on a life of its own as it acquired completion on subdirectory names of the bookmark target. apparix-11-062/TODO000066400000000000000000000024231326043744200137440ustar00rootroot00000000000000 $ pass ls options to als et cetera. $ change to tab separated resource files. - make backup mechanism where date tag is automatically added. - [src] it would be neater to have the shell examples in a separate file and have code that incorporates it into the C source (a la clmformat). - enable sorting with 'apparix -l', 'apparix', possibly 'apparix -d' - sorting for jumping can first grep the bookmark into a mini-folder. ? when a subdirectory is given it could be used to resolve multiple hits (bit too fancy though). ? portal: option to prepend prefix to all bookmarks. This would require change of rc format (because of rehashing) ? for a portal, optionally add a bookmark for the portal itself. could do this with a two-argument invocation. # read from $APPARIXRC (to support different file systems / machines) # make a mode (maybe -a) to simply list all matching occurrences without going into the menu if multiple matches. hum ho, that's what grep is for. note that simply 'apparix' lists all the bookmarks. # if no exact match, make menu for strstr occurrences. (e.g. strcmp/strstr callback to attempt_jump) bash tab completion does this nicely. # a 'rename' option. apparix -r foo bar difficult with duplicates: use editor. apparix-11-062/VERSION000066400000000000000000000000071326043744200143200ustar00rootroot0000000000000011-062 apparix-11-062/acinclude.m4000066400000000000000000000352661326043744200154600ustar00rootroot00000000000000 ## va_copy check ## dnl Available from the GNU Autoconf Macro Archive at: dnl http://www.gnu.org/software/ac-archive/htmldoc/acx_pthread.html dnl AC_DEFUN([ACX_PTHREAD], [ AC_REQUIRE([AC_CANONICAL_HOST]) AC_LANG_SAVE AC_LANG_C acx_pthread_ok=no # We used to check for pthread.h first, but this fails if pthread.h # requires special compiler flags (e.g. on True64 or Sequent). # It gets checked for in the link test anyway. # First of all, check if the user has set any of the PTHREAD_LIBS, # etcetera environment variables, and if threads linking works using # them: if test x"$PTHREAD_LIBS$PTHREAD_CFLAGS" != x; then save_CFLAGS="$CFLAGS" CFLAGS="$CFLAGS $PTHREAD_CFLAGS" save_LIBS="$LIBS" LIBS="$PTHREAD_LIBS $LIBS" AC_MSG_CHECKING([for pthread_join in LIBS=$PTHREAD_LIBS with CFLAGS=$PTHREAD_CFLAGS]) AC_TRY_LINK_FUNC(pthread_join, acx_pthread_ok=yes) AC_MSG_RESULT($acx_pthread_ok) if test x"$acx_pthread_ok" = xno; then PTHREAD_LIBS="" PTHREAD_CFLAGS="" fi LIBS="$save_LIBS" CFLAGS="$save_CFLAGS" fi # We must check for the threads library under a number of different # names; the ordering is very important because some systems # (e.g. DEC) have both -lpthread and -lpthreads, where one of the # libraries is broken (non-POSIX). # Create a list of thread flags to try. Items starting with a "-" are # C compiler flags, and other items are library names, except for "none" # which indicates that we try without any flags at all, and "pthread-config" # which is a program returning the flags for the Pth emulation library. acx_pthread_flags="pthreads none -Kthread -kthread lthread -pthread -pthreads -mthreads pthread --thread-safe -mt pthread-config" # The ordering *is* (sometimes) important. Some notes on the # individual items follow: # pthreads: AIX (must check this before -lpthread) # none: in case threads are in libc; should be tried before -Kthread and # other compiler flags to prevent continual compiler warnings # -Kthread: Sequent (threads in libc, but -Kthread needed for pthread.h) # -kthread: FreeBSD kernel threads (preferred to -pthread since SMP-able) # lthread: LinuxThreads port on FreeBSD (also preferred to -pthread) # -pthread: Linux/gcc (kernel threads), BSD/gcc (userland threads) # -pthreads: Solaris/gcc # -mthreads: Mingw32/gcc, Lynx/gcc # -mt: Sun Workshop C (may only link SunOS threads [-lthread], but it # doesn't hurt to check since this sometimes defines pthreads too; # also defines -D_REENTRANT) # pthread: Linux, etcetera # --thread-safe: KAI C++ # pthread-config: use pthread-config program (for GNU Pth library) case "${host_cpu}-${host_os}" in *solaris*) # On Solaris (at least, for some versions), libc contains stubbed # (non-functional) versions of the pthreads routines, so link-based # tests will erroneously succeed. (We need to link with -pthread or # -lpthread.) (The stubs are missing pthread_cleanup_push, or rather # a function called by this macro, so we could check for that, but # who knows whether they'll stub that too in a future libc.) So, # we'll just look for -pthreads and -lpthread first: acx_pthread_flags="-pthread -pthreads pthread -mt $acx_pthread_flags" ;; esac if test x"$acx_pthread_ok" = xno; then for flag in $acx_pthread_flags; do case $flag in none) AC_MSG_CHECKING([whether pthreads work without any flags]) ;; -*) AC_MSG_CHECKING([whether pthreads work with $flag]) PTHREAD_CFLAGS="$flag" ;; pthread-config) AC_CHECK_PROG(acx_pthread_config, pthread-config, yes, no) if test x"$acx_pthread_config" = xno; then continue; fi PTHREAD_CFLAGS="`pthread-config --cflags`" PTHREAD_LIBS="`pthread-config --ldflags` `pthread-config --libs`" ;; *) AC_MSG_CHECKING([for the pthreads library -l$flag]) PTHREAD_LIBS="-l$flag" ;; esac save_LIBS="$LIBS" save_CFLAGS="$CFLAGS" LIBS="$PTHREAD_LIBS $LIBS" CFLAGS="$CFLAGS $PTHREAD_CFLAGS" # Check for various functions. We must include pthread.h, # since some functions may be macros. (On the Sequent, we # need a special flag -Kthread to make this header compile.) # We check for pthread_join because it is in -lpthread on IRIX # while pthread_create is in libc. We check for pthread_attr_init # due to DEC craziness with -lpthreads. We check for # pthread_cleanup_push because it is one of the few pthread # functions on Solaris that doesn't have a non-functional libc stub. # We try pthread_create on general principles. AC_TRY_LINK([#include ], [pthread_t th; pthread_join(th, 0); pthread_attr_init(0); pthread_cleanup_push(0, 0); pthread_create(0,0,0,0); pthread_cleanup_pop(0); ], [acx_pthread_ok=yes]) LIBS="$save_LIBS" CFLAGS="$save_CFLAGS" AC_MSG_RESULT($acx_pthread_ok) if test "x$acx_pthread_ok" = xyes; then break; fi PTHREAD_LIBS="" PTHREAD_CFLAGS="" done fi # Various other checks: if test "x$acx_pthread_ok" = xyes; then save_LIBS="$LIBS" LIBS="$PTHREAD_LIBS $LIBS" save_CFLAGS="$CFLAGS" CFLAGS="$CFLAGS $PTHREAD_CFLAGS" # Detect AIX lossage: threads are created detached by default # and the JOINABLE attribute has a nonstandard name (UNDETACHED). AC_MSG_CHECKING([for joinable pthread attribute]) AC_TRY_LINK([#include ], [int attr=PTHREAD_CREATE_JOINABLE;], ok=PTHREAD_CREATE_JOINABLE, ok=unknown) if test x"$ok" = xunknown; then AC_TRY_LINK([#include ], [int attr=PTHREAD_CREATE_UNDETACHED;], ok=PTHREAD_CREATE_UNDETACHED, ok=unknown) fi if test x"$ok" != xPTHREAD_CREATE_JOINABLE; then AC_DEFINE(PTHREAD_CREATE_JOINABLE, $ok, [Define to the necessary symbol if this constant uses a non-standard name on your system.]) fi AC_MSG_RESULT(${ok}) if test x"$ok" = xunknown; then AC_MSG_WARN([we do not know how to create joinable pthreads]) fi AC_MSG_CHECKING([if more special flags are required for pthreads]) flag=no case "${host_cpu}-${host_os}" in *-aix* | *-freebsd* | *-darwin*) flag="-D_THREAD_SAFE";; *solaris* | *-osf* | *-hpux*) flag="-D_REENTRANT";; esac AC_MSG_RESULT(${flag}) if test "x$flag" != xno; then PTHREAD_CFLAGS="$flag $PTHREAD_CFLAGS" fi LIBS="$save_LIBS" CFLAGS="$save_CFLAGS" # More AIX lossage: must compile with cc_r AC_CHECK_PROG(PTHREAD_CC, cc_r, cc_r, ${CC}) else PTHREAD_CC="$CC" fi AC_SUBST(PTHREAD_LIBS) AC_SUBST(PTHREAD_CFLAGS) AC_SUBST(PTHREAD_CC) # Finally, execute ACTION-IF-FOUND/ACTION-IF-NOT-FOUND: if test x"$acx_pthread_ok" = xyes; then ifelse([$1],,AC_DEFINE(HAVE_PTHREAD,1,[Define if you have POSIX threads libraries and header files.]),[$1]) : else acx_pthread_ok=no $2 fi AC_LANG_RESTORE ])dnl ACX_PTHREAD ## va_copy check ## dnl ## dnl ## NAME: dnl ## AC_CHECK_VA_COPY -- Check for C99 va_copy dnl ## dnl ## COPYRIGHT dnl ## Copyright (c) 2006 Ralf S. Engelschall dnl ## dnl ## DESCRIPTION: dnl ## This macro checks for C99 va_copy() implementation and dnl ## provides fallback implementation if neccessary. Notice: this dnl ## check is rather complex because first because we really have dnl ## to try various possible implementations in sequence and dnl ## second, we cannot define a macro in config.h with parameters dnl ## directly. dnl ## dnl ## USAGE: dnl ## configure.in: dnl ## AC_CHECK_VA_COPY dnl ## foo.c: dnl ## #include "config.h" dnl ## [...] dnl ## va_copy(d,s) dnl ## dnl # test program for va_copy() implementation changequote(<<,>>) m4_define(__va_copy_test, <<[ #include #include #include #define DO_VA_COPY(d, s) $1 void test(char *str, ...) { va_list ap, ap2; int i; va_start(ap, str); DO_VA_COPY(ap2, ap); for (i = 1; i <= 9; i++) { int k = (int)va_arg(ap, int); if (k != i) abort(); } DO_VA_COPY(ap, ap2); for (i = 1; i <= 9; i++) { int k = (int)va_arg(ap, int); if (k != i) abort(); } va_end(ap); } int main(int argc, char *argv[]) { test("test", 1, 2, 3, 4, 5, 6, 7, 8, 9); exit(0); } ]>>) changequote([,]) dnl # test driver for va_copy() implementation m4_define(__va_copy_check, [ AH_VERBATIM($1, [/* Predefined possible va_copy() implementation (id: $1) */ #define __VA_COPY_USE_$1(d, s) $2]) if test ".$ac_cv_va_copy" = .; then AC_TRY_RUN(__va_copy_test($2), [ac_cv_va_copy="$1"]) fi ]) dnl # Autoconf check for va_copy() implementation checking AC_DEFUN([AC_CHECK_VA_COPY],[ dnl # provide Autoconf display check message AC_MSG_CHECKING(for va_copy() function) dnl # check for various implementations in priorized sequence AC_CACHE_VAL(ac_cv_va_copy, [ ac_cv_va_copy="" dnl # 1. check for standardized C99 macro __va_copy_check(C99, [va_copy((d), (s))]) dnl # 2. check for alternative/deprecated GCC macro __va_copy_check(GCM, [VA_COPY((d), (s))]) dnl # 3. check for internal GCC macro (high-level define) __va_copy_check(GCH, [__va_copy((d), (s))]) dnl # 4. check for internal GCC macro (built-in function) __va_copy_check(GCB, [__builtin_va_copy((d), (s))]) dnl # 5. check for assignment approach (assuming va_list is a struct) __va_copy_check(ASS, [do { (d) = (s); } while (0)]) dnl # 6. check for assignment approach (assuming va_list is a pointer) __va_copy_check(ASP, [do { *(d) = *(s); } while (0)]) dnl # 7. check for memory copying approach (assuming va_list is a struct) __va_copy_check(CPS, [memcpy((void *)&(d), (void *)&(s)), sizeof((s))]) dnl # 8. check for memory copying approach (assuming va_list is a pointer) __va_copy_check(CPP, [memcpy((void *)(d), (void *)(s)), sizeof(*(s))]) if test ".$ac_cv_va_copy" = .; then AC_ERROR([no working implementation found]) fi ]) dnl # optionally activate the fallback implementation if test ".$ac_cv_va_copy" = ".C99"; then AC_DEFINE(HAVE_VA_COPY, 1, [Define if va_copy() macro exists (and no fallback implementation is required)]) fi dnl # declare which fallback implementation to actually use AC_DEFINE_UNQUOTED([__VA_COPY_USE], [__VA_COPY_USE_$ac_cv_va_copy], [Define to id of used va_copy() implementation]) dnl # provide activation hook for fallback implementation AH_VERBATIM([__VA_COPY_ACTIVATION], [/* Optional va_copy() implementation activation */ #ifndef HAVE_VA_COPY #define va_copy(d, s) __VA_COPY_USE(d, s) #define HAVE_VA_COPY 1 #endif ]) dnl # provide Autoconf display result message if test ".$ac_cv_va_copy" = ".C99"; then AC_MSG_RESULT([yes]) else AC_MSG_RESULT([no (using fallback implementation)]) fi ]) ## Referenceable va_list ## # http://autoconf-archive.cryp.to/ax_c_referenceable_passed_va_list.html AC_DEFUN([AX_C_REFERENCEABLE_PASSED_VA_LIST], [ AC_CACHE_CHECK([whether f(va_list va){ &va; } works as expected], [ax_cv_c_referenceable_passed_va_list], [AC_LINK_IFELSE([[ #include volatile va_list g_va; void vf(va_list callee_va) { /* typeof(callee_va) differs from typeof(caller_va) by a compiler trick, if * va_list is implemented as an array. On such environment, this copy * operation fails. */ g_va = callee_va; } void f(int last, ...) { va_list caller_va; va_start(caller_va, last); vf(caller_va); /* passed as &caller_va[0] if va_list is an array type */ va_end(caller_va); } int main(int argc, char *argv[]) { f(0xdeadbeef, 0xfedbeef, 0xfeedee); return 0; } ]], [ax_cv_c_referenceable_passed_va_list=yes], [ax_cv_c_referenceable_passed_va_list=no])]) if test "x$ax_cv_c_referenceable_passed_va_list" = xyes; then AC_DEFINE([HAVE_REFERENCEABLE_PASSED_VA_LIST], [1], [Define to 1 if f(va_list va){ &va; } works as expected.]) fi ]) AC_DEFUN([AC_LIB_READLINE], [ AC_CACHE_CHECK([for the readline library], ac_cv_lib_readline, [ ac_cv_lib_readline="no" ORIG_LIBS=$LIBS LIBS="$ORIG_LIBS -lreadline -ltermcap" AC_TRY_LINK_FUNC(readline, ac_cv_lib_readline="yes") if test "$ac_cv_lib_readline" = "no"; then LIBS=$ORIG_LIBS fi ]) enable_readline="no" if test "$ac_cv_lib_readline" = "yes"; then AC_CHECK_HEADERS(readline.h readline/readline.h) AC_CACHE_CHECK([whether readline supports history], ac_cv_lib_readline_history, [ ac_cv_lib_readline_history="no" AC_TRY_LINK_FUNC(add_history, ac_cv_lib_readline_history="yes") ]) if test "$ac_cv_lib_readline_history" = "yes"; then AC_CHECK_HEADERS(history.h readline/history.h) AC_CACHE_CHECK([whether readline supports completion], ac_cv_lib_readline_completion, [ ac_cv_lib_readline_completion="no" AC_TRY_LINK_FUNC(rl_completion_matches, ac_cv_lib_readline_completion="yes") ]) if test "$ac_cv_lib_readline_completion" = "yes"; then enable_readline="yes" fi fi else AC_MSG_RESULT([readline or termcap library is missing]) fi ]) AC_DEFUN([AC_WITH_READLINE], [ AC_ARG_WITH(readline, [ --with-readline=DIR Readline installation directory], with_readline=$withval) if test "$with_readline" != ""; then CPPFLAGS="-I$with_readline/include $CPPFLAGS" LIBS="-L$with_readline/lib $LIBS" fi ]) AC_DEFUN([AC_MMX_OPTION_READLINE], [ AC_ARG_ENABLE(readline, AC_HELP_STRING( [--enable-readline], [use the readline library [[yes]]]), [], [enable_readline="yes"]) if test "$enable_readline" = "yes"; then AC_WITH_READLINE AC_LIB_READLINE fi if test "$enable_readline" = "no"; then AC_MSG_RESULT([disabling readline]) AC_DEFINE(HAVE_READLINE, 0, [Define if you have the readline library]) else AC_MSG_RESULT([enabling readline]) AC_DEFINE(HAVE_READLINE, 1, [Define if you have the readline library]) fi AM_CONDITIONAL([READLINE_OPT], [test "$enable_readline" = "yes"]) ]) apparix-11-062/aclocal.m4000066400000000000000000001077101326043744200151210ustar00rootroot00000000000000# generated automatically by aclocal 1.11 -*- Autoconf -*- # Copyright (C) 1996, 1997, 1998, 1999, 2000, 2001, 2002, 2003, 2004, # 2005, 2006, 2007, 2008, 2009 Free Software Foundation, Inc. # This file is free software; the Free Software Foundation # gives unlimited permission to copy and/or distribute it, # with or without modifications, as long as this notice is preserved. # This program is distributed in the hope that it will be useful, # but WITHOUT ANY WARRANTY, to the extent permitted by law; without # even the implied warranty of MERCHANTABILITY or FITNESS FOR A # PARTICULAR PURPOSE. m4_ifndef([AC_AUTOCONF_VERSION], [m4_copy([m4_PACKAGE_VERSION], [AC_AUTOCONF_VERSION])])dnl m4_if(m4_defn([AC_AUTOCONF_VERSION]), [2.65],, [m4_warning([this file was generated for autoconf 2.65. You have another version of autoconf. It may work, but is not guaranteed to. If you have problems, you may need to regenerate the build system entirely. To do so, use the procedure documented by the package, typically `autoreconf'.])]) # Copyright (C) 2002, 2003, 2005, 2006, 2007, 2008 Free Software Foundation, Inc. # # This file is free software; the Free Software Foundation # gives unlimited permission to copy and/or distribute it, # with or without modifications, as long as this notice is preserved. # AM_AUTOMAKE_VERSION(VERSION) # ---------------------------- # Automake X.Y traces this macro to ensure aclocal.m4 has been # generated from the m4 files accompanying Automake X.Y. # (This private macro should not be called outside this file.) AC_DEFUN([AM_AUTOMAKE_VERSION], [am__api_version='1.11' dnl Some users find AM_AUTOMAKE_VERSION and mistake it for a way to dnl require some minimum version. Point them to the right macro. m4_if([$1], [1.11], [], [AC_FATAL([Do not call $0, use AM_INIT_AUTOMAKE([$1]).])])dnl ]) # _AM_AUTOCONF_VERSION(VERSION) # ----------------------------- # aclocal traces this macro to find the Autoconf version. # This is a private macro too. Using m4_define simplifies # the logic in aclocal, which can simply ignore this definition. m4_define([_AM_AUTOCONF_VERSION], []) # AM_SET_CURRENT_AUTOMAKE_VERSION # ------------------------------- # Call AM_AUTOMAKE_VERSION and AM_AUTOMAKE_VERSION so they can be traced. # This function is AC_REQUIREd by AM_INIT_AUTOMAKE. AC_DEFUN([AM_SET_CURRENT_AUTOMAKE_VERSION], [AM_AUTOMAKE_VERSION([1.11])dnl m4_ifndef([AC_AUTOCONF_VERSION], [m4_copy([m4_PACKAGE_VERSION], [AC_AUTOCONF_VERSION])])dnl _AM_AUTOCONF_VERSION(m4_defn([AC_AUTOCONF_VERSION]))]) # AM_AUX_DIR_EXPAND -*- Autoconf -*- # Copyright (C) 2001, 2003, 2005 Free Software Foundation, Inc. # # This file is free software; the Free Software Foundation # gives unlimited permission to copy and/or distribute it, # with or without modifications, as long as this notice is preserved. # For projects using AC_CONFIG_AUX_DIR([foo]), Autoconf sets # $ac_aux_dir to `$srcdir/foo'. In other projects, it is set to # `$srcdir', `$srcdir/..', or `$srcdir/../..'. # # Of course, Automake must honor this variable whenever it calls a # tool from the auxiliary directory. The problem is that $srcdir (and # therefore $ac_aux_dir as well) can be either absolute or relative, # depending on how configure is run. This is pretty annoying, since # it makes $ac_aux_dir quite unusable in subdirectories: in the top # source directory, any form will work fine, but in subdirectories a # relative path needs to be adjusted first. # # $ac_aux_dir/missing # fails when called from a subdirectory if $ac_aux_dir is relative # $top_srcdir/$ac_aux_dir/missing # fails if $ac_aux_dir is absolute, # fails when called from a subdirectory in a VPATH build with # a relative $ac_aux_dir # # The reason of the latter failure is that $top_srcdir and $ac_aux_dir # are both prefixed by $srcdir. In an in-source build this is usually # harmless because $srcdir is `.', but things will broke when you # start a VPATH build or use an absolute $srcdir. # # So we could use something similar to $top_srcdir/$ac_aux_dir/missing, # iff we strip the leading $srcdir from $ac_aux_dir. That would be: # am_aux_dir='\$(top_srcdir)/'`expr "$ac_aux_dir" : "$srcdir//*\(.*\)"` # and then we would define $MISSING as # MISSING="\${SHELL} $am_aux_dir/missing" # This will work as long as MISSING is not called from configure, because # unfortunately $(top_srcdir) has no meaning in configure. # However there are other variables, like CC, which are often used in # configure, and could therefore not use this "fixed" $ac_aux_dir. # # Another solution, used here, is to always expand $ac_aux_dir to an # absolute PATH. The drawback is that using absolute paths prevent a # configured tree to be moved without reconfiguration. AC_DEFUN([AM_AUX_DIR_EXPAND], [dnl Rely on autoconf to set up CDPATH properly. AC_PREREQ([2.50])dnl # expand $ac_aux_dir to an absolute path am_aux_dir=`cd $ac_aux_dir && pwd` ]) # AM_CONDITIONAL -*- Autoconf -*- # Copyright (C) 1997, 2000, 2001, 2003, 2004, 2005, 2006, 2008 # Free Software Foundation, Inc. # # This file is free software; the Free Software Foundation # gives unlimited permission to copy and/or distribute it, # with or without modifications, as long as this notice is preserved. # serial 9 # AM_CONDITIONAL(NAME, SHELL-CONDITION) # ------------------------------------- # Define a conditional. AC_DEFUN([AM_CONDITIONAL], [AC_PREREQ(2.52)dnl ifelse([$1], [TRUE], [AC_FATAL([$0: invalid condition: $1])], [$1], [FALSE], [AC_FATAL([$0: invalid condition: $1])])dnl AC_SUBST([$1_TRUE])dnl AC_SUBST([$1_FALSE])dnl _AM_SUBST_NOTMAKE([$1_TRUE])dnl _AM_SUBST_NOTMAKE([$1_FALSE])dnl m4_define([_AM_COND_VALUE_$1], [$2])dnl if $2; then $1_TRUE= $1_FALSE='#' else $1_TRUE='#' $1_FALSE= fi AC_CONFIG_COMMANDS_PRE( [if test -z "${$1_TRUE}" && test -z "${$1_FALSE}"; then AC_MSG_ERROR([[conditional "$1" was never defined. Usually this means the macro was only invoked conditionally.]]) fi])]) # Copyright (C) 1999, 2000, 2001, 2002, 2003, 2004, 2005, 2006, 2009 # Free Software Foundation, Inc. # # This file is free software; the Free Software Foundation # gives unlimited permission to copy and/or distribute it, # with or without modifications, as long as this notice is preserved. # serial 10 # There are a few dirty hacks below to avoid letting `AC_PROG_CC' be # written in clear, in which case automake, when reading aclocal.m4, # will think it sees a *use*, and therefore will trigger all it's # C support machinery. Also note that it means that autoscan, seeing # CC etc. in the Makefile, will ask for an AC_PROG_CC use... # _AM_DEPENDENCIES(NAME) # ---------------------- # See how the compiler implements dependency checking. # NAME is "CC", "CXX", "GCJ", or "OBJC". # We try a few techniques and use that to set a single cache variable. # # We don't AC_REQUIRE the corresponding AC_PROG_CC since the latter was # modified to invoke _AM_DEPENDENCIES(CC); we would have a circular # dependency, and given that the user is not expected to run this macro, # just rely on AC_PROG_CC. AC_DEFUN([_AM_DEPENDENCIES], [AC_REQUIRE([AM_SET_DEPDIR])dnl AC_REQUIRE([AM_OUTPUT_DEPENDENCY_COMMANDS])dnl AC_REQUIRE([AM_MAKE_INCLUDE])dnl AC_REQUIRE([AM_DEP_TRACK])dnl ifelse([$1], CC, [depcc="$CC" am_compiler_list=], [$1], CXX, [depcc="$CXX" am_compiler_list=], [$1], OBJC, [depcc="$OBJC" am_compiler_list='gcc3 gcc'], [$1], UPC, [depcc="$UPC" am_compiler_list=], [$1], GCJ, [depcc="$GCJ" am_compiler_list='gcc3 gcc'], [depcc="$$1" am_compiler_list=]) AC_CACHE_CHECK([dependency style of $depcc], [am_cv_$1_dependencies_compiler_type], [if test -z "$AMDEP_TRUE" && test -f "$am_depcomp"; then # We make a subdir and do the tests there. Otherwise we can end up # making bogus files that we don't know about and never remove. For # instance it was reported that on HP-UX the gcc test will end up # making a dummy file named `D' -- because `-MD' means `put the output # in D'. mkdir conftest.dir # Copy depcomp to subdir because otherwise we won't find it if we're # using a relative directory. cp "$am_depcomp" conftest.dir cd conftest.dir # We will build objects and dependencies in a subdirectory because # it helps to detect inapplicable dependency modes. For instance # both Tru64's cc and ICC support -MD to output dependencies as a # side effect of compilation, but ICC will put the dependencies in # the current directory while Tru64 will put them in the object # directory. mkdir sub am_cv_$1_dependencies_compiler_type=none if test "$am_compiler_list" = ""; then am_compiler_list=`sed -n ['s/^#*\([a-zA-Z0-9]*\))$/\1/p'] < ./depcomp` fi am__universal=false m4_case([$1], [CC], [case " $depcc " in #( *\ -arch\ *\ -arch\ *) am__universal=true ;; esac], [CXX], [case " $depcc " in #( *\ -arch\ *\ -arch\ *) am__universal=true ;; esac]) for depmode in $am_compiler_list; do # Setup a source with many dependencies, because some compilers # like to wrap large dependency lists on column 80 (with \), and # we should not choose a depcomp mode which is confused by this. # # We need to recreate these files for each test, as the compiler may # overwrite some of them when testing with obscure command lines. # This happens at least with the AIX C compiler. : > sub/conftest.c for i in 1 2 3 4 5 6; do echo '#include "conftst'$i'.h"' >> sub/conftest.c # Using `: > sub/conftst$i.h' creates only sub/conftst1.h with # Solaris 8's {/usr,}/bin/sh. touch sub/conftst$i.h done echo "${am__include} ${am__quote}sub/conftest.Po${am__quote}" > confmf # We check with `-c' and `-o' for the sake of the "dashmstdout" # mode. It turns out that the SunPro C++ compiler does not properly # handle `-M -o', and we need to detect this. Also, some Intel # versions had trouble with output in subdirs am__obj=sub/conftest.${OBJEXT-o} am__minus_obj="-o $am__obj" case $depmode in gcc) # This depmode causes a compiler race in universal mode. test "$am__universal" = false || continue ;; nosideeffect) # after this tag, mechanisms are not by side-effect, so they'll # only be used when explicitly requested if test "x$enable_dependency_tracking" = xyes; then continue else break fi ;; msvisualcpp | msvcmsys) # This compiler won't grok `-c -o', but also, the minuso test has # not run yet. These depmodes are late enough in the game, and # so weak that their functioning should not be impacted. am__obj=conftest.${OBJEXT-o} am__minus_obj= ;; none) break ;; esac if depmode=$depmode \ source=sub/conftest.c object=$am__obj \ depfile=sub/conftest.Po tmpdepfile=sub/conftest.TPo \ $SHELL ./depcomp $depcc -c $am__minus_obj sub/conftest.c \ >/dev/null 2>conftest.err && grep sub/conftst1.h sub/conftest.Po > /dev/null 2>&1 && grep sub/conftst6.h sub/conftest.Po > /dev/null 2>&1 && grep $am__obj sub/conftest.Po > /dev/null 2>&1 && ${MAKE-make} -s -f confmf > /dev/null 2>&1; then # icc doesn't choke on unknown options, it will just issue warnings # or remarks (even with -Werror). So we grep stderr for any message # that says an option was ignored or not supported. # When given -MP, icc 7.0 and 7.1 complain thusly: # icc: Command line warning: ignoring option '-M'; no argument required # The diagnosis changed in icc 8.0: # icc: Command line remark: option '-MP' not supported if (grep 'ignoring option' conftest.err || grep 'not supported' conftest.err) >/dev/null 2>&1; then :; else am_cv_$1_dependencies_compiler_type=$depmode break fi fi done cd .. rm -rf conftest.dir else am_cv_$1_dependencies_compiler_type=none fi ]) AC_SUBST([$1DEPMODE], [depmode=$am_cv_$1_dependencies_compiler_type]) AM_CONDITIONAL([am__fastdep$1], [ test "x$enable_dependency_tracking" != xno \ && test "$am_cv_$1_dependencies_compiler_type" = gcc3]) ]) # AM_SET_DEPDIR # ------------- # Choose a directory name for dependency files. # This macro is AC_REQUIREd in _AM_DEPENDENCIES AC_DEFUN([AM_SET_DEPDIR], [AC_REQUIRE([AM_SET_LEADING_DOT])dnl AC_SUBST([DEPDIR], ["${am__leading_dot}deps"])dnl ]) # AM_DEP_TRACK # ------------ AC_DEFUN([AM_DEP_TRACK], [AC_ARG_ENABLE(dependency-tracking, [ --disable-dependency-tracking speeds up one-time build --enable-dependency-tracking do not reject slow dependency extractors]) if test "x$enable_dependency_tracking" != xno; then am_depcomp="$ac_aux_dir/depcomp" AMDEPBACKSLASH='\' fi AM_CONDITIONAL([AMDEP], [test "x$enable_dependency_tracking" != xno]) AC_SUBST([AMDEPBACKSLASH])dnl _AM_SUBST_NOTMAKE([AMDEPBACKSLASH])dnl ]) # Generate code to set up dependency tracking. -*- Autoconf -*- # Copyright (C) 1999, 2000, 2001, 2002, 2003, 2004, 2005, 2008 # Free Software Foundation, Inc. # # This file is free software; the Free Software Foundation # gives unlimited permission to copy and/or distribute it, # with or without modifications, as long as this notice is preserved. #serial 5 # _AM_OUTPUT_DEPENDENCY_COMMANDS # ------------------------------ AC_DEFUN([_AM_OUTPUT_DEPENDENCY_COMMANDS], [{ # Autoconf 2.62 quotes --file arguments for eval, but not when files # are listed without --file. Let's play safe and only enable the eval # if we detect the quoting. case $CONFIG_FILES in *\'*) eval set x "$CONFIG_FILES" ;; *) set x $CONFIG_FILES ;; esac shift for mf do # Strip MF so we end up with the name of the file. mf=`echo "$mf" | sed -e 's/:.*$//'` # Check whether this is an Automake generated Makefile or not. # We used to match only the files named `Makefile.in', but # some people rename them; so instead we look at the file content. # Grep'ing the first line is not enough: some people post-process # each Makefile.in and add a new line on top of each file to say so. # Grep'ing the whole file is not good either: AIX grep has a line # limit of 2048, but all sed's we know have understand at least 4000. if sed -n 's,^#.*generated by automake.*,X,p' "$mf" | grep X >/dev/null 2>&1; then dirpart=`AS_DIRNAME("$mf")` else continue fi # Extract the definition of DEPDIR, am__include, and am__quote # from the Makefile without running `make'. DEPDIR=`sed -n 's/^DEPDIR = //p' < "$mf"` test -z "$DEPDIR" && continue am__include=`sed -n 's/^am__include = //p' < "$mf"` test -z "am__include" && continue am__quote=`sed -n 's/^am__quote = //p' < "$mf"` # When using ansi2knr, U may be empty or an underscore; expand it U=`sed -n 's/^U = //p' < "$mf"` # Find all dependency output files, they are included files with # $(DEPDIR) in their names. We invoke sed twice because it is the # simplest approach to changing $(DEPDIR) to its actual value in the # expansion. for file in `sed -n " s/^$am__include $am__quote\(.*(DEPDIR).*\)$am__quote"'$/\1/p' <"$mf" | \ sed -e 's/\$(DEPDIR)/'"$DEPDIR"'/g' -e 's/\$U/'"$U"'/g'`; do # Make sure the directory exists. test -f "$dirpart/$file" && continue fdir=`AS_DIRNAME(["$file"])` AS_MKDIR_P([$dirpart/$fdir]) # echo "creating $dirpart/$file" echo '# dummy' > "$dirpart/$file" done done } ])# _AM_OUTPUT_DEPENDENCY_COMMANDS # AM_OUTPUT_DEPENDENCY_COMMANDS # ----------------------------- # This macro should only be invoked once -- use via AC_REQUIRE. # # This code is only required when automatic dependency tracking # is enabled. FIXME. This creates each `.P' file that we will # need in order to bootstrap the dependency handling code. AC_DEFUN([AM_OUTPUT_DEPENDENCY_COMMANDS], [AC_CONFIG_COMMANDS([depfiles], [test x"$AMDEP_TRUE" != x"" || _AM_OUTPUT_DEPENDENCY_COMMANDS], [AMDEP_TRUE="$AMDEP_TRUE" ac_aux_dir="$ac_aux_dir"]) ]) # Copyright (C) 1996, 1997, 2000, 2001, 2003, 2005 # Free Software Foundation, Inc. # # This file is free software; the Free Software Foundation # gives unlimited permission to copy and/or distribute it, # with or without modifications, as long as this notice is preserved. # serial 8 # AM_CONFIG_HEADER is obsolete. It has been replaced by AC_CONFIG_HEADERS. AU_DEFUN([AM_CONFIG_HEADER], [AC_CONFIG_HEADERS($@)]) # Do all the work for Automake. -*- Autoconf -*- # Copyright (C) 1996, 1997, 1998, 1999, 2000, 2001, 2002, 2003, 2004, # 2005, 2006, 2008, 2009 Free Software Foundation, Inc. # # This file is free software; the Free Software Foundation # gives unlimited permission to copy and/or distribute it, # with or without modifications, as long as this notice is preserved. # serial 16 # This macro actually does too much. Some checks are only needed if # your package does certain things. But this isn't really a big deal. # AM_INIT_AUTOMAKE(PACKAGE, VERSION, [NO-DEFINE]) # AM_INIT_AUTOMAKE([OPTIONS]) # ----------------------------------------------- # The call with PACKAGE and VERSION arguments is the old style # call (pre autoconf-2.50), which is being phased out. PACKAGE # and VERSION should now be passed to AC_INIT and removed from # the call to AM_INIT_AUTOMAKE. # We support both call styles for the transition. After # the next Automake release, Autoconf can make the AC_INIT # arguments mandatory, and then we can depend on a new Autoconf # release and drop the old call support. AC_DEFUN([AM_INIT_AUTOMAKE], [AC_PREREQ([2.62])dnl dnl Autoconf wants to disallow AM_ names. We explicitly allow dnl the ones we care about. m4_pattern_allow([^AM_[A-Z]+FLAGS$])dnl AC_REQUIRE([AM_SET_CURRENT_AUTOMAKE_VERSION])dnl AC_REQUIRE([AC_PROG_INSTALL])dnl if test "`cd $srcdir && pwd`" != "`pwd`"; then # Use -I$(srcdir) only when $(srcdir) != ., so that make's output # is not polluted with repeated "-I." AC_SUBST([am__isrc], [' -I$(srcdir)'])_AM_SUBST_NOTMAKE([am__isrc])dnl # test to see if srcdir already configured if test -f $srcdir/config.status; then AC_MSG_ERROR([source directory already configured; run "make distclean" there first]) fi fi # test whether we have cygpath if test -z "$CYGPATH_W"; then if (cygpath --version) >/dev/null 2>/dev/null; then CYGPATH_W='cygpath -w' else CYGPATH_W=echo fi fi AC_SUBST([CYGPATH_W]) # Define the identity of the package. dnl Distinguish between old-style and new-style calls. m4_ifval([$2], [m4_ifval([$3], [_AM_SET_OPTION([no-define])])dnl AC_SUBST([PACKAGE], [$1])dnl AC_SUBST([VERSION], [$2])], [_AM_SET_OPTIONS([$1])dnl dnl Diagnose old-style AC_INIT with new-style AM_AUTOMAKE_INIT. m4_if(m4_ifdef([AC_PACKAGE_NAME], 1)m4_ifdef([AC_PACKAGE_VERSION], 1), 11,, [m4_fatal([AC_INIT should be called with package and version arguments])])dnl AC_SUBST([PACKAGE], ['AC_PACKAGE_TARNAME'])dnl AC_SUBST([VERSION], ['AC_PACKAGE_VERSION'])])dnl _AM_IF_OPTION([no-define],, [AC_DEFINE_UNQUOTED(PACKAGE, "$PACKAGE", [Name of package]) AC_DEFINE_UNQUOTED(VERSION, "$VERSION", [Version number of package])])dnl # Some tools Automake needs. AC_REQUIRE([AM_SANITY_CHECK])dnl AC_REQUIRE([AC_ARG_PROGRAM])dnl AM_MISSING_PROG(ACLOCAL, aclocal-${am__api_version}) AM_MISSING_PROG(AUTOCONF, autoconf) AM_MISSING_PROG(AUTOMAKE, automake-${am__api_version}) AM_MISSING_PROG(AUTOHEADER, autoheader) AM_MISSING_PROG(MAKEINFO, makeinfo) AC_REQUIRE([AM_PROG_INSTALL_SH])dnl AC_REQUIRE([AM_PROG_INSTALL_STRIP])dnl AC_REQUIRE([AM_PROG_MKDIR_P])dnl # We need awk for the "check" target. The system "awk" is bad on # some platforms. AC_REQUIRE([AC_PROG_AWK])dnl AC_REQUIRE([AC_PROG_MAKE_SET])dnl AC_REQUIRE([AM_SET_LEADING_DOT])dnl _AM_IF_OPTION([tar-ustar], [_AM_PROG_TAR([ustar])], [_AM_IF_OPTION([tar-pax], [_AM_PROG_TAR([pax])], [_AM_PROG_TAR([v7])])]) _AM_IF_OPTION([no-dependencies],, [AC_PROVIDE_IFELSE([AC_PROG_CC], [_AM_DEPENDENCIES(CC)], [define([AC_PROG_CC], defn([AC_PROG_CC])[_AM_DEPENDENCIES(CC)])])dnl AC_PROVIDE_IFELSE([AC_PROG_CXX], [_AM_DEPENDENCIES(CXX)], [define([AC_PROG_CXX], defn([AC_PROG_CXX])[_AM_DEPENDENCIES(CXX)])])dnl AC_PROVIDE_IFELSE([AC_PROG_OBJC], [_AM_DEPENDENCIES(OBJC)], [define([AC_PROG_OBJC], defn([AC_PROG_OBJC])[_AM_DEPENDENCIES(OBJC)])])dnl ]) _AM_IF_OPTION([silent-rules], [AC_REQUIRE([AM_SILENT_RULES])])dnl dnl The `parallel-tests' driver may need to know about EXEEXT, so add the dnl `am__EXEEXT' conditional if _AM_COMPILER_EXEEXT was seen. This macro dnl is hooked onto _AC_COMPILER_EXEEXT early, see below. AC_CONFIG_COMMANDS_PRE(dnl [m4_provide_if([_AM_COMPILER_EXEEXT], [AM_CONDITIONAL([am__EXEEXT], [test -n "$EXEEXT"])])])dnl ]) dnl Hook into `_AC_COMPILER_EXEEXT' early to learn its expansion. Do not dnl add the conditional right here, as _AC_COMPILER_EXEEXT may be further dnl mangled by Autoconf and run in a shell conditional statement. m4_define([_AC_COMPILER_EXEEXT], m4_defn([_AC_COMPILER_EXEEXT])[m4_provide([_AM_COMPILER_EXEEXT])]) # When config.status generates a header, we must update the stamp-h file. # This file resides in the same directory as the config header # that is generated. The stamp files are numbered to have different names. # Autoconf calls _AC_AM_CONFIG_HEADER_HOOK (when defined) in the # loop where config.status creates the headers, so we can generate # our stamp files there. AC_DEFUN([_AC_AM_CONFIG_HEADER_HOOK], [# Compute $1's index in $config_headers. _am_arg=$1 _am_stamp_count=1 for _am_header in $config_headers :; do case $_am_header in $_am_arg | $_am_arg:* ) break ;; * ) _am_stamp_count=`expr $_am_stamp_count + 1` ;; esac done echo "timestamp for $_am_arg" >`AS_DIRNAME(["$_am_arg"])`/stamp-h[]$_am_stamp_count]) # Copyright (C) 2001, 2003, 2005, 2008 Free Software Foundation, Inc. # # This file is free software; the Free Software Foundation # gives unlimited permission to copy and/or distribute it, # with or without modifications, as long as this notice is preserved. # AM_PROG_INSTALL_SH # ------------------ # Define $install_sh. AC_DEFUN([AM_PROG_INSTALL_SH], [AC_REQUIRE([AM_AUX_DIR_EXPAND])dnl if test x"${install_sh}" != xset; then case $am_aux_dir in *\ * | *\ *) install_sh="\${SHELL} '$am_aux_dir/install-sh'" ;; *) install_sh="\${SHELL} $am_aux_dir/install-sh" esac fi AC_SUBST(install_sh)]) # Copyright (C) 2003, 2005 Free Software Foundation, Inc. # # This file is free software; the Free Software Foundation # gives unlimited permission to copy and/or distribute it, # with or without modifications, as long as this notice is preserved. # serial 2 # Check whether the underlying file-system supports filenames # with a leading dot. For instance MS-DOS doesn't. AC_DEFUN([AM_SET_LEADING_DOT], [rm -rf .tst 2>/dev/null mkdir .tst 2>/dev/null if test -d .tst; then am__leading_dot=. else am__leading_dot=_ fi rmdir .tst 2>/dev/null AC_SUBST([am__leading_dot])]) # Add --enable-maintainer-mode option to configure. -*- Autoconf -*- # From Jim Meyering # Copyright (C) 1996, 1998, 2000, 2001, 2002, 2003, 2004, 2005, 2008 # Free Software Foundation, Inc. # # This file is free software; the Free Software Foundation # gives unlimited permission to copy and/or distribute it, # with or without modifications, as long as this notice is preserved. # serial 5 # AM_MAINTAINER_MODE([DEFAULT-MODE]) # ---------------------------------- # Control maintainer-specific portions of Makefiles. # Default is to disable them, unless `enable' is passed literally. # For symmetry, `disable' may be passed as well. Anyway, the user # can override the default with the --enable/--disable switch. AC_DEFUN([AM_MAINTAINER_MODE], [m4_case(m4_default([$1], [disable]), [enable], [m4_define([am_maintainer_other], [disable])], [disable], [m4_define([am_maintainer_other], [enable])], [m4_define([am_maintainer_other], [enable]) m4_warn([syntax], [unexpected argument to AM@&t@_MAINTAINER_MODE: $1])]) AC_MSG_CHECKING([whether to am_maintainer_other maintainer-specific portions of Makefiles]) dnl maintainer-mode's default is 'disable' unless 'enable' is passed AC_ARG_ENABLE([maintainer-mode], [ --][am_maintainer_other][-maintainer-mode am_maintainer_other make rules and dependencies not useful (and sometimes confusing) to the casual installer], [USE_MAINTAINER_MODE=$enableval], [USE_MAINTAINER_MODE=]m4_if(am_maintainer_other, [enable], [no], [yes])) AC_MSG_RESULT([$USE_MAINTAINER_MODE]) AM_CONDITIONAL([MAINTAINER_MODE], [test $USE_MAINTAINER_MODE = yes]) MAINT=$MAINTAINER_MODE_TRUE AC_SUBST([MAINT])dnl ] ) AU_DEFUN([jm_MAINTAINER_MODE], [AM_MAINTAINER_MODE]) # Check to see how 'make' treats includes. -*- Autoconf -*- # Copyright (C) 2001, 2002, 2003, 2005, 2009 Free Software Foundation, Inc. # # This file is free software; the Free Software Foundation # gives unlimited permission to copy and/or distribute it, # with or without modifications, as long as this notice is preserved. # serial 4 # AM_MAKE_INCLUDE() # ----------------- # Check to see how make treats includes. AC_DEFUN([AM_MAKE_INCLUDE], [am_make=${MAKE-make} cat > confinc << 'END' am__doit: @echo this is the am__doit target .PHONY: am__doit END # If we don't find an include directive, just comment out the code. AC_MSG_CHECKING([for style of include used by $am_make]) am__include="#" am__quote= _am_result=none # First try GNU make style include. echo "include confinc" > confmf # Ignore all kinds of additional output from `make'. case `$am_make -s -f confmf 2> /dev/null` in #( *the\ am__doit\ target*) am__include=include am__quote= _am_result=GNU ;; esac # Now try BSD make style include. if test "$am__include" = "#"; then echo '.include "confinc"' > confmf case `$am_make -s -f confmf 2> /dev/null` in #( *the\ am__doit\ target*) am__include=.include am__quote="\"" _am_result=BSD ;; esac fi AC_SUBST([am__include]) AC_SUBST([am__quote]) AC_MSG_RESULT([$_am_result]) rm -f confinc confmf ]) # Fake the existence of programs that GNU maintainers use. -*- Autoconf -*- # Copyright (C) 1997, 1999, 2000, 2001, 2003, 2004, 2005, 2008 # Free Software Foundation, Inc. # # This file is free software; the Free Software Foundation # gives unlimited permission to copy and/or distribute it, # with or without modifications, as long as this notice is preserved. # serial 6 # AM_MISSING_PROG(NAME, PROGRAM) # ------------------------------ AC_DEFUN([AM_MISSING_PROG], [AC_REQUIRE([AM_MISSING_HAS_RUN]) $1=${$1-"${am_missing_run}$2"} AC_SUBST($1)]) # AM_MISSING_HAS_RUN # ------------------ # Define MISSING if not defined so far and test if it supports --run. # If it does, set am_missing_run to use it, otherwise, to nothing. AC_DEFUN([AM_MISSING_HAS_RUN], [AC_REQUIRE([AM_AUX_DIR_EXPAND])dnl AC_REQUIRE_AUX_FILE([missing])dnl if test x"${MISSING+set}" != xset; then case $am_aux_dir in *\ * | *\ *) MISSING="\${SHELL} \"$am_aux_dir/missing\"" ;; *) MISSING="\${SHELL} $am_aux_dir/missing" ;; esac fi # Use eval to expand $SHELL if eval "$MISSING --run true"; then am_missing_run="$MISSING --run " else am_missing_run= AC_MSG_WARN([`missing' script is too old or missing]) fi ]) # Copyright (C) 2003, 2004, 2005, 2006 Free Software Foundation, Inc. # # This file is free software; the Free Software Foundation # gives unlimited permission to copy and/or distribute it, # with or without modifications, as long as this notice is preserved. # AM_PROG_MKDIR_P # --------------- # Check for `mkdir -p'. AC_DEFUN([AM_PROG_MKDIR_P], [AC_PREREQ([2.60])dnl AC_REQUIRE([AC_PROG_MKDIR_P])dnl dnl Automake 1.8 to 1.9.6 used to define mkdir_p. We now use MKDIR_P, dnl while keeping a definition of mkdir_p for backward compatibility. dnl @MKDIR_P@ is magic: AC_OUTPUT adjusts its value for each Makefile. dnl However we cannot define mkdir_p as $(MKDIR_P) for the sake of dnl Makefile.ins that do not define MKDIR_P, so we do our own dnl adjustment using top_builddir (which is defined more often than dnl MKDIR_P). AC_SUBST([mkdir_p], ["$MKDIR_P"])dnl case $mkdir_p in [[\\/$]]* | ?:[[\\/]]*) ;; */*) mkdir_p="\$(top_builddir)/$mkdir_p" ;; esac ]) # Helper functions for option handling. -*- Autoconf -*- # Copyright (C) 2001, 2002, 2003, 2005, 2008 Free Software Foundation, Inc. # # This file is free software; the Free Software Foundation # gives unlimited permission to copy and/or distribute it, # with or without modifications, as long as this notice is preserved. # serial 4 # _AM_MANGLE_OPTION(NAME) # ----------------------- AC_DEFUN([_AM_MANGLE_OPTION], [[_AM_OPTION_]m4_bpatsubst($1, [[^a-zA-Z0-9_]], [_])]) # _AM_SET_OPTION(NAME) # ------------------------------ # Set option NAME. Presently that only means defining a flag for this option. AC_DEFUN([_AM_SET_OPTION], [m4_define(_AM_MANGLE_OPTION([$1]), 1)]) # _AM_SET_OPTIONS(OPTIONS) # ---------------------------------- # OPTIONS is a space-separated list of Automake options. AC_DEFUN([_AM_SET_OPTIONS], [m4_foreach_w([_AM_Option], [$1], [_AM_SET_OPTION(_AM_Option)])]) # _AM_IF_OPTION(OPTION, IF-SET, [IF-NOT-SET]) # ------------------------------------------- # Execute IF-SET if OPTION is set, IF-NOT-SET otherwise. AC_DEFUN([_AM_IF_OPTION], [m4_ifset(_AM_MANGLE_OPTION([$1]), [$2], [$3])]) # Check to make sure that the build environment is sane. -*- Autoconf -*- # Copyright (C) 1996, 1997, 2000, 2001, 2003, 2005, 2008 # Free Software Foundation, Inc. # # This file is free software; the Free Software Foundation # gives unlimited permission to copy and/or distribute it, # with or without modifications, as long as this notice is preserved. # serial 5 # AM_SANITY_CHECK # --------------- AC_DEFUN([AM_SANITY_CHECK], [AC_MSG_CHECKING([whether build environment is sane]) # Just in case sleep 1 echo timestamp > conftest.file # Reject unsafe characters in $srcdir or the absolute working directory # name. Accept space and tab only in the latter. am_lf=' ' case `pwd` in *[[\\\"\#\$\&\'\`$am_lf]]*) AC_MSG_ERROR([unsafe absolute working directory name]);; esac case $srcdir in *[[\\\"\#\$\&\'\`$am_lf\ \ ]]*) AC_MSG_ERROR([unsafe srcdir value: `$srcdir']);; esac # Do `set' in a subshell so we don't clobber the current shell's # arguments. Must try -L first in case configure is actually a # symlink; some systems play weird games with the mod time of symlinks # (eg FreeBSD returns the mod time of the symlink's containing # directory). if ( set X `ls -Lt "$srcdir/configure" conftest.file 2> /dev/null` if test "$[*]" = "X"; then # -L didn't work. set X `ls -t "$srcdir/configure" conftest.file` fi rm -f conftest.file if test "$[*]" != "X $srcdir/configure conftest.file" \ && test "$[*]" != "X conftest.file $srcdir/configure"; then # If neither matched, then we have a broken ls. This can happen # if, for instance, CONFIG_SHELL is bash and it inherits a # broken ls alias from the environment. This has actually # happened. Such a system could not be considered "sane". AC_MSG_ERROR([ls -t appears to fail. Make sure there is not a broken alias in your environment]) fi test "$[2]" = conftest.file ) then # Ok. : else AC_MSG_ERROR([newly created file is older than distributed files! Check your system clock]) fi AC_MSG_RESULT(yes)]) # Copyright (C) 2001, 2003, 2005 Free Software Foundation, Inc. # # This file is free software; the Free Software Foundation # gives unlimited permission to copy and/or distribute it, # with or without modifications, as long as this notice is preserved. # AM_PROG_INSTALL_STRIP # --------------------- # One issue with vendor `install' (even GNU) is that you can't # specify the program used to strip binaries. This is especially # annoying in cross-compiling environments, where the build's strip # is unlikely to handle the host's binaries. # Fortunately install-sh will honor a STRIPPROG variable, so we # always use install-sh in `make install-strip', and initialize # STRIPPROG with the value of the STRIP variable (set by the user). AC_DEFUN([AM_PROG_INSTALL_STRIP], [AC_REQUIRE([AM_PROG_INSTALL_SH])dnl # Installed binaries are usually stripped using `strip' when the user # run `make install-strip'. However `strip' might not be the right # tool to use in cross-compilation environments, therefore Automake # will honor the `STRIP' environment variable to overrule this program. dnl Don't test for $cross_compiling = yes, because it might be `maybe'. if test "$cross_compiling" != no; then AC_CHECK_TOOL([STRIP], [strip], :) fi INSTALL_STRIP_PROGRAM="\$(install_sh) -c -s" AC_SUBST([INSTALL_STRIP_PROGRAM])]) # Copyright (C) 2006, 2008 Free Software Foundation, Inc. # # This file is free software; the Free Software Foundation # gives unlimited permission to copy and/or distribute it, # with or without modifications, as long as this notice is preserved. # serial 2 # _AM_SUBST_NOTMAKE(VARIABLE) # --------------------------- # Prevent Automake from outputting VARIABLE = @VARIABLE@ in Makefile.in. # This macro is traced by Automake. AC_DEFUN([_AM_SUBST_NOTMAKE]) # AM_SUBST_NOTMAKE(VARIABLE) # --------------------------- # Public sister of _AM_SUBST_NOTMAKE. AC_DEFUN([AM_SUBST_NOTMAKE], [_AM_SUBST_NOTMAKE($@)]) # Check how to create a tarball. -*- Autoconf -*- # Copyright (C) 2004, 2005 Free Software Foundation, Inc. # # This file is free software; the Free Software Foundation # gives unlimited permission to copy and/or distribute it, # with or without modifications, as long as this notice is preserved. # serial 2 # _AM_PROG_TAR(FORMAT) # -------------------- # Check how to create a tarball in format FORMAT. # FORMAT should be one of `v7', `ustar', or `pax'. # # Substitute a variable $(am__tar) that is a command # writing to stdout a FORMAT-tarball containing the directory # $tardir. # tardir=directory && $(am__tar) > result.tar # # Substitute a variable $(am__untar) that extract such # a tarball read from stdin. # $(am__untar) < result.tar AC_DEFUN([_AM_PROG_TAR], [# Always define AMTAR for backward compatibility. AM_MISSING_PROG([AMTAR], [tar]) m4_if([$1], [v7], [am__tar='${AMTAR} chof - "$$tardir"'; am__untar='${AMTAR} xf -'], [m4_case([$1], [ustar],, [pax],, [m4_fatal([Unknown tar format])]) AC_MSG_CHECKING([how to create a $1 tar archive]) # Loop over all known methods to create a tar archive until one works. _am_tools='gnutar m4_if([$1], [ustar], [plaintar]) pax cpio none' _am_tools=${am_cv_prog_tar_$1-$_am_tools} # Do not fold the above two line into one, because Tru64 sh and # Solaris sh will not grok spaces in the rhs of `-'. for _am_tool in $_am_tools do case $_am_tool in gnutar) for _am_tar in tar gnutar gtar; do AM_RUN_LOG([$_am_tar --version]) && break done am__tar="$_am_tar --format=m4_if([$1], [pax], [posix], [$1]) -chf - "'"$$tardir"' am__tar_="$_am_tar --format=m4_if([$1], [pax], [posix], [$1]) -chf - "'"$tardir"' am__untar="$_am_tar -xf -" ;; plaintar) # Must skip GNU tar: if it does not support --format= it doesn't create # ustar tarball either. (tar --version) >/dev/null 2>&1 && continue am__tar='tar chf - "$$tardir"' am__tar_='tar chf - "$tardir"' am__untar='tar xf -' ;; pax) am__tar='pax -L -x $1 -w "$$tardir"' am__tar_='pax -L -x $1 -w "$tardir"' am__untar='pax -r' ;; cpio) am__tar='find "$$tardir" -print | cpio -o -H $1 -L' am__tar_='find "$tardir" -print | cpio -o -H $1 -L' am__untar='cpio -i -H $1 -d' ;; none) am__tar=false am__tar_=false am__untar=false ;; esac # If the value was cached, stop now. We just wanted to have am__tar # and am__untar set. test -n "${am_cv_prog_tar_$1}" && break # tar/untar a dummy directory, and stop if the command works rm -rf conftest.dir mkdir conftest.dir echo GrepMe > conftest.dir/file AM_RUN_LOG([tardir=conftest.dir && eval $am__tar_ >conftest.tar]) rm -rf conftest.dir if test -s conftest.tar; then AM_RUN_LOG([$am__untar /dev/null 2>&1 && break fi done rm -rf conftest.dir AC_CACHE_VAL([am_cv_prog_tar_$1], [am_cv_prog_tar_$1=$_am_tool]) AC_MSG_RESULT([$am_cv_prog_tar_$1])]) AC_SUBST([am__tar]) AC_SUBST([am__untar]) ]) # _AM_PROG_TAR m4_include([acinclude.m4]) apparix-11-062/bootstrap000077500000000000000000000015541326043744200152230ustar00rootroot00000000000000#!/bin/sh -e # $Id: bootstrap,v 1.1 2005/10/09 22:32:36 flux Exp $ # # bootstrap - script to bootstrap the distribution rolling engine # # to build a tarball, ready for distribution, from fresh checked out # cvs sources, do # # automake --add-missing && ./bootstrap && ./configure && make distcheck # # this will yield a tarball, e.g. zoem-20020109.tar.gz . Once this has been # run, one can, after e.g. editing sources, run just # # make distcheck # # to generate a new tarball. (No need to run ./bootstrap again in this case.) # After downloading, users do # # tar zxf mcl-20020109.tar.gz # cd mcl-20020109 # ./configure && make # make install # set -x if test ! -f VERSION then ./setversion fi if test ! -L util/Makefile.am then ./mkutil fi aclocal \ && autoheader \ && automake --verbose --gnu --add-missing \ && autoconf apparix-11-062/config.h.in000066400000000000000000000111621326043744200152770ustar00rootroot00000000000000/* config.h.in. Generated from configure.ac by autoheader. */ /* Predefined possible va_copy() implementation (id: ASP) */ #define __VA_COPY_USE_ASP(d, s) do { *(d) = *(s); } while (0) /* Predefined possible va_copy() implementation (id: ASS) */ #define __VA_COPY_USE_ASS(d, s) do { (d) = (s); } while (0) /* Predefined possible va_copy() implementation (id: C99) */ #define __VA_COPY_USE_C99(d, s) va_copy((d), (s)) /* Predefined possible va_copy() implementation (id: CPP) */ #define __VA_COPY_USE_CPP(d, s) memcpy((void *)(d), (void *)(s)), sizeof(*(s)) /* Predefined possible va_copy() implementation (id: CPS) */ #define __VA_COPY_USE_CPS(d, s) memcpy((void *)&(d), (void *)&(s)), sizeof((s)) /* Predefined possible va_copy() implementation (id: GCB) */ #define __VA_COPY_USE_GCB(d, s) __builtin_va_copy((d), (s)) /* Predefined possible va_copy() implementation (id: GCH) */ #define __VA_COPY_USE_GCH(d, s) __va_copy((d), (s)) /* Predefined possible va_copy() implementation (id: GCM) */ #define __VA_COPY_USE_GCM(d, s) VA_COPY((d), (s)) /* Define to 1 if you don't have `vprintf' but do have `_doprnt.' */ #undef HAVE_DOPRNT /* Define to 1 if you have the `dup2' function. */ #undef HAVE_DUP2 /* Define to 1 if you have the header file. */ #undef HAVE_FCNTL_H /* Define to 1 if you have the header file. */ #undef HAVE_FLOAT_H /* Define to 1 if you have the `floor' function. */ #undef HAVE_FLOOR /* Define to 1 if you have the `fork' function. */ #undef HAVE_FORK /* Define to 1 if you have the header file. */ #undef HAVE_INTTYPES_H /* Define to 1 if you have the `m' library (-lm). */ #undef HAVE_LIBM /* Define to 1 if you have the header file. */ #undef HAVE_LIMITS_H /* Define to 1 if your system has a GNU libc compatible `malloc' function, and to 0 otherwise. */ #undef HAVE_MALLOC /* Define to 1 if you have the header file. */ #undef HAVE_MEMORY_H /* Define to 1 if you have the `memset' function. */ #undef HAVE_MEMSET /* Define to 1 if you have the `pow' function. */ #undef HAVE_POW /* Define to 1 if you have the `regcomp' function. */ #undef HAVE_REGCOMP /* Define to 1 if you have the `sqrt' function. */ #undef HAVE_SQRT /* Define to 1 if you have the header file. */ #undef HAVE_STDINT_H /* Define to 1 if you have the header file. */ #undef HAVE_STDLIB_H /* Define to 1 if you have the `strchr' function. */ #undef HAVE_STRCHR /* Define to 1 if you have the header file. */ #undef HAVE_STRINGS_H /* Define to 1 if you have the header file. */ #undef HAVE_STRING_H /* Define to 1 if you have the `strrchr' function. */ #undef HAVE_STRRCHR /* Define to 1 if you have the `strstr' function. */ #undef HAVE_STRSTR /* Define to 1 if you have the header file. */ #undef HAVE_SYS_STAT_H /* Define to 1 if you have the header file. */ #undef HAVE_SYS_TYPES_H /* Define to 1 if you have that is POSIX.1 compatible. */ #undef HAVE_SYS_WAIT_H /* Define to 1 if you have the header file. */ #undef HAVE_UNISTD_H /* Define if va_copy() macro exists (and no fallback implementation is required) */ #undef HAVE_VA_COPY /* Define to 1 if you have the `vfork' function. */ #undef HAVE_VFORK /* Define to 1 if you have the header file. */ #undef HAVE_VFORK_H /* Define to 1 if you have the `vprintf' function. */ #undef HAVE_VPRINTF /* Define to 1 if `fork' works. */ #undef HAVE_WORKING_FORK /* Define to 1 if `vfork' works. */ #undef HAVE_WORKING_VFORK /* Name of package */ #undef PACKAGE /* 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 home page for this package. */ #undef PACKAGE_URL /* Define to the version of this package. */ #undef PACKAGE_VERSION /* Define to 1 if you have the ANSI C header files. */ #undef STDC_HEADERS /* Version number of package */ #undef VERSION /* Optional va_copy() implementation activation */ #ifndef HAVE_VA_COPY #define va_copy(d, s) __VA_COPY_USE(d, s) #define HAVE_VA_COPY 1 #endif /* Define to id of used va_copy() implementation */ #undef __VA_COPY_USE /* Define to empty if `const' does not conform to ANSI C. */ #undef const /* Define to rpl_malloc if the replacement function should be used. */ #undef malloc /* Define to `int' if does not define. */ #undef pid_t /* Define as `fork' if `vfork' does not work. */ #undef vfork apparix-11-062/configure000077500000000000000000005675641326043744200152110ustar00rootroot00000000000000#! /bin/sh # Guess values for system-dependent variables and create Makefiles. # Generated by GNU Autoconf 2.65 for apparix 11-062. # # Report bugs to . # # # Copyright (C) 1992, 1993, 1994, 1995, 1996, 1998, 1999, 2000, 2001, # 2002, 2003, 2004, 2005, 2006, 2007, 2008, 2009 Free Software Foundation, # Inc. # # # This configure script is free software; the Free Software Foundation # gives unlimited permission to copy, distribute and modify it. ## -------------------- ## ## M4sh Initialization. ## ## -------------------- ## # Be more Bourne compatible DUALCASE=1; export DUALCASE # for MKS sh if test -n "${ZSH_VERSION+set}" && (emulate sh) >/dev/null 2>&1; then : emulate sh NULLCMD=: # Pre-4.2 versions of Zsh do word splitting on ${1+"$@"}, which # is contrary to our usage. Disable this feature. alias -g '${1+"$@"}'='"$@"' setopt NO_GLOB_SUBST else case `(set -o) 2>/dev/null` in #( *posix*) : set -o posix ;; #( *) : ;; esac fi as_nl=' ' export as_nl # Printing a long string crashes Solaris 7 /usr/bin/printf. as_echo='\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\' as_echo=$as_echo$as_echo$as_echo$as_echo$as_echo as_echo=$as_echo$as_echo$as_echo$as_echo$as_echo$as_echo # Prefer a ksh shell builtin over an external printf program on Solaris, # but without wasting forks for bash or zsh. if test -z "$BASH_VERSION$ZSH_VERSION" \ && (test "X`print -r -- $as_echo`" = "X$as_echo") 2>/dev/null; then as_echo='print -r --' as_echo_n='print -rn --' elif (test "X`printf %s $as_echo`" = "X$as_echo") 2>/dev/null; then as_echo='printf %s\n' as_echo_n='printf %s' else if test "X`(/usr/ucb/echo -n -n $as_echo) 2>/dev/null`" = "X-n $as_echo"; then as_echo_body='eval /usr/ucb/echo -n "$1$as_nl"' as_echo_n='/usr/ucb/echo -n' else as_echo_body='eval expr "X$1" : "X\\(.*\\)"' as_echo_n_body='eval arg=$1; case $arg in #( *"$as_nl"*) expr "X$arg" : "X\\(.*\\)$as_nl"; arg=`expr "X$arg" : ".*$as_nl\\(.*\\)"`;; esac; expr "X$arg" : "X\\(.*\\)" | tr -d "$as_nl" ' export as_echo_n_body as_echo_n='sh -c $as_echo_n_body as_echo' fi export as_echo_body as_echo='sh -c $as_echo_body as_echo' fi # The user is always right. if test "${PATH_SEPARATOR+set}" != set; then PATH_SEPARATOR=: (PATH='/bin;/bin'; FPATH=$PATH; sh -c :) >/dev/null 2>&1 && { (PATH='/bin:/bin'; FPATH=$PATH; sh -c :) >/dev/null 2>&1 || PATH_SEPARATOR=';' } fi # IFS # We need space, tab and new line, in precisely that order. Quoting is # there to prevent editors from complaining about space-tab. # (If _AS_PATH_WALK were called with IFS unset, it would disable word # splitting by setting IFS to empty value.) IFS=" "" $as_nl" # Find who we are. Look in the path if we contain no directory separator. case $0 in #(( *[\\/]* ) as_myself=$0 ;; *) as_save_IFS=$IFS; IFS=$PATH_SEPARATOR for as_dir in $PATH do IFS=$as_save_IFS test -z "$as_dir" && as_dir=. test -r "$as_dir/$0" && as_myself=$as_dir/$0 && break done IFS=$as_save_IFS ;; esac # We did not find ourselves, most probably we were run as `sh COMMAND' # in which case we are not to be found in the path. if test "x$as_myself" = x; then as_myself=$0 fi if test ! -f "$as_myself"; then $as_echo "$as_myself: error: cannot find myself; rerun with an absolute file name" >&2 exit 1 fi # Unset variables that we do not need and which cause bugs (e.g. in # pre-3.0 UWIN ksh). But do not cause bugs in bash 2.01; the "|| exit 1" # suppresses any "Segmentation fault" message there. '((' could # trigger a bug in pdksh 5.2.14. for as_var in BASH_ENV ENV MAIL MAILPATH do eval test x\${$as_var+set} = xset \ && ( (unset $as_var) || exit 1) >/dev/null 2>&1 && unset $as_var || : done PS1='$ ' PS2='> ' PS4='+ ' # NLS nuisances. LC_ALL=C export LC_ALL LANGUAGE=C export LANGUAGE # CDPATH. (unset CDPATH) >/dev/null 2>&1 && unset CDPATH if test "x$CONFIG_SHELL" = x; then as_bourne_compatible="if test -n \"\${ZSH_VERSION+set}\" && (emulate sh) >/dev/null 2>&1; then : emulate sh NULLCMD=: # Pre-4.2 versions of Zsh do word splitting on \${1+\"\$@\"}, which # is contrary to our usage. Disable this feature. alias -g '\${1+\"\$@\"}'='\"\$@\"' setopt NO_GLOB_SUBST else case \`(set -o) 2>/dev/null\` in #( *posix*) : set -o posix ;; #( *) : ;; esac fi " as_required="as_fn_return () { (exit \$1); } as_fn_success () { as_fn_return 0; } as_fn_failure () { as_fn_return 1; } as_fn_ret_success () { return 0; } as_fn_ret_failure () { return 1; } exitcode=0 as_fn_success || { exitcode=1; echo as_fn_success failed.; } as_fn_failure && { exitcode=1; echo as_fn_failure succeeded.; } as_fn_ret_success || { exitcode=1; echo as_fn_ret_success failed.; } as_fn_ret_failure && { exitcode=1; echo as_fn_ret_failure succeeded.; } if ( set x; as_fn_ret_success y && test x = \"\$1\" ); then : else exitcode=1; echo positional parameters were not saved. fi test x\$exitcode = x0 || exit 1" as_suggested=" as_lineno_1=";as_suggested=$as_suggested$LINENO;as_suggested=$as_suggested" as_lineno_1a=\$LINENO as_lineno_2=";as_suggested=$as_suggested$LINENO;as_suggested=$as_suggested" as_lineno_2a=\$LINENO eval 'test \"x\$as_lineno_1'\$as_run'\" != \"x\$as_lineno_2'\$as_run'\" && test \"x\`expr \$as_lineno_1'\$as_run' + 1\`\" = \"x\$as_lineno_2'\$as_run'\"' || exit 1 test \$(( 1 + 1 )) = 2 || exit 1" if (eval "$as_required") 2>/dev/null; then : as_have_required=yes else as_have_required=no fi if test x$as_have_required = xyes && (eval "$as_suggested") 2>/dev/null; then : else as_save_IFS=$IFS; IFS=$PATH_SEPARATOR as_found=false for as_dir in /bin$PATH_SEPARATOR/usr/bin$PATH_SEPARATOR$PATH do IFS=$as_save_IFS test -z "$as_dir" && as_dir=. as_found=: case $as_dir in #( /*) for as_base in sh bash ksh sh5; do # Try only shells that exist, to save several forks. as_shell=$as_dir/$as_base if { test -f "$as_shell" || test -f "$as_shell.exe"; } && { $as_echo "$as_bourne_compatible""$as_required" | as_run=a "$as_shell"; } 2>/dev/null; then : CONFIG_SHELL=$as_shell as_have_required=yes if { $as_echo "$as_bourne_compatible""$as_suggested" | as_run=a "$as_shell"; } 2>/dev/null; then : break 2 fi fi done;; esac as_found=false done $as_found || { if { test -f "$SHELL" || test -f "$SHELL.exe"; } && { $as_echo "$as_bourne_compatible""$as_required" | as_run=a "$SHELL"; } 2>/dev/null; then : CONFIG_SHELL=$SHELL as_have_required=yes fi; } IFS=$as_save_IFS if test "x$CONFIG_SHELL" != x; then : # We cannot yet assume a decent shell, so we have to provide a # neutralization value for shells without unset; and this also # works around shells that cannot unset nonexistent variables. BASH_ENV=/dev/null ENV=/dev/null (unset BASH_ENV) >/dev/null 2>&1 && unset BASH_ENV ENV export CONFIG_SHELL exec "$CONFIG_SHELL" "$as_myself" ${1+"$@"} fi if test x$as_have_required = xno; then : $as_echo "$0: This script requires a shell more modern than all" $as_echo "$0: the shells that I found on your system." if test x${ZSH_VERSION+set} = xset ; then $as_echo "$0: In particular, zsh $ZSH_VERSION has bugs and should" $as_echo "$0: be upgraded to zsh 4.3.4 or later." else $as_echo "$0: Please tell bug-autoconf@gnu.org and $0: mcx-devel@lists.micans.org about your system, including $0: any error possibly output before this message. Then $0: install a modern shell, or manually run the script $0: under such a shell if you do have one." fi exit 1 fi fi fi SHELL=${CONFIG_SHELL-/bin/sh} export SHELL # Unset more variables known to interfere with behavior of common tools. CLICOLOR_FORCE= GREP_OPTIONS= unset CLICOLOR_FORCE GREP_OPTIONS ## --------------------- ## ## M4sh Shell Functions. ## ## --------------------- ## # as_fn_unset VAR # --------------- # Portably unset VAR. as_fn_unset () { { eval $1=; unset $1;} } as_unset=as_fn_unset # as_fn_set_status STATUS # ----------------------- # Set $? to STATUS, without forking. as_fn_set_status () { return $1 } # as_fn_set_status # as_fn_exit STATUS # ----------------- # Exit the shell with STATUS, even in a "trap 0" or "set -e" context. as_fn_exit () { set +e as_fn_set_status $1 exit $1 } # as_fn_exit # as_fn_mkdir_p # ------------- # Create "$as_dir" as a directory, including parents if necessary. as_fn_mkdir_p () { case $as_dir in #( -*) as_dir=./$as_dir;; esac test -d "$as_dir" || eval $as_mkdir_p || { as_dirs= while :; do case $as_dir in #( *\'*) as_qdir=`$as_echo "$as_dir" | sed "s/'/'\\\\\\\\''/g"`;; #'( *) as_qdir=$as_dir;; esac as_dirs="'$as_qdir' $as_dirs" as_dir=`$as_dirname -- "$as_dir" || $as_expr X"$as_dir" : 'X\(.*[^/]\)//*[^/][^/]*/*$' \| \ X"$as_dir" : 'X\(//\)[^/]' \| \ X"$as_dir" : 'X\(//\)$' \| \ X"$as_dir" : 'X\(/\)' \| . 2>/dev/null || $as_echo X"$as_dir" | sed '/^X\(.*[^/]\)\/\/*[^/][^/]*\/*$/{ s//\1/ q } /^X\(\/\/\)[^/].*/{ s//\1/ q } /^X\(\/\/\)$/{ s//\1/ q } /^X\(\/\).*/{ s//\1/ q } s/.*/./; q'` test -d "$as_dir" && break done test -z "$as_dirs" || eval "mkdir $as_dirs" } || test -d "$as_dir" || as_fn_error "cannot create directory $as_dir" } # as_fn_mkdir_p # as_fn_append VAR VALUE # ---------------------- # Append the text in VALUE to the end of the definition contained in VAR. Take # advantage of any shell optimizations that allow amortized linear growth over # repeated appends, instead of the typical quadratic growth present in naive # implementations. if (eval "as_var=1; as_var+=2; test x\$as_var = x12") 2>/dev/null; then : eval 'as_fn_append () { eval $1+=\$2 }' else as_fn_append () { eval $1=\$$1\$2 } fi # as_fn_append # as_fn_arith ARG... # ------------------ # Perform arithmetic evaluation on the ARGs, and store the result in the # global $as_val. Take advantage of shells that can avoid forks. The arguments # must be portable across $(()) and expr. if (eval "test \$(( 1 + 1 )) = 2") 2>/dev/null; then : eval 'as_fn_arith () { as_val=$(( $* )) }' else as_fn_arith () { as_val=`expr "$@" || test $? -eq 1` } fi # as_fn_arith # as_fn_error ERROR [LINENO LOG_FD] # --------------------------------- # Output "`basename $0`: error: ERROR" to stderr. If LINENO and LOG_FD are # provided, also output the error to LOG_FD, referencing LINENO. Then exit the # script with status $?, using 1 if that was 0. as_fn_error () { as_status=$?; test $as_status -eq 0 && as_status=1 if test "$3"; then as_lineno=${as_lineno-"$2"} as_lineno_stack=as_lineno_stack=$as_lineno_stack $as_echo "$as_me:${as_lineno-$LINENO}: error: $1" >&$3 fi $as_echo "$as_me: error: $1" >&2 as_fn_exit $as_status } # as_fn_error if expr a : '\(a\)' >/dev/null 2>&1 && test "X`expr 00001 : '.*\(...\)'`" = X001; then as_expr=expr else as_expr=false fi if (basename -- /) >/dev/null 2>&1 && test "X`basename -- / 2>&1`" = "X/"; then as_basename=basename else as_basename=false fi if (as_dir=`dirname -- /` && test "X$as_dir" = X/) >/dev/null 2>&1; then as_dirname=dirname else as_dirname=false fi as_me=`$as_basename -- "$0" || $as_expr X/"$0" : '.*/\([^/][^/]*\)/*$' \| \ X"$0" : 'X\(//\)$' \| \ X"$0" : 'X\(/\)' \| . 2>/dev/null || $as_echo X/"$0" | sed '/^.*\/\([^/][^/]*\)\/*$/{ s//\1/ q } /^X\/\(\/\/\)$/{ s//\1/ q } /^X\/\(\/\).*/{ s//\1/ q } s/.*/./; q'` # Avoid depending upon Character Ranges. as_cr_letters='abcdefghijklmnopqrstuvwxyz' as_cr_LETTERS='ABCDEFGHIJKLMNOPQRSTUVWXYZ' as_cr_Letters=$as_cr_letters$as_cr_LETTERS as_cr_digits='0123456789' as_cr_alnum=$as_cr_Letters$as_cr_digits as_lineno_1=$LINENO as_lineno_1a=$LINENO as_lineno_2=$LINENO as_lineno_2a=$LINENO eval 'test "x$as_lineno_1'$as_run'" != "x$as_lineno_2'$as_run'" && test "x`expr $as_lineno_1'$as_run' + 1`" = "x$as_lineno_2'$as_run'"' || { # Blame Lee E. McMahon (1931-1989) for sed's syntax. :-) sed -n ' p /[$]LINENO/= ' <$as_myself | sed ' s/[$]LINENO.*/&-/ t lineno b :lineno N :loop s/[$]LINENO\([^'$as_cr_alnum'_].*\n\)\(.*\)/\2\1\2/ t loop s/-\n.*// ' >$as_me.lineno && chmod +x "$as_me.lineno" || { $as_echo "$as_me: error: cannot create $as_me.lineno; rerun with a POSIX shell" >&2; as_fn_exit 1; } # Don't try to exec as it changes $[0], causing all sort of problems # (the dirname of $[0] is not the place where we might find the # original and so on. Autoconf is especially sensitive to this). . "./$as_me.lineno" # Exit status is that of the last command. exit } ECHO_C= ECHO_N= ECHO_T= case `echo -n x` in #((((( -n*) case `echo 'xy\c'` in *c*) ECHO_T=' ';; # ECHO_T is single tab character. xy) ECHO_C='\c';; *) echo `echo ksh88 bug on AIX 6.1` > /dev/null ECHO_T=' ';; esac;; *) ECHO_N='-n';; esac rm -f conf$$ conf$$.exe conf$$.file if test -d conf$$.dir; then rm -f conf$$.dir/conf$$.file else rm -f conf$$.dir mkdir conf$$.dir 2>/dev/null fi if (echo >conf$$.file) 2>/dev/null; then if ln -s conf$$.file conf$$ 2>/dev/null; then as_ln_s='ln -s' # ... but there are two gotchas: # 1) On MSYS, both `ln -s file dir' and `ln file dir' fail. # 2) DJGPP < 2.04 has no symlinks; `ln -s' creates a wrapper executable. # In both cases, we have to default to `cp -p'. ln -s conf$$.file conf$$.dir 2>/dev/null && test ! -f conf$$.exe || as_ln_s='cp -p' elif ln conf$$.file conf$$ 2>/dev/null; then as_ln_s=ln else as_ln_s='cp -p' fi else as_ln_s='cp -p' fi rm -f conf$$ conf$$.exe conf$$.dir/conf$$.file conf$$.file rmdir conf$$.dir 2>/dev/null if mkdir -p . 2>/dev/null; then as_mkdir_p='mkdir -p "$as_dir"' else test -d ./-p && rmdir ./-p as_mkdir_p=false fi if test -x / >/dev/null 2>&1; then as_test_x='test -x' else if ls -dL / >/dev/null 2>&1; then as_ls_L_option=L else as_ls_L_option= fi as_test_x=' eval sh -c '\'' if test -d "$1"; then test -d "$1/."; else case $1 in #( -*)set "./$1";; esac; case `ls -ld'$as_ls_L_option' "$1" 2>/dev/null` in #(( ???[sx]*):;;*)false;;esac;fi '\'' sh ' fi as_executable_p=$as_test_x # Sed expression to map a string onto a valid CPP name. as_tr_cpp="eval sed 'y%*$as_cr_letters%P$as_cr_LETTERS%;s%[^_$as_cr_alnum]%_%g'" # Sed expression to map a string onto a valid variable name. as_tr_sh="eval sed 'y%*+%pp%;s%[^_$as_cr_alnum]%_%g'" test -n "$DJDIR" || exec 7<&0 &1 # Name of the host. # hostname on some systems (SVR3.2, Linux) returns a bogus exit status, # so uname gets run too. ac_hostname=`(hostname || uname -n) 2>/dev/null | sed 1q` # # Initializations. # ac_default_prefix=/usr/local ac_clean_files= ac_config_libobj_dir=. LIBOBJS= cross_compiling=no subdirs= MFLAGS= MAKEFLAGS= # Identity of this package. PACKAGE_NAME='apparix' PACKAGE_TARNAME='apparix' PACKAGE_VERSION='11-062' PACKAGE_STRING='apparix 11-062' PACKAGE_BUGREPORT='mcx-devel@lists.micans.org' PACKAGE_URL='' ac_unique_file="src/apparix.c" # Factoring default headers for most tests. ac_includes_default="\ #include #ifdef HAVE_SYS_TYPES_H # include #endif #ifdef HAVE_SYS_STAT_H # include #endif #ifdef STDC_HEADERS # include # include #else # ifdef HAVE_STDLIB_H # include # endif #endif #ifdef HAVE_STRING_H # if !defined STDC_HEADERS && defined HAVE_MEMORY_H # include # endif # include #endif #ifdef HAVE_STRINGS_H # include #endif #ifdef HAVE_INTTYPES_H # include #endif #ifdef HAVE_STDINT_H # include #endif #ifdef HAVE_UNISTD_H # include #endif" ac_subst_vars='am__EXEEXT_FALSE am__EXEEXT_TRUE LTLIBOBJS LIBOBJS EGREP GREP CPP RANLIB LN_S am__fastdepCC_FALSE am__fastdepCC_TRUE CCDEPMODE AMDEPBACKSLASH AMDEP_FALSE AMDEP_TRUE am__quote am__include DEPDIR OBJEXT EXEEXT ac_ct_CC CPPFLAGS LDFLAGS CFLAGS CC MAINT MAINTAINER_MODE_FALSE MAINTAINER_MODE_TRUE am__untar am__tar AMTAR am__leading_dot SET_MAKE AWK mkdir_p MKDIR_P INSTALL_STRIP_PROGRAM STRIP install_sh MAKEINFO AUTOHEADER AUTOMAKE AUTOCONF ACLOCAL VERSION PACKAGE CYGPATH_W am__isrc INSTALL_DATA INSTALL_SCRIPT INSTALL_PROGRAM target_alias host_alias build_alias LIBS ECHO_T ECHO_N ECHO_C DEFS mandir localedir libdir psdir pdfdir dvidir htmldir infodir docdir oldincludedir includedir localstatedir sharedstatedir sysconfdir datadir datarootdir libexecdir sbindir bindir program_transform_name prefix exec_prefix PACKAGE_URL PACKAGE_BUGREPORT PACKAGE_STRING PACKAGE_VERSION PACKAGE_TARNAME PACKAGE_NAME PATH_SEPARATOR SHELL' ac_subst_files='' ac_user_opts=' enable_option_checking enable_maintainer_mode enable_dependency_tracking ' ac_precious_vars='build_alias host_alias target_alias CC CFLAGS LDFLAGS LIBS CPPFLAGS CPP' # Initialize some variables set by options. ac_init_help= ac_init_version=false ac_unrecognized_opts= ac_unrecognized_sep= # The variables have the same names as the options, with # dashes changed to underlines. cache_file=/dev/null exec_prefix=NONE no_create= no_recursion= prefix=NONE program_prefix=NONE program_suffix=NONE program_transform_name=s,x,x, silent= site= srcdir= verbose= x_includes=NONE x_libraries=NONE # Installation directory options. # These are left unexpanded so users can "make install exec_prefix=/foo" # and all the variables that are supposed to be based on exec_prefix # by default will actually change. # Use braces instead of parens because sh, perl, etc. also accept them. # (The list follows the same order as the GNU Coding Standards.) bindir='${exec_prefix}/bin' sbindir='${exec_prefix}/sbin' libexecdir='${exec_prefix}/libexec' datarootdir='${prefix}/share' datadir='${datarootdir}' sysconfdir='${prefix}/etc' sharedstatedir='${prefix}/com' localstatedir='${prefix}/var' includedir='${prefix}/include' oldincludedir='/usr/include' docdir='${datarootdir}/doc/${PACKAGE_TARNAME}' infodir='${datarootdir}/info' htmldir='${docdir}' dvidir='${docdir}' pdfdir='${docdir}' psdir='${docdir}' libdir='${exec_prefix}/lib' localedir='${datarootdir}/locale' mandir='${datarootdir}/man' ac_prev= ac_dashdash= for ac_option do # If the previous option needs an argument, assign it. if test -n "$ac_prev"; then eval $ac_prev=\$ac_option ac_prev= continue fi case $ac_option in *=*) ac_optarg=`expr "X$ac_option" : '[^=]*=\(.*\)'` ;; *) ac_optarg=yes ;; esac # Accept the important Cygnus configure options, so we can diagnose typos. case $ac_dashdash$ac_option in --) ac_dashdash=yes ;; -bindir | --bindir | --bindi | --bind | --bin | --bi) ac_prev=bindir ;; -bindir=* | --bindir=* | --bindi=* | --bind=* | --bin=* | --bi=*) bindir=$ac_optarg ;; -build | --build | --buil | --bui | --bu) ac_prev=build_alias ;; -build=* | --build=* | --buil=* | --bui=* | --bu=*) build_alias=$ac_optarg ;; -cache-file | --cache-file | --cache-fil | --cache-fi \ | --cache-f | --cache- | --cache | --cach | --cac | --ca | --c) ac_prev=cache_file ;; -cache-file=* | --cache-file=* | --cache-fil=* | --cache-fi=* \ | --cache-f=* | --cache-=* | --cache=* | --cach=* | --cac=* | --ca=* | --c=*) cache_file=$ac_optarg ;; --config-cache | -C) cache_file=config.cache ;; -datadir | --datadir | --datadi | --datad) ac_prev=datadir ;; -datadir=* | --datadir=* | --datadi=* | --datad=*) datadir=$ac_optarg ;; -datarootdir | --datarootdir | --datarootdi | --datarootd | --dataroot \ | --dataroo | --dataro | --datar) ac_prev=datarootdir ;; -datarootdir=* | --datarootdir=* | --datarootdi=* | --datarootd=* \ | --dataroot=* | --dataroo=* | --dataro=* | --datar=*) datarootdir=$ac_optarg ;; -disable-* | --disable-*) ac_useropt=`expr "x$ac_option" : 'x-*disable-\(.*\)'` # Reject names that are not valid shell variable names. expr "x$ac_useropt" : ".*[^-+._$as_cr_alnum]" >/dev/null && as_fn_error "invalid feature name: $ac_useropt" ac_useropt_orig=$ac_useropt ac_useropt=`$as_echo "$ac_useropt" | sed 's/[-+.]/_/g'` case $ac_user_opts in *" "enable_$ac_useropt" "*) ;; *) ac_unrecognized_opts="$ac_unrecognized_opts$ac_unrecognized_sep--disable-$ac_useropt_orig" ac_unrecognized_sep=', ';; esac eval enable_$ac_useropt=no ;; -docdir | --docdir | --docdi | --doc | --do) ac_prev=docdir ;; -docdir=* | --docdir=* | --docdi=* | --doc=* | --do=*) docdir=$ac_optarg ;; -dvidir | --dvidir | --dvidi | --dvid | --dvi | --dv) ac_prev=dvidir ;; -dvidir=* | --dvidir=* | --dvidi=* | --dvid=* | --dvi=* | --dv=*) dvidir=$ac_optarg ;; -enable-* | --enable-*) ac_useropt=`expr "x$ac_option" : 'x-*enable-\([^=]*\)'` # Reject names that are not valid shell variable names. expr "x$ac_useropt" : ".*[^-+._$as_cr_alnum]" >/dev/null && as_fn_error "invalid feature name: $ac_useropt" ac_useropt_orig=$ac_useropt ac_useropt=`$as_echo "$ac_useropt" | sed 's/[-+.]/_/g'` case $ac_user_opts in *" "enable_$ac_useropt" "*) ;; *) ac_unrecognized_opts="$ac_unrecognized_opts$ac_unrecognized_sep--enable-$ac_useropt_orig" ac_unrecognized_sep=', ';; esac eval enable_$ac_useropt=\$ac_optarg ;; -exec-prefix | --exec_prefix | --exec-prefix | --exec-prefi \ | --exec-pref | --exec-pre | --exec-pr | --exec-p | --exec- \ | --exec | --exe | --ex) ac_prev=exec_prefix ;; -exec-prefix=* | --exec_prefix=* | --exec-prefix=* | --exec-prefi=* \ | --exec-pref=* | --exec-pre=* | --exec-pr=* | --exec-p=* | --exec-=* \ | --exec=* | --exe=* | --ex=*) exec_prefix=$ac_optarg ;; -gas | --gas | --ga | --g) # Obsolete; use --with-gas. with_gas=yes ;; -help | --help | --hel | --he | -h) ac_init_help=long ;; -help=r* | --help=r* | --hel=r* | --he=r* | -hr*) ac_init_help=recursive ;; -help=s* | --help=s* | --hel=s* | --he=s* | -hs*) ac_init_help=short ;; -host | --host | --hos | --ho) ac_prev=host_alias ;; -host=* | --host=* | --hos=* | --ho=*) host_alias=$ac_optarg ;; -htmldir | --htmldir | --htmldi | --htmld | --html | --htm | --ht) ac_prev=htmldir ;; -htmldir=* | --htmldir=* | --htmldi=* | --htmld=* | --html=* | --htm=* \ | --ht=*) htmldir=$ac_optarg ;; -includedir | --includedir | --includedi | --included | --include \ | --includ | --inclu | --incl | --inc) ac_prev=includedir ;; -includedir=* | --includedir=* | --includedi=* | --included=* | --include=* \ | --includ=* | --inclu=* | --incl=* | --inc=*) includedir=$ac_optarg ;; -infodir | --infodir | --infodi | --infod | --info | --inf) ac_prev=infodir ;; -infodir=* | --infodir=* | --infodi=* | --infod=* | --info=* | --inf=*) infodir=$ac_optarg ;; -libdir | --libdir | --libdi | --libd) ac_prev=libdir ;; -libdir=* | --libdir=* | --libdi=* | --libd=*) libdir=$ac_optarg ;; -libexecdir | --libexecdir | --libexecdi | --libexecd | --libexec \ | --libexe | --libex | --libe) ac_prev=libexecdir ;; -libexecdir=* | --libexecdir=* | --libexecdi=* | --libexecd=* | --libexec=* \ | --libexe=* | --libex=* | --libe=*) libexecdir=$ac_optarg ;; -localedir | --localedir | --localedi | --localed | --locale) ac_prev=localedir ;; -localedir=* | --localedir=* | --localedi=* | --localed=* | --locale=*) localedir=$ac_optarg ;; -localstatedir | --localstatedir | --localstatedi | --localstated \ | --localstate | --localstat | --localsta | --localst | --locals) ac_prev=localstatedir ;; -localstatedir=* | --localstatedir=* | --localstatedi=* | --localstated=* \ | --localstate=* | --localstat=* | --localsta=* | --localst=* | --locals=*) localstatedir=$ac_optarg ;; -mandir | --mandir | --mandi | --mand | --man | --ma | --m) ac_prev=mandir ;; -mandir=* | --mandir=* | --mandi=* | --mand=* | --man=* | --ma=* | --m=*) mandir=$ac_optarg ;; -nfp | --nfp | --nf) # Obsolete; use --without-fp. with_fp=no ;; -no-create | --no-create | --no-creat | --no-crea | --no-cre \ | --no-cr | --no-c | -n) no_create=yes ;; -no-recursion | --no-recursion | --no-recursio | --no-recursi \ | --no-recurs | --no-recur | --no-recu | --no-rec | --no-re | --no-r) no_recursion=yes ;; -oldincludedir | --oldincludedir | --oldincludedi | --oldincluded \ | --oldinclude | --oldinclud | --oldinclu | --oldincl | --oldinc \ | --oldin | --oldi | --old | --ol | --o) ac_prev=oldincludedir ;; -oldincludedir=* | --oldincludedir=* | --oldincludedi=* | --oldincluded=* \ | --oldinclude=* | --oldinclud=* | --oldinclu=* | --oldincl=* | --oldinc=* \ | --oldin=* | --oldi=* | --old=* | --ol=* | --o=*) oldincludedir=$ac_optarg ;; -prefix | --prefix | --prefi | --pref | --pre | --pr | --p) ac_prev=prefix ;; -prefix=* | --prefix=* | --prefi=* | --pref=* | --pre=* | --pr=* | --p=*) prefix=$ac_optarg ;; -program-prefix | --program-prefix | --program-prefi | --program-pref \ | --program-pre | --program-pr | --program-p) ac_prev=program_prefix ;; -program-prefix=* | --program-prefix=* | --program-prefi=* \ | --program-pref=* | --program-pre=* | --program-pr=* | --program-p=*) program_prefix=$ac_optarg ;; -program-suffix | --program-suffix | --program-suffi | --program-suff \ | --program-suf | --program-su | --program-s) ac_prev=program_suffix ;; -program-suffix=* | --program-suffix=* | --program-suffi=* \ | --program-suff=* | --program-suf=* | --program-su=* | --program-s=*) program_suffix=$ac_optarg ;; -program-transform-name | --program-transform-name \ | --program-transform-nam | --program-transform-na \ | --program-transform-n | --program-transform- \ | --program-transform | --program-transfor \ | --program-transfo | --program-transf \ | --program-trans | --program-tran \ | --progr-tra | --program-tr | --program-t) ac_prev=program_transform_name ;; -program-transform-name=* | --program-transform-name=* \ | --program-transform-nam=* | --program-transform-na=* \ | --program-transform-n=* | --program-transform-=* \ | --program-transform=* | --program-transfor=* \ | --program-transfo=* | --program-transf=* \ | --program-trans=* | --program-tran=* \ | --progr-tra=* | --program-tr=* | --program-t=*) program_transform_name=$ac_optarg ;; -pdfdir | --pdfdir | --pdfdi | --pdfd | --pdf | --pd) ac_prev=pdfdir ;; -pdfdir=* | --pdfdir=* | --pdfdi=* | --pdfd=* | --pdf=* | --pd=*) pdfdir=$ac_optarg ;; -psdir | --psdir | --psdi | --psd | --ps) ac_prev=psdir ;; -psdir=* | --psdir=* | --psdi=* | --psd=* | --ps=*) psdir=$ac_optarg ;; -q | -quiet | --quiet | --quie | --qui | --qu | --q \ | -silent | --silent | --silen | --sile | --sil) silent=yes ;; -sbindir | --sbindir | --sbindi | --sbind | --sbin | --sbi | --sb) ac_prev=sbindir ;; -sbindir=* | --sbindir=* | --sbindi=* | --sbind=* | --sbin=* \ | --sbi=* | --sb=*) sbindir=$ac_optarg ;; -sharedstatedir | --sharedstatedir | --sharedstatedi \ | --sharedstated | --sharedstate | --sharedstat | --sharedsta \ | --sharedst | --shareds | --shared | --share | --shar \ | --sha | --sh) ac_prev=sharedstatedir ;; -sharedstatedir=* | --sharedstatedir=* | --sharedstatedi=* \ | --sharedstated=* | --sharedstate=* | --sharedstat=* | --sharedsta=* \ | --sharedst=* | --shareds=* | --shared=* | --share=* | --shar=* \ | --sha=* | --sh=*) sharedstatedir=$ac_optarg ;; -site | --site | --sit) ac_prev=site ;; -site=* | --site=* | --sit=*) site=$ac_optarg ;; -srcdir | --srcdir | --srcdi | --srcd | --src | --sr) ac_prev=srcdir ;; -srcdir=* | --srcdir=* | --srcdi=* | --srcd=* | --src=* | --sr=*) srcdir=$ac_optarg ;; -sysconfdir | --sysconfdir | --sysconfdi | --sysconfd | --sysconf \ | --syscon | --sysco | --sysc | --sys | --sy) ac_prev=sysconfdir ;; -sysconfdir=* | --sysconfdir=* | --sysconfdi=* | --sysconfd=* | --sysconf=* \ | --syscon=* | --sysco=* | --sysc=* | --sys=* | --sy=*) sysconfdir=$ac_optarg ;; -target | --target | --targe | --targ | --tar | --ta | --t) ac_prev=target_alias ;; -target=* | --target=* | --targe=* | --targ=* | --tar=* | --ta=* | --t=*) target_alias=$ac_optarg ;; -v | -verbose | --verbose | --verbos | --verbo | --verb) verbose=yes ;; -version | --version | --versio | --versi | --vers | -V) ac_init_version=: ;; -with-* | --with-*) ac_useropt=`expr "x$ac_option" : 'x-*with-\([^=]*\)'` # Reject names that are not valid shell variable names. expr "x$ac_useropt" : ".*[^-+._$as_cr_alnum]" >/dev/null && as_fn_error "invalid package name: $ac_useropt" ac_useropt_orig=$ac_useropt ac_useropt=`$as_echo "$ac_useropt" | sed 's/[-+.]/_/g'` case $ac_user_opts in *" "with_$ac_useropt" "*) ;; *) ac_unrecognized_opts="$ac_unrecognized_opts$ac_unrecognized_sep--with-$ac_useropt_orig" ac_unrecognized_sep=', ';; esac eval with_$ac_useropt=\$ac_optarg ;; -without-* | --without-*) ac_useropt=`expr "x$ac_option" : 'x-*without-\(.*\)'` # Reject names that are not valid shell variable names. expr "x$ac_useropt" : ".*[^-+._$as_cr_alnum]" >/dev/null && as_fn_error "invalid package name: $ac_useropt" ac_useropt_orig=$ac_useropt ac_useropt=`$as_echo "$ac_useropt" | sed 's/[-+.]/_/g'` case $ac_user_opts in *" "with_$ac_useropt" "*) ;; *) ac_unrecognized_opts="$ac_unrecognized_opts$ac_unrecognized_sep--without-$ac_useropt_orig" ac_unrecognized_sep=', ';; esac eval with_$ac_useropt=no ;; --x) # Obsolete; use --with-x. with_x=yes ;; -x-includes | --x-includes | --x-include | --x-includ | --x-inclu \ | --x-incl | --x-inc | --x-in | --x-i) ac_prev=x_includes ;; -x-includes=* | --x-includes=* | --x-include=* | --x-includ=* | --x-inclu=* \ | --x-incl=* | --x-inc=* | --x-in=* | --x-i=*) x_includes=$ac_optarg ;; -x-libraries | --x-libraries | --x-librarie | --x-librari \ | --x-librar | --x-libra | --x-libr | --x-lib | --x-li | --x-l) ac_prev=x_libraries ;; -x-libraries=* | --x-libraries=* | --x-librarie=* | --x-librari=* \ | --x-librar=* | --x-libra=* | --x-libr=* | --x-lib=* | --x-li=* | --x-l=*) x_libraries=$ac_optarg ;; -*) as_fn_error "unrecognized option: \`$ac_option' Try \`$0 --help' for more information." ;; *=*) ac_envvar=`expr "x$ac_option" : 'x\([^=]*\)='` # Reject names that are not valid shell variable names. case $ac_envvar in #( '' | [0-9]* | *[!_$as_cr_alnum]* ) as_fn_error "invalid variable name: \`$ac_envvar'" ;; esac eval $ac_envvar=\$ac_optarg export $ac_envvar ;; *) # FIXME: should be removed in autoconf 3.0. $as_echo "$as_me: WARNING: you should use --build, --host, --target" >&2 expr "x$ac_option" : ".*[^-._$as_cr_alnum]" >/dev/null && $as_echo "$as_me: WARNING: invalid host type: $ac_option" >&2 : ${build_alias=$ac_option} ${host_alias=$ac_option} ${target_alias=$ac_option} ;; esac done if test -n "$ac_prev"; then ac_option=--`echo $ac_prev | sed 's/_/-/g'` as_fn_error "missing argument to $ac_option" fi if test -n "$ac_unrecognized_opts"; then case $enable_option_checking in no) ;; fatal) as_fn_error "unrecognized options: $ac_unrecognized_opts" ;; *) $as_echo "$as_me: WARNING: unrecognized options: $ac_unrecognized_opts" >&2 ;; esac fi # Check all directory arguments for consistency. for ac_var in exec_prefix prefix bindir sbindir libexecdir datarootdir \ datadir sysconfdir sharedstatedir localstatedir includedir \ oldincludedir docdir infodir htmldir dvidir pdfdir psdir \ libdir localedir mandir do eval ac_val=\$$ac_var # Remove trailing slashes. case $ac_val in */ ) ac_val=`expr "X$ac_val" : 'X\(.*[^/]\)' \| "X$ac_val" : 'X\(.*\)'` eval $ac_var=\$ac_val;; esac # Be sure to have absolute directory names. case $ac_val in [\\/$]* | ?:[\\/]* ) continue;; NONE | '' ) case $ac_var in *prefix ) continue;; esac;; esac as_fn_error "expected an absolute directory name for --$ac_var: $ac_val" done # There might be people who depend on the old broken behavior: `$host' # used to hold the argument of --host etc. # FIXME: To remove some day. build=$build_alias host=$host_alias target=$target_alias # FIXME: To remove some day. if test "x$host_alias" != x; then if test "x$build_alias" = x; then cross_compiling=maybe $as_echo "$as_me: WARNING: If you wanted to set the --build type, don't use --host. If a cross compiler is detected then cross compile mode will be used." >&2 elif test "x$build_alias" != "x$host_alias"; then cross_compiling=yes fi fi ac_tool_prefix= test -n "$host_alias" && ac_tool_prefix=$host_alias- test "$silent" = yes && exec 6>/dev/null ac_pwd=`pwd` && test -n "$ac_pwd" && ac_ls_di=`ls -di .` && ac_pwd_ls_di=`cd "$ac_pwd" && ls -di .` || as_fn_error "working directory cannot be determined" test "X$ac_ls_di" = "X$ac_pwd_ls_di" || as_fn_error "pwd does not report name of working directory" # Find the source files, if location was not specified. if test -z "$srcdir"; then ac_srcdir_defaulted=yes # Try the directory containing this script, then the parent directory. ac_confdir=`$as_dirname -- "$as_myself" || $as_expr X"$as_myself" : 'X\(.*[^/]\)//*[^/][^/]*/*$' \| \ X"$as_myself" : 'X\(//\)[^/]' \| \ X"$as_myself" : 'X\(//\)$' \| \ X"$as_myself" : 'X\(/\)' \| . 2>/dev/null || $as_echo X"$as_myself" | sed '/^X\(.*[^/]\)\/\/*[^/][^/]*\/*$/{ s//\1/ q } /^X\(\/\/\)[^/].*/{ s//\1/ q } /^X\(\/\/\)$/{ s//\1/ q } /^X\(\/\).*/{ s//\1/ q } s/.*/./; q'` srcdir=$ac_confdir if test ! -r "$srcdir/$ac_unique_file"; then srcdir=.. fi else ac_srcdir_defaulted=no fi if test ! -r "$srcdir/$ac_unique_file"; then test "$ac_srcdir_defaulted" = yes && srcdir="$ac_confdir or .." as_fn_error "cannot find sources ($ac_unique_file) in $srcdir" fi ac_msg="sources are in $srcdir, but \`cd $srcdir' does not work" ac_abs_confdir=`( cd "$srcdir" && test -r "./$ac_unique_file" || as_fn_error "$ac_msg" pwd)` # When building in place, set srcdir=. if test "$ac_abs_confdir" = "$ac_pwd"; then srcdir=. fi # Remove unnecessary trailing slashes from srcdir. # Double slashes in file names in object file debugging info # mess up M-x gdb in Emacs. case $srcdir in */) srcdir=`expr "X$srcdir" : 'X\(.*[^/]\)' \| "X$srcdir" : 'X\(.*\)'`;; esac for ac_var in $ac_precious_vars; do eval ac_env_${ac_var}_set=\${${ac_var}+set} eval ac_env_${ac_var}_value=\$${ac_var} eval ac_cv_env_${ac_var}_set=\${${ac_var}+set} eval ac_cv_env_${ac_var}_value=\$${ac_var} done # # Report the --help message. # if test "$ac_init_help" = "long"; then # Omit some internal or obsolete options to make the list less imposing. # This message is too long to be a string in the A/UX 3.1 sh. cat <<_ACEOF \`configure' configures apparix 11-062 to adapt to many kinds of systems. Usage: $0 [OPTION]... [VAR=VALUE]... To assign environment variables (e.g., CC, CFLAGS...), specify them as VAR=VALUE. See below for descriptions of some of the useful variables. Defaults for the options are specified in brackets. Configuration: -h, --help display this help and exit --help=short display options specific to this package --help=recursive display the short help of all the included packages -V, --version display version information and exit -q, --quiet, --silent do not print \`checking...' messages --cache-file=FILE cache test results in FILE [disabled] -C, --config-cache alias for \`--cache-file=config.cache' -n, --no-create do not create output files --srcdir=DIR find the sources in DIR [configure dir or \`..'] Installation directories: --prefix=PREFIX install architecture-independent files in PREFIX [$ac_default_prefix] --exec-prefix=EPREFIX install architecture-dependent files in EPREFIX [PREFIX] By default, \`make install' will install all the files in \`$ac_default_prefix/bin', \`$ac_default_prefix/lib' etc. You can specify an installation prefix other than \`$ac_default_prefix' using \`--prefix', for instance \`--prefix=\$HOME'. For better control, use the options below. Fine tuning of the installation directories: --bindir=DIR user executables [EPREFIX/bin] --sbindir=DIR system admin executables [EPREFIX/sbin] --libexecdir=DIR program executables [EPREFIX/libexec] --sysconfdir=DIR read-only single-machine data [PREFIX/etc] --sharedstatedir=DIR modifiable architecture-independent data [PREFIX/com] --localstatedir=DIR modifiable single-machine data [PREFIX/var] --libdir=DIR object code libraries [EPREFIX/lib] --includedir=DIR C header files [PREFIX/include] --oldincludedir=DIR C header files for non-gcc [/usr/include] --datarootdir=DIR read-only arch.-independent data root [PREFIX/share] --datadir=DIR read-only architecture-independent data [DATAROOTDIR] --infodir=DIR info documentation [DATAROOTDIR/info] --localedir=DIR locale-dependent data [DATAROOTDIR/locale] --mandir=DIR man documentation [DATAROOTDIR/man] --docdir=DIR documentation root [DATAROOTDIR/doc/apparix] --htmldir=DIR html documentation [DOCDIR] --dvidir=DIR dvi documentation [DOCDIR] --pdfdir=DIR pdf documentation [DOCDIR] --psdir=DIR ps documentation [DOCDIR] _ACEOF cat <<\_ACEOF Program names: --program-prefix=PREFIX prepend PREFIX to installed program names --program-suffix=SUFFIX append SUFFIX to installed program names --program-transform-name=PROGRAM run sed PROGRAM on installed program names _ACEOF fi if test -n "$ac_init_help"; then case $ac_init_help in short | recursive ) echo "Configuration of apparix 11-062:";; esac cat <<\_ACEOF Optional Features: --disable-option-checking ignore unrecognized --enable/--with options --disable-FEATURE do not include FEATURE (same as --enable-FEATURE=no) --enable-FEATURE[=ARG] include FEATURE [ARG=yes] --enable-maintainer-mode enable make rules and dependencies not useful (and sometimes confusing) to the casual installer --disable-dependency-tracking speeds up one-time build --enable-dependency-tracking do not reject slow dependency extractors Some influential environment variables: CC C compiler command CFLAGS C compiler flags LDFLAGS linker flags, e.g. -L if you have libraries in a nonstandard directory LIBS libraries to pass to the linker, e.g. -l CPPFLAGS (Objective) C/C++ preprocessor flags, e.g. -I if you have headers in a nonstandard directory CPP C preprocessor Use these variables to override the choices made by `configure' or to help it to find libraries and programs with nonstandard names/locations. Report bugs to . _ACEOF ac_status=$? fi if test "$ac_init_help" = "recursive"; then # If there are subdirs, report their specific --help. for ac_dir in : $ac_subdirs_all; do test "x$ac_dir" = x: && continue test -d "$ac_dir" || { cd "$srcdir" && ac_pwd=`pwd` && srcdir=. && test -d "$ac_dir"; } || continue ac_builddir=. case "$ac_dir" in .) ac_dir_suffix= ac_top_builddir_sub=. ac_top_build_prefix= ;; *) ac_dir_suffix=/`$as_echo "$ac_dir" | sed 's|^\.[\\/]||'` # A ".." for each directory in $ac_dir_suffix. ac_top_builddir_sub=`$as_echo "$ac_dir_suffix" | sed 's|/[^\\/]*|/..|g;s|/||'` case $ac_top_builddir_sub in "") ac_top_builddir_sub=. ac_top_build_prefix= ;; *) ac_top_build_prefix=$ac_top_builddir_sub/ ;; esac ;; esac ac_abs_top_builddir=$ac_pwd ac_abs_builddir=$ac_pwd$ac_dir_suffix # for backward compatibility: ac_top_builddir=$ac_top_build_prefix case $srcdir in .) # We are building in place. ac_srcdir=. ac_top_srcdir=$ac_top_builddir_sub ac_abs_top_srcdir=$ac_pwd ;; [\\/]* | ?:[\\/]* ) # Absolute name. ac_srcdir=$srcdir$ac_dir_suffix; ac_top_srcdir=$srcdir ac_abs_top_srcdir=$srcdir ;; *) # Relative name. ac_srcdir=$ac_top_build_prefix$srcdir$ac_dir_suffix ac_top_srcdir=$ac_top_build_prefix$srcdir ac_abs_top_srcdir=$ac_pwd/$srcdir ;; esac ac_abs_srcdir=$ac_abs_top_srcdir$ac_dir_suffix cd "$ac_dir" || { ac_status=$?; continue; } # Check for guested configure. if test -f "$ac_srcdir/configure.gnu"; then echo && $SHELL "$ac_srcdir/configure.gnu" --help=recursive elif test -f "$ac_srcdir/configure"; then echo && $SHELL "$ac_srcdir/configure" --help=recursive else $as_echo "$as_me: WARNING: no configuration information is in $ac_dir" >&2 fi || ac_status=$? cd "$ac_pwd" || { ac_status=$?; break; } done fi test -n "$ac_init_help" && exit $ac_status if $ac_init_version; then cat <<\_ACEOF apparix configure 11-062 generated by GNU Autoconf 2.65 Copyright (C) 2009 Free Software Foundation, Inc. This configure script is free software; the Free Software Foundation gives unlimited permission to copy, distribute and modify it. _ACEOF exit fi ## ------------------------ ## ## Autoconf initialization. ## ## ------------------------ ## # ac_fn_c_try_compile LINENO # -------------------------- # Try to compile conftest.$ac_ext, and return whether this succeeded. ac_fn_c_try_compile () { as_lineno=${as_lineno-"$1"} as_lineno_stack=as_lineno_stack=$as_lineno_stack rm -f conftest.$ac_objext if { { ac_try="$ac_compile" case "(($ac_try" in *\"* | *\`* | *\\*) ac_try_echo=\$ac_try;; *) ac_try_echo=$ac_try;; esac eval ac_try_echo="\"\$as_me:${as_lineno-$LINENO}: $ac_try_echo\"" $as_echo "$ac_try_echo"; } >&5 (eval "$ac_compile") 2>conftest.err ac_status=$? if test -s conftest.err; then grep -v '^ *+' conftest.err >conftest.er1 cat conftest.er1 >&5 mv -f conftest.er1 conftest.err fi $as_echo "$as_me:${as_lineno-$LINENO}: \$? = $ac_status" >&5 test $ac_status = 0; } && { test -z "$ac_c_werror_flag" || test ! -s conftest.err } && test -s conftest.$ac_objext; then : ac_retval=0 else $as_echo "$as_me: failed program was:" >&5 sed 's/^/| /' conftest.$ac_ext >&5 ac_retval=1 fi eval $as_lineno_stack; test "x$as_lineno_stack" = x && { as_lineno=; unset as_lineno;} as_fn_set_status $ac_retval } # ac_fn_c_try_compile # ac_fn_c_try_link LINENO # ----------------------- # Try to link conftest.$ac_ext, and return whether this succeeded. ac_fn_c_try_link () { as_lineno=${as_lineno-"$1"} as_lineno_stack=as_lineno_stack=$as_lineno_stack rm -f conftest.$ac_objext conftest$ac_exeext if { { ac_try="$ac_link" case "(($ac_try" in *\"* | *\`* | *\\*) ac_try_echo=\$ac_try;; *) ac_try_echo=$ac_try;; esac eval ac_try_echo="\"\$as_me:${as_lineno-$LINENO}: $ac_try_echo\"" $as_echo "$ac_try_echo"; } >&5 (eval "$ac_link") 2>conftest.err ac_status=$? if test -s conftest.err; then grep -v '^ *+' conftest.err >conftest.er1 cat conftest.er1 >&5 mv -f conftest.er1 conftest.err fi $as_echo "$as_me:${as_lineno-$LINENO}: \$? = $ac_status" >&5 test $ac_status = 0; } && { test -z "$ac_c_werror_flag" || test ! -s conftest.err } && test -s conftest$ac_exeext && { test "$cross_compiling" = yes || $as_test_x conftest$ac_exeext }; then : ac_retval=0 else $as_echo "$as_me: failed program was:" >&5 sed 's/^/| /' conftest.$ac_ext >&5 ac_retval=1 fi # Delete the IPA/IPO (Inter Procedural Analysis/Optimization) information # created by the PGI compiler (conftest_ipa8_conftest.oo), as it would # interfere with the next link command; also delete a directory that is # left behind by Apple's compiler. We do this before executing the actions. rm -rf conftest.dSYM conftest_ipa8_conftest.oo eval $as_lineno_stack; test "x$as_lineno_stack" = x && { as_lineno=; unset as_lineno;} as_fn_set_status $ac_retval } # ac_fn_c_try_link # ac_fn_c_try_cpp LINENO # ---------------------- # Try to preprocess conftest.$ac_ext, and return whether this succeeded. ac_fn_c_try_cpp () { as_lineno=${as_lineno-"$1"} as_lineno_stack=as_lineno_stack=$as_lineno_stack if { { ac_try="$ac_cpp conftest.$ac_ext" case "(($ac_try" in *\"* | *\`* | *\\*) ac_try_echo=\$ac_try;; *) ac_try_echo=$ac_try;; esac eval ac_try_echo="\"\$as_me:${as_lineno-$LINENO}: $ac_try_echo\"" $as_echo "$ac_try_echo"; } >&5 (eval "$ac_cpp conftest.$ac_ext") 2>conftest.err ac_status=$? if test -s conftest.err; then grep -v '^ *+' conftest.err >conftest.er1 cat conftest.er1 >&5 mv -f conftest.er1 conftest.err fi $as_echo "$as_me:${as_lineno-$LINENO}: \$? = $ac_status" >&5 test $ac_status = 0; } >/dev/null && { test -z "$ac_c_preproc_warn_flag$ac_c_werror_flag" || test ! -s conftest.err }; then : ac_retval=0 else $as_echo "$as_me: failed program was:" >&5 sed 's/^/| /' conftest.$ac_ext >&5 ac_retval=1 fi eval $as_lineno_stack; test "x$as_lineno_stack" = x && { as_lineno=; unset as_lineno;} as_fn_set_status $ac_retval } # ac_fn_c_try_cpp # ac_fn_c_try_run LINENO # ---------------------- # Try to link conftest.$ac_ext, and return whether this succeeded. Assumes # that executables *can* be run. ac_fn_c_try_run () { as_lineno=${as_lineno-"$1"} as_lineno_stack=as_lineno_stack=$as_lineno_stack if { { ac_try="$ac_link" case "(($ac_try" in *\"* | *\`* | *\\*) ac_try_echo=\$ac_try;; *) ac_try_echo=$ac_try;; esac eval ac_try_echo="\"\$as_me:${as_lineno-$LINENO}: $ac_try_echo\"" $as_echo "$ac_try_echo"; } >&5 (eval "$ac_link") 2>&5 ac_status=$? $as_echo "$as_me:${as_lineno-$LINENO}: \$? = $ac_status" >&5 test $ac_status = 0; } && { ac_try='./conftest$ac_exeext' { { case "(($ac_try" in *\"* | *\`* | *\\*) ac_try_echo=\$ac_try;; *) ac_try_echo=$ac_try;; esac eval ac_try_echo="\"\$as_me:${as_lineno-$LINENO}: $ac_try_echo\"" $as_echo "$ac_try_echo"; } >&5 (eval "$ac_try") 2>&5 ac_status=$? $as_echo "$as_me:${as_lineno-$LINENO}: \$? = $ac_status" >&5 test $ac_status = 0; }; }; then : ac_retval=0 else $as_echo "$as_me: program exited with status $ac_status" >&5 $as_echo "$as_me: failed program was:" >&5 sed 's/^/| /' conftest.$ac_ext >&5 ac_retval=$ac_status fi rm -rf conftest.dSYM conftest_ipa8_conftest.oo eval $as_lineno_stack; test "x$as_lineno_stack" = x && { as_lineno=; unset as_lineno;} as_fn_set_status $ac_retval } # ac_fn_c_try_run # ac_fn_c_check_header_mongrel LINENO HEADER VAR INCLUDES # ------------------------------------------------------- # Tests whether HEADER exists, giving a warning if it cannot be compiled using # the include files in INCLUDES and setting the cache variable VAR # accordingly. ac_fn_c_check_header_mongrel () { as_lineno=${as_lineno-"$1"} as_lineno_stack=as_lineno_stack=$as_lineno_stack if { as_var=$3; eval "test \"\${$as_var+set}\" = set"; }; then : { $as_echo "$as_me:${as_lineno-$LINENO}: checking for $2" >&5 $as_echo_n "checking for $2... " >&6; } if { as_var=$3; eval "test \"\${$as_var+set}\" = set"; }; then : $as_echo_n "(cached) " >&6 fi eval ac_res=\$$3 { $as_echo "$as_me:${as_lineno-$LINENO}: result: $ac_res" >&5 $as_echo "$ac_res" >&6; } else # Is the header compilable? { $as_echo "$as_me:${as_lineno-$LINENO}: checking $2 usability" >&5 $as_echo_n "checking $2 usability... " >&6; } cat confdefs.h - <<_ACEOF >conftest.$ac_ext /* end confdefs.h. */ $4 #include <$2> _ACEOF if ac_fn_c_try_compile "$LINENO"; then : ac_header_compiler=yes else ac_header_compiler=no fi rm -f core conftest.err conftest.$ac_objext conftest.$ac_ext { $as_echo "$as_me:${as_lineno-$LINENO}: result: $ac_header_compiler" >&5 $as_echo "$ac_header_compiler" >&6; } # Is the header present? { $as_echo "$as_me:${as_lineno-$LINENO}: checking $2 presence" >&5 $as_echo_n "checking $2 presence... " >&6; } cat confdefs.h - <<_ACEOF >conftest.$ac_ext /* end confdefs.h. */ #include <$2> _ACEOF if ac_fn_c_try_cpp "$LINENO"; then : ac_header_preproc=yes else ac_header_preproc=no fi rm -f conftest.err conftest.$ac_ext { $as_echo "$as_me:${as_lineno-$LINENO}: result: $ac_header_preproc" >&5 $as_echo "$ac_header_preproc" >&6; } # So? What about this header? case $ac_header_compiler:$ac_header_preproc:$ac_c_preproc_warn_flag in #(( yes:no: ) { $as_echo "$as_me:${as_lineno-$LINENO}: WARNING: $2: accepted by the compiler, rejected by the preprocessor!" >&5 $as_echo "$as_me: WARNING: $2: accepted by the compiler, rejected by the preprocessor!" >&2;} { $as_echo "$as_me:${as_lineno-$LINENO}: WARNING: $2: proceeding with the compiler's result" >&5 $as_echo "$as_me: WARNING: $2: proceeding with the compiler's result" >&2;} ;; no:yes:* ) { $as_echo "$as_me:${as_lineno-$LINENO}: WARNING: $2: present but cannot be compiled" >&5 $as_echo "$as_me: WARNING: $2: present but cannot be compiled" >&2;} { $as_echo "$as_me:${as_lineno-$LINENO}: WARNING: $2: check for missing prerequisite headers?" >&5 $as_echo "$as_me: WARNING: $2: check for missing prerequisite headers?" >&2;} { $as_echo "$as_me:${as_lineno-$LINENO}: WARNING: $2: see the Autoconf documentation" >&5 $as_echo "$as_me: WARNING: $2: see the Autoconf documentation" >&2;} { $as_echo "$as_me:${as_lineno-$LINENO}: WARNING: $2: section \"Present But Cannot Be Compiled\"" >&5 $as_echo "$as_me: WARNING: $2: section \"Present But Cannot Be Compiled\"" >&2;} { $as_echo "$as_me:${as_lineno-$LINENO}: WARNING: $2: proceeding with the compiler's result" >&5 $as_echo "$as_me: WARNING: $2: proceeding with the compiler's result" >&2;} ( cat <<\_ASBOX ## ----------------------------------------- ## ## Report this to mcx-devel@lists.micans.org ## ## ----------------------------------------- ## _ASBOX ) | sed "s/^/$as_me: WARNING: /" >&2 ;; esac { $as_echo "$as_me:${as_lineno-$LINENO}: checking for $2" >&5 $as_echo_n "checking for $2... " >&6; } if { as_var=$3; eval "test \"\${$as_var+set}\" = set"; }; then : $as_echo_n "(cached) " >&6 else eval "$3=\$ac_header_compiler" fi eval ac_res=\$$3 { $as_echo "$as_me:${as_lineno-$LINENO}: result: $ac_res" >&5 $as_echo "$ac_res" >&6; } fi eval $as_lineno_stack; test "x$as_lineno_stack" = x && { as_lineno=; unset as_lineno;} } # ac_fn_c_check_header_mongrel # ac_fn_c_check_header_compile LINENO HEADER VAR INCLUDES # ------------------------------------------------------- # Tests whether HEADER exists and can be compiled using the include files in # INCLUDES, setting the cache variable VAR accordingly. ac_fn_c_check_header_compile () { as_lineno=${as_lineno-"$1"} as_lineno_stack=as_lineno_stack=$as_lineno_stack { $as_echo "$as_me:${as_lineno-$LINENO}: checking for $2" >&5 $as_echo_n "checking for $2... " >&6; } if { as_var=$3; eval "test \"\${$as_var+set}\" = set"; }; then : $as_echo_n "(cached) " >&6 else cat confdefs.h - <<_ACEOF >conftest.$ac_ext /* end confdefs.h. */ $4 #include <$2> _ACEOF if ac_fn_c_try_compile "$LINENO"; then : eval "$3=yes" else eval "$3=no" fi rm -f core conftest.err conftest.$ac_objext conftest.$ac_ext fi eval ac_res=\$$3 { $as_echo "$as_me:${as_lineno-$LINENO}: result: $ac_res" >&5 $as_echo "$ac_res" >&6; } eval $as_lineno_stack; test "x$as_lineno_stack" = x && { as_lineno=; unset as_lineno;} } # ac_fn_c_check_header_compile # ac_fn_c_check_type LINENO TYPE VAR INCLUDES # ------------------------------------------- # Tests whether TYPE exists after having included INCLUDES, setting cache # variable VAR accordingly. ac_fn_c_check_type () { as_lineno=${as_lineno-"$1"} as_lineno_stack=as_lineno_stack=$as_lineno_stack { $as_echo "$as_me:${as_lineno-$LINENO}: checking for $2" >&5 $as_echo_n "checking for $2... " >&6; } if { as_var=$3; eval "test \"\${$as_var+set}\" = set"; }; then : $as_echo_n "(cached) " >&6 else eval "$3=no" cat confdefs.h - <<_ACEOF >conftest.$ac_ext /* end confdefs.h. */ $4 int main () { if (sizeof ($2)) return 0; ; return 0; } _ACEOF if ac_fn_c_try_compile "$LINENO"; then : cat confdefs.h - <<_ACEOF >conftest.$ac_ext /* end confdefs.h. */ $4 int main () { if (sizeof (($2))) return 0; ; return 0; } _ACEOF if ac_fn_c_try_compile "$LINENO"; then : else eval "$3=yes" fi rm -f core conftest.err conftest.$ac_objext conftest.$ac_ext fi rm -f core conftest.err conftest.$ac_objext conftest.$ac_ext fi eval ac_res=\$$3 { $as_echo "$as_me:${as_lineno-$LINENO}: result: $ac_res" >&5 $as_echo "$ac_res" >&6; } eval $as_lineno_stack; test "x$as_lineno_stack" = x && { as_lineno=; unset as_lineno;} } # ac_fn_c_check_type # ac_fn_c_check_func LINENO FUNC VAR # ---------------------------------- # Tests whether FUNC exists, setting the cache variable VAR accordingly ac_fn_c_check_func () { as_lineno=${as_lineno-"$1"} as_lineno_stack=as_lineno_stack=$as_lineno_stack { $as_echo "$as_me:${as_lineno-$LINENO}: checking for $2" >&5 $as_echo_n "checking for $2... " >&6; } if { as_var=$3; eval "test \"\${$as_var+set}\" = set"; }; then : $as_echo_n "(cached) " >&6 else cat confdefs.h - <<_ACEOF >conftest.$ac_ext /* end confdefs.h. */ /* Define $2 to an innocuous variant, in case declares $2. For example, HP-UX 11i declares gettimeofday. */ #define $2 innocuous_$2 /* System header to define __stub macros and hopefully few prototypes, which can conflict with char $2 (); below. Prefer to if __STDC__ is defined, since exists even on freestanding compilers. */ #ifdef __STDC__ # include #else # include #endif #undef $2 /* Override any GCC internal prototype to avoid an error. Use char because int might match the return type of a GCC builtin and then its argument prototype would still apply. */ #ifdef __cplusplus extern "C" #endif char $2 (); /* The GNU C library defines this for functions which it implements to always fail with ENOSYS. Some functions are actually named something starting with __ and the normal name is an alias. */ #if defined __stub_$2 || defined __stub___$2 choke me #endif int main () { return $2 (); ; return 0; } _ACEOF if ac_fn_c_try_link "$LINENO"; then : eval "$3=yes" else eval "$3=no" fi rm -f core conftest.err conftest.$ac_objext \ conftest$ac_exeext conftest.$ac_ext fi eval ac_res=\$$3 { $as_echo "$as_me:${as_lineno-$LINENO}: result: $ac_res" >&5 $as_echo "$ac_res" >&6; } eval $as_lineno_stack; test "x$as_lineno_stack" = x && { as_lineno=; unset as_lineno;} } # ac_fn_c_check_func cat >config.log <<_ACEOF This file contains any messages produced by compilers while running configure, to aid debugging if configure makes a mistake. It was created by apparix $as_me 11-062, which was generated by GNU Autoconf 2.65. Invocation command line was $ $0 $@ _ACEOF exec 5>>config.log { cat <<_ASUNAME ## --------- ## ## Platform. ## ## --------- ## hostname = `(hostname || uname -n) 2>/dev/null | sed 1q` uname -m = `(uname -m) 2>/dev/null || echo unknown` uname -r = `(uname -r) 2>/dev/null || echo unknown` uname -s = `(uname -s) 2>/dev/null || echo unknown` uname -v = `(uname -v) 2>/dev/null || echo unknown` /usr/bin/uname -p = `(/usr/bin/uname -p) 2>/dev/null || echo unknown` /bin/uname -X = `(/bin/uname -X) 2>/dev/null || echo unknown` /bin/arch = `(/bin/arch) 2>/dev/null || echo unknown` /usr/bin/arch -k = `(/usr/bin/arch -k) 2>/dev/null || echo unknown` /usr/convex/getsysinfo = `(/usr/convex/getsysinfo) 2>/dev/null || echo unknown` /usr/bin/hostinfo = `(/usr/bin/hostinfo) 2>/dev/null || echo unknown` /bin/machine = `(/bin/machine) 2>/dev/null || echo unknown` /usr/bin/oslevel = `(/usr/bin/oslevel) 2>/dev/null || echo unknown` /bin/universe = `(/bin/universe) 2>/dev/null || echo unknown` _ASUNAME as_save_IFS=$IFS; IFS=$PATH_SEPARATOR for as_dir in $PATH do IFS=$as_save_IFS test -z "$as_dir" && as_dir=. $as_echo "PATH: $as_dir" done IFS=$as_save_IFS } >&5 cat >&5 <<_ACEOF ## ----------- ## ## Core tests. ## ## ----------- ## _ACEOF # Keep a trace of the command line. # Strip out --no-create and --no-recursion so they do not pile up. # Strip out --silent because we don't want to record it for future runs. # Also quote any args containing shell meta-characters. # Make two passes to allow for proper duplicate-argument suppression. ac_configure_args= ac_configure_args0= ac_configure_args1= ac_must_keep_next=false for ac_pass in 1 2 do for ac_arg do case $ac_arg in -no-create | --no-c* | -n | -no-recursion | --no-r*) continue ;; -q | -quiet | --quiet | --quie | --qui | --qu | --q \ | -silent | --silent | --silen | --sile | --sil) continue ;; *\'*) ac_arg=`$as_echo "$ac_arg" | sed "s/'/'\\\\\\\\''/g"` ;; esac case $ac_pass in 1) as_fn_append ac_configure_args0 " '$ac_arg'" ;; 2) as_fn_append ac_configure_args1 " '$ac_arg'" if test $ac_must_keep_next = true; then ac_must_keep_next=false # Got value, back to normal. else case $ac_arg in *=* | --config-cache | -C | -disable-* | --disable-* \ | -enable-* | --enable-* | -gas | --g* | -nfp | --nf* \ | -q | -quiet | --q* | -silent | --sil* | -v | -verb* \ | -with-* | --with-* | -without-* | --without-* | --x) case "$ac_configure_args0 " in "$ac_configure_args1"*" '$ac_arg' "* ) continue ;; esac ;; -* ) ac_must_keep_next=true ;; esac fi as_fn_append ac_configure_args " '$ac_arg'" ;; esac done done { ac_configure_args0=; unset ac_configure_args0;} { ac_configure_args1=; unset ac_configure_args1;} # When interrupted or exit'd, cleanup temporary files, and complete # config.log. We remove comments because anyway the quotes in there # would cause problems or look ugly. # WARNING: Use '\'' to represent an apostrophe within the trap. # WARNING: Do not start the trap code with a newline, due to a FreeBSD 4.0 bug. trap 'exit_status=$? # Save into config.log some information that might help in debugging. { echo cat <<\_ASBOX ## ---------------- ## ## Cache variables. ## ## ---------------- ## _ASBOX echo # The following way of writing the cache mishandles newlines in values, ( for ac_var in `(set) 2>&1 | sed -n '\''s/^\([a-zA-Z_][a-zA-Z0-9_]*\)=.*/\1/p'\''`; do eval ac_val=\$$ac_var case $ac_val in #( *${as_nl}*) case $ac_var in #( *_cv_*) { $as_echo "$as_me:${as_lineno-$LINENO}: WARNING: cache variable $ac_var contains a newline" >&5 $as_echo "$as_me: WARNING: cache variable $ac_var contains a newline" >&2;} ;; esac case $ac_var in #( _ | IFS | as_nl) ;; #( BASH_ARGV | BASH_SOURCE) eval $ac_var= ;; #( *) { eval $ac_var=; unset $ac_var;} ;; esac ;; esac done (set) 2>&1 | case $as_nl`(ac_space='\'' '\''; set) 2>&1` in #( *${as_nl}ac_space=\ *) sed -n \ "s/'\''/'\''\\\\'\'''\''/g; s/^\\([_$as_cr_alnum]*_cv_[_$as_cr_alnum]*\\)=\\(.*\\)/\\1='\''\\2'\''/p" ;; #( *) sed -n "/^[_$as_cr_alnum]*_cv_[_$as_cr_alnum]*=/p" ;; esac | sort ) echo cat <<\_ASBOX ## ----------------- ## ## Output variables. ## ## ----------------- ## _ASBOX echo for ac_var in $ac_subst_vars do eval ac_val=\$$ac_var case $ac_val in *\'\''*) ac_val=`$as_echo "$ac_val" | sed "s/'\''/'\''\\\\\\\\'\'''\''/g"`;; esac $as_echo "$ac_var='\''$ac_val'\''" done | sort echo if test -n "$ac_subst_files"; then cat <<\_ASBOX ## ------------------- ## ## File substitutions. ## ## ------------------- ## _ASBOX echo for ac_var in $ac_subst_files do eval ac_val=\$$ac_var case $ac_val in *\'\''*) ac_val=`$as_echo "$ac_val" | sed "s/'\''/'\''\\\\\\\\'\'''\''/g"`;; esac $as_echo "$ac_var='\''$ac_val'\''" done | sort echo fi if test -s confdefs.h; then cat <<\_ASBOX ## ----------- ## ## confdefs.h. ## ## ----------- ## _ASBOX echo cat confdefs.h echo fi test "$ac_signal" != 0 && $as_echo "$as_me: caught signal $ac_signal" $as_echo "$as_me: exit $exit_status" } >&5 rm -f core *.core core.conftest.* && rm -f -r conftest* confdefs* conf$$* $ac_clean_files && exit $exit_status ' 0 for ac_signal in 1 2 13 15; do trap 'ac_signal='$ac_signal'; as_fn_exit 1' $ac_signal done ac_signal=0 # confdefs.h avoids OS command line length limits that DEFS can exceed. rm -f -r conftest* confdefs.h $as_echo "/* confdefs.h */" > confdefs.h # Predefined preprocessor variables. cat >>confdefs.h <<_ACEOF #define PACKAGE_NAME "$PACKAGE_NAME" _ACEOF cat >>confdefs.h <<_ACEOF #define PACKAGE_TARNAME "$PACKAGE_TARNAME" _ACEOF cat >>confdefs.h <<_ACEOF #define PACKAGE_VERSION "$PACKAGE_VERSION" _ACEOF cat >>confdefs.h <<_ACEOF #define PACKAGE_STRING "$PACKAGE_STRING" _ACEOF cat >>confdefs.h <<_ACEOF #define PACKAGE_BUGREPORT "$PACKAGE_BUGREPORT" _ACEOF cat >>confdefs.h <<_ACEOF #define PACKAGE_URL "$PACKAGE_URL" _ACEOF # Let the site file select an alternate cache file if it wants to. # Prefer an explicitly selected file to automatically selected ones. ac_site_file1=NONE ac_site_file2=NONE if test -n "$CONFIG_SITE"; then ac_site_file1=$CONFIG_SITE elif test "x$prefix" != xNONE; then ac_site_file1=$prefix/share/config.site ac_site_file2=$prefix/etc/config.site else ac_site_file1=$ac_default_prefix/share/config.site ac_site_file2=$ac_default_prefix/etc/config.site fi for ac_site_file in "$ac_site_file1" "$ac_site_file2" do test "x$ac_site_file" = xNONE && continue if test /dev/null != "$ac_site_file" && test -r "$ac_site_file"; then { $as_echo "$as_me:${as_lineno-$LINENO}: loading site script $ac_site_file" >&5 $as_echo "$as_me: loading site script $ac_site_file" >&6;} sed 's/^/| /' "$ac_site_file" >&5 . "$ac_site_file" fi done if test -r "$cache_file"; then # Some versions of bash will fail to source /dev/null (special files # actually), so we avoid doing that. DJGPP emulates it as a regular file. if test /dev/null != "$cache_file" && test -f "$cache_file"; then { $as_echo "$as_me:${as_lineno-$LINENO}: loading cache $cache_file" >&5 $as_echo "$as_me: loading cache $cache_file" >&6;} case $cache_file in [\\/]* | ?:[\\/]* ) . "$cache_file";; *) . "./$cache_file";; esac fi else { $as_echo "$as_me:${as_lineno-$LINENO}: creating cache $cache_file" >&5 $as_echo "$as_me: creating cache $cache_file" >&6;} >$cache_file fi # Check that the precious variables saved in the cache have kept the same # value. ac_cache_corrupted=false for ac_var in $ac_precious_vars; do eval ac_old_set=\$ac_cv_env_${ac_var}_set eval ac_new_set=\$ac_env_${ac_var}_set eval ac_old_val=\$ac_cv_env_${ac_var}_value eval ac_new_val=\$ac_env_${ac_var}_value case $ac_old_set,$ac_new_set in set,) { $as_echo "$as_me:${as_lineno-$LINENO}: error: \`$ac_var' was set to \`$ac_old_val' in the previous run" >&5 $as_echo "$as_me: error: \`$ac_var' was set to \`$ac_old_val' in the previous run" >&2;} ac_cache_corrupted=: ;; ,set) { $as_echo "$as_me:${as_lineno-$LINENO}: error: \`$ac_var' was not set in the previous run" >&5 $as_echo "$as_me: error: \`$ac_var' was not set in the previous run" >&2;} ac_cache_corrupted=: ;; ,);; *) if test "x$ac_old_val" != "x$ac_new_val"; then # differences in whitespace do not lead to failure. ac_old_val_w=`echo x $ac_old_val` ac_new_val_w=`echo x $ac_new_val` if test "$ac_old_val_w" != "$ac_new_val_w"; then { $as_echo "$as_me:${as_lineno-$LINENO}: error: \`$ac_var' has changed since the previous run:" >&5 $as_echo "$as_me: error: \`$ac_var' has changed since the previous run:" >&2;} ac_cache_corrupted=: else { $as_echo "$as_me:${as_lineno-$LINENO}: warning: ignoring whitespace changes in \`$ac_var' since the previous run:" >&5 $as_echo "$as_me: warning: ignoring whitespace changes in \`$ac_var' since the previous run:" >&2;} eval $ac_var=\$ac_old_val fi { $as_echo "$as_me:${as_lineno-$LINENO}: former value: \`$ac_old_val'" >&5 $as_echo "$as_me: former value: \`$ac_old_val'" >&2;} { $as_echo "$as_me:${as_lineno-$LINENO}: current value: \`$ac_new_val'" >&5 $as_echo "$as_me: current value: \`$ac_new_val'" >&2;} fi;; esac # Pass precious variables to config.status. if test "$ac_new_set" = set; then case $ac_new_val in *\'*) ac_arg=$ac_var=`$as_echo "$ac_new_val" | sed "s/'/'\\\\\\\\''/g"` ;; *) ac_arg=$ac_var=$ac_new_val ;; esac case " $ac_configure_args " in *" '$ac_arg' "*) ;; # Avoid dups. Use of quotes ensures accuracy. *) as_fn_append ac_configure_args " '$ac_arg'" ;; esac fi done if $ac_cache_corrupted; then { $as_echo "$as_me:${as_lineno-$LINENO}: error: in \`$ac_pwd':" >&5 $as_echo "$as_me: error: in \`$ac_pwd':" >&2;} { $as_echo "$as_me:${as_lineno-$LINENO}: error: changes in the environment can compromise the build" >&5 $as_echo "$as_me: error: changes in the environment can compromise the build" >&2;} as_fn_error "run \`make distclean' and/or \`rm $cache_file' and start over" "$LINENO" 5 fi ## -------------------- ## ## Main body of script. ## ## -------------------- ## ac_ext=c ac_cpp='$CPP $CPPFLAGS' ac_compile='$CC -c $CFLAGS $CPPFLAGS conftest.$ac_ext >&5' ac_link='$CC -o conftest$ac_exeext $CFLAGS $CPPFLAGS $LDFLAGS conftest.$ac_ext $LIBS >&5' ac_compiler_gnu=$ac_cv_c_compiler_gnu ac_config_headers="$ac_config_headers config.h" PACKAGE=$PACKAGE_NAME VERSION=$PACKAGE_VERSION am__api_version='1.11' ac_aux_dir= for ac_dir in "$srcdir" "$srcdir/.." "$srcdir/../.."; do for ac_t in install-sh install.sh shtool; do if test -f "$ac_dir/$ac_t"; then ac_aux_dir=$ac_dir ac_install_sh="$ac_aux_dir/$ac_t -c" break 2 fi done done if test -z "$ac_aux_dir"; then as_fn_error "cannot find install-sh, install.sh, or shtool in \"$srcdir\" \"$srcdir/..\" \"$srcdir/../..\"" "$LINENO" 5 fi # These three variables are undocumented and unsupported, # and are intended to be withdrawn in a future Autoconf release. # They can cause serious problems if a builder's source tree is in a directory # whose full name contains unusual characters. ac_config_guess="$SHELL $ac_aux_dir/config.guess" # Please don't use this var. ac_config_sub="$SHELL $ac_aux_dir/config.sub" # Please don't use this var. ac_configure="$SHELL $ac_aux_dir/configure" # Please don't use this var. # 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 # AmigaOS /C/install, which installs bootblocks on floppy discs # AIX 4 /usr/bin/installbsd, which doesn't work without a -g flag # AFS /usr/afsws/bin/install, which mishandles nonexistent args # SVR4 /usr/ucb/install, which tries to use the nonexistent group "staff" # OS/2's system install, which has a completely different semantic # ./install, which can be erroneously created by make from ./install.sh. # Reject install programs that cannot install multiple files. { $as_echo "$as_me:${as_lineno-$LINENO}: checking for a BSD-compatible install" >&5 $as_echo_n "checking for a BSD-compatible install... " >&6; } if test -z "$INSTALL"; then if test "${ac_cv_path_install+set}" = set; then : $as_echo_n "(cached) " >&6 else as_save_IFS=$IFS; IFS=$PATH_SEPARATOR for as_dir in $PATH do IFS=$as_save_IFS test -z "$as_dir" && as_dir=. # Account for people who put trailing slashes in PATH elements. case $as_dir/ in #(( ./ | .// | /[cC]/* | \ /etc/* | /usr/sbin/* | /usr/etc/* | /sbin/* | /usr/afsws/bin/* | \ ?:[\\/]os2[\\/]install[\\/]* | ?:[\\/]OS2[\\/]INSTALL[\\/]* | \ /usr/ucb/* ) ;; *) # OSF1 and SCO ODT 3.0 have their own names for install. # Don't use installbsd from OSF since it installs stuff as root # by default. for ac_prog in ginstall scoinst install; do for ac_exec_ext in '' $ac_executable_extensions; do if { test -f "$as_dir/$ac_prog$ac_exec_ext" && $as_test_x "$as_dir/$ac_prog$ac_exec_ext"; }; then if test $ac_prog = install && grep dspmsg "$as_dir/$ac_prog$ac_exec_ext" >/dev/null 2>&1; then # AIX install. It has an incompatible calling convention. : elif test $ac_prog = install && grep pwplus "$as_dir/$ac_prog$ac_exec_ext" >/dev/null 2>&1; then # program-specific install script used by HP pwplus--don't use. : else rm -rf conftest.one conftest.two conftest.dir echo one > conftest.one echo two > conftest.two mkdir conftest.dir if "$as_dir/$ac_prog$ac_exec_ext" -c conftest.one conftest.two "`pwd`/conftest.dir" && test -s conftest.one && test -s conftest.two && test -s conftest.dir/conftest.one && test -s conftest.dir/conftest.two then ac_cv_path_install="$as_dir/$ac_prog$ac_exec_ext -c" break 3 fi fi fi done done ;; esac done IFS=$as_save_IFS rm -rf conftest.one conftest.two conftest.dir fi if test "${ac_cv_path_install+set}" = set; then INSTALL=$ac_cv_path_install else # As a last resort, use the slow shell script. Don't cache a # value for INSTALL within a source directory, because that will # break other packages using the cache if that directory is # removed, or if the value is a relative name. INSTALL=$ac_install_sh fi fi { $as_echo "$as_me:${as_lineno-$LINENO}: result: $INSTALL" >&5 $as_echo "$INSTALL" >&6; } # 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}' test -z "$INSTALL_SCRIPT" && INSTALL_SCRIPT='${INSTALL}' test -z "$INSTALL_DATA" && INSTALL_DATA='${INSTALL} -m 644' { $as_echo "$as_me:${as_lineno-$LINENO}: checking whether build environment is sane" >&5 $as_echo_n "checking whether build environment is sane... " >&6; } # Just in case sleep 1 echo timestamp > conftest.file # Reject unsafe characters in $srcdir or the absolute working directory # name. Accept space and tab only in the latter. am_lf=' ' case `pwd` in *[\\\"\#\$\&\'\`$am_lf]*) as_fn_error "unsafe absolute working directory name" "$LINENO" 5;; esac case $srcdir in *[\\\"\#\$\&\'\`$am_lf\ \ ]*) as_fn_error "unsafe srcdir value: \`$srcdir'" "$LINENO" 5;; esac # Do `set' in a subshell so we don't clobber the current shell's # arguments. Must try -L first in case configure is actually a # symlink; some systems play weird games with the mod time of symlinks # (eg FreeBSD returns the mod time of the symlink's containing # directory). if ( set X `ls -Lt "$srcdir/configure" conftest.file 2> /dev/null` if test "$*" = "X"; then # -L didn't work. set X `ls -t "$srcdir/configure" conftest.file` fi rm -f conftest.file if test "$*" != "X $srcdir/configure conftest.file" \ && test "$*" != "X conftest.file $srcdir/configure"; then # If neither matched, then we have a broken ls. This can happen # if, for instance, CONFIG_SHELL is bash and it inherits a # broken ls alias from the environment. This has actually # happened. Such a system could not be considered "sane". as_fn_error "ls -t appears to fail. Make sure there is not a broken alias in your environment" "$LINENO" 5 fi test "$2" = conftest.file ) then # Ok. : else as_fn_error "newly created file is older than distributed files! Check your system clock" "$LINENO" 5 fi { $as_echo "$as_me:${as_lineno-$LINENO}: result: yes" >&5 $as_echo "yes" >&6; } test "$program_prefix" != NONE && program_transform_name="s&^&$program_prefix&;$program_transform_name" # Use a double $ so make ignores it. test "$program_suffix" != NONE && program_transform_name="s&\$&$program_suffix&;$program_transform_name" # Double any \ or $. # By default was `s,x,x', remove it if useless. ac_script='s/[\\$]/&&/g;s/;s,x,x,$//' program_transform_name=`$as_echo "$program_transform_name" | sed "$ac_script"` # expand $ac_aux_dir to an absolute path am_aux_dir=`cd $ac_aux_dir && pwd` if test x"${MISSING+set}" != xset; then case $am_aux_dir in *\ * | *\ *) MISSING="\${SHELL} \"$am_aux_dir/missing\"" ;; *) MISSING="\${SHELL} $am_aux_dir/missing" ;; esac fi # Use eval to expand $SHELL if eval "$MISSING --run true"; then am_missing_run="$MISSING --run " else am_missing_run= { $as_echo "$as_me:${as_lineno-$LINENO}: WARNING: \`missing' script is too old or missing" >&5 $as_echo "$as_me: WARNING: \`missing' script is too old or missing" >&2;} fi if test x"${install_sh}" != xset; then case $am_aux_dir in *\ * | *\ *) install_sh="\${SHELL} '$am_aux_dir/install-sh'" ;; *) install_sh="\${SHELL} $am_aux_dir/install-sh" esac fi # Installed binaries are usually stripped using `strip' when the user # run `make install-strip'. However `strip' might not be the right # tool to use in cross-compilation environments, therefore Automake # will honor the `STRIP' environment variable to overrule this program. if test "$cross_compiling" != no; then if test -n "$ac_tool_prefix"; then # Extract the first word of "${ac_tool_prefix}strip", so it can be a program name with args. set dummy ${ac_tool_prefix}strip; ac_word=$2 { $as_echo "$as_me:${as_lineno-$LINENO}: checking for $ac_word" >&5 $as_echo_n "checking for $ac_word... " >&6; } if test "${ac_cv_prog_STRIP+set}" = set; then : $as_echo_n "(cached) " >&6 else if test -n "$STRIP"; then ac_cv_prog_STRIP="$STRIP" # Let the user override the test. else as_save_IFS=$IFS; IFS=$PATH_SEPARATOR for as_dir in $PATH do IFS=$as_save_IFS test -z "$as_dir" && as_dir=. for ac_exec_ext in '' $ac_executable_extensions; do if { test -f "$as_dir/$ac_word$ac_exec_ext" && $as_test_x "$as_dir/$ac_word$ac_exec_ext"; }; then ac_cv_prog_STRIP="${ac_tool_prefix}strip" $as_echo "$as_me:${as_lineno-$LINENO}: found $as_dir/$ac_word$ac_exec_ext" >&5 break 2 fi done done IFS=$as_save_IFS fi fi STRIP=$ac_cv_prog_STRIP if test -n "$STRIP"; then { $as_echo "$as_me:${as_lineno-$LINENO}: result: $STRIP" >&5 $as_echo "$STRIP" >&6; } else { $as_echo "$as_me:${as_lineno-$LINENO}: result: no" >&5 $as_echo "no" >&6; } fi fi if test -z "$ac_cv_prog_STRIP"; then ac_ct_STRIP=$STRIP # Extract the first word of "strip", so it can be a program name with args. set dummy strip; ac_word=$2 { $as_echo "$as_me:${as_lineno-$LINENO}: checking for $ac_word" >&5 $as_echo_n "checking for $ac_word... " >&6; } if test "${ac_cv_prog_ac_ct_STRIP+set}" = set; then : $as_echo_n "(cached) " >&6 else if test -n "$ac_ct_STRIP"; then ac_cv_prog_ac_ct_STRIP="$ac_ct_STRIP" # Let the user override the test. else as_save_IFS=$IFS; IFS=$PATH_SEPARATOR for as_dir in $PATH do IFS=$as_save_IFS test -z "$as_dir" && as_dir=. for ac_exec_ext in '' $ac_executable_extensions; do if { test -f "$as_dir/$ac_word$ac_exec_ext" && $as_test_x "$as_dir/$ac_word$ac_exec_ext"; }; then ac_cv_prog_ac_ct_STRIP="strip" $as_echo "$as_me:${as_lineno-$LINENO}: found $as_dir/$ac_word$ac_exec_ext" >&5 break 2 fi done done IFS=$as_save_IFS fi fi ac_ct_STRIP=$ac_cv_prog_ac_ct_STRIP if test -n "$ac_ct_STRIP"; then { $as_echo "$as_me:${as_lineno-$LINENO}: result: $ac_ct_STRIP" >&5 $as_echo "$ac_ct_STRIP" >&6; } else { $as_echo "$as_me:${as_lineno-$LINENO}: result: no" >&5 $as_echo "no" >&6; } fi if test "x$ac_ct_STRIP" = x; then STRIP=":" else case $cross_compiling:$ac_tool_warned in yes:) { $as_echo "$as_me:${as_lineno-$LINENO}: WARNING: using cross tools not prefixed with host triplet" >&5 $as_echo "$as_me: WARNING: using cross tools not prefixed with host triplet" >&2;} ac_tool_warned=yes ;; esac STRIP=$ac_ct_STRIP fi else STRIP="$ac_cv_prog_STRIP" fi fi INSTALL_STRIP_PROGRAM="\$(install_sh) -c -s" { $as_echo "$as_me:${as_lineno-$LINENO}: checking for a thread-safe mkdir -p" >&5 $as_echo_n "checking for a thread-safe mkdir -p... " >&6; } if test -z "$MKDIR_P"; then if test "${ac_cv_path_mkdir+set}" = set; then : $as_echo_n "(cached) " >&6 else as_save_IFS=$IFS; IFS=$PATH_SEPARATOR for as_dir in $PATH$PATH_SEPARATOR/opt/sfw/bin do IFS=$as_save_IFS test -z "$as_dir" && as_dir=. for ac_prog in mkdir gmkdir; do for ac_exec_ext in '' $ac_executable_extensions; do { test -f "$as_dir/$ac_prog$ac_exec_ext" && $as_test_x "$as_dir/$ac_prog$ac_exec_ext"; } || continue case `"$as_dir/$ac_prog$ac_exec_ext" --version 2>&1` in #( 'mkdir (GNU coreutils) '* | \ 'mkdir (coreutils) '* | \ 'mkdir (fileutils) '4.1*) ac_cv_path_mkdir=$as_dir/$ac_prog$ac_exec_ext break 3;; esac done done done IFS=$as_save_IFS fi test -d ./--version && rmdir ./--version if test "${ac_cv_path_mkdir+set}" = set; then MKDIR_P="$ac_cv_path_mkdir -p" else # As a last resort, use the slow shell script. Don't cache a # value for MKDIR_P within a source directory, because that will # break other packages using the cache if that directory is # removed, or if the value is a relative name. MKDIR_P="$ac_install_sh -d" fi fi { $as_echo "$as_me:${as_lineno-$LINENO}: result: $MKDIR_P" >&5 $as_echo "$MKDIR_P" >&6; } mkdir_p="$MKDIR_P" case $mkdir_p in [\\/$]* | ?:[\\/]*) ;; */*) mkdir_p="\$(top_builddir)/$mkdir_p" ;; esac for ac_prog in gawk mawk nawk awk do # Extract the first word of "$ac_prog", so it can be a program name with args. set dummy $ac_prog; ac_word=$2 { $as_echo "$as_me:${as_lineno-$LINENO}: checking for $ac_word" >&5 $as_echo_n "checking for $ac_word... " >&6; } if test "${ac_cv_prog_AWK+set}" = set; then : $as_echo_n "(cached) " >&6 else if test -n "$AWK"; then ac_cv_prog_AWK="$AWK" # Let the user override the test. else as_save_IFS=$IFS; IFS=$PATH_SEPARATOR for as_dir in $PATH do IFS=$as_save_IFS test -z "$as_dir" && as_dir=. for ac_exec_ext in '' $ac_executable_extensions; do if { test -f "$as_dir/$ac_word$ac_exec_ext" && $as_test_x "$as_dir/$ac_word$ac_exec_ext"; }; then ac_cv_prog_AWK="$ac_prog" $as_echo "$as_me:${as_lineno-$LINENO}: found $as_dir/$ac_word$ac_exec_ext" >&5 break 2 fi done done IFS=$as_save_IFS fi fi AWK=$ac_cv_prog_AWK if test -n "$AWK"; then { $as_echo "$as_me:${as_lineno-$LINENO}: result: $AWK" >&5 $as_echo "$AWK" >&6; } else { $as_echo "$as_me:${as_lineno-$LINENO}: result: no" >&5 $as_echo "no" >&6; } fi test -n "$AWK" && break done { $as_echo "$as_me:${as_lineno-$LINENO}: checking whether ${MAKE-make} sets \$(MAKE)" >&5 $as_echo_n "checking whether ${MAKE-make} sets \$(MAKE)... " >&6; } set x ${MAKE-make} ac_make=`$as_echo "$2" | sed 's/+/p/g; s/[^a-zA-Z0-9_]/_/g'` if { as_var=ac_cv_prog_make_${ac_make}_set; eval "test \"\${$as_var+set}\" = set"; }; then : $as_echo_n "(cached) " >&6 else cat >conftest.make <<\_ACEOF SHELL = /bin/sh all: @echo '@@@%%%=$(MAKE)=@@@%%%' _ACEOF # GNU make sometimes prints "make[1]: Entering...", which would confuse us. case `${MAKE-make} -f conftest.make 2>/dev/null` in *@@@%%%=?*=@@@%%%*) eval ac_cv_prog_make_${ac_make}_set=yes;; *) eval ac_cv_prog_make_${ac_make}_set=no;; esac rm -f conftest.make fi if eval test \$ac_cv_prog_make_${ac_make}_set = yes; then { $as_echo "$as_me:${as_lineno-$LINENO}: result: yes" >&5 $as_echo "yes" >&6; } SET_MAKE= else { $as_echo "$as_me:${as_lineno-$LINENO}: result: no" >&5 $as_echo "no" >&6; } SET_MAKE="MAKE=${MAKE-make}" fi rm -rf .tst 2>/dev/null mkdir .tst 2>/dev/null if test -d .tst; then am__leading_dot=. else am__leading_dot=_ fi rmdir .tst 2>/dev/null if test "`cd $srcdir && pwd`" != "`pwd`"; then # Use -I$(srcdir) only when $(srcdir) != ., so that make's output # is not polluted with repeated "-I." am__isrc=' -I$(srcdir)' # test to see if srcdir already configured if test -f $srcdir/config.status; then as_fn_error "source directory already configured; run \"make distclean\" there first" "$LINENO" 5 fi fi # test whether we have cygpath if test -z "$CYGPATH_W"; then if (cygpath --version) >/dev/null 2>/dev/null; then CYGPATH_W='cygpath -w' else CYGPATH_W=echo fi fi # Define the identity of the package. PACKAGE=$PACKAGE VERSION=$VERSION cat >>confdefs.h <<_ACEOF #define PACKAGE "$PACKAGE" _ACEOF cat >>confdefs.h <<_ACEOF #define VERSION "$VERSION" _ACEOF # Some tools Automake needs. ACLOCAL=${ACLOCAL-"${am_missing_run}aclocal-${am__api_version}"} AUTOCONF=${AUTOCONF-"${am_missing_run}autoconf"} AUTOMAKE=${AUTOMAKE-"${am_missing_run}automake-${am__api_version}"} AUTOHEADER=${AUTOHEADER-"${am_missing_run}autoheader"} MAKEINFO=${MAKEINFO-"${am_missing_run}makeinfo"} # We need awk for the "check" target. The system "awk" is bad on # some platforms. # Always define AMTAR for backward compatibility. AMTAR=${AMTAR-"${am_missing_run}tar"} am__tar='${AMTAR} chof - "$$tardir"'; am__untar='${AMTAR} xf -' # AM_CONFIG_HEADER(config.h) # AC_CONFIG_HEADERS([config.h]) # add a `--enable-maintainer-mode' option to `configure'; `maintainer-only' rules turned off by # default in Makefile.in's { $as_echo "$as_me:${as_lineno-$LINENO}: checking whether to enable maintainer-specific portions of Makefiles" >&5 $as_echo_n "checking whether to enable maintainer-specific portions of Makefiles... " >&6; } # Check whether --enable-maintainer-mode was given. if test "${enable_maintainer_mode+set}" = set; then : enableval=$enable_maintainer_mode; USE_MAINTAINER_MODE=$enableval else USE_MAINTAINER_MODE=no fi { $as_echo "$as_me:${as_lineno-$LINENO}: result: $USE_MAINTAINER_MODE" >&5 $as_echo "$USE_MAINTAINER_MODE" >&6; } if test $USE_MAINTAINER_MODE = yes; then MAINTAINER_MODE_TRUE= MAINTAINER_MODE_FALSE='#' else MAINTAINER_MODE_TRUE='#' MAINTAINER_MODE_FALSE= fi MAINT=$MAINTAINER_MODE_TRUE # Checks for programs. for ac_prog in gawk mawk nawk awk do # Extract the first word of "$ac_prog", so it can be a program name with args. set dummy $ac_prog; ac_word=$2 { $as_echo "$as_me:${as_lineno-$LINENO}: checking for $ac_word" >&5 $as_echo_n "checking for $ac_word... " >&6; } if test "${ac_cv_prog_AWK+set}" = set; then : $as_echo_n "(cached) " >&6 else if test -n "$AWK"; then ac_cv_prog_AWK="$AWK" # Let the user override the test. else as_save_IFS=$IFS; IFS=$PATH_SEPARATOR for as_dir in $PATH do IFS=$as_save_IFS test -z "$as_dir" && as_dir=. for ac_exec_ext in '' $ac_executable_extensions; do if { test -f "$as_dir/$ac_word$ac_exec_ext" && $as_test_x "$as_dir/$ac_word$ac_exec_ext"; }; then ac_cv_prog_AWK="$ac_prog" $as_echo "$as_me:${as_lineno-$LINENO}: found $as_dir/$ac_word$ac_exec_ext" >&5 break 2 fi done done IFS=$as_save_IFS fi fi AWK=$ac_cv_prog_AWK if test -n "$AWK"; then { $as_echo "$as_me:${as_lineno-$LINENO}: result: $AWK" >&5 $as_echo "$AWK" >&6; } else { $as_echo "$as_me:${as_lineno-$LINENO}: result: no" >&5 $as_echo "no" >&6; } fi test -n "$AWK" && break done ac_ext=c ac_cpp='$CPP $CPPFLAGS' ac_compile='$CC -c $CFLAGS $CPPFLAGS conftest.$ac_ext >&5' ac_link='$CC -o conftest$ac_exeext $CFLAGS $CPPFLAGS $LDFLAGS conftest.$ac_ext $LIBS >&5' ac_compiler_gnu=$ac_cv_c_compiler_gnu if test -n "$ac_tool_prefix"; then # Extract the first word of "${ac_tool_prefix}gcc", so it can be a program name with args. set dummy ${ac_tool_prefix}gcc; ac_word=$2 { $as_echo "$as_me:${as_lineno-$LINENO}: checking for $ac_word" >&5 $as_echo_n "checking for $ac_word... " >&6; } if test "${ac_cv_prog_CC+set}" = set; then : $as_echo_n "(cached) " >&6 else if test -n "$CC"; then ac_cv_prog_CC="$CC" # Let the user override the test. else as_save_IFS=$IFS; IFS=$PATH_SEPARATOR for as_dir in $PATH do IFS=$as_save_IFS test -z "$as_dir" && as_dir=. for ac_exec_ext in '' $ac_executable_extensions; do if { test -f "$as_dir/$ac_word$ac_exec_ext" && $as_test_x "$as_dir/$ac_word$ac_exec_ext"; }; then ac_cv_prog_CC="${ac_tool_prefix}gcc" $as_echo "$as_me:${as_lineno-$LINENO}: found $as_dir/$ac_word$ac_exec_ext" >&5 break 2 fi done done IFS=$as_save_IFS fi fi CC=$ac_cv_prog_CC if test -n "$CC"; then { $as_echo "$as_me:${as_lineno-$LINENO}: result: $CC" >&5 $as_echo "$CC" >&6; } else { $as_echo "$as_me:${as_lineno-$LINENO}: result: no" >&5 $as_echo "no" >&6; } fi fi if test -z "$ac_cv_prog_CC"; then ac_ct_CC=$CC # Extract the first word of "gcc", so it can be a program name with args. set dummy gcc; ac_word=$2 { $as_echo "$as_me:${as_lineno-$LINENO}: checking for $ac_word" >&5 $as_echo_n "checking for $ac_word... " >&6; } if test "${ac_cv_prog_ac_ct_CC+set}" = set; then : $as_echo_n "(cached) " >&6 else if test -n "$ac_ct_CC"; then ac_cv_prog_ac_ct_CC="$ac_ct_CC" # Let the user override the test. else as_save_IFS=$IFS; IFS=$PATH_SEPARATOR for as_dir in $PATH do IFS=$as_save_IFS test -z "$as_dir" && as_dir=. for ac_exec_ext in '' $ac_executable_extensions; do if { test -f "$as_dir/$ac_word$ac_exec_ext" && $as_test_x "$as_dir/$ac_word$ac_exec_ext"; }; then ac_cv_prog_ac_ct_CC="gcc" $as_echo "$as_me:${as_lineno-$LINENO}: found $as_dir/$ac_word$ac_exec_ext" >&5 break 2 fi done done IFS=$as_save_IFS fi fi ac_ct_CC=$ac_cv_prog_ac_ct_CC if test -n "$ac_ct_CC"; then { $as_echo "$as_me:${as_lineno-$LINENO}: result: $ac_ct_CC" >&5 $as_echo "$ac_ct_CC" >&6; } else { $as_echo "$as_me:${as_lineno-$LINENO}: result: no" >&5 $as_echo "no" >&6; } fi if test "x$ac_ct_CC" = x; then CC="" else case $cross_compiling:$ac_tool_warned in yes:) { $as_echo "$as_me:${as_lineno-$LINENO}: WARNING: using cross tools not prefixed with host triplet" >&5 $as_echo "$as_me: WARNING: using cross tools not prefixed with host triplet" >&2;} ac_tool_warned=yes ;; esac CC=$ac_ct_CC fi else CC="$ac_cv_prog_CC" fi if test -z "$CC"; then if test -n "$ac_tool_prefix"; then # Extract the first word of "${ac_tool_prefix}cc", so it can be a program name with args. set dummy ${ac_tool_prefix}cc; ac_word=$2 { $as_echo "$as_me:${as_lineno-$LINENO}: checking for $ac_word" >&5 $as_echo_n "checking for $ac_word... " >&6; } if test "${ac_cv_prog_CC+set}" = set; then : $as_echo_n "(cached) " >&6 else if test -n "$CC"; then ac_cv_prog_CC="$CC" # Let the user override the test. else as_save_IFS=$IFS; IFS=$PATH_SEPARATOR for as_dir in $PATH do IFS=$as_save_IFS test -z "$as_dir" && as_dir=. for ac_exec_ext in '' $ac_executable_extensions; do if { test -f "$as_dir/$ac_word$ac_exec_ext" && $as_test_x "$as_dir/$ac_word$ac_exec_ext"; }; then ac_cv_prog_CC="${ac_tool_prefix}cc" $as_echo "$as_me:${as_lineno-$LINENO}: found $as_dir/$ac_word$ac_exec_ext" >&5 break 2 fi done done IFS=$as_save_IFS fi fi CC=$ac_cv_prog_CC if test -n "$CC"; then { $as_echo "$as_me:${as_lineno-$LINENO}: result: $CC" >&5 $as_echo "$CC" >&6; } else { $as_echo "$as_me:${as_lineno-$LINENO}: result: no" >&5 $as_echo "no" >&6; } fi fi fi if test -z "$CC"; then # Extract the first word of "cc", so it can be a program name with args. set dummy cc; ac_word=$2 { $as_echo "$as_me:${as_lineno-$LINENO}: checking for $ac_word" >&5 $as_echo_n "checking for $ac_word... " >&6; } if test "${ac_cv_prog_CC+set}" = set; then : $as_echo_n "(cached) " >&6 else if test -n "$CC"; then ac_cv_prog_CC="$CC" # Let the user override the test. else ac_prog_rejected=no as_save_IFS=$IFS; IFS=$PATH_SEPARATOR for as_dir in $PATH do IFS=$as_save_IFS test -z "$as_dir" && as_dir=. for ac_exec_ext in '' $ac_executable_extensions; do if { test -f "$as_dir/$ac_word$ac_exec_ext" && $as_test_x "$as_dir/$ac_word$ac_exec_ext"; }; then if test "$as_dir/$ac_word$ac_exec_ext" = "/usr/ucb/cc"; then ac_prog_rejected=yes continue fi ac_cv_prog_CC="cc" $as_echo "$as_me:${as_lineno-$LINENO}: found $as_dir/$ac_word$ac_exec_ext" >&5 break 2 fi done done IFS=$as_save_IFS if test $ac_prog_rejected = yes; then # We found a bogon in the path, so make sure we never use it. set dummy $ac_cv_prog_CC shift if test $# != 0; then # We chose a different compiler from the bogus one. # However, it has the same basename, so the bogon will be chosen # first if we set CC to just the basename; use the full file name. shift ac_cv_prog_CC="$as_dir/$ac_word${1+' '}$@" fi fi fi fi CC=$ac_cv_prog_CC if test -n "$CC"; then { $as_echo "$as_me:${as_lineno-$LINENO}: result: $CC" >&5 $as_echo "$CC" >&6; } else { $as_echo "$as_me:${as_lineno-$LINENO}: result: no" >&5 $as_echo "no" >&6; } fi fi if test -z "$CC"; then if test -n "$ac_tool_prefix"; then for ac_prog in cl.exe do # Extract the first word of "$ac_tool_prefix$ac_prog", so it can be a program name with args. set dummy $ac_tool_prefix$ac_prog; ac_word=$2 { $as_echo "$as_me:${as_lineno-$LINENO}: checking for $ac_word" >&5 $as_echo_n "checking for $ac_word... " >&6; } if test "${ac_cv_prog_CC+set}" = set; then : $as_echo_n "(cached) " >&6 else if test -n "$CC"; then ac_cv_prog_CC="$CC" # Let the user override the test. else as_save_IFS=$IFS; IFS=$PATH_SEPARATOR for as_dir in $PATH do IFS=$as_save_IFS test -z "$as_dir" && as_dir=. for ac_exec_ext in '' $ac_executable_extensions; do if { test -f "$as_dir/$ac_word$ac_exec_ext" && $as_test_x "$as_dir/$ac_word$ac_exec_ext"; }; then ac_cv_prog_CC="$ac_tool_prefix$ac_prog" $as_echo "$as_me:${as_lineno-$LINENO}: found $as_dir/$ac_word$ac_exec_ext" >&5 break 2 fi done done IFS=$as_save_IFS fi fi CC=$ac_cv_prog_CC if test -n "$CC"; then { $as_echo "$as_me:${as_lineno-$LINENO}: result: $CC" >&5 $as_echo "$CC" >&6; } else { $as_echo "$as_me:${as_lineno-$LINENO}: result: no" >&5 $as_echo "no" >&6; } fi test -n "$CC" && break done fi if test -z "$CC"; then ac_ct_CC=$CC for ac_prog in cl.exe do # Extract the first word of "$ac_prog", so it can be a program name with args. set dummy $ac_prog; ac_word=$2 { $as_echo "$as_me:${as_lineno-$LINENO}: checking for $ac_word" >&5 $as_echo_n "checking for $ac_word... " >&6; } if test "${ac_cv_prog_ac_ct_CC+set}" = set; then : $as_echo_n "(cached) " >&6 else if test -n "$ac_ct_CC"; then ac_cv_prog_ac_ct_CC="$ac_ct_CC" # Let the user override the test. else as_save_IFS=$IFS; IFS=$PATH_SEPARATOR for as_dir in $PATH do IFS=$as_save_IFS test -z "$as_dir" && as_dir=. for ac_exec_ext in '' $ac_executable_extensions; do if { test -f "$as_dir/$ac_word$ac_exec_ext" && $as_test_x "$as_dir/$ac_word$ac_exec_ext"; }; then ac_cv_prog_ac_ct_CC="$ac_prog" $as_echo "$as_me:${as_lineno-$LINENO}: found $as_dir/$ac_word$ac_exec_ext" >&5 break 2 fi done done IFS=$as_save_IFS fi fi ac_ct_CC=$ac_cv_prog_ac_ct_CC if test -n "$ac_ct_CC"; then { $as_echo "$as_me:${as_lineno-$LINENO}: result: $ac_ct_CC" >&5 $as_echo "$ac_ct_CC" >&6; } else { $as_echo "$as_me:${as_lineno-$LINENO}: result: no" >&5 $as_echo "no" >&6; } fi test -n "$ac_ct_CC" && break done if test "x$ac_ct_CC" = x; then CC="" else case $cross_compiling:$ac_tool_warned in yes:) { $as_echo "$as_me:${as_lineno-$LINENO}: WARNING: using cross tools not prefixed with host triplet" >&5 $as_echo "$as_me: WARNING: using cross tools not prefixed with host triplet" >&2;} ac_tool_warned=yes ;; esac CC=$ac_ct_CC fi fi fi test -z "$CC" && { { $as_echo "$as_me:${as_lineno-$LINENO}: error: in \`$ac_pwd':" >&5 $as_echo "$as_me: error: in \`$ac_pwd':" >&2;} as_fn_error "no acceptable C compiler found in \$PATH See \`config.log' for more details." "$LINENO" 5; } # Provide some information about the compiler. $as_echo "$as_me:${as_lineno-$LINENO}: checking for C compiler version" >&5 set X $ac_compile ac_compiler=$2 for ac_option in --version -v -V -qversion; do { { ac_try="$ac_compiler $ac_option >&5" case "(($ac_try" in *\"* | *\`* | *\\*) ac_try_echo=\$ac_try;; *) ac_try_echo=$ac_try;; esac eval ac_try_echo="\"\$as_me:${as_lineno-$LINENO}: $ac_try_echo\"" $as_echo "$ac_try_echo"; } >&5 (eval "$ac_compiler $ac_option >&5") 2>conftest.err ac_status=$? if test -s conftest.err; then sed '10a\ ... rest of stderr output deleted ... 10q' conftest.err >conftest.er1 cat conftest.er1 >&5 fi rm -f conftest.er1 conftest.err $as_echo "$as_me:${as_lineno-$LINENO}: \$? = $ac_status" >&5 test $ac_status = 0; } done cat confdefs.h - <<_ACEOF >conftest.$ac_ext /* end confdefs.h. */ int main () { ; return 0; } _ACEOF ac_clean_files_save=$ac_clean_files ac_clean_files="$ac_clean_files a.out a.out.dSYM a.exe b.out" # Try to create an executable without -o first, disregard a.out. # It will help us diagnose broken compilers, and finding out an intuition # of exeext. { $as_echo "$as_me:${as_lineno-$LINENO}: checking whether the C compiler works" >&5 $as_echo_n "checking whether the C compiler works... " >&6; } ac_link_default=`$as_echo "$ac_link" | sed 's/ -o *conftest[^ ]*//'` # The possible output files: ac_files="a.out conftest.exe conftest a.exe a_out.exe b.out conftest.*" ac_rmfiles= for ac_file in $ac_files do case $ac_file in *.$ac_ext | *.xcoff | *.tds | *.d | *.pdb | *.xSYM | *.bb | *.bbg | *.map | *.inf | *.dSYM | *.o | *.obj ) ;; * ) ac_rmfiles="$ac_rmfiles $ac_file";; esac done rm -f $ac_rmfiles if { { ac_try="$ac_link_default" case "(($ac_try" in *\"* | *\`* | *\\*) ac_try_echo=\$ac_try;; *) ac_try_echo=$ac_try;; esac eval ac_try_echo="\"\$as_me:${as_lineno-$LINENO}: $ac_try_echo\"" $as_echo "$ac_try_echo"; } >&5 (eval "$ac_link_default") 2>&5 ac_status=$? $as_echo "$as_me:${as_lineno-$LINENO}: \$? = $ac_status" >&5 test $ac_status = 0; }; then : # Autoconf-2.13 could set the ac_cv_exeext variable to `no'. # So ignore a value of `no', otherwise this would lead to `EXEEXT = no' # in a Makefile. We should not override ac_cv_exeext if it was cached, # so that the user can short-circuit this test for compilers unknown to # Autoconf. for ac_file in $ac_files '' do test -f "$ac_file" || continue case $ac_file in *.$ac_ext | *.xcoff | *.tds | *.d | *.pdb | *.xSYM | *.bb | *.bbg | *.map | *.inf | *.dSYM | *.o | *.obj ) ;; [ab].out ) # We found the default executable, but exeext='' is most # certainly right. break;; *.* ) if test "${ac_cv_exeext+set}" = set && test "$ac_cv_exeext" != no; then :; else ac_cv_exeext=`expr "$ac_file" : '[^.]*\(\..*\)'` fi # We set ac_cv_exeext here because the later test for it is not # safe: cross compilers may not add the suffix if given an `-o' # argument, so we may need to know it at that point already. # Even if this section looks crufty: it has the advantage of # actually working. break;; * ) break;; esac done test "$ac_cv_exeext" = no && ac_cv_exeext= else ac_file='' fi if test -z "$ac_file"; then : { $as_echo "$as_me:${as_lineno-$LINENO}: result: no" >&5 $as_echo "no" >&6; } $as_echo "$as_me: failed program was:" >&5 sed 's/^/| /' conftest.$ac_ext >&5 { { $as_echo "$as_me:${as_lineno-$LINENO}: error: in \`$ac_pwd':" >&5 $as_echo "$as_me: error: in \`$ac_pwd':" >&2;} { as_fn_set_status 77 as_fn_error "C compiler cannot create executables See \`config.log' for more details." "$LINENO" 5; }; } else { $as_echo "$as_me:${as_lineno-$LINENO}: result: yes" >&5 $as_echo "yes" >&6; } fi { $as_echo "$as_me:${as_lineno-$LINENO}: checking for C compiler default output file name" >&5 $as_echo_n "checking for C compiler default output file name... " >&6; } { $as_echo "$as_me:${as_lineno-$LINENO}: result: $ac_file" >&5 $as_echo "$ac_file" >&6; } ac_exeext=$ac_cv_exeext rm -f -r a.out a.out.dSYM a.exe conftest$ac_cv_exeext b.out ac_clean_files=$ac_clean_files_save { $as_echo "$as_me:${as_lineno-$LINENO}: checking for suffix of executables" >&5 $as_echo_n "checking for suffix of executables... " >&6; } if { { ac_try="$ac_link" case "(($ac_try" in *\"* | *\`* | *\\*) ac_try_echo=\$ac_try;; *) ac_try_echo=$ac_try;; esac eval ac_try_echo="\"\$as_me:${as_lineno-$LINENO}: $ac_try_echo\"" $as_echo "$ac_try_echo"; } >&5 (eval "$ac_link") 2>&5 ac_status=$? $as_echo "$as_me:${as_lineno-$LINENO}: \$? = $ac_status" >&5 test $ac_status = 0; }; then : # If both `conftest.exe' and `conftest' are `present' (well, observable) # catch `conftest.exe'. For instance with Cygwin, `ls conftest' will # work properly (i.e., refer to `conftest.exe'), while it won't with # `rm'. for ac_file in conftest.exe conftest conftest.*; do test -f "$ac_file" || continue case $ac_file in *.$ac_ext | *.xcoff | *.tds | *.d | *.pdb | *.xSYM | *.bb | *.bbg | *.map | *.inf | *.dSYM | *.o | *.obj ) ;; *.* ) ac_cv_exeext=`expr "$ac_file" : '[^.]*\(\..*\)'` break;; * ) break;; esac done else { { $as_echo "$as_me:${as_lineno-$LINENO}: error: in \`$ac_pwd':" >&5 $as_echo "$as_me: error: in \`$ac_pwd':" >&2;} as_fn_error "cannot compute suffix of executables: cannot compile and link See \`config.log' for more details." "$LINENO" 5; } fi rm -f conftest conftest$ac_cv_exeext { $as_echo "$as_me:${as_lineno-$LINENO}: result: $ac_cv_exeext" >&5 $as_echo "$ac_cv_exeext" >&6; } rm -f conftest.$ac_ext EXEEXT=$ac_cv_exeext ac_exeext=$EXEEXT cat confdefs.h - <<_ACEOF >conftest.$ac_ext /* end confdefs.h. */ #include int main () { FILE *f = fopen ("conftest.out", "w"); return ferror (f) || fclose (f) != 0; ; return 0; } _ACEOF ac_clean_files="$ac_clean_files conftest.out" # Check that the compiler produces executables we can run. If not, either # the compiler is broken, or we cross compile. { $as_echo "$as_me:${as_lineno-$LINENO}: checking whether we are cross compiling" >&5 $as_echo_n "checking whether we are cross compiling... " >&6; } if test "$cross_compiling" != yes; then { { ac_try="$ac_link" case "(($ac_try" in *\"* | *\`* | *\\*) ac_try_echo=\$ac_try;; *) ac_try_echo=$ac_try;; esac eval ac_try_echo="\"\$as_me:${as_lineno-$LINENO}: $ac_try_echo\"" $as_echo "$ac_try_echo"; } >&5 (eval "$ac_link") 2>&5 ac_status=$? $as_echo "$as_me:${as_lineno-$LINENO}: \$? = $ac_status" >&5 test $ac_status = 0; } if { ac_try='./conftest$ac_cv_exeext' { { case "(($ac_try" in *\"* | *\`* | *\\*) ac_try_echo=\$ac_try;; *) ac_try_echo=$ac_try;; esac eval ac_try_echo="\"\$as_me:${as_lineno-$LINENO}: $ac_try_echo\"" $as_echo "$ac_try_echo"; } >&5 (eval "$ac_try") 2>&5 ac_status=$? $as_echo "$as_me:${as_lineno-$LINENO}: \$? = $ac_status" >&5 test $ac_status = 0; }; }; then cross_compiling=no else if test "$cross_compiling" = maybe; then cross_compiling=yes else { { $as_echo "$as_me:${as_lineno-$LINENO}: error: in \`$ac_pwd':" >&5 $as_echo "$as_me: error: in \`$ac_pwd':" >&2;} as_fn_error "cannot run C compiled programs. If you meant to cross compile, use \`--host'. See \`config.log' for more details." "$LINENO" 5; } fi fi fi { $as_echo "$as_me:${as_lineno-$LINENO}: result: $cross_compiling" >&5 $as_echo "$cross_compiling" >&6; } rm -f conftest.$ac_ext conftest$ac_cv_exeext conftest.out ac_clean_files=$ac_clean_files_save { $as_echo "$as_me:${as_lineno-$LINENO}: checking for suffix of object files" >&5 $as_echo_n "checking for suffix of object files... " >&6; } if test "${ac_cv_objext+set}" = set; then : $as_echo_n "(cached) " >&6 else cat confdefs.h - <<_ACEOF >conftest.$ac_ext /* end confdefs.h. */ int main () { ; return 0; } _ACEOF rm -f conftest.o conftest.obj if { { ac_try="$ac_compile" case "(($ac_try" in *\"* | *\`* | *\\*) ac_try_echo=\$ac_try;; *) ac_try_echo=$ac_try;; esac eval ac_try_echo="\"\$as_me:${as_lineno-$LINENO}: $ac_try_echo\"" $as_echo "$ac_try_echo"; } >&5 (eval "$ac_compile") 2>&5 ac_status=$? $as_echo "$as_me:${as_lineno-$LINENO}: \$? = $ac_status" >&5 test $ac_status = 0; }; then : for ac_file in conftest.o conftest.obj conftest.*; do test -f "$ac_file" || continue; case $ac_file in *.$ac_ext | *.xcoff | *.tds | *.d | *.pdb | *.xSYM | *.bb | *.bbg | *.map | *.inf | *.dSYM ) ;; *) ac_cv_objext=`expr "$ac_file" : '.*\.\(.*\)'` break;; esac done else $as_echo "$as_me: failed program was:" >&5 sed 's/^/| /' conftest.$ac_ext >&5 { { $as_echo "$as_me:${as_lineno-$LINENO}: error: in \`$ac_pwd':" >&5 $as_echo "$as_me: error: in \`$ac_pwd':" >&2;} as_fn_error "cannot compute suffix of object files: cannot compile See \`config.log' for more details." "$LINENO" 5; } fi rm -f conftest.$ac_cv_objext conftest.$ac_ext fi { $as_echo "$as_me:${as_lineno-$LINENO}: result: $ac_cv_objext" >&5 $as_echo "$ac_cv_objext" >&6; } OBJEXT=$ac_cv_objext ac_objext=$OBJEXT { $as_echo "$as_me:${as_lineno-$LINENO}: checking whether we are using the GNU C compiler" >&5 $as_echo_n "checking whether we are using the GNU C compiler... " >&6; } if test "${ac_cv_c_compiler_gnu+set}" = set; then : $as_echo_n "(cached) " >&6 else cat confdefs.h - <<_ACEOF >conftest.$ac_ext /* end confdefs.h. */ int main () { #ifndef __GNUC__ choke me #endif ; return 0; } _ACEOF if ac_fn_c_try_compile "$LINENO"; then : ac_compiler_gnu=yes else ac_compiler_gnu=no fi rm -f core conftest.err conftest.$ac_objext conftest.$ac_ext ac_cv_c_compiler_gnu=$ac_compiler_gnu fi { $as_echo "$as_me:${as_lineno-$LINENO}: result: $ac_cv_c_compiler_gnu" >&5 $as_echo "$ac_cv_c_compiler_gnu" >&6; } if test $ac_compiler_gnu = yes; then GCC=yes else GCC= fi ac_test_CFLAGS=${CFLAGS+set} ac_save_CFLAGS=$CFLAGS { $as_echo "$as_me:${as_lineno-$LINENO}: checking whether $CC accepts -g" >&5 $as_echo_n "checking whether $CC accepts -g... " >&6; } if test "${ac_cv_prog_cc_g+set}" = set; then : $as_echo_n "(cached) " >&6 else ac_save_c_werror_flag=$ac_c_werror_flag ac_c_werror_flag=yes ac_cv_prog_cc_g=no CFLAGS="-g" cat confdefs.h - <<_ACEOF >conftest.$ac_ext /* end confdefs.h. */ int main () { ; return 0; } _ACEOF if ac_fn_c_try_compile "$LINENO"; then : ac_cv_prog_cc_g=yes else CFLAGS="" cat confdefs.h - <<_ACEOF >conftest.$ac_ext /* end confdefs.h. */ int main () { ; return 0; } _ACEOF if ac_fn_c_try_compile "$LINENO"; then : else ac_c_werror_flag=$ac_save_c_werror_flag CFLAGS="-g" cat confdefs.h - <<_ACEOF >conftest.$ac_ext /* end confdefs.h. */ int main () { ; return 0; } _ACEOF if ac_fn_c_try_compile "$LINENO"; then : ac_cv_prog_cc_g=yes fi rm -f core conftest.err conftest.$ac_objext conftest.$ac_ext fi rm -f core conftest.err conftest.$ac_objext conftest.$ac_ext fi rm -f core conftest.err conftest.$ac_objext conftest.$ac_ext ac_c_werror_flag=$ac_save_c_werror_flag fi { $as_echo "$as_me:${as_lineno-$LINENO}: result: $ac_cv_prog_cc_g" >&5 $as_echo "$ac_cv_prog_cc_g" >&6; } if test "$ac_test_CFLAGS" = set; then CFLAGS=$ac_save_CFLAGS elif test $ac_cv_prog_cc_g = yes; then if test "$GCC" = yes; then CFLAGS="-g -O2" else CFLAGS="-g" fi else if test "$GCC" = yes; then CFLAGS="-O2" else CFLAGS= fi fi { $as_echo "$as_me:${as_lineno-$LINENO}: checking for $CC option to accept ISO C89" >&5 $as_echo_n "checking for $CC option to accept ISO C89... " >&6; } if test "${ac_cv_prog_cc_c89+set}" = set; then : $as_echo_n "(cached) " >&6 else ac_cv_prog_cc_c89=no ac_save_CC=$CC cat confdefs.h - <<_ACEOF >conftest.$ac_ext /* end confdefs.h. */ #include #include #include #include /* Most of the following tests are stolen from RCS 5.7's src/conf.sh. */ struct buf { int x; }; FILE * (*rcsopen) (struct buf *, struct stat *, int); static char *e (p, i) char **p; int i; { return p[i]; } static char *f (char * (*g) (char **, int), char **p, ...) { char *s; va_list v; va_start (v,p); s = g (p, va_arg (v,int)); va_end (v); return s; } /* OSF 4.0 Compaq cc is some sort of almost-ANSI by default. It has function prototypes and stuff, but not '\xHH' hex character constants. These don't provoke an error unfortunately, instead are silently treated as 'x'. The following induces an error, until -std is added to get proper ANSI mode. Curiously '\x00'!='x' always comes out true, for an array size at least. It's necessary to write '\x00'==0 to get something that's true only with -std. */ int osf4_cc_array ['\x00' == 0 ? 1 : -1]; /* IBM C 6 for AIX is almost-ANSI by default, but it replaces macro parameters inside strings and character constants. */ #define FOO(x) 'x' int xlc6_cc_array[FOO(a) == 'x' ? 1 : -1]; int test (int i, double x); struct s1 {int (*f) (int a);}; struct s2 {int (*f) (double a);}; int pairnames (int, char **, FILE *(*)(struct buf *, struct stat *, int), int, int); int argc; char **argv; int main () { return f (e, argv, 0) != argv[0] || f (e, argv, 1) != argv[1]; ; return 0; } _ACEOF for ac_arg in '' -qlanglvl=extc89 -qlanglvl=ansi -std \ -Ae "-Aa -D_HPUX_SOURCE" "-Xc -D__EXTENSIONS__" do CC="$ac_save_CC $ac_arg" if ac_fn_c_try_compile "$LINENO"; then : ac_cv_prog_cc_c89=$ac_arg fi rm -f core conftest.err conftest.$ac_objext test "x$ac_cv_prog_cc_c89" != "xno" && break done rm -f conftest.$ac_ext CC=$ac_save_CC fi # AC_CACHE_VAL case "x$ac_cv_prog_cc_c89" in x) { $as_echo "$as_me:${as_lineno-$LINENO}: result: none needed" >&5 $as_echo "none needed" >&6; } ;; xno) { $as_echo "$as_me:${as_lineno-$LINENO}: result: unsupported" >&5 $as_echo "unsupported" >&6; } ;; *) CC="$CC $ac_cv_prog_cc_c89" { $as_echo "$as_me:${as_lineno-$LINENO}: result: $ac_cv_prog_cc_c89" >&5 $as_echo "$ac_cv_prog_cc_c89" >&6; } ;; esac if test "x$ac_cv_prog_cc_c89" != xno; then : fi ac_ext=c ac_cpp='$CPP $CPPFLAGS' ac_compile='$CC -c $CFLAGS $CPPFLAGS conftest.$ac_ext >&5' ac_link='$CC -o conftest$ac_exeext $CFLAGS $CPPFLAGS $LDFLAGS conftest.$ac_ext $LIBS >&5' ac_compiler_gnu=$ac_cv_c_compiler_gnu DEPDIR="${am__leading_dot}deps" ac_config_commands="$ac_config_commands depfiles" am_make=${MAKE-make} cat > confinc << 'END' am__doit: @echo this is the am__doit target .PHONY: am__doit END # If we don't find an include directive, just comment out the code. { $as_echo "$as_me:${as_lineno-$LINENO}: checking for style of include used by $am_make" >&5 $as_echo_n "checking for style of include used by $am_make... " >&6; } am__include="#" am__quote= _am_result=none # First try GNU make style include. echo "include confinc" > confmf # Ignore all kinds of additional output from `make'. case `$am_make -s -f confmf 2> /dev/null` in #( *the\ am__doit\ target*) am__include=include am__quote= _am_result=GNU ;; esac # Now try BSD make style include. if test "$am__include" = "#"; then echo '.include "confinc"' > confmf case `$am_make -s -f confmf 2> /dev/null` in #( *the\ am__doit\ target*) am__include=.include am__quote="\"" _am_result=BSD ;; esac fi { $as_echo "$as_me:${as_lineno-$LINENO}: result: $_am_result" >&5 $as_echo "$_am_result" >&6; } rm -f confinc confmf # Check whether --enable-dependency-tracking was given. if test "${enable_dependency_tracking+set}" = set; then : enableval=$enable_dependency_tracking; fi if test "x$enable_dependency_tracking" != xno; then am_depcomp="$ac_aux_dir/depcomp" AMDEPBACKSLASH='\' fi if test "x$enable_dependency_tracking" != xno; then AMDEP_TRUE= AMDEP_FALSE='#' else AMDEP_TRUE='#' AMDEP_FALSE= fi depcc="$CC" am_compiler_list= { $as_echo "$as_me:${as_lineno-$LINENO}: checking dependency style of $depcc" >&5 $as_echo_n "checking dependency style of $depcc... " >&6; } if test "${am_cv_CC_dependencies_compiler_type+set}" = set; then : $as_echo_n "(cached) " >&6 else if test -z "$AMDEP_TRUE" && test -f "$am_depcomp"; then # We make a subdir and do the tests there. Otherwise we can end up # making bogus files that we don't know about and never remove. For # instance it was reported that on HP-UX the gcc test will end up # making a dummy file named `D' -- because `-MD' means `put the output # in D'. mkdir conftest.dir # Copy depcomp to subdir because otherwise we won't find it if we're # using a relative directory. cp "$am_depcomp" conftest.dir cd conftest.dir # We will build objects and dependencies in a subdirectory because # it helps to detect inapplicable dependency modes. For instance # both Tru64's cc and ICC support -MD to output dependencies as a # side effect of compilation, but ICC will put the dependencies in # the current directory while Tru64 will put them in the object # directory. mkdir sub am_cv_CC_dependencies_compiler_type=none if test "$am_compiler_list" = ""; then am_compiler_list=`sed -n 's/^#*\([a-zA-Z0-9]*\))$/\1/p' < ./depcomp` fi am__universal=false case " $depcc " in #( *\ -arch\ *\ -arch\ *) am__universal=true ;; esac for depmode in $am_compiler_list; do # Setup a source with many dependencies, because some compilers # like to wrap large dependency lists on column 80 (with \), and # we should not choose a depcomp mode which is confused by this. # # We need to recreate these files for each test, as the compiler may # overwrite some of them when testing with obscure command lines. # This happens at least with the AIX C compiler. : > sub/conftest.c for i in 1 2 3 4 5 6; do echo '#include "conftst'$i'.h"' >> sub/conftest.c # Using `: > sub/conftst$i.h' creates only sub/conftst1.h with # Solaris 8's {/usr,}/bin/sh. touch sub/conftst$i.h done echo "${am__include} ${am__quote}sub/conftest.Po${am__quote}" > confmf # We check with `-c' and `-o' for the sake of the "dashmstdout" # mode. It turns out that the SunPro C++ compiler does not properly # handle `-M -o', and we need to detect this. Also, some Intel # versions had trouble with output in subdirs am__obj=sub/conftest.${OBJEXT-o} am__minus_obj="-o $am__obj" case $depmode in gcc) # This depmode causes a compiler race in universal mode. test "$am__universal" = false || continue ;; nosideeffect) # after this tag, mechanisms are not by side-effect, so they'll # only be used when explicitly requested if test "x$enable_dependency_tracking" = xyes; then continue else break fi ;; msvisualcpp | msvcmsys) # This compiler won't grok `-c -o', but also, the minuso test has # not run yet. These depmodes are late enough in the game, and # so weak that their functioning should not be impacted. am__obj=conftest.${OBJEXT-o} am__minus_obj= ;; none) break ;; esac if depmode=$depmode \ source=sub/conftest.c object=$am__obj \ depfile=sub/conftest.Po tmpdepfile=sub/conftest.TPo \ $SHELL ./depcomp $depcc -c $am__minus_obj sub/conftest.c \ >/dev/null 2>conftest.err && grep sub/conftst1.h sub/conftest.Po > /dev/null 2>&1 && grep sub/conftst6.h sub/conftest.Po > /dev/null 2>&1 && grep $am__obj sub/conftest.Po > /dev/null 2>&1 && ${MAKE-make} -s -f confmf > /dev/null 2>&1; then # icc doesn't choke on unknown options, it will just issue warnings # or remarks (even with -Werror). So we grep stderr for any message # that says an option was ignored or not supported. # When given -MP, icc 7.0 and 7.1 complain thusly: # icc: Command line warning: ignoring option '-M'; no argument required # The diagnosis changed in icc 8.0: # icc: Command line remark: option '-MP' not supported if (grep 'ignoring option' conftest.err || grep 'not supported' conftest.err) >/dev/null 2>&1; then :; else am_cv_CC_dependencies_compiler_type=$depmode break fi fi done cd .. rm -rf conftest.dir else am_cv_CC_dependencies_compiler_type=none fi fi { $as_echo "$as_me:${as_lineno-$LINENO}: result: $am_cv_CC_dependencies_compiler_type" >&5 $as_echo "$am_cv_CC_dependencies_compiler_type" >&6; } CCDEPMODE=depmode=$am_cv_CC_dependencies_compiler_type if test "x$enable_dependency_tracking" != xno \ && test "$am_cv_CC_dependencies_compiler_type" = gcc3; then am__fastdepCC_TRUE= am__fastdepCC_FALSE='#' else am__fastdepCC_TRUE='#' am__fastdepCC_FALSE= fi { $as_echo "$as_me:${as_lineno-$LINENO}: checking whether ln -s works" >&5 $as_echo_n "checking whether ln -s works... " >&6; } LN_S=$as_ln_s if test "$LN_S" = "ln -s"; then { $as_echo "$as_me:${as_lineno-$LINENO}: result: yes" >&5 $as_echo "yes" >&6; } else { $as_echo "$as_me:${as_lineno-$LINENO}: result: no, using $LN_S" >&5 $as_echo "no, using $LN_S" >&6; } fi if test -n "$ac_tool_prefix"; then # Extract the first word of "${ac_tool_prefix}ranlib", so it can be a program name with args. set dummy ${ac_tool_prefix}ranlib; ac_word=$2 { $as_echo "$as_me:${as_lineno-$LINENO}: checking for $ac_word" >&5 $as_echo_n "checking for $ac_word... " >&6; } if test "${ac_cv_prog_RANLIB+set}" = set; then : $as_echo_n "(cached) " >&6 else if test -n "$RANLIB"; then ac_cv_prog_RANLIB="$RANLIB" # Let the user override the test. else as_save_IFS=$IFS; IFS=$PATH_SEPARATOR for as_dir in $PATH do IFS=$as_save_IFS test -z "$as_dir" && as_dir=. for ac_exec_ext in '' $ac_executable_extensions; do if { test -f "$as_dir/$ac_word$ac_exec_ext" && $as_test_x "$as_dir/$ac_word$ac_exec_ext"; }; then ac_cv_prog_RANLIB="${ac_tool_prefix}ranlib" $as_echo "$as_me:${as_lineno-$LINENO}: found $as_dir/$ac_word$ac_exec_ext" >&5 break 2 fi done done IFS=$as_save_IFS fi fi RANLIB=$ac_cv_prog_RANLIB if test -n "$RANLIB"; then { $as_echo "$as_me:${as_lineno-$LINENO}: result: $RANLIB" >&5 $as_echo "$RANLIB" >&6; } else { $as_echo "$as_me:${as_lineno-$LINENO}: result: no" >&5 $as_echo "no" >&6; } fi fi if test -z "$ac_cv_prog_RANLIB"; then ac_ct_RANLIB=$RANLIB # Extract the first word of "ranlib", so it can be a program name with args. set dummy ranlib; ac_word=$2 { $as_echo "$as_me:${as_lineno-$LINENO}: checking for $ac_word" >&5 $as_echo_n "checking for $ac_word... " >&6; } if test "${ac_cv_prog_ac_ct_RANLIB+set}" = set; then : $as_echo_n "(cached) " >&6 else if test -n "$ac_ct_RANLIB"; then ac_cv_prog_ac_ct_RANLIB="$ac_ct_RANLIB" # Let the user override the test. else as_save_IFS=$IFS; IFS=$PATH_SEPARATOR for as_dir in $PATH do IFS=$as_save_IFS test -z "$as_dir" && as_dir=. for ac_exec_ext in '' $ac_executable_extensions; do if { test -f "$as_dir/$ac_word$ac_exec_ext" && $as_test_x "$as_dir/$ac_word$ac_exec_ext"; }; then ac_cv_prog_ac_ct_RANLIB="ranlib" $as_echo "$as_me:${as_lineno-$LINENO}: found $as_dir/$ac_word$ac_exec_ext" >&5 break 2 fi done done IFS=$as_save_IFS fi fi ac_ct_RANLIB=$ac_cv_prog_ac_ct_RANLIB if test -n "$ac_ct_RANLIB"; then { $as_echo "$as_me:${as_lineno-$LINENO}: result: $ac_ct_RANLIB" >&5 $as_echo "$ac_ct_RANLIB" >&6; } else { $as_echo "$as_me:${as_lineno-$LINENO}: result: no" >&5 $as_echo "no" >&6; } fi if test "x$ac_ct_RANLIB" = x; then RANLIB=":" else case $cross_compiling:$ac_tool_warned in yes:) { $as_echo "$as_me:${as_lineno-$LINENO}: WARNING: using cross tools not prefixed with host triplet" >&5 $as_echo "$as_me: WARNING: using cross tools not prefixed with host triplet" >&2;} ac_tool_warned=yes ;; esac RANLIB=$ac_ct_RANLIB fi else RANLIB="$ac_cv_prog_RANLIB" fi # Checks for libraries. # FIXME: Replace `main' with a function in `-lm': { $as_echo "$as_me:${as_lineno-$LINENO}: checking for main in -lm" >&5 $as_echo_n "checking for main in -lm... " >&6; } if test "${ac_cv_lib_m_main+set}" = set; then : $as_echo_n "(cached) " >&6 else ac_check_lib_save_LIBS=$LIBS LIBS="-lm $LIBS" cat confdefs.h - <<_ACEOF >conftest.$ac_ext /* end confdefs.h. */ int main () { return main (); ; return 0; } _ACEOF if ac_fn_c_try_link "$LINENO"; then : ac_cv_lib_m_main=yes else ac_cv_lib_m_main=no fi rm -f core conftest.err conftest.$ac_objext \ conftest$ac_exeext conftest.$ac_ext LIBS=$ac_check_lib_save_LIBS fi { $as_echo "$as_me:${as_lineno-$LINENO}: result: $ac_cv_lib_m_main" >&5 $as_echo "$ac_cv_lib_m_main" >&6; } if test "x$ac_cv_lib_m_main" = x""yes; then : cat >>confdefs.h <<_ACEOF #define HAVE_LIBM 1 _ACEOF LIBS="-lm $LIBS" fi # Checks for header files. ac_ext=c ac_cpp='$CPP $CPPFLAGS' ac_compile='$CC -c $CFLAGS $CPPFLAGS conftest.$ac_ext >&5' ac_link='$CC -o conftest$ac_exeext $CFLAGS $CPPFLAGS $LDFLAGS conftest.$ac_ext $LIBS >&5' ac_compiler_gnu=$ac_cv_c_compiler_gnu { $as_echo "$as_me:${as_lineno-$LINENO}: checking how to run the C preprocessor" >&5 $as_echo_n "checking how to run the C preprocessor... " >&6; } # On Suns, sometimes $CPP names a directory. if test -n "$CPP" && test -d "$CPP"; then CPP= fi if test -z "$CPP"; then if test "${ac_cv_prog_CPP+set}" = set; then : $as_echo_n "(cached) " >&6 else # Double quotes because CPP needs to be expanded for CPP in "$CC -E" "$CC -E -traditional-cpp" "/lib/cpp" do ac_preproc_ok=false for ac_c_preproc_warn_flag in '' yes do # Use a header file that comes with gcc, so configuring glibc # with a fresh cross-compiler works. # Prefer to if __STDC__ is defined, since # exists even on freestanding compilers. # On the NeXT, cc -E runs the code through the compiler's parser, # not just through cpp. "Syntax error" is here to catch this case. cat confdefs.h - <<_ACEOF >conftest.$ac_ext /* end confdefs.h. */ #ifdef __STDC__ # include #else # include #endif Syntax error _ACEOF if ac_fn_c_try_cpp "$LINENO"; then : else # Broken: fails on valid input. continue fi rm -f conftest.err conftest.$ac_ext # OK, works on sane cases. Now check whether nonexistent headers # can be detected and how. cat confdefs.h - <<_ACEOF >conftest.$ac_ext /* end confdefs.h. */ #include _ACEOF if ac_fn_c_try_cpp "$LINENO"; then : # Broken: success on invalid input. continue else # Passes both tests. ac_preproc_ok=: break fi rm -f conftest.err conftest.$ac_ext done # Because of `break', _AC_PREPROC_IFELSE's cleaning code was skipped. rm -f conftest.err conftest.$ac_ext if $ac_preproc_ok; then : break fi done ac_cv_prog_CPP=$CPP fi CPP=$ac_cv_prog_CPP else ac_cv_prog_CPP=$CPP fi { $as_echo "$as_me:${as_lineno-$LINENO}: result: $CPP" >&5 $as_echo "$CPP" >&6; } ac_preproc_ok=false for ac_c_preproc_warn_flag in '' yes do # Use a header file that comes with gcc, so configuring glibc # with a fresh cross-compiler works. # Prefer to if __STDC__ is defined, since # exists even on freestanding compilers. # On the NeXT, cc -E runs the code through the compiler's parser, # not just through cpp. "Syntax error" is here to catch this case. cat confdefs.h - <<_ACEOF >conftest.$ac_ext /* end confdefs.h. */ #ifdef __STDC__ # include #else # include #endif Syntax error _ACEOF if ac_fn_c_try_cpp "$LINENO"; then : else # Broken: fails on valid input. continue fi rm -f conftest.err conftest.$ac_ext # OK, works on sane cases. Now check whether nonexistent headers # can be detected and how. cat confdefs.h - <<_ACEOF >conftest.$ac_ext /* end confdefs.h. */ #include _ACEOF if ac_fn_c_try_cpp "$LINENO"; then : # Broken: success on invalid input. continue else # Passes both tests. ac_preproc_ok=: break fi rm -f conftest.err conftest.$ac_ext done # Because of `break', _AC_PREPROC_IFELSE's cleaning code was skipped. rm -f conftest.err conftest.$ac_ext if $ac_preproc_ok; then : else { { $as_echo "$as_me:${as_lineno-$LINENO}: error: in \`$ac_pwd':" >&5 $as_echo "$as_me: error: in \`$ac_pwd':" >&2;} as_fn_error "C preprocessor \"$CPP\" fails sanity check See \`config.log' for more details." "$LINENO" 5; } fi ac_ext=c ac_cpp='$CPP $CPPFLAGS' ac_compile='$CC -c $CFLAGS $CPPFLAGS conftest.$ac_ext >&5' ac_link='$CC -o conftest$ac_exeext $CFLAGS $CPPFLAGS $LDFLAGS conftest.$ac_ext $LIBS >&5' ac_compiler_gnu=$ac_cv_c_compiler_gnu { $as_echo "$as_me:${as_lineno-$LINENO}: checking for grep that handles long lines and -e" >&5 $as_echo_n "checking for grep that handles long lines and -e... " >&6; } if test "${ac_cv_path_GREP+set}" = set; then : $as_echo_n "(cached) " >&6 else if test -z "$GREP"; then ac_path_GREP_found=false # Loop through the user's path and test for each of PROGNAME-LIST as_save_IFS=$IFS; IFS=$PATH_SEPARATOR for as_dir in $PATH$PATH_SEPARATOR/usr/xpg4/bin do IFS=$as_save_IFS test -z "$as_dir" && as_dir=. for ac_prog in grep ggrep; do for ac_exec_ext in '' $ac_executable_extensions; do ac_path_GREP="$as_dir/$ac_prog$ac_exec_ext" { test -f "$ac_path_GREP" && $as_test_x "$ac_path_GREP"; } || continue # Check for GNU ac_path_GREP and select it if it is found. # Check for GNU $ac_path_GREP case `"$ac_path_GREP" --version 2>&1` in *GNU*) ac_cv_path_GREP="$ac_path_GREP" ac_path_GREP_found=:;; *) ac_count=0 $as_echo_n 0123456789 >"conftest.in" while : do cat "conftest.in" "conftest.in" >"conftest.tmp" mv "conftest.tmp" "conftest.in" cp "conftest.in" "conftest.nl" $as_echo 'GREP' >> "conftest.nl" "$ac_path_GREP" -e 'GREP$' -e '-(cannot match)-' < "conftest.nl" >"conftest.out" 2>/dev/null || break diff "conftest.out" "conftest.nl" >/dev/null 2>&1 || break as_fn_arith $ac_count + 1 && ac_count=$as_val if test $ac_count -gt ${ac_path_GREP_max-0}; then # Best one so far, save it but keep looking for a better one ac_cv_path_GREP="$ac_path_GREP" ac_path_GREP_max=$ac_count fi # 10*(2^10) chars as input seems more than enough test $ac_count -gt 10 && break done rm -f conftest.in conftest.tmp conftest.nl conftest.out;; esac $ac_path_GREP_found && break 3 done done done IFS=$as_save_IFS if test -z "$ac_cv_path_GREP"; then as_fn_error "no acceptable grep could be found in $PATH$PATH_SEPARATOR/usr/xpg4/bin" "$LINENO" 5 fi else ac_cv_path_GREP=$GREP fi fi { $as_echo "$as_me:${as_lineno-$LINENO}: result: $ac_cv_path_GREP" >&5 $as_echo "$ac_cv_path_GREP" >&6; } GREP="$ac_cv_path_GREP" { $as_echo "$as_me:${as_lineno-$LINENO}: checking for egrep" >&5 $as_echo_n "checking for egrep... " >&6; } if test "${ac_cv_path_EGREP+set}" = set; then : $as_echo_n "(cached) " >&6 else if echo a | $GREP -E '(a|b)' >/dev/null 2>&1 then ac_cv_path_EGREP="$GREP -E" else if test -z "$EGREP"; then ac_path_EGREP_found=false # Loop through the user's path and test for each of PROGNAME-LIST as_save_IFS=$IFS; IFS=$PATH_SEPARATOR for as_dir in $PATH$PATH_SEPARATOR/usr/xpg4/bin do IFS=$as_save_IFS test -z "$as_dir" && as_dir=. for ac_prog in egrep; do for ac_exec_ext in '' $ac_executable_extensions; do ac_path_EGREP="$as_dir/$ac_prog$ac_exec_ext" { test -f "$ac_path_EGREP" && $as_test_x "$ac_path_EGREP"; } || continue # Check for GNU ac_path_EGREP and select it if it is found. # Check for GNU $ac_path_EGREP case `"$ac_path_EGREP" --version 2>&1` in *GNU*) ac_cv_path_EGREP="$ac_path_EGREP" ac_path_EGREP_found=:;; *) ac_count=0 $as_echo_n 0123456789 >"conftest.in" while : do cat "conftest.in" "conftest.in" >"conftest.tmp" mv "conftest.tmp" "conftest.in" cp "conftest.in" "conftest.nl" $as_echo 'EGREP' >> "conftest.nl" "$ac_path_EGREP" 'EGREP$' < "conftest.nl" >"conftest.out" 2>/dev/null || break diff "conftest.out" "conftest.nl" >/dev/null 2>&1 || break as_fn_arith $ac_count + 1 && ac_count=$as_val if test $ac_count -gt ${ac_path_EGREP_max-0}; then # Best one so far, save it but keep looking for a better one ac_cv_path_EGREP="$ac_path_EGREP" ac_path_EGREP_max=$ac_count fi # 10*(2^10) chars as input seems more than enough test $ac_count -gt 10 && break done rm -f conftest.in conftest.tmp conftest.nl conftest.out;; esac $ac_path_EGREP_found && break 3 done done done IFS=$as_save_IFS if test -z "$ac_cv_path_EGREP"; then as_fn_error "no acceptable egrep could be found in $PATH$PATH_SEPARATOR/usr/xpg4/bin" "$LINENO" 5 fi else ac_cv_path_EGREP=$EGREP fi fi fi { $as_echo "$as_me:${as_lineno-$LINENO}: result: $ac_cv_path_EGREP" >&5 $as_echo "$ac_cv_path_EGREP" >&6; } EGREP="$ac_cv_path_EGREP" { $as_echo "$as_me:${as_lineno-$LINENO}: checking for ANSI C header files" >&5 $as_echo_n "checking for ANSI C header files... " >&6; } if test "${ac_cv_header_stdc+set}" = set; then : $as_echo_n "(cached) " >&6 else cat confdefs.h - <<_ACEOF >conftest.$ac_ext /* end confdefs.h. */ #include #include #include #include int main () { ; return 0; } _ACEOF if ac_fn_c_try_compile "$LINENO"; then : ac_cv_header_stdc=yes else ac_cv_header_stdc=no fi rm -f core conftest.err conftest.$ac_objext conftest.$ac_ext if test $ac_cv_header_stdc = yes; then # SunOS 4.x string.h does not declare mem*, contrary to ANSI. cat confdefs.h - <<_ACEOF >conftest.$ac_ext /* end confdefs.h. */ #include _ACEOF if (eval "$ac_cpp conftest.$ac_ext") 2>&5 | $EGREP "memchr" >/dev/null 2>&1; then : else ac_cv_header_stdc=no fi rm -f conftest* fi if test $ac_cv_header_stdc = yes; then # ISC 2.0.2 stdlib.h does not declare free, contrary to ANSI. cat confdefs.h - <<_ACEOF >conftest.$ac_ext /* end confdefs.h. */ #include _ACEOF if (eval "$ac_cpp conftest.$ac_ext") 2>&5 | $EGREP "free" >/dev/null 2>&1; then : else ac_cv_header_stdc=no fi rm -f conftest* fi if test $ac_cv_header_stdc = yes; then # /bin/cc in Irix-4.0.5 gets non-ANSI ctype macros unless using -ansi. if test "$cross_compiling" = yes; then : : else cat confdefs.h - <<_ACEOF >conftest.$ac_ext /* end confdefs.h. */ #include #include #if ((' ' & 0x0FF) == 0x020) # define ISLOWER(c) ('a' <= (c) && (c) <= 'z') # define TOUPPER(c) (ISLOWER(c) ? 'A' + ((c) - 'a') : (c)) #else # define ISLOWER(c) \ (('a' <= (c) && (c) <= 'i') \ || ('j' <= (c) && (c) <= 'r') \ || ('s' <= (c) && (c) <= 'z')) # define TOUPPER(c) (ISLOWER(c) ? ((c) | 0x40) : (c)) #endif #define XOR(e, f) (((e) && !(f)) || (!(e) && (f))) int main () { int i; for (i = 0; i < 256; i++) if (XOR (islower (i), ISLOWER (i)) || toupper (i) != TOUPPER (i)) return 2; return 0; } _ACEOF if ac_fn_c_try_run "$LINENO"; then : else ac_cv_header_stdc=no fi rm -f core *.core core.conftest.* gmon.out bb.out conftest$ac_exeext \ conftest.$ac_objext conftest.beam conftest.$ac_ext fi fi fi { $as_echo "$as_me:${as_lineno-$LINENO}: result: $ac_cv_header_stdc" >&5 $as_echo "$ac_cv_header_stdc" >&6; } if test $ac_cv_header_stdc = yes; then $as_echo "#define STDC_HEADERS 1" >>confdefs.h fi { $as_echo "$as_me:${as_lineno-$LINENO}: checking for sys/wait.h that is POSIX.1 compatible" >&5 $as_echo_n "checking for sys/wait.h that is POSIX.1 compatible... " >&6; } if test "${ac_cv_header_sys_wait_h+set}" = set; then : $as_echo_n "(cached) " >&6 else cat confdefs.h - <<_ACEOF >conftest.$ac_ext /* end confdefs.h. */ #include #include #ifndef WEXITSTATUS # define WEXITSTATUS(stat_val) ((unsigned int) (stat_val) >> 8) #endif #ifndef WIFEXITED # define WIFEXITED(stat_val) (((stat_val) & 255) == 0) #endif int main () { int s; wait (&s); s = WIFEXITED (s) ? WEXITSTATUS (s) : 1; ; return 0; } _ACEOF if ac_fn_c_try_compile "$LINENO"; then : ac_cv_header_sys_wait_h=yes else ac_cv_header_sys_wait_h=no fi rm -f core conftest.err conftest.$ac_objext conftest.$ac_ext fi { $as_echo "$as_me:${as_lineno-$LINENO}: result: $ac_cv_header_sys_wait_h" >&5 $as_echo "$ac_cv_header_sys_wait_h" >&6; } if test $ac_cv_header_sys_wait_h = yes; then $as_echo "#define HAVE_SYS_WAIT_H 1" >>confdefs.h fi # On IRIX 5.3, sys/types and inttypes.h are conflicting. for ac_header in sys/types.h sys/stat.h stdlib.h string.h memory.h strings.h \ inttypes.h stdint.h unistd.h do : as_ac_Header=`$as_echo "ac_cv_header_$ac_header" | $as_tr_sh` ac_fn_c_check_header_compile "$LINENO" "$ac_header" "$as_ac_Header" "$ac_includes_default " eval as_val=\$$as_ac_Header if test "x$as_val" = x""yes; then : cat >>confdefs.h <<_ACEOF #define `$as_echo "HAVE_$ac_header" | $as_tr_cpp` 1 _ACEOF fi done for ac_header in fcntl.h float.h limits.h stdlib.h string.h do : as_ac_Header=`$as_echo "ac_cv_header_$ac_header" | $as_tr_sh` ac_fn_c_check_header_mongrel "$LINENO" "$ac_header" "$as_ac_Header" "$ac_includes_default" eval as_val=\$$as_ac_Header if test "x$as_val" = x""yes; then : cat >>confdefs.h <<_ACEOF #define `$as_echo "HAVE_$ac_header" | $as_tr_cpp` 1 _ACEOF fi done { $as_echo "$as_me:${as_lineno-$LINENO}: checking for va_copy() function" >&5 $as_echo_n "checking for va_copy() function... " >&6; } if test "${ac_cv_va_copy+set}" = set; then : $as_echo_n "(cached) " >&6 else ac_cv_va_copy="" if test ".$ac_cv_va_copy" = .; then if test "$cross_compiling" = yes; then : { { $as_echo "$as_me:${as_lineno-$LINENO}: error: in \`$ac_pwd':" >&5 $as_echo "$as_me: error: in \`$ac_pwd':" >&2;} as_fn_error "cannot run test program while cross compiling See \`config.log' for more details." "$LINENO" 5; } else cat confdefs.h - <<_ACEOF >conftest.$ac_ext /* end confdefs.h. */ #include #include #include #define DO_VA_COPY(d, s) va_copy((d), (s)) void test(char *str, ...) { va_list ap, ap2; int i; va_start(ap, str); DO_VA_COPY(ap2, ap); for (i = 1; i <= 9; i++) { int k = (int)va_arg(ap, int); if (k != i) abort(); } DO_VA_COPY(ap, ap2); for (i = 1; i <= 9; i++) { int k = (int)va_arg(ap, int); if (k != i) abort(); } va_end(ap); } int main(int argc, char *argv[]) { test("test", 1, 2, 3, 4, 5, 6, 7, 8, 9); exit(0); } _ACEOF if ac_fn_c_try_run "$LINENO"; then : ac_cv_va_copy="C99" fi rm -f core *.core core.conftest.* gmon.out bb.out conftest$ac_exeext \ conftest.$ac_objext conftest.beam conftest.$ac_ext fi fi if test ".$ac_cv_va_copy" = .; then if test "$cross_compiling" = yes; then : { { $as_echo "$as_me:${as_lineno-$LINENO}: error: in \`$ac_pwd':" >&5 $as_echo "$as_me: error: in \`$ac_pwd':" >&2;} as_fn_error "cannot run test program while cross compiling See \`config.log' for more details." "$LINENO" 5; } else cat confdefs.h - <<_ACEOF >conftest.$ac_ext /* end confdefs.h. */ #include #include #include #define DO_VA_COPY(d, s) VA_COPY((d), (s)) void test(char *str, ...) { va_list ap, ap2; int i; va_start(ap, str); DO_VA_COPY(ap2, ap); for (i = 1; i <= 9; i++) { int k = (int)va_arg(ap, int); if (k != i) abort(); } DO_VA_COPY(ap, ap2); for (i = 1; i <= 9; i++) { int k = (int)va_arg(ap, int); if (k != i) abort(); } va_end(ap); } int main(int argc, char *argv[]) { test("test", 1, 2, 3, 4, 5, 6, 7, 8, 9); exit(0); } _ACEOF if ac_fn_c_try_run "$LINENO"; then : ac_cv_va_copy="GCM" fi rm -f core *.core core.conftest.* gmon.out bb.out conftest$ac_exeext \ conftest.$ac_objext conftest.beam conftest.$ac_ext fi fi if test ".$ac_cv_va_copy" = .; then if test "$cross_compiling" = yes; then : { { $as_echo "$as_me:${as_lineno-$LINENO}: error: in \`$ac_pwd':" >&5 $as_echo "$as_me: error: in \`$ac_pwd':" >&2;} as_fn_error "cannot run test program while cross compiling See \`config.log' for more details." "$LINENO" 5; } else cat confdefs.h - <<_ACEOF >conftest.$ac_ext /* end confdefs.h. */ #include #include #include #define DO_VA_COPY(d, s) __va_copy((d), (s)) void test(char *str, ...) { va_list ap, ap2; int i; va_start(ap, str); DO_VA_COPY(ap2, ap); for (i = 1; i <= 9; i++) { int k = (int)va_arg(ap, int); if (k != i) abort(); } DO_VA_COPY(ap, ap2); for (i = 1; i <= 9; i++) { int k = (int)va_arg(ap, int); if (k != i) abort(); } va_end(ap); } int main(int argc, char *argv[]) { test("test", 1, 2, 3, 4, 5, 6, 7, 8, 9); exit(0); } _ACEOF if ac_fn_c_try_run "$LINENO"; then : ac_cv_va_copy="GCH" fi rm -f core *.core core.conftest.* gmon.out bb.out conftest$ac_exeext \ conftest.$ac_objext conftest.beam conftest.$ac_ext fi fi if test ".$ac_cv_va_copy" = .; then if test "$cross_compiling" = yes; then : { { $as_echo "$as_me:${as_lineno-$LINENO}: error: in \`$ac_pwd':" >&5 $as_echo "$as_me: error: in \`$ac_pwd':" >&2;} as_fn_error "cannot run test program while cross compiling See \`config.log' for more details." "$LINENO" 5; } else cat confdefs.h - <<_ACEOF >conftest.$ac_ext /* end confdefs.h. */ #include #include #include #define DO_VA_COPY(d, s) __builtin_va_copy((d), (s)) void test(char *str, ...) { va_list ap, ap2; int i; va_start(ap, str); DO_VA_COPY(ap2, ap); for (i = 1; i <= 9; i++) { int k = (int)va_arg(ap, int); if (k != i) abort(); } DO_VA_COPY(ap, ap2); for (i = 1; i <= 9; i++) { int k = (int)va_arg(ap, int); if (k != i) abort(); } va_end(ap); } int main(int argc, char *argv[]) { test("test", 1, 2, 3, 4, 5, 6, 7, 8, 9); exit(0); } _ACEOF if ac_fn_c_try_run "$LINENO"; then : ac_cv_va_copy="GCB" fi rm -f core *.core core.conftest.* gmon.out bb.out conftest$ac_exeext \ conftest.$ac_objext conftest.beam conftest.$ac_ext fi fi if test ".$ac_cv_va_copy" = .; then if test "$cross_compiling" = yes; then : { { $as_echo "$as_me:${as_lineno-$LINENO}: error: in \`$ac_pwd':" >&5 $as_echo "$as_me: error: in \`$ac_pwd':" >&2;} as_fn_error "cannot run test program while cross compiling See \`config.log' for more details." "$LINENO" 5; } else cat confdefs.h - <<_ACEOF >conftest.$ac_ext /* end confdefs.h. */ #include #include #include #define DO_VA_COPY(d, s) do { (d) = (s); } while (0) void test(char *str, ...) { va_list ap, ap2; int i; va_start(ap, str); DO_VA_COPY(ap2, ap); for (i = 1; i <= 9; i++) { int k = (int)va_arg(ap, int); if (k != i) abort(); } DO_VA_COPY(ap, ap2); for (i = 1; i <= 9; i++) { int k = (int)va_arg(ap, int); if (k != i) abort(); } va_end(ap); } int main(int argc, char *argv[]) { test("test", 1, 2, 3, 4, 5, 6, 7, 8, 9); exit(0); } _ACEOF if ac_fn_c_try_run "$LINENO"; then : ac_cv_va_copy="ASS" fi rm -f core *.core core.conftest.* gmon.out bb.out conftest$ac_exeext \ conftest.$ac_objext conftest.beam conftest.$ac_ext fi fi if test ".$ac_cv_va_copy" = .; then if test "$cross_compiling" = yes; then : { { $as_echo "$as_me:${as_lineno-$LINENO}: error: in \`$ac_pwd':" >&5 $as_echo "$as_me: error: in \`$ac_pwd':" >&2;} as_fn_error "cannot run test program while cross compiling See \`config.log' for more details." "$LINENO" 5; } else cat confdefs.h - <<_ACEOF >conftest.$ac_ext /* end confdefs.h. */ #include #include #include #define DO_VA_COPY(d, s) do { *(d) = *(s); } while (0) void test(char *str, ...) { va_list ap, ap2; int i; va_start(ap, str); DO_VA_COPY(ap2, ap); for (i = 1; i <= 9; i++) { int k = (int)va_arg(ap, int); if (k != i) abort(); } DO_VA_COPY(ap, ap2); for (i = 1; i <= 9; i++) { int k = (int)va_arg(ap, int); if (k != i) abort(); } va_end(ap); } int main(int argc, char *argv[]) { test("test", 1, 2, 3, 4, 5, 6, 7, 8, 9); exit(0); } _ACEOF if ac_fn_c_try_run "$LINENO"; then : ac_cv_va_copy="ASP" fi rm -f core *.core core.conftest.* gmon.out bb.out conftest$ac_exeext \ conftest.$ac_objext conftest.beam conftest.$ac_ext fi fi if test ".$ac_cv_va_copy" = .; then if test "$cross_compiling" = yes; then : { { $as_echo "$as_me:${as_lineno-$LINENO}: error: in \`$ac_pwd':" >&5 $as_echo "$as_me: error: in \`$ac_pwd':" >&2;} as_fn_error "cannot run test program while cross compiling See \`config.log' for more details." "$LINENO" 5; } else cat confdefs.h - <<_ACEOF >conftest.$ac_ext /* end confdefs.h. */ #include #include #include #define DO_VA_COPY(d, s) memcpy((void *)&(d), (void *)&(s)) void test(char *str, ...) { va_list ap, ap2; int i; va_start(ap, str); DO_VA_COPY(ap2, ap); for (i = 1; i <= 9; i++) { int k = (int)va_arg(ap, int); if (k != i) abort(); } DO_VA_COPY(ap, ap2); for (i = 1; i <= 9; i++) { int k = (int)va_arg(ap, int); if (k != i) abort(); } va_end(ap); } int main(int argc, char *argv[]) { test("test", 1, 2, 3, 4, 5, 6, 7, 8, 9); exit(0); } _ACEOF if ac_fn_c_try_run "$LINENO"; then : ac_cv_va_copy="CPS" fi rm -f core *.core core.conftest.* gmon.out bb.out conftest$ac_exeext \ conftest.$ac_objext conftest.beam conftest.$ac_ext fi fi if test ".$ac_cv_va_copy" = .; then if test "$cross_compiling" = yes; then : { { $as_echo "$as_me:${as_lineno-$LINENO}: error: in \`$ac_pwd':" >&5 $as_echo "$as_me: error: in \`$ac_pwd':" >&2;} as_fn_error "cannot run test program while cross compiling See \`config.log' for more details." "$LINENO" 5; } else cat confdefs.h - <<_ACEOF >conftest.$ac_ext /* end confdefs.h. */ #include #include #include #define DO_VA_COPY(d, s) memcpy((void *)(d), (void *)(s)) void test(char *str, ...) { va_list ap, ap2; int i; va_start(ap, str); DO_VA_COPY(ap2, ap); for (i = 1; i <= 9; i++) { int k = (int)va_arg(ap, int); if (k != i) abort(); } DO_VA_COPY(ap, ap2); for (i = 1; i <= 9; i++) { int k = (int)va_arg(ap, int); if (k != i) abort(); } va_end(ap); } int main(int argc, char *argv[]) { test("test", 1, 2, 3, 4, 5, 6, 7, 8, 9); exit(0); } _ACEOF if ac_fn_c_try_run "$LINENO"; then : ac_cv_va_copy="CPP" fi rm -f core *.core core.conftest.* gmon.out bb.out conftest$ac_exeext \ conftest.$ac_objext conftest.beam conftest.$ac_ext fi fi if test ".$ac_cv_va_copy" = .; then as_fn_error "no working implementation found" "$LINENO" 5 fi fi if test ".$ac_cv_va_copy" = ".C99"; then $as_echo "#define HAVE_VA_COPY 1" >>confdefs.h fi cat >>confdefs.h <<_ACEOF #define __VA_COPY_USE __VA_COPY_USE_$ac_cv_va_copy _ACEOF if test ".$ac_cv_va_copy" = ".C99"; then { $as_echo "$as_me:${as_lineno-$LINENO}: result: yes" >&5 $as_echo "yes" >&6; } else { $as_echo "$as_me:${as_lineno-$LINENO}: result: no (using fallback implementation)" >&5 $as_echo "no (using fallback implementation)" >&6; } fi # Checks for typedefs, structures, and compiler characteristics. { $as_echo "$as_me:${as_lineno-$LINENO}: checking for an ANSI C-conforming const" >&5 $as_echo_n "checking for an ANSI C-conforming const... " >&6; } if test "${ac_cv_c_const+set}" = set; then : $as_echo_n "(cached) " >&6 else cat confdefs.h - <<_ACEOF >conftest.$ac_ext /* end confdefs.h. */ int main () { /* FIXME: Include the comments suggested by Paul. */ #ifndef __cplusplus /* Ultrix mips cc rejects this. */ typedef int charset[2]; const charset cs; /* SunOS 4.1.1 cc rejects this. */ char const *const *pcpcc; char **ppc; /* NEC SVR4.0.2 mips cc rejects this. */ struct point {int x, y;}; static struct point const zero = {0,0}; /* AIX XL C 1.02.0.0 rejects this. It does not let you subtract one const X* pointer from another in an arm of an if-expression whose if-part is not a constant expression */ const char *g = "string"; pcpcc = &g + (g ? g-g : 0); /* HPUX 7.0 cc rejects these. */ ++pcpcc; ppc = (char**) pcpcc; pcpcc = (char const *const *) ppc; { /* SCO 3.2v4 cc rejects this. */ char *t; char const *s = 0 ? (char *) 0 : (char const *) 0; *t++ = 0; if (s) return 0; } { /* Someone thinks the Sun supposedly-ANSI compiler will reject this. */ int x[] = {25, 17}; const int *foo = &x[0]; ++foo; } { /* Sun SC1.0 ANSI compiler rejects this -- but not the above. */ typedef const int *iptr; iptr p = 0; ++p; } { /* AIX XL C 1.02.0.0 rejects this saying "k.c", line 2.27: 1506-025 (S) Operand must be a modifiable lvalue. */ struct s { int j; const int *ap[3]; }; struct s *b; b->j = 5; } { /* ULTRIX-32 V3.1 (Rev 9) vcc rejects this */ const int foo = 10; if (!foo) return 0; } return !cs[0] && !zero.x; #endif ; return 0; } _ACEOF if ac_fn_c_try_compile "$LINENO"; then : ac_cv_c_const=yes else ac_cv_c_const=no fi rm -f core conftest.err conftest.$ac_objext conftest.$ac_ext fi { $as_echo "$as_me:${as_lineno-$LINENO}: result: $ac_cv_c_const" >&5 $as_echo "$ac_cv_c_const" >&6; } if test $ac_cv_c_const = no; then $as_echo "#define const /**/" >>confdefs.h fi ac_fn_c_check_type "$LINENO" "pid_t" "ac_cv_type_pid_t" "$ac_includes_default" if test "x$ac_cv_type_pid_t" = x""yes; then : else cat >>confdefs.h <<_ACEOF #define pid_t int _ACEOF fi # Checks for library functions. for ac_func in vprintf do : ac_fn_c_check_func "$LINENO" "vprintf" "ac_cv_func_vprintf" if test "x$ac_cv_func_vprintf" = x""yes; then : cat >>confdefs.h <<_ACEOF #define HAVE_VPRINTF 1 _ACEOF ac_fn_c_check_func "$LINENO" "_doprnt" "ac_cv_func__doprnt" if test "x$ac_cv_func__doprnt" = x""yes; then : $as_echo "#define HAVE_DOPRNT 1" >>confdefs.h fi fi done for ac_header in vfork.h do : ac_fn_c_check_header_mongrel "$LINENO" "vfork.h" "ac_cv_header_vfork_h" "$ac_includes_default" if test "x$ac_cv_header_vfork_h" = x""yes; then : cat >>confdefs.h <<_ACEOF #define HAVE_VFORK_H 1 _ACEOF fi done for ac_func in fork vfork do : as_ac_var=`$as_echo "ac_cv_func_$ac_func" | $as_tr_sh` ac_fn_c_check_func "$LINENO" "$ac_func" "$as_ac_var" eval as_val=\$$as_ac_var if test "x$as_val" = x""yes; then : cat >>confdefs.h <<_ACEOF #define `$as_echo "HAVE_$ac_func" | $as_tr_cpp` 1 _ACEOF fi done if test "x$ac_cv_func_fork" = xyes; then { $as_echo "$as_me:${as_lineno-$LINENO}: checking for working fork" >&5 $as_echo_n "checking for working fork... " >&6; } if test "${ac_cv_func_fork_works+set}" = set; then : $as_echo_n "(cached) " >&6 else if test "$cross_compiling" = yes; then : ac_cv_func_fork_works=cross else cat confdefs.h - <<_ACEOF >conftest.$ac_ext /* end confdefs.h. */ $ac_includes_default int main () { /* By Ruediger Kuhlmann. */ return fork () < 0; ; return 0; } _ACEOF if ac_fn_c_try_run "$LINENO"; then : ac_cv_func_fork_works=yes else ac_cv_func_fork_works=no fi rm -f core *.core core.conftest.* gmon.out bb.out conftest$ac_exeext \ conftest.$ac_objext conftest.beam conftest.$ac_ext fi fi { $as_echo "$as_me:${as_lineno-$LINENO}: result: $ac_cv_func_fork_works" >&5 $as_echo "$ac_cv_func_fork_works" >&6; } else ac_cv_func_fork_works=$ac_cv_func_fork fi if test "x$ac_cv_func_fork_works" = xcross; then case $host in *-*-amigaos* | *-*-msdosdjgpp*) # Override, as these systems have only a dummy fork() stub ac_cv_func_fork_works=no ;; *) ac_cv_func_fork_works=yes ;; esac { $as_echo "$as_me:${as_lineno-$LINENO}: WARNING: result $ac_cv_func_fork_works guessed because of cross compilation" >&5 $as_echo "$as_me: WARNING: result $ac_cv_func_fork_works guessed because of cross compilation" >&2;} fi ac_cv_func_vfork_works=$ac_cv_func_vfork if test "x$ac_cv_func_vfork" = xyes; then { $as_echo "$as_me:${as_lineno-$LINENO}: checking for working vfork" >&5 $as_echo_n "checking for working vfork... " >&6; } if test "${ac_cv_func_vfork_works+set}" = set; then : $as_echo_n "(cached) " >&6 else if test "$cross_compiling" = yes; then : ac_cv_func_vfork_works=cross else cat confdefs.h - <<_ACEOF >conftest.$ac_ext /* end confdefs.h. */ /* Thanks to Paul Eggert for this test. */ $ac_includes_default #include #ifdef HAVE_VFORK_H # include #endif /* On some sparc systems, changes by the child to local and incoming argument registers are propagated back to the parent. The compiler is told about this with #include , but some compilers (e.g. gcc -O) don't grok . Test for this by using a static variable whose address is put into a register that is clobbered by the vfork. */ static void #ifdef __cplusplus sparc_address_test (int arg) # else sparc_address_test (arg) int arg; #endif { static pid_t child; if (!child) { child = vfork (); if (child < 0) { perror ("vfork"); _exit(2); } if (!child) { arg = getpid(); write(-1, "", 0); _exit (arg); } } } int main () { pid_t parent = getpid (); pid_t child; sparc_address_test (0); child = vfork (); if (child == 0) { /* Here is another test for sparc vfork register problems. This test uses lots of local variables, at least as many local variables as main has allocated so far including compiler temporaries. 4 locals are enough for gcc 1.40.3 on a Solaris 4.1.3 sparc, but we use 8 to be safe. A buggy compiler should reuse the register of parent for one of the local variables, since it will think that parent can't possibly be used any more in this routine. Assigning to the local variable will thus munge parent in the parent process. */ pid_t p = getpid(), p1 = getpid(), p2 = getpid(), p3 = getpid(), p4 = getpid(), p5 = getpid(), p6 = getpid(), p7 = getpid(); /* Convince the compiler that p..p7 are live; otherwise, it might use the same hardware register for all 8 local variables. */ if (p != p1 || p != p2 || p != p3 || p != p4 || p != p5 || p != p6 || p != p7) _exit(1); /* On some systems (e.g. IRIX 3.3), vfork doesn't separate parent from child file descriptors. If the child closes a descriptor before it execs or exits, this munges the parent's descriptor as well. Test for this by closing stdout in the child. */ _exit(close(fileno(stdout)) != 0); } else { int status; struct stat st; while (wait(&status) != child) ; return ( /* Was there some problem with vforking? */ child < 0 /* Did the child fail? (This shouldn't happen.) */ || status /* Did the vfork/compiler bug occur? */ || parent != getpid() /* Did the file descriptor bug occur? */ || fstat(fileno(stdout), &st) != 0 ); } } _ACEOF if ac_fn_c_try_run "$LINENO"; then : ac_cv_func_vfork_works=yes else ac_cv_func_vfork_works=no fi rm -f core *.core core.conftest.* gmon.out bb.out conftest$ac_exeext \ conftest.$ac_objext conftest.beam conftest.$ac_ext fi fi { $as_echo "$as_me:${as_lineno-$LINENO}: result: $ac_cv_func_vfork_works" >&5 $as_echo "$ac_cv_func_vfork_works" >&6; } fi; if test "x$ac_cv_func_fork_works" = xcross; then ac_cv_func_vfork_works=$ac_cv_func_vfork { $as_echo "$as_me:${as_lineno-$LINENO}: WARNING: result $ac_cv_func_vfork_works guessed because of cross compilation" >&5 $as_echo "$as_me: WARNING: result $ac_cv_func_vfork_works guessed because of cross compilation" >&2;} fi if test "x$ac_cv_func_vfork_works" = xyes; then $as_echo "#define HAVE_WORKING_VFORK 1" >>confdefs.h else $as_echo "#define vfork fork" >>confdefs.h fi if test "x$ac_cv_func_fork_works" = xyes; then $as_echo "#define HAVE_WORKING_FORK 1" >>confdefs.h fi for ac_header in stdlib.h do : ac_fn_c_check_header_mongrel "$LINENO" "stdlib.h" "ac_cv_header_stdlib_h" "$ac_includes_default" if test "x$ac_cv_header_stdlib_h" = x""yes; then : cat >>confdefs.h <<_ACEOF #define HAVE_STDLIB_H 1 _ACEOF fi done { $as_echo "$as_me:${as_lineno-$LINENO}: checking for GNU libc compatible malloc" >&5 $as_echo_n "checking for GNU libc compatible malloc... " >&6; } if test "${ac_cv_func_malloc_0_nonnull+set}" = set; then : $as_echo_n "(cached) " >&6 else if test "$cross_compiling" = yes; then : ac_cv_func_malloc_0_nonnull=no else cat confdefs.h - <<_ACEOF >conftest.$ac_ext /* end confdefs.h. */ #if defined STDC_HEADERS || defined HAVE_STDLIB_H # include #else char *malloc (); #endif int main () { return ! malloc (0); ; return 0; } _ACEOF if ac_fn_c_try_run "$LINENO"; then : ac_cv_func_malloc_0_nonnull=yes else ac_cv_func_malloc_0_nonnull=no fi rm -f core *.core core.conftest.* gmon.out bb.out conftest$ac_exeext \ conftest.$ac_objext conftest.beam conftest.$ac_ext fi fi { $as_echo "$as_me:${as_lineno-$LINENO}: result: $ac_cv_func_malloc_0_nonnull" >&5 $as_echo "$ac_cv_func_malloc_0_nonnull" >&6; } if test $ac_cv_func_malloc_0_nonnull = yes; then : $as_echo "#define HAVE_MALLOC 1" >>confdefs.h else $as_echo "#define HAVE_MALLOC 0" >>confdefs.h case " $LIBOBJS " in *" malloc.$ac_objext "* ) ;; *) LIBOBJS="$LIBOBJS malloc.$ac_objext" ;; esac $as_echo "#define malloc rpl_malloc" >>confdefs.h fi { $as_echo "$as_me:${as_lineno-$LINENO}: checking for working memcmp" >&5 $as_echo_n "checking for working memcmp... " >&6; } if test "${ac_cv_func_memcmp_working+set}" = set; then : $as_echo_n "(cached) " >&6 else if test "$cross_compiling" = yes; then : ac_cv_func_memcmp_working=no else cat confdefs.h - <<_ACEOF >conftest.$ac_ext /* end confdefs.h. */ $ac_includes_default int main () { /* Some versions of memcmp are not 8-bit clean. */ char c0 = '\100', c1 = '\200', c2 = '\201'; if (memcmp(&c0, &c2, 1) >= 0 || memcmp(&c1, &c2, 1) >= 0) return 1; /* The Next x86 OpenStep bug shows up only when comparing 16 bytes or more and with at least one buffer not starting on a 4-byte boundary. William Lewis provided this test program. */ { char foo[21]; char bar[21]; int i; for (i = 0; i < 4; i++) { char *a = foo + i; char *b = bar + i; strcpy (a, "--------01111111"); strcpy (b, "--------10000000"); if (memcmp (a, b, 16) >= 0) return 1; } return 0; } ; return 0; } _ACEOF if ac_fn_c_try_run "$LINENO"; then : ac_cv_func_memcmp_working=yes else ac_cv_func_memcmp_working=no fi rm -f core *.core core.conftest.* gmon.out bb.out conftest$ac_exeext \ conftest.$ac_objext conftest.beam conftest.$ac_ext fi fi { $as_echo "$as_me:${as_lineno-$LINENO}: result: $ac_cv_func_memcmp_working" >&5 $as_echo "$ac_cv_func_memcmp_working" >&6; } test $ac_cv_func_memcmp_working = no && case " $LIBOBJS " in *" memcmp.$ac_objext "* ) ;; *) LIBOBJS="$LIBOBJS memcmp.$ac_objext" ;; esac # AC_FUNC_REALLOC for ac_func in dup2 floor memset pow regcomp sqrt strchr strrchr strstr do : as_ac_var=`$as_echo "ac_cv_func_$ac_func" | $as_tr_sh` ac_fn_c_check_func "$LINENO" "$ac_func" "$as_ac_var" eval as_val=\$$as_ac_var if test "x$as_val" = x""yes; then : cat >>confdefs.h <<_ACEOF #define `$as_echo "HAVE_$ac_func" | $as_tr_cpp` 1 _ACEOF fi done # AC_CONFIG_FILES([]) ac_config_files="$ac_config_files Makefile util/Makefile src/Makefile doc/Makefile" cat >confcache <<\_ACEOF # This file is a shell script that caches the results of configure # tests run on this system so they can be shared between configure # scripts and configure runs, see configure's option --config-cache. # It is not useful on other systems. If it contains results you don't # want to keep, you may remove or edit it. # # config.status only pays attention to the cache file if you give it # the --recheck option to rerun configure. # # `ac_cv_env_foo' variables (set or unset) will be overridden when # loading this file, other *unset* `ac_cv_foo' will be assigned the # following values. _ACEOF # The following way of writing the cache mishandles newlines in values, # but we know of no workaround that is simple, portable, and efficient. # So, we kill variables containing newlines. # Ultrix sh set writes to stderr and can't be redirected directly, # and sets the high bit in the cache file unless we assign to the vars. ( for ac_var in `(set) 2>&1 | sed -n 's/^\([a-zA-Z_][a-zA-Z0-9_]*\)=.*/\1/p'`; do eval ac_val=\$$ac_var case $ac_val in #( *${as_nl}*) case $ac_var in #( *_cv_*) { $as_echo "$as_me:${as_lineno-$LINENO}: WARNING: cache variable $ac_var contains a newline" >&5 $as_echo "$as_me: WARNING: cache variable $ac_var contains a newline" >&2;} ;; esac case $ac_var in #( _ | IFS | as_nl) ;; #( BASH_ARGV | BASH_SOURCE) eval $ac_var= ;; #( *) { eval $ac_var=; unset $ac_var;} ;; esac ;; esac done (set) 2>&1 | case $as_nl`(ac_space=' '; set) 2>&1` in #( *${as_nl}ac_space=\ *) # `set' does not quote correctly, so add quotes: double-quote # substitution turns \\\\ into \\, and sed turns \\ into \. sed -n \ "s/'/'\\\\''/g; s/^\\([_$as_cr_alnum]*_cv_[_$as_cr_alnum]*\\)=\\(.*\\)/\\1='\\2'/p" ;; #( *) # `set' quotes correctly as required by POSIX, so do not add quotes. sed -n "/^[_$as_cr_alnum]*_cv_[_$as_cr_alnum]*=/p" ;; esac | sort ) | sed ' /^ac_cv_env_/b end t clear :clear s/^\([^=]*\)=\(.*[{}].*\)$/test "${\1+set}" = set || &/ t end s/^\([^=]*\)=\(.*\)$/\1=${\1=\2}/ :end' >>confcache if diff "$cache_file" confcache >/dev/null 2>&1; then :; else if test -w "$cache_file"; then test "x$cache_file" != "x/dev/null" && { $as_echo "$as_me:${as_lineno-$LINENO}: updating cache $cache_file" >&5 $as_echo "$as_me: updating cache $cache_file" >&6;} cat confcache >$cache_file else { $as_echo "$as_me:${as_lineno-$LINENO}: not updating unwritable cache $cache_file" >&5 $as_echo "$as_me: not updating unwritable cache $cache_file" >&6;} fi fi rm -f confcache test "x$prefix" = xNONE && prefix=$ac_default_prefix # Let make expand exec_prefix. test "x$exec_prefix" = xNONE && exec_prefix='${prefix}' DEFS=-DHAVE_CONFIG_H ac_libobjs= ac_ltlibobjs= for ac_i in : $LIBOBJS; do test "x$ac_i" = x: && continue # 1. Remove the extension, and $U if already installed. ac_script='s/\$U\././;s/\.o$//;s/\.obj$//' ac_i=`$as_echo "$ac_i" | sed "$ac_script"` # 2. Prepend LIBOBJDIR. When used with automake>=1.10 LIBOBJDIR # will be set to the directory where LIBOBJS objects are built. as_fn_append ac_libobjs " \${LIBOBJDIR}$ac_i\$U.$ac_objext" as_fn_append ac_ltlibobjs " \${LIBOBJDIR}$ac_i"'$U.lo' done LIBOBJS=$ac_libobjs LTLIBOBJS=$ac_ltlibobjs if test -n "$EXEEXT"; then am__EXEEXT_TRUE= am__EXEEXT_FALSE='#' else am__EXEEXT_TRUE='#' am__EXEEXT_FALSE= fi if test -z "${MAINTAINER_MODE_TRUE}" && test -z "${MAINTAINER_MODE_FALSE}"; then as_fn_error "conditional \"MAINTAINER_MODE\" was never defined. Usually this means the macro was only invoked conditionally." "$LINENO" 5 fi if test -z "${AMDEP_TRUE}" && test -z "${AMDEP_FALSE}"; then as_fn_error "conditional \"AMDEP\" was never defined. Usually this means the macro was only invoked conditionally." "$LINENO" 5 fi if test -z "${am__fastdepCC_TRUE}" && test -z "${am__fastdepCC_FALSE}"; then as_fn_error "conditional \"am__fastdepCC\" was never defined. Usually this means the macro was only invoked conditionally." "$LINENO" 5 fi : ${CONFIG_STATUS=./config.status} ac_write_fail=0 ac_clean_files_save=$ac_clean_files ac_clean_files="$ac_clean_files $CONFIG_STATUS" { $as_echo "$as_me:${as_lineno-$LINENO}: creating $CONFIG_STATUS" >&5 $as_echo "$as_me: creating $CONFIG_STATUS" >&6;} as_write_fail=0 cat >$CONFIG_STATUS <<_ASEOF || as_write_fail=1 #! $SHELL # Generated by $as_me. # Run this file to recreate the current configuration. # Compiler output produced by configure, useful for debugging # configure, is in config.log if it exists. debug=false ac_cs_recheck=false ac_cs_silent=false SHELL=\${CONFIG_SHELL-$SHELL} export SHELL _ASEOF cat >>$CONFIG_STATUS <<\_ASEOF || as_write_fail=1 ## -------------------- ## ## M4sh Initialization. ## ## -------------------- ## # Be more Bourne compatible DUALCASE=1; export DUALCASE # for MKS sh if test -n "${ZSH_VERSION+set}" && (emulate sh) >/dev/null 2>&1; then : emulate sh NULLCMD=: # Pre-4.2 versions of Zsh do word splitting on ${1+"$@"}, which # is contrary to our usage. Disable this feature. alias -g '${1+"$@"}'='"$@"' setopt NO_GLOB_SUBST else case `(set -o) 2>/dev/null` in #( *posix*) : set -o posix ;; #( *) : ;; esac fi as_nl=' ' export as_nl # Printing a long string crashes Solaris 7 /usr/bin/printf. as_echo='\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\' as_echo=$as_echo$as_echo$as_echo$as_echo$as_echo as_echo=$as_echo$as_echo$as_echo$as_echo$as_echo$as_echo # Prefer a ksh shell builtin over an external printf program on Solaris, # but without wasting forks for bash or zsh. if test -z "$BASH_VERSION$ZSH_VERSION" \ && (test "X`print -r -- $as_echo`" = "X$as_echo") 2>/dev/null; then as_echo='print -r --' as_echo_n='print -rn --' elif (test "X`printf %s $as_echo`" = "X$as_echo") 2>/dev/null; then as_echo='printf %s\n' as_echo_n='printf %s' else if test "X`(/usr/ucb/echo -n -n $as_echo) 2>/dev/null`" = "X-n $as_echo"; then as_echo_body='eval /usr/ucb/echo -n "$1$as_nl"' as_echo_n='/usr/ucb/echo -n' else as_echo_body='eval expr "X$1" : "X\\(.*\\)"' as_echo_n_body='eval arg=$1; case $arg in #( *"$as_nl"*) expr "X$arg" : "X\\(.*\\)$as_nl"; arg=`expr "X$arg" : ".*$as_nl\\(.*\\)"`;; esac; expr "X$arg" : "X\\(.*\\)" | tr -d "$as_nl" ' export as_echo_n_body as_echo_n='sh -c $as_echo_n_body as_echo' fi export as_echo_body as_echo='sh -c $as_echo_body as_echo' fi # The user is always right. if test "${PATH_SEPARATOR+set}" != set; then PATH_SEPARATOR=: (PATH='/bin;/bin'; FPATH=$PATH; sh -c :) >/dev/null 2>&1 && { (PATH='/bin:/bin'; FPATH=$PATH; sh -c :) >/dev/null 2>&1 || PATH_SEPARATOR=';' } fi # IFS # We need space, tab and new line, in precisely that order. Quoting is # there to prevent editors from complaining about space-tab. # (If _AS_PATH_WALK were called with IFS unset, it would disable word # splitting by setting IFS to empty value.) IFS=" "" $as_nl" # Find who we are. Look in the path if we contain no directory separator. case $0 in #(( *[\\/]* ) as_myself=$0 ;; *) as_save_IFS=$IFS; IFS=$PATH_SEPARATOR for as_dir in $PATH do IFS=$as_save_IFS test -z "$as_dir" && as_dir=. test -r "$as_dir/$0" && as_myself=$as_dir/$0 && break done IFS=$as_save_IFS ;; esac # We did not find ourselves, most probably we were run as `sh COMMAND' # in which case we are not to be found in the path. if test "x$as_myself" = x; then as_myself=$0 fi if test ! -f "$as_myself"; then $as_echo "$as_myself: error: cannot find myself; rerun with an absolute file name" >&2 exit 1 fi # Unset variables that we do not need and which cause bugs (e.g. in # pre-3.0 UWIN ksh). But do not cause bugs in bash 2.01; the "|| exit 1" # suppresses any "Segmentation fault" message there. '((' could # trigger a bug in pdksh 5.2.14. for as_var in BASH_ENV ENV MAIL MAILPATH do eval test x\${$as_var+set} = xset \ && ( (unset $as_var) || exit 1) >/dev/null 2>&1 && unset $as_var || : done PS1='$ ' PS2='> ' PS4='+ ' # NLS nuisances. LC_ALL=C export LC_ALL LANGUAGE=C export LANGUAGE # CDPATH. (unset CDPATH) >/dev/null 2>&1 && unset CDPATH # as_fn_error ERROR [LINENO LOG_FD] # --------------------------------- # Output "`basename $0`: error: ERROR" to stderr. If LINENO and LOG_FD are # provided, also output the error to LOG_FD, referencing LINENO. Then exit the # script with status $?, using 1 if that was 0. as_fn_error () { as_status=$?; test $as_status -eq 0 && as_status=1 if test "$3"; then as_lineno=${as_lineno-"$2"} as_lineno_stack=as_lineno_stack=$as_lineno_stack $as_echo "$as_me:${as_lineno-$LINENO}: error: $1" >&$3 fi $as_echo "$as_me: error: $1" >&2 as_fn_exit $as_status } # as_fn_error # as_fn_set_status STATUS # ----------------------- # Set $? to STATUS, without forking. as_fn_set_status () { return $1 } # as_fn_set_status # as_fn_exit STATUS # ----------------- # Exit the shell with STATUS, even in a "trap 0" or "set -e" context. as_fn_exit () { set +e as_fn_set_status $1 exit $1 } # as_fn_exit # as_fn_unset VAR # --------------- # Portably unset VAR. as_fn_unset () { { eval $1=; unset $1;} } as_unset=as_fn_unset # as_fn_append VAR VALUE # ---------------------- # Append the text in VALUE to the end of the definition contained in VAR. Take # advantage of any shell optimizations that allow amortized linear growth over # repeated appends, instead of the typical quadratic growth present in naive # implementations. if (eval "as_var=1; as_var+=2; test x\$as_var = x12") 2>/dev/null; then : eval 'as_fn_append () { eval $1+=\$2 }' else as_fn_append () { eval $1=\$$1\$2 } fi # as_fn_append # as_fn_arith ARG... # ------------------ # Perform arithmetic evaluation on the ARGs, and store the result in the # global $as_val. Take advantage of shells that can avoid forks. The arguments # must be portable across $(()) and expr. if (eval "test \$(( 1 + 1 )) = 2") 2>/dev/null; then : eval 'as_fn_arith () { as_val=$(( $* )) }' else as_fn_arith () { as_val=`expr "$@" || test $? -eq 1` } fi # as_fn_arith if expr a : '\(a\)' >/dev/null 2>&1 && test "X`expr 00001 : '.*\(...\)'`" = X001; then as_expr=expr else as_expr=false fi if (basename -- /) >/dev/null 2>&1 && test "X`basename -- / 2>&1`" = "X/"; then as_basename=basename else as_basename=false fi if (as_dir=`dirname -- /` && test "X$as_dir" = X/) >/dev/null 2>&1; then as_dirname=dirname else as_dirname=false fi as_me=`$as_basename -- "$0" || $as_expr X/"$0" : '.*/\([^/][^/]*\)/*$' \| \ X"$0" : 'X\(//\)$' \| \ X"$0" : 'X\(/\)' \| . 2>/dev/null || $as_echo X/"$0" | sed '/^.*\/\([^/][^/]*\)\/*$/{ s//\1/ q } /^X\/\(\/\/\)$/{ s//\1/ q } /^X\/\(\/\).*/{ s//\1/ q } s/.*/./; q'` # Avoid depending upon Character Ranges. as_cr_letters='abcdefghijklmnopqrstuvwxyz' as_cr_LETTERS='ABCDEFGHIJKLMNOPQRSTUVWXYZ' as_cr_Letters=$as_cr_letters$as_cr_LETTERS as_cr_digits='0123456789' as_cr_alnum=$as_cr_Letters$as_cr_digits ECHO_C= ECHO_N= ECHO_T= case `echo -n x` in #((((( -n*) case `echo 'xy\c'` in *c*) ECHO_T=' ';; # ECHO_T is single tab character. xy) ECHO_C='\c';; *) echo `echo ksh88 bug on AIX 6.1` > /dev/null ECHO_T=' ';; esac;; *) ECHO_N='-n';; esac rm -f conf$$ conf$$.exe conf$$.file if test -d conf$$.dir; then rm -f conf$$.dir/conf$$.file else rm -f conf$$.dir mkdir conf$$.dir 2>/dev/null fi if (echo >conf$$.file) 2>/dev/null; then if ln -s conf$$.file conf$$ 2>/dev/null; then as_ln_s='ln -s' # ... but there are two gotchas: # 1) On MSYS, both `ln -s file dir' and `ln file dir' fail. # 2) DJGPP < 2.04 has no symlinks; `ln -s' creates a wrapper executable. # In both cases, we have to default to `cp -p'. ln -s conf$$.file conf$$.dir 2>/dev/null && test ! -f conf$$.exe || as_ln_s='cp -p' elif ln conf$$.file conf$$ 2>/dev/null; then as_ln_s=ln else as_ln_s='cp -p' fi else as_ln_s='cp -p' fi rm -f conf$$ conf$$.exe conf$$.dir/conf$$.file conf$$.file rmdir conf$$.dir 2>/dev/null # as_fn_mkdir_p # ------------- # Create "$as_dir" as a directory, including parents if necessary. as_fn_mkdir_p () { case $as_dir in #( -*) as_dir=./$as_dir;; esac test -d "$as_dir" || eval $as_mkdir_p || { as_dirs= while :; do case $as_dir in #( *\'*) as_qdir=`$as_echo "$as_dir" | sed "s/'/'\\\\\\\\''/g"`;; #'( *) as_qdir=$as_dir;; esac as_dirs="'$as_qdir' $as_dirs" as_dir=`$as_dirname -- "$as_dir" || $as_expr X"$as_dir" : 'X\(.*[^/]\)//*[^/][^/]*/*$' \| \ X"$as_dir" : 'X\(//\)[^/]' \| \ X"$as_dir" : 'X\(//\)$' \| \ X"$as_dir" : 'X\(/\)' \| . 2>/dev/null || $as_echo X"$as_dir" | sed '/^X\(.*[^/]\)\/\/*[^/][^/]*\/*$/{ s//\1/ q } /^X\(\/\/\)[^/].*/{ s//\1/ q } /^X\(\/\/\)$/{ s//\1/ q } /^X\(\/\).*/{ s//\1/ q } s/.*/./; q'` test -d "$as_dir" && break done test -z "$as_dirs" || eval "mkdir $as_dirs" } || test -d "$as_dir" || as_fn_error "cannot create directory $as_dir" } # as_fn_mkdir_p if mkdir -p . 2>/dev/null; then as_mkdir_p='mkdir -p "$as_dir"' else test -d ./-p && rmdir ./-p as_mkdir_p=false fi if test -x / >/dev/null 2>&1; then as_test_x='test -x' else if ls -dL / >/dev/null 2>&1; then as_ls_L_option=L else as_ls_L_option= fi as_test_x=' eval sh -c '\'' if test -d "$1"; then test -d "$1/."; else case $1 in #( -*)set "./$1";; esac; case `ls -ld'$as_ls_L_option' "$1" 2>/dev/null` in #(( ???[sx]*):;;*)false;;esac;fi '\'' sh ' fi as_executable_p=$as_test_x # Sed expression to map a string onto a valid CPP name. as_tr_cpp="eval sed 'y%*$as_cr_letters%P$as_cr_LETTERS%;s%[^_$as_cr_alnum]%_%g'" # Sed expression to map a string onto a valid variable name. as_tr_sh="eval sed 'y%*+%pp%;s%[^_$as_cr_alnum]%_%g'" exec 6>&1 ## ----------------------------------- ## ## Main body of $CONFIG_STATUS script. ## ## ----------------------------------- ## _ASEOF test $as_write_fail = 0 && chmod +x $CONFIG_STATUS || ac_write_fail=1 cat >>$CONFIG_STATUS <<\_ACEOF || ac_write_fail=1 # Save the log message, to keep $0 and so on meaningful, and to # report actual input values of CONFIG_FILES etc. instead of their # values after options handling. ac_log=" This file was extended by apparix $as_me 11-062, which was generated by GNU Autoconf 2.65. Invocation command line was CONFIG_FILES = $CONFIG_FILES CONFIG_HEADERS = $CONFIG_HEADERS CONFIG_LINKS = $CONFIG_LINKS CONFIG_COMMANDS = $CONFIG_COMMANDS $ $0 $@ on `(hostname || uname -n) 2>/dev/null | sed 1q` " _ACEOF case $ac_config_files in *" "*) set x $ac_config_files; shift; ac_config_files=$*;; esac case $ac_config_headers in *" "*) set x $ac_config_headers; shift; ac_config_headers=$*;; esac cat >>$CONFIG_STATUS <<_ACEOF || ac_write_fail=1 # Files that config.status was made for. config_files="$ac_config_files" config_headers="$ac_config_headers" config_commands="$ac_config_commands" _ACEOF cat >>$CONFIG_STATUS <<\_ACEOF || ac_write_fail=1 ac_cs_usage="\ \`$as_me' instantiates files and other configuration actions from templates according to the current configuration. Unless the files and actions are specified as TAGs, all are instantiated by default. Usage: $0 [OPTION]... [TAG]... -h, --help print this help, then exit -V, --version print version number and configuration settings, then exit --config print configuration, then exit -q, --quiet, --silent do not print progress messages -d, --debug don't remove temporary files --recheck update $as_me by reconfiguring in the same conditions --file=FILE[:TEMPLATE] instantiate the configuration file FILE --header=FILE[:TEMPLATE] instantiate the configuration header FILE Configuration files: $config_files Configuration headers: $config_headers Configuration commands: $config_commands Report bugs to ." _ACEOF cat >>$CONFIG_STATUS <<_ACEOF || ac_write_fail=1 ac_cs_config="`$as_echo "$ac_configure_args" | sed 's/^ //; s/[\\""\`\$]/\\\\&/g'`" ac_cs_version="\\ apparix config.status 11-062 configured by $0, generated by GNU Autoconf 2.65, with options \\"\$ac_cs_config\\" Copyright (C) 2009 Free Software Foundation, Inc. This config.status script is free software; the Free Software Foundation gives unlimited permission to copy, distribute and modify it." ac_pwd='$ac_pwd' srcdir='$srcdir' INSTALL='$INSTALL' MKDIR_P='$MKDIR_P' AWK='$AWK' test -n "\$AWK" || AWK=awk _ACEOF cat >>$CONFIG_STATUS <<\_ACEOF || ac_write_fail=1 # The default lists apply if the user does not specify any file. ac_need_defaults=: while test $# != 0 do case $1 in --*=*) ac_option=`expr "X$1" : 'X\([^=]*\)='` ac_optarg=`expr "X$1" : 'X[^=]*=\(.*\)'` ac_shift=: ;; *) ac_option=$1 ac_optarg=$2 ac_shift=shift ;; esac case $ac_option in # Handling of the options. -recheck | --recheck | --rechec | --reche | --rech | --rec | --re | --r) ac_cs_recheck=: ;; --version | --versio | --versi | --vers | --ver | --ve | --v | -V ) $as_echo "$ac_cs_version"; exit ;; --config | --confi | --conf | --con | --co | --c ) $as_echo "$ac_cs_config"; exit ;; --debug | --debu | --deb | --de | --d | -d ) debug=: ;; --file | --fil | --fi | --f ) $ac_shift case $ac_optarg in *\'*) ac_optarg=`$as_echo "$ac_optarg" | sed "s/'/'\\\\\\\\''/g"` ;; esac as_fn_append CONFIG_FILES " '$ac_optarg'" ac_need_defaults=false;; --header | --heade | --head | --hea ) $ac_shift case $ac_optarg in *\'*) ac_optarg=`$as_echo "$ac_optarg" | sed "s/'/'\\\\\\\\''/g"` ;; esac as_fn_append CONFIG_HEADERS " '$ac_optarg'" ac_need_defaults=false;; --he | --h) # Conflict between --help and --header as_fn_error "ambiguous option: \`$1' Try \`$0 --help' for more information.";; --help | --hel | -h ) $as_echo "$ac_cs_usage"; exit ;; -q | -quiet | --quiet | --quie | --qui | --qu | --q \ | -silent | --silent | --silen | --sile | --sil | --si | --s) ac_cs_silent=: ;; # This is an error. -*) as_fn_error "unrecognized option: \`$1' Try \`$0 --help' for more information." ;; *) as_fn_append ac_config_targets " $1" ac_need_defaults=false ;; esac shift done ac_configure_extra_args= if $ac_cs_silent; then exec 6>/dev/null ac_configure_extra_args="$ac_configure_extra_args --silent" fi _ACEOF cat >>$CONFIG_STATUS <<_ACEOF || ac_write_fail=1 if \$ac_cs_recheck; then set X '$SHELL' '$0' $ac_configure_args \$ac_configure_extra_args --no-create --no-recursion shift \$as_echo "running CONFIG_SHELL=$SHELL \$*" >&6 CONFIG_SHELL='$SHELL' export CONFIG_SHELL exec "\$@" fi _ACEOF cat >>$CONFIG_STATUS <<\_ACEOF || ac_write_fail=1 exec 5>>config.log { echo sed 'h;s/./-/g;s/^.../## /;s/...$/ ##/;p;x;p;x' <<_ASBOX ## Running $as_me. ## _ASBOX $as_echo "$ac_log" } >&5 _ACEOF cat >>$CONFIG_STATUS <<_ACEOF || ac_write_fail=1 # # INIT-COMMANDS # AMDEP_TRUE="$AMDEP_TRUE" ac_aux_dir="$ac_aux_dir" _ACEOF cat >>$CONFIG_STATUS <<\_ACEOF || ac_write_fail=1 # Handling of arguments. for ac_config_target in $ac_config_targets do case $ac_config_target in "config.h") CONFIG_HEADERS="$CONFIG_HEADERS config.h" ;; "depfiles") CONFIG_COMMANDS="$CONFIG_COMMANDS depfiles" ;; "Makefile") CONFIG_FILES="$CONFIG_FILES Makefile" ;; "util/Makefile") CONFIG_FILES="$CONFIG_FILES util/Makefile" ;; "src/Makefile") CONFIG_FILES="$CONFIG_FILES src/Makefile" ;; "doc/Makefile") CONFIG_FILES="$CONFIG_FILES doc/Makefile" ;; *) as_fn_error "invalid argument: \`$ac_config_target'" "$LINENO" 5;; esac done # If the user did not use the arguments to specify the items to instantiate, # then the envvar interface is used. Set only those that are not. # We use the long form for the default assignment because of an extremely # bizarre bug on SunOS 4.1.3. if $ac_need_defaults; then test "${CONFIG_FILES+set}" = set || CONFIG_FILES=$config_files test "${CONFIG_HEADERS+set}" = set || CONFIG_HEADERS=$config_headers test "${CONFIG_COMMANDS+set}" = set || CONFIG_COMMANDS=$config_commands fi # Have a temporary directory for convenience. Make it in the build tree # simply because there is no reason against having it here, and in addition, # creating and moving files from /tmp can sometimes cause problems. # Hook for its removal unless debugging. # Note that there is a small window in which the directory will not be cleaned: # after its creation but before its name has been assigned to `$tmp'. $debug || { tmp= trap 'exit_status=$? { test -z "$tmp" || test ! -d "$tmp" || rm -fr "$tmp"; } && exit $exit_status ' 0 trap 'as_fn_exit 1' 1 2 13 15 } # Create a (secure) tmp directory for tmp files. { tmp=`(umask 077 && mktemp -d "./confXXXXXX") 2>/dev/null` && test -n "$tmp" && test -d "$tmp" } || { tmp=./conf$$-$RANDOM (umask 077 && mkdir "$tmp") } || as_fn_error "cannot create a temporary directory in ." "$LINENO" 5 # Set up the scripts for CONFIG_FILES section. # No need to generate them if there are no CONFIG_FILES. # This happens for instance with `./config.status config.h'. if test -n "$CONFIG_FILES"; then ac_cr=`echo X | tr X '\015'` # On cygwin, bash can eat \r inside `` if the user requested igncr. # But we know of no other shell where ac_cr would be empty at this # point, so we can use a bashism as a fallback. if test "x$ac_cr" = x; then eval ac_cr=\$\'\\r\' fi ac_cs_awk_cr=`$AWK 'BEGIN { print "a\rb" }' /dev/null` if test "$ac_cs_awk_cr" = "a${ac_cr}b"; then ac_cs_awk_cr='\r' else ac_cs_awk_cr=$ac_cr fi echo 'BEGIN {' >"$tmp/subs1.awk" && _ACEOF { echo "cat >conf$$subs.awk <<_ACEOF" && echo "$ac_subst_vars" | sed 's/.*/&!$&$ac_delim/' && echo "_ACEOF" } >conf$$subs.sh || as_fn_error "could not make $CONFIG_STATUS" "$LINENO" 5 ac_delim_num=`echo "$ac_subst_vars" | grep -c '$'` ac_delim='%!_!# ' for ac_last_try in false false false false false :; do . ./conf$$subs.sh || as_fn_error "could not make $CONFIG_STATUS" "$LINENO" 5 ac_delim_n=`sed -n "s/.*$ac_delim\$/X/p" conf$$subs.awk | grep -c X` if test $ac_delim_n = $ac_delim_num; then break elif $ac_last_try; then as_fn_error "could not make $CONFIG_STATUS" "$LINENO" 5 else ac_delim="$ac_delim!$ac_delim _$ac_delim!! " fi done rm -f conf$$subs.sh cat >>$CONFIG_STATUS <<_ACEOF || ac_write_fail=1 cat >>"\$tmp/subs1.awk" <<\\_ACAWK && _ACEOF sed -n ' h s/^/S["/; s/!.*/"]=/ p g s/^[^!]*!// :repl t repl s/'"$ac_delim"'$// t delim :nl h s/\(.\{148\}\)..*/\1/ t more1 s/["\\]/\\&/g; s/^/"/; s/$/\\n"\\/ p n b repl :more1 s/["\\]/\\&/g; s/^/"/; s/$/"\\/ p g s/.\{148\}// t nl :delim h s/\(.\{148\}\)..*/\1/ t more2 s/["\\]/\\&/g; s/^/"/; s/$/"/ p b :more2 s/["\\]/\\&/g; s/^/"/; s/$/"\\/ p g s/.\{148\}// t delim ' >$CONFIG_STATUS || ac_write_fail=1 rm -f conf$$subs.awk cat >>$CONFIG_STATUS <<_ACEOF || ac_write_fail=1 _ACAWK cat >>"\$tmp/subs1.awk" <<_ACAWK && for (key in S) S_is_set[key] = 1 FS = "" } { line = $ 0 nfields = split(line, field, "@") substed = 0 len = length(field[1]) for (i = 2; i < nfields; i++) { key = field[i] keylen = length(key) if (S_is_set[key]) { value = S[key] line = substr(line, 1, len) "" value "" substr(line, len + keylen + 3) len += length(value) + length(field[++i]) substed = 1 } else len += 1 + keylen } print line } _ACAWK _ACEOF cat >>$CONFIG_STATUS <<\_ACEOF || ac_write_fail=1 if sed "s/$ac_cr//" < /dev/null > /dev/null 2>&1; then sed "s/$ac_cr\$//; s/$ac_cr/$ac_cs_awk_cr/g" else cat fi < "$tmp/subs1.awk" > "$tmp/subs.awk" \ || as_fn_error "could not setup config files machinery" "$LINENO" 5 _ACEOF # VPATH may cause trouble with some makes, so we remove $(srcdir), # ${srcdir} and @srcdir@ from VPATH if srcdir is ".", strip leading and # trailing colons and then remove the whole line if VPATH becomes empty # (actually we leave an empty line to preserve line numbers). if test "x$srcdir" = x.; then ac_vpsub='/^[ ]*VPATH[ ]*=/{ s/:*\$(srcdir):*/:/ s/:*\${srcdir}:*/:/ s/:*@srcdir@:*/:/ s/^\([^=]*=[ ]*\):*/\1/ s/:*$// s/^[^=]*=[ ]*$// }' fi cat >>$CONFIG_STATUS <<\_ACEOF || ac_write_fail=1 fi # test -n "$CONFIG_FILES" # Set up the scripts for CONFIG_HEADERS section. # No need to generate them if there are no CONFIG_HEADERS. # This happens for instance with `./config.status Makefile'. if test -n "$CONFIG_HEADERS"; then cat >"$tmp/defines.awk" <<\_ACAWK || BEGIN { _ACEOF # Transform confdefs.h into an awk script `defines.awk', embedded as # here-document in config.status, that substitutes the proper values into # config.h.in to produce config.h. # Create a delimiter string that does not exist in confdefs.h, to ease # handling of long lines. ac_delim='%!_!# ' for ac_last_try in false false :; do ac_t=`sed -n "/$ac_delim/p" confdefs.h` if test -z "$ac_t"; then break elif $ac_last_try; then as_fn_error "could not make $CONFIG_HEADERS" "$LINENO" 5 else ac_delim="$ac_delim!$ac_delim _$ac_delim!! " fi done # For the awk script, D is an array of macro values keyed by name, # likewise P contains macro parameters if any. Preserve backslash # newline sequences. ac_word_re=[_$as_cr_Letters][_$as_cr_alnum]* sed -n ' s/.\{148\}/&'"$ac_delim"'/g t rset :rset s/^[ ]*#[ ]*define[ ][ ]*/ / t def d :def s/\\$// t bsnl s/["\\]/\\&/g s/^ \('"$ac_word_re"'\)\(([^()]*)\)[ ]*\(.*\)/P["\1"]="\2"\ D["\1"]=" \3"/p s/^ \('"$ac_word_re"'\)[ ]*\(.*\)/D["\1"]=" \2"/p d :bsnl s/["\\]/\\&/g s/^ \('"$ac_word_re"'\)\(([^()]*)\)[ ]*\(.*\)/P["\1"]="\2"\ D["\1"]=" \3\\\\\\n"\\/p t cont s/^ \('"$ac_word_re"'\)[ ]*\(.*\)/D["\1"]=" \2\\\\\\n"\\/p t cont d :cont n s/.\{148\}/&'"$ac_delim"'/g t clear :clear s/\\$// t bsnlc s/["\\]/\\&/g; s/^/"/; s/$/"/p d :bsnlc s/["\\]/\\&/g; s/^/"/; s/$/\\\\\\n"\\/p b cont ' >$CONFIG_STATUS || ac_write_fail=1 cat >>$CONFIG_STATUS <<_ACEOF || ac_write_fail=1 for (key in D) D_is_set[key] = 1 FS = "" } /^[\t ]*#[\t ]*(define|undef)[\t ]+$ac_word_re([\t (]|\$)/ { line = \$ 0 split(line, arg, " ") if (arg[1] == "#") { defundef = arg[2] mac1 = arg[3] } else { defundef = substr(arg[1], 2) mac1 = arg[2] } split(mac1, mac2, "(") #) macro = mac2[1] prefix = substr(line, 1, index(line, defundef) - 1) if (D_is_set[macro]) { # Preserve the white space surrounding the "#". print prefix "define", macro P[macro] D[macro] next } else { # Replace #undef with comments. This is necessary, for example, # in the case of _POSIX_SOURCE, which is predefined and required # on some systems where configure will not decide to define it. if (defundef == "undef") { print "/*", prefix defundef, macro, "*/" next } } } { print } _ACAWK _ACEOF cat >>$CONFIG_STATUS <<\_ACEOF || ac_write_fail=1 as_fn_error "could not setup config headers machinery" "$LINENO" 5 fi # test -n "$CONFIG_HEADERS" eval set X " :F $CONFIG_FILES :H $CONFIG_HEADERS :C $CONFIG_COMMANDS" shift for ac_tag do case $ac_tag in :[FHLC]) ac_mode=$ac_tag; continue;; esac case $ac_mode$ac_tag in :[FHL]*:*);; :L* | :C*:*) as_fn_error "invalid tag \`$ac_tag'" "$LINENO" 5;; :[FH]-) ac_tag=-:-;; :[FH]*) ac_tag=$ac_tag:$ac_tag.in;; esac ac_save_IFS=$IFS IFS=: set x $ac_tag IFS=$ac_save_IFS shift ac_file=$1 shift case $ac_mode in :L) ac_source=$1;; :[FH]) ac_file_inputs= for ac_f do case $ac_f in -) ac_f="$tmp/stdin";; *) # Look for the file first in the build tree, then in the source tree # (if the path is not absolute). The absolute path cannot be DOS-style, # because $ac_f cannot contain `:'. test -f "$ac_f" || case $ac_f in [\\/$]*) false;; *) test -f "$srcdir/$ac_f" && ac_f="$srcdir/$ac_f";; esac || as_fn_error "cannot find input file: \`$ac_f'" "$LINENO" 5;; esac case $ac_f in *\'*) ac_f=`$as_echo "$ac_f" | sed "s/'/'\\\\\\\\''/g"`;; esac as_fn_append ac_file_inputs " '$ac_f'" done # Let's still pretend it is `configure' which instantiates (i.e., don't # use $as_me), people would be surprised to read: # /* config.h. Generated by config.status. */ configure_input='Generated from '` $as_echo "$*" | sed 's|^[^:]*/||;s|:[^:]*/|, |g' `' by configure.' if test x"$ac_file" != x-; then configure_input="$ac_file. $configure_input" { $as_echo "$as_me:${as_lineno-$LINENO}: creating $ac_file" >&5 $as_echo "$as_me: creating $ac_file" >&6;} fi # Neutralize special characters interpreted by sed in replacement strings. case $configure_input in #( *\&* | *\|* | *\\* ) ac_sed_conf_input=`$as_echo "$configure_input" | sed 's/[\\\\&|]/\\\\&/g'`;; #( *) ac_sed_conf_input=$configure_input;; esac case $ac_tag in *:-:* | *:-) cat >"$tmp/stdin" \ || as_fn_error "could not create $ac_file" "$LINENO" 5 ;; esac ;; esac ac_dir=`$as_dirname -- "$ac_file" || $as_expr X"$ac_file" : 'X\(.*[^/]\)//*[^/][^/]*/*$' \| \ X"$ac_file" : 'X\(//\)[^/]' \| \ X"$ac_file" : 'X\(//\)$' \| \ X"$ac_file" : 'X\(/\)' \| . 2>/dev/null || $as_echo X"$ac_file" | sed '/^X\(.*[^/]\)\/\/*[^/][^/]*\/*$/{ s//\1/ q } /^X\(\/\/\)[^/].*/{ s//\1/ q } /^X\(\/\/\)$/{ s//\1/ q } /^X\(\/\).*/{ s//\1/ q } s/.*/./; q'` as_dir="$ac_dir"; as_fn_mkdir_p ac_builddir=. case "$ac_dir" in .) ac_dir_suffix= ac_top_builddir_sub=. ac_top_build_prefix= ;; *) ac_dir_suffix=/`$as_echo "$ac_dir" | sed 's|^\.[\\/]||'` # A ".." for each directory in $ac_dir_suffix. ac_top_builddir_sub=`$as_echo "$ac_dir_suffix" | sed 's|/[^\\/]*|/..|g;s|/||'` case $ac_top_builddir_sub in "") ac_top_builddir_sub=. ac_top_build_prefix= ;; *) ac_top_build_prefix=$ac_top_builddir_sub/ ;; esac ;; esac ac_abs_top_builddir=$ac_pwd ac_abs_builddir=$ac_pwd$ac_dir_suffix # for backward compatibility: ac_top_builddir=$ac_top_build_prefix case $srcdir in .) # We are building in place. ac_srcdir=. ac_top_srcdir=$ac_top_builddir_sub ac_abs_top_srcdir=$ac_pwd ;; [\\/]* | ?:[\\/]* ) # Absolute name. ac_srcdir=$srcdir$ac_dir_suffix; ac_top_srcdir=$srcdir ac_abs_top_srcdir=$srcdir ;; *) # Relative name. ac_srcdir=$ac_top_build_prefix$srcdir$ac_dir_suffix ac_top_srcdir=$ac_top_build_prefix$srcdir ac_abs_top_srcdir=$ac_pwd/$srcdir ;; esac ac_abs_srcdir=$ac_abs_top_srcdir$ac_dir_suffix case $ac_mode in :F) # # CONFIG_FILE # case $INSTALL in [\\/$]* | ?:[\\/]* ) ac_INSTALL=$INSTALL ;; *) ac_INSTALL=$ac_top_build_prefix$INSTALL ;; esac ac_MKDIR_P=$MKDIR_P case $MKDIR_P in [\\/$]* | ?:[\\/]* ) ;; */*) ac_MKDIR_P=$ac_top_build_prefix$MKDIR_P ;; esac _ACEOF cat >>$CONFIG_STATUS <<\_ACEOF || ac_write_fail=1 # If the template does not know about datarootdir, expand it. # FIXME: This hack should be removed a few years after 2.60. ac_datarootdir_hack=; ac_datarootdir_seen= ac_sed_dataroot=' /datarootdir/ { p q } /@datadir@/p /@docdir@/p /@infodir@/p /@localedir@/p /@mandir@/p' case `eval "sed -n \"\$ac_sed_dataroot\" $ac_file_inputs"` in *datarootdir*) ac_datarootdir_seen=yes;; *@datadir@*|*@docdir@*|*@infodir@*|*@localedir@*|*@mandir@*) { $as_echo "$as_me:${as_lineno-$LINENO}: WARNING: $ac_file_inputs seems to ignore the --datarootdir setting" >&5 $as_echo "$as_me: WARNING: $ac_file_inputs seems to ignore the --datarootdir setting" >&2;} _ACEOF cat >>$CONFIG_STATUS <<_ACEOF || ac_write_fail=1 ac_datarootdir_hack=' s&@datadir@&$datadir&g s&@docdir@&$docdir&g s&@infodir@&$infodir&g s&@localedir@&$localedir&g s&@mandir@&$mandir&g s&\\\${datarootdir}&$datarootdir&g' ;; esac _ACEOF # Neutralize VPATH when `$srcdir' = `.'. # Shell code in configure.ac might set extrasub. # FIXME: do we really want to maintain this feature? cat >>$CONFIG_STATUS <<_ACEOF || ac_write_fail=1 ac_sed_extra="$ac_vpsub $extrasub _ACEOF cat >>$CONFIG_STATUS <<\_ACEOF || ac_write_fail=1 :t /@[a-zA-Z_][a-zA-Z_0-9]*@/!b s|@configure_input@|$ac_sed_conf_input|;t t s&@top_builddir@&$ac_top_builddir_sub&;t t s&@top_build_prefix@&$ac_top_build_prefix&;t t s&@srcdir@&$ac_srcdir&;t t s&@abs_srcdir@&$ac_abs_srcdir&;t t s&@top_srcdir@&$ac_top_srcdir&;t t s&@abs_top_srcdir@&$ac_abs_top_srcdir&;t t s&@builddir@&$ac_builddir&;t t s&@abs_builddir@&$ac_abs_builddir&;t t s&@abs_top_builddir@&$ac_abs_top_builddir&;t t s&@INSTALL@&$ac_INSTALL&;t t s&@MKDIR_P@&$ac_MKDIR_P&;t t $ac_datarootdir_hack " eval sed \"\$ac_sed_extra\" "$ac_file_inputs" | $AWK -f "$tmp/subs.awk" >$tmp/out \ || as_fn_error "could not create $ac_file" "$LINENO" 5 test -z "$ac_datarootdir_hack$ac_datarootdir_seen" && { ac_out=`sed -n '/\${datarootdir}/p' "$tmp/out"`; test -n "$ac_out"; } && { ac_out=`sed -n '/^[ ]*datarootdir[ ]*:*=/p' "$tmp/out"`; test -z "$ac_out"; } && { $as_echo "$as_me:${as_lineno-$LINENO}: WARNING: $ac_file contains a reference to the variable \`datarootdir' which seems to be undefined. Please make sure it is defined." >&5 $as_echo "$as_me: WARNING: $ac_file contains a reference to the variable \`datarootdir' which seems to be undefined. Please make sure it is defined." >&2;} rm -f "$tmp/stdin" case $ac_file in -) cat "$tmp/out" && rm -f "$tmp/out";; *) rm -f "$ac_file" && mv "$tmp/out" "$ac_file";; esac \ || as_fn_error "could not create $ac_file" "$LINENO" 5 ;; :H) # # CONFIG_HEADER # if test x"$ac_file" != x-; then { $as_echo "/* $configure_input */" \ && eval '$AWK -f "$tmp/defines.awk"' "$ac_file_inputs" } >"$tmp/config.h" \ || as_fn_error "could not create $ac_file" "$LINENO" 5 if diff "$ac_file" "$tmp/config.h" >/dev/null 2>&1; then { $as_echo "$as_me:${as_lineno-$LINENO}: $ac_file is unchanged" >&5 $as_echo "$as_me: $ac_file is unchanged" >&6;} else rm -f "$ac_file" mv "$tmp/config.h" "$ac_file" \ || as_fn_error "could not create $ac_file" "$LINENO" 5 fi else $as_echo "/* $configure_input */" \ && eval '$AWK -f "$tmp/defines.awk"' "$ac_file_inputs" \ || as_fn_error "could not create -" "$LINENO" 5 fi # Compute "$ac_file"'s index in $config_headers. _am_arg="$ac_file" _am_stamp_count=1 for _am_header in $config_headers :; do case $_am_header in $_am_arg | $_am_arg:* ) break ;; * ) _am_stamp_count=`expr $_am_stamp_count + 1` ;; esac done echo "timestamp for $_am_arg" >`$as_dirname -- "$_am_arg" || $as_expr X"$_am_arg" : 'X\(.*[^/]\)//*[^/][^/]*/*$' \| \ X"$_am_arg" : 'X\(//\)[^/]' \| \ X"$_am_arg" : 'X\(//\)$' \| \ X"$_am_arg" : 'X\(/\)' \| . 2>/dev/null || $as_echo X"$_am_arg" | sed '/^X\(.*[^/]\)\/\/*[^/][^/]*\/*$/{ s//\1/ q } /^X\(\/\/\)[^/].*/{ s//\1/ q } /^X\(\/\/\)$/{ s//\1/ q } /^X\(\/\).*/{ s//\1/ q } s/.*/./; q'`/stamp-h$_am_stamp_count ;; :C) { $as_echo "$as_me:${as_lineno-$LINENO}: executing $ac_file commands" >&5 $as_echo "$as_me: executing $ac_file commands" >&6;} ;; esac case $ac_file$ac_mode in "depfiles":C) test x"$AMDEP_TRUE" != x"" || { # Autoconf 2.62 quotes --file arguments for eval, but not when files # are listed without --file. Let's play safe and only enable the eval # if we detect the quoting. case $CONFIG_FILES in *\'*) eval set x "$CONFIG_FILES" ;; *) set x $CONFIG_FILES ;; esac shift for mf do # Strip MF so we end up with the name of the file. mf=`echo "$mf" | sed -e 's/:.*$//'` # Check whether this is an Automake generated Makefile or not. # We used to match only the files named `Makefile.in', but # some people rename them; so instead we look at the file content. # Grep'ing the first line is not enough: some people post-process # each Makefile.in and add a new line on top of each file to say so. # Grep'ing the whole file is not good either: AIX grep has a line # limit of 2048, but all sed's we know have understand at least 4000. if sed -n 's,^#.*generated by automake.*,X,p' "$mf" | grep X >/dev/null 2>&1; then dirpart=`$as_dirname -- "$mf" || $as_expr X"$mf" : 'X\(.*[^/]\)//*[^/][^/]*/*$' \| \ X"$mf" : 'X\(//\)[^/]' \| \ X"$mf" : 'X\(//\)$' \| \ X"$mf" : 'X\(/\)' \| . 2>/dev/null || $as_echo X"$mf" | sed '/^X\(.*[^/]\)\/\/*[^/][^/]*\/*$/{ s//\1/ q } /^X\(\/\/\)[^/].*/{ s//\1/ q } /^X\(\/\/\)$/{ s//\1/ q } /^X\(\/\).*/{ s//\1/ q } s/.*/./; q'` else continue fi # Extract the definition of DEPDIR, am__include, and am__quote # from the Makefile without running `make'. DEPDIR=`sed -n 's/^DEPDIR = //p' < "$mf"` test -z "$DEPDIR" && continue am__include=`sed -n 's/^am__include = //p' < "$mf"` test -z "am__include" && continue am__quote=`sed -n 's/^am__quote = //p' < "$mf"` # When using ansi2knr, U may be empty or an underscore; expand it U=`sed -n 's/^U = //p' < "$mf"` # Find all dependency output files, they are included files with # $(DEPDIR) in their names. We invoke sed twice because it is the # simplest approach to changing $(DEPDIR) to its actual value in the # expansion. for file in `sed -n " s/^$am__include $am__quote\(.*(DEPDIR).*\)$am__quote"'$/\1/p' <"$mf" | \ sed -e 's/\$(DEPDIR)/'"$DEPDIR"'/g' -e 's/\$U/'"$U"'/g'`; do # Make sure the directory exists. test -f "$dirpart/$file" && continue fdir=`$as_dirname -- "$file" || $as_expr X"$file" : 'X\(.*[^/]\)//*[^/][^/]*/*$' \| \ X"$file" : 'X\(//\)[^/]' \| \ X"$file" : 'X\(//\)$' \| \ X"$file" : 'X\(/\)' \| . 2>/dev/null || $as_echo X"$file" | sed '/^X\(.*[^/]\)\/\/*[^/][^/]*\/*$/{ s//\1/ q } /^X\(\/\/\)[^/].*/{ s//\1/ q } /^X\(\/\/\)$/{ s//\1/ q } /^X\(\/\).*/{ s//\1/ q } s/.*/./; q'` as_dir=$dirpart/$fdir; as_fn_mkdir_p # echo "creating $dirpart/$file" echo '# dummy' > "$dirpart/$file" done done } ;; esac done # for ac_tag as_fn_exit 0 _ACEOF ac_clean_files=$ac_clean_files_save test $ac_write_fail = 0 || as_fn_error "write failure creating $CONFIG_STATUS" "$LINENO" 5 # configure is writing to config.log, and then calls config.status. # config.status does its own redirection, appending to config.log. # Unfortunately, on DOS this fails, as config.log is still kept open # by configure, so config.status won't be able to write to it; its # output is simply discarded. So we exec the FD to /dev/null, # effectively closing config.log, so it can be properly (re)opened and # appended to by config.status. When coming back to configure, we # need to make the FD available again. if test "$no_create" != yes; then ac_cs_success=: ac_config_status_args= test "$silent" = yes && ac_config_status_args="$ac_config_status_args --quiet" exec 5>/dev/null $SHELL $CONFIG_STATUS $ac_config_status_args || ac_cs_success=false exec 5>>config.log # Use ||, not &&, to avoid exiting from the if with $? = 1, which # would make configure fail if this is the last instruction. $ac_cs_success || as_fn_exit $? fi if test -n "$ac_unrecognized_opts" && test "$enable_option_checking" != no; then { $as_echo "$as_me:${as_lineno-$LINENO}: WARNING: unrecognized options: $ac_unrecognized_opts" >&5 $as_echo "$as_me: WARNING: unrecognized options: $ac_unrecognized_opts" >&2;} fi apparix-11-062/configure.ac000066400000000000000000000027551326043744200155520ustar00rootroot00000000000000# configure.ac - generated from configure.ac.in by setversion. do not edit # configure.ac, but edit the master. # configure.ac - generated from configure.ac.in by setversion. do not edit # configure.ac, but edit the master. # $Id: configure.ac.in,v 1.2 2005/10/10 17:53:19 flux Exp $ # Process this file with autoconf to produce a configure script. AC_PREREQ(2.50) AC_INIT(apparix, 11-062, mcx-devel@lists.micans.org) AM_CONFIG_HEADER(config.h) PACKAGE=$PACKAGE_NAME VERSION=$PACKAGE_VERSION AC_CONFIG_SRCDIR([src/apparix.c]) AM_INIT_AUTOMAKE($PACKAGE, $VERSION) # AM_CONFIG_HEADER(config.h) # AC_CONFIG_HEADERS([config.h]) # add a `--enable-maintainer-mode' option to `configure'; `maintainer-only' rules turned off by # default in Makefile.in's AM_MAINTAINER_MODE AC_SUBST(PACKAGE) AC_SUBST(VERSION) # Checks for programs. AC_PROG_AWK AC_PROG_CC AC_PROG_INSTALL AC_PROG_LN_S AC_PROG_RANLIB # Checks for libraries. # FIXME: Replace `main' with a function in `-lm': AC_CHECK_LIB([m], [main]) # Checks for header files. AC_HEADER_STDC AC_HEADER_SYS_WAIT AC_CHECK_HEADERS([fcntl.h float.h limits.h stdlib.h string.h ]) AC_CHECK_VA_COPY # Checks for typedefs, structures, and compiler characteristics. AC_C_CONST AC_TYPE_PID_T # Checks for library functions. AC_FUNC_VPRINTF AC_FUNC_FORK AC_FUNC_MALLOC AC_FUNC_MEMCMP # AC_FUNC_REALLOC AC_CHECK_FUNCS([dup2 floor memset pow regcomp sqrt strchr strrchr strstr]) # AC_CONFIG_FILES([]) AC_OUTPUT([ Makefile util/Makefile src/Makefile doc/Makefile ]) apparix-11-062/depcomp000077500000000000000000000355451326043744200146440ustar00rootroot00000000000000#! /bin/sh # depcomp - compile a program generating dependencies as side-effects scriptversion=2004-05-31.23 # Copyright (C) 1999, 2000, 2003, 2004 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., 59 Temple Place - Suite 330, Boston, MA # 02111-1307, USA. # As a special exception to the GNU General Public License, if you # distribute this file as part of a program that contains a # configuration script generated by Autoconf, you may include it under # the same distribution terms that you use for the rest of that program. # Originally written by Alexandre Oliva . case $1 in '') echo "$0: No command. Try \`$0 --help' for more information." 1>&2 exit 1; ;; -h | --h*) cat <<\EOF Usage: depcomp [--help] [--version] PROGRAM [ARGS] Run PROGRAMS ARGS to compile a file, generating dependencies as side-effects. Environment variables: depmode Dependency tracking mode. source Source file read by `PROGRAMS ARGS'. object Object file output by `PROGRAMS ARGS'. DEPDIR directory where to store dependencies. depfile Dependency file to output. tmpdepfile Temporary file to use when outputing dependencies. libtool Whether libtool is used (yes/no). Report bugs to . EOF exit 0 ;; -v | --v*) echo "depcomp $scriptversion" exit 0 ;; esac if test -z "$depmode" || test -z "$source" || test -z "$object"; then echo "depcomp: Variables source, object and depmode must be set" 1>&2 exit 1 fi # Dependencies for sub/bar.o or sub/bar.obj go into sub/.deps/bar.Po. depfile=${depfile-`echo "$object" | sed 's|[^\\/]*$|'${DEPDIR-.deps}'/&|;s|\.\([^.]*\)$|.P\1|;s|Pobj$|Po|'`} tmpdepfile=${tmpdepfile-`echo "$depfile" | sed 's/\.\([^.]*\)$/.T\1/'`} rm -f "$tmpdepfile" # Some modes work just like other modes, but use different flags. We # parameterize here, but still list the modes in the big case below, # to make depend.m4 easier to write. Note that we *cannot* use a case # here, because this file can only contain one case statement. if test "$depmode" = hp; then # HP compiler uses -M and no extra arg. gccflag=-M depmode=gcc fi if test "$depmode" = dashXmstdout; then # This is just like dashmstdout with a different argument. dashmflag=-xM depmode=dashmstdout fi case "$depmode" in gcc3) ## gcc 3 implements dependency tracking that does exactly what ## we want. Yay! Note: for some reason libtool 1.4 doesn't like ## it if -MD -MP comes after the -MF stuff. Hmm. "$@" -MT "$object" -MD -MP -MF "$tmpdepfile" stat=$? if test $stat -eq 0; then : else rm -f "$tmpdepfile" exit $stat fi mv "$tmpdepfile" "$depfile" ;; gcc) ## There are various ways to get dependency output from gcc. Here's ## why we pick this rather obscure method: ## - Don't want to use -MD because we'd like the dependencies to end ## up in a subdir. Having to rename by hand is ugly. ## (We might end up doing this anyway to support other compilers.) ## - The DEPENDENCIES_OUTPUT environment variable makes gcc act like ## -MM, not -M (despite what the docs say). ## - Using -M directly means running the compiler twice (even worse ## than renaming). if test -z "$gccflag"; then gccflag=-MD, fi "$@" -Wp,"$gccflag$tmpdepfile" stat=$? if test $stat -eq 0; then : else rm -f "$tmpdepfile" exit $stat fi rm -f "$depfile" echo "$object : \\" > "$depfile" alpha=ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz ## The second -e expression handles DOS-style file names with drive letters. sed -e 's/^[^:]*: / /' \ -e 's/^['$alpha']:\/[^:]*: / /' < "$tmpdepfile" >> "$depfile" ## This next piece of magic avoids the `deleted header file' problem. ## The problem is that when a header file which appears in a .P file ## is deleted, the dependency causes make to die (because there is ## typically no way to rebuild the header). We avoid this by adding ## dummy dependencies for each header file. Too bad gcc doesn't do ## this for us directly. tr ' ' ' ' < "$tmpdepfile" | ## Some versions of gcc put a space before the `:'. On the theory ## that the space means something, we add a space to the output as ## well. ## Some versions of the HPUX 10.20 sed can't process this invocation ## correctly. Breaking it into two sed invocations is a workaround. sed -e 's/^\\$//' -e '/^$/d' -e '/:$/d' | sed -e 's/$/ :/' >> "$depfile" rm -f "$tmpdepfile" ;; hp) # This case exists only to let depend.m4 do its work. It works by # looking at the text of this script. This case will never be run, # since it is checked for above. exit 1 ;; sgi) if test "$libtool" = yes; then "$@" "-Wp,-MDupdate,$tmpdepfile" else "$@" -MDupdate "$tmpdepfile" fi stat=$? if test $stat -eq 0; then : else rm -f "$tmpdepfile" exit $stat fi rm -f "$depfile" if test -f "$tmpdepfile"; then # yes, the sourcefile depend on other files echo "$object : \\" > "$depfile" # Clip off the initial element (the dependent). Don't try to be # clever and replace this with sed code, as IRIX sed won't handle # lines with more than a fixed number of characters (4096 in # IRIX 6.2 sed, 8192 in IRIX 6.5). We also remove comment lines; # the IRIX cc adds comments like `#:fec' to the end of the # dependency line. tr ' ' ' ' < "$tmpdepfile" \ | sed -e 's/^.*\.o://' -e 's/#.*$//' -e '/^$/ d' | \ tr ' ' ' ' >> $depfile echo >> $depfile # The second pass generates a dummy entry for each header file. tr ' ' ' ' < "$tmpdepfile" \ | sed -e 's/^.*\.o://' -e 's/#.*$//' -e '/^$/ d' -e 's/$/:/' \ >> $depfile else # The sourcefile does not contain any dependencies, so just # store a dummy comment line, to avoid errors with the Makefile # "include basename.Plo" scheme. echo "#dummy" > "$depfile" fi rm -f "$tmpdepfile" ;; aix) # The C for AIX Compiler uses -M and outputs the dependencies # in a .u file. In older versions, this file always lives in the # current directory. Also, the AIX compiler puts `$object:' at the # start of each line; $object doesn't have directory information. # Version 6 uses the directory in both cases. stripped=`echo "$object" | sed 's/\(.*\)\..*$/\1/'` tmpdepfile="$stripped.u" if test "$libtool" = yes; then "$@" -Wc,-M else "$@" -M fi stat=$? if test -f "$tmpdepfile"; then : else stripped=`echo "$stripped" | sed 's,^.*/,,'` tmpdepfile="$stripped.u" fi if test $stat -eq 0; then : else rm -f "$tmpdepfile" exit $stat fi if test -f "$tmpdepfile"; then outname="$stripped.o" # Each line is of the form `foo.o: dependent.h'. # Do two passes, one to just change these to # `$object: dependent.h' and one to simply `dependent.h:'. sed -e "s,^$outname:,$object :," < "$tmpdepfile" > "$depfile" sed -e "s,^$outname: \(.*\)$,\1:," < "$tmpdepfile" >> "$depfile" else # The sourcefile does not contain any dependencies, so just # store a dummy comment line, to avoid errors with the Makefile # "include basename.Plo" scheme. echo "#dummy" > "$depfile" fi rm -f "$tmpdepfile" ;; icc) # Intel's C compiler understands `-MD -MF file'. However on # icc -MD -MF foo.d -c -o sub/foo.o sub/foo.c # ICC 7.0 will fill foo.d with something like # foo.o: sub/foo.c # foo.o: sub/foo.h # which is wrong. We want: # sub/foo.o: sub/foo.c # sub/foo.o: sub/foo.h # sub/foo.c: # sub/foo.h: # ICC 7.1 will output # foo.o: sub/foo.c sub/foo.h # and will wrap long lines using \ : # foo.o: sub/foo.c ... \ # sub/foo.h ... \ # ... "$@" -MD -MF "$tmpdepfile" stat=$? if test $stat -eq 0; then : else rm -f "$tmpdepfile" exit $stat fi rm -f "$depfile" # Each line is of the form `foo.o: dependent.h', # or `foo.o: dep1.h dep2.h \', or ` dep3.h dep4.h \'. # Do two passes, one to just change these to # `$object: dependent.h' and one to simply `dependent.h:'. sed "s,^[^:]*:,$object :," < "$tmpdepfile" > "$depfile" # Some versions of the HPUX 10.20 sed can't process this invocation # correctly. Breaking it into two sed invocations is a workaround. sed 's,^[^:]*: \(.*\)$,\1,;s/^\\$//;/^$/d;/:$/d' < "$tmpdepfile" | sed -e 's/$/ :/' >> "$depfile" rm -f "$tmpdepfile" ;; tru64) # The Tru64 compiler uses -MD to generate dependencies as a side # effect. `cc -MD -o foo.o ...' puts the dependencies into `foo.o.d'. # At least on Alpha/Redhat 6.1, Compaq CCC V6.2-504 seems to put # dependencies in `foo.d' instead, so we check for that too. # Subdirectories are respected. dir=`echo "$object" | sed -e 's|/[^/]*$|/|'` test "x$dir" = "x$object" && dir= base=`echo "$object" | sed -e 's|^.*/||' -e 's/\.o$//' -e 's/\.lo$//'` if test "$libtool" = yes; then # Dependencies are output in .lo.d with libtool 1.4. # With libtool 1.5 they are output both in $dir.libs/$base.o.d # and in $dir.libs/$base.o.d and $dir$base.o.d. We process the # latter, because the former will be cleaned when $dir.libs is # erased. tmpdepfile1="$dir.libs/$base.lo.d" tmpdepfile2="$dir$base.o.d" tmpdepfile3="$dir.libs/$base.d" "$@" -Wc,-MD else tmpdepfile1="$dir$base.o.d" tmpdepfile2="$dir$base.d" tmpdepfile3="$dir$base.d" "$@" -MD fi stat=$? if test $stat -eq 0; then : else rm -f "$tmpdepfile1" "$tmpdepfile2" "$tmpdepfile3" exit $stat fi if test -f "$tmpdepfile1"; then tmpdepfile="$tmpdepfile1" elif test -f "$tmpdepfile2"; then tmpdepfile="$tmpdepfile2" else tmpdepfile="$tmpdepfile3" fi if test -f "$tmpdepfile"; then sed -e "s,^.*\.[a-z]*:,$object:," < "$tmpdepfile" > "$depfile" # That's a tab and a space in the []. sed -e 's,^.*\.[a-z]*:[ ]*,,' -e 's,$,:,' < "$tmpdepfile" >> "$depfile" else echo "#dummy" > "$depfile" fi rm -f "$tmpdepfile" ;; #nosideeffect) # This comment above is used by automake to tell side-effect # dependency tracking mechanisms from slower ones. dashmstdout) # Important note: in order to support this mode, a compiler *must* # always write the preprocessed file to stdout, regardless of -o. "$@" || exit $? # Remove the call to Libtool. if test "$libtool" = yes; then while test $1 != '--mode=compile'; do shift done shift fi # Remove `-o $object'. IFS=" " for arg do case $arg in -o) shift ;; $object) shift ;; *) set fnord "$@" "$arg" shift # fnord shift # $arg ;; esac done test -z "$dashmflag" && dashmflag=-M # Require at least two characters before searching for `:' # in the target name. This is to cope with DOS-style filenames: # a dependency such as `c:/foo/bar' could be seen as target `c' otherwise. "$@" $dashmflag | sed 's:^[ ]*[^: ][^:][^:]*\:[ ]*:'"$object"'\: :' > "$tmpdepfile" rm -f "$depfile" cat < "$tmpdepfile" > "$depfile" tr ' ' ' ' < "$tmpdepfile" | \ ## Some versions of the HPUX 10.20 sed can't process this invocation ## correctly. Breaking it into two sed invocations is a workaround. sed -e 's/^\\$//' -e '/^$/d' -e '/:$/d' | sed -e 's/$/ :/' >> "$depfile" rm -f "$tmpdepfile" ;; dashXmstdout) # This case only exists to satisfy depend.m4. It is never actually # run, as this mode is specially recognized in the preamble. exit 1 ;; makedepend) "$@" || exit $? # Remove any Libtool call if test "$libtool" = yes; then while test $1 != '--mode=compile'; do shift done shift fi # X makedepend shift cleared=no for arg in "$@"; do case $cleared in no) set ""; shift cleared=yes ;; esac case "$arg" in -D*|-I*) set fnord "$@" "$arg"; shift ;; # Strip any option that makedepend may not understand. Remove # the object too, otherwise makedepend will parse it as a source file. -*|$object) ;; *) set fnord "$@" "$arg"; shift ;; esac done obj_suffix="`echo $object | sed 's/^.*\././'`" touch "$tmpdepfile" ${MAKEDEPEND-makedepend} -o"$obj_suffix" -f"$tmpdepfile" "$@" rm -f "$depfile" cat < "$tmpdepfile" > "$depfile" sed '1,2d' "$tmpdepfile" | tr ' ' ' ' | \ ## Some versions of the HPUX 10.20 sed can't process this invocation ## correctly. Breaking it into two sed invocations is a workaround. sed -e 's/^\\$//' -e '/^$/d' -e '/:$/d' | sed -e 's/$/ :/' >> "$depfile" rm -f "$tmpdepfile" "$tmpdepfile".bak ;; cpp) # Important note: in order to support this mode, a compiler *must* # always write the preprocessed file to stdout. "$@" || exit $? # Remove the call to Libtool. if test "$libtool" = yes; then while test $1 != '--mode=compile'; do shift done shift fi # Remove `-o $object'. IFS=" " for arg do case $arg in -o) shift ;; $object) shift ;; *) set fnord "$@" "$arg" shift # fnord shift # $arg ;; esac done "$@" -E | sed -n '/^# [0-9][0-9]* "\([^"]*\)".*/ s:: \1 \\:p' | sed '$ s: \\$::' > "$tmpdepfile" rm -f "$depfile" echo "$object : \\" > "$depfile" cat < "$tmpdepfile" >> "$depfile" sed < "$tmpdepfile" '/^$/d;s/^ //;s/ \\$//;s/$/ :/' >> "$depfile" rm -f "$tmpdepfile" ;; msvisualcpp) # Important note: in order to support this mode, a compiler *must* # always write the preprocessed file to stdout, regardless of -o, # because we must use -o when running libtool. "$@" || exit $? IFS=" " for arg do case "$arg" in "-Gm"|"/Gm"|"-Gi"|"/Gi"|"-ZI"|"/ZI") set fnord "$@" shift shift ;; *) set fnord "$@" "$arg" shift shift ;; esac done "$@" -E | sed -n '/^#line [0-9][0-9]* "\([^"]*\)"/ s::echo "`cygpath -u \\"\1\\"`":p' | sort | uniq > "$tmpdepfile" rm -f "$depfile" echo "$object : \\" > "$depfile" . "$tmpdepfile" | sed 's% %\\ %g' | sed -n '/^\(.*\)$/ s:: \1 \\:p' >> "$depfile" echo " " >> "$depfile" . "$tmpdepfile" | sed 's% %\\ %g' | sed -n '/^\(.*\)$/ s::\1\::p' >> "$depfile" rm -f "$tmpdepfile" ;; none) exec "$@" ;; *) echo "Unknown depmode $depmode" 1>&2 exit 1 ;; esac exit 0 # Local Variables: # mode: shell-script # sh-indentation: 2 # eval: (add-hook 'write-file-hooks 'time-stamp) # time-stamp-start: "scriptversion=" # time-stamp-format: "%:y-%02m-%02d.%02H" # time-stamp-end: "$" # End: apparix-11-062/doc/000077500000000000000000000000001326043744200140205ustar00rootroot00000000000000apparix-11-062/doc/Makefile.am000066400000000000000000000014121326043744200160520ustar00rootroot00000000000000## Process this file with automake to produce Makefile.in ## $Id: Makefile.am,v 1.4 2006-08-04 20:50:19 flux Exp $ TROFF = groff ZOEM = zoem TIDY = tidy docdir = $(datadir)/doc/$(PACKAGE) docdocdir = $(docdir) azms = apparix.azm docdoc_DATA = apparix.html apparix.ps $(azms) man_MANS = apparix.1 EXTRA_DIST = $(azms) $(docdoc_DATA) $(man_MANS) SUFFIXES = .1 .7 .azm .html .ps .azm.1: $(ZOEM) --allow=../src/apparix -d roff -i $< -o $@ $(ZOEM) --allow=../src/apparix -d roff -i $< -o $@ .azm.7: $(ZOEM) -d roff -i $< -o $@ $(ZOEM) -d roff -i $< -o $@ .1.ps: $(TROFF) -man $< > $@ .7.ps: $(TROFF) -man $< > $@ .azm.html: $(ZOEM) --allow=../src/apparix:date -d html -i $< -o $@ $(ZOEM) --allow=../src/apparix:date -d html -i $< -o $@ - $(TIDY) -e $@ apparix-11-062/doc/Makefile.in000066400000000000000000000330461326043744200160730ustar00rootroot00000000000000# Makefile.in generated by automake 1.11 from Makefile.am. # @configure_input@ # Copyright (C) 1994, 1995, 1996, 1997, 1998, 1999, 2000, 2001, 2002, # 2003, 2004, 2005, 2006, 2007, 2008, 2009 Free Software Foundation, # Inc. # This Makefile.in is free software; the Free Software Foundation # gives unlimited permission to copy and/or distribute it, # with or without modifications, as long as this notice is preserved. # This program is distributed in the hope that it will be useful, # but WITHOUT ANY WARRANTY, to the extent permitted by law; without # even the implied warranty of MERCHANTABILITY or FITNESS FOR A # PARTICULAR PURPOSE. @SET_MAKE@ VPATH = @srcdir@ pkgdatadir = $(datadir)/@PACKAGE@ pkgincludedir = $(includedir)/@PACKAGE@ pkglibdir = $(libdir)/@PACKAGE@ pkglibexecdir = $(libexecdir)/@PACKAGE@ am__cd = CDPATH="$${ZSH_VERSION+.}$(PATH_SEPARATOR)" && cd install_sh_DATA = $(install_sh) -c -m 644 install_sh_PROGRAM = $(install_sh) -c install_sh_SCRIPT = $(install_sh) -c INSTALL_HEADER = $(INSTALL_DATA) transform = $(program_transform_name) NORMAL_INSTALL = : PRE_INSTALL = : POST_INSTALL = : NORMAL_UNINSTALL = : PRE_UNINSTALL = : POST_UNINSTALL = : subdir = doc DIST_COMMON = $(srcdir)/Makefile.am $(srcdir)/Makefile.in ACLOCAL_M4 = $(top_srcdir)/aclocal.m4 am__aclocal_m4_deps = $(top_srcdir)/acinclude.m4 \ $(top_srcdir)/configure.ac am__configure_deps = $(am__aclocal_m4_deps) $(CONFIGURE_DEPENDENCIES) \ $(ACLOCAL_M4) mkinstalldirs = $(install_sh) -d CONFIG_HEADER = $(top_builddir)/config.h CONFIG_CLEAN_FILES = CONFIG_CLEAN_VPATH_FILES = SOURCES = DIST_SOURCES = am__vpath_adj_setup = srcdirstrip=`echo "$(srcdir)" | sed 's|.|.|g'`; am__vpath_adj = case $$p in \ $(srcdir)/*) f=`echo "$$p" | sed "s|^$$srcdirstrip/||"`;; \ *) f=$$p;; \ esac; am__strip_dir = f=`echo $$p | sed -e 's|^.*/||'`; am__install_max = 40 am__nobase_strip_setup = \ srcdirstrip=`echo "$(srcdir)" | sed 's/[].[^$$\\*|]/\\\\&/g'` am__nobase_strip = \ for p in $$list; do echo "$$p"; done | sed -e "s|$$srcdirstrip/||" am__nobase_list = $(am__nobase_strip_setup); \ for p in $$list; do echo "$$p $$p"; done | \ sed "s| $$srcdirstrip/| |;"' / .*\//!s/ .*/ ./; s,\( .*\)/[^/]*$$,\1,' | \ $(AWK) 'BEGIN { files["."] = "" } { files[$$2] = files[$$2] " " $$1; \ if (++n[$$2] == $(am__install_max)) \ { print $$2, files[$$2]; n[$$2] = 0; files[$$2] = "" } } \ END { for (dir in files) print dir, files[dir] }' am__base_list = \ sed '$$!N;$$!N;$$!N;$$!N;$$!N;$$!N;$$!N;s/\n/ /g' | \ sed '$$!N;$$!N;$$!N;$$!N;s/\n/ /g' man1dir = $(mandir)/man1 am__installdirs = "$(DESTDIR)$(man1dir)" "$(DESTDIR)$(docdocdir)" NROFF = nroff MANS = $(man_MANS) DATA = $(docdoc_DATA) DISTFILES = $(DIST_COMMON) $(DIST_SOURCES) $(TEXINFOS) $(EXTRA_DIST) ACLOCAL = @ACLOCAL@ AMTAR = @AMTAR@ AUTOCONF = @AUTOCONF@ AUTOHEADER = @AUTOHEADER@ AUTOMAKE = @AUTOMAKE@ AWK = @AWK@ CC = @CC@ CCDEPMODE = @CCDEPMODE@ CFLAGS = @CFLAGS@ CPP = @CPP@ CPPFLAGS = @CPPFLAGS@ CYGPATH_W = @CYGPATH_W@ DEFS = @DEFS@ DEPDIR = @DEPDIR@ ECHO_C = @ECHO_C@ ECHO_N = @ECHO_N@ ECHO_T = @ECHO_T@ EGREP = @EGREP@ EXEEXT = @EXEEXT@ GREP = @GREP@ INSTALL = @INSTALL@ INSTALL_DATA = @INSTALL_DATA@ INSTALL_PROGRAM = @INSTALL_PROGRAM@ INSTALL_SCRIPT = @INSTALL_SCRIPT@ INSTALL_STRIP_PROGRAM = @INSTALL_STRIP_PROGRAM@ LDFLAGS = @LDFLAGS@ LIBOBJS = @LIBOBJS@ LIBS = @LIBS@ LN_S = @LN_S@ LTLIBOBJS = @LTLIBOBJS@ MAINT = @MAINT@ MAKEINFO = @MAKEINFO@ MKDIR_P = @MKDIR_P@ OBJEXT = @OBJEXT@ PACKAGE = @PACKAGE@ PACKAGE_BUGREPORT = @PACKAGE_BUGREPORT@ PACKAGE_NAME = @PACKAGE_NAME@ PACKAGE_STRING = @PACKAGE_STRING@ PACKAGE_TARNAME = @PACKAGE_TARNAME@ PACKAGE_URL = @PACKAGE_URL@ PACKAGE_VERSION = @PACKAGE_VERSION@ PATH_SEPARATOR = @PATH_SEPARATOR@ RANLIB = @RANLIB@ SET_MAKE = @SET_MAKE@ SHELL = @SHELL@ STRIP = @STRIP@ VERSION = @VERSION@ abs_builddir = @abs_builddir@ abs_srcdir = @abs_srcdir@ abs_top_builddir = @abs_top_builddir@ abs_top_srcdir = @abs_top_srcdir@ ac_ct_CC = @ac_ct_CC@ am__include = @am__include@ am__leading_dot = @am__leading_dot@ am__quote = @am__quote@ am__tar = @am__tar@ am__untar = @am__untar@ bindir = @bindir@ build_alias = @build_alias@ builddir = @builddir@ datadir = @datadir@ datarootdir = @datarootdir@ docdir = $(datadir)/doc/$(PACKAGE) dvidir = @dvidir@ exec_prefix = @exec_prefix@ host_alias = @host_alias@ htmldir = @htmldir@ includedir = @includedir@ infodir = @infodir@ install_sh = @install_sh@ libdir = @libdir@ libexecdir = @libexecdir@ localedir = @localedir@ localstatedir = @localstatedir@ mandir = @mandir@ mkdir_p = @mkdir_p@ oldincludedir = @oldincludedir@ pdfdir = @pdfdir@ prefix = @prefix@ program_transform_name = @program_transform_name@ psdir = @psdir@ sbindir = @sbindir@ sharedstatedir = @sharedstatedir@ srcdir = @srcdir@ sysconfdir = @sysconfdir@ target_alias = @target_alias@ top_build_prefix = @top_build_prefix@ top_builddir = @top_builddir@ top_srcdir = @top_srcdir@ TROFF = groff ZOEM = zoem TIDY = tidy docdocdir = $(docdir) azms = apparix.azm docdoc_DATA = apparix.html apparix.ps $(azms) man_MANS = apparix.1 EXTRA_DIST = $(azms) $(docdoc_DATA) $(man_MANS) SUFFIXES = .1 .7 .azm .html .ps all: all-am .SUFFIXES: .SUFFIXES: .1 .7 .azm .html .ps $(srcdir)/Makefile.in: @MAINTAINER_MODE_TRUE@ $(srcdir)/Makefile.am $(am__configure_deps) @for dep in $?; do \ case '$(am__configure_deps)' in \ *$$dep*) \ ( cd $(top_builddir) && $(MAKE) $(AM_MAKEFLAGS) am--refresh ) \ && { if test -f $@; then exit 0; else break; fi; }; \ exit 1;; \ esac; \ done; \ echo ' cd $(top_srcdir) && $(AUTOMAKE) --gnu doc/Makefile'; \ $(am__cd) $(top_srcdir) && \ $(AUTOMAKE) --gnu doc/Makefile .PRECIOUS: Makefile Makefile: $(srcdir)/Makefile.in $(top_builddir)/config.status @case '$?' in \ *config.status*) \ cd $(top_builddir) && $(MAKE) $(AM_MAKEFLAGS) am--refresh;; \ *) \ echo ' cd $(top_builddir) && $(SHELL) ./config.status $(subdir)/$@ $(am__depfiles_maybe)'; \ cd $(top_builddir) && $(SHELL) ./config.status $(subdir)/$@ $(am__depfiles_maybe);; \ esac; $(top_builddir)/config.status: $(top_srcdir)/configure $(CONFIG_STATUS_DEPENDENCIES) cd $(top_builddir) && $(MAKE) $(AM_MAKEFLAGS) am--refresh $(top_srcdir)/configure: @MAINTAINER_MODE_TRUE@ $(am__configure_deps) cd $(top_builddir) && $(MAKE) $(AM_MAKEFLAGS) am--refresh $(ACLOCAL_M4): @MAINTAINER_MODE_TRUE@ $(am__aclocal_m4_deps) cd $(top_builddir) && $(MAKE) $(AM_MAKEFLAGS) am--refresh $(am__aclocal_m4_deps): install-man1: $(man_MANS) @$(NORMAL_INSTALL) test -z "$(man1dir)" || $(MKDIR_P) "$(DESTDIR)$(man1dir)" @list=''; test -n "$(man1dir)" || exit 0; \ { for i in $$list; do echo "$$i"; done; \ l2='$(man_MANS)'; for i in $$l2; do echo "$$i"; done | \ sed -n '/\.1[a-z]*$$/p'; \ } | while read p; do \ if test -f $$p; then d=; else d="$(srcdir)/"; fi; \ echo "$$d$$p"; echo "$$p"; \ done | \ sed -e 'n;s,.*/,,;p;h;s,.*\.,,;s,^[^1][0-9a-z]*$$,1,;x' \ -e 's,\.[0-9a-z]*$$,,;$(transform);G;s,\n,.,' | \ sed 'N;N;s,\n, ,g' | { \ list=; while read file base inst; do \ if test "$$base" = "$$inst"; then list="$$list $$file"; else \ echo " $(INSTALL_DATA) '$$file' '$(DESTDIR)$(man1dir)/$$inst'"; \ $(INSTALL_DATA) "$$file" "$(DESTDIR)$(man1dir)/$$inst" || exit $$?; \ fi; \ done; \ for i in $$list; do echo "$$i"; done | $(am__base_list) | \ while read files; do \ test -z "$$files" || { \ echo " $(INSTALL_DATA) $$files '$(DESTDIR)$(man1dir)'"; \ $(INSTALL_DATA) $$files "$(DESTDIR)$(man1dir)" || exit $$?; }; \ done; } uninstall-man1: @$(NORMAL_UNINSTALL) @list=''; test -n "$(man1dir)" || exit 0; \ files=`{ for i in $$list; do echo "$$i"; done; \ l2='$(man_MANS)'; for i in $$l2; do echo "$$i"; done | \ sed -n '/\.1[a-z]*$$/p'; \ } | sed -e 's,.*/,,;h;s,.*\.,,;s,^[^1][0-9a-z]*$$,1,;x' \ -e 's,\.[0-9a-z]*$$,,;$(transform);G;s,\n,.,'`; \ test -z "$$files" || { \ echo " ( cd '$(DESTDIR)$(man1dir)' && rm -f" $$files ")"; \ cd "$(DESTDIR)$(man1dir)" && rm -f $$files; } install-docdocDATA: $(docdoc_DATA) @$(NORMAL_INSTALL) test -z "$(docdocdir)" || $(MKDIR_P) "$(DESTDIR)$(docdocdir)" @list='$(docdoc_DATA)'; test -n "$(docdocdir)" || list=; \ for p in $$list; do \ if test -f "$$p"; then d=; else d="$(srcdir)/"; fi; \ echo "$$d$$p"; \ done | $(am__base_list) | \ while read files; do \ echo " $(INSTALL_DATA) $$files '$(DESTDIR)$(docdocdir)'"; \ $(INSTALL_DATA) $$files "$(DESTDIR)$(docdocdir)" || exit $$?; \ done uninstall-docdocDATA: @$(NORMAL_UNINSTALL) @list='$(docdoc_DATA)'; test -n "$(docdocdir)" || list=; \ files=`for p in $$list; do echo $$p; done | sed -e 's|^.*/||'`; \ test -n "$$files" || exit 0; \ echo " ( cd '$(DESTDIR)$(docdocdir)' && rm -f" $$files ")"; \ cd "$(DESTDIR)$(docdocdir)" && rm -f $$files tags: TAGS TAGS: ctags: CTAGS CTAGS: distdir: $(DISTFILES) @list='$(MANS)'; if test -n "$$list"; then \ list=`for p in $$list; do \ if test -f $$p; then d=; else d="$(srcdir)/"; fi; \ if test -f "$$d$$p"; then echo "$$d$$p"; else :; fi; done`; \ if test -n "$$list" && \ grep 'ab help2man is required to generate this page' $$list >/dev/null; then \ echo "error: found man pages containing the \`missing help2man' replacement text:" >&2; \ grep -l 'ab help2man is required to generate this page' $$list | sed 's/^/ /' >&2; \ echo " to fix them, install help2man, remove and regenerate the man pages;" >&2; \ echo " typically \`make maintainer-clean' will remove them" >&2; \ exit 1; \ else :; fi; \ else :; fi @srcdirstrip=`echo "$(srcdir)" | sed 's/[].[^$$\\*]/\\\\&/g'`; \ topsrcdirstrip=`echo "$(top_srcdir)" | sed 's/[].[^$$\\*]/\\\\&/g'`; \ list='$(DISTFILES)'; \ dist_files=`for file in $$list; do echo $$file; done | \ sed -e "s|^$$srcdirstrip/||;t" \ -e "s|^$$topsrcdirstrip/|$(top_builddir)/|;t"`; \ case $$dist_files in \ */*) $(MKDIR_P) `echo "$$dist_files" | \ sed '/\//!d;s|^|$(distdir)/|;s,/[^/]*$$,,' | \ sort -u` ;; \ esac; \ for file in $$dist_files; do \ if test -f $$file || test -d $$file; then d=.; else d=$(srcdir); fi; \ if test -d $$d/$$file; then \ dir=`echo "/$$file" | sed -e 's,/[^/]*$$,,'`; \ if test -d "$(distdir)/$$file"; then \ find "$(distdir)/$$file" -type d ! -perm -700 -exec chmod u+rwx {} \;; \ fi; \ if test -d $(srcdir)/$$file && test $$d != $(srcdir); then \ cp -fpR $(srcdir)/$$file "$(distdir)$$dir" || exit 1; \ find "$(distdir)/$$file" -type d ! -perm -700 -exec chmod u+rwx {} \;; \ fi; \ cp -fpR $$d/$$file "$(distdir)$$dir" || exit 1; \ else \ test -f "$(distdir)/$$file" \ || cp -p $$d/$$file "$(distdir)/$$file" \ || exit 1; \ fi; \ done check-am: all-am check: check-am all-am: Makefile $(MANS) $(DATA) installdirs: for dir in "$(DESTDIR)$(man1dir)" "$(DESTDIR)$(docdocdir)"; do \ test -z "$$dir" || $(MKDIR_P) "$$dir"; \ done install: install-am install-exec: install-exec-am install-data: install-data-am uninstall: uninstall-am install-am: all-am @$(MAKE) $(AM_MAKEFLAGS) install-exec-am install-data-am installcheck: installcheck-am install-strip: $(MAKE) $(AM_MAKEFLAGS) INSTALL_PROGRAM="$(INSTALL_STRIP_PROGRAM)" \ install_sh_PROGRAM="$(INSTALL_STRIP_PROGRAM)" INSTALL_STRIP_FLAG=-s \ `test -z '$(STRIP)' || \ echo "INSTALL_PROGRAM_ENV=STRIPPROG='$(STRIP)'"` install mostlyclean-generic: clean-generic: distclean-generic: -test -z "$(CONFIG_CLEAN_FILES)" || rm -f $(CONFIG_CLEAN_FILES) -test . = "$(srcdir)" || test -z "$(CONFIG_CLEAN_VPATH_FILES)" || rm -f $(CONFIG_CLEAN_VPATH_FILES) maintainer-clean-generic: @echo "This command is intended for maintainers to use" @echo "it deletes files that may require special tools to rebuild." clean: clean-am clean-am: clean-generic mostlyclean-am distclean: distclean-am -rm -f Makefile distclean-am: clean-am distclean-generic dvi: dvi-am dvi-am: html: html-am html-am: info: info-am info-am: install-data-am: install-docdocDATA install-man install-dvi: install-dvi-am install-dvi-am: install-exec-am: install-html: install-html-am install-html-am: install-info: install-info-am install-info-am: install-man: install-man1 install-pdf: install-pdf-am install-pdf-am: install-ps: install-ps-am install-ps-am: installcheck-am: maintainer-clean: maintainer-clean-am -rm -f Makefile maintainer-clean-am: distclean-am maintainer-clean-generic mostlyclean: mostlyclean-am mostlyclean-am: mostlyclean-generic pdf: pdf-am pdf-am: ps: ps-am ps-am: uninstall-am: uninstall-docdocDATA uninstall-man uninstall-man: uninstall-man1 .MAKE: install-am install-strip .PHONY: all all-am check check-am clean clean-generic distclean \ distclean-generic distdir dvi dvi-am html html-am info info-am \ install install-am install-data install-data-am \ install-docdocDATA install-dvi install-dvi-am install-exec \ install-exec-am install-html install-html-am install-info \ install-info-am install-man install-man1 install-pdf \ install-pdf-am install-ps install-ps-am install-strip \ installcheck installcheck-am installdirs maintainer-clean \ maintainer-clean-generic mostlyclean mostlyclean-generic pdf \ pdf-am ps ps-am uninstall uninstall-am uninstall-docdocDATA \ uninstall-man uninstall-man1 .azm.1: $(ZOEM) --allow=../src/apparix -d roff -i $< -o $@ $(ZOEM) --allow=../src/apparix -d roff -i $< -o $@ .azm.7: $(ZOEM) -d roff -i $< -o $@ $(ZOEM) -d roff -i $< -o $@ .1.ps: $(TROFF) -man $< > $@ .7.ps: $(TROFF) -man $< > $@ .azm.html: $(ZOEM) --allow=../src/apparix:date -d html -i $< -o $@ $(ZOEM) --allow=../src/apparix:date -d html -i $< -o $@ - $(TIDY) -e $@ # Tell versions [3.59,3.63) of GNU make to not export all variables. # Otherwise a system limit (for SysV at least) may be exceeded. .NOEXPORT: apparix-11-062/doc/apparix.1000066400000000000000000001046531326043744200155570ustar00rootroot00000000000000.\" Copyright (c) 2011 Stijn van Dongen .TH "apparix" 1 "3 Mar 2011" "apparix 1\&.004, 11-062" "USER COMMANDS " .po 2m .de ZI .\" Zoem Indent/Itemize macro I. .br 'in +\\$1 .nr xa 0 .nr xa -\\$1 .nr xb \\$1 .nr xb -\\w'\\$2' \h'|\\n(xau'\\$2\h'\\n(xbu'\\ .. .de ZJ .br .\" Zoem Indent/Itemize macro II. 'in +\\$1 'in +\\$2 .nr xa 0 .nr xa -\\$2 .nr xa -\\w'\\$3' .nr xb \\$2 \h'|\\n(xau'\\$3\h'\\n(xbu'\\ .. .if n .ll -2m .am SH .ie n .in 4m .el .in 8m .. .SH NAME apparix \- augmenting cd with bookmarks .SH SYNOPSIS Apparix allows you to bookmark directories and later jump to them using the mark\&. By default apparix acts as a replacement for \fIcd\fP and can be used in the same manner, including the special behaviour for \fIcd\fP without argument and \fIcd\fP\ \&\fC-\fP\&. It is possible to directly jump to subdirectories of a bookmarked directory\&. The contributed bash completion code facilitates completion both on bookmarks and directories, but can be adjusted to accomodate other preferences\&. This manual page suffers from an excess in verbosity due to the many examples, explanations of the bells and whistles, and comparisons with other approaches to bookmarking\&. The fundamental idea is simply that typing a string of your own choosing takes you to the directory associated with it\&. Apparix does little more than maintaining a list of keys and values\&. It obtains directory names and listings, associates path names (values) with bookmarks (keys), and has some facilities for manipulating keys and values\&. The functions involving apparix (\fBbm\fP, \fBto\fP, and \fBportal\fP) provide the user interface\&. Other functions, \fBals\fP (apparix ls) and \fBae\fP (apparix edit) are discussed on the main apparix page http://micans\&.org/apparix\&. .SH GETTING STARTED Install apparix\&. This should be as easy as \fC\&./configure --prefix=$HOME/local && make && make install\fP, or perhaps a pre-packaged apparix is available for your system\&. Then get hold of the \fBto\fP, \fBbm\fP and \fBportal\fP shell handles\&. These are either aliases or functions depending on your shell\&. Currently csh-style shells and bash are supported\&. Get the ones you need preferably from http://micans\&.org/apparix/#shell\&. For a more limited set of commands either visit the \fBFILES\fP section, or issue \fCapparix --shell-examples\fP\&. Activate them by simply pasting them in a shell or adding them to the appropriate resource file, e\&.g\&. \fC$HOME/\&.cshrc\fP or \fC$HOME/\&.bashrc\fP (do not forget to \fIsource\fP the resource file)\&. The handles \fBto\fP, \fBbm\fP and \fBportal\fP can of course be changed to any name desired\&. With these preliminaries, the following is a mock-up shell navigation session\&. .di ZV .in 0 .nf \fC > \fBpwd\fP /home/eez/cvs/xyz/tfa/faq/zut/bar/foo > \fBls\fP src/ doc/ CVS/ bin/ > \fBbm xkr\fP # bookmark as xkr (funny name though) > \fBbm\fP # bookmark as foo (trailing component is default) (later) > \fBto xkr\fP # cd to /home/eez/cvs/xyz/tfa/faq/zut/bar/foo (alternatively) > \fBto xkr src\fP # cd to /home/eez/cvs/xyz/tfa/faq/zut/bar/foo/src (alternatively) > \fBto foo\fP # cd to /home/eez/cvs/xyz/tfa/faq/zut/bar/foo (later) > \fBls\fP aap pyu/ qua tim/ zut/ > \fBpwd\fP /home/eez/another/branch/deep/down/under > \fBportal\fP # bookmark as portal, imports tim zut pyu bookmarks added flock of 3 in portal /home/eez/another/branch/deep/down/under (later) > \fBto zut\fP # cd to /home/eez/another/branch/deep/down/under/zut (later) > \fBapparix\fP # show all bookmarks --- portals e /home/eez/another/branch/deep/down/under --- expansions j pyu /home/eez/another/branch/deep/down/under/pyu j tim /home/eez/another/branch/deep/down/under/tim j zut /home/eez/another/branch/deep/down/under/zut --- bookmarks j xkr /home/eez/cvs/xyz/tfa/faq/zut/bar/foo j foo /home/eez/cvs/xyz/tfa/faq/zut/bar/foo .fi \fR .in .di .ne \n(dnu .nf \fC .ZV .fi \fR In the last example apparix simply shows all its bookmarks\&. The first batch shows portals\&. The second batch shows secondary bookmarks expanded from portals\&. The third batch shows all regular bookmarks\&. In the default definitions of \fBto\fP it falls back to regular \fIcd\fP behaviour in case a mark is not found\&. This is done by instructing apparix to check whether the mark exists as the name of a directory\&. It is possible to do this either before or after bookmark lookup, or not at all\&. By default the bash completion code takes into account both bookmarks and directories\&. Apparix also allows subdirectory specification of bookmarked locations\&. If this is combined with the bash completion code it yields a powerful way of navigating container directories, i\&.e\&. directories that contain a large number of subdirectories\&. Refer to the \fBsubdirectory specification\fP section\&. \fBFurther options\fP .br \fB[--add-mark\fP (\fIadd jump bookmark\fP)\fB]\fP \fB[--add-portal\fP (\fIadd portal bookmark\fP)\fB]\fP \fB[-sm\fP (\fIsquash repeated marks\fP)\fB]\fP \fB[-sd\fP (\fIsquash repeated destinations\fP)\fB]\fP \fB[-lm\fP (\fIlist bookmarks with this mark\fP)\fB]\fP \fB[-ld\fP (\fIlist destinations with mark indirection\fP)\fB]\fP \fB[-favour\fP (\fIduplicate resolution policy\fP)\fB]\fP \fB[-pick\fP (\fIimmediate duplicate resolution\fP)\fB]\fP \fB[-purge\fP pat (\fIdelete bookmarks\fP)\fB]\fP \fB[-purge-mark\fP (\fIpat\fP)\fB]\fP \fB[-d\fP (\fIdump resource file to STDOUT\fP)\fB]\fP \fB[-l\fP (\fIlist available jumps\fP)\fB]\fP \fB[-u\fP (\fIremove last additions\fP)\fB]\fP \fB[--rehash\fP (\fIre-expand portal bookmarks\fP)\fB]\fP \fB[--bu\fP (\fIcreate backup of resource file\fP)\fB]\fP \fB[-bu\fP (\fIcreate backup in \fP)\fB]\fP \fB[--cwd\fP (\fIuse getcwd(3), not pwd(1)\fP)\fB]\fP \fB[--shell-examples\fP (\fIoutput example macros\fP)\fB]\fP .SH DESCRIPTION Apparix combines the properties of the \fIcdargs\fP utility and the CDPATH shell mechanism for fast navigation through the file system\&. It can additionally act as the regular \fIcd\fP command\&. It is especially useful for visiting and documenting both often- and rarely-used locations\&. Apparix enables you to attach marks to locations and jump to those locations by loading the mark\&. Marking, unmarking and jumping are simple operations that are performed in the shell\&. All actions take effect immediately in all shells running\&. By setting up convenient aliases for marking and jumping the file system can be navigated in a fast and intuitive manner\&. The \fBFILES\fP section lists aliases for csh-type shells and functions for bash, including the setup to equip the \fBto\fP function with argument completion in bash\&. This section contains some examples of the most common uses of apparix\&. \fBOPTIONS\fP contains a list of additional options available for listing, pruning, and squashing bookmarks\&. \fBNOTES\fP features a brief discussion of the advantages of apparix over other approaches such as setting up aliases for often visited directories, using symlinks, CDPATH, or a combination of these\&. \fBHISTORY\fP explains the difference between cdargs and apparix\&. The sections \fBduplicate resolution\fP, \fBsubdirectory specification\fP, \fBtab completion\fP, \fBcopying and moving files\fP, \fBlisting bookmarks\fP, and \fBreplacing cd\fP further below are also recommended reading\&. Apparix works in a manner similar to cdargs\&. One usually invokes apparix by using pre-defined aliases\&. Here they will be called \fBbm\fP for bookmark, \fBportal\fP for a CDPATH-style bookmark and \fBto\fP for initiating an apparition (aka jump)\&. These aliases are found below in the \fBFILES\fP section and can also be obtained by issuing .di ZV .in 0 .nf \fC apparix --shell-examples .fi \fR .in .di .ne \n(dnu .nf \fC .ZV .fi \fR Suppose your user name is \fIeez\fP and your home directory is \fC/home/eez\fP\&. You often visit a directory called \fC/home/eez/cvs/xyz/tfa/faq/zut/bar/foo\fP\&. This is how to create and use a bookmark for foo .di ZV .in 0 .nf \fC /home/eez/cvs/xyz/tfa/faq/zut/bar/foo> \fBbm foo\fP added: foo -> /home/eez/cvs/xyz/tfa/faq/zut/bar/foo /home/eez/cvs/xyz/tfa/faq/zut/bar/foo> \fBcd\fP /home/eez> \fBto foo\fP /home/eez/cvs/xyz/tfa/faq/zut/bar/foo> .fi \fR .in .di .ne \n(dnu .nf \fC .ZV .fi \fR If one bookmarks a directory by its trailing component as happened in this case, it is not necessary to specify the mark\&. By default apparix will use the trailing component as the mark\&. So .di ZV .in 0 .nf \fC /home/eez/cvs/xyz/tfa/faq/zut/bar/foo> \fBbm\fP added: foo -> /home/eez/cvs/xyz/tfa/faq/zut/bar/foo .fi \fR .in .di .ne \n(dnu .nf \fC .ZV .fi \fR gives the same result\&. Another scenario is where you have some directory that contains a largish number of subdirectories, all of which you would like to have bookmarked\&. If the subdirectories have distinctive names this can be achieved in one fell swoop by marking the parent directory as a \fIportal\fP\&. This is similar to adding the parent directory to the CDPATH environment variable, except that apparix bookmarks are not part of the cd namespace\&. It is argued in \fBNOTES\fP that this is a good thing\&. Consider this: .di ZV .in 0 .nf \fC /home/cvs/bagger/boemel/mcl/mcl/src> \fBls\fP alien/ CVS/ impala/ Makefile\&.am README shmcx/ attic/ giraffe/ lib/ Makefile\&.in shcl/ shmx/ contrib/ gmon\&.out Makefile mcl/ shmcl/ taurus/ .fi \fR .in .di .ne \n(dnu .nf \fC .ZV .fi \fR Some of the subdirectories have not-so-distinct names such as \fIcontrib\fP and \fIattic\fP, but they happen to be the directories least visited\&. Issuing: .di ZV .in 0 .nf \fC /home/cvs/bagger/boemel/mcl/mcl/src> \fBportal\fP [apparix] expanded 1 portal to 12 destinations .fi \fR .in .di .ne \n(dnu .nf \fC .ZV .fi \fR yields all of the subdirectories as destinations bookmarked by the last component of their path name\&. Incidentally, directory names such as \fCCVS\fP can be explicitly excluded from expansion by setting the environment variable \fCAPPARIXEXCLUDE\fP appropriately \- refer to section \fBENVIRONMENT\fP\&. Bookmarks resulting from portal expansion are kept in a separate resource file (see \fBFILES\fP)\&. Portal expansions can be recreated by issuing .di ZV .in 0 .nf \fC apparix --rehash .fi \fR .in .di .ne \n(dnu .nf \fC .ZV .fi \fR This is useful to reflect a change in the directory naming structure underneath a portal\&. .SH duplicate resolution Apparix allows identical bookmarks to point to different locations\&. When asked to visit such a bookmark it will by default present a list of options\&. The \fB-favour\fP\ \&\fI\fP option can be used to automate resolution\&. \fB\fP is a sequence of single characters, described further below\&. The order in which they are given denote the order in which resolution rules are applied\&. This option is typically used in the definition of the \fBto\fP function/alias or in the bash completion code\&. The \fB-pick\fP\ \&\fI\fP option is used to resolve to a particular directory directly\&. This is useful when you already know where you want to go, and typically used for the \fCnow\fP bookmark in conjunction with the bash \fCwhence\fP function\&. Use \fCwhence now\fP to see an indexed list of now bookmarks\&. It is possible to go to the desired directory by entering the bookmark index\&. It is possible to bypass the selection step by specifying \fCwhence now N\fP\&. Duplicates are allowed because it can be useful to overwrite a bookmark with a new location\&. The old bookmark is kept as a matter of policy\&. Use \fB-sm\fP to explicitly squash duplicates\&. .ZI 2m "l" \fIlevel\fP; prefer paths with fewer components\&. .in -2m .ZI 2m "L" reverse of the above\&. .in -2m .ZI 2m "o" \fIbookmark order\fP; prefer older entries\&. Entries appearing earlier in the file are considered older, but the actual date of creating the bookmark is not stored\&. Refer to \fBediting bookmarks\fP for more information\&. .in -2m .ZI 2m "O" reverse of the above\&. .in -2m .ZI 2m "r" \fIregular first\fP; prefer regular bookmarks over portal expansion\&. .in -2m .ZI 2m "R" reverse of the above\&. .in -2m If there are still ties after the specified rules have been applied apparix will simply take the first matching option\&. This behaviour cannot be further specified as the program uses a non-stable ordering routine\&. It is an absolute prerequisite that \fB-favour\fP is used in the bash completion code\&. Otherwise completion will fail (for a duplicated bookmark) while apparix is waiting for input\&. Refer to the tab completion description below\&. .SH subdirectory specification When jumping (apparating) you can specify an additional subdirectory after the bookmark\&. Apparix will append the subdirectory to the destination\&. This is useful for projects with directory nodes corresponding with versions\&. Assume you have a directory structure such as this: .di ZV .in 0 .nf \fC /x/y/z/OpusMagnum/v1/ /x/y/z/OpusMagnum/v2/ /x/y/z/OpusMagnum/v3/ .fi \fR .in .di .ne \n(dnu .nf \fC .ZV .fi \fR It is probably easiest to simply bookmark the OpusMagnum directory in some way (say with bookmark \fCom\fP)\&. You can then issue \&'\fCto om v2\fP\&' to jump to \fCOpusMagnum/v2\fP\&. This is more flexible and maintainable than creating bookmarks \fCom1\fP, \fCom2\fP, \fCom3\fP\&. One could add OpusMagnum as a portal, but with generic names such as \fCv1\fP this is not a very extendible approach\&. See also the tab completion description below - it is possible to tab-complete on subdirectories of the apparix jump directory\&. .SH tab completion The bash tab completion code does two things\&. First, it is possible to tab-complete on apparix bookmarks themselves, showing a listing of all available bookmarks (or iterating through them in cyclic mode, depending on your bash settings)\&. Second, once a bookmark has been given tab completion will list or iterate over all the subdirectories of the directory associated with that bookmark\&. Specifying a string after the bookmark will limit tab-completion to directories matching the shell-pattern in string\&. \fIVery\fP useful\&. Be careful to not remove the \fB-favour\fP\ \&\fIlist\fP option from the bash completion code\&. It is necessary to resolve duplicate bookmarks\&. .SH editing bookmarks Apparix appends new bookmarks to the end of the \&.apparixrc file\&. Nothing stops you from editing the file, and this is in fact recommended if for example you need to get rid of a bookmark and neither of \fB-purge\fP, \fB-purge-mark\fP, \fB-sd\fP, \fB-sm\fP fulfills your needs\&. It was an easy design choice not to equip apparix with editor capabilities\&. .SH copying and moving files It is straightforward to copy or move files to locations known by apparix\&. Examples: .di ZV .in 0 .nf \fC BASH and variants cp FOO $(apparix zoem) mv BAR $(apparix zoem doc) mv BAR $(apparix zoem doc)/test CSH and variants cp FOO \&`apparix zoem\&` mv BAR \&`apparix zoem doc\&`/test .fi \fR .in .di .ne \n(dnu .nf \fC .ZV .fi \fR .SH listing bookmarks Simply issuing apparix gives you a list of bookmarks grouped into three categories, portals, expansions, and bookmarks\&. Use the \fB-d\fP option to dump the resource file to STDOUT exactly as it is\&. This can be useful when you intend to use the \fB-u\fP\ \&\fInum\fP option to remove bookmarks or portals that were most recently added\&. Use \fB-l\fP to list all available jumps without their destinations\&. The jumps are grouped into expansions resulting from portals and regular bookmarks\&. .SH replacing cd With the supplied definition(s) of \fBto\fP, apparix will first see whether the mark is the name of a directory, accessible from the current directory\&. A directory is accessible if it would be a valid argument to cd, so it need not necessarily be a subdirectory of the current directory\&. If the mark is not an accessible directory, apparix will then try to do a lookup of the mark in the bookmark files\&. This behaviour can be inverted to do the lookup first and the current directory thereafter\&. Both modes can be used to make \fBto\fP a drop-in replacement for \fIcd\fP\&. Additionally and again similar to \fIcd\fP, \fC\&'to -\&'\fP will take you to the previous directory, and specifying \fCto\fP without arguments will take you to your home directory\&. The bash completion code acts accordingly, and should transparently complete on both marks and directories\&. .SH OPTIONS For bookmarking and jumping apparix is best invoked by using the aliases (tcsh-variants) or functions (sh/bash) listed in \fBFILES\fP\&. Apparix has a few options that are useful for pruning, squashing and rehasing bookmarks\&. These are best issued by invoking apparix directly\&. If you are interested in marks or destinations matching a certain pattern, simply issue apparix without arguments and pipe it through your program of choice\&. Unary options (those without arguments) usually start with two hyphens except for standardized options such as \fB-h\fP\&. Options that take an argument can be converted to a unary key=value notation, e\&.g\&. \fB-purge-mark\fP\ \&\fBfoo\fP is equivalent to \fB--purge-mark\fP=\fBfoo\fP\&. When invoked without arguments apparix will simply dump its bookmarks\&. .ZI 2m "\fB--add-mark\fP (\fIadd jump bookmark\fP)" \& .br This options expects trailing \fI[mark [destination]]\fP argument(s)\&. Both arguments are optional\&. If a single argument is given it is interpreted as a bookmark name to be mapped to the current directory\&. If two arguments are given the last argument is taken as the target directory\&. If no argument is given apparix will enlist the current directory as a target bookmarked by the trailing component of the directory path\&. .in -2m .ZI 2m "\fB--add-portal\fP (\fIadd portal bookmark\fP)" \& .br This option enlists a directory as a portal and adds all subdirectories as bookmarks\&. The name of the bookmark is simply the name of the subdirectory\&. By default the current directory is added as a portal\&. An optional trailing argument will override this behaviour and instead be interpreted as the portal location\&. .in -2m .ZI 2m "\fB--try-current-first\fP (\fItry current directory before lookup\fP)" \& .br This option is useful in the definition of the \fBto\fP wrapper\&. Before attempting any lookup of the mark, apparix tests whether the supplied mark exists as a subdirectory in the current directory\&. If it does, the mark is simply expanded to itself\&. .in -2m .ZI 2m "\fB--try-current-last\fP (\fItry current directory if lookup fails\fP)" \& .br This option is useful in the definition of the \fBto\fP wrapper\&. If lookup of the mark fails, apparix tests whether the supplied mark exists as a subdirectory in the current directory\&. If it does, the mark is simply expanded to itself\&. .in -2m .ZI 2m "\fB--notify-current\fP (\fInotify if current directory is used\fP)" \& .br This option is useful in the definition of the \fIbf\fP wrapper in conjunction with either \fB--try-current-first\fP or \fB--try-current-last\fP\&. If the mark is found as a subdirectory in the current directory, apparix notifies the user of this fact (on the diagnostic stream)\&. .in -2m .ZI 2m "\fB-sm\fP (\fIsquash repeated marks\fP)" \& .br Apparix will squash bookmarks with mark \fC\fP\&. This is useful when a mark points to a versioned project, and the project is updated to a new version and a new directory\&. Apparix will by default keep the last one occurring in the resource file (corresponding with \fB-favour\fP\ \&\fBO\fP)\&. This option respects the \fB-favour\fP option if given\&. Duplicating an already existing mark can be useful when it identifies a project for which the underlying directory changes every once in a while (e\&.g\&. the project is downloaded from external sources and comes with version information)\&. It is not strictly necessary to squash bookmarks since \fBto\fP functions/macros that are equipped with the \fB-favour\fP option will generally resolve duplicate matches\&. .in -2m .ZI 2m "\fB-sd\fP (\fIsquash repeated destinations\fP)" \& .br All other bookmarks with the same destination as \fC\fP are removed\&. This is useful when a given destination has acquired multiple bookmarks and you decide to settle on a favourite\&. .in -2m .ZI 2m "\fB-lm\fP (\fIlist bookmarks with this mark\fP)" \& .br It lists all bookmarks \fC\fP (noting that it may point to multiple locations)\&. .in -2m .ZI 2m "\fB-ld\fP (\fIlist repeated destinations\fP)" \& .br This lists all bookmarks \fC\fP (noting that it may point to multiple locations) and additionally lists all other bookmarks that share the destination with any of the first bookmarks\&. This allows one to predict the effect of issuing \fCapparix -sd \fP\&. .in -2m .ZI 2m "\fB-purge\fP pat (\fIdelete bookmarks\fP)" \& .br This deletes bookmarks where destination matches \fIpat\fP\&. All deleted bookmarks are printed to STDOUT\&. Thus if you regret deleting a bookmark it is easy to add it back\&. Portal specifications are never affected\&. .in -2m .ZI 2m "\fB-purge-mark\fP (\fIpat\fP)" \& .br This deletes bookmarks where mark matches \fIpat\fP\&. Portal specifications are never affected\&. .in -2m .ZI 2m "\fB-d\fP (\fIdump resource file to STDOUT\fP)" \& .br Dump resource file to STDOUT\&. .in -2m .ZI 2m "\fB-l\fP (\fIlist available jumps\fP)" \& .br List available jumps paragraph-style\&. Portal specifications themselves are excluded, and regular jumps and jumps resulting from portal expansions are listed under different headers\&. .in -2m .ZI 2m "\fB-u\fP (\fIremove last additions\fP)" \& .br Remove last additions\&. Portal specifications and regular jumps are treated alike\&. .in -2m .ZI 2m "\fB--rehash\fP (\fIre-expand portal bookmarks\fP)" \& .br Apparix will reread the resource file and reexpand portal locations\&. Useful if directories have been added, renamed, or removed\&. Refer to section \fBENVIRONMENT\fP for the effect that the environment variable \fCAPPARIXEXCLUDE\fP has on portal expansion\&. .in -2m .ZI 2m "\fB-favour\fP (\fIset duplicate resolution policy\fP)" \& 'in -2m .ZI 2m "\fB-pick\fP (\fIimmediate duplicate resolution\fP)" \& 'in -2m 'in +2m \& .br These options have a section to themselves\&. Refer to \fBduplicate resolution\fP\&. .in -2m .ZI 2m "\fB--cwd\fP (\fIuse getcwd(3), not pwd(1)\fP)" \& .br By default aparix uses the program \fIpwd\fP(1) rather than the system call \fIgetcwd\fP(3)\&. On some systems it was found that the latter results in paths that contain machine-specific mount components\&. Appparix will use \fIgetcwd\fP(3) when \fB--cwd\fP is used\&. .in -2m .ZI 2m "\fB--shell-examples\fP (\fIoutput example macros\fP)" \& .br This outputs example macros\&. They are also listed in the \fBFILES\fP section though\&. .in -2m .ZI 2m "\fB--bu\fP (\fIcreate backup of the resource file\fP)" \& .br This creates the backup file in \&.apparixrc\&.bu\&. .in -2m .ZI 2m "\fB-bu\fP fname (\fIcreate backup of the resource file\fP)" \& .br This creates the backup file in \fIfname\fP\&. Use \fB-d\fP or \fB-bu\fP\ \&\fB-\fP to dump to STDOUT\&. .in -2m .ZI 2m "\fB-h\fP (\fIshow synopsis\fP)" \& 'in -2m .ZI 2m "\fB--apropos\fP (\fIshow synopsis\fP)" \& 'in -2m 'in +2m \& .br print synopsis of all options .in -2m .SH ENVIRONMENT .ZI 2m "APPARIXEXCLUDE" \& .br This variable specifies exclusion behaviour when portals are expanded with the \fC--rehash\fP option\&. It has the following syntax: .di ZV .in 0 .nf \fC <[:,][]>+ .fi \fR .in .di .ne \n(dnu .nf \fC .ZV .fi \fR That is, a list of names with each name preceded by a colon or a comma\&. A colon indicates that \fC\fP triggers exclusion of directory names for which the trailing component is identical to \fC\fP\&. A comma indicates that \fC\fP triggers exclusion of directory names for which the trailing component contains \fC\fP as a substring\&. Consider: .di ZV .in 0 .nf \fC export APPARIXEXCLUDE=:CVS:lib,tmp # A - example export APPARIXEXCLUDE=, # B - curiosity .fi \fR .in .di .ne \n(dnu .nf \fC .ZV .fi \fR The first excludes directory names \fCCVS\fP and \fClib\fP and any directory name having \fCtmp\fP as a substring\&. The second example will effectively disable portals, as it speficies the empty string which is a substring of all strings\&. .in -2m .ZI 2m "APPARIXTAG" \& .br This variable, if set, is incorporated into the names of the apparix resource files\&. By default these are \fC\&.apparixrc\fP and \fC\&.apparixexpand\fP\&. When APPARIXTAG is set to \fC\fP they become \fC\&.apparixrc\fP and \fC\&.apparixexpand\fP\&. This can be used e\&.g\&. to maintain different sets of bookmarks on different host machines\&. .in -2m .ZI 2m "APPARIXLOG" \& .br This variable, if set, is interpreted as the name of a log file\&. The log file keeps track of all newly added bookmarks and portals without ever deleting anything, in the same format as the \fC\&.apparixrc\fP file\&. If this variable is not set nothing is tracked\&. .in -2m .ZI 2m "APPARIXPURGE" \& .br This changes the way apparix dumps purged bookmarks to STDOUT\&. By default they are dumped as command lines that will reimport the bookmarks if issued (i\&.e\&. cut and pasted)\&. By setting this variable to 1 purged bookmarks are dumped in the format used in the \fC\&.apparixrc\fP file\&. .in -2m .SH FILES You should use aliases or functions to make apparix really useful\&. Get them from apparix by giving it the --shell-examples option, or from further below\&. Note the fragment that provides \fBto\fP argument completion in bash\&. .ZI 2m "$HOME/\&.apparixrc" \& .br This is the primary resource file\&. There is usually no need to edit it by hand\&. Sometimes it can be useful to edit by hand to remove an unwanted bookmark; refer to \fBediting bookmarks\fP\&. .in -2m .ZI 2m "$HOME/\&.apparixrc\&.bu" \& .br Apparix creates a back-up file whenever it is asked to remove entries from it\&. Refer to \fBediting bookmarks\fP for options inducing removal\&. You can explicitly require a backup to be made by either of \fB--bu\fP or \fB-bu\fP\ \&\fIfname\fP\&. .in -2m .ZI 2m "$HOME/\&.apparixexpand" \& .br This contains bookmarks that are expanded from portals\&. A portal is simply some directory\&. The names of all subdirectories are taken as bookmarks that point to those subdirectories\&. This file can be recreated by issuing .di ZV .in 0 .nf \fC apparix --rehash .fi \fR .in .di .ne \n(dnu .nf \fC .ZV .fi \fR .in -2m .ZI 2m "$HOME/\&.bashrc" \& 'in -2m .ZI 2m "$HOME/\&.tcshrc" \& 'in -2m .ZI 2m "$HOME/\&.cshrc" \& 'in -2m 'in +2m \& .br Add the code you need to the appropriate rc file\&. The macros and functions below point \fIcd\fP(1) in the right direction\&. .in -2m .di ZV .in 0 .nf \fC BASH-style functions --- function to () { if test "$2"; then cd "$(apparix --try-current-first -favour rOl "$1" "$2" || echo \&.)" elif test "$1"; then if test "$1" == \&'-\&'; then cd - else cd "$(apparix --try-current-first -favour rOl "$1" || echo \&.)" fi else cd $HOME fi } function bm () { if test "$2"; then apparix --add-mark "$1" "$2"; elif test "$1"; then apparix --add-mark "$1"; else apparix --add-mark; fi } function portal () { if test "$1"; then apparix --add-portal "$1"; else apparix --add-portal; fi } # function to generate list of completions from \&.apparixrc function _apparix_aliases () { cur=$2 dir=$3 COMPREPLY=() nullglobsa=$(shopt -p nullglob) shopt -s nullglob if let $(($COMP_CWORD == 1)); then # now cur= (completing on this) and dir=\&'to\&' # Below will not complete on subdirectories\&. swap if so desired\&. # COMPREPLY=( $( cat $HOME/\&.apparix{rc,expand} | grep "j,\&.*$cur\&.*," | cut -f2 -d, ) ) COMPREPLY=( $( (cat $HOME/\&.apparix{rc,expand} | grep "\e and cur= (completing on this) dir=\&`apparix --try-current-first -favour rOl $dir 2>/dev/null\&` || return 0 eval_compreply="COMPREPLY=( $( cd "$dir" \els -d $cur* | while read r do [[ -d "$r" ]] && [[ $r == *$cur* ]] && echo \e"${r// /\e\e }\e" done ) )" eval $eval_compreply fi $nullglobsa return 0 } # command to register the above to expand when the \&'to\&' command\&'s args are # being expanded complete -F _apparix_aliases to --- CSH-style aliases --- # The outcommented alias does not supplant cd, the other one does\&. # alias to \&'cd \&`(apparix -favour rOl \e!* || echo -n \&.)\&`\&' alias to \&'(test "x-" = "x\e!*") && cd - || (test "x" != "x\e!*") && cd \&`(apparix --try-current-first -favour rOl \e!* || echo -n \&.)\&` || cd\&' alias bm \&'apparix --add-mark \e!*\&' alias portal \&'apparix --add-portal \e!*\&' --- .fi \fR .in .di .ne \n(dnu .nf \fC .ZV .fi \fR More elaborate setups are possible\&. This CSH-style alias: .di ZV .in 0 .nf \fC alias to \&'(test "x" != "x\e!*") && cd \&`(apparix -favour rOl \e!* || echo -n \&.)\&` || apparix -l\&' .fi \fR .in .di .ne \n(dnu .nf \fC .ZV .fi \fR lists all available jumps if invoked without arguments\&. .SH NOTES Below follow some comments on other approaches to file system navigation\&. \fBHISTORY\fP explains the difference between the venerable \fBcdargs\fP program and \fBapparix\fP\&. CDPATH is only useful in cases where a given directory has subdirectories with distinctive names\&. It does not usually scale well when there are more than a few paths in CDPATH\&. Some people use aliases to jump to often visited directories\&. I was one of them for a period of ten years\&. The fact is, those aliases are cumbersome to create and remove and they clutter up the alias namespace\&. They can clash with executable names when the alias includes the \fIcd\fP part\&. This sometimes prohibits one from assigning the logical bookmark to a given location, especially when one has a lot of source code locations\&. They can clash with directory names when the aliases just expand to the location\&. This again means that sometimes a location cannot be assigned its logical bookmark\&. I have found that setting \fIcd\fP jumps aside in their own namespace improves file system navigation by a large factor\&. It is also possible to create symlinks to often visited files\&. Again, creation and removal of these are cumbersome\&. One could of course create shell functions with a similar interface to apparix or cdargs to handle the symlink lifecycle\&. On Linux Weekly News \fInix\fP suggested to put these symlinks in a single directory and add that directory to CDPATH\&. This is quite a neat trick and effectively creates a bookmark navigation system\&. Still there are problems with the above approach\&. One problem with the symlink approach is that they are a bit awkward to edit\&. One could make a utility to wrap around the problem, but in the end the directory-with-symlinks would functionally be the same as apparix\&'s \fB\&.apparixrc\fP resource file, only more of a kludge\&. Another problem is that symlinks are awkard when traversing the file system\&. They confuse the notion of parent directory and \&'\fCcd \&.\&.\fP\&' mostly does the unexpected\&. Sometimes \&'\fC\&.\&.\fP\&' has a different meaning to \fBcd\fP than it has to another application, as one will trace back symlinks and the other will not\&. Finally, a minor objection is that I find it convenient to have bookmarks in a separate namespace than that of \fIcd\fP(1)\&. Jumps are magical and it is natural to invoke them by a different method\&. This is in fact how apparix acquired its CDPATH behaviour\&. I used CDPATH to jump to a few particular source directories with distinct names that lay deeply hidden in some CVS directory\&. Once I started using apparix however, I would mistakenly issue \fIto\fP rather than \fIcd\fP to jump to those locations\&. My brain classified both types of jump in the same category\&. Apparix (and cdargs) have another use besides jumping, namely annotation\&. Whenever I end up in an esoteric part of the file system and need to make a quick note of the location, I simply bookmark it\&. On SlashDot, that eternal source of wisdom or alternatively the geek wheel of suffering, Clueless Moron offered the following gems\&. .di ZV .in 0 .nf \fC mk() { eval ${1:-MKPWD}=\e"\&`pwd\&`\e"; } rt() { eval cd \e"\e$${1:-MKPWD}\e";pwd; } # type "mk" (as in "mark") and "rt" (as in "return") to mark # a directory and later go back to it\&. # Or give it a name: do "mk foo", and later on "rt foo" .fi \fR .in .di .ne \n(dnu .nf \fC .ZV .fi \fR This of course is a per-session mechanism, but noteworthy for its simplicity\&. I am not sure whether csh-style shells could offer an equivalent\&. A feature shared by apparix and cdargs is that adding a bookmark immediately takes effect in all shells\&. There is no need to source some resource file, as the applications do this everytime they are invoked\&. It is fast, do not worry\&. .SH BUGS The resource file parsing code thinks that parentheses are special\&. Also records are currently separated by commas\&. Accordingly, apparix will hitch if a path name contains a parenthesis or a comma\&. .SH AUTHOR Stijn van Dongen\&. .SH THANKS Stefan Kamphausen wrote \fBcdargs\fP, the inspiration for apparix\&. Sitaram Chamarty fixed up some of the existing bash code, and added the tab completion part (basing this on similar code in cdargs)\&. He does not garantuee predictable or even pretty results if there are spaces in the directory names which you attempt to complete\&. \fBAUTHOR\fP would like to submit that spaces in path names are evil, and that the completion code seems to work in their evil presence anyway\&. Just \fIdon\&'t put commas\fP in path names\&. The autotooled build environment was modified from a template written by Joost van Baal\&. Several people suggested to enable apparix to merge accessible directories and marks, but Matias Piipari phrased it the most convincingly\&. .SH HISTORY Apparix was created to optimize a scenario that \fIcdargs\fP does not support very well, namely where the mark (called \fIneedle\fP in cdargs) is always known\&. As additional features apparix supports CDPATH-style behaviour, derived subdirectory specification, and transparent treatment of bookmarks and directories, all integrated with bash tab completion\&. In other respects apparix is a much simpler application\&. \fBcdargs\fP offers menu-based navigation of the file system and the bookmark list, which apparix does not\&. apparix-11-062/doc/apparix.azm000066400000000000000000001037111326043744200162000ustar00rootroot00000000000000\import{pud/man.zmm} \setx{"year"}{\zinsert{stamp.year}} \setx{"month"}{\zinsert{stamp.month}} \setx{"day"}{\zinsert{stamp.day}} \setx{"tag"}{\zinsert{stamp.tag}} \setx{"stamp"}{\zinsert{stamp.stamp}} \setx{"year"}{\tr{{delete}{[:space:]}}{\"year"}} \setx{"month"}{\tr{{delete}{[:space:]}}{\"month"}} \setx{"day"}{\tr{{delete}{[:space:]}}{\"day"}} \setx{"stamp"}{\tr{{delete}{[:space:]}}{\"stamp"}} \setx{"tag"}{\tr{{delete}{[:space:]}}{\"tag"}} \setx{"tag"}{\"tag", \"stamp"} \begin{pud::man}{ {name}{apparix} {html_title}{apparix, augmenting the shell with directory bookmarks} {keywords}{cd, change directory, bookmarks, command line, cdpath, subdirectory, tab completion} {author}{Stijn van Dongen} {section}{1} {synstyle}{long} {defstyle}{long} {year}{\"year"} {day}{\"day"} {month}{\"month"} {stamp}{\"stamp"} {tag}{\"tag"} } \${html}{\"pud::man::maketoc"} \def{apparix}{\bf{apparix}} \sec{name}{NAME} \NAME{apparix}{augmenting cd with bookmarks} \sec{synopsis}{SYNOPSIS} \par{ Apparix allows you to bookmark directories and later jump to them using the mark. By default apparix acts as a replacement for \it{cd} and can be used in the same manner, including the special behaviour for \it{cd} without argument and \it{cd}\~\tt{-}. It is possible to directly jump to subdirectories of a bookmarked directory. The contributed bash completion code facilitates completion both on bookmarks and directories, but can be adjusted to accomodate other preferences. } \par{ This manual page suffers from an excess in verbosity due to the many examples, explanations of the bells and whistles, and comparisons with other approaches to bookmarking. The fundamental idea is simply that typing a string of your own choosing takes you to the directory associated with it. Apparix does little more than maintaining a list of keys and values. It obtains directory names and listings, associates path names (values) with bookmarks (keys), and has some facilities for manipulating keys and values. The functions involving apparix (\bf{bm}, \bf{to}, and \bf{portal}) provide the user interface. Other functions, \bf{als} (apparix ls) and \bf{ae} (apparix edit) are discussed on the main apparix page \httpref{http://micans.org/apparix}. } \sec{gs}{GETTING STARTED} \par{ Install apparix. This should be as easy as \v{./configure --prefix=$HOME/local && make && make install}, or perhaps a pre-packaged apparix is available for your system. Then get hold of the \bf{to}, \bf{bm} and \bf{portal} shell handles. These are either aliases or functions depending on your shell. Currently csh-style shells and bash are supported. Get the ones you need preferably from \httpref{http://micans.org/apparix/#shell}. For a more limited set of commands either visit the \secref{files} section, or issue \v{apparix --shell-examples}. Activate them by simply pasting them in a shell or adding them to the appropriate resource file, e.g. \v{$HOME/.cshrc} or \v{$HOME/.bashrc} (do not forget to \it{source} the resource file). The handles \bf{to}, \bf{bm} and \bf{portal} can of course be changed to any name desired. With these preliminaries, the following is a mock-up shell navigation session. } \verbatim{\:/ > \bf{pwd} /home/eez/cvs/xyz/tfa/faq/zut/bar/foo > \bf{ls} src/ doc/ CVS/ bin/ > \bf{bm xkr} # bookmark as xkr (funny name though) > \bf{bm} # bookmark as foo (trailing component is default) (later) > \bf{to xkr} # cd to /home/eez/cvs/xyz/tfa/faq/zut/bar/foo (alternatively) > \bf{to xkr src} # cd to /home/eez/cvs/xyz/tfa/faq/zut/bar/foo/src (alternatively) > \bf{to foo} # cd to /home/eez/cvs/xyz/tfa/faq/zut/bar/foo (later) > \bf{ls} aap pyu/ qua tim/ zut/ > \bf{pwd} /home/eez/another/branch/deep/down/under > \bf{portal} # bookmark as portal, imports tim zut pyu bookmarks added flock of 3 in portal /home/eez/another/branch/deep/down/under (later) > \bf{to zut} # cd to /home/eez/another/branch/deep/down/under/zut (later) > \bf{apparix} # show all bookmarks --- portals e /home/eez/another/branch/deep/down/under --- expansions j pyu /home/eez/another/branch/deep/down/under/pyu j tim /home/eez/another/branch/deep/down/under/tim j zut /home/eez/another/branch/deep/down/under/zut --- bookmarks j xkr /home/eez/cvs/xyz/tfa/faq/zut/bar/foo j foo /home/eez/cvs/xyz/tfa/faq/zut/bar/foo} \car{ In the last example apparix simply shows all its bookmarks. The first batch shows portals. The second batch shows secondary bookmarks expanded from portals. The third batch shows all regular bookmarks. } \par{ In the default definitions of \bf{to} it falls back to regular \it{cd} behaviour in case a mark is not found. This is done by instructing apparix to check whether the mark exists as the name of a directory. It is possible to do this either before or after bookmark lookup, or not at all. By default the bash completion code takes into account both bookmarks and directories. } \par{ Apparix also allows subdirectory specification of bookmarked locations. If this is combined with the bash completion code it yields a powerful way of navigating container directories, i.e. directories that contain a large number of subdirectories. Refer to the \secref{sub} section. } \cpar{Further options}{ \synoptopt{--add-mark}{add jump bookmark} \synoptopt{--add-portal}{add portal bookmark} \synoptopt{-sm}{}{squash repeated marks} \synoptopt{-sd}{}{squash repeated destinations} \synoptopt{-lm}{}{list bookmarks with this mark} \synoptopt{-ld}{}{list destinations with mark indirection} \synoptopt{-favour}{}{duplicate resolution policy} \synoptopt{-pick}{}{immediate duplicate resolution} \synoptopt{-purge}{pat}{delete bookmarks} \synoptopt{-purge-mark}{pat} \synoptopt{-d}{dump resource file to STDOUT} \synoptopt{-l}{list available jumps} \synoptopt{-u}{}{remove last additions} \synoptopt{--rehash}{re-expand portal bookmarks} \synoptopt{--bu}{create backup of resource file} \synoptopt{-bu}{}{create backup in } \synoptopt{--cwd}{use getcwd(3), not pwd(1)} \synoptopt{--shell-examples}{output example macros} } \sec{description}{DESCRIPTION} \par{ Apparix combines the properties of the \aref{http://www.skamphausen.de/cgi-bin/ska/CDargs}{cdargs} utility and the CDPATH shell mechanism for fast navigation through the file system. It can additionally act as the regular \it{cd} command. It is especially useful for visiting and documenting both often- and rarely-used locations. Apparix enables you to attach marks to locations and jump to those locations by loading the mark. Marking, unmarking and jumping are simple operations that are performed in the shell. All actions take effect immediately in all shells running. By setting up convenient aliases for marking and jumping the file system can be navigated in a fast and intuitive manner. The \secref{files} section lists aliases for csh-type shells and functions for bash, including the setup to equip the \bf{to} function with argument completion in bash. } \par{ This section contains some examples of the most common uses of apparix. \secref{options} contains a list of additional options available for listing, pruning, and squashing bookmarks.} \par{ \secref{notes} features a brief discussion of the advantages of apparix over other approaches such as setting up aliases for often visited directories, using symlinks, CDPATH, or a combination of these. \secref{history} explains the difference between cdargs and apparix. The sections \secref{dup}, \secref{sub}, \secref{tab}, \secref{mov}, \secref{list}, and \secref{cd} further below are also recommended reading.} \par{ Apparix works in a manner similar to cdargs. One usually invokes apparix by using pre-defined aliases. Here they will be called \bf{bm} for bookmark, \bf{portal} for a CDPATH-style bookmark and \bf{to} for initiating an apparition (aka jump). These aliases are found below in the \secref{files} section and can also be obtained by issuing} \verbatim{apparix --shell-examples} \par{ Suppose your user name is \it{eez} and your home directory is \v{/home/eez}. You often visit a directory called \v{/home/eez/cvs/xyz/tfa/faq/zut/bar/foo}. This is how to create and use a bookmark for foo} \verbatim{\:/ /home/eez/cvs/xyz/tfa/faq/zut/bar/foo> \bf{bm foo} added: foo -> /home/eez/cvs/xyz/tfa/faq/zut/bar/foo /home/eez/cvs/xyz/tfa/faq/zut/bar/foo> \bf{cd} /home/eez> \bf{to foo} /home/eez/cvs/xyz/tfa/faq/zut/bar/foo>} \car{ If one bookmarks a directory by its trailing component as happened in this case, it is not necessary to specify the mark. By default apparix will use the trailing component as the mark. So} \verbatim{\:/ /home/eez/cvs/xyz/tfa/faq/zut/bar/foo> \bf{bm} added: foo -> /home/eez/cvs/xyz/tfa/faq/zut/bar/foo} \car{gives the same result.} \par{ Another scenario is where you have some directory that contains a largish number of subdirectories, all of which you would like to have bookmarked. If the subdirectories have distinctive names this can be achieved in one fell swoop by marking the parent directory as a \it{portal}. This is similar to adding the parent directory to the CDPATH environment variable, except that apparix bookmarks are not part of the cd namespace. It is argued in \secref{notes} that this is a good thing. Consider this:} \verbatim{\:/ /home/cvs/bagger/boemel/mcl/mcl/src> \bf{ls} alien/ CVS/ impala/ Makefile.am README shmcx/ attic/ giraffe/ lib/ Makefile.in shcl/ shmx/ contrib/ gmon.out Makefile mcl/ shmcl/ taurus/} \car{ Some of the subdirectories have not-so-distinct names such as \it{contrib} and \it{attic}, but they happen to be the directories least visited. Issuing:} \verbatim{\:/ /home/cvs/bagger/boemel/mcl/mcl/src> \bf{portal} [apparix] expanded 1 portal to 12 destinations} \car{ yields all of the subdirectories as destinations bookmarked by the last component of their path name. Incidentally, directory names such as \v{CVS} can be explicitly excluded from expansion by setting the environment variable \v{APPARIXEXCLUDE} appropriately \- refer to section \secref{environment}. } \par{ Bookmarks resulting from portal expansion are kept in a separate resource file (see \secref{files}). Portal expansions can be recreated by issuing} \verbatim{apparix --rehash} \car{ This is useful to reflect a change in the directory naming structure underneath a portal.} \sec{dup}{duplicate resolution} \par{ Apparix allows identical bookmarks to point to different locations. When asked to visit such a bookmark it will by default present a list of options.} \par{ The \genoptref{-favour}{} option can be used to automate resolution. \usearg{} is a sequence of single characters, described further below. The order in which they are given denote the order in which resolution rules are applied. This option is typically used in the definition of the \bf{to} function/alias or in the bash completion code.} \par{ The \genoptref{-pick}{} option is used to resolve to a particular directory directly. This is useful when you already know where you want to go, and typically used for the \v{now} bookmark in conjunction with the bash \v{whence} function. Use \v{whence now} to see an indexed list of now bookmarks. It is possible to go to the desired directory by entering the bookmark index. It is possible to bypass the selection step by specifying \v{whence now N}. } \par{ Duplicates are allowed because it can be useful to overwrite a bookmark with a new location. The old bookmark is kept as a matter of policy. Use \genoptref{-sm} to explicitly squash duplicates. } \begin{itemize}{ {flow}{compact} {interitem}{1} } \item{l} \car{ \it{level}; prefer paths with fewer components.} \item{L} \car{ reverse of the above.} \item{o} \car{ \it{bookmark order}; prefer older entries. Entries appearing earlier in the file are considered older, but the actual date of creating the bookmark is not stored. Refer to \secref{edit} for more information.} \item{O} \car{ reverse of the above.} \item{r} \car{ \it{regular first}; prefer regular bookmarks over portal expansion.} \item{R} \car{ reverse of the above.} \end{itemize} \par{ If there are still ties after the specified rules have been applied apparix will simply take the first matching option. This behaviour cannot be further specified as the program uses a non-stable ordering routine.} \par{ It is an absolute prerequisite that \genoptref{-favour} is used in the bash completion code. Otherwise completion will fail (for a duplicated bookmark) while apparix is waiting for input. Refer to the tab completion description below.} \sec{sub}{subdirectory specification} \par{ When jumping (apparating) you can specify an additional subdirectory after the bookmark. Apparix will append the subdirectory to the destination.} \par{ This is useful for projects with directory nodes corresponding with versions. Assume you have a directory structure such as this:} \verbatim{\:/ /x/y/z/OpusMagnum/v1/ /x/y/z/OpusMagnum/v2/ /x/y/z/OpusMagnum/v3/} \par{ It is probably easiest to simply bookmark the OpusMagnum directory in some way (say with bookmark \v{om}). You can then issue \vq{to om v2} to jump to \v{OpusMagnum/v2}. This is more flexible and maintainable than creating bookmarks \v{om1}, \v{om2}, \v{om3}. One could add OpusMagnum as a portal, but with generic names such as \v{v1} this is not a very extendible approach.} \par{ See also the tab completion description below - it is possible to tab-complete on subdirectories of the apparix jump directory.} \sec{tab}{tab completion} \par{ The bash tab completion code does two things. First, it is possible to tab-complete on apparix bookmarks themselves, showing a listing of all available bookmarks (or iterating through them in cyclic mode, depending on your bash settings). Second, once a bookmark has been given tab completion will list or iterate over all the subdirectories of the directory associated with that bookmark. Specifying a string after the bookmark will limit tab-completion to directories matching the shell-pattern in string. \it{Very} useful.} \par{ Be careful to not remove the \genoptref{-favour}{list} option from the bash completion code. It is necessary to resolve duplicate bookmarks. } \sec{edit}{editing bookmarks} \car{ Apparix appends new bookmarks to the end of the .apparixrc file. Nothing stops you from editing the file, and this is in fact recommended if for example you need to get rid of a bookmark and neither of \genoptref{-purge}, \genoptref{-purge-mark}, \genoptref{-sd}, \genoptref{-sm} fulfills your needs. It was an easy design choice not to equip apparix with editor capabilities.} \sec{mov}{copying and moving files} \par{ It is straightforward to copy or move files to locations known by apparix. Examples:} \verbatim{BASH and variants cp FOO $(apparix zoem) mv BAR $(apparix zoem doc) mv BAR $(apparix zoem doc)/test CSH and variants cp FOO `apparix zoem` mv BAR `apparix zoem doc`/test} \sec{list}{listing bookmarks} \par{ Simply issuing apparix gives you a list of bookmarks grouped into three categories, portals, expansions, and bookmarks. Use the \genoptref{-d} option to dump the resource file to STDOUT exactly as it is. This can be useful when you intend to use the \genoptref{-u}{num} option to remove bookmarks or portals that were most recently added.} \par{ Use \genoptref{-l} to list all available jumps without their destinations. The jumps are grouped into expansions resulting from portals and regular bookmarks.} \: \car{ \: Apparix currently uses \it{getcwd}(3) to obtain the path name \: of the current directory. On some machines this may include \: funny mount components, e.g. \: } \: \: \verbatim{\:/ \: \bf{/.automount/eek/root}/home/eez/cvs/xyz/tfa/faq/zut/bar/foo} \: \: \car{ \: Until apparix obtains a \: } \sec{cd}{replacing cd} \par{ With the supplied definition(s) of \bf{to}, apparix will first see whether the mark is the name of a directory, accessible from the current directory. A directory is accessible if it would be a valid argument to cd, so it need not necessarily be a subdirectory of the current directory. If the mark is not an accessible directory, apparix will then try to do a lookup of the mark in the bookmark files. This behaviour can be inverted to do the lookup first and the current directory thereafter. Both modes can be used to make \bf{to} a drop-in replacement for \it{cd}. Additionally and again similar to \it{cd}, \tt{'to -'} will take you to the previous directory, and specifying \tt{to} without arguments will take you to your home directory. } \par{ The bash completion code acts accordingly, and should transparently complete on both marks and directories. } \sec{options}{OPTIONS} \par{ For bookmarking and jumping apparix is best invoked by using the aliases (tcsh-variants) or functions (sh/bash) listed in \secref{files}. Apparix has a few options that are useful for pruning, squashing and rehasing bookmarks. These are best issued by invoking apparix directly.} \par{ If you are interested in marks or destinations matching a certain pattern, simply issue apparix without arguments and pipe it through your program of choice.} \par{ Unary options (those without arguments) usually start with two hyphens except for standardized options such as \genoptref{-h}. Options that take an argument can be converted to a unary key=value notation, e.g. \useopt{-purge-mark}{foo} is equivalent to \usekvp{--purge-mark}{foo}.} \par{ When invoked without arguments apparix will simply dump its bookmarks.} \begin{itemize}{ {flow}{cascade} {interitem}{1} } \item{\defopt{--add-mark}{add jump bookmark}} \car{ This options expects trailing \it{[mark [destination]]} argument(s). Both arguments are optional. If a single argument is given it is interpreted as a bookmark name to be mapped to the current directory. If two arguments are given the last argument is taken as the target directory. If no argument is given apparix will enlist the current directory as a target bookmarked by the trailing component of the directory path.} \item{\defopt{--add-portal}{add portal bookmark}} \car{ This option enlists a directory as a portal and adds all subdirectories as bookmarks. The name of the bookmark is simply the name of the subdirectory. By default the current directory is added as a portal. An optional trailing argument will override this behaviour and instead be interpreted as the portal location.} \item{\defopt{--try-current-first}{try current directory before lookup}} \car{ This option is useful in the definition of the \bf{to} wrapper. Before attempting any lookup of the mark, apparix tests whether the supplied mark exists as a subdirectory in the current directory. If it does, the mark is simply expanded to itself. } \item{\defopt{--try-current-last}{try current directory if lookup fails}} \car{ This option is useful in the definition of the \bf{to} wrapper. If lookup of the mark fails, apparix tests whether the supplied mark exists as a subdirectory in the current directory. If it does, the mark is simply expanded to itself. } \item{\defopt{--notify-current}{notify if current directory is used}} \car{ This option is useful in the definition of the \it{bf} wrapper in conjunction with either \genopt{--try-current-first} or \genopt{--try-current-last}. If the mark is found as a subdirectory in the current directory, apparix notifies the user of this fact (on the diagnostic stream). } \item{\defopt{-sm}{}{squash repeated marks}} \car{ Apparix will squash bookmarks with mark \v{}. This is useful when a mark points to a versioned project, and the project is updated to a new version and a new directory.} \par{ Apparix will by default keep the last one occurring in the resource file (corresponding with \useopt{-favour}{O}). This option respects the \genoptref{-favour} option if given. Duplicating an already existing mark can be useful when it identifies a project for which the underlying directory changes every once in a while (e.g. the project is downloaded from external sources and comes with version information). It is not strictly necessary to squash bookmarks since \bf{to} functions/macros that are equipped with the \genoptref{-favour} option will generally resolve duplicate matches. } \item{\defopt{-sd}{}{squash repeated destinations}} \car{ All other bookmarks with the same destination as \v{} are removed. This is useful when a given destination has acquired multiple bookmarks and you decide to settle on a favourite. } \item{\defopt{-lm}{}{list bookmarks with this mark}} \car{ It lists all bookmarks \v{} (noting that it may point to multiple locations). } \item{\defopt{-ld}{}{list repeated destinations}} \car{ This lists all bookmarks \v{} (noting that it may point to multiple locations) and additionally lists all other bookmarks that share the destination with any of the first bookmarks. This allows one to predict the effect of issuing \v{apparix -sd }. } \item{\defopt{-purge}{pat}{delete bookmarks}} \car{ This deletes bookmarks where destination matches \genarg{pat}. All deleted bookmarks are printed to STDOUT. Thus if you regret deleting a bookmark it is easy to add it back. Portal specifications are never affected.} \item{\defopt{-purge-mark}{pat}} \car{ This deletes bookmarks where mark matches \genarg{pat}. Portal specifications are never affected.} \item{\defopt{-d}{dump resource file to STDOUT}} \car{ Dump resource file to STDOUT.} \item{\defopt{-l}{list available jumps}} \car{ List available jumps paragraph-style. Portal specifications themselves are excluded, and regular jumps and jumps resulting from portal expansions are listed under different headers.} \item{\defopt{-u}{}{remove last additions}} \car{ Remove last additions. Portal specifications and regular jumps are treated alike.} \item{\defopt{--rehash}{re-expand portal bookmarks}} \car{ Apparix will reread the resource file and reexpand portal locations. Useful if directories have been added, renamed, or removed. Refer to section \secref{environment} for the effect that the environment variable \v{APPARIXEXCLUDE} has on portal expansion.} \items{ {\defopt{-favour}{}{set duplicate resolution policy}} {\defopt{-pick}{}{immediate duplicate resolution}} } \car{ These options have a section to themselves. Refer to \secref{dup}.} \item{\defopt{--cwd}{use getcwd(3), not pwd(1)}} \car{ By default aparix uses the program \it{pwd}(1) rather than the system call \it{getcwd}(3). On some systems it was found that the latter results in paths that contain machine-specific mount components. Appparix will use \it{getcwd}(3) when \genoptref{--cwd} is used.} \item{\defopt{--shell-examples}{output example macros}} \car{ This outputs example macros. They are also listed in the \secref{files} section though.} \item{\defopt{--bu}{create backup of the resource file}} \car{ This creates the backup file in .apparixrc.bu.} \item{\defopt{-bu}{fname}{create backup of the resource file}} \car{ This creates the backup file in \genarg{fname}. Use \genoptref{-d} or \useopt{-bu}{-} to dump to STDOUT.} \items{ {\defopt{-h}{show synopsis}} {\defopt{--apropos}{show synopsis}} } \car{ print synopsis of all options} \end{itemize} \sec{environment}{ENVIRONMENT} \'begin{itemize}{ {flow}{cascade} {interitem}{1} } \item{APPARIXEXCLUDE} \car{ This variable specifies exclusion behaviour when portals are expanded with the \v{--rehash} option. It has the following syntax: } \verbatim{\:/ <[:,][]>+} \car{ That is, a list of names with each name preceded by a colon or a comma. A colon indicates that \v{} triggers exclusion of directory names for which the trailing component is identical to \v{}. A comma indicates that \v{} triggers exclusion of directory names for which the trailing component contains \v{} as a substring. Consider: } \verbatim{\:/ export APPARIXEXCLUDE=:CVS:lib,tmp # A - example export APPARIXEXCLUDE=, # B - curiosity} \car{ The first excludes directory names \v{CVS} and \v{lib} and any directory name having \v{tmp} as a substring. The second example will effectively disable portals, as it speficies the empty string which is a substring of all strings. } \item{APPARIXTAG} \car{ This variable, if set, is incorporated into the names of the apparix resource files. By default these are \v{.apparixrc} and \v{.apparixexpand}. When APPARIXTAG is set to \v{} they become \v{.apparixrc} and \v{.apparixexpand}. This can be used e.g. to maintain different sets of bookmarks on different host machines. } \item{APPARIXLOG} \car{ This variable, if set, is interpreted as the name of a log file. The log file keeps track of all newly added bookmarks and portals without ever deleting anything, in the same format as the \v{.apparixrc} file. If this variable is not set nothing is tracked. } \item{APPARIXPURGE} \car{ This changes the way apparix dumps purged bookmarks to STDOUT. By default they are dumped as command lines that will reimport the bookmarks if issued (i.e. cut and pasted). By setting this variable to 1 purged bookmarks are dumped in the format used in the \v{.apparixrc} file. } \end{itemize} \sec{files}{FILES} \par{ You should use aliases or functions to make apparix really useful. Get them from apparix by giving it the --shell-examples option, or from further below. Note the fragment that provides \bf{to} argument completion in bash. } \begin{itemize}{ {flow}{cascade} {interitem}{1} } \item{$HOME/.apparixrc} \car{This is the primary resource file. There is usually no need to edit it by hand. Sometimes it can be useful to edit by hand to remove an unwanted bookmark; refer to \secref{edit}.} \item{$HOME/.apparixrc.bu} \car{ Apparix creates a back-up file whenever it is asked to remove entries from it. Refer to \secref{edit} for options inducing removal. You can explicitly require a backup to be made by either of \genoptref{--bu} or \genoptref{-bu}{fname}.} \item{$HOME/.apparixexpand} \car{ This contains bookmarks that are expanded from portals. A portal is simply some directory. The names of all subdirectories are taken as bookmarks that point to those subdirectories. This file can be recreated by issuing} \verbatim{apparix --rehash} \items{{$HOME/.bashrc} {$HOME/.tcshrc} {$HOME/.cshrc} } \car{ Add the code you need to the appropriate rc file. The macros and functions below point \it{cd}(1) in the right direction.} \end{itemize} \setx{"examples"}{\system{../src/apparix}{{--shell-examples}}} \apply{_#1{\!{\verbatim{\1}}}}{{\"examples"}} \par{More elaborate setups are possible. This CSH-style alias:} \verbatim{alias to '(test "x" != "x\\!*") && cd `(apparix -favour rOl \\!* || echo -n .)` || apparix -l'} \par{lists all available jumps if invoked without arguments.} \sec{notes}{NOTES} \par{ Below follow some comments on other approaches to file system navigation. \secref{history} explains the difference between the venerable \bf{cdargs} program and \bf{apparix}. } \par{ CDPATH is only useful in cases where a given directory has subdirectories with distinctive names. It does not usually scale well when there are more than a few paths in CDPATH. } \par{ Some people use aliases to jump to often visited directories. I was one of them for a period of ten years. The fact is, those aliases are cumbersome to create and remove and they clutter up the alias namespace. They can clash with executable names when the alias includes the \it{cd} part. This sometimes prohibits one from assigning the logical bookmark to a given location, especially when one has a lot of source code locations. They can clash with directory names when the aliases just expand to the location. This again means that sometimes a location cannot be assigned its logical bookmark. I have found that setting \it{cd} jumps aside in their own namespace improves file system navigation by a large factor. } \par{ It is also possible to create symlinks to often visited files. Again, creation and removal of these are cumbersome. One could of course create shell functions with a similar interface to apparix or cdargs to handle the symlink lifecycle. On Linux Weekly News \it{nix} suggested to put these symlinks in a single directory and add that directory to CDPATH. This is quite a neat trick and effectively creates a bookmark navigation system. } \par{ Still there are problems with the above approach. One problem with the symlink approach is that they are a bit awkward to edit. One could make a utility to wrap around the problem, but in the end the directory-with-symlinks would functionally be the same as apparix's \bf{.apparixrc} resource file, only more of a kludge. Another problem is that symlinks are awkard when traversing the file system. They confuse the notion of parent directory and '\v{cd ..}' mostly does the unexpected. Sometimes '\v{..}' has a different meaning to \bf{cd} than it has to another application, as one will trace back symlinks and the other will not. Finally, a minor objection is that I find it convenient to have bookmarks in a separate namespace than that of \it{cd}(1). Jumps are magical and it is natural to invoke them by a different method. This is in fact how apparix acquired its CDPATH behaviour. I used CDPATH to jump to a few particular source directories with distinct names that lay deeply hidden in some CVS directory. Once I started using apparix however, I would mistakenly issue \it{to} rather than \it{cd} to jump to those locations. My brain classified both types of jump in the same category. } \par{ Apparix (and cdargs) have another use besides jumping, namely annotation. Whenever I end up in an esoteric part of the file system and need to make a quick note of the location, I simply bookmark it. } \par{ On SlashDot, that eternal source of wisdom or alternatively the geek wheel of suffering, Clueless Moron offered the following gems.} \verbatim{\:/ mk() { eval ${1:-MKPWD}=\\"`pwd`\\"; } rt() { eval cd \\"\\$${1:-MKPWD}\\";pwd; } # type "mk" (as in "mark") and "rt" (as in "return") to mark # a directory and later go back to it. # Or give it a name: do "mk foo", and later on "rt foo"} \par{ This of course is a per-session mechanism, but noteworthy for its simplicity. I am not sure whether csh-style shells could offer an equivalent.} \par{ A feature shared by apparix and cdargs is that adding a bookmark immediately takes effect in all shells. There is no need to source some resource file, as the applications do this everytime they are invoked. It is fast, do not worry. } \""{ At LWN nix writes: At work I am stuck with ksh, which doesn't have pushd or popd. Solution: function pushd { PWDSTACK=${PWD}:${PWDSTACK} cd $1 } function popd { cd $(echo ${PWDSTACK:-${PWD}} | cut -d: -f 1) PWDSTACK=$(echo ${PWDSTACK} | cut -s -d: -f 2-) } function dirs { echo $PWDSTACK | tr ":" "\\n" | sed '/^$/d' } (warning: this code was written ten years ago when I barely knew shell scripting and not touched since then; it has notable problems, trivially fixed, with directories with names starting with minus signs). } \sec{bugs}{BUGS} \car{ The resource file parsing code thinks that parentheses are special. Also records are currently separated by commas. Accordingly, apparix will hitch if a path name contains a parenthesis or a comma.} \sec{author}{AUTHOR} \car{ Stijn van Dongen.} \sec{thanks}{THANKS} \par{ Stefan Kamphausen wrote \bf{cdargs}, the inspiration for apparix.} \par{ Sitaram Chamarty fixed up some of the existing bash code, and added the tab completion part (basing this on similar code in cdargs). He does not garantuee predictable or even pretty results if there are spaces in the directory names which you attempt to complete. \secref{author} would like to submit that spaces in path names are evil, and that the completion code seems to work in their evil presence anyway. Just \iref{bugs}{don't put commas} in path names. } \par{ The autotooled build environment was modified from a template written by Joost van Baal. } \par{ Several people suggested to enable apparix to merge accessible directories and marks, but Matias Piipari phrased it the most convincingly. } \sec{history}{HISTORY} \par{ Apparix was created to optimize a scenario that \aref{http://www.skamphausen.de/cgi-bin/ska/CDargs}{cdargs} does not support very well, namely where the mark (called \it{needle} in cdargs) is always known. As additional features apparix supports CDPATH-style behaviour, derived subdirectory specification, and transparent treatment of bookmarks and directories, all integrated with bash tab completion. In other respects apparix is a much simpler application. \bf{cdargs} offers menu-based navigation of the file system and the bookmark list, which apparix does not. } \end{pud::man} apparix-11-062/doc/apparix.html000066400000000000000000001516331326043744200163630ustar00rootroot00000000000000 apparix, augmenting the shell with directory bookmarks

3 Mar 2011    apparix 1.004, 11-062

NAME

apparix — augmenting cd with bookmarks

SYNOPSIS

Apparix allows you to bookmark directories and later jump to them using the mark. By default apparix acts as a replacement for cd and can be used in the same manner, including the special behaviour for cd without argument and cd -. It is possible to directly jump to subdirectories of a bookmarked directory. The contributed bash completion code facilitates completion both on bookmarks and directories, but can be adjusted to accomodate other preferences.

This manual page suffers from an excess in verbosity due to the many examples, explanations of the bells and whistles, and comparisons with other approaches to bookmarking. The fundamental idea is simply that typing a string of your own choosing takes you to the directory associated with it. Apparix does little more than maintaining a list of keys and values. It obtains directory names and listings, associates path names (values) with bookmarks (keys), and has some facilities for manipulating keys and values. The functions involving apparix (bm, to, and portal) provide the user interface. Other functions, als (apparix ls) and ae (apparix edit) are discussed on the main apparix page http://micans.org/apparix.

GETTING STARTED

Install apparix. This should be as easy as ./configure --prefix=$HOME/local && make && make install, or perhaps a pre-packaged apparix is available for your system. Then get hold of the to, bm and portal shell handles. These are either aliases or functions depending on your shell. Currently csh-style shells and bash are supported. Get the ones you need preferably from http://micans.org/apparix/#shell. For a more limited set of commands either visit the FILES section, or issue apparix --shell-examples. Activate them by simply pasting them in a shell or adding them to the appropriate resource file, e.g. $HOME/.cshrc or $HOME/.bashrc (do not forget to source the resource file). The handles to, bm and portal can of course be changed to any name desired. With these preliminaries, the following is a mock-up shell navigation session.

> pwd /home/eez/cvs/xyz/tfa/faq/zut/bar/foo > ls src/ doc/ CVS/ bin/ > bm xkr # bookmark as xkr (funny name though) > bm # bookmark as foo (trailing component is default) (later) > to xkr # cd to /home/eez/cvs/xyz/tfa/faq/zut/bar/foo (alternatively) > to xkr src # cd to /home/eez/cvs/xyz/tfa/faq/zut/bar/foo/src (alternatively) > to foo # cd to /home/eez/cvs/xyz/tfa/faq/zut/bar/foo (later) > ls aap pyu/ qua tim/ zut/ > pwd /home/eez/another/branch/deep/down/under > portal # bookmark as portal, imports tim zut pyu bookmarks added flock of 3 in portal /home/eez/another/branch/deep/down/under (later) > to zut # cd to /home/eez/another/branch/deep/down/under/zut (later) > apparix # show all bookmarks --- portals e /home/eez/another/branch/deep/down/under --- expansions j pyu /home/eez/another/branch/deep/down/under/pyu j tim /home/eez/another/branch/deep/down/under/tim j zut /home/eez/another/branch/deep/down/under/zut --- bookmarks j xkr /home/eez/cvs/xyz/tfa/faq/zut/bar/foo j foo /home/eez/cvs/xyz/tfa/faq/zut/bar/foo

In the last example apparix simply shows all its bookmarks. The first batch shows portals. The second batch shows secondary bookmarks expanded from portals. The third batch shows all regular bookmarks.

In the default definitions of to it falls back to regular cd behaviour in case a mark is not found. This is done by instructing apparix to check whether the mark exists as the name of a directory. It is possible to do this either before or after bookmark lookup, or not at all. By default the bash completion code takes into account both bookmarks and directories.

Apparix also allows subdirectory specification of bookmarked locations. If this is combined with the bash completion code it yields a powerful way of navigating container directories, i.e. directories that contain a large number of subdirectories. Refer to the subdirectory specification section.

Further options
[--add-mark (add jump bookmark)] [--add-portal (add portal bookmark)] [-sm <mark> (squash repeated marks)] [-sd <mark> (squash repeated destinations)] [-lm <mark> (list bookmarks with this mark)] [-ld <mark> (list destinations with mark indirection)] [-favour <list> (duplicate resolution policy)] [-pick <num> (immediate duplicate resolution)] [-purge pat (delete bookmarks)] [-purge-mark (pat)] [-d (dump resource file to STDOUT)] [-l (list available jumps)] [-u <num> (remove last <num> additions)] [--rehash (re-expand portal bookmarks)] [--bu (create backup of resource file)] [-bu <fname> (create backup in <fname>)] [--cwd (use getcwd(3), not pwd(1))] [--shell-examples (output example macros)]

DESCRIPTION

Apparix combines the properties of the cdargs utility and the CDPATH shell mechanism for fast navigation through the file system. It can additionally act as the regular cd command. It is especially useful for visiting and documenting both often- and rarely-used locations. Apparix enables you to attach marks to locations and jump to those locations by loading the mark. Marking, unmarking and jumping are simple operations that are performed in the shell. All actions take effect immediately in all shells running. By setting up convenient aliases for marking and jumping the file system can be navigated in a fast and intuitive manner. The FILES section lists aliases for csh-type shells and functions for bash, including the setup to equip the to function with argument completion in bash.

This section contains some examples of the most common uses of apparix. OPTIONS contains a list of additional options available for listing, pruning, and squashing bookmarks.

NOTES features a brief discussion of the advantages of apparix over other approaches such as setting up aliases for often visited directories, using symlinks, CDPATH, or a combination of these. HISTORY explains the difference between cdargs and apparix. The sections duplicate resolution, subdirectory specification, tab completion, copying and moving files, listing bookmarks, and replacing cd further below are also recommended reading.

Apparix works in a manner similar to cdargs. One usually invokes apparix by using pre-defined aliases. Here they will be called bm for bookmark, portal for a CDPATH-style bookmark and to for initiating an apparition (aka jump). These aliases are found below in the FILES section and can also be obtained by issuing

apparix --shell-examples

Suppose your user name is eez and your home directory is /home/eez. You often visit a directory called /home/eez/cvs/xyz/tfa/faq/zut/bar/foo. This is how to create and use a bookmark for foo

/home/eez/cvs/xyz/tfa/faq/zut/bar/foo> bm foo added: foo -> /home/eez/cvs/xyz/tfa/faq/zut/bar/foo /home/eez/cvs/xyz/tfa/faq/zut/bar/foo> cd /home/eez> to foo /home/eez/cvs/xyz/tfa/faq/zut/bar/foo>

If one bookmarks a directory by its trailing component as happened in this case, it is not necessary to specify the mark. By default apparix will use the trailing component as the mark. So

/home/eez/cvs/xyz/tfa/faq/zut/bar/foo> bm added: foo -> /home/eez/cvs/xyz/tfa/faq/zut/bar/foo

gives the same result.

Another scenario is where you have some directory that contains a largish number of subdirectories, all of which you would like to have bookmarked. If the subdirectories have distinctive names this can be achieved in one fell swoop by marking the parent directory as a portal. This is similar to adding the parent directory to the CDPATH environment variable, except that apparix bookmarks are not part of the cd namespace. It is argued in NOTES that this is a good thing. Consider this:

/home/cvs/bagger/boemel/mcl/mcl/src> ls alien/ CVS/ impala/ Makefile.am README shmcx/ attic/ giraffe/ lib/ Makefile.in shcl/ shmx/ contrib/ gmon.out Makefile mcl/ shmcl/ taurus/

Some of the subdirectories have not-so-distinct names such as contrib and attic, but they happen to be the directories least visited. Issuing:

/home/cvs/bagger/boemel/mcl/mcl/src> portal [apparix] expanded 1 portal to 12 destinations

yields all of the subdirectories as destinations bookmarked by the last component of their path name. Incidentally, directory names such as CVS can be explicitly excluded from expansion by setting the environment variable APPARIXEXCLUDE appropriately — refer to section ENVIRONMENT.

Bookmarks resulting from portal expansion are kept in a separate resource file (see FILES). Portal expansions can be recreated by issuing

apparix --rehash

This is useful to reflect a change in the directory naming structure underneath a portal.

duplicate resolution

Apparix allows identical bookmarks to point to different locations. When asked to visit such a bookmark it will by default present a list of options.

The -favour <list> option can be used to automate resolution. <list> is a sequence of single characters, described further below. The order in which they are given denote the order in which resolution rules are applied. This option is typically used in the definition of the to function/alias or in the bash completion code.

The -pick <num> option is used to resolve to a particular directory directly. This is useful when you already know where you want to go, and typically used for the now bookmark in conjunction with the bash whence function. Use whence now to see an indexed list of now bookmarks. It is possible to go to the desired directory by entering the bookmark index. It is possible to bypass the selection step by specifying whence now N.

Duplicates are allowed because it can be useful to overwrite a bookmark with a new location. The old bookmark is kept as a matter of policy. Use -sm to explicitly squash duplicates.

l

level; prefer paths with fewer components.

 
L

reverse of the above.

 
o

bookmark order; prefer older entries. Entries appearing earlier in the file are considered older, but the actual date of creating the bookmark is not stored. Refer to editing bookmarks for more information.

 
O

reverse of the above.

 
r

regular first; prefer regular bookmarks over portal expansion.

 
R

reverse of the above.

If there are still ties after the specified rules have been applied apparix will simply take the first matching option. This behaviour cannot be further specified as the program uses a non-stable ordering routine.

It is an absolute prerequisite that -favour is used in the bash completion code. Otherwise completion will fail (for a duplicated bookmark) while apparix is waiting for input. Refer to the tab completion description below.

subdirectory specification

When jumping (apparating) you can specify an additional subdirectory after the bookmark. Apparix will append the subdirectory to the destination.

This is useful for projects with directory nodes corresponding with versions. Assume you have a directory structure such as this:

/x/y/z/OpusMagnum/v1/ /x/y/z/OpusMagnum/v2/ /x/y/z/OpusMagnum/v3/

It is probably easiest to simply bookmark the OpusMagnum directory in some way (say with bookmark om). You can then issue to om v2 to jump to OpusMagnum/v2. This is more flexible and maintainable than creating bookmarks om1, om2, om3. One could add OpusMagnum as a portal, but with generic names such as v1 this is not a very extendible approach.

See also the tab completion description below - it is possible to tab-complete on subdirectories of the apparix jump directory.

tab completion

The bash tab completion code does two things. First, it is possible to tab-complete on apparix bookmarks themselves, showing a listing of all available bookmarks (or iterating through them in cyclic mode, depending on your bash settings). Second, once a bookmark has been given tab completion will list or iterate over all the subdirectories of the directory associated with that bookmark. Specifying a string after the bookmark will limit tab-completion to directories matching the shell-pattern in string. Very useful.

Be careful to not remove the -favour list option from the bash completion code. It is necessary to resolve duplicate bookmarks.

editing bookmarks

Apparix appends new bookmarks to the end of the .apparixrc file. Nothing stops you from editing the file, and this is in fact recommended if for example you need to get rid of a bookmark and neither of -purge, -purge-mark, -sd, -sm fulfills your needs. It was an easy design choice not to equip apparix with editor capabilities.

copying and moving files

It is straightforward to copy or move files to locations known by apparix. Examples:

BASH and variants cp FOO $(apparix zoem) mv BAR $(apparix zoem doc) mv BAR $(apparix zoem doc)/test CSH and variants cp FOO `apparix zoem` mv BAR `apparix zoem doc`/test

listing bookmarks

Simply issuing apparix gives you a list of bookmarks grouped into three categories, portals, expansions, and bookmarks. Use the -d option to dump the resource file to STDOUT exactly as it is. This can be useful when you intend to use the -u num option to remove bookmarks or portals that were most recently added.

Use -l to list all available jumps without their destinations. The jumps are grouped into expansions resulting from portals and regular bookmarks.

replacing cd

With the supplied definition(s) of to, apparix will first see whether the mark is the name of a directory, accessible from the current directory. A directory is accessible if it would be a valid argument to cd, so it need not necessarily be a subdirectory of the current directory. If the mark is not an accessible directory, apparix will then try to do a lookup of the mark in the bookmark files. This behaviour can be inverted to do the lookup first and the current directory thereafter. Both modes can be used to make to a drop-in replacement for cd. Additionally and again similar to cd, 'to -' will take you to the previous directory, and specifying to without arguments will take you to your home directory.

The bash completion code acts accordingly, and should transparently complete on both marks and directories.

OPTIONS

For bookmarking and jumping apparix is best invoked by using the aliases (tcsh-variants) or functions (sh/bash) listed in FILES. Apparix has a few options that are useful for pruning, squashing and rehasing bookmarks. These are best issued by invoking apparix directly.

If you are interested in marks or destinations matching a certain pattern, simply issue apparix without arguments and pipe it through your program of choice.

Unary options (those without arguments) usually start with two hyphens except for standardized options such as -h. Options that take an argument can be converted to a unary key=value notation, e.g. -purge-mark foo is equivalent to --purge-mark=foo.

When invoked without arguments apparix will simply dump its bookmarks.

--add-mark (add jump bookmark)

This options expects trailing [mark [destination]] argument(s). Both arguments are optional. If a single argument is given it is interpreted as a bookmark name to be mapped to the current directory. If two arguments are given the last argument is taken as the target directory. If no argument is given apparix will enlist the current directory as a target bookmarked by the trailing component of the directory path.

 
--add-portal (add portal bookmark)

This option enlists a directory as a portal and adds all subdirectories as bookmarks. The name of the bookmark is simply the name of the subdirectory. By default the current directory is added as a portal. An optional trailing argument will override this behaviour and instead be interpreted as the portal location.

 
--try-current-first (try current directory before lookup)

This option is useful in the definition of the to wrapper. Before attempting any lookup of the mark, apparix tests whether the supplied mark exists as a subdirectory in the current directory. If it does, the mark is simply expanded to itself.

 
--try-current-last (try current directory if lookup fails)

This option is useful in the definition of the to wrapper. If lookup of the mark fails, apparix tests whether the supplied mark exists as a subdirectory in the current directory. If it does, the mark is simply expanded to itself.

 
--notify-current (notify if current directory is used)

This option is useful in the definition of the bf wrapper in conjunction with either --try-current-first or --try-current-last. If the mark is found as a subdirectory in the current directory, apparix notifies the user of this fact (on the diagnostic stream).

 
-sm <mar> (squash repeated marks)

Apparix will squash bookmarks with mark <mark>. This is useful when a mark points to a versioned project, and the project is updated to a new version and a new directory.

Apparix will by default keep the last one occurring in the resource file (corresponding with -favour O). This option respects the -favour option if given. Duplicating an already existing mark can be useful when it identifies a project for which the underlying directory changes every once in a while (e.g. the project is downloaded from external sources and comes with version information). It is not strictly necessary to squash bookmarks since to functions/macros that are equipped with the -favour option will generally resolve duplicate matches.

 
-sd <mark> (squash repeated destinations)

All other bookmarks with the same destination as <mark> are removed. This is useful when a given destination has acquired multiple bookmarks and you decide to settle on a favourite.

 
-lm <mark> (list bookmarks with this mark)

It lists all bookmarks <mark> (noting that it may point to multiple locations).

 
-ld <mark> (list repeated destinations)

This lists all bookmarks <mark> (noting that it may point to multiple locations) and additionally lists all other bookmarks that share the destination with any of the first bookmarks. This allows one to predict the effect of issuing apparix -sd <mark>.

 
-purge pat (delete bookmarks)

This deletes bookmarks where destination matches pat. All deleted bookmarks are printed to STDOUT. Thus if you regret deleting a bookmark it is easy to add it back. Portal specifications are never affected.

 
-purge-mark (pat)

This deletes bookmarks where mark matches pat. Portal specifications are never affected.

 
-d (dump resource file to STDOUT)

Dump resource file to STDOUT.

 
-l (list available jumps)

List available jumps paragraph-style. Portal specifications themselves are excluded, and regular jumps and jumps resulting from portal expansions are listed under different headers.

 
-u <num> (remove last <num> additions)

Remove last <num> additions. Portal specifications and regular jumps are treated alike.

 
--rehash (re-expand portal bookmarks)

Apparix will reread the resource file and reexpand portal locations. Useful if directories have been added, renamed, or removed. Refer to section ENVIRONMENT for the effect that the environment variable APPARIXEXCLUDE has on portal expansion.

 
-favour <list> (set duplicate resolution policy)
-pick <num> (immediate duplicate resolution)

These options have a section to themselves. Refer to duplicate resolution.

 
--cwd (use getcwd(3), not pwd(1))

By default aparix uses the program pwd(1) rather than the system call getcwd(3). On some systems it was found that the latter results in paths that contain machine-specific mount components. Appparix will use getcwd(3) when --cwd is used.

 
--shell-examples (output example macros)

This outputs example macros. They are also listed in the FILES section though.

 
--bu (create backup of the resource file)

This creates the backup file in .apparixrc.bu.

 
-bu fname (create backup of the resource file)

This creates the backup file in fname. Use -d or -bu - to dump to STDOUT.

 
-h (show synopsis)
--apropos (show synopsis)

print synopsis of all options

ENVIRONMENT

APPARIXEXCLUDE

This variable specifies exclusion behaviour when portals are expanded with the --rehash option. It has the following syntax:

<[:,][<string>]>+

That is, a list of names with each name preceded by a colon or a comma. A colon indicates that <string> triggers exclusion of directory names for which the trailing component is identical to <string>. A comma indicates that <string> triggers exclusion of directory names for which the trailing component contains <string> as a substring. Consider:

export APPARIXEXCLUDE=:CVS:lib,tmp # A - example export APPARIXEXCLUDE=, # B - curiosity

The first excludes directory names CVS and lib and any directory name having tmp as a substring. The second example will effectively disable portals, as it speficies the empty string which is a substring of all strings.

 
APPARIXTAG

This variable, if set, is incorporated into the names of the apparix resource files. By default these are .apparixrc and .apparixexpand. When APPARIXTAG is set to <tag> they become .<tag>apparixrc and .<tag>apparixexpand. This can be used e.g. to maintain different sets of bookmarks on different host machines.

 
APPARIXLOG

This variable, if set, is interpreted as the name of a log file. The log file keeps track of all newly added bookmarks and portals without ever deleting anything, in the same format as the .apparixrc file. If this variable is not set nothing is tracked.

 
APPARIXPURGE

This changes the way apparix dumps purged bookmarks to STDOUT. By default they are dumped as command lines that will reimport the bookmarks if issued (i.e. cut and pasted). By setting this variable to 1 purged bookmarks are dumped in the format used in the .apparixrc file.

FILES

You should use aliases or functions to make apparix really useful. Get them from apparix by giving it the --shell-examples option, or from further below. Note the fragment that provides to argument completion in bash.

$HOME/.apparixrc

This is the primary resource file. There is usually no need to edit it by hand. Sometimes it can be useful to edit by hand to remove an unwanted bookmark; refer to editing bookmarks.

 
$HOME/.apparixrc.bu

Apparix creates a back-up file whenever it is asked to remove entries from it. Refer to editing bookmarks for options inducing removal. You can explicitly require a backup to be made by either of --bu or -bu fname.

 
$HOME/.apparixexpand

This contains bookmarks that are expanded from portals. A portal is simply some directory. The names of all subdirectories are taken as bookmarks that point to those subdirectories. This file can be recreated by issuing

apparix --rehash
 
$HOME/.bashrc
$HOME/.tcshrc
$HOME/.cshrc

Add the code you need to the appropriate rc file. The macros and functions below point cd(1) in the right direction.

BASH-style functions --- function to () { if test "$2"; then cd "$(apparix --try-current-first -favour rOl "$1" "$2" || echo .)" elif test "$1"; then if test "$1" == '-'; then cd - else cd "$(apparix --try-current-first -favour rOl "$1" || echo .)" fi else cd $HOME fi } function bm () { if test "$2"; then apparix --add-mark "$1" "$2"; elif test "$1"; then apparix --add-mark "$1"; else apparix --add-mark; fi } function portal () { if test "$1"; then apparix --add-portal "$1"; else apparix --add-portal; fi } # function to generate list of completions from .apparixrc function _apparix_aliases () { cur=$2 dir=$3 COMPREPLY=() nullglobsa=$(shopt -p nullglob) shopt -s nullglob if let $(($COMP_CWORD == 1)); then # now cur=<apparix mark> (completing on this) and dir='to' # Below will not complete on subdirectories. swap if so desired. # COMPREPLY=( $( cat $HOME/.apparix{rc,expand} | grep "j,.*$cur.*," | cut -f2 -d, ) ) COMPREPLY=( $( (cat $HOME/.apparix{rc,expand} | grep "\<j," | cut -f2 -d, ; ls -1p | grep '/$' | tr -d /) | grep "\<$cur.*" ) ) else # now dir=<apparix mark> and cur=<subdirectory-of-mark> (completing on this) dir=`apparix --try-current-first -favour rOl $dir 2>/dev/null` || return 0 eval_compreply="COMPREPLY=( $( cd "$dir" \ls -d $cur* | while read r do [[ -d "$r" ]] && [[ $r == *$cur* ]] && echo \"${r// /\\ }\" done ) )" eval $eval_compreply fi $nullglobsa return 0 } # command to register the above to expand when the 'to' command's args are # being expanded complete -F _apparix_aliases to --- CSH-style aliases --- # The outcommented alias does not supplant cd, the other one does. # alias to 'cd `(apparix -favour rOl \!* || echo -n .)`' alias to '(test "x-" = "x\!*") && cd - || (test "x" != "x\!*") && cd `(apparix --try-current-first -favour rOl \!* || echo -n .)` || cd' alias bm 'apparix --add-mark \!*' alias portal 'apparix --add-portal \!*' ---

More elaborate setups are possible. This CSH-style alias:

alias to '(test "x" != "x\!*") && cd `(apparix -favour rOl \!* || echo -n .)` || apparix -l'

lists all available jumps if invoked without arguments.

NOTES

Below follow some comments on other approaches to file system navigation. HISTORY explains the difference between the venerable cdargs program and apparix.

CDPATH is only useful in cases where a given directory has subdirectories with distinctive names. It does not usually scale well when there are more than a few paths in CDPATH.

Some people use aliases to jump to often visited directories. I was one of them for a period of ten years. The fact is, those aliases are cumbersome to create and remove and they clutter up the alias namespace. They can clash with executable names when the alias includes the cd part. This sometimes prohibits one from assigning the logical bookmark to a given location, especially when one has a lot of source code locations. They can clash with directory names when the aliases just expand to the location. This again means that sometimes a location cannot be assigned its logical bookmark. I have found that setting cd jumps aside in their own namespace improves file system navigation by a large factor.

It is also possible to create symlinks to often visited files. Again, creation and removal of these are cumbersome. One could of course create shell functions with a similar interface to apparix or cdargs to handle the symlink lifecycle. On Linux Weekly News nix suggested to put these symlinks in a single directory and add that directory to CDPATH. This is quite a neat trick and effectively creates a bookmark navigation system.

Still there are problems with the above approach. One problem with the symlink approach is that they are a bit awkward to edit. One could make a utility to wrap around the problem, but in the end the directory-with-symlinks would functionally be the same as apparix's .apparixrc resource file, only more of a kludge. Another problem is that symlinks are awkard when traversing the file system. They confuse the notion of parent directory and 'cd ..' mostly does the unexpected. Sometimes '..' has a different meaning to cd than it has to another application, as one will trace back symlinks and the other will not. Finally, a minor objection is that I find it convenient to have bookmarks in a separate namespace than that of cd(1). Jumps are magical and it is natural to invoke them by a different method. This is in fact how apparix acquired its CDPATH behaviour. I used CDPATH to jump to a few particular source directories with distinct names that lay deeply hidden in some CVS directory. Once I started using apparix however, I would mistakenly issue to rather than cd to jump to those locations. My brain classified both types of jump in the same category.

Apparix (and cdargs) have another use besides jumping, namely annotation. Whenever I end up in an esoteric part of the file system and need to make a quick note of the location, I simply bookmark it.

On SlashDot, that eternal source of wisdom or alternatively the geek wheel of suffering, Clueless Moron offered the following gems.

mk() { eval ${1:-MKPWD}=\"`pwd`\"; } rt() { eval cd \"\$${1:-MKPWD}\";pwd; } # type "mk" (as in "mark") and "rt" (as in "return") to mark # a directory and later go back to it. # Or give it a name: do "mk foo", and later on "rt foo"

This of course is a per-session mechanism, but noteworthy for its simplicity. I am not sure whether csh-style shells could offer an equivalent.

A feature shared by apparix and cdargs is that adding a bookmark immediately takes effect in all shells. There is no need to source some resource file, as the applications do this everytime they are invoked. It is fast, do not worry.

BUGS

The resource file parsing code thinks that parentheses are special. Also records are currently separated by commas. Accordingly, apparix will hitch if a path name contains a parenthesis or a comma.

AUTHOR

Stijn van Dongen.

THANKS

Stefan Kamphausen wrote cdargs, the inspiration for apparix.

Sitaram Chamarty fixed up some of the existing bash code, and added the tab completion part (basing this on similar code in cdargs). He does not garantuee predictable or even pretty results if there are spaces in the directory names which you attempt to complete. AUTHOR would like to submit that spaces in path names are evil, and that the completion code seems to work in their evil presence anyway. Just don't put commas in path names.

The autotooled build environment was modified from a template written by Joost van Baal.

Several people suggested to enable apparix to merge accessible directories and marks, but Matias Piipari phrased it the most convincingly.

HISTORY

Apparix was created to optimize a scenario that cdargs does not support very well, namely where the mark (called needle in cdargs) is always known. As additional features apparix supports CDPATH-style behaviour, derived subdirectory specification, and transparent treatment of bookmarks and directories, all integrated with bash tab completion. In other respects apparix is a much simpler application. cdargs offers menu-based navigation of the file system and the bookmark list, which apparix does not.

apparix-11-062/doc/apparix.ps000066400000000000000000002630371326043744200160430ustar00rootroot00000000000000%!PS-Adobe-3.0 %%Creator: groff version 1.18.1.1 %%CreationDate: Thu Mar 3 13:55:13 2011 %%DocumentNeededResources: font Times-Roman %%+ font Times-Bold %%+ font Times-Italic %%+ font Courier %%DocumentSuppliedResources: procset grops 1.18 1 %%Pages: 12 %%PageOrder: Ascend %%Orientation: Portrait %%EndComments %%BeginProlog %%BeginResource: procset grops 1.18 1 /setpacking where{ pop currentpacking true setpacking }if /grops 120 dict dup begin /SC 32 def /A/show load def /B{0 SC 3 -1 roll widthshow}bind def /C{0 exch ashow}bind def /D{0 exch 0 SC 5 2 roll awidthshow}bind def /E{0 rmoveto show}bind def /F{0 rmoveto 0 SC 3 -1 roll widthshow}bind def /G{0 rmoveto 0 exch ashow}bind def /H{0 rmoveto 0 exch 0 SC 5 2 roll awidthshow}bind def /I{0 exch rmoveto show}bind def /J{0 exch rmoveto 0 SC 3 -1 roll widthshow}bind def /K{0 exch rmoveto 0 exch ashow}bind def /L{0 exch rmoveto 0 exch 0 SC 5 2 roll awidthshow}bind def /M{rmoveto show}bind def /N{rmoveto 0 SC 3 -1 roll widthshow}bind def /O{rmoveto 0 exch ashow}bind def /P{rmoveto 0 exch 0 SC 5 2 roll awidthshow}bind def /Q{moveto show}bind def /R{moveto 0 SC 3 -1 roll widthshow}bind def /S{moveto 0 exch ashow}bind def /T{moveto 0 exch 0 SC 5 2 roll awidthshow}bind def /SF{ findfont exch [exch dup 0 exch 0 exch neg 0 0]makefont dup setfont [exch/setfont cvx]cvx bind def }bind def /MF{ findfont [5 2 roll 0 3 1 roll neg 0 0]makefont dup setfont [exch/setfont cvx]cvx bind def }bind def /level0 0 def /RES 0 def /PL 0 def /LS 0 def /MANUAL{ statusdict begin/manualfeed true store end }bind def /PLG{ gsave newpath clippath pathbbox grestore exch pop add exch pop }bind def /BP{ /level0 save def 1 setlinecap 1 setlinejoin 72 RES div dup scale LS{ 90 rotate }{ 0 PL translate }ifelse 1 -1 scale }bind def /EP{ level0 restore showpage }bind def /DA{ newpath arcn stroke }bind def /SN{ transform .25 sub exch .25 sub exch round .25 add exch round .25 add exch itransform }bind def /DL{ SN moveto SN lineto stroke }bind def /DC{ newpath 0 360 arc closepath }bind def /TM matrix def /DE{ TM currentmatrix pop translate scale newpath 0 0 .5 0 360 arc closepath TM setmatrix }bind def /RC/rcurveto load def /RL/rlineto load def /ST/stroke load def /MT/moveto load def /CL/closepath load def /Fr{ setrgbcolor fill }bind def /Fk{ setcmykcolor fill }bind def /Fg{ setgray fill }bind def /FL/fill load def /LW/setlinewidth load def /Cr/setrgbcolor load def /Ck/setcmykcolor load def /Cg/setgray load def /RE{ findfont dup maxlength 1 index/FontName known not{1 add}if dict begin { 1 index/FID ne{def}{pop pop}ifelse }forall /Encoding exch def dup/FontName exch def currentdict end definefont pop }bind def /DEFS 0 def /EBEGIN{ moveto DEFS begin }bind def /EEND/end load def /CNT 0 def /level1 0 def /PBEGIN{ /level1 save def translate div 3 1 roll div exch scale neg exch neg exch translate 0 setgray 0 setlinecap 1 setlinewidth 0 setlinejoin 10 setmiterlimit []0 setdash /setstrokeadjust where{ pop false setstrokeadjust }if /setoverprint where{ pop false setoverprint }if newpath /CNT countdictstack def userdict begin /showpage{}def }bind def /PEND{ clear countdictstack CNT sub{end}repeat level1 restore }bind def end def /setpacking where{ pop setpacking }if %%EndResource %%IncludeResource: font Times-Roman %%IncludeResource: font Times-Bold %%IncludeResource: font Times-Italic %%IncludeResource: font Courier grops begin/DEFS 1 dict def DEFS begin/u{.001 mul}bind def end/RES 72 def/PL 792 def/LS false def/ENC0[/asciicircum/asciitilde/Scaron/Zcaron /scaron/zcaron/Ydieresis/trademark/quotesingle/Euro/.notdef/.notdef /.notdef/.notdef/.notdef/.notdef/.notdef/.notdef/.notdef/.notdef/.notdef /.notdef/.notdef/.notdef/.notdef/.notdef/.notdef/.notdef/.notdef/.notdef /.notdef/.notdef/space/exclam/quotedbl/numbersign/dollar/percent /ampersand/quoteright/parenleft/parenright/asterisk/plus/comma/hyphen /period/slash/zero/one/two/three/four/five/six/seven/eight/nine/colon /semicolon/less/equal/greater/question/at/A/B/C/D/E/F/G/H/I/J/K/L/M/N/O /P/Q/R/S/T/U/V/W/X/Y/Z/bracketleft/backslash/bracketright/circumflex /underscore/quoteleft/a/b/c/d/e/f/g/h/i/j/k/l/m/n/o/p/q/r/s/t/u/v/w/x/y /z/braceleft/bar/braceright/tilde/.notdef/quotesinglbase/guillemotleft /guillemotright/bullet/florin/fraction/perthousand/dagger/daggerdbl /endash/emdash/ff/fi/fl/ffi/ffl/dotlessi/dotlessj/grave/hungarumlaut /dotaccent/breve/caron/ring/ogonek/quotedblleft/quotedblright/oe/lslash /quotedblbase/OE/Lslash/.notdef/exclamdown/cent/sterling/currency/yen /brokenbar/section/dieresis/copyright/ordfeminine/guilsinglleft /logicalnot/minus/registered/macron/degree/plusminus/twosuperior /threesuperior/acute/mu/paragraph/periodcentered/cedilla/onesuperior /ordmasculine/guilsinglright/onequarter/onehalf/threequarters /questiondown/Agrave/Aacute/Acircumflex/Atilde/Adieresis/Aring/AE /Ccedilla/Egrave/Eacute/Ecircumflex/Edieresis/Igrave/Iacute/Icircumflex /Idieresis/Eth/Ntilde/Ograve/Oacute/Ocircumflex/Otilde/Odieresis /multiply/Oslash/Ugrave/Uacute/Ucircumflex/Udieresis/Yacute/Thorn /germandbls/agrave/aacute/acircumflex/atilde/adieresis/aring/ae/ccedilla /egrave/eacute/ecircumflex/edieresis/igrave/iacute/icircumflex/idieresis /eth/ntilde/ograve/oacute/ocircumflex/otilde/odieresis/divide/oslash /ugrave/uacute/ucircumflex/udieresis/yacute/thorn/ydieresis]def /Courier@0 ENC0/Courier RE/Times-Italic@0 ENC0/Times-Italic RE /Times-Bold@0 ENC0/Times-Bold RE/Times-Roman@0 ENC0/Times-Roman RE %%EndProlog %%Page: 1 1 %%BeginPageSetup BP %%EndPageSetup /F0 10/Times-Roman@0 SF 145.125<617070617269782831292055534552>20 48 R 147.625<434f4d4d414e44532061707061726978283129>2.5 F/F1 10.95 /Times-Bold@0 SF -.219<4e41>20 84 S<4d45>.219 E F0<6170706172697820ad20 6175676d656e74696e67206364207769746820626f6f6b6d61726b73>100 96 Q F1 <53594e4f50534953>20 112.8 Q F0 .467<4170706172697820616c6c6f>100 124.8 R .467<777320796f7520746f20626f6f6b6d61726b206469726563746f726965732061 6e64206c61746572206a756d7020746f207468656d207573696e6720746865206d61726b 2e>-.25 F .466<427920646566>5.466 F<61756c74>-.1 E .63 <6170706172697820616374732061732061207265706c6163656d656e7420666f72>100 136.8 R/F2 10/Times-Italic@0 SF<6364>3.13 E F0 .631 <616e642063616e206265207573656420696e207468652073616d65206d616e6e6572> 3.13 F 3.131<2c69>-.4 G .631<6e636c7564696e6720746865207370656369616c> -3.131 F<62656861>100 148.8 Q .03<76696f757220666f72>-.2 F F2<6364>2.53 E F0 .03<776974686f7574206172>2.53 F .03<67756d656e7420616e64>-.18 F F2 <6364>2.53 E/F3 10/Courier@0 SF<2d>2.5 E F0 5.03<2e49>C 2.53<7469>-5.03 G 2.53<7370>-2.53 G .03<6f737369626c6520746f206469726563746c79206a756d70 20746f207375626469726563746f72696573206f662061>-2.53 F<626f6f6b6d61726b> 100 160.8 Q 1.734<6564206469726563746f72792e>-.1 F 1.734 <54686520636f6e74726962>6.734 F 1.734 <75746564206261736820636f6d706c6574696f6e20636f64652066>-.2 F 1.734 <6163696c69746174657320636f6d706c6574696f6e20626f7468206f6e>-.1 F <626f6f6b6d61726b7320616e64206469726563746f726965732c2062>100 172.8 Q<75 742063616e2062652061646a757374656420746f206163636f6d6f64617465206f746865 7220707265666572656e6365732e>-.2 E .16 <54686973206d616e75616c207061676520737566>100 196.8 R .16 <666572732066726f6d20616e2065>-.25 F .16<786365737320696e2076>-.15 F .16 <6572626f736974792064756520746f20746865206d616e>-.15 F 2.66<7965>-.15 G .16<78616d706c65732c2065>-2.81 F .16<78706c616e6174696f6e73206f66>-.15 F .532<7468652062656c6c7320616e642077686973746c65732c20616e6420636f6d7061 7269736f6e732077697468206f7468657220617070726f616368657320746f20626f6f6b 6d61726b696e672e205468652066756e64616d656e2d>100 208.8 R .281<74616c2069 6465612069732073696d706c79207468617420747970696e67206120737472696e67206f 6620796f7572206f>100 220.8 R .28<776e2063686f6f73696e672074616b>-.25 F .28 <657320796f7520746f20746865206469726563746f7279206173736f636961746564> -.1 F .359<776974682069742e>100 232.8 R .359<4170706172697820646f657320 6c6974746c65206d6f7265207468616e206d61696e7461696e696e672061206c69737420 6f66206b>5.359 F -.15<6579>-.1 G 2.86<7361>.15 G .36<6e642076>-2.86 F 2.86<616c7565732e204974>-.25 F .36<6f627461696e73206469726563746f7279> 2.86 F .56<6e616d657320616e64206c697374696e67732c206173736f636961746573 2070617468206e616d6573202876>100 244.8 R .559 <616c75657329207769746820626f6f6b6d61726b7320286b>-.25 F -.15<6579>-.1 G .559<73292c20616e642068617320736f6d652066>.15 F<6163696c692d>-.1 E .197 <7469657320666f72206d616e6970756c6174696e67206b>100 256.8 R -.15<6579> -.1 G 2.697<7361>.15 G .197<6e642076>-2.697 F .197 <616c7565732e205468652066756e6374696f6e7320696e>-.25 F -.2<766f>-.4 G .197<6c76696e6720617070617269782028>.2 F/F4 10/Times-Bold@0 SF<626d>A F0 <2c>A F4<746f>2.697 E F0 2.697<2c61>C<6e64>-2.697 E F4<706f7274616c> 2.698 E F0 2.698<2970>C<726f2d>-2.698 E .732 <7669646520746865207573657220696e74657266>100 268.8 R 3.232 <6163652e204f74686572>-.1 F<66756e6374696f6e732c>3.232 E F4<616c73>3.231 E F0 .731<2861707061726978206c732920616e64>3.231 F F4<6165>3.231 E F0 .731<28617070617269782065646974292061726520646973637573736564206f6e> 3.231 F<746865206d61696e2061707061726978207061676520687474703a2f2f6d6963 616e732e6f72>100 280.8 Q<672f617070617269782e>-.18 E F1 <47455454494e47205354>20 297.6 Q<4152>-.986 E<544544>-.438 E F0 1.219<49 6e7374616c6c20617070617269782e20546869732073686f756c64206265206173206561 7379206173>100 309.6 R F3 1.219 <2e2f636f6e666967757265202d2d7072656669783d24484f4d452f6c6f63616c202626> 3.719 F .784<6d616b65202626206d616b6520696e7374616c6c>100 321.6 R F0 3.284<2c6f>C 3.284<7270>-3.284 G .784 <6572686170732061207072652d7061636b6167656420617070617269782069732061> -3.284 F -.25<7661>-.2 G .783 <696c61626c6520666f7220796f75722073797374656d2e>.25 F 1.788 <5468656e2067657420686f6c64206f6620746865>100 333.6 R F4<746f>4.289 E F0 <2c>A F4<626d>4.289 E F0<616e64>4.289 E F4<706f7274616c>4.289 E F0 1.789 <7368656c6c2068616e646c65732e205468657365206172652065697468657220616c69 61736573206f722066756e6374696f6e73>4.289 F 1.111<646570656e64696e67206f 6e20796f7572207368656c6c2e2043757272656e746c79206373682d7374796c65207368 656c6c7320616e6420626173682061726520737570706f727465642e>100 345.6 R 1.11<47657420746865206f6e657320796f75>6.11 F 2.393<6e656564207072656665 7261626c792066726f6d20687474703a2f2f6d6963616e732e6f72>100 357.6 R 2.393 <672f617070617269782f237368656c6c2e2046>-.18 F 2.393 <6f722061206d6f7265206c696d6974656420736574206f6620636f6d6d616e6473>-.15 F 1.168<65697468657220766973697420746865>100 369.6 R F4<46494c4553>3.668 E F0 1.167<73656374696f6e2c206f72206973737565>3.667 F F3 1.167 <61707061726978202d2d7368656c6c2d6578616d706c6573>3.667 F F0 3.667<2e41> C<637469>-3.667 E -.25<7661>-.25 G 1.167<7465207468656d206279>.25 F 4.364<73696d706c792070617374696e67207468656d20696e2061207368656c6c206f72 20616464696e67207468656d20746f2074686520617070726f707269617465207265736f 75726365208c6c652c20652e672e>100 381.6 R F3<24484f4d452f2e6373687263>100 393.6 Q F0<6f72>2.916 E F3<24484f4d452f2e626173687263>2.916 E F0 .416 <28646f206e6f7420666f72>2.916 F .416<67657420746f>-.18 F F2<736f7572> 2.916 E<6365>-.37 E F0 .416 <746865207265736f75726365208c6c65292e205468652068616e646c6573>2.916 F F4 <746f>100 405.6 Q F0<2c>A F4<626d>3.056 E F0<616e64>3.056 E F4 <706f7274616c>3.057 E F0 .557 <63616e206f6620636f75727365206265206368616e67656420746f20616e>3.057 F 3.057<796e>-.15 G .557<616d6520646573697265642e2057>-3.057 F .557 <697468207468657365207072656c696d696e61726965732c20746865>-.4 F <666f6c6c6f>100 417.6 Q <77696e672069732061206d6f636b2d7570207368656c6c206e61>-.25 E<766967>-.2 E<6174696f6e2073657373696f6e2e>-.05 E <6170706172697820312e3030342c2031312d303632>20 768 Q 2.5<334d>122.35 G <61722032303131>-2.5 E<31>205.67 E 0 Cg EP %%Page: 2 2 %%BeginPageSetup BP %%EndPageSetup /F0 10/Times-Roman@0 SF 145.125<617070617269782831292055534552>20 48 R 147.625<434f4d4d414e44532061707061726978283129>2.5 F/F1 10/Courier@0 SF <3e>118 84 Q/F2 10/Times-Bold@0 SF<707764>6 E F1<2f686f6d652f65657a2f63 76732f78797a2f7466612f6661712f7a75742f6261722f666f6f>118 96 Q<3e>118 108 Q F2<6c73>6 E F1<7372632f20646f632f204356532f2062696e2f>118 120 Q<3e>118 132 Q F2<626d20786b72>6 E F1 6<2362>42 G <6f6f6b6d61726b20617320786b72202866756e6e79206e616d652074686f75676829>-6 E<3e>118 144 Q F2<626d>6 E F1 6<2362>66 G<6f6f6b6d61726b20617320666f6f20 28747261696c696e6720636f6d706f6e656e742069732064656661756c7429>-6 E <286c6174657229>100 156 Q<3e>118 168 Q F2<746f20786b72>6 E F1 6<2363>42 G 6<6474>-6 G 6<6f2f>-6 G<686f6d652f65657a2f6376732f78797a2f7466612f6661 712f7a75742f6261722f666f6f>-6 E<28616c7465726e61746976656c7929>100 180 Q <3e>118 192 Q F2<746f20786b72207372>6 E<63>-.18 E F1 6<2363>18 G 6<6474> -6 G 6<6f2f>-6 G<686f6d652f65657a2f6376732f78797a2f7466612f6661712f7a75 742f6261722f666f6f2f737263>-6 E<28616c7465726e61746976656c7929>100 204 Q <3e>118 216 Q F2<746f2066>6 E<6f6f>-.25 E F1 6<2363>42 G 6<6474>-6 G 6 <6f2f>-6 G<686f6d652f65657a2f6376732f78797a2f7466612f6661712f7a75742f62 61722f666f6f>-6 E<286c6174657229>100 240 Q<3e>118 252 Q F2<6c73>6 E F1 <616170207079752f207175612074696d2f207a75742f>118 264 Q<3e>118 276 Q F2 <707764>6 E F1<2f686f6d652f65657a2f616e6f746865722f6272616e63682f646565 702f646f776e2f756e646572>118 288 Q<3e>118 300 Q F2<706f7274616c>6 E F1 6 <2362>42 G<6f6f6b6d61726b20617320706f7274616c2c20696d706f7274732074696d 207a75742070797520626f6f6b6d61726b73>-6 E<616464656420666c6f636b206f6620 3320696e20706f7274616c202f686f6d652f65657a2f616e6f746865722f6272616e6368 2f646565702f646f776e2f756e646572>118 312 Q<286c6174657229>100 336 Q<3e> 118 348 Q F2<746f207a7574>6 E F1 6<2363>42 G 6<6474>-6 G 6<6f2f>-6 G<68 6f6d652f65657a2f616e6f746865722f6272616e63682f646565702f646f776e2f756e64 65722f7a7574>-6 E<286c6174657229>100 372 Q<3e>118 384 Q F2 <61707061726978>6 E F1 6<2373>18 G<686f7720616c6c20626f6f6b6d61726b73>-6 E<2d2d2d20706f7274616c73>118 396 Q 84<652f>118 408 S<686f6d652f65657a2f 616e6f746865722f6272616e63682f646565702f646f776e2f756e646572>-84 E <2d2d2d20657870616e73696f6e73>118 420 Q 6<6a70>118 432 S 54<7975202f686f 6d652f65657a2f616e6f746865722f6272616e63682f646565702f646f776e2f756e6465 722f707975>-6 F 6<6a74>118 444 S 54<696d202f686f6d652f65657a2f616e6f7468 65722f6272616e63682f646565702f646f776e2f756e6465722f74696d>-6 F 6<6a7a> 118 456 S 54<7574202f686f6d652f65657a2f616e6f746865722f6272616e63682f64 6565702f646f776e2f756e6465722f7a7574>-6 F<2d2d2d20626f6f6b6d61726b73>118 468 Q 6<6a78>118 480 S 54<6b72202f686f6d652f65657a2f6376732f78797a2f7466 612f6661712f7a75742f6261722f666f6f>-6 F 6<6a66>118 492 S 54<6f6f202f686f 6d652f65657a2f6376732f78797a2f7466612f6661712f7a75742f6261722f666f6f>-6 F F0 .746<496e20746865206c6173742065>100 516 R .746 <78616d706c6520617070617269782073696d706c792073686f>-.15 F .745<77732061 6c6c2069747320626f6f6b6d61726b732e20546865208c7273742062617463682073686f> -.25 F .745<777320706f7274616c732e20546865>-.25 F .17 <7365636f6e642062617463682073686f>100 528 R .17 <7773207365636f6e6461727920626f6f6b6d61726b732065>-.25 F .17<7870616e64 65642066726f6d20706f7274616c732e205468652074686972642062617463682073686f> -.15 F .17<777320616c6c207265>-.25 F<672d>-.15 E <756c617220626f6f6b6d61726b732e>100 540 Q .6<496e2074686520646566>100 564 R .6<61756c742064658c6e6974696f6e73206f66>-.1 F F2<746f>3.1 E F0 .6 <69742066>3.1 F .6<616c6c73206261636b20746f207265>-.1 F<67756c6172>-.15 E/F3 10/Times-Italic@0 SF<6364>3.099 E F0<62656861>3.099 E .599 <76696f757220696e20636173652061206d61726b206973206e6f7420666f756e642e> -.2 F .385<5468697320697320646f6e6520627920696e737472756374696e67206170 706172697820746f20636865636b207768657468657220746865206d61726b2065>100 576 R .386 <786973747320617320746865206e616d65206f662061206469726563746f72792e>-.15 F .326<497420697320706f737369626c6520746f20646f207468697320656974686572 206265666f7265206f7220616674657220626f6f6b6d61726b206c6f6f6b75702c206f72 206e6f7420617420616c6c2e20427920646566>100 588 R .326 <61756c74207468652062617368>-.1 F <636f6d706c6574696f6e20636f64652074616b>100 600 Q<657320696e746f20616363 6f756e7420626f746820626f6f6b6d61726b7320616e64206469726563746f726965732e> -.1 E .074<4170706172697820616c736f20616c6c6f>100 624 R .074<7773207375 626469726563746f72792073706563698c636174696f6e206f6620626f6f6b6d61726b> -.25 F .074<6564206c6f636174696f6e732e204966207468697320697320636f6d6269 6e65642077697468>-.1 F .322<746865206261736820636f6d706c6574696f6e20636f 6465206974207969656c6473206120706f>100 636 R .322<77657266756c2077>-.25 F .322<6179206f66206e61>-.1 F<766967>-.2 E .322<6174696e6720636f6e746169 6e6572206469726563746f726965732c20692e652e2064697265632d>-.05 F .135 <746f72696573207468617420636f6e7461696e2061206c6172>100 648 R .135<6765 206e756d626572206f66207375626469726563746f726965732e20526566657220746f20 746865>-.18 F F2<737562646972>2.636 E .136 <6563746f72792073706563698c636174696f6e>-.18 F F0<7365632d>2.636 E <74696f6e2e>100 660 Q F2<46757274686572206f7074696f6e73>100 684 Q <5b2d2d6164642d6d61726b>100 696 Q F0<28>6.063 E F3 3.563 <616464206a756d7020626f6f6b6d61726b>B F0<29>A F2 6.062<5d5b>C <2d2d6164642d706f7274616c>-6.062 E F0<28>6.062 E F3 3.562 <61646420706f7274616c20626f6f6b6d61726b>B F0<29>A F2 6.062<5d5b>C <2d736d>-6.062 E F0<3c6d61726b3e>6.062 E<28>100 708 Q F3 .642 <7371756173682072>B .642<65706561746564206d61726b73>-.37 F F0<29>A F2 3.142<5d5b>C<2d7364>-3.142 E F0 .643<3c6d61726b3e2028>3.143 F F3 .643 <7371756173682072>B .643<657065617465642064657374696e6174696f6e73>-.37 F F0<29>A F2 3.143<5d5b>C<2d6c6d>-3.143 E F0 .643<3c6d61726b3e2028>3.143 F F3 .643<6c69737420626f6f6b2d>B 1.486 <6d61726b7320776974682074686973206d61726b>100 720 R F0<29>A F2 3.986 <5d5b>C<2d6c64>-3.986 E F0 1.486<3c6d61726b3e2028>3.986 F F3 1.486 <6c6973742064657374696e6174696f6e732077697468206d61726b20696e646972>B <656374696f6e>-.37 E F0<29>A F2 3.985<5d5b>C<2d6661>-3.985 E -.1<766f> -.25 G<7572>.1 E F0<3c6c6973743e>3.985 E <6170706172697820312e3030342c2031312d303632>20 768 Q 2.5<334d>122.35 G <61722032303131>-2.5 E<32>205.67 E 0 Cg EP %%Page: 3 3 %%BeginPageSetup BP %%EndPageSetup /F0 10/Times-Roman@0 SF 145.125<617070617269782831292055534552>20 48 R 147.625<434f4d4d414e44532061707061726978283129>2.5 F<28>100 84 Q/F1 10 /Times-Italic@0 SF 2.973<6475706c69636174652072>B 2.973 <65736f6c7574696f6e20706f6c696379>-.37 F F0<29>A/F2 10/Times-Bold@0 SF 5.473<5d5b>C<2d7069636b>-5.473 E F0 2.973<3c6e756d3e2028>5.473 F F1 2.973<696d6d656469617465206475706c69636174652072>B<65736f6c7574696f6e> -.37 E F0<29>A F2 5.474<5d5b>C<2d707572>-5.474 E<6765>-.1 E F0<706174> 5.474 E<28>100 96 Q F1 .049<64656c65746520626f6f6b6d61726b73>B F0<29>A F2 2.549<5d5b>C<2d707572>-2.549 E<67652d6d61726b>-.1 E F0<28>2.549 E F1 <706174>A F0<29>A F2 2.549<5d5b>C<2d64>-2.549 E F0<28>2.548 E F1 .048 <64756d702072>B<65736f7572>-.37 E .048<6365208c6c6520746f205354444f5554> -.37 F F0<29>A F2 2.548<5d5b>C<2d6c>-2.548 E F0<28>2.548 E F1 .048 <6c69737420617661696c61626c65>B<6a756d7073>100 108 Q F0<29>A F2 3.783 <5d5b>C<2d75>-3.783 E F0 1.283<3c6e756d3e2028>3.783 F F1 -.37<7265>C <6d6f>.37 E 1.283<7665206c617374203c6e756d3e206164646974696f6e73>-.1 F F0<29>A F2 3.783<5d5b>C<2d2d72>-3.783 E<6568617368>-.18 E F0<28>3.783 E F1 -.37<7265>C<2d65>.37 E 1.283 <7870616e6420706f7274616c20626f6f6b6d61726b73>-.2 F F0<29>A F2<5d>A <5b2d2d62>100 120 Q<75>-.2 E F0<28>3.294 E F1<6372>A .794 <6561746520626163>-.37 F .794<6b7570206f662072>-.2 F<65736f7572>-.37 E .794<6365208c6c65>-.37 F F0<29>A F2 3.294<5d5b>C<2d62>-3.294 E<75>-.2 E F0 .794<3c666e616d653e2028>3.294 F F1<6372>A .794<6561746520626163>-.37 F .794<6b757020696e203c666e616d653e>-.2 F F0<29>A F2 3.293<5d5b>C <2d2d637764>-3.293 E F0<28>3.293 E F1<757365>A -.1<6765>100 132 S <746377642833292c206e6f7420707764283129>.1 E F0<29>A F2 2.5<5d5b>C <2d2d7368656c6c2d6578616d706c6573>-2.5 E F0<28>2.5 E F1 <6f75747075742065>A<78616d706c65206d616372>-.2 E<6f73>-.45 E F0<29>A F2 <5d>A/F3 10.95/Times-Bold@0 SF<4445534352495054494f4e>20 148.8 Q F0 .237 <4170706172697820636f6d62696e6573207468652070726f70657274696573206f6620 746865>100 160.8 R F1<63646172>2.737 E<6773>-.37 E F0 .237 <7574696c69747920616e642074686520434450>2.737 F -1.11<4154>-.92 G 2.737 <4873>1.11 G .238<68656c6c206d656368616e69736d20666f722066>-2.737 F <617374>-.1 E<6e61>100 172.8 Q<766967>-.2 E .39<6174696f6e207468726f7567 6820746865208c6c652073797374656d2e2049742063616e206164646974696f6e616c6c 792061637420617320746865207265>-.05 F<67756c6172>-.15 E F1<6364>2.889 E F0 .389<636f6d6d616e642e20497420697320657370652d>2.889 F .047<6369616c6c 792075736566756c20666f72207669736974696e6720616e6420646f63756d656e74696e 6720626f7468206f6674656e2d20616e6420726172656c792d75736564206c6f63617469 6f6e732e204170706172697820656e61626c6573>100 184.8 R 1.553<796f7520746f 20617474616368206d61726b7320746f206c6f636174696f6e7320616e64206a756d7020 746f2074686f7365206c6f636174696f6e73206279206c6f6164696e6720746865206d61 726b2e204d61726b696e672c>100 196.8 R .959<756e6d61726b696e6720616e64206a 756d70696e67206172652073696d706c65206f7065726174696f6e732074686174206172 6520706572666f726d656420696e20746865207368656c6c2e20416c6c20616374696f6e 732074616b>100 208.8 R<65>-.1 E<6566>100 220.8 Q .334<6665637420696d6d65 64696174656c7920696e20616c6c207368656c6c732072756e6e696e672e204279207365 7474696e6720757020636f6e>-.25 F -.15<7665>-.4 G .333 <6e69656e7420616c696173657320666f72206d61726b696e6720616e64206a756d702d> .15 F 1.572<696e6720746865208c6c652073797374656d2063616e206265206e61>100 232.8 R<766967>-.2 E 1.572<6174656420696e20612066>-.05 F 1.573 <61737420616e6420696e7475697469>-.1 F 1.873 -.15<7665206d>-.25 H 1.573 <616e6e65722e20546865>.15 F F2<46494c4553>4.073 E F0 1.573 <73656374696f6e206c69737473>4.073 F 1.092<616c696173657320666f7220637368 2d74797065207368656c6c7320616e642066756e6374696f6e7320666f7220626173682c 20696e636c7564696e672074686520736574757020746f20657175697020746865>100 244.8 R F2<746f>3.592 E F0<66756e6374696f6e>3.592 E<77697468206172>100 256.8 Q<67756d656e7420636f6d706c6574696f6e20696e20626173682e>-.18 E .265 <546869732073656374696f6e20636f6e7461696e7320736f6d652065>100 280.8 R .265<78616d706c6573206f6620746865206d6f737420636f6d6d6f6e2075736573206f 6620617070617269782e>-.15 F F2<4f5054494f4e53>5.266 E F0 <636f6e7461696e73>2.766 E 2.5<616c>100 292.8 S <697374206f66206164646974696f6e616c206f7074696f6e732061>-2.5 E -.25 <7661>-.2 G<696c61626c6520666f72206c697374696e672c207072756e696e672c2061 6e6420737175617368696e6720626f6f6b6d61726b732e>.25 E F2<4e4f>100 316.8 Q <544553>-.4 E F0 .725<66656174757265732061206272696566206469736375737369 6f6e206f662074686520616476>3.225 F .725 <616e7461676573206f662061707061726978206f>-.25 F -.15<7665>-.15 G 3.225 <726f>.15 G .725<7468657220617070726f61636865732073756368206173>-3.225 F 1.286<73657474696e6720757020616c696173657320666f72206f6674656e2076697369 746564206469726563746f726965732c207573696e672073796d6c696e6b732c20434450> 100 328.8 R -1.11<4154>-.92 G 1.286 <482c206f72206120636f6d62696e6174696f6e206f66>1.11 F<74686573652e>100 340.8 Q F2<48495354>3.436 E<4f52>-.18 E<59>-.35 E F0 -.15<6578>3.436 G .936<706c61696e732074686520646966>.15 F .936 <666572656e6365206265747765656e2063646172>-.25 F .935 <677320616e6420617070617269782e>-.18 F .935<5468652073656374696f6e73> 5.935 F F2<6475706c6963617465>3.435 E -.18<7265>100 352.8 S <736f6c7574696f6e>.18 E F0<2c>A F2<737562646972>4.825 E 2.325 <6563746f72792073706563698c636174696f6e>-.18 F F0<2c>A F2 2.325 <74616220636f6d706c6574696f6e>4.825 F F0<2c>A F2 2.326 <636f7079696e6720616e64206d6f>4.826 F 2.326<76696e67208c6c6573>-.1 F F0 <2c>A F2<6c697374696e67>4.826 E<626f6f6b6d61726b73>100 364.8 Q F0 2.5 <2c61>C<6e64>-2.5 E F2 -.18<7265>2.5 G<706c6163696e67206364>.18 E F0 <667572746865722062656c6f>2.5 E 2.5<7761>-.25 G <726520616c736f207265636f6d6d656e6465642072656164696e672e>-2.5 E .468 <417070617269782077>100 388.8 R .467 <6f726b7320696e2061206d616e6e65722073696d696c617220746f2063646172>-.1 F .467<67732e204f6e6520757375616c6c7920696e>-.18 F -.2<766f>-.4 G -.1 <6b65>.2 G 2.967<7361>.1 G .467 <707061726978206279207573696e67207072652d64658c6e6564>-2.967 F .109 <616c69617365732e204865726520746865>100 400.8 R 2.609<7977>-.15 G .109 <696c6c2062652063616c6c6564>-2.609 F F2<626d>2.609 E F0 .109 <666f7220626f6f6b6d61726b2c>2.609 F F2<706f7274616c>2.609 E F0 .11 <666f72206120434450>2.609 F -1.11<4154>-.92 G .11 <482d7374796c6520626f6f6b6d61726b20616e64>1.11 F F2<746f>2.61 E F0 .313< 666f7220696e6974696174696e6720616e2061707061726974696f6e2028616b61206a75 6d70292e>100 412.8 R .313 <546865736520616c69617365732061726520666f756e642062656c6f>5.313 F 2.812 <7769>-.25 G 2.812<6e74>-2.812 G<6865>-2.812 E F2<46494c4553>2.812 E F0 .312<73656374696f6e20616e64>2.812 F <63616e20616c736f206265206f627461696e65642062792069737375696e67>100 424.8 Q/F4 10/Courier@0 SF <61707061726978202d2d7368656c6c2d6578616d706c6573>100 448.8 Q F0 1.694 <537570706f736520796f75722075736572206e616d65206973>100 472.8 R F1 <65657a>4.194 E F0 1.695 <616e6420796f757220686f6d65206469726563746f7279206973>4.195 F F4 <2f686f6d652f65657a>4.195 E F0 6.695<2e59>C 1.695 <6f75206f6674656e2076697369742061>-7.795 F 1.493 <6469726563746f72792063616c6c6564>100 484.8 R F4<2f686f6d652f65657a2f63 76732f78797a2f7466612f6661712f7a75742f6261722f666f6f>3.993 E F0 6.493 <2e54>C 1.493<68697320697320686f>-6.493 F 3.993<7774>-.25 G 3.992<6f63> -3.993 G<7265617465>-3.992 E <616e6420757365206120626f6f6b6d61726b20666f7220666f6f>100 496.8 Q F4<2f 686f6d652f65657a2f6376732f78797a2f7466612f6661712f7a75742f6261722f666f6f 3e>100 520.8 Q F2<626d2066>6 E<6f6f>-.25 E F4<61646465643a20666f6f202d3e 202f686f6d652f65657a2f6376732f78797a2f7466612f6661712f7a75742f6261722f66 6f6f>100 532.8 Q<2f686f6d652f65657a2f6376732f78797a2f7466612f6661712f7a 75742f6261722f666f6f3e>100 544.8 Q F2<6364>6 E F4<2f686f6d652f65657a3e> 100 556.8 Q F2<746f2066>6 E<6f6f>-.25 E F4<2f686f6d652f65657a2f6376732f 78797a2f7466612f6661712f7a75742f6261722f666f6f3e>100 568.8 Q F0 .441<49 66206f6e6520626f6f6b6d61726b732061206469726563746f7279206279206974732074 7261696c696e6720636f6d706f6e656e742061732068617070656e656420696e20746869 7320636173652c206974206973206e6f74206e656365732d>100 592.8 R <7361727920746f207370656369667920746865206d61726b2e20427920646566>100 604.8 Q<61756c7420617070617269782077696c6c207573652074686520747261696c69 6e6720636f6d706f6e656e7420617320746865206d61726b2e20536f>-.1 E F4<2f686f 6d652f65657a2f6376732f78797a2f7466612f6661712f7a75742f6261722f666f6f3e> 100 628.8 Q F2<626d>6 E F4<61646465643a20666f6f202d3e202f686f6d652f6565 7a2f6376732f78797a2f7466612f6661712f7a75742f6261722f666f6f>100 640.8 Q F0<6769>100 664.8 Q -.15<7665>-.25 G 2.5<7374>.15 G <68652073616d6520726573756c742e>-2.5 E .1 <416e6f74686572207363656e6172696f20697320776865726520796f75206861>100 688.8 R .399 -.15<76652073>-.2 H .099 <6f6d65206469726563746f7279207468617420636f6e7461696e732061206c6172>.15 F .099<67697368206e756d626572206f66207375626469726563746f2d>-.18 F 1.608 <726965732c20616c6c206f6620776869636820796f752077>100 700.8 R 1.608 <6f756c64206c696b>-.1 F 4.108<6574>-.1 G 4.108<6f68>-4.108 G -2.25 -.2 <61762065>-4.108 H<626f6f6b6d61726b>4.308 E 4.108<65642e204966>-.1 F 1.608<746865207375626469726563746f72696573206861>4.108 F 1.908 -.15 <76652064>-.2 H<697374696e637469>.15 E -.15<7665>-.25 G .121 <6e616d657320746869732063616e206265206163686965>100 712.8 R -.15<7665> -.25 G 2.621<6469>.15 G 2.621<6e6f>-2.621 G .121<6e652066656c6c207377> -2.621 F .12<6f6f70206279206d61726b696e672074686520706172656e7420646972 6563746f72792061732061>-.1 F F1<706f7274616c>2.62 E F0 2.62<2e54>C .12 <686973206973>-2.62 F .453<73696d696c617220746f20616464696e672074686520 706172656e74206469726563746f727920746f2074686520434450>100 724.8 R -1.11 <4154>-.92 G 2.953<4865>1.11 G -.4<6e76>-2.953 G .453 <69726f6e6d656e742076>.4 F .453<61726961626c652c2065>-.25 F .453 <786365707420746861742061707061726978>-.15 F <6170706172697820312e3030342c2031312d303632>20 768 Q 2.5<334d>122.35 G <61722032303131>-2.5 E<33>205.67 E 0 Cg EP %%Page: 4 4 %%BeginPageSetup BP %%EndPageSetup /F0 10/Times-Roman@0 SF 145.125<617070617269782831292055534552>20 48 R 147.625<434f4d4d414e44532061707061726978283129>2.5 F .942<626f6f6b6d6172 6b7320617265206e6f742070617274206f6620746865206364206e616d6573706163652e 204974206973206172>100 84 R .942<6775656420696e>-.18 F/F1 10 /Times-Bold@0 SF<4e4f>3.442 E<544553>-.4 E F0 .941 <746861742074686973206973206120676f6f64207468696e672e>3.441 F <436f6e736964657220746869733a>100 96 Q/F2 10/Courier@0 SF<2f686f6d652f63 76732f6261676765722f626f656d656c2f6d636c2f6d636c2f7372633e>100 120 Q F1 <6c73>6 E F2 36<616c69656e2f204356532f>100 132 R 30 <696d70616c612f204d616b6566696c652e616d>54 F 36 <524541444d452073686d63782f>12 F 36<61747469632f20676972616666652f>100 144 R 48<6c69622f204d616b6566696c652e696e>30 F 42 <7368636c2f2073686d782f>12 F 24 <636f6e747269622f20676d6f6e2e6f7574204d616b6566696c65206d636c2f>100 156 R 36<73686d636c2f207461757275732f>54 F F0 .207 <536f6d65206f6620746865207375626469726563746f72696573206861>100 180 R .508 -.15<7665206e>-.2 H .208 <6f742d736f2d64697374696e6374206e616d65732073756368206173>.15 F/F3 10 /Times-Italic@0 SF<636f6e74726962>2.708 E F0<616e64>2.708 E F3 <6174746963>2.708 E F0 2.708<2c62>C .208<757420746865>-2.908 F 2.708 <7968>-.15 G<617070656e>-2.708 E<746f20626520746865206469726563746f7269 6573206c6561737420766973697465642e>100 192 Q<49737375696e673a>5 E F2<2f 686f6d652f6376732f6261676765722f626f656d656c2f6d636c2f6d636c2f7372633e> 100 216 Q F1<706f7274616c>6 E F2<5b617070617269785d20657870616e64656420 3120706f7274616c20746f2031322064657374696e6174696f6e73>100 228 Q F0 .86< 7969656c647320616c6c206f6620746865207375626469726563746f7269657320617320 64657374696e6174696f6e7320626f6f6b6d61726b>100 252 R .859<65642062792074 6865206c61737420636f6d706f6e656e74206f662074686569722070617468>-.1 F 2.974<6e616d652e20496e636964656e74616c6c79>100 264 R 2.974<2c64>-.65 G .474<69726563746f7279206e616d65732073756368206173>-2.974 F F2<435653> 2.975 E F0 .475<63616e2062652065>2.975 F .475<78706c696369746c792065> -.15 F .475<78636c756465642066726f6d2065>-.15 F .475 <7870616e73696f6e206279>-.15 F 1.573<73657474696e672074686520656e>100 276 R 1.573<7669726f6e6d656e742076>-.4 F<61726961626c65>-.25 E F2 <415050415249584558434c554445>4.073 E F0 1.573 <617070726f7072696174656c7920ad20726566657220746f2073656374696f6e>4.073 F F1<454e56492d>4.073 E -.3<524f>100 288 S<4e4d454e54>.3 E F0<2e>A 1.494 <426f6f6b6d61726b7320726573756c74696e672066726f6d20706f7274616c2065>100 312 R 1.494<7870616e73696f6e20617265206b>-.15 F 1.495 <65707420696e2061207365706172617465207265736f75726365208c6c652028736565> -.1 F F1<46494c4553>3.995 E F0<292e>A<506f7274616c2065>100 324 Q<787061 6e73696f6e732063616e206265207265637265617465642062792069737375696e67> -.15 E F2<61707061726978202d2d726568617368>100 348 Q F0<5468697320697320 75736566756c20746f2072658d6563742061206368616e676520696e2074686520646972 6563746f7279206e616d696e672073747275637475726520756e6465726e656174682061 20706f7274616c2e>100 372 Q/F4 10.95/Times-Bold@0 SF <6475706c69636174652072>20 388.8 Q<65736f6c7574696f6e>-.197 E F0 .697 <4170706172697820616c6c6f>100 400.8 R .697<7773206964656e746963616c2062 6f6f6b6d61726b7320746f20706f696e7420746f20646966>-.25 F .696 <666572656e74206c6f636174696f6e732e>-.25 F .696<5768656e2061736b>5.696 F .696<656420746f20766973697420737563682061>-.1 F <626f6f6b6d61726b2069742077696c6c20627920646566>100 412.8 Q <61756c742070726573656e742061206c697374206f66206f7074696f6e732e>-.1 E <546865>100 436.8 Q F1<2d6661>3.9 E -.1<766f>-.25 G<7572>.1 E F3 <3c6c6973743e>2.5 E F0 1.4<6f7074696f6e2063616e206265207573656420746f20 6175746f6d617465207265736f6c7574696f6e2e>3.9 F F1<3c6c6973743e>3.9 E F0 1.4<697320612073657175656e6365206f662073696e676c65>3.9 F .039 <636861726163746572732c2064657363726962656420667572746865722062656c6f> 100 448.8 R 2.539<772e20546865>-.25 F .039 <6f7264657220696e20776869636820746865>2.539 F 2.539<7961>-.15 G .039 <7265206769>-2.539 F -.15<7665>-.25 G 2.538<6e64>.15 G .038 <656e6f746520746865206f7264657220696e207768696368>-2.538 F .127<7265736f 6c7574696f6e2072756c657320617265206170706c6965642e2054686973206f7074696f 6e206973207479706963616c6c79207573656420696e207468652064658c6e6974696f6e 206f6620746865>100 460.8 R F1<746f>2.628 E F0 <66756e6374696f6e2f616c696173>2.628 E <6f7220696e20746865206261736820636f6d706c6574696f6e20636f64652e>100 472.8 Q<546865>100 496.8 Q F1<2d7069636b>2.684 E F3<3c6e756d3e>2.5 E F0 .184<6f7074696f6e206973207573656420746f207265736f6c76>2.684 F 2.683 <6574>-.15 G 2.683<6f6170>-2.683 G .183<6172746963756c617220646972656374 6f7279206469726563746c792e20546869732069732075736566756c207768656e> -2.683 F .598<796f7520616c7265616479206b6e6f>100 508.8 R 3.098<7777>-.25 G .598<6865726520796f752077>-3.098 F .599<616e7420746f20676f2c20616e6420 7479706963616c6c79207573656420666f7220746865>-.1 F F2<6e6f77>3.099 E F0 .599<626f6f6b6d61726b20696e20636f6e6a756e632d>3.099 F 1.064 <74696f6e2077697468207468652062617368>100 520.8 R F2<7768656e6365>3.564 E F0 1.064<66756e6374696f6e2e20557365>3.564 F F2 1.064 <7768656e6365206e6f77>3.564 F F0 1.064<746f2073656520616e20696e6465> 3.564 F -.15<7865>-.15 G 3.563<646c>.15 G 1.063<697374206f66206e6f> -3.563 F 3.563<7762>-.25 G<6f6f6b2d>-3.563 E .269<6d61726b732e2049742069 7320706f737369626c6520746f20676f20746f2074686520646573697265642064697265 63746f727920627920656e746572696e672074686520626f6f6b6d61726b20696e6465> 100 532.8 R .269<782e20497420697320706f737369626c65>-.15 F<746f20627970 617373207468652073656c656374696f6e20737465702062792073706563696679696e67> 100 544.8 Q F2<7768656e6365206e6f77204e>2.5 E F0<2e>A 1 <4475706c6963617465732061726520616c6c6f>100 568.8 R 1 <77656420626563617573652069742063616e2062652075736566756c20746f206f>-.25 F -.15<7665>-.15 G 1 <727772697465206120626f6f6b6d61726b20776974682061206e65>.15 F 3.5<776c> -.25 G<6f636174696f6e2e>-3.5 E <546865206f6c6420626f6f6b6d61726b206973206b>100 580.8 Q <6570742061732061206d6174746572206f6620706f6c6963>-.1 E<792e20557365> -.15 E F1<2d736d>2.5 E F0<746f2065>2.5 E <78706c696369746c7920737175617368206475706c6963617465732e>-.15 E<6c>100 604.8 Q F3<6c65>17.22 E<76656c>-.15 E F0 2.5<3b70>C <72656665722070617468732077697468206665>-2.5 E <77657220636f6d706f6e656e74732e>-.25 E 13.89<4c72>100 628.8 S -2.15 -.25 <65762065>-13.89 H<727365206f66207468652061626f>.25 E -.15<7665>-.15 G <2e>.15 E<6f>100 652.8 Q F3 1.307<626f6f6b6d61726b206f72>15 F<646572> -.37 E F0 3.807<3b70>C 1.307<7265666572206f6c64657220656e74726965732e> -3.807 F 1.308<456e747269657320617070656172696e67206561726c69657220696e 20746865208c6c652061726520636f6e73696465726564>6.307 F<6f6c646572>120 664.8 Q 3.595<2c62>-.4 G 1.095<7574207468652061637475616c2064617465206f 66206372656174696e672074686520626f6f6b6d61726b206973206e6f742073746f7265 642e>-3.795 F 1.094<526566657220746f>6.094 F F1 1.094 <65646974696e6720626f6f6b2d>3.594 F<6d61726b73>120 676.8 Q F0 <666f72206d6f726520696e666f726d6174696f6e2e>2.5 E 12.78<4f72>100 700.8 S -2.15 -.25<65762065>-12.78 H<727365206f66207468652061626f>.25 E -.15 <7665>-.15 G<2e>.15 E<72>100 724.8 Q F3 -.37<7265>16.67 G <67756c6172208c72>-.03 E<7374>-.1 E F0 2.5<3b70>C<7265666572207265>-2.5 E<67756c617220626f6f6b6d61726b73206f>-.15 E -.15<7665>-.15 G 2.5<7270> .15 G<6f7274616c2065>-2.5 E<7870616e73696f6e2e>-.15 E <6170706172697820312e3030342c2031312d303632>20 768 Q 2.5<334d>122.35 G <61722032303131>-2.5 E<34>205.67 E 0 Cg EP %%Page: 5 5 %%BeginPageSetup BP %%EndPageSetup /F0 10/Times-Roman@0 SF 145.125<617070617269782831292055534552>20 48 R 147.625<434f4d4d414e44532061707061726978283129>2.5 F 13.33<5272>100 84 S -2.15 -.25<65762065>-13.33 H<727365206f66207468652061626f>.25 E -.15 <7665>-.15 G<2e>.15 E .484<496620746865726520617265207374696c6c20746965 73206166746572207468652073706563698c65642072756c6573206861>100 108 R .785 -.15<76652062>-.2 H .485 <65656e206170706c69656420617070617269782077696c6c2073696d706c792074616b> .15 F 2.985<6574>-.1 G .485<6865208c727374>-2.985 F 1.234 <6d61746368696e67206f7074696f6e2e20546869732062656861>100 120 R 1.234<76 696f75722063616e6e6f7420626520667572746865722073706563698c65642061732074 68652070726f6772616d20757365732061206e6f6e2d737461626c65>-.2 F <6f72646572696e6720726f7574696e652e>100 132 Q .671 <497420697320616e206162736f6c757465207072657265717569736974652074686174> 100 156 R/F1 10/Times-Bold@0 SF<2d6661>3.171 E -.1<766f>-.25 G<7572>.1 E F0 .672<6973207573656420696e20746865206261736820636f6d706c6574696f6e2063 6f64652e204f746865727769736520636f6d2d>3.171 F .534 <706c6574696f6e2077696c6c2066>100 168 R .533<61696c2028666f722061206475 706c69636174656420626f6f6b6d61726b29207768696c65206170706172697820697320 77>-.1 F .533 <616974696e6720666f7220696e7075742e20526566657220746f2074686520746162> -.1 F<636f6d706c6574696f6e206465736372697074696f6e2062656c6f>100 180 Q <772e>-.25 E/F2 10.95/Times-Bold@0 SF<737562646972>20 196.8 Q <6563746f72792073706563698c636174696f6e>-.197 E F0 2.148<5768656e206a75 6d70696e67202861707061726174696e672920796f752063616e20737065636966792061 6e206164646974696f6e616c207375626469726563746f72792061667465722074686520 626f6f6b6d61726b2e>100 208.8 R<417070617269782077696c6c20617070656e6420 746865207375626469726563746f727920746f207468652064657374696e6174696f6e2e> 100 220.8 Q .194<546869732069732075736566756c20666f722070726f6a65637473 2077697468206469726563746f7279206e6f64657320636f72726573706f6e64696e6720 776974682076>100 244.8 R .194 <657273696f6e732e20417373756d6520796f75206861>-.15 F .494 -.15<76652061> -.2 H <6469726563746f727920737472756374757265207375636820617320746869733a>100 256.8 Q/F3 10/Courier@0 SF<2f782f792f7a2f4f7075734d61676e756d2f76312f> 118 280.8 Q<2f782f792f7a2f4f7075734d61676e756d2f76322f>118 292.8 Q <2f782f792f7a2f4f7075734d61676e756d2f76332f>118 304.8 Q F0 1.216<497420 69732070726f6261626c79206561736965737420746f2073696d706c7920626f6f6b6d61 726b20746865204f7075734d61676e756d206469726563746f727920696e20736f6d6520 77>100 328.8 R 1.216<617920287361792077697468>-.1 F<626f6f6b6d61726b>100 340.8 Q F3<6f6d>3.408 E F0 .908<292e2059>B .908 <6f752063616e207468656e2069737375652027>-1.1 F F3 .908<746f206f6d207632> B F0 3.408<2774>C 3.408<6f6a>-3.408 G .908<756d7020746f>-3.408 F F3 <4f7075734d61676e756d2f7632>3.408 E F0 3.408<2e54>C .908 <686973206973206d6f7265>-3.408 F<8d65>100 352.8 Q .674<7869626c6520616e 64206d61696e7461696e61626c65207468616e206372656174696e6720626f6f6b6d6172 6b73>-.15 F F3<6f6d31>3.174 E F0<2c>A F3<6f6d32>3.174 E F0<2c>A F3 <6f6d33>3.174 E F0 5.674<2e4f>C .675 <6e6520636f756c6420616464204f7075734d61672d>-5.674 F <6e756d206173206120706f7274616c2c2062>100 364.8 Q <757420776974682067656e65726963206e616d65732073756368206173>-.2 E F3 <7631>2.5 E F0<74686973206973206e6f7420612076>2.5 E<6572792065>-.15 E <7874656e6469626c6520617070726f6163682e>-.15 E .711<53656520616c736f2074 68652074616220636f6d706c6574696f6e206465736372697074696f6e2062656c6f>100 388.8 R 3.211<772d69>-.25 G 3.211<7469>-3.211 G 3.211<7370>-3.211 G .71< 6f737369626c6520746f207461622d636f6d706c657465206f6e20737562646972656374 6f72696573>-3.211 F <6f66207468652061707061726978206a756d70206469726563746f72792e>100 400.8 Q F2<74616220636f6d706c6574696f6e>20 417.6 Q F0 .967<546865206261736820 74616220636f6d706c6574696f6e20636f646520646f6573207477>100 429.6 R 3.467 <6f74>-.1 G .968<68696e67732e2046697273742c20697420697320706f737369626c 6520746f207461622d636f6d706c657465206f6e2061707061726978>-3.467 F .764 <626f6f6b6d61726b73207468656d73656c76>100 441.6 R .764<65732c2073686f> -.15 F .763<77696e672061206c697374696e67206f6620616c6c2061>-.25 F -.25 <7661>-.2 G .763<696c61626c6520626f6f6b6d61726b7320286f7220697465726174 696e67207468726f756768207468656d>.25 F .5<696e2063>100 453.6 R .5<79636c 6963206d6f64652c20646570656e64696e67206f6e20796f757220626173682073657474 696e6773292e205365636f6e642c206f6e6365206120626f6f6b6d61726b206861732062 65656e206769>-.15 F -.15<7665>-.25 G 3<6e74>.15 G<6162>-3 E 1.47 <636f6d706c6574696f6e2077696c6c206c697374206f722069746572617465206f>100 465.6 R -.15<7665>-.15 G 3.969<7261>.15 G 1.469<6c6c20746865207375626469 726563746f72696573206f6620746865206469726563746f7279206173736f6369617465 6420776974682074686174>-3.969 F .045<626f6f6b6d61726b2e2053706563696679 696e67206120737472696e672061667465722074686520626f6f6b6d61726b2077696c6c 206c696d6974207461622d636f6d706c6574696f6e20746f206469726563746f72696573 206d617463682d>100 477.6 R <696e6720746865207368656c6c2d7061747465726e20696e20737472696e672e>100 489.6 Q/F4 10/Times-Italic@0 SF -1.11<5665>5 G<7279>1.11 E F0 <75736566756c2e>2.5 E .636<4265206361726566756c20746f206e6f742072656d6f> 100 513.6 R .936 -.15<76652074>-.15 H<6865>.15 E F1<2d6661>3.136 E -.1 <766f>-.25 G<7572>.1 E F4<6c697374>2.5 E F0 .636<6f7074696f6e2066726f6d 20746865206261736820636f6d706c6574696f6e20636f64652e204974206973206e6563 657373617279>3.136 F<746f207265736f6c76>100 525.6 Q 2.5<6564>-.15 G <75706c696361746520626f6f6b6d61726b732e>-2.5 E F2 <65646974696e6720626f6f6b6d61726b73>20 542.4 Q F0 .498 <4170706172697820617070656e6473206e65>100 554.4 R 2.998<7762>-.25 G .498 <6f6f6b6d61726b7320746f2074686520656e64206f6620746865202e61707061726978 7263208c6c652e204e6f7468696e672073746f707320796f752066726f6d20656469742d> -2.998 F .818 <696e6720746865208c6c652c20616e64207468697320697320696e2066>100 566.4 R .817<616374207265636f6d6d656e64656420696620666f722065>-.1 F .817<78616d 706c6520796f75206e65656420746f2067657420726964206f66206120626f6f6b6d6172 6b>-.15 F .687<616e64206e656974686572206f66>100 578.4 R F1<2d707572> 3.187 E<6765>-.1 E F0<2c>A F1<2d707572>3.187 E<67652d6d61726b>-.1 E F0 <2c>A F1<2d7364>3.187 E F0<2c>A F1<2d736d>3.187 E F0 .687 <66756c8c6c6c7320796f7572206e656564732e2049742077>3.187 F .688 <617320616e20656173792064657369676e2063686f696365>-.1 F<6e6f7420746f2065 717569702061707061726978207769746820656469746f72206361706162696c69746965 732e>100 590.4 Q F2<636f7079696e6720616e64206d6f>20 607.2 Q <76696e67208c6c6573>-.11 E F0<4974206973207374726169676874666f7277>100 619.2 Q<61726420746f20636f70>-.1 E 2.5<796f>-.1 G 2.5<726d>-2.5 G .3 -.15<6f7665208c>-2.5 H<6c657320746f206c6f636174696f6e73206b6e6f>.15 E <776e20627920617070617269782e204578616d706c65733a>-.25 E <6170706172697820312e3030342c2031312d303632>20 768 Q 2.5<334d>122.35 G <61722032303131>-2.5 E<35>205.67 E 0 Cg EP %%Page: 6 6 %%BeginPageSetup BP %%EndPageSetup /F0 10/Times-Roman@0 SF 145.125<617070617269782831292055534552>20 48 R 147.625<434f4d4d414e44532061707061726978283129>2.5 F/F1 10/Courier@0 SF <4241534820616e642076617269616e7473>100 84 Q <637020464f4f20242861707061726978207a6f656d29>118 96 Q <6d762042415220242861707061726978207a6f656d20646f6329>118 108 Q <6d762042415220242861707061726978207a6f656d20646f63292f74657374>118 120 Q<43534820616e642076617269616e7473>100 144 Q <637020464f4f206061707061726978207a6f656d60>118 156 Q <6d7620424152206061707061726978207a6f656d20646f63602f74657374>118 168 Q /F2 10.95/Times-Bold@0 SF<6c697374696e6720626f6f6b6d61726b73>20 196.8 Q F0 1.707<53696d706c792069737375696e672061707061726978206769>100 208.8 R -.15<7665>-.25 G 4.207<7379>.15 G 1.707<6f752061206c697374206f6620626f6f 6b6d61726b732067726f7570656420696e746f2074687265652063617465>-4.207 F 1.706<676f726965732c20706f7274616c732c>-.15 F -.15<6578>100 220.8 S .426 <70616e73696f6e732c20616e6420626f6f6b6d61726b732e2055736520746865>.15 F /F3 10/Times-Bold@0 SF<2d64>2.926 E F0 .427<6f7074696f6e20746f2064756d70 20746865207265736f75726365208c6c6520746f205354444f55542065>2.927 F .427 <786163746c79206173>-.15 F .382<69742069732e20546869732063616e2062652075 736566756c207768656e20796f7520696e74656e6420746f2075736520746865>100 232.8 R F3<2d75>2.882 E/F4 10/Times-Italic@0 SF<6e756d>2.5 E F0 .381 <6f7074696f6e20746f2072656d6f>2.881 F .681 -.15<76652062>-.15 H .381 <6f6f6b6d61726b73206f7220706f72>.15 F<2d>-.2 E <74616c7320746861742077657265206d6f737420726563656e746c792061646465642e> 100 244.8 Q<557365>100 268.8 Q F3<2d6c>3.13 E F0 .63 <746f206c69737420616c6c2061>3.13 F -.25<7661>-.2 G .631<696c61626c65206a 756d707320776974686f75742074686569722064657374696e6174696f6e732e>.25 F .631<546865206a756d7073206172652067726f7570656420696e746f2065>5.631 F <7870616e2d>-.15 E <73696f6e7320726573756c74696e672066726f6d20706f7274616c7320616e64207265> 100 280.8 Q<67756c617220626f6f6b6d61726b732e>-.15 E F2 -.197<7265>20 297.6 S<706c6163696e67206364>.197 E F0 -.4<5769>100 309.6 S 1.151 <74682074686520737570706c6965642064658c6e6974696f6e287329206f66>.4 F F3 <746f>3.651 E F0 3.651<2c61>C 1.15<7070617269782077696c6c208c7273742073 6565207768657468657220746865206d61726b20697320746865206e616d65206f662061> -3.651 F<6469726563746f7279>100 321.6 Q 3.18<2c61>-.65 G .68<6363657373 69626c652066726f6d207468652063757272656e74206469726563746f72792e>-3.18 F 3.18<4164>5.68 G .68 <69726563746f72792069732061636365737369626c652069662069742077>-3.18 F .68<6f756c6420626520612076>-.1 F<616c6964>-.25 E<6172>100 333.6 Q .405< 67756d656e7420746f2063642c20736f206974206e656564206e6f74206e656365737361 72696c792062652061207375626469726563746f7279206f66207468652063757272656e 74206469726563746f72792e20496620746865206d61726b>-.18 F .56 <6973206e6f7420616e2061636365737369626c65206469726563746f7279>100 345.6 R 3.06<2c61>-.65 G .561<7070617269782077696c6c207468656e2074727920746f20 646f2061206c6f6f6b7570206f6620746865206d61726b20696e2074686520626f6f6b6d 61726b>-3.06 F .866<8c6c65732e20546869732062656861>100 357.6 R .866 <76696f75722063616e20626520696e>-.2 F -.15<7665>-.4 G .866<727465642074 6f20646f20746865206c6f6f6b7570208c72737420616e64207468652063757272656e74 206469726563746f727920746865726561667465722e>.15 F .148 <426f7468206d6f6465732063616e206265207573656420746f206d616b>100 369.6 R <65>-.1 E F3<746f>2.649 E F0 2.649<6164>2.649 G .149 <726f702d696e207265706c6163656d656e7420666f72>-2.649 F F4<6364>2.649 E F0 2.649<2e41>C .149<64646974696f6e616c6c7920616e64206167>-2.649 F .149 <61696e2073696d696c6172>-.05 F<746f>100 381.6 Q F4<6364>3.692 E F0<2c>A F1 1.192<27746f202d27>3.692 F F0 1.192<77696c6c2074616b>3.692 F 3.692 <6579>-.1 G 1.192<6f7520746f2074686520707265>-3.692 F 1.192 <76696f7573206469726563746f7279>-.25 F 3.692<2c61>-.65 G 1.192 <6e642073706563696679696e67>-3.692 F F1<746f>3.692 E F0 1.192 <776974686f7574206172>3.692 F<67756d656e7473>-.18 E<77696c6c2074616b>100 393.6 Q 2.5<6579>-.1 G <6f7520746f20796f757220686f6d65206469726563746f72792e>-2.5 E 1.119<5468 65206261736820636f6d706c6574696f6e20636f64652061637473206163636f7264696e 676c79>100 417.6 R 3.619<2c61>-.65 G 1.119<6e642073686f756c64207472616e 73706172656e746c7920636f6d706c657465206f6e20626f7468206d61726b73>-3.619 F<616e64206469726563746f726965732e>100 429.6 Q F2<4f5054494f4e53>20 446.4 Q F0 -.15<466f>100 458.4 S 4.037<7262>.15 G 1.536<6f6f6b6d61726b69 6e6720616e64206a756d70696e672061707061726978206973206265737420696e> -4.037 F -.2<766f>-.4 G -.1<6b65>.2 G 4.036<6462>.1 G 4.036<7975>-4.036 G 1.536<73696e672074686520616c69617365732028746373682d76>-4.036 F 1.536 <617269616e747329206f72>-.25 F 1.722 <66756e6374696f6e73202873682f6261736829206c697374656420696e>100 470.4 R F3<46494c4553>4.223 E F0 6.723<2e41>C 1.723 <707061726978206861732061206665>-6.723 F 4.223<776f>-.25 G 1.723 <7074696f6e732074686174206172652075736566756c20666f72207072756e696e672c> -4.223 F<737175617368696e6720616e64207265686173696e6720626f6f6b6d61726b 732e2054686573652061726520626573742069737375656420627920696e>100 482.4 Q -.2<766f>-.4 G<6b696e672061707061726978206469726563746c792e>.2 E 1.111< 496620796f752061726520696e746572657374656420696e206d61726b73206f72206465 7374696e6174696f6e73206d61746368696e672061206365727461696e20706174746572 6e2c2073696d706c792069737375652061707061726978>100 506.4 R <776974686f7574206172>100 518.4 Q<67756d656e747320616e642070697065206974 207468726f75676820796f75722070726f6772616d206f662063686f6963652e>-.18 E .294<556e617279206f7074696f6e73202874686f736520776974686f7574206172>100 542.4 R .294 <67756d656e74732920757375616c6c792073746172742077697468207477>-.18 F 2.794<6f68>-.1 G .294<797068656e732065>-2.844 F .295 <786365707420666f72207374616e64617264697a6564>-.15 F .548 <6f7074696f6e732073756368206173>100 554.4 R F3<2d68>3.048 E F0 5.548 <2e4f>C .548<7074696f6e7320746861742074616b>-5.548 F 3.048<6561>-.1 G 3.048<6e61>-3.048 G -.18<7267>-3.048 G .547 <756d656e742063616e20626520636f6e>.18 F -.15<7665>-.4 G .547 <7274656420746f206120756e617279206b>.15 F -.15<6579>-.1 G<3d76>.15 E .547<616c7565206e6f74612d>-.25 F<74696f6e2c20652e672e>100 566.4 Q F3 <2d707572>2.5 E<67652d6d61726b2066>-.1 E<6f6f>-.25 E F0<69732065717569> 2.5 E -.25<7661>-.25 G<6c656e7420746f>.25 E F3<2d2d707572>2.5 E <67652d6d61726b>-.1 E F0<3d>A F3 -.25<666f>C<6f>.25 E F0<2e>A <5768656e20696e>100 590.4 Q -.2<766f>-.4 G -.1<6b65>.2 G 2.5<6477>.1 G <6974686f7574206172>-2.5 E<67756d656e747320617070617269782077696c6c2073 696d706c792064756d702069747320626f6f6b6d61726b732e>-.18 E F3 <2d2d6164642d6d61726b>100 614.4 Q F0<28>2.5 E F4 <616464206a756d7020626f6f6b6d61726b>A F0<29>A 3.633 <54686973206f7074696f6e732065>120 626.4 R 3.633 <78706563747320747261696c696e67>-.15 F F4 3.633 <5b6d61726b205b64657374696e6174696f6e5d5d>6.133 F F0<6172>6.133 E 6.134 <67756d656e742873292e20426f7468>-.18 F<6172>6.134 E 3.634 <67756d656e747320617265>-.18 F .116 <6f7074696f6e616c2e20496620612073696e676c65206172>120 638.4 R .116 <67756d656e74206973206769>-.18 F -.15<7665>-.25 G 2.615<6e69>.15 G 2.615 <7469>-2.615 G 2.615<7369>-2.615 G .115<6e746572707265746564206173206120 626f6f6b6d61726b206e616d6520746f206265206d617070656420746f>-2.615 F 1.114<7468652063757272656e74206469726563746f72792e>120 650.4 R 1.114 <4966207477>6.114 F 3.614<6f61>-.1 G -.18<7267>-3.614 G 1.115 <756d656e747320617265206769>.18 F -.15<7665>-.25 G 3.615<6e74>.15 G 1.115<6865206c617374206172>-3.615 F 1.115<67756d656e742069732074616b> -.18 F 1.115<656e2061732074686520746172>-.1 F<676574>-.18 E .441 <6469726563746f72792e204966206e6f206172>120 662.4 R .441 <67756d656e74206973206769>-.18 F -.15<7665>-.25 G 2.941<6e61>.15 G .441< 7070617269782077696c6c20656e6c697374207468652063757272656e74206469726563 746f7279206173206120746172>-2.941 F .44<67657420626f6f6b2d>-.18 F <6d61726b>120 674.4 Q<65642062792074686520747261696c696e6720636f6d706f6e 656e74206f6620746865206469726563746f727920706174682e>-.1 E F3 <2d2d6164642d706f7274616c>100 698.4 Q F0<28>2.5 E F4 <61646420706f7274616c20626f6f6b6d61726b>A F0<29>A 1.269<54686973206f7074 696f6e20656e6c697374732061206469726563746f7279206173206120706f7274616c20 616e64206164647320616c6c207375626469726563746f7269657320617320626f6f6b6d 61726b732e20546865>120 710.4 R 2.11<6e616d65206f662074686520626f6f6b6d61 726b2069732073696d706c7920746865206e616d65206f66207468652073756264697265 63746f72792e20427920646566>120 722.4 R 2.11 <61756c74207468652063757272656e74>-.1 F <6170706172697820312e3030342c2031312d303632>20 768 Q 2.5<334d>122.35 G <61722032303131>-2.5 E<36>205.67 E 0 Cg EP %%Page: 7 7 %%BeginPageSetup BP %%EndPageSetup /F0 10/Times-Roman@0 SF 145.125<617070617269782831292055534552>20 48 R 147.625<434f4d4d414e44532061707061726978283129>2.5 F 1.034 <6469726563746f7279206973206164646564206173206120706f7274616c2e>120 84 R 1.035<416e206f7074696f6e616c20747261696c696e67206172>6.035 F 1.035 <67756d656e742077696c6c206f>-.18 F -.15<7665>-.15 G 1.035 <727269646520746869732062656861>.15 F<76696f7572>-.2 E<616e6420696e7374 65616420626520696e7465727072657465642061732074686520706f7274616c206c6f63 6174696f6e2e>120 96 Q/F1 10/Times-Bold@0 SF<2d2d7472792d63757272>100 120 Q<656e742d8c727374>-.18 E F0<28>2.5 E/F2 10/Times-Italic@0 SF <7472792063757272>A<656e7420646972>-.37 E<6563746f7279206265666f72>-.37 E 2.5<656c>-.37 G<6f6f6b7570>-2.5 E F0<29>A .879<54686973206f7074696f6e 2069732075736566756c20696e207468652064658c6e6974696f6e206f6620746865>120 132 R F1<746f>3.379 E F0 .878 <777261707065722e204265666f726520617474656d7074696e6720616e>3.379 F 3.378<796c>-.15 G .878<6f6f6b7570206f66>-3.378 F 1.241<746865206d61726b 2c206170706172697820746573747320776865746865722074686520737570706c696564 206d61726b2065>120 144 R 1.242<7869737473206173206120737562646972656374 6f727920696e207468652063757272656e74>-.15 F<6469726563746f72792e20496620 697420646f65732c20746865206d61726b2069732073696d706c792065>120 156 Q <7870616e64656420746f20697473656c662e>-.15 E F1<2d2d7472792d63757272>100 180 Q<656e742d6c617374>-.18 E F0<28>2.5 E F2<7472792063757272>A <656e7420646972>-.37 E<6563746f7279206966206c6f6f6b7570206661696c73>-.37 E F0<29>A .201<54686973206f7074696f6e2069732075736566756c20696e20746865 2064658c6e6974696f6e206f6620746865>120 192 R F1<746f>2.701 E F0 .201 <777261707065722e204966206c6f6f6b7570206f6620746865206d61726b2066>2.701 F .201<61696c732c2061707061726978>-.1 F .566 <746573747320776865746865722074686520737570706c696564206d61726b2065>120 204 R .566<78697374732061732061207375626469726563746f727920696e20746865 2063757272656e74206469726563746f72792e20496620697420646f65732c>-.15 F <746865206d61726b2069732073696d706c792065>120 216 Q <7870616e64656420746f20697473656c662e>-.15 E F1 <2d2d6e6f746966792d63757272>100 240 Q<656e74>-.18 E F0<28>2.5 E F2 <6e6f746966792069662063757272>A<656e7420646972>-.37 E <6563746f72792069732075736564>-.37 E F0<29>A .061<54686973206f7074696f6e 2069732075736566756c20696e207468652064658c6e6974696f6e206f6620746865>120 252 R F2<6266>2.561 E F0 .06 <7772617070657220696e20636f6e6a756e6374696f6e207769746820656974686572> 2.561 F F1<2d2d7472792d637572>2.56 E<2d>-.37 E -.18<7265>120 264 S <6e742d8c727374>.18 E F0<6f72>2.827 E F1<2d2d7472792d63757272>2.827 E <656e742d6c617374>-.18 E F0 5.327<2e49>C 2.827<6674>-5.327 G .327<686520 6d61726b20697320666f756e642061732061207375626469726563746f727920696e2074 68652063757272656e742064697265632d>-2.827 F<746f7279>120 276 Q 2.5<2c61> -.65 G <707061726978206e6f74698c6573207468652075736572206f6620746869732066>-2.5 E<61637420286f6e2074686520646961676e6f737469632073747265616d292e>-.1 E F1<2d736d>100 300 Q F0<3c6d61723e2028>2.5 E F2<7371756173682072>A <65706561746564206d61726b73>-.37 E F0<29>A .422<417070617269782077696c6c 2073717561736820626f6f6b6d61726b732077697468206d61726b>120 312 R/F3 10 /Courier@0 SF<3c6d61726b3e>2.922 E F0 5.422<2e54>C .422 <6869732069732075736566756c207768656e2061206d61726b20706f696e747320746f> -5.422 F 2.5<6176>120 324 S<657273696f6e65642070726f6a6563742c20616e6420 7468652070726f6a656374206973207570646174656420746f2061206e65>-2.65 E 2.5 <7776>-.25 G<657273696f6e20616e642061206e65>-2.65 E 2.5<7764>-.25 G <69726563746f72792e>-2.5 E .312<417070617269782077696c6c20627920646566> 120 348 R .313<61756c74206b>-.1 F .313<65657020746865206c617374206f6e65 206f6363757272696e6720696e20746865207265736f75726365208c6c652028636f7272 6573706f6e64696e672077697468>-.1 F F1<2d6661>120 360 Q -.1<766f>-.25 G <7572204f>.1 E F0 .613 <292e2054686973206f7074696f6e20726573706563747320746865>B F1<2d6661> 3.113 E -.1<766f>-.25 G<7572>.1 E F0 .612<6f7074696f6e206966206769>3.113 F -.15<7665>-.25 G .612 <6e2e204475706c69636174696e6720616e20616c72656164792065>.15 F <786973742d>-.15 E 2.004<696e67206d61726b2063616e2062652075736566756c20 7768656e206974206964656e74698c657320612070726f6a65637420666f722077686963 682074686520756e6465726c79696e67206469726563746f7279>120 372 R 1.191 <6368616e6765732065>120 384 R -.15<7665>-.25 G 1.191<7279206f6e63652069 6e2061207768696c652028652e672e207468652070726f6a65637420697320646f>.15 F 1.19<776e6c6f616465642066726f6d2065>-.25 F 1.19 <787465726e616c20736f757263657320616e64>-.15 F .715 <636f6d657320776974682076>120 396 R .715<657273696f6e20696e666f726d6174 696f6e292e204974206973206e6f74207374726963746c79206e65636573736172792074 6f2073717561736820626f6f6b6d61726b732073696e6365>-.15 F F1<746f>3.216 E F0 .248<66756e6374696f6e732f6d6163726f7320746861742061726520657175697070 6564207769746820746865>120 408 R F1<2d6661>2.747 E -.1<766f>-.25 G<7572> .1 E F0 .247<6f7074696f6e2077696c6c2067656e6572616c6c79207265736f6c76> 2.747 F 2.747<6564>-.15 G<75706c6963617465>-2.747 E<6d6174636865732e>120 420 Q F1<2d7364>100 444 Q F0<3c6d61726b3e2028>2.5 E F2<7371756173682072> A<657065617465642064657374696e6174696f6e73>-.37 E F0<29>A 1.397<416c6c20 6f7468657220626f6f6b6d61726b732077697468207468652073616d652064657374696e 6174696f6e206173>120 456 R F3<3c6d61726b3e>3.898 E F0 1.398 <6172652072656d6f>3.898 F -.15<7665>-.15 G 3.898<642e2054686973>.15 F 1.398<69732075736566756c>3.898 F 1.199<7768656e2061206769>120 468 R -.15 <7665>-.25 G 3.699<6e64>.15 G 1.198<657374696e6174696f6e2068617320616371 7569726564206d756c7469706c6520626f6f6b6d61726b7320616e6420796f7520646563 69646520746f20736574746c65206f6e2061>-3.699 F -.1<6661>120 480 S -.2 <766f>-.1 G<75726974652e>.2 E F1<2d6c6d>100 504 Q F0<3c6d61726b3e2028> 2.5 E F2<6c69737420626f6f6b6d61726b7320776974682074686973206d61726b>A F0 <29>A<4974206c6973747320616c6c20626f6f6b6d61726b73>120 516 Q F3 <3c6d61726b3e>2.5 E F0<286e6f74696e672074686174206974206d617920706f696e 7420746f206d756c7469706c65206c6f636174696f6e73292e>2.5 E F1<2d6c64>100 540 Q F0<3c6d61726b3e2028>2.5 E F2<6c6973742072>A <657065617465642064657374696e6174696f6e73>-.37 E F0<29>A .42 <54686973206c6973747320616c6c20626f6f6b6d61726b73>120 552 R F3 <3c6d61726b3e>2.92 E F0 .42<286e6f74696e672074686174206974206d617920706f 696e7420746f206d756c7469706c65206c6f636174696f6e732920616e6420616464692d> 2.92 F .286<74696f6e616c6c79206c6973747320616c6c206f7468657220626f6f6b6d 61726b732074686174207368617265207468652064657374696e6174696f6e2077697468 20616e>120 564 R 2.785<796f>-.15 G 2.785<6674>-2.785 G .285 <6865208c72737420626f6f6b6d61726b732e>-2.785 F<5468697320616c6c6f>120 576 Q<7773206f6e6520746f207072656469637420746865206566>-.25 E <66656374206f662069737375696e67>-.25 E F3 <61707061726978202d7364203c6d61726b3e>2.5 E F0<2e>A F1<2d707572>100 600 Q<6765>-.1 E F0<7061742028>2.5 E F2<64656c65746520626f6f6b6d61726b73>A F0<29>A .454<546869732064656c6574657320626f6f6b6d61726b7320776865726520 64657374696e6174696f6e206d617463686573>120 612 R F2<706174>2.955 E F0 5.455<2e41>C .455 <6c6c2064656c6574656420626f6f6b6d61726b7320617265207072696e746564>-5.455 F .106<746f205354444f55542e205468757320696620796f75207265>120 624 R .106 <677265742064656c6574696e67206120626f6f6b6d61726b2069742069732065617379 20746f20616464206974206261636b2e20506f7274616c2073706563698c2d>-.15 F <636174696f6e7320617265206e65>120 636 Q -.15<7665>-.25 G 2.5<7261>.15 G -.25<6666>-2.5 G<65637465642e>.25 E F1<2d707572>100 660 Q <67652d6d61726b>-.1 E F0<28>2.5 E F2<706174>A F0<29>A<546869732064656c65 74657320626f6f6b6d61726b73207768657265206d61726b206d617463686573>120 672 Q F2<706174>2.5 E F0 5<2e50>C <6f7274616c2073706563698c636174696f6e7320617265206e65>-5 E -.15<7665> -.25 G 2.5<7261>.15 G -.25<6666>-2.5 G<65637465642e>.25 E F1<2d64>100 696 Q F0<28>2.5 E F2<64756d702072>A<65736f7572>-.37 E <6365208c6c6520746f205354444f5554>-.37 E F0<29>A <44756d70207265736f75726365208c6c6520746f205354444f55542e>120 708 Q <6170706172697820312e3030342c2031312d303632>20 768 Q 2.5<334d>122.35 G <61722032303131>-2.5 E<37>205.67 E 0 Cg EP %%Page: 8 8 %%BeginPageSetup BP %%EndPageSetup /F0 10/Times-Roman@0 SF 145.125<617070617269782831292055534552>20 48 R 147.625<434f4d4d414e44532061707061726978283129>2.5 F/F1 10/Times-Bold@0 SF<2d6c>100 84 Q F0<28>2.5 E/F2 10/Times-Italic@0 SF <6c69737420617661696c61626c65206a756d7073>A F0<29>A 1.935<4c6973742061> 120 96 R -.25<7661>-.2 G 1.935<696c61626c65206a756d70732070617261677261 70682d7374796c652e20506f7274616c2073706563698c636174696f6e73207468656d73 656c76>.25 F 1.936<6573206172652065>-.15 F 1.936 <78636c756465642c20616e64>-.15 F<7265>120 108 Q .047<67756c6172206a756d 707320616e64206a756d707320726573756c74696e672066726f6d20706f7274616c2065> -.15 F .046 <7870616e73696f6e7320617265206c697374656420756e64657220646966>-.15 F .046<666572656e7420686561646572732e>-.25 F F1<2d75>100 132 Q F0 <3c6e756d3e2028>2.5 E F2 -.37<7265>C<6d6f>.37 E <7665206c617374203c6e756d3e206164646974696f6e73>-.1 E F0<29>A<52656d6f> 120 144 Q .3 -.15<7665206c>-.15 H<617374203c6e756d3e206164646974696f6e73 2e20506f7274616c2073706563698c636174696f6e7320616e64207265>.15 E <67756c6172206a756d707320617265207472656174656420616c696b>-.15 E<652e> -.1 E F1<2d2d72>100 168 Q<6568617368>-.18 E F0<28>2.5 E F2 -.37<7265>C <2d65>.37 E<7870616e6420706f7274616c20626f6f6b6d61726b73>-.2 E F0<29>A 1.496<417070617269782077696c6c2072657265616420746865207265736f7572636520 8c6c6520616e6420726565>120 180 R 1.497<7870616e6420706f7274616c206c6f63 6174696f6e732e2055736566756c206966206469726563746f72696573>-.15 F<6861> 120 192 Q 1.145 -.15<76652062>-.2 H .844 <65656e2061646465642c2072656e616d65642c206f722072656d6f>.15 F -.15<7665> -.15 G .844<642e20526566657220746f2073656374696f6e>.15 F F1<454e564952> 3.344 E<4f4e4d454e54>-.3 E F0 .844<666f7220746865206566>3.344 F <66656374>-.25 E<746861742074686520656e>120 204 Q <7669726f6e6d656e742076>-.4 E<61726961626c65>-.25 E/F3 10/Courier@0 SF <415050415249584558434c554445>2.5 E F0<686173206f6e20706f7274616c2065> 2.5 E<7870616e73696f6e2e>-.15 E F1<2d6661>100 228 Q -.1<766f>-.25 G <7572>.1 E F0<3c6c6973743e2028>2.5 E F2<736574206475706c69636174652072>A <65736f6c7574696f6e20706f6c696379>-.37 E F0<29>A F1<2d7069636b>100 240 Q F0<3c6e756d3e2028>2.5 E F2<696d6d656469617465206475706c69636174652072>A <65736f6c7574696f6e>-.37 E F0<29>A<5468657365206f7074696f6e73206861>120 252 Q .3 -.15<766520612073>-.2 H<656374696f6e20746f207468656d73656c76> .15 E<65732e20526566657220746f>-.15 E F1<6475706c69636174652072>2.5 E <65736f6c7574696f6e>-.18 E F0<2e>A F1<2d2d637764>100 276 Q F0<28>2.5 E F2<7573652067>A<65746377642833292c206e6f7420707764283129>-.1 E F0<29>A .451<427920646566>120 288 R .451 <61756c74206170617269782075736573207468652070726f6772616d>-.1 F F2 <707764>2.951 E F0 .452 <28312920726174686572207468616e207468652073797374656d2063616c6c>B F2 -.1 <6765>2.952 G<74637764>.1 E F0 .452<2833292e204f6e20736f6d65>B 1.459 <73797374656d732069742077>120 300 R 1.458<617320666f756e6420746861742074 6865206c617474657220726573756c747320696e207061746873207468617420636f6e74 61696e206d616368696e652d73706563698c63206d6f756e74>-.1 F 2.5 <636f6d706f6e656e74732e204170707061726978>120 312 R<77696c6c20757365>2.5 E F2 -.1<6765>2.5 G<74637764>.1 E F0<283329207768656e>A F1<2d2d637764> 2.5 E F0<697320757365642e>2.5 E F1<2d2d7368656c6c2d6578616d706c6573>100 336 Q F0<28>2.5 E F2<6f75747075742065>A<78616d706c65206d616372>-.2 E <6f73>-.45 E F0<29>A<54686973206f7574707574732065>120 348 Q <78616d706c65206d6163726f732e20546865>-.15 E 2.5<7961>-.15 G <726520616c736f206c697374656420696e20746865>-2.5 E F1<46494c4553>2.5 E F0<73656374696f6e2074686f7567682e>2.5 E F1<2d2d62>100 372 Q<75>-.2 E F0 <28>2.5 E F2<6372>A<6561746520626163>-.37 E<6b7570206f66207468652072>-.2 E<65736f7572>-.37 E<6365208c6c65>-.37 E F0<29>A<546869732063726561746573 20746865206261636b7570208c6c6520696e202e6170706172697872632e62>120 384 Q <752e>-.2 E F1<2d62>100 408 Q<75>-.2 E F0<666e616d652028>2.5 E F2<6372>A <6561746520626163>-.37 E<6b7570206f66207468652072>-.2 E<65736f7572>-.37 E<6365208c6c65>-.37 E F0<29>A <54686973206372656174657320746865206261636b7570208c6c6520696e>120 420 Q F2<666e616d65>2.5 E F0 2.5<2e55>C<7365>-2.5 E F1<2d64>2.5 E F0<6f72>2.5 E F1<2d62>2.5 E 2.5<752d>-.2 G F0<746f2064756d7020746f205354444f55542e>A F1<2d68>100 444 Q F0<28>2.5 E F2<73686f772073796e6f70736973>A F0<29>A F1 <2d2d617072>100 456 Q<6f706f73>-.18 E F0<28>2.5 E F2 <73686f772073796e6f70736973>A F0<29>A <7072696e742073796e6f70736973206f6620616c6c206f7074696f6e73>120 468 Q/F4 10.95/Times-Bold@0 SF<454e564952>20 484.8 Q<4f4e4d454e54>-.329 E F0 <415050>100 496.8 Q<415249584558434c554445>-.92 E .099<546869732076>120 508.8 R .099<61726961626c652073706563698c65732065>-.25 F .099 <78636c7573696f6e2062656861>-.15 F .099 <76696f7572207768656e20706f7274616c73206172652065>-.2 F .099 <7870616e646564207769746820746865>-.15 F F3<2d2d726568617368>2.6 E F0 2.5<6f7074696f6e2e204974>120 520.8 R<6861732074686520666f6c6c6f>2.5 E <77696e672073796e7461783a>-.25 E F3<3c5b3a2c5d5b3c737472696e673e5d3e2b> 138 544.8 Q F0 .125<546861742069732c2061206c697374206f66206e616d65732077 6974682065616368206e616d65207072656365646564206279206120636f6c6f6e206f72 206120636f6d6d612e>120 568.8 R 2.624<4163>5.124 G .124 <6f6c6f6e20696e64696361746573>-2.624 F<74686174>120 580.8 Q F3 <3c737472696e673e>3.164 E F0 .664<74726967676572732065>3.164 F .664<7863 6c7573696f6e206f66206469726563746f7279206e616d657320666f7220776869636820 74686520747261696c696e6720636f6d706f6e656e74206973>-.15 F .881 <6964656e746963616c20746f>120 592.8 R F3<3c737472696e673e>3.381 E F0 5.881<2e41>C .881<636f6d6d6120696e646963617465732074686174>-2.5 F F3 <3c737472696e673e>3.381 E F0 .881<74726967676572732065>3.381 F .881 <78636c7573696f6e206f662064697265632d>-.15 F .002<746f7279206e616d657320 666f722077686963682074686520747261696c696e6720636f6d706f6e656e7420636f6e 7461696e73>120 604.8 R F3<3c737472696e673e>2.503 E F0 .003 <6173206120737562737472696e672e>2.503 F<436f6e73696465723a>5.003 E F3 <6578706f727420415050415249584558434c5544453d3a4356533a6c69622c746d70> 138 628.8 Q 6<23412d65>48 G<78616d706c65>-6 E <6578706f727420415050415249584558434c5544453d2c>138 640.8 Q 6<23422d63> 114 G<7572696f73697479>-6 E F0 .546<546865208c7273742065>120 664.8 R .546<78636c75646573206469726563746f7279206e616d6573>-.15 F F3<435653> 3.046 E F0<616e64>3.045 E F3<6c6962>3.045 E F0 .545<616e6420616e>3.045 F 3.045<7964>-.15 G .545<69726563746f7279206e616d65206861>-3.045 F <76696e67>-.2 E F3<746d70>3.045 E F0 .545<61732061>3.045 F 4 <737562737472696e672e20546865>120 676.8 R 1.501<7365636f6e642065>4 F 1.501<78616d706c652077696c6c206566>-.15 F<6665637469>-.25 E -.15<7665> -.25 G 1.501<6c792064697361626c6520706f7274616c732c20617320697420737065 8c636965732074686520656d707479>.15 F<737472696e672077686963682069732061 20737562737472696e67206f6620616c6c20737472696e67732e>120 688.8 Q<415050> 100 712.8 Q<4152495854>-.92 E -.4<4147>-.93 G .339<546869732076>120 724.8 R .339<61726961626c652c206966207365742c20697320696e636f72706f7261 74656420696e746f20746865206e616d6573206f66207468652061707061726978207265 736f75726365208c6c65732e20427920646566>-.25 F<61756c74>-.1 E <6170706172697820312e3030342c2031312d303632>20 768 Q 2.5<334d>122.35 G <61722032303131>-2.5 E<38>205.67 E 0 Cg EP %%Page: 9 9 %%BeginPageSetup BP %%EndPageSetup /F0 10/Times-Roman@0 SF 145.125<617070617269782831292055534552>20 48 R 147.625<434f4d4d414e44532061707061726978283129>2.5 F .628 <746865736520617265>120 84 R/F1 10/Courier@0 SF<2e617070617269787263> 3.128 E F0<616e64>3.128 E F1<2e61707061726978657870616e64>3.128 E F0 5.628<2e57>C .628<68656e20415050>-5.628 F<4152495854>-.92 E 1.428 -.4 <41472069>-.93 H 3.128<7373>.4 G .628<657420746f>-3.128 F F1<3c7461673e> 3.128 E F0<746865>120 96 Q 2.503<7962>-.15 G<65636f6d65>-2.503 E F1 <2e3c7461673e617070617269787263>2.503 E F0<616e64>2.502 E F1 <2e3c7461673e61707061726978657870616e64>2.502 E F0 5.002<2e54>C .002 <6869732063616e206265207573656420652e672e>-5.002 F <746f206d61696e7461696e20646966>120 108 Q <666572656e742073657473206f6620626f6f6b6d61726b73206f6e20646966>-.25 E <666572656e7420686f7374206d616368696e65732e>-.25 E<415050>100 132 Q <415249584c4f47>-.92 E .574<546869732076>120 144 R .574<61726961626c652c 206966207365742c20697320696e74657270726574656420617320746865206e616d6520 6f662061206c6f67208c6c652e>-.25 F .574<546865206c6f67208c6c65206b>5.574 F .575<6565707320747261636b206f6620616c6c>-.1 F<6e65>120 156 Q .681<776c 7920616464656420626f6f6b6d61726b7320616e6420706f7274616c7320776974686f75 742065>-.25 F -.15<7665>-.25 G 3.181<7264>.15 G .681 <656c6574696e6720616e>-3.181 F .68 <797468696e672c20696e207468652073616d6520666f726d6174206173>-.15 F <746865>120 168 Q F1<2e617070617269787263>2.5 E F0 <8c6c652e20496620746869732076>2.5 E <61726961626c65206973206e6f7420736574206e6f7468696e6720697320747261636b> -.25 E<65642e>-.1 E<415050>100 192 Q<415249585055524745>-.92 E .553 <54686973206368616e676573207468652077>120 204 R .554 <617920617070617269782064756d707320707572>-.1 F .554 <67656420626f6f6b6d61726b7320746f205354444f55542e>-.18 F .554 <427920646566>5.554 F .554<61756c7420746865>-.1 F 3.054<7961>-.15 G <7265>-3.054 E .554<64756d70656420617320636f6d6d616e64206c696e6573207468 61742077696c6c207265696d706f72742074686520626f6f6b6d61726b73206966206973 737565642028692e652e2063757420616e6420706173746564292e>120 216 R 2.101 <42792073657474696e6720746869732076>120 228 R 2.101 <61726961626c6520746f203120707572>-.25 F 2.102<67656420626f6f6b6d61726b 73206172652064756d70656420696e2074686520666f726d6174207573656420696e2074 6865>-.18 F F1<2e617070617269787263>120 240 Q F0<8c6c652e>2.5 E/F2 10.95 /Times-Bold@0 SF<46494c4553>20 256.8 Q F0 -1.1<596f>100 268.8 S 3.618 <7573>1.1 G 1.118<686f756c642075736520616c6961736573206f722066756e637469 6f6e7320746f206d616b>-3.618 F 3.617<6561>-.1 G 1.117 <707061726978207265616c6c792075736566756c2e>-3.617 F 1.117 <476574207468656d2066726f6d2061707061726978206279>6.117 F<6769>100 280.8 Q .414<76696e6720697420746865202d2d7368656c6c2d65>-.25 F .414<78616d706c 6573206f7074696f6e2c206f722066726f6d20667572746865722062656c6f>-.15 F 2.914<772e204e6f7465>-.25 F .415 <74686520667261676d656e7420746861742070726f>2.914 F<7669646573>-.15 E/F3 10/Times-Bold@0 SF<746f>2.915 E F0<6172>100 292.8 Q <67756d656e7420636f6d706c6574696f6e20696e20626173682e>-.18 E <24484f4d452f2e617070617269787263>100 316.8 Q .586<54686973206973207468 65207072696d617279207265736f75726365208c6c652e20546865726520697320757375 616c6c79206e6f206e65656420746f20656469742069742062792068616e642e20536f6d 6574696d6573206974>120 328.8 R 1.396<63616e2062652075736566756c20746f20 656469742062792068616e6420746f2072656d6f>120 340.8 R 1.697 -.15 <76652061>-.15 H 3.897<6e75>.15 G<6e77>-3.897 E 1.397 <616e74656420626f6f6b6d61726b3b20726566657220746f>-.1 F F3 1.397 <65646974696e6720626f6f6b2d>3.897 F<6d61726b73>120 352.8 Q F0<2e>A <24484f4d452f2e6170706172697872632e62>100 376.8 Q<75>-.2 E .226 <4170706172697820637265617465732061206261636b2d7570208c6c65207768656e65> 120 388.8 R -.15<7665>-.25 G 2.726<7269>.15 G 2.726<7469>-2.726 G 2.726 <7361>-2.726 G<736b>-2.726 E .226<656420746f2072656d6f>-.1 F .525 -.15 <76652065>-.15 H .225<6e74726965732066726f6d2069742e20526566657220746f> .15 F F3<656469742d>2.725 E 1.065<696e6720626f6f6b6d61726b73>120 400.8 R F0 1.065<666f72206f7074696f6e7320696e647563696e672072656d6f>3.565 F -.25 <7661>-.15 G 3.565<6c2e2059>.25 F 1.065<6f752063616e2065>-1.1 F 1.066 <78706c696369746c7920726571756972652061206261636b757020746f206265>-.15 F <6d61646520627920656974686572206f66>120 412.8 Q F3<2d2d62>2.5 E<75>-.2 E F0<6f72>2.5 E F3<2d62>2.5 E<75>-.2 E/F4 10/Times-Italic@0 SF<666e616d65> 2.5 E F0<2e>A<24484f4d452f2e61707061726978>100 436.8 Q -.15<6578>-.15 G <70616e64>.15 E 1.08 <5468697320636f6e7461696e7320626f6f6b6d61726b732074686174206172652065> 120 448.8 R 1.079<7870616e6465642066726f6d20706f7274616c732e>-.15 F 3.579<4170>6.079 G 1.079 <6f7274616c2069732073696d706c7920736f6d652064697265632d>-3.579 F .205<74 6f72792e20546865206e616d6573206f6620616c6c207375626469726563746f72696573 206172652074616b>120 460.8 R .206<656e20617320626f6f6b6d61726b7320746861 7420706f696e7420746f2074686f7365207375626469726563746f2d>-.1 F 2.5 <726965732e2054686973>120 472.8 R <8c6c652063616e206265207265637265617465642062792069737375696e67>2.5 E F1 <61707061726978202d2d726568617368>120 496.8 Q F0 <24484f4d452f2e626173687263>100 532.8 Q<24484f4d452f2e746373687263>100 544.8 Q<24484f4d452f2e6373687263>100 556.8 Q 1.258<4164642074686520636f 646520796f75206e65656420746f2074686520617070726f707269617465207263208c6c 652e20546865206d6163726f7320616e642066756e6374696f6e732062656c6f>120 568.8 R 3.758<7770>-.25 G<6f696e74>-3.758 E F4<6364>120 580.8 Q F0 <28312920696e2074686520726967687420646972656374696f6e2e>A <6170706172697820312e3030342c2031312d303632>20 768 Q 2.5<334d>122.35 G <61722032303131>-2.5 E<39>205.67 E 0 Cg EP %%Page: 10 10 %%BeginPageSetup BP %%EndPageSetup /F0 10/Times-Roman@0 SF 145.125<617070617269782831292055534552>20 48 R 147.625<434f4d4d414e44532061707061726978283129>2.5 F/F1 10/Courier@0 SF <424153482d7374796c652066756e6374696f6e73>100 84 Q<2d2d2d>100 96 Q <66756e6374696f6e20746f202829207b>100 108 Q <6966207465737420222432223b207468656e>112 120 Q<636420222428617070617269 78202d2d7472792d63757272656e742d6669727374202d6661766f757220724f6c202224 31222022243222207c7c206563686f202e2922>124 132 Q <656c6966207465737420222431223b207468656e>112 144 Q <696620746573742022243122203d3d20272d273b207468656e>124 156 Q<6364202d> 136 168 Q<656c7365>124 180 Q<63642022242861707061726978202d2d7472792d63 757272656e742d6669727374202d6661766f757220724f6c2022243122207c7c20656368 6f202e2922>136 192 Q<6669>124 204 Q<656c7365>112 216 Q<63642024484f4d45> 124 228 Q<6669>112 240 Q<7d>100 252 Q<66756e6374696f6e20626d202829207b> 100 264 Q<6966207465737420222432223b207468656e>112 276 Q <61707061726978202d2d6164642d6d61726b202224312220222432223b>124 288 Q <656c6966207465737420222431223b207468656e>112 300 Q <61707061726978202d2d6164642d6d61726b20222431223b>124 312 Q<656c7365>112 324 Q<61707061726978202d2d6164642d6d61726b3b>124 336 Q<6669>112 348 Q <7d>100 360 Q<66756e6374696f6e20706f7274616c202829207b>100 372 Q <6966207465737420222431223b207468656e>112 384 Q <61707061726978202d2d6164642d706f7274616c20222431223b>124 396 Q <656c7365>112 408 Q<61707061726978202d2d6164642d706f7274616c3b>124 420 Q <6669>112 432 Q<7d>100 444 Q 6<2366>100 456 S<756e6374696f6e20746f206765 6e6572617465206c697374206f6620636f6d706c6574696f6e732066726f6d202e617070 617269787263>-6 E <66756e6374696f6e205f617070617269785f616c6961736573202829>100 468 Q 6 <7b63>100 480 S<75723d2432>-6 E<6469723d2433>112 492 Q <434f4d505245504c593d2829>112 504 Q <6e756c6c676c6f6273613d242873686f7074202d70206e756c6c676c6f6229>112 516 Q<73686f7074202d73206e756c6c676c6f62>112 528 Q <6966206c65742024282824434f4d505f43574f5244203d3d203129293b207468656e> 112 540 Q 6<236e>124 552 S<6f77206375723d3c61707061726978206d61726b3e20 28636f6d706c6574696e67206f6e20746869732920616e64206469723d27746f27>-6 E 6<2342>124 564 S<656c6f772077696c6c206e6f7420636f6d706c657465206f6e2073 75626469726563746f726965732e207377617020696620736f20646573697265642e>-6 E 6<2343>124 576 S<4f4d505245504c593d28202428206361742024484f4d452f2e61 7070617269787b72632c657870616e647d207c206772657020226a2c2e2a246375722e2a 2c22207c20637574202d6632202d642c20292029>-6 E<434f4d505245504c593d282024 2820286361742024484f4d452f2e617070617269787b72632c657870616e647d207c2067 72657020225c3c6a2c22207c20637574202d6632202d642c203b206c73202d3170207c20 6772657020272f2427207c207472202d64202f29207c206772657020225c3c246375722e 2a2220292029>124 588 Q<656c7365>112 600 Q 6<236e>124 612 S<6f7720646972 3d3c61707061726978206d61726b3e20616e64206375723d3c7375626469726563746f72 792d6f662d6d61726b3e2028636f6d706c6574696e67206f6e207468697329>-6 E<6469 723d6061707061726978202d2d7472792d63757272656e742d6669727374202d6661766f 757220724f6c202464697220323e2f6465762f6e756c6c60207c7c2072657475726e2030> 124 624 Q<6576616c5f636f6d707265706c793d22434f4d505245504c593d28202428> 124 636 Q<636420222464697222>136 648 Q <5c6c73202d6420246375722a207c207768696c6520726561642072>136 660 Q<646f> 136 672 Q<5b5b202d642022247222205d5d202626>148 684 Q <5b5b202472203d3d202a246375722a205d5d202626>148 696 Q <6563686f205c22247b722f2f202f5c5c207d5c22>160 708 Q<646f6e65>136 720 Q F0<6170706172697820312e3030342c2031312d303632>20 768 Q 2.5<334d>122.35 G <61722032303131>-2.5 E<3130>200.67 E 0 Cg EP %%Page: 11 11 %%BeginPageSetup BP %%EndPageSetup /F0 10/Times-Roman@0 SF 145.125<617070617269782831292055534552>20 48 R 147.625<434f4d4d414e44532061707061726978283129>2.5 F/F1 10/Courier@0 SF 6<2929>124 84 S<22>-6 E<6576616c20246576616c5f636f6d707265706c79>112 96 Q<6669>112 108 Q<246e756c6c676c6f627361>112 120 Q<72657475726e2030>112 132 Q<7d>100 144 Q 6<2363>100 156 S<6f6d6d616e6420746f207265676973746572 207468652061626f766520746f20657870616e64207768656e207468652027746f272063 6f6d6d616e642773206172677320617265>-6 E 6<2362>100 168 S <65696e6720657870616e646564>-6 E <636f6d706c657465202d46205f617070617269785f616c696173657320746f>100 180 Q<2d2d2d>100 192 Q<4353482d7374796c6520616c6961736573>100 204 Q<2d2d2d> 100 216 Q 6<2354>100 228 S<6865206f7574636f6d6d656e74656420616c69617320 646f6573206e6f7420737570706c616e742063642c20746865206f74686572206f6e6520 646f65732e>-6 E 6<2361>100 240 S<6c69617320746f>-6 E<276364206028617070 61726978202d6661766f757220724f6c205c212a207c7c206563686f202d6e202e296027> 24 E<616c69617320746f202728746573742022782d22203d>100 252 Q <22785c212a2229202626206364202d207c7c2028746573742022782220213d>12 E<22 785c212a222920262620636420602861707061726978202d2d7472792d63757272656e74 2d6669727374202d6661766f757220724f6c205c212a207c7c206563686f202d6e202e29 60207c7c20636427>12 E<616c69617320626d>100 264 Q <2761707061726978202d2d6164642d6d61726b205c212a27>18 E<616c69617320706f 7274616c202761707061726978202d2d6164642d706f7274616c205c212a27>100 276 Q <2d2d2d>100 288 Q F0<4d6f726520656c61626f726174652073657475707320617265 20706f737369626c652e2054686973204353482d7374796c6520616c6961733a>100 312 Q F1<616c69617320746f202728746573742022782220213d>100 336 Q<22785c212a22 2920262620636420602861707061726978202d6661766f757220724f6c205c212a207c7c 206563686f202d6e202e2960207c7c2061707061726978202d6c27>12 E F0 <6c6973747320616c6c2061>100 360 Q -.25<7661>-.2 G <696c61626c65206a756d707320696620696e>.25 E -.2<766f>-.4 G -.1<6b65>.2 G 2.5<6477>.1 G<6974686f7574206172>-2.5 E<67756d656e74732e>-.18 E/F2 10.95 /Times-Bold@0 SF<4e4f>20 376.8 Q<544553>-.438 E F0<42656c6f>100 388.8 Q 5.239<7766>-.25 G<6f6c6c6f>-5.239 E 5.239<7773>-.25 G 2.739<6f6d6520636f 6d6d656e7473206f6e206f7468657220617070726f616368657320746f208c6c65207379 7374656d206e61>-5.239 F<766967>-.2 E<6174696f6e2e>-.05 E/F3 10 /Times-Bold@0 SF<48495354>7.74 E<4f52>-.18 E<59>-.35 E F0 -.15<6578>100 400.8 S<706c61696e732074686520646966>.15 E <666572656e6365206265747765656e207468652076>-.25 E<656e657261626c65>-.15 E F3<63646172>2.5 E<6773>-.1 E F0<70726f6772616d20616e64>2.5 E F3 <61707061726978>2.5 E F0<2e>A<434450>100 424.8 Q -1.11<4154>-.92 G 4.384 <4869>1.11 G 4.384<736f>-4.384 G 1.884 <6e6c792075736566756c20696e2063617365732077686572652061206769>-4.384 F -.15<7665>-.25 G 4.384<6e64>.15 G 1.884<69726563746f72792068617320737562 6469726563746f7269657320776974682064697374696e637469>-4.384 F -.15<7665> -.25 G<6e616d65732e20497420646f6573206e6f7420757375616c6c79207363616c65 2077656c6c207768656e20746865726520617265206d6f7265207468616e2061206665> 100 436.8 Q 2.5<7770>-.25 G<6174687320696e20434450>-2.5 E -1.11<4154> -.92 G<482e>1.11 E .638<536f6d652070656f706c652075736520616c696173657320 746f206a756d7020746f206f6674656e2076697369746564206469726563746f72696573 2e>100 460.8 R 3.138<4977>5.638 G .639 <6173206f6e65206f66207468656d20666f72206120706572696f64206f66>-3.238 F .232<74656e2079656172732e205468652066>100 472.8 R .231<6163742069732c20 74686f736520616c6961736573206172652063756d626572736f6d6520746f2063726561 746520616e642072656d6f>-.1 F .531 -.15<76652061>-.15 H .231 <6e6420746865>.15 F 2.731<7963>-.15 G .231<6c757474657220757020746865> -2.731 F .143<616c696173206e616d6573706163652e20546865>100 484.8 R 2.643 <7963>-.15 G .143<616e20636c61736820776974682065>-2.643 F -.15<7865>-.15 G .143<63757461626c65206e616d6573207768656e2074686520616c69617320696e63 6c7564657320746865>.15 F/F4 10/Times-Italic@0 SF<6364>2.644 E F0 .144 <706172742e2054686973>2.644 F 1.605<736f6d6574696d65732070726f6869626974 73206f6e652066726f6d2061737369676e696e6720746865206c6f676963616c20626f6f 6b6d61726b20746f2061206769>100 496.8 R -.15<7665>-.25 G 4.105<6e6c>.15 G 1.605<6f636174696f6e2c20657370656369616c6c79>-4.105 F 1.313<7768656e206f 6e65206861732061206c6f74206f6620736f7572636520636f6465206c6f636174696f6e 732e>100 508.8 R<546865>6.313 E 3.813<7963>-.15 G 1.313<616e20636c617368 2077697468206469726563746f7279206e616d6573207768656e20746865>-3.813 F 2.355<616c6961736573206a7573742065>100 520.8 R 2.354 <7870616e6420746f20746865206c6f636174696f6e2e2054686973206167>-.15 F 2.354<61696e206d65616e73207468617420736f6d6574696d65732061206c6f63617469 6f6e2063616e6e6f74206265>-.05 F .372 <61737369676e656420697473206c6f676963616c20626f6f6b6d61726b2e>100 532.8 R 2.872<4968>5.372 G -2.25 -.2<61762065>-2.872 H .373 <666f756e6420746861742073657474696e67>3.073 F F4<6364>2.873 E F0 .373 <6a756d707320617369646520696e207468656972206f>2.873 F .373 <776e206e616d657370616365>-.25 F<696d70726f>100 544.8 Q -.15<7665>-.15 G 2.5<738c>.15 G<6c652073797374656d206e61>-2.5 E<766967>-.2 E <6174696f6e2062792061206c6172>-.05 E<67652066>-.18 E<6163746f722e>-.1 E .6<497420697320616c736f20706f737369626c6520746f206372656174652073796d6c 696e6b7320746f206f6674656e2076697369746564208c6c65732e204167>100 568.8 R .6<61696e2c206372656174696f6e20616e642072656d6f>-.05 F -.25<7661>-.15 G 3.1<6c6f>.25 G 3.1<6674>-3.1 G<68657365>-3.1 E .625 <6172652063756d626572736f6d652e>100 580.8 R .625<4f6e6520636f756c64206f 6620636f7572736520637265617465207368656c6c2066756e6374696f6e732077697468 20612073696d696c617220696e74657266>5.625 F .625 <61636520746f2061707061726978>-.1 F 1.092<6f722063646172>100 592.8 R 1.092<677320746f2068616e646c65207468652073796d6c696e6b206c69666563>-.18 F 3.592<79636c652e204f6e>-.15 F 1.092<4c696e75782057>3.592 F 1.092 <65656b6c79204e65>-.8 F<7773>-.25 E F4<6e6978>3.592 E F0 1.092 <73756767657374656420746f20707574207468657365>3.592 F .477<73796d6c696e 6b7320696e20612073696e676c65206469726563746f727920616e642061646420746861 74206469726563746f727920746f20434450>100 604.8 R -1.11<4154>-.92 G 2.978 <482e2054686973>1.11 F .478 <69732071756974652061206e65617420747269636b20616e64>2.978 F<6566>100 616.8 Q<6665637469>-.25 E -.15<7665>-.25 G <6c792063726561746573206120626f6f6b6d61726b206e61>.15 E<766967>-.2 E <6174696f6e2073797374656d2e>-.05 E 1.152<5374696c6c20746865726520617265 2070726f626c656d732077697468207468652061626f>100 640.8 R 1.452 -.15 <76652061>-.15 H 3.652<7070726f6163682e204f6e65>.15 F 1.152<70726f626c65 6d2077697468207468652073796d6c696e6b20617070726f616368206973>3.652 F .358<7468617420746865>100 652.8 R 2.858<7961>-.15 G .358 <72652061206269742061>-2.858 F<776b77>-.15 E .358 <61726420746f20656469742e204f6e6520636f756c64206d616b>-.1 F -5.357 2.858 <65612075>-.1 H .359<74696c69747920746f20777261702061726f756e6420746865 2070726f626c656d2c2062>-2.858 F .359<757420696e>-.2 F 1.818<74686520656e 6420746865206469726563746f72792d776974682d73796d6c696e6b732077>100 664.8 R 1.817<6f756c642066756e6374696f6e616c6c79206265207468652073616d65206173 206170706172697827>-.1 F<73>-.55 E F3<2e6170706172697872>4.317 E<63>-.18 E F0 .053<7265736f75726365208c6c652c206f6e6c79206d6f7265206f662061206b6c 756467652e>100 676.8 R .053<416e6f746865722070726f626c656d20697320746861 742073796d6c696e6b73206172652061>5.053 F .054 <776b617264207768656e20747261>-.15 F -.15<7665>-.2 G<72732d>.15 E .929 <696e6720746865208c6c652073797374656d2e20546865>100 688.8 R 3.429<7963> -.15 G .929<6f6e6675736520746865206e6f74696f6e206f6620706172656e74206469 726563746f727920616e642027>-3.429 F F1 .928<6364202e2e>B F0 3.428<276d>C .928<6f73746c7920646f657320746865>-3.428 F<756e65>100 700.8 Q .412 <787065637465642e20536f6d6574696d65732027>-.15 F F1<2e2e>A F0 2.912 <2768>C .412<6173206120646966>-2.912 F .412 <666572656e74206d65616e696e6720746f>-.25 F F3<6364>2.912 E F0 .412<7468 616e2069742068617320746f20616e6f74686572206170706c69636174696f6e2c206173> 2.912 F .898<6f6e652077696c6c207472616365206261636b2073796d6c696e6b7320 616e6420746865206f746865722077696c6c206e6f742e>100 712.8 R <46696e616c6c79>5.898 E 3.398<2c616d>-.65 G .897 <696e6f72206f626a656374696f6e20697320746861742049208c6e64206974>-3.398 F <636f6e>100 724.8 Q -.15<7665>-.4 G 1.177<6e69656e7420746f206861>.15 F 1.478 -.15<76652062>-.2 H 1.178<6f6f6b6d61726b7320696e206120736570617261 7465206e616d657370616365207468616e2074686174206f66>.15 F F4<6364>3.678 E F0 1.178<2831292e204a756d707320617265206d61676963616c>B <6170706172697820312e3030342c2031312d303632>20 768 Q 2.5<334d>122.35 G <61722032303131>-2.5 E<3131>200.67 E 0 Cg EP %%Page: 12 12 %%BeginPageSetup BP %%EndPageSetup /F0 10/Times-Roman@0 SF 145.125<617070617269782831292055534552>20 48 R 147.625<434f4d4d414e44532061707061726978283129>2.5 F .844 <616e64206974206973206e61747572616c20746f20696e>100 84 R -.2<766f>-.4 G 1.044 -.1<6b652074>.2 H .843<68656d206279206120646966>.1 F .843 <666572656e74206d6574686f642e205468697320697320696e2066>-.25 F .843 <61637420686f>-.1 F 3.343<7761>-.25 G .843 <70706172697820616371756972656420697473>-3.343 F<434450>100 96 Q -1.11 <4154>-.92 G 2.782<4862>1.11 G<656861>-2.782 E .282 <76696f75722e2049207573656420434450>-.2 F -1.11<4154>-.92 G 2.782<4874> 1.11 G 2.782<6f6a>-2.782 G .282<756d7020746f2061206665>-2.782 F 2.782 <7770>-.25 G .282<6172746963756c617220736f75726365206469726563746f726965 7320776974682064697374696e6374>-2.782 F .997<6e616d65732074686174206c61 7920646565706c792068696464656e20696e20736f6d6520435653206469726563746f72 792e204f6e636520492073746172746564207573696e67206170706172697820686f>100 108 R<7765>-.25 E -.15<7665>-.25 G 1.796 -.4<722c2049>.15 H -.1<776f>100 120 S 1.251<756c64206d697374616b>.1 F 1.251<656e6c79206973737565>-.1 F /F1 10/Times-Italic@0 SF<746f>3.751 E F0 1.251<726174686572207468616e> 3.751 F F1<6364>3.751 E F0 1.252<746f206a756d7020746f2074686f7365206c6f 636174696f6e732e204d7920627261696e20636c617373698c656420626f7468>3.751 F <7479706573206f66206a756d7020696e207468652073616d652063617465>100 132 Q <676f72792e>-.15 E .459<417070617269782028616e642063646172>100 156 R .459<677329206861>-.18 F .759 -.15<76652061>-.2 H .458<6e6f746865722075 73652062657369646573206a756d70696e672c206e616d656c7920616e6e6f746174696f 6e2e205768656e65>.15 F -.15<7665>-.25 G 2.958<724965>.15 G .458 <6e64207570>-2.958 F 1.218<696e20616e2065736f74657269632070617274206f66 20746865208c6c652073797374656d20616e64206e65656420746f206d616b>100 168 R 3.719<656171>-.1 G 1.219 <7569636b206e6f7465206f6620746865206c6f636174696f6e2c20492073696d706c79> -3.719 F<626f6f6b6d61726b2069742e>100 180 Q .822<4f6e20536c617368446f74 2c207468617420657465726e616c20736f75726365206f6620776973646f6d206f722061 6c7465726e617469>100 204 R -.15<7665>-.25 G .821 <6c7920746865206765656b20776865656c206f6620737566>.15 F .821 <666572696e672c20436c75652d>-.25 F<6c657373204d6f726f6e206f66>100 216 Q <66657265642074686520666f6c6c6f>-.25 E<77696e672067656d732e>-.25 E/F2 10 /Courier@0 SF<6d6b2829207b206576616c20247b313a2d4d4b5057447d3d5c22607077 64605c223b207d>118 240 Q<72742829207b206576616c206364205c225c24247b313a 2d4d4b5057447d5c223b7077643b207d>118 252 Q 6<2374>118 276 S<79706520226d 6b222028617320696e20226d61726b222920616e6420227274222028617320696e202272 657475726e222920746f206d61726b>-6 E 6<236164>118 288 S <69726563746f727920616e64206c6174657220676f206261636b20746f2069742e>-6 E 6<234f>118 300 S 6<7267>-6 G<6976652069742061206e616d653a20646f20226d6b 20666f6f222c20616e64206c61746572206f6e2022727420666f6f22>-6 E F0 1.866 <54686973206f6620636f75727365206973206120706572>100 324 R 1.867 <2d73657373696f6e206d656368616e69736d2c2062>-.2 F 1.867<7574206e6f7465> -.2 F -.1<776f>-.25 G<727468>.1 E 4.367<7966>-.05 G 1.867 <6f72206974732073696d706c69636974792e204920616d206e6f742073757265>-4.367 F<77686574686572206373682d7374796c65207368656c6c7320636f756c64206f66>100 336 Q<66657220616e2065717569>-.25 E -.25<7661>-.25 G<6c656e742e>.25 E 2.622<4166>100 360 S .122 <65617475726520736861726564206279206170706172697820616e642063646172> -2.622 F .122<6773206973207468617420616464696e67206120626f6f6b6d61726b20 696d6d6564696174656c792074616b>-.18 F .122<6573206566>-.1 F .121 <6665637420696e20616c6c>-.25 F .607<7368656c6c732e205468657265206973206e 6f206e65656420746f20736f7572636520736f6d65207265736f75726365208c6c652c20 617320746865206170706c69636174696f6e7320646f20746869732065>100 372 R -.15<7665>-.25 G .608<727974696d6520746865>.15 F<79>-.15 E<61726520696e> 100 384 Q -.2<766f>-.4 G -.1<6b65>.2 G<642e2049742069732066>.1 E <6173742c20646f206e6f742077>-.1 E<6f7272792e>-.1 E/F3 10.95/Times-Bold@0 SF -.11<4255>20 400.8 S<4753>.11 E F0 1.329<546865207265736f75726365208c 6c652070617273696e6720636f6465207468696e6b73207468617420706172656e746865 73657320617265207370656369616c2e>100 412.8 R 1.328 <416c736f207265636f726473206172652063757272656e746c79>6.328 F .304 <73657061726174656420627920636f6d6d61732e204163636f7264696e676c79>100 424.8 R 2.804<2c61>-.65 G .304<7070617269782077696c6c206869746368206966 20612070617468206e616d6520636f6e7461696e73206120706172656e74686573697320 6f722061>-2.804 F<636f6d6d612e>100 436.8 Q F3 -.548<4155>20 453.6 S <54484f52>.548 E F0<5374696a6e2076>100 465.6 Q<616e20446f6e67656e2e>-.25 E F3<5448414e4b53>20 482.4 Q F0<53746566>100 494.4 Q <616e204b616d7068617573656e2077726f7465>-.1 E/F4 10/Times-Bold@0 SF <63646172>2.5 E<6773>-.1 E F0 2.5<2c74>C <686520696e737069726174696f6e20666f7220617070617269782e>-2.5 E .927 <5369746172616d204368616d61727479208c78>100 518.4 R .927 <656420757020736f6d65206f66207468652065>-.15 F .926<78697374696e67206261 736820636f64652c20616e64206164646564207468652074616220636f6d706c6574696f 6e2070617274>-.15 F .543<28626173696e672074686973206f6e2073696d696c6172 20636f646520696e2063646172>100 530.4 R .543 <6773292e20486520646f6573206e6f742067>-.18 F .544 <6172616e74756565207072656469637461626c65206f722065>-.05 F -.15<7665> -.25 G 3.044<6e70>.15 G .544<726574747920726573756c7473>-3.044 F .325<69 66207468657265206172652073706163657320696e20746865206469726563746f727920 6e616d657320776869636820796f7520617474656d707420746f20636f6d706c6574652e> 100 542.4 R F4 -.5<4155>2.824 G<54484f52>.5 E F0 -.1<776f>2.824 G .324 <756c64206c696b>.1 F<65>-.1 E .142<746f207375626d6974207468617420737061 63657320696e2070617468206e616d6573206172652065>100 554.4 R .142<76696c2c 20616e6420746861742074686520636f6d706c6574696f6e20636f6465207365656d7320 746f2077>-.25 F .143<6f726b20696e207468656972>-.1 F -.25<6576>100 566.4 S<696c2070726573656e636520616e>.25 E<7977>-.15 E<61792e204a757374>-.1 E F1<646f6e27>2.5 E 2.5<7470>-.3 G<757420636f6d6d6173>-2.5 E F0 <696e2070617468206e616d65732e>2.5 E<546865206175746f746f6f6c65642062>100 590.4 Q<75696c6420656e>-.2 E<7669726f6e6d656e742077>-.4 E<6173206d6f6469 8c65642066726f6d20612074656d706c617465207772697474656e206279204a6f6f7374 2076>-.1 E<616e204261616c2e>-.25 E<5365>100 614.4 Q -.15<7665>-.25 G 2.429<72616c2070656f706c652073756767657374656420746f20656e61626c65206170 706172697820746f206d6572>.15 F 2.428<67652061636365737369626c6520646972 6563746f7269657320616e64206d61726b732c2062>-.18 F<7574>-.2 E<4d61746961 732050696970617269207068726173656420697420746865206d6f737420636f6e>100 626.4 Q<76696e63696e676c792e>-.4 E F3<48495354>20 643.2 Q<4f52>-.197 E <59>-.383 E F0 1.83<417070617269782077>100 655.2 R 1.83<6173206372656174 656420746f206f7074696d697a652061207363656e6172696f2074686174>-.1 F F1 <63646172>4.331 E<6773>-.37 E F0 1.831 <646f6573206e6f7420737570706f72742076>4.331 F 1.831 <6572792077656c6c2c206e616d656c79>-.15 F .842 <776865726520746865206d61726b202863616c6c6564>100 667.2 R F1 <6e6565646c65>3.342 E F0 .842<696e2063646172>3.342 F .841 <67732920697320616c>-.18 F -.1<7761>-.1 G .841<7973206b6e6f>.1 F .841<77 6e2e204173206164646974696f6e616c2066656174757265732061707061726978207375 702d>-.25 F .646<706f72747320434450>100 679.2 R -1.11<4154>-.92 G .646 <482d7374796c652062656861>1.11 F<76696f7572>-.2 E 3.146<2c64>-.4 G <657269>-3.146 E -.15<7665>-.25 G 3.147<6473>.15 G .647<7562646972656374 6f72792073706563698c636174696f6e2c20616e64207472616e73706172656e74207472 6561746d656e74206f66>-3.147 F .111 <626f6f6b6d61726b7320616e64206469726563746f726965732c20616c6c20696e7465> 100 691.2 R .111<677261746564207769746820626173682074616220636f6d706c65 74696f6e2e20496e206f7468657220726573706563747320617070617269782069732061> -.15 F .28<6d7563682073696d706c6572206170706c69636174696f6e2e>100 703.2 R F4<63646172>2.78 E<6773>-.1 E F0<6f66>2.781 E .281 <66657273206d656e752d6261736564206e61>-.25 F<766967>-.2 E .281<6174696f 6e206f6620746865208c6c652073797374656d20616e642074686520626f6f6b2d>-.05 F<6d61726b206c6973742c207768696368206170706172697820646f6573206e6f742e> 100 715.2 Q<6170706172697820312e3030342c2031312d303632>20 768 Q 2.5 <334d>122.35 G<61722032303131>-2.5 E<3132>200.67 E 0 Cg EP %%Trailer end %%EOF apparix-11-062/install-sh000077500000000000000000000130271326043744200152620ustar00rootroot00000000000000#!/bin/sh # # $Id: install-sh,v 1.1 2004/08/18 16:32:53 flux Exp $ # # install - install a program, script, or datafile # This comes from X11R5 (mit/util/scripts/install.sh). # # Copyright 1991 by the Massachusetts Institute of Technology # # Permission to use, copy, modify, distribute, and sell this software and its # documentation for any purpose is hereby granted without fee, provided that # the above copyright notice appear in all copies and that both that # copyright notice and this permission notice appear in supporting # documentation, and that the name of M.I.T. not be used in advertising or # publicity pertaining to distribution of the software without specific, # written prior permission. M.I.T. makes no representations about the # suitability of this software for any purpose. It is provided "as is" # without express or implied warranty. # # Calling this script install-sh is preferred over install.sh, to prevent # `make' implicit rules from creating a file called install from it # when there is no Makefile. # # This script is compatible with the BSD install script, but was written # from scratch. It can only install one file at a time, a restriction # shared with many OS's install programs. # set DOITPROG to echo to test this script # Don't use :- since 4.3BSD and earlier shells don't like it. doit="${DOITPROG-}" # put in absolute paths if you don't have them in your path; or use env. vars. mvprog="${MVPROG-mv}" cpprog="${CPPROG-cp}" chmodprog="${CHMODPROG-chmod}" chownprog="${CHOWNPROG-chown}" chgrpprog="${CHGRPPROG-chgrp}" stripprog="${STRIPPROG-strip}" rmprog="${RMPROG-rm}" mkdirprog="${MKDIRPROG-mkdir}" transformbasename="" transform_arg="" instcmd="$mvprog" chmodcmd="$chmodprog 0755" chowncmd="" chgrpcmd="" stripcmd="" rmcmd="$rmprog -f" mvcmd="$mvprog" src="" dst="" dir_arg="" while [ x"$1" != x ]; do case $1 in -c) instcmd="$cpprog" shift continue;; -d) dir_arg=true shift continue;; -m) chmodcmd="$chmodprog $2" shift shift continue;; -o) chowncmd="$chownprog $2" shift shift continue;; -g) chgrpcmd="$chgrpprog $2" shift shift continue;; -s) stripcmd="$stripprog" shift continue;; -t=*) transformarg=`echo $1 | sed 's/-t=//'` shift continue;; -b=*) transformbasename=`echo $1 | sed 's/-b=//'` shift continue;; *) if [ x"$src" = x ] then src=$1 else # this colon is to work around a 386BSD /bin/sh bug : dst=$1 fi shift continue;; esac done if [ x"$src" = x ] then echo "install: no input file specified" exit 1 else true fi if [ x"$dir_arg" != x ]; then dst=$src src="" if [ -d $dst ]; then instcmd=: chmodcmd="" else instcmd=mkdir fi else # Waiting for this to be detected by the "$instcmd $src $dsttmp" command # might cause directories to be created, which would be especially bad # if $src (and thus $dsttmp) contains '*'. if [ -f $src -o -d $src ] then true else echo "install: $src does not exist" exit 1 fi if [ x"$dst" = x ] then echo "install: no destination specified" exit 1 else true fi # If destination is a directory, append the input filename; if your system # does not like double slashes in filenames, you may need to add some logic if [ -d $dst ] then dst="$dst"/`basename $src` else true fi fi ## this sed command emulates the dirname command dstdir=`echo $dst | sed -e 's,[^/]*$,,;s,/$,,;s,^$,.,'` # Make sure that the destination directory exists. # this part is taken from Noah Friedman's mkinstalldirs script # Skip lots of stat calls in the usual case. if [ ! -d "$dstdir" ]; then defaultIFS=' ' IFS="${IFS-${defaultIFS}}" oIFS="${IFS}" # Some sh's can't handle IFS=/ for some reason. IFS='%' set - `echo ${dstdir} | sed -e 's@/@%@g' -e 's@^%@/@'` IFS="${oIFS}" pathcomp='' while [ $# -ne 0 ] ; do pathcomp="${pathcomp}${1}" shift if [ ! -d "${pathcomp}" ] ; then $mkdirprog "${pathcomp}" else true fi pathcomp="${pathcomp}/" done fi if [ x"$dir_arg" != x ] then $doit $instcmd $dst && if [ x"$chowncmd" != x ]; then $doit $chowncmd $dst; else true ; fi && if [ x"$chgrpcmd" != x ]; then $doit $chgrpcmd $dst; else true ; fi && if [ x"$stripcmd" != x ]; then $doit $stripcmd $dst; else true ; fi && if [ x"$chmodcmd" != x ]; then $doit $chmodcmd $dst; else true ; fi else # If we're going to rename the final executable, determine the name now. if [ x"$transformarg" = x ] then dstfile=`basename $dst` else dstfile=`basename $dst $transformbasename | sed $transformarg`$transformbasename fi # don't allow the sed command to completely eliminate the filename if [ x"$dstfile" = x ] then dstfile=`basename $dst` else true fi # Make a temp file name in the proper directory. dsttmp=$dstdir/#inst.$$# # Move or copy the file name to the temp name $doit $instcmd $src $dsttmp && trap "rm -f ${dsttmp}" 0 && # and set any options; do chmod last to preserve setuid bits # If any of these fail, we abort the whole thing. If we want to # ignore errors from any of these, just make sure not to ignore # errors from the above "$doit $instcmd $src $dsttmp" command. if [ x"$chowncmd" != x ]; then $doit $chowncmd $dsttmp; else true;fi && if [ x"$chgrpcmd" != x ]; then $doit $chgrpcmd $dsttmp; else true;fi && if [ x"$stripcmd" != x ]; then $doit $stripcmd $dsttmp; else true;fi && if [ x"$chmodcmd" != x ]; then $doit $chmodcmd $dsttmp; else true;fi && # Now rename the file to the real destination. $doit $rmcmd -f $dstdir/$dstfile && $doit $mvcmd $dsttmp $dstdir/$dstfile fi && exit 0 apparix-11-062/missing000077500000000000000000000246661326043744200146700ustar00rootroot00000000000000#! /bin/sh # Common stub for a few missing GNU programs while installing. scriptversion=2003-09-02.23 # Copyright (C) 1996, 1997, 1999, 2000, 2002, 2003 # Free Software Foundation, Inc. # Originally by Fran,cois Pinard , 1996. # 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., 59 Temple Place - Suite 330, Boston, MA # 02111-1307, USA. # As a special exception to the GNU General Public License, if you # distribute this file as part of a program that contains a # configuration script generated by Autoconf, you may include it under # the same distribution terms that you use for the rest of that program. if test $# -eq 0; then echo 1>&2 "Try \`$0 --help' for more information" exit 1 fi run=: # In the cases where this matters, `missing' is being run in the # srcdir already. if test -f configure.ac; then configure_ac=configure.ac else configure_ac=configure.in fi msg="missing on your system" case "$1" in --run) # Try to run requested program, and just exit if it succeeds. run= shift "$@" && exit 0 # Exit code 63 means version mismatch. This often happens # when the user try to use an ancient version of a tool on # a file that requires a minimum version. In this case we # we should proceed has if the program had been absent, or # if --run hadn't been passed. if test $? = 63; then run=: msg="probably too old" fi ;; esac # If it does not exist, or fails to run (possibly an outdated version), # try to emulate it. case "$1" in -h|--h|--he|--hel|--help) echo "\ $0 [OPTION]... PROGRAM [ARGUMENT]... Handle \`PROGRAM [ARGUMENT]...' for when PROGRAM is missing, or return an error status if there is no known handling for PROGRAM. Options: -h, --help display this help and exit -v, --version output version information and exit --run try to run the given command, and emulate it if it fails Supported PROGRAM values: aclocal touch file \`aclocal.m4' autoconf touch file \`configure' autoheader touch file \`config.h.in' automake touch all \`Makefile.in' files bison create \`y.tab.[ch]', if possible, from existing .[ch] flex create \`lex.yy.c', if possible, from existing .c help2man touch the output file lex create \`lex.yy.c', if possible, from existing .c makeinfo touch the output file tar try tar, gnutar, gtar, then tar without non-portable flags yacc create \`y.tab.[ch]', if possible, from existing .[ch] Send bug reports to ." ;; -v|--v|--ve|--ver|--vers|--versi|--versio|--version) echo "missing $scriptversion (GNU Automake)" ;; -*) echo 1>&2 "$0: Unknown \`$1' option" echo 1>&2 "Try \`$0 --help' for more information" exit 1 ;; aclocal*) if test -z "$run" && ($1 --version) > /dev/null 2>&1; then # We have it, but it failed. exit 1 fi echo 1>&2 "\ WARNING: \`$1' is $msg. You should only need it if you modified \`acinclude.m4' or \`${configure_ac}'. You might want to install the \`Automake' and \`Perl' packages. Grab them from any GNU archive site." touch aclocal.m4 ;; autoconf) if test -z "$run" && ($1 --version) > /dev/null 2>&1; then # We have it, but it failed. exit 1 fi echo 1>&2 "\ WARNING: \`$1' is $msg. You should only need it if you modified \`${configure_ac}'. You might want to install the \`Autoconf' and \`GNU m4' packages. Grab them from any GNU archive site." touch configure ;; autoheader) if test -z "$run" && ($1 --version) > /dev/null 2>&1; then # We have it, but it failed. exit 1 fi echo 1>&2 "\ WARNING: \`$1' is $msg. You should only need it if you modified \`acconfig.h' or \`${configure_ac}'. You might want to install the \`Autoconf' and \`GNU m4' packages. Grab them from any GNU archive site." files=`sed -n 's/^[ ]*A[CM]_CONFIG_HEADER(\([^)]*\)).*/\1/p' ${configure_ac}` test -z "$files" && files="config.h" touch_files= for f in $files; do case "$f" in *:*) touch_files="$touch_files "`echo "$f" | sed -e 's/^[^:]*://' -e 's/:.*//'`;; *) touch_files="$touch_files $f.in";; esac done touch $touch_files ;; automake*) if test -z "$run" && ($1 --version) > /dev/null 2>&1; then # We have it, but it failed. exit 1 fi echo 1>&2 "\ WARNING: \`$1' is $msg. You should only need it if you modified \`Makefile.am', \`acinclude.m4' or \`${configure_ac}'. You might want to install the \`Automake' and \`Perl' packages. Grab them from any GNU archive site." find . -type f -name Makefile.am -print | sed 's/\.am$/.in/' | while read f; do touch "$f"; done ;; autom4te) if test -z "$run" && ($1 --version) > /dev/null 2>&1; then # We have it, but it failed. exit 1 fi echo 1>&2 "\ WARNING: \`$1' is needed, but is $msg. You might have modified some files without having the proper tools for further handling them. You can get \`$1' as part of \`Autoconf' from any GNU archive site." file=`echo "$*" | sed -n 's/.*--output[ =]*\([^ ]*\).*/\1/p'` test -z "$file" && file=`echo "$*" | sed -n 's/.*-o[ ]*\([^ ]*\).*/\1/p'` if test -f "$file"; then touch $file else test -z "$file" || exec >$file echo "#! /bin/sh" echo "# Created by GNU Automake missing as a replacement of" echo "# $ $@" echo "exit 0" chmod +x $file exit 1 fi ;; bison|yacc) echo 1>&2 "\ WARNING: \`$1' $msg. You should only need it if you modified a \`.y' file. You may need the \`Bison' package in order for those modifications to take effect. You can get \`Bison' from any GNU archive site." rm -f y.tab.c y.tab.h if [ $# -ne 1 ]; then eval LASTARG="\${$#}" case "$LASTARG" in *.y) SRCFILE=`echo "$LASTARG" | sed 's/y$/c/'` if [ -f "$SRCFILE" ]; then cp "$SRCFILE" y.tab.c fi SRCFILE=`echo "$LASTARG" | sed 's/y$/h/'` if [ -f "$SRCFILE" ]; then cp "$SRCFILE" y.tab.h fi ;; esac fi if [ ! -f y.tab.h ]; then echo >y.tab.h fi if [ ! -f y.tab.c ]; then echo 'main() { return 0; }' >y.tab.c fi ;; lex|flex) echo 1>&2 "\ WARNING: \`$1' is $msg. You should only need it if you modified a \`.l' file. You may need the \`Flex' package in order for those modifications to take effect. You can get \`Flex' from any GNU archive site." rm -f lex.yy.c if [ $# -ne 1 ]; then eval LASTARG="\${$#}" case "$LASTARG" in *.l) SRCFILE=`echo "$LASTARG" | sed 's/l$/c/'` if [ -f "$SRCFILE" ]; then cp "$SRCFILE" lex.yy.c fi ;; esac fi if [ ! -f lex.yy.c ]; then echo 'main() { return 0; }' >lex.yy.c fi ;; help2man) if test -z "$run" && ($1 --version) > /dev/null 2>&1; then # We have it, but it failed. exit 1 fi echo 1>&2 "\ WARNING: \`$1' is $msg. You should only need it if you modified a dependency of a manual page. You may need the \`Help2man' package in order for those modifications to take effect. You can get \`Help2man' from any GNU archive site." file=`echo "$*" | sed -n 's/.*-o \([^ ]*\).*/\1/p'` if test -z "$file"; then file=`echo "$*" | sed -n 's/.*--output=\([^ ]*\).*/\1/p'` fi if [ -f "$file" ]; then touch $file else test -z "$file" || exec >$file echo ".ab help2man is required to generate this page" exit 1 fi ;; makeinfo) if test -z "$run" && (makeinfo --version) > /dev/null 2>&1; then # We have makeinfo, but it failed. exit 1 fi echo 1>&2 "\ WARNING: \`$1' is $msg. You should only need it if you modified a \`.texi' or \`.texinfo' file, or any other file indirectly affecting the aspect of the manual. The spurious call might also be the consequence of using a buggy \`make' (AIX, DU, IRIX). You might want to install the \`Texinfo' package or the \`GNU make' package. Grab either from any GNU archive site." file=`echo "$*" | sed -n 's/.*-o \([^ ]*\).*/\1/p'` if test -z "$file"; then file=`echo "$*" | sed 's/.* \([^ ]*\) *$/\1/'` file=`sed -n '/^@setfilename/ { s/.* \([^ ]*\) *$/\1/; p; q; }' $file` fi touch $file ;; tar) shift if test -n "$run"; then echo 1>&2 "ERROR: \`tar' requires --run" exit 1 fi # We have already tried tar in the generic part. # Look for gnutar/gtar before invocation to avoid ugly error # messages. if (gnutar --version > /dev/null 2>&1); then gnutar "$@" && exit 0 fi if (gtar --version > /dev/null 2>&1); then gtar "$@" && exit 0 fi firstarg="$1" if shift; then case "$firstarg" in *o*) firstarg=`echo "$firstarg" | sed s/o//` tar "$firstarg" "$@" && exit 0 ;; esac case "$firstarg" in *h*) firstarg=`echo "$firstarg" | sed s/h//` tar "$firstarg" "$@" && exit 0 ;; esac fi echo 1>&2 "\ WARNING: I can't seem to be able to run \`tar' with the given arguments. You may want to install GNU tar or Free paxutils, or check the command line arguments." exit 1 ;; *) echo 1>&2 "\ WARNING: \`$1' is needed, and is $msg. You might have modified some files without having the proper tools for further handling them. Check the \`README' file, it often tells you about the needed prerequisites for installing this package. You may also peek at any GNU archive site, in case some other package would contain this missing \`$1' program." exit 1 ;; esac exit 0 # Local variables: # eval: (add-hook 'write-file-hooks 'time-stamp) # time-stamp-start: "scriptversion=" # time-stamp-format: "%:y-%02m-%02d.%02H" # time-stamp-end: "$" # End: apparix-11-062/setversion000077500000000000000000000013171326043744200154040ustar00rootroot00000000000000#!/bin/sh -e # $Id: setversion,v 1.4 2006-05-23 09:11:23 flux Exp $ # called in bootstrap # be verbose set -x TAG=1.004 VERSION=`date '+%y-%j'` echo $VERSION > VERSION cat > configure.ac <> configure.ac # echo '#include "version.h"' > src/version.c echo 'const char *apxDateTag = "'$VERSION'";' > src/version.c echo 'const char *apxNumTag = "'$TAG'";' >> src/version.c echo $TAG > doc/stamp.tag date '+%y-%j' > doc/stamp.stamp date '+%e' > doc/stamp.day date '+%b' > doc/stamp.month date '+%Y' > doc/stamp.year apparix-11-062/src/000077500000000000000000000000001326043744200140425ustar00rootroot00000000000000apparix-11-062/src/Makefile.am000066400000000000000000000004011326043744200160710ustar00rootroot00000000000000## Process this file with automake to produce Makefile.in ## $Id: Makefile.am,v 1.3 2005/11/02 23:00:08 flux Exp $ INCLUDES = -I$(top_srcdir) bin_PROGRAMS = apparix apparix_SOURCES = apparix.c version.c EXTRA_DIST = version.h LDADD = ../util/libutil.a apparix-11-062/src/Makefile.in000066400000000000000000000337051326043744200161170ustar00rootroot00000000000000# Makefile.in generated by automake 1.11 from Makefile.am. # @configure_input@ # Copyright (C) 1994, 1995, 1996, 1997, 1998, 1999, 2000, 2001, 2002, # 2003, 2004, 2005, 2006, 2007, 2008, 2009 Free Software Foundation, # Inc. # This Makefile.in is free software; the Free Software Foundation # gives unlimited permission to copy and/or distribute it, # with or without modifications, as long as this notice is preserved. # This program is distributed in the hope that it will be useful, # but WITHOUT ANY WARRANTY, to the extent permitted by law; without # even the implied warranty of MERCHANTABILITY or FITNESS FOR A # PARTICULAR PURPOSE. @SET_MAKE@ VPATH = @srcdir@ pkgdatadir = $(datadir)/@PACKAGE@ pkgincludedir = $(includedir)/@PACKAGE@ pkglibdir = $(libdir)/@PACKAGE@ pkglibexecdir = $(libexecdir)/@PACKAGE@ am__cd = CDPATH="$${ZSH_VERSION+.}$(PATH_SEPARATOR)" && cd install_sh_DATA = $(install_sh) -c -m 644 install_sh_PROGRAM = $(install_sh) -c install_sh_SCRIPT = $(install_sh) -c INSTALL_HEADER = $(INSTALL_DATA) transform = $(program_transform_name) NORMAL_INSTALL = : PRE_INSTALL = : POST_INSTALL = : NORMAL_UNINSTALL = : PRE_UNINSTALL = : POST_UNINSTALL = : bin_PROGRAMS = apparix$(EXEEXT) subdir = src DIST_COMMON = $(srcdir)/Makefile.am $(srcdir)/Makefile.in ACLOCAL_M4 = $(top_srcdir)/aclocal.m4 am__aclocal_m4_deps = $(top_srcdir)/acinclude.m4 \ $(top_srcdir)/configure.ac am__configure_deps = $(am__aclocal_m4_deps) $(CONFIGURE_DEPENDENCIES) \ $(ACLOCAL_M4) mkinstalldirs = $(install_sh) -d CONFIG_HEADER = $(top_builddir)/config.h CONFIG_CLEAN_FILES = CONFIG_CLEAN_VPATH_FILES = am__installdirs = "$(DESTDIR)$(bindir)" PROGRAMS = $(bin_PROGRAMS) am_apparix_OBJECTS = apparix.$(OBJEXT) version.$(OBJEXT) apparix_OBJECTS = $(am_apparix_OBJECTS) apparix_LDADD = $(LDADD) apparix_DEPENDENCIES = ../util/libutil.a DEFAULT_INCLUDES = -I.@am__isrc@ -I$(top_builddir) depcomp = $(SHELL) $(top_srcdir)/depcomp am__depfiles_maybe = depfiles am__mv = mv -f COMPILE = $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) \ $(CPPFLAGS) $(AM_CFLAGS) $(CFLAGS) CCLD = $(CC) LINK = $(CCLD) $(AM_CFLAGS) $(CFLAGS) $(AM_LDFLAGS) $(LDFLAGS) -o $@ SOURCES = $(apparix_SOURCES) DIST_SOURCES = $(apparix_SOURCES) ETAGS = etags CTAGS = ctags DISTFILES = $(DIST_COMMON) $(DIST_SOURCES) $(TEXINFOS) $(EXTRA_DIST) ACLOCAL = @ACLOCAL@ AMTAR = @AMTAR@ AUTOCONF = @AUTOCONF@ AUTOHEADER = @AUTOHEADER@ AUTOMAKE = @AUTOMAKE@ AWK = @AWK@ CC = @CC@ CCDEPMODE = @CCDEPMODE@ CFLAGS = @CFLAGS@ CPP = @CPP@ CPPFLAGS = @CPPFLAGS@ CYGPATH_W = @CYGPATH_W@ DEFS = @DEFS@ DEPDIR = @DEPDIR@ ECHO_C = @ECHO_C@ ECHO_N = @ECHO_N@ ECHO_T = @ECHO_T@ EGREP = @EGREP@ EXEEXT = @EXEEXT@ GREP = @GREP@ INSTALL = @INSTALL@ INSTALL_DATA = @INSTALL_DATA@ INSTALL_PROGRAM = @INSTALL_PROGRAM@ INSTALL_SCRIPT = @INSTALL_SCRIPT@ INSTALL_STRIP_PROGRAM = @INSTALL_STRIP_PROGRAM@ LDFLAGS = @LDFLAGS@ LIBOBJS = @LIBOBJS@ LIBS = @LIBS@ LN_S = @LN_S@ LTLIBOBJS = @LTLIBOBJS@ MAINT = @MAINT@ MAKEINFO = @MAKEINFO@ MKDIR_P = @MKDIR_P@ OBJEXT = @OBJEXT@ PACKAGE = @PACKAGE@ PACKAGE_BUGREPORT = @PACKAGE_BUGREPORT@ PACKAGE_NAME = @PACKAGE_NAME@ PACKAGE_STRING = @PACKAGE_STRING@ PACKAGE_TARNAME = @PACKAGE_TARNAME@ PACKAGE_URL = @PACKAGE_URL@ PACKAGE_VERSION = @PACKAGE_VERSION@ PATH_SEPARATOR = @PATH_SEPARATOR@ RANLIB = @RANLIB@ SET_MAKE = @SET_MAKE@ SHELL = @SHELL@ STRIP = @STRIP@ VERSION = @VERSION@ abs_builddir = @abs_builddir@ abs_srcdir = @abs_srcdir@ abs_top_builddir = @abs_top_builddir@ abs_top_srcdir = @abs_top_srcdir@ ac_ct_CC = @ac_ct_CC@ am__include = @am__include@ am__leading_dot = @am__leading_dot@ am__quote = @am__quote@ am__tar = @am__tar@ am__untar = @am__untar@ bindir = @bindir@ build_alias = @build_alias@ builddir = @builddir@ datadir = @datadir@ datarootdir = @datarootdir@ docdir = @docdir@ dvidir = @dvidir@ exec_prefix = @exec_prefix@ host_alias = @host_alias@ htmldir = @htmldir@ includedir = @includedir@ infodir = @infodir@ install_sh = @install_sh@ libdir = @libdir@ libexecdir = @libexecdir@ localedir = @localedir@ localstatedir = @localstatedir@ mandir = @mandir@ mkdir_p = @mkdir_p@ oldincludedir = @oldincludedir@ pdfdir = @pdfdir@ prefix = @prefix@ program_transform_name = @program_transform_name@ psdir = @psdir@ sbindir = @sbindir@ sharedstatedir = @sharedstatedir@ srcdir = @srcdir@ sysconfdir = @sysconfdir@ target_alias = @target_alias@ top_build_prefix = @top_build_prefix@ top_builddir = @top_builddir@ top_srcdir = @top_srcdir@ INCLUDES = -I$(top_srcdir) apparix_SOURCES = apparix.c version.c EXTRA_DIST = version.h LDADD = ../util/libutil.a all: all-am .SUFFIXES: .SUFFIXES: .c .o .obj $(srcdir)/Makefile.in: @MAINTAINER_MODE_TRUE@ $(srcdir)/Makefile.am $(am__configure_deps) @for dep in $?; do \ case '$(am__configure_deps)' in \ *$$dep*) \ ( cd $(top_builddir) && $(MAKE) $(AM_MAKEFLAGS) am--refresh ) \ && { if test -f $@; then exit 0; else break; fi; }; \ exit 1;; \ esac; \ done; \ echo ' cd $(top_srcdir) && $(AUTOMAKE) --gnu src/Makefile'; \ $(am__cd) $(top_srcdir) && \ $(AUTOMAKE) --gnu src/Makefile .PRECIOUS: Makefile Makefile: $(srcdir)/Makefile.in $(top_builddir)/config.status @case '$?' in \ *config.status*) \ cd $(top_builddir) && $(MAKE) $(AM_MAKEFLAGS) am--refresh;; \ *) \ echo ' cd $(top_builddir) && $(SHELL) ./config.status $(subdir)/$@ $(am__depfiles_maybe)'; \ cd $(top_builddir) && $(SHELL) ./config.status $(subdir)/$@ $(am__depfiles_maybe);; \ esac; $(top_builddir)/config.status: $(top_srcdir)/configure $(CONFIG_STATUS_DEPENDENCIES) cd $(top_builddir) && $(MAKE) $(AM_MAKEFLAGS) am--refresh $(top_srcdir)/configure: @MAINTAINER_MODE_TRUE@ $(am__configure_deps) cd $(top_builddir) && $(MAKE) $(AM_MAKEFLAGS) am--refresh $(ACLOCAL_M4): @MAINTAINER_MODE_TRUE@ $(am__aclocal_m4_deps) cd $(top_builddir) && $(MAKE) $(AM_MAKEFLAGS) am--refresh $(am__aclocal_m4_deps): install-binPROGRAMS: $(bin_PROGRAMS) @$(NORMAL_INSTALL) test -z "$(bindir)" || $(MKDIR_P) "$(DESTDIR)$(bindir)" @list='$(bin_PROGRAMS)'; test -n "$(bindir)" || list=; \ for p in $$list; do echo "$$p $$p"; done | \ sed 's/$(EXEEXT)$$//' | \ while read p p1; do if test -f $$p; \ then echo "$$p"; echo "$$p"; else :; fi; \ done | \ sed -e 'p;s,.*/,,;n;h' -e 's|.*|.|' \ -e 'p;x;s,.*/,,;s/$(EXEEXT)$$//;$(transform);s/$$/$(EXEEXT)/' | \ sed 'N;N;N;s,\n, ,g' | \ $(AWK) 'BEGIN { files["."] = ""; dirs["."] = 1 } \ { d=$$3; if (dirs[d] != 1) { print "d", d; dirs[d] = 1 } \ if ($$2 == $$4) files[d] = files[d] " " $$1; \ else { print "f", $$3 "/" $$4, $$1; } } \ END { for (d in files) print "f", d, files[d] }' | \ while read type dir files; do \ if test "$$dir" = .; then dir=; else dir=/$$dir; fi; \ test -z "$$files" || { \ echo " $(INSTALL_PROGRAM_ENV) $(INSTALL_PROGRAM) $$files '$(DESTDIR)$(bindir)$$dir'"; \ $(INSTALL_PROGRAM_ENV) $(INSTALL_PROGRAM) $$files "$(DESTDIR)$(bindir)$$dir" || exit $$?; \ } \ ; done uninstall-binPROGRAMS: @$(NORMAL_UNINSTALL) @list='$(bin_PROGRAMS)'; test -n "$(bindir)" || list=; \ files=`for p in $$list; do echo "$$p"; done | \ sed -e 'h;s,^.*/,,;s/$(EXEEXT)$$//;$(transform)' \ -e 's/$$/$(EXEEXT)/' `; \ test -n "$$list" || exit 0; \ echo " ( cd '$(DESTDIR)$(bindir)' && rm -f" $$files ")"; \ cd "$(DESTDIR)$(bindir)" && rm -f $$files clean-binPROGRAMS: -test -z "$(bin_PROGRAMS)" || rm -f $(bin_PROGRAMS) apparix$(EXEEXT): $(apparix_OBJECTS) $(apparix_DEPENDENCIES) @rm -f apparix$(EXEEXT) $(LINK) $(apparix_OBJECTS) $(apparix_LDADD) $(LIBS) mostlyclean-compile: -rm -f *.$(OBJEXT) distclean-compile: -rm -f *.tab.c @AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/apparix.Po@am__quote@ @AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/version.Po@am__quote@ .c.o: @am__fastdepCC_TRUE@ $(COMPILE) -MT $@ -MD -MP -MF $(DEPDIR)/$*.Tpo -c -o $@ $< @am__fastdepCC_TRUE@ $(am__mv) $(DEPDIR)/$*.Tpo $(DEPDIR)/$*.Po @AMDEP_TRUE@@am__fastdepCC_FALSE@ source='$<' object='$@' libtool=no @AMDEPBACKSLASH@ @AMDEP_TRUE@@am__fastdepCC_FALSE@ DEPDIR=$(DEPDIR) $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@ @am__fastdepCC_FALSE@ $(COMPILE) -c $< .c.obj: @am__fastdepCC_TRUE@ $(COMPILE) -MT $@ -MD -MP -MF $(DEPDIR)/$*.Tpo -c -o $@ `$(CYGPATH_W) '$<'` @am__fastdepCC_TRUE@ $(am__mv) $(DEPDIR)/$*.Tpo $(DEPDIR)/$*.Po @AMDEP_TRUE@@am__fastdepCC_FALSE@ source='$<' object='$@' libtool=no @AMDEPBACKSLASH@ @AMDEP_TRUE@@am__fastdepCC_FALSE@ DEPDIR=$(DEPDIR) $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@ @am__fastdepCC_FALSE@ $(COMPILE) -c `$(CYGPATH_W) '$<'` ID: $(HEADERS) $(SOURCES) $(LISP) $(TAGS_FILES) list='$(SOURCES) $(HEADERS) $(LISP) $(TAGS_FILES)'; \ unique=`for i in $$list; do \ if test -f "$$i"; then echo $$i; else echo $(srcdir)/$$i; fi; \ done | \ $(AWK) '{ files[$$0] = 1; nonempty = 1; } \ END { if (nonempty) { for (i in files) print i; }; }'`; \ mkid -fID $$unique tags: TAGS TAGS: $(HEADERS) $(SOURCES) $(TAGS_DEPENDENCIES) \ $(TAGS_FILES) $(LISP) set x; \ here=`pwd`; \ list='$(SOURCES) $(HEADERS) $(LISP) $(TAGS_FILES)'; \ unique=`for i in $$list; do \ if test -f "$$i"; then echo $$i; else echo $(srcdir)/$$i; fi; \ done | \ $(AWK) '{ files[$$0] = 1; nonempty = 1; } \ END { if (nonempty) { for (i in files) print i; }; }'`; \ shift; \ if test -z "$(ETAGS_ARGS)$$*$$unique"; then :; else \ test -n "$$unique" || unique=$$empty_fix; \ if test $$# -gt 0; then \ $(ETAGS) $(ETAGSFLAGS) $(AM_ETAGSFLAGS) $(ETAGS_ARGS) \ "$$@" $$unique; \ else \ $(ETAGS) $(ETAGSFLAGS) $(AM_ETAGSFLAGS) $(ETAGS_ARGS) \ $$unique; \ fi; \ fi ctags: CTAGS CTAGS: $(HEADERS) $(SOURCES) $(TAGS_DEPENDENCIES) \ $(TAGS_FILES) $(LISP) list='$(SOURCES) $(HEADERS) $(LISP) $(TAGS_FILES)'; \ unique=`for i in $$list; do \ if test -f "$$i"; then echo $$i; else echo $(srcdir)/$$i; fi; \ done | \ $(AWK) '{ files[$$0] = 1; nonempty = 1; } \ END { if (nonempty) { for (i in files) print i; }; }'`; \ test -z "$(CTAGS_ARGS)$$unique" \ || $(CTAGS) $(CTAGSFLAGS) $(AM_CTAGSFLAGS) $(CTAGS_ARGS) \ $$unique GTAGS: here=`$(am__cd) $(top_builddir) && pwd` \ && $(am__cd) $(top_srcdir) \ && gtags -i $(GTAGS_ARGS) "$$here" distclean-tags: -rm -f TAGS ID GTAGS GRTAGS GSYMS GPATH tags distdir: $(DISTFILES) @srcdirstrip=`echo "$(srcdir)" | sed 's/[].[^$$\\*]/\\\\&/g'`; \ topsrcdirstrip=`echo "$(top_srcdir)" | sed 's/[].[^$$\\*]/\\\\&/g'`; \ list='$(DISTFILES)'; \ dist_files=`for file in $$list; do echo $$file; done | \ sed -e "s|^$$srcdirstrip/||;t" \ -e "s|^$$topsrcdirstrip/|$(top_builddir)/|;t"`; \ case $$dist_files in \ */*) $(MKDIR_P) `echo "$$dist_files" | \ sed '/\//!d;s|^|$(distdir)/|;s,/[^/]*$$,,' | \ sort -u` ;; \ esac; \ for file in $$dist_files; do \ if test -f $$file || test -d $$file; then d=.; else d=$(srcdir); fi; \ if test -d $$d/$$file; then \ dir=`echo "/$$file" | sed -e 's,/[^/]*$$,,'`; \ if test -d "$(distdir)/$$file"; then \ find "$(distdir)/$$file" -type d ! -perm -700 -exec chmod u+rwx {} \;; \ fi; \ if test -d $(srcdir)/$$file && test $$d != $(srcdir); then \ cp -fpR $(srcdir)/$$file "$(distdir)$$dir" || exit 1; \ find "$(distdir)/$$file" -type d ! -perm -700 -exec chmod u+rwx {} \;; \ fi; \ cp -fpR $$d/$$file "$(distdir)$$dir" || exit 1; \ else \ test -f "$(distdir)/$$file" \ || cp -p $$d/$$file "$(distdir)/$$file" \ || exit 1; \ fi; \ done check-am: all-am check: check-am all-am: Makefile $(PROGRAMS) installdirs: for dir in "$(DESTDIR)$(bindir)"; do \ test -z "$$dir" || $(MKDIR_P) "$$dir"; \ done install: install-am install-exec: install-exec-am install-data: install-data-am uninstall: uninstall-am install-am: all-am @$(MAKE) $(AM_MAKEFLAGS) install-exec-am install-data-am installcheck: installcheck-am install-strip: $(MAKE) $(AM_MAKEFLAGS) INSTALL_PROGRAM="$(INSTALL_STRIP_PROGRAM)" \ install_sh_PROGRAM="$(INSTALL_STRIP_PROGRAM)" INSTALL_STRIP_FLAG=-s \ `test -z '$(STRIP)' || \ echo "INSTALL_PROGRAM_ENV=STRIPPROG='$(STRIP)'"` install mostlyclean-generic: clean-generic: distclean-generic: -test -z "$(CONFIG_CLEAN_FILES)" || rm -f $(CONFIG_CLEAN_FILES) -test . = "$(srcdir)" || test -z "$(CONFIG_CLEAN_VPATH_FILES)" || rm -f $(CONFIG_CLEAN_VPATH_FILES) maintainer-clean-generic: @echo "This command is intended for maintainers to use" @echo "it deletes files that may require special tools to rebuild." clean: clean-am clean-am: clean-binPROGRAMS clean-generic mostlyclean-am distclean: distclean-am -rm -rf ./$(DEPDIR) -rm -f Makefile distclean-am: clean-am distclean-compile distclean-generic \ distclean-tags dvi: dvi-am dvi-am: html: html-am html-am: info: info-am info-am: install-data-am: install-dvi: install-dvi-am install-dvi-am: install-exec-am: install-binPROGRAMS install-html: install-html-am install-html-am: install-info: install-info-am install-info-am: install-man: install-pdf: install-pdf-am install-pdf-am: install-ps: install-ps-am install-ps-am: installcheck-am: maintainer-clean: maintainer-clean-am -rm -rf ./$(DEPDIR) -rm -f Makefile maintainer-clean-am: distclean-am maintainer-clean-generic mostlyclean: mostlyclean-am mostlyclean-am: mostlyclean-compile mostlyclean-generic pdf: pdf-am pdf-am: ps: ps-am ps-am: uninstall-am: uninstall-binPROGRAMS .MAKE: install-am install-strip .PHONY: CTAGS GTAGS all all-am check check-am clean clean-binPROGRAMS \ clean-generic ctags distclean distclean-compile \ distclean-generic distclean-tags distdir dvi dvi-am html \ html-am info info-am install install-am install-binPROGRAMS \ install-data install-data-am install-dvi install-dvi-am \ install-exec install-exec-am install-html install-html-am \ install-info install-info-am install-man install-pdf \ install-pdf-am install-ps install-ps-am install-strip \ installcheck installcheck-am installdirs maintainer-clean \ maintainer-clean-generic mostlyclean mostlyclean-compile \ mostlyclean-generic pdf pdf-am ps ps-am tags uninstall \ uninstall-am uninstall-binPROGRAMS # Tell versions [3.59,3.63) of GNU make to not export all variables. # Otherwise a system limit (for SysV at least) may be exceeded. .NOEXPORT: apparix-11-062/src/apparix.c000066400000000000000000001213071326043744200156560ustar00rootroot00000000000000/* (c) Copyright 2005, 2006, 2007, 2008 Stijn van Dongen * * This file is part of apparix. You can redistribute and/or modify apparix * under the terms of the GNU General Public License; either version 3 of the * License or (at your option) any later version. You should have received a * copy of the GPL along with apparix, in the file COPYING. */ /* This file is largish, mostly because it was spaceously written. * NOTE * we do not do hash lookup of mark, because just building the hash * takes longer then a sequential search. * TODO * j/J is a bit of a kludge. On disk is always j. */ #include #include #include #include #include #include #include #include #include "version.h" #include "util/io.h" #include "util/alloc.h" #include "util/opt.h" #include "util/err.h" #include "util/tok.h" #include "util/ding.h" #include "util/ting.h" #include "util/types.h" enum { MY_OPT_ADD_JUMP , MY_OPT_ADD_PORTAL , MY_OPT_TRY_CURRENT_FIRST , MY_OPT_TRY_CURRENT_LAST , MY_OPT_NTF_CURRENT , MY_OPT_REHASH , MY_OPT_GREP , MY_OPT_DUMP , MY_OPT_LIST , MY_OPT_UNDO , MY_OPT_FAVOUR , MY_OPT_PICK , MY_OPT_QUIETJUMP , MY_OPT_SQUASH_MARK , MY_OPT_SQUASH_DEST , MY_OPT_LIST_MARK , MY_OPT_LIST_DEST , MY_OPT_PURGE_DEST , MY_OPT_PURGE_MARK , MY_OPT_BACKUP , MY_OPT_BACKUP_NAMED , MY_OPT_CWD , MY_OPT_SHELL , MY_OPT_VERSION , MY_OPT_HELP , MY_OPT_APROPOS } ; static mcxbool quietjump = FALSE; static mcxbool trycurrentfirst = FALSE; static mcxbool trycurrentlast = FALSE; static mcxbool notifycurrent = FALSE; static const char* us = "apparix"; static mcxbool use_cwd = FALSE; #define MY_PATH_MAX 1024 const char* shell_examples[] = { "BASH-style functions\n---" , "function to () {" , " if test \"$2\"; then" , " cd \"$(apparix --try-current-first -favour rOl \"$1\" \"$2\" || echo .)\"" , " elif test \"$1\"; then" , " if test \"$1\" == '-'; then" , " cd -" , " else" , " cd \"$(apparix --try-current-first -favour rOl \"$1\" || echo .)\"" , " fi" , " else" , " cd $HOME" , " fi" , "}" , "function bm () {" , " if test \"$2\"; then" , " apparix --add-mark \"$1\" \"$2\";" , " elif test \"$1\"; then" , " apparix --add-mark \"$1\";" , " else" , " apparix --add-mark;" , " fi" , "}" , "function portal () {" , " if test \"$1\"; then" , " apparix --add-portal \"$1\";" , " else" , " apparix --add-portal;" , " fi" , "}" , "# function to generate list of completions from .apparixrc" , "function _apparix_aliases ()" , "{ cur=$2" , " dir=$3" , " COMPREPLY=()" , " nullglobsa=$(shopt -p nullglob)" , " shopt -s nullglob" , " if let $(($COMP_CWORD == 1)); then" , " # now cur= (completing on this) and dir='to'" , " # Below will not complete on subdirectories. swap if so desired." , " # COMPREPLY=( $( cat $HOME/.apparix{rc,expand} | grep \"j,.*$cur.*,\" | cut -f2 -d, ) )" , " COMPREPLY=( $( (cat $HOME/.apparix{rc,expand} | grep \"\\ and cur= (completing on this)" , " dir=`apparix --try-current-first -favour rOl $dir 2>/dev/null` || return 0" , " eval_compreply=\"COMPREPLY=( $(" , " cd \"$dir\"" , " \\ls -d $cur* | while read r" , " do" , " [[ -d \"$r\" ]] &&" , " [[ $r == *$cur* ]] &&" , " echo \\\"${r// /\\\\ }\\\"" , " done" , " ) )\"" , " eval $eval_compreply" , " fi" , " $nullglobsa" , " return 0" , "}" , "# command to register the above to expand when the 'to' command's args are" , "# being expanded" , "complete -F _apparix_aliases to" , "---\nCSH-style aliases\n---" , "# The outcommented alias does not supplant cd, the other one does." , "# alias to 'cd `(apparix -favour rOl \\!* || echo -n .)`'" , "alias to '(test \"x-\" = \"x\\!*\") && cd - || (test \"x\" != \"x\\!*\") && cd `(apparix --try-current-first -favour rOl \\!* || echo -n .)` || cd'" , "alias bm 'apparix --add-mark \\!*'" , "alias portal 'apparix --add-portal \\!*'" , "---" , NULL } ; const char* syntax = "apparix [--add-mark|--add-portal] bookmark (...)"; mcxOptAnchor options[] = { { "--apropos" , MCX_OPT_DEFAULT | MCX_OPT_INFO , MY_OPT_APROPOS , NULL , "print this help" } , { "--version" , MCX_OPT_DEFAULT | MCX_OPT_INFO , MY_OPT_VERSION , NULL , "print version and exit" } , { "--bu" , MCX_OPT_DEFAULT , MY_OPT_BACKUP , NULL , "copy .apparixrc to .apparixrc.bu" } , { "-l" , MCX_OPT_DEFAULT , MY_OPT_LIST , NULL , "list all bookmarks" } , { "-d" , MCX_OPT_DEFAULT , MY_OPT_DUMP , NULL , "dump resource file to STDOUT" } , { "-u" , MCX_OPT_HASARG , MY_OPT_UNDO , "" , "undo last additions" } , { "-bu" , MCX_OPT_HASARG , MY_OPT_BACKUP_NAMED , "fname" , "copy .apparixrc to fname" } , { "--quiet-jump" , MCX_OPT_DEFAULT , MY_OPT_QUIETJUMP , NULL , "be quiet when jump fails" } , { "-v" , MCX_OPT_DEFAULT | MCX_OPT_INFO , MY_OPT_VERSION , NULL , "print version and exit" } , { "-h" , MCX_OPT_DEFAULT | MCX_OPT_INFO , MY_OPT_HELP , NULL , "print this help" } , { "--add-mark" , MCX_OPT_DEFAULT , MY_OPT_ADD_JUMP , NULL , "add jump bookmark, accepts trailing [mark [destination]]" } , { "--add-portal" , MCX_OPT_DEFAULT , MY_OPT_ADD_PORTAL , NULL , "add portal bookmark, accepts trailing [destination]" } , { "--try-current-first" , MCX_OPT_DEFAULT , MY_OPT_TRY_CURRENT_FIRST , NULL , "try current directory first, then try lookup" } , { "--notify-current" , MCX_OPT_DEFAULT , MY_OPT_NTF_CURRENT , NULL , "emit notification when current directory prevails over lookup" } , { "--try-current-last" , MCX_OPT_DEFAULT , MY_OPT_TRY_CURRENT_LAST , NULL , "try current directory if lookup fails" } , { "-sm" , MCX_OPT_HASARG , MY_OPT_SQUASH_MARK , "" , "take the first occurring destination for (cf -lm)" } , { "-sd" , MCX_OPT_HASARG , MY_OPT_SQUASH_DEST , "" , "remove other marks with the same destination (cf -ld)" } , { "-lm" , MCX_OPT_HASARG , MY_OPT_LIST_MARK , "" , "list all marks " } , { "-ld" , MCX_OPT_HASARG , MY_OPT_LIST_DEST , "" , "list all marks/destinations sharing destination with " } , { "-purge-dest" , MCX_OPT_HASARG , MY_OPT_PURGE_DEST , "" , "delete bookmarks where destination matches " } , { "-purge-mark" , MCX_OPT_HASARG , MY_OPT_PURGE_MARK , "" , "delete bookmarks where mark matches " } , { "-favour" , MCX_OPT_HASARG , MY_OPT_FAVOUR , "[lroLRO]*" , "(level, order, regular) duplicate resolution" } , { "-pick" , MCX_OPT_HASARG , MY_OPT_PICK , "" , "resolve duplicates by picking " } , { "--rehash" , MCX_OPT_DEFAULT , MY_OPT_REHASH , NULL , "re-expand portal bookmarks" } , { "--cwd" , MCX_OPT_DEFAULT , MY_OPT_CWD , NULL , "use getcwd(3) rather than reading pwd(1) output" } , { "--shell-examples" , MCX_OPT_DEFAULT , MY_OPT_SHELL , NULL , "output example macros for tcsh and bash" } , { NULL , 0 , 0 , NULL , NULL } } ; void show_version ( void ) { fprintf ( stdout , "apparix %s, %s\n" "(c) Copyright 2005, 2006, 2007, 2008, 2009, 2010, 2011 Stijn van Dongen.\n" "apparix comes with NO WARRANTY to the extent permitted by law. You may re-\n" "distribute copies of apparix under the terms of the GNU General Public License.\n" , apxNumTag , apxDateTag ) ; } #define BIT_PURGE 1 #define BIT_LIST_DEST 2 typedef struct { int type /* 'j', 'e', 'J' */ ; mcxTing* mark ; mcxTing* dest ; mcxbits info ; int ord ; } bookmark ; typedef struct { bookmark* bms ; int bm_n ; int bm_N ; } folder ; static mcxTing* favour = NULL; unsigned pick = 0; int bookmark_cmp_j_over_J ( const void* bm1 , const void* bm2 ) { const bookmark* b1 = bm1 ; const bookmark* b2 = bm2 ; return b2->type - b1->type ; } int bookmark_cmp_ord ( const void* bm1 , const void* bm2 ) { return ((bookmark*)bm1)->ord - ((bookmark*)bm2)->ord ; } int bookmark_cmp_level ( const void* bm1 , const void* bm2 ) { const bookmark* b1 = bm1 ; const bookmark* b2 = bm2 ; return ( mcxStrCountChar(b1->dest->str, '/', b1->dest->len) - mcxStrCountChar(b2->dest->str, '/', b2->dest->len) ) ; } int bookmark_cmp_mark_favour ( const void* bm1 , const void* bm2 ) { int i=0 ; int cmp_result = 0 ; int c = strcmp(((bookmark*) bm1)->mark->str, ((bookmark*) bm2)->mark->str) ; if (c) return c ; for (i=0;ilen;i++) { int mode = (unsigned char) favour->str[i] ; switch(mode) { case 'l' : cmp_result = bookmark_cmp_level(bm1, bm2) ; break ; case 'L' : cmp_result = bookmark_cmp_level(bm2, bm1) ; break ; case 'o' : cmp_result = bookmark_cmp_ord(bm1, bm2) ; break ; case 'O' : cmp_result = bookmark_cmp_ord(bm2, bm1) ; break ; case 'r' : cmp_result = bookmark_cmp_j_over_J(bm1, bm2) ; break ; case 'R' : cmp_result = bookmark_cmp_j_over_J(bm2, bm1) ; break ; } if (cmp_result) break ; } return cmp_result ; } int bookmark_cmp_mark ( const void* bm1 , const void* bm2 ) { return strcmp(((bookmark*)bm1)->mark->str,((bookmark*)bm2)->mark->str) ; } int bookmark_cmp_dest ( const void* bm1 , const void* bm2 ) { const bookmark* mk1 = bm1 ; const bookmark* mk2 = bm2 ; int res ; if ((res = strcmp(mk1->dest->str,mk2->dest->str))) return res ; if ((res = (((int) mk2->info & BIT_LIST_DEST) - ((int) mk1->info & BIT_LIST_DEST)))) return res ; return strcmp(mk1->mark->str,mk2->mark->str) ; } void* bookmark_init ( void* bm_v ) { bookmark* bm = bm_v ; bm->type = 0 ; bm->mark = mcxTingEmpty(NULL, 12) ; bm->dest = mcxTingEmpty(NULL, 40) ; bm->info = 0 ; bm->ord = 0 ; return bm ; } folder* folder_new ( int bm_N ) { folder* fl = mcxAlloc(sizeof *fl, EXIT_ON_FAIL) ; bookmark* bms = mcxNAlloc (bm_N, sizeof *bms, bookmark_init, EXIT_ON_FAIL) ; fl->bm_n = 0 ; fl->bm_N = bm_N ; fl->bms = bms ; return fl ; } void folder_add ( folder* fl , int type , mcxbits info , const mcxTing* mark , const mcxTing* dest , int ord ) { int bm_n = fl->bm_n ; int bm_N = fl->bm_N ; bookmark* bm = NULL ; if (bm_n >= bm_N) { fl->bms = mcxNRealloc ( fl->bms , 2*bm_N , bm_N , sizeof fl->bms[0] , bookmark_init , EXIT_ON_FAIL ) ; bm_N = 2*bm_N ; } bm = fl->bms+bm_n++ ; bm->type = type ; bm->info = info ; mcxTingWrite(bm->dest, dest->str) ; if (mark) mcxTingWrite(bm->mark, mark->str) ; bm->ord = ord ; fl->bm_n = bm_n ; fl->bm_N = bm_N ; } #if 0 /* not used */ int folder_dups ( folder* fl_any ) { bookmark* bm = fl_any->bms+1 ; int n_dup = 0 ; while (bmbms + fl_any->bm_n) { if (!strcmp(bm[0].mark->str, bm[-1].mark->str)) n_dup++ ; bm++ ; } return n_dup ; } /* this is broken when both contain same mark multiple times */ int folder_dups2 ( folder* fl_uniq /* assume/pretend uniq */ , folder* fl_any ) { bookmark* bmu = fl_uniq->bms ; bookmark* bma = fl_any->bms ; int n_dup = 0 ; while (bmubms+fl_uniq->bm_n && bmabms+fl_any->bm_n) { int c = strcmp(bmu->mark->str, bma->mark->str) ; if (!c) { n_dup++ ; bma++ ; } else if (c < 0) bmu++ ; else bma++ ; } return n_dup ; } #endif void folder_addto ( folder* flall , folder* fl , mcxbool reuse_ord ) { bookmark* bm = fl->bms ; int ord = 0 ; while (bmbms+fl->bm_n) { folder_add(flall, bm->type, bm->info, bm->mark, bm->dest, reuse_ord ? bm->ord : ord++) ; bm++ ; } } /* warning: does not merge in the sense of preserving sort. */ folder* folder_merge ( folder* fl1 , folder* fl2 , mcxbool reuse_ord ) { folder* fl3 = folder_new(fl1->bm_n+fl2->bm_n) ; folder_addto(fl3, fl1, reuse_ord) ; folder_addto(fl3, fl2, reuse_ord) ; return fl3 ; } folder* expand_portal ( mcxIO* xfport , const char* dest ) { DIR * dir = opendir(dest) ; struct dirent *de ; mcxstatus status = STATUS_FAIL ; mcxTing* fqname = mcxTingEmpty(NULL, 512) ; mcxTing* dname = mcxTingEmpty(NULL, 512) ; folder* fl = folder_new(20) ; const char* s_exclude = getenv("APPARIXEXCLUDE") ; int ct = 0 ; while (1) { mcxbool syntaxerror = FALSE ; if (!dir) { mcxErr(us, "cannot open directory %s", dest) ; break ; } while ((de = readdir(dir))) { struct stat dstat ; mcxTingWrite(dname, de->d_name) ; mcxTingPrint(fqname, "%s/%s", dest, de->d_name) ; if ((unsigned char) dname->str[0] == '.') continue ; if (s_exclude && !syntaxerror) { const char* p = s_exclude ; mcxTing* check = mcxTingEmpty(NULL, 20) ; while (p) { const char* pp = strpbrk(p+1, ":,") ; unsigned char t = p[0] ; if (pp) mcxTingNWrite(check, p+1, pp-1-p) ; else mcxTingWrite(check, p+1) ; if (t == ':' && !strcmp(check->str, dname->str)) break ; else if (t == ',' && strstr(dname->str, check->str)) break ; else if (t != ':' && t != ',') { mcxErr(us, "syntax error in APPARIXEXCLUDE") ; syntaxerror = TRUE ; break ; } p = pp ; } mcxTingFree(&check) ; if (!syntaxerror && p) /* we hit an APPARIXEXCLUDE match */ continue ; } if (stat(fqname->str, &dstat) < 0) { mcxErr(us, "error accessing node %s", fqname->str) ; break ; } if (!S_ISDIR(dstat.st_mode)) continue ; fprintf(xfport->fp, "j,%s,%s\n", dname->str, fqname->str) ; folder_add(fl, 'J', 0, dname, fqname, ct++) ; } closedir(dir) ; if (de) break ; status = STATUS_OK ; break ; } mcxTingFree(&fqname) ; mcxTingFree(&dname) ; return fl ; } mcxstatus bookmark_resync_portal ( folder* flport , mcxIO* xfport ) { int i ; const char* portname = xfport->fn->str ; int ct_expansion = 0 ; int ct_portal = 0 ; mcxIOclose(xfport) ; { struct stat dstat ; if (stat(portname, &dstat) < 0) { if (errno == ENOENT) mcxTell(us, "portal file %s will be newly created", portname) ; else mcxErr(us, "cannot access %s, fingers crossed", portname) ; } } mcxIOrenew(xfport, NULL, "w") ; if (mcxIOopen(xfport, EXIT_ON_FAIL)) { mcxErr(us, "panic - portal file is gone, try --rehash") ; return STATUS_FAIL ; } for (i=0;ibm_n;i++) { folder* fl = expand_portal(xfport, flport->bms[i].dest->str) ; if (fl) ct_expansion += fl->bm_n , ct_portal++ ; } /* fixme fl memleak */ mcxTell (us, "expanded %d portals to %d destinations", ct_portal, ct_expansion) ; return STATUS_OK ; } mcxstatus bookmark_backup_rcfile ( const char* name , const char* dest ) { mcxTing* target = dest ? mcxTingPrint(NULL, "%s", dest) : mcxTingPrint(NULL, "%s.bu", name) ; mcxTing* cmd = !strcmp(target->str, "-") ? mcxTingPrint(NULL, "cat %s", name) : mcxTingPrint(NULL, "cp %s %s", name, target->str) ; int cpstat = system(cmd->str) ; if (cpstat) { mcxErr(us, "panic cannot write file %s", target->str) ; return STATUS_FAIL ; } return STATUS_OK ; } void bookmark_report ( const char* kind , folder* fl , const char* mark ) { int i ; for (i=0;ibm_n;i++) { bookmark* bm = fl->bms+i ; if (!strcmp(bm->mark->str, mark)) fprintf(stderr, "%s %s exists -> %s\n", kind, mark, bm->dest->str) ; } } mcxstatus bookmark_resync_rc ( folder* flreg , folder* flport , mcxIO* xfrc ) { int i ; const char* rcname = xfrc->fn->str ; folder* flmerge ; int n_purged = 0 ; const char* echo_s = getenv("APPARIXPURGE") ; mcxenum echo_mode = echo_s ? atoi(echo_s) : 0 ; mcxIOclose(xfrc) ; if (bookmark_backup_rcfile(xfrc->fn->str, NULL)) return STATUS_FAIL ; mcxIOrenew(xfrc, NULL, "w") ; if (mcxIOopen(xfrc, EXIT_ON_FAIL)) { mcxErr(us, "panic - rc file is gone, backup in %s.bu", rcname) ; return STATUS_FAIL ; } flmerge = flport ? folder_merge(flreg, flport, TRUE) : flreg ; qsort(flmerge->bms, flmerge->bm_n, sizeof flmerge->bms[0], bookmark_cmp_ord) ; for (i=0;ibm_n;i++) { bookmark* bm = flmerge->bms+i ; mcxbool purge = bm->info & BIT_PURGE ; FILE* fp = purge ? stdout : xfrc->fp ; int type = bm->type ; if (type == 'j' || type == 'J') (echo_mode == 0 && purge) ? fprintf(fp, "apparix --add-mark %s %s\n", bm->mark->str, bm->dest->str) : fprintf(fp, "j,%s,%s\n", bm->mark->str, bm->dest->str) ; else if (bm->type == 'e') (echo_mode == 0 && purge) ? fprintf(fp, "apparix --add-portal %s\n", bm->dest->str) : fprintf(fp, "e,%s\n", bm->dest->str) ; if (purge) n_purged++ ; } fprintf(stderr, "purged a flock of %d\n", n_purged) ; return STATUS_OK ; } void bookmark_squash ( folder* flreg , mcxIO* xfrc , const char* mark , mcxbool dest ) { int j ; const char* target_dest = NULL ; const char* target_mark = NULL ; if (!flreg->bm_n) return ; if (dest) { for (j=0;jbm_n;j++) { if (!strcmp(flreg->bms[j].mark->str, mark)) { if (target_mark) { mcxErr(us, "multiple targets for mark <%s>", mark) ; return ; } target_dest = flreg->bms[j].dest->str ; target_mark = mark ; } } } else target_mark = mark ; if (!target_mark) return ; if (!favour) favour = mcxTingNew("OLr") /* younger entries before older entries (keep latest & greatest) * deeper levels over shallower levels (irrelevant due to o) * regular before expansions (irrelevant due to o) */ ; qsort(flreg->bms, flreg->bm_n, sizeof flreg->bms[0], bookmark_cmp_mark_favour) ; if (dest) for (j=0;jbm_n;j++) { bookmark* bmj = flreg->bms+j ; if ( !strcmp(bmj->dest->str, target_dest) && strcmp(bmj->mark->str, target_mark) ) bmj->info |= BIT_PURGE ; } else for (j=1;jbm_n;j++) { bookmark* bmj = flreg->bms+j ; bookmark* bmi = bmj - 1 ; if (bmj->type == 'e') mcxErr(us, "internal error e-in-rc-folder") ; if ( !strcmp(bmi->mark->str, target_mark) && !strcmp(bmj->mark->str, target_mark) ) bmj->info |= BIT_PURGE ; } qsort(flreg->bms, flreg->bm_n, sizeof flreg->bms[0], bookmark_cmp_ord) ; } folder* bookmark_undo ( folder* flreg , folder* flport , int num ) { folder* flall = folder_merge(flreg, flport, TRUE) ; int i = flall->bm_n ; qsort(flall->bms, flall->bm_n, sizeof flall->bms[0], bookmark_cmp_ord) ; while (--num >= 0 && --i >= 0) flall->bms[i].info |= BIT_PURGE ; return flall ; } void bookmark_ungrep ( folder* flreg , mcxIO* xfrc , const char* destpat , const char* markpat ) { int i ; for (i=0;ibm_n;i++) { bookmark* bm = flreg->bms+i ; if ( (destpat && strstr(bm->dest->str, destpat)) || (markpat && strstr(bm->mark->str, markpat)) ) bm->info |= BIT_PURGE ; } } void bookmark_list ( const char* what , folder* fl ) { int i ; int n_mark, n_char ; fprintf(stdout, "--- %s\n", what) ; if (!fl->bm_n) return ; fputs(fl->bms[0].mark->str, stdout) ; n_mark = 1 ; n_char = fl->bms[0].mark->len ; for (i=1;ibm_n;i++) { bookmark* bm = fl->bms+i ; int len = strlen(bm->mark->str) ; if (n_char + 1 + len <= 70) fputc(' ', stdout) , n_char += 1 + len ; else fputc('\n', stdout) , n_char = 0 ; fputs(bm->mark->str, stdout) ; } fputc('\n', stdout) ; } mcxstatus bookmark_show ( folder* fl ) { int i ; for (i=0;ibm_n;i++) { bookmark* bm = fl->bms+i ; if (bm->type == 'j' || bm->type == 'J') fprintf ( stdout , "j %-12s %s\n" , bm->mark->str , bm->dest->str ) ; else if (bm->type == 'e') fprintf ( stdout , "%c %-12s %s\n" , bm->type , "" , bm->dest->str ) ; } return STATUS_OK ; } void logit ( const char* line ) { const char* logfile = getenv("APPARIXLOG") ; if (logfile) { mcxIO* xflog = mcxIOnew(logfile, "a") ; if (!mcxIOopen(xflog, RETURN_ON_FAIL)) fputs(line, xflog->fp) ; mcxIOclose(xflog) ; mcxIOfree(&xflog) ; } } mcxstatus bookmark_write_jump ( mcxIO* xfrc , const char* mark , const char* dest ) { mcxTing* line = mcxTingPrint(NULL, "j,%s,%s\n", mark, dest) ; fputs(line->str, xfrc->fp) ; fprintf(stderr, "added: %s -> %s\n", mark, dest) ; logit(line->str) ; mcxTingFree(&line) ; return STATUS_OK ; } folder* bookmark_parse ( mcxIO* xf , mcxbool expansion , folder** flportpp ) { mcxTing* line = mcxTingEmpty(NULL, 512) ; folder* flreg = folder_new(100) ; folder* flport = NULL ; mcxstatus status = STATUS_OK ; int lct = 0 ; int ord = 0 ; if (flportpp) flport = folder_new(10) ; while ( STATUS_OK == (status = mcxIOreadLine(xf, line, MCX_READLINE_CHOMP)) ) { mcxTing* typeting = NULL, *mark = NULL, *dest = NULL ; int n_args = 0 ; char* sth = NULL ; mcxLink* lk = NULL, *root = NULL ; unsigned char type = 0 ; lct++ ; if ( (sth = mcxStrChrAint(line->str, isspace, line->len)) && (unsigned char) sth[0] == '#' ) continue ; if (!(root = mcxTokArgs(line->str, line->len, &n_args, MCX_TOK_DEL_WS))) { mcxErr(us, "parse error at line %d (empty line?)\n", lct) ; break ; } lk = root->next ; typeting = lk->val ; if (typeting->len != 1) { mcxErr(us, "syntax error at line %d token %s", lct, typeting->str) ; continue ; } type = typeting->str[0] ; lk = lk->next ; if (type == 'j' && n_args == 3) { mark = lk->val ; dest = lk->next->val ; } else if (type == 'e' && n_args == 2) { mark = NULL ; dest = lk->val ; } else if (n_args > 3) { mcxErr(us, "comma in destination at line %d - skipping", lct) ; continue ; } else { mcxErr(us, "syntax error at line %d - skipping", lct) ; continue ; } if (type == 'j' && expansion) type = 'J' ; if (type == 'e' && flport) folder_add(flport, type, 0, mark, dest, ord++) ; else folder_add(flreg, type, 0, mark, dest, ord++) ; mcxTingFree(&typeting) ; root->val = NULL ; mcxListFree(&root, mcxTingFree_v) ; } if (flportpp) *flportpp = flport ; return flreg ; } /* - creates if not exists * - sets file pointer at EOF * - returns folder on success, NULL otherwise. */ folder* resource_prepare ( mcxIO* xf , folder** flportpp ) { mcxbool expansion = flportpp ? FALSE : TRUE ; const char* type = expansion ? "expansion" : "bookmark" ; folder* fl = NULL ; if (STATUS_OK == mcxIOopen(xf, RETURN_ON_FAIL)) fl = bookmark_parse(xf, expansion, flportpp) /* xf now positioned at EOF */ ; else { mcxIOrenew(xf, NULL, "w") ; if (mcxIOopen(xf, RETURN_ON_FAIL)) mcxErr(us, "cannot create %s file %s", type, xf->fn->str) ; else { mcxTell(us, "created %s file %s", type, xf->fn->str) ; fl = folder_new(0) ; if (flportpp) *flportpp = folder_new(0) ; } } return fl ; } int resolve_user ( bookmark* bmx , int n_same , bookmark* bmz ) { mcxTing* ans = mcxTingEmpty(NULL, 10) ; mcxIO* xfin = mcxIOnew("-", "r") ; int n_chosen = 0 ; int i ; FILE* fask = stderr ; mcxIOopen(xfin, EXIT_ON_FAIL) ; fprintf ( fask , "multiple hits for mark %s - please choose (abort with x)\n" , bmx->mark->str ) ; for (i=0;istr) ; fprintf(fask, "> ") ; fflush(NULL) ; mcxIOreadLine(xfin, ans, MCX_READLINE_CHOMP) ; if (ans->len && sscanf(ans->str, "%d", &n_chosen) == 1) { if (n_chosen <= 0 || n_chosen > n_same) n_chosen = -2 ; else n_chosen-- ; } else if (!strcmp(ans->str, "x")) n_chosen = -1 ; else n_chosen = -2 ; return n_chosen ; } mcxTing* try_current ( const char* name ) { struct stat dstat ; if (stat(name, &dstat) < 0 || !S_ISDIR(dstat.st_mode)) return NULL ; if (notifycurrent) fprintf(stderr, "(found in current directory)\n") ; return mcxTingNew(name) ; } mcxstatus attempt_jump ( folder* flreg , folder* flexp , mcxTing* mark , mcxTing* sub ) { mcxTing* dest = NULL ; folder* flall = folder_merge(flreg, flexp, FALSE) ; bookmark* bmx = NULL ; bookmark* bmz = flall->bms+flall->bm_n ; bookmark* bm = flall->bms ; mcxstatus status = STATUS_FAIL ; qsort(flall->bms, flall->bm_n, sizeof flall->bms[0], bookmark_cmp_mark) ; while (bm < bmz) { if ( (bm->type == 'j' || bm->type == 'J') && !strcmp(bm->mark->str, mark->str) ) { bmx = bm ; break ; } bm++ ; } while (1) { if (trycurrentfirst) dest = try_current(mark->str) ; if (dest) NOTHING /* trycurrentfirst succeeded */ ; else if (!bmx) NOTHING /* trycurrentlast might still work */ ; else if ( bmx < bmz-1 /* DUPLICATES */ && !strcmp(bmx->mark->str, bmx[1].mark->str) ) { int n_same = 2 ; bm = bmx+1 ; while (bmmark->str, bm[1].mark->str)) n_same++ , bm++ ; if (!favour && !pick) { int ans = resolve_user(bmx, n_same, bmz) ; if (ans < 0) { if (ans == -1) status = STATUS_ABORT ; break ; } else dest = bmx[ans].dest ; } else if (pick) { if (pick <= n_same) dest = bmx[pick-1].dest ; } else /* WARNING changed ordering in this segment */ { qsort(bmx, n_same, sizeof bmx[0], bookmark_cmp_mark_favour) ; dest = bmx->dest ; } } else dest = bmx->dest ; if (!dest && trycurrentlast) dest = try_current(mark->str) ; if (!dest) break ; if (sub) mcxTingPrintAfter(dest, "/%s", sub->str) ; fprintf(stdout, "%s\n", dest->str) ; status = STATUS_OK ; break ; } /* noteme: flall memleak */ return status ; } mcxTing* get_cwd ( void ) { char buf[MY_PATH_MAX+1] ; mcxTing* ret = NULL ; if (use_cwd) { if (!getcwd(buf, MY_PATH_MAX + 1)) mcxErr(us, "cannot get current directory") ; else ret = mcxTingNew(buf) ; } else { mcxIO* xfpipe = mcxIOnew("dummy-file-name", "r") ; FILE* p = popen("pwd", "r") ; if (p) { mcxTing *pwd = mcxTingEmpty(NULL, 256) ; xfpipe->fp = p /* its a hack */ ; mcxIOreadLine(xfpipe, pwd, MCX_READLINE_CHOMP) /* xfpipe: (donot) fixme (yet) warning danger sign todo */ /* readline: fixme check status */ ; if (!ferror(p)) { pclose(p) ; xfpipe->fp = NULL ; mcxIOfree(&xfpipe) ; ret = pwd ; } else mcxErr(us, "pwd does not want to play") ; } else mcxErr(us, "cannot execute pwd") ; } return ret ; } mcxstatus bookmark_add_jump ( folder* flreg , folder* flexp , mcxIO* xfrc , const char* argv[] , int argc , int n_arg_trailing ) { mcxTing* pwd = NULL ; const char* newmark ; const char* dest ; mcxstatus status = STATUS_OK ; dest = n_arg_trailing >= 2 ? argv[argc-1] : NULL ; if (n_arg_trailing > 2) mcxErr(us, "ignoring trailing arguments") ; newmark = dest ? argv[argc-2] : n_arg_trailing == 1 ? argv[argc-1] : NULL ; if (!dest) { if (!(pwd = get_cwd())) { mcxErr(us, "cannot get current directory") ; return STATUS_FAIL ; } dest = pwd->str ; } if (!newmark) { const char* sep = strrchr(dest, '/') ; if (!sep) mcxErr(us, "strange - no separator in %s", dest) , newmark = dest ; else newmark = sep+1 ; } if (strchr(newmark, ',')) { mcxErr(us, "I cannot handle commas in mark") ; status = STATUS_FAIL ; } if (!status) status = bookmark_write_jump(xfrc, newmark, dest) ; if (!status) { bookmark_report("bookmark", flreg, newmark) ; bookmark_report("expansion", flexp, newmark) ; } mcxTingFree(&pwd) ; return status ; } /* sets bits in flreg->bms */ /* sorts bookmarks */ mcxstatus bookmark_list_query ( folder* flreg , const char* mark , mcxbool target_dest ) { dim j ; for (j=0;jbm_n;j++) if (!strcmp(flreg->bms[j].mark->str, mark)) flreg->bms[j].info |= BIT_LIST_DEST ; if (target_dest) qsort(flreg->bms, flreg->bm_n, sizeof flreg->bms[0], bookmark_cmp_dest) ; for (j=0;jbm_n;j++) { bookmark* bm = flreg->bms+j ; if ( bm->info & BIT_LIST_DEST || ( target_dest && (j > 0 && !strcmp(bm->dest->str, (bm-1)->dest->str) && (bm-1)->info & BIT_LIST_DEST ) ) ) fprintf(stdout, "j,%s,%s\n", bm->mark->str, bm->dest->str) , bm->info |= BIT_LIST_DEST ; } return STATUS_OK ; } mcxstatus bookmark_add_portal ( mcxIO* xfrc , mcxIO* xfport , const char* argv[] , int argc , int n_arg_trailing ) { const char* dest= n_arg_trailing == 1 ? argv[argc-1] : NULL ; folder* fl = NULL ; mcxTing* pwd = NULL ; if (n_arg_trailing > 1) { mcxErr(us, "expecting [dest] trailing argument") ; return STATUS_FAIL ; } if (!dest) { if (!(pwd = get_cwd())) { mcxErr(us, "cannot get current directory") ; return STATUS_FAIL ; } dest = pwd->str ; } if ((fl = expand_portal(xfport, dest))) { mcxTing* line = mcxTingPrint(NULL, "e,%s\n", dest) ; fputs(line->str, xfrc->fp) ; fprintf(stderr, "added flock of %d in portal %s\n", fl->bm_n, dest) ; logit(line->str) ; mcxTingFree(&line) ; } else return STATUS_FAIL ; return STATUS_OK ; } mcxstatus show_or_jump ( folder* flreg , folder* flport , folder* flexp , const char* argv[] , int argc , int n_arg_trailing ) { int arg_ofs = argc - n_arg_trailing ; mcxTing* mark = n_arg_trailing > 0 ? mcxTingNew(argv[arg_ofs]) : NULL ; mcxTing* sub = n_arg_trailing > 1 ? mcxTingNew(argv[arg_ofs+1]) : NULL ; mcxstatus status = STATUS_FAIL ; if (!mark) { qsort(flport->bms, flport->bm_n, sizeof flport->bms[0], bookmark_cmp_dest) ; fprintf(stdout, "--- portals\n"); ; bookmark_show(flport) ; qsort(flexp->bms, flexp->bm_n, sizeof flexp->bms[0], bookmark_cmp_dest) ; fprintf(stdout, "--- expansions\n"); ; bookmark_show(flexp) ; qsort(flreg->bms, flreg->bm_n, sizeof flreg->bms[0], bookmark_cmp_dest) ; fprintf(stdout, "--- bookmarks\n"); ; return bookmark_show(flreg) ; } if ( STATUS_FAIL == (status = attempt_jump(flreg, flexp, mark, sub)) && !quietjump ) mcxErr(us, "I have nothing for %s", mark->str) ; return status ; } int main ( int argc , const char* argv[] ) { const char* h = getenv("HOME") ; const char* home = h ? h : "" ; const char* t = getenv("APPARIXTAG") ; const char* tag = t ? t : "" ; mcxTing* fnrc = mcxTingPrint(NULL, "%s/.%sapparixrc", home, tag) ; mcxTing* fnport = mcxTingPrint(NULL, "%s/.%sapparixexpand", home, tag) ; mcxIO* xfrc = mcxIOnew(fnrc->str, "r+") ; mcxIO* xfport = mcxIOnew(fnport->str, "r+") ; mcxstatus status = STATUS_FAIL ; const char* mark = NULL ; folder* flreg = NULL ; folder* flexp = NULL ; folder* flport = NULL /* only allow one of these modes */ ; enum { MODE_DEFAULT , MODE_LIST , MODE_SHOWARG , MODE_PURGE , MODE_UNDO , MODE_PURGE_MARK , MODE_SQUASH_MARK , MODE_SQUASH_DEST , MODE_LIST_DEST , MODE_LIST_MARK , MODE_REHASH , MODE_BACKUP , MODE_ADD_JUMP , MODE_ADD_PORTAL , MODE_SHELL } ; int n_mode = 0 ; int mode = MODE_DEFAULT ; const char* mode_arg = NULL ; int num = 0 ; mcxstatus parseStatus = STATUS_OK ; mcxOption* opts, *opt ; int n_arg_read = 0 ; int n_arg_trailing = 0 ; mcxOptAnchorSortById(options, sizeof(options)/sizeof(mcxOptAnchor) -1) ; if ( !( opts = mcxOptExhaust (options, (char**) argv, argc, 1, &n_arg_read, &parseStatus) ) ) exit(0) ; for (opt=opts;opt->anch;opt++) { mcxOptAnchor* anch = opt->anch ; switch(anch->id) { case MY_OPT_HELP : case MY_OPT_APROPOS : mcxOptApropos(stdout, us, syntax, 20, MCX_OPT_DISPLAY_SKIP, options) ; return 0 ; case MY_OPT_QUIETJUMP : quietjump = TRUE ; break ; case MY_OPT_VERSION : show_version() ; exit(0) ; case MY_OPT_ADD_JUMP : mode = MODE_ADD_JUMP; n_mode++ ; break ; case MY_OPT_ADD_PORTAL : mode = MODE_ADD_PORTAL; n_mode++ ; break ; case MY_OPT_TRY_CURRENT_FIRST : trycurrentfirst = TRUE ; break ; case MY_OPT_NTF_CURRENT : notifycurrent = TRUE ; break ; case MY_OPT_TRY_CURRENT_LAST : trycurrentlast = TRUE ; break ; case MY_OPT_SQUASH_MARK : mode = MODE_SQUASH_MARK ; mark = opt->val ; n_mode++ ; break ; case MY_OPT_SQUASH_DEST : mode = MODE_SQUASH_DEST ; mark = opt->val ; n_mode++ ; break ; case MY_OPT_BACKUP_NAMED : mode = MODE_BACKUP; n_mode++ ; mode_arg = opt->val ; break ; case MY_OPT_LIST : mode = MODE_LIST; n_mode++ ; break ; case MY_OPT_LIST_MARK : mode = MODE_LIST_MARK; ; mark = opt->val ; n_mode++ ; break ; case MY_OPT_LIST_DEST : mode = MODE_LIST_DEST; ; mark = opt->val ; n_mode++ ; break ; case MY_OPT_DUMP : mode = MODE_BACKUP; n_mode++ ; mode_arg = "-" ; break ; case MY_OPT_BACKUP : mode = MODE_BACKUP; n_mode++ ; break ; case MY_OPT_REHASH : mode = MODE_REHASH; n_mode++ ; break ; case MY_OPT_UNDO : mode = MODE_UNDO; n_mode++ ; num = atoi(opt->val) ; break ; case MY_OPT_PURGE_DEST : mode = MODE_PURGE; n_mode++ ; mode_arg = opt->val ; break ; case MY_OPT_PURGE_MARK : mode = MODE_PURGE_MARK; n_mode++ ; mode_arg = opt->val ; break ; case MY_OPT_PICK : pick = atoi(opt->val) ; break ; case MY_OPT_FAVOUR : favour = mcxTingNew(opt->val) ; break ; case MY_OPT_SHELL : mode = MODE_SHELL; n_mode++ ; break ; case MY_OPT_CWD : use_cwd = TRUE ; break ; } } if (n_mode > 1) mcxDie(1, us, "arguments specify multiple modes") ; if (mode == MODE_SHELL) { const char** exline = shell_examples ; while (*exline) fprintf(stdout, "%s\n", *exline) , exline++ ; return STATUS_OK ; } else if (mode == MODE_BACKUP) return bookmark_backup_rcfile(xfrc->fn->str, mode_arg) ; if (!(flreg = resource_prepare(xfrc, &flport))) return STATUS_FAIL ; if (mode == MODE_REHASH) return bookmark_resync_portal(flport, xfport) ; if (!(flexp = resource_prepare(xfport, NULL))) return STATUS_FAIL ; n_arg_trailing = argc - n_arg_read - 1 /* ** ** ** ** ** ** ** ** ** ** ** ** ** ** ** ** ** ** ** ** ** ** ** ** */ ; switch(mode) { case MODE_PURGE : bookmark_ungrep(flreg, xfrc, mode_arg, NULL) ; status = bookmark_resync_rc(flreg, flport, xfrc) ; break ; case MODE_UNDO : { folder* flall = bookmark_undo(flreg, flport, num) ; status = bookmark_resync_rc(flall, NULL, xfrc) ; } break ; case MODE_LIST : bookmark_list("expansions", flexp) ; bookmark_list("bookmarks", flreg) ; break ; case MODE_PURGE_MARK : bookmark_ungrep(flreg, xfrc, NULL, mode_arg) ; status = bookmark_resync_rc(flreg, flport, xfrc) ; break ; case MODE_SQUASH_DEST : bookmark_squash(flreg, xfrc, mark, TRUE) ; status = bookmark_resync_rc(flreg, flport, xfrc) ; break ; case MODE_SQUASH_MARK : bookmark_squash(flreg, xfrc, mark, FALSE) ; status = bookmark_resync_rc(flreg, flport, xfrc) ; break ; case MODE_LIST_DEST : status = bookmark_list_query(flreg, mark, TRUE) ; break ; case MODE_LIST_MARK : status = bookmark_list_query(flreg, mark, FALSE) ; break ; case MODE_ADD_JUMP : status = bookmark_add_jump(flreg, flexp, xfrc, argv, argc, n_arg_trailing) ; break ; case MODE_ADD_PORTAL : status = bookmark_add_portal(xfrc, xfport, argv, argc, n_arg_trailing) ; break ; case MODE_DEFAULT : status = show_or_jump(flreg, flport, flexp, argv, argc, n_arg_trailing) ; break ; } mcxIOclose(xfrc) ; mcxIOclose(xfport) ; return status ; } apparix-11-062/src/version.c000066400000000000000000000001041326043744200156660ustar00rootroot00000000000000const char *apxDateTag = "11-062"; const char *apxNumTag = "1.004"; apparix-11-062/src/version.h000066400000000000000000000001641326043744200157010ustar00rootroot00000000000000#ifndef apx_version_h__ #define apx_version_h__ extern const char *apxDateTag; extern const char *apxNumTag; #endif apparix-11-062/util/000077500000000000000000000000001326043744200142305ustar00rootroot00000000000000apparix-11-062/util/Makefile.am000066400000000000000000000013731326043744200162700ustar00rootroot00000000000000## Process this file with automake to produce Makefile.in ## $Id: Makefile.am-assimilate,v 1.3 2005-12-07 16:58:40 flux Exp $ INCLUDES = -I$(top_srcdir) noinst_LIBRARIES = libutil.a libutil_a_SOURCES = alloc.c array.c rand.c equate.c opt.c io.c \ err.c hash.c heap.c let.c list.c gralloc.c tok.c ting.c ding.c \ tr.c types.c EXTRA_DIST = alloc.h array.h rand.h equate.h hash.h heap.h let.h io.h \ opt.h err.h tok.h ting.h ding.h list.h gralloc.h tok.h \ compile.h getpagesize.h types.h inttypes.h minmax.h tr.h apparix-11-062/util/Makefile.in000066400000000000000000000335401326043744200163020ustar00rootroot00000000000000# Makefile.in generated by automake 1.11 from Makefile.am. # @configure_input@ # Copyright (C) 1994, 1995, 1996, 1997, 1998, 1999, 2000, 2001, 2002, # 2003, 2004, 2005, 2006, 2007, 2008, 2009 Free Software Foundation, # Inc. # This Makefile.in is free software; the Free Software Foundation # gives unlimited permission to copy and/or distribute it, # with or without modifications, as long as this notice is preserved. # This program is distributed in the hope that it will be useful, # but WITHOUT ANY WARRANTY, to the extent permitted by law; without # even the implied warranty of MERCHANTABILITY or FITNESS FOR A # PARTICULAR PURPOSE. @SET_MAKE@ VPATH = @srcdir@ pkgdatadir = $(datadir)/@PACKAGE@ pkgincludedir = $(includedir)/@PACKAGE@ pkglibdir = $(libdir)/@PACKAGE@ pkglibexecdir = $(libexecdir)/@PACKAGE@ am__cd = CDPATH="$${ZSH_VERSION+.}$(PATH_SEPARATOR)" && cd install_sh_DATA = $(install_sh) -c -m 644 install_sh_PROGRAM = $(install_sh) -c install_sh_SCRIPT = $(install_sh) -c INSTALL_HEADER = $(INSTALL_DATA) transform = $(program_transform_name) NORMAL_INSTALL = : PRE_INSTALL = : POST_INSTALL = : NORMAL_UNINSTALL = : PRE_UNINSTALL = : POST_UNINSTALL = : subdir = util DIST_COMMON = $(srcdir)/Makefile.am $(srcdir)/Makefile.in ACLOCAL_M4 = $(top_srcdir)/aclocal.m4 am__aclocal_m4_deps = $(top_srcdir)/acinclude.m4 \ $(top_srcdir)/configure.ac am__configure_deps = $(am__aclocal_m4_deps) $(CONFIGURE_DEPENDENCIES) \ $(ACLOCAL_M4) mkinstalldirs = $(install_sh) -d CONFIG_HEADER = $(top_builddir)/config.h CONFIG_CLEAN_FILES = CONFIG_CLEAN_VPATH_FILES = LIBRARIES = $(noinst_LIBRARIES) AR = ar ARFLAGS = cru libutil_a_AR = $(AR) $(ARFLAGS) libutil_a_LIBADD = am_libutil_a_OBJECTS = alloc.$(OBJEXT) array.$(OBJEXT) rand.$(OBJEXT) \ equate.$(OBJEXT) opt.$(OBJEXT) io.$(OBJEXT) err.$(OBJEXT) \ hash.$(OBJEXT) heap.$(OBJEXT) let.$(OBJEXT) list.$(OBJEXT) \ gralloc.$(OBJEXT) tok.$(OBJEXT) ting.$(OBJEXT) ding.$(OBJEXT) \ tr.$(OBJEXT) types.$(OBJEXT) libutil_a_OBJECTS = $(am_libutil_a_OBJECTS) DEFAULT_INCLUDES = -I.@am__isrc@ -I$(top_builddir) depcomp = $(SHELL) $(top_srcdir)/depcomp am__depfiles_maybe = depfiles am__mv = mv -f COMPILE = $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) \ $(CPPFLAGS) $(AM_CFLAGS) $(CFLAGS) CCLD = $(CC) LINK = $(CCLD) $(AM_CFLAGS) $(CFLAGS) $(AM_LDFLAGS) $(LDFLAGS) -o $@ SOURCES = $(libutil_a_SOURCES) DIST_SOURCES = $(libutil_a_SOURCES) ETAGS = etags CTAGS = ctags DISTFILES = $(DIST_COMMON) $(DIST_SOURCES) $(TEXINFOS) $(EXTRA_DIST) ACLOCAL = @ACLOCAL@ AMTAR = @AMTAR@ AUTOCONF = @AUTOCONF@ AUTOHEADER = @AUTOHEADER@ AUTOMAKE = @AUTOMAKE@ AWK = @AWK@ CC = @CC@ CCDEPMODE = @CCDEPMODE@ CFLAGS = @CFLAGS@ CPP = @CPP@ CPPFLAGS = @CPPFLAGS@ CYGPATH_W = @CYGPATH_W@ DEFS = @DEFS@ DEPDIR = @DEPDIR@ ECHO_C = @ECHO_C@ ECHO_N = @ECHO_N@ ECHO_T = @ECHO_T@ EGREP = @EGREP@ EXEEXT = @EXEEXT@ GREP = @GREP@ INSTALL = @INSTALL@ INSTALL_DATA = @INSTALL_DATA@ INSTALL_PROGRAM = @INSTALL_PROGRAM@ INSTALL_SCRIPT = @INSTALL_SCRIPT@ INSTALL_STRIP_PROGRAM = @INSTALL_STRIP_PROGRAM@ LDFLAGS = @LDFLAGS@ LIBOBJS = @LIBOBJS@ LIBS = @LIBS@ LN_S = @LN_S@ LTLIBOBJS = @LTLIBOBJS@ MAINT = @MAINT@ MAKEINFO = @MAKEINFO@ MKDIR_P = @MKDIR_P@ OBJEXT = @OBJEXT@ PACKAGE = @PACKAGE@ PACKAGE_BUGREPORT = @PACKAGE_BUGREPORT@ PACKAGE_NAME = @PACKAGE_NAME@ PACKAGE_STRING = @PACKAGE_STRING@ PACKAGE_TARNAME = @PACKAGE_TARNAME@ PACKAGE_URL = @PACKAGE_URL@ PACKAGE_VERSION = @PACKAGE_VERSION@ PATH_SEPARATOR = @PATH_SEPARATOR@ RANLIB = @RANLIB@ SET_MAKE = @SET_MAKE@ SHELL = @SHELL@ STRIP = @STRIP@ VERSION = @VERSION@ abs_builddir = @abs_builddir@ abs_srcdir = @abs_srcdir@ abs_top_builddir = @abs_top_builddir@ abs_top_srcdir = @abs_top_srcdir@ ac_ct_CC = @ac_ct_CC@ am__include = @am__include@ am__leading_dot = @am__leading_dot@ am__quote = @am__quote@ am__tar = @am__tar@ am__untar = @am__untar@ bindir = @bindir@ build_alias = @build_alias@ builddir = @builddir@ datadir = @datadir@ datarootdir = @datarootdir@ docdir = @docdir@ dvidir = @dvidir@ exec_prefix = @exec_prefix@ host_alias = @host_alias@ htmldir = @htmldir@ includedir = @includedir@ infodir = @infodir@ install_sh = @install_sh@ libdir = @libdir@ libexecdir = @libexecdir@ localedir = @localedir@ localstatedir = @localstatedir@ mandir = @mandir@ mkdir_p = @mkdir_p@ oldincludedir = @oldincludedir@ pdfdir = @pdfdir@ prefix = @prefix@ program_transform_name = @program_transform_name@ psdir = @psdir@ sbindir = @sbindir@ sharedstatedir = @sharedstatedir@ srcdir = @srcdir@ sysconfdir = @sysconfdir@ target_alias = @target_alias@ top_build_prefix = @top_build_prefix@ top_builddir = @top_builddir@ top_srcdir = @top_srcdir@ INCLUDES = -I$(top_srcdir) noinst_LIBRARIES = libutil.a libutil_a_SOURCES = alloc.c array.c rand.c equate.c opt.c io.c \ err.c hash.c heap.c let.c list.c gralloc.c tok.c ting.c ding.c \ tr.c types.c EXTRA_DIST = alloc.h array.h rand.h equate.h hash.h heap.h let.h io.h \ opt.h err.h tok.h ting.h ding.h list.h gralloc.h tok.h \ compile.h getpagesize.h types.h inttypes.h minmax.h tr.h all: all-am .SUFFIXES: .SUFFIXES: .c .o .obj $(srcdir)/Makefile.in: @MAINTAINER_MODE_TRUE@ $(srcdir)/Makefile.am $(am__configure_deps) @for dep in $?; do \ case '$(am__configure_deps)' in \ *$$dep*) \ ( cd $(top_builddir) && $(MAKE) $(AM_MAKEFLAGS) am--refresh ) \ && { if test -f $@; then exit 0; else break; fi; }; \ exit 1;; \ esac; \ done; \ echo ' cd $(top_srcdir) && $(AUTOMAKE) --gnu util/Makefile'; \ $(am__cd) $(top_srcdir) && \ $(AUTOMAKE) --gnu util/Makefile .PRECIOUS: Makefile Makefile: $(srcdir)/Makefile.in $(top_builddir)/config.status @case '$?' in \ *config.status*) \ cd $(top_builddir) && $(MAKE) $(AM_MAKEFLAGS) am--refresh;; \ *) \ echo ' cd $(top_builddir) && $(SHELL) ./config.status $(subdir)/$@ $(am__depfiles_maybe)'; \ cd $(top_builddir) && $(SHELL) ./config.status $(subdir)/$@ $(am__depfiles_maybe);; \ esac; $(top_builddir)/config.status: $(top_srcdir)/configure $(CONFIG_STATUS_DEPENDENCIES) cd $(top_builddir) && $(MAKE) $(AM_MAKEFLAGS) am--refresh $(top_srcdir)/configure: @MAINTAINER_MODE_TRUE@ $(am__configure_deps) cd $(top_builddir) && $(MAKE) $(AM_MAKEFLAGS) am--refresh $(ACLOCAL_M4): @MAINTAINER_MODE_TRUE@ $(am__aclocal_m4_deps) cd $(top_builddir) && $(MAKE) $(AM_MAKEFLAGS) am--refresh $(am__aclocal_m4_deps): clean-noinstLIBRARIES: -test -z "$(noinst_LIBRARIES)" || rm -f $(noinst_LIBRARIES) libutil.a: $(libutil_a_OBJECTS) $(libutil_a_DEPENDENCIES) -rm -f libutil.a $(libutil_a_AR) libutil.a $(libutil_a_OBJECTS) $(libutil_a_LIBADD) $(RANLIB) libutil.a mostlyclean-compile: -rm -f *.$(OBJEXT) distclean-compile: -rm -f *.tab.c @AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/alloc.Po@am__quote@ @AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/array.Po@am__quote@ @AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/ding.Po@am__quote@ @AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/equate.Po@am__quote@ @AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/err.Po@am__quote@ @AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/gralloc.Po@am__quote@ @AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/hash.Po@am__quote@ @AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/heap.Po@am__quote@ @AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/io.Po@am__quote@ @AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/let.Po@am__quote@ @AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/list.Po@am__quote@ @AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/opt.Po@am__quote@ @AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/rand.Po@am__quote@ @AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/ting.Po@am__quote@ @AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/tok.Po@am__quote@ @AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/tr.Po@am__quote@ @AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/types.Po@am__quote@ .c.o: @am__fastdepCC_TRUE@ $(COMPILE) -MT $@ -MD -MP -MF $(DEPDIR)/$*.Tpo -c -o $@ $< @am__fastdepCC_TRUE@ $(am__mv) $(DEPDIR)/$*.Tpo $(DEPDIR)/$*.Po @AMDEP_TRUE@@am__fastdepCC_FALSE@ source='$<' object='$@' libtool=no @AMDEPBACKSLASH@ @AMDEP_TRUE@@am__fastdepCC_FALSE@ DEPDIR=$(DEPDIR) $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@ @am__fastdepCC_FALSE@ $(COMPILE) -c $< .c.obj: @am__fastdepCC_TRUE@ $(COMPILE) -MT $@ -MD -MP -MF $(DEPDIR)/$*.Tpo -c -o $@ `$(CYGPATH_W) '$<'` @am__fastdepCC_TRUE@ $(am__mv) $(DEPDIR)/$*.Tpo $(DEPDIR)/$*.Po @AMDEP_TRUE@@am__fastdepCC_FALSE@ source='$<' object='$@' libtool=no @AMDEPBACKSLASH@ @AMDEP_TRUE@@am__fastdepCC_FALSE@ DEPDIR=$(DEPDIR) $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@ @am__fastdepCC_FALSE@ $(COMPILE) -c `$(CYGPATH_W) '$<'` ID: $(HEADERS) $(SOURCES) $(LISP) $(TAGS_FILES) list='$(SOURCES) $(HEADERS) $(LISP) $(TAGS_FILES)'; \ unique=`for i in $$list; do \ if test -f "$$i"; then echo $$i; else echo $(srcdir)/$$i; fi; \ done | \ $(AWK) '{ files[$$0] = 1; nonempty = 1; } \ END { if (nonempty) { for (i in files) print i; }; }'`; \ mkid -fID $$unique tags: TAGS TAGS: $(HEADERS) $(SOURCES) $(TAGS_DEPENDENCIES) \ $(TAGS_FILES) $(LISP) set x; \ here=`pwd`; \ list='$(SOURCES) $(HEADERS) $(LISP) $(TAGS_FILES)'; \ unique=`for i in $$list; do \ if test -f "$$i"; then echo $$i; else echo $(srcdir)/$$i; fi; \ done | \ $(AWK) '{ files[$$0] = 1; nonempty = 1; } \ END { if (nonempty) { for (i in files) print i; }; }'`; \ shift; \ if test -z "$(ETAGS_ARGS)$$*$$unique"; then :; else \ test -n "$$unique" || unique=$$empty_fix; \ if test $$# -gt 0; then \ $(ETAGS) $(ETAGSFLAGS) $(AM_ETAGSFLAGS) $(ETAGS_ARGS) \ "$$@" $$unique; \ else \ $(ETAGS) $(ETAGSFLAGS) $(AM_ETAGSFLAGS) $(ETAGS_ARGS) \ $$unique; \ fi; \ fi ctags: CTAGS CTAGS: $(HEADERS) $(SOURCES) $(TAGS_DEPENDENCIES) \ $(TAGS_FILES) $(LISP) list='$(SOURCES) $(HEADERS) $(LISP) $(TAGS_FILES)'; \ unique=`for i in $$list; do \ if test -f "$$i"; then echo $$i; else echo $(srcdir)/$$i; fi; \ done | \ $(AWK) '{ files[$$0] = 1; nonempty = 1; } \ END { if (nonempty) { for (i in files) print i; }; }'`; \ test -z "$(CTAGS_ARGS)$$unique" \ || $(CTAGS) $(CTAGSFLAGS) $(AM_CTAGSFLAGS) $(CTAGS_ARGS) \ $$unique GTAGS: here=`$(am__cd) $(top_builddir) && pwd` \ && $(am__cd) $(top_srcdir) \ && gtags -i $(GTAGS_ARGS) "$$here" distclean-tags: -rm -f TAGS ID GTAGS GRTAGS GSYMS GPATH tags distdir: $(DISTFILES) @srcdirstrip=`echo "$(srcdir)" | sed 's/[].[^$$\\*]/\\\\&/g'`; \ topsrcdirstrip=`echo "$(top_srcdir)" | sed 's/[].[^$$\\*]/\\\\&/g'`; \ list='$(DISTFILES)'; \ dist_files=`for file in $$list; do echo $$file; done | \ sed -e "s|^$$srcdirstrip/||;t" \ -e "s|^$$topsrcdirstrip/|$(top_builddir)/|;t"`; \ case $$dist_files in \ */*) $(MKDIR_P) `echo "$$dist_files" | \ sed '/\//!d;s|^|$(distdir)/|;s,/[^/]*$$,,' | \ sort -u` ;; \ esac; \ for file in $$dist_files; do \ if test -f $$file || test -d $$file; then d=.; else d=$(srcdir); fi; \ if test -d $$d/$$file; then \ dir=`echo "/$$file" | sed -e 's,/[^/]*$$,,'`; \ if test -d "$(distdir)/$$file"; then \ find "$(distdir)/$$file" -type d ! -perm -700 -exec chmod u+rwx {} \;; \ fi; \ if test -d $(srcdir)/$$file && test $$d != $(srcdir); then \ cp -fpR $(srcdir)/$$file "$(distdir)$$dir" || exit 1; \ find "$(distdir)/$$file" -type d ! -perm -700 -exec chmod u+rwx {} \;; \ fi; \ cp -fpR $$d/$$file "$(distdir)$$dir" || exit 1; \ else \ test -f "$(distdir)/$$file" \ || cp -p $$d/$$file "$(distdir)/$$file" \ || exit 1; \ fi; \ done check-am: all-am check: check-am all-am: Makefile $(LIBRARIES) installdirs: install: install-am install-exec: install-exec-am install-data: install-data-am uninstall: uninstall-am install-am: all-am @$(MAKE) $(AM_MAKEFLAGS) install-exec-am install-data-am installcheck: installcheck-am install-strip: $(MAKE) $(AM_MAKEFLAGS) INSTALL_PROGRAM="$(INSTALL_STRIP_PROGRAM)" \ install_sh_PROGRAM="$(INSTALL_STRIP_PROGRAM)" INSTALL_STRIP_FLAG=-s \ `test -z '$(STRIP)' || \ echo "INSTALL_PROGRAM_ENV=STRIPPROG='$(STRIP)'"` install mostlyclean-generic: clean-generic: distclean-generic: -test -z "$(CONFIG_CLEAN_FILES)" || rm -f $(CONFIG_CLEAN_FILES) -test . = "$(srcdir)" || test -z "$(CONFIG_CLEAN_VPATH_FILES)" || rm -f $(CONFIG_CLEAN_VPATH_FILES) maintainer-clean-generic: @echo "This command is intended for maintainers to use" @echo "it deletes files that may require special tools to rebuild." clean: clean-am clean-am: clean-generic clean-noinstLIBRARIES mostlyclean-am distclean: distclean-am -rm -rf ./$(DEPDIR) -rm -f Makefile distclean-am: clean-am distclean-compile distclean-generic \ distclean-tags dvi: dvi-am dvi-am: html: html-am html-am: info: info-am info-am: install-data-am: install-dvi: install-dvi-am install-dvi-am: install-exec-am: install-html: install-html-am install-html-am: install-info: install-info-am install-info-am: install-man: install-pdf: install-pdf-am install-pdf-am: install-ps: install-ps-am install-ps-am: installcheck-am: maintainer-clean: maintainer-clean-am -rm -rf ./$(DEPDIR) -rm -f Makefile maintainer-clean-am: distclean-am maintainer-clean-generic mostlyclean: mostlyclean-am mostlyclean-am: mostlyclean-compile mostlyclean-generic pdf: pdf-am pdf-am: ps: ps-am ps-am: uninstall-am: .MAKE: install-am install-strip .PHONY: CTAGS GTAGS all all-am check check-am clean clean-generic \ clean-noinstLIBRARIES ctags distclean distclean-compile \ distclean-generic distclean-tags distdir dvi dvi-am html \ html-am info info-am install install-am install-data \ install-data-am install-dvi install-dvi-am install-exec \ install-exec-am install-html install-html-am install-info \ install-info-am install-man install-pdf install-pdf-am \ install-ps install-ps-am install-strip installcheck \ installcheck-am installdirs maintainer-clean \ maintainer-clean-generic mostlyclean mostlyclean-compile \ mostlyclean-generic pdf pdf-am ps ps-am tags uninstall \ uninstall-am # Tell versions [3.59,3.63) of GNU make to not export all variables. # Otherwise a system limit (for SysV at least) may be exceeded. .NOEXPORT: apparix-11-062/util/alloc.c000066400000000000000000000075771326043744200155060ustar00rootroot00000000000000/* (C) Copyright 1999, 2000, 2001, 2002, 2003, 2004, 2005 Stijn van Dongen * (C) Copyright 2006, 2007, 2008, 2009 Stijn van Dongen * * This file is part of tingea. You can redistribute and/or modify tingea * under the terms of the GNU General Public License; either version 3 of the * License or (at your option) any later version. You should have received a * copy of the GPL along with tingea, in the file COPYING. */ /* include include include include */ #include #include #include #include "alloc.h" #include "err.h" static dim mcx_alloc_maxchunksize = 1048576; static long mcx_alloc_maxtimes = -1; static mcxbool mcx_alloc_limit = FALSE; void mcxAllocLimits ( long maxchunksize , long maxtimes ) { if (maxchunksize > 0) mcx_alloc_maxchunksize = maxchunksize ; if (maxtimes > 0) mcx_alloc_maxtimes = maxtimes ; mcx_alloc_limit = TRUE; ; } void* mcxRealloc ( void* object , dim new_size , mcxOnFail ON_FAIL ) { void* mblock = NULL ; mcxstatus status = STATUS_OK ; const char* me = "mcxRealloc" ; if (!new_size) { if (object) mcxFree(object) ; } else { if ( mcx_alloc_limit && (!mcx_alloc_maxtimes-- || new_size > mcx_alloc_maxchunksize) ) mblock = NULL ; else mblock = object ? realloc(object, new_size) : malloc(new_size) ; } if (new_size && (!mblock)) mcxMemDenied(stderr, me, "byte", new_size) , status = 1 ; if (status) { const char* tin = getenv("TINGEA_MEM_SIGNAL") ; if (tin) { unsigned tintin = atoi(tin) ; raise(tintin ? tintin : SIGSEGV) ; } if (ON_FAIL == SLEEP_ON_FAIL) { mcxTell(me, "pid %ld, entering sleep mode", (long) getpid()) ; while(1) sleep(1000) ; } if (ON_FAIL == EXIT_ON_FAIL || ON_FAIL == ENQUIRE_ON_FAIL) { mcxTell(me, "going down") ; if (ON_FAIL == ENQUIRE_ON_FAIL) mcxTell(me, "ENQUIRE fail mode ignored") ; exit(1) ; } } return mblock ; } void mcxNFree ( void* base , dim n_elem , dim elem_size , void (*obRelease) (void *) ) { if (n_elem && obRelease) { char *ob = base ; while (n_elem-- > 0) obRelease(ob) , ob += elem_size ; } mcxFree(base) ; } void* mcxNAlloc ( dim n_elem , dim elem_size , void* (*obInit) (void *) , mcxOnFail ON_FAIL ) { return mcxNRealloc(NULL, n_elem, 0, elem_size, obInit, ON_FAIL) ; } void* mcxNRealloc ( void* mem , dim n_elem , dim n_elem_prev , dim elem_size , void* (*obInit) (void *) , mcxOnFail ON_FAIL ) { char* ob ; mem = mcxRealloc(mem, n_elem * elem_size, ON_FAIL) ; if (!mem) return NULL ; if (obInit && n_elem > n_elem_prev) { ob = ((char*) mem) + (elem_size * n_elem_prev) ; while (n_elem-- > n_elem_prev) /* careful with unsignedness */ { obInit(ob) ; ob += elem_size ; } } return mem ; } void mcxMemDenied ( FILE* channel , const char* requestee , const char* unittype , dim n ) { mcxErrf ( channel , requestee , "memory shortage: could not alloc [%lu] instances of [%s]" , (ulong) n , unittype ) ; } void mcxFree ( void* object ) { if (object) free(object) ; } void* mcxAlloc ( dim size , mcxOnFail ON_FAIL ) { return mcxRealloc(NULL, size, ON_FAIL) ; } apparix-11-062/util/alloc.h000066400000000000000000000036531326043744200155020ustar00rootroot00000000000000/* (C) Copyright 1999, 2000, 2001, 2002, 2003, 2004, 2005 Stijn van Dongen * (C) Copyright 2006, 2007, 2008, 2009 Stijn van Dongen * * This file is part of tingea. You can redistribute and/or modify tingea * under the terms of the GNU General Public License; either version 3 of the * License or (at your option) any later version. You should have received a * copy of the GPL along with tingea, in the file COPYING. */ #ifndef tingea_alloc_h #define tingea_alloc_h #include /* ========================================================================= * * * mcxRealloc is notable, for it *frees* memory and returns a NULL pointer * if the newly requested block has size 0. This must be so in order to * allow routines to do their math and housekeeping. If they register the * new block as having 0 bytes, then they need not and must not attempt to * free it thereafter. * * ========================================================================= * */ #include "types.h" void* mcxAlloc ( dim size , mcxOnFail ON_FAIL ) ; void* mcxRealloc ( void* object , dim new_size , mcxOnFail ON_FAIL ) ; void mcxFree ( void* object ) ; void mcxNFree ( void* base , dim n_elem , dim elem_size , void (*obRelease) (void *) ) ; void* mcxNAlloc ( dim n_elem , dim elem_size , void* (*obInit) (void *) , mcxOnFail ON_FAIL ) ; void* mcxNRealloc ( void* mem , dim n_elem , dim n_elem_prev , dim elem_size , void* (*obInit) (void *) , mcxOnFail ON_FAIL ) ; void mcxMemDenied ( FILE* channel , const char* requestee , const char* unittype , dim n ) ; void mcxAllocLimits ( long maxchunksize , long maxtimes ) ; #endif apparix-11-062/util/array.c000066400000000000000000000303131326043744200155120ustar00rootroot00000000000000/* (C) Copyright 2000, 2001, 2002, 2003, 2004, 2005 Stijn van Dongen * (C) Copyright 2006, 2007, 2008, 2009 Stijn van Dongen * * This file is part of tingea. You can redistribute and/or modify tingea * under the terms of the GNU General Public License; either version 3 of the * License or (at your option) any later version. You should have received a * copy of the GPL along with tingea, in the file COPYING. */ #include #include #include #include #include "array.h" #include "alloc.h" #include "types.h" #include "err.h" #include "minmax.h" mcxstatus mcxSplice ( void* base1pptr , const void* base2ptr , dim size /* size of base1 and base2 members */ , dim *pn_base1 /* # base1 elements currently in use */ , dim *pN_base1 /* # base1 elements for which is malloced */ , ofs O_base1 /* splice relative to this element */ , dim d_base1 /* delete this number of elements */ , dim c_base2 /* number of elements to copy */ ) { char **ppr1 = (char **) base1pptr ; char* dummy ; const char *ptr2 = (const char *) base2ptr ; dim n_base1 = *pn_base1 ; dim N_base1 = *pN_base1 ; dim m_base1 = 0, o_base1 = 0 ; const char *errMsg = "" ; mcxstatus stat = STATUS_FAIL ; do { if (n_base1 > N_base1) { errMsg = "integer arguments not consistent" ; break ; } if (n_base1 + c_base2 < d_base1) { errMsg = "overly deleterious" ; break ; } m_base1 = (n_base1 + c_base2) - d_base1 /* new size */ ; if (O_base1 >= 0) o_base1 = O_base1 ; else { if ((dim) -O_base1 > n_base1 + 1) { errMsg = "offset specification out of bounds" ; break ; } o_base1 = (n_base1 + 1) + O_base1 ; } if (o_base1 > n_base1) { errMsg = "computed splice offset not in bounds" ; break ; } if (*ppr1 == NULL && ptr2 == NULL) { errMsg = "source and destination both void" ; break ; } if (o_base1 + d_base1 > n_base1) { errMsg = "not that many elements to delete" ; break ; } stat = STATUS_OK ; } while (0) ; if (stat != STATUS_OK) { mcxErr("[mcxSplice PBD]", "%s", errMsg) ; mcxErr ( "[mcxSplice PBD]" , "[n1, %lu] [N1, %lu] [o1, %lu] [d1, %lu] [c2, %lu]" , (ulong) n_base1, (ulong) N_base1 , (ulong) O_base1 , (ulong) d_base1, (ulong) c_base2 ) ; return STATUS_FAIL ; } if (m_base1 > N_base1) { if (!(dummy = mcxRealloc(*ppr1, size*m_base1, RETURN_ON_FAIL))) { mcxMemDenied(stderr, "mcxSplice", "void", m_base1) ; return STATUS_FAIL ; } *pN_base1 = N_base1 = m_base1 ; *ppr1 = dummy ; } if (o_base1 < n_base1) memmove ( *ppr1 + size*(o_base1 + c_base2) , *ppr1 + size*(o_base1 + d_base1) , size*(n_base1 - o_base1 - d_base1) ) ; if (c_base2) memcpy ( *ppr1 + size * (o_base1) , ptr2 , size*(c_base2) ) ; *pn_base1 = m_base1 ; return STATUS_OK ; } /* fixme, this implementation looks ugly (nested while). use instead: ; for (offset=1;offsetmempptr = mempptr ; buf->size = size ; buf->n = 0 ; buf->bFinalized = 0 ; buf->factor = 1.41 ; dummy = mcxRealloc ( *usrpptr , n_alloc * size , RETURN_ON_FAIL ) ; if (n_alloc && !dummy) { mcxMemDenied(stderr, "mcxBufInit", "char", n_alloc * size) ; buf->n_alloc = 0 ; return STATUS_FAIL ; } buf->n_alloc = n_alloc ; *usrpptr = dummy ; return STATUS_OK ; } void* mcxBufExtend ( mcxBuf* buf , dim n_request , mcxOnFail ON_FAIL ) { dim oldsize = buf->n ; char **usrpptr = (char **) buf->mempptr ; char* dummy ; if (buf->bFinalized) mcxErr("mcxBufExtend PBD", "extending finalized buffer") ; if (buf->n_alloc < buf->n + n_request) { dim n_new = MCX_MAX ( (dim) (buf->n_alloc * buf->factor + 8) , (dim) (buf->n + n_request) ) ; dummy = mcxRealloc(*usrpptr, n_new * buf->size, ON_FAIL) ; if (n_new && !dummy) { mcxMemDenied(stderr,"mcxBufExtend","char",buf->n*buf->size) ; return NULL ; } buf->n_alloc = n_new ; *usrpptr = dummy ; } buf->n += n_request ; return *usrpptr + (oldsize * buf->size) ; } dim mcxBufFinalize ( mcxBuf* buf ) { char **usrpptr = (char **) buf->mempptr ; char* dummy ; if (buf->bFinalized) mcxErr("mcxBufFinalize PBD", "extending finalized buffer") ; else buf->bFinalized = 1 ; dummy = mcxRealloc ( *usrpptr , buf->n * buf->size , RETURN_ON_FAIL ) ; if (buf->n && !dummy) { mcxMemDenied(stderr, "mcxBufFinalize", "char", buf->n * buf->size) ; errno = ENOMEM ; return buf->n ; } *usrpptr = dummy ; buf->n_alloc = buf->n ; return buf->n ; } void mcxBufReset ( mcxBuf* buf , void* mempptr ) { if (!buf->bFinalized) mcxErr("mcxBufReset PBD", "buffer not finalized") ; buf->mempptr = mempptr ; buf->n = 0 ; buf->n_alloc = 0 ; buf->bFinalized = 0 ; } /* Return a larger or equal element; the smallest of these. * The result is the minimal element at least as big as pivot. * and a 'ceil' for pivot. */ void* mcxBsearchCeil ( const void *pivot , const void *base , dim nmemb , dim size , int (*cmp)(const void *, const void *) ) { dim lft = -1 /* on purpose; we use wraparound */ ; dim rgt = nmemb ; dim bar = nmemb/2 /* nothing, or nothing that is larger than pivot */ ; if (!nmemb || cmp(pivot, ((char*)base) + (nmemb-1) * size) > 0) return NULL /* invariant: lft points to a * a member that is smaller than pivot or it * points before the first member. */ ; while (lft+1 < rgt) { /* bar is smaller than pivot, move lft inward */ if (cmp(pivot, ((char*) base) + bar*size) > 0) lft = bar /* bar is larger or equal element, move rgt inward */ ; else rgt = bar /* update bar to be the middle of lft and rgt * when lft == -1 this depends on unsigned wraparound. */ ; bar = rgt - (rgt-lft) / 2; ; } return (((char*) base) + bar * size) ; } /* Return a smaller or equal element; the largest of these. * The result is the maximal element not exceeding pivot, * and a 'floor' for pivot. */ void* mcxBsearchFloor ( const void *pivot , const void *base , dim nmemb , dim size , int (*cmp)(const void *, const void *) ) { dim lft = 0 ; dim rgt = nmemb ; dim bar = nmemb / 2 /* nothing, or nothing that is smaller than pivot */ ; if (!nmemb || cmp(pivot, base) < 0) return NULL /* invariant: rgt points to a * a member that is larger than pivot or it * points beyond the last member. */ ; while (lft+1 < rgt) { /* bar is greater than pivot, move right inward */ if (cmp(pivot, ((char*) base) + bar*size) < 0) rgt = bar /* bar is smaller than (or equal to) pivot element, move lft inward */ ; else lft = bar /* update bar to be the middle of lft and rgt */ ; bar = lft + (rgt-lft) / 2; ; } return (((char*) base) + bar * size) ; } /* TODO: compare with std::lower_bound implementation template fwd_it lower_bound(fwd_it first, fwd_it last, const t & val) { typedef typename iterator_traits::difference_type distance; distance len = std::distance(first, last); distance half; fwd_it middle; while (len > 0) { half = len >> 1; middle = first; std::advance(middle, half); if (*middle < val) { first = middle; ++first; len = len - half - 1; } else len = half; } return first; } */ double mcxMedian ( void* base , dim n , dim sz , double (*get)(const void*) , double* iqr ) { double median = 0.0, q1 = 0.0, q2 = 0.0, quant = 0.0 ; if (n > 1) median = (get((char*) base + sz * (n/2)) + get((char*) base+ sz * ((n-1)/2))) / 2.0 ; else if (n == 1) median = get(base) /* p locates the left boundary of quantile, * q locates the right boundary. We need to interpolate * neighbours in case the boundaries don't fall exacly * on integer offsets. In that case pLoffset and rOffset * are different and a weighted mean between them * is computed. */ ; if (n > 1) { dim n3 = 3 * n ; dim pLoffset = n / 4 ; dim pRoffset = pLoffset + 1 ; double pLweight = (4 - (n % 4)) / 4.0 ; double pRweight = 1.0 - pLweight ; dim qRoffset = (n3 - (n3 % 4)) / 4 ; dim qLoffset = qRoffset - 1 ; double qRweight = (n3 % 4) / 4.0 ; double qLweight = 1 - qRweight ; q1 = pLweight * get((char*) base + sz * pLoffset) + pRweight * get((char*) base + sz * pRoffset) ; q2 = qLweight * get((char*) base + sz * qLoffset) + qRweight * get((char*) base + sz * qRoffset) ; quant = q2 - q1 ; if (quant < 0) quant = -quant ; } *iqr = quant ; return median ; } void mcxShuffle ( void* datap , dim nmem , dim mem_size , char* mem_cell /* should have mem_size size */ ) { dim n = nmem ; char* data = datap ; while (n > 0) { unsigned long r = (random() >> 3) % n /* Fisher-Yates shuffle */ ; if (r != n-1) { memcpy(mem_cell, data + (n-1) * mem_size, mem_size) ; memcpy(data + (n-1) * mem_size, data + r * mem_size, mem_size) ; memcpy(data + r * mem_size, mem_cell, mem_size) ; } n-- ; } } apparix-11-062/util/array.h000066400000000000000000000077471326043744200155360ustar00rootroot00000000000000/* (C) Copyright 2000, 2001, 2002, 2003, 2004, 2005 Stijn van Dongen * (C) Copyright 2006, 2007, 2008, 2009 Stijn van Dongen * * This file is part of tingea. You can redistribute and/or modify tingea * under the terms of the GNU General Public License; either version 3 of the * License or (at your option) any later version. You should have received a * copy of the GPL along with tingea, in the file COPYING. */ #ifndef tingea_array_h #define tingea_array_h #include "types.h" mcxstatus mcxSplice ( void* base1pp /* _address_ of pointer to elements */ , const void* base2p /* pointer to elements */ , dim size /* size of base1 and base2 members */ , dim *n_base1 /* total length of elements after base1 */ , dim *N_base1 /* number of alloc'ed elements for base1 */ , ofs o_base1 /* splice relative to this ofset */ , dim d_base1 /* delete this number of elements */ , dim c_base2 /* number of elements to copy */ ) ; dim mcxDedup ( void* base , dim nmemb , dim size , int (*cmp)(const void *, const void *) , void (*merge)(void *, const void *) ) ; mcxstatus mcxResize ( void* mempp , dim size , dim* ct , dim newct , mcxOnFail ON_FAIL ) ; /* Return largest element smaller than or equal to key. * return NULL if no element is smaller than key. * Returns rightmost element in case entries sort identically, * (note: mcxBsearchCeil will then return the leftmost element) * * base should be sorted according to cmp */ void* mcxBsearchFloor ( const void *key , const void *base , dim nmemb , dim size , int (*cmp)(const void *, const void *) ) ; /* Return smallest element larger than or equal to key. * return NULL if no element is larger than key. * Returns leftmost element in case entries sort identically, * (note: mcxBsearchFloor will then return the rightmost element) * * base should be sorted according to cmp */ void* mcxBsearchCeil ( const void *key , const void *base , dim nmemb , dim size , int (*cmp)(const void *, const void *) ) ; /* Uses weighted combinations of neighbours when the quartile * range does not fall perfectly on array offsets (i.e. * when the array size is not a multiple of 4. */ double mcxMedian ( void* base , dim n , dim sz , double (*get)(const void*) , double* iqr ) ; /* Fisher Yates shuffle */ void mcxShuffle ( void* datap , dim nmem , dim mem_size , char* mem_cell /* should have mem_size size */ ) ; typedef struct { void* mempptr ; dim size ; dim n ; dim n_alloc ; float factor ; mcxbool bFinalized ; } mcxBuf ; /* * *mempptr should be peekable; NULL or valid memory pointer. */ mcxstatus mcxBufInit ( mcxBuf* buf , void* mempptr , dim size , dim n ) ; /* * Extends the buffer by n_request unitialized chunks and returns a pointer * to this space. It is the caller's responsibility to treat this space * consistently. The counter buf->n is increased by n_request. * * If we cannot extend (realloc), a NULL pointer is returned; * the original space is left intact. * * Returns NULL on (alloc) failure */ void* mcxBufExtend ( mcxBuf* buf , dim n_request , mcxOnFail ON_FAIL ) ; /* * Make superfluous memory reclaimable by system, * prepare for discarding buf (but not *(buf->memptr)!) * * If for some bizarre reason we cannot shrink (realloc), * errno is set to ENOMEM. * the original space is left intact. Its size is in buf.n . */ dim mcxBufFinalize ( mcxBuf* buf ) ; /* * Make buffer refer to a new variable. Size cannot be changed, * so variable should be of same type as before. */ void mcxBufReset ( mcxBuf* buf , void* mempptr ) ; #endif apparix-11-062/util/compile.h000066400000000000000000000044641326043744200160410ustar00rootroot00000000000000/* (C) Copyright 2001, 2002, 2003, 2004, 2005 Stijn van Dongen * (C) Copyright 2006, 2007, 2008, 2009 Stijn van Dongen * * This file is part of tingea. You can redistribute and/or modify tingea * under the terms of the GNU General Public License; either version 3 of the * License or (at your option) any later version. You should have received a * copy of the GPL along with tingea, in the file COPYING. */ #ifndef tingea_compile_h #define tingea_compile_h #ifndef TINGEA__TYPED_MINMAX # define TINGEA__TYPED_MINMAX 0 #endif #ifndef __GNUC__ # define MCX_GNUC_OK 0 # define inline /* no inline */ # define cpl__pure /* no pure */ # define cpl__const /* no const */ # define cpl__noreturn /* no noreturn */ # define cpl__malloc /* no malloc */ # define cpl__must_check /* no warn_unused_result */ # define cpl__deprecated /* no deprecated */ # define cpl__used /* no used */ # define cpl__unused /* no unused */ # define cpl__packed /* no packed */ # define likely(x) (x) # define unlikely(x) (x) #else #define MCX_GNUC_OK 1 #if __GNUC__ >= 3 # define inline __inline__ __attribute__ ((always_inline)) # define cpl__pure __attribute__ ((pure)) # define cpl__const __attribute__ ((const)) # define cpl__noreturn __attribute__ ((noreturn)) # define cpl__malloc __attribute__ ((malloc)) # define cpl__must_check __attribute__ ((warn_unused_result)) # define cpl__deprecated __attribute__ ((deprecated)) # define cpl__used __attribute__ ((used)) # define cpl__unused __attribute__ ((unused)) # define cpl__packed __attribute__ ((packed)) # define likely(x) __builtin_expect (!!(x), 1) # define unlikely(x) __builtin_expect (!!(x), 0) #else # define inline /* no inline */ # define cpl__pure /* no pure */ # define cpl__const /* no const */ # define cpl__noreturn /* no noreturn */ # define cpl__malloc /* no malloc */ # define cpl__must_check /* no warn_unused_result */ # define cpl__deprecated /* no deprecated */ # define cpl__used /* no used */ # define cpl__unused /* no unused */ # define cpl__packed /* no packed */ # define likely(x) (x) # define unlikely(x) (x) #endif #endif #endif apparix-11-062/util/ding.c000066400000000000000000000226451326043744200153260ustar00rootroot00000000000000/* (C) Copyright 1999, 2000, 2001, 2002, 2003, 2004, 2005 Stijn van Dongen * (C) Copyright 2006, 2007, 2008, 2009 Stijn van Dongen * * This file is part of tingea. You can redistribute and/or modify tingea * under the terms of the GNU General Public License; either version 3 of the * License or (at your option) any later version. You should have received a * copy of the GPL along with tingea, in the file COPYING. */ #include #include #include #include #include #include "ding.h" #include "types.h" #include "alloc.h" #include "minmax.h" char* mcxStrDup ( const char* str ) { return mcxStrNDup(str, strlen(str)) ; } char* mcxStrNDup ( const char* str , dim n ) { char* rts = mcxAlloc(n+1, RETURN_ON_FAIL) ; if (rts) memcpy(rts, str, n) , rts[n] = '\0' ; return rts ; } dim mcxStrCountChar ( const char* p , char c , ofs len ) { const char* z = p ; dim ct = 0 ; z += (len >= 0) ? (dim) len : strlen(p) ; while (p= 0 ? p+offset : p + strlen(p) ; while (--z >= p && !fbool((unsigned char) *z)) ; return (char*) (z >= p ? z : NULL) ; } char* mcxStrRChrAint ( const char* p , int (*fbool)(int c) , ofs offset ) { const char* z = offset >= 0 ? p+offset : p + strlen(p) ; while (--z >= p && fbool((unsigned char) *z)) ; return (char*) (z >= p ? z : NULL) ; } const char* bit8[256] = { "00000000" , "00000001" , "00000010" , "00000011" , "00000100" , "00000101" , "00000110" , "00000111" , "00001000" , "00001001" , "00001010" , "00001011" , "00001100" , "00001101" , "00001110" , "00001111" , "00010000" , "00010001" , "00010010" , "00010011" , "00010100" , "00010101" , "00010110" , "00010111" , "00011000" , "00011001" , "00011010" , "00011011" , "00011100" , "00011101" , "00011110" , "00011111" , "00100000" , "00100001" , "00100010" , "00100011" , "00100100" , "00100101" , "00100110" , "00100111" , "00101000" , "00101001" , "00101010" , "00101011" , "00101100" , "00101101" , "00101110" , "00101111" , "00110000" , "00110001" , "00110010" , "00110011" , "00110100" , "00110101" , "00110110" , "00110111" , "00111000" , "00111001" , "00111010" , "00111011" , "00111100" , "00111101" , "00111110" , "00111111" , "01000000" , "01000001" , "01000010" , "01000011" , "01000100" , "01000101" , "01000110" , "01000111" , "01001000" , "01001001" , "01001010" , "01001011" , "01001100" , "01001101" , "01001110" , "01001111" , "01010000" , "01010001" , "01010010" , "01010011" , "01010100" , "01010101" , "01010110" , "01010111" , "01011000" , "01011001" , "01011010" , "01011011" , "01011100" , "01011101" , "01011110" , "01011111" , "01100000" , "01100001" , "01100010" , "01100011" , "01100100" , "01100101" , "01100110" , "01100111" , "01101000" , "01101001" , "01101010" , "01101011" , "01101100" , "01101101" , "01101110" , "01101111" , "01110000" , "01110001" , "01110010" , "01110011" , "01110100" , "01110101" , "01110110" , "01110111" , "01111000" , "01111001" , "01111010" , "01111011" , "01111100" , "01111101" , "01111110" , "01111111" , "10000000" , "10000001" , "10000010" , "10000011" , "10000100" , "10000101" , "10000110" , "10000111" , "10001000" , "10001001" , "10001010" , "10001011" , "10001100" , "10001101" , "10001110" , "10001111" , "10010000" , "10010001" , "10010010" , "10010011" , "10010100" , "10010101" , "10010110" , "10010111" , "10011000" , "10011001" , "10011010" , "10011011" , "10011100" , "10011101" , "10011110" , "10011111" , "10100000" , "10100001" , "10100010" , "10100011" , "10100100" , "10100101" , "10100110" , "10100111" , "10101000" , "10101001" , "10101010" , "10101011" , "10101100" , "10101101" , "10101110" , "10101111" , "10110000" , "10110001" , "10110010" , "10110011" , "10110100" , "10110101" , "10110110" , "10110111" , "10111000" , "10111001" , "10111010" , "10111011" , "10111100" , "10111101" , "10111110" , "10111111" , "11000000" , "11000001" , "11000010" , "11000011" , "11000100" , "11000101" , "11000110" , "11000111" , "11001000" , "11001001" , "11001010" , "11001011" , "11001100" , "11001101" , "11001110" , "11001111" , "11010000" , "11010001" , "11010010" , "11010011" , "11010100" , "11010101" , "11010110" , "11010111" , "11011000" , "11011001" , "11011010" , "11011011" , "11011100" , "11011101" , "11011110" , "11011111" , "11100000" , "11100001" , "11100010" , "11100011" , "11100100" , "11100101" , "11100110" , "11100111" , "11101000" , "11101001" , "11101010" , "11101011" , "11101100" , "11101101" , "11101110" , "11101111" , "11110000" , "11110001" , "11110010" , "11110011" , "11110100" , "11110101" , "11110110" , "11110111" , "11111000" , "11111001" , "11111010" , "11111011" , "11111100" , "11111101" , "11111110" , "11111111" } ; mcxTing* mcxMemPrint ( mcxTing* ting , void* p , dim n_bytes , mcxbits flags ) { char* m = p ; mcxbool space = !(flags & MCX_MEMPRINT_NOSPACE) ; mcxbool rev = flags & MCX_MEMPRINT_REVERSE ; dim i ; ting = mcxTingEmpty(ting, 32) ; for (i=0;i best) best = TBL(i+1,j+1) ; } *lcs = best ; } free(tbl) ; return min_val ; } int mcxSetenv ( const char* kv ) { mcxTing* tv = mcxTingNew(kv) ; if (!strchr(kv, '=')) mcxTingAppend(tv, "=1") ; return putenv(mcxTinguish(tv)) ; } mcxstatus mcxStrTol ( const char* s , long* value , char** end ) { int errno_sa = errno ; char* e = NULL ; mcxstatus status = STATUS_OK ; errno = 0 ; *value = strtol(s, &e, 10) ; if (errno || e == s) status = STATUS_FAIL ; errno = errno_sa ; if (end) *end = e ; return status ; } mcxstatus mcxStrToul ( const char* s , ulong* value , char** end ) { int errno_sa = errno ; mcxstatus status = STATUS_OK ; char* e = NULL ; errno = 0 ; *value = strtoul(s, &e, 10) ; if (errno || e == s) status = STATUS_FAIL ; errno = errno_sa ; if (end) *end = e ; return status ; } apparix-11-062/util/ding.h000066400000000000000000000034741326043744200153320ustar00rootroot00000000000000/* (C) Copyright 1999, 2000, 2001, 2002, 2003, 2004, 2005 Stijn van Dongen * (C) Copyright 2006, 2007, 2008, 2009 Stijn van Dongen * * This file is part of tingea. You can redistribute and/or modify tingea * under the terms of the GNU General Public License; either version 3 of the * License or (at your option) any later version. You should have received a * copy of the GPL along with tingea, in the file COPYING. */ #ifndef tingea_ding #define tingea_ding #include #include "types.h" #include "ting.h" char* mcxStrDup ( const char* str ) ; char* mcxStrNDup ( const char* str , dim n ) ; mcxstatus mcxStrTol ( const char* s , long* value , char** end ) ; mcxstatus mcxStrToul ( const char* s , ulong* value , char** end ) ; /* * if len < 0, strlen(p) is used. */ dim mcxStrCountChar ( const char* p , char c , ofs len /* -1 for don't know */ ) ; char* mcxStrChrIs ( const char* src , int (*fbool)(int c) , ofs len /* -1 for don't know */ ) ; char* mcxStrChrAint ( const char* src , int (*fbool)(int c) , ofs len /* -1 for don't know */ ) ; char* mcxStrRChrIs ( const char* src , int (*fbool)(int c) , ofs offset /* -1 for don't know */ ) ; char* mcxStrRChrAint ( const char* src , int (*fbool)(int c) , ofs offset /* -1 for don't know */ ) ; #define MCX_MEMPRINT_REVERSE 1 #define MCX_MEMPRINT_NOSPACE 2 /* Strides in char units, treats/truncates each unit * as/to an 8-bit entity. */ mcxTing* mcxMemPrint ( mcxTing* ting , void* p , dim n_bytes , mcxbits flags ) ; int mcxEditDistance ( const char* s1 , const char* s2 , int* lcs ) ; int mcxSetenv ( const char* kv ) ; #endif apparix-11-062/util/equate.c000066400000000000000000000055111326043744200156620ustar00rootroot00000000000000/* (C) Copyright 2001, 2002, 2003, 2004, 2005 Stijn van Dongen * (C) Copyright 2006, 2007, 2008, 2009 Stijn van Dongen * * This file is part of tingea. You can redistribute and/or modify tingea * under the terms of the GNU General Public License; either version 3 of the * License or (at your option) any later version. You should have received a * copy of the GPL along with tingea, in the file COPYING. */ #include #include "equate.h" int dblCmp ( const void* f1 , const void* f2 ) { return ( *((double*)f1) < *((double*)f2) ? -1 : *((double*)f1) > *((double*)f2) ? 1 : 0 ) ; } int dblRevCmp ( const void* f1 , const void* f2 ) { return ( *((double*)f1) > *((double*)f2) ? 1 : *((double*)f1) < *((double*)f2) ? -1 : 0 ) ; } int fltCmp ( const void* f1 , const void* f2 ) { return ( *((float*)f1) < *((float*)f2) ? -1 : *((float*)f1) > *((float*)f2) ? 1 : 0 ) ; } int fltRevCmp ( const void* f1 , const void* f2 ) { return ( *((float*)f1) > *((float*)f2) ? 1 : *((float*)f1) < *((float*)f2) ? -1 : 0 ) ; } int intCmp ( const void* i1 , const void* i2 ) { return ( *((int*)i1) - *((int*)i2)) ; } int intRevCmp ( const void* i1 , const void* i2 ) { return ( *((int*)i2) - *((int*)i1)) ; } int intnCmp ( const int* i1 , const int* i2 , int n ) { const int* i1max = i1+n ; while (i1 *((int*) i2) ); ; } int intGq ( const void* i1 , const void* i2 ) { return ( *((int*) i1) >= *((int*) i2) ); ; } int fltLt ( const void* f1 , const void* f2 ) { return ( *((float*) f1) < *((float*) f2) ); ; } int fltLq ( const void* f1 , const void* f2 ) { return ( *((float*) f1) <= *((float*) f2) ); ; } int fltGt ( const void* f1 , const void* f2 ) { return ( *((float*) f1) > *((float*) f2) ); ; } int fltGq ( const void* f1 , const void* f2 ) { return ( *((float*) f1) >= *((float*) f2) ); ; } apparix-11-062/util/equate.h000066400000000000000000000030231326043744200156630ustar00rootroot00000000000000/* (C) Copyright 2001, 2002, 2003, 2004, 2005 Stijn van Dongen * (C) Copyright 2006, 2007, 2008, 2009 Stijn van Dongen * * This file is part of tingea. You can redistribute and/or modify tingea * under the terms of the GNU General Public License; either version 3 of the * License or (at your option) any later version. You should have received a * copy of the GPL along with tingea, in the file COPYING. */ #ifndef equate_h #define equate_h int intCmp ( const void* i1 , const void* i2 ) ; int intRevCmp ( const void* i1 , const void* i2 ) ; int intnCmp ( const int* i1 , const int* i2 , int n ) ; int fltCmp ( const void* f1 , const void* f2 ) ; int fltRevCmp ( const void* f1 , const void* f2 ) ; int dblCmp ( const void* f1 , const void* f2 ) ; int dblRevCmp ( const void* f1 , const void* f2 ) ; int intLt ( const void* i1 , const void* i2 ) ; int intLq ( const void* i1 , const void* i2 ) ; int intGt ( const void* i1 , const void* i2 ) ; int intGq ( const void* i1 , const void* i2 ) ; int fltLt ( const void* f1 , const void* f2 ) ; int fltLq ( const void* f1 , const void* f2 ) ; int fltGt ( const void* f1 , const void* f2 ) ; int fltGq ( const void* f1 , const void* f2 ) ; #endif apparix-11-062/util/err.c000066400000000000000000000167771326043744200152060ustar00rootroot00000000000000/* (C) Copyright 2002, 2003, 2004, 2005 Stijn van Dongen * (C) Copyright 2006, 2007, 2008, 2009 Stijn van Dongen * * This file is part of tingea. You can redistribute and/or modify tingea * under the terms of the GNU General Public License; either version 3 of the * License or (at your option) any later version. You should have received a * copy of the GPL along with tingea, in the file COPYING. */ #include #include #include #include #include #include #include "err.h" #include "types.h" #include "compile.h" /* TODO unify code. */ FILE* mcxLogFILE = NULL; static FILE* mcx_fperr = NULL; static FILE* mcx_fpwarn = NULL; static FILE* mcx_fptell = NULL; mcxbits mcxLogLevel = 0; void mcx_err_f ( FILE* fp , const char *caller , const char *fmt , va_list *args ) { if (caller) fprintf(fp, "___ [%s] ", caller) ; else fprintf(fp, "___ ") ; vfprintf(fp, fmt, *args) ; fprintf(fp, "\n") ; return ; } void mcxFail ( void ) { while(1) sleep(1000) ; } void mcxDie ( int status , const char* caller , const char* fmt , ... ) { va_list args ; va_start(args, fmt) ; mcx_err_f(stderr, caller, fmt, &args) ; va_end(args) ; mcxExit(status) ; } void mcxExit ( int val ) { exit(val) ; } void mcxErrorFile ( FILE* fp ) { mcx_fperr = fp ; } void mcxTellFile ( FILE* fp ) { mcx_fptell = fp ; } void mcxLogSetFILE ( FILE* fp , mcxbool ENV_LOG ) { mcxLogFILE = fp ; if (ENV_LOG) mcxLogLevelSetByString(getenv("TINGEA_LOG_TAG")) ; } FILE* mcxLogGetFILE ( void ) { return mcxLogFILE ? mcxLogFILE : stderr ; } void mcxWarnFile ( FILE* fp ) { mcx_fpwarn = fp ; } void mcxErrf ( FILE* fp , const char *caller , const char *fmt , ... ) { va_list args ; va_start(args, fmt) ; mcx_err_f(fp, caller, fmt, &args) ; va_end(args) ; } void mcxErr ( const char *caller , const char *fmt , ... ) { FILE* fp = mcx_fperr ? mcx_fperr : stderr ; va_list args ; va_start(args, fmt) ; mcx_err_f(fp, caller, fmt, &args) ; va_end(args) ; } void mcxWarn ( const char *caller , const char *fmt , ... ) { va_list args ; if (caller) fprintf(stderr, "[%s] ", caller) ; va_start(args, fmt) ; vfprintf(stderr, fmt, args) ; fprintf(stderr, "\n") ; va_end(args) ; return ; } static void mcx_write_f ( FILE* fp , const char *caller , const char *fmt , va_list *args , ... ) { if (caller) fprintf(fp, "[%s] ", caller) ; vfprintf(fp, fmt, *args) ; fprintf(fp, "\n") ; return ; } void mcxTellf ( FILE* fp , const char *caller , const char *fmt , ... ) { va_list args ; va_start(args, fmt) ; mcx_write_f(fp, caller, fmt, &args) ; va_end(args) ; } void mcxTell ( const char *caller , const char *fmt , ... ) { FILE* fp = mcx_fptell ? mcx_fptell : stderr ; va_list args ; va_start(args, fmt) ; mcx_write_f(fp, caller, fmt, &args) ; va_end(args) ; } struct mcx_log_class_annotated { int type ; mcxbits class ; mcxbits low ; } ; struct mcx_log_class_annotated mcx_log_class_list[] = { { 'd' , MCX_LOG_DATA , MCX_LOG_DATA0 } , { 'f' , MCX_LOG_FUNC , MCX_LOG_FUNC0 } , { 'g' , MCX_LOG_GAUGE , MCX_LOG_GAUGE } , { 'i' , MCX_LOG_IO , MCX_LOG_IO } , { 'm' , MCX_LOG_MON , MCX_LOG_MON0 } , { 'n' , MCX_LOG_NETWORK , MCX_LOG_NETWORK } , { 'p' , MCX_LOG_IP , MCX_LOG_IP } , { 't' , MCX_LOG_THREAD , MCX_LOG_THREAD } , { 'A' , MCX_LOG_SLOT1 , MCX_LOG_SLOT1 } , { 'B' , MCX_LOG_SLOT2 , MCX_LOG_SLOT2 } , { 'C' , MCX_LOG_SLOT3 , MCX_LOG_SLOT3 } } ; mcxbool mcxLogGet ( mcxbits level_programmer ) { dim i ; mcxbool ok = FALSE ; for (i=0;i= (mcxLogLevel & mcx_log_class_list[i].class)) ) ; if (mcxLogLevel & MCX_LOG_OR) { if (ok) return TRUE ; } else if (!ok) /* AND, implicit or not */ return FALSE ; } return ok ; } void mcxLog2 ( const char* tag , const char* fmt , ... ) { FILE* fp = mcxLogFILE ? mcxLogFILE : stderr ; va_list args ; va_start(args, fmt) ; mcx_write_f(fp, tag, fmt, &args) ; va_end(args) ; } void mcxLog ( mcxbits level_programmer , const char* tag , const char* fmt , ... ) { FILE* fp = mcxLogFILE ? mcxLogFILE : stderr ; va_list args ; mcxbool ok = FALSE ; if (!mcxLogLevel || (mcxLogLevel & MCX_LOG_NULL)) return ; ok = mcxLogGet(level_programmer) ; if (ok) { va_start(args, fmt) ; mcx_write_f(fp, tag, fmt, &args) ; va_end(args) ; } } /* dependency with mcx_level_setnum */ static int mcx_level_parsenum ( int T , int c ) { int r = -1 ; if (c == 'x') r = 0 ; else if (c >= '1' && c <= '9') r = ((int) c) - '0' ; else mcxErr ( "mcxLogLevelSetByString" , "%c axis level [%c] parse error" , (int) T , (int) c ) ; return r ; } /* covers val -1 mcx_level_parsenum case */ static int mcx_level_setnum ( int val , mcxbits CLASS , mcxbits CLASS0 ) { mcxbits new = 0 ; if (val > 0) { new = (1 << (val-1)) * CLASS0 /* below we know that new is simply too high: e.g. new == 6 * but there are only 5 classes. * We then set new to the highest class member */ ; if (!(new & CLASS)) new = CLASS ^ (CLASS >> 1) ^ (CLASS0 >> 1) ; } return new ; } volatile sig_atomic_t mcxLogSigGuard = 0; void mcxLogSig ( int sig ) { mcxLogSigGuard = sig ; } void mcxLogLevelSetByString ( const char* str ) { dim i ; u8 str0 = str ? str[0] : 0 ; if (!str) return ; if (str0 == 'x') mcxLogLevel = 0 ; else if (str0 == '1') mcxLogLevel = MCX_LOG_VERBOSE ; else if (str0 == '8') mcxLogLevel = MCX_LOG_TERSE ; else if (str0 == '9') mcxLogLevel = MCX_LOG_TERSER ; if (strchr(str, 'V')) mcxLogLevel |= MCX_LOG_OR ; if (strchr(str, '#')) mcxLogLevel |= MCX_LOG_NULL ; if (strchr(str, '%')) BIT_OFF(mcxLogLevel, MCX_LOG_NULL) ; for (i=0;i #include #include "types.h" /* Experimental scheme for logging * Contains * Three axes that have scales: * - data 1 2 3 * CELL * LIST * AGGR * - function/code 1 2 3 4 * LINE * FUNCTION * MODULE * APP * - monitoring 1 2 3 4 5 * DEBUG * INFO * WARN * ERR * PANIC * * These scales correspond with * * what (data, what are its parameters) * how (function, what is changing) * pulse (anything) * * Several axes that are radio buttons: * - IO * - Thread * - gauge progress bars * - IP inter (process) * - SLOT1 custom * - SLOT2 custom * - SLOT3 custom * * The programmer associates one or more logging levels with a logging * statement. The user sets logging levels in terms of quietness. * Quietness is quantified as shown in the list below. It may be applied * to a single axis or to several axes simultaneously. * * x is silent * 5 is tersest monitoring level * 4 is tersest function/code level * 3 is tersest data level * 9 is tersest level possible, may exceed actual upper bound * 1 is yappiest level. * * Only those statements for which the quiet level is quieter than the * user-specified level will be printed. If the programmer combines several * axes generally all the corresponding levels are checked and all have to be * OK, unless the user has specified that she is happy if at least one level is * OK. This is done by including a literal 'V' in the MCXLOGTAG string or in * the corresponding command-line option (usually -q). * * MCXLOGTAG is of the following form: * * []<[dfgimstABC][0-9]>+[V] * * The optional is one of [19x] as described above. The rest are * pairs consisting of an indicator * * d data * f function * g gauge/progress * i IO * m monitoring * n network * t thread * A custom axis 1 * B custom axis 1 * C custom axis 1 * * followed by a level. Each indicator specifies an axis; each axis has its * own scale and number of steps on the scale (see above). Finally, a 'V' * occurring anywhere signifies that OR logic is applied to loggin clauses * rather than AND logic. * * The lead tag sets a logging level for all axes simultaneously as follows: * 1 MCX_LOG_ALL * 9 MCX_LOG_TERSER * 8 MCX_LOG_TERSE * x MCX_LOG_NONE */ extern mcxbits mcxLogLevel; /* When called this one optionally checks environment variable * MCXLOGTAG to set the logging levels mcxLogLevelSetByString */ void mcxLogSetFILE ( FILE* fp , mcxbool ENV_LOG ) ; /* When writing to this file embed the print statement in an if statement * that checks whether your priority is ok with mcxLogGet. * This is paramount with GAUGE type logging as a GAUGE = x setting * may indicate that the user is logging to a shared stream. */ FILE* mcxLogGetFILE ( void ) ; extern volatile sig_atomic_t mcxLogSigGuard ; void mcxLogSig ( int sig ) ; /* ******************** data */ #define MCX_LOG_CELL 1 << 0 /* node, point, scalar */ #define MCX_LOG_LIST 1 << 1 /* list, tree, hash */ #define MCX_LOG_AGGR 1 << 2 /* everything else */ #define MCX_LOG_DATA (MCX_LOG_CELL | MCX_LOG_LIST | MCX_LOG_AGGR) #define MCX_LOG_DATA0 MCX_LOG_CELL /* ******************** function */ #define MCX_LOG_LINE 1u << 3 #define MCX_LOG_FUNCTION 1u << 4 #define MCX_LOG_MODULE 1u << 5 #define MCX_LOG_APP 1u << 6 #define MCX_LOG_FUNC (MCX_LOG_LINE | MCX_LOG_FUNCTION | MCX_LOG_MODULE | MCX_LOG_APP) #define MCX_LOG_FUNC0 MCX_LOG_LINE /* ******************** monitoring */ #define MCX_LOG_DEBUG 1u << 7 #define MCX_LOG_INFO 1u << 8 #define MCX_LOG_WARN 1u << 9 #define MCX_LOG_ERR 1u << 10 #define MCX_LOG_PANIC 1u << 11 #define MCX_LOG_MON ( MCX_LOG_DEBUG| MCX_LOG_INFO | MCX_LOG_WARN | MCX_LOG_ERR| MCX_LOG_PANIC ) #define MCX_LOG_MON0 MCX_LOG_DEBUG /* ********************* unimodal axes */ #define MCX_LOG_IO 1u << 12 #define MCX_LOG_IP 1u << 13 #define MCX_LOG_THREAD 1u << 15 #define MCX_LOG_NETWORK 1u << 16 #define MCX_LOG_ASPECTS ( MCX_LOG_IO | MCX_LOG_IP | MCX_LOG_THREAD | MCX_LOG_GAUGE | MCX_LOG_NETWORK ) /* ********************* miscellaneous*/ #define MCX_LOG_GAUGE 1u << 17 /* ********************* control */ #define MCX_LOG_AND 1u << 18 #define MCX_LOG_OR 1u << 19 #define MCX_LOG_NULL 1u << 20 /* turns of logging */ /* ********************* unspecified */ #define MCX_LOG_SLOT1 1u << 22 #define MCX_LOG_SLOT2 1u << 22 #define MCX_LOG_SLOT3 1u << 23 #define MCX_LOG_SLOT ( MCX_LOG_SLOT1 | MCX_LOG_SLOT2 | MCX_LOG_SLOT3 ) /* ********************* all / terse */ #define MCX_LOG_NONE 0 #define MCX_LOG_VERBOSE ( MCX_LOG_CELL | MCX_LOG_LINE | MCX_LOG_DEBUG | MCX_LOG_SLOT | MCX_LOG_ASPECTS ) #define MCX_LOG_TERSER ( MCX_LOG_PANIC | MCX_LOG_AGGR | MCX_LOG_APP ) #define MCX_LOG_TERSE ( MCX_LOG_TERSER | MCX_LOG_ASPECTS ) #define MCX_LOG_UNIVERSE ( MCX_LOG_DATA | MCX_LOG_FUNC | MCX_LOG_MON | MCX_LOG_SLOT | MCX_LOG_ASPECTS ) /* ********************* unused */ #define MCX_LOG_UNUSED 1u << 24 void mcxLogLevelSetByString ( const char* str ) ; void mcxLog ( mcxbits level_programmer , const char* tag , const char* fmt , ... ) #ifdef __GNUC__ __attribute__ ((format (printf, 3, 4))) #endif ; mcxbool mcxLogGet ( mcxbits level_programmer ) ; void mcxLog2 ( const char* tag , const char* fmt , ... ) #ifdef __GNUC__ __attribute__ ((format (printf, 2, 3))) #endif ; void mcxTell ( const char *caller , const char *fmt , ... ) #ifdef __GNUC__ __attribute__ ((format (printf, 2, 3))) #endif ; void mcxTellf ( FILE* fp , const char *caller , const char *fmt , ... ) #ifdef __GNUC__ __attribute__ ((format (printf, 3, 4))) #endif ; void mcxWarn ( const char *caller , const char *fmt , ... ) #ifdef __GNUC__ __attribute__ ((format (printf, 2, 3))) #endif ; void mcxErr ( const char *caller , const char *fmt , ... ) #ifdef __GNUC__ __attribute__ ((format (printf, 2, 3))) #endif ; void mcxErrf ( FILE* fp , const char *caller , const char *fmt , ... ) #ifdef __GNUC__ __attribute__ ((format (printf, 3, 4))) #endif ; void mcxDie ( int status , const char *caller , const char *fmt , ... ) #ifdef __GNUC__ __attribute__ ((format (printf, 3, 4))) #endif ; void mcxTellFile ( FILE* fp ) ; void mcxWarnFile ( FILE* fp ) ; void mcxErrorFile ( FILE* fp ) ; void mcxFail ( void ) ; void mcxExit ( int val ) ; #endif apparix-11-062/util/getpagesize.h000066400000000000000000000015401326043744200167100ustar00rootroot00000000000000/* Emulate getpagesize on systems that lack it. */ #ifndef HAVE_GETPAGESIZE #if !defined getpagesize && defined __BEOS__ # include # define getpagesize() B_PAGE_SIZE #endif #ifdef HAVE_UNISTD_H # include #endif #if !defined getpagesize && defined _SC_PAGESIZE # if !(defined VMS && __VMS_VER < 70000000) # define getpagesize() sysconf (_SC_PAGESIZE) # endif #endif #if !defined getpagesize && defined VMS # ifdef __ALPHA # define getpagesize() 8192 # else # define getpagesize() 512 # endif #endif #ifndef getpagesize # include # ifdef EXEC_PAGESIZE # define getpagesize() EXEC_PAGESIZE # else # ifdef NBPG # ifndef CLSIZE # define CLSIZE 1 # endif # define getpagesize() (NBPG * CLSIZE) # else # ifdef NBPC # define getpagesize() NBPC # endif # endif # endif #endif #endif /* not HAVE_GETPAGESIZE */ apparix-11-062/util/gralloc.c000066400000000000000000000077571326043744200160370ustar00rootroot00000000000000/* (c) Copyright 2004, 2005, 2006, 2007, 2008, 2009 Stijn van Dongen * * This file is part of tingea. You can redistribute and/or modify tingea * under the terms of the GNU General Public License; either version 3 of the * License or (at your option) any later version. You should have received a * copy of the GPL along with tingea, in the file COPYING. */ #include "alloc.h" #include "gralloc.h" /* TODO * calloc stuff. * implement arithmetic capacity strategy. */ #define DEBUG 0 typedef struct memnext { struct memnext* next ; } memnext ; /* future idea; use higher bita as perbytage style coefficients. duh. */ #define n1(grim) ((grim->flags >> 16) & 0xFF) #define n2(grim) ((grim->flags >> 24) & 0xFF) typedef struct grim_buf { char* units /* n_units * (sizeof(memnext) + sz_unit) */ ; dim n_units /* number of units available for this struct */ ; struct grim_buf* prev ; } grim_buf ; struct mcxGrim { grim_buf* buf ; dim sz_unit /* size of one unit */ ; memnext* na /* next available */ ; dim ct /* number in use */ ; mcxbits flags /* allocation strategy, numbers */ ; } ; grim_buf* grim_buf_new ( dim sz_unit , dim n_units ) { dim i ; grim_buf* buf ; char* units ; dim sz_load = sizeof(memnext) + sz_unit ; if (!(buf = mcxAlloc(sizeof(grim_buf), RETURN_ON_FAIL))) return NULL ; if ( !(buf->units = units = mcxAlloc(n_units * sz_load, RETURN_ON_FAIL) ) ) { mcxFree(buf) ; return NULL ; } buf->prev = NULL ; buf->n_units = n_units #if DEBUG ; fprintf (stderr, "Extending grim with <%lu> units\n", (ulong) n_units); #endif ; for (i=0;inext = (memnext*) (units + (i+1) * sz_load) ; ((memnext*) (buf->units + (n_units-1) * sz_load))->next = NULL ; return buf ; } mcxGrim* mcxGrimNew ( dim sz_unit , dim n_units , mcxbits options ) { mcxGrim* src = mcxAlloc(sizeof(mcxGrim), RETURN_ON_FAIL) ; if (!src) return NULL ; if (!(src->buf = grim_buf_new(sz_unit, n_units))) { mcxFree(src) ; return NULL ; } src->buf->prev = NULL ; src->flags = options ; src->na = (void*) src->buf->units ; src->ct = 0 ; src->sz_unit = sz_unit ; return src ; } dim mcxGrimMemSize ( mcxGrim* src ) { grim_buf *buf = src->buf, *this = buf->prev ; dim n = buf->n_units ; while (this) n += this->n_units , this = this->prev ; return n ; } mcxbool mcx_grim_extend ( mcxGrim* src ) { grim_buf* prevbuf = src->buf->prev ; dim n_units = prevbuf ? 2 * prevbuf->n_units : src->buf->n_units #if DEBUG ; dim t = mcxGrimMemSize(src) ; fprintf(stderr, "have %lu units\n", (ulong) t) #endif ; grim_buf* newbuf = grim_buf_new(src->sz_unit, n_units) ; if (!newbuf) return FALSE ; newbuf->prev = src->buf->prev ; src->buf->prev = newbuf ; src->na = (void*) newbuf->units /* fixme cast */ ; return TRUE ; } void mcxGrimFree ( mcxGrim** srcp ) { grim_buf *this = (*srcp)->buf ; while (this) { grim_buf* tmp = this->prev ; mcxFree(this->units) ; mcxFree(this) ; this = tmp ; } mcxFree(*srcp) ; *srcp = NULL ; } void mcxGrimLet ( mcxGrim* src , void* mem ) { memnext* na = (void*) ((char*) mem - sizeof(memnext)) ; na->next = src->na ; src->na = na ; src->ct-- ; } void* mcxGrimGet ( mcxGrim* src ) { void* mem ; if (!src->na && !mcx_grim_extend(src)) return NULL ; mem = ((char*) src->na) + sizeof(memnext) ; src->na = src->na->next ; src->ct++ ; return mem ; } dim mcxGrimCount ( mcxGrim* src ) { return src->ct ; } apparix-11-062/util/gralloc.h000066400000000000000000000016721326043744200160320ustar00rootroot00000000000000/* (C) Copyright 2004, 2005, 2006, 2007, 2008, 2009 Stijn van Dongen * * This file is part of tingea. You can redistribute and/or modify tingea * under the terms of the GNU General Public License; either version 3 of the * License or (at your option) any later version. You should have received a * copy of the GPL along with tingea, in the file COPYING. */ #ifndef tingea_gralloc_h #define tingea_gralloc_h #include "types.h" /* * gralloc; grid memory allocation; allocation of equally sized chunks */ typedef struct mcxGrim mcxGrim; #define MCX_GRIM_GEOMETRIC 1 #define MCX_GRIM_ARITHMETIC 2 mcxGrim* mcxGrimNew ( dim sz_unit , dim n_units /* initial capacity */ , mcxbits options ) ; void* mcxGrimGet ( mcxGrim* src ) ; void mcxGrimLet ( mcxGrim* src , void* mem ) ; dim mcxGrimCount ( mcxGrim* src ) ; dim mcxGrimMemSize ( mcxGrim* src ) ; void mcxGrimFree ( mcxGrim** src ) ; #endif apparix-11-062/util/hash.c000066400000000000000000000617661326043744200153370ustar00rootroot00000000000000/* (C) Copyright 2001, 2002, 2003, 2004, 2005 Stijn van Dongen * (C) Copyright 2006, 2007, 2008, 2009, 2010 Stijn van Dongen * * This file is part of tingea. You can redistribute and/or modify tingea * under the terms of the GNU General Public License; either version 3 of the * License or (at your option) any later version. You should have received a * copy of the GPL along with tingea, in the file COPYING. */ /* TODO (?) * * integer overflow handling. * * better bucket fill statistics. * * nested hashes. * could lump * options cmp hash src_link * into a structure and make hashes share them. */ #include #include #include #include #include #include "hash.h" #include "minmax.h" #include "types.h" #include "inttypes.h" #include "ting.h" #include "err.h" #include "alloc.h" #include "gralloc.h" #include "compile.h" #include "list.h" /* the distribution of bit counts over all 32-bit keys */ int promilles[32] = { 0, 0, 0, 0, 0, 0, 0, 0 , 2, 7, 15, 30, 53, 81,110,131 ,140,131,110, 81, 53, 30, 15, 7 , 2, 0, 0, 0, 0, 0, 0, 0 } ; #ifndef TINGEA_HASH_CACHE # define TINGEA_HASH_CACHE 0 #endif typedef struct hash_link { struct hash_link* next ; mcxKV kv #if TINGEA_HASH_CACHE ; u32 hv #endif ; } hash_link ; typedef struct bucket { hash_link* base ; } mcx_bucket ; /* For further optimization work, options * options * load * cmp * hash * src_link * can be shared between different hashes (e.g. * with multidimensional hashes). Consider * making src_link file static variable. */ struct mcxHash { dim n_buckets /* 2^n_bits */ ; mcx_bucket *buckets ; dim n_entries ; mcxbits options ; int (*cmp) (const void *a, const void *b) ; u32 (*hash) (const void *a) ; mcxGrim* src_link ; float load ; } ; struct mcxHashWalk { mcxHash* hash ; dim i_bucket ; hash_link* link ; } ; void* mcx_bucket_init ( void* buck ) { ((mcx_bucket*) buck)->base = NULL ; return NULL ; } void bitprint ( u32 key , FILE* fp ) ; int bitcount ( u32 key ) ; mcxHash* mcxHashNew ( dim n_buckets , u32 (*hash)(const void *a) , int (*cmp) (const void *a, const void *b) ) { mcxHash *h ; mcxbool ok = FALSE ; u8 n_bits = 0 ; if (!n_buckets) { mcxErr("mcxHashNew strange", "void alloc request") ; n_buckets = 2 ; } if (!(h = mcxAlloc(sizeof(mcxHash), RETURN_ON_FAIL))) return NULL ; while(n_buckets) { n_buckets >>= 1 ; n_bits++ ; } h->load = 0.5 ; h->n_entries = 0 ; h->n_buckets = n_buckets = (1 << n_bits) ; h->cmp = cmp ; h->hash = hash ; h->options = MCX_HASH_OPT_DEFAULTS ; h->src_link = NULL ; while (1) /* fixme 2nd arg below, have better choice? */ { h->src_link = mcxGrimNew(sizeof(hash_link), h->n_buckets, MCX_GRIM_ARITHMETIC) ; if (!h->src_link) break ; if (! ( h->buckets = mcxNAlloc ( h->n_buckets , sizeof(mcx_bucket) , mcx_bucket_init , RETURN_ON_FAIL ) ) ) break ; ok = TRUE ; break ; } if (!ok) { mcxGrimFree(&(h->src_link)) ; mcxFree(h) ; return NULL ; } return h ; } dim mcxHashMemSize ( mcxHash* hash ) { return mcxGrimMemSize(hash->src_link) + sizeof(mcx_bucket) * hash->n_buckets ; } void mcxHashGetSettings ( mcxHash* hash , mcxHashSettings* settings ) { settings->n_buckets = hash->n_buckets ; settings->load = hash->load ; settings->n_entries = hash->n_entries ; settings->options = hash->options ; } static dim hash_link_size ( hash_link* link ) { dim s = 0 ; while(link) link = link->next , s++ ; return(s) ; } void mcxHashStats ( FILE* fp , mcxHash* h ) { dim buckets = h->n_buckets ; dim buckets_used = 0 ; float ctr = 0.0 ; float cb = 0.0 ; dim max = 0 ; dim entries = 0 ; const char* me = "mcxHashStats" ; int j, k, distr[32] ; mcx_bucket *buck ; for (j=0;j<32;j++) distr[j] = 0 ; for (buck=h->buckets; buckbuckets + h->n_buckets; buck++) { dim d = hash_link_size(buck->base) ; hash_link* this= buck->base ; if (d) { buckets_used++ ; entries += d ; ctr += (float) d * d ; cb += (float) d * d * d ; max = MCX_MAX(max, d) ; } while(this) { u32 u = (h->hash)(this->kv.key) ; int ct = bitcount(u) ; this = this->next ; distr[ct]++ ;if (0) fprintf(stderr, "bucket [%d] key [%s]\n", (int)d, ((mcxTing*) this->kv.key)->str) ; } } ctr = ctr / MCX_MAX(1, entries) ; cb = sqrt(cb / MCX_MAX(1, entries)) ; if (buckets && buckets_used) mcxTellf ( fp , me , "%4.2f bucket usage (%ld available, %ld used, %ld entries)" , (double) ((double) buckets_used) / buckets , (long) buckets , (long) buckets_used , (long) entries ) , mcxTellf ( fp , me , "bucket average: %.2f, center: %.2f, cube: %.2f, max: %ld" , (double) entries / ((double) buckets_used) , (double) ctr , (double) cb , (long) max ) ; mcxTellf(fp, me, "bit distribution (promilles):") ; fprintf ( fp , " %-37s %s\n" , "Current bit distribution" , "Ideally random distribution" ) ; for (k=0;k<4;k++) { for (j=k*8;j<(k+1)*8;j++) fprintf(fp, "%3.0f ", entries ? (1000 * (float)distr[j]) / entries : 0.0) ; fprintf(fp, " "); ; for (j=k*8;j<(k+1)*8;j++) fprintf(fp, "%3d ", promilles[j]) ; fprintf(fp, "\n") ; } mcxTellf(fp, me, "link count: %ld", (long) (mcxGrimCount(h->src_link))) ; mcxTellf(fp, me, "link mem count: %ld", (long) (mcxGrimMemSize(h->src_link))) ; mcxTellf(fp, me, "done") ; } void mcxHashSetOpts ( mcxHash* h , double load , int options ) { if (options >= 0) h->options |= options /* fixme; are there states in which either of these can be corrupting ? */ ; h->load = load ; } void mcxHashFreeScalar ( void* scalar cpl__unused ) { /* this triggers freeing of kv.key or kv.val */ ; } void mcxHashFree ( mcxHash** hpp , void freekey(void* key) , void freeval(void* key) ) { mcxHash* h = *hpp ; mcx_bucket* buck = h ? h->buckets : NULL ; dim d = h ? h->n_buckets : 0 ; if (!h) return ; if (freekey || freeval) { while (d-- > 0) /* careful with unsignedness */ { hash_link* link = (buck++)->base ; while(link) { void* key = link->kv.key ; void* val = link->kv.val ; if (freekey && key) freekey(key) , mcxFree(key) ; if (freeval && val) freeval(val) , mcxFree(val) ; link = link->next ; } } } mcxGrimFree(&h->src_link) ; mcxFree(h->buckets) ; mcxFree(h) ; *hpp = NULL ; } #define MCX_HASH_DOUBLING MCX_HASH_OPT_UNUSED #if TINGEA_HASH_CACHE static hash_link* mcx_bucket_search ( mcxHash* h , void* ob , mcxmode ACTION , u32* hashval ) { u32 thishash = hashval ? *hashval : (h->hash)(ob) ; mcx_bucket *buck = h->buckets + (thishash & (h->n_buckets-1)) ; hash_link* link = buck->base, *prev = NULL, *new ; int delta = 0 ; while ( link && ( link->hv != thishash || h->cmp(ob, link->kv.key) ) ) prev = link , link = link->next ; if (link && ACTION == MCX_DATUM_DELETE) { if (buck->base == link) buck->base = link->next ; else prev->next = link->next ; delta = -1 ; mcxGrimLet(h->src_link, link) /* we return link below though */ ; } else if (!link) { if (ACTION == MCX_DATUM_FIND || ACTION == MCX_DATUM_DELETE) link = NULL ; else if (ACTION == MCX_DATUM_INSERT) { new = mcxGrimGet(h->src_link) /* fixme could be NULL */ ; new->next = NULL ; new->kv.val = NULL ; new->kv.key = ob ; new->hv = thishash ; if (!buck->base) buck->base = new /* in TINGEA_HASH_CACHE case we always append */ ; else new->next = prev->next , prev->next = new ; delta = 1 ; link = new ; } } h->n_entries += delta ; return link ; } #else static hash_link* mcx_bucket_search ( mcxHash* h , void* ob , mcxmode ACTION , u32* hashval ) { u32 thishash = hashval ? *hashval : (h->hash)(ob) ; mcx_bucket *buck = h->buckets + (thishash & (h->n_buckets-1)) ; hash_link* link = buck->base, *prev = NULL, *new ; int c = 1 ; int delta = 0 ; while ( link && (c = h->cmp(ob, link->kv.key)) > 0 ) prev = link , link = link->next ; if (!c && ACTION == MCX_DATUM_DELETE) { if (buck->base == link) buck->base = link->next ; else prev->next = link->next ; delta = -1 ; mcxGrimLet(h->src_link, link) /* we return link below though */ ; } else if (!link || c < 0) { if (ACTION == MCX_DATUM_FIND || ACTION == MCX_DATUM_DELETE) link = NULL ; else if (ACTION == MCX_DATUM_INSERT) { new = mcxGrimGet(h->src_link) /* fixme could be NULL */ ; new->next = NULL ; new->kv.val = NULL ; new->kv.key = ob ; if (!buck->base) buck->base = new ; else if (link == buck->base) new->next = buck->base , buck->base = new ; else new->next = prev->next , prev->next = new ; delta = 1 ; link = new ; } } h->n_entries += delta ; return link ; } #endif static mcxstatus mcx_hash_double ( mcxHash* h ) ; mcxKV* mcxHashSearchx ( void* key , mcxHash* h , mcxmode ACTION , int* delta ) { hash_link *link ; dim n_entries = h->n_entries ; if ( h->load * h->n_buckets < h->n_entries && !(h->options & (MCX_HASH_OPT_CONSTANT | MCX_HASH_DOUBLING)) && mcx_hash_double(h) ) mcxErr("mcxHashSearch", "cannot double hash") ; link = mcx_bucket_search(h, key, ACTION, NULL) ; if (delta) *delta = h->n_entries < n_entries ? -1 : (int) (h->n_entries - n_entries) ; return link ? &link->kv : NULL ; } enum { ARRAY_OF_KEY , ARRAY_OF_KV } ; void mcxHashApply ( mcxHash* hash , void (*cb)(const void* key, void* val, void* data) , void* data ) { mcxHashWalk* walk = mcxHashWalkInit(hash) ; mcxKV* kv ; dim i_bucket ; while ((kv = mcxHashWalkStep(walk, &i_bucket))) cb(kv->key, kv->val, data) ; mcxHashWalkFree(&walk) ; } static void** hash_array ( mcxHash* hash , dim* n_entries , int (*cmp)(const void*, const void*) , mcxbits opts cpl__unused , mcxenum mode ) { void** obs = mcxAlloc(sizeof(void*) * hash->n_entries, RETURN_ON_FAIL) ; dim d = 0 ; mcxKV* kv ; const char* me = mode == ARRAY_OF_KEY ? "mcxHashKeys" : "mcxHashKVs" ; mcxHashWalk* walk = mcxHashWalkInit(hash) ; if (!walk || !obs) return NULL ; while ((kv = mcxHashWalkStep(walk, NULL))) /* fixme extract */ { if (d >= hash->n_entries) { mcxErr ( me , "PANIC inconsistent state (n_entries %ld)" , (long) hash->n_entries ) ; break ; } obs[d] = mode == ARRAY_OF_KEY ? kv->key : kv ; d++ ; } if (d != hash->n_entries) mcxErr(me, "PANIC inconsistent state (n_entries %lu)", (ulong) hash->n_entries) ; if (cmp) qsort(obs, d, sizeof(void*), cmp) ; mcxHashWalkFree(&walk) ; *n_entries = d ; return obs ; } void** mcxHashKeys ( mcxHash* hash , dim* n_entries , int (*cmp)(const void*, const void*) , mcxbits opts /* unused yet */ ) { return hash_array(hash, n_entries, cmp, opts, ARRAY_OF_KEY) ; } void** mcxHashKVs ( mcxHash* hash , dim* n_entries , int (*cmp)(const void*, const void*) , mcxbits opts /* unused yet */ ) { return hash_array(hash, n_entries, cmp, opts, ARRAY_OF_KV) ; } mcxKV* mcxHashWalkStep ( mcxHashWalk *walk , dim *i_bucket ) { hash_link* step = walk->link ; while (!step && ++walk->i_bucket < walk->hash->n_buckets) step = (walk->hash->buckets+walk->i_bucket)->base ; if (step) { walk->link = step->next ; if (i_bucket) *i_bucket = walk->i_bucket ; return &step->kv ; } return NULL ; } mcxHashWalk* mcxHashWalkInit ( mcxHash *h ) { mcxHashWalk* walk = mcxAlloc(sizeof *walk, RETURN_ON_FAIL) ; if (!walk) return NULL ; walk->hash = h ; if (!h || !h->buckets) { mcxFree(walk) ; return NULL ; } walk->i_bucket = 0 ; walk->link = (h->buckets+0)->base ; return walk ; } void mcxHashWalkFree ( mcxHashWalk **walkpp ) { mcxFree(*walkpp) ; *walkpp = NULL ; } mcxHash* mcxHashMerge ( mcxHash* h1 , mcxHash* h2 , mcxHash* hd /* hash destination */ , void* merge(void* val1, void* val2) ) { mcxHash* ha[2] /* hash array */ ; mcxHash* h ; int i ; if (!h1 || !h2) mcxDie(1, "mcxHashMerge FATAL", "clone functionality not yet supported") /* * fixme/note I am comparing fie pointers here, is that ok? */ ; if (h1->hash != h2->hash || h1->cmp != h2->cmp) mcxErr("mcxHashMerge WARNING", "non matching hash or cmp fie") ; if (merge) mcxErr("mcxHashMerge WARNING", "merge functionality not yet supported") ; hd = hd ? hd : mcxHashNew ( h1->n_entries + h2->n_entries , h1->hash , h1->cmp ) ; if (!hd) return NULL ; ha[0] = h1 ; ha[1] = h2 ; for (i=0;i<2;i++) { h = ha[i] ; if (h != hd) { mcx_bucket* buck ; for (buck = h->buckets; buckbuckets + h->n_buckets; buck++) { hash_link* this = buck->base ; while(this) { mcxKV* kv = mcxHashSearch(this->kv.key, hd, MCX_DATUM_INSERT) ; if (!kv) return NULL /* note/fixme: cannot free hd, don't have key/val free functions */ ; if (!kv->val) kv->val = this->kv.val ; this = this->next ; } } } } return hd ; } static mcxstatus mcx_hash_double ( mcxHash* h ) { mcx_bucket* ole_bucket = h->buckets ; mcx_bucket* ole_buckets = h->buckets ; dim d = h->n_buckets ; dim n_fail = 0 ; if (h->options & MCX_HASH_DOUBLING) /* called before */ { mcxErr("mcx_hash_double PANIC", "double trouble") ; return STATUS_FAIL ; } h->options |= MCX_HASH_DOUBLING ; if (! ( h->buckets = mcxNAlloc ( 2 * h->n_buckets , sizeof(mcx_bucket) , mcx_bucket_init , RETURN_ON_FAIL ) ) ) { h->options ^= MCX_HASH_DOUBLING ; h->buckets = ole_buckets ; return STATUS_FAIL ; } h->n_buckets *= 2 ; h->n_entries = 0 ; while(d-- > 0) /* careful with unsignedness */ { hash_link* this = ole_bucket->base ; while(this) { hash_link* next = this->next, *clone ; void* val = this->kv.val ; void* key = this->kv.key ; mcxGrimLet(h->src_link, this) /* will be used immediately */ #if TINGEA_HASH_CACHE ; clone = mcx_bucket_search(h, key, MCX_DATUM_INSERT, &this->hv) #else ; clone = mcx_bucket_search(h, key, MCX_DATUM_INSERT, NULL) #endif ; if (clone) clone->kv.val = val ; else n_fail++ ; this = next ; } ole_bucket++ ; } if (n_fail) mcxErr ( "mcx_hash_double PANIC" , "<%ld> reinsertion failures in hash with <%ld> entries" , (long) n_fail , (long) h->n_entries ) ; mcxFree(ole_buckets) ; h->options ^= MCX_HASH_DOUBLING ; return STATUS_OK ; } #define BJmix(a,b,c) \ { \ a -= b; a -= c; a ^= (c>>13); \ b -= c; b -= a; b ^= (a<< 8); \ c -= a; c -= b; c ^= (b>>13); \ a -= b; a -= c; a ^= (c>>12); \ b -= c; b -= a; b ^= (a<<16); \ c -= a; c -= b; c ^= (b>> 5); \ a -= b; a -= c; a ^= (c>> 3); \ b -= c; b -= a; b ^= (a<<10); \ c -= a; c -= b; c ^= (b>>15); \ } /* * Thomas Wang says Robert Jenkins says this is a good integer hash function: *unsigned int inthash(unsigned int key) *{ * key += (key << 12); * key ^= (key >> 22); * key += (key << 4); * key ^= (key >> 9); * key += (key << 10); * key ^= (key >> 2); * key += (key << 7); * key ^= (key >> 12); * return key; *} */ /* created by Bob Jenkins */ u32 mcxBJhash ( register const void* key , register u32 len ) { register u32 a, b, c, l ; const char* k = key ; l = len ; a = b = 0x9e3779b9u ; c = 0xabcdef01u ; while (l >= 12) { a += k[0] + (k[1]<<8) + (k[2]<<16) + (k[3]<<24) ; b += k[4] + (k[5]<<8) + (k[6]<<16) + (k[7]<<24) ; c += k[8] + (k[9]<<8) + (k[10]<<16)+ (k[11]<<24) ; BJmix(a,b,c) ; k += 12 ; l -= 12 ; } c += len ; switch(l) /* all the case statements fall through */ { case 11: c+= k[10]<<24 ; case 10: c+= k[9]<<16 ; case 9 : c+= k[8]<<8 /* the first byte of c is reserved for the length */ ; case 8 : b+= k[7]<<24 ; case 7 : b+= k[6]<<16 ; case 6 : b+= k[5]<<8 ; case 5 : b+= k[4] ; case 4 : a+= k[3]<<24 ; case 3 : a+= k[2]<<16 ; case 2 : a+= k[1]<<8 ; case 1 : a+= k[0] /* case 0: nothing left to add */ ; } BJmix(a,b,c) ; return c ; } /* created by Chris Torek */ u32 mcxCThash ( const void *key , u32 len ) #define ctHASH4a h = (h << 5) - h + *k++; #define ctHASH4b h = (h << 5) + h + *k++; #define ctHASH4 ctHASH4b { u32 h = 0 ; const unsigned char *k = key ; if (len > 0) { unsigned loop = (len + 8 - 1) >> 3 /* loop >= 1 */ ; switch (len & (8 - 1)) { case 0: do { /* All fall through */ ctHASH4 case 7: ctHASH4 case 6: ctHASH4 case 5: ctHASH4 case 4: ctHASH4 case 3: ctHASH4 case 2: ctHASH4 case 1: ctHASH4 } while (--loop) /* unsignedcmpok */ ; } } ; return h ; } /* All 3 hash fies below play on a similar theme. Interesting: as long as only * << >> and ^ are used, a hash function does a partial homogeneous fill of all * 2^k different strings of length k built out of two distinct characters -- * not all buckets need be used. E.g. for k=15, such a hash function might fill * 2^13 buckets with 4 entries each, or it might fill 2^10 buckets with 32 * entries each. This was observed, not proven. */ u32 mcxSvDhash ( const void *key , u32 len ) { u32 h = 0x7cabd53e /* 0x7cabd53e */ ; const char* k = key ; h = 0x0180244a ; while (len--) { u32 g = *k ; u32 gc = 0xff ^ g ; u32 hc = 0xffffffffu ; hc ^= h ; h = ( (h << 2) + h + (h >> 3)) ^ ( (g << 25) + (gc << 18) + (g << 11) + (g << 5) + g ) ; k++ ; } ; return h ; } /* created by me */ u32 mcxSvD2hash ( const void *key , u32 len ) { u32 h = 0x7cabd53e /* 0x7cabd53e */ ; const char* k = key ; while (len--) { u32 g = *k ; u32 gc = 0xff ^ g ; h = ( (h << 3) ^ h ^ (h >> 5) ) ^ ( (g << 25) ^ (gc << 18) ^ (g << 11) ^ (gc << 5) ^ g ) ; k++ ; } ; return h ; } /* created by me */ u32 mcxSvD1hash ( const void *key , u32 len ) { u32 h = 0xeca96537u ; const char* k = key ; while (len--) { u32 g = *k ; h = ( (h << 3) ^ h ^ (h >> 5) ) ^ ( (g << 21) ^ (g << 12) ^ (g << 5) ^ g ) ; k++ ; } ; return h ; } /* created by Daniel Phillips */ u32 mcxDPhash ( const void *key , u32 len ) { u32 h0 = 0x12a3fe2du , h1 = 0x37abe8f9u ; const char* k = key ; while (len--) { u32 h = h1 + (h0 ^ (*k++ * 71523)) ; h1 = h0 ; h0 = h ; } return h0 ; } /* "GNU Emacs" hash (from m4) */ u32 mcxGEhash ( const void* key , u32 len ) { const char* k = key ; u32 hash = 0 ; int t ; while (len--) { if ((t = *k++) >= 0140) t -= 40 ; hash = ((hash << 3) + (hash >> 28) + t) ; } return hash ; } /* Fowler Noll Vo hash */ u32 mcxFNVhash ( const void *buf , u32 len ) { u32 hval = 0x811c9dc5 ; const char *bp = buf ; while (len--) { #if 0 /* other branch supposedly optimizes gcc */ hval *= 0x01000193 #else hval += (hval<<1) + (hval<<4) + (hval<<7) + (hval<<8) + (hval<<24) #endif ; hval ^= *bp++; ; } return hval ; } /* Berkely Database hash */ u32 mcxBDBhash ( const void *key , u32 len ) { const char* k = key ; u32 hash = 0 ; while (len--) { hash = *k++ + (hash << 6) + (hash << 16) - hash ; } return hash ; } /* One at a time hash, Bob Jenkins/Colin Plumb */ u32 mcxOAThash ( const void *key , u32 len ) { const char* k = key ; u32 hash = 0 ; while (len--) { hash += *k++ ; hash += (hash << 10) ; hash ^= (hash >> 6) ; } hash += (hash << 3); ; hash ^= (hash >> 11); ; hash += (hash << 15); ; return hash ; } /* by Dan Bernstein */ u32 mcxDJBhash ( const void *key , u32 len ) { const char* k = key ; u32 hash = 5381 ; while (len--) { hash = *k++ + (hash << 5) + hash ; } return hash ; } /* UNIX ELF hash */ u32 mcxELFhash ( const void *key , u32 len ) { const char* k = key ; u32 hash = 0 ; u32 g ; while (len--) { hash = *k++ + (hash << 4) ; if ((g = (hash & 0xF0000000u))) hash ^= g >> 24 ; hash &= ~g ; } return hash ; } u32 mcxStrHash ( const void* s ) { dim l = strlen(s) ; return(mcxDPhash(s, l)) ; } int mcxStrCmp ( const void* a , const void* b ) { return strcmp(a, b) ; } void bitprint ( u32 key , FILE* fp ) { do { fputc(key & 1 ? '1' : '0', fp) ; } while ((key = key >> 1)) ; } int bitcount ( u32 key ) { int ct = 0 ; do { if (key & 1) ct++ ; } while ((key = key >> 1)) ; return ct ; } #if 0 /* The old legacy hash */ static __u32 dx_hack_hash (const char *name, int len) { __u32 hash0 = 0x12a3fe2d, hash1 = 0x37abe8f9; while (len--) { __u32 hash = hash1 + (hash0 ^ (*name++ * 7152373)); if (hash & 0x80000000) hash -= 0x7fffffff; hash1 = hash0; hash0 = hash; } return (hash0 << 1); } #endif apparix-11-062/util/hash.h000066400000000000000000000251671326043744200153370ustar00rootroot00000000000000/* (C) Copyright 2001, 2002, 2003, 2004, 2005 Stijn van Dongen * (C) Copyright 2006, 2007, 2008, 2009 Stijn van Dongen * * This file is part of tingea. You can redistribute and/or modify tingea * under the terms of the GNU General Public License; either version 3 of the * License or (at your option) any later version. You should have received a * copy of the GPL along with tingea, in the file COPYING. */ #ifndef tingea_hash_h #define tingea_hash_h #include /* TODO: * - make sort routines for keys and values by key or value criteria. * - make interface for storing integers, preferably without objectifying them. * - shrink hashes dynamically. * */ /* * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * ** Implementation notes (a few). * * * This hash interface is very powerful. It gives you more than enough * rope to hang yourself and then some. It can be used as is, or wrappers * can be made around it that restrict a caller's ability to err. * * The danger lies in the fact that this interface only does retrieval * and storage of pointers (both for keys and values), and does not clone * anything. Anything happening with the objects pointed to during the * lifetime of the hash is the responsibility of the caller. * * What the interface cannot do currently is hash integers by value (rather * than by reference). This functionality will probably be added someday. * Features: * o Searching, inserting, and deletion are all done by * mcxHashSearch. It returns a pointer to mcxKV. In all modes, the * caller can use the returned mcxKV* structure to obtain * the 'val' and 'key' members. * * o Hashes grow automatically once the average load per bucket * exceeds a settable threshold and if the hash was not declared * constant. * * o Caller supplies both the hash function and the compare function. * This interface provides several hash functions operating on a * (void* base, int len) combo, where base is cast to char by the * hash function. These functions can be used in creating custom hash * functions for your custom objects. * * o You can (of course) have multiple hashes. This is not really * a feature - however, since the idiotic does not offer * this I thought I'd mention it. * * o Witness mcxHashWalkInit, mcxHashWalkStep. * * o There is mcxHashMerge. * * o mcxHashKeys, mcxHashKVs. * * Enjoy. * Notes * There is a utility hashfile.c (distributed in a separate package) * that can be used to stress-test this module. It allows customization * of several aspects, including the hash function that should be used. */ #include "types.h" #include "list.h" /* The hash struct is hidden. Use mcxHashGetSettings if you need * to peek into the interior. Or read hash.c */ typedef struct mcxHash mcxHash; typedef struct { void* key ; void* val ; } mcxKV ; mcxHash* mcxHashNew ( dim n_buckets , u32 (*hash) (const void *a) , int (*cmp) (const void *a, const void *b) ) ; #define MCX_HASH_OPT_DEFAULTS 0 #define MCX_HASH_OPT_CONSTANT 1 #define MCX_HASH_OPT_UNUSED 2 void mcxHashSetOpts ( mcxHash* hash , double load , int option /* negative values will be ignored (feature) */ ) ; dim mcxHashMemSize ( mcxHash* hash ) ; typedef struct mcxHashSettings { dim n_buckets ; dim n_entries ; float load ; mcxbits options ; } mcxHashSettings ; void mcxHashGetSettings ( mcxHash* hash , mcxHashSettings* settings ) ; /* * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * ** mcxHashSearch * * action returns * * MCX_DATUM_DELETE -> deleted mcxKV* or NULL if not present * MCX_DATUM_INSERT -> new or present mcxKV* * MCX_DATUM_FIND -> mcxKV* if present NULL otherwise. * * usage: * * Values have to be inserted by the caller into the returned KV struct. * Make sure that keys point to objects that are constant * (with respect to the cmp function) during the lifetime of the hash. * YOU have to ensure the integrity of both keys and values. * This enables you to do whatever suits you, such as appending to * values. * * When inserting, check whether kv->key != key (where kv is returned value) * if this is the case, an identically comparing key is already present. * You may want to destroy one of the two keys and decide what to do * with the value. * * When deleting, the key-value pair is removed from the hash *AND RETURNED * TO CALLER* - you have to decide yourself what to do with it. You have to * fetch the val and key members of the returned mcxKV object immediately: * Subsequent inserts in the hash may reuse it. If the key was not present, * a value of NULL is returned. * * When finding, life is simple. NULL if absent, matching kv otherwise. * * note: * * memory management of keys and values is totally up to caller. * If usage is clean, you can use mcxHashFree for disposal of hash. */ #define mcxHashSearch(key, hash, ACTION) mcxHashSearchx(key, hash, ACTION, NULL) mcxKV* mcxHashSearchx ( void* key , mcxHash* hash , mcxmode ACTION , int* delta ) ; /* * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * ** mcxHashMerge * * this one COPIES OBJECT POINTERS and DOES NOT CLONE. * so after the merge, hash1 and hash2 keys and values should not be freed. * In case there are equivalent keys in hash1 and hash2, this may * cause trouble when the caller wants to do cleaning afterwards. * This interface is still under development. * * hashd may be equal to hash1 or hash2, and it may also be NULL. */ mcxHash* mcxHashMerge ( mcxHash* hash1 , mcxHash* hash2 , mcxHash* hashd , void* merge(void* val1, void* val2) ) ; /* * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * ** mcxHashFree * * This only works if all keys are of the same type and/or all values * are of the same type, and if your objects were created as expected by * the free routines (presumably malloced heap memory) - be careful with * constant objects like constant strings. * * freekey and freeval may not free their argument. This is because * tingea does not allow routines that leave arguments in an * inconsistent state, and free routines in tingea generally accept * an argument of the form ** pptr. * In the case of mcxHashFree this means that the interface may * feel slighly more cumbersome. * A way out would have been to make the callbacks of signature * * void freemem(void** mempp) * * The caller could access *mempp, cast it to the expected type, * and later set *mempp to NULL. However, this would require * new free routines for lots of types. With the current interface * existing Release routines can be used: * * The type of free routine expected by mcxHashFree is generally * called Release or Release_v, e.g. mcxTingRelease. * Release routines release all memory of a composite object except the * memory which holds the outer struct. * * If one of key or val is *not* a composite type or is a composite type * that does not contain malloced memory, use mcxHashFreeScalar. * * Both freekey and freeval may be NULL. When NULL, the corresponding * KV member is not loooked at. This is useful e.g. when hashing objects * owned by someone else. */ void mcxHashFree ( mcxHash** hashpp , void freekey(void* keypp) /* (yourtype1** keypp) */ , void freeval(void* valpp) /* (yourtype2** valpp) */ ) ; void mcxHashFreeScalar ( void* scalar ) ; /* * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * It copies the pointers stored in the hash */ void** mcxHashKeys ( mcxHash* hash , dim* n_entries , int (*cmp)(const void*, const void*) /* works on keys */ , mcxbits opts /* unused yet */ ) ; /* Future options: SORT, SORT_DESC */ /* * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * It copies the pointers stored in the hash */ void** mcxHashKVs ( mcxHash* hash , dim* n_entries , int (*cmp)(const void*, const void*) , mcxbits opts /* unused yet */ ) ; /* * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * Prints some information to stdout. */ void mcxHashStats ( FILE* fp , mcxHash* hash ) ; typedef struct mcxHashWalk mcxHashWalk; mcxHashWalk* mcxHashWalkInit ( mcxHash *hash ) ; mcxKV* mcxHashWalkStep ( mcxHashWalk* walk , dim *i_bucket ) ; void mcxHashWalkFree ( mcxHashWalk **walkpp ) ; void mcxHashApply ( mcxHash* hash , void (*cb)(const void* key, void* val, void* data) , void* data ) ; /* UNIX ELF hash */ /* POOR! */ u32 mcxELFhash ( const void *key , u32 len ) ; /* created by Bob Jenkins */ u32 mcxBJhash ( const void* key , u32 len ) ; /* One at a time hash, Bob Jenkins/Colin Plumb */ u32 mcxOAThash ( const void *key , u32 len ) ; /* created by Daniel Phillips */ u32 mcxDPhash ( const void* key , u32 len ) ; /* "Berkely Database" hash (from Ozan Yigit's page) */ /* POOR! */ u32 mcxBDBhash ( const void *key , u32 len ) ; /* Dan Bernstein hash (from Ozan Yigit's page) */ u32 mcxDJBhash ( const void *key , u32 len ) ; /* created by Chris Torek */ u32 mcxCThash ( const void* key , u32 len ) ; /* "GNU Emacs" hash (from m4) */ /* not among the best */ u32 mcxGEhash ( const void* key , u32 len ) ; /* Fowler Noll Vo hash */ u32 mcxFNVhash ( const void *buf , u32 len ) ; /* All experimental with weak points. */ u32 mcxSvDhash ( const void *key , u32 len ) ; u32 mcxSvD2hash ( const void *key , u32 len ) ; u32 mcxSvD1hash ( const void *key , u32 len ) ; /* uses mcxDPhash */ u32 mcxStrHash ( const void* s ) ; int mcxStrCmp ( const void* a , const void* b ) ; #endif apparix-11-062/util/heap.c000066400000000000000000000061161326043744200153150ustar00rootroot00000000000000/* (C) Copyright 2001, 2002, 2003, 2004, 2005 Stijn van Dongen * (C) Copyright 2006, 2007, 2008, 2009 Stijn van Dongen * * This file is part of tingea. You can redistribute and/or modify tingea * under the terms of the GNU General Public License; either version 3 of the * License or (at your option) any later version. You should have received a * copy of the GPL along with tingea, in the file COPYING. */ #include #include #include "alloc.h" #include "heap.h" #include "types.h" #include "err.h" mcxHeap* mcxHeapInit ( void* h ) { mcxHeap* heap = h ; if (!heap && !(heap = mcxAlloc(sizeof(mcxHeap), RETURN_ON_FAIL))) return NULL ; heap->base = NULL ; heap->heapSize = 0 ; heap->elemSize = 0 ; heap->cmp = NULL ; heap->n_inserted = 0 ; return heap ; } mcxHeap* mcxHeapNew ( mcxHeap* h , dim heapSize , dim elemSize , int (*cmp) (const void* lft, const void* rgt) ) { mcxHeap* heap = mcxHeapInit(h) ; mcxstatus status = STATUS_FAIL ; char* base ; do { if (!heap) break ; if (!(heap->base = mcxAlloc (heapSize*elemSize, RETURN_ON_FAIL))) break ; status = STATUS_OK ; } while (0) ; if (status) { mcxHeapFree(&heap) ; return NULL ; } heap->heapSize = heapSize ; heap->elemSize = elemSize ; heap->cmp = cmp ; heap->n_inserted = 0 ; base = (char*) heap->base ; return heap ; } void mcxHeapClean ( mcxHeap* heap ) { heap->n_inserted = 0 ; } void mcxHeapRelease ( void* heapv ) { mcxHeap* heap = (mcxHeap*) heapv ; if (heap->base) mcxFree(heap->base) ; heap->base = NULL ; heap->heapSize = 0 ; } void mcxHeapFree ( mcxHeap** heap ) { if (*heap) { if ((*heap)->base) mcxFree((*heap)->base) ; mcxFree(*heap) ; *heap = NULL ; } } void mcxHeapInsert ( mcxHeap* heap , void* elem ) { char* heapRoot = heap->base ; char* elemch = elem ; dim elsz = heap->elemSize ; dim hpsz = heap->heapSize ; int (*cmp)(const void *, const void*) = heap->cmp ; if (heap->n_inserted < hpsz) { dim i = heap->n_inserted ; while (i != 0 && (cmp)(heapRoot+elsz*((i-1)/2), elemch) < 0) { memcpy(heapRoot + i*elsz, heapRoot + elsz*((i-1)/2), elsz) ; i = (i-1)/2 ; } memcpy(heapRoot + i*elsz, elemch, elsz) ; heap->n_inserted++ ; } else if ((cmp)(elemch, heapRoot) < 0) { dim root = 0 ; dim d ; while ((d = 2*root+1) < hpsz) { if ( (d+1 #include #if UINT_MAX >= 4294967295 # define MCX_UINT32 unsigned int # define MCX_INT32 int #else # define MCX_UINT32 unsigned long # define MCX_INT32 long #endif typedef MCX_UINT32 u32 ; /* at least 32 bits */ typedef MCX_INT32 i32 ; /* at least 32 bits */ typedef unsigned char u8 ; /* at least 8 bits */ #ifndef ulong # define ulong unsigned long #endif #ifndef uchar # define uchar unsigned char #endif /* dim is garantueed to be an unsigned type. * ofs is garantueed to be the corresponding signed type. */ #if 0 # define dim size_t # define ofs ssize_t #else typedef size_t dim; typedef ssize_t ofs; #endif #ifdef SIZE_MAX # define DIM_MAX SIZE_MAX #else # define DIM_MAX ((size_t)-1) #endif #ifdef SSIZE_MAX # define OFS_MAX SSIZE_MAX #else # define OFS_MAX LONG_MAX /* lame, reasonable stopgap */ #endif #ifdef SSIZE_MIN # define OFS_MIN SSIZE_MIN #else # define OFS_MIN LONG_MIN /* lame, reasonable stopgap */ #endif /* annotate 'unsigned due to prototype' * and related messages */ #define different_sign #define different_width #endif apparix-11-062/util/io.c000066400000000000000000000603771326043744200150200ustar00rootroot00000000000000/* (C) Copyright 2000, 2001, 2002, 2003, 2004, 2005 Stijn van Dongen * (C) Copyright 2006, 2007, 2008, 2009 Stijn van Dongen * * This file is part of tingea. You can redistribute and/or modify tingea * under the terms of the GNU General Public License; either version 3 of the * License or (at your option) any later version. You should have received a * copy of the GPL along with tingea, in the file COPYING. */ #define DEBUG 0 /* NOTE * Very few routines should be allowed to touch buffer. * create/free routines, and step and stepBack. * currently many routines ignore the buffer (but warn * when doing so). * mcxIOtryCookie is currently only one filling buffer. * Conceivably, mcxIOfind could be next. * * TODO * buffering: document, who can initiate it? * buffering: document, which routines are incompatible? * general: remove dependency on ungetc. * make mcxIOreadLine/ mcxIOstep zlib-aware. * mcxIOfind can be made much faster. * - inline fillpatbuf * - get rid of modulus computations - subtract patlen if necessary. * - use buffered input. */ #include #include #include #include #include #include #include #include #include "io.h" #include "types.h" #include "ting.h" #include "ding.h" #include "err.h" #include "alloc.h" #include "compile.h" #include "getpagesize.h" #define inbuffer(xf) (xf->buffer_consumed < xf->buffer->len) static void buffer_empty ( mcxIO* xf ) { mcxTingEmpty(xf->buffer, getpagesize()) /* sets xf->buffer->len to 0 */ ; xf->buffer_consumed = 0 ; } static void buffer_spout ( mcxIO* xf , const char* me ) { mcxErr ( "mcxIO" , "warning: reader %s in file <%s> discards buffered input <%.*s>" , me , xf->fn->str , (int) (xf->buffer->len - xf->buffer_consumed) , xf->buffer->str+xf->buffer_consumed ) ; buffer_empty(xf) ; } int begets_stdio ( const char* name , const char* mode ) { if ( ( strchr(mode, 'r') && !strcmp(name, "-") ) || ( (strchr(mode, 'w') || strchr(mode, 'a')) && (!strcmp(name, "-") || !strcmp(name, "stderr")) ) ) return 1 ; return 0 ; } static int mcxIOwarnOpenfp ( mcxIO* xf , const char* who ) { if (xf->fp && !xf->stdio) { mcxIOerr(xf, who, "has open file pointer") ; return 1 ; } return 0 ; } mcxstatus mcxIOclose ( mcxIO* xf ) { fflush(xf->fp) ;if (!strcmp(xf->fn->str, "-") && !strcmp(xf->mode, "w") && !xf->stdio) mcxDie(1, "tst", "should not happen") ; if (xf->fp && !xf->stdio) { fclose(xf->fp) ; xf->fp = NULL ; } else if (xf->fp && xf->stdio) { int fe = ferror(xf->fp) /* fixme why not in branch above? */ ; if (fe) mcxErr("mcxIOclose", "error [%d] for [%s] stdio", fe, xf->mode) , perror("mcxIOclose") ; if (xf->ateof || feof(xf->fp)) clearerr(xf->fp) ; } /* fixme contract with usr_reset */ return mcxIOreset(xf) ; } /* note: does not touch all members, notably * usr * fn * mode * fp */ mcxstatus mcxIOreset ( mcxIO* xf ) { xf->lc = 0 ; xf->lo = 0 ; xf->lo_ = 0 ; xf->bc = 0 ; xf->ateof = 0 /* regardless of read/write */ ; buffer_empty(xf) /* xf->fp not touched; promote user care */ ; if (xf->usr && xf->usr_reset) return xf->usr_reset(xf->usr) ; return STATUS_OK ; } void mcxIOerr ( mcxIO* xf , const char *complainer , const char *complaint ) { if (!xf) return ; mcxErr ( complainer , "%s stream <%s> %s" , xf->mode , xf->fn->str , complaint ) ; } mcxIO* mcxIOnew ( const char* str , const char* mode ) { if (!str || !mode) { mcxErr("mcxIOnew PBD", "void string or mode argument") ; return NULL ; } return mcxIOrenew(NULL, str, mode) ; } /* fixme: the code below is mildly muddy. * The ->stdio decision (for new streams) might best be made * at open time? */ mcxIO* mcxIOrenew ( mcxIO* xf , const char* name , const char* mode ) { mcxbool twas_stdio = xf && xf->stdio /* it was one of STD{IN,OUT,ERR} */ ; if ( mode && !strstr(mode, "w") && !strstr(mode, "r") && !strstr(mode, "a") ) { mcxErr ("mcxIOrenew PBD", "unsupported open mode <%s>", mode) ; return NULL ; } if ( getenv("TINGEA_PLUS_APPEND") && ( name && (uchar) name[0] == '+' ) && ( mode && strchr(mode, 'w') ) ) { name++ /* user can specify -o +foo to append to foo */ ; mode = "a" ; } if (!xf) /* case 1) create a new one */ { if (!name || !mode) { mcxErr("mcxIOrenew PBD", "too few arguments") ; return NULL ; } if (!(xf = (mcxIO*) mcxAlloc(sizeof(mcxIO), RETURN_ON_FAIL))) return NULL ; if (!(xf->fn = mcxTingEmpty(NULL, 20))) return NULL ; if (!(xf->buffer = mcxTingEmpty(NULL, getpagesize()))) return NULL ; xf->fp = NULL ; xf->mode = NULL ; xf->usr = NULL ; xf->usr_reset = NULL ; xf->buffer_consumed = 0 ; } else if (xf->stdio) /* case 2) have one, don't close */ NOTHING ; else if (mcxIOwarnOpenfp(xf, "mcxIOrenew")) mcxIOclose(xf) /* case 3) have one, warn and close if open */ ; mcxIOreset(xf) ; if (name && !mcxTingWrite(xf->fn, name)) return NULL ; if (mode) { if (xf->mode) mcxFree(xf->mode) ; xf->mode = mcxStrDup(mode) ; } xf->stdio = begets_stdio(xf->fn->str, xf->mode) /* name changed, no longer stdio */ ; if (twas_stdio && !xf->stdio) xf->fp = NULL ; if (xf->stdio && mode && strchr(mode, 'a')) /* recently added */ { if (xf->mode) mcxFree(xf->mode) ; xf->mode = mcxStrDup("w") ; } return xf ; } mcxstatus mcxIOopen ( mcxIO* xf , mcxOnFail ON_FAIL ) { const char* fname = xf->fn->str ; if (!xf) { mcxErr("mcxIOnew PBD", "received void object") ; if (ON_FAIL == RETURN_ON_FAIL) return STATUS_FAIL ; exit(1) ; } if (mcxIOwarnOpenfp(xf, "mcxIOopen PBD")) return STATUS_OK ; if (!strcmp(fname, "-")) { if (strchr(xf->mode, 'r')) xf->fp = stdin ; else if (strchr(xf->mode, 'w') || strchr(xf->mode, 'a')) xf->fp = stdout ; } else if ( !strcmp(fname, "stderr") && (strchr(xf->mode, 'w') || strchr(xf->mode, 'a')) ) xf->fp = stderr ; else if ((xf->fp = fopen(fname, xf->mode)) == NULL) { if (ON_FAIL == RETURN_ON_FAIL) return STATUS_FAIL ; mcxIOerr(xf, "mcxIOopen", "cannae be opened") ; mcxExit(1) ; } return STATUS_OK ; } mcxstatus mcxIOtestOpen ( mcxIO* xf , mcxOnFail ON_FAIL ) { if (!xf->fp && mcxIOopen(xf, ON_FAIL) != STATUS_OK) { mcxErr ("mcxIO", "cannot open file <%s> in mode %s", xf->fn->str, xf->mode) ; return STATUS_FAIL ; } return STATUS_OK ; } void mcxIOrelease ( mcxIO* xf ) { if (xf) { mcxIOclose(xf) ; if (xf->fn) mcxTingFree(&(xf->fn)) ; if (xf->mode) mcxFree(xf->mode) ; } } mcxstatus mcxIOappendName ( mcxIO* xf , const char* suffix ) { if (xf->fp && !xf->stdio) mcxErr ( "mcxIOappendName PBD" , "stream open while request for name change from <%s> to <%s>" , xf->fn->str , suffix ) ; else if (!mcxTingAppend(xf->fn, suffix)) return STATUS_FAIL ; xf->stdio = begets_stdio(xf->fn->str, "-") ; return STATUS_OK ; } #if 0 mcxstatus mcxIOnewName ( mcxIO* xf , const char* newname ) { if (!mcxTingEmpty(xf->fn, 0)) return STATUS_FAIL ; return mcxIOappendName(xf, newname) ; } #else mcxstatus mcxIOnewName ( mcxIO* xf , const char* newname ) { return mcxIOrenew(xf, newname, NULL) ? STATUS_OK : STATUS_FAIL ; } #endif int mcxIOstepback ( int c , mcxIO* xf ) { if (c == EOF) return EOF ; else { if (inbuffer(xf) && xf->buffer_consumed > 0) c = xf->buffer->str[--xf->buffer_consumed] /* insert a new branch for zlib aware reading here; splice into buffer */ ; else if (ungetc(c, xf->fp) == EOF) { mcxErr ( "mcxIOstepback" , "failed to push back <%d> on stream <%s>\n" , c , xf->fn->str ) ; return EOF ; } xf->bc-- ; if (c == '\n') xf->lc-- , xf->lo = xf->lo_ , xf->lo_ = 0 ; else xf->lo-- ; } return c ; } int mcxIOstep ( mcxIO* xf ) { int c #if 0 ;if (xf->buffer) fprintf(stderr, "buffer [%s]\n", xf->buffer->str) ;else fprintf(stderr, "nobuffer\n") #endif ; if (xf->ateof) c = EOF ; else if (inbuffer(xf)) { c = xf->buffer->str[xf->buffer_consumed++] ; if (!inbuffer(xf)) buffer_empty(xf) ; } else c = fgetc(xf->fp) ; switch(c) { case '\n' : xf->lc++ ; xf->bc++ ; xf->lo_ = xf->lo ; xf->lo = 0 ; break ; case EOF : xf->ateof = 1 ; break ; default : xf->bc++ ; xf->lo++ ; break ; } return c ; } /* fixme todo * * look at bc; substract it from sz (we might have read a part already). * * support growing files. and look at other items in the grep source code. */ mcxstatus mcxIOreadFile ( mcxIO *xf , mcxTing *filetxt ) { struct stat mystat ; size_t sz = 4096 ; ssize_t r ; const char* me = "mcxIOreadFile" ; mcxTingEmpty(filetxt, 0) ; if (inbuffer(xf)) buffer_spout(xf, me) ; if (!xf->stdio) { if (stat(xf->fn->str, &mystat)) mcxIOerr(xf, me, "cannae stat file") ; else sz = mystat.st_size ; } if (!xf->fp && mcxIOopen(xf, RETURN_ON_FAIL)) { mcxIOerr(xf, me, "cannae open file") ; return STATUS_FAIL ; } if (xf->ateof) return STATUS_OK /* fixme; ting count overflow */ ; if (!(filetxt = mcxTingEmpty(filetxt, sz))) return STATUS_NOMEM ; while ((r = mcxIOappendChunk(xf, filetxt, sz, 0)) > 0 && !xf->ateof) ; if (r <0) return STATUS_FAIL /* fixme; look closer at error */ ; return STATUS_OK ; } static dim mcxIO__rl_fillbuf__ ( mcxIO* xf , char* buf , dim size , int* last ) { int a = 0 ; dim ct = 0 ; while(ctateof = 1 ; return z #undef MCX_IORL_BSZ ; } dim mcxIOdiscardLine ( mcxIO *xf ) { int a ; dim ct = 0 ; if (!xf->fp) { mcxIOerr(xf, "mcxIOdiscardLine", "is not open") ; return 0 /* fixme; set errno? */ ; } while(((a = mcxIOstep(xf)) != '\n') && a != EOF) ct++ ; if (inbuffer(xf)) /* fixme/design check buffer for line */ buffer_spout(xf, "mcxIOdiscardLine") ; return ct ; } ofs mcxIOappendChunk ( mcxIO *xf , mcxTing *dst , dim sz , mcxbits flags cpl__unused ) { unsigned long psz = getpagesize() ; dim k = sz / psz /* fixme: size checks? */ ; dim rem = sz % psz ; ofs r = 1 /* pretend in case k == 0 */ /* mcxbool account = flags & MCX_CHUNK_ACCOUNT ? TRUE : FALSE */ ; dim offset = dst->len ; char* p ; if (!dst || !xf->fp || !mcxTingEnsure(dst, dst->len + sz)) return -1 /* fixme set some (new) errno */ ; if (k) while (k-- > 0 && (r = read(fileno(xf->fp), dst->str+dst->len, psz)) > 0) dst->len += r /* careful with unsignedness */ ; if ( r > 0 && rem > 0 && (r = read(fileno(xf->fp), dst->str+dst->len, rem)) > 0 ) dst->len += r ; dst->str[dst->len] = '\0' ; xf->bc += dst->len - offset ; for (p = dst->str+offset; pstr+dst->len; p++) { if (*p == '\n') { xf->lc++ ; xf->lo_ = xf->lo ; xf->lo = 0 ; } else xf->lo++ ; } /* fixme; what if k == 0, rem == 0 ? */ if (!r) /* fixme; other possibilities? */ xf->ateof = 1 ; return dst->len ; } mcxstatus mcxIOreadLine ( mcxIO *xf , mcxTing *dst , mcxbits flags ) { int a ; dim ll ; mcxbool chomp = flags & MCX_READLINE_CHOMP ? TRUE : FALSE ; mcxbool skip = flags & MCX_READLINE_SKIP_EMPTY ? TRUE : FALSE ; mcxbool par = flags & MCX_READLINE_PAR ? TRUE : FALSE ; mcxbool dot = flags & MCX_READLINE_DOT ? TRUE : FALSE ; mcxbool bsc = flags & MCX_READLINE_BSC ? TRUE : FALSE ; mcxbool repeat = dot || par || bsc ? TRUE : FALSE ; mcxbool continuation = FALSE ; mcxTing* line ; mcxstatus stat = STATUS_OK ; if (!xf->fp && mcxIOopen(xf, RETURN_ON_FAIL)) { mcxIOerr(xf, "mcxIOreadLine", "is not open") ; return STATUS_FAIL ; } if (xf->ateof) return STATUS_DONE ; if (!dst || !mcxTingEmpty(dst, 1)) return STATUS_NOMEM ; if (skip || par) { while((a = mcxIOstep(xf)) == '\n') NOTHING ; if (xf->ateof) return STATUS_DONE ; else mcxIOstepback(a, xf) ; } if (!(line = repeat ? mcxTingEmpty(NULL, 1) : dst)) return STATUS_NOMEM ; while (1) { ofs d = mcxIO__rl_rl__(xf, line) ; if (IO_MEM_ERROR == d) { stat = STATUS_NOMEM /* fixme grainify error/status */ ; break ; } ll = line->len ; if (!repeat) break ; else /* must append line to dst */ { if ( dot && !continuation && line->str[0] == '.' && ( ll == 2 || (ll == 3 && line->str[1] == '\r') ) /* fixme still not fully covering */ ) break /* do not attach the single-dot-line */ ; if (par && !continuation && ll == 1) break /* do not attach the second newline */ ; if (!mcxTingNAppend(dst, line->str, line->len)) { stat = STATUS_NOMEM ; break ; } continuation = bsc && (ll > 1 && *(line->str+ll-2) == '\\') ; if (continuation) mcxTingShrink(dst, -2) ; if (!par && !dot && (bsc && !continuation)) break ; if (xf->ateof) break ; } } if (repeat) mcxTingFree(&line) ; if (stat) return stat /* fixme; should we not check chomp first ? */ /* fixme _: \n\r ? */ ; if (chomp && dst->len && *(dst->str+dst->len-1) == '\n') mcxTingShrink(dst, -1) ; if (xf->ateof && !dst->len) return STATUS_DONE ; return STATUS_OK ; } void mcxIOlistParmodes ( void ) { fprintf ( stdout , "%5d vanilla mode, fetch next line\n" , MCX_READLINE_DEFAULT ) ; fprintf(stdout, "%5d chomp trailing newline\n", MCX_READLINE_CHOMP) ; fprintf(stdout, "%5d skip empty lines\n", MCX_READLINE_SKIP_EMPTY) ; fprintf(stdout, "%5d paragraph mode\n", MCX_READLINE_PAR) ; fprintf(stdout, "%5d backslash escapes newline\n", MCX_READLINE_BSC) ; fprintf ( stdout , "%5d section mode, ended by singly dot on a single line\n" , MCX_READLINE_DOT ) ; } void mcxIOpos ( mcxIO* xf , FILE* channel ) { const char* ateof = xf->ateof ? "at EOF in " : "" ; fprintf ( channel , "[mcxIO] %sstream <%s>, line <%ld>, character <%ld>\n" , ateof , xf->fn->str , (long) xf->lc , (long) xf->lo ) ; } void mcxIOfree_v ( void* xfpp ) { mcxIOfree((mcxIO**) xfpp) ; } void mcxIOfree ( mcxIO** xfpp ) { if (*xfpp) { mcxIO* xf = *xfpp ; mcxIOrelease(xf) ; mcxTingFree(&(xf->buffer)) ; if (xf->usr && xf->usr_free) xf->usr_free(xf->usr) ; mcxFree(xf) ; *xfpp = NULL ; } } mcxstatus mcxIOexpectReal ( mcxIO* xf , double* dblp , mcxOnFail ON_FAIL ) { int n_read = 0 ; int n_conv = 0 ; if (inbuffer(xf)) buffer_spout(xf, "mcxIOexpectReal") ; mcxIOskipSpace(xf) /* keeps accounting correct */ ; n_conv = fscanf(xf->fp, " %lf%n", dblp, &n_read) ; xf->bc += n_read /* fixme do fscanf error handling */ ; xf->lo += n_read ; if (1 != n_conv) { if (ON_FAIL == EXIT_ON_FAIL) { mcxIOpos(xf, stderr) ; mcxErr("parseReal", "parse error: expected to find real") ; mcxExit(1) ; } return STATUS_FAIL ; } return STATUS_OK ; } mcxstatus mcxIOexpectNum ( mcxIO* xf , long* lngp , mcxOnFail ON_FAIL ) { int n_read = 0 ; int n_conv = 0 ; mcxstatus status = STATUS_OK ; if (inbuffer(xf)) buffer_spout(xf, "mcxIOexpectNum") ; mcxIOskipSpace(xf) /* keeps accounting correct */ ; errno = 0 ; n_conv = fscanf(xf->fp, "%ld%n", lngp, &n_read) ; xf->bc += n_read /* fixme do fscanf error handling */ ; xf->lo += n_read ; if (1 != n_conv) mcxErr("mcxIOexpectNum", "parse error: expected to find integer") , status = STATUS_FAIL ; else if (errno == ERANGE) mcxErr("mcxIOexpectNum", "range error: not in allowable range") , status = STATUS_FAIL ; if (status) { mcxIOpos(xf, stderr) ; if (ON_FAIL == EXIT_ON_FAIL) mcxExit(1) ; } return status ; } int mcxIOskipSpace ( mcxIO* xf ) { int c ; while ((c = mcxIOstep(xf)) != EOF && isspace(c)) ; return mcxIOstepback(c, xf) ; } mcxbool mcxIOtryCookie ( mcxIO* xf , const uchar abcd[4] ) { uchar efgh[5] ; int n_read = fread(efgh, sizeof efgh[0], 4, xf->fp) ; int error = ferror(xf->fp) ; dim i = 0 ; if (n_read == 4) for (i=0; i<4 && abcd[i] == efgh[i]; i++) NOTHING #if 0 ;fprintf(stderr, "IN %d %d %d %d %d %d\n", i, n_read, (int) efgh[0], (int) efgh[1], (int) efgh[2], (int) efgh[3]) ;fprintf(stderr, "IN %d %d %d %d %d %d\n", i, n_read, (int) abcd[0], (int) abcd[1], (int) abcd[2], (int) abcd[3]) #endif ; if (i == 4) { xf->bc += 4 ; return TRUE ; } if (!fseek(xf->fp, -n_read, SEEK_CUR)) xf->bc += (4-n_read) ; else { mcxTingNAppend(xf->buffer, (char*) efgh, n_read) ; /* xf->bc += n_read mcxIOstep does subsequent accounting */ ; if (!error) clearerr(xf->fp) ; } return FALSE ; } mcxbool mcxIOwriteCookie ( mcxIO* xf , const uchar abcd[4] ) { dim n_written = fwrite(abcd, sizeof abcd[0], 4, xf->fp) ; if (n_written != 4) { mcxErr("mcxIOwriteCookie", "failed to write <%.4s>", abcd) ; return FALSE ; } return TRUE ; } /* fixme: newlines in str thrash correct lc/lo counting */ int mcxIOexpect ( mcxIO *xf , const char *str , mcxOnFail ON_FAIL ) { const char* s = str ; int c = 0 ; int d = 0 ; int n_trailing /* * no functional behaviour yet attached to this state change * fixme: semantics for STDIN agree between stdlib and us? */ ; while ( c = (uchar) s[0] , ( c && ( d = mcxIOstep(xf) , c == d ) ) ) s++ ; n_trailing = strlen(s) /* truncintok */ ; if (c && ON_FAIL == EXIT_ON_FAIL) { mcxErr("mcxIOexpect", "parse error: expected to see <%s>", str) ; mcxIOpos(xf, stderr) ; mcxExit(1) ; } return n_trailing ; } typedef struct { int tbl[256] ; int* circle /* circular buffer */ ; int circle_last /* circle bumper */ ; const char* pat ; int patlen ; } mcxIOpat ; static void mcxio_newpat ( mcxIOpat* md , const char* pattern ) { int i ; int *tbl = md->tbl ; const char* pat ; int patlen = strlen(pattern) /* truncintok */ ; md->circle = mcxAlloc(patlen * sizeof(int), EXIT_ON_FAIL) ; md->pat = pattern ; md->patlen = patlen ; pat = md->pat /* initialize */ ; for (i = 0; i < 256; i ++) tbl[i] = patlen ; for (i = 0; i < patlen-1; i++) tbl[(uchar) pat[i]] = patlen -i -1 #if DEBUG ; for (i=0; icircle_last = patlen -1 ; } static void mcxIOcleanpat ( mcxIOpat* md ) { mcxFree(md->circle) ; } static int fillpatbuf ( mcxIO* xfin , int shift , mcxIOpat* md ) { int c = 0 ; int z = 0 ; int patlen = md->patlen ; while (z < shift && (c = mcxIOstep(xfin)) != EOF) { int q = (md->circle_last+z+1) % patlen ; md->circle[q] = c ; z++ ; } md->circle_last = (md->circle_last+shift) % patlen ; return c ; } mcxstatus mcxIOfind ( mcxIO* xfin , const char* pat , mcxOnFail ON_FAIL ) { int j, k ; int shift, patlen ; int* tbl ; int* circle ; mcxIOpat md ; int found = 0 ; mcxio_newpat(&md, pat) ; patlen = md.patlen ; tbl = md.tbl ; circle = md.circle ; shift = patlen /* * hum. This means that empty pattern matches on empty string .. * Need to fix fillpatbuf if this should be reversed. */ ; if (!patlen) found = 1 ; else do { if (EOF == fillpatbuf(xfin, shift, &md)) break ; for ( j=md.circle_last+patlen, k=patlen-1 ; j>md.circle_last && circle[j%patlen] == (uchar) pat[k] ; j--, k-- ) NOTHING #if DEBUG fprintf (stderr ,"comparing circlebuf pos %d char [%c] with pattern pos %d char [%c]\n" ,(int) (j%patlen) ,(int) ((uchar) circle[j%patlen]) ,(int) k ,(int) pat[k] ) #endif ; if (j == md.circle_last) { found++ ; break ; } shift = tbl[circle[md.circle_last % patlen]] #if DEBUG ; fprintf ( stderr , "___ last[%d] index[%d] pivot[%c] shift[%d]\n" , (int) md.circle_last , (int) md.circle_last % patlen , (int) circle[md.circle_last % patlen] , (int) shift ) #endif ; } while (1) ; mcxIOcleanpat(&md) ; if (!found && ON_FAIL == RETURN_ON_FAIL) return STATUS_FAIL ; else if (!found) exit(EXIT_FAILURE) ; return STATUS_OK ; } dim mcxIOdiscard ( mcxIO* xf , dim amount ) { dim bsz = xf->buffer->mxl ; char* buf = xf->buffer->str ; dim n_read = 0 ; dim n_chunk = amount / bsz ; dim rem = amount - bsz * n_chunk ; dim i, n ; if (inbuffer(xf)) buffer_spout(xf, "mcxIOdiscard") ; for (i=0;ifp) ; n_read += n ; xf->bc += n ; if (n != bsz) break ; } if (i < n_chunk) return n_read ; if (rem) n = fread(buf, 1, rem, xf->fp) , n_read += n , xf->bc += n ; return n_read ; } apparix-11-062/util/io.h000066400000000000000000000211661326043744200150160ustar00rootroot00000000000000/* (C) Copyright 2000, 2001, 2002, 2003, 2004, 2005 Stijn van Dongen * (C) Copyright 2006, 2007, 2008, 2009 Stijn van Dongen * * This file is part of tingea. You can redistribute and/or modify tingea * under the terms of the GNU General Public License; either version 3 of the * License or (at your option) any later version. You should have received a * copy of the GPL along with tingea, in the file COPYING. */ /* STATUS: * usable: yes * tested: yes, stress-tested in zoem and mcl * ad hoc: somewhat * quirks: probably a few * support: limited * * AIMS * - Provide convenient and efficient wrappers for reading lines, files, searching. * - Within these wrappers, account bytes and lines read. * It is explicitly not an aim to be an all-encompassing interface, wrapping * everything provided by stdio.h. The type is not opaque and you are * encouraged to inspect its fp member. * - The open modes are inspected to infer some knowledge, * then passed on directly to fopen. * - File "-" is interpreted as either STDIN or STDOUT depending on the open mode. * * BUGS * - buffer framework is fully implemented: * mcxIOexpectNum and mcxIOexpectReal ignore buffer. * - Should incorporate more (f)error checking. * * TODO: * - document interfaces. * - document which routines corrupt the counts. * - make sure that buffer treats \0 bytes correctly. Should be * pretty close. * - buffered reads (problematic: mcxIOexpectNum and friends). * - design {reset,close} framework, esp related to usr member. * ? support for pipes */ #ifndef tingea_file_h #define tingea_file_h #include #include #include "ting.h" #include "types.h" /* The thing below seems a reasonable test for seekability. * Let's agree that the main thing is the encapsulation. * */ #define mcxFPisSeekable(fp) (!fseek(fp, 0, SEEK_CUR)) /* Possibly more stringent check: * int had_error = ferror(file); * long curpos = ftell(file); * bool seekable = (curpos != -1L && fseek(file, curpos, SEEK_SET) == 0); * if (!had_error) * clearerr(file); */ /* ************************************************************************** * * ** Implementation notes. * * * This is meant to be a lightweight layer for file operations. * It is so lightweight that the pivotal data structure is not hidden. * * Basic usage: * mcxIO* xf = mcxIOnew(somestr, "r"); * mcxIOopen(xf, EXIT_ON_FAIL); * * * Searching: * mcxIOfind(xf, pattern, ON_FAIL) * * * Reading lines: * mcxIOreadLine(xf, txt, mode) * modes (xor'ed bits): * MCX_READLINE_CHOMP * MCX_READLINE_SKIP_EMPTY * MCX_READLINE_PAR (read a paragraph) * MCX_READLINE_BSC (backslash continues line) * MCX_READLINE_DOT (single dot on single line ends paragraph) * Reading files: * mcxIOreadFile(xf, txt) * * * Reading bytes: * int c = mcxIOstep(xf) * mcxIOstepback(c, xf) * * These keep track of byte count, line count, and ofset within line. * * * Reset attributes for file name object - change name or mode. * mcxIOrenew(xf, name, mode) * * * There are some more small utility functions. * ************************************************************************** * * * * TODO: * much todo about everything. * * mcxIOdiscardLine * mcxIOskipSpace * Change to instance of sth more general. * */ #define mcxIOateof(xf) (xf->ateof) #define mcxIOstdio(xf) (xf->stdio) #define mcxIOlc(xf) ((long) ((xf->lc) + (xf->lo ? 1 : 0))) /* this also takes care of EOF * not preceded by a newline */ /* As long as you did not use mcxIOopen, feel free to do anything with the fn * member, especially right after mcxIOnew. */ typedef struct { mcxTing* fn ; char* mode ; FILE* fp ; dim lc /* line count */ ; dim lo /* line offset */ ; dim lo_ /* line offset backup, only valid when lo == 0 */ ; dim bc /* byte count */ ; int ateof ; int stdio ; mcxTing* buffer /* e.g. when tryCookie fails and unseekable stream */ ; dim buffer_consumed ; void* usr /* user object */ ; mcxstatus (*usr_reset)(void*) /* function to reset user object */ ; void (*usr_free)(void*) /* function to free user object */ ; } mcxIO ; /* * mcxIOrenew does *not* support callback for resetting the usr object */ mcxIO* mcxIOrenew ( mcxIO* xf , const char* name , const char* mode ) ; mcxIO* mcxIOnew ( const char* name , const char* mode ) ; mcxstatus mcxIOopen ( mcxIO* xf , mcxOnFail ON_FAIL ) ; mcxstatus mcxIOtestOpen ( mcxIO* xf , mcxOnFail ON_FAIL ) ; /* * mcxIOfree does *not* support callback for freeing the usr object */ void mcxIOfree ( mcxIO** xf ) ; void mcxIOfree_v ( void* xfpp ) ; void mcxIOrelease ( mcxIO* xf ) ; void mcxIOerr ( mcxIO* xf , const char *complainer , const char *complaint ) ; /* Currently, for stdin/stdout/stderr clearerr is issued if necessary. * This makes e.g. repeated reads from STDIN possible. * * usr_reset is called if present. */ mcxstatus mcxIOclose ( mcxIO *xf ) ; mcxstatus mcxIOreset ( mcxIO *xf ) ; mcxstatus mcxIOreadFile ( mcxIO *xf , mcxTing *fileTxt ) ; #define MCX_READLINE_DEFAULT 0 #define MCX_READLINE_CHOMP 1 #define MCX_READLINE_SKIP_EMPTY 2 #define MCX_READLINE_PAR 4 #define MCX_READLINE_BSC 8 #define MCX_READLINE_DOT 16 mcxstatus mcxIOreadLine ( mcxIO *xf , mcxTing *lineTxt , mcxbits flags ) ; ofs mcxIOappendChunk ( mcxIO *xf , mcxTing *dst , dim sz , mcxbits flags ) ; /* Returns the number of bytes that could be discarded. */ dim mcxIOdiscardLine ( mcxIO *xf ) ; /* Returns the number of bytes that could be discarded. * ONLY keeps the xf->bc counter up to date. */ dim mcxIOdiscard ( mcxIO *xf , dim amount ) ; /* OK to call this after mcxIOnew, before mcxIOopen */ mcxstatus mcxIOnewName ( mcxIO* xf , const char* newname ) ; /* OK to call this after mcxIOnew, before mcxIOopen */ mcxstatus mcxIOappendName ( mcxIO* xf , const char* suffix ) ; int mcxIOstep ( mcxIO* xf ) ; int mcxIOstepback ( int c , mcxIO* xf ) ; void mcxIOpos ( mcxIO* xf , FILE* channel ) ; void mcxIOlistParmodes ( void ) ; /* * Returns count of trailing characters in str not matching. */ int mcxIOexpect ( mcxIO* xf , const char* str , mcxOnFail ON_FAIL ) ; mcxstatus mcxIOexpectReal ( mcxIO* xf , double* dblp , mcxOnFail ON_FAIL ) ; mcxstatus mcxIOexpectNum ( mcxIO* xf , long* lngp , mcxOnFail ON_FAIL ) ; /* * Returns next non-white space char, * which is pushed back onto stream after reading. */ int mcxIOskipSpace ( mcxIO* xf ) ; /* * Purpose: find str in file. If str is found file pointer is set at the end * of match (fgetc or mcxIOstep would retrieve the next byte), otherwise, * the stream is at EOF. * * Internally this uses Boyer Moore Horspool (bmh) search. * It processes the stream with fgetc, so the input file need not be * seekable. This means that finding is relatively slow. * * An improvement would be to implement faster input munging for seekable * streams, (using reads of size pagesize) and then reposition the stream * after searching. * */ mcxstatus mcxIOfind ( mcxIO* xf , const char* str , mcxOnFail ON_FAIL ) ; /* * NOTE * When the cookie is not found this routine does * 1) It tries to fseek to the point of departure * 2) If that fails, it stores the bytes it could not rewind * in xfin->buffer * * + mcxIOstep * + mcxIOfind * + mcxIOskipSpace * + mcxIOexpect * + mcxIOreadLine * * will access this buffer, but certain other routines will not, e.g. * * - mcxIOreadFile * - mcxIOexpectNum * - mcxIOexpectReal * - all stdio routines (fread, fgetc) * * For all mcxIO routines this is an open bug. * */ mcxbool mcxIOtryCookie ( mcxIO* xfin , const unsigned char abcd[4] ) ; mcxbool mcxIOwriteCookie ( mcxIO* xfout , const unsigned char abcd[4] ) ; #endif apparix-11-062/util/let.c000066400000000000000000001347331326043744200151730ustar00rootroot00000000000000/* (C) Copyright 2001, 2002, 2003, 2004, 2005 Stijn van Dongen * (C) Copyright 2006, 2007, 2008, 2009 Stijn van Dongen * * This file is part of tingea. You can redistribute and/or modify tingea * under the terms of the GNU General Public License; either version 3 of the * License or (at your option) any later version. You should have received a * copy of the GPL along with tingea, in the file COPYING. */ /* * You probably don't want to look at this code - the reasons are explained * below. I like the beast though, especially the part that you can specify * callbacks to parse 'external' data. */ /* * TODO * catch integer overflow. * consider unsigned type. Perhaps implement signed with separate sign. * consider bit operators and unsigned type. * precision. */ #include #include #include #include #include "let.h" #include "ting.h" #include "ding.h" #include "alloc.h" #include "minmax.h" #include "err.h" #include "types.h" #include "ding.h" #include "compile.h" /* ************************************************************************** * * ** Implementation notes (a few). * * Features * All of C's operators in a revised precedence scheme, with exponentiation * added. The groups of logical operators, bitwise operators, comparison * operators have equal precedence internally (but changing this is a * matter of editing a single table). Unsigned integers are not supported * (so bitwise complement behaves funnily). Ternary operator behaves as * should; evaluates only one of its branches. Boolean logical operators * do shortcircuit. All mathematical functions from math.h and some * additional ones (e.g. abs, round, sign). Variables can be parsed and * evaluated using user-supplied functions. Currently, variables must be * recognizable by a special lead character. Todos * I may want to pass raam along to compute and flatten after all. * This brings back in the tokids, which are nice to have. * It also means that global callbacks can be localized. * * Right now, inf is not caught. isinf() seems not portable though :( * * getatoken could be equipped with more error handling facilities now that * user_parse is inserted. The current behaviour is that parsing control * is transfered to native parsing if user parsing does not succeed. This * can be used for overloading the special character, e.g. setting it to * '!' -> user parsing could require a !<..> sequence; if not found, '!' * would be seen as the negation operator. * * user_parse and user_eval need to be global in scope as long * as raam is not passed along in compute and flatten, * but that is actually not a problem (apart from .so libs). * * Hashing of function names. * * Audit overflow, exceptions, long/double mixing. * * Should min(1,2.0) be 1 rather than 1.0 ? in that case, need special * behaviour for twoary max and min just like now for oneary abs. * * Make int to double overflow promotion a trmInit option. * * on STATUS_FAIL for parse, write error message in telraam. * * allow functions with empty arguments (e.g. rand()). * * add some of the funny stuff provided by fv, f? * * tn toktype is used both in lexing/parsing stage and in reduction stage. * not scalable. Future idea: * Implement an intermediate layer between parsing and evaluation. * E.g. convert the result of trmParse() to a stack. Done * Errors cascade back. For parse errors all memory seems to be reclaimed * (for all cases tried so far). * After parsing, no other errors should be possible I believe. * * made real type, which could be long double. Tis not however, * because long double math does not seem widespread and/or standard. * made num type, which could be long long. Tis not however, * because long long math seems to be C99 (not widespread etc). * * enabled user callbacks for variable and function interpolation. Integers/Floats * It is tracked which operations result in integers and which do * not. If integer overflow occurs the result is promoted to double. * The internal logic implementing this behaviour dictates that * as long as (flags & TN_ISINT) it must be true that fval ==~ ival. * TODO: make this customizable. * NOTE: doubles pbb can capture all 32-bit integers, but not so for * 64-bit integers. May make subtle difference. Apology * It's lame to write your own parser rather than lex and yacc but scriptor * wanted to do it one more time than zero. * * The result is pretty ad hoc and not generic, what it's got going for it * is that it works. Also, trmParse() is not that bad I believe, although * it is not very scalable either. compute() is the trickiest. Some * provisions were made to get short-circuiting and the ternary op working. * The same data structure is used for tokenization, parsing, and * evaluation. Ugly! Implementation notes * . Parse tree is implicitly stored as a linked list. * . Evaluation is done by compute/flatten; precedence and branching are done * during evaluation, rather than (partly) precomputed (which would much be * cleaner). precedence is done in flatten; branching in compute. * . tn's (token nodes) are used both by lexer, parser, and interpreter, * which is not the nicest way of doing it. * . Could push and convert all tokens to a stack (format), which would unify * operators and functions to some extent, and separate interpretation from * parsing and braching. Errors * Currently we have arithmetic error only. * TODO: * Overflow error -- but isinf does not seem portable :( Caveat * tnFree/tnDup should not be applied to a TOKEN_CLOSE node, dupwise * speaking. This is because compute currently has a sanity check for * pointer identity before and after its main loop. * * tricky spots, unfinished thoughts, future ideas, and omitted assertions * are marked with the sequence 'mq' (or even 'mqmq'), but not all of them. * Some reminders * routines that must be checked (malloc dependent) * tnDup * tnNewToken * tnPushToken * tnPushThis * routines that need be checked for other reason * tnUser * flatten * compute * getatom * getexpression * trmParse */ typedef double real; /* but we always use double arithmetic */ /* i.e. never use long double */ #ifdef LET99 typedef long long num; # define NUM_MIN LLONG_MIN /* this branch has not been tested! */ # define NUM_MAX LLONG_MAX /* and requires modifiation of trmEval */ #else typedef long num; # define NUM_MIN LONG_MIN # define NUM_MAX LONG_MAX #endif static int debug_g = 0; static int (*user_parse_g)(mcxTing* txt, int offset) = NULL; static mcxenum (*user_eval_g)(const char* token, long *ival, double *fval) = NULL; static char user_char_g = 0; typedef struct tn /* the lex/parse/interpret one stop-shop */ { mcxTing* token ; i32 toktype ; i32 optype ; i32 opid ; real fval ; num ival ; struct tn* prev ; struct tn* next ; i32 flags ; } tn; /* token node, or whatever */ struct telRaam { mcxTing *text ; mcxTing *token /* current token */ ; char* p ; mcxbool buffered /* should use buffer (pushed back token)? */ ; tn* node ; tn* start ; real fval ; num ival ; i32 flags ; i32 toktype ; i32 depth ; } ; typedef enum { TOKEN_EXH = -1 , TOKEN_START = 0 /* special start symbol */ , TOKEN_UNIOP = 1 /* unary, 1 */ , TOKEN_BINOP = 2 /* binary, 2 */ , TOKEN_FUN = 69 /* can be fun, but I mean 6 = ( 9 = ) */ , TOKEN_TRIOP = 3333 /* ternary, let's stress the fact */ , TOKEN_TRICATCH = 6667 /* complement of a number wrt another number */ , TOKEN_CMP = 12321 /* hum, dunnow really */ , TOKEN_OR = 11 /* || */ , TOKEN_AND = 88 /* && */ , TOKEN_OPEN = 6 /* like fun, 6 = ( */ , TOKEN_CLOSE = 9 /* like fun, 9 = ) */ , TOKEN_COMMA = 13579 /* gaps */ , TOKEN_CONST = 31415 /* PI */ , TOKEN_USER = 981 /* G, variable */ } tokentype ; #define OP_UNI_NEG 1 << 0 /* - */ #define OP_UNI_NOT 1 << 1 /* ! */ #define OP_UNI_COMPL 1 << 2 /* ~ */ #define OP_EXP_EXP 1 << 3 /* ** */ #define OP_MUL_MUL 1 << 4 /* * */ #define OP_MUL_FRAC 1 << 5 /* / */ #define OP_MUL_DIV 1 << 6 /* // */ #define OP_MUL_MOD 1 << 7 /* % */ #define OP_ADD_ADD 1 << 8 /* + */ #define OP_ADD_SUB 1 << 9 /* - */ #define OP_BIT_LSHIFT 1 << 10 /* << */ #define OP_BIT_RSHIFT 1 << 11 /* >> */ #define OP_BIT_AND 1 << 12 /* & */ #define OP_BIT_OR 1 << 13 /* | */ #define OP_BIT_XOR 1 << 14 /* ^ */ #define OP_CMP_LT 1 << 15 /* < */ #define OP_CMP_LQ 1 << 16 /* <= */ #define OP_CMP_GQ 1 << 17 /* >= */ #define OP_CMP_GT 1 << 18 /* > */ #define OP_CMP_EQ 1 << 19 /* == */ #define OP_CMP_NE 1 << 20 /* != */ #define OP_TRI_START 1 << 21 /* ! */ #define OPTYPE_UNI (OP_UNI_NEG | OP_UNI_NOT | OP_UNI_COMPL) #define OPTYPE_EXP OP_EXP_EXP #define OPTYPE_MUL (OP_MUL_MUL | OP_MUL_FRAC | OP_MUL_DIV | OP_MUL_MOD) #define OPTYPE_ADD (OP_ADD_ADD | OP_ADD_SUB) #define OPTYPE_BIT (OP_BIT_LSHIFT | OP_BIT_RSHIFT \ | OP_BIT_AND | OP_BIT_OR | OP_BIT_XOR) #define OPTYPE_CMP (OP_CMP_LT | OP_CMP_LQ | OP_CMP_GT | OP_CMP_GQ \ | OP_CMP_EQ | OP_CMP_NE) #define OPTYPE_TRI OP_TRI_START typedef struct opHook { char* opname ; i32 opid ; i32 optype ; } opHook ; double sign (double f ) { return f > 0 ? 1.0 : f < 0 ? -1.0 : 0.0 ; } double letround (double f ) { return f > 0 ? floor(f+0.5) : ceil(f-0.5) ; } double letlog2 (double f) { return f > 0 ? log(f) / log(2.0) : 0.0 ; } typedef struct fun1Hook { char* funname ; double (*funcd)(double a) ; i32 funflags ; } fun1Hook ; #define FUN_SPECIAL 1 #define FUN_INTRESULT 2 #define FUN_OVERLOADED 4 double show_bits(double a) { return a; } static fun1Hook fun1HookDir[] = { { "sin", sin , 0 } , { "cos", cos , 0 } , { "tan", tan , 0 } , { "exp", exp , 0 } , { "log", log , 0 } , { "log10", log10 , 0 } , { "log2", letlog2 , 0 } , { "asin", asin , 0 } , { "acos", cos , 0 } , { "atan", atan , 0 } , { "sqrt", sqrt , 0 } , { "abs", fabs , FUN_SPECIAL } , { "floor", floor , FUN_INTRESULT } , { "ceil", ceil , FUN_INTRESULT } , { "round", letround , FUN_INTRESULT } , { "int", letround , FUN_INTRESULT } , { "sign", sign , FUN_INTRESULT } , { "bits", show_bits , FUN_SPECIAL } , { NULL, NULL , 0 } } ; double max ( double a, double b ) { return a > b ? a : b ; } double min ( double a, double b ) { return a < b ? a : b ; } num maxl ( num a, num b ) { return a > b ? a : b ; } num minl ( num a, num b ) { return a < b ? a : b ; } typedef struct fun2Hook { char* funname ; double (*funcd)(double a, double b) ; num (*funcl)(num a, num b) ; i32 funflags ; } fun2Hook ; static fun2Hook fun2HookDir[] = { { "max", max , maxl, 0 } , { "min", min , minl, 0 } , { NULL, NULL , NULL, 0 } } ; /* mq if (tn_isint(lft) && tn_isint(rgt) && hook->funcl) */ static opHook opHookDir[] = { { "-", OP_UNI_NEG, OPTYPE_UNI } , { "!", OP_UNI_NOT, OPTYPE_UNI } , { "~", OP_UNI_COMPL, OPTYPE_UNI } , { "**", OP_EXP_EXP, OPTYPE_EXP } , { "*", OP_MUL_MUL, OPTYPE_MUL } , { "/", OP_MUL_FRAC, OPTYPE_MUL } , { "//", OP_MUL_DIV, OPTYPE_MUL } , { "%", OP_MUL_MOD, OPTYPE_MUL } , { "+", OP_ADD_ADD, OPTYPE_ADD } , { "-", OP_ADD_SUB, OPTYPE_ADD } , { "<<", OP_BIT_LSHIFT, OPTYPE_BIT } , { ">>", OP_BIT_RSHIFT, OPTYPE_BIT } , { "&", OP_BIT_AND, OPTYPE_BIT } , { "|", OP_BIT_OR, OPTYPE_BIT } , { "^", OP_BIT_XOR, OPTYPE_BIT } , { "<", OP_CMP_LT, OPTYPE_CMP } , { "<=", OP_CMP_LQ, OPTYPE_CMP } , { ">=", OP_CMP_GQ, OPTYPE_CMP } , { ">", OP_CMP_GT, OPTYPE_CMP } , { "==", OP_CMP_EQ, OPTYPE_CMP } , { "!=", OP_CMP_NE, OPTYPE_CMP } , { "?", OP_TRI_START, OPTYPE_TRI } , { NULL, 0, 0, } } ; enum { EXPECT_ANY = 1 , EXPECT_ATOM = 2 } ; #define TN_ISINT 1 /* tn token node, object used everywhere */ #define TN_NOINT 2 #define TN_ISNAN 4 #define TN_ISINF 8 #define tn_isint(a) (a->flags & TN_ISINT) mcxbool trmIsNan ( int flags ) { return flags & TN_ISNAN ; } mcxbool trmError ( int flags ) { return flags & (TN_ISNAN | TN_ISINF) ; } mcxbool trmIsInf ( int flags ) { return flags & TN_ISINF ; } mcxbool trmIsNum ( int flags ) { return flags & TN_ISINT ; } mcxbool trmIsReal ( int flags ) { return !(flags & (TN_ISINT | TN_ISNAN | TN_ISINF)) ; } mcxstatus getexpression ( telRaam *raam ) ; mcxstatus getatom ( telRaam* raam ) ; void dump ( tn* node , i32 times , const char* msg ) ; void trmDump ( telRaam* raam , const char* msg ) { dump(raam->start, 0, msg) ; } tn* tnNewToken ( const char* token , i32 toktype , real fval , num ival ) { tn* node = mcxAlloc(sizeof(tn), RETURN_ON_FAIL) ; if (!node) return NULL ; if (!(node->token = mcxTingNew(token ? token : "_<>_"))) { mcxFree(node) ; return NULL ; } node->toktype = toktype ; node->optype = 0 ; node->opid = 0 ; node->ival = ival ; node->fval = fval ; node->next = NULL ; node->prev = NULL ; node->flags = 0 ; if (debug_g) dump(node, 1, "new node") ; return node ; } tn* tnDup ( tn* this , const char* str ) { tn* new = tnNewToken ( str , this->toktype , this->fval , this->ival ) ; if (!new) return NULL ; new->optype = this->optype ; new->next = this->next ; new->prev = this->prev ; new->flags = this->flags ; return new ; } mcxstatus tnFree ( tn* lft , tn* rgt ) { tn* cur = lft, *next ; while (cur) { mcxTingFree(&(cur->token)) ; if (debug_g) fprintf(stderr, "___ [telraam] freeing node <%p>\n", (void*) cur) ; if (cur == rgt) { mcxFree(cur) ; break ; } if (cur->next && cur->next->prev != cur) { mcxErr("tnFree", "free encountered spaghetti") ; return STATUS_FAIL ; } next = cur->next ; mcxFree(cur) ; cur = next ; } return STATUS_OK ; } void tnLink2 ( tn* one , tn* two ) { if (one) one->next = two ; if (two) two->prev = one ; } void tnLink3 ( tn* one , tn* two , tn* three ) { if (one) one->next = two ; if (three) three->prev = two ; two->prev = one ; two->next = three ; } mcxstatus tnPushToken ( telRaam* raam ) { i32 toktype = raam->toktype ; tn* new = tnNewToken(raam->token->str, toktype, 0.0, 0) ; if (!new) return STATUS_FAIL ; if (toktype == TOKEN_CONST) new->fval = raam->fval , new->ival = raam->ival , new->flags = raam->flags ; else if ( toktype == TOKEN_BINOP || toktype == TOKEN_UNIOP ) { opHook* oh = raam->toktype == TOKEN_BINOP ? opHookDir+3 : opHookDir+0 /* bigg phat ugly hack */ /* (need to overcome '-' uni/bin ambiguity */ ; while (oh->opname) { if (!strcmp(oh->opname, raam->token->str)) { new->optype = oh->optype ; new->opid = oh->opid ; break ; } oh++ ; } if (!oh->opname) { mcxErr("tnPushToken", "no such operator: <%s>", raam->token->str) ; tnFree(new, NULL) ; return STATUS_FAIL ; } } else if (raam->toktype == TOKEN_FUN) { /* mq: move name resolution to here ? mm, needs arity */ ; } tnLink3(raam->node, new, NULL) ; raam->node = new ; return STATUS_OK ; } mcxstatus tnPushThis ( telRaam* raam , const char* token , i32 toktype ) { tn* new = tnNewToken(token, toktype, 0.0, 0) ; if (!new) return STATUS_FAIL ; tnLink3(raam->node, new, NULL) ; raam->node = new ; return STATUS_OK ; } void trmDebug ( void ) { debug_g = 1 ; } telRaam* trmInit ( const char* str ) { telRaam* raam= mcxAlloc(sizeof(telRaam), RETURN_ON_FAIL) ; if (!raam) return NULL ; raam->text = mcxTingNew(str) ; raam->token = mcxTingEmpty(NULL, 30) ; raam->p = raam->text->str ; raam->buffered = FALSE ; raam->node = tnNewToken("_start_", TOKEN_START, 0.0, 0) ; raam->start = raam->node ; raam->fval = 0.0 ; raam->ival = 0 ; raam->flags = 0 ; raam->depth = 1 ; raam->toktype= 0 ; if (!raam->text || !raam->token || !raam->node) mcxFree(raam) , raam = NULL ; return raam ; } mcxstatus trmExit ( telRaam* raam ) { if (tnFree(raam->start, raam->node)) return STATUS_FAIL ; mcxTingFree(&(raam->text)) ; mcxTingFree(&(raam->token)) ; mcxFree(raam) ; return STATUS_OK ; } void untoken ( telRaam* raam ) { raam->buffered = TRUE ; } void dump ( tn* node , i32 times , const char* msg ) { tn* prev = NULL ; printf("______ %s\n", msg ? msg : "dumping dumping dumping") ; printf ("%8s" "%10s" "%10s" "%10s" "%12s" "%10s" "%6s\n" ,"toktype","optype","opclass","token","fval","ival","flags" ) ; while (node) { printf ("%8d" "%10d" "%10d" "%10s" "%12.4f""%10ld""%6d\n" , node->toktype , node->opid , node->optype , node->token ? node->token->str : "<>" , node->fval , (long) node->ival , node->flags ) ; prev = node ; node = node->next ; if (node && (node->prev->next != node || node->prev != prev)) fprintf ( stderr , "_____ [telraam] PANICK incorrect linking" " <%p> n<%p> np<%p> npn<%p>\n" , (void*) prev , (void*) node , (void*) node->prev , (void*) node->prev->next ) ; if (!--times) break ; } } int getatoken ( telRaam* raam , i32 mode ) { char* p = raam->p ; i32 toktype = 0 ; int len ; while (isspace((unsigned char) *p)) p++ ; raam->p = p ; if (!*p) { mcxTingWrite(raam->token, "EOF") ; return TOKEN_EXH ; } else if ( mode == EXPECT_ATOM && ( *p == '-' || *p == '!' || *p == '~' ) ) { toktype = TOKEN_UNIOP ; p = p+1 ; } else if (*p == ':') { toktype = TOKEN_TRICATCH ; p = p+1 ; } else if (*p == '&' && *(p+1) == '&') { toktype = TOKEN_AND ; p = p+2 ; } else if (*p == '|' && *(p+1) == '|') { toktype = TOKEN_OR ; p = p+2 ; } else if (*p == '?') { toktype = TOKEN_TRIOP ; p = p+1 ; } else if (*p == ',') { toktype = TOKEN_COMMA ; p = p+1 ; } else if (isdigit((unsigned char) *p)) { int l ; double f ; sscanf(p, "%lf%n", &f, &l) /* mq need error checking */ ; toktype = TOKEN_CONST ; raam->fval = f ; raam->ival = 0 ; if (raam->fval < NUM_MIN || raam->fval > NUM_MAX) raam->flags = TN_NOINT ; else { raam->flags = mcxStrChrAint(p, isdigit, l) ? 0 : TN_ISINT ; raam->ival = f > 0 ? f + 0.5 : f - 0.5 ; } p = p+l ; } else if (isalpha((unsigned char) *p) || *p == '_') { char* q = p ; while(isalpha((unsigned char) *q) || *q == '_' || isdigit((unsigned char) *q)) q++ ; p = q ; toktype = TOKEN_FUN ; } else if (*p == '(' || *p == ')') { toktype = *p == '(' ? TOKEN_OPEN : TOKEN_CLOSE ; p = p+1 ; } else if ( user_char_g == *p && (len = user_parse_g(raam->text, p-raam->text->str)) > 0 ) /* ^truncintok */ { p += len ; toktype = TOKEN_USER ; } else { char* q = p ; while (*q == *p || *q == '=') /* hack */ q++ ; toktype = TOKEN_BINOP ; p = q ; } mcxTingNWrite(raam->token, raam->p, (dim) (p-raam->p)) ; raam->p = p ; return toktype ; } i32 gettoken ( telRaam* raam , i32 mode ) { if (raam->buffered) raam->buffered = FALSE ; else raam->toktype = getatoken(raam, mode) ; return raam->toktype ; } tn* findop ( tn* end ) { tn* node = end->prev, *max = NULL ; while (node->toktype != TOKEN_OPEN) { if ( node->toktype == TOKEN_UNIOP || node->toktype == TOKEN_BINOP || node->toktype == TOKEN_TRIOP ) { if ( !max || node->optype <= max->optype ) max = node ; } node = node->prev ; } return max ; } tn* finduser ( tn* start ) { tn* node = start->next ; while (node->toktype != TOKEN_CLOSE) { if (node->toktype == TOKEN_USER) return node ; node = node->next ; } return NULL ; } mcxstatus tnUser ( tn* usr ) { mcxenum stat = user_eval_g(usr->token->str, &usr->ival, &usr->fval) ; if (stat == TRM_ISNUM) { usr->flags = TN_ISINT ; usr->fval = usr->ival ; } else if (stat == TRM_ISREAL) usr->flags = 0 ; else if (stat == TRM_ISNAN) { usr->flags = TN_ISNAN ; return STATUS_FAIL ; } else if (stat == TRM_FAIL) { usr->flags = TN_ISNAN ; return STATUS_FAIL ; } usr->toktype = TOKEN_CONST ; return STATUS_OK ; } /* * Flattens a bunch of leafs interspersed with operators. * Leaves received start and corresponding end alone. */ mcxstatus flatten ( tn* start , tn* end ) { tn* new, *op, *usr ; real fval = 0.0 ; num ival = 0 ; const char* me = "flatten" ; if ( start->toktype != TOKEN_OPEN || end->toktype != TOKEN_CLOSE ) { mcxErr ( me , "wrong toktype - ids (%p, %p)" , (void*) start, (void*) end ) ; dump(start, 0, NULL) ; return STATUS_FAIL ; } new = start->next ; while ((usr = finduser(start))) { if (tnUser(usr)) return STATUS_FAIL ; } while ((op = findop(end))) { tn* lft = op->prev ; tn* rgt = op->next /* ugly in case of UNIOP */ ; int err = 0 ; i32 flags = 0 ; if (op->toktype == TOKEN_UNIOP) { real frgt = rgt->fval ; num irgt = rgt->ival ; switch(op->opid) { case OP_UNI_NOT : ival = (tn_isint(rgt) && irgt) ? 0 : frgt ? 0 : 1 ; fval = ival ; flags |= TN_ISINT ; break ; case OP_UNI_NEG : fval = -frgt ; ival = -irgt ; break ; case OP_UNI_COMPL : ival = ~irgt ; fval = ival ; flags |= TN_ISINT ; break ; default : err = 1 ; } lft = op ; flags |= tn_isint(rgt) /* mq fval=ival assignment ugly, need overflow check as well :) */ ; } else if (op->toktype == TOKEN_BINOP) { real flft = lft->fval ; real frgt = rgt->fval ; num ilft = lft->ival ; num irgt = rgt->ival ; if (op->opid & OPTYPE_BIT) { if (!tn_isint(lft)) ilft = lft->fval /* fixme: why the reassign? */ ; if (!tn_isint(rgt)) irgt = rgt->fval /* fixme: why the reassign? */ ; if (!tn_isint(rgt) || !tn_isint(lft)) mcxErr ( "let" , "[flatten][bitop %s] forcing real operands to number" , op->token->str ) ; } if (lft->toktype != TOKEN_CONST || rgt->toktype != TOKEN_CONST) { mcxErr(me, "this bifoo is not the right foo") ; dump(start, 0, NULL) ; return STATUS_FAIL ; } switch(op->opid) { case OP_MUL_MUL : fval = flft * frgt ; ival = ilft * irgt ; break ; case OP_EXP_EXP : if (flft < 0 && !(rgt->flags & TN_ISINT)) fval = 0.0 , flags |= TN_ISNAN ; else fval = pow(flft,frgt) ; ival = letround(fval) ; break ; case OP_ADD_ADD : fval = flft + frgt ; ival = ilft + irgt ; break ; case OP_MUL_FRAC : fval = frgt ? (flft / frgt) : 0.0 ; ival = irgt ? (ilft / irgt) : 0 ; if (tn_isint(lft) && tn_isint(rgt) && ival * irgt == ilft) flags |= TN_ISINT ; else flags |= TN_NOINT ; if (!frgt) flags |= TN_ISNAN ; break ; case OP_MUL_DIV : fval = frgt ? floor(flft/frgt) : 0.0 ; ival = irgt ? (ilft / irgt) : 0 ; if (!frgt) flags |= TN_ISNAN ; break ; case OP_MUL_MOD : fval = frgt ? frgt * (flft/frgt-floor(flft/frgt)) : 0.0 ; ival = irgt ? (ilft % irgt) : 0.0 ; if (!frgt) flags |= TN_ISNAN ; break ; case OP_ADD_SUB : fval = flft - frgt ; ival = ilft - irgt ; break ; case OP_CMP_LT : ival = tn_isint(lft) && tn_isint(rgt) && (ilft < irgt) ? 1 : flft < frgt ? 1 : 0 ; flags |= TN_ISINT ; break ; case OP_CMP_LQ : ival = tn_isint(lft) && tn_isint(rgt) && (ilft <= irgt) ? 1 : flft <= frgt ? 1 : 0 ; flags |= TN_ISINT ; break ; case OP_CMP_GQ : ival = tn_isint(lft) && tn_isint(rgt) && (ilft >= irgt) ? 1 : flft >= frgt ? 1 : 0 ; flags |= TN_ISINT ; break ; case OP_CMP_GT : ival = tn_isint(lft) && tn_isint(rgt) && (ilft > irgt) ? 1 : flft > frgt ? 1 : 0 ; flags |= TN_ISINT ; break ; case OP_CMP_EQ : ival = tn_isint(lft) && tn_isint(rgt) && (ilft == irgt) ? 1 : flft == frgt ? 1 : 0 ; flags |= TN_ISINT ; break ; case OP_CMP_NE : ival = tn_isint(lft) && tn_isint(rgt) && (ilft != irgt) ? 1 : flft != frgt ? 1 : 0 ; flags |= TN_ISINT ; break ; case OP_BIT_LSHIFT : ival = ilft << irgt ; flags |= TN_ISINT ; break ; case OP_BIT_RSHIFT : ival = ilft >> irgt ; flags |= TN_ISINT ; break ; case OP_BIT_AND : ival = ilft & irgt ; flags |= TN_ISINT ; break ; case OP_BIT_OR : ival = ilft | irgt ; flags |= TN_ISINT ; break ; case OP_BIT_XOR : ival = ilft ^ irgt ; flags |= TN_ISINT ; break ; default : err = 1 ; } /* this rule implements implicit behaviour with overruling: * two integers result in an integer unless overruled * with the TN_NOINT attribute. */ if (!(flags & TN_NOINT)) flags |= tn_isint(lft) & tn_isint(rgt) /* next we check whether overflow occurred. If so, discard the * integer attribute. This depends on i) fval follows ival as * long as the integer attribute is set and ii) in that pursuit, * fval is computed to be similar to ival. */ ; if ((fval > NUM_MAX || fval < NUM_MIN) && (flags & TN_ISINT)) flags ^= TN_ISINT /* make fval follow ival, otherwise, give ival special * value. *Never* should float->int conversion happen * in this code; it should be user-enforced. * Setting ival to 0 may help show any such behaviour as a bug. */ ; if (flags & TN_ISINT) fval = ival ; else ival = 0 ; } else { mcxErr(me, "panicking at toktype <%ld>", (long) op->toktype) ; return STATUS_FAIL ; } if (err) { mcxErr ( me , "op <%s> id <%ld> class <%ld> not yet supported" , op->token->str , (long) op->opid , (long) op->optype ) ; return STATUS_FAIL ; } if (flags & TN_ISNAN) { mcxErr(me, "arithmetic exception for op <%s>", op->token->str) ; return STATUS_FAIL ; } if (!(new = tnNewToken("_eval_", TOKEN_CONST, fval, ival))) return STATUS_FAIL ; new->flags = flags /* mq need overflow check, nan check etc */ ; tnLink3(lft->prev, new, rgt->next) ; if (tnFree(lft, rgt)) return STATUS_FAIL ; } return STATUS_OK ; } fun1Hook* getfun1id ( tn* start ) { fun1Hook *fh = fun1HookDir+0 ; while (fh->funname && strcmp(fh->funname, start->token->str)) fh++ ; return fh->funname ? fh : NULL ; } fun2Hook* getfun2id ( tn* start ) { fun2Hook *fh = fun2HookDir+0 ; while (fh->funname && strcmp(fh->funname, start->token->str)) fh++ ; return fh->funname ? fh : NULL ; } tn* funcx ( tn* start , tn* end ) { tn *new, *arg = end->prev ; real fval = 0.0 ; num ival = 0 ; i32 flags = 0 ; int n_args = arg->toktype == TOKEN_CONST ; int err = 0 ; const char* me = "funcx" ; const char* fn = "_init_" ; if ( start->toktype != TOKEN_FUN || start->next->toktype != TOKEN_OPEN || end->toktype != TOKEN_CLOSE ) { mcxErr(me, "wrong toktype - ids (%p, %p)", (void*) start, (void*) end) ; dump(start, 0, NULL) ; return NULL ; } while ( arg->toktype == TOKEN_CONST && arg->prev->toktype == TOKEN_COMMA ) arg = arg->prev->prev , n_args++ ; if (arg->prev != start->next) { mcxErr(me, "this function foo is not the right foo") ; dump(start, 0, NULL) ; return NULL ; } if (n_args == 1) { tn* op1 = arg ; fun1Hook* fh = getfun1id(start) ; if (fh) { fn = fh->funname ; if (fh->funflags & FUN_SPECIAL) { if (!strcmp(fn, "abs")) { if (tn_isint(op1)) { ival = op1->ival > 0 ? op1->ival : -op1->ival ; flags |= TN_ISINT ; } else fval = op1->fval > 0 ? op1->fval : -op1->fval ; } else if (!strcmp(fn, "bits")) { if (tn_isint(op1)) { ival = op1->ival ; flags |= TN_ISINT /* mq show the damn bits */ ; } else fval = op1->fval /* mq show the damn bits */ ; } else err = 1 ; } else { fval = (fh->funcd)(op1->fval) ; if ( fh->funflags & FUN_INTRESULT && fval <= NUM_MAX && fval >= NUM_MIN ) { flags |= TN_ISINT ; ival = (num) fval > 0 ? fval+0.5 : fval - 0.5 ; } } } else err = 1 ; } else if (n_args == 2) { tn* op1 = arg, *op2 = op1->next->next ; fun2Hook* fh = getfun2id(start) ; if (fh) { fn = fh->funname ; if (tn_isint(op1) && tn_isint(op2) && fh->funcl) { ival = (fh->funcl)(op1->ival, op2->ival) ; flags |= TN_ISINT ; } else fval = (fh->funcd)(op1->fval, op2->fval) ; } else err = 1 ; } else err = 1 ; if (err) { mcxErr ( me , "<%s> [%d] not supported" , start->token->str , n_args ) ; return NULL ; } else { if (!(new = tnNewToken(fn, TOKEN_CONST, fval, ival))) return NULL ; new->flags = flags ; } return new ; } tn* match ( tn* start ) { int depth = 1 ; if (start->toktype != TOKEN_OPEN) { mcxErr("match", "node <%p> has wrong toktype", (void*) start) ; return NULL ; } while (start->next) { start = start->next ; if (start->toktype == TOKEN_OPEN) depth++ ; else if (start->toktype == TOKEN_CLOSE) { depth-- ; if (!depth) break ; } } return depth ? NULL : start ; } /* * must leave received start and corresponding end alone */ mcxstatus compute ( tn* start ) { tn* ptr, *new, *end ; const char* me = "compute" ; if (start->toktype != TOKEN_OPEN) { mcxErr(me, "node <%p> has wrong toktype", (void*) start) ; return(STATUS_FAIL) ; } if (!(end = match(start))) { mcxErr(me, "node <%p> has no match", (void*) start) ; return(STATUS_FAIL) ; } ptr = start->next ; while (ptr) /* ok by the naming police? */ { tn* eosc, *val ; if (ptr->toktype == TOKEN_FUN) { if (compute(ptr->next)) return STATUS_FAIL /* now:: LPT op CM [op CM]* RPT */ ; eosc = match(ptr->next) ; if (!eosc || !(val = funcx(ptr, eosc))) return STATUS_FAIL /* now:: fun LPT val RPT */ ; tnLink3(ptr->prev, val, eosc->next) ; if (tnFree(ptr, eosc)) return STATUS_FAIL ; ptr = val->next ; } else if (ptr->toktype == TOKEN_OPEN) { if (compute(ptr)) return STATUS_FAIL ; if (!(eosc = match(ptr))) /* should check singularity */ return STATUS_FAIL ; if (!(val = tnDup(eosc->prev, "_scope_"))) return STATUS_FAIL ; tnLink3(ptr->prev, val, eosc->next) ; if (tnFree(ptr, eosc)) return STATUS_FAIL ; ptr = val->next ; } /* should check presence TRICATCH */ else if (ptr->toktype == TOKEN_TRIOP) { tn* br1 = ptr->next, *br2, *eobr1, *eobr2 /* branches */ ; if (!(eobr1 = match(br1))) return STATUS_FAIL ; if (!(br2 = eobr1->next->next)) return STATUS_FAIL ; eobr2 = match(br2) ; if (ptr->prev->fval) /* mqmq! logic by fval */ { if (compute(br1)) return STATUS_FAIL ; if (!(new = tnDup(br1->next, "triop1"))) return STATUS_FAIL ; tnLink3(ptr->prev->prev, new, eobr2->next) ; if (tnFree(ptr->prev, eobr2)) return STATUS_FAIL ; } else { if (compute(br2)) return STATUS_FAIL ; if (!(new = tnDup(br2->next, "triop2"))) return STATUS_FAIL ; tnLink3(ptr->prev->prev, new, eobr2->next) ; if (tnFree(ptr->prev, eobr2)) return STATUS_FAIL ; } ptr = new->next ; } else if (ptr->toktype == TOKEN_AND) /* now:: val AND LPT any RPT */ { tn* pivot = ptr->prev, *clause=ptr->next, *after ; if (pivot->fval) { if (compute(clause)) return STATUS_FAIL /* should check singularity of result */ /* lpt val rpt ? */ ; after = clause->next->next->next /* oops, ugly dugly */ ; pivot->fval = clause->next->fval /* mqmq! logic by fval */ ; if (tnFree(pivot->next, after->prev)) return STATUS_FAIL ; tnLink2(pivot, after) ; ptr = after ; } else { tn* eoclause = match(clause) ; tn* any = eoclause ? eoclause->next : NULL ; if (!eoclause || tnFree(pivot->next, eoclause)) return STATUS_FAIL ; tnLink2(pivot, any) ; ptr = any ; } pivot->ival = pivot->fval ? 1 : 0 ; pivot->flags |= TN_ISINT ; } else if (ptr->toktype == TOKEN_OR) { tn* pivot = ptr->prev, *clause=ptr->next, *after ; if (pivot->fval) { tn* eoclause = match(clause) ; tn* any = eoclause ? eoclause->next : NULL ; if (!eoclause || tnFree(pivot->next, eoclause)) return STATUS_FAIL ; tnLink2(pivot, any) ; ptr = any ; } else { if (compute(clause)) return STATUS_FAIL /* should check singularity of result */ ; after = clause->next->next->next /* oops, ugly dugly */ ; pivot->fval = clause->next->fval /* mqmq! logic by fval */ ; if (tnFree(pivot->next, after->prev)) return STATUS_FAIL ; tnLink2(pivot, after) ; ptr = after ; } pivot->ival = pivot->fval ? 1 : 0 ; pivot->flags |= TN_ISINT ; } else if (ptr->toktype == TOKEN_CLOSE) break ; else ptr = ptr->next ; } /* NOTE: by design we should always have ptr != NULL * that makes the clause to the while (ptr) { } loop * above a bit dodgy. */ if (ptr != end || ptr->toktype != TOKEN_CLOSE) { mcxErr(me, "ptr does not close") ; dump(ptr->prev, 0, NULL) ; return STATUS_FAIL ; } if (flatten(start, ptr)) return STATUS_FAIL ; return STATUS_OK ; } mcxstatus getatom ( telRaam* raam ) { i32 toktype = gettoken(raam, EXPECT_ATOM) ; const char* me = "getatom" ; if (toktype < 0) { mcxErr(me, "unexpected token <%s>", raam->token->str) ; return STATUS_FAIL ; } ; if (toktype == TOKEN_UNIOP) { if (tnPushToken(raam)) return STATUS_FAIL ; if (getatom(raam)) return STATUS_FAIL ; } else if (toktype == TOKEN_OPEN) { if (getexpression(raam)) return STATUS_FAIL ; if ((toktype = gettoken(raam, EXPECT_ANY)) != TOKEN_CLOSE) { mcxErr(me, "no close (token <%ld>)", (long) toktype) ; return STATUS_FAIL ; } if (raam->depth < 0) { mcxErr(me, "spurious rpth (atom I)") ; return STATUS_FAIL ; } } else if (toktype == TOKEN_FUN) { if (tnPushToken(raam)) return STATUS_FAIL ; if (tnPushThis(raam, "_open_", TOKEN_OPEN)) return STATUS_FAIL ; if ((toktype = gettoken(raam, EXPECT_ANY)) != TOKEN_OPEN) { mcxErr(me, "expect '(' after function symbol") ; return STATUS_FAIL ; } while(1) { if (getexpression(raam)) return STATUS_FAIL ; if (gettoken(raam, EXPECT_ANY) == TOKEN_COMMA) { if (tnPushToken(raam)) return STATUS_FAIL ; } else { untoken(raam) ; break ; } } if ((toktype = gettoken(raam, EXPECT_ANY)) != TOKEN_CLOSE) { mcxErr(me, "expect ')' closing function symbol") ; return STATUS_FAIL ; } if (tnPushThis(raam, "_close_", TOKEN_CLOSE)) return STATUS_FAIL ; } else if (toktype == TOKEN_CONST) { if (tnPushToken(raam)) return STATUS_FAIL ; } else if (toktype == TOKEN_CLOSE) { mcxErr(me, "empty group not allowed") ; return STATUS_FAIL ; } else if (toktype == TOKEN_USER) { if (tnPushToken(raam)) return STATUS_FAIL ; } else { mcxErr(me, "unexpected token <%s> (atom)", raam->token->str) ; return STATUS_FAIL ; } return STATUS_OK ; } mcxstatus getexpression ( telRaam* raam ) { i32 toktype ; const char* me = "getexpression" ; raam->depth++ ; if (tnPushThis(raam, "_open_", TOKEN_OPEN)) return STATUS_FAIL ; while (1) { if (getatom(raam)) return STATUS_FAIL ; toktype = gettoken(raam, EXPECT_ANY) ; if (toktype == TOKEN_BINOP) { if (tnPushToken(raam)) return STATUS_FAIL ; } else if (toktype == TOKEN_AND) { if (tnPushThis(raam, "_close_", TOKEN_CLOSE)) return STATUS_FAIL ; if (tnPushToken(raam)) return STATUS_FAIL ; if (tnPushThis(raam, "_open_", TOKEN_OPEN)) return STATUS_FAIL ; } else if (toktype == TOKEN_OR) { if (tnPushThis(raam, "_close_", TOKEN_CLOSE)) return STATUS_FAIL ; if (tnPushToken(raam)) return STATUS_FAIL ; if (tnPushThis(raam, "_open_", TOKEN_OPEN)) return STATUS_FAIL ; } else if (toktype == TOKEN_TRIOP) { if (tnPushThis(raam, "_close_", TOKEN_CLOSE)) return STATUS_FAIL ; if (tnPushToken(raam)) return STATUS_FAIL ; if (tnPushThis(raam, "_open_", TOKEN_OPEN)) return STATUS_FAIL ; if (getexpression(raam)) return STATUS_FAIL ; if (tnPushThis(raam, "_close_", TOKEN_CLOSE)) return STATUS_FAIL ; toktype = gettoken(raam, EXPECT_ANY) ; if (toktype != TOKEN_TRICATCH) { mcxErr ( me , "unexpected token <%s> (expression)" , raam->token->str ) ; return STATUS_FAIL ; } if (tnPushToken(raam)) return STATUS_FAIL ; if (tnPushThis(raam, "_open_", TOKEN_OPEN)) return STATUS_FAIL ; } else if ( toktype == TOKEN_COMMA || toktype == TOKEN_CLOSE || toktype == TOKEN_EXH || toktype == TOKEN_TRICATCH ) { untoken(raam) ; break ; } else { mcxErr ( me , "unexpected token <%s> <%ld> (expression)" , raam->token->str , (long) toktype ) ; return STATUS_FAIL ; } } if (tnPushThis(raam, "_close_", TOKEN_CLOSE)) return STATUS_FAIL ; raam->depth-- ; return STATUS_OK ; } mcxstatus trmParse ( telRaam* raam ) { if (tnPushThis(raam, "_open_", TOKEN_OPEN)) return STATUS_FAIL ; if (getexpression(raam)) return STATUS_FAIL ; if (tnPushThis(raam, "_close_", TOKEN_CLOSE)) return STATUS_FAIL ; if (gettoken(raam, EXPECT_ANY) != TOKEN_EXH) { mcxErr("trmParse", "spurious token <%s>", raam->token->str) ; return STATUS_FAIL ; } return STATUS_OK ; } void trmRegister ( telRaam* raam cpl__unused , int (user_parse)(mcxTing* txt, int offset) , mcxenum (user_eval)(const char* token, long *ival, double *fval) , char user_char ) { user_parse_g = user_parse ; user_eval_g = user_eval ; user_char_g = user_char ; } int trmEval ( telRaam* raam , long* lp , double* fp ) { tn* result ; mcxstatus stat = compute(raam->start->next) ; result = stat ? NULL : (raam->start->next->next) ; if (result) { *lp = result->ival ; *fp = result->fval ; return result->flags ; } return -1 ; } apparix-11-062/util/let.h000066400000000000000000000024041326043744200151650ustar00rootroot00000000000000/* (C) Copyright 2001, 2002, 2003, 2004, 2005 Stijn van Dongen * (C) Copyright 2006, 2007, 2008, 2009 Stijn van Dongen * * This file is part of tingea. You can redistribute and/or modify tingea * under the terms of the GNU General Public License; either version 3 of the * License or (at your option) any later version. You should have received a * copy of the GPL along with tingea, in the file COPYING. */ #ifndef tingea_let #define tingea_let #include "types.h" #include "ting.h" #define TRM_FAIL 0 #define TRM_ISNUM 1 #define TRM_ISREAL 2 #define TRM_ISINF 3 #define TRM_ISNAN 4 typedef struct telRaam telRaam; telRaam* trmInit ( const char* str ) ; mcxstatus trmExit ( telRaam* raam ) ; mcxstatus trmParse ( telRaam* raam ) ; int trmEval ( telRaam* raam , long* lp , double* fp ) ; void trmRegister ( telRaam* raam , int (user_parse)(mcxTing* txt, int offset) , mcxenum (user_eval)(const char* token, long *ival, double *fval) , char user_char ) ; mcxbool trmError ( int flags ) ; mcxbool trmIsReal ( int flags ) ; mcxbool trmIsNum ( int flags ) ; mcxbool trmIsNan ( int flags ) ; mcxbool trmIsInf ( int flags ) ; void trmDump ( telRaam* raam , const char* msg ) ; void trmDebug ( void ) ; #endif apparix-11-062/util/list.c000066400000000000000000000110651326043744200153520ustar00rootroot00000000000000/* (C) Copyright 2004, 2005, 2006, 2007, 2008, 2009 Stijn van Dongen * * This file is part of tingea. You can redistribute and/or modify tingea * under the terms of the GNU General Public License; either version 3 of the * License or (at your option) any later version. You should have received a * copy of the GPL along with tingea, in the file COPYING. */ #include "list.h" #include "alloc.h" #include "gralloc.h" #include "compile.h" #define DEBUG 0 /* TODO. very funny interface. in flux. * * ! allow null argument for linkdelete. * * ! * little support for corruption checking. * is the spawn thing a good idea ? * ! * interface with list object, or not? * not requires hidden list pointer everywhere (have that now). * perhaps supply separate interface with list handle .. ?] * ! * how to unify FLink, BLink, and link (forward/backward/bidi) * optify hidden list pointer, next xor prev pointer. * * - Add triple sanity checks for user supplied data (?) * - implement val freeing. * - with deleting, should warn if no handle remains .. * and can check grim count. */ /* Note. * We very much do not want to define (as previously thought) next and prev * as const pointers (with the goal of keeping chain consistency up * to this interface). * This interface provides some convenience interfaces, but * the integrity and life-cycle of the chains built with the links * is entirely up to the caller. So tie-rap away with them links. * * So we do not keep track of list characteristics, * e.g. first, last, count. That would be something for a higher layer. */ typedef struct { mcxGrim* grim ; } mcx_list ; typedef struct lsptr { mcx_list* ls ; } lsptr ; #define mcx_list_find(lk) ((lsptr*)((void*)((char*) lk - sizeof(lsptr))))->ls void mcx_link_init ( mcxLink* lk , void* val ) { lk->next = NULL ; lk->prev = NULL ; lk->val = val ; } mcxLink* mcx_list_shift ( mcx_list* ls , void* val ) { void* mem ; mcxLink* lk ; if (!(mem = mcxGrimGet(ls->grim))) return NULL ; lk = (void*) ((char*) mem + sizeof(lsptr)) ; ((lsptr*) mem)->ls = ls ; mcx_link_init(lk, val) ; return lk ; } mcxLink* mcxListSource ( dim capacity_start , mcxbits options ) { mcx_list* ls ; if (!(ls = mcxAlloc(sizeof(mcx_list), RETURN_ON_FAIL))) return NULL #if DEBUG ; fprintf (stderr, "new list ptr <%p> capacity <%ld>\n", (void*) ls, (long) capacity_start) #endif ; if (! (ls->grim = mcxGrimNew(sizeof(lsptr) + sizeof(mcxLink), capacity_start, options) ) ) return NULL ; return mcx_list_shift(ls, NULL) ; } mcxLink* mcxLinkSpawn ( mcxLink* lk , void* val ) { mcx_list* ls = mcx_list_find(lk) ; return mcx_list_shift(ls, val) ; } void mcxLinkClose ( mcxLink* left , mcxLink* right ) { if (left) left->next = right ; if (right) right->prev = left ; } mcxLink* mcxLinkBefore ( mcxLink* next , void* val ) { mcx_list* ls = mcx_list_find(next) ; mcxLink* new = mcx_list_shift(ls, val) ; if (!new) return NULL ; new->next = next ; new->prev = next->prev ; next->prev = new ; if (new->prev) new->prev->next = new ; return new ; } mcxLink* mcxLinkAfter ( mcxLink* prev , void* val ) { mcx_list* ls = mcx_list_find(prev) ; mcxLink* new #if DEBUG ; fprintf(stderr, "list ptr <%p>\n", (void*) ls) #endif ; new = mcx_list_shift(ls, val) ; if (!new) return NULL ; new->prev = prev ; new->next = prev->next ; prev->next = new ; if (new->next) new->next->prev = new ; return new ; } void mcxLinkRemove ( mcxLink* lk ) { mcx_list* ls = mcx_list_find(lk) ; mcxGrimLet(ls->grim, ((char*) lk) - sizeof(lsptr)) ; } mcxLink* mcxLinkDelete ( mcxLink* lk ) { mcx_list* ls = mcx_list_find(lk) ; mcxLink* prev = lk->prev ; mcxLink* next = lk->next ; if (prev) prev->next = next ; if (next) next->prev = prev ; mcxGrimLet(ls->grim, ((char*) lk) - sizeof(lsptr)) ; return lk ; } mcxGrim* mcxLinkGrim ( mcxLink* lk ) { mcx_list* ls = mcx_list_find(lk) ; return ls->grim ; } void mcxListFree ( mcxLink** lkp , void freeval(void* valpp) cpl__unused /* (yourtype1** valpp) */ ) { if (*lkp) { mcx_list* ls = mcx_list_find(*lkp) ; mcxGrimFree(&(ls->grim)) ; mcxFree(ls) ; *lkp = NULL ; } ; } #undef DEBUG apparix-11-062/util/list.h000066400000000000000000000064101326043744200153550ustar00rootroot00000000000000/* (C) Copyright 2004, 2005, 2006, 2007, 2008, 2009 Stijn van Dongen * * This file is part of tingea. You can redistribute and/or modify tingea * under the terms of the GNU General Public License; either version 3 of the * License or (at your option) any later version. You should have received a * copy of the GPL along with tingea, in the file COPYING. */ #ifndef tingea_list_h #define tingea_list_h #include "gralloc.h" #include "types.h" /* TODO: * - linkDelete linkRemove semantics interface documentation. * - make prev xor next link optional. * - make hidden pointer optional. * - provide interface that uses list struct. * - convenience interface for tying two chains together. * - list-to-array interface. */ /* * History. * The data structure used is similar to that by Jan van der Steen's pool.c * code, which used to be part of this library. So kudos to Jan. The * present implementation, which is a bit different, was not directly copied * nor modified. It descended from a botched linked list implementation * having it's own buffered storage. Only at that time I realized that the * right solution for lists and hashes is to have a private pool of gridmem, * rather than deriving it from a global pool (so that we still can defer * thread-safety to malloc). Right? * The present implementation was then derived from the botched linked list * and sanitized afterwards. The linked list.c is still slightly botched. */ /* Description * This provides a doubly linked list/link interface with buffered storage * (invisible to the user). The current interface operates entirely via * links, the commanding structure is hidden. Other interface types may * arise later. * * You can create a number of chains drawing memory from the same pool. * * It only provides basic link insertions and deletions as a convenience * interface, and does not maintain consistency checks, neither on links, * nor on storage. */ typedef struct mcxLink { struct mcxLink* next ; struct mcxLink* prev ; void* val ; } mcxLink ; /* Options: * same as for mcxGrimNew */ mcxLink* mcxListSource ( dim capacity_start , mcxbits options ) ; /* * This removes all links that have the same parent link as lk. [huh?] * BEWARE freeval doesn't do anything yet */ void mcxListFree ( mcxLink** lk , void freeval(void* valpp) /* (yourtype1** valpp) */ ) ; /* Creates new chain, that can later be tied to other chains. */ mcxLink* mcxLinkSpawn ( mcxLink* lk , void* val ) ; /* * This inspects prev and next and links them if possible. * * You can use the val pointer, immediately after deleting. * That makes it unsafe in threads (but you need locking anyway). * The feature is used in the hash library. */ mcxLink* mcxLinkDelete ( mcxLink* lk ) ; /* * This just deallocates the link. */ void mcxLinkRemove ( mcxLink* lk ) ; mcxLink* mcxLinkAfter ( mcxLink* prev , void* val ) ; mcxLink* mcxLinkBefore ( mcxLink* prev , void* val ) ; void mcxLinkClose ( mcxLink* left , mcxLink* right ) ; /* * Get the grim that serves this list */ mcxGrim* mcxLinkGrim ( mcxLink* lk ) ; #endif apparix-11-062/util/minmax.h000066400000000000000000000043351326043744200156770ustar00rootroot00000000000000/* (C) Copyright 1999, 2000, 2001, 2002, 2003, 2004, 2005 Stijn van Dongen * (C) Copyright 2006, 2007, 2008, 2009 Stijn van Dongen * * This file is part of tingea. You can redistribute and/or modify tingea * under the terms of the GNU General Public License; either version 3 of the * License or (at your option) any later version. You should have received a * copy of the GPL along with tingea, in the file COPYING. */ #ifndef minmax_h #define minmax_h #include "compile.h" #if MCX_GNUC_OK && TINGEA__TYPED_MINMAX /* these buggers do not nest, which I dislike */ # define MCX_MAX(x,y) \ ( { const typeof(x) _x = x; \ const typeof(y) _y = y; \ (void) (&_x == &_y); \ _x > _y ? _x : _y; \ } ) # define MCX_MIN(x,y) \ ( { const typeof(x) _x = x; \ const typeof(y) _y = y; \ (void) (&_x == &_y); \ _x < _y ? _x : _y; \ } ) #else /* The usual brain-damaged min and max, which do nest though. */ # define MCX_MAX(a,b) ((a)>(b) ? (a) : (b)) # define MCX_MIN(a,b) ((a)<(b) ? (a) : (b)) #endif #define ABS(x) ((x) > 0 ? (x) : (x) < 0 ? (-(x)) : 0) /* The first version cannot be used recursively. * I don't like this at all I think, which is why I turned it off. */ #if 0 && MCX_GNUC_OK # define MCX_SIGN(a) \ __extension__ \ ( { typedef _ta = (a) \ ; _ta _a = (a) \ ; _a > 0 \ ? 1 \ : _a < 0 \ ? -1 \ : 0 \ ; } \ ) #else # define MCX_SIGN(a) \ ((a) > 0 ? 1 : !(a) ? 0 : -1) #endif #define MCX_RESTRICT(x,a,b) \ do { if (x < a) x = a; else if (x > b) x = b; } while (0) #endif apparix-11-062/util/opt.c000066400000000000000000000532551326043744200152100ustar00rootroot00000000000000/* (C) Copyright 2002, 2003, 2004, 2005, 2006 Stijn van Dongen * (C) Copyright 2007, 2008, 2009, 2010 Stijn van Dongen * * This file is part of tingea. You can redistribute and/or modify tingea * under the terms of the GNU General Public License; either version 3 of the * License or (at your option) any later version. You should have received a * copy of the GPL along with tingea, in the file COPYING. */ /* TODO * does display skip account for hidden options? */ #include #include #include #include #include "opt.h" #include "alloc.h" #include "types.h" #include "ding.h" #include "err.h" #include "equate.h" #include "minmax.h" #include "compile.h" static int strcmp_void ( const void* s1 , const void* s2 ) { return strcmp(s1, s2) ; } mcxHash* mcxOptHash ( mcxOptAnchor* opts , mcxHash* hash ) { mcxOptAnchor* anch = opts ? opts+0 : NULL ; hash = hash ? hash : mcxHashNew ( 100 , mcxStrHash , strcmp_void ) ; if (!hash) return NULL ; while (anch && anch->tag) { mcxKV* kv = mcxHashSearch(anch->tag, hash, MCX_DATUM_INSERT) ; if (!kv) { mcxHashFree(&hash, NULL, NULL) ; return NULL ; } if (kv->val) mcxErr ( "mcxOptHash" , "warning: option <%s> already present" , anch->tag ) ; kv->val = anch ; anch++ ; } return hash ; } void mcxOptHashFree ( mcxHash** hashpp ) { mcxHashFree(hashpp, NULL, NULL) ; } void* mcxOptInit ( void* opt ) { mcxOption* option = opt ; option->anch = NULL ; option->val = NULL ; return option ; } mcxOptAnchor* mcxOptFind ( char* tag , mcxHash* hopts ) { mcxKV* kv = mcxHashSearch(tag, hopts, MCX_DATUM_FIND) ; return kv ? (mcxOptAnchor*) kv->val : NULL ; } mcxOption* mcxOptParse__ ( mcxHash* opthash , char** argv , int argc , int prefix /* skip these */ , int suffix /* skip those too */ , int* n_elems_read , mcxstatus* status ) { char** argp = argv+prefix ; char** argl = argv+argc-suffix /* arg last */ ; mcxbool do_exhaust = n_elems_read ? TRUE : FALSE /* fixme: very ugly internal iface*/ ; mcxOption* opts = mcxNAlloc (argc+1, sizeof(mcxOption), mcxOptInit, RETURN_ON_FAIL) ; mcxOption* opt = opts ; if (!opts) { *status = MCX_OPT_STATUS_NOMEM ; return NULL ; } *status = MCX_OPT_STATUS_OK ; if (do_exhaust) *n_elems_read = 0 ; while (argp < argl) { char* arg = *argp ; const char* embedded_val = NULL ; mcxKV* kv = mcxHashSearch(arg, opthash, MCX_DATUM_FIND) ; mcxOptAnchor* anch = kv ? (mcxOptAnchor*) kv->val : NULL ; const char* eq = strchr(arg, '=') ; if (!kv && eq) { char argcpy[501] ; if (eq - arg < 500) { strncpy(argcpy, arg, (eq-arg)) ; argcpy[eq-arg] = '\0' ; if ( !strncmp(argcpy, "--", 2) && (kv = mcxHashSearch(argcpy+1, opthash, MCX_DATUM_FIND)) && (anch = (mcxOptAnchor*) kv->val) ) embedded_val = eq+1 ; else kv = NULL ; } else { /* fimxe do sth */ } } ; if (kv) { opt->anch = anch ; if (do_exhaust) (*n_elems_read)++ ; if (embedded_val) opt->val = embedded_val ; else if (anch->flags & MCX_OPT_HASARG) { argp++ ; if (argp >= argl) { mcxErr("mcxOptParse", "option <%s> takes value", anch->tag) ; *status = MCX_OPT_STATUS_NOARG ; break ; } opt->val = *argp /* mq note: shallow copy */ ; if (do_exhaust) (*n_elems_read)++ ; } } else { if (do_exhaust) break ; else { mcxErr("mcxOptParse", "unsupported option <%s>", arg) ; *status = MCX_OPT_STATUS_UNKNOWN ; break ; } } argp++ ; opt++ ; } if (*status) mcxOptFree(&opts) ; return opts ; } mcxOption* mcxOptExhaust ( mcxOptAnchor *anch , char **argv , int argc , int prefix /* skip these */ , int *n_elems_read , mcxstatus *status ) { mcxHash* opthash = mcxOptHash(anch, NULL) ; mcxOption* opts = mcxOptParse__ (opthash, argv, argc, prefix, 0, n_elems_read, status) ; mcxOptHashFree(&opthash) ; return opts ; } mcxOption* mcxOptParse ( mcxOptAnchor *anch , char **argv , int argc , int prefix /* skip these */ , int suffix /* skip those too */ , mcxstatus *status ) { mcxHash* opthash = mcxOptHash(anch, NULL) ; mcxOption* opts = mcxOptParse__(opthash, argv, argc, prefix, suffix, NULL, status) ; mcxOptHashFree(&opthash) ; return opts ; } mcxOption* mcxHOptExhaust ( mcxHash *opthash , char **argv , int argc , int prefix /* skip these */ , int *n_elems_read , mcxstatus *status ) { return mcxOptParse__ (opthash, argv, argc, prefix, 0, n_elems_read, status) ; } mcxOption* mcxHOptParse ( mcxHash *opthash , char **argv , int argc , int prefix /* skip these */ , int suffix /* skip those too */ , mcxstatus *status ) { return mcxOptParse__(opthash, argv, argc, prefix, suffix, NULL, status) ; } void mcxOptFree ( mcxOption** optpp ) { if (*optpp) mcxFree(*optpp) ; *optpp = NULL ; } void mcxUsage ( FILE* fp , const char* caller , const char** lines ) { int i = 0 ; while(lines[i]) { fprintf(fp, "%s\n", lines[i]) ; i++ ; } fprintf(fp, "[%s] Printed %d lines\n", caller, i+1) ; } static int (*rltFunctions[8])(const void* f1, const void* f2) = { intGt , intGq , fltGt, fltGq , intLt , intLq , fltLt, fltLq } ; int mcxOptPrintDigits = 5; const char* rltSigns[8] = { "(", "[", "(", "[" , ")", "]", ")", "]" } ; /* * todo: NULL lftbound argument & non-NULL lftRelate argument * idem for rgt */ static int checkBoundsUsage ( unsigned char type , void* var cpl__unused , int (*lftRlt) (const void*, const void*) , void* lftBound , int (*rgtRlt) (const void*, const void*) , void* rgtBound ) { int i ; const char* me = "checkBoundsUsage PBD" ; if (type != 'f' && type != 'i') { mcxErr(me, "unsupported checkbound type <%c>", type) ; return 1 ; } if ((lftRlt && !lftBound)||(!lftRlt && lftBound)) { mcxErr(me, "abusive lftRlt lftBound combination") ; return 1 ; } if ((rgtRlt && !rgtBound)||(!rgtRlt && rgtBound)) { mcxErr(me, "abusive rgtRlt rgtBound combination") ; return 1 ; } if (lftRlt) { for(i=0;i<4;i++) if (lftRlt == rltFunctions[i]) break ; if (i == 4) { mcxErr(me, "lftRlt should use gt or gq arg") ; return 1 ; } ; } if (rgtRlt) { for(i=4;i<8;i++) if (rgtRlt == rltFunctions[i]) break ; if (i==8) { mcxErr(me, "rgtRlt should use lt or lq arg") ; return 1 ; } ; } return 0 ; } /* returns * STATUS_OK for matching bounds * STATUS_FAIL for non-matching bounds * STATUS_CB_PBD for internal error. */ enum { STATUS_CB_PBD = STATUS_UNUSED + 1 } ; static mcxstatus checkBounds ( unsigned char type , void* var , int (*lftRlt) (const void*, const void*) , void* lftBound , int (*rgtRlt) (const void*, const void*) , void* rgtBound ) { int lftOk, rgtOk ; if (checkBoundsUsage(type, var, lftRlt, lftBound, rgtRlt, rgtBound)) { mcxErr("checkBounds PBD", "internal error -- cannot validate") ; return STATUS_CB_PBD ; } lftOk = !lftRlt || lftRlt(var, lftBound) ; rgtOk = !rgtRlt || rgtRlt(var, rgtBound) ; return (lftOk && rgtOk) ? STATUS_OK : STATUS_FAIL ; } static mcxTing* checkBoundsRange ( unsigned char type , void* var cpl__unused , int (*lftRlt) (const void*, const void*) , void* lftBound , int (*rgtRlt) (const void*, const void*) , void* rgtBound ) { mcxTing* textRange = mcxTingEmpty(NULL, 40) ; char* lftToken = (char *) "" ; int i ; if (!textRange) return NULL ; if (lftRlt) { for(i=0;i<4;i++) if (lftRlt == rltFunctions[i]) break ; if (i<4) lftToken = (char *) rltSigns[i] ; } else lftToken = (char *) "(" ; mcxTingPrint(textRange, "%s", lftToken) /* * This might fail due to mem shortage; * we ignore and simply keep plodding on with more mcxTingPrint-s * below. It's actually pretty inconceivable, since we alloced * 40 bytes - it depends on mcxOptPrintDigits. */ ; if (lftBound) { if (type == 'f') mcxTingPrintAfter (textRange, "%.*f", mcxOptPrintDigits, *((float*)lftBound)) ; else if (type == 'i') mcxTingPrintAfter(textRange, "%d", *((int*)lftBound)) ; } else mcxTingPrintAfter(textRange, "%s", "<-") ; mcxTingPrintAfter(textRange, "%s", ",") ; if (rgtBound) { if (type == 'f') mcxTingPrintAfter (textRange, "%.*f", mcxOptPrintDigits, *((float*)rgtBound)) ; else if (type == 'i') mcxTingPrintAfter(textRange, "%d", *((int*)rgtBound)) ; } else mcxTingPrintAfter(textRange, "%s", "->") ; if (rgtRlt) { for(i=4;i<8;i++) if (rgtRlt == rltFunctions[i]) break ; if (i<8) rgtToken = (char *) rltSigns[i] ; } else rgtToken = (char *) ")" ; mcxTingPrintAfter(textRange, "%s", rgtToken) ; return textRange ; } mcxbool mcxOptCheckBounds ( const char* caller , const char* flag , unsigned char type , void* var , int (*lftRlt) (const void*, const void*) , void* lftBound , int (*rgtRlt) (const void*, const void*) , void* rgtBound ) { mcxTing* textRange ; mcxstatus stat = checkBounds(type, var, lftRlt, lftBound, rgtRlt, rgtBound) ; if (stat == STATUS_CB_PBD) { mcxErr("mcxOptCheckBounds", "cannot validate option %s", flag) ; return FALSE ; } else if (stat == STATUS_FAIL) { if (! ( textRange = checkBoundsRange ( type , var , lftRlt , lftBound , rgtRlt , rgtBound ) ) ) return FALSE ; mcxErr ( caller , "%s argument to %s should be in range %s" , type == 'i' ? "integer" : type == 'f' ? "float" : "MICANS" , flag , textRange->str ) ; mcxTingFree(&textRange) ; return FALSE ; } return TRUE ; } int mcxOptAnchorCmpId ( const void *a1 , const void *a2 ) { const mcxOptAnchor* A1 = a1 ; const mcxOptAnchor* A2 = a2 ; return A1->id < A2->id ? -1 : A1->id - A2->id ; } int mcxOptAnchorCmpTag ( const void *a1 , const void *a2 ) { const mcxOptAnchor* A1 = a1 ; const mcxOptAnchor* A2 = a2 ; return A1->tag && A2->tag ? strcmp(A1->tag, A2->tag) : A1->tag ? -1 : 1 ; } void mcxOptAnchorSortByTag ( mcxOptAnchor *anchors , dim n_anchors ) { if (n_anchors) qsort(anchors, n_anchors, sizeof(mcxOptAnchor), mcxOptAnchorCmpTag) ; } void mcxOptAnchorSortById ( mcxOptAnchor *anchors , dim n_anchors ) { if (n_anchors) qsort(anchors, n_anchors, sizeof(mcxOptAnchor), mcxOptAnchorCmpId) ; } void parse_descr ( const char* field , const char** descrp , const char** markp , int* mark_width ) { const char* m = strstr(field, "\tM") ; const char* n = m ? strstr(m+2, "\t") : NULL ; const char* d = strstr(field, "\tD") ; if (m && n) *mark_width = n - m - 2 /* truncintok */ , *markp = m + 2 ; else *markp = "" , *mark_width = 0 ; *descrp = d ? d + 2 : field ; } void mcxOptApropos ( FILE* fp , const char* me cpl__unused , const char* syntax , int width , mcxbits display , const mcxOptAnchor opt[] ) { const mcxOptAnchor *baseopt = opt ; mcxTing* scr = mcxTingEmpty(NULL, 100) ; int id_prev = -1 ; const char* descr_usage, *descr_mark ; int mark_width = 0, mark_width_max = 0 ; int mywidth = 0 ; if (syntax) fprintf(fp, "%s\n\n", syntax) ; for (opt = baseopt; opt->tag; opt++) { int thislen = strlen(opt->tag) /* truncintok */ ; if (opt->descr_arg) thislen += 1 + strlen(opt->descr_arg) /* truncintok */ ; if ( !(opt->flags & MCX_OPT_HIDDEN) || display & MCX_OPT_DISPLAY_HIDDEN ) mywidth = MCX_MAX(mywidth, thislen) ; if (opt->descr_usage) { parse_descr (opt->descr_usage, &descr_usage, &descr_mark, &mark_width) ; mark_width_max = MCX_MAX(mark_width_max, mark_width) ; } } if (!width) width = mywidth ; for (opt = baseopt; opt->tag; opt++) { const char* skip = "" ; if ( opt->flags & MCX_OPT_HIDDEN && !(display & MCX_OPT_DISPLAY_HIDDEN) ) { id_prev = opt->id ; continue ; } if (display & MCX_OPT_DISPLAY_SKIP && opt->id - id_prev > 1) skip = "\n" ; id_prev = opt->id ; if (opt->flags & MCX_OPT_HASARG && opt->descr_arg) mcxTingPrint ( scr , "%s%c%s" , opt->tag , ' ' , opt->descr_arg ) ; else mcxTingPrint(scr, "%s", opt->tag) ; fputs(skip, fp) ; if (!opt->descr_usage) { fprintf(fp, "%s\n", scr->str) ; continue ; } if (mark_width_max) { parse_descr (opt->descr_usage, &descr_usage, &descr_mark, &mark_width) ; fprintf(fp, "%-*s", width, scr->str) ; fprintf(fp, " %-*.*s ",(int) mark_width_max,mark_width, descr_mark) ; fprintf(fp, "%s\n", descr_usage) ; } else { fprintf(fp, "%-*s", width, scr->str) ; fprintf(fp, " %s\n", opt->descr_usage) ; } } } char** mcxOptParseString ( char* src , int* argc , unsigned char delim ) { dim srclen = strlen(src) ; dim n_delim = mcxStrCountChar(src, delim, srclen) ; dim n_args = 0 ; char** argv ; char *z = src + srclen ; char *p = src, *os ; *argc = 0 ; if (!srclen) return NULL ; if (!(argv = mcxAlloc(sizeof(char*) * (n_delim+1), RETURN_ON_FAIL))) return NULL ; while (p=z) break ; os = p ; if (!(p = strchr(os, delim))) p = z ; *p = '\0' ; argv[n_args++] = os ; p++ ; } *argc = n_args ; return argv ; } mcxbool mcxOptIsInfo ( const char* arg , mcxOptAnchor* options ) { mcxOptAnchor* opt ; for (opt = options; opt->tag; opt++) if (!strcmp(opt->tag, arg)) break ; return (opt->tag && opt->flags & MCX_OPT_INFO) ? TRUE : FALSE ; } mcxTing* mcxOptArgLine ( const char** argv , int argc , int quote ) { mcxTing* cl = mcxTingEmpty(NULL, 80) ; int i ; const char* ql = "*", *qr = "*" ; if (quote == '[') ql = "[", qr = "]" ; else if (quote == '{') ql = "{", qr = "}" ; else if (quote == '<') ql = "<", qr = ">" ; else if (quote == '(') ql = "(", qr = ")" ; else if (quote == '"') ql = "\"", qr = "\"" ; else if (quote == '\'') ql = "'", qr = "'" ; if (argc) mcxTingPrint(cl, "%s%s%s", ql, argv[0], qr) ; for (i=1;idisp_argc ; const char** argv = bundle->disp_argv ; const char* me = bundle->disp_name ; const char* syntax = bundle->disp_syntax ; mcxOptAnchor* dispatcher_options = bundle->disp_shared ; dim n_options= bundle->n_disp_shared ; mcxDispEntry* entry_dir= bundle->disp_table ; void (*report_version)(const char* me) = bundle->disp_version ; const char* mode_str ; mcxDispHook* hk = NULL ; mcxOption* opts, *opt ; int n_arg_read = 0 ; mcxstatus parseStatus = STATUS_FAIL ; mcxHash *clmOpts, *delgOpts, *mergedOpts ; mcxDispEntry* entry ; int help = argc <= 1 || !strcmp(argv[1], "-h") ? 1 : 0 ; int delg_id_max ; int a ; mcxOptAnchorSortById(dispatcher_options, n_options) ; clmOpts = mcxOptHash(dispatcher_options, NULL) ; delg_id_max = dispatcher_options[n_options-1].id ; if (help) { entry = entry_dir+0 ; fprintf(stdout, "%s\n\n", syntax) ; while(entry->id >= 0) { hk = entry->get_hk() ; if (!(hk->flags & MCX_DISP_HIDDEN)) fprintf(stdout, "%s %s\n", me, hk->syntax) ; entry++ ; } fprintf ( stdout , "\n%s help (invoke manual page for )\n" "help pages are available for:" , me ) ; entry = entry_dir+0 ; while(entry->id >= 0) { hk = entry->get_hk() ; if (!(hk->flags & MCX_DISP_HIDDEN) && (hk->flags & MCX_DISP_MANUAL)) fprintf(stdout, " %s", hk->name) ; entry++ ; } fputc('\n', stdout) ; exit(0) ; } else if (argc > 1 && !strcmp(argv[1], "--version")) { report_version(me) ; exit(0) ; } else if (argc > 1 && !strcmp(argv[1], "help")) { mcxTing* minime = mcxTingNew(me) ; if (argc != 3) mcxDie ( 1 , me , "help mode requires single trailing mode argument, e.g. %s help %s" , me, (entry_dir+0)->get_hk()->name ) ; entry = entry_dir+0 /* todo unify all entry walking code */ ; while (entry->id >= 0) { hk = entry->get_hk() ; if (!strcmp(hk->name, argv[2])) { mcxTingPrintAfter(minime, "%s", hk->name) ; execlp("man", "man", minime->str, NULL) ; mcxErr(minime->str, "the 'man' program was not found") ; mcxDie(1, me, "make sure PATH is set correctly") ; } entry++ ; } if (entry->id < 0) mcxDie(1, me, "unknown mode <%s>", argv[2]) ; } /* todo emit warning to check for right version of manual page */ mode_str = argv[1] /* Find the mode in which we are invoked */ ; { const char* name ; entry = entry_dir+0 ; while (entry->id >= 0) { hk = entry->get_hk() ; name = hk->name ; if (!strcmp(name, mode_str)) break ; entry++ ; } if (entry->id < 0) mcxDie(1, me, "unknown mode <%s>", mode_str) ; } mcxOptAnchorSortById(hk->options, hk->n_options) /* caller screwed up: it's IDs should top the * largest ID in the shared options. */ ; if (hk->n_options && delg_id_max >= hk->options[0].id) mcxDie(1, me, "PBD option merge is pointless") ; delgOpts = mcxOptHash(hk->options, NULL) ; mergedOpts = mcxHashMerge(clmOpts, delgOpts, NULL, NULL) ; opts = mcxHOptExhaust (mergedOpts, (char**) argv, argc, 2, &n_arg_read, &parseStatus) ; a = 2 + n_arg_read /* fixme: we should be able to check n_at_most and n_at_least * right here, should we not? */ ; if (parseStatus != STATUS_OK) { mcxErr(me, "initialization failed") ; exit(1) ; } if (hk->init()) mcxDie(1, me, "initialization failed for <%s>", hk->name) ; for (opt=opts;opt->anch;opt++) { mcxOptAnchor* anch = opt->anch ; if (anch->id <= delg_id_max) { if (bundle->shared_handler(anch->id, opt->val, hk, bundle)) mcxDie(1, me, "dispatcher curtains") ; } else if (hk->arg_cb(anch->id, opt->val)) mcxDie(1, me, "dispatchee curtains") ; } /* do the checks below after parsing: * Parsing is needed to -h --help type flags * and other type of meta-enquiry options. */ if ( a + hk->n_at_least > argc || (hk->n_at_most >= 0 && a + hk->n_at_most < argc) ) { mcxTing* t = mcxTingPrint ( NULL , "mode %s needs %s %d trailing arguments" , mode_str , hk->n_at_least == hk->n_at_most ? "exactly" : "at least" , hk->n_at_least ) ; if (hk->n_at_most > hk->n_at_most) mcxTingPrintAfter(t, " and at most %d", hk->n_at_most) ; if (hk->n_at_most >= 0 && a + hk->n_at_most < argc) mcxTingPrintAfter(t, " (found %s)", argv[a]) ; mcxDie(1, me, "%s", t->str) ; } mcxOptFree(&opts) ; mcxOptHashFree(&clmOpts) ; mcxOptHashFree(&delgOpts) ; mcxOptHashFree(&mergedOpts) ; return hk->main(argc-a, argv+a) ; } apparix-11-062/util/opt.h000066400000000000000000000207351326043744200152120ustar00rootroot00000000000000/* (C) Copyright 2002, 2003, 2004, 2005, 2006 Stijn van Dongen * (C) Copyright 2007, 2008, 2009, 2010 Stijn van Dongen * * This file is part of tingea. You can redistribute and/or modify tingea * under the terms of the GNU General Public License; either version 3 of the * License or (at your option) any later version. You should have received a * copy of the GPL along with tingea, in the file COPYING. */ /* TODO * recode dispatch case 'no arguments supplied'. now ugly. */ #ifndef tingea_opt_h #define tingea_opt_h #include "types.h" #include "ting.h" #include "hash.h" /* ************************************************************************** * * ** Implementation notes (a few). * * This interface munges and parses text presented to it, and creates * arrays and optionally hashes from them. It does so by simply storing * pointers to the data presented to it, and does not copy anything at all. * * It is the callers job to make sure that the data scrutinized by this * interface stays constant during interface usage. * * Tentatively, this interface treats -I 3 and --I=3 as equivalent * syntax. It is possible to define -I and --I= as separate options. * (by defining -I with MCX_OPT_HASARG and --I with MCX_OPT_DEFAULT). * * TODO: * implement newline/indent magic in option descriptions. * * The prefix thing, is it necessary? caller could pass argv+prefix .. */ #define MCX_OPT_DEFAULT 0 /* -a, xyz */ #define MCX_OPT_HASARG 1 /* -a 10, xyz foo */ #define MCX_OPT_REQUIRED 2 #define MCX_OPT_INFO 4 #define MCX_OPT_HIDDEN 16 #define MCX_OPT_UNUSED 32 enum { MCX_OPT_STATUS_OK = 0 , MCX_OPT_STATUS_NOARG , MCX_OPT_STATUS_UNKNOWN , MCX_OPT_STATUS_NOMEM } ; /* struct mcxOptAnchor * * id * When using mcxOptApropos, if the option MCX_OPT_DISPLAY_SKIP is used, * an increment larger then one between successive ids (from the structs * in the array presented to mcxOptApropos) causes an additional newline * to be output before the option synopsis. * This enables the creation of paragraphs in a simple manner. * * descr_usage * By default, this just contains the description of what the option does * It is possible to specify a mark to be printed in front of that * description. This requires both the mark and the description * (which are joined in the same string) to be proceded by a special * sequence. For the mark this is "\tM" and for the description * this is "\tD". The description string should be last. A valid entry is * thus * "\tM!\tDset the resource scheme" * This will print the marker '!' inbetween the option tag and its * description. * * Presumably, the legend to such markers is explained by the caller. */ typedef struct mcxOptAnchor { char* tag /* '-foo' or '--expand-only' etc */ ; int flags /* MCX_OPT_HASARG etc */ ; int id /* ID */ ; char* descr_arg /* "" or "", NULL ok */ ; char* descr_usage /* NULL allowed */ ; } mcxOptAnchor ; void mcxOptAnchorSortByTag ( mcxOptAnchor *anchors , dim n_anchors ) ; void mcxOptAnchorSortById ( mcxOptAnchor *anchors , dim n_anchors ) ; /* * An array of these is returned by parse routines below. * An entry with .anch == NULL indicates end-of-array. */ typedef struct mcxOption { mcxOptAnchor* anch ; const char* val ; } mcxOption ; /* * these routines only use status MCX_OPT_NOARG. The interface * is not yet frozen. */ /* This tries to find as many arguments as it can, and reports the * number of array elements it skipped. */ mcxOption* mcxOptExhaust ( mcxOptAnchor* anch , char** argv , int argc , int prefix /* skip these */ , int* n_elems_read , mcxstatus* status ) ; /* This will never read past the last arguments (suffix of them). * It does currently not enforce that the number of arguments left * is exactly equal to suffix (fixme?). */ mcxOption* mcxOptParse ( mcxOptAnchor* anch , char** argv , int argc , int prefix /* skip these */ , int suffix /* skip those too */ , mcxstatus* status ) ; void mcxOptFree ( mcxOption** optpp ) ; mcxbool mcxOptIsInfo ( const char* arg , mcxOptAnchor* options ) ; #define MCX_OPT_DISPLAY_DEFAULT 0 #define MCX_OPT_DISPLAY_BREAK_HARD 1 << 4 /* break overly long lines */ #define MCX_OPT_DISPLAY_BREAK_SOFT 1 << 6 /* break overly long lines */ #define MCX_OPT_DISPLAY_CAPTION 1 << 10 /* break after option */ #define MCX_OPT_DISPLAY_PAR 1 << 12 /* ? useful ? paragraph mode */ #define MCX_OPT_DISPLAY_SKIP 1 << 14 /* display enum skips as pars */ #define MCX_OPT_DISPLAY_HIDDEN 1 << 16 /* do that */ void mcxOptApropos ( FILE* fp , const char* me /* unused currently */ , const char* syntax , int width , mcxbits display , const mcxOptAnchor opt[] ) ; /* The ones below are for spreading responsibility for parsing * argument over different modules. * See the mcl implementation for an example. */ mcxOption* mcxHOptExhaust ( mcxHash* opthash , char** argv , int argc , int prefix /* skip these */ , int* n_elems_read , mcxstatus* status ) ; mcxOption* mcxHOptParse ( mcxHash* opthash , char** argv , int argc , int prefix /* skip these */ , int suffix /* skip those too */ , mcxstatus* status ) ; /* * Creates a hash where the tag string is key, and the mcxOptAnchor is value. */ mcxHash* mcxOptHash ( mcxOptAnchor* opts , mcxHash* hash ) ; void mcxOptHashFree ( mcxHash** hashpp ) ; mcxOptAnchor* mcxOptFind ( char* tag , mcxHash* hopts ) ; void mcxUsage ( FILE* fp , const char* caller , const char** lines ) ; extern int mcxOptPrintDigits; mcxbool mcxOptCheckBounds ( const char* caller , const char* flag , unsigned char type , void* var , int (*lftRlt) (const void*, const void*) , void* lftBound , int (*rgtRlt) (const void*, const void*) , void* rgtBound ) ; /* TODO * provide escape mechanisms for delim; * e.g. mcx tilde, UNIX backslash, or SGML percent sign based. * -> smarter space-based separation. whitespace ? * * NOTE * Separates on spaces, which are replaced with '\0'. * src is modified ('\0' are written throughout). * the char* members 'char* argv[]' all point to within src. */ char** mcxOptParseString ( char* src , int* argc , unsigned char delim ) ; mcxTing* mcxOptArgLine ( const char** argv , int argc , int quote /* '[' or '"' */ ) ; /* * Severely undocumented stuff, but quite useful. * This is used to write a program that * - takes modes, e.g. 'clm dist' 'clm info' 'clm meet' * - has a set of shared options * - allows modes to have their own unique set of options * - Program and mode options are not separated by the mode, * but all are specified after the mode. * Look at htpp://micans.org/mcl/src/mcl-latest/src/shcl/clm.c * htpp://micans.org/mcl/src/mcl-latest/src/shmx/mcx.c * for two fully functioning examples. */ #define MCX_DISP_DEFAULT 0 #define MCX_DISP_HIDDEN 1 #define MCX_DISP_MANUAL 2 typedef struct { const char* name ; const char* syntax ; mcxOptAnchor* options ; int n_options ; mcxstatus (*arg_cb)(int optid, const char* val) ; mcxstatus (*init)( void ) ; mcxstatus (*main)(int argc, const char* argv[]) ; int n_at_least /* trailing arguments */ ; int n_at_most /* trailing arguments */ ; mcxbits flags ; } mcxDispHook ; typedef struct { int id ; mcxDispHook* (*get_hk)(void) ; } mcxDispEntry ; typedef struct mcx_disp_bundle { int disp_argc ; const char** disp_argv ; const char* disp_name ; const char* disp_syntax ; mcxOptAnchor* disp_shared ; dim n_disp_shared ; mcxstatus (*shared_handler)(int optid, const char* val, mcxDispHook*, struct mcx_disp_bundle*) ; void (*disp_version)(const char* me) ; mcxDispEntry* disp_table ; } mcxDispBundle ; int mcxDispatch ( mcxDispBundle* bundle ) ; #endif apparix-11-062/util/rand.c000066400000000000000000000237361326043744200153330ustar00rootroot00000000000000/* (C) Copyright 2004, 2005, 2006, 2007, 2008, 2009 Stijn van Dongen * * (C) Ziggurat method Copyright 2005 Jochen Voss. * * This file is part of tingea. You can redistribute and/or modify tingea * under the terms of the GNU General Public License; either version 3 of the * License or (at your option) any later version. You should have received a * copy of the GPL along with tingea, in the file COPYING. */ #include #include #include #include #include "rand.h" #include "math.h" #include "types.h" unsigned long mcxSeed ( unsigned long i ) { pid_t p = getpid() ; pid_t pp = getppid() ; time_t t = time(NULL) ; unsigned long s = (p ^ p << 4 ^ p << 16 ^ p << 28) ^ (pp ^ pp << 8 ^ pp << 24) ^ (t ^ t << 12 ^ t << 20) ^ (i ^ i << 3 ^ i << 23 ^ i << 26) /* I have no solid evidence backing up the usefulness of the xors. * They won't increase entropy anyway of course. * Anyway, the xors do seem useful in order to spread input * bits out over the output space, as seen from some hashing * experiments. */ ; return s ; } /* Box-Muller transform */ double mcxNormalBoxMuller ( void ) { double a = 1.0 - (random() * 1.0) / (RAND_MAX + 1.0) ; double b = 1.0 - (random() * 1.0) / (RAND_MAX + 1.0) ; return sqrt( -2.0 * log(a)) * cos(2*3.14159265358979323846*b) ; } double mcxNormal ( void ) { return mcxNormalZiggurat() ; } double mcxNormalCut ( double radius , double stddev ) { dim d ; if (radius < 0) radius = -radius ; for (d=0;d<256;d++) { double r = stddev * mcxNormal() ; if (r >= -radius && r <= radius) return r ; } return 0.0 ; } double mcxNormalSample ( double radius , double stddev ) { int n_try = 0 ; double r = 2 * radius * (((1.0 * random()) / RAND_MAX) - 0.5) ; while (n_try++ < 1000) { double n = exp( - (r * r) / (2 * stddev * stddev)) / (2.5066282746 * stddev) ; double p = (1.0 * random()) / RAND_MAX ; if (n >= p) break ; r = 2 * radius * (((1.0 * random()) / RAND_MAX) - 0.5) ; } return r ; } /* Ziggurat method * * Copyright (C) 2005 Jochen Voss. * * For details see the following article. * * George Marsaglia, Wai Wan Tsang * The Ziggurat Method for Generating Random Variables * Journal of Statistical Software, vol. 5 (2000), no. 8 * http://www.jstatsoft.org/v05/i08/ */ /* position of right-most step */ #define PARAM_R 3.44428647676 /* tabulated values for the heigt of the Ziggurat levels */ static const double ytab[128] = { 1.000000000000 , 0.963598623011 , 0.936280813353 , 0.913041104253 , 0.892278506696 , 0.873239356919 , 0.855496407634 , 0.838778928349 , 0.822902083699 , 0.807732738234 , 0.793171045519 , 0.779139726505 , 0.765577436082 , 0.752434456248 , 0.739669787677 , 0.727249120285 , 0.715143377413 , 0.703327646455 , 0.691780377035 , 0.680482768910 , 0.669418297233 , 0.658572339120 , 0.647931876189 , 0.637485254896 , 0.627221991450 , 0.617132611532 , 0.607208517467 , 0.597441877296 , 0.587825531465 , 0.578352913803 , 0.569017984198 , 0.559815170911 , 0.550739320877 , 0.541785656682 , 0.532949739145 , 0.524227434628 , 0.515614886373 , 0.507108489253 , 0.498704867478 , 0.490400854812 , 0.482193476986 , 0.474079936010 , 0.466057596125 , 0.458123971214 , 0.450276713467 , 0.442513603171 , 0.434832539473 , 0.427231532022 , 0.419708693379 , 0.412262232120 , 0.404890446548 , 0.397591718955 , 0.390364510382 , 0.383207355816 , 0.376118859788 , 0.369097692334 , 0.362142585282 , 0.355252328834 , 0.348425768415 , 0.341661801776 , 0.334959376311 , 0.328317486588 , 0.321735172063 , 0.315211514970 , 0.308745638367 , 0.302336704338 , 0.295983912320 , 0.289686497571 , 0.283443729739 , 0.277254911560 , 0.271119377649 , 0.265036493387 , 0.259005653912 , 0.253026283183 , 0.247097833139 , 0.241219782932 , 0.235391638239 , 0.229612930649 , 0.223883217122 , 0.218202079518 , 0.212569124201 , 0.206983981709 , 0.201446306496 , 0.195955776745 , 0.190512094256 , 0.185114984406 , 0.179764196185 , 0.174459502324 , 0.169200699492 , 0.163987608600 , 0.158820075195 , 0.153697969964 , 0.148621189348 , 0.143589656295 , 0.138603321143 , 0.133662162669 , 0.128766189309 , 0.123915440582 , 0.119109988745 , 0.114349940703 , 0.109635440230 , 0.104966670533 , 0.100343857232 , 0.0957672718266 , 0.0912372357329 , 0.0867541250127 , 0.082318375932 , 0.0779304915295 , 0.0735910494266 , 0.0693007111742 , 0.065060233529 , 0.0608704821745 , 0.0567324485840 , 0.0526472709800 , 0.0486162607163 , 0.0446409359769 , 0.0407230655415 , 0.0368647267386 , 0.0330683839378 , 0.0293369977411 , 0.0256741818288 , 0.0220844372634 , 0.0185735200577 , 0.0151490552854 , 0.0118216532614 , 0.00860719483079, 0.00553245272614, 0.00265435214565 } ; /* tabulated values for 2^24 times x[i]/x[i+1], * used to accept for U*x[i+1]<=x[i] * without any floating point operations */ static const unsigned long ktab[128] = { 0 , 12590644 , 14272653 , 14988939 , 15384584 , 15635009 , 15807561 , 15933577 , 16029594 , 16105155 , 16166147 , 16216399 , 16258508 , 16294295 , 16325078 , 16351831 , 16375291 , 16396026 , 16414479 , 16431002 , 16445880 , 16459343 , 16471578 , 16482744 , 16492970 , 16502368 , 16511031 , 16519039 , 16526459 , 16533352 , 16539769 , 16545755 , 16551348 , 16556584 , 16561493 , 16566101 , 16570433 , 16574511 , 16578353 , 16581977 , 16585398 , 16588629 , 16591685 , 16594575 , 16597311 , 16599901 , 16602354 , 16604679 , 16606881 , 16608968 , 16610945 , 16612818 , 16614592 , 16616272 , 16617861 , 16619363 , 16620782 , 16622121 , 16623383 , 16624570 , 16625685 , 16626730 , 16627708 , 16628619 , 16629465 , 16630248 , 16630969 , 16631628 , 16632228 , 16632768 , 16633248 , 16633671 , 16634034 , 16634340 , 16634586 , 16634774 , 16634903 , 16634972 , 16634980 , 16634926 , 16634810 , 16634628 , 16634381 , 16634066 , 16633680 , 16633222 , 16632688 , 16632075 , 16631380 , 16630598 , 16629726 , 16628757 , 16627686 , 16626507 , 16625212 , 16623794 , 16622243 , 16620548 , 16618698 , 16616679 , 16614476 , 16612071 , 16609444 , 16606571 , 16603425 , 16599973 , 16596178 , 16591995 , 16587369 , 16582237 , 16576520 , 16570120 , 16562917 , 16554758 , 16545450 , 16534739 , 16522287 , 16507638 , 16490152 , 16468907 , 16442518 , 16408804 , 16364095 , 16301683 , 16207738 , 16047994 , 15704248 , 15472926 } ; /* tabulated values of 2^{-24}*x[i] */ static const double wtab[128] = { 1.62318314817e-08 , 2.16291505214e-08 , 2.54246305087e-08, 2.84579525938e-08 , 3.10340022482e-08 , 3.33011726243e-08 , 3.53439060345e-08, 3.72152672658e-08 , 3.89509895720e-08 , 4.05763964764e-08 , 4.21101548915e-08, 4.35664624904e-08 , 4.49563968336e-08 , 4.62887864029e-08 , 4.75707945735e-08, 4.88083237257e-08 , 5.00063025384e-08 , 5.11688950428e-08 , 5.22996558616e-08, 5.34016475624e-08 , 5.44775307871e-08 , 5.55296344581e-08 , 5.65600111659e-08, 5.75704813695e-08 , 5.85626690412e-08 , 5.95380306862e-08 , 6.04978791776e-08, 6.14434034901e-08 , 6.23756851626e-08 , 6.32957121259e-08 , 6.42043903937e-08, 6.51025540077e-08 , 6.59909735447e-08 , 6.68703634341e-08 , 6.77413882848e-08, 6.86046683810e-08 , 6.94607844804e-08 , 7.03102820203e-08 , 7.11536748229e-08, 7.19914483720e-08 , 7.28240627230e-08 , 7.36519550992e-08 , 7.44755422158e-08, 7.52952223703e-08 , 7.61113773308e-08 , 7.69243740467e-08 , 7.77345662086e-08, 7.85422956743e-08 , 7.93478937793e-08 , 8.01516825471e-08 , 8.09539758128e-08, 8.17550802699e-08 , 8.25552964535e-08 , 8.33549196661e-08 , 8.41542408569e-08, 8.49535474601e-08 , 8.57531242006e-08 , 8.65532538723e-08 , 8.73542180955e-08, 8.81562980590e-08 , 8.89597752521e-08 , 8.97649321908e-08 , 9.05720531451e-08, 9.13814248700e-08 , 9.21933373471e-08 , 9.30080845407e-08 , 9.38259651738e-08, 9.46472835298e-08 , 9.54723502847e-08 , 9.63014833769e-08 , 9.71350089201e-08, 9.79732621669e-08 , 9.88165885297e-08 , 9.96653446693e-08 , 1.00519899658e-07, 1.01380636230e-07 , 1.02247952126e-07 , 1.03122261554e-07 , 1.04003996769e-07, 1.04893609795e-07 , 1.05791574313e-07 , 1.06698387725e-07 , 1.07614573423e-07, 1.08540683296e-07 , 1.09477300508e-07 , 1.10425042570e-07 , 1.11384564771e-07, 1.12356564007e-07 , 1.13341783071e-07 , 1.14341015475e-07 , 1.15355110887e-07, 1.16384981291e-07 , 1.17431607977e-07 , 1.18496049514e-07 , 1.19579450872e-07, 1.20683053909e-07 , 1.21808209468e-07 , 1.22956391410e-07 , 1.24129212952e-07, 1.25328445797e-07 , 1.26556042658e-07 , 1.27814163916e-07 , 1.29105209375e-07, 1.30431856341e-07 , 1.31797105598e-07 , 1.33204337360e-07 , 1.34657379914e-07, 1.36160594606e-07 , 1.37718982103e-07 , 1.39338316679e-07 , 1.41025317971e-07, 1.42787873535e-07 , 1.44635331499e-07 , 1.46578891730e-07 , 1.48632138436e-07, 1.50811780719e-07 , 1.53138707402e-07 , 1.55639532047e-07 , 1.58348931426e-07, 1.61313325908e-07 , 1.64596952856e-07 , 1.68292495203e-07 , 1.72541128694e-07, 1.77574279496e-07 , 1.83813550477e-07 , 1.92166040885e-07 , 2.05295471952e-07, 2.22600839893e-07 } ; double mcxNormalZiggurat ( void ) { unsigned long U, sign, i, j ; double x = 0.0, y ; while (1) { U = random() ; i = U & 0x0000007F /* 7 bit to choose the step */ ; sign = U & 0x00000080 /* 1 bit for the sign */ ; j = random() & 0x00FFFFFF /* 24 bit for the x-value */ ; x = j*wtab[i] ; if (j < ktab[i]) break ; if (i<127) { double y0, y1 ; y0 = ytab[i] ; y1 = ytab[i+1] ; y = y1+(y0-y1) * mcxUniform0 ; } else { x = PARAM_R - log(mcxUniform1)/PARAM_R ; y = exp(-PARAM_R*(x-0.5*PARAM_R)) * mcxUniform0 ; } if (y < exp(-0.5*x*x)) break ; } return sign ? x : -x ; } apparix-11-062/util/rand.h000066400000000000000000000022651326043744200153320ustar00rootroot00000000000000/* (C) Copyright 2004, 2005, 2006, 2007, 2008, 2009 Stijn van Dongen * * This file is part of tingea. You can redistribute and/or modify tingea * under the terms of the GNU General Public License; either version 3 of the * License or (at your option) any later version. You should have received a * copy of the GPL along with tingea, in the file COPYING. */ #ifndef tingea_rand_h #define tingea_rand_h #include #define MCX_RAND_MAX RAND_MAX #define mcxUniform0 ((1.0 * random()) / ((double) RAND_MAX + 1.0)) #define mcxUniform1 (1.0 - ((1.0 * random()) / ((double) RAND_MAX + 1.0))) /* This is for weak seeding, to obtain fresh seeds which will definitely * *not* be suitable for cryptographic needs */ unsigned long mcxSeed ( unsigned long seedlet ) ; double mcxNormal ( void ) ; double mcxNormalCut ( double radius , double stddev ) ; double mcxNormalZiggurat ( void ) ; double mcxNormalBoxMuller ( void ) ; /* Generate numbers in the interval [-outer, outer] according * to the normal distribution with standard deviation sigma. * Use e.g. outer = 2.0 sigma = 0.5 */ double mcxNormalSample ( double radius , double stddev ) ; #endif apparix-11-062/util/ting.c000066400000000000000000000466741326043744200153560ustar00rootroot00000000000000/* (C) Copyright 1999, 2000, 2001, 2002, 2003, 2004, 2005 Stijn van Dongen * (C) Copyright 2006, 2007, 2008, 2009 Stijn van Dongen * * This file is part of tingea. You can redistribute and/or modify tingea * under the terms of the GNU General Public License; either version 3 of the * License or (at your option) any later version. You should have received a * copy of the GPL along with tingea, in the file COPYING. */ #include #include #include #include #include "../config.h" #include "ting.h" #include "ding.h" #include "minmax.h" #include "alloc.h" #include "array.h" #include "hash.h" #include "types.h" #include "err.h" #include "tr.h" void mcxTingRelease ( void* tingv ) { if (tingv && ((mcxTing*)tingv)->str) mcxFree(((mcxTing*)tingv)->str) ; } void mcxTingFree ( mcxTing **tingpp ) { mcxTing* ting = *tingpp ; if (ting) { if (ting->str) mcxFree(ting->str) ; mcxFree(ting) ; *tingpp = NULL ; } } void mcxTingFree_v ( void *tingpp ) { mcxTingFree((mcxTing**) tingpp) ; } #if 0 void mcxTingAbandon ( void *tingpp ) { mcxTing* ting = *((mcxTing**) tingpp) ; mcxFree(ting) ; } #endif mcxTing* mcxTingShrink ( mcxTing* ting , ofs offset ) { if (offset < 0) offset = ting->len + offset /* fixme conversion? */ ; if (offset < 0 || (dim) offset > ting->len) { mcxErr ( "mcxTingShrink" , "funny offset <%lu> newlen <%ld> combo" , (ulong) ting->len , (long) offset ) ; return ting ; } else { *(ting->str+offset) = '\0' ; ting->len = offset; ; } return ting ; } mcxTing* mcxTingEnsure ( mcxTing* ting , dim len ) { if (!ting && !(ting = (mcxTing*) mcxTingInit(NULL))) return NULL ; if (len <= ting->mxl) ; else { char* t = mcxRealloc(ting->str, len+1, RETURN_ON_FAIL) ; if (!t) return NULL ; ting->str = t ; ting->mxl = len ; if (1) *(ting->str+ting->mxl) = '\0' /* there should be no need to do this; * and for large allocations this may fail. */ ; } return ting ; } #ifndef HAVE_VA_COPY #define HAVE_VA_COPY 1 #endif /* todo nul hardening */ static mcxTing* mcx_ting_print ( mcxTing* dst , const char* fmt , va_list *args ) #define PRINT_BUF_SIZE 512 { char buf[PRINT_BUF_SIZE], *src ; mcxTing* txtbuf = NULL ; dim m = PRINT_BUF_SIZE ; int npf /* Perhaps hook this #definery with configure options that * benefit from autoconf machinery. */ #if HAVE_VA_COPY ; va_list args2 ; va_copy(args2, *args) ; npf = vsnprintf(buf, PRINT_BUF_SIZE, fmt, args2) ; va_end(args2) #else ; npf = vsnprintf(buf, PRINT_BUF_SIZE, fmt, *args) #endif /* from reading standards it seems that npf >= PRINT_BUF_SIZE * should be sufficient. However, alpha OSF1 provides * a counterexample. And from reading standard annotations * it seems that vsnprintf is widely ill-implemented */ ; if (npf < 0 || npf >= PRINT_BUF_SIZE - 1) { m = (npf >= 0 && npf >= PRINT_BUF_SIZE - 1) ? ((dim) npf) + 1 : 2 * m /* Suppose m is set to npf+1. Then mcxTingEmpty will malloc npf+2 * bytes and vnsprintf is given m+1=npf+2 as size argument, * which is > PRINT_BUF_SIZE. */ ; while (1) { if (!(txtbuf = mcxTingEmpty(txtbuf, m))) { mcxTingFree(&txtbuf) ; return NULL ; } #if HAVE_VA_COPY va_copy(args2, *args) ; npf = vsnprintf(txtbuf->str, m+1, fmt, args2) ; va_end(args2) #else ; npf = vsnprintf(txtbuf->str, m+1, fmt, *args) #endif /* Only the npf < 0 case is expected below. * The other check is defensive coding. We gave * vsnprintf m+1 as size argument, so the check is * against one less than that (alpha OSF1 example). */ ; if (npf < 0 || (dim) npf >= m) m *= 2 ; else break ; } src = txtbuf->str ; } else src = buf ; dst = mcxTingWrite(dst, src) ; mcxTingFree(&txtbuf) ; return dst ; } mcxTing* mcxTingPrintSplice ( mcxTing* dst , ofs offset , ofs delete , const char* fmt , ... ) { va_list args ; mcxTing *infix = NULL ; va_start(args, fmt) ; infix = mcx_ting_print(NULL, fmt, &args) ; va_end(args) ; if (!infix) return NULL ; if (!dst) return infix ; if ( mcxTingSplice(dst, infix->str, offset, delete, infix->len) != STATUS_OK ) { mcxTingFree(&infix) ; return NULL ; } mcxTingFree(&infix) ; return dst ; } mcxTing* mcxTingPrint ( mcxTing* dst , const char* fmt , ... ) { va_list args ; va_start(args, fmt) ; dst = mcx_ting_print(dst, fmt, &args) ; va_end(args) ; return dst ; } mcxTing* mcxTingPrintAfter ( mcxTing* dst , const char* fmt , ... ) { va_list args ; mcxTing *affix = NULL ; va_start(args, fmt) ; affix = mcx_ting_print(affix, fmt, &args) ; va_end(args) ; if (!dst) return affix ; if (!affix) /* presumably malloc failure */ return NULL ; if (!mcxTingAppend(dst, affix->str)) { mcxTingFree(&affix) ; return NULL ; } mcxTingFree(&affix) ; return dst ; } static const char* roman[40] = { "" , "i" , "ii", "iii", "iv" , "v" , "vi", "vii", "viii", "ix" , "" , "x" , "xx", "xxx", "xl" , "l" , "lx", "lxx", "lxxx", "xc" , "" , "c" , "cc", "ccc", "cd" , "d" , "dc", "dcc", "dccc", "cm" , "" , "m" , "mm", "mmm", "mmmm", "" , "" , "", "", "" } ; mcxTing* mcxTingRoman ( mcxTing* dst , long a , mcxbool ucase ) { long i, x, c, m ; char* p ; if (a >= 5000 || a <= 0) return mcxTingWrite(dst, "-") ; i = a % 10 ; a /= 10 ; x = a % 10 ; a /= 10 ; c = a % 10 ; a /= 10 ; m = a ; dst = mcxTingPrint ( dst , "%s%s%s%s" , roman[30+m] , roman[20+c] , roman[10+x] , roman[ 0+i] ) ; if (dst && ucase) for (p=dst->str;pstr+dst->len;p++) *p += 'A' - 'a' ; return dst ; } mcxTing* mcxTingDouble ( mcxTing* dst , double x , int decimals ) { char num[500] ; char* p ; int len = snprintf(num, 500, "%.*f", decimals, x) ; if (decimals < 0) { mcxErr("mcxTingDouble PBD", "negative decimals arg") ; decimals = 6 ; } if (len < 0 || len >= 500) return mcxTingWrite(dst, "[]") ; p = num+len-1 /* GNU libcx bug workaround */ /* it returns 2 for length of 'inf' */ ; if (decimals && strcmp(num, "inf")) { while (*p == '0') p-- ; if (*p == '.') *++p = '0' ; *++p = '\0' ; } return mcxTingWrite(dst, num) ; } mcxTing* mcxTingInteger ( mcxTing* dst , long x ) { char num[128] ; int len = snprintf(num, 128, "%ld", x) ; if (len < 0 || len >= 128) return mcxTingWrite(dst, "[]") ; return mcxTingWrite(dst, num) ; } void* mcxTingInit ( void * tingv ) { mcxTing *ting = tingv ; if (!ting) { if (!(ting = mcxAlloc(sizeof(mcxTing), RETURN_ON_FAIL))) return NULL ; } if (!(ting->str = (char*) mcxAlloc(sizeof(char), RETURN_ON_FAIL))) return NULL ; *(ting->str+0) = '\0' ; ting->len = 0 ; ting->mxl = 0 ; return ting ; } /* * Take string into an existing ting or into a new ting */ mcxTing* mcxTingInstantiate ( mcxTing* ting , const char* string ) /* strnotice strlen */ { dim length = string ? strlen(string) : 0 /* ensure handles ting==NULL and/or length==0 cases */ ; if (!(ting = mcxTingEnsure(ting, length))) return NULL /* strnotice strncpy */ ; if (string) { strncpy(ting->str, string, length) ; *(ting->str+length) = '\0' ; } ting->len = length ; return ting ; } int mcxTingRevCmp ( const void* t1 , const void* t2 ) { return (strcmp(((mcxTing*)t2)->str, ((mcxTing*)t1)->str)) ; } int mcxTingCmp ( const void* t1 , const void* t2 ) { return (strcmp(((mcxTing*)t1)->str, ((mcxTing*)t2)->str)) ; } int mcxTingPCmp ( const void* t1 , const void* t2 ) { return (strcmp(((mcxTing**)t1)[0]->str, ((mcxTing**)t2)[0]->str)) ; } int mcxTingPRevCmp ( const void* t1 , const void* t2 ) { return (strcmp(((mcxTing**)t2)[0]->str, ((mcxTing**)t1)[0]->str)) ; } int mcxPKeyTingCmp ( const void* k1 , const void* k2 ) { return strcmp ( ((mcxTing*) ((mcxKV**)k1)[0]->key)->str , ((mcxTing*) ((mcxKV**)k2)[0]->key)->str ) ; } int mcxPKeyTingRevCmp ( const void* k1 , const void* k2 ) { return strcmp ( ((mcxTing*) ((mcxKV**)k2)[0]->key)->str , ((mcxTing*) ((mcxKV**)k1)[0]->key)->str ) ; } mcxstatus mcxTingSplice ( mcxTing* ting , const char* pstr , ofs offset , ofs n_delete , dim n_copy ) { dim newlen ; if (!ting) { mcxErr("mcxTingSplice PBD", "void ting argument") ; return STATUS_FAIL ; } /* offset -1 denotes appending at the end, * offset -2 denotes inserting at the last-but-one position. * etc */ if (offset < 0) { if ((dim) -offset > ting->len + 1) offset = 0 ; else offset = ting->len + offset + 1 ; } else if ((dim) offset > ting->len) offset = ting->len ; if (n_delete == TING_INS_CENTER) { n_delete = MCX_MIN(ting->len, n_copy) ; offset = (ting->len - n_delete) / 2 /* n_delete <= ting->len */ ; } else if (n_delete == TING_INS_OVERWRITE) n_delete = MCX_MIN(ting->len - offset, n_copy) /* offset <= ting->len */ ; else if (n_delete == TING_INS_OVERRUN || n_delete < 0) n_delete = ting->len - offset /* offset <= ting->len */ ; else if (n_delete < 0) { mcxErr ( "mcxTingSplice PBD" , "unsupported delete mode %ld" , (long) n_delete ) ; return STATUS_FAIL ; } else if ((dim) (offset + n_delete) > ting->len) n_delete = ting->len - offset ; if (ting->len + n_copy < (dim) n_delete) /* now spurious? */ { mcxErr("mcxTingSplice PBD", "arguments result in negative length") ; return STATUS_FAIL ; } /* * essential: mcxSplice does not know to allocate room for '\0' */ newlen = ting->len - n_delete + n_copy ; if (!mcxTingEnsure(ting, newlen)) return STATUS_FAIL ; if ( mcxSplice ( &(ting->str) , pstr , sizeof(char) , &(ting->len) , &(ting->mxl) , offset , (dim) n_delete , n_copy ) != STATUS_OK ) return STATUS_FAIL /* * essential: mcxSplice might have realloced, so has to be done afterwards. */ ; *(ting->str+newlen) = '\0' ; if (ting->len != newlen) { mcxErr("mcxTingSplice panic", "mcxSplice gives unexpected result") ; return STATUS_FAIL ; } return STATUS_OK ; } mcxTing* mcxTingNew ( const char* str ) { return mcxTingInstantiate(NULL, str) ; } mcxTing* mcxTingNNew ( const char* str , dim sz ) { mcxTing* ting = mcxTingEnsure(NULL, sz) ; if (!ting) return NULL /* strnotice memcpy */ ; if (str && sz) memcpy(ting->str, str, sz) ; *(ting->str+sz) = '\0' ; ting->len = sz ; return ting ; } mcxTing* mcxTingEmpty ( mcxTing* ting , dim len ) { if (!(ting = mcxTingEnsure(ting, len))) return NULL ; *(ting->str+0) = '\0' , ting->len = 0 ; return ting ; } mcxTing* mcxTingWrite ( mcxTing* ting , const char* str ) { return mcxTingInstantiate(ting, str) ; } mcxTing* mcxTingNWrite ( mcxTing* ting , const char* str , dim sz ) { if (!(ting = mcxTingEnsure(ting, sz))) return NULL /* strnotice strncpy */ ; memcpy(ting->str, str, sz) ; *(ting->str+sz) = '\0' ; ting->len = sz ; return ting ; } char* mcxTingSubStr ( const mcxTing* ting , ofs offset , ofs length ) { char* str ; if (offset < 0 || (dim) offset > ting->len) offset = ting->len ; if (length < 0 || (dim) (offset+length) > ting->len) length = ting->len - offset ; if (!(str = mcxAlloc((dim) (length+1), RETURN_ON_FAIL))) return NULL ; if (length) memcpy(str, ting->str+offset, (dim) length) ; *(str+length) = '\0' ; return str ; } mcxTing* mcxTingify ( char* str ) { mcxTing* ting = mcxAlloc(sizeof(mcxTing), RETURN_ON_FAIL) ; ting->str = str /* strnotice strlen; ? tingify2 */ ; ting->len = strlen(str) ; return ting ; } char* mcxTinguish ( mcxTing* ting ) { char* str = ting->str ; mcxFree(ting) ; return str ; } char* mcxTingStr ( const mcxTing* ting ) { ofs slen = ting->len ; return mcxTingSubStr(ting, 0, slen) ; } mcxTing* mcxTingAppend ( mcxTing* ting , const char* str ) { if (!ting) return mcxTingNew(str) /* strnotice strlen */ ; if ( mcxTingSplice ( ting , str , -1 /* splice offset */ , 0 /* delete nothing */ , str? strlen(str) : 0 /* string length */ ) != STATUS_OK ) return NULL ; return ting ; } mcxTing* mcxTingKAppend ( mcxTing* ting , const char* str , dim sz ) { dim len = strlen(str) ; if (!ting && !sz) return mcxTingEmpty(NULL, 0) ; if (!sz) return ting ; while (sz-- > 0) /* careful with unsignedness */ if (!(ting = mcxTingNAppend(ting, str, len))) return NULL ; return ting ; } mcxTing* mcxTingNAppend ( mcxTing* ting , const char* str , dim sz ) { if (!ting) return mcxTingNWrite(NULL, str, sz) ; if ( mcxTingSplice ( ting , str , -1 /* splice offset */ , 0 /* delete nothing */ , sz ) != STATUS_OK ) return NULL ; return ting ; } mcxTing* mcxTingInsert ( mcxTing* ting , const char* str , ofs offset ) { if (!ting) return mcxTingNew(str) /* strnotice strlen */ ; if ( mcxTingSplice ( ting , str , offset /* splice offset */ , 0 /* delete nothing */ , str ? strlen(str) : 0 /* string length */ ) != STATUS_OK ) return NULL ; return ting ; } mcxTing* mcxTingNInsert ( mcxTing* ting , const char* str , ofs offset , dim length ) { if (!ting) return mcxTingNWrite(NULL, str, length) ; if ( mcxTingSplice ( ting , str , offset /* splice offset */ , 0 /* delete nothing */ , length /* length of str */ ) != STATUS_OK ) return NULL ; return ting ; } mcxTing* mcxTingDelete ( mcxTing* ting , ofs offset , dim width ) { ofs swidth = width ; if (!ting) return NULL ; if ( mcxTingSplice ( ting , NULL , offset /* splice offset */ , swidth /* delete width */ , 0 /* string length */ ) != STATUS_OK ) return NULL ; return ting ; } u32 mcxTingDJBhash ( const void* ting ) { return(mcxBJhash(((mcxTing*) ting)->str, ((mcxTing*) ting)->len)) ; } u32 mcxTingBDBhash ( const void* ting ) { return(mcxBDBhash(((mcxTing*) ting)->str, ((mcxTing*) ting)->len)) ; } u32 mcxTingBJhash ( const void* ting ) { return(mcxBJhash(((mcxTing*) ting)->str, ((mcxTing*) ting)->len)) ; } u32 mcxTingCThash ( const void* ting ) { return(mcxCThash(((mcxTing*) ting)->str, ((mcxTing*) ting)->len)) ; } u32 mcxTingDPhash ( const void* ting ) { return(mcxDPhash(((mcxTing*) ting)->str, ((mcxTing*) ting)->len)) ; } u32 mcxTingGEhash ( const void* ting ) { return(mcxGEhash(((mcxTing*) ting)->str, ((mcxTing*) ting)->len)) ; } u32 mcxTingOAThash ( const void* ting ) { return(mcxOAThash(((mcxTing*) ting)->str, ((mcxTing*) ting)->len)) ; } u32 mcxTingELFhash ( const void* ting ) { return(mcxELFhash(((mcxTing*) ting)->str, ((mcxTing*) ting)->len)) ; } u32 mcxTingFNVhash ( const void* ting ) { return(mcxFNVhash(((mcxTing*) ting)->str, ((mcxTing*) ting)->len)) ; } u32 (*mcxTingHFieByName(const char* id))(const void* ting) { if (!strcmp(id, "dp")) return mcxTingDPhash ; else if (!strcmp(id, "bj")) return mcxTingBJhash ; else if (!strcmp(id, "elf")) return mcxTingELFhash ; else if (!strcmp(id, "djb")) return mcxTingDJBhash ; else if (!strcmp(id, "bdb")) return mcxTingBDBhash ; else if (!strcmp(id, "ge")) return mcxTingGEhash ; else if (!strcmp(id, "oat")) return mcxTingOAThash ; else if (!strcmp(id, "svd")) return mcxTingSvDhash ; else if (!strcmp(id, "svd2")) return mcxTingSvD2hash ; else if (!strcmp(id, "svd1")) return mcxTingSvD1hash ; else if (!strcmp(id, "ct")) return mcxTingCThash ; else if (!strcmp(id, "fnv")) return mcxTingFNVhash ; else return NULL ; } u32 mcxTingSvDhash ( const void* ting ) { return(mcxSvDhash(((mcxTing*) ting)->str, ((mcxTing*) ting)->len)) ; } u32 mcxTingSvD2hash ( const void* ting ) { return(mcxSvD2hash(((mcxTing*) ting)->str, ((mcxTing*) ting)->len)) ; } u32 mcxTingSvD1hash ( const void* ting ) { return(mcxSvD1hash(((mcxTing*) ting)->str, ((mcxTing*) ting)->len)) ; } u32 mcxTingHash ( const void* ting ) { return(mcxDPhash(((mcxTing*) ting)->str, ((mcxTing*) ting)->len)) ; } /* Fails only for memory reason */ mcxstatus mcxTingTackc ( mcxTing* ting , unsigned char c ) { if (!ting || !mcxTingEnsure(ting, ting->len+1)) return STATUS_FAIL ; ting->str[ting->len] = c ; ting->str[ting->len+1] = '\0' ; ting->len += 1 ; return STATUS_OK ; } /* Fails if last char is not the same as c */ mcxstatus mcxTingTickc ( mcxTing* ting , unsigned char c ) { if (!ting || !ting->len) return STATUS_FAIL ; if ((unsigned char) ting->str[ting->len-1] == c) { mcxTingShrink(ting, -1) ; return STATUS_OK ; } return STATUS_FAIL ; } apparix-11-062/util/ting.h000066400000000000000000000272751326043744200153570ustar00rootroot00000000000000/* (C) Copyright 1999, 2000, 2001, 2002, 2003, 2004, 2005 Stijn van Dongen * (C) Copyright 2006, 2007, 2008, 2009 Stijn van Dongen * * This file is part of tingea. You can redistribute and/or modify tingea * under the terms of the GNU General Public License; either version 3 of the * License or (at your option) any later version. You should have received a * copy of the GPL along with tingea, in the file COPYING. */ #ifndef tingea_ting #define tingea_ting #include "types.h" typedef struct { char *str ; dim len ; dim mxl ; } mcxTing ; /* ************************************************************************** * * ** Implementation notes (a few). * * Synopsis * This little module provides an objectified C-string compatible interface * to strings. * Some philosophy * Do not mind the overhead of 2*sizeof(int) bytes per ting. * If you have humongous amounts of small strings, use C-strings. Optionally * you can do the needed char manipulation in a ting used as scratch-space * using the ting interface, then create a normal string once you are done. * Use mcxTinguish to avoid copying if needed. * Feel free to use the str member with routines from * or perhaps from ding.h. Just remember to treat it as a const object * when doing so. * Applications * Zoem is the macro processor that processes the zoem language. It is very * string-heavy and its string operations are entirely based on the ting * module. * Caveat * Nearly all routines return a NULL pointer to indicate malloc failure. * Data structure * str: array of chars * * len: length of string in str (excluding '\0') * *(str+len) == '\0' * * mxl: current allocated number of writable char's (excluding '\0') * Allocated amount is mxl+1 * *(str+mxl) == '\0' - but don't count on that. * Notes * mcxTingEnsure is the only routine allowed to fiddle with mxl. * (apart from mcxTingInit which sets it to zero). * * Future idea * mcxTingFinalize, (realloc to length) * * Routines marked `!' will NOT accept ting==NULL argument. * Routines marked `#' should not be called other than by ting routines * * _ #Init _ * / \ * Ensure <--- #Instantiate * / \ \ * Empty !Splice New,Write,Print,PrintAfter * NWrite | * | * Append,Insert,Delete,PrintSplice * TODO * the library should be able to deal with embedded \0's. Really. */ /* ************************************************************************** * * ** Various instantiation routines. */ /* Accepts NULL argument. * void arguments so that it can be used * as callback. * * Should ordinarily *not* be used, unless * you want to initialize a ting allocated * on the frame stack. */ void* mcxTingInit ( void* ting ) ; /* Accepts NULL argument. * Should ordinarily *not* be used. */ mcxTing* mcxTingInstantiate ( mcxTing* dst_ting , const char* str ) ; /* Accepts NULL argument. Does not affect * ting->str. used for preallocing, e.g. to * prepare for successive calls of Append. (see * also Empty). */ mcxTing* mcxTingEnsure ( mcxTing* ting , dim length ) ; /* Accepts NULL argument. The string part is * set to the empty string. * Can be used for preallocing. */ mcxTing* mcxTingEmpty ( mcxTing* ting , dim length ) ; /* ************************************************************************** * * ** Some freeing routines. */ /* Free members and shell struct * You pass the address of a variable, * loosely speaking. */ void mcxTingFree ( mcxTing **tingpp ) ; /* Free members and shell struct * Use with callbacks, e.g. * for freeing hash with tings in one go. */ void mcxTingFree_v ( void *tingpp ) ; /* Free members * Use for freeing array of ting; * e.g. as callback in mcxNFree. */ void mcxTingRelease ( void *ting ) ; /* ************************************************************************** * * ** A bunch of user-land creation routines. */ /* accepts NULL argument, maps to empty string. */ mcxTing* mcxTingNew ( const char* str ) ; /* accepts NULL argument, maps to empty string. */ mcxTing* mcxTingNNew ( const char* str , dim n ) ; /* accepts NULL argument. */ mcxTing* mcxTingWrite ( mcxTing* ting , const char* str ) ; /* accepts NULL argument. */ mcxTing* mcxTingNWrite ( mcxTing* ting , const char* str , dim n ) ; /* usurps argument. */ mcxTing* mcxTingify ( char* str ) ; /* destroys argument, returns str member. */ char* mcxTinguish ( mcxTing* ting ) ; /* ************************************************************************** * * ** Appending, inserting, deleting, shrinking. * Some can be used as creation routine (e.g. append). */ #define TING_INS_CENTER -3 #define TING_INS_OVERRUN -4 #define TING_INS_OVERWRITE -5 /* * The offset argument can be negative, for subscripting from the end. * * The n_delete argument can be nonnegative, or one of * TING_INS_CENTER center, (try to) overwrite without changing length. * TING_INS_OVERRUN overwrite till the end. * TING_INS_OVERWRITE (try to) overwrite without changing length. * * The n_copy argument is not magical like the previous two. * */ /* does NOT accept NULL argument. */ mcxstatus mcxTingSplice ( mcxTing* ting , const char* pstr , ofs d_offset /* negative offset refers to end */ , ofs n_delete /* special modes as documented above */ , dim n_copy ) ; /* accepts NULL argument. */ mcxTing* mcxTingInsert ( mcxTing* ting , const char* str , ofs offset ) ; /* accepts NULL argument. */ mcxTing* mcxTingNInsert ( mcxTing* ting , const char* str , ofs offset /* of ting->str */ , dim length /* of str */ ) ; /* accepts NULL argument. */ mcxTing* mcxTingAppend ( mcxTing* ting , const char* str ) ; /* accepts NULL argument. */ mcxTing* mcxTingKAppend ( mcxTing* ting , const char* str , dim n ) ; /* accepts NULL argument. */ mcxTing* mcxTingNAppend ( mcxTing* ting , const char* str , dim n ) ; /* accepts NULL argument. */ mcxTing* mcxTingDelete ( mcxTing* ting , ofs offset , dim width ) ; /* accepts NULL argument. */ mcxTing* mcxTingShrink ( mcxTing* ting , ofs length ) ; /* Fails only for memory reason */ mcxstatus mcxTingTackc ( mcxTing* ting , unsigned char c ) ; /* Fails if last char is not the same as c */ mcxstatus mcxTingTickc ( mcxTing* ting , unsigned char c ) ; /* ************************************************************************** * * ** A bunch of printf like routines. */ /* Accepts NULL argument. */ mcxTing* mcxTingPrint ( mcxTing* ting , const char* fmt , ... ) #ifdef __GNUC__ __attribute__ ((format (printf, 2, 3))) #endif ; /* Accepts NULL argument. */ mcxTing* mcxTingPrintAfter ( mcxTing* dst , const char* fmt , ... ) #ifdef __GNUC__ __attribute__ ((format (printf, 2, 3))) #endif ; /* Accepts NULL argument. * same offset and delete interface as * mcxTingSplice. */ mcxTing* mcxTingPrintSplice ( mcxTing* dst , ofs offset , ofs n_delete /* count of chars to delete, special modes */ , const char* fmt , ... ) #ifdef __GNUC__ __attribute__ ((format (printf, 4, 5))) #endif ; /* ************************************************************************** * * ** Miscellaneous. */ char* mcxTingStr ( const mcxTing* ting ) ; char* mcxTingSubStr ( const mcxTing* ting , ofs offset , ofs length /* use -1 to indicate remainder of string */ ) ; /* accepts NULL argument. */ mcxTing* mcxTingRoman ( mcxTing* dst , long x , mcxbool ucase ) ; /* accepts NULL argument. */ mcxTing* mcxTingInteger ( mcxTing* dst , long x ) ; /* accepts NULL argument. */ mcxTing* mcxTingDouble ( mcxTing* dst , double x , int decimals ) ; /* ************************************************************************** * * ** Comparing. */ /* compare two mcxTing* pointers */ int mcxTingCmp ( const void* t1 , const void* t2 ) ; /* compare two mcxTing* pointers */ int mcxTingRevCmp ( const void* t1 , const void* t2 ) ; /* compare two mcxTing** pointers */ int mcxTingPCmp ( const void* t1 , const void* t2 ) ; /* compare two mcxTing** pointers */ int mcxTingPRevCmp ( const void* t1 , const void* t2 ) ; /* compare two mcxKV** pointers by key as mcxTing* */ int mcxPKeyTingCmp ( const void* k1 , const void* k2 ) ; /* compare two mcxKV** pointers by key as mcxTing* */ int mcxPKeyTingRevCmp ( const void* k1 , const void* k2 ) ; /* ************************************************************************** * * ** Hashing. */ u32 (*mcxTingHFieByName(const char* id))(const void* ting) ; u32 mcxTingELFhash ( const void* ting ) ; u32 mcxTingHash ( const void* ting ) ; u32 mcxTingBJhash ( const void* ting ) ; u32 mcxTingCThash ( const void* ting ) ; u32 mcxTingDPhash ( const void* ting ) ; u32 mcxTingBDBhash ( const void* ting ) ; u32 mcxTingGEhash ( const void* ting ) ; u32 mcxTingOAThash ( const void* ting ) ; u32 mcxTingFNVhash ( const void* ting ) ; u32 mcxTingSvDhash ( const void* ting ) ; u32 mcxTingSvD2hash ( const void* ting ) ; u32 mcxTingSvD1hash ( const void* ting ) ; u32 mcxTingDJBhash ( const void* ting ) ; #endif apparix-11-062/util/tok.c000066400000000000000000000153171326043744200152000ustar00rootroot00000000000000/* (C) Copyright 2005, 2006, 2007, 2008, 2009 Stijn van Dongen * * This file is part of tingea. You can redistribute and/or modify tingea * under the terms of the GNU General Public License; either version 3 of the * License or (at your option) any later version. You should have received a * copy of the GPL along with tingea, in the file COPYING. */ /* TODO allow empty args () */ #include #include #include #include "tok.h" #include "types.h" #include "ting.h" #include "ding.h" #include "err.h" #include "alloc.h" #include "compile.h" #ifndef DEBUG # define DEBUG 0 #else # define DEBUG_DEFINED #endif char* mcxTokSkip ( const char* offset , int (*fbool)(int c) , ofs len ) { return mcxStrChrAint(offset, fbool, len) ; } /* * Accounts for nesting. * Will do '}', ')', ']', '>', assuming one of several conventions. * Does not handle string arguments with embedded delimiters, e.g. "foo) bar" */ mcxstatus mcxTokMatch ( const char* str_search , char** endptr , mcxbits mode , ofs len /* considered if >= 0 */ ) { const char* offset= str_search ; unsigned char c = *offset ; mcxstatus status = STATUS_OK ; mcxTing* stack ; const char* z ; *endptr = NULL ; if (len < 0) len = strlen(offset) ; z = offset + len ; switch(c) { case '{' : case '(' : case '[' : break ; default : mcxErr("mcxTokMatch", "not my coal of char <%c>", (int) c) ; return STATUS_FAIL ; } if (!(stack = mcxTingEmpty(NULL, 80))) return STATUS_FAIL ; do { unsigned char m = '\0' ; c = *offset ; switch(c) { case '{' : case '(' : case '[' : status = mcxTingTackc(stack, c) ; break ; case ')' : m = '(' ; break ; case '}' : m = '{' ; break ; case ']' : m = '[' ; break ; } if (m) status = mcxTingTickc(stack, m) ; if (status) break ; if (!stack->len) break ; offset++ ; } while (offset < z) ; if (stack->len) status = STATUS_FAIL ; else if (!status) *endptr = (char* )offset ; if (status) mcxErr ( "mcxTokMatch" , "stacklen <%lu>, offset <%ld>, char <%c>" , (ulong) stack->len , (long) (offset - str_search) , (int) *offset ) ; mcxTingFree(&stack) ; return status ; } mcxstatus mcxTokFind ( const char* offset , char* tok /* Only tok[0] considered for now! */ , char** pos , mcxbits mode cpl__unused , ofs len /* considered if >= 0 */ ) { mcxstatus status = STATUS_OK ; const char* x = offset, *z ; char *y = NULL ; if (len < 0) len = strlen(offset) ; z = offset + len ; *pos = NULL ; while (x < z) { if (*x == tok[0]) break ; switch(*x) { case '(' : case '{' : case '[' : if (!(status = mcxTokMatch(x, &y, 0, z-x))) x = y+1 ; break ; default : x++ ; break ; } if (status) break ; } if (!status) { *pos = (char*) x ; return *x == tok[0] ? STATUS_OK : STATUS_DONE ; } return STATUS_FAIL ; } void mcxTokFuncFree ( mcxTokFunc* tf ) { mcxTingFree(&(tf->key)) ; mcxListFree(&(tf->args), mcxTingFree_v) ; } mcxstatus mcxTokExpectFunc ( mcxTokFunc* tf , const char* str , dim str_len , char** z_pp , int n_min , int n_max , int *n_args ) { const char* me = "mcxTokExpectFunc" ; const char *z = str + str_len ; char *x = mcxTokSkip(str, isspace, str_len) /* signed issue */ ; char *y ; mcxTing* key = mcxTingEmpty(NULL, 20) ; mcxTing* args = mcxTingEmpty(NULL, 40) ; mcxstatus status = STATUS_FAIL ; mcxLink* src = NULL ; int ct = 0 ; *z_pp = NULL ; tf->key = NULL ; tf->args = NULL ; if (n_args) *n_args = 0 ; do { if (!x) { mcxErr(me, "no identifier at EOS") ; break ; } y = mcxStrChrAint(x, isalpha, z-x) ; if (y==x) { mcxErr(me, "expect identifier: <%s>", x) ; break ; } if (!y) { mcxErr(me, "lost identifier: <%s>", x) ; break ; } mcxTingNWrite(key, x, y-x) ; x = mcxTokSkip(y, isspace, z-y) ; if (!x || *x != '(') { mcxErr(me, "expect parenthesis: <%s>", x ? x : "EOS") ; break ; } if (mcxTokMatch(x, &y, 0, z-x)) { mcxErr(me, "error parsing <%s>", x) ; break ; } mcxTingNWrite(args, x+1, y-x-1) ; if (!(src = mcxTokArgs(args->str, args->len, &ct, tf->opts))) break ; if ( ( n_min >= 0 && ct < n_min ) || ( n_max >= 0 && ct > n_max ) ) { mcxErr ( me , "for key <%s>, arg count %d conflicts min/max %d/%d" , key->str , ct, n_min, n_max ) ; break ; } *z_pp = y+1 ; status = STATUS_OK ; } while (0) ; mcxTingFree(&args) ; if (status) { mcxTingFree(&key) ; mcxListFree(&src, mcxTingFree_v) ; } else { tf->key = key ; tf->args = src ; if (n_args) *n_args = ct ; } return status ; } mcxLink* mcxTokArgs ( const char* str , long str_len , int* n_args , mcxbits opts ) { mcxLink* src = mcxListSource(8, MCX_GRIM_ARITHMETIC) ; mcxLink* lk = src ; const char* x = str ; char* y = NULL ; const char* z = str + str_len ; mcxTing* arg = NULL ; int ct = 0 ; mcxstatus status = STATUS_FAIL ; while ((status = mcxTokFind(x, ",", &y, 0, z-x)) == STATUS_OK || y) { const char* l = x, *r = y ; if (opts & MCX_TOK_DEL_WS) { l = mcxStrChrAint(x, isspace, y-x) ; r = mcxStrRChrAint(x, isspace, y-x) ; if (l && r && l<=r) r++ ; else r = l = x ; } arg = mcxTingNNew(l, r-l) #if DEBUG ;fprintf(stderr, "adding <%s> [%d/ /%s]\n", arg->str, status, y) #endif ; lk = mcxLinkAfter(lk, arg) ; x = y+1 ; ct++ ; if (status) break ; } if (!y) { mcxErr("mcxTokArgs", "error occurred") ; mcxListFree(&src, mcxTingFree_v) ; return NULL ; } *n_args = ct ; return src ; } #ifndef DEBUG_DEFINED # undef DEBUG #else # undef DEBUG_DEFINED #endif apparix-11-062/util/tok.h000066400000000000000000000052061326043744200152010ustar00rootroot00000000000000/* (C) Copyright 2005, 2006, 2007, 2008, 2009 Stijn van Dongen * * This file is part of tingea. You can redistribute and/or modify tingea * under the terms of the GNU General Public License; either version 3 of the * License or (at your option) any later version. You should have received a * copy of the GPL along with tingea, in the file COPYING. */ #ifndef tingea_tok #define tingea_tok #include #include "inttypes.h" #include "types.h" #include "list.h" #include "ting.h" /* This is a first sketchy attempt at some parse/tokenize routines. * The scope is not very well defined yet. Should it do basic constructs * only, or aim for more power, possibly aided by callbacks, and * god forbid, a state description? * * TODO * quoted strings not yet implemented! * SGML not yet implemented! * * unify with mcxIOExpect, possibly stuff from ding.h * wide chars? */ #define MCX_TOK_MODE_UNIX 1 /* Unix escapes, including esc newlines */ #define MCX_TOK_MODE_QUOTED 2 /* Quotes delimit tokens, hide brackets */ #define MCX_TOK_MODE_PLAIN 4 #define MCX_TOK_MODE_SGML 8 /* &code; other? */ #define MCX_TOK_DEL_WS 16 /* only delimiting whitespace */ /* Returns first character not matching fbool, NULL if none. */ char* mcxTokSkip ( const char* offset , int (*fbool)(int c) , ofs len ) ; /* * Accounts for nesting. * Will do '}', ')', ']', '>', assuming one of several conventions. */ mcxstatus mcxTokMatch ( const char* offset , char** end , mcxbits mode , ofs len /* considered if >= 0 */ ) ; /* * Find some token, skipping over expressions. * Either *pos == NULL and retval == STATUS_FAIL * or *pos != NULL and retval == STATUS_OK * or *pos != NULL and retval == STATUS_DONE */ mcxstatus mcxTokFind ( const char* offset , char* tok /* Only tok[0] considered for now! */ , char** pos , mcxbits mode , ofs len /* considered if >= 0 */ ) ; /* fixme. - document; - add free routine. - then perhaps optify. */ mcxLink* mcxTokArgs ( const char* str , long str_len , int* n_args , mcxbits opts ) ; typedef struct { mcxTing* key ; mcxLink* args ; mcxbits opts ; } mcxTokFunc ; void mcxTokFuncFree ( mcxTokFunc* tf ) ; mcxstatus mcxTokExpectFunc ( mcxTokFunc* tf , const char* str , dim str_len , char** z , int n_min , int n_max , int *n_args ) ; #endif apparix-11-062/util/tr.c000066400000000000000000000564201326043744200150300ustar00rootroot00000000000000/* (C) Copyright 2005, 2006, 2007, 2008, 2009 Stijn van Dongen * * This file is part of tingea. You can redistribute and/or modify tingea * under the terms of the GNU General Public License; either version 3 of the * License or (at your option) any later version. You should have received a * copy of the GPL along with tingea, in the file COPYING. */ /* TODO * - xtr_get_token does not check repeat pointer. crashable? * - something that translates \012 to the byte value. * - write regression test. * - More error codes * - Have a magic repeat operator that does not stop on boundaries. * - Do sane things to implicit \0 (e.g. as result of complement) and * characters outside ascii range. * - [*a*256] leads to count 0. * # tr a-z A-C[*#*]X-Z will not (now nor ever) lookahead * - what about alpha tr(1) capabilities? * 6. In the POSIX locale, to translate all ASCII characters that are not * specified, enter: * tr -c '[ -~]' '[A-_]' newfile */ /* NOTE - only room for 256 classes including sentinels C_CLASSSTART C_CLASSEND - during tlt phase delete and squash bits are ignored and not respected */ /* randomly located documentation of intermediate and final tbl formats * * css class start sentinel * ces class end sentinel * rps repeat sentinel * rss range start sentinel * res range end sentinel * * Class: * css | class , i1, i2, i3, .. , ces | class * where i1 etc are to be mapped * * Repeat: * rss | value, count * * Range * rss | _ , i, i+1, i+2, i+3, .. , res | _ * * Final tbl format: value stored in lower 8 bits. * Higher bits may contain MCX_TR_TRANSLATE, MCX_TR_DELETE MCX_TR_SQUASH */ #include #include #include #include #include "tr.h" #include "ting.h" #include "types.h" #include "ding.h" #include "err.h" const char* X_REPEAT_UNEXPECTED = "repeat unexpected"; const char* X_REPEAT_SYNTAX = "repeat syntax"; const char* X_CLASS_UNKNOWN = "class unknown"; const char* X_CLASS_UNEXPECTED = "class unexpected"; const char* X_OCTAL_RANGE = "octal range"; const char* X_OCTAL_SYNTAX = "octal syntax"; const char* X_HEX_RANGE = "hex range"; const char* X_HEX_SYNTAX = "hex syntax"; const char* X_RANGE_INVERTED = "inverted range"; const char* mcx_tr_err = NULL; mcxbool mcx_tr_debug = FALSE; #define MAX_SPEC_INDEX 511 #define error_break break #define UC(c) ((unsigned char) *(c)) static const char* us = "tr"; enum { C_CLASSSTART = 1u , C_ALNUM , C_ALPHA , C_CNTRL , C_DIGIT , C_GRAPH , C_LOWER , C_PRINT , C_PUNCT , C_SPACE , C_UPPER , C_XDIGIT , C_CLASSEND /* 13 */ , C_RANGESTART , C_RANGEEND , C_REPEAT /* next token encodes repeat (stops on boundary)*/ , C_FLOOD /* next token encodeѕ flood (floods all) */ , C_EOF } ; #define ISCLASS(cl) ((cl) > C_CLASSSTART && (cl) < C_CLASSEND) #define ISREPEAT(cl) ((cl) == C_REPEAT || (cl) == C_FLOOD) #define ISUCHARRANGE(i) \ ( (i) >= 0 && (i) < 256 ) #define ISBOUNDARY(cl) \ ( (cl) == C_CLASSSTART || (cl) == C_CLASSEND \ || (cl) == C_RANGESTART || (cl) == C_RANGEEND ) #define ISSTART(cl) \ ( (cl) == C_CLASSSTART || (cl) == C_RANGESTART ) #define ISEND(cl) \ ( (cl) == C_CLASSEND || (cl) == C_RANGEEND ) #define ISUPPERSTART(tok) \ ( tok == ((C_CLASSSTART << 8) | C_UPPER) ) #define ISLOWERSTART(tok) \ ( tok == ((C_CLASSSTART << 8) | C_LOWER) ) int (*isit[13])(int c) = { NULL /* so C_CLASSVAL - C_CLASSSTART gives an index */ , isalnum , isalpha , iscntrl , isdigit , isgraph , islower , isprint , ispunct , isspace , isupper , isxdigit } ; mcxTing* mcxTRsplash ( mcxTR* tr , mcxbits bits ) { int i,j ; u32* tbl = tr->tlt ; mcxTing* splash = mcxTingEmpty(NULL, 256) ; for (i=1,j=0;i<256;i++) /* NOTE: \000 excluded */ { u32 tok = tbl[i] ; u32 meta = tok >> 8 ; if ( ((bits & MCX_TR_SOURCE) && (meta & MCX_TR_TRANSLATE)) || ((bits & MCX_TR_SOURCE_C) && ! (meta & MCX_TR_TRANSLATE)) || ((bits & MCX_TR_SQUASH) && (meta & MCX_TR_SQUASH)) || ((bits & MCX_TR_SQUASH_C) && ! (meta & MCX_TR_SQUASH)) || ((bits & MCX_TR_DELETE) && (meta & MCX_TR_DELETE)) || ((bits & MCX_TR_DELETE_C) && ! (meta & MCX_TR_DELETE)) ) splash->str[j++] = i ; } splash->str[j] = '\0' ; return splash ; } ofs mcxTRtranslate ( char* src , mcxTR* tr ) { dim i,j ; int prev = INT_MAX /* only relevant for squash case */ ; dim len = strlen(src) ; u32* tbl = tr->tlt ; for (i=0,j=0;i> 8) & MCX_TR_TRANSLATE ? idxmap : idx ; if ((tbl[val] >> 8) & MCX_TR_DELETE) continue ; if (!((tbl[val] >> 8) & MCX_TR_SQUASH) || val != prev) { *(src+j++) = (char) val ; prev = val ; } } *(src+j) = '\0' ; return (ofs) j ; } ofs mcxTingTranslate ( mcxTing* src , mcxTR* tr ) { src->len = mcxTRtranslate(src->str, tr) ; return src->len ; } /* fixme conceivably mcxTRtranslate could return -1 as * error condition. hum ho. */ ofs mcxTingTr ( mcxTing* txt , const char* src , const char* dst , const char* set_delete , const char* set_squash , mcxbits modes ) { mcxTR tr ; if (mcxTRloadTable(&tr, src, dst, set_delete, set_squash, modes)) return -1 ; txt->len = mcxTRtranslate(txt->str, &tr) ; return txt->len ; } static const char* xtr_get_token ( const char *p , const char *z , u8* classp , u8* valuep , int *repeat ) #define MCX_HEX(c) ( (c>='0' && c<='9') ? c-'0'\ : (c>='a' && c<='f') ? c-'a'+10\ : (c>='A' && c<='F') ? c-'A'+10\ : 0\ ) { int c = UC(p), d = 0, np = 0 ; mcxstatus status = STATUS_FAIL ; i32 value = 0, class = 0 /* need to be able to check overflow */ ; const char* me = "xtr_" "get_token" ; mcxbool class_ok = classp ? TRUE : FALSE ; if (classp) *classp = 0 ; if (valuep) *valuep = 0 ; if (repeat) *repeat = -1 ; while (1) { if (p >= z) break /*************************************************************************/ ; if (c == '\\') { if (p+1 >= z) error_break ; d = UC(p+1) ; if (strchr("0123", d)) { if ( p+3 >=z || !isdigit(UC(p+2)) || !isdigit(UC(p+3)) /* fixme 009 */ ) { mcx_tr_err = X_OCTAL_SYNTAX ; error_break ; } value = 64*(d-'0') + 8*(UC(p+2)-'0') + (UC(p+3)-'0') ; if (value > 0377) { mcx_tr_err = X_OCTAL_RANGE ; error_break ; } np = 4 ; } else if (d == 'x') { if ( p+3 >= z || !isxdigit(UC(p+2)) || !isxdigit(UC(p+3)) ) { mcx_tr_err = X_HEX_SYNTAX ; error_break ; } value = 16 * MCX_HEX(UC(p+2)) + MCX_HEX(UC(p+3)) ; np = 4 ; } else if (strchr("\\abfnrtv", d)) { np = 2 ; switch(d) { case 'a' : value = 07 ; break ; case 'b' : value = 010 ; break ; case 'f' : value = 014 ; break ; case 'n' : value = 012 ; break ; case 'r' : value = 015 ; break ; case 't' : value = 011 ; break ; case 'v' : value = 013 ; break ; case '\\': value = 0134; break ; default : value = '?' ; break /* impossible */ ; } } else { value= d ; np = 2 ; } } /* case '\\' */ /*************************************************************************/ else if (c == '[') { if (!class_ok) /* fixme: could just accept '[' */ { mcx_tr_err = X_CLASS_UNEXPECTED ; error_break ; } /* * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * */ else if (p+1 < z && UC(p+1) == ':') { if (!strncmp(p+2, "alpha:]", 7)) class = C_ALPHA, np = 4+ 5 ; else if (!strncmp(p+2, "alnum:]", 7)) class = C_ALNUM, np = 4+ 5 ; else if (!strncmp(p+2, "digit:]", 7)) class = C_DIGIT, np = 4+ 5 ; else if (!strncmp(p+2, "cntrl:]", 7)) class = C_CNTRL, np = 4+ 5 ; else if (!strncmp(p+2, "graph:]", 7)) class = C_GRAPH, np = 4+ 5 ; else if (!strncmp(p+2, "lower:]", 7)) class = C_LOWER, np = 4+ 5 ; else if (!strncmp(p+2, "print:]", 7)) class = C_PRINT, np = 4+ 5 ; else if (!strncmp(p+2, "punct:]", 7)) class = C_PUNCT, np = 4+ 5 ; else if (!strncmp(p+2, "space:]", 7)) class = C_SPACE, np = 4+ 5 ; else if (!strncmp(p+2, "upper:]", 7)) class = C_UPPER, np = 4+ 5 ; else if (!strncmp(p+2, "xdigit:]", 8)) class = C_XDIGIT, np = 4+ 6 ; else { mcx_tr_err = X_CLASS_UNKNOWN ; break ; } } /* * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * */ else if (p+1 < z && UC(p+1) == '*') { int num = 0 ; u8 value2 = 0 ; const char* q = NULL ; if (p+2 >= z) { mcx_tr_err = X_REPEAT_SYNTAX ; error_break ; } if (!(q = xtr_get_token(p+2, z, NULL, &value2, NULL))) error_break ; if (UC(q) == '*' && UC(q+1) == ']') class = C_FLOOD ; else if ( (UC(q) == '#' && UC(q+1) == ']') || (UC(q) == '*') ) class = C_REPEAT ; else { mcx_tr_err = X_REPEAT_SYNTAX ; error_break ; } if (UC(q+1) == ']') { *repeat = 0 ; q++ ; } else { if (sscanf(q+1, "%d]", &num) != 1) break ; if (!(q = strchr(q, ']'))) break ; if (num < 0 || num > 256) break ; *repeat = num ; if (!num) class = C_FLOOD ; } /* q[0] should be ']' now */ value = value2 ; np = (q+1) - p /* truncintok */ ; } /* * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * */ else break ; } /*************************************************************************/ else { value = c ; np = 1 ; } status = STATUS_OK ; break ; } if (status) { mcxErr(me, "error at char (%c)", UC(p)) ; return NULL ; } if (mcx_tr_debug) fprintf(stdout, "xtr_get_token (%d | %d)\n", (int) value, (int) class) ; if (classp) *classp = class ; if (valuep) *valuep = value ; return p + np ; } char* mcxStrEscapedValue ( const char* p , const char* z , int *value ) { u8 val = p[0] ; const char* q = NULL ; if (val != '\\') { *value = val ; return (char*) (p+1) ; } if (!(q = xtr_get_token(p, z, NULL, &val, NULL))) return NULL ; *value = val ; return (char*) q ; } /* Sets either * value to something in the range 0-255 and length * to something >= 1 * or * value to one of the constants C_ALPHA etc and length to 0. * * Returns the next parsable character or NULL for failure. */ static const char* xtr_get_set ( const char *p , const char *z , u8 *classp , u8 *valuep , int *countp ) { const char* q = xtr_get_token(p, z, classp, valuep, countp) ; if (!q) return NULL ; if (!*classp && *q == '-') { u8 range_top = 0 ; q = xtr_get_token(q+1, z, NULL, &range_top, NULL) ; if (!q) return NULL ; if (range_top < *valuep) { mcx_tr_err = X_RANGE_INVERTED ; return NULL ; } *countp = range_top - *valuep + 1 ; } else if (!*classp) *countp = 1 /* else it is a repeat class or .. */ ; return q ; } static void mcx_tr_enc_dump ( u32* enc , const char* tag ) { int i = 0 ; fprintf(stdout, "(dumping %s\n", tag) ; while (i> 8 ; int val = enc[i] & 0377 ; fprintf(stdout, "%6d%6d%6d\n", i, meta, val) ; if (meta == C_EOF) break ; i++ ; } fprintf(stdout, ")\n") ; } static mcxstatus xtr_get_spec ( const char* spec , u32* tbl /* size MAX_SPEC_INDEX+1 */ , mcxbool repeat_ok /* doubles as true for dst, false for src, ugly! */ ) { const char* p = spec ; const char* z = spec + strlen(spec) ; int offset=0, i=0 ; mcxstatus status = STATUS_FAIL ; while (1) { u8 value = 0 ; u8 class = 0 ; int count = -1 ; status = STATUS_OK ; if (p >= z) break ; status = STATUS_FAIL /* space for 1 token; check anything longer. * (reserve space for EOF token) */ ; if (offset >= MAX_SPEC_INDEX) break ; if (!(p = xtr_get_set(p, z, &class, &value, &count))) break ; if (ISREPEAT(class) && count >= 0) { if (!repeat_ok) { mcx_tr_err = X_REPEAT_UNEXPECTED ; break ; } tbl[offset++] = (class << 8) | value ; if (offset >= MAX_SPEC_INDEX) break ; tbl[offset++] = count & 0377 ; } else if (ISCLASS(class)) { int (*innit)(int) = isit[class - C_CLASSSTART] ; tbl[offset++] = (C_CLASSSTART << 8 ) | class ; for (i=0;i<256;i++) { if (innit(i)) { if (offset >= MAX_SPEC_INDEX) break ; tbl[offset++] = i ; } } if (i != 256) break ; if (offset >= MAX_SPEC_INDEX) break ; tbl[offset++] = (C_CLASSEND << 8) | class ; } else if (count > 1) { tbl[offset++] = (C_RANGESTART << 8) ; for (i=value;i= MAX_SPEC_INDEX) break ; tbl[offset++] = i ; } if (i != value+count) break ; if (offset >= MAX_SPEC_INDEX) break ; tbl[offset++] = C_RANGEEND << 8 ; } else tbl[offset++] = value ; status = STATUS_OK ; } tbl[offset++] = C_EOF << 8 ; if (status || p!=z) { mcxErr(us, "error!") ; return STATUS_FAIL ; } return STATUS_OK ; } static mcxstatus mcx_tr_encode_boolean ( mcxTR* tr , u32* enc , mcxbits bit ) { int i ; for (i=0;i> 8 ; int value = enc[i] & 0377 ; if (class == C_EOF) break ; if (class) continue ; tr->tlt[value] |= bit << 8 ; } return STATUS_OK ; } static mcxstatus mcx_tr_translate_encode ( mcxTR* tr , u32* srcenc , u32* dstenc ) { int X = -1, Y = -1 ; int s = 0, d = 0 ; int star_count = 0 ; mcxbool star_fill = FALSE , flood_fill = FALSE , src_end = FALSE , dst_end = FALSE , to_lower = FALSE , to_upper = FALSE , src_class_end = FALSE ; while (1) { u32 src_tok = 0 ; u32 src_cls = 0 ; u32 src_val = 0 ; u32 dst_tok = 0 ; u32 dst_cls = 0 ; u32 dst_val = 0 ; src_class_end = FALSE ; if (s >= MAX_SPEC_INDEX || d >= MAX_SPEC_INDEX) { mcxErr(us, "panic off the rails") ; break ; } if (X >= 0 && Y >= 0) { tr->tlt[X] = Y | (MCX_TR_TRANSLATE << 8) ;if (mcx_tr_debug) fprintf(stdout, "map %d to %d\n", X, Y) ; X = -1 ; if (star_count) star_count-- ; if (!star_count && !star_fill && !flood_fill) Y = -1 ; } else if (s || d) mcxErr(us, "fimbly feeling") /* skip ends, unset star_fill if necessary */ ; src_tok = srcenc[s++] ; src_cls = src_tok >> 8 ; src_val = src_tok & 0377 /* consider both * tring -x 'abcdef[:digit:]' -y '[*_#][*##]' (magic ends with f) * tring -x '[:digit:]abcdef' -y '[*##][*_#]' (magic ends before a) */ ; if (ISBOUNDARY(src_cls)) star_fill = FALSE ; if (ISEND(src_cls)) src_tok = srcenc[s++] , src_cls = src_tok >> 8 , src_val = src_tok & 0377 , src_class_end = TRUE ; if (!star_count && !star_fill && !flood_fill) { dst_tok = dstenc[d++] ; dst_cls = dst_tok >> 8 ; dst_val = dst_tok & 0377 ; if (ISEND(dst_cls)) dst_tok = dstenc[d++] , dst_cls = dst_tok >> 8 , dst_val = dst_tok & 0377 ; } ;if (mcx_tr_debug) fprintf(stdout, "have %3d %3d %3d %3d\n", (int) src_cls, (int) src_val, (int) dst_cls, (int) dst_val); /* check class/range conditions. */ if (ISLOWERSTART(src_tok) && ISUPPERSTART(dst_tok)) to_upper = TRUE ; else if (ISUPPERSTART(src_tok) && ISLOWERSTART(dst_tok)) to_lower = TRUE ; else if ((to_upper || to_lower) && src_class_end) to_lower = FALSE , to_upper = FALSE /* check repeat */ ; if (ISREPEAT(dst_cls)) { Y = dst_val ; star_count = dstenc[d++] ; if (dst_cls == C_FLOOD) flood_fill = TRUE ; else if (!star_count) star_fill = TRUE ;if (mcx_tr_debug) fprintf(stdout, "star count/fill/flood %d %d %d\n", star_count, star_fill, flood_fill) ; } ;if (mcx_tr_debug && (to_upper || to_lower)) fprintf(stdout, "case mapping\n") ; if (!star_count && !star_fill && !flood_fill) { if (ISSTART(dst_cls)) Y = dstenc[d++] ; else Y = dst_val ; } if (ISSTART(src_cls)) X = srcenc[s++] ; else X = src_val ; if (!ISUCHARRANGE(X) || !ISUCHARRANGE(Y)) mcxErr(us, "panic %d %d", X, Y) , X = 0 , Y = 0 ; if (to_lower) { if (!isupper(X)) { mcxErr(us, "panic %d not lower", X) ; X = 0, Y = 0 ; } else Y = tolower(X) ; } else if (to_upper) { if (!islower(X)) { mcxErr(us, "panic %d not upper", X) ; X = 0, Y = 0 ; } else Y = toupper(X) ; } src_end = src_cls == C_EOF ; dst_end = dst_cls == C_EOF ; if (src_end || dst_end) break ; } if (!src_end) mcxErr(us, "trailing fluff in src") ; if (!dst_end && !((star_fill || flood_fill) && dstenc[d] >> 8 == C_EOF)) mcxErr(us, "trailing fluff in dst") ; return STATUS_OK /* specs parsed alright, just ignore spurious stuff */ ; } static void mcx_tr_complement ( u32* enc ) { u32 tmp[256] ; int i = 0 ; int j = 0 ; int delta = 1 ; for (i=0;i<256;i++) tmp[i] = 0 ; for (i=0;i<=MAX_SPEC_INDEX;i+=delta) { int class = enc[i] >> 8 ; int value = enc[i] & 0377 ; if (ISREPEAT(class)) { delta = 2 ; mcxErr(us, "value taken but repeat ignored in complement") ; tmp[value] = 1 ; continue ; } else if (ISBOUNDARY(class)) /* nada */ ; else tmp[value] = 1 ; delta = 1 ; } for (i=0;i<256;i++) if (!tmp[i]) enc[j++] = i ; enc[j++] = C_EOF << 8 ; while (j<=MAX_SPEC_INDEX) enc[j++] = C_EOF << 8 ; } /* * the enc arrays use stop and end tokens for ranges and classes. both are * required to have more than 1 element. No more than MAX_SPEC_INDEX+1 * positions are allocated for either specification, which also cater for * start and end and EOF tokens - the +1 is for the EOF token. * * carryon */ static mcxstatus mcx_tr_encode ( mcxTR* tr , const char* src , const char* dst , const char* set_delete , const char* set_squash ) { u32 srcenc[MAX_SPEC_INDEX+1] ; u32 dstenc[MAX_SPEC_INDEX+1] ; int i ; if (src && dst) { for (i=0;i<=MAX_SPEC_INDEX;i++) srcenc[i] = 0 , dstenc[i] = 0 ; if (xtr_get_spec(src, srcenc, FALSE)) return STATUS_FAIL ; if (mcx_tr_debug) mcx_tr_enc_dump(srcenc, "source") ; if (tr->modes & MCX_TR_SOURCE_C) mcx_tr_complement(srcenc) ; if (xtr_get_spec(dst, dstenc, TRUE)) return STATUS_FAIL ; if (mcx_tr_debug) mcx_tr_enc_dump(dstenc, "destination") ; if (tr->modes & MCX_TR_DEST_C) mcx_tr_complement(dstenc) ; if (mcx_tr_translate_encode(tr, srcenc, dstenc)) return STATUS_FAIL ; } if (set_delete) { for (i=0;i<=MAX_SPEC_INDEX;i++) srcenc[i] = 0 ; if (xtr_get_spec(set_delete, srcenc, FALSE)) return STATUS_FAIL ; if (mcx_tr_debug) mcx_tr_enc_dump(srcenc, "delete") ; if (tr->modes & MCX_TR_DELETE_C) mcx_tr_complement(srcenc) ; mcx_tr_encode_boolean(tr, srcenc, MCX_TR_DELETE) ; } if (set_squash) { for (i=0;i<=MAX_SPEC_INDEX;i++) srcenc[i] = 0 ; if (xtr_get_spec(set_squash, srcenc, FALSE)) return STATUS_FAIL ; if (mcx_tr_debug) mcx_tr_enc_dump(srcenc, "squash") ; if (tr->modes & MCX_TR_SQUASH_C) mcx_tr_complement(srcenc) ; mcx_tr_encode_boolean(tr, srcenc, MCX_TR_SQUASH) ; } return STATUS_OK ; } mcxstatus mcxTRloadTable ( mcxTR* tr , const char* src , const char* dst , const char* set_delete , const char* set_squash , mcxbits modes ) { const char* me = "mcxTRloadTable" ; int i ; mcx_tr_err = NULL ; if (src && UC(src) == '^') src++ , modes |= MCX_TR_SOURCE_C ; if (dst && UC(dst) == '^') dst++ , modes |= MCX_TR_DEST_C ; if (src && dst) modes |= MCX_TR_TRANSLATE ; if (set_delete) { if (UC(set_delete) == '^') set_delete++ , modes |= MCX_TR_DELETE_C ; modes |= MCX_TR_DELETE ; } ; if (set_squash) { if (UC(set_squash) == '^') set_squash++ , modes |= MCX_TR_SQUASH_C ; modes |= MCX_TR_SQUASH ; } tr->modes = modes ; for (i=0;i<256;i++) tr->tlt[i] = 0 ; if (src && !dst) { mcxErr(me, "src requires dst") ; return STATUS_FAIL ; } return mcx_tr_encode(tr, src, dst, set_delete, set_squash) ; } apparix-11-062/util/tr.h000066400000000000000000000103731326043744200150320ustar00rootroot00000000000000/* (C) Copyright 2005, 2006, 2007, 2008, 2009 Stijn van Dongen * * This file is part of tingea. You can redistribute and/or modify tingea under * the terms of the GNU General Public License; either version 3 of the License * or (at your option) any later version. You should have received a copy of * the GPL along with tingea, in the file COPYING. */ #ifndef tingea_tr #define tingea_tr #include #include "ting.h" #include "types.h" #include "inttypes.h" /* * README * This interface is not POSIX compliant. It might evolve to * optionally be indeed. * However, given some of the braindeadliness of POSIX tr compliance, * I don't think the worlds needs another tr implementation. * My gripe is mainly about derailed syntax such as '[:alpha:0'. * It should go down in a ball of flames, not happily parse. * To be honest, I don't know for sure whether this is a POSIX * lack of requirement or an implementation choice. * * I did choose to follow most of the POSIX syntax. It is probably * a sign of weakness. * This interface should be able to do everything a POSIX interface can, * possibly more. * * - It allows separate specification of src, dst, del and squash sets. * - Provisionally we accept "^spec" to indicate complement, * for any of src dst del squash sets. * - It uses [*c*20] to denote repeats, rather than [c*20]. * rationale: do not slam door shut on new syntax. * - It does not recognize '[a-z]' ranges, only 'a-z'. * rationale: none. If ever, notation will be [-a-z] or similar. * - The magic repeat operator [*c#] stops on boundaries * rationale: I like it. * A boundary is introduced by stop/start of ranges and classes. * - The magic repeat operator [*c*] does not stop on boundaries. * - For now, the interface does 1) deletion, 2) translation, 3) squashing. * in the future it may provide a custom order of doing things. * * * Apart from the fact that you cannot have '\0' in C strings, everything * here should work for '\0' as well - specifically the mcxTrTable structure. * However, the current interface uses C strings for dst and src and C strings * for data. * * More documentation to follow. * */ extern const char* mcx_tr_err; extern mcxbool mcx_tr_debug; typedef struct { u32 tlt[256] ; mcxbits modes ; } mcxTR ; #define MCX_TR_DEFAULT 0 #define MCX_TR_TRANSLATE 1 << 1 #define MCX_TR_SOURCE 1 << 2 #define MCX_TR_DEST 1 << 3 #define MCX_TR_SQUASH 1 << 4 #define MCX_TR_DELETE 1 << 5 #define MCX_TR_SOURCE_C 1 << 6 #define MCX_TR_DEST_C 1 << 7 #define MCX_TR_DELETE_C 1 << 8 #define MCX_TR_SQUASH_C 1 << 9 #define MCX_TR_COMPLEMENT 1 << 10 mcxstatus mcxTRloadTable ( mcxTR* tr , const char* src , const char* dst , const char* set_delete , const char* set_squash , mcxbits modes ) ; /* returns new length of string. * fixme: document map/squash semantics. */ ofs mcxTRtranslate ( char* src , mcxTR* tr ) ; ofs mcxTingTranslate ( mcxTing* src , mcxTR* tr ) ; ofs mcxTingTr ( mcxTing* txt , const char* src , const char* dst , const char* set_delete , const char* set_squash , mcxbits flags ) ; /* Accepts e.g. \012 and sets *value to 10. * idem \xa0 and \n (\t, \r, \b etc) * Does *not* yet accept \0xa0 * * Returns next parsable character. * * This interface should be moved to ding. */ char* mcxStrEscapedValue ( const char* p , const char* z , int *value ) ; /* * returns a ting containing all the characters according to bits. * bits accept * MCX_TR_SOURCE * MCX_TR_SOURCE_C * MCX_TR_SQUASH * MCX_TR_SQUASH_C * MCX_TR_DELETE * MCX_TR_DELETE_C * * NOTE * MCX_TR_DEST * MCX_TR_DEST_C * are not yet implemented. * * NOTE DANGER SIGN * tr no longer contains information on complements that were * used in constructing it. * The complements that bits refer to is simply the information * present in tr. * So a source of "^a-z" given to mcxTRloadTable * and MCX_TR_SOURCE_C given to mcxTRsplash * result in a string containing all of a-z. */ mcxTing* mcxTRsplash ( mcxTR* tr , mcxbits bits ) ; #endif apparix-11-062/util/types.c000066400000000000000000000007761326043744200155520ustar00rootroot00000000000000/* (C) Copyright 2008, 2009 Stijn van Dongen * * This file is part of tingea. You can redistribute and/or modify tingea * under the terms of the GNU General Public License; either version 3 of the * License or (at your option) any later version. You should have received a * copy of the GPL along with tingea, in the file COPYING. */ #include "types.h" const char* mcx_status_list[] = { "OK" , "FAIL" , "DONE" , "IGNORE" , "NOMEM" , "ABORT" , "NEW" , "UNUSED" } ; apparix-11-062/util/types.h000066400000000000000000000054301326043744200155470ustar00rootroot00000000000000/* (C) Copyright 2000, 2001, 2002, 2003, 2004, 2005 Stijn van Dongen * (C) Copyright 2006, 2007, 2008, 2009 Stijn van Dongen * * This file is part of tingea. You can redistribute and/or modify tingea * under the terms of the GNU General Public License; either version 3 of the * License or (at your option) any later version. You should have received a * copy of the GPL along with tingea, in the file COPYING. */ #ifndef types_h #define types_h #include "inttypes.h" typedef unsigned long mcxbits ; typedef unsigned long mcxmode ; typedef unsigned long mcxenum ; /* mcxstatus defined below */ /* mcxbool defined below */ #define BIT_ON(var,bits) (var) |= (bits) #define BIT_OFF(var, bits) do { (var) |= (bits); (var) ^= (bits); } while (0) #define ALL_BITS_OFF 0 #define VOID_TO_UINT (unsigned) #define UINT_TO_VOID (void*) #define VOID_TO_ULONG (unsigned long) #define ULONG_TO_VOID (void*) #define NOTHING do { } while (0) /* ************************************************************************** * * ** Implementation notes (a few). * * * The intent is that routines that return mcxstatus can define their own * values, so one must check the interface of a given routine as to what kind * of symbolic values it may return. * * For example, the opt library defines MCX_OPT_OK, MCX_OPT_NOARG, and * MCX_OPT_UNKNOWN. * * The intent is also that the OK value is always defined as zero -- it's * not the zero that counts but the fact that all OK values (e.g. STATUS_OK, * MCX_OPT_OK etc) are equal. One should be able to count on this. * If multiple ok values are possible, use one of mcxenum, mcxbits, mcxmode. * */ typedef enum { STATUS_OK = 0 , STATUS_FAIL , STATUS_DONE /* for iterator type interfaces (e.g. readLine) */ , STATUS_IGNORE /* for iterator type interfaces (line parser) */ , STATUS_NOMEM , STATUS_ABORT /* e.g. user response */ , STATUS_NEW /* for cache type interfaces */ , STATUS_UNUSED /* use this as lower bound for new statuses */ } mcxstatus ; extern const char* mcx_status_list[]; #define MCXSTATUS(status) \ ( status <= STATUS_UNUSED \ ? mcx_status_list[status] \ : "NO_such_status!" \ ) #ifndef FALSE typedef enum { FALSE = 0 , TRUE = 1 } mcxbool ; #else typedef int mcxbool ; #endif typedef enum { RETURN_ON_FAIL = 1960 , EXIT_ON_FAIL , SLEEP_ON_FAIL , ENQUIRE_ON_FAIL /* user sets TINGEA_MEM_DO to e.g. exit or retry */ } mcxOnFail ; #define MCX_DATUM_THREADING 1 #define MCX_DATUM_FIND 2 #define MCX_DATUM_INSERT 4 #define MCX_DATUM_DELETE 8 #endif