From: Kibum Kim Date: Fri, 6 Jan 2012 15:44:20 +0000 (+0900) Subject: Git init X-Git-Tag: 2.0_alpha~3 X-Git-Url: http://review.tizen.org/git/?a=commitdiff_plain;h=90930ee2e190d9e9dbc9625d4300d99e03833638;p=external%2Fcheck.git Git init --- diff --git a/AUTHORS b/AUTHORS new file mode 100644 index 0000000..d6ee6cd --- /dev/null +++ b/AUTHORS @@ -0,0 +1,20 @@ +Author: Arien Malec + +Maintainers: Fredrik Hugosson + Sven Neumann + +Patches: Bernhard Reiter (configure issues) + Neil Spring (const fixes) + Rick Poyner (pipe handling, bug fixes) + Dietmar Petras (bug fixes) + Gilgamesh Nootebos (bug fixes) + Frederic Peters (XML output) + Lucas Di Pentima and Cesar Ballardini (signals) + Chris Pickett (GNU Build System update) + Robert Lemmen (gcov description in manual) + Loic Martin (AM_PATH_CHECK patch) + Ross Burton (pkg-config patch) + +Anybody who has contributed code to Check or Check's build system is +considered an author. Send patches to this file to +. diff --git a/COPYING.LESSER b/COPYING.LESSER new file mode 100644 index 0000000..2d2d780 --- /dev/null +++ b/COPYING.LESSER @@ -0,0 +1,510 @@ + + GNU LESSER GENERAL PUBLIC LICENSE + Version 2.1, February 1999 + + Copyright (C) 1991, 1999 Free Software Foundation, Inc. + 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA + Everyone is permitted to copy and distribute verbatim copies + of this license document, but changing it is not allowed. + +[This is the first released version of the Lesser GPL. It also counts + as the successor of the GNU Library Public License, version 2, hence + the version number 2.1.] + + Preamble + + The licenses for most software are designed to take away your +freedom to share and change it. By contrast, the GNU General Public +Licenses are intended to guarantee your freedom to share and change +free software--to make sure the software is free for all its users. + + This license, the Lesser General Public License, applies to some +specially designated software packages--typically libraries--of the +Free Software Foundation and other authors who decide to use it. You +can use it too, but we suggest you first think carefully about whether +this license or the ordinary General Public License is the better +strategy to use in any particular case, based on the explanations +below. + + When we speak of free software, we are referring to freedom of use, +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 and use pieces of +it in new free programs; and that you are informed that you can do +these things. + + To protect your rights, we need to make restrictions that forbid +distributors to deny you these rights or to ask you to surrender these +rights. These restrictions translate to certain responsibilities for +you if you distribute copies of the library or if you modify it. + + For example, if you distribute copies of the library, whether gratis +or for a fee, you must give the recipients all the rights that we gave +you. You must make sure that they, too, receive or can get the source +code. If you link other code with the library, you must provide +complete object files to the recipients, so that they can relink them +with the library after making changes to the library and recompiling +it. And you must show them these terms so they know their rights. + + We protect your rights with a two-step method: (1) we copyright the +library, and (2) we offer you this license, which gives you legal +permission to copy, distribute and/or modify the library. + + To protect each distributor, we want to make it very clear that +there is no warranty for the free library. Also, if the library is +modified by someone else and passed on, the recipients should know +that what they have is not the original version, so that the original +author's reputation will not be affected by problems that might be +introduced by others. + + Finally, software patents pose a constant threat to the existence of +any free program. We wish to make sure that a company cannot +effectively restrict the users of a free program by obtaining a +restrictive license from a patent holder. Therefore, we insist that +any patent license obtained for a version of the library must be +consistent with the full freedom of use specified in this license. + + Most GNU software, including some libraries, is covered by the +ordinary GNU General Public License. This license, the GNU Lesser +General Public License, applies to certain designated libraries, and +is quite different from the ordinary General Public License. We use +this license for certain libraries in order to permit linking those +libraries into non-free programs. + + When a program is linked with a library, whether statically or using +a shared library, the combination of the two is legally speaking a +combined work, a derivative of the original library. The ordinary +General Public License therefore permits such linking only if the +entire combination fits its criteria of freedom. The Lesser General +Public License permits more lax criteria for linking other code with +the library. + + We call this license the "Lesser" General Public License because it +does Less to protect the user's freedom than the ordinary General +Public License. It also provides other free software developers Less +of an advantage over competing non-free programs. These disadvantages +are the reason we use the ordinary General Public License for many +libraries. However, the Lesser license provides advantages in certain +special circumstances. + + For example, on rare occasions, there may be a special need to +encourage the widest possible use of a certain library, so that it +becomes a de-facto standard. To achieve this, non-free programs must +be allowed to use the library. A more frequent case is that a free +library does the same job as widely used non-free libraries. In this +case, there is little to gain by limiting the free library to free +software only, so we use the Lesser General Public License. + + In other cases, permission to use a particular library in non-free +programs enables a greater number of people to use a large body of +free software. For example, permission to use the GNU C Library in +non-free programs enables many more people to use the whole GNU +operating system, as well as its variant, the GNU/Linux operating +system. + + Although the Lesser General Public License is Less protective of the +users' freedom, it does ensure that the user of a program that is +linked with the Library has the freedom and the wherewithal to run +that program using a modified version of the Library. + + The precise terms and conditions for copying, distribution and +modification follow. Pay close attention to the difference between a +"work based on the library" and a "work that uses the library". The +former contains code derived from the library, whereas the latter must +be combined with the library in order to run. + + GNU LESSER GENERAL PUBLIC LICENSE + TERMS AND CONDITIONS FOR COPYING, DISTRIBUTION AND MODIFICATION + + 0. This License Agreement applies to any software library or other +program which contains a notice placed by the copyright holder or +other authorized party saying it may be distributed under the terms of +this Lesser General Public License (also called "this License"). +Each licensee is addressed as "you". + + A "library" means a collection of software functions and/or data +prepared so as to be conveniently linked with application programs +(which use some of those functions and data) to form executables. + + The "Library", below, refers to any such software library or work +which has been distributed under these terms. A "work based on the +Library" means either the Library or any derivative work under +copyright law: that is to say, a work containing the Library or a +portion of it, either verbatim or with modifications and/or translated +straightforwardly into another language. (Hereinafter, translation is +included without limitation in the term "modification".) + + "Source code" for a work means the preferred form of the work for +making modifications to it. For a library, 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 library. + + Activities other than copying, distribution and modification are not +covered by this License; they are outside its scope. The act of +running a program using the Library is not restricted, and output from +such a program is covered only if its contents constitute a work based +on the Library (independent of the use of the Library in a tool for +writing it). Whether that is true depends on what the Library does +and what the program that uses the Library does. + + 1. You may copy and distribute verbatim copies of the Library's +complete 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 distribute a copy of this License along with the +Library. + + 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 Library or any portion +of it, thus forming a work based on the Library, 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) The modified work must itself be a software library. + + b) You must cause the files modified to carry prominent notices + stating that you changed the files and the date of any change. + + c) You must cause the whole of the work to be licensed at no + charge to all third parties under the terms of this License. + + d) If a facility in the modified Library refers to a function or a + table of data to be supplied by an application program that uses + the facility, other than as an argument passed when the facility + is invoked, then you must make a good faith effort to ensure that, + in the event an application does not supply such function or + table, the facility still operates, and performs whatever part of + its purpose remains meaningful. + + (For example, a function in a library to compute square roots has + a purpose that is entirely well-defined independent of the + application. Therefore, Subsection 2d requires that any + application-supplied function or table used by this function must + be optional: if the application does not supply it, the square + root function must still compute square roots.) + +These requirements apply to the modified work as a whole. If +identifiable sections of that work are not derived from the Library, +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 Library, 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 Library. + +In addition, mere aggregation of another work not based on the Library +with the Library (or with a work based on the Library) on a volume of +a storage or distribution medium does not bring the other work under +the scope of this License. + + 3. You may opt to apply the terms of the ordinary GNU General Public +License instead of this License to a given copy of the Library. To do +this, you must alter all the notices that refer to this License, so +that they refer to the ordinary GNU General Public License, version 2, +instead of to this License. (If a newer version than version 2 of the +ordinary GNU General Public License has appeared, then you can specify +that version instead if you wish.) Do not make any other change in +these notices. + + Once this change is made in a given copy, it is irreversible for +that copy, so the ordinary GNU General Public License applies to all +subsequent copies and derivative works made from that copy. + + This option is useful when you wish to copy part of the code of +the Library into a program that is not a library. + + 4. You may copy and distribute the Library (or a portion or +derivative of it, under Section 2) in object code or executable form +under the terms of Sections 1 and 2 above provided that you 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. + + If distribution of 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 satisfies the requirement to +distribute the source code, even though third parties are not +compelled to copy the source along with the object code. + + 5. A program that contains no derivative of any portion of the +Library, but is designed to work with the Library by being compiled or +linked with it, is called a "work that uses the Library". Such a +work, in isolation, is not a derivative work of the Library, and +therefore falls outside the scope of this License. + + However, linking a "work that uses the Library" with the Library +creates an executable that is a derivative of the Library (because it +contains portions of the Library), rather than a "work that uses the +library". The executable is therefore covered by this License. +Section 6 states terms for distribution of such executables. + + When a "work that uses the Library" uses material from a header file +that is part of the Library, the object code for the work may be a +derivative work of the Library even though the source code is not. +Whether this is true is especially significant if the work can be +linked without the Library, or if the work is itself a library. The +threshold for this to be true is not precisely defined by law. + + If such an object file uses only numerical parameters, data +structure layouts and accessors, and small macros and small inline +functions (ten lines or less in length), then the use of the object +file is unrestricted, regardless of whether it is legally a derivative +work. (Executables containing this object code plus portions of the +Library will still fall under Section 6.) + + Otherwise, if the work is a derivative of the Library, you may +distribute the object code for the work under the terms of Section 6. +Any executables containing that work also fall under Section 6, +whether or not they are linked directly with the Library itself. + + 6. As an exception to the Sections above, you may also combine or +link a "work that uses the Library" with the Library to produce a +work containing portions of the Library, and distribute that work +under terms of your choice, provided that the terms permit +modification of the work for the customer's own use and reverse +engineering for debugging such modifications. + + You must give prominent notice with each copy of the work that the +Library is used in it and that the Library and its use are covered by +this License. You must supply a copy of this License. If the work +during execution displays copyright notices, you must include the +copyright notice for the Library among them, as well as a reference +directing the user to the copy of this License. Also, you must do one +of these things: + + a) Accompany the work with the complete corresponding + machine-readable source code for the Library including whatever + changes were used in the work (which must be distributed under + Sections 1 and 2 above); and, if the work is an executable linked + with the Library, with the complete machine-readable "work that + uses the Library", as object code and/or source code, so that the + user can modify the Library and then relink to produce a modified + executable containing the modified Library. (It is understood + that the user who changes the contents of definitions files in the + Library will not necessarily be able to recompile the application + to use the modified definitions.) + + b) Use a suitable shared library mechanism for linking with the + Library. A suitable mechanism is one that (1) uses at run time a + copy of the library already present on the user's computer system, + rather than copying library functions into the executable, and (2) + will operate properly with a modified version of the library, if + the user installs one, as long as the modified version is + interface-compatible with the version that the work was made with. + + c) Accompany the work with a written offer, valid for at least + three years, to give the same user the materials specified in + Subsection 6a, above, for a charge no more than the cost of + performing this distribution. + + d) If distribution of the work is made by offering access to copy + from a designated place, offer equivalent access to copy the above + specified materials from the same place. + + e) Verify that the user has already received a copy of these + materials or that you have already sent this user a copy. + + For an executable, the required form of the "work that uses the +Library" must include any data and utility programs needed for +reproducing the executable from it. However, as a special exception, +the materials to be 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. + + It may happen that this requirement contradicts the license +restrictions of other proprietary libraries that do not normally +accompany the operating system. Such a contradiction means you cannot +use both them and the Library together in an executable that you +distribute. + + 7. You may place library facilities that are a work based on the +Library side-by-side in a single library together with other library +facilities not covered by this License, and distribute such a combined +library, provided that the separate distribution of the work based on +the Library and of the other library facilities is otherwise +permitted, and provided that you do these two things: + + a) Accompany the combined library with a copy of the same work + based on the Library, uncombined with any other library + facilities. This must be distributed under the terms of the + Sections above. + + b) Give prominent notice with the combined library of the fact + that part of it is a work based on the Library, and explaining + where to find the accompanying uncombined form of the same work. + + 8. You may not copy, modify, sublicense, link with, or distribute +the Library except as expressly provided under this License. Any +attempt otherwise to copy, modify, sublicense, link with, or +distribute the Library 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. + + 9. 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 Library or its derivative works. These actions are +prohibited by law if you do not accept this License. Therefore, by +modifying or distributing the Library (or any work based on the +Library), you indicate your acceptance of this License to do so, and +all its terms and conditions for copying, distributing or modifying +the Library or works based on it. + + 10. Each time you redistribute the Library (or any work based on the +Library), the recipient automatically receives a license from the +original licensor to copy, distribute, link with or modify the Library +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 with +this License. + + 11. 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 Library at all. For example, if a patent +license would not permit royalty-free redistribution of the Library 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 Library. + +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. + + 12. If the distribution and/or use of the Library is restricted in +certain countries either by patents or by copyrighted interfaces, the +original copyright holder who places the Library 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. + + 13. The Free Software Foundation may publish revised and/or new +versions of the Lesser 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 Library +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 Library does not specify a +license version number, you may choose any version ever published by +the Free Software Foundation. + + 14. If you wish to incorporate parts of the Library into other free +programs whose distribution conditions are incompatible with these, +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 + + 15. BECAUSE THE LIBRARY IS LICENSED FREE OF CHARGE, THERE IS NO +WARRANTY FOR THE LIBRARY, TO THE EXTENT PERMITTED BY APPLICABLE LAW. +EXCEPT WHEN OTHERWISE STATED IN WRITING THE COPYRIGHT HOLDERS AND/OR +OTHER PARTIES PROVIDE THE LIBRARY "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 +LIBRARY IS WITH YOU. SHOULD THE LIBRARY PROVE DEFECTIVE, YOU ASSUME +THE COST OF ALL NECESSARY SERVICING, REPAIR OR CORRECTION. + + 16. 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 LIBRARY 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 +LIBRARY (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 LIBRARY TO OPERATE WITH ANY OTHER SOFTWARE), 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 Libraries + + If you develop a new library, and you want it to be of the greatest +possible use to the public, we recommend making it free software that +everyone can redistribute and change. You can do so by permitting +redistribution under these terms (or, alternatively, under the terms +of the ordinary General Public License). + + To apply these terms, attach the following notices to the library. +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 library is free software; you can redistribute it and/or + modify it under the terms of the GNU Lesser General Public + License as published by the Free Software Foundation; either + version 2.1 of the License, or (at your option) any later version. + + This library 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 + Lesser General Public License for more details. + + You should have received a copy of the GNU Lesser General Public + License along with this library; if not, write to the Free Software + Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA + +Also add information on how to contact you by electronic and paper mail. + +You should also get your employer (if you work as a programmer) or +your school, if any, to sign a "copyright disclaimer" for the library, +if necessary. Here is a sample; alter the names: + + Yoyodyne, Inc., hereby disclaims all copyright interest in the + library `Frob' (a library for tweaking knobs) written by James + Random Hacker. + + , 1 April 1990 + Ty Coon, President of Vice + +That's all there is to it! + + diff --git a/ChangeLog b/ChangeLog new file mode 100644 index 0000000..3a601cd --- /dev/null +++ b/ChangeLog @@ -0,0 +1,1102 @@ +2005-12-16 hugo303 + + * src/check_pack.c: Fixed buggy eprintf string. + +2005-10-31 hugo303 + + * src/check_list.c, tests/check_list.c, tests/check_check_fixture.c: + Fixed sourceforge bug #1327225, Two teardown checked fixtures + segfaults. Originated in a pointer arithmetic bug in a memmove() + call in list_add_front() in src/check_list.c. + +2005-09-30 hugo303 + + * doc/tutorial.sgml: Updated with a section about looping tests. + +2005-09-30 hugo303 + + * src/check.c, src/check.h.in, src/check_impl.h, src/check_print.c, + src/check_run.c, src/check_str.c, tests/Makefile.am, + tests/check_check_fixture.c, tests/check_check_master.c, + tests/ex_xml_output.c, tests/test_log_output.sh, tests/test_output.sh, + tests/test_xml_output.sh: + + Added a new kind of test, looping tests, which are called with a new + context for each loop iteration. This makes them ideal for table based + tests. Previously, with the loop in the test itself, only the first + error was caught and then the test would exit. Now all errors are + shown at once which should help in debugging. + +2005-09-15 hugo303 + + * configure.in, tests/check_check_sub.c, tests/check_check.h, + tests/check_check_master.c, tests/Makefile.am: + Added possibility to turn off timeout tests through configure option + --enable-timeout-tests=no + +2005-09-15 hugo303 + + * src/Makefile.am: Improved coverage analysis by running all tests + before compiling result. Added gcc3.3 coverage bug workaround. + +2005-09-15 hugo303 + + * tests/check_check_sub.c, tests/check_check_master.c: + Added testing of timeout set through environment variable. + +2005-09-07 hugo303 + + *configure.in, src/Makefile.am, tests/Makefile.am: Added gcov/lcov + support. Enable with 'autogen.sh --enable-gcov'. + Run with 'cd src && make lcov'. + +2005-08-30 hugo303 + + * debian/README.Debian, debian/compat, debian/docs, + debian/example_makefile, debian/examples, debian/watch: + Added new debian files, missed in the checkin of the debian patch. + +2005-08-30 hugo303 + + * NEWS: Checked in forgotten updated NEWS file. + +2005-08-22 hugo303 + + * debian/changelog, debian/check.doc-base.tut, debian/check.docs, + debian/check.postinst.debhelper, debian/check.prerm.debhelper, + debian/control, debian/copyright, debian/dirs, debian/rules: + + Applied patch for debian files received from check debian + maintainer Robert Lemmen. + +2005-08-22 hugo303 + + * src/check.h.in: Added include of stddef.h for NULL definition + +2005-08-22 hugo303 + + * doc/tutorial.sgml: Fixed sourceforge bug #1216502 + +2005-07-19 hugo303 + + * tests/check_check_master.c, tests/check_check_msg.c, + tests/check_check_sub.c, src/check.c, src/check.h.in, + src/check_msg.c, src/check_msg.h, src/check_run.c: + + Refactored messaging to use the new tmpfile() method all the way, + removing the message keys, pipes, pipe entries and pipe list. This + makes the messaging work with forking tests, and also with threading + tests on linux 2.4 (on 2.6 it already worked). Added check_fork and + check_waitpid_and_exit to be used for forking tests. + +2005-05-26 hugo303 + + * debian/Makefile.am: Removed 'files' file from DIST + +2005-03-29 hugo303 + + * src/check.h.in: Fixed compatibility with gcc 2.95.3 according + to sourceforge patch #1161654. + +2005-03-02 hugo303 + + * src/check.h.in: Added define for NULL if needed. + +2005-03-01 hugo303 + + * src/check_run.c, tests/check_check_master.c: Changed timeout + error message according to sourceforge feature request #1121452. + +2005-02-28 hugo303 + + * debian/files: Removed this auto generated file. + +2005-02-28 hugo303 + + * rpm/check.spec.in: Added patch for x86_64 arch (fc3). + +2005-02-28 hugo303 + + * tests/ex_xml_output.c, tests/ex_log_output.c, tests/ex_output.c, + src/check_log.c: + Fixed memory leaks. + +2005-01-04 hugo303 + + * check.m4, config.h.in, configure.in, src/check_pack.c: Fixed + quoting and added configure test for stdint.h. + +2005-01-04 hugo303 + + * tests/check_check_master.c: Made failure messages more helpful. + +2004-11-12 hugo303 + + * debian/check.dirs, debian/control, debian/rules: Fixed building + with gcc3. Removed empty money dir from docs. + +2004-11-10 hugo303 + + * Makefile.am, rpm/check.spec.in, rpm/Makefile.am: Fixed so + distributions build without trouble. + +2004-11-09 hugo303 + + * src/check_run.c, tests/check_check_master.c: Use strsignal + to print describing text for signals. + +2004-11-09 hugo303 + + * doc/tutorial.sgml: Documented signals handling and timeouts. + +2004-11-09 hugo303 + + * tests/check_check_master.c src/check.h.in: + Changed failure message for fail_if. + +2004-11-09 hugo303 + + * src/check.c, src/check.h.in, src/check_impl.h, src/check_run.c, + tests/check_check_master.c, tests/check_check_sub.c: + Added support for timeouts on tests, enabling detection of + eternal loops as errors. + +2004-11-08 hugo303 + + * src/check.c, src/check.h.in, src/check_impl.h, src/check_run.c, + tests/check_check_master.c, tests/check_check_sub.c: + Added support for testing on expected signals. Implementation + courtesy of Lucas Di Pentima and Cesar Ballardini. Also cleaned + up the test verification to simplify merging of new tests. + +2004-11-04 hugo303 + + * src/check.c, src/check_list.c, src/check_list.h, src/check_log.c, + src/check_msg.c, tests/check_list.c: + Changed name on function list_create to check_list_create to avoid + name clash. + +2004-11-04 hugo303 + + * src/check.c, src/check.h.in, tests/check_check_master.c, + tests/check_check_sub.c: Applied ANSI C99 patch (#1047014) + +2004-08-20 hugo303 + + * doc/tutorial.sgml: Updated with new features. + +2004-08-18 hugo303 + + * src/check.c, src/check.h.in, src/check_impl.h, src/check_log.c, + src/check_log.h, src/check_print.c, src/check_print.h, + src/check_run.c, tests/Makefile.am, tests/check_check_log.c, + tests/ex_xml_output.c, tests/test_xml_output.sh: + Added support for XML output of the test results, courtesy of + Frederic Peters. + +2004-08-18 hugo303 + + * src/check_run.c, tests/check_check_fixture.c: Fixed setup bug + from forum, failure in setup did not abort test in nofork mode. + Added test cases for bug. + +2004-08-17 hugo303 + + * src/check_pack.c: Use stdint.h for specific sized type. + * src/check.c, src/check.h.in, tests/check_check_master.c, + tests/check_check_sub.c, ChangeLog + Applied varargs patch (#933411) and added test cases. + * src/check.h.in tests/check_check_master.c tests/check_check_sub.c: + Applied fail_if (#709167) patch. + +2004-08-16 hugo303 + + * doc/tutorial.sgml: Applied 'newbies' patch #995028 for autoconf doc. + * rpm/check.spec.in: Applied doc patch #995028 from Bill Barnard. + +2004-06-04 hugo303 + + * tests/: test_log_output.sh test_output.sh: Fixed portability + problem by changing == to =. + +2004-05-26 hugo303 + + * rpm/check.spec.in: Changed copyright. + +2004-05-25 hugo303 + + * src/check_run.c: Applied patch 796705. Replacing _exit with exit. + +2004-05-25 hugo303 + + * src/check.c tests/check_check_master.c tests/check_check_sub.c: + Applied patch for bug 793671. + +2004-05-17 10:44 hugo303 + + * Released 0.9.0. See NEWS file for changes. + +2002-10-16 13:47 neo23 + + * AUTHORS, ChangeLog, configure.in: Bumped version number to 0.8.4. + Updated AUTHORS and ChangeLog. + +2002-10-16 13:39 neo23 + + * src/check_msg.c, tests/check_check_msg.c: Applied a patch from + Rick Poyner that changes the pipe used for IPC to use a temporary + file instead of stdin/stdout. This fixes the long-standing problem + that the pipe used to fill up when too many fail_unless() were + used. (#482012). + +2002-10-09 18:57 neo23 + + * src/check.h.in: Applied a patch from Rick Poyner that fixes a + typo which broke check for C++ compilers (bug #601397). + +2002-08-16 19:41 neo23 + + * src/: check.c, check_msg.c, check_msg.h, check_pack.c, + check_pack.h: Applied a patch from Dietmar Petras + that plugs some memory leaks. + +2002-07-10 04:37 neo23 + + * .cvsignore, autogen.sh: Call aclocal from autogen.sh. + +2002-07-10 04:32 neo23 + + * aclocal.m4, depcomp, install-sh, missing, mkinstalldirs: Removed + files generated by automake. + +2002-06-16 14:25 neo23 + + * debian/changelog: applied patch from Arien Malec to fix build of + Debian packages + +2002-05-24 17:04 neo23 + + * ChangeLog: Made 0.8.3 Release. + +2002-05-24 17:00 neo23 + + * NEWS, doc/tutorial.lyx, rpm/check.spec.in: Added check.m4 to the + spec file. Updated NEWS. Updated the date of the tutorial. + +2002-05-24 16:35 neo23 + + * debian/: check.dirs, check.files, control: Added check.m4 to + debian rules. Changed the maintainer entry. + +2002-05-23 17:08 neo23 + + * doc/tutorial.lyx: Mention that EXIT_SUCCESS and EXIT_FAILURE are + defined in stdlib.h. Suggested by Russell Reed in bug #547129. + +2002-05-10 14:01 neo23 + + * src/check_msg.c: Declared local functions static (based on a + patch from Gilgamesh Nootebos). + +2002-05-03 13:58 neo23 + + * src/Makefile.am, src/check.c, src/check_error.c, + src/check_list.c, src/check_list.h, src/check_log.c, + src/check_msg.c, src/check_pack.c, src/check_print.c, + src/check_run.c, src/check_str.c, src/list.c, src/list.h, + tests/check_list.c: Renamed list.[ch] to check_list.[ch] for + consistency. Include config.h from all over the place, cleaned up + includes. + +2002-05-02 10:34 neo23 + + * src/check_pack.c, tests/check_check_log.c: Removed compiler + warnings mentioned in bug #547126. + +2002-05-02 10:27 neo23 + + * src/check_print.c, tests/check_check_msg.c: Don't include + "error.h" (bug #546175 small cygwin portability problem). + +2002-04-16 19:33 neo23 + + * doc/tutorial.lyx: Changed date to that of the latest release. + Added a name to an internal reference so that we get a working link + in the generated HTML. + +2002-04-15 18:47 neo23 + + * check.m4, configure.in: Fixed check.m4 so that --without-check is + a valid option to disable check. Bumped version number to 0.8.3. + +2002-04-15 12:58 neo23 + + * ChangeLog: Updated ChangeLog. + +2002-04-15 12:57 neo23 + + * NEWS, README: Made 0.8.2 Release. + +2002-04-14 18:59 neo23 + + * src/check_msg.c: Applied a patch from Arien that makes the pipe + nonblocking. This doesn't solve #482012 but makes it more obvious + what is going wrong if the pipe fills up. + +2002-04-12 12:50 neo23 + + * doc/tutorial.lyx: Use #include rather than #import (bug #484564). + +2002-04-12 12:34 neo23 + + * ChangeLog: Updated ChangeLog. + +2002-04-12 12:33 neo23 + + * AUTHORS, doc/tutorial.lyx: Document the fact that you can now use + NULL as msg argument for fail_unless(). + +2002-04-12 11:54 neo23 + + * config.h.in, configure.in, src/Makefile.am, src/check.c, + src/check_impl.h, src/check_magic.h, src/check_msg.c, + src/check_pack.c, src/check_pack.h, src/check_run.c, + src/check_str.c, src/check_str.h, tests/Makefile.am, + tests/check_check_fixture.c, tests/check_check_master.c, + tests/check_check_msg.c, tests/check_check_pack.c: Removed + limitations on line number, message and buffer sizes (bug #478233) + by changing the way we send integers over the pipe. Instead of + strings, integers are now send as 4 bytes. This allows the pack + routine to easily calculate the message size so that we can + allocate the needed buffer there. Made a union out of the + different Msg structs to clean up the internal API. Also introduced + the internal function ck_strdup_printf(), a simple wrapper around + sprintf() that allocates enough space to hold the resulting string. + +2002-04-10 13:11 neo23 + + * AUTHORS, NEWS, configure.in, src/check.c, src/check.h.in, + src/check_error.c, src/check_error.h, src/check_impl.h, + src/check_log.c, src/check_msg.c, src/check_msg.h, + src/check_pack.c, src/check_run.c, src/check_str.c, src/list.c, + src/list.h, tests/check_check_fixture.c, tests/check_check_fork.c, + tests/check_check_master.c, tests/check_check_pack.c, + tests/check_list.c: Applied a slightly modified version of a patch + from Neil Spring that declares strings + as const where applicable. It also changes our CFLAGS to be much + stricter and removes the warnings introduced by -Wwrite-strings. + This allows building other check tests with -Wwrite-strings without + heaping gobs of compiler warnings. + +2002-03-28 20:12 neo23 + + * ChangeLog: Updated ChangeLog. + +2002-03-28 19:37 neo23 + + * src/check.c, src/check.h.in, tests/check_check_master.c, + tests/check_check_sub.c: Allow fail_unless() to be called with a + NULL msg and substitute a reasonable error message in that case. + Bail out if NULL is passed to _fail_unless() to avoid possible + confusion. + + Added a test case that calls fail_unless() with msg=NULL. + +2002-03-28 19:19 neo23 + + * Makefile.am, README, autogen.sh, check.m4, configure.in, + doc/tutorial.lyx, doc/money/.cvsignore, + doc/money/Makefile.am.money, doc/money/aclocal.m4, + doc/money/configure.in.money, rpm/.cvsignore, rpm/Makefile.am, + rpm/check.spec, rpm/check.spec.in, src/.cvsignore, src/Makefile.am, + src/check.c, src/check.h, src/check.h.in, tests/.cvsignore: Changed + autogen.sh to bail out if necessary tools can't be found instead of + proceeding to the version checks. + + Document use of autogen.sh in README. + + Generate check.spec from check.spec.in to it automatically gets the + correct version number. + + Generate check.h from chech.h.in and include Check version + information. + + Compile Check version number into the library to allow for runtime + version checks. + + Added the m4 script check.m4 that allows to easily integrate Check + into projects using autoconf/automake. It does version checking and + also assures that header and library versions match. + + Document the use of check.m4 and the AM_PATH_CHECK() macro in the + tutorial. Adapted example Makefile.am and configure.in and added a + missing .cvsignore file. + +2002-03-27 02:21 amalec + + * src/Makefile.in, tests/Makefile.in: Complete CVS cleanup + +2002-03-27 02:18 amalec + + * .cvsignore, Makefile.am, Makefile.in, autogen.sh, configure, + debian/.cvsignore, debian/Makefile.in, doc/.cvsignore, + doc/Makefile.in, doc/money/Makefile.in, rpm/.cvsignore, + rpm/Makefile.in, src/.cvsignore, tests/.cvsignore: Cleaned up CVS + to remove all autofoo generated files, included an autogen.sh + bootstrap file. Changes at the suggestion of Sven Neumann + +2002-03-02 02:42 amalec + + * ChangeLog: Update ChangeLog + +2002-03-02 02:42 amalec + + * debian/changelog, debian/files, rpm/check.spec, src/Makefile.am, + src/Makefile.in, src/check.c, src/check_error.c, src/check_error.h, + src/check_log.c, src/check_msg.c, src/check_pack.c, + src/check_run.c, src/check_str.c, src/error.c, src/error.h, + src/list.c, tests/check_check_fixture.c, tests/check_check_pack.c: + Moved error.[hc] to check_error.[hc], and fixed bug in running + checked setup in nofork mode. + +2002-02-28 03:02 amalec + + * COPYING, configure, configure.in, src/check.c, src/check.h, + src/check_impl.h, src/check_log.c, src/check_log.h, + src/check_magic.h, src/check_msg.c, src/check_msg.h, + src/check_pack.c, src/check_pack.h, src/check_print.c, + src/check_print.h, src/check_run.c, src/check_str.c, + src/check_str.h, src/error.c, src/error.h, src/list.c, src/list.h: + Changed license to LGPL + +2001-10-26 01:19 amalec + + * ChangeLog: Update ChangeLog + +2001-10-26 01:18 amalec + + * AUTHORS: Update AUTHORS to give credit to key contributors + +2001-10-26 01:12 amalec + + * configure, configure.in: Clarified configuration warning on doc + building + +2001-10-26 00:51 amalec + + * ChangeLog: Updating ChangeLog prior to release + +2001-10-26 00:45 amalec + + * src/check_run.c, tests/check_check_pack.c: Fixed some missing + header includes + +2001-10-26 00:25 amalec + + * src/check_pack.c: Fix packing of NULL strings (causing problems + under Solaris) + +2001-10-26 00:17 amalec + + * tests/check_check_pack.c: Minor change to pack tests to ensure + that tests don't pass accidentally + +2001-10-25 02:45 amalec + + * ChangeLog: Updated ChangeLog + +2001-10-25 02:44 amalec + + * depcomp: Added new automake file + +2001-10-25 02:43 amalec + + * NEWS, doc/index.html, doc/money/check_money.c, + tests/check_check_sub.c: Added comments on string functions to + NEWS, cleaned up money example, and fixed a signal unit test so + that it will pass under cygwin + +2001-10-24 19:25 amalec + + * Makefile.in, NEWS, aclocal.m4, configure, debian/Makefile.in, + debian/changelog, debian/files, doc/Makefile.am, doc/Makefile.in, + doc/tutorial.lyx, doc/money/Makefile.in, rpm/Makefile.in, + rpm/check.spec, src/Makefile.am, src/Makefile.in, src/check.h, + src/check_log.c, src/check_msg.c, src/check_msg.h, + src/check_print.c, src/check_run.c, tests/Makefile.am, + tests/Makefile.in, tests/check_check_fixture.c, + tests/check_check_fork.c, tests/check_check_limit.c, + tests/check_check_main.c, tests/check_check_master.c, + tests/check_stress.c, tests/ex_log_output.c, tests/ex_output.c, + tests/test_log_output.sh, tests/test_output.sh: Documentation + updates + +2001-10-23 01:57 amalec + + * src/check_msg.c, src/check_pack.c, src/check_pack.h, + tests/check_check_pack.c: Removed old ppunpack, renamed new_*, and + updated callers + +2001-10-23 01:26 amalec + + * src/check_msg.c, src/check_msg.h, src/check_pack.c, + src/check_run.c, tests/check_check_master.c, + tests/check_check_msg.c, tests/check_check_pack.c: Moved Check to + use new internal ppack routine, and fixed a nasty bug + +2001-10-20 01:27 amalec + + * src/check_msg.c, src/check_msg.h, src/check_pack.c, + tests/check_check_msg.c, tests/check_check_pack.c: New version of + receive_test_result passes unit tests + +2001-10-19 20:44 amalec + + * src/check_pack.c, src/check_pack.h, tests/check_check_fixture.c, + tests/check_check_pack.c: Changed punpack to return test and + fixture locs to preserve test information when teardown messages + are sent + +2001-10-17 03:15 amalec + + * src/check_run.c, tests/check_check_fixture.c: Checked setup + passes unit tests + +2001-10-13 18:13 amalec + + * src/Makefile.am, src/Makefile.in, src/check.c, src/check_msg.c, + src/check_msg.h, src/check_run.c, tests/check_check_msg.c: Replace + previous messaging implementation files with new module + +2001-10-13 08:05 amalec + + * src/check.c, src/check.h, src/check_log.c, src/check_msg.c, + src/check_pack.c, src/check_run.c, src/check_str.c, src/error.c, + src/error.h, tests/check_check_master.c, tests/test_log_output.sh, + tests/test_output.sh: Fully implemented new messaging back-end + based on pipes + +2001-10-10 20:01 amalec + + * Makefile.in, aclocal.m4, configure, debian/Makefile.in, + doc/Makefile.in, doc/money/Makefile.in, rpm/Makefile.in, + src/Makefile.am, src/Makefile.in, src/check.c, src/check_impl.h, + src/check_pack.c, tests/Makefile.in, tests/check_check_msg.c, + tests/check_check_pack.c: Updated messaging tests to use new + infrastructure + +2001-10-04 23:55 amalec + + * src/check.c, src/check.h, src/check_impl.h, src/check_pack.c, + src/check_pack.h, tests/check_check_pack.c: Completed + implementation of check_pack + +2001-10-02 17:38 amalec + + * doc/index.html, doc/tutorial.lyx, src/Makefile.am, + src/Makefile.in, src/check.c, src/check.h, src/check_magic.h, + src/check_msg.h, src/check_pack.c, src/check_pack.h, + tests/Makefile.am, tests/Makefile.in, tests/check_check.h, + tests/check_check_fixture.c, tests/check_check_fork.c, + tests/check_check_limit.c, tests/check_check_main.c, + tests/check_check_master.c, tests/check_check_msg.c, + tests/check_check_pack.c: First generation packing code as the + infrastructure to revising message passing between processes, to + accomodate context messages + +2001-09-28 02:20 amalec + + * src/check.c, src/check.h, src/check_impl.h, src/check_run.c, + src/list.c, src/list.h, tests/check_check_fixture.c, + tests/check_check_fork.c, tests/check_check_limit.c, + tests/check_check_master.c, tests/check_check_msg.c: Added + framework for support of checked fixture functions + +2001-09-27 18:08 amalec + + * src/: check.c, check_run.c: Refactored failure info functions + +2001-09-19 02:14 amalec + + * src/check.c, src/check.h, src/check_impl.h, src/check_magic.h, + src/check_msg.c, src/check_msg.h, src/check_print.c, + src/check_run.c, src/check_str.c, tests/Makefile.am, + tests/Makefile.in, tests/check_check.h, + tests/check_check_fixture.c, tests/check_check_main.c, + tests/check_check_master.c: Setup failure is working and partially + tested + +2001-09-15 01:15 amalec + + * tests/: check_check.h, check_check_fork.c, check_check_main.c: + Completed implementation of CK_NOFORK + +2001-09-08 00:12 amalec + + * src/: check_impl.h, check_msg.c, check_msg.h, check_run.c: + Implemented nofork mode + +2001-09-06 20:10 amalec + + * Doxyfile, configure.in, src/check.h, src/check_impl.h, + src/check_log.c, src/check_log.h, src/check_print.c, + src/check_print.h, src/check_run.c, tests/Makefile.am, + tests/Makefile.in, tests/check_check.h, tests/check_check_main.c: + Added initial control functions to control forking + +2001-09-05 18:48 amalec + + * src/check.c, src/check_msg.c, src/check_msg.h, src/check_run.c, + tests/check_check_msg.c: Completely abstracted the details of + messaging behind check_msg.c + +2001-09-01 02:12 amalec + + * src/: check.c, check_msg.c, check_msg.h, check_run.c: Ensure that + each subprocesses alloc the correct msg queue + +2001-08-30 03:00 amalec + + * src/check.c, src/check.h, src/check_msg.c, src/check_msg.h, + src/check_run.c, tests/check_check_msg.c: Eliminated passing of + msqid in unit tests + +2001-08-29 02:49 amalec + + * src/check_print.c, src/check_str.c, tests/check_check_limit.c: + Added test checking running empty suites + +2001-08-28 19:06 amalec + + * src/check_magic.h: Moved magic values to separate header + +2001-08-28 19:04 amalec + + * src/Makefile.am, src/Makefile.in, src/check.h, src/check_impl.h, + src/check_print.c, src/check_str.c, src/check_str.h, + tests/check_check_master.c, tests/check_check_msg.c: Separated + printing from string formating functions to allow better testing. + +2001-08-28 02:18 amalec + + * configure, configure.in, src/check_msg.c, src/check_msg.h, + src/check_run.c, tests/Makefile.am, tests/Makefile.in, + tests/check_check.h, tests/check_check_main.c, + tests/check_check_msg.c: Use pid/ppid as message queue key, + preliminary to removing _msqid from unit test functions + +2001-08-23 23:26 amalec + + * ChangeLog: Final ChangeLog for 0.7.3 release + +2001-08-23 23:25 amalec + + * NEWS: Document 0.7.3 in NEWS + +2001-08-23 23:13 amalec + + * debian/changelog: This time, fix debian changelog correctly + +2001-08-23 23:10 amalec + + * debian/changelog: Fixed maintainer email in debian changelog + +2001-08-23 01:08 amalec + + * ChangeLog, acinclude.m4, aclocal.m4, configure, configure.in, + debian/changelog, debian/check.doc-base.tut, debian/files, + rpm/check.spec: Updated acinclude.m4 to increase portability; fixed + a minor packaging bug in debian doc-base files + +2001-08-18 07:28 amalec + + * ChangeLog, doc/index.html: index.html changes + +2001-08-18 07:24 amalec + + * INSTALL, NEWS: NEWS and INSTALL changes + +2001-08-18 07:15 amalec + + * Doxyfile, configure, configure.in, + debian/check.postinst.debhelper, debian/check.prerm.debhelper, + debian/files, doc/Makefile.in, doc/tutorial.lyx, rpm/Makefile.am, + rpm/Makefile.in, rpm/check.spec, src/check.c, src/check.h, + src/check_log.c, src/check_msg.c, src/check_print.c, + src/check_run.c, tests/check_check_log.c, + tests/check_check_master.c, tests/check_check_msg.c, + tests/check_list.c, tests/check_stress.c, tests/ex_log_output.c, + tests/ex_output.c: Bug fixes and assorted cleanup prior to release + +2001-08-18 01:16 amalec + + * doc/money/: Makefile.am, Makefile.in: Added money example + Makefiles to CVS + +2001-08-18 01:13 amalec + + * doc/: Makefile.am, example.lyx, tutorial.lyx: Moved example.lyx + to tutorial.lyx + +2001-08-16 02:47 amalec + + * acinclude.m4, debian/Makefile.am, debian/Makefile.in, + debian/check.docs: Added leftover stuff in debian directory, + acinclude.m4 + +2001-08-16 02:45 amalec + + * Makefile.am, Makefile.in, aclocal.m4, configure, configure.in, + debian/check.doc-base.tut, debian/control, debian/docs, + doc/Makefile.am, doc/Makefile.in, doc/money/AUTHORS, + doc/money/COPYING, doc/money/ChangeLog, doc/money/INSTALL, + doc/money/Makefile.am, doc/money/Makefile.am.money, + doc/money/Makefile.in, doc/money/NEWS, doc/money/README, + doc/money/config.h.in, doc/money/configure, doc/money/configure.in, + doc/money/configure.in.money, doc/money/stamp-h.in, + rpm/Makefile.in, rpm/check.spec, src/Makefile.in, + tests/Makefile.in: Added configure check for Lyx with Linuxdoc + +2001-08-06 22:45 amalec + + * rpm/Makefile.in: Added rpm/Makefile.in + +2001-08-06 22:44 amalec + + * Makefile.am, Makefile.in, configure, configure.in, + debian/changelog, debian/check.dirs, debian/check.files, + debian/rules, doc/Makefile.am, doc/Makefile.in, doc/index.html, + doc/money/AUTHORS, doc/money/COPYING, doc/money/ChangeLog, + doc/money/NEWS, doc/money/README, rpm/check.spec: Can now build + complete debs + +2001-08-04 07:40 amalec + + * debian/README.Debian: Don't need README.Debian + +2001-08-04 07:26 amalec + + * debian/README.Debian, debian/changelog, debian/check.dirs, + debian/check.files, debian/check.postinst.debhelper, + debian/check.prerm.debhelper, debian/control, debian/copyright, + debian/dirs, debian/docs, debian/files, debian/rules, + doc/Makefile.am, doc/index.html: Added preliminary debian packaging + files + +2001-08-03 03:05 amalec + + * Makefile.am, Makefile.in, aclocal.m4, configure, configure.in, + doc/index.html, rpm/Makefile.am, rpm/buildrpm.sh: Added automatic + building of RPMs + +2001-07-31 18:51 amalec + + * doc/index.html: Update index.html for final release to main Check + website. + +2001-07-31 03:08 amalec + + * ChangeLog: Update ChangeLog + +2001-07-31 03:08 amalec + + * NEWS, configure, configure.in, doc/example.lyx, rpm/buildrpm.sh, + rpm/check.spec, tests/Makefile.am, tests/Makefile.in, + tests/ex_log_output.c, tests/test_log_output.sh: Update NEWS, docs, + and rpm building + +2001-07-30 22:10 amalec + + * ChangeLog: Update ChangeLog + +2001-07-30 22:10 amalec + + * doc/Makefile.in, tests/ex_log_output.c: Add neglected files + +2001-07-30 22:08 amalec + + * src/Makefile.am, src/Makefile.in, src/check_impl.h, + src/check_log.c, src/check_log.h, src/check_print.c, + src/check_print.h, src/check_run.c, tests/test_log_output.sh: + Reorganized printing and logging functions and implemented more + sophisticated logging + +2001-07-25 23:26 amalec + + * Makefile.in, aclocal.m4, config.h.in, configure, + doc/money/aclocal.m4, doc/money/config.h.in, doc/money/configure, + src/Makefile.in, tests/Makefile.in, tests/test_log_output.sh: Added + log tests + +2001-07-11 22:46 amalec + + * NEWS, README, doc/example.lyx, rpm/check.spec, src/check.h, + tests/check_check_log.c, tests/check_check_main.c: Updated docs + +2001-07-11 01:29 amalec + + * ChangeLog: Update ChangeLog + +2001-07-11 01:28 amalec + + * src/Makefile.in, src/check_log.c, tests/check_check.h, + tests/check_check_log.c, tests/check_check_master.c, + tests/check_check_sub.c, tests/test_output.sh: Completed testing + for multiple suite running, and reorganized files + +2001-07-11 01:26 amalec + + * src/: check_log.c, check_log.h: Commit file changes + +2001-07-11 01:25 amalec + + * src/: Makefile.am, check.h, check_run.c: Moved check_log.h + functions into check.h + +2001-07-10 02:10 amalec + + * ChangeLog: Commit ChangeLog + +2001-07-10 02:09 amalec + + * src/check.c, src/check.h, src/check_impl.h, src/check_run.c, + src/list.h, tests/Makefile.am, tests/Makefile.in, + tests/check_check.h, tests/check_check_log.c, + tests/check_check_main.c, tests/check_check_master.c, + tests/check_check_msg.c, tests/check_check_sub.c, + tests/check_list.c: Completed test for initial logging feature, and + added feature to run multiple suites through an SRunner + +2001-06-30 03:27 amalec + + * src/Makefile.in, src/check.h, src/check_impl.h, src/check_log.h, + src/check_run.c, tests/check_check_log.c, tests/test_output.sh: + Restructured printing to allow for logging function + +2001-06-29 02:40 amalec + + * src/: Makefile.am, Makefile.in: Add check_log.c to Makefile.am + +2001-06-29 02:33 amalec + + * tests/: Makefile.am, Makefile.in: Complete move of + check_check_log.c -- this time for real... + +2001-06-29 02:31 amalec + + * Doxyfile, src/check_log.h, tests/Makefile.am, tests/Makefile.in: + Complete move of check_check_log.c + +2001-06-29 02:30 amalec + + * tests/: Makefile.am, check_check_log.c, check_log.c: Moved + check_log.c to check_check_log.c + +2001-06-29 00:56 amalec + + * doc/money/stamp-h: Removed stamp-h + +2001-06-29 00:51 amalec + + * src/check_log.h, tests/check_log.c: Added skeleton files for + check logging + +2001-06-29 00:33 amalec + + * Doxyfile, configure, configure.in, src/check.h, + tests/Makefile.am, tests/Makefile.in: Additional doxygenation of + check.h + +2001-06-27 20:27 amalec + + * ChangeLog: Updated ChangeLog + +2001-06-27 20:25 amalec + + * configure, rpm/check.spec: Updated check.spec + +2001-06-27 20:21 amalec + + * ChangeLog: Update ChangeLog + +2001-06-27 20:20 amalec + + * NEWS, configure.in, doc/example.lyx, doc/money/check_money.c, + doc/money/configure, doc/money/configure.in, src/check.h, + src/check_run.c, tests/check_check_main.c, + tests/check_check_master.c, tests/check_check_msg.c, + tests/check_list.c, tests/check_stress.c: Completed + srunner_results, and added unit tests; changed srunner_nfailed to + srunner_ntests_failed and changed documentation. + +2001-06-27 00:51 amalec + + * Doxyfile, doc/example.lyx, src/check.h, src/check_run.c, + tests/Makefile.am, tests/Makefile.in, tests/check_check.c, + tests/check_check.h, tests/check_check_main.c, + tests/check_check_master.c, tests/check_check_msg.c, + tests/check_check_sub.c, tests/check_list.c, tests/check_stress.c: + Fixed a bug in srunner_failures, fixed a typo in the tutorial + documentation (thanks to Michael Tucker), and refactored + check_check + +2001-06-22 03:16 amalec + + * ChangeLog: Update ChangeLog + +2001-06-22 03:15 amalec + + * NEWS, doc/Makefile.am, doc/example.lyx, doc/index.html, + rpm/check.spec, tests/Makefile.am, tests/Makefile.in: Specfile + changes, updates to NEWS + +2001-06-22 02:37 amalec + + * ChangeLog: Update ChangeLog + +2001-06-22 02:36 amalec + + * src/check.h, src/check_run.c, tests/Makefile.am, + tests/Makefile.in, tests/check_check.c, tests/ex_output.c, + tests/test_output.sh: Changed test output, added end-to-end test, + and removed redundant field from TestResult struct + +2001-06-19 22:01 amalec + + * ChangeLog: Update changelog + +2001-06-19 21:59 amalec + + * src/check.h, src/check_run.c, tests/check_check.c: Added + accessors for TestResult and expanded unit test + +2001-06-12 19:29 amalec + + * ChangeLog: Updated ChangeLog + +2001-06-12 19:28 amalec + + * configure, configure.in, src/check.h, src/check_run.c, + tests/check_check.c: Added new tests for line number + +2001-06-04 19:58 amalec + + * ChangeLog, doc/index.html: Added homepage file in doc directory, + and updated change log + +2001-06-04 19:08 amalec + + * doc/Makefile.am, doc/example.lyx, rpm/check.spec: Cleaned up spec + file for RPM packaging + +2001-06-04 01:50 amalec + + * Makefile.am, Makefile.in, configure, configure.in, + doc/Makefile.am, rpm/check.spec: Added RPM spec file and added + additional documentation files + +2001-06-01 17:46 amalec + + * ChangeLog: Updated ChangeLog + +2001-06-01 17:44 amalec + + * Makefile.in, src/Makefile.in, src/check.c, src/check.h, + src/check_impl.h, src/check_msg.c, src/check_msg.h, + src/check_run.c, src/error.c, src/error.h, src/list.c, src/list.h, + tests/Makefile.in: GNUified source files with copyright notice + +2001-06-01 17:33 amalec + + * aclocal.m4, configure, configure.in, doc/Makefile.am, + doc/example.lyx: Made building docs conditional on presence of lyx + and sgml2html + +2001-06-01 00:35 amalec + + * ChangeLog: Update ChangeLog + +2001-06-01 00:34 amalec + + * configure.in, doc/Makefile.am: Modified Makefile.am to include + docs in dist + +2001-06-01 00:26 amalec + + * ChangeLog, Makefile.am, Makefile.in, aclocal.m4, configure, + configure.in, doc/Makefile.am, src/Makefile.in, tests/Makefile.in: + Added Automake support to create and install documentation + +2001-05-31 23:30 amalec + + * doc/money/: config.h, config.log, config.status: Removed unneded + files + +2001-05-31 17:37 amalec + + * ChangeLog, ChangeLogOld: Updated change logs + +2001-05-31 17:35 amalec + + * doc/example.lyx: Commit changes to example, get things in synch + +2001-05-31 17:32 amalec + + * doc/money/: COPYING, ChangeLog, INSTALL, Makefile.am, + Makefile.in, NEWS, README, aclocal.m4, check_money.c, config.h, + config.h.in, config.log, config.status, configure, configure.in, + money.c, money.h, stamp-h, stamp-h.in: Hopefully finally solved CVS + problems and commited changes to money example and example.lyx + +2001-05-31 01:48 amalec + + * doc/money/AUTHORS: Trying to commit added files... + +2001-05-31 01:45 amalec + + * doc/example.lyx: Cleaning up CVS.. + +2001-05-31 01:37 amalec + + * ChangeLogOld: Trying to update documentation and change log, and + statisfy CVS... + +2001-05-31 01:34 amalec + + * ChangeLog: Refined documentation, and moved old change log + information to ChangeLogOld + +2001-05-31 00:44 amalec + + * doc/example.lyx: Added complete example to accompany + documentation + +2001-05-30 05:25 amalec + + * Makefile.in: Added example and expanded documentation + +2001-05-30 00:42 amalec + + * AUTHORS, Makefile.in, README, stamp-h.in, COPYING, ChangeLog, + INSTALL, Makefile.am, NEWS, aclocal.m4, config.h.in, configure, + configure.in, install-sh, missing, mkinstalldirs, src/Makefile.am, + src/Makefile.in, src/check.c, src/check.h, src/check_impl.h, + src/check_run.c, doc/example.lyx, src/check_msg.c, src/check_msg.h, + src/error.c, src/error.h, src/list.c, src/list.h, + tests/Makefile.am, tests/Makefile.in, tests/check_check.c, + tests/check_check_msg.c, tests/check_list.c, tests/check_stress.c: + Initial revision + +2001-05-30 00:42 amalec + + * AUTHORS, Makefile.in, README, stamp-h.in, COPYING, ChangeLog, + INSTALL, Makefile.am, NEWS, aclocal.m4, config.h.in, configure, + configure.in, install-sh, missing, mkinstalldirs, src/Makefile.am, + src/Makefile.in, src/check.c, src/check.h, src/check_impl.h, + src/check_run.c, doc/example.lyx, src/check_msg.c, src/check_msg.h, + src/error.c, src/error.h, src/list.c, src/list.h, + tests/Makefile.am, tests/Makefile.in, tests/check_check.c, + tests/check_check_msg.c, tests/check_list.c, tests/check_stress.c: + Import into Sourceforge. Previous CVS version information resides + on Arien's local machine + diff --git a/ChangeLogOld b/ChangeLogOld new file mode 100644 index 0000000..ed78fcf --- /dev/null +++ b/ChangeLogOld @@ -0,0 +1,120 @@ +Revisions previous to move to SourceForge +2001-05-25 05:56 amalec + + * src/check_msg.c, src/check_msg.h, tests/Makefile.am, + tests/check_check_msg.c: Added testcases for check_msg + +2001-05-25 05:25 amalec + + * ChangeLog: Update ChangeLog + +2001-05-25 05:25 amalec + + * configure, src/Makefile.am, src/check.c, src/check.h, + src/check_impl.h, src/check_run.c, src/check_run.h, + tests/check_check.c, tests/check_list.c, tests/check_stress.c: + Added fixture support and moved suite running functions to main + check.h header + +2001-05-23 20:29 amalec + + * ChangeLog, configure.in: Bumped version + +2001-05-23 20:28 amalec + + * src/check.h, src/check_impl.h, src/check_msg.c, src/check_msg.h, + src/check_run.c, src/check_run.h, tests/check_check.c, + tests/check_list.c, tests/check_stress.c: Changed check_check to + run silently if no errors + +2001-05-22 16:15 amalec + + * src/Makefile.am, tests/Makefile.am: Cleanup of move to a non-flat + directory structure + +2001-05-22 16:15 amalec + + * Makefile.am, Makefile.in, check.c, check.h, check_check.c, + check_impl.h, check_list.c, check_msg.c, check_msg.h, check_run.h, + configure, configure.in, error.c, error.h, list.c, list.h, + src/check.c, src/check.h, src/check_impl.h, src/check_msg.c, + src/check_msg.h, src/check_run.c, src/check_run.h, src/error.c, + src/error.h, src/list.c, src/list.h, tests/check_check.c, + tests/check_list.c, tests/check_stress.c: Moved to a non-flat + directory structure + +2001-05-22 14:53 amalec + + * ChangeLog: Update ChangeLog + +2001-05-22 14:52 amalec + + * Makefile.am, Makefile.in, check.c, check.h, check_check.c, + check_list.c, check_run.h, config.h.in, configure, configure.in, + error.c, error.h, list.c: Switched to a dynamically grown array + implementation for lists, to solve a performance problem forking + with large numbers of tests; fixed a memory problem in srunner_free + +2001-05-18 12:31 amalec + + * ChangeLog: Useing cvs2cl.pl to handle ChangeLog + +2001-05-18 12:02 amalec + + * check_run.h, configure, stamp-h.in: More code reorgazization + +2001-05-16 11:20 amalec + + * check.c, check_check.c, check_msg.c, check_msg.h, check_run.h, + configure.in: Cleaned up memory leaks and rearranged some + responsibilities + +2001-05-15 17:36 amalec + + * check.c, check.h, check_check.c, check_impl.h, check_list.c, + check_msg.c, check_msg.h, check_run.h: Addition of SRunner object, + and major reorganization of responsibilites between suites/cases + and the SRunner + +2001-05-15 15:11 amalec + + * list.c: Added list_add_end function + +2001-05-15 09:20 amalec + + * Makefile.am, Makefile.in: Cleaned up Makefile.am to declare + headers correctly, and install correctly. + +2001-05-14 18:06 amalec + + * check.c, check.h, check_impl.h, check_run.h: Completed + reorganization + +2001-05-14 17:33 amalec + + * Makefile.in, check.c, check_run.h: Complete commit of last + changes + +2001-05-14 17:30 amalec + + * Makefile.am, check.h, check_check.c, check_list.c, check_run.h: + Cleaned up some documentation, and moved suite printing functions + to a separate module as a first step to separating the text runner + from the underlying interface. + +2001-05-14 17:07 amalec + + * AUTHORS, ChangeLog, Makefile.am, Makefile.in, NEWS, README, + aclocal.m4, check.c, check.h, check_check.c, check_impl.h, + check_list.c, check_msg.c, check_msg.h, config.h.in, configure, + configure.in, error.c, error.h, list.c, list.h, stamp-h.in: Initial + revision + +2001-05-14 17:07 amalec + + * AUTHORS, ChangeLog, Makefile.am, Makefile.in, NEWS, README, + aclocal.m4, check.c, check.h, check_check.c, check_impl.h, + check_list.c, check_msg.c, check_msg.h, config.h.in, configure, + configure.in, error.c, error.h, list.c, list.h, stamp-h.in: + Imported sources + diff --git a/INSTALL b/INSTALL new file mode 100644 index 0000000..23e5f25 --- /dev/null +++ b/INSTALL @@ -0,0 +1,236 @@ +Installation Instructions +************************* + +Copyright (C) 1994, 1995, 1996, 1999, 2000, 2001, 2002, 2004, 2005 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' installs the package's commands under +`/usr/local/bin', include files under `/usr/local/include', etc. You +can specify an installation prefix other than `/usr/local' by giving +`configure' the option `--prefix=PREFIX'. + + You can specify separate installation prefixes for +architecture-specific files and architecture-independent files. If you +pass the option `--exec-prefix=PREFIX' to `configure', the package uses +PREFIX as the prefix for installing programs and libraries. +Documentation and other data files still use the regular prefix. + + In addition, if you use an unusual directory layout you can give +options like `--bindir=DIR' 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 option `--target=TYPE' 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 + +causes the specified `gcc' to be used as the C compiler (unless it is +overridden in the site shell script). Here is a another example: + + /bin/bash ./configure CONFIG_SHELL=/bin/bash + +Here the `CONFIG_SHELL=/bin/bash' operand causes subsequent +configuration-related scripts to be executed by `/bin/bash'. + +`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. + diff --git a/Makefile.am b/Makefile.am new file mode 100644 index 0000000..2ad5fa7 --- /dev/null +++ b/Makefile.am @@ -0,0 +1,34 @@ +## Process this file with automake to produce Makefile.in + +## run tests after everything else + +SUBDIRS = src doc . tests + +## FIXME: maybe we don't need this line + +AM_MAKEINFOFLAGS = -I$(top_srcdir)/doc/example + +## what to clean + +CLEANFILES = *~\ + $(PACKAGE)-$(VERSION).tar.gz\ + ChangeLog.bak + +## what additional things to distribute + +EXTRA_DIST = ChangeLogOld check.pc.in $(m4data_DATA) + +## install docs +docdir = $(datadir)/doc/$(PACKAGE) +doc_DATA = SVNChangeLog ChangeLog ChangeLogOld NEWS README COPYING.LESSER + +## install check.m4 with AM_PATH_CHECK in it +m4datadir = $(datadir)/aclocal +m4data_DATA = check.m4 + +## install check.pc +pcdatadir = $(libdir)/pkgconfig +pcdata_DATA = check.pc + +SVNChangeLog: + svn log -v @abs_top_srcdir@ > $@ diff --git a/NEWS b/NEWS new file mode 100644 index 0000000..688c50f --- /dev/null +++ b/NEWS @@ -0,0 +1,213 @@ +Fri, Oct 13, 2006: Released Check 0.9.4 + +* Updated manual and converted from DocBook to Texinfo. + +* Added pkg-config support. + +* Added Libtool support to build both static and shared libraries. + +* Removed debian/ and rpm/ directories for building packages. + Downstream maintainers can easily handle this. + +* Updated GNU Build System to use modern Autotools. + +* Fixed sourceforge bug #1327225, two teardown checked fixtures + segfaults. + +* Added a new kind of test, looping tests, which are called with a new + context for each loop iteration. This makes them ideal for table + based tests. Previously, with the loop in the test itself, only the + first error was caught and then the test would exit. Now all errors + are shown at once which should help in debugging + +* Added possibility to turn off timeout tests in check's own unit tests + through configure option --disable-timeout-tests. + +* Added coverage analysis for check's own unit tests. + +Thu, Aug 25, 2005: Released Check 0.9.3 + +Applied debian patches from debian maintainer. + +Fixed documentation bug #1216502. + +gcc 2.95.3 compatibility fixed (patch #1161654, bug #1211672). + +Messaging refactored to make it work with forking tests, and also with +threading tests on linux 2.4. Added check_fork and check_waitpid_and_exit +to be used for forking tests. (bug # 1233585) + +Timeout error message changed (feature request #1121452, bug #1160305). + +Fix check.spec for fc3 x86_64 (patch #1111782) + + +Fri, Nov 12, 2004: Released Check 0.9.2 + +Use strsignal to print describing text for signals. +Documented signals handling and timeouts. +Changed failure message for fail_if. +Added support for timeouts on tests, enabling detection of eternal loops. +Changed name on function list_create to check_list_create to avoid name clash. +Applied ANSI C99 patch (#1047014) for macro var args. +Cleaned up the self test verification to simplify merging of new tests. +Fixed debian and rpm targets + +Added support for testing on expected signals. Implementation courtesy of +Lucas Di Pentima and Cesar Ballardini. + + +Fri, Sep 3, 2004: Released Check 0.9.1 + +Updated tutorial with new features. +Added support for XML output of the test results, courtesy of Frederic Peters. +Fixed setup bug from forum, failure in setup did not abort test in nofork mode. +Applied varargs patch (#933411) and added test cases. +Applied fail_if (#709167) patch. +Applied 'newbies' patch #995028 for autoconf doc. +Applied doc patch #995028 from Bill Barnard. +Fixed portability problems tests by changing == to =. +Changed copyright according to bug report. +Applied patch 796705. Replacing _exit with exit. +Applied patch for bug 793671. + + +Mon, May 17, 2004: Released Check 0.9.0 + +Run fixture teardowns in reverse order to setup +Plugged some memory leaks. +Added test name to log outputs. +Applied patch (802160) for distcheck bug (579604). +Fixed log printouts for nofork mode. +Updated documentation and converted to DocBook. + +Added a new print mode, CK_ENV, that gets the print mode from the +environment variable CK_VERBOSITY. + +Made tcase_free and suite_free static. This may break existing test +programs. Everything is now freed when srunner_free is called. + + +Mon Oct 21, 2002: Released Check 0.8.4 + +Fixed pipe issues. +Allow to use check.h from C++. +Plugged some memory leaks. + + +Fri May 24, 2002: Released Check 0.8.3 + +Fixed various build problems. Fixed a problem with check.m4. +Documentation updates. + + +Mon Apr 15, 2002: Released Check 0.8.2 + +Added version information to headers and library. Added an autoconf +macro to easily integrate check into projects that use autoconf. + +Removed limitations on line number, message and buffer sizes. + +Declared constant string parameters as const. + + +Sat Mar 2, 2002: Released Check 0.8.1 + +Changed license to LGPL. + +Fixed bug in running checked setup in nofork mode. + + +Wed Oct 24, 2001: Released Check 0.8.0 + +Support running in a nofork mode. Defined a checked fixture as well as +an unchecked fixture, support failing in checked and uncheck fixture +functions, and errors in checked fixture functions. Rewrote the +back-end to use pipes, rather than message queues. + +Reimplemented printing functions in terms of string formatting +functions, to allow better testing of output without full end-to-end +testing. + +Renamed some public constants to use the CK_ naming convention. This +will break existing test programs. + +Documented the new features, and changed the distribution to include +sgml and html files, as well as lyx files, as many people don't have +lyx. + + +Thu Aug 23, 2001: Released Check 0.7.3 + +Fixed the Autoconf Lyx check in acinclude.m4 so that configure works +on Solaris systems (and hopefully others), and cleaned up a minor +problem in Debian packaging. + + +Fri Aug 17, 2001: Released Check 0.7.2 + +Automated RPM packaging, and included debian packaging. The makefiles +now has an rpm target (the RPMFLAGS variable can be set to add +additional flags to RPM). Debian packages are built the ordinary way +(dpkg-buildpackage). + +Moved the example*.* files to tutorial*.*, since the docs really are +tutorials. Beefed up the tutorial docs to add clarity to the behavior +of fixture setup/teardown (based on a helpful critique by Fred Drake), +and to document the static nature of unit tests demanded by the bug +fix below. + +Many bugfixes: added -Wall to the CCFLAGS for gcc, and fixed a mess of +warnings that resulted. Changed a bizarre naming mismatch in +tcase_set_fixture (masked by the lack of compile warnings), and made +unit tests static (both bugfixes suggested by Fred Drake). Also added +a more sophisticated test of Lyx to (hopefully) ensure that Lyx +supports linuxdoc (but it's not clear to me how to test that for +sure). + + +Wed Jul 30, 2001: Released Check 0.7.1 + +Reorganized printing and logging functions to allow for a less +primitive logging function. Logging is now documented in the tutorial +documentation. + + +Wed Jul 11, 2001: Released Check 0.7.0 + +Included a primitive logging function (at the moment, it only prints a +copy of the CRVERBOSE output to the log file), added the ability for +an SRunner to run multiple suites (and reorganized the Check tests to +take advantage of that), and added the magic to allow Check to be used +with C++. + +Also added Doxygen markup to the header file, but I'm not terribly +satisfied withe clarity of the output. I may switch to CWEB... Next +release should include API docs and improved logging, if nothing else +comes up... + + +Wed Jun 27, 2001: Released Check 0.6.1 + +Bug fix for srunner_failures (bad version actually returned all +results), added srunner_results to do what srunner_failures used to +do, and added corrected unit tests for both. + +Also changed the API for reporting the number of failed tests from +srunner_nfailed to srunner_ntests_failed, to harmonized better with +new function srunner_ntests_run. This unfortunately may break some +unit tests slightly -- that's why the major release number is 0 :-) + + +Thu Jun 21, 2001: Released Check 0.6.0 + +Features improved unit test reporting options, more complete unit +tests, and end-to-end test, and a full API into TestResults + + +Check 0.5.2 +Minor edits +Check 0.5.1 +GPL compliance release +Check 0.5.0 +Initial public release diff --git a/README b/README new file mode 100644 index 0000000..b28dc6e --- /dev/null +++ b/README @@ -0,0 +1,69 @@ +About Check +----------- + +Check is a unit test framework for C. It features a simple interface +for defining unit tests, putting little in the way of the +developer. Tests are run in a separate address space, so Check can +catch both assertion failures and code errors that cause segmentation +faults or other signals. The output from unit tests can be used within +source code editors and IDEs. + +See http://check.sourceforge.net/ for more information, including a +tutorial. The tutorial is also available as `info check'. + +Installation +------------ + +Check has the following dependencies: + + automake-1.9.6 + autoconf-2.59 + libtool-1.5.22 + pkg-config-0.20 + +First, do + +$ autoreconf --install + +in this directory to set everything up. autoreconf calls all of the +necessary tools for you, like autoconf, automake, autoheader, etc. If +you ever change something during development, run autoreconf again +(without --install), and it will perform the minimum set of actions +necessary. + +Then, read the directions in INSTALL if you need more information. + +Linking against Check +--------------------- + +Check uses variadic macros in check.h, and the strict C90 options for +gcc will complain about this. In gcc 4.0 and above you can turn this +off explicitly with -Wno-variadic-macros. In a future API it would be +nice to eliminate these macros. + +Debian rationale for not having upstream build packages (.deb files) +-------------------------------------------------------------------- + +For debian, it is highly undesirable if the upstream source contains a +debian directory as this one will never be the same as the "official" +Debian one, and patching is easier if it's not around. + +Sometimes upstream insists on having the possibility to build Debian +packages themselves, in which case it is best to have a debian +directory in the CVS, but not ship it when doing "make dist". + +Sometimes upstream insists on shipping the debian directory to their +users so these can easily build a .deb, which is really bad because +they usually don't remmeber to change the Debian changelog and version +accordingly, and generally don't know enough about Debian policy to +make conforming packages. + +So in the end you will have different broken packages compiled on +various systems floating around which all have the same version number +and look like offical packages. + + -- Robert Lemmen, 2006 + +The same holds for .rpm packages. The Check maintainer for Fedora +Extras, Tom 'spot' Callaway, confirmed that they do not depend on an +upstream rpm target in Check. diff --git a/SVNChangeLog b/SVNChangeLog new file mode 100644 index 0000000..7d31e7a --- /dev/null +++ b/SVNChangeLog @@ -0,0 +1,3424 @@ +------------------------------------------------------------------------ +r361 | cpickett | 2006-10-13 15:24:52 -0400 (Fri, 13 Oct 2006) | 2 lines +Changed paths: + M /tags/check-0.9.4/configure.ac + +* s/yes/no/ in --enable-gcov help message + +------------------------------------------------------------------------ +r360 | cpickett | 2006-10-13 15:22:25 -0400 (Fri, 13 Oct 2006) | 2 lines +Changed paths: + A /tags/check-0.9.4 (from /trunk:359) + +* Tag check-0.9.4 release. + +------------------------------------------------------------------------ +r359 | cpickett | 2006-10-13 14:40:38 -0400 (Fri, 13 Oct 2006) | 2 lines +Changed paths: + M /trunk/NEWS + M /trunk/index.html + +* Update NEWS. + +------------------------------------------------------------------------ +r358 | cpickett | 2006-10-13 14:23:09 -0400 (Fri, 13 Oct 2006) | 2 lines +Changed paths: + M /trunk/configure.ac + +* Oops, s/>:/:>/ + +------------------------------------------------------------------------ +r357 | cpickett | 2006-10-13 14:20:07 -0400 (Fri, 13 Oct 2006) | 2 lines +Changed paths: + M /trunk/configure.ac + +* Fixed help strings for --enable-gcov and --enable-timeout-tests + +------------------------------------------------------------------------ +r356 | cpickett | 2006-10-13 03:51:23 -0400 (Fri, 13 Oct 2006) | 2 lines +Changed paths: + M /trunk/index.html + +* Update links to projects using Check. + +------------------------------------------------------------------------ +r355 | cpickett | 2006-10-13 03:23:13 -0400 (Fri, 13 Oct 2006) | 2 lines +Changed paths: + M /trunk/TODO + +* Update TODO. + +------------------------------------------------------------------------ +r354 | cpickett | 2006-10-13 03:12:57 -0400 (Fri, 13 Oct 2006) | 2 lines +Changed paths: + M /trunk/index.html + +* Clean up webpage a little bit more. + +------------------------------------------------------------------------ +r353 | cpickett | 2006-10-13 03:08:35 -0400 (Fri, 13 Oct 2006) | 2 lines +Changed paths: + M /trunk/index.html + +* Update webpage. + +------------------------------------------------------------------------ +r352 | cpickett | 2006-10-13 02:33:37 -0400 (Fri, 13 Oct 2006) | 2 lines +Changed paths: + D /trunk/htdocs + A /trunk/index.html (from /trunk/htdocs/index.html:351) + +* Move website index.html into root directory. + +------------------------------------------------------------------------ +r351 | cpickett | 2006-10-13 02:12:16 -0400 (Fri, 13 Oct 2006) | 2 lines +Changed paths: + A /trunk/htdocs (from /trunk/website:350) + D /trunk/website + +* Rename website/ to htdocs/ + +------------------------------------------------------------------------ +r350 | cpickett | 2006-10-13 02:02:34 -0400 (Fri, 13 Oct 2006) | 2 lines +Changed paths: + M /trunk/website/index.html + +* Updated website. + +------------------------------------------------------------------------ +r346 | cpickett | 2006-10-13 00:15:58 -0400 (Fri, 13 Oct 2006) | 2 lines +Changed paths: + M /trunk/src/check.h.in + +* Add FIXME documenting broken fail_if and fail_unless macros. + +------------------------------------------------------------------------ +r345 | cpickett | 2006-10-13 00:15:28 -0400 (Fri, 13 Oct 2006) | 2 lines +Changed paths: + M /trunk/README + +* Mention dependencies better in README. + +------------------------------------------------------------------------ +r344 | cpickett | 2006-10-13 00:14:36 -0400 (Fri, 13 Oct 2006) | 2 lines +Changed paths: + A /trunk/website + A /trunk/website/doc + A /trunk/website/index.html + +* Create website directory with existing index.html. + +------------------------------------------------------------------------ +r343 | cpickett | 2006-10-13 00:13:07 -0400 (Fri, 13 Oct 2006) | 2 lines +Changed paths: + M /trunk/TODO + +* Update TODO. + +------------------------------------------------------------------------ +r342 | cpickett | 2006-10-13 00:12:41 -0400 (Fri, 13 Oct 2006) | 3 lines +Changed paths: + M /trunk/src/check.h.in + +* Indicate that the loop index `i' of a test might be unused + with __attribute__((unused)). + +------------------------------------------------------------------------ +r341 | cpickett | 2006-10-13 00:12:08 -0400 (Fri, 13 Oct 2006) | 2 lines +Changed paths: + M /trunk/src/check.h.in + +* Added tcase_add_loop_test_raise_signal() + +------------------------------------------------------------------------ +r340 | cpickett | 2006-10-13 00:11:22 -0400 (Fri, 13 Oct 2006) | 2 lines +Changed paths: + M /trunk/Makefile.am + M /trunk/TODO + +* Update TODO, tiny Makefile.am fixes + +------------------------------------------------------------------------ +r339 | cpickett | 2006-10-13 00:10:50 -0400 (Fri, 13 Oct 2006) | 2 lines +Changed paths: + M /trunk/src/check_log.c + +* Fixed printing of newlines in output. + +------------------------------------------------------------------------ +r338 | cpickett | 2006-10-13 00:09:56 -0400 (Fri, 13 Oct 2006) | 2 lines +Changed paths: + M /trunk/HACKING + M /trunk/README + M /trunk/TODO + M /trunk/configure.ac + M /trunk/doc/Makefile.am + D /trunk/doc/tutorial.sgml + +* Removed SGML / DocBook tutorial; Texinfo version supersedes it. + +------------------------------------------------------------------------ +r337 | cpickett | 2006-10-13 00:08:49 -0400 (Fri, 13 Oct 2006) | 3 lines +Changed paths: + M /trunk/Makefile.am + M /trunk/doc/Makefile.am + +* Fixed doc building for make distcheck. +* Cleaned up SVNChangeLog generation a little + +------------------------------------------------------------------------ +r336 | cpickett | 2006-10-13 00:08:19 -0400 (Fri, 13 Oct 2006) | 2 lines +Changed paths: + M /trunk/doc/Makefile.am + M /trunk/doc/check.texi + +* Cleaner building of diffs for check.texi + +------------------------------------------------------------------------ +r335 | cpickett | 2006-10-13 00:07:44 -0400 (Fri, 13 Oct 2006) | 2 lines +Changed paths: + M /trunk/doc/example/tests/Makefile.am + +* s/check_money_INCLUDES/check_money_CFLAGS/ in tests/Makefile.am + +------------------------------------------------------------------------ +r334 | cpickett | 2006-10-13 00:06:57 -0400 (Fri, 13 Oct 2006) | 2 lines +Changed paths: + M /trunk/TODO + +* Update TODO + +------------------------------------------------------------------------ +r333 | cpickett | 2006-10-13 00:05:59 -0400 (Fri, 13 Oct 2006) | 2 lines +Changed paths: + M /trunk/AUTHORS + M /trunk/Makefile.am + M /trunk/check.m4 + A /trunk/check.pc.in + M /trunk/configure.ac + +* Added check.pc.in for pkg-config support + +------------------------------------------------------------------------ +r332 | cpickett | 2006-10-13 00:05:10 -0400 (Fri, 13 Oct 2006) | 3 lines +Changed paths: + M /trunk/TODO + M /trunk/tests/check_check_fixture.c + M /trunk/tests/check_check_fork.c + M /trunk/tests/check_check_limit.c + M /trunk/tests/check_check_main.c + M /trunk/tests/check_check_master.c + +* Updated TODO, pulled in check.sourceforge.net TODO +* Made tests run with CK_VERBOSE instead of CK_SILENT + +------------------------------------------------------------------------ +r331 | cpickett | 2006-10-13 00:03:41 -0400 (Fri, 13 Oct 2006) | 2 lines +Changed paths: + A /trunk/HACKING + M /trunk/Makefile.am + +* Add SVNChangeLog generation, brief HACKING file + +------------------------------------------------------------------------ +r330 | cpickett | 2006-10-13 00:00:54 -0400 (Fri, 13 Oct 2006) | 2 lines +Changed paths: + M /trunk/doc/Makefile.am + +* Create money example diffs in tutorial Makefile.am + +------------------------------------------------------------------------ +r329 | cpickett | 2006-10-13 00:00:11 -0400 (Fri, 13 Oct 2006) | 2 lines +Changed paths: + M /trunk/doc/check.texi + +* Finished converting tutorial to Texinfo! + +------------------------------------------------------------------------ +r328 | cpickett | 2006-10-12 23:59:30 -0400 (Thu, 12 Oct 2006) | 2 lines +Changed paths: + M /trunk/doc/check.texi + +* Converted next section of Chapter 4 to Texinfo. + +------------------------------------------------------------------------ +r327 | cpickett | 2006-10-12 23:59:06 -0400 (Thu, 12 Oct 2006) | 2 lines +Changed paths: + M /trunk/doc/example/tests/check_money.c + +* Break another line for money_suite() + +------------------------------------------------------------------------ +r326 | cpickett | 2006-10-12 23:58:41 -0400 (Thu, 12 Oct 2006) | 2 lines +Changed paths: + M /trunk/doc/example/tests/check_money.3.c + M /trunk/doc/example/tests/check_money.6.c + M /trunk/doc/example/tests/check_money.7.c + +* Insert line break between type and name of money_suite() + +------------------------------------------------------------------------ +r325 | cpickett | 2006-10-12 23:58:04 -0400 (Thu, 12 Oct 2006) | 2 lines +Changed paths: + M /trunk/doc/example/tests/check_money.2.c + M /trunk/doc/example/tests/check_money.3.c + M /trunk/doc/example/tests/check_money.6.c + A /trunk/doc/example/tests/check_money.7.c + M /trunk/doc/example/tests/check_money.c + +* Added revision 7 of money example. + +------------------------------------------------------------------------ +r324 | cpickett | 2006-10-12 23:56:57 -0400 (Thu, 12 Oct 2006) | 2 lines +Changed paths: + M /trunk/doc/check.texi + +* Converted "No Fork Mode" section of Chapter 4 to Texinfo. + +------------------------------------------------------------------------ +r323 | cpickett | 2006-10-12 23:56:23 -0400 (Thu, 12 Oct 2006) | 2 lines +Changed paths: + M /trunk/doc/check.texi + +* Convert first section of tutorial Chapter 4 to Texinfo. + +------------------------------------------------------------------------ +r322 | cpickett | 2006-10-12 23:55:47 -0400 (Thu, 12 Oct 2006) | 3 lines +Changed paths: + A /trunk/doc/example/src/money.6.c + M /trunk/doc/example/src/money.c + M /trunk/doc/example/tests/check_money.2.c + M /trunk/doc/example/tests/check_money.3.c + A /trunk/doc/example/tests/check_money.6.c + +* Added revision 6 of money example. +* Fixed some whitespace errors in other revisions. + +------------------------------------------------------------------------ +r321 | cpickett | 2006-10-12 23:54:47 -0400 (Thu, 12 Oct 2006) | 2 lines +Changed paths: + M /trunk/doc/check.texi + +* Finally converted all of tutorial chapter 3 to Texinfo. + +------------------------------------------------------------------------ +r320 | cpickett | 2006-10-12 23:54:20 -0400 (Thu, 12 Oct 2006) | 2 lines +Changed paths: + A /trunk/doc/example/src/money.5.c + +* Added revision 5 of money example. + +------------------------------------------------------------------------ +r319 | cpickett | 2006-10-12 23:53:41 -0400 (Thu, 12 Oct 2006) | 2 lines +Changed paths: + A /trunk/doc/example/src/money.4.c + +* Added revision 4 of money example. + +------------------------------------------------------------------------ +r318 | cpickett | 2006-10-12 23:52:59 -0400 (Thu, 12 Oct 2006) | 2 lines +Changed paths: + M /trunk/doc/check.texi + +* Added next section of Chapter 3. + +------------------------------------------------------------------------ +r317 | cpickett | 2006-10-12 23:52:28 -0400 (Thu, 12 Oct 2006) | 2 lines +Changed paths: + A /trunk/doc/example/src/money.3.c + A /trunk/doc/example/tests/check_money.3.c + +* Added revision 3 of money example. + +------------------------------------------------------------------------ +r316 | cpickett | 2006-10-12 23:51:41 -0400 (Thu, 12 Oct 2006) | 2 lines +Changed paths: + A /trunk/doc/example/src/money.2.h + A /trunk/doc/example/tests/check_money.2.c + +* Added revision 2 of money example + +------------------------------------------------------------------------ +r315 | cpickett | 2006-10-12 23:50:38 -0400 (Thu, 12 Oct 2006) | 2 lines +Changed paths: + A /trunk/doc/example/src/money.1.c + A /trunk/doc/example/src/money.1.h + A /trunk/doc/example/tests/check_money.1.c + +* Added revision 1 of money example + +------------------------------------------------------------------------ +r314 | cpickett | 2006-10-12 23:49:07 -0400 (Thu, 12 Oct 2006) | 4 lines +Changed paths: + M /trunk/doc/check.texi + +* Converted the next section of chapter 3 to Texinfo. +* And actually, below, chapter 3 wasn't completed. The previous + section _in_ chapter 3 was completed. + +------------------------------------------------------------------------ +r313 | cpickett | 2006-10-12 23:48:36 -0400 (Thu, 12 Oct 2006) | 2 lines +Changed paths: + M /trunk/Makefile.am + +* include example/ dir in AM_MAKEINFOFLAGS + +------------------------------------------------------------------------ +r312 | cpickett | 2006-10-12 23:47:54 -0400 (Thu, 12 Oct 2006) | 2 lines +Changed paths: + M /trunk/doc/check.texi + +* Converted chapter 3 of manual to Texinfo. + +------------------------------------------------------------------------ +r311 | cpickett | 2006-10-12 23:47:07 -0400 (Thu, 12 Oct 2006) | 2 lines +Changed paths: + M /trunk/doc/example/tests/Makefile.am + +* small example Makefile.am fixes + +------------------------------------------------------------------------ +r310 | cpickett | 2006-10-12 23:46:43 -0400 (Thu, 12 Oct 2006) | 2 lines +Changed paths: + M /trunk/doc/example/tests/Makefile.am + +* add spaces to example Makefile.am + +------------------------------------------------------------------------ +r309 | cpickett | 2006-10-12 23:46:16 -0400 (Thu, 12 Oct 2006) | 2 lines +Changed paths: + M /trunk/AUTHORS + M /trunk/THANKS + +* Add Robert Lemmen to AUTHORS + +------------------------------------------------------------------------ +r308 | cpickett | 2006-10-12 23:45:52 -0400 (Thu, 12 Oct 2006) | 3 lines +Changed paths: + M /trunk/doc/tutorial.sgml + +* Applied patch from Robert Lemmen, adding test coverage description + to the (Docbook) manual. + +------------------------------------------------------------------------ +r307 | cpickett | 2006-10-12 23:45:09 -0400 (Thu, 12 Oct 2006) | 2 lines +Changed paths: + M /trunk/doc/check.texi + +* Partway through Chapter 3. + +------------------------------------------------------------------------ +r306 | cpickett | 2006-10-12 23:44:39 -0400 (Thu, 12 Oct 2006) | 2 lines +Changed paths: + M /trunk/doc/check.texi + +* Converted chapter 2 of manual to Texinfo. + +------------------------------------------------------------------------ +r305 | cpickett | 2006-10-12 23:44:12 -0400 (Thu, 12 Oct 2006) | 2 lines +Changed paths: + M /trunk/doc/check.texi + +* Converted first chapter to Texinfo. + +------------------------------------------------------------------------ +r304 | cpickett | 2006-10-12 23:43:41 -0400 (Thu, 12 Oct 2006) | 2 lines +Changed paths: + M /trunk/doc/check.texi + +* Update manual structure a little. + +------------------------------------------------------------------------ +r303 | cpickett | 2006-10-12 23:43:12 -0400 (Thu, 12 Oct 2006) | 2 lines +Changed paths: + M /trunk/doc/Makefile.am + M /trunk/doc/check.texi + A /trunk/doc/fdl.texi + +* add hooks to Makefile.am, include copy of FDL + +------------------------------------------------------------------------ +r302 | cpickett | 2006-10-12 23:41:40 -0400 (Thu, 12 Oct 2006) | 2 lines +Changed paths: + A /trunk/doc/check.texi (from /trunk/doc/tutorial.texi:301) + D /trunk/doc/tutorial.texi + +* rename tutorial.texi to check.texi + +------------------------------------------------------------------------ +r301 | cpickett | 2006-10-12 23:41:09 -0400 (Thu, 12 Oct 2006) | 2 lines +Changed paths: + A /trunk/doc/tutorial.texi + +* create Texinfo boilerplate for Check manual / tutorial + +------------------------------------------------------------------------ +r300 | cpickett | 2006-10-12 23:40:25 -0400 (Thu, 12 Oct 2006) | 3 lines +Changed paths: + M /trunk/check.m4 + +* Applied patch from Loic Minier to fix check.m4. + From http://bugs.debian.org/cgi-bin/bugreport.cgi?bug=342864 + +------------------------------------------------------------------------ +r299 | cpickett | 2006-10-12 23:39:41 -0400 (Thu, 12 Oct 2006) | 3 lines +Changed paths: + M /trunk/TODO + M /trunk/configure.ac + M /trunk/doc/example/configure.ac + M /trunk/src/Makefile.am + M /trunk/tests/Makefile.am + +* update check to use libtool, now both static and shared + libraries are created. + +------------------------------------------------------------------------ +r298 | cpickett | 2006-10-12 23:38:33 -0400 (Thu, 12 Oct 2006) | 2 lines +Changed paths: + M /trunk/doc/Makefile.am + +* include money src, tests in doc EXTRA_DIST + +------------------------------------------------------------------------ +r297 | cpickett | 2006-10-12 23:38:07 -0400 (Thu, 12 Oct 2006) | 2 lines +Changed paths: + M /trunk/TODO + M /trunk/doc/Makefile.am + +* fix installation of tutorial and example docs + +------------------------------------------------------------------------ +r296 | cpickett | 2006-10-12 23:37:39 -0400 (Thu, 12 Oct 2006) | 2 lines +Changed paths: + M /trunk/doc/Makefile.am + +* include example README in distribution + +------------------------------------------------------------------------ +r295 | cpickett | 2006-10-12 23:37:00 -0400 (Thu, 12 Oct 2006) | 2 lines +Changed paths: + A /trunk/doc/example/README + +* add README to money example + +------------------------------------------------------------------------ +r294 | cpickett | 2006-10-12 23:34:16 -0400 (Thu, 12 Oct 2006) | 2 lines +Changed paths: + M /trunk/doc/tutorial.sgml + +* add a missing quote to tutorial + +------------------------------------------------------------------------ +r293 | cpickett | 2006-10-12 23:33:25 -0400 (Thu, 12 Oct 2006) | 2 lines +Changed paths: + M /trunk/doc/example/configure.ac + M /trunk/doc/example/src/Makefile.am + M /trunk/doc/example/src/money.c + M /trunk/doc/example/tests/Makefile.am + M /trunk/doc/example/tests/check_money.c + +* fix money example somewhat + +------------------------------------------------------------------------ +r292 | cpickett | 2006-10-12 23:32:46 -0400 (Thu, 12 Oct 2006) | 2 lines +Changed paths: + M /trunk/configure.ac + +* change unique file in AC_CONFIG_SRCDIR + +------------------------------------------------------------------------ +r291 | cpickett | 2006-10-12 23:32:02 -0400 (Thu, 12 Oct 2006) | 2 lines +Changed paths: + M /trunk/Makefile.am + M /trunk/configure.ac + M /trunk/doc/Makefile.am + +* Use $(datadir) in Makefile.am's + +------------------------------------------------------------------------ +r290 | cpickett | 2006-10-12 23:31:33 -0400 (Thu, 12 Oct 2006) | 2 lines +Changed paths: + M /trunk/doc/Makefile.am + +* Adjusted doc Makefile.am to use example, tutorial subdirs better + +------------------------------------------------------------------------ +r289 | cpickett | 2006-10-12 23:30:47 -0400 (Thu, 12 Oct 2006) | 2 lines +Changed paths: + M /trunk/doc/example/Makefile.am + M /trunk/doc/example/configure.ac + A /trunk/doc/example/src/Makefile.am + A /trunk/doc/example/src/main.c + M /trunk/doc/example/src/money.c + M /trunk/doc/example/src/money.h + A /trunk/doc/example/tests/Makefile.am + M /trunk/doc/example/tests/check_money.c + +* Rewrite Makefiles to accomodate new example structure + +------------------------------------------------------------------------ +r288 | cpickett | 2006-10-12 23:28:43 -0400 (Thu, 12 Oct 2006) | 2 lines +Changed paths: + D /trunk/doc/example/check_money.c + D /trunk/doc/example/money.c + D /trunk/doc/example/money.h + A /trunk/doc/example/src + A /trunk/doc/example/src/money.c (from /trunk/doc/example/money.c:285) + A /trunk/doc/example/src/money.h (from /trunk/doc/example/money.h:285) + A /trunk/doc/example/tests + A /trunk/doc/example/tests/check_money.c (from /trunk/doc/example/check_money.c:285) + +* Move money example source into src/ and tests/ + +------------------------------------------------------------------------ +r287 | cpickett | 2006-10-12 23:26:35 -0400 (Thu, 12 Oct 2006) | 3 lines +Changed paths: + A /trunk/doc/example/Makefile.am (from /trunk/doc/example/Makefile.am.money:285) + D /trunk/doc/example/Makefile.am.money + A /trunk/doc/example/configure.ac (from /trunk/doc/example/configure.in.money:285) + D /trunk/doc/example/configure.in.money + +* Renamed Makefile.am.money to Makefile.am +* Renamed configure.in.money to configure.ac + +------------------------------------------------------------------------ +r286 | cpickett | 2006-10-12 23:24:34 -0400 (Thu, 12 Oct 2006) | 2 lines +Changed paths: + D /trunk/doc/example/Makefile.am + +* delete old Makefile.am + +------------------------------------------------------------------------ +r285 | cpickett | 2006-10-12 23:23:36 -0400 (Thu, 12 Oct 2006) | 2 lines +Changed paths: + A /trunk/doc/example (from /trunk/doc/money:284) + D /trunk/doc/money + +* Rename money to example + +------------------------------------------------------------------------ +r284 | cpickett | 2006-10-12 23:19:55 -0400 (Thu, 12 Oct 2006) | 2 lines +Changed paths: + M /trunk/TODO + D /trunk/doc/money/aclocal.m4 + +* Update TODO, remove generated aclocal.m4 from money example + +------------------------------------------------------------------------ +r283 | cpickett | 2006-10-12 23:18:54 -0400 (Thu, 12 Oct 2006) | 5 lines +Changed paths: + D /trunk/INSTALL + M /trunk/README + M /trunk/THANKS + M /trunk/TODO + M /trunk/configure.ac + D /trunk/rpm + +* Remove installation instructions +* Remove rpm target altogether +* Update README with comments from downstream Fedora Extras + and Debian maintainers + +------------------------------------------------------------------------ +r282 | cpickett | 2006-10-12 23:18:04 -0400 (Thu, 12 Oct 2006) | 4 lines +Changed paths: + M /trunk/Makefile.am + M /trunk/tests/Makefile.am + +* Removed $(MAKE) compilation of libcheck.a in tests/Makefile.am +* Removed core from CLEANFILES in tests/Makefile.am +* Put tests at the end of top-level SUBDIRS + +------------------------------------------------------------------------ +r281 | cpickett | 2006-10-12 23:17:18 -0400 (Thu, 12 Oct 2006) | 2 lines +Changed paths: + D /trunk/Doxyfile + +* delete obsolete Doxyfile + +------------------------------------------------------------------------ +r280 | cpickett | 2006-10-12 23:16:36 -0400 (Thu, 12 Oct 2006) | 2 lines +Changed paths: + A /trunk/TODO + +* simple TODO file, just build issues for now + +------------------------------------------------------------------------ +r279 | cpickett | 2006-10-12 23:15:57 -0400 (Thu, 12 Oct 2006) | 2 lines +Changed paths: + M /trunk/Makefile.am + M /trunk/configure.ac + M /trunk/doc/Makefile.am + M /trunk/doc/money/Makefile.am + +* various fixes to doc building and installation + +------------------------------------------------------------------------ +r278 | cpickett | 2006-10-12 23:15:21 -0400 (Thu, 12 Oct 2006) | 2 lines +Changed paths: + M /trunk/Makefile.am + M /trunk/configure.ac + +* Remove debian from top-level Makefile.am and configure.ac + +------------------------------------------------------------------------ +r277 | cpickett | 2006-10-12 23:14:20 -0400 (Thu, 12 Oct 2006) | 3 lines +Changed paths: + M /trunk/Makefile.am + M /trunk/NEWS + M /trunk/configure.ac + M /trunk/doc/Makefile.am + M /trunk/doc/money/Makefile.am + +* Got rid of --enable-plain-docdir : just let packagers take care + of this if they want to. + +------------------------------------------------------------------------ +r276 | cpickett | 2006-10-12 23:13:37 -0400 (Thu, 12 Oct 2006) | 3 lines +Changed paths: + D /trunk/debian + +* Delete debian/ per Debian maintainer's suggestion + -- it's better not for upstream to manage packaging for distributions + +------------------------------------------------------------------------ +r275 | cpickett | 2006-10-12 23:12:50 -0400 (Thu, 12 Oct 2006) | 8 lines +Changed paths: + M /trunk/NEWS + M /trunk/configure.ac + M /trunk/doc/Makefile.am + M /trunk/src/Makefile.am + M /trunk/tests/Makefile.am + +* Replaced .. usage in Makefile.am's with $(top_builddir) or + $(top_srcdir) where appropriate + -- make distcheck now works, make distcleancheck and + make distuninstallcheck do not +* Added core to CLEANFILES in tests/Makefile.am +* Bumped version to 0.9.4, added notice to top of NEWS + -- should bump version in CVS right after release + +------------------------------------------------------------------------ +r274 | cpickett | 2006-10-12 23:11:12 -0400 (Thu, 12 Oct 2006) | 2 lines +Changed paths: + M /trunk/Makefile.am + M /trunk/debian/Makefile.am + M /trunk/doc/Makefile.am + M /trunk/doc/money/Makefile.am + M /trunk/doc/money/Makefile.am.money + M /trunk/rpm/Makefile.am + M /trunk/src/Makefile.am + M /trunk/tests/Makefile.am + +* Comments in Makefile.am's + +------------------------------------------------------------------------ +r273 | cpickett | 2006-10-12 23:10:08 -0400 (Thu, 12 Oct 2006) | 2 lines +Changed paths: + M /trunk/AUTHORS + M /trunk/NEWS + +* Add change notice to AUTHORS, NEWS + +------------------------------------------------------------------------ +r272 | cpickett | 2006-10-12 23:09:21 -0400 (Thu, 12 Oct 2006) | 2 lines +Changed paths: + M /trunk/README + +* Updated README to mention docbook2html + +------------------------------------------------------------------------ +r271 | cpickett | 2006-10-12 23:08:27 -0400 (Thu, 12 Oct 2006) | 2 lines +Changed paths: + M /trunk/Makefile.am + +* Remove autogen.sh from EXTRA_DIST + +------------------------------------------------------------------------ +r270 | cpickett | 2006-10-12 23:07:50 -0400 (Thu, 12 Oct 2006) | 2 lines +Changed paths: + M /trunk/Makefile.am + +* Change COPYING to COPYING.LESSER in Makefile.am + +------------------------------------------------------------------------ +r269 | cpickett | 2006-10-12 23:06:36 -0400 (Thu, 12 Oct 2006) | 2 lines +Changed paths: + M /trunk/configure.ac + +* remove accidental junk line from configure.ac + +------------------------------------------------------------------------ +r268 | cpickett | 2006-10-12 23:05:55 -0400 (Thu, 12 Oct 2006) | 3 lines +Changed paths: + D /trunk/acinclude.m4 + D /trunk/stamp-h.in + +* Removed acinclude.m4 because it was empty +* Removed stamp-h.in because it is automatically generated + +------------------------------------------------------------------------ +r267 | cpickett | 2006-10-12 23:05:06 -0400 (Thu, 12 Oct 2006) | 6 lines +Changed paths: + D /trunk/COPYING + A /trunk/COPYING.LESSER + +* Removed COPYING, replaced with COPYING.LESSER + The LGPL-2.1 in COPYING had some problems: + -- out of date, FSF address has changed + -- formatting (linebreaks and such) has changed or is unofficial + -- COPYING is actually for GPL, so use COPYING.LESSER instead + +------------------------------------------------------------------------ +r266 | cpickett | 2006-10-12 23:02:53 -0400 (Thu, 12 Oct 2006) | 2 lines +Changed paths: + M /trunk/tests/Makefile.am + +* change INCLUDES to AM_CPPFLAGS to stop Automake from complaining + +------------------------------------------------------------------------ +r265 | cpickett | 2006-10-12 23:01:50 -0400 (Thu, 12 Oct 2006) | 3 lines +Changed paths: + M /trunk/AUTHORS + A /trunk/THANKS + +* moved design suggestions out of AUTHORS and into THANKS + -- AUTHORS is for people with copyright over some piece of Check + +------------------------------------------------------------------------ +r264 | cpickett | 2006-10-12 22:58:52 -0400 (Thu, 12 Oct 2006) | 4 lines +Changed paths: + M /trunk/configure.ac + +* Updated configure.ac to use 2.59 macro syntax +* Ran autoscan, merged generated configure.scan with configure.ac + -- this resolves autoscan warnings + +------------------------------------------------------------------------ +r263 | cpickett | 2006-10-12 22:57:19 -0400 (Thu, 12 Oct 2006) | 17 lines +Changed paths: + M /trunk/README + D /trunk/autogen.sh + D /trunk/config.h.in + +* Removed config.h.in -- generated automatically by autoheader + +* Removed autogen.sh. Unnecessary features inside included: + 1) checking version of autoconf, automake (twice each) + 2) checking for being in the top-level project dir + 3) running configure automatically + 4) specifying --include-deps to automake (obsolete) + 5) some autoheader line I don't understand: + (autoheader --version) < /dev/null > /dev/null 2>&1 && autoheader + 6) calling configure --enable-maintainer-mode, which is no + longer recognized by configure + +* Updated README to specify latest autoconf and automake, + and usage of autoreconf --install instead of ./autogen.sh + +* Note: this build is still broken + +------------------------------------------------------------------------ +r262 | cpickett | 2006-10-12 22:09:26 -0400 (Thu, 12 Oct 2006) | 2 lines +Changed paths: + A /trunk/configure.ac (from /trunk/configure.in:261) + D /trunk/configure.in + +* svn mv configure.in configure.ac + +------------------------------------------------------------------------ +r261 | cpickett | 2006-10-12 20:29:39 -0400 (Thu, 12 Oct 2006) | 2 lines +Changed paths: + D /trunk/check + +* Remove old trunk/check directory. + +------------------------------------------------------------------------ +r260 | cpickett | 2006-10-12 20:24:56 -0400 (Thu, 12 Oct 2006) | 2 lines +Changed paths: + A /trunk/.cvsignore (from /trunk/check/.cvsignore:259) + A /trunk/AUTHORS (from /trunk/check/AUTHORS:259) + A /trunk/COPYING (from /trunk/check/COPYING:259) + A /trunk/ChangeLog (from /trunk/check/ChangeLog:259) + A /trunk/ChangeLogOld (from /trunk/check/ChangeLogOld:259) + A /trunk/Doxyfile (from /trunk/check/Doxyfile:259) + A /trunk/INSTALL (from /trunk/check/INSTALL:259) + A /trunk/Makefile.am (from /trunk/check/Makefile.am:259) + A /trunk/NEWS (from /trunk/check/NEWS:259) + A /trunk/README (from /trunk/check/README:259) + A /trunk/acinclude.m4 (from /trunk/check/acinclude.m4:259) + A /trunk/autogen.sh (from /trunk/check/autogen.sh:259) + D /trunk/check/.cvsignore + D /trunk/check/AUTHORS + D /trunk/check/COPYING + D /trunk/check/ChangeLog + D /trunk/check/ChangeLogOld + D /trunk/check/Doxyfile + D /trunk/check/INSTALL + D /trunk/check/Makefile.am + D /trunk/check/NEWS + D /trunk/check/README + D /trunk/check/acinclude.m4 + D /trunk/check/autogen.sh + D /trunk/check/check.m4 + D /trunk/check/config.h.in + D /trunk/check/configure.in + D /trunk/check/debian + D /trunk/check/doc + D /trunk/check/rpm + D /trunk/check/src + D /trunk/check/stamp-h.in + D /trunk/check/tests + A /trunk/check.m4 (from /trunk/check/check.m4:259) + A /trunk/config.h.in (from /trunk/check/config.h.in:259) + A /trunk/configure.in (from /trunk/check/configure.in:259) + A /trunk/debian (from /trunk/check/debian:259) + A /trunk/doc (from /trunk/check/doc:259) + A /trunk/rpm (from /trunk/check/rpm:259) + A /trunk/src (from /trunk/check/src:259) + A /trunk/stamp-h.in (from /trunk/check/stamp-h.in:259) + A /trunk/tests (from /trunk/check/tests:259) + +* Move trunk/check/* to trunk/. + +------------------------------------------------------------------------ +r259 | hugo303 | 2005-12-16 10:19:16 -0500 (Fri, 16 Dec 2005) | 2 lines +Changed paths: + M /trunk/check/ChangeLog + +Fixed eprintf arguments + +------------------------------------------------------------------------ +r258 | hugo303 | 2005-12-16 10:07:01 -0500 (Fri, 16 Dec 2005) | 2 lines +Changed paths: + M /trunk/check/src/check_pack.c + +Fixed eprintf string + +------------------------------------------------------------------------ +r257 | hugo303 | 2005-10-31 07:35:18 -0500 (Mon, 31 Oct 2005) | 2 lines +Changed paths: + M /trunk/check/ChangeLog + M /trunk/check/NEWS + +Fixed sourceforge bug #1327225, Two teardown checked fixtures segfaults + +------------------------------------------------------------------------ +r256 | hugo303 | 2005-10-31 07:29:12 -0500 (Mon, 31 Oct 2005) | 2 lines +Changed paths: + M /trunk/check/tests/check_check_fixture.c + +Added tests for several setup and teardown functions. + +------------------------------------------------------------------------ +r255 | hugo303 | 2005-10-31 07:25:59 -0500 (Mon, 31 Oct 2005) | 2 lines +Changed paths: + M /trunk/check/tests/check_list.c + +Added tests for list_add_front. + +------------------------------------------------------------------------ +r254 | hugo303 | 2005-10-31 07:25:12 -0500 (Mon, 31 Oct 2005) | 2 lines +Changed paths: + M /trunk/check/src/check_list.c + +Fixed memove bug in list_add_front. Pointer arithmetics bites again. + +------------------------------------------------------------------------ +r253 | hugo303 | 2005-09-30 08:19:44 -0400 (Fri, 30 Sep 2005) | 2 lines +Changed paths: + M /trunk/check/ChangeLog + M /trunk/check/doc/tutorial.sgml + +Updated documentation with a section about looping tests + +------------------------------------------------------------------------ +r252 | hugo303 | 2005-09-30 07:43:03 -0400 (Fri, 30 Sep 2005) | 2 lines +Changed paths: + M /trunk/check/ChangeLog + M /trunk/check/NEWS + M /trunk/check/src/check.c + M /trunk/check/src/check.h.in + M /trunk/check/src/check_impl.h + M /trunk/check/src/check_print.c + M /trunk/check/src/check_run.c + M /trunk/check/src/check_str.c + M /trunk/check/tests/Makefile.am + M /trunk/check/tests/check_check_fixture.c + M /trunk/check/tests/check_check_master.c + M /trunk/check/tests/ex_xml_output.c + M /trunk/check/tests/test_log_output.sh + M /trunk/check/tests/test_output.sh + M /trunk/check/tests/test_xml_output.sh + +Looping tests added + +------------------------------------------------------------------------ +r251 | hugo303 | 2005-09-21 10:42:10 -0400 (Wed, 21 Sep 2005) | 2 lines +Changed paths: + M /trunk/check/tests/check_check_sub.c + +Fixed line number error introduced when adding configure option --enable-timeout-tests=no + +------------------------------------------------------------------------ +r250 | hugo303 | 2005-09-15 09:04:17 -0400 (Thu, 15 Sep 2005) | 2 lines +Changed paths: + M /trunk/check/ChangeLog + M /trunk/check/configure.in + M /trunk/check/tests/Makefile.am + M /trunk/check/tests/check_check.h + M /trunk/check/tests/check_check_master.c + M /trunk/check/tests/check_check_sub.c + +Added possibility to turn off timeout tests through configure option --enable-timeout-tests=no + +------------------------------------------------------------------------ +r249 | hugo303 | 2005-09-15 05:55:21 -0400 (Thu, 15 Sep 2005) | 2 lines +Changed paths: + M /trunk/check/ChangeLog + +Coverage improvements + +------------------------------------------------------------------------ +r248 | hugo303 | 2005-09-15 05:52:26 -0400 (Thu, 15 Sep 2005) | 2 lines +Changed paths: + M /trunk/check/src/Makefile.am + +Improved coverage analysis by running all tests before compiling result. Added gcc3.3 coverage bug workaround. + +------------------------------------------------------------------------ +r247 | hugo303 | 2005-09-15 05:49:11 -0400 (Thu, 15 Sep 2005) | 2 lines +Changed paths: + M /trunk/check/tests/check_check_master.c + M /trunk/check/tests/check_check_sub.c + +Added testing of timeout set through environment variable + +------------------------------------------------------------------------ +r246 | hugo303 | 2005-09-14 10:24:14 -0400 (Wed, 14 Sep 2005) | 2 lines +Changed paths: + M /trunk/check/ChangeLog + +Added gcov/lcov support + +------------------------------------------------------------------------ +r245 | hugo303 | 2005-09-07 11:10:17 -0400 (Wed, 07 Sep 2005) | 2 lines +Changed paths: + M /trunk/check/configure.in + M /trunk/check/src/Makefile.am + M /trunk/check/tests/Makefile.am + +Added gcov/lcov support + +------------------------------------------------------------------------ +r244 | hugo303 | 2005-09-07 10:35:18 -0400 (Wed, 07 Sep 2005) | 2 lines +Changed paths: + M /trunk/check/tests/Makefile.am + +Clean emacs temp files + +------------------------------------------------------------------------ +r243 | hugo303 | 2005-09-07 10:24:57 -0400 (Wed, 07 Sep 2005) | 2 lines +Changed paths: + M /trunk/check/tests/check_list.c + +Added a test to get 100% coverage + +------------------------------------------------------------------------ +r241 | hugo303 | 2005-08-30 05:12:23 -0400 (Tue, 30 Aug 2005) | 2 lines +Changed paths: + M /trunk/check/ChangeLog + +Post 0.9.3 fixes + +------------------------------------------------------------------------ +r240 | hugo303 | 2005-08-30 05:05:22 -0400 (Tue, 30 Aug 2005) | 2 lines +Changed paths: + A /trunk/check/debian/README.Debian + A /trunk/check/debian/compat + M /trunk/check/debian/copyright + A /trunk/check/debian/docs + A /trunk/check/debian/example_makefile + A /trunk/check/debian/examples + A /trunk/check/debian/watch + +Added new debian files, missed in the checkin of the debian patch + +------------------------------------------------------------------------ +r239 | hugo303 | 2005-08-30 04:40:11 -0400 (Tue, 30 Aug 2005) | 2 lines +Changed paths: + M /trunk/check/NEWS + +Added missed NEWS update for 0.9.3 + +------------------------------------------------------------------------ +r237 | hugo303 | 2005-08-23 09:28:00 -0400 (Tue, 23 Aug 2005) | 2 lines +Changed paths: + M /trunk/check/ChangeLog + +Added debian fixes + +------------------------------------------------------------------------ +r236 | hugo303 | 2005-08-22 09:46:48 -0400 (Mon, 22 Aug 2005) | 2 lines +Changed paths: + M /trunk/check/debian/changelog + M /trunk/check/debian/check.doc-base.tut + M /trunk/check/debian/check.docs + M /trunk/check/debian/check.postinst.debhelper + M /trunk/check/debian/check.prerm.debhelper + M /trunk/check/debian/control + M /trunk/check/debian/copyright + M /trunk/check/debian/dirs + M /trunk/check/debian/rules + +Applied patch for debian files received from check debian maintainer Robert Lemmen + +------------------------------------------------------------------------ +r235 | hugo303 | 2005-08-22 09:42:53 -0400 (Mon, 22 Aug 2005) | 2 lines +Changed paths: + M /trunk/check/src/check.h.in + +Added include of stddef.h for NULL definition + +------------------------------------------------------------------------ +r234 | hugo303 | 2005-08-22 09:36:43 -0400 (Mon, 22 Aug 2005) | 2 lines +Changed paths: + M /trunk/check/doc/tutorial.sgml + +Fixed sourceforge bug #1216502 + +------------------------------------------------------------------------ +r233 | hugo303 | 2005-07-19 09:53:37 -0400 (Tue, 19 Jul 2005) | 2 lines +Changed paths: + M /trunk/check/configure.in + +Updated for 0.9.3 release + +------------------------------------------------------------------------ +r232 | hugo303 | 2005-07-19 09:02:43 -0400 (Tue, 19 Jul 2005) | 2 lines +Changed paths: + M /trunk/check/ChangeLog + +Refactored messaging + +------------------------------------------------------------------------ +r231 | hugo303 | 2005-07-19 08:54:45 -0400 (Tue, 19 Jul 2005) | 2 lines +Changed paths: + M /trunk/check/src/check.c + M /trunk/check/src/check.h.in + M /trunk/check/src/check_msg.c + M /trunk/check/src/check_msg.h + M /trunk/check/src/check_run.c + M /trunk/check/tests/check_check_master.c + M /trunk/check/tests/check_check_msg.c + M /trunk/check/tests/check_check_sub.c + +Refactored messaging to use the new tmpfile() method all the way, removing the message keys, pipes, pipe entries and pipe list. This makes the messaging work with forking tests, and also with threading tests on linux 2.4 (on 2.6 it already worked). Added check_fork and check_waitpid_and_exit to be used for forking tests. + +------------------------------------------------------------------------ +r230 | hugo303 | 2005-07-18 07:05:00 -0400 (Mon, 18 Jul 2005) | 2 lines +Changed paths: + M /trunk/check/tests/check_check_main.c + +Use correct variable for number of tests + +------------------------------------------------------------------------ +r229 | hugo303 | 2005-05-26 16:12:31 -0400 (Thu, 26 May 2005) | 2 lines +Changed paths: + M /trunk/check/ChangeLog + M /trunk/check/debian/Makefile.am + +Removed 'files' file from DIST + +------------------------------------------------------------------------ +r228 | hugo303 | 2005-03-29 09:30:06 -0500 (Tue, 29 Mar 2005) | 2 lines +Changed paths: + M /trunk/check/ChangeLog + M /trunk/check/src/check.h.in + +Fixed gcc 2.95.3 compatibility for VA_ARGS in fail_if + +------------------------------------------------------------------------ +r227 | hugo303 | 2005-03-29 09:25:56 -0500 (Tue, 29 Mar 2005) | 2 lines +Changed paths: + M /trunk/check/src/check_run.c + +Removed warning introduced by 2005-03-01 test timeout fix + +------------------------------------------------------------------------ +r226 | hugo303 | 2005-03-02 08:07:07 -0500 (Wed, 02 Mar 2005) | 2 lines +Changed paths: + M /trunk/check/ChangeLog + M /trunk/check/src/check.h.in + +Added define for NULL if needed + +------------------------------------------------------------------------ +r225 | hugo303 | 2005-03-01 04:46:47 -0500 (Tue, 01 Mar 2005) | 2 lines +Changed paths: + M /trunk/check/ChangeLog + M /trunk/check/src/check_run.c + +Changed timeout error message + +------------------------------------------------------------------------ +r224 | hugo303 | 2005-03-01 04:41:31 -0500 (Tue, 01 Mar 2005) | 2 lines +Changed paths: + M /trunk/check/tests/check_check_master.c + +Updated tests for timeout message change + +------------------------------------------------------------------------ +r223 | hugo303 | 2005-02-28 09:46:46 -0500 (Mon, 28 Feb 2005) | 2 lines +Changed paths: + M /trunk/check/ChangeLog + D /trunk/check/debian/files + +Removed auto generated debian file + +------------------------------------------------------------------------ +r222 | hugo303 | 2005-02-28 09:06:23 -0500 (Mon, 28 Feb 2005) | 2 lines +Changed paths: + M /trunk/check/ChangeLog + M /trunk/check/rpm/check.spec.in + +Added patch for x86_64 arch (fc3) + +------------------------------------------------------------------------ +r221 | hugo303 | 2005-02-28 08:42:53 -0500 (Mon, 28 Feb 2005) | 2 lines +Changed paths: + M /trunk/check/ChangeLog + +Fixed mem leaks + +------------------------------------------------------------------------ +r220 | hugo303 | 2005-02-28 08:35:19 -0500 (Mon, 28 Feb 2005) | 2 lines +Changed paths: + M /trunk/check/tests/ex_output.c + +Added free of srunner + +------------------------------------------------------------------------ +r219 | hugo303 | 2005-02-28 08:28:06 -0500 (Mon, 28 Feb 2005) | 2 lines +Changed paths: + M /trunk/check/src/check_log.c + +Fixed memory leaks in xml log + +------------------------------------------------------------------------ +r218 | hugo303 | 2005-02-28 08:26:59 -0500 (Mon, 28 Feb 2005) | 2 lines +Changed paths: + M /trunk/check/tests/ex_log_output.c + M /trunk/check/tests/ex_xml_output.c + +Added free of srunner + +------------------------------------------------------------------------ +r216 | hugo303 | 2005-01-04 04:42:35 -0500 (Tue, 04 Jan 2005) | 2 lines +Changed paths: + M /trunk/check/debian/files + +Fixed for 0.9.2 + +------------------------------------------------------------------------ +r215 | hugo303 | 2005-01-04 03:57:00 -0500 (Tue, 04 Jan 2005) | 2 lines +Changed paths: + M /trunk/check/ChangeLog + +Updated with latest changes + +------------------------------------------------------------------------ +r214 | hugo303 | 2005-01-04 03:56:03 -0500 (Tue, 04 Jan 2005) | 2 lines +Changed paths: + M /trunk/check/check.m4 + M /trunk/check/config.h.in + M /trunk/check/configure.in + M /trunk/check/src/check_pack.c + +Fixed quoting and added configure test for stdint.h. + +------------------------------------------------------------------------ +r213 | hugo303 | 2005-01-04 03:47:04 -0500 (Tue, 04 Jan 2005) | 2 lines +Changed paths: + M /trunk/check/tests/check_check_master.c + +Made fail strings more helpful + +------------------------------------------------------------------------ +r212 | hugo303 | 2004-11-12 06:00:49 -0500 (Fri, 12 Nov 2004) | 2 lines +Changed paths: + M /trunk/check/ChangeLog + +Debian fixes + +------------------------------------------------------------------------ +r211 | hugo303 | 2004-11-12 05:56:36 -0500 (Fri, 12 Nov 2004) | 2 lines +Changed paths: + M /trunk/check/debian/changelog + M /trunk/check/debian/check.dirs + M /trunk/check/debian/control + M /trunk/check/debian/rules + +Fixed building with gcc3. Removed empty money dir from docs + +------------------------------------------------------------------------ +r210 | hugo303 | 2004-11-11 06:19:24 -0500 (Thu, 11 Nov 2004) | 2 lines +Changed paths: + M /trunk/check/debian/control + M /trunk/check/rpm/check.spec.in + +Fixed mail address + +------------------------------------------------------------------------ +r209 | hugo303 | 2004-11-10 07:49:49 -0500 (Wed, 10 Nov 2004) | 2 lines +Changed paths: + M /trunk/check/rpm/Makefile.am + +Added autogenerated check.spec to CLEANFILES + +------------------------------------------------------------------------ +r208 | hugo303 | 2004-11-10 07:26:29 -0500 (Wed, 10 Nov 2004) | 2 lines +Changed paths: + M /trunk/check/ChangeLog + M /trunk/check/NEWS + +Preparations for 0.9.2 release + +------------------------------------------------------------------------ +r207 | hugo303 | 2004-11-10 07:16:57 -0500 (Wed, 10 Nov 2004) | 2 lines +Changed paths: + M /trunk/check/ChangeLog + +Use strsignal to print describing text for signals. + +------------------------------------------------------------------------ +r206 | hugo303 | 2004-11-10 07:12:35 -0500 (Wed, 10 Nov 2004) | 2 lines +Changed paths: + M /trunk/check/Makefile.am + +Added debian target + +------------------------------------------------------------------------ +r205 | hugo303 | 2004-11-10 07:06:38 -0500 (Wed, 10 Nov 2004) | 2 lines +Changed paths: + M /trunk/check/rpm/Makefile.am + +Added variable for RPM release number + +------------------------------------------------------------------------ +r204 | hugo303 | 2004-11-10 06:55:20 -0500 (Wed, 10 Nov 2004) | 2 lines +Changed paths: + M /trunk/check/configure.in + M /trunk/check/debian/changelog + M /trunk/check/rpm/check.spec.in + +Updated for 0.9.2 release + +------------------------------------------------------------------------ +r203 | hugo303 | 2004-11-10 06:03:41 -0500 (Wed, 10 Nov 2004) | 2 lines +Changed paths: + M /trunk/check/debian/control + +Changed maintainer + +------------------------------------------------------------------------ +r202 | hugo303 | 2004-11-10 05:56:31 -0500 (Wed, 10 Nov 2004) | 2 lines +Changed paths: + M /trunk/check/AUTHORS + +Added more names + +------------------------------------------------------------------------ +r201 | hugo303 | 2004-11-09 10:42:26 -0500 (Tue, 09 Nov 2004) | 2 lines +Changed paths: + M /trunk/check/src/check_run.c + M /trunk/check/tests/check_check_master.c + +Use strsignal to print describing text for signals. + +------------------------------------------------------------------------ +r200 | hugo303 | 2004-11-09 10:29:55 -0500 (Tue, 09 Nov 2004) | 2 lines +Changed paths: + M /trunk/check/src/check_list.c + +Fixed warning + +------------------------------------------------------------------------ +r199 | hugo303 | 2004-11-09 09:51:15 -0500 (Tue, 09 Nov 2004) | 2 lines +Changed paths: + M /trunk/check/ChangeLog + M /trunk/check/doc/tutorial.sgml + +Documented signals handling and timeouts + +------------------------------------------------------------------------ +r198 | hugo303 | 2004-11-09 08:38:47 -0500 (Tue, 09 Nov 2004) | 2 lines +Changed paths: + M /trunk/check/ChangeLog + M /trunk/check/src/check.h.in + M /trunk/check/tests/check_check_master.c + +Changed failure message for fail_if + +------------------------------------------------------------------------ +r197 | hugo303 | 2004-11-09 07:49:41 -0500 (Tue, 09 Nov 2004) | 2 lines +Changed paths: + M /trunk/check/ChangeLog + M /trunk/check/src/check.c + M /trunk/check/src/check.h.in + M /trunk/check/src/check_impl.h + M /trunk/check/src/check_run.c + M /trunk/check/tests/check_check_master.c + M /trunk/check/tests/check_check_sub.c + +Added support for timeouts on tests, enabling detection of eternal loops as errors. + +------------------------------------------------------------------------ +r196 | hugo303 | 2004-11-08 09:40:05 -0500 (Mon, 08 Nov 2004) | 2 lines +Changed paths: + M /trunk/check/ChangeLog + M /trunk/check/src/check.c + M /trunk/check/src/check.h.in + M /trunk/check/src/check_impl.h + M /trunk/check/src/check_run.c + +Added support for testing on expected signals. + +------------------------------------------------------------------------ +r195 | hugo303 | 2004-11-08 09:31:49 -0500 (Mon, 08 Nov 2004) | 2 lines +Changed paths: + M /trunk/check/tests/check_check_master.c + +Added tests for signals patch and cleaned up the verification functions + +------------------------------------------------------------------------ +r194 | hugo303 | 2004-11-08 09:31:01 -0500 (Mon, 08 Nov 2004) | 2 lines +Changed paths: + M /trunk/check/tests/check_check_sub.c + +Added tests for signals patch + +------------------------------------------------------------------------ +r193 | hugo303 | 2004-11-04 08:51:03 -0500 (Thu, 04 Nov 2004) | 2 lines +Changed paths: + M /trunk/check/ChangeLog + M /trunk/check/src/check.c + M /trunk/check/src/check_list.c + M /trunk/check/src/check_list.h + M /trunk/check/src/check_log.c + M /trunk/check/src/check_msg.c + M /trunk/check/tests/check_list.c + +Changed name on function list_create to check_list_create to avoid name clash + +------------------------------------------------------------------------ +r192 | hugo303 | 2004-11-04 08:03:42 -0500 (Thu, 04 Nov 2004) | 2 lines +Changed paths: + M /trunk/check/doc/tutorial.sgml + +Fixed stale link to gnu autounit + +------------------------------------------------------------------------ +r191 | hugo303 | 2004-11-04 07:52:10 -0500 (Thu, 04 Nov 2004) | 2 lines +Changed paths: + M /trunk/check/check.m4 + +Fixed underquoted definition of AM_PATH_CHECK + +------------------------------------------------------------------------ +r190 | hugo303 | 2004-11-04 07:42:51 -0500 (Thu, 04 Nov 2004) | 2 lines +Changed paths: + M /trunk/check/ChangeLog + M /trunk/check/src/check.c + M /trunk/check/src/check.h.in + M /trunk/check/tests/check_check_master.c + M /trunk/check/tests/check_check_sub.c + +Applied ANSI C99 patch (#1047014) + +------------------------------------------------------------------------ +r188 | hugo303 | 2004-09-03 07:50:51 -0400 (Fri, 03 Sep 2004) | 2 lines +Changed paths: + M /trunk/check/NEWS + M /trunk/check/configure.in + +Updated for 0.9.1 release + +------------------------------------------------------------------------ +r187 | hugo303 | 2004-08-20 07:21:39 -0400 (Fri, 20 Aug 2004) | 2 lines +Changed paths: + M /trunk/check/ChangeLog + M /trunk/check/doc/tutorial.sgml + +Updated documentation with new features + +------------------------------------------------------------------------ +r186 | hugo303 | 2004-08-18 08:52:09 -0400 (Wed, 18 Aug 2004) | 2 lines +Changed paths: + M /trunk/check/ChangeLog + M /trunk/check/src/check_print.c + M /trunk/check/tests/test_xml_output.sh + +Fixed distcheck problem + +------------------------------------------------------------------------ +r185 | hugo303 | 2004-08-18 08:08:09 -0400 (Wed, 18 Aug 2004) | 2 lines +Changed paths: + M /trunk/check/tests/Makefile.am + +Added test_xml_output.sh to EXTRA_DIST + +------------------------------------------------------------------------ +r184 | hugo303 | 2004-08-18 08:02:02 -0400 (Wed, 18 Aug 2004) | 2 lines +Changed paths: + M /trunk/check/src/check.c + M /trunk/check/src/check.h.in + M /trunk/check/src/check_impl.h + M /trunk/check/src/check_log.c + M /trunk/check/src/check_log.h + M /trunk/check/src/check_print.c + M /trunk/check/src/check_print.h + M /trunk/check/src/check_run.c + M /trunk/check/tests/Makefile.am + M /trunk/check/tests/check_check_log.c + A /trunk/check/tests/ex_xml_output.c + A /trunk/check/tests/test_xml_output.sh + +Added support for XML output of the test results. + +------------------------------------------------------------------------ +r183 | hugo303 | 2004-08-18 05:23:02 -0400 (Wed, 18 Aug 2004) | 2 lines +Changed paths: + M /trunk/check/ChangeLog + M /trunk/check/tests/check_check_fixture.c + +Fixed setup bug from forum, failure in setup did not abort test in nofork mode. Added test cases for bug. + +------------------------------------------------------------------------ +r182 | hugo303 | 2004-08-18 05:19:37 -0400 (Wed, 18 Aug 2004) | 2 lines +Changed paths: + M /trunk/check/src/check_run.c + +Fixed setup bug from forum, failure in setup did not abort test in nofork mode. + +------------------------------------------------------------------------ +r181 | hugo303 | 2004-08-17 10:39:30 -0400 (Tue, 17 Aug 2004) | 2 lines +Changed paths: + M /trunk/check/ChangeLog + M /trunk/check/src/check_pack.c + +Use stdint.h for specific sized type + +------------------------------------------------------------------------ +r180 | hugo303 | 2004-08-17 05:50:36 -0400 (Tue, 17 Aug 2004) | 2 lines +Changed paths: + M /trunk/check/ChangeLog + M /trunk/check/src/check.c + M /trunk/check/src/check.h.in + M /trunk/check/tests/check_check_master.c + M /trunk/check/tests/check_check_sub.c + +Applied varargs patch (#933411) and added test cases. + +------------------------------------------------------------------------ +r179 | hugo303 | 2004-08-17 04:39:12 -0400 (Tue, 17 Aug 2004) | 2 lines +Changed paths: + M /trunk/check/ChangeLog + M /trunk/check/src/check.h.in + M /trunk/check/tests/check_check_master.c + M /trunk/check/tests/check_check_sub.c + +Applied fail_if (#709167) patch + +------------------------------------------------------------------------ +r178 | hugo303 | 2004-08-16 10:40:35 -0400 (Mon, 16 Aug 2004) | 2 lines +Changed paths: + M /trunk/check/ChangeLog + +Updated with latest changes + +------------------------------------------------------------------------ +r177 | hugo303 | 2004-08-16 10:11:31 -0400 (Mon, 16 Aug 2004) | 2 lines +Changed paths: + M /trunk/check/rpm/check.spec.in + +Applied doc patch from Bill Barnard + +------------------------------------------------------------------------ +r176 | hugo303 | 2004-08-16 10:01:27 -0400 (Mon, 16 Aug 2004) | 2 lines +Changed paths: + M /trunk/check/doc/tutorial.sgml + +Applied 'newbies' patch for autoconf doc. + +------------------------------------------------------------------------ +r175 | hugo303 | 2004-06-04 10:52:40 -0400 (Fri, 04 Jun 2004) | 2 lines +Changed paths: + M /trunk/check/tests/test_log_output.sh + M /trunk/check/tests/test_output.sh + +Fixed portability problem by changing == to =. + +------------------------------------------------------------------------ +r174 | hugo303 | 2004-05-26 05:55:37 -0400 (Wed, 26 May 2004) | 2 lines +Changed paths: + M /trunk/check/rpm/check.spec.in + +Changed copyright + +------------------------------------------------------------------------ +r173 | hugo303 | 2004-05-25 03:46:03 -0400 (Tue, 25 May 2004) | 2 lines +Changed paths: + M /trunk/check/src/check_run.c + +Applied patch 796705. Replacing _exit with exit + +------------------------------------------------------------------------ +r172 | hugo303 | 2004-05-25 03:38:36 -0400 (Tue, 25 May 2004) | 2 lines +Changed paths: + M /trunk/check/src/check.c + M /trunk/check/tests/check_check_master.c + M /trunk/check/tests/check_check_sub.c + +Applied patch for bug 793671 + +------------------------------------------------------------------------ +r170 | hugo303 | 2004-05-25 03:05:15 -0400 (Tue, 25 May 2004) | 2 lines +Changed paths: + M /trunk/check/ChangeLog + M /trunk/check/NEWS + M /trunk/check/configure.in + +Released 0.9.0 + +------------------------------------------------------------------------ +r169 | hugo303 | 2004-05-17 04:46:53 -0400 (Mon, 17 May 2004) | 2 lines +Changed paths: + M /trunk/check/ChangeLog + M /trunk/check/NEWS + +Released 0.8.5 + +------------------------------------------------------------------------ +r168 | hugo303 | 2004-05-17 04:42:08 -0400 (Mon, 17 May 2004) | 2 lines +Changed paths: + M /trunk/check/AUTHORS + +Updated with new maintainer + +------------------------------------------------------------------------ +r167 | hugo303 | 2004-05-17 03:30:56 -0400 (Mon, 17 May 2004) | 2 lines +Changed paths: + M /trunk/check/src/check.c + M /trunk/check/src/check_list.c + M /trunk/check/src/check_list.h + +Run fixture teardowns in reverse order to setup + +------------------------------------------------------------------------ +r166 | hugo303 | 2004-05-14 11:26:45 -0400 (Fri, 14 May 2004) | 2 lines +Changed paths: + M /trunk/check/doc/tutorial.sgml + +Updated doc to show test name when printing + +------------------------------------------------------------------------ +r165 | hugo303 | 2004-05-14 10:41:20 -0400 (Fri, 14 May 2004) | 2 lines +Changed paths: + M /trunk/check/configure.in + +Replaced lyx stuff with docbook. Bumped minor version. Removed autoconf warnings + +------------------------------------------------------------------------ +r164 | hugo303 | 2004-05-14 10:39:37 -0400 (Fri, 14 May 2004) | 2 lines +Changed paths: + M /trunk/check/acinclude.m4 + +Removed lyx stuff + +------------------------------------------------------------------------ +r163 | hugo303 | 2004-05-14 10:35:18 -0400 (Fri, 14 May 2004) | 2 lines +Changed paths: + M /trunk/check/doc/Makefile.am + D /trunk/check/doc/index.html + D /trunk/check/doc/tutorial.lyx + A /trunk/check/doc/tutorial.sgml + +Updated documentation according to changes. Changed to docbook format + +------------------------------------------------------------------------ +r162 | hugo303 | 2004-05-14 10:33:35 -0400 (Fri, 14 May 2004) | 2 lines +Changed paths: + M /trunk/check/doc/money/check_money.c + +Removed suite_free() + +------------------------------------------------------------------------ +r161 | hugo303 | 2004-05-14 10:09:46 -0400 (Fri, 14 May 2004) | 2 lines +Changed paths: + M /trunk/check/tests/check_check_fixture.c + M /trunk/check/tests/check_check_fork.c + M /trunk/check/tests/check_check_log.c + M /trunk/check/tests/check_check_master.c + M /trunk/check/tests/check_check_msg.c + M /trunk/check/tests/check_check_sub.c + M /trunk/check/tests/check_stress.c + M /trunk/check/tests/ex_log_output.c + M /trunk/check/tests/ex_output.c + M /trunk/check/tests/test_log_output.sh + M /trunk/check/tests/test_output.sh + +Updated according to implementation changes. Applied distcheck patch (802160). + +------------------------------------------------------------------------ +r160 | hugo303 | 2004-05-14 09:54:49 -0400 (Fri, 14 May 2004) | 2 lines +Changed paths: + M /trunk/check/src/check_run.c + M /trunk/check/src/check_str.c + +Added name of test to result. + +------------------------------------------------------------------------ +r159 | hugo303 | 2004-05-14 09:53:02 -0400 (Fri, 14 May 2004) | 2 lines +Changed paths: + M /trunk/check/src/check_msg.c + +Fixed message for nofork failures. + +------------------------------------------------------------------------ +r158 | hugo303 | 2004-05-14 08:11:16 -0400 (Fri, 14 May 2004) | 2 lines +Changed paths: + M /trunk/check/src/check_pack.c + M /trunk/check/src/check_pack.h + +Fixed message for nofork failures. + +------------------------------------------------------------------------ +r157 | hugo303 | 2004-05-14 08:08:11 -0400 (Fri, 14 May 2004) | 2 lines +Changed paths: + M /trunk/check/src/check_log.c + M /trunk/check/src/check_print.c + M /trunk/check/src/check_print.h + +Added new print mode that reads the mode from environment variable. + +------------------------------------------------------------------------ +r156 | hugo303 | 2004-05-14 08:05:49 -0400 (Fri, 14 May 2004) | 2 lines +Changed paths: + M /trunk/check/src/check_list.c + +Fixed bug in NULL check + +------------------------------------------------------------------------ +r155 | hugo303 | 2004-05-14 08:04:31 -0400 (Fri, 14 May 2004) | 2 lines +Changed paths: + M /trunk/check/src/check_impl.h + +Added name of test to result. + +------------------------------------------------------------------------ +r154 | hugo303 | 2004-05-14 08:02:51 -0400 (Fri, 14 May 2004) | 2 lines +Changed paths: + M /trunk/check/src/check.h.in + +Made suite_free and tcase_free static. Added new print mode that reads the mode from environment variable. + +------------------------------------------------------------------------ +r153 | hugo303 | 2004-05-14 08:00:53 -0400 (Fri, 14 May 2004) | 2 lines +Changed paths: + M /trunk/check/src/check.c + +Added free of suites when freeing srunner. Made suite_free and tcase_free static. Added name of test to result. + +------------------------------------------------------------------------ +r152 | neo23 | 2002-10-21 07:29:53 -0400 (Mon, 21 Oct 2002) | 2 lines +Changed paths: + M /trunk/check/ChangeLog + M /trunk/check/NEWS + +Made 0.8.4 release. + +------------------------------------------------------------------------ +r151 | neo23 | 2002-10-16 07:47:44 -0400 (Wed, 16 Oct 2002) | 2 lines +Changed paths: + M /trunk/check/AUTHORS + M /trunk/check/ChangeLog + M /trunk/check/configure.in + +Bumped version number to 0.8.4. Updated AUTHORS and ChangeLog. + +------------------------------------------------------------------------ +r150 | neo23 | 2002-10-16 07:39:48 -0400 (Wed, 16 Oct 2002) | 5 lines +Changed paths: + M /trunk/check/src/check_msg.c + M /trunk/check/tests/check_check_msg.c + +Applied a patch from Rick Poyner that changes the pipe used for IPC +to use a temporary file instead of stdin/stdout. This fixes the +long-standing problem that the pipe used to fill up when too many +fail_unless() were used. (#482012). + +------------------------------------------------------------------------ +r149 | neo23 | 2002-10-09 12:57:36 -0400 (Wed, 09 Oct 2002) | 3 lines +Changed paths: + M /trunk/check/src/check.h.in + +Applied a patch from Rick Poyner that fixes a typo which broke check +for C++ compilers (bug #601397). + +------------------------------------------------------------------------ +r148 | neo23 | 2002-08-16 13:41:04 -0400 (Fri, 16 Aug 2002) | 3 lines +Changed paths: + M /trunk/check/src/check.c + M /trunk/check/src/check_msg.c + M /trunk/check/src/check_msg.h + M /trunk/check/src/check_pack.c + M /trunk/check/src/check_pack.h + +Applied a patch from Dietmar Petras that plugs some +memory leaks. + +------------------------------------------------------------------------ +r147 | neo23 | 2002-07-09 22:37:19 -0400 (Tue, 09 Jul 2002) | 2 lines +Changed paths: + M /trunk/check + M /trunk/check/.cvsignore + M /trunk/check/autogen.sh + +Call aclocal from autogen.sh. + +------------------------------------------------------------------------ +r146 | neo23 | 2002-07-09 22:32:55 -0400 (Tue, 09 Jul 2002) | 2 lines +Changed paths: + D /trunk/check/aclocal.m4 + D /trunk/check/depcomp + D /trunk/check/install-sh + D /trunk/check/missing + D /trunk/check/mkinstalldirs + +Removed files generated by automake. + +------------------------------------------------------------------------ +r145 | neo23 | 2002-06-16 08:25:04 -0400 (Sun, 16 Jun 2002) | 2 lines +Changed paths: + M /trunk/check/debian/changelog + +applied patch from Arien Malec to fix build of Debian packages + +------------------------------------------------------------------------ +r144 | neo23 | 2002-05-24 11:04:38 -0400 (Fri, 24 May 2002) | 2 lines +Changed paths: + M /trunk/check/ChangeLog + +Made 0.8.3 Release. + +------------------------------------------------------------------------ +r143 | neo23 | 2002-05-24 11:00:49 -0400 (Fri, 24 May 2002) | 3 lines +Changed paths: + M /trunk/check/NEWS + M /trunk/check/doc/tutorial.lyx + M /trunk/check/rpm/check.spec.in + +Added check.m4 to the spec file. Updated NEWS. Updated the date of the +tutorial. + +------------------------------------------------------------------------ +r142 | neo23 | 2002-05-24 10:35:10 -0400 (Fri, 24 May 2002) | 2 lines +Changed paths: + M /trunk/check/debian/check.dirs + M /trunk/check/debian/check.files + M /trunk/check/debian/control + +Added check.m4 to debian rules. Changed the maintainer entry. + +------------------------------------------------------------------------ +r141 | neo23 | 2002-05-23 11:08:32 -0400 (Thu, 23 May 2002) | 3 lines +Changed paths: + M /trunk/check/doc/tutorial.lyx + +Mention that EXIT_SUCCESS and EXIT_FAILURE are defined in stdlib.h. +Suggested by Russell Reed in bug #547129. + +------------------------------------------------------------------------ +r140 | neo23 | 2002-05-10 08:01:44 -0400 (Fri, 10 May 2002) | 2 lines +Changed paths: + M /trunk/check/src/check_msg.c + +Declared local functions static (based on a patch from Gilgamesh Nootebos). + +------------------------------------------------------------------------ +r139 | neo23 | 2002-05-03 07:58:02 -0400 (Fri, 03 May 2002) | 3 lines +Changed paths: + M /trunk/check/src/Makefile.am + M /trunk/check/src/check.c + M /trunk/check/src/check_error.c + A /trunk/check/src/check_list.c + A /trunk/check/src/check_list.h + M /trunk/check/src/check_log.c + M /trunk/check/src/check_msg.c + M /trunk/check/src/check_pack.c + M /trunk/check/src/check_print.c + M /trunk/check/src/check_run.c + M /trunk/check/src/check_str.c + D /trunk/check/src/list.c + D /trunk/check/src/list.h + M /trunk/check/tests/check_list.c + +Renamed list.[ch] to check_list.[ch] for consistency. +Include config.h from all over the place, cleaned up includes. + +------------------------------------------------------------------------ +r138 | neo23 | 2002-05-02 04:34:57 -0400 (Thu, 02 May 2002) | 2 lines +Changed paths: + M /trunk/check/src/check_pack.c + M /trunk/check/tests/check_check_log.c + +Removed compiler warnings mentioned in bug #547126. + +------------------------------------------------------------------------ +r137 | neo23 | 2002-05-02 04:27:25 -0400 (Thu, 02 May 2002) | 2 lines +Changed paths: + M /trunk/check/src/check_print.c + M /trunk/check/tests/check_check_msg.c + +Don't include "error.h" (bug #546175 small cygwin portability problem). + +------------------------------------------------------------------------ +r136 | neo23 | 2002-04-16 13:33:49 -0400 (Tue, 16 Apr 2002) | 4 lines +Changed paths: + M /trunk/check/doc/tutorial.lyx + +Changed date to that of the latest release. +Added a name to an internal reference so that we get a working link in +the generated HTML. + +------------------------------------------------------------------------ +r135 | neo23 | 2002-04-15 12:47:44 -0400 (Mon, 15 Apr 2002) | 3 lines +Changed paths: + M /trunk/check/check.m4 + M /trunk/check/configure.in + +Fixed check.m4 so that --without-check is a valid option to disable check. +Bumped version number to 0.8.3. + +------------------------------------------------------------------------ +r134 | neo23 | 2002-04-15 06:58:10 -0400 (Mon, 15 Apr 2002) | 2 lines +Changed paths: + M /trunk/check/ChangeLog + +Updated ChangeLog. + +------------------------------------------------------------------------ +r133 | neo23 | 2002-04-15 06:57:35 -0400 (Mon, 15 Apr 2002) | 2 lines +Changed paths: + M /trunk/check/NEWS + M /trunk/check/README + +Made 0.8.2 Release. + +------------------------------------------------------------------------ +r132 | neo23 | 2002-04-14 12:59:08 -0400 (Sun, 14 Apr 2002) | 4 lines +Changed paths: + M /trunk/check/src/check_msg.c + +Applied a patch from Arien that makes the pipe nonblocking. This doesn't +solve #482012 but makes it more obvious what is going wrong if the pipe +fills up. + +------------------------------------------------------------------------ +r131 | neo23 | 2002-04-12 06:50:04 -0400 (Fri, 12 Apr 2002) | 2 lines +Changed paths: + M /trunk/check/doc/tutorial.lyx + +Use #include rather than #import (bug #484564). + +------------------------------------------------------------------------ +r130 | neo23 | 2002-04-12 06:34:04 -0400 (Fri, 12 Apr 2002) | 2 lines +Changed paths: + M /trunk/check/ChangeLog + +Updated ChangeLog. + +------------------------------------------------------------------------ +r129 | neo23 | 2002-04-12 06:33:06 -0400 (Fri, 12 Apr 2002) | 3 lines +Changed paths: + M /trunk/check/AUTHORS + M /trunk/check/doc/tutorial.lyx + +Document the fact that you can now use NULL as msg argument for +fail_unless(). + +------------------------------------------------------------------------ +r128 | neo23 | 2002-04-12 05:54:17 -0400 (Fri, 12 Apr 2002) | 10 lines +Changed paths: + M /trunk/check/config.h.in + M /trunk/check/configure.in + M /trunk/check/src/Makefile.am + M /trunk/check/src/check.c + M /trunk/check/src/check_impl.h + D /trunk/check/src/check_magic.h + M /trunk/check/src/check_msg.c + M /trunk/check/src/check_pack.c + M /trunk/check/src/check_pack.h + M /trunk/check/src/check_run.c + M /trunk/check/src/check_str.c + M /trunk/check/src/check_str.h + M /trunk/check/tests/Makefile.am + M /trunk/check/tests/check_check_fixture.c + M /trunk/check/tests/check_check_master.c + M /trunk/check/tests/check_check_msg.c + M /trunk/check/tests/check_check_pack.c + +Removed limitations on line number, message and buffer sizes +(bug #478233) by changing the way we send integers over the +pipe. Instead of strings, integers are now send as 4 bytes. +This allows the pack routine to easily calculate the message +size so that we can allocate the needed buffer there. +Made a union out of the different Msg structs to clean up the +internal API. Also introduced the internal function +ck_strdup_printf(), a simple wrapper around sprintf() that +allocates enough space to hold the resulting string. + +------------------------------------------------------------------------ +r127 | neo23 | 2002-04-10 07:11:48 -0400 (Wed, 10 Apr 2002) | 7 lines +Changed paths: + M /trunk/check/AUTHORS + M /trunk/check/NEWS + M /trunk/check/configure.in + M /trunk/check/src/check.c + M /trunk/check/src/check.h.in + M /trunk/check/src/check_error.c + M /trunk/check/src/check_error.h + M /trunk/check/src/check_impl.h + M /trunk/check/src/check_log.c + M /trunk/check/src/check_msg.c + M /trunk/check/src/check_msg.h + M /trunk/check/src/check_pack.c + M /trunk/check/src/check_run.c + M /trunk/check/src/check_str.c + M /trunk/check/src/list.c + M /trunk/check/src/list.h + M /trunk/check/tests/check_check_fixture.c + M /trunk/check/tests/check_check_fork.c + M /trunk/check/tests/check_check_master.c + M /trunk/check/tests/check_check_pack.c + M /trunk/check/tests/check_list.c + +Applied a slightly modified version of a patch from +Neil Spring that declares strings as +const where applicable. It also changes our CFLAGS to be much +stricter and removes the warnings introduced by -Wwrite-strings. +This allows building other check tests with -Wwrite-strings +without heaping gobs of compiler warnings. + +------------------------------------------------------------------------ +r126 | neo23 | 2002-03-28 14:12:30 -0500 (Thu, 28 Mar 2002) | 2 lines +Changed paths: + M /trunk/check/ChangeLog + +Updated ChangeLog. + +------------------------------------------------------------------------ +r125 | neo23 | 2002-03-28 13:37:07 -0500 (Thu, 28 Mar 2002) | 6 lines +Changed paths: + M /trunk/check/src/check.c + M /trunk/check/src/check.h.in + M /trunk/check/tests/check_check_master.c + M /trunk/check/tests/check_check_sub.c + +Allow fail_unless() to be called with a NULL msg and substitute a reasonable +error message in that case. Bail out if NULL is passed to _fail_unless() to +avoid possible confusion. + +Added a test case that calls fail_unless() with msg=NULL. + +------------------------------------------------------------------------ +r124 | neo23 | 2002-03-28 13:22:09 -0500 (Thu, 28 Mar 2002) | 21 lines +Changed paths: + M /trunk/check/Makefile.am + M /trunk/check/README + M /trunk/check/autogen.sh + A /trunk/check/check.m4 + M /trunk/check/configure.in + M /trunk/check/doc/money + A /trunk/check/doc/money/.cvsignore + M /trunk/check/doc/money/Makefile.am.money + M /trunk/check/doc/money/aclocal.m4 + M /trunk/check/doc/money/configure.in.money + M /trunk/check/doc/tutorial.lyx + M /trunk/check/rpm + M /trunk/check/rpm/.cvsignore + M /trunk/check/rpm/Makefile.am + D /trunk/check/rpm/check.spec + A /trunk/check/rpm/check.spec.in + M /trunk/check/src + M /trunk/check/src/.cvsignore + M /trunk/check/src/Makefile.am + M /trunk/check/src/check.c + D /trunk/check/src/check.h + A /trunk/check/src/check.h.in + M /trunk/check/tests + M /trunk/check/tests/.cvsignore + +Changed autogen.sh to bail out if necessary tools can't be found +instead of proceeding to the version checks. + +Document use of autogen.sh in README. + +Generate check.spec from check.spec.in to it automatically gets the +correct version number. + +Generate check.h from chech.h.in and include Check version information. + +Compile Check version number into the library to allow for runtime +version checks. + +Added the m4 script check.m4 that allows to easily integrate Check +into projects using autoconf/automake. It does version checking and +also assures that header and library versions match. + +Document the use of check.m4 and the AM_PATH_CHECK() macro in the +tutorial. Adapted example Makefile.am and configure.in and added a +missing .cvsignore file. + +------------------------------------------------------------------------ +r123 | amalec | 2002-03-26 20:21:12 -0500 (Tue, 26 Mar 2002) | 2 lines +Changed paths: + D /trunk/check/src/Makefile.in + D /trunk/check/tests/Makefile.in + +Complete CVS cleanup + +------------------------------------------------------------------------ +r122 | amalec | 2002-03-26 20:18:55 -0500 (Tue, 26 Mar 2002) | 2 lines +Changed paths: + M /trunk/check + A /trunk/check/.cvsignore + M /trunk/check/Makefile.am + D /trunk/check/Makefile.in + A /trunk/check/autogen.sh + D /trunk/check/configure + M /trunk/check/debian + A /trunk/check/debian/.cvsignore + D /trunk/check/debian/Makefile.in + M /trunk/check/doc + A /trunk/check/doc/.cvsignore + D /trunk/check/doc/Makefile.in + D /trunk/check/doc/money/Makefile.in + M /trunk/check/rpm + A /trunk/check/rpm/.cvsignore + D /trunk/check/rpm/Makefile.in + M /trunk/check/src + A /trunk/check/src/.cvsignore + M /trunk/check/tests + A /trunk/check/tests/.cvsignore + +Cleaned up CVS to remove all autofoo generated files, included an autogen.sh bootstrap file. Changes at the suggestion of Sven Neumann + +------------------------------------------------------------------------ +r121 | amalec | 2002-03-01 20:42:48 -0500 (Fri, 01 Mar 2002) | 2 lines +Changed paths: + M /trunk/check/ChangeLog + +Update ChangeLog + +------------------------------------------------------------------------ +r120 | amalec | 2002-03-01 20:42:20 -0500 (Fri, 01 Mar 2002) | 2 lines +Changed paths: + M /trunk/check/debian/changelog + M /trunk/check/debian/files + M /trunk/check/rpm/check.spec + M /trunk/check/src/Makefile.am + M /trunk/check/src/Makefile.in + M /trunk/check/src/check.c + A /trunk/check/src/check_error.c + A /trunk/check/src/check_error.h + M /trunk/check/src/check_log.c + M /trunk/check/src/check_msg.c + M /trunk/check/src/check_pack.c + M /trunk/check/src/check_run.c + M /trunk/check/src/check_str.c + D /trunk/check/src/error.c + D /trunk/check/src/error.h + M /trunk/check/src/list.c + M /trunk/check/tests/check_check_fixture.c + M /trunk/check/tests/check_check_pack.c + +Moved error.[hc] to check_error.[hc], and fixed bug in running checked setup in nofork mode. + +------------------------------------------------------------------------ +r119 | amalec | 2002-02-27 21:02:09 -0500 (Wed, 27 Feb 2002) | 2 lines +Changed paths: + M /trunk/check/COPYING + M /trunk/check/configure + M /trunk/check/configure.in + M /trunk/check/src/check.c + M /trunk/check/src/check.h + M /trunk/check/src/check_impl.h + M /trunk/check/src/check_log.c + M /trunk/check/src/check_log.h + M /trunk/check/src/check_magic.h + M /trunk/check/src/check_msg.c + M /trunk/check/src/check_msg.h + M /trunk/check/src/check_pack.c + M /trunk/check/src/check_pack.h + M /trunk/check/src/check_print.c + M /trunk/check/src/check_print.h + M /trunk/check/src/check_run.c + M /trunk/check/src/check_str.c + M /trunk/check/src/check_str.h + M /trunk/check/src/error.c + M /trunk/check/src/error.h + M /trunk/check/src/list.c + M /trunk/check/src/list.h + +Changed license to LGPL + +------------------------------------------------------------------------ +r117 | amalec | 2001-10-25 19:19:28 -0400 (Thu, 25 Oct 2001) | 2 lines +Changed paths: + M /trunk/check/ChangeLog + +Update ChangeLog + +------------------------------------------------------------------------ +r116 | amalec | 2001-10-25 19:18:42 -0400 (Thu, 25 Oct 2001) | 2 lines +Changed paths: + M /trunk/check/AUTHORS + +Update AUTHORS to give credit to key contributors + +------------------------------------------------------------------------ +r115 | amalec | 2001-10-25 19:12:35 -0400 (Thu, 25 Oct 2001) | 2 lines +Changed paths: + M /trunk/check/configure + M /trunk/check/configure.in + +Clarified configuration warning on doc building + +------------------------------------------------------------------------ +r114 | amalec | 2001-10-25 18:51:35 -0400 (Thu, 25 Oct 2001) | 2 lines +Changed paths: + M /trunk/check/ChangeLog + +Updating ChangeLog prior to release + +------------------------------------------------------------------------ +r113 | amalec | 2001-10-25 18:45:31 -0400 (Thu, 25 Oct 2001) | 2 lines +Changed paths: + M /trunk/check/src/check_run.c + M /trunk/check/tests/check_check_pack.c + +Fixed some missing header includes + +------------------------------------------------------------------------ +r112 | amalec | 2001-10-25 18:25:11 -0400 (Thu, 25 Oct 2001) | 2 lines +Changed paths: + M /trunk/check/src/check_pack.c + +Fix packing of NULL strings (causing problems under Solaris) + +------------------------------------------------------------------------ +r111 | amalec | 2001-10-25 18:17:03 -0400 (Thu, 25 Oct 2001) | 2 lines +Changed paths: + M /trunk/check/tests/check_check_pack.c + +Minor change to pack tests to ensure that tests don't pass accidentally + +------------------------------------------------------------------------ +r110 | amalec | 2001-10-24 20:45:23 -0400 (Wed, 24 Oct 2001) | 2 lines +Changed paths: + M /trunk/check/ChangeLog + +Updated ChangeLog + +------------------------------------------------------------------------ +r109 | amalec | 2001-10-24 20:44:13 -0400 (Wed, 24 Oct 2001) | 2 lines +Changed paths: + A /trunk/check/depcomp + +Added new automake file + +------------------------------------------------------------------------ +r108 | amalec | 2001-10-24 20:43:37 -0400 (Wed, 24 Oct 2001) | 2 lines +Changed paths: + M /trunk/check/NEWS + M /trunk/check/doc/index.html + M /trunk/check/doc/money/check_money.c + M /trunk/check/tests/check_check_sub.c + +Added comments on string functions to NEWS, cleaned up money example, and fixed a signal unit test so that it will pass under cygwin + +------------------------------------------------------------------------ +r107 | amalec | 2001-10-24 13:25:47 -0400 (Wed, 24 Oct 2001) | 2 lines +Changed paths: + M /trunk/check/Makefile.in + M /trunk/check/NEWS + M /trunk/check/aclocal.m4 + M /trunk/check/configure + M /trunk/check/debian/Makefile.in + M /trunk/check/debian/changelog + M /trunk/check/debian/files + M /trunk/check/doc/Makefile.am + M /trunk/check/doc/Makefile.in + M /trunk/check/doc/money/Makefile.in + M /trunk/check/doc/tutorial.lyx + M /trunk/check/rpm/Makefile.in + M /trunk/check/rpm/check.spec + M /trunk/check/src/Makefile.am + M /trunk/check/src/Makefile.in + M /trunk/check/src/check.h + M /trunk/check/src/check_log.c + M /trunk/check/src/check_msg.c + M /trunk/check/src/check_msg.h + M /trunk/check/src/check_print.c + M /trunk/check/src/check_run.c + M /trunk/check/tests/Makefile.am + M /trunk/check/tests/Makefile.in + M /trunk/check/tests/check_check_fixture.c + M /trunk/check/tests/check_check_fork.c + M /trunk/check/tests/check_check_limit.c + M /trunk/check/tests/check_check_main.c + M /trunk/check/tests/check_check_master.c + M /trunk/check/tests/check_stress.c + M /trunk/check/tests/ex_log_output.c + M /trunk/check/tests/ex_output.c + M /trunk/check/tests/test_log_output.sh + M /trunk/check/tests/test_output.sh + +Documentation updates + +------------------------------------------------------------------------ +r106 | amalec | 2001-10-22 19:57:18 -0400 (Mon, 22 Oct 2001) | 2 lines +Changed paths: + M /trunk/check/src/check_msg.c + M /trunk/check/src/check_pack.c + M /trunk/check/src/check_pack.h + M /trunk/check/tests/check_check_pack.c + +Removed old ppunpack, renamed new_*, and updated callers + +------------------------------------------------------------------------ +r105 | amalec | 2001-10-22 19:26:48 -0400 (Mon, 22 Oct 2001) | 2 lines +Changed paths: + M /trunk/check/src/check_msg.c + M /trunk/check/src/check_msg.h + M /trunk/check/src/check_pack.c + M /trunk/check/src/check_run.c + M /trunk/check/tests/check_check_master.c + M /trunk/check/tests/check_check_msg.c + M /trunk/check/tests/check_check_pack.c + +Moved Check to use new internal ppack routine, and fixed a nasty bug + +------------------------------------------------------------------------ +r104 | amalec | 2001-10-19 19:27:33 -0400 (Fri, 19 Oct 2001) | 2 lines +Changed paths: + M /trunk/check/src/check_msg.c + M /trunk/check/src/check_msg.h + M /trunk/check/src/check_pack.c + M /trunk/check/tests/check_check_msg.c + M /trunk/check/tests/check_check_pack.c + +New version of receive_test_result passes unit tests + +------------------------------------------------------------------------ +r103 | amalec | 2001-10-19 14:44:39 -0400 (Fri, 19 Oct 2001) | 2 lines +Changed paths: + M /trunk/check/src/check_pack.c + M /trunk/check/src/check_pack.h + M /trunk/check/tests/check_check_fixture.c + M /trunk/check/tests/check_check_pack.c + +Changed punpack to return test and fixture locs to preserve test information when teardown messages are sent + +------------------------------------------------------------------------ +r102 | amalec | 2001-10-16 21:15:16 -0400 (Tue, 16 Oct 2001) | 2 lines +Changed paths: + M /trunk/check/src/check_run.c + M /trunk/check/tests/check_check_fixture.c + +Checked setup passes unit tests + +------------------------------------------------------------------------ +r101 | amalec | 2001-10-13 12:13:52 -0400 (Sat, 13 Oct 2001) | 2 lines +Changed paths: + M /trunk/check/src/Makefile.am + M /trunk/check/src/Makefile.in + M /trunk/check/src/check.c + M /trunk/check/src/check_msg.c + M /trunk/check/src/check_msg.h + M /trunk/check/src/check_run.c + M /trunk/check/tests/check_check_msg.c + +Replace previous messaging implementation files with new module + +------------------------------------------------------------------------ +r100 | amalec | 2001-10-13 02:05:11 -0400 (Sat, 13 Oct 2001) | 2 lines +Changed paths: + M /trunk/check/src/check.c + M /trunk/check/src/check.h + M /trunk/check/src/check_log.c + M /trunk/check/src/check_msg.c + M /trunk/check/src/check_pack.c + M /trunk/check/src/check_run.c + M /trunk/check/src/check_str.c + M /trunk/check/src/error.c + M /trunk/check/src/error.h + M /trunk/check/tests/check_check_master.c + M /trunk/check/tests/test_log_output.sh + M /trunk/check/tests/test_output.sh + +Fully implemented new messaging back-end based on pipes + +------------------------------------------------------------------------ +r99 | amalec | 2001-10-10 14:01:17 -0400 (Wed, 10 Oct 2001) | 2 lines +Changed paths: + M /trunk/check/Makefile.in + M /trunk/check/aclocal.m4 + M /trunk/check/configure + M /trunk/check/debian/Makefile.in + M /trunk/check/doc/Makefile.in + M /trunk/check/doc/money/Makefile.in + M /trunk/check/rpm/Makefile.in + M /trunk/check/src/Makefile.am + M /trunk/check/src/Makefile.in + M /trunk/check/src/check.c + M /trunk/check/src/check_impl.h + M /trunk/check/src/check_pack.c + M /trunk/check/tests/Makefile.in + M /trunk/check/tests/check_check_msg.c + M /trunk/check/tests/check_check_pack.c + +Updated messaging tests to use new infrastructure + +------------------------------------------------------------------------ +r98 | amalec | 2001-10-04 17:55:29 -0400 (Thu, 04 Oct 2001) | 2 lines +Changed paths: + M /trunk/check/src/check.c + M /trunk/check/src/check.h + M /trunk/check/src/check_impl.h + M /trunk/check/src/check_pack.c + M /trunk/check/src/check_pack.h + M /trunk/check/tests/check_check_pack.c + +Completed implementation of check_pack + +------------------------------------------------------------------------ +r97 | amalec | 2001-10-02 11:38:48 -0400 (Tue, 02 Oct 2001) | 2 lines +Changed paths: + M /trunk/check/doc/index.html + M /trunk/check/doc/tutorial.lyx + M /trunk/check/src/Makefile.am + M /trunk/check/src/Makefile.in + M /trunk/check/src/check.c + M /trunk/check/src/check.h + M /trunk/check/src/check_magic.h + M /trunk/check/src/check_msg.h + A /trunk/check/src/check_pack.c + A /trunk/check/src/check_pack.h + M /trunk/check/tests/Makefile.am + M /trunk/check/tests/Makefile.in + M /trunk/check/tests/check_check.h + M /trunk/check/tests/check_check_fixture.c + M /trunk/check/tests/check_check_fork.c + M /trunk/check/tests/check_check_limit.c + M /trunk/check/tests/check_check_main.c + M /trunk/check/tests/check_check_master.c + M /trunk/check/tests/check_check_msg.c + A /trunk/check/tests/check_check_pack.c + +First generation packing code as the infrastructure to revising message passing between processes, to accomodate context messages + +------------------------------------------------------------------------ +r96 | amalec | 2001-09-27 20:20:37 -0400 (Thu, 27 Sep 2001) | 2 lines +Changed paths: + M /trunk/check/src/check.c + M /trunk/check/src/check.h + M /trunk/check/src/check_impl.h + M /trunk/check/src/check_run.c + M /trunk/check/src/list.c + M /trunk/check/src/list.h + M /trunk/check/tests/check_check_fixture.c + M /trunk/check/tests/check_check_fork.c + M /trunk/check/tests/check_check_limit.c + M /trunk/check/tests/check_check_master.c + M /trunk/check/tests/check_check_msg.c + +Added framework for support of checked fixture functions + +------------------------------------------------------------------------ +r95 | amalec | 2001-09-27 12:08:48 -0400 (Thu, 27 Sep 2001) | 2 lines +Changed paths: + M /trunk/check/src/check.c + M /trunk/check/src/check_run.c + +Refactored failure info functions + +------------------------------------------------------------------------ +r94 | amalec | 2001-09-18 20:14:03 -0400 (Tue, 18 Sep 2001) | 2 lines +Changed paths: + M /trunk/check/src/check.c + M /trunk/check/src/check.h + M /trunk/check/src/check_impl.h + M /trunk/check/src/check_magic.h + M /trunk/check/src/check_msg.c + M /trunk/check/src/check_msg.h + M /trunk/check/src/check_print.c + M /trunk/check/src/check_run.c + M /trunk/check/src/check_str.c + M /trunk/check/tests/Makefile.am + M /trunk/check/tests/Makefile.in + M /trunk/check/tests/check_check.h + A /trunk/check/tests/check_check_fixture.c + M /trunk/check/tests/check_check_main.c + M /trunk/check/tests/check_check_master.c + +Setup failure is working and partially tested + +------------------------------------------------------------------------ +r93 | amalec | 2001-09-14 19:15:28 -0400 (Fri, 14 Sep 2001) | 2 lines +Changed paths: + M /trunk/check/tests/check_check.h + A /trunk/check/tests/check_check_fork.c + M /trunk/check/tests/check_check_main.c + +Completed implementation of CK_NOFORK + +------------------------------------------------------------------------ +r92 | amalec | 2001-09-07 18:12:54 -0400 (Fri, 07 Sep 2001) | 2 lines +Changed paths: + M /trunk/check/src/check_impl.h + M /trunk/check/src/check_msg.c + M /trunk/check/src/check_msg.h + M /trunk/check/src/check_run.c + +Implemented nofork mode + +------------------------------------------------------------------------ +r91 | amalec | 2001-09-06 14:10:22 -0400 (Thu, 06 Sep 2001) | 2 lines +Changed paths: + M /trunk/check/Doxyfile + M /trunk/check/configure.in + M /trunk/check/src/check.h + M /trunk/check/src/check_impl.h + M /trunk/check/src/check_log.c + M /trunk/check/src/check_log.h + M /trunk/check/src/check_print.c + M /trunk/check/src/check_print.h + M /trunk/check/src/check_run.c + M /trunk/check/tests/Makefile.am + M /trunk/check/tests/Makefile.in + M /trunk/check/tests/check_check.h + M /trunk/check/tests/check_check_main.c + +Added initial control functions to control forking + +------------------------------------------------------------------------ +r90 | amalec | 2001-09-05 12:48:45 -0400 (Wed, 05 Sep 2001) | 2 lines +Changed paths: + M /trunk/check/src/check.c + M /trunk/check/src/check_msg.c + M /trunk/check/src/check_msg.h + M /trunk/check/src/check_run.c + M /trunk/check/tests/check_check_msg.c + +Completely abstracted the details of messaging behind check_msg.c + +------------------------------------------------------------------------ +r89 | amalec | 2001-08-31 20:12:51 -0400 (Fri, 31 Aug 2001) | 2 lines +Changed paths: + M /trunk/check/src/check.c + M /trunk/check/src/check_msg.c + M /trunk/check/src/check_msg.h + M /trunk/check/src/check_run.c + +Ensure that each subprocesses alloc the correct msg queue + +------------------------------------------------------------------------ +r88 | amalec | 2001-08-29 21:00:45 -0400 (Wed, 29 Aug 2001) | 2 lines +Changed paths: + M /trunk/check/src/check.c + M /trunk/check/src/check.h + M /trunk/check/src/check_msg.c + M /trunk/check/src/check_msg.h + M /trunk/check/src/check_run.c + M /trunk/check/tests/check_check_msg.c + +Eliminated passing of msqid in unit tests + +------------------------------------------------------------------------ +r87 | amalec | 2001-08-28 20:49:07 -0400 (Tue, 28 Aug 2001) | 2 lines +Changed paths: + M /trunk/check/src/check_print.c + M /trunk/check/src/check_str.c + A /trunk/check/tests/check_check_limit.c + +Added test checking running empty suites + +------------------------------------------------------------------------ +r86 | amalec | 2001-08-28 13:06:05 -0400 (Tue, 28 Aug 2001) | 2 lines +Changed paths: + A /trunk/check/src/check_magic.h + +Moved magic values to separate header + +------------------------------------------------------------------------ +r85 | amalec | 2001-08-28 13:04:27 -0400 (Tue, 28 Aug 2001) | 2 lines +Changed paths: + M /trunk/check/src/Makefile.am + M /trunk/check/src/Makefile.in + M /trunk/check/src/check.h + M /trunk/check/src/check_impl.h + M /trunk/check/src/check_print.c + A /trunk/check/src/check_str.c + A /trunk/check/src/check_str.h + M /trunk/check/tests/check_check_master.c + M /trunk/check/tests/check_check_msg.c + +Separated printing from string formating functions to allow better testing. + +------------------------------------------------------------------------ +r84 | amalec | 2001-08-27 20:18:00 -0400 (Mon, 27 Aug 2001) | 2 lines +Changed paths: + M /trunk/check/configure + M /trunk/check/configure.in + M /trunk/check/src/check_msg.c + M /trunk/check/src/check_msg.h + M /trunk/check/src/check_run.c + M /trunk/check/tests/Makefile.am + M /trunk/check/tests/Makefile.in + M /trunk/check/tests/check_check.h + M /trunk/check/tests/check_check_main.c + M /trunk/check/tests/check_check_msg.c + +Use pid/ppid as message queue key, preliminary to removing _msqid from unit test functions + +------------------------------------------------------------------------ +r82 | amalec | 2001-08-23 17:26:16 -0400 (Thu, 23 Aug 2001) | 2 lines +Changed paths: + M /trunk/check/ChangeLog + +Final ChangeLog for 0.7.3 release + +------------------------------------------------------------------------ +r81 | amalec | 2001-08-23 17:25:03 -0400 (Thu, 23 Aug 2001) | 2 lines +Changed paths: + M /trunk/check/NEWS + +Document 0.7.3 in NEWS + +------------------------------------------------------------------------ +r80 | amalec | 2001-08-23 17:13:58 -0400 (Thu, 23 Aug 2001) | 2 lines +Changed paths: + M /trunk/check/debian/changelog + +This time, fix debian changelog correctly + +------------------------------------------------------------------------ +r79 | amalec | 2001-08-23 17:10:48 -0400 (Thu, 23 Aug 2001) | 2 lines +Changed paths: + M /trunk/check/debian/changelog + +Fixed maintainer email in debian changelog + +------------------------------------------------------------------------ +r78 | amalec | 2001-08-22 19:08:21 -0400 (Wed, 22 Aug 2001) | 2 lines +Changed paths: + M /trunk/check/ChangeLog + M /trunk/check/acinclude.m4 + M /trunk/check/aclocal.m4 + M /trunk/check/configure + M /trunk/check/configure.in + M /trunk/check/debian/changelog + M /trunk/check/debian/check.doc-base.tut + M /trunk/check/debian/files + M /trunk/check/rpm/check.spec + +Updated acinclude.m4 to increase portability; fixed a minor packaging bug in debian doc-base files + +------------------------------------------------------------------------ +r76 | amalec | 2001-08-18 01:28:01 -0400 (Sat, 18 Aug 2001) | 2 lines +Changed paths: + M /trunk/check/ChangeLog + M /trunk/check/doc/index.html + +index.html changes + +------------------------------------------------------------------------ +r75 | amalec | 2001-08-18 01:24:32 -0400 (Sat, 18 Aug 2001) | 2 lines +Changed paths: + M /trunk/check/INSTALL + M /trunk/check/NEWS + +NEWS and INSTALL changes + +------------------------------------------------------------------------ +r74 | amalec | 2001-08-18 01:15:48 -0400 (Sat, 18 Aug 2001) | 2 lines +Changed paths: + M /trunk/check/Doxyfile + M /trunk/check/configure + M /trunk/check/configure.in + M /trunk/check/debian/check.postinst.debhelper + M /trunk/check/debian/check.prerm.debhelper + M /trunk/check/debian/files + M /trunk/check/doc/Makefile.in + M /trunk/check/doc/tutorial.lyx + M /trunk/check/rpm/Makefile.am + M /trunk/check/rpm/Makefile.in + M /trunk/check/rpm/check.spec + M /trunk/check/src/check.c + M /trunk/check/src/check.h + M /trunk/check/src/check_log.c + M /trunk/check/src/check_msg.c + M /trunk/check/src/check_print.c + M /trunk/check/src/check_run.c + M /trunk/check/tests/check_check_log.c + M /trunk/check/tests/check_check_master.c + M /trunk/check/tests/check_check_msg.c + M /trunk/check/tests/check_list.c + M /trunk/check/tests/check_stress.c + M /trunk/check/tests/ex_log_output.c + M /trunk/check/tests/ex_output.c + +Bug fixes and assorted cleanup prior to release + +------------------------------------------------------------------------ +r73 | amalec | 2001-08-17 19:16:57 -0400 (Fri, 17 Aug 2001) | 2 lines +Changed paths: + A /trunk/check/doc/money/Makefile.am + A /trunk/check/doc/money/Makefile.in + +Added money example Makefiles to CVS + +------------------------------------------------------------------------ +r72 | amalec | 2001-08-17 19:13:21 -0400 (Fri, 17 Aug 2001) | 2 lines +Changed paths: + M /trunk/check/doc/Makefile.am + D /trunk/check/doc/example.lyx + A /trunk/check/doc/tutorial.lyx + +Moved example.lyx to tutorial.lyx + +------------------------------------------------------------------------ +r71 | amalec | 2001-08-15 20:47:35 -0400 (Wed, 15 Aug 2001) | 2 lines +Changed paths: + A /trunk/check/acinclude.m4 + A /trunk/check/debian/Makefile.am + A /trunk/check/debian/Makefile.in + A /trunk/check/debian/check.docs + +Added leftover stuff in debian directory, acinclude.m4 + +------------------------------------------------------------------------ +r70 | amalec | 2001-08-15 20:45:54 -0400 (Wed, 15 Aug 2001) | 2 lines +Changed paths: + M /trunk/check/Makefile.am + M /trunk/check/Makefile.in + M /trunk/check/aclocal.m4 + M /trunk/check/configure + M /trunk/check/configure.in + A /trunk/check/debian/check.doc-base.tut + M /trunk/check/debian/control + D /trunk/check/debian/docs + M /trunk/check/doc/Makefile.am + M /trunk/check/doc/Makefile.in + D /trunk/check/doc/money/AUTHORS + D /trunk/check/doc/money/COPYING + D /trunk/check/doc/money/ChangeLog + D /trunk/check/doc/money/INSTALL + D /trunk/check/doc/money/Makefile.am + A /trunk/check/doc/money/Makefile.am.money + D /trunk/check/doc/money/Makefile.in + D /trunk/check/doc/money/NEWS + D /trunk/check/doc/money/README + D /trunk/check/doc/money/config.h.in + D /trunk/check/doc/money/configure + D /trunk/check/doc/money/configure.in + A /trunk/check/doc/money/configure.in.money + D /trunk/check/doc/money/stamp-h.in + M /trunk/check/rpm/Makefile.in + M /trunk/check/rpm/check.spec + M /trunk/check/src/Makefile.in + M /trunk/check/tests/Makefile.in + +Added configure check for Lyx with Linuxdoc + +------------------------------------------------------------------------ +r69 | amalec | 2001-08-06 16:45:30 -0400 (Mon, 06 Aug 2001) | 2 lines +Changed paths: + A /trunk/check/rpm/Makefile.in + +Added rpm/Makefile.in + +------------------------------------------------------------------------ +r68 | amalec | 2001-08-06 16:44:28 -0400 (Mon, 06 Aug 2001) | 2 lines +Changed paths: + M /trunk/check/Makefile.am + M /trunk/check/Makefile.in + M /trunk/check/configure + M /trunk/check/configure.in + M /trunk/check/debian/changelog + M /trunk/check/debian/check.dirs + M /trunk/check/debian/check.files + M /trunk/check/debian/rules + M /trunk/check/doc/Makefile.am + M /trunk/check/doc/Makefile.in + M /trunk/check/doc/index.html + M /trunk/check/doc/money/AUTHORS + M /trunk/check/doc/money/COPYING + M /trunk/check/doc/money/ChangeLog + M /trunk/check/doc/money/NEWS + M /trunk/check/doc/money/README + M /trunk/check/rpm/check.spec + +Can now build complete debs + +------------------------------------------------------------------------ +r67 | amalec | 2001-08-04 01:40:15 -0400 (Sat, 04 Aug 2001) | 2 lines +Changed paths: + D /trunk/check/debian/README.Debian + +Don't need README.Debian + +------------------------------------------------------------------------ +r66 | amalec | 2001-08-04 01:26:40 -0400 (Sat, 04 Aug 2001) | 2 lines +Changed paths: + A /trunk/check/debian + A /trunk/check/debian/README.Debian + A /trunk/check/debian/changelog + A /trunk/check/debian/check.dirs + A /trunk/check/debian/check.files + A /trunk/check/debian/check.postinst.debhelper + A /trunk/check/debian/check.prerm.debhelper + A /trunk/check/debian/control + A /trunk/check/debian/copyright + A /trunk/check/debian/dirs + A /trunk/check/debian/docs + A /trunk/check/debian/files + A /trunk/check/debian/rules + M /trunk/check/doc/Makefile.am + M /trunk/check/doc/index.html + +Added preliminary debian packaging files + +------------------------------------------------------------------------ +r65 | amalec | 2001-08-02 21:05:18 -0400 (Thu, 02 Aug 2001) | 2 lines +Changed paths: + M /trunk/check/Makefile.am + M /trunk/check/Makefile.in + M /trunk/check/aclocal.m4 + M /trunk/check/configure + M /trunk/check/configure.in + M /trunk/check/doc/index.html + A /trunk/check/rpm/Makefile.am + D /trunk/check/rpm/buildrpm.sh + +Added automatic building of RPMs + +------------------------------------------------------------------------ +r63 | amalec | 2001-07-31 12:51:40 -0400 (Tue, 31 Jul 2001) | 2 lines +Changed paths: + M /trunk/check/doc/index.html + +Update index.html for final release to main Check website. + +------------------------------------------------------------------------ +r62 | amalec | 2001-07-30 21:08:59 -0400 (Mon, 30 Jul 2001) | 2 lines +Changed paths: + M /trunk/check/ChangeLog + +Update ChangeLog + +------------------------------------------------------------------------ +r61 | amalec | 2001-07-30 21:08:17 -0400 (Mon, 30 Jul 2001) | 2 lines +Changed paths: + M /trunk/check/NEWS + M /trunk/check/configure + M /trunk/check/configure.in + M /trunk/check/doc/example.lyx + A /trunk/check/rpm/buildrpm.sh + M /trunk/check/rpm/check.spec + M /trunk/check/tests/Makefile.am + M /trunk/check/tests/Makefile.in + M /trunk/check/tests/ex_log_output.c + M /trunk/check/tests/test_log_output.sh + +Update NEWS, docs, and rpm building + +------------------------------------------------------------------------ +r60 | amalec | 2001-07-30 16:10:32 -0400 (Mon, 30 Jul 2001) | 2 lines +Changed paths: + M /trunk/check/ChangeLog + +Update ChangeLog + +------------------------------------------------------------------------ +r59 | amalec | 2001-07-30 16:10:10 -0400 (Mon, 30 Jul 2001) | 2 lines +Changed paths: + A /trunk/check/doc/Makefile.in + A /trunk/check/tests/ex_log_output.c + +Add neglected files + +------------------------------------------------------------------------ +r58 | amalec | 2001-07-30 16:08:57 -0400 (Mon, 30 Jul 2001) | 2 lines +Changed paths: + M /trunk/check/src/Makefile.am + M /trunk/check/src/Makefile.in + M /trunk/check/src/check_impl.h + M /trunk/check/src/check_log.c + A /trunk/check/src/check_log.h + A /trunk/check/src/check_print.c + A /trunk/check/src/check_print.h + M /trunk/check/src/check_run.c + M /trunk/check/tests/test_log_output.sh + +Reorganized printing and logging functions and implemented more sophisticated logging + +------------------------------------------------------------------------ +r57 | amalec | 2001-07-25 17:26:51 -0400 (Wed, 25 Jul 2001) | 2 lines +Changed paths: + M /trunk/check/Makefile.in + M /trunk/check/aclocal.m4 + M /trunk/check/config.h.in + M /trunk/check/configure + M /trunk/check/doc/money/aclocal.m4 + M /trunk/check/doc/money/config.h.in + M /trunk/check/doc/money/configure + M /trunk/check/src/Makefile.in + M /trunk/check/tests/Makefile.in + A /trunk/check/tests/test_log_output.sh + +Added log tests + +------------------------------------------------------------------------ +r55 | amalec | 2001-07-11 16:46:08 -0400 (Wed, 11 Jul 2001) | 2 lines +Changed paths: + M /trunk/check/NEWS + M /trunk/check/README + M /trunk/check/doc/example.lyx + M /trunk/check/rpm/check.spec + M /trunk/check/src/check.h + M /trunk/check/tests/check_check_log.c + M /trunk/check/tests/check_check_main.c + +Updated docs + +------------------------------------------------------------------------ +r54 | amalec | 2001-07-10 19:29:27 -0400 (Tue, 10 Jul 2001) | 2 lines +Changed paths: + M /trunk/check/ChangeLog + +Update ChangeLog + +------------------------------------------------------------------------ +r53 | amalec | 2001-07-10 19:28:57 -0400 (Tue, 10 Jul 2001) | 2 lines +Changed paths: + M /trunk/check/src/Makefile.in + M /trunk/check/src/check_log.c + M /trunk/check/tests/check_check.h + M /trunk/check/tests/check_check_log.c + M /trunk/check/tests/check_check_master.c + M /trunk/check/tests/check_check_sub.c + M /trunk/check/tests/test_output.sh + +Completed testing for multiple suite running, and reorganized files + +------------------------------------------------------------------------ +r52 | amalec | 2001-07-10 19:26:28 -0400 (Tue, 10 Jul 2001) | 2 lines +Changed paths: + A /trunk/check/src/check_log.c + D /trunk/check/src/check_log.h + +Commit file changes + +------------------------------------------------------------------------ +r51 | amalec | 2001-07-10 19:25:53 -0400 (Tue, 10 Jul 2001) | 2 lines +Changed paths: + M /trunk/check/src/Makefile.am + M /trunk/check/src/check.h + M /trunk/check/src/check_run.c + +Moved check_log.h functions into check.h + +------------------------------------------------------------------------ +r50 | amalec | 2001-07-09 20:10:06 -0400 (Mon, 09 Jul 2001) | 2 lines +Changed paths: + M /trunk/check/ChangeLog + +Commit ChangeLog + +------------------------------------------------------------------------ +r49 | amalec | 2001-07-09 20:09:41 -0400 (Mon, 09 Jul 2001) | 2 lines +Changed paths: + M /trunk/check/src/check.c + M /trunk/check/src/check.h + M /trunk/check/src/check_impl.h + M /trunk/check/src/check_run.c + M /trunk/check/src/list.h + M /trunk/check/tests/Makefile.am + M /trunk/check/tests/Makefile.in + M /trunk/check/tests/check_check.h + M /trunk/check/tests/check_check_log.c + M /trunk/check/tests/check_check_main.c + M /trunk/check/tests/check_check_master.c + M /trunk/check/tests/check_check_msg.c + M /trunk/check/tests/check_check_sub.c + M /trunk/check/tests/check_list.c + +Completed test for initial logging feature, and added feature to run multiple suites through an SRunner + +------------------------------------------------------------------------ +r48 | amalec | 2001-06-29 21:27:02 -0400 (Fri, 29 Jun 2001) | 2 lines +Changed paths: + M /trunk/check/src/Makefile.in + M /trunk/check/src/check.h + M /trunk/check/src/check_impl.h + M /trunk/check/src/check_log.h + M /trunk/check/src/check_run.c + M /trunk/check/tests/check_check_log.c + M /trunk/check/tests/test_output.sh + +Restructured printing to allow for logging function + +------------------------------------------------------------------------ +r47 | amalec | 2001-06-28 20:40:03 -0400 (Thu, 28 Jun 2001) | 2 lines +Changed paths: + M /trunk/check/src/Makefile.am + M /trunk/check/src/Makefile.in + +Add check_log.c to Makefile.am + +------------------------------------------------------------------------ +r46 | amalec | 2001-06-28 20:33:07 -0400 (Thu, 28 Jun 2001) | 2 lines +Changed paths: + M /trunk/check/tests/Makefile.am + M /trunk/check/tests/Makefile.in + +Complete move of check_check_log.c -- this time for real... + +------------------------------------------------------------------------ +r45 | amalec | 2001-06-28 20:31:39 -0400 (Thu, 28 Jun 2001) | 2 lines +Changed paths: + M /trunk/check/Doxyfile + M /trunk/check/src/check_log.h + M /trunk/check/tests/Makefile.am + M /trunk/check/tests/Makefile.in + +Complete move of check_check_log.c + +------------------------------------------------------------------------ +r44 | amalec | 2001-06-28 20:30:29 -0400 (Thu, 28 Jun 2001) | 2 lines +Changed paths: + M /trunk/check/tests/Makefile.am + A /trunk/check/tests/check_check_log.c + D /trunk/check/tests/check_log.c + +Moved check_log.c to check_check_log.c + +------------------------------------------------------------------------ +r43 | amalec | 2001-06-28 18:56:26 -0400 (Thu, 28 Jun 2001) | 2 lines +Changed paths: + D /trunk/check/doc/money/stamp-h + +Removed stamp-h + +------------------------------------------------------------------------ +r42 | amalec | 2001-06-28 18:51:36 -0400 (Thu, 28 Jun 2001) | 2 lines +Changed paths: + A /trunk/check/src/check_log.h + A /trunk/check/tests/check_log.c + +Added skeleton files for check logging + +------------------------------------------------------------------------ +r41 | amalec | 2001-06-28 18:33:50 -0400 (Thu, 28 Jun 2001) | 2 lines +Changed paths: + M /trunk/check/Doxyfile + M /trunk/check/configure + M /trunk/check/configure.in + M /trunk/check/src/check.h + M /trunk/check/tests/Makefile.am + M /trunk/check/tests/Makefile.in + +Additional doxygenation of check.h + +------------------------------------------------------------------------ +r39 | amalec | 2001-06-27 14:27:35 -0400 (Wed, 27 Jun 2001) | 2 lines +Changed paths: + M /trunk/check/ChangeLog + +Updated ChangeLog + +------------------------------------------------------------------------ +r38 | amalec | 2001-06-27 14:25:54 -0400 (Wed, 27 Jun 2001) | 2 lines +Changed paths: + M /trunk/check/configure + M /trunk/check/rpm/check.spec + +Updated check.spec + +------------------------------------------------------------------------ +r37 | amalec | 2001-06-27 14:21:32 -0400 (Wed, 27 Jun 2001) | 2 lines +Changed paths: + M /trunk/check/ChangeLog + +Update ChangeLog + +------------------------------------------------------------------------ +r36 | amalec | 2001-06-27 14:20:42 -0400 (Wed, 27 Jun 2001) | 2 lines +Changed paths: + M /trunk/check/NEWS + M /trunk/check/configure.in + M /trunk/check/doc/example.lyx + M /trunk/check/doc/money/check_money.c + M /trunk/check/doc/money/configure + M /trunk/check/doc/money/configure.in + M /trunk/check/src/check.h + M /trunk/check/src/check_run.c + M /trunk/check/tests/check_check_main.c + M /trunk/check/tests/check_check_master.c + M /trunk/check/tests/check_check_msg.c + M /trunk/check/tests/check_list.c + M /trunk/check/tests/check_stress.c + +Completed srunner_results, and added unit tests; changed srunner_nfailed to srunner_ntests_failed and changed documentation. + +------------------------------------------------------------------------ +r35 | amalec | 2001-06-26 18:51:57 -0400 (Tue, 26 Jun 2001) | 2 lines +Changed paths: + A /trunk/check/Doxyfile + M /trunk/check/doc/example.lyx + M /trunk/check/src/check.h + M /trunk/check/src/check_run.c + M /trunk/check/tests/Makefile.am + M /trunk/check/tests/Makefile.in + D /trunk/check/tests/check_check.c + A /trunk/check/tests/check_check.h + A /trunk/check/tests/check_check_main.c + A /trunk/check/tests/check_check_master.c + M /trunk/check/tests/check_check_msg.c + A /trunk/check/tests/check_check_sub.c + M /trunk/check/tests/check_list.c + M /trunk/check/tests/check_stress.c + +Fixed a bug in srunner_failures, fixed a typo in the tutorial documentation (thanks to Michael Tucker), and refactored check_check + +------------------------------------------------------------------------ +r34 | amalec | 2001-06-21 21:16:03 -0400 (Thu, 21 Jun 2001) | 2 lines +Changed paths: + M /trunk/check/ChangeLog + +Update ChangeLog + +------------------------------------------------------------------------ +r33 | amalec | 2001-06-21 21:15:23 -0400 (Thu, 21 Jun 2001) | 2 lines +Changed paths: + M /trunk/check/NEWS + M /trunk/check/doc/Makefile.am + M /trunk/check/doc/example.lyx + M /trunk/check/doc/index.html + M /trunk/check/rpm/check.spec + M /trunk/check/tests/Makefile.am + M /trunk/check/tests/Makefile.in + +Specfile changes, updates to NEWS + +------------------------------------------------------------------------ +r32 | amalec | 2001-06-21 20:37:48 -0400 (Thu, 21 Jun 2001) | 2 lines +Changed paths: + M /trunk/check/ChangeLog + +Update ChangeLog + +------------------------------------------------------------------------ +r31 | amalec | 2001-06-21 20:36:49 -0400 (Thu, 21 Jun 2001) | 2 lines +Changed paths: + M /trunk/check/src/check.h + M /trunk/check/src/check_run.c + M /trunk/check/tests/Makefile.am + M /trunk/check/tests/Makefile.in + M /trunk/check/tests/check_check.c + A /trunk/check/tests/ex_output.c + A /trunk/check/tests/test_output.sh + +Changed test output, added end-to-end test, and removed redundant field from TestResult struct + +------------------------------------------------------------------------ +r30 | amalec | 2001-06-19 16:01:10 -0400 (Tue, 19 Jun 2001) | 2 lines +Changed paths: + M /trunk/check/ChangeLog + +Update changelog + +------------------------------------------------------------------------ +r29 | amalec | 2001-06-19 15:59:48 -0400 (Tue, 19 Jun 2001) | 2 lines +Changed paths: + M /trunk/check/src/check.h + M /trunk/check/src/check_run.c + M /trunk/check/tests/check_check.c + +Added accessors for TestResult and expanded unit test + +------------------------------------------------------------------------ +r28 | amalec | 2001-06-12 13:29:04 -0400 (Tue, 12 Jun 2001) | 2 lines +Changed paths: + M /trunk/check/ChangeLog + +Updated ChangeLog + +------------------------------------------------------------------------ +r27 | amalec | 2001-06-12 13:28:10 -0400 (Tue, 12 Jun 2001) | 2 lines +Changed paths: + M /trunk/check/configure + M /trunk/check/configure.in + M /trunk/check/src/check.h + M /trunk/check/src/check_run.c + M /trunk/check/tests/check_check.c + +Added new tests for line number + +------------------------------------------------------------------------ +r26 | amalec | 2001-06-04 13:58:14 -0400 (Mon, 04 Jun 2001) | 2 lines +Changed paths: + M /trunk/check/ChangeLog + A /trunk/check/doc/index.html + +Added homepage file in doc directory, and updated change log + +------------------------------------------------------------------------ +r24 | amalec | 2001-06-04 13:08:54 -0400 (Mon, 04 Jun 2001) | 2 lines +Changed paths: + M /trunk/check/doc/Makefile.am + M /trunk/check/doc/example.lyx + M /trunk/check/rpm/check.spec + +Cleaned up spec file for RPM packaging + +------------------------------------------------------------------------ +r23 | amalec | 2001-06-03 19:50:40 -0400 (Sun, 03 Jun 2001) | 2 lines +Changed paths: + M /trunk/check/Makefile.am + M /trunk/check/Makefile.in + M /trunk/check/configure + M /trunk/check/configure.in + M /trunk/check/doc/Makefile.am + A /trunk/check/rpm + A /trunk/check/rpm/check.spec + +Added RPM spec file and added additional documentation files + +------------------------------------------------------------------------ +r22 | amalec | 2001-06-01 11:46:39 -0400 (Fri, 01 Jun 2001) | 2 lines +Changed paths: + M /trunk/check/ChangeLog + +Updated ChangeLog + +------------------------------------------------------------------------ +r21 | amalec | 2001-06-01 11:44:43 -0400 (Fri, 01 Jun 2001) | 2 lines +Changed paths: + M /trunk/check/Makefile.in + M /trunk/check/src/Makefile.in + M /trunk/check/src/check.c + M /trunk/check/src/check.h + M /trunk/check/src/check_impl.h + M /trunk/check/src/check_msg.c + M /trunk/check/src/check_msg.h + M /trunk/check/src/check_run.c + M /trunk/check/src/error.c + M /trunk/check/src/error.h + M /trunk/check/src/list.c + M /trunk/check/src/list.h + M /trunk/check/tests/Makefile.in + +GNUified source files with copyright notice + +------------------------------------------------------------------------ +r20 | amalec | 2001-06-01 11:33:42 -0400 (Fri, 01 Jun 2001) | 2 lines +Changed paths: + M /trunk/check/aclocal.m4 + M /trunk/check/configure + M /trunk/check/configure.in + M /trunk/check/doc/Makefile.am + M /trunk/check/doc/example.lyx + +Made building docs conditional on presence of lyx and sgml2html + +------------------------------------------------------------------------ +r19 | amalec | 2001-05-31 18:35:20 -0400 (Thu, 31 May 2001) | 2 lines +Changed paths: + M /trunk/check/ChangeLog + +Update ChangeLog + +------------------------------------------------------------------------ +r18 | amalec | 2001-05-31 18:34:38 -0400 (Thu, 31 May 2001) | 2 lines +Changed paths: + M /trunk/check/configure.in + M /trunk/check/doc/Makefile.am + +Modified Makefile.am to include docs in dist + +------------------------------------------------------------------------ +r17 | amalec | 2001-05-31 18:26:35 -0400 (Thu, 31 May 2001) | 2 lines +Changed paths: + M /trunk/check/ChangeLog + M /trunk/check/Makefile.am + M /trunk/check/Makefile.in + M /trunk/check/aclocal.m4 + M /trunk/check/configure + M /trunk/check/configure.in + A /trunk/check/doc/Makefile.am + M /trunk/check/src/Makefile.in + M /trunk/check/tests/Makefile.in + +Added Automake support to create and install documentation + +------------------------------------------------------------------------ +r16 | amalec | 2001-05-31 17:30:36 -0400 (Thu, 31 May 2001) | 2 lines +Changed paths: + D /trunk/check/doc/money/config.h + D /trunk/check/doc/money/config.log + D /trunk/check/doc/money/config.status + +Removed unneded files + +------------------------------------------------------------------------ +r15 | amalec | 2001-05-31 11:37:53 -0400 (Thu, 31 May 2001) | 2 lines +Changed paths: + M /trunk/check/ChangeLog + M /trunk/check/ChangeLogOld + +Updated change logs + +------------------------------------------------------------------------ +r14 | amalec | 2001-05-31 11:35:28 -0400 (Thu, 31 May 2001) | 2 lines +Changed paths: + M /trunk/check/doc/example.lyx + +Commit changes to example, get things in synch + +------------------------------------------------------------------------ +r13 | amalec | 2001-05-31 11:32:22 -0400 (Thu, 31 May 2001) | 2 lines +Changed paths: + A /trunk/check/doc/money/COPYING + A /trunk/check/doc/money/ChangeLog + A /trunk/check/doc/money/INSTALL + A /trunk/check/doc/money/Makefile.am + A /trunk/check/doc/money/Makefile.in + A /trunk/check/doc/money/NEWS + A /trunk/check/doc/money/README + A /trunk/check/doc/money/aclocal.m4 + A /trunk/check/doc/money/check_money.c + A /trunk/check/doc/money/config.h + A /trunk/check/doc/money/config.h.in + A /trunk/check/doc/money/config.log + A /trunk/check/doc/money/config.status + A /trunk/check/doc/money/configure + A /trunk/check/doc/money/configure.in + A /trunk/check/doc/money/money.c + A /trunk/check/doc/money/money.h + A /trunk/check/doc/money/stamp-h + A /trunk/check/doc/money/stamp-h.in + +Hopefully finally solved CVS problems and commited changes to money example and example.lyx + +------------------------------------------------------------------------ +r12 | amalec | 2001-05-30 19:48:43 -0400 (Wed, 30 May 2001) | 2 lines +Changed paths: + A /trunk/check/doc/money + A /trunk/check/doc/money/AUTHORS + +Trying to commit added files... + +------------------------------------------------------------------------ +r11 | amalec | 2001-05-30 19:45:07 -0400 (Wed, 30 May 2001) | 2 lines +Changed paths: + M /trunk/check/doc/example.lyx + +Cleaning up CVS.. + +------------------------------------------------------------------------ +r10 | amalec | 2001-05-30 19:37:35 -0400 (Wed, 30 May 2001) | 2 lines +Changed paths: + A /trunk/check/ChangeLogOld + +Trying to update documentation and change log, and statisfy CVS... + +------------------------------------------------------------------------ +r9 | amalec | 2001-05-30 19:34:29 -0400 (Wed, 30 May 2001) | 2 lines +Changed paths: + M /trunk/check/ChangeLog + +Refined documentation, and moved old change log information to ChangeLogOld + +------------------------------------------------------------------------ +r8 | amalec | 2001-05-30 18:44:48 -0400 (Wed, 30 May 2001) | 2 lines +Changed paths: + M /trunk/check/doc/example.lyx + +Added complete example to accompany documentation + +------------------------------------------------------------------------ +r7 | amalec | 2001-05-29 23:25:29 -0400 (Tue, 29 May 2001) | 2 lines +Changed paths: + M /trunk/check/Makefile.in + +Added example and expanded documentation + +------------------------------------------------------------------------ +r3 | amalec | 2001-05-29 18:42:55 -0400 (Tue, 29 May 2001) | 2 lines +Changed paths: + A /trunk/check + A /trunk/check/AUTHORS + A /trunk/check/COPYING + A /trunk/check/ChangeLog + A /trunk/check/INSTALL + A /trunk/check/Makefile.am + A /trunk/check/Makefile.in + A /trunk/check/NEWS + A /trunk/check/README + A /trunk/check/aclocal.m4 + A /trunk/check/config.h.in + A /trunk/check/configure + A /trunk/check/configure.in + A /trunk/check/doc + A /trunk/check/doc/example.lyx + A /trunk/check/install-sh + A /trunk/check/missing + A /trunk/check/mkinstalldirs + A /trunk/check/src + A /trunk/check/src/Makefile.am + A /trunk/check/src/Makefile.in + A /trunk/check/src/check.c + A /trunk/check/src/check.h + A /trunk/check/src/check_impl.h + A /trunk/check/src/check_msg.c + A /trunk/check/src/check_msg.h + A /trunk/check/src/check_run.c + A /trunk/check/src/error.c + A /trunk/check/src/error.h + A /trunk/check/src/list.c + A /trunk/check/src/list.h + A /trunk/check/stamp-h.in + A /trunk/check/tests + A /trunk/check/tests/Makefile.am + A /trunk/check/tests/Makefile.in + A /trunk/check/tests/check_check.c + A /trunk/check/tests/check_check_msg.c + A /trunk/check/tests/check_list.c + A /trunk/check/tests/check_stress.c + +Initial revision + +------------------------------------------------------------------------ +r1 | (no author) | 2001-05-29 18:42:54 -0400 (Tue, 29 May 2001) | 1 line +Changed paths: + A /branches + A /tags + A /trunk + +New repository initialized by cvs2svn. +------------------------------------------------------------------------ diff --git a/THANKS b/THANKS new file mode 100644 index 0000000..9c0d17e --- /dev/null +++ b/THANKS @@ -0,0 +1,10 @@ +Design suggestions: + Fred Drake (checked fixture functions) + Jim O'Leary (forkless mode) + +Downstream maintainers: + Robert Lemmen (Debian) + Tom 'spot' Callaway (Fedora Extras) + +If you helped out with Check in some way and would like to be listed +here, send a patch to . diff --git a/TODO b/TODO new file mode 100644 index 0000000..d63ae23 --- /dev/null +++ b/TODO @@ -0,0 +1,131 @@ +TODO +==== + +The following are considered bugs in Check. If you have a fix, please +send it to . Bug fixing is +considered more important than feature requests at this point. Also +please check the Sourceforge trackers. + +Documentation +============= + +[0.9.4] * Convert to info format and update. +[0.9.4] * Remove old SGML documentation. +[0.9.4] * Fix building of documentation that relies on diff +[ ] * Add html generation of Texinfo docs. +[0.9.4] * Create initial and final versions of money example. +[0.9.4] * Update tutorial so that it works with modern tools. +[ ] * Clarify looping tests and give example of usage. + +Interface +========= + +[ ] * Change check not to clobber things in the global namespace. + Prepend CHECK_ to all constants, check_ to all exported symbols, + and _check to all internal functions. Currently fail() is + causing a problem. Deprecate the old API in a nice way. + +Build issues: +============= + +[0.9.4] * Convert Check to use Libtool +[ ] * Figure out if we need stamp-h.in or not +[ ] * use AC_CONFIG_MACRO_DIR([m4]) and create an m4/ dir for check.m4 + aclocaldir = $(datadir)/aclocal + aclocal_DATA = mymacro.m4 myothermacro.m4 + ACLOCAL_AMFLAGS = -I m4 # put in top-level Makefile.am +[ ] * Fix overriding CFLAGS in configure.ac +[ ] * Use AC_DEFINE to define version number stuff? +[ ] * Change MICRO to ALPHA? probably not +[ ] * Add std-options to AM_INIT_AUTOMAKE +[ ] * Investigate subdir-objects option to AM_INIT_AUTOMAKE +[ ] * Use filename-length-max=99 in AM_INIT_AUTOMAKE +[0.9.4] * Make sure libcheck.(l)a works as a dependency, don't call $(MAKE) +[0.9.4] * Build tests/ dirs after everything else +[0.9.4] * Fix AM_PATH_CHECK by deprecating it; use pkg-config instead +[ ] * make Check pass its own unit tests: make distcheck fails +[ ] * use stricter CFLAGS for compiling Check + +Check source code: +============ + +[ ] * Eliminate abbreviations like nf for number_failed +[ ] * Run indent on everything, make sure it works well. +[ ] * Fix START_TEST/END_TEST to look like valid C code. +[ ] * Document things way more. +[ ] * Create check.h automatically using makeheaders.c (not sure) +[ ] * Eliminate check_ prefix from files in src/ ... not needed + +Internal Check tests +====================== + +[0.9.3] * Use gcov to test and expand coverage of existing unit tests +[ ] * Increase tests for more non-public modules +[0.8.0] * Refactor to allow better unit testing of printing functionality. +[ ] * Document things way more. +[ ] * Clarify what all the different tests mean, whether they are + meant to fail or not --- setting all CK_SILENT to CK_VERBOSE + makes it seem like there are lots of errors being produced! + +Packaging +========= + +[0.7.2] * Automate RPM production +[0.7.2] * Debian packaging +[0.9.2] * Get Check into Debian Sid +[0.9.4] * Eliminate .deb and .rpm packaging for vendors --- not necessary + + + +The following enhancements are being considered for Check. Please +send an email to if you would like +to assist in any of these, or if you would like to suggest additional +enhancements. Also please check the various trackers at the Check +project website. + +Printing and Logging +==================== + +[ ] * Allow unit test output (stdout and stderr) to be captured and logged +[0.9.1] * Add XML as option for test output +[ ] * Open the API for printing/logging customization +[ ] * JUnit-style UI? + +Unit test writing +================= + +[0.8.0] * Allow fail and friends to be used within fixture + setup/teardown functions +[0.8.0] * Allow forkless running of suites, to allow debugging +[0.9.2] * Allow unit tests that expect signals +[ ] * Allow unit tests to write to the log +[ ] * Allow unit tests that expect output (see stdout logging above) (but + maybe perl/sh/expect/dejagnu are better tools) +[ ] * Autoproduce unit test framework from header files +[ ] * Count the number of START_TEST macros and check that each function + is added to some suite; issue a warning message otherwise. Maybe the + best way to do this is to put each function onto a list or + table as its defined, and then remove it once its added + somewhere. Then, when finished, print out what remains on the list / + in the table. This might require some ugly macro hackery... +[ ] * Better macro for START_TEST. It would be nice to pass in + three separate arguments, something like: + 1) a numeric ID for the tests function + 2) the exact name of the function being tested + 3) the name of the feature in (2) being tested for +[ ] * Find a way to create setup/teardown macros such that global + variables aren't necessary, and they're really just blocks + that get added at the beginning and ending of tests. +[ ] * Some mechanism to profile execution times, and assert that the time + a test takes to complete scales according to some big-O notation. + +Check Internals +=============== + +[0.8.0] * Implement message passing between unit test and test + programs using pipes, rather than SysV IPC, to allow support + under cygwin. +[ ] * Abstract the forking and message passing implementation to + allow Win32 compatibility. +[ ] * Incorporate existing Win32 support as mentioned here: + http://opendarwin.org/pipermail/cvs-libfoundation-all/2005-March/000177.html diff --git a/autogen.sh b/autogen.sh new file mode 100755 index 0000000..683dd89 --- /dev/null +++ b/autogen.sh @@ -0,0 +1,5 @@ +aclocal +autoheader +autoconf +libtoolize --copy --automake +automake --add-missing --copy --gnu diff --git a/build-aux/config.guess b/build-aux/config.guess new file mode 100755 index 0000000..e3ef63f --- /dev/null +++ b/build-aux/config.guess @@ -0,0 +1,1471 @@ +#! /bin/sh +# Attempt to guess a canonical system name. +# Copyright (C) 1992, 1993, 1994, 1995, 1996, 1997, 1998, 1999, +# 2000, 2001, 2002, 2003, 2004, 2005 Free Software Foundation, Inc. + +timestamp='2005-12-13' + +# This file is free software; you can redistribute it and/or modify it +# under the terms of the GNU General Public License as published by +# the Free Software Foundation; either version 2 of the License, or +# (at your option) any later version. +# +# This program is distributed in the hope that it will be useful, but +# WITHOUT ANY WARRANTY; without even the implied warranty of +# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU +# General Public License for more details. +# +# You should have received a copy of the GNU General Public License +# along with this program; if not, write to the Free Software +# Foundation, Inc., 51 Franklin Street - Fifth Floor, Boston, MA +# 02110-1301, USA. +# +# 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 Per Bothner . +# Please send patches to . Submit a context +# diff and a properly formatted ChangeLog entry. +# +# This script attempts to guess a canonical system name similar to +# config.sub. If it succeeds, it prints the system name on stdout, and +# exits with 0. Otherwise, it exits with 1. +# +# The plan is that this can be called by configure scripts if you +# don't specify an explicit build system type. + +me=`echo "$0" | sed -e 's,.*/,,'` + +usage="\ +Usage: $0 [OPTION] + +Output the configuration name of the system \`$me' is run on. + +Operation modes: + -h, --help print this help, then exit + -t, --time-stamp print date of last modification, then exit + -v, --version print version number, then exit + +Report bugs and patches to ." + +version="\ +GNU config.guess ($timestamp) + +Originally written by Per Bothner. +Copyright (C) 1992, 1993, 1994, 1995, 1996, 1997, 1998, 1999, 2000, 2001, 2002, 2003, 2004, 2005 +Free Software Foundation, Inc. + +This is free software; see the source for copying conditions. There is NO +warranty; not even for MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE." + +help=" +Try \`$me --help' for more information." + +# Parse command line +while test $# -gt 0 ; do + case $1 in + --time-stamp | --time* | -t ) + echo "$timestamp" ; exit ;; + --version | -v ) + echo "$version" ; exit ;; + --help | --h* | -h ) + echo "$usage"; exit ;; + -- ) # Stop option processing + shift; break ;; + - ) # Use stdin as input. + break ;; + -* ) + echo "$me: invalid option $1$help" >&2 + exit 1 ;; + * ) + break ;; + esac +done + +if test $# != 0; then + echo "$me: too many arguments$help" >&2 + exit 1 +fi + +trap 'exit 1' 1 2 15 + +# CC_FOR_BUILD -- compiler used by this script. Note that the use of a +# compiler to aid in system detection is discouraged as it requires +# temporary files to be created and, as you can see below, it is a +# headache to deal with in a portable fashion. + +# Historically, `CC_FOR_BUILD' used to be named `HOST_CC'. We still +# use `HOST_CC' if defined, but it is deprecated. + +# Portable tmp directory creation inspired by the Autoconf team. + +set_cc_for_build=' +trap "exitcode=\$?; (rm -f \$tmpfiles 2>/dev/null; rmdir \$tmp 2>/dev/null) && exit \$exitcode" 0 ; +trap "rm -f \$tmpfiles 2>/dev/null; rmdir \$tmp 2>/dev/null; exit 1" 1 2 13 15 ; +: ${TMPDIR=/tmp} ; + { tmp=`(umask 077 && mktemp -d -q "$TMPDIR/cgXXXXXX") 2>/dev/null` && test -n "$tmp" && test -d "$tmp" ; } || + { test -n "$RANDOM" && tmp=$TMPDIR/cg$$-$RANDOM && (umask 077 && mkdir $tmp) ; } || + { tmp=$TMPDIR/cg-$$ && (umask 077 && mkdir $tmp) && echo "Warning: creating insecure temp directory" >&2 ; } || + { echo "$me: cannot create a temporary directory in $TMPDIR" >&2 ; exit 1 ; } ; +dummy=$tmp/dummy ; +tmpfiles="$dummy.c $dummy.o $dummy.rel $dummy" ; +case $CC_FOR_BUILD,$HOST_CC,$CC in + ,,) echo "int x;" > $dummy.c ; + for c in cc gcc c89 c99 ; do + if ($c -c -o $dummy.o $dummy.c) >/dev/null 2>&1 ; then + CC_FOR_BUILD="$c"; break ; + fi ; + done ; + if test x"$CC_FOR_BUILD" = x ; then + CC_FOR_BUILD=no_compiler_found ; + fi + ;; + ,,*) CC_FOR_BUILD=$CC ;; + ,*,*) CC_FOR_BUILD=$HOST_CC ;; +esac ; set_cc_for_build= ;' + +# This is needed to find uname on a Pyramid OSx when run in the BSD universe. +# (ghazi@noc.rutgers.edu 1994-08-24) +if (test -f /.attbin/uname) >/dev/null 2>&1 ; then + PATH=$PATH:/.attbin ; export PATH +fi + +UNAME_MACHINE=`(uname -m) 2>/dev/null` || UNAME_MACHINE=unknown +UNAME_RELEASE=`(uname -r) 2>/dev/null` || UNAME_RELEASE=unknown +UNAME_SYSTEM=`(uname -s) 2>/dev/null` || UNAME_SYSTEM=unknown +UNAME_VERSION=`(uname -v) 2>/dev/null` || UNAME_VERSION=unknown + +# Note: order is significant - the case branches are not exclusive. + +case "${UNAME_MACHINE}:${UNAME_SYSTEM}:${UNAME_RELEASE}:${UNAME_VERSION}" in + *:NetBSD:*:*) + # NetBSD (nbsd) targets should (where applicable) match one or + # more of the tupples: *-*-netbsdelf*, *-*-netbsdaout*, + # *-*-netbsdecoff* and *-*-netbsd*. For targets that recently + # switched to ELF, *-*-netbsd* would select the old + # object file format. This provides both forward + # compatibility and a consistent mechanism for selecting the + # object file format. + # + # Note: NetBSD doesn't particularly care about the vendor + # portion of the name. We always set it to "unknown". + sysctl="sysctl -n hw.machine_arch" + UNAME_MACHINE_ARCH=`(/sbin/$sysctl 2>/dev/null || \ + /usr/sbin/$sysctl 2>/dev/null || echo unknown)` + case "${UNAME_MACHINE_ARCH}" in + armeb) machine=armeb-unknown ;; + arm*) machine=arm-unknown ;; + sh3el) machine=shl-unknown ;; + sh3eb) machine=sh-unknown ;; + *) machine=${UNAME_MACHINE_ARCH}-unknown ;; + esac + # The Operating System including object format, if it has switched + # to ELF recently, or will in the future. + case "${UNAME_MACHINE_ARCH}" in + arm*|i386|m68k|ns32k|sh3*|sparc|vax) + eval $set_cc_for_build + if echo __ELF__ | $CC_FOR_BUILD -E - 2>/dev/null \ + | grep __ELF__ >/dev/null + then + # Once all utilities can be ECOFF (netbsdecoff) or a.out (netbsdaout). + # Return netbsd for either. FIX? + os=netbsd + else + os=netbsdelf + fi + ;; + *) + os=netbsd + ;; + esac + # The OS release + # Debian GNU/NetBSD machines have a different userland, and + # thus, need a distinct triplet. However, they do not need + # kernel version information, so it can be replaced with a + # suitable tag, in the style of linux-gnu. + case "${UNAME_VERSION}" in + Debian*) + release='-gnu' + ;; + *) + release=`echo ${UNAME_RELEASE}|sed -e 's/[-_].*/\./'` + ;; + esac + # Since CPU_TYPE-MANUFACTURER-KERNEL-OPERATING_SYSTEM: + # contains redundant information, the shorter form: + # CPU_TYPE-MANUFACTURER-OPERATING_SYSTEM is used. + echo "${machine}-${os}${release}" + exit ;; + *:OpenBSD:*:*) + UNAME_MACHINE_ARCH=`arch | sed 's/OpenBSD.//'` + echo ${UNAME_MACHINE_ARCH}-unknown-openbsd${UNAME_RELEASE} + exit ;; + *:ekkoBSD:*:*) + echo ${UNAME_MACHINE}-unknown-ekkobsd${UNAME_RELEASE} + exit ;; + macppc:MirBSD:*:*) + echo powerppc-unknown-mirbsd${UNAME_RELEASE} + exit ;; + *:MirBSD:*:*) + echo ${UNAME_MACHINE}-unknown-mirbsd${UNAME_RELEASE} + exit ;; + alpha:OSF1:*:*) + case $UNAME_RELEASE in + *4.0) + UNAME_RELEASE=`/usr/sbin/sizer -v | awk '{print $3}'` + ;; + *5.*) + UNAME_RELEASE=`/usr/sbin/sizer -v | awk '{print $4}'` + ;; + esac + # According to Compaq, /usr/sbin/psrinfo has been available on + # OSF/1 and Tru64 systems produced since 1995. I hope that + # covers most systems running today. This code pipes the CPU + # types through head -n 1, so we only detect the type of CPU 0. + ALPHA_CPU_TYPE=`/usr/sbin/psrinfo -v | sed -n -e 's/^ The alpha \(.*\) processor.*$/\1/p' | head -n 1` + case "$ALPHA_CPU_TYPE" in + "EV4 (21064)") + UNAME_MACHINE="alpha" ;; + "EV4.5 (21064)") + UNAME_MACHINE="alpha" ;; + "LCA4 (21066/21068)") + UNAME_MACHINE="alpha" ;; + "EV5 (21164)") + UNAME_MACHINE="alphaev5" ;; + "EV5.6 (21164A)") + UNAME_MACHINE="alphaev56" ;; + "EV5.6 (21164PC)") + UNAME_MACHINE="alphapca56" ;; + "EV5.7 (21164PC)") + UNAME_MACHINE="alphapca57" ;; + "EV6 (21264)") + UNAME_MACHINE="alphaev6" ;; + "EV6.7 (21264A)") + UNAME_MACHINE="alphaev67" ;; + "EV6.8CB (21264C)") + UNAME_MACHINE="alphaev68" ;; + "EV6.8AL (21264B)") + UNAME_MACHINE="alphaev68" ;; + "EV6.8CX (21264D)") + UNAME_MACHINE="alphaev68" ;; + "EV6.9A (21264/EV69A)") + UNAME_MACHINE="alphaev69" ;; + "EV7 (21364)") + UNAME_MACHINE="alphaev7" ;; + "EV7.9 (21364A)") + UNAME_MACHINE="alphaev79" ;; + esac + # A Pn.n version is a patched version. + # A Vn.n version is a released version. + # A Tn.n version is a released field test version. + # A Xn.n version is an unreleased experimental baselevel. + # 1.2 uses "1.2" for uname -r. + echo ${UNAME_MACHINE}-dec-osf`echo ${UNAME_RELEASE} | sed -e 's/^[PVTX]//' | tr 'ABCDEFGHIJKLMNOPQRSTUVWXYZ' 'abcdefghijklmnopqrstuvwxyz'` + exit ;; + Alpha\ *:Windows_NT*:*) + # How do we know it's Interix rather than the generic POSIX subsystem? + # Should we change UNAME_MACHINE based on the output of uname instead + # of the specific Alpha model? + echo alpha-pc-interix + exit ;; + 21064:Windows_NT:50:3) + echo alpha-dec-winnt3.5 + exit ;; + Amiga*:UNIX_System_V:4.0:*) + echo m68k-unknown-sysv4 + exit ;; + *:[Aa]miga[Oo][Ss]:*:*) + echo ${UNAME_MACHINE}-unknown-amigaos + exit ;; + *:[Mm]orph[Oo][Ss]:*:*) + echo ${UNAME_MACHINE}-unknown-morphos + exit ;; + *:OS/390:*:*) + echo i370-ibm-openedition + exit ;; + *:z/VM:*:*) + echo s390-ibm-zvmoe + exit ;; + *:OS400:*:*) + echo powerpc-ibm-os400 + exit ;; + arm:RISC*:1.[012]*:*|arm:riscix:1.[012]*:*) + echo arm-acorn-riscix${UNAME_RELEASE} + exit ;; + arm:riscos:*:*|arm:RISCOS:*:*) + echo arm-unknown-riscos + exit ;; + SR2?01:HI-UX/MPP:*:* | SR8000:HI-UX/MPP:*:*) + echo hppa1.1-hitachi-hiuxmpp + exit ;; + Pyramid*:OSx*:*:* | MIS*:OSx*:*:* | MIS*:SMP_DC-OSx*:*:*) + # akee@wpdis03.wpafb.af.mil (Earle F. Ake) contributed MIS and NILE. + if test "`(/bin/universe) 2>/dev/null`" = att ; then + echo pyramid-pyramid-sysv3 + else + echo pyramid-pyramid-bsd + fi + exit ;; + NILE*:*:*:dcosx) + echo pyramid-pyramid-svr4 + exit ;; + DRS?6000:unix:4.0:6*) + echo sparc-icl-nx6 + exit ;; + DRS?6000:UNIX_SV:4.2*:7* | DRS?6000:isis:4.2*:7*) + case `/usr/bin/uname -p` in + sparc) echo sparc-icl-nx7; exit ;; + esac ;; + sun4H:SunOS:5.*:*) + echo sparc-hal-solaris2`echo ${UNAME_RELEASE}|sed -e 's/[^.]*//'` + exit ;; + sun4*:SunOS:5.*:* | tadpole*:SunOS:5.*:*) + echo sparc-sun-solaris2`echo ${UNAME_RELEASE}|sed -e 's/[^.]*//'` + exit ;; + i86pc:SunOS:5.*:*) + echo i386-pc-solaris2`echo ${UNAME_RELEASE}|sed -e 's/[^.]*//'` + exit ;; + sun4*:SunOS:6*:*) + # According to config.sub, this is the proper way to canonicalize + # SunOS6. Hard to guess exactly what SunOS6 will be like, but + # it's likely to be more like Solaris than SunOS4. + echo sparc-sun-solaris3`echo ${UNAME_RELEASE}|sed -e 's/[^.]*//'` + exit ;; + sun4*:SunOS:*:*) + case "`/usr/bin/arch -k`" in + Series*|S4*) + UNAME_RELEASE=`uname -v` + ;; + esac + # Japanese Language versions have a version number like `4.1.3-JL'. + echo sparc-sun-sunos`echo ${UNAME_RELEASE}|sed -e 's/-/_/'` + exit ;; + sun3*:SunOS:*:*) + echo m68k-sun-sunos${UNAME_RELEASE} + exit ;; + sun*:*:4.2BSD:*) + UNAME_RELEASE=`(sed 1q /etc/motd | awk '{print substr($5,1,3)}') 2>/dev/null` + test "x${UNAME_RELEASE}" = "x" && UNAME_RELEASE=3 + case "`/bin/arch`" in + sun3) + echo m68k-sun-sunos${UNAME_RELEASE} + ;; + sun4) + echo sparc-sun-sunos${UNAME_RELEASE} + ;; + esac + exit ;; + aushp:SunOS:*:*) + echo sparc-auspex-sunos${UNAME_RELEASE} + exit ;; + # The situation for MiNT is a little confusing. The machine name + # can be virtually everything (everything which is not + # "atarist" or "atariste" at least should have a processor + # > m68000). The system name ranges from "MiNT" over "FreeMiNT" + # to the lowercase version "mint" (or "freemint"). Finally + # the system name "TOS" denotes a system which is actually not + # MiNT. But MiNT is downward compatible to TOS, so this should + # be no problem. + atarist[e]:*MiNT:*:* | atarist[e]:*mint:*:* | atarist[e]:*TOS:*:*) + echo m68k-atari-mint${UNAME_RELEASE} + exit ;; + atari*:*MiNT:*:* | atari*:*mint:*:* | atarist[e]:*TOS:*:*) + echo m68k-atari-mint${UNAME_RELEASE} + exit ;; + *falcon*:*MiNT:*:* | *falcon*:*mint:*:* | *falcon*:*TOS:*:*) + echo m68k-atari-mint${UNAME_RELEASE} + exit ;; + milan*:*MiNT:*:* | milan*:*mint:*:* | *milan*:*TOS:*:*) + echo m68k-milan-mint${UNAME_RELEASE} + exit ;; + hades*:*MiNT:*:* | hades*:*mint:*:* | *hades*:*TOS:*:*) + echo m68k-hades-mint${UNAME_RELEASE} + exit ;; + *:*MiNT:*:* | *:*mint:*:* | *:*TOS:*:*) + echo m68k-unknown-mint${UNAME_RELEASE} + exit ;; + m68k:machten:*:*) + echo m68k-apple-machten${UNAME_RELEASE} + exit ;; + powerpc:machten:*:*) + echo powerpc-apple-machten${UNAME_RELEASE} + exit ;; + RISC*:Mach:*:*) + echo mips-dec-mach_bsd4.3 + exit ;; + RISC*:ULTRIX:*:*) + echo mips-dec-ultrix${UNAME_RELEASE} + exit ;; + VAX*:ULTRIX*:*:*) + echo vax-dec-ultrix${UNAME_RELEASE} + exit ;; + 2020:CLIX:*:* | 2430:CLIX:*:*) + echo clipper-intergraph-clix${UNAME_RELEASE} + exit ;; + mips:*:*:UMIPS | mips:*:*:RISCos) + eval $set_cc_for_build + sed 's/^ //' << EOF >$dummy.c +#ifdef __cplusplus +#include /* for printf() prototype */ + int main (int argc, char *argv[]) { +#else + int main (argc, argv) int argc; char *argv[]; { +#endif + #if defined (host_mips) && defined (MIPSEB) + #if defined (SYSTYPE_SYSV) + printf ("mips-mips-riscos%ssysv\n", argv[1]); exit (0); + #endif + #if defined (SYSTYPE_SVR4) + printf ("mips-mips-riscos%ssvr4\n", argv[1]); exit (0); + #endif + #if defined (SYSTYPE_BSD43) || defined(SYSTYPE_BSD) + printf ("mips-mips-riscos%sbsd\n", argv[1]); exit (0); + #endif + #endif + exit (-1); + } +EOF + $CC_FOR_BUILD -o $dummy $dummy.c && + dummyarg=`echo "${UNAME_RELEASE}" | sed -n 's/\([0-9]*\).*/\1/p'` && + SYSTEM_NAME=`$dummy $dummyarg` && + { echo "$SYSTEM_NAME"; exit; } + echo mips-mips-riscos${UNAME_RELEASE} + exit ;; + Motorola:PowerMAX_OS:*:*) + echo powerpc-motorola-powermax + exit ;; + Motorola:*:4.3:PL8-*) + echo powerpc-harris-powermax + exit ;; + Night_Hawk:*:*:PowerMAX_OS | Synergy:PowerMAX_OS:*:*) + echo powerpc-harris-powermax + exit ;; + Night_Hawk:Power_UNIX:*:*) + echo powerpc-harris-powerunix + exit ;; + m88k:CX/UX:7*:*) + echo m88k-harris-cxux7 + exit ;; + m88k:*:4*:R4*) + echo m88k-motorola-sysv4 + exit ;; + m88k:*:3*:R3*) + echo m88k-motorola-sysv3 + exit ;; + AViiON:dgux:*:*) + # DG/UX returns AViiON for all architectures + UNAME_PROCESSOR=`/usr/bin/uname -p` + if [ $UNAME_PROCESSOR = mc88100 ] || [ $UNAME_PROCESSOR = mc88110 ] + then + if [ ${TARGET_BINARY_INTERFACE}x = m88kdguxelfx ] || \ + [ ${TARGET_BINARY_INTERFACE}x = x ] + then + echo m88k-dg-dgux${UNAME_RELEASE} + else + echo m88k-dg-dguxbcs${UNAME_RELEASE} + fi + else + echo i586-dg-dgux${UNAME_RELEASE} + fi + exit ;; + M88*:DolphinOS:*:*) # DolphinOS (SVR3) + echo m88k-dolphin-sysv3 + exit ;; + M88*:*:R3*:*) + # Delta 88k system running SVR3 + echo m88k-motorola-sysv3 + exit ;; + XD88*:*:*:*) # Tektronix XD88 system running UTekV (SVR3) + echo m88k-tektronix-sysv3 + exit ;; + Tek43[0-9][0-9]:UTek:*:*) # Tektronix 4300 system running UTek (BSD) + echo m68k-tektronix-bsd + exit ;; + *:IRIX*:*:*) + echo mips-sgi-irix`echo ${UNAME_RELEASE}|sed -e 's/-/_/g'` + exit ;; + ????????:AIX?:[12].1:2) # AIX 2.2.1 or AIX 2.1.1 is RT/PC AIX. + echo romp-ibm-aix # uname -m gives an 8 hex-code CPU id + exit ;; # Note that: echo "'`uname -s`'" gives 'AIX ' + i*86:AIX:*:*) + echo i386-ibm-aix + exit ;; + ia64:AIX:*:*) + if [ -x /usr/bin/oslevel ] ; then + IBM_REV=`/usr/bin/oslevel` + else + IBM_REV=${UNAME_VERSION}.${UNAME_RELEASE} + fi + echo ${UNAME_MACHINE}-ibm-aix${IBM_REV} + exit ;; + *:AIX:2:3) + if grep bos325 /usr/include/stdio.h >/dev/null 2>&1; then + eval $set_cc_for_build + sed 's/^ //' << EOF >$dummy.c + #include + + main() + { + if (!__power_pc()) + exit(1); + puts("powerpc-ibm-aix3.2.5"); + exit(0); + } +EOF + if $CC_FOR_BUILD -o $dummy $dummy.c && SYSTEM_NAME=`$dummy` + then + echo "$SYSTEM_NAME" + else + echo rs6000-ibm-aix3.2.5 + fi + elif grep bos324 /usr/include/stdio.h >/dev/null 2>&1; then + echo rs6000-ibm-aix3.2.4 + else + echo rs6000-ibm-aix3.2 + fi + exit ;; + *:AIX:*:[45]) + IBM_CPU_ID=`/usr/sbin/lsdev -C -c processor -S available | sed 1q | awk '{ print $1 }'` + if /usr/sbin/lsattr -El ${IBM_CPU_ID} | grep ' POWER' >/dev/null 2>&1; then + IBM_ARCH=rs6000 + else + IBM_ARCH=powerpc + fi + if [ -x /usr/bin/oslevel ] ; then + IBM_REV=`/usr/bin/oslevel` + else + IBM_REV=${UNAME_VERSION}.${UNAME_RELEASE} + fi + echo ${IBM_ARCH}-ibm-aix${IBM_REV} + exit ;; + *:AIX:*:*) + echo rs6000-ibm-aix + exit ;; + ibmrt:4.4BSD:*|romp-ibm:BSD:*) + echo romp-ibm-bsd4.4 + exit ;; + ibmrt:*BSD:*|romp-ibm:BSD:*) # covers RT/PC BSD and + echo romp-ibm-bsd${UNAME_RELEASE} # 4.3 with uname added to + exit ;; # report: romp-ibm BSD 4.3 + *:BOSX:*:*) + echo rs6000-bull-bosx + exit ;; + DPX/2?00:B.O.S.:*:*) + echo m68k-bull-sysv3 + exit ;; + 9000/[34]??:4.3bsd:1.*:*) + echo m68k-hp-bsd + exit ;; + hp300:4.4BSD:*:* | 9000/[34]??:4.3bsd:2.*:*) + echo m68k-hp-bsd4.4 + exit ;; + 9000/[34678]??:HP-UX:*:*) + HPUX_REV=`echo ${UNAME_RELEASE}|sed -e 's/[^.]*.[0B]*//'` + case "${UNAME_MACHINE}" in + 9000/31? ) HP_ARCH=m68000 ;; + 9000/[34]?? ) HP_ARCH=m68k ;; + 9000/[678][0-9][0-9]) + if [ -x /usr/bin/getconf ]; then + sc_cpu_version=`/usr/bin/getconf SC_CPU_VERSION 2>/dev/null` + sc_kernel_bits=`/usr/bin/getconf SC_KERNEL_BITS 2>/dev/null` + case "${sc_cpu_version}" in + 523) HP_ARCH="hppa1.0" ;; # CPU_PA_RISC1_0 + 528) HP_ARCH="hppa1.1" ;; # CPU_PA_RISC1_1 + 532) # CPU_PA_RISC2_0 + case "${sc_kernel_bits}" in + 32) HP_ARCH="hppa2.0n" ;; + 64) HP_ARCH="hppa2.0w" ;; + '') HP_ARCH="hppa2.0" ;; # HP-UX 10.20 + esac ;; + esac + fi + if [ "${HP_ARCH}" = "" ]; then + eval $set_cc_for_build + sed 's/^ //' << EOF >$dummy.c + + #define _HPUX_SOURCE + #include + #include + + int main () + { + #if defined(_SC_KERNEL_BITS) + long bits = sysconf(_SC_KERNEL_BITS); + #endif + long cpu = sysconf (_SC_CPU_VERSION); + + switch (cpu) + { + case CPU_PA_RISC1_0: puts ("hppa1.0"); break; + case CPU_PA_RISC1_1: puts ("hppa1.1"); break; + case CPU_PA_RISC2_0: + #if defined(_SC_KERNEL_BITS) + switch (bits) + { + case 64: puts ("hppa2.0w"); break; + case 32: puts ("hppa2.0n"); break; + default: puts ("hppa2.0"); break; + } break; + #else /* !defined(_SC_KERNEL_BITS) */ + puts ("hppa2.0"); break; + #endif + default: puts ("hppa1.0"); break; + } + exit (0); + } +EOF + (CCOPTS= $CC_FOR_BUILD -o $dummy $dummy.c 2>/dev/null) && HP_ARCH=`$dummy` + test -z "$HP_ARCH" && HP_ARCH=hppa + fi ;; + esac + if [ ${HP_ARCH} = "hppa2.0w" ] + then + eval $set_cc_for_build + + # hppa2.0w-hp-hpux* has a 64-bit kernel and a compiler generating + # 32-bit code. hppa64-hp-hpux* has the same kernel and a compiler + # generating 64-bit code. GNU and HP use different nomenclature: + # + # $ CC_FOR_BUILD=cc ./config.guess + # => hppa2.0w-hp-hpux11.23 + # $ CC_FOR_BUILD="cc +DA2.0w" ./config.guess + # => hppa64-hp-hpux11.23 + + if echo __LP64__ | (CCOPTS= $CC_FOR_BUILD -E - 2>/dev/null) | + grep __LP64__ >/dev/null + then + HP_ARCH="hppa2.0w" + else + HP_ARCH="hppa64" + fi + fi + echo ${HP_ARCH}-hp-hpux${HPUX_REV} + exit ;; + ia64:HP-UX:*:*) + HPUX_REV=`echo ${UNAME_RELEASE}|sed -e 's/[^.]*.[0B]*//'` + echo ia64-hp-hpux${HPUX_REV} + exit ;; + 3050*:HI-UX:*:*) + eval $set_cc_for_build + sed 's/^ //' << EOF >$dummy.c + #include + int + main () + { + long cpu = sysconf (_SC_CPU_VERSION); + /* The order matters, because CPU_IS_HP_MC68K erroneously returns + true for CPU_PA_RISC1_0. CPU_IS_PA_RISC returns correct + results, however. */ + if (CPU_IS_PA_RISC (cpu)) + { + switch (cpu) + { + case CPU_PA_RISC1_0: puts ("hppa1.0-hitachi-hiuxwe2"); break; + case CPU_PA_RISC1_1: puts ("hppa1.1-hitachi-hiuxwe2"); break; + case CPU_PA_RISC2_0: puts ("hppa2.0-hitachi-hiuxwe2"); break; + default: puts ("hppa-hitachi-hiuxwe2"); break; + } + } + else if (CPU_IS_HP_MC68K (cpu)) + puts ("m68k-hitachi-hiuxwe2"); + else puts ("unknown-hitachi-hiuxwe2"); + exit (0); + } +EOF + $CC_FOR_BUILD -o $dummy $dummy.c && SYSTEM_NAME=`$dummy` && + { echo "$SYSTEM_NAME"; exit; } + echo unknown-hitachi-hiuxwe2 + exit ;; + 9000/7??:4.3bsd:*:* | 9000/8?[79]:4.3bsd:*:* ) + echo hppa1.1-hp-bsd + exit ;; + 9000/8??:4.3bsd:*:*) + echo hppa1.0-hp-bsd + exit ;; + *9??*:MPE/iX:*:* | *3000*:MPE/iX:*:*) + echo hppa1.0-hp-mpeix + exit ;; + hp7??:OSF1:*:* | hp8?[79]:OSF1:*:* ) + echo hppa1.1-hp-osf + exit ;; + hp8??:OSF1:*:*) + echo hppa1.0-hp-osf + exit ;; + i*86:OSF1:*:*) + if [ -x /usr/sbin/sysversion ] ; then + echo ${UNAME_MACHINE}-unknown-osf1mk + else + echo ${UNAME_MACHINE}-unknown-osf1 + fi + exit ;; + parisc*:Lites*:*:*) + echo hppa1.1-hp-lites + exit ;; + C1*:ConvexOS:*:* | convex:ConvexOS:C1*:*) + echo c1-convex-bsd + exit ;; + C2*:ConvexOS:*:* | convex:ConvexOS:C2*:*) + if getsysinfo -f scalar_acc + then echo c32-convex-bsd + else echo c2-convex-bsd + fi + exit ;; + C34*:ConvexOS:*:* | convex:ConvexOS:C34*:*) + echo c34-convex-bsd + exit ;; + C38*:ConvexOS:*:* | convex:ConvexOS:C38*:*) + echo c38-convex-bsd + exit ;; + C4*:ConvexOS:*:* | convex:ConvexOS:C4*:*) + echo c4-convex-bsd + exit ;; + CRAY*Y-MP:*:*:*) + echo ymp-cray-unicos${UNAME_RELEASE} | sed -e 's/\.[^.]*$/.X/' + exit ;; + CRAY*[A-Z]90:*:*:*) + echo ${UNAME_MACHINE}-cray-unicos${UNAME_RELEASE} \ + | sed -e 's/CRAY.*\([A-Z]90\)/\1/' \ + -e y/ABCDEFGHIJKLMNOPQRSTUVWXYZ/abcdefghijklmnopqrstuvwxyz/ \ + -e 's/\.[^.]*$/.X/' + exit ;; + CRAY*TS:*:*:*) + echo t90-cray-unicos${UNAME_RELEASE} | sed -e 's/\.[^.]*$/.X/' + exit ;; + CRAY*T3E:*:*:*) + echo alphaev5-cray-unicosmk${UNAME_RELEASE} | sed -e 's/\.[^.]*$/.X/' + exit ;; + CRAY*SV1:*:*:*) + echo sv1-cray-unicos${UNAME_RELEASE} | sed -e 's/\.[^.]*$/.X/' + exit ;; + *:UNICOS/mp:*:*) + echo craynv-cray-unicosmp${UNAME_RELEASE} | sed -e 's/\.[^.]*$/.X/' + exit ;; + F30[01]:UNIX_System_V:*:* | F700:UNIX_System_V:*:*) + FUJITSU_PROC=`uname -m | tr 'ABCDEFGHIJKLMNOPQRSTUVWXYZ' 'abcdefghijklmnopqrstuvwxyz'` + FUJITSU_SYS=`uname -p | tr 'ABCDEFGHIJKLMNOPQRSTUVWXYZ' 'abcdefghijklmnopqrstuvwxyz' | sed -e 's/\///'` + FUJITSU_REL=`echo ${UNAME_RELEASE} | sed -e 's/ /_/'` + echo "${FUJITSU_PROC}-fujitsu-${FUJITSU_SYS}${FUJITSU_REL}" + exit ;; + 5000:UNIX_System_V:4.*:*) + FUJITSU_SYS=`uname -p | tr 'ABCDEFGHIJKLMNOPQRSTUVWXYZ' 'abcdefghijklmnopqrstuvwxyz' | sed -e 's/\///'` + FUJITSU_REL=`echo ${UNAME_RELEASE} | tr 'ABCDEFGHIJKLMNOPQRSTUVWXYZ' 'abcdefghijklmnopqrstuvwxyz' | sed -e 's/ /_/'` + echo "sparc-fujitsu-${FUJITSU_SYS}${FUJITSU_REL}" + exit ;; + i*86:BSD/386:*:* | i*86:BSD/OS:*:* | *:Ascend\ Embedded/OS:*:*) + echo ${UNAME_MACHINE}-pc-bsdi${UNAME_RELEASE} + exit ;; + sparc*:BSD/OS:*:*) + echo sparc-unknown-bsdi${UNAME_RELEASE} + exit ;; + *:BSD/OS:*:*) + echo ${UNAME_MACHINE}-unknown-bsdi${UNAME_RELEASE} + exit ;; + *:FreeBSD:*:*) + echo ${UNAME_MACHINE}-unknown-freebsd`echo ${UNAME_RELEASE}|sed -e 's/[-(].*//'` + exit ;; + i*:CYGWIN*:*) + echo ${UNAME_MACHINE}-pc-cygwin + exit ;; + i*:MINGW*:*) + echo ${UNAME_MACHINE}-pc-mingw32 + exit ;; + i*:windows32*:*) + # uname -m includes "-pc" on this system. + echo ${UNAME_MACHINE}-mingw32 + exit ;; + i*:PW*:*) + echo ${UNAME_MACHINE}-pc-pw32 + exit ;; + x86:Interix*:[345]*) + echo i586-pc-interix${UNAME_RELEASE}|sed -e 's/\..*//' + exit ;; + [345]86:Windows_95:* | [345]86:Windows_98:* | [345]86:Windows_NT:*) + echo i${UNAME_MACHINE}-pc-mks + exit ;; + i*:Windows_NT*:* | Pentium*:Windows_NT*:*) + # How do we know it's Interix rather than the generic POSIX subsystem? + # It also conflicts with pre-2.0 versions of AT&T UWIN. Should we + # UNAME_MACHINE based on the output of uname instead of i386? + echo i586-pc-interix + exit ;; + i*:UWIN*:*) + echo ${UNAME_MACHINE}-pc-uwin + exit ;; + amd64:CYGWIN*:*:* | x86_64:CYGWIN*:*:*) + echo x86_64-unknown-cygwin + exit ;; + p*:CYGWIN*:*) + echo powerpcle-unknown-cygwin + exit ;; + prep*:SunOS:5.*:*) + echo powerpcle-unknown-solaris2`echo ${UNAME_RELEASE}|sed -e 's/[^.]*//'` + exit ;; + *:GNU:*:*) + # the GNU system + echo `echo ${UNAME_MACHINE}|sed -e 's,[-/].*$,,'`-unknown-gnu`echo ${UNAME_RELEASE}|sed -e 's,/.*$,,'` + exit ;; + *:GNU/*:*:*) + # other systems with GNU libc and userland + echo ${UNAME_MACHINE}-unknown-`echo ${UNAME_SYSTEM} | sed 's,^[^/]*/,,' | tr '[A-Z]' '[a-z]'``echo ${UNAME_RELEASE}|sed -e 's/[-(].*//'`-gnu + exit ;; + i*86:Minix:*:*) + echo ${UNAME_MACHINE}-pc-minix + exit ;; + arm*:Linux:*:*) + echo ${UNAME_MACHINE}-unknown-linux-gnu + exit ;; + cris:Linux:*:*) + echo cris-axis-linux-gnu + exit ;; + crisv32:Linux:*:*) + echo crisv32-axis-linux-gnu + exit ;; + frv:Linux:*:*) + echo frv-unknown-linux-gnu + exit ;; + ia64:Linux:*:*) + echo ${UNAME_MACHINE}-unknown-linux-gnu + exit ;; + m32r*:Linux:*:*) + echo ${UNAME_MACHINE}-unknown-linux-gnu + exit ;; + m68*:Linux:*:*) + echo ${UNAME_MACHINE}-unknown-linux-gnu + exit ;; + mips:Linux:*:*) + eval $set_cc_for_build + sed 's/^ //' << EOF >$dummy.c + #undef CPU + #undef mips + #undef mipsel + #if defined(__MIPSEL__) || defined(__MIPSEL) || defined(_MIPSEL) || defined(MIPSEL) + CPU=mipsel + #else + #if defined(__MIPSEB__) || defined(__MIPSEB) || defined(_MIPSEB) || defined(MIPSEB) + CPU=mips + #else + CPU= + #endif + #endif +EOF + eval "`$CC_FOR_BUILD -E $dummy.c 2>/dev/null | sed -n '/^CPU/{s: ::g;p;}'`" + test x"${CPU}" != x && { echo "${CPU}-unknown-linux-gnu"; exit; } + ;; + mips64:Linux:*:*) + eval $set_cc_for_build + sed 's/^ //' << EOF >$dummy.c + #undef CPU + #undef mips64 + #undef mips64el + #if defined(__MIPSEL__) || defined(__MIPSEL) || defined(_MIPSEL) || defined(MIPSEL) + CPU=mips64el + #else + #if defined(__MIPSEB__) || defined(__MIPSEB) || defined(_MIPSEB) || defined(MIPSEB) + CPU=mips64 + #else + CPU= + #endif + #endif +EOF + eval "`$CC_FOR_BUILD -E $dummy.c 2>/dev/null | sed -n '/^CPU/{s: ::g;p;}'`" + test x"${CPU}" != x && { echo "${CPU}-unknown-linux-gnu"; exit; } + ;; + or32:Linux:*:*) + echo or32-unknown-linux-gnu + exit ;; + ppc:Linux:*:*) + echo powerpc-unknown-linux-gnu + exit ;; + ppc64:Linux:*:*) + echo powerpc64-unknown-linux-gnu + exit ;; + alpha:Linux:*:*) + case `sed -n '/^cpu model/s/^.*: \(.*\)/\1/p' < /proc/cpuinfo` in + EV5) UNAME_MACHINE=alphaev5 ;; + EV56) UNAME_MACHINE=alphaev56 ;; + PCA56) UNAME_MACHINE=alphapca56 ;; + PCA57) UNAME_MACHINE=alphapca56 ;; + EV6) UNAME_MACHINE=alphaev6 ;; + EV67) UNAME_MACHINE=alphaev67 ;; + EV68*) UNAME_MACHINE=alphaev68 ;; + esac + objdump --private-headers /bin/sh | grep ld.so.1 >/dev/null + if test "$?" = 0 ; then LIBC="libc1" ; else LIBC="" ; fi + echo ${UNAME_MACHINE}-unknown-linux-gnu${LIBC} + exit ;; + parisc:Linux:*:* | hppa:Linux:*:*) + # Look for CPU level + case `grep '^cpu[^a-z]*:' /proc/cpuinfo 2>/dev/null | cut -d' ' -f2` in + PA7*) echo hppa1.1-unknown-linux-gnu ;; + PA8*) echo hppa2.0-unknown-linux-gnu ;; + *) echo hppa-unknown-linux-gnu ;; + esac + exit ;; + parisc64:Linux:*:* | hppa64:Linux:*:*) + echo hppa64-unknown-linux-gnu + exit ;; + s390:Linux:*:* | s390x:Linux:*:*) + echo ${UNAME_MACHINE}-ibm-linux + exit ;; + sh64*:Linux:*:*) + echo ${UNAME_MACHINE}-unknown-linux-gnu + exit ;; + sh*:Linux:*:*) + echo ${UNAME_MACHINE}-unknown-linux-gnu + exit ;; + sparc:Linux:*:* | sparc64:Linux:*:*) + echo ${UNAME_MACHINE}-unknown-linux-gnu + exit ;; + vax:Linux:*:*) + echo ${UNAME_MACHINE}-dec-linux-gnu + exit ;; + x86_64:Linux:*:*) + echo x86_64-unknown-linux-gnu + exit ;; + i*86:Linux:*:*) + # The BFD linker knows what the default object file format is, so + # first see if it will tell us. cd to the root directory to prevent + # problems with other programs or directories called `ld' in the path. + # Set LC_ALL=C to ensure ld outputs messages in English. + ld_supported_targets=`cd /; LC_ALL=C ld --help 2>&1 \ + | sed -ne '/supported targets:/!d + s/[ ][ ]*/ /g + s/.*supported targets: *// + s/ .*// + p'` + case "$ld_supported_targets" in + elf32-i386) + TENTATIVE="${UNAME_MACHINE}-pc-linux-gnu" + ;; + a.out-i386-linux) + echo "${UNAME_MACHINE}-pc-linux-gnuaout" + exit ;; + coff-i386) + echo "${UNAME_MACHINE}-pc-linux-gnucoff" + exit ;; + "") + # Either a pre-BFD a.out linker (linux-gnuoldld) or + # one that does not give us useful --help. + echo "${UNAME_MACHINE}-pc-linux-gnuoldld" + exit ;; + esac + # Determine whether the default compiler is a.out or elf + eval $set_cc_for_build + sed 's/^ //' << EOF >$dummy.c + #include + #ifdef __ELF__ + # ifdef __GLIBC__ + # if __GLIBC__ >= 2 + LIBC=gnu + # else + LIBC=gnulibc1 + # endif + # else + LIBC=gnulibc1 + # endif + #else + #if defined(__INTEL_COMPILER) || defined(__PGI) + LIBC=gnu + #else + LIBC=gnuaout + #endif + #endif + #ifdef __dietlibc__ + LIBC=dietlibc + #endif +EOF + eval "`$CC_FOR_BUILD -E $dummy.c 2>/dev/null | sed -n '/^LIBC/{s: ::g;p;}'`" + test x"${LIBC}" != x && { + echo "${UNAME_MACHINE}-pc-linux-${LIBC}" + exit + } + test x"${TENTATIVE}" != x && { echo "${TENTATIVE}"; exit; } + ;; + i*86:DYNIX/ptx:4*:*) + # ptx 4.0 does uname -s correctly, with DYNIX/ptx in there. + # earlier versions are messed up and put the nodename in both + # sysname and nodename. + echo i386-sequent-sysv4 + exit ;; + i*86:UNIX_SV:4.2MP:2.*) + # Unixware is an offshoot of SVR4, but it has its own version + # number series starting with 2... + # I am not positive that other SVR4 systems won't match this, + # I just have to hope. -- rms. + # Use sysv4.2uw... so that sysv4* matches it. + echo ${UNAME_MACHINE}-pc-sysv4.2uw${UNAME_VERSION} + exit ;; + i*86:OS/2:*:*) + # If we were able to find `uname', then EMX Unix compatibility + # is probably installed. + echo ${UNAME_MACHINE}-pc-os2-emx + exit ;; + i*86:XTS-300:*:STOP) + echo ${UNAME_MACHINE}-unknown-stop + exit ;; + i*86:atheos:*:*) + echo ${UNAME_MACHINE}-unknown-atheos + exit ;; + i*86:syllable:*:*) + echo ${UNAME_MACHINE}-pc-syllable + exit ;; + i*86:LynxOS:2.*:* | i*86:LynxOS:3.[01]*:* | i*86:LynxOS:4.0*:*) + echo i386-unknown-lynxos${UNAME_RELEASE} + exit ;; + i*86:*DOS:*:*) + echo ${UNAME_MACHINE}-pc-msdosdjgpp + exit ;; + i*86:*:4.*:* | i*86:SYSTEM_V:4.*:*) + UNAME_REL=`echo ${UNAME_RELEASE} | sed 's/\/MP$//'` + if grep Novell /usr/include/link.h >/dev/null 2>/dev/null; then + echo ${UNAME_MACHINE}-univel-sysv${UNAME_REL} + else + echo ${UNAME_MACHINE}-pc-sysv${UNAME_REL} + fi + exit ;; + i*86:*:5:[678]*) + # UnixWare 7.x, OpenUNIX and OpenServer 6. + case `/bin/uname -X | grep "^Machine"` in + *486*) UNAME_MACHINE=i486 ;; + *Pentium) UNAME_MACHINE=i586 ;; + *Pent*|*Celeron) UNAME_MACHINE=i686 ;; + esac + echo ${UNAME_MACHINE}-unknown-sysv${UNAME_RELEASE}${UNAME_SYSTEM}${UNAME_VERSION} + exit ;; + i*86:*:3.2:*) + if test -f /usr/options/cb.name; then + UNAME_REL=`sed -n 's/.*Version //p' /dev/null >/dev/null ; then + UNAME_REL=`(/bin/uname -X|grep Release|sed -e 's/.*= //')` + (/bin/uname -X|grep i80486 >/dev/null) && UNAME_MACHINE=i486 + (/bin/uname -X|grep '^Machine.*Pentium' >/dev/null) \ + && UNAME_MACHINE=i586 + (/bin/uname -X|grep '^Machine.*Pent *II' >/dev/null) \ + && UNAME_MACHINE=i686 + (/bin/uname -X|grep '^Machine.*Pentium Pro' >/dev/null) \ + && UNAME_MACHINE=i686 + echo ${UNAME_MACHINE}-pc-sco$UNAME_REL + else + echo ${UNAME_MACHINE}-pc-sysv32 + fi + exit ;; + pc:*:*:*) + # Left here for compatibility: + # uname -m prints for DJGPP always 'pc', but it prints nothing about + # the processor, so we play safe by assuming i386. + echo i386-pc-msdosdjgpp + exit ;; + Intel:Mach:3*:*) + echo i386-pc-mach3 + exit ;; + paragon:*:*:*) + echo i860-intel-osf1 + exit ;; + i860:*:4.*:*) # i860-SVR4 + if grep Stardent /usr/include/sys/uadmin.h >/dev/null 2>&1 ; then + echo i860-stardent-sysv${UNAME_RELEASE} # Stardent Vistra i860-SVR4 + else # Add other i860-SVR4 vendors below as they are discovered. + echo i860-unknown-sysv${UNAME_RELEASE} # Unknown i860-SVR4 + fi + exit ;; + mini*:CTIX:SYS*5:*) + # "miniframe" + echo m68010-convergent-sysv + exit ;; + mc68k:UNIX:SYSTEM5:3.51m) + echo m68k-convergent-sysv + exit ;; + M680?0:D-NIX:5.3:*) + echo m68k-diab-dnix + exit ;; + M68*:*:R3V[5678]*:*) + test -r /sysV68 && { echo 'm68k-motorola-sysv'; exit; } ;; + 3[345]??:*:4.0:3.0 | 3[34]??A:*:4.0:3.0 | 3[34]??,*:*:4.0:3.0 | 3[34]??/*:*:4.0:3.0 | 4400:*:4.0:3.0 | 4850:*:4.0:3.0 | SKA40:*:4.0:3.0 | SDS2:*:4.0:3.0 | SHG2:*:4.0:3.0 | S7501*:*:4.0:3.0) + OS_REL='' + test -r /etc/.relid \ + && OS_REL=.`sed -n 's/[^ ]* [^ ]* \([0-9][0-9]\).*/\1/p' < /etc/.relid` + /bin/uname -p 2>/dev/null | grep 86 >/dev/null \ + && { echo i486-ncr-sysv4.3${OS_REL}; exit; } + /bin/uname -p 2>/dev/null | /bin/grep entium >/dev/null \ + && { echo i586-ncr-sysv4.3${OS_REL}; exit; } ;; + 3[34]??:*:4.0:* | 3[34]??,*:*:4.0:*) + /bin/uname -p 2>/dev/null | grep 86 >/dev/null \ + && { echo i486-ncr-sysv4; exit; } ;; + m68*:LynxOS:2.*:* | m68*:LynxOS:3.0*:*) + echo m68k-unknown-lynxos${UNAME_RELEASE} + exit ;; + mc68030:UNIX_System_V:4.*:*) + echo m68k-atari-sysv4 + exit ;; + TSUNAMI:LynxOS:2.*:*) + echo sparc-unknown-lynxos${UNAME_RELEASE} + exit ;; + rs6000:LynxOS:2.*:*) + echo rs6000-unknown-lynxos${UNAME_RELEASE} + exit ;; + PowerPC:LynxOS:2.*:* | PowerPC:LynxOS:3.[01]*:* | PowerPC:LynxOS:4.0*:*) + echo powerpc-unknown-lynxos${UNAME_RELEASE} + exit ;; + SM[BE]S:UNIX_SV:*:*) + echo mips-dde-sysv${UNAME_RELEASE} + exit ;; + RM*:ReliantUNIX-*:*:*) + echo mips-sni-sysv4 + exit ;; + RM*:SINIX-*:*:*) + echo mips-sni-sysv4 + exit ;; + *:SINIX-*:*:*) + if uname -p 2>/dev/null >/dev/null ; then + UNAME_MACHINE=`(uname -p) 2>/dev/null` + echo ${UNAME_MACHINE}-sni-sysv4 + else + echo ns32k-sni-sysv + fi + exit ;; + PENTIUM:*:4.0*:*) # Unisys `ClearPath HMP IX 4000' SVR4/MP effort + # says + echo i586-unisys-sysv4 + exit ;; + *:UNIX_System_V:4*:FTX*) + # From Gerald Hewes . + # How about differentiating between stratus architectures? -djm + echo hppa1.1-stratus-sysv4 + exit ;; + *:*:*:FTX*) + # From seanf@swdc.stratus.com. + echo i860-stratus-sysv4 + exit ;; + i*86:VOS:*:*) + # From Paul.Green@stratus.com. + echo ${UNAME_MACHINE}-stratus-vos + exit ;; + *:VOS:*:*) + # From Paul.Green@stratus.com. + echo hppa1.1-stratus-vos + exit ;; + mc68*:A/UX:*:*) + echo m68k-apple-aux${UNAME_RELEASE} + exit ;; + news*:NEWS-OS:6*:*) + echo mips-sony-newsos6 + exit ;; + R[34]000:*System_V*:*:* | R4000:UNIX_SYSV:*:* | R*000:UNIX_SV:*:*) + if [ -d /usr/nec ]; then + echo mips-nec-sysv${UNAME_RELEASE} + else + echo mips-unknown-sysv${UNAME_RELEASE} + fi + exit ;; + BeBox:BeOS:*:*) # BeOS running on hardware made by Be, PPC only. + echo powerpc-be-beos + exit ;; + BeMac:BeOS:*:*) # BeOS running on Mac or Mac clone, PPC only. + echo powerpc-apple-beos + exit ;; + BePC:BeOS:*:*) # BeOS running on Intel PC compatible. + echo i586-pc-beos + exit ;; + SX-4:SUPER-UX:*:*) + echo sx4-nec-superux${UNAME_RELEASE} + exit ;; + SX-5:SUPER-UX:*:*) + echo sx5-nec-superux${UNAME_RELEASE} + exit ;; + SX-6:SUPER-UX:*:*) + echo sx6-nec-superux${UNAME_RELEASE} + exit ;; + Power*:Rhapsody:*:*) + echo powerpc-apple-rhapsody${UNAME_RELEASE} + exit ;; + *:Rhapsody:*:*) + echo ${UNAME_MACHINE}-apple-rhapsody${UNAME_RELEASE} + exit ;; + *:Darwin:*:*) + UNAME_PROCESSOR=`uname -p` || UNAME_PROCESSOR=unknown + case $UNAME_PROCESSOR in + unknown) UNAME_PROCESSOR=powerpc ;; + esac + echo ${UNAME_PROCESSOR}-apple-darwin${UNAME_RELEASE} + exit ;; + *:procnto*:*:* | *:QNX:[0123456789]*:*) + UNAME_PROCESSOR=`uname -p` + if test "$UNAME_PROCESSOR" = "x86"; then + UNAME_PROCESSOR=i386 + UNAME_MACHINE=pc + fi + echo ${UNAME_PROCESSOR}-${UNAME_MACHINE}-nto-qnx${UNAME_RELEASE} + exit ;; + *:QNX:*:4*) + echo i386-pc-qnx + exit ;; + NSE-?:NONSTOP_KERNEL:*:*) + echo nse-tandem-nsk${UNAME_RELEASE} + exit ;; + NSR-?:NONSTOP_KERNEL:*:*) + echo nsr-tandem-nsk${UNAME_RELEASE} + exit ;; + *:NonStop-UX:*:*) + echo mips-compaq-nonstopux + exit ;; + BS2000:POSIX*:*:*) + echo bs2000-siemens-sysv + exit ;; + DS/*:UNIX_System_V:*:*) + echo ${UNAME_MACHINE}-${UNAME_SYSTEM}-${UNAME_RELEASE} + exit ;; + *:Plan9:*:*) + # "uname -m" is not consistent, so use $cputype instead. 386 + # is converted to i386 for consistency with other x86 + # operating systems. + if test "$cputype" = "386"; then + UNAME_MACHINE=i386 + else + UNAME_MACHINE="$cputype" + fi + echo ${UNAME_MACHINE}-unknown-plan9 + exit ;; + *:TOPS-10:*:*) + echo pdp10-unknown-tops10 + exit ;; + *:TENEX:*:*) + echo pdp10-unknown-tenex + exit ;; + KS10:TOPS-20:*:* | KL10:TOPS-20:*:* | TYPE4:TOPS-20:*:*) + echo pdp10-dec-tops20 + exit ;; + XKL-1:TOPS-20:*:* | TYPE5:TOPS-20:*:*) + echo pdp10-xkl-tops20 + exit ;; + *:TOPS-20:*:*) + echo pdp10-unknown-tops20 + exit ;; + *:ITS:*:*) + echo pdp10-unknown-its + exit ;; + SEI:*:*:SEIUX) + echo mips-sei-seiux${UNAME_RELEASE} + exit ;; + *:DragonFly:*:*) + echo ${UNAME_MACHINE}-unknown-dragonfly`echo ${UNAME_RELEASE}|sed -e 's/[-(].*//'` + exit ;; + *:*VMS:*:*) + UNAME_MACHINE=`(uname -p) 2>/dev/null` + case "${UNAME_MACHINE}" in + A*) echo alpha-dec-vms ; exit ;; + I*) echo ia64-dec-vms ; exit ;; + V*) echo vax-dec-vms ; exit ;; + esac ;; + *:XENIX:*:SysV) + echo i386-pc-xenix + exit ;; + i*86:skyos:*:*) + echo ${UNAME_MACHINE}-pc-skyos`echo ${UNAME_RELEASE}` | sed -e 's/ .*$//' + exit ;; + i*86:rdos:*:*) + echo ${UNAME_MACHINE}-pc-rdos + exit ;; +esac + +#echo '(No uname command or uname output not recognized.)' 1>&2 +#echo "${UNAME_MACHINE}:${UNAME_SYSTEM}:${UNAME_RELEASE}:${UNAME_VERSION}" 1>&2 + +eval $set_cc_for_build +cat >$dummy.c < +# include +#endif +main () +{ +#if defined (sony) +#if defined (MIPSEB) + /* BFD wants "bsd" instead of "newsos". Perhaps BFD should be changed, + I don't know.... */ + printf ("mips-sony-bsd\n"); exit (0); +#else +#include + printf ("m68k-sony-newsos%s\n", +#ifdef NEWSOS4 + "4" +#else + "" +#endif + ); exit (0); +#endif +#endif + +#if defined (__arm) && defined (__acorn) && defined (__unix) + printf ("arm-acorn-riscix\n"); exit (0); +#endif + +#if defined (hp300) && !defined (hpux) + printf ("m68k-hp-bsd\n"); exit (0); +#endif + +#if defined (NeXT) +#if !defined (__ARCHITECTURE__) +#define __ARCHITECTURE__ "m68k" +#endif + int version; + version=`(hostinfo | sed -n 's/.*NeXT Mach \([0-9]*\).*/\1/p') 2>/dev/null`; + if (version < 4) + printf ("%s-next-nextstep%d\n", __ARCHITECTURE__, version); + else + printf ("%s-next-openstep%d\n", __ARCHITECTURE__, version); + exit (0); +#endif + +#if defined (MULTIMAX) || defined (n16) +#if defined (UMAXV) + printf ("ns32k-encore-sysv\n"); exit (0); +#else +#if defined (CMU) + printf ("ns32k-encore-mach\n"); exit (0); +#else + printf ("ns32k-encore-bsd\n"); exit (0); +#endif +#endif +#endif + +#if defined (__386BSD__) + printf ("i386-pc-bsd\n"); exit (0); +#endif + +#if defined (sequent) +#if defined (i386) + printf ("i386-sequent-dynix\n"); exit (0); +#endif +#if defined (ns32000) + printf ("ns32k-sequent-dynix\n"); exit (0); +#endif +#endif + +#if defined (_SEQUENT_) + struct utsname un; + + uname(&un); + + if (strncmp(un.version, "V2", 2) == 0) { + printf ("i386-sequent-ptx2\n"); exit (0); + } + if (strncmp(un.version, "V1", 2) == 0) { /* XXX is V1 correct? */ + printf ("i386-sequent-ptx1\n"); exit (0); + } + printf ("i386-sequent-ptx\n"); exit (0); + +#endif + +#if defined (vax) +# if !defined (ultrix) +# include +# if defined (BSD) +# if BSD == 43 + printf ("vax-dec-bsd4.3\n"); exit (0); +# else +# if BSD == 199006 + printf ("vax-dec-bsd4.3reno\n"); exit (0); +# else + printf ("vax-dec-bsd\n"); exit (0); +# endif +# endif +# else + printf ("vax-dec-bsd\n"); exit (0); +# endif +# else + printf ("vax-dec-ultrix\n"); exit (0); +# endif +#endif + +#if defined (alliant) && defined (i860) + printf ("i860-alliant-bsd\n"); exit (0); +#endif + + exit (1); +} +EOF + +$CC_FOR_BUILD -o $dummy $dummy.c 2>/dev/null && SYSTEM_NAME=`$dummy` && + { echo "$SYSTEM_NAME"; exit; } + +# Apollos put the system type in the environment. + +test -d /usr/apollo && { echo ${ISP}-apollo-${SYSTYPE}; exit; } + +# Convex versions that predate uname can use getsysinfo(1) + +if [ -x /usr/convex/getsysinfo ] +then + case `getsysinfo -f cpu_type` in + c1*) + echo c1-convex-bsd + exit ;; + c2*) + if getsysinfo -f scalar_acc + then echo c32-convex-bsd + else echo c2-convex-bsd + fi + exit ;; + c34*) + echo c34-convex-bsd + exit ;; + c38*) + echo c38-convex-bsd + exit ;; + c4*) + echo c4-convex-bsd + exit ;; + esac +fi + +cat >&2 < in order to provide the needed +information to handle your system. + +config.guess timestamp = $timestamp + +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` +/bin/uname -X = `(/bin/uname -X) 2>/dev/null` + +hostinfo = `(hostinfo) 2>/dev/null` +/bin/universe = `(/bin/universe) 2>/dev/null` +/usr/bin/arch -k = `(/usr/bin/arch -k) 2>/dev/null` +/bin/arch = `(/bin/arch) 2>/dev/null` +/usr/bin/oslevel = `(/usr/bin/oslevel) 2>/dev/null` +/usr/convex/getsysinfo = `(/usr/convex/getsysinfo) 2>/dev/null` + +UNAME_MACHINE = ${UNAME_MACHINE} +UNAME_RELEASE = ${UNAME_RELEASE} +UNAME_SYSTEM = ${UNAME_SYSTEM} +UNAME_VERSION = ${UNAME_VERSION} +EOF + +exit 1 + +# Local variables: +# eval: (add-hook 'write-file-hooks 'time-stamp) +# time-stamp-start: "timestamp='" +# time-stamp-format: "%:y-%02m-%02d" +# time-stamp-end: "'" +# End: diff --git a/build-aux/config.sub b/build-aux/config.sub new file mode 100755 index 0000000..2851647 --- /dev/null +++ b/build-aux/config.sub @@ -0,0 +1,1599 @@ +#! /bin/sh +# Configuration validation subroutine script. +# Copyright (C) 1992, 1993, 1994, 1995, 1996, 1997, 1998, 1999, +# 2000, 2001, 2002, 2003, 2004, 2005 Free Software Foundation, Inc. + +timestamp='2005-12-11' + +# This file is (in principle) common to ALL GNU software. +# The presence of a machine in this file suggests that SOME GNU software +# can handle that machine. It does not imply ALL GNU software can. +# +# This file is free software; you can redistribute it and/or modify +# it under the terms of the GNU General Public License as published by +# the Free Software Foundation; either version 2 of the License, or +# (at your option) any later version. +# +# This program is distributed in the hope that it will be useful, +# but WITHOUT ANY WARRANTY; without even the implied warranty of +# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +# GNU General Public License for more details. +# +# You should have received a copy of the GNU General Public License +# along with this program; if not, write to the Free Software +# Foundation, Inc., 51 Franklin Street - Fifth Floor, Boston, MA +# 02110-1301, USA. +# +# 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. + + +# Please send patches to . Submit a context +# diff and a properly formatted ChangeLog entry. +# +# Configuration subroutine to validate and canonicalize a configuration type. +# Supply the specified configuration type as an argument. +# If it is invalid, we print an error message on stderr and exit with code 1. +# Otherwise, we print the canonical config type on stdout and succeed. + +# This file is supposed to be the same for all GNU packages +# and recognize all the CPU types, system types and aliases +# that are meaningful with *any* GNU software. +# Each package is responsible for reporting which valid configurations +# it does not support. The user should be able to distinguish +# a failure to support a valid configuration from a meaningless +# configuration. + +# The goal of this file is to map all the various variations of a given +# machine specification into a single specification in the form: +# CPU_TYPE-MANUFACTURER-OPERATING_SYSTEM +# or in some cases, the newer four-part form: +# CPU_TYPE-MANUFACTURER-KERNEL-OPERATING_SYSTEM +# It is wrong to echo any other type of specification. + +me=`echo "$0" | sed -e 's,.*/,,'` + +usage="\ +Usage: $0 [OPTION] CPU-MFR-OPSYS + $0 [OPTION] ALIAS + +Canonicalize a configuration name. + +Operation modes: + -h, --help print this help, then exit + -t, --time-stamp print date of last modification, then exit + -v, --version print version number, then exit + +Report bugs and patches to ." + +version="\ +GNU config.sub ($timestamp) + +Copyright (C) 1992, 1993, 1994, 1995, 1996, 1997, 1998, 1999, 2000, 2001, 2002, 2003, 2004, 2005 +Free Software Foundation, Inc. + +This is free software; see the source for copying conditions. There is NO +warranty; not even for MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE." + +help=" +Try \`$me --help' for more information." + +# Parse command line +while test $# -gt 0 ; do + case $1 in + --time-stamp | --time* | -t ) + echo "$timestamp" ; exit ;; + --version | -v ) + echo "$version" ; exit ;; + --help | --h* | -h ) + echo "$usage"; exit ;; + -- ) # Stop option processing + shift; break ;; + - ) # Use stdin as input. + break ;; + -* ) + echo "$me: invalid option $1$help" + exit 1 ;; + + *local*) + # First pass through any local machine types. + echo $1 + exit ;; + + * ) + break ;; + esac +done + +case $# in + 0) echo "$me: missing argument$help" >&2 + exit 1;; + 1) ;; + *) echo "$me: too many arguments$help" >&2 + exit 1;; +esac + +# Separate what the user gave into CPU-COMPANY and OS or KERNEL-OS (if any). +# Here we must recognize all the valid KERNEL-OS combinations. +maybe_os=`echo $1 | sed 's/^\(.*\)-\([^-]*-[^-]*\)$/\2/'` +case $maybe_os in + nto-qnx* | linux-gnu* | linux-dietlibc | linux-newlib* | linux-uclibc* | \ + uclinux-uclibc* | uclinux-gnu* | kfreebsd*-gnu* | knetbsd*-gnu* | netbsd*-gnu* | \ + storm-chaos* | os2-emx* | rtmk-nova*) + os=-$maybe_os + basic_machine=`echo $1 | sed 's/^\(.*\)-\([^-]*-[^-]*\)$/\1/'` + ;; + *) + basic_machine=`echo $1 | sed 's/-[^-]*$//'` + if [ $basic_machine != $1 ] + then os=`echo $1 | sed 's/.*-/-/'` + else os=; fi + ;; +esac + +### Let's recognize common machines as not being operating systems so +### that things like config.sub decstation-3100 work. We also +### recognize some manufacturers as not being operating systems, so we +### can provide default operating systems below. +case $os in + -sun*os*) + # Prevent following clause from handling this invalid input. + ;; + -dec* | -mips* | -sequent* | -encore* | -pc532* | -sgi* | -sony* | \ + -att* | -7300* | -3300* | -delta* | -motorola* | -sun[234]* | \ + -unicom* | -ibm* | -next | -hp | -isi* | -apollo | -altos* | \ + -convergent* | -ncr* | -news | -32* | -3600* | -3100* | -hitachi* |\ + -c[123]* | -convex* | -sun | -crds | -omron* | -dg | -ultra | -tti* | \ + -harris | -dolphin | -highlevel | -gould | -cbm | -ns | -masscomp | \ + -apple | -axis | -knuth | -cray) + os= + basic_machine=$1 + ;; + -sim | -cisco | -oki | -wec | -winbond) + os= + basic_machine=$1 + ;; + -scout) + ;; + -wrs) + os=-vxworks + basic_machine=$1 + ;; + -chorusos*) + os=-chorusos + basic_machine=$1 + ;; + -chorusrdb) + os=-chorusrdb + basic_machine=$1 + ;; + -hiux*) + os=-hiuxwe2 + ;; + -sco6) + os=-sco5v6 + basic_machine=`echo $1 | sed -e 's/86-.*/86-pc/'` + ;; + -sco5) + os=-sco3.2v5 + basic_machine=`echo $1 | sed -e 's/86-.*/86-pc/'` + ;; + -sco4) + os=-sco3.2v4 + basic_machine=`echo $1 | sed -e 's/86-.*/86-pc/'` + ;; + -sco3.2.[4-9]*) + os=`echo $os | sed -e 's/sco3.2./sco3.2v/'` + basic_machine=`echo $1 | sed -e 's/86-.*/86-pc/'` + ;; + -sco3.2v[4-9]*) + # Don't forget version if it is 3.2v4 or newer. + basic_machine=`echo $1 | sed -e 's/86-.*/86-pc/'` + ;; + -sco5v6*) + # Don't forget version if it is 3.2v4 or newer. + basic_machine=`echo $1 | sed -e 's/86-.*/86-pc/'` + ;; + -sco*) + os=-sco3.2v2 + basic_machine=`echo $1 | sed -e 's/86-.*/86-pc/'` + ;; + -udk*) + basic_machine=`echo $1 | sed -e 's/86-.*/86-pc/'` + ;; + -isc) + os=-isc2.2 + basic_machine=`echo $1 | sed -e 's/86-.*/86-pc/'` + ;; + -clix*) + basic_machine=clipper-intergraph + ;; + -isc*) + basic_machine=`echo $1 | sed -e 's/86-.*/86-pc/'` + ;; + -lynx*) + os=-lynxos + ;; + -ptx*) + basic_machine=`echo $1 | sed -e 's/86-.*/86-sequent/'` + ;; + -windowsnt*) + os=`echo $os | sed -e 's/windowsnt/winnt/'` + ;; + -psos*) + os=-psos + ;; + -mint | -mint[0-9]*) + basic_machine=m68k-atari + os=-mint + ;; +esac + +# Decode aliases for certain CPU-COMPANY combinations. +case $basic_machine in + # Recognize the basic CPU types without company name. + # Some are omitted here because they have special meanings below. + 1750a | 580 \ + | a29k \ + | alpha | alphaev[4-8] | alphaev56 | alphaev6[78] | alphapca5[67] \ + | alpha64 | alpha64ev[4-8] | alpha64ev56 | alpha64ev6[78] | alpha64pca5[67] \ + | am33_2.0 \ + | arc | arm | arm[bl]e | arme[lb] | armv[2345] | armv[345][lb] | avr \ + | bfin \ + | c4x | clipper \ + | d10v | d30v | dlx | dsp16xx \ + | fr30 | frv \ + | h8300 | h8500 | hppa | hppa1.[01] | hppa2.0 | hppa2.0[nw] | hppa64 \ + | i370 | i860 | i960 | ia64 \ + | ip2k | iq2000 \ + | m32r | m32rle | m68000 | m68k | m88k | maxq | mcore \ + | mips | mipsbe | mipseb | mipsel | mipsle \ + | mips16 \ + | mips64 | mips64el \ + | mips64vr | mips64vrel \ + | mips64orion | mips64orionel \ + | mips64vr4100 | mips64vr4100el \ + | mips64vr4300 | mips64vr4300el \ + | mips64vr5000 | mips64vr5000el \ + | mips64vr5900 | mips64vr5900el \ + | mipsisa32 | mipsisa32el \ + | mipsisa32r2 | mipsisa32r2el \ + | mipsisa64 | mipsisa64el \ + | mipsisa64r2 | mipsisa64r2el \ + | mipsisa64sb1 | mipsisa64sb1el \ + | mipsisa64sr71k | mipsisa64sr71kel \ + | mipstx39 | mipstx39el \ + | mn10200 | mn10300 \ + | mt \ + | msp430 \ + | ns16k | ns32k \ + | or32 \ + | pdp10 | pdp11 | pj | pjl \ + | powerpc | powerpc64 | powerpc64le | powerpcle | ppcbe \ + | pyramid \ + | sh | sh[1234] | sh[24]a | sh[23]e | sh[34]eb | shbe | shle | sh[1234]le | sh3ele \ + | sh64 | sh64le \ + | sparc | sparc64 | sparc64b | sparc86x | sparclet | sparclite \ + | sparcv8 | sparcv9 | sparcv9b \ + | strongarm \ + | tahoe | thumb | tic4x | tic80 | tron \ + | v850 | v850e \ + | we32k \ + | x86 | xscale | xscalee[bl] | xstormy16 | xtensa \ + | z8k) + basic_machine=$basic_machine-unknown + ;; + m32c) + basic_machine=$basic_machine-unknown + ;; + m6811 | m68hc11 | m6812 | m68hc12) + # Motorola 68HC11/12. + basic_machine=$basic_machine-unknown + os=-none + ;; + m88110 | m680[12346]0 | m683?2 | m68360 | m5200 | v70 | w65 | z8k) + ;; + ms1) + basic_machine=mt-unknown + ;; + + # We use `pc' rather than `unknown' + # because (1) that's what they normally are, and + # (2) the word "unknown" tends to confuse beginning users. + i*86 | x86_64) + basic_machine=$basic_machine-pc + ;; + # Object if more than one company name word. + *-*-*) + echo Invalid configuration \`$1\': machine \`$basic_machine\' not recognized 1>&2 + exit 1 + ;; + # Recognize the basic CPU types with company name. + 580-* \ + | a29k-* \ + | alpha-* | alphaev[4-8]-* | alphaev56-* | alphaev6[78]-* \ + | alpha64-* | alpha64ev[4-8]-* | alpha64ev56-* | alpha64ev6[78]-* \ + | alphapca5[67]-* | alpha64pca5[67]-* | arc-* \ + | arm-* | armbe-* | armle-* | armeb-* | armv*-* \ + | avr-* \ + | bfin-* | bs2000-* \ + | c[123]* | c30-* | [cjt]90-* | c4x-* | c54x-* | c55x-* | c6x-* \ + | clipper-* | craynv-* | cydra-* \ + | d10v-* | d30v-* | dlx-* \ + | elxsi-* \ + | f30[01]-* | f700-* | fr30-* | frv-* | fx80-* \ + | h8300-* | h8500-* \ + | hppa-* | hppa1.[01]-* | hppa2.0-* | hppa2.0[nw]-* | hppa64-* \ + | i*86-* | i860-* | i960-* | ia64-* \ + | ip2k-* | iq2000-* \ + | m32r-* | m32rle-* \ + | m68000-* | m680[012346]0-* | m68360-* | m683?2-* | m68k-* \ + | m88110-* | m88k-* | maxq-* | mcore-* \ + | mips-* | mipsbe-* | mipseb-* | mipsel-* | mipsle-* \ + | mips16-* \ + | mips64-* | mips64el-* \ + | mips64vr-* | mips64vrel-* \ + | mips64orion-* | mips64orionel-* \ + | mips64vr4100-* | mips64vr4100el-* \ + | mips64vr4300-* | mips64vr4300el-* \ + | mips64vr5000-* | mips64vr5000el-* \ + | mips64vr5900-* | mips64vr5900el-* \ + | mipsisa32-* | mipsisa32el-* \ + | mipsisa32r2-* | mipsisa32r2el-* \ + | mipsisa64-* | mipsisa64el-* \ + | mipsisa64r2-* | mipsisa64r2el-* \ + | mipsisa64sb1-* | mipsisa64sb1el-* \ + | mipsisa64sr71k-* | mipsisa64sr71kel-* \ + | mipstx39-* | mipstx39el-* \ + | mmix-* \ + | mt-* \ + | msp430-* \ + | none-* | np1-* | ns16k-* | ns32k-* \ + | orion-* \ + | pdp10-* | pdp11-* | pj-* | pjl-* | pn-* | power-* \ + | powerpc-* | powerpc64-* | powerpc64le-* | powerpcle-* | ppcbe-* \ + | pyramid-* \ + | romp-* | rs6000-* \ + | sh-* | sh[1234]-* | sh[24]a-* | sh[23]e-* | sh[34]eb-* | shbe-* \ + | shle-* | sh[1234]le-* | sh3ele-* | sh64-* | sh64le-* \ + | sparc-* | sparc64-* | sparc64b-* | sparc86x-* | sparclet-* \ + | sparclite-* \ + | sparcv8-* | sparcv9-* | sparcv9b-* | strongarm-* | sv1-* | sx?-* \ + | tahoe-* | thumb-* \ + | tic30-* | tic4x-* | tic54x-* | tic55x-* | tic6x-* | tic80-* \ + | tron-* \ + | v850-* | v850e-* | vax-* \ + | we32k-* \ + | x86-* | x86_64-* | xps100-* | xscale-* | xscalee[bl]-* \ + | xstormy16-* | xtensa-* \ + | ymp-* \ + | z8k-*) + ;; + m32c-*) + ;; + # Recognize the various machine names and aliases which stand + # for a CPU type and a company and sometimes even an OS. + 386bsd) + basic_machine=i386-unknown + os=-bsd + ;; + 3b1 | 7300 | 7300-att | att-7300 | pc7300 | safari | unixpc) + basic_machine=m68000-att + ;; + 3b*) + basic_machine=we32k-att + ;; + a29khif) + basic_machine=a29k-amd + os=-udi + ;; + abacus) + basic_machine=abacus-unknown + ;; + adobe68k) + basic_machine=m68010-adobe + os=-scout + ;; + alliant | fx80) + basic_machine=fx80-alliant + ;; + altos | altos3068) + basic_machine=m68k-altos + ;; + am29k) + basic_machine=a29k-none + os=-bsd + ;; + amd64) + basic_machine=x86_64-pc + ;; + amd64-*) + basic_machine=x86_64-`echo $basic_machine | sed 's/^[^-]*-//'` + ;; + amdahl) + basic_machine=580-amdahl + os=-sysv + ;; + amiga | amiga-*) + basic_machine=m68k-unknown + ;; + amigaos | amigados) + basic_machine=m68k-unknown + os=-amigaos + ;; + amigaunix | amix) + basic_machine=m68k-unknown + os=-sysv4 + ;; + apollo68) + basic_machine=m68k-apollo + os=-sysv + ;; + apollo68bsd) + basic_machine=m68k-apollo + os=-bsd + ;; + aux) + basic_machine=m68k-apple + os=-aux + ;; + balance) + basic_machine=ns32k-sequent + os=-dynix + ;; + c90) + basic_machine=c90-cray + os=-unicos + ;; + convex-c1) + basic_machine=c1-convex + os=-bsd + ;; + convex-c2) + basic_machine=c2-convex + os=-bsd + ;; + convex-c32) + basic_machine=c32-convex + os=-bsd + ;; + convex-c34) + basic_machine=c34-convex + os=-bsd + ;; + convex-c38) + basic_machine=c38-convex + os=-bsd + ;; + cray | j90) + basic_machine=j90-cray + os=-unicos + ;; + craynv) + basic_machine=craynv-cray + os=-unicosmp + ;; + cr16c) + basic_machine=cr16c-unknown + os=-elf + ;; + crds | unos) + basic_machine=m68k-crds + ;; + crisv32 | crisv32-* | etraxfs*) + basic_machine=crisv32-axis + ;; + cris | cris-* | etrax*) + basic_machine=cris-axis + ;; + crx) + basic_machine=crx-unknown + os=-elf + ;; + da30 | da30-*) + basic_machine=m68k-da30 + ;; + decstation | decstation-3100 | pmax | pmax-* | pmin | dec3100 | decstatn) + basic_machine=mips-dec + ;; + decsystem10* | dec10*) + basic_machine=pdp10-dec + os=-tops10 + ;; + decsystem20* | dec20*) + basic_machine=pdp10-dec + os=-tops20 + ;; + delta | 3300 | motorola-3300 | motorola-delta \ + | 3300-motorola | delta-motorola) + basic_machine=m68k-motorola + ;; + delta88) + basic_machine=m88k-motorola + os=-sysv3 + ;; + djgpp) + basic_machine=i586-pc + os=-msdosdjgpp + ;; + dpx20 | dpx20-*) + basic_machine=rs6000-bull + os=-bosx + ;; + dpx2* | dpx2*-bull) + basic_machine=m68k-bull + os=-sysv3 + ;; + ebmon29k) + basic_machine=a29k-amd + os=-ebmon + ;; + elxsi) + basic_machine=elxsi-elxsi + os=-bsd + ;; + encore | umax | mmax) + basic_machine=ns32k-encore + ;; + es1800 | OSE68k | ose68k | ose | OSE) + basic_machine=m68k-ericsson + os=-ose + ;; + fx2800) + basic_machine=i860-alliant + ;; + genix) + basic_machine=ns32k-ns + ;; + gmicro) + basic_machine=tron-gmicro + os=-sysv + ;; + go32) + basic_machine=i386-pc + os=-go32 + ;; + h3050r* | hiux*) + basic_machine=hppa1.1-hitachi + os=-hiuxwe2 + ;; + h8300hms) + basic_machine=h8300-hitachi + os=-hms + ;; + h8300xray) + basic_machine=h8300-hitachi + os=-xray + ;; + h8500hms) + basic_machine=h8500-hitachi + os=-hms + ;; + harris) + basic_machine=m88k-harris + os=-sysv3 + ;; + hp300-*) + basic_machine=m68k-hp + ;; + hp300bsd) + basic_machine=m68k-hp + os=-bsd + ;; + hp300hpux) + basic_machine=m68k-hp + os=-hpux + ;; + hp3k9[0-9][0-9] | hp9[0-9][0-9]) + basic_machine=hppa1.0-hp + ;; + hp9k2[0-9][0-9] | hp9k31[0-9]) + basic_machine=m68000-hp + ;; + hp9k3[2-9][0-9]) + basic_machine=m68k-hp + ;; + hp9k6[0-9][0-9] | hp6[0-9][0-9]) + basic_machine=hppa1.0-hp + ;; + hp9k7[0-79][0-9] | hp7[0-79][0-9]) + basic_machine=hppa1.1-hp + ;; + hp9k78[0-9] | hp78[0-9]) + # FIXME: really hppa2.0-hp + basic_machine=hppa1.1-hp + ;; + hp9k8[67]1 | hp8[67]1 | hp9k80[24] | hp80[24] | hp9k8[78]9 | hp8[78]9 | hp9k893 | hp893) + # FIXME: really hppa2.0-hp + basic_machine=hppa1.1-hp + ;; + hp9k8[0-9][13679] | hp8[0-9][13679]) + basic_machine=hppa1.1-hp + ;; + hp9k8[0-9][0-9] | hp8[0-9][0-9]) + basic_machine=hppa1.0-hp + ;; + hppa-next) + os=-nextstep3 + ;; + hppaosf) + basic_machine=hppa1.1-hp + os=-osf + ;; + hppro) + basic_machine=hppa1.1-hp + os=-proelf + ;; + i370-ibm* | ibm*) + basic_machine=i370-ibm + ;; +# I'm not sure what "Sysv32" means. Should this be sysv3.2? + i*86v32) + basic_machine=`echo $1 | sed -e 's/86.*/86-pc/'` + os=-sysv32 + ;; + i*86v4*) + basic_machine=`echo $1 | sed -e 's/86.*/86-pc/'` + os=-sysv4 + ;; + i*86v) + basic_machine=`echo $1 | sed -e 's/86.*/86-pc/'` + os=-sysv + ;; + i*86sol2) + basic_machine=`echo $1 | sed -e 's/86.*/86-pc/'` + os=-solaris2 + ;; + i386mach) + basic_machine=i386-mach + os=-mach + ;; + i386-vsta | vsta) + basic_machine=i386-unknown + os=-vsta + ;; + iris | iris4d) + basic_machine=mips-sgi + case $os in + -irix*) + ;; + *) + os=-irix4 + ;; + esac + ;; + isi68 | isi) + basic_machine=m68k-isi + os=-sysv + ;; + m88k-omron*) + basic_machine=m88k-omron + ;; + magnum | m3230) + basic_machine=mips-mips + os=-sysv + ;; + merlin) + basic_machine=ns32k-utek + os=-sysv + ;; + mingw32) + basic_machine=i386-pc + os=-mingw32 + ;; + miniframe) + basic_machine=m68000-convergent + ;; + *mint | -mint[0-9]* | *MiNT | *MiNT[0-9]*) + basic_machine=m68k-atari + os=-mint + ;; + mips3*-*) + basic_machine=`echo $basic_machine | sed -e 's/mips3/mips64/'` + ;; + mips3*) + basic_machine=`echo $basic_machine | sed -e 's/mips3/mips64/'`-unknown + ;; + monitor) + basic_machine=m68k-rom68k + os=-coff + ;; + morphos) + basic_machine=powerpc-unknown + os=-morphos + ;; + msdos) + basic_machine=i386-pc + os=-msdos + ;; + ms1-*) + basic_machine=`echo $basic_machine | sed -e 's/ms1-/mt-/'` + ;; + mvs) + basic_machine=i370-ibm + os=-mvs + ;; + ncr3000) + basic_machine=i486-ncr + os=-sysv4 + ;; + netbsd386) + basic_machine=i386-unknown + os=-netbsd + ;; + netwinder) + basic_machine=armv4l-rebel + os=-linux + ;; + news | news700 | news800 | news900) + basic_machine=m68k-sony + os=-newsos + ;; + news1000) + basic_machine=m68030-sony + os=-newsos + ;; + news-3600 | risc-news) + basic_machine=mips-sony + os=-newsos + ;; + necv70) + basic_machine=v70-nec + os=-sysv + ;; + next | m*-next ) + basic_machine=m68k-next + case $os in + -nextstep* ) + ;; + -ns2*) + os=-nextstep2 + ;; + *) + os=-nextstep3 + ;; + esac + ;; + nh3000) + basic_machine=m68k-harris + os=-cxux + ;; + nh[45]000) + basic_machine=m88k-harris + os=-cxux + ;; + nindy960) + basic_machine=i960-intel + os=-nindy + ;; + mon960) + basic_machine=i960-intel + os=-mon960 + ;; + nonstopux) + basic_machine=mips-compaq + os=-nonstopux + ;; + np1) + basic_machine=np1-gould + ;; + nsr-tandem) + basic_machine=nsr-tandem + ;; + op50n-* | op60c-*) + basic_machine=hppa1.1-oki + os=-proelf + ;; + openrisc | openrisc-*) + basic_machine=or32-unknown + ;; + os400) + basic_machine=powerpc-ibm + os=-os400 + ;; + OSE68000 | ose68000) + basic_machine=m68000-ericsson + os=-ose + ;; + os68k) + basic_machine=m68k-none + os=-os68k + ;; + pa-hitachi) + basic_machine=hppa1.1-hitachi + os=-hiuxwe2 + ;; + paragon) + basic_machine=i860-intel + os=-osf + ;; + pbd) + basic_machine=sparc-tti + ;; + pbb) + basic_machine=m68k-tti + ;; + pc532 | pc532-*) + basic_machine=ns32k-pc532 + ;; + pentium | p5 | k5 | k6 | nexgen | viac3) + basic_machine=i586-pc + ;; + pentiumpro | p6 | 6x86 | athlon | athlon_*) + basic_machine=i686-pc + ;; + pentiumii | pentium2 | pentiumiii | pentium3) + basic_machine=i686-pc + ;; + pentium4) + basic_machine=i786-pc + ;; + pentium-* | p5-* | k5-* | k6-* | nexgen-* | viac3-*) + basic_machine=i586-`echo $basic_machine | sed 's/^[^-]*-//'` + ;; + pentiumpro-* | p6-* | 6x86-* | athlon-*) + basic_machine=i686-`echo $basic_machine | sed 's/^[^-]*-//'` + ;; + pentiumii-* | pentium2-* | pentiumiii-* | pentium3-*) + basic_machine=i686-`echo $basic_machine | sed 's/^[^-]*-//'` + ;; + pentium4-*) + basic_machine=i786-`echo $basic_machine | sed 's/^[^-]*-//'` + ;; + pn) + basic_machine=pn-gould + ;; + power) basic_machine=power-ibm + ;; + ppc) basic_machine=powerpc-unknown + ;; + ppc-*) basic_machine=powerpc-`echo $basic_machine | sed 's/^[^-]*-//'` + ;; + ppcle | powerpclittle | ppc-le | powerpc-little) + basic_machine=powerpcle-unknown + ;; + ppcle-* | powerpclittle-*) + basic_machine=powerpcle-`echo $basic_machine | sed 's/^[^-]*-//'` + ;; + ppc64) basic_machine=powerpc64-unknown + ;; + ppc64-*) basic_machine=powerpc64-`echo $basic_machine | sed 's/^[^-]*-//'` + ;; + ppc64le | powerpc64little | ppc64-le | powerpc64-little) + basic_machine=powerpc64le-unknown + ;; + ppc64le-* | powerpc64little-*) + basic_machine=powerpc64le-`echo $basic_machine | sed 's/^[^-]*-//'` + ;; + ps2) + basic_machine=i386-ibm + ;; + pw32) + basic_machine=i586-unknown + os=-pw32 + ;; + rdos) + basic_machine=i386-pc + os=-rdos + ;; + rom68k) + basic_machine=m68k-rom68k + os=-coff + ;; + rm[46]00) + basic_machine=mips-siemens + ;; + rtpc | rtpc-*) + basic_machine=romp-ibm + ;; + s390 | s390-*) + basic_machine=s390-ibm + ;; + s390x | s390x-*) + basic_machine=s390x-ibm + ;; + sa29200) + basic_machine=a29k-amd + os=-udi + ;; + sb1) + basic_machine=mipsisa64sb1-unknown + ;; + sb1el) + basic_machine=mipsisa64sb1el-unknown + ;; + sei) + basic_machine=mips-sei + os=-seiux + ;; + sequent) + basic_machine=i386-sequent + ;; + sh) + basic_machine=sh-hitachi + os=-hms + ;; + sh64) + basic_machine=sh64-unknown + ;; + sparclite-wrs | simso-wrs) + basic_machine=sparclite-wrs + os=-vxworks + ;; + sps7) + basic_machine=m68k-bull + os=-sysv2 + ;; + spur) + basic_machine=spur-unknown + ;; + st2000) + basic_machine=m68k-tandem + ;; + stratus) + basic_machine=i860-stratus + os=-sysv4 + ;; + sun2) + basic_machine=m68000-sun + ;; + sun2os3) + basic_machine=m68000-sun + os=-sunos3 + ;; + sun2os4) + basic_machine=m68000-sun + os=-sunos4 + ;; + sun3os3) + basic_machine=m68k-sun + os=-sunos3 + ;; + sun3os4) + basic_machine=m68k-sun + os=-sunos4 + ;; + sun4os3) + basic_machine=sparc-sun + os=-sunos3 + ;; + sun4os4) + basic_machine=sparc-sun + os=-sunos4 + ;; + sun4sol2) + basic_machine=sparc-sun + os=-solaris2 + ;; + sun3 | sun3-*) + basic_machine=m68k-sun + ;; + sun4) + basic_machine=sparc-sun + ;; + sun386 | sun386i | roadrunner) + basic_machine=i386-sun + ;; + sv1) + basic_machine=sv1-cray + os=-unicos + ;; + symmetry) + basic_machine=i386-sequent + os=-dynix + ;; + t3e) + basic_machine=alphaev5-cray + os=-unicos + ;; + t90) + basic_machine=t90-cray + os=-unicos + ;; + tic54x | c54x*) + basic_machine=tic54x-unknown + os=-coff + ;; + tic55x | c55x*) + basic_machine=tic55x-unknown + os=-coff + ;; + tic6x | c6x*) + basic_machine=tic6x-unknown + os=-coff + ;; + tx39) + basic_machine=mipstx39-unknown + ;; + tx39el) + basic_machine=mipstx39el-unknown + ;; + toad1) + basic_machine=pdp10-xkl + os=-tops20 + ;; + tower | tower-32) + basic_machine=m68k-ncr + ;; + tpf) + basic_machine=s390x-ibm + os=-tpf + ;; + udi29k) + basic_machine=a29k-amd + os=-udi + ;; + ultra3) + basic_machine=a29k-nyu + os=-sym1 + ;; + v810 | necv810) + basic_machine=v810-nec + os=-none + ;; + vaxv) + basic_machine=vax-dec + os=-sysv + ;; + vms) + basic_machine=vax-dec + os=-vms + ;; + vpp*|vx|vx-*) + basic_machine=f301-fujitsu + ;; + vxworks960) + basic_machine=i960-wrs + os=-vxworks + ;; + vxworks68) + basic_machine=m68k-wrs + os=-vxworks + ;; + vxworks29k) + basic_machine=a29k-wrs + os=-vxworks + ;; + w65*) + basic_machine=w65-wdc + os=-none + ;; + w89k-*) + basic_machine=hppa1.1-winbond + os=-proelf + ;; + xbox) + basic_machine=i686-pc + os=-mingw32 + ;; + xps | xps100) + basic_machine=xps100-honeywell + ;; + ymp) + basic_machine=ymp-cray + os=-unicos + ;; + z8k-*-coff) + basic_machine=z8k-unknown + os=-sim + ;; + none) + basic_machine=none-none + os=-none + ;; + +# Here we handle the default manufacturer of certain CPU types. It is in +# some cases the only manufacturer, in others, it is the most popular. + w89k) + basic_machine=hppa1.1-winbond + ;; + op50n) + basic_machine=hppa1.1-oki + ;; + op60c) + basic_machine=hppa1.1-oki + ;; + romp) + basic_machine=romp-ibm + ;; + mmix) + basic_machine=mmix-knuth + ;; + rs6000) + basic_machine=rs6000-ibm + ;; + vax) + basic_machine=vax-dec + ;; + pdp10) + # there are many clones, so DEC is not a safe bet + basic_machine=pdp10-unknown + ;; + pdp11) + basic_machine=pdp11-dec + ;; + we32k) + basic_machine=we32k-att + ;; + sh[1234] | sh[24]a | sh[34]eb | sh[1234]le | sh[23]ele) + basic_machine=sh-unknown + ;; + sparc | sparcv8 | sparcv9 | sparcv9b) + basic_machine=sparc-sun + ;; + cydra) + basic_machine=cydra-cydrome + ;; + orion) + basic_machine=orion-highlevel + ;; + orion105) + basic_machine=clipper-highlevel + ;; + mac | mpw | mac-mpw) + basic_machine=m68k-apple + ;; + pmac | pmac-mpw) + basic_machine=powerpc-apple + ;; + *-unknown) + # Make sure to match an already-canonicalized machine name. + ;; + *) + echo Invalid configuration \`$1\': machine \`$basic_machine\' not recognized 1>&2 + exit 1 + ;; +esac + +# Here we canonicalize certain aliases for manufacturers. +case $basic_machine in + *-digital*) + basic_machine=`echo $basic_machine | sed 's/digital.*/dec/'` + ;; + *-commodore*) + basic_machine=`echo $basic_machine | sed 's/commodore.*/cbm/'` + ;; + *) + ;; +esac + +# Decode manufacturer-specific aliases for certain operating systems. + +if [ x"$os" != x"" ] +then +case $os in + # First match some system type aliases + # that might get confused with valid system types. + # -solaris* is a basic system type, with this one exception. + -solaris1 | -solaris1.*) + os=`echo $os | sed -e 's|solaris1|sunos4|'` + ;; + -solaris) + os=-solaris2 + ;; + -svr4*) + os=-sysv4 + ;; + -unixware*) + os=-sysv4.2uw + ;; + -gnu/linux*) + os=`echo $os | sed -e 's|gnu/linux|linux-gnu|'` + ;; + # First accept the basic system types. + # The portable systems comes first. + # Each alternative MUST END IN A *, to match a version number. + # -sysv* is not here because it comes later, after sysvr4. + -gnu* | -bsd* | -mach* | -minix* | -genix* | -ultrix* | -irix* \ + | -*vms* | -sco* | -esix* | -isc* | -aix* | -sunos | -sunos[34]*\ + | -hpux* | -unos* | -osf* | -luna* | -dgux* | -solaris* | -sym* \ + | -amigaos* | -amigados* | -msdos* | -newsos* | -unicos* | -aof* \ + | -aos* \ + | -nindy* | -vxsim* | -vxworks* | -ebmon* | -hms* | -mvs* \ + | -clix* | -riscos* | -uniplus* | -iris* | -rtu* | -xenix* \ + | -hiux* | -386bsd* | -knetbsd* | -mirbsd* | -netbsd* | -openbsd* \ + | -ekkobsd* | -kfreebsd* | -freebsd* | -riscix* | -lynxos* \ + | -bosx* | -nextstep* | -cxux* | -aout* | -elf* | -oabi* \ + | -ptx* | -coff* | -ecoff* | -winnt* | -domain* | -vsta* \ + | -udi* | -eabi* | -lites* | -ieee* | -go32* | -aux* \ + | -chorusos* | -chorusrdb* \ + | -cygwin* | -pe* | -psos* | -moss* | -proelf* | -rtems* \ + | -mingw32* | -linux-gnu* | -linux-newlib* | -linux-uclibc* \ + | -uxpv* | -beos* | -mpeix* | -udk* \ + | -interix* | -uwin* | -mks* | -rhapsody* | -darwin* | -opened* \ + | -openstep* | -oskit* | -conix* | -pw32* | -nonstopux* \ + | -storm-chaos* | -tops10* | -tenex* | -tops20* | -its* \ + | -os2* | -vos* | -palmos* | -uclinux* | -nucleus* \ + | -morphos* | -superux* | -rtmk* | -rtmk-nova* | -windiss* \ + | -powermax* | -dnix* | -nx6 | -nx7 | -sei* | -dragonfly* \ + | -skyos* | -haiku* | -rdos*) + # Remember, each alternative MUST END IN *, to match a version number. + ;; + -qnx*) + case $basic_machine in + x86-* | i*86-*) + ;; + *) + os=-nto$os + ;; + esac + ;; + -nto-qnx*) + ;; + -nto*) + os=`echo $os | sed -e 's|nto|nto-qnx|'` + ;; + -sim | -es1800* | -hms* | -xray | -os68k* | -none* | -v88r* \ + | -windows* | -osx | -abug | -netware* | -os9* | -beos* | -haiku* \ + | -macos* | -mpw* | -magic* | -mmixware* | -mon960* | -lnews*) + ;; + -mac*) + os=`echo $os | sed -e 's|mac|macos|'` + ;; + -linux-dietlibc) + os=-linux-dietlibc + ;; + -linux*) + os=`echo $os | sed -e 's|linux|linux-gnu|'` + ;; + -sunos5*) + os=`echo $os | sed -e 's|sunos5|solaris2|'` + ;; + -sunos6*) + os=`echo $os | sed -e 's|sunos6|solaris3|'` + ;; + -opened*) + os=-openedition + ;; + -os400*) + os=-os400 + ;; + -wince*) + os=-wince + ;; + -osfrose*) + os=-osfrose + ;; + -osf*) + os=-osf + ;; + -utek*) + os=-bsd + ;; + -dynix*) + os=-bsd + ;; + -acis*) + os=-aos + ;; + -atheos*) + os=-atheos + ;; + -syllable*) + os=-syllable + ;; + -386bsd) + os=-bsd + ;; + -ctix* | -uts*) + os=-sysv + ;; + -nova*) + os=-rtmk-nova + ;; + -ns2 ) + os=-nextstep2 + ;; + -nsk*) + os=-nsk + ;; + # Preserve the version number of sinix5. + -sinix5.*) + os=`echo $os | sed -e 's|sinix|sysv|'` + ;; + -sinix*) + os=-sysv4 + ;; + -tpf*) + os=-tpf + ;; + -triton*) + os=-sysv3 + ;; + -oss*) + os=-sysv3 + ;; + -svr4) + os=-sysv4 + ;; + -svr3) + os=-sysv3 + ;; + -sysvr4) + os=-sysv4 + ;; + # This must come after -sysvr4. + -sysv*) + ;; + -ose*) + os=-ose + ;; + -es1800*) + os=-ose + ;; + -xenix) + os=-xenix + ;; + -*mint | -mint[0-9]* | -*MiNT | -MiNT[0-9]*) + os=-mint + ;; + -aros*) + os=-aros + ;; + -kaos*) + os=-kaos + ;; + -zvmoe) + os=-zvmoe + ;; + -none) + ;; + *) + # Get rid of the `-' at the beginning of $os. + os=`echo $os | sed 's/[^-]*-//'` + echo Invalid configuration \`$1\': system \`$os\' not recognized 1>&2 + exit 1 + ;; +esac +else + +# Here we handle the default operating systems that come with various machines. +# The value should be what the vendor currently ships out the door with their +# machine or put another way, the most popular os provided with the machine. + +# Note that if you're going to try to match "-MANUFACTURER" here (say, +# "-sun"), then you have to tell the case statement up towards the top +# that MANUFACTURER isn't an operating system. Otherwise, code above +# will signal an error saying that MANUFACTURER isn't an operating +# system, and we'll never get to this point. + +case $basic_machine in + *-acorn) + os=-riscix1.2 + ;; + arm*-rebel) + os=-linux + ;; + arm*-semi) + os=-aout + ;; + c4x-* | tic4x-*) + os=-coff + ;; + # This must come before the *-dec entry. + pdp10-*) + os=-tops20 + ;; + pdp11-*) + os=-none + ;; + *-dec | vax-*) + os=-ultrix4.2 + ;; + m68*-apollo) + os=-domain + ;; + i386-sun) + os=-sunos4.0.2 + ;; + m68000-sun) + os=-sunos3 + # This also exists in the configure program, but was not the + # default. + # os=-sunos4 + ;; + m68*-cisco) + os=-aout + ;; + mips*-cisco) + os=-elf + ;; + mips*-*) + os=-elf + ;; + or32-*) + os=-coff + ;; + *-tti) # must be before sparc entry or we get the wrong os. + os=-sysv3 + ;; + sparc-* | *-sun) + os=-sunos4.1.1 + ;; + *-be) + os=-beos + ;; + *-haiku) + os=-haiku + ;; + *-ibm) + os=-aix + ;; + *-knuth) + os=-mmixware + ;; + *-wec) + os=-proelf + ;; + *-winbond) + os=-proelf + ;; + *-oki) + os=-proelf + ;; + *-hp) + os=-hpux + ;; + *-hitachi) + os=-hiux + ;; + i860-* | *-att | *-ncr | *-altos | *-motorola | *-convergent) + os=-sysv + ;; + *-cbm) + os=-amigaos + ;; + *-dg) + os=-dgux + ;; + *-dolphin) + os=-sysv3 + ;; + m68k-ccur) + os=-rtu + ;; + m88k-omron*) + os=-luna + ;; + *-next ) + os=-nextstep + ;; + *-sequent) + os=-ptx + ;; + *-crds) + os=-unos + ;; + *-ns) + os=-genix + ;; + i370-*) + os=-mvs + ;; + *-next) + os=-nextstep3 + ;; + *-gould) + os=-sysv + ;; + *-highlevel) + os=-bsd + ;; + *-encore) + os=-bsd + ;; + *-sgi) + os=-irix + ;; + *-siemens) + os=-sysv4 + ;; + *-masscomp) + os=-rtu + ;; + f30[01]-fujitsu | f700-fujitsu) + os=-uxpv + ;; + *-rom68k) + os=-coff + ;; + *-*bug) + os=-coff + ;; + *-apple) + os=-macos + ;; + *-atari*) + os=-mint + ;; + *) + os=-none + ;; +esac +fi + +# Here we handle the case where we know the os, and the CPU type, but not the +# manufacturer. We pick the logical manufacturer. +vendor=unknown +case $basic_machine in + *-unknown) + case $os in + -riscix*) + vendor=acorn + ;; + -sunos*) + vendor=sun + ;; + -aix*) + vendor=ibm + ;; + -beos*) + vendor=be + ;; + -hpux*) + vendor=hp + ;; + -mpeix*) + vendor=hp + ;; + -hiux*) + vendor=hitachi + ;; + -unos*) + vendor=crds + ;; + -dgux*) + vendor=dg + ;; + -luna*) + vendor=omron + ;; + -genix*) + vendor=ns + ;; + -mvs* | -opened*) + vendor=ibm + ;; + -os400*) + vendor=ibm + ;; + -ptx*) + vendor=sequent + ;; + -tpf*) + vendor=ibm + ;; + -vxsim* | -vxworks* | -windiss*) + vendor=wrs + ;; + -aux*) + vendor=apple + ;; + -hms*) + vendor=hitachi + ;; + -mpw* | -macos*) + vendor=apple + ;; + -*mint | -mint[0-9]* | -*MiNT | -MiNT[0-9]*) + vendor=atari + ;; + -vos*) + vendor=stratus + ;; + esac + basic_machine=`echo $basic_machine | sed "s/unknown/$vendor/"` + ;; +esac + +echo $basic_machine$os +exit + +# Local variables: +# eval: (add-hook 'write-file-hooks 'time-stamp) +# time-stamp-start: "timestamp='" +# time-stamp-format: "%:y-%02m-%02d" +# time-stamp-end: "'" +# End: diff --git a/build-aux/install-sh b/build-aux/install-sh new file mode 100755 index 0000000..4d4a951 --- /dev/null +++ b/build-aux/install-sh @@ -0,0 +1,323 @@ +#!/bin/sh +# install - install a program, script, or datafile + +scriptversion=2005-05-14.22 + +# This originates from X11R5 (mit/util/scripts/install.sh), which was +# later released in X11R6 (xc/config/util/install.sh) with the +# following copyright and license. +# +# Copyright (C) 1994 X Consortium +# +# Permission is hereby granted, free of charge, to any person obtaining a copy +# of this software and associated documentation files (the "Software"), to +# deal in the Software without restriction, including without limitation the +# rights to use, copy, modify, merge, publish, distribute, sublicense, and/or +# sell copies of the Software, and to permit persons to whom the Software is +# furnished to do so, subject to the following conditions: +# +# The above copyright notice and this permission notice shall be included in +# all copies or substantial portions of the Software. +# +# THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR +# IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, +# FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE +# X CONSORTIUM BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN +# AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNEC- +# TION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. +# +# Except as contained in this notice, the name of the X Consortium shall not +# be used in advertising or otherwise to promote the sale, use or other deal- +# ings in this Software without prior written authorization from the X Consor- +# tium. +# +# +# FSF changes to this file are in the public domain. +# +# 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}" + +chmodcmd="$chmodprog 0755" +chowncmd= +chgrpcmd= +stripcmd= +rmcmd="$rmprog -f" +mvcmd="$mvprog" +src= +dst= +dir_arg= +dstarg= +no_target_directory= + +usage="Usage: $0 [OPTION]... [-T] SRCFILE DSTFILE + or: $0 [OPTION]... SRCFILES... DIRECTORY + or: $0 [OPTION]... -t DIRECTORY SRCFILES... + or: $0 [OPTION]... -d DIRECTORIES... + +In the 1st form, copy SRCFILE to DSTFILE. +In the 2nd and 3rd, copy all SRCFILES to DIRECTORY. +In the 4th, create DIRECTORIES. + +Options: +-c (ignored) +-d create directories instead of installing files. +-g GROUP $chgrpprog installed files to GROUP. +-m MODE $chmodprog installed files to MODE. +-o USER $chownprog installed files to USER. +-s $stripprog installed files. +-t DIRECTORY install into DIRECTORY. +-T report an error if DSTFILE is a directory. +--help display this help and exit. +--version display version info and exit. + +Environment variables override the default commands: + CHGRPPROG CHMODPROG CHOWNPROG CPPROG MKDIRPROG MVPROG RMPROG STRIPPROG +" + +while test -n "$1"; do + case $1 in + -c) shift + continue;; + + -d) dir_arg=true + shift + continue;; + + -g) chgrpcmd="$chgrpprog $2" + shift + shift + continue;; + + --help) echo "$usage"; exit $?;; + + -m) chmodcmd="$chmodprog $2" + shift + shift + continue;; + + -o) chowncmd="$chownprog $2" + shift + shift + continue;; + + -s) stripcmd=$stripprog + shift + continue;; + + -t) dstarg=$2 + shift + shift + continue;; + + -T) no_target_directory=true + shift + continue;; + + --version) echo "$0 $scriptversion"; exit $?;; + + *) # When -d is used, all remaining arguments are directories to create. + # When -t is used, the destination is already specified. + test -n "$dir_arg$dstarg" && break + # Otherwise, the last argument is the destination. Remove it from $@. + for arg + do + if test -n "$dstarg"; then + # $@ is not empty: it contains at least $arg. + set fnord "$@" "$dstarg" + shift # fnord + fi + shift # arg + dstarg=$arg + done + break;; + esac +done + +if test -z "$1"; then + if test -z "$dir_arg"; then + echo "$0: no input file specified." >&2 + exit 1 + fi + # It's OK to call `install-sh -d' without argument. + # This can happen when creating conditional directories. + exit 0 +fi + +for src +do + # Protect names starting with `-'. + case $src in + -*) src=./$src ;; + esac + + if test -n "$dir_arg"; then + dst=$src + src= + + if test -d "$dst"; then + mkdircmd=: + chmodcmd= + else + mkdircmd=$mkdirprog + fi + else + # Waiting for this to be detected by the "$cpprog $src $dsttmp" command + # might cause directories to be created, which would be especially bad + # if $src (and thus $dsttmp) contains '*'. + if test ! -f "$src" && test ! -d "$src"; then + echo "$0: $src does not exist." >&2 + exit 1 + fi + + if test -z "$dstarg"; then + echo "$0: no destination specified." >&2 + exit 1 + fi + + dst=$dstarg + # Protect names starting with `-'. + case $dst in + -*) dst=./$dst ;; + esac + + # If destination is a directory, append the input filename; won't work + # if double slashes aren't ignored. + if test -d "$dst"; then + if test -n "$no_target_directory"; then + echo "$0: $dstarg: Is a directory" >&2 + exit 1 + fi + dst=$dst/`basename "$src"` + fi + fi + + # This sed command emulates the dirname command. + dstdir=`echo "$dst" | sed -e 's,/*$,,;s,[^/]*$,,;s,/*$,,;s,^$,.,'` + + # Make sure that the destination directory exists. + + # Skip lots of stat calls in the usual case. + if test ! -d "$dstdir"; then + defaultIFS=' + ' + IFS="${IFS-$defaultIFS}" + + oIFS=$IFS + # Some sh's can't handle IFS=/ for some reason. + IFS='%' + set x `echo "$dstdir" | sed -e 's@/@%@g' -e 's@^%@/@'` + shift + IFS=$oIFS + + pathcomp= + + while test $# -ne 0 ; do + pathcomp=$pathcomp$1 + shift + if test ! -d "$pathcomp"; then + $mkdirprog "$pathcomp" + # mkdir can fail with a `File exist' error in case several + # install-sh are creating the directory concurrently. This + # is OK. + test -d "$pathcomp" || exit + fi + pathcomp=$pathcomp/ + done + fi + + if test -n "$dir_arg"; then + $doit $mkdircmd "$dst" \ + && { test -z "$chowncmd" || $doit $chowncmd "$dst"; } \ + && { test -z "$chgrpcmd" || $doit $chgrpcmd "$dst"; } \ + && { test -z "$stripcmd" || $doit $stripcmd "$dst"; } \ + && { test -z "$chmodcmd" || $doit $chmodcmd "$dst"; } + + else + dstfile=`basename "$dst"` + + # Make a couple of temp file names in the proper directory. + dsttmp=$dstdir/_inst.$$_ + rmtmp=$dstdir/_rm.$$_ + + # Trap to clean up those temp files at exit. + trap 'ret=$?; rm -f "$dsttmp" "$rmtmp" && exit $ret' 0 + trap '(exit $?); exit' 1 2 13 15 + + # Copy the file name to the temp name. + $doit $cpprog "$src" "$dsttmp" && + + # 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 $cpprog $src $dsttmp" command. + # + { test -z "$chowncmd" || $doit $chowncmd "$dsttmp"; } \ + && { test -z "$chgrpcmd" || $doit $chgrpcmd "$dsttmp"; } \ + && { test -z "$stripcmd" || $doit $stripcmd "$dsttmp"; } \ + && { test -z "$chmodcmd" || $doit $chmodcmd "$dsttmp"; } && + + # Now rename the file to the real destination. + { $doit $mvcmd -f "$dsttmp" "$dstdir/$dstfile" 2>/dev/null \ + || { + # The rename failed, perhaps because mv can't rename something else + # to itself, or perhaps because mv is so ancient that it does not + # support -f. + + # Now remove or move aside any old file at destination location. + # We try this two ways since rm can't unlink itself on some + # systems and the destination file might be busy for other + # reasons. In this case, the final cleanup might fail but the new + # file should still install successfully. + { + if test -f "$dstdir/$dstfile"; then + $doit $rmcmd -f "$dstdir/$dstfile" 2>/dev/null \ + || $doit $mvcmd -f "$dstdir/$dstfile" "$rmtmp" 2>/dev/null \ + || { + echo "$0: cannot unlink or rename $dstdir/$dstfile" >&2 + (exit 1); exit 1 + } + else + : + fi + } && + + # Now rename the file to the real destination. + $doit $mvcmd "$dsttmp" "$dstdir/$dstfile" + } + } + fi || { (exit 1); exit 1; } +done + +# The final little trick to "correctly" pass the exit status to the exit trap. +{ + (exit 0); 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: diff --git a/build-aux/mdate-sh b/build-aux/mdate-sh new file mode 100755 index 0000000..cd916c0 --- /dev/null +++ b/build-aux/mdate-sh @@ -0,0 +1,201 @@ +#!/bin/sh +# Get modification time of a file or directory and pretty-print it. + +scriptversion=2005-06-29.22 + +# Copyright (C) 1995, 1996, 1997, 2003, 2004, 2005 Free Software +# Foundation, Inc. +# written by Ulrich Drepper , June 1995 +# +# This program is free software; you can redistribute it and/or modify +# it under the terms of the GNU General Public License as published by +# the Free Software Foundation; either version 2, or (at your option) +# any later version. +# +# This program is distributed in the hope that it will be useful, +# but WITHOUT ANY WARRANTY; without even the implied warranty of +# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +# GNU General Public License for more details. +# +# You should have received a copy of the GNU General Public License +# along with this program; if not, write to the Free Software Foundation, +# Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. + +# 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. + +# This file is maintained in Automake, please report +# bugs to or send patches to +# . + +case $1 in + '') + echo "$0: No file. Try \`$0 --help' for more information." 1>&2 + exit 1; + ;; + -h | --h*) + cat <<\EOF +Usage: mdate-sh [--help] [--version] FILE + +Pretty-print the modification time of FILE. + +Report bugs to . +EOF + exit $? + ;; + -v | --v*) + echo "mdate-sh $scriptversion" + exit $? + ;; +esac + +# Prevent date giving response in another language. +LANG=C +export LANG +LC_ALL=C +export LC_ALL +LC_TIME=C +export LC_TIME + +# GNU ls changes its time format in response to the TIME_STYLE +# variable. Since we cannot assume `unset' works, revert this +# variable to its documented default. +if test "${TIME_STYLE+set}" = set; then + TIME_STYLE=posix-long-iso + export TIME_STYLE +fi + +save_arg1=$1 + +# Find out how to get the extended ls output of a file or directory. +if ls -L /dev/null 1>/dev/null 2>&1; then + ls_command='ls -L -l -d' +else + ls_command='ls -l -d' +fi + +# A `ls -l' line looks as follows on OS/2. +# drwxrwx--- 0 Aug 11 2001 foo +# This differs from Unix, which adds ownership information. +# drwxrwx--- 2 root root 4096 Aug 11 2001 foo +# +# To find the date, we split the line on spaces and iterate on words +# until we find a month. This cannot work with files whose owner is a +# user named `Jan', or `Feb', etc. However, it's unlikely that `/' +# will be owned by a user whose name is a month. So we first look at +# the extended ls output of the root directory to decide how many +# words should be skipped to get the date. + +# On HPUX /bin/sh, "set" interprets "-rw-r--r--" as options, so the "x" below. +set x`ls -l -d /` + +# Find which argument is the month. +month= +command= +until test $month +do + shift + # Add another shift to the command. + command="$command shift;" + case $1 in + Jan) month=January; nummonth=1;; + Feb) month=February; nummonth=2;; + Mar) month=March; nummonth=3;; + Apr) month=April; nummonth=4;; + May) month=May; nummonth=5;; + Jun) month=June; nummonth=6;; + Jul) month=July; nummonth=7;; + Aug) month=August; nummonth=8;; + Sep) month=September; nummonth=9;; + Oct) month=October; nummonth=10;; + Nov) month=November; nummonth=11;; + Dec) month=December; nummonth=12;; + esac +done + +# Get the extended ls output of the file or directory. +set dummy x`eval "$ls_command \"\$save_arg1\""` + +# Remove all preceding arguments +eval $command + +# Because of the dummy argument above, month is in $2. +# +# On a POSIX system, we should have +# +# $# = 5 +# $1 = file size +# $2 = month +# $3 = day +# $4 = year or time +# $5 = filename +# +# On Darwin 7.7.0 and 7.6.0, we have +# +# $# = 4 +# $1 = day +# $2 = month +# $3 = year or time +# $4 = filename + +# Get the month. +case $2 in + Jan) month=January; nummonth=1;; + Feb) month=February; nummonth=2;; + Mar) month=March; nummonth=3;; + Apr) month=April; nummonth=4;; + May) month=May; nummonth=5;; + Jun) month=June; nummonth=6;; + Jul) month=July; nummonth=7;; + Aug) month=August; nummonth=8;; + Sep) month=September; nummonth=9;; + Oct) month=October; nummonth=10;; + Nov) month=November; nummonth=11;; + Dec) month=December; nummonth=12;; +esac + +case $3 in + ???*) day=$1;; + *) day=$3; shift;; +esac + +# Here we have to deal with the problem that the ls output gives either +# the time of day or the year. +case $3 in + *:*) set `date`; eval year=\$$# + case $2 in + Jan) nummonthtod=1;; + Feb) nummonthtod=2;; + Mar) nummonthtod=3;; + Apr) nummonthtod=4;; + May) nummonthtod=5;; + Jun) nummonthtod=6;; + Jul) nummonthtod=7;; + Aug) nummonthtod=8;; + Sep) nummonthtod=9;; + Oct) nummonthtod=10;; + Nov) nummonthtod=11;; + Dec) nummonthtod=12;; + esac + # For the first six month of the year the time notation can also + # be used for files modified in the last year. + if (expr $nummonth \> $nummonthtod) > /dev/null; + then + year=`expr $year - 1` + fi;; + *) year=$3;; +esac + +# The result. +echo $day $month $year + +# 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: diff --git a/build-aux/texinfo.tex b/build-aux/texinfo.tex new file mode 100644 index 0000000..ff2c406 --- /dev/null +++ b/build-aux/texinfo.tex @@ -0,0 +1,7210 @@ +% texinfo.tex -- TeX macros to handle Texinfo files. +% +% Load plain if necessary, i.e., if running under initex. +\expandafter\ifx\csname fmtname\endcsname\relax\input plain\fi +% +\def\texinfoversion{2005-07-05.19} +% +% Copyright (C) 1985, 1986, 1988, 1990, 1991, 1992, 1993, 1994, 1995, +% 1996, 1997, 1998, 1999, 2000, 2001, 2002, 2003, 2004, 2005 Free Software +% Foundation, Inc. +% +% This texinfo.tex file 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 texinfo.tex file 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 texinfo.tex file; see the file COPYING. If not, write +% to the Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor, +% Boston, MA 02110-1301, USA. +% +% As a special exception, when this file is read by TeX when processing +% a Texinfo source document, you may use the result without +% restriction. (This has been our intent since Texinfo was invented.) +% +% Please try the latest version of texinfo.tex before submitting bug +% reports; you can get the latest version from: +% http://www.gnu.org/software/texinfo/ (the Texinfo home page), or +% ftp://tug.org/tex/texinfo.tex +% (and all CTAN mirrors, see http://www.ctan.org). +% The texinfo.tex in any given distribution could well be out +% of date, so if that's what you're using, please check. +% +% Send bug reports to bug-texinfo@gnu.org. Please include including a +% complete document in each bug report with which we can reproduce the +% problem. Patches are, of course, greatly appreciated. +% +% To process a Texinfo manual with TeX, it's most reliable to use the +% texi2dvi shell script that comes with the distribution. For a simple +% manual foo.texi, however, you can get away with this: +% tex foo.texi +% texindex foo.?? +% tex foo.texi +% tex foo.texi +% dvips foo.dvi -o # or whatever; this makes foo.ps. +% The extra TeX runs get the cross-reference information correct. +% Sometimes one run after texindex suffices, and sometimes you need more +% than two; texi2dvi does it as many times as necessary. +% +% It is possible to adapt texinfo.tex for other languages, to some +% extent. You can get the existing language-specific files from the +% full Texinfo distribution. +% +% The GNU Texinfo home page is http://www.gnu.org/software/texinfo. + + +\message{Loading texinfo [version \texinfoversion]:} + +% If in a .fmt file, print the version number +% and turn on active characters that we couldn't do earlier because +% they might have appeared in the input file name. +\everyjob{\message{[Texinfo version \texinfoversion]}% + \catcode`+=\active \catcode`\_=\active} + +\message{Basics,} +\chardef\other=12 + +% We never want plain's \outer definition of \+ in Texinfo. +% For @tex, we can use \tabalign. +\let\+ = \relax + +% Save some plain tex macros whose names we will redefine. +\let\ptexb=\b +\let\ptexbullet=\bullet +\let\ptexc=\c +\let\ptexcomma=\, +\let\ptexdot=\. +\let\ptexdots=\dots +\let\ptexend=\end +\let\ptexequiv=\equiv +\let\ptexexclam=\! +\let\ptexfootnote=\footnote +\let\ptexgtr=> +\let\ptexhat=^ +\let\ptexi=\i +\let\ptexindent=\indent +\let\ptexinsert=\insert +\let\ptexlbrace=\{ +\let\ptexless=< +\let\ptexnewwrite\newwrite +\let\ptexnoindent=\noindent +\let\ptexplus=+ +\let\ptexrbrace=\} +\let\ptexslash=\/ +\let\ptexstar=\* +\let\ptext=\t + +% If this character appears in an error message or help string, it +% starts a new line in the output. +\newlinechar = `^^J + +% Use TeX 3.0's \inputlineno to get the line number, for better error +% messages, but if we're using an old version of TeX, don't do anything. +% +\ifx\inputlineno\thisisundefined + \let\linenumber = \empty % Pre-3.0. +\else + \def\linenumber{l.\the\inputlineno:\space} +\fi + +% Set up fixed words for English if not already set. +\ifx\putwordAppendix\undefined \gdef\putwordAppendix{Appendix}\fi +\ifx\putwordChapter\undefined \gdef\putwordChapter{Chapter}\fi +\ifx\putwordfile\undefined \gdef\putwordfile{file}\fi +\ifx\putwordin\undefined \gdef\putwordin{in}\fi +\ifx\putwordIndexIsEmpty\undefined \gdef\putwordIndexIsEmpty{(Index is empty)}\fi +\ifx\putwordIndexNonexistent\undefined \gdef\putwordIndexNonexistent{(Index is nonexistent)}\fi +\ifx\putwordInfo\undefined \gdef\putwordInfo{Info}\fi +\ifx\putwordInstanceVariableof\undefined \gdef\putwordInstanceVariableof{Instance Variable of}\fi +\ifx\putwordMethodon\undefined \gdef\putwordMethodon{Method on}\fi +\ifx\putwordNoTitle\undefined \gdef\putwordNoTitle{No Title}\fi +\ifx\putwordof\undefined \gdef\putwordof{of}\fi +\ifx\putwordon\undefined \gdef\putwordon{on}\fi +\ifx\putwordpage\undefined \gdef\putwordpage{page}\fi +\ifx\putwordsection\undefined \gdef\putwordsection{section}\fi +\ifx\putwordSection\undefined \gdef\putwordSection{Section}\fi +\ifx\putwordsee\undefined \gdef\putwordsee{see}\fi +\ifx\putwordSee\undefined \gdef\putwordSee{See}\fi +\ifx\putwordShortTOC\undefined \gdef\putwordShortTOC{Short Contents}\fi +\ifx\putwordTOC\undefined \gdef\putwordTOC{Table of Contents}\fi +% +\ifx\putwordMJan\undefined \gdef\putwordMJan{January}\fi +\ifx\putwordMFeb\undefined \gdef\putwordMFeb{February}\fi +\ifx\putwordMMar\undefined \gdef\putwordMMar{March}\fi +\ifx\putwordMApr\undefined \gdef\putwordMApr{April}\fi +\ifx\putwordMMay\undefined \gdef\putwordMMay{May}\fi +\ifx\putwordMJun\undefined \gdef\putwordMJun{June}\fi +\ifx\putwordMJul\undefined \gdef\putwordMJul{July}\fi +\ifx\putwordMAug\undefined \gdef\putwordMAug{August}\fi +\ifx\putwordMSep\undefined \gdef\putwordMSep{September}\fi +\ifx\putwordMOct\undefined \gdef\putwordMOct{October}\fi +\ifx\putwordMNov\undefined \gdef\putwordMNov{November}\fi +\ifx\putwordMDec\undefined \gdef\putwordMDec{December}\fi +% +\ifx\putwordDefmac\undefined \gdef\putwordDefmac{Macro}\fi +\ifx\putwordDefspec\undefined \gdef\putwordDefspec{Special Form}\fi +\ifx\putwordDefvar\undefined \gdef\putwordDefvar{Variable}\fi +\ifx\putwordDefopt\undefined \gdef\putwordDefopt{User Option}\fi +\ifx\putwordDeffunc\undefined \gdef\putwordDeffunc{Function}\fi + +% In some macros, we cannot use the `\? notation---the left quote is +% in some cases the escape char. +\chardef\backChar = `\\ +\chardef\colonChar = `\: +\chardef\commaChar = `\, +\chardef\dotChar = `\. +\chardef\exclamChar= `\! +\chardef\plusChar = `\+ +\chardef\questChar = `\? +\chardef\semiChar = `\; +\chardef\underChar = `\_ + +\chardef\spaceChar = `\ % +\chardef\spacecat = 10 +\def\spaceisspace{\catcode\spaceChar=\spacecat} + +{% for help with debugging. + % example usage: \expandafter\show\activebackslash + \catcode`\! = 0 \catcode`\\ = \active + !global!def!activebackslash{\} +} + +% Ignore a token. +% +\def\gobble#1{} + +% The following is used inside several \edef's. +\def\makecsname#1{\expandafter\noexpand\csname#1\endcsname} + +% Hyphenation fixes. +\hyphenation{ + Flor-i-da Ghost-script Ghost-view Mac-OS Post-Script + ap-pen-dix bit-map bit-maps + data-base data-bases eshell fall-ing half-way long-est man-u-script + man-u-scripts mini-buf-fer mini-buf-fers over-view par-a-digm + par-a-digms rath-er rec-tan-gu-lar ro-bot-ics se-vere-ly set-up spa-ces + spell-ing spell-ings + stand-alone strong-est time-stamp time-stamps which-ever white-space + wide-spread wrap-around +} + +% Margin to add to right of even pages, to left of odd pages. +\newdimen\bindingoffset +\newdimen\normaloffset +\newdimen\pagewidth \newdimen\pageheight + +% For a final copy, take out the rectangles +% that mark overfull boxes (in case you have decided +% that the text looks ok even though it passes the margin). +% +\def\finalout{\overfullrule=0pt} + +% @| inserts a changebar to the left of the current line. It should +% surround any changed text. This approach does *not* work if the +% change spans more than two lines of output. To handle that, we would +% have adopt a much more difficult approach (putting marks into the main +% vertical list for the beginning and end of each change). +% +\def\|{% + % \vadjust can only be used in horizontal mode. + \leavevmode + % + % Append this vertical mode material after the current line in the output. + \vadjust{% + % We want to insert a rule with the height and depth of the current + % leading; that is exactly what \strutbox is supposed to record. + \vskip-\baselineskip + % + % \vadjust-items are inserted at the left edge of the type. So + % the \llap here moves out into the left-hand margin. + \llap{% + % + % For a thicker or thinner bar, change the `1pt'. + \vrule height\baselineskip width1pt + % + % This is the space between the bar and the text. + \hskip 12pt + }% + }% +} + +% Sometimes it is convenient to have everything in the transcript file +% and nothing on the terminal. We don't just call \tracingall here, +% since that produces some useless output on the terminal. We also make +% some effort to order the tracing commands to reduce output in the log +% file; cf. trace.sty in LaTeX. +% +\def\gloggingall{\begingroup \globaldefs = 1 \loggingall \endgroup}% +\def\loggingall{% + \tracingstats2 + \tracingpages1 + \tracinglostchars2 % 2 gives us more in etex + \tracingparagraphs1 + \tracingoutput1 + \tracingmacros2 + \tracingrestores1 + \showboxbreadth\maxdimen \showboxdepth\maxdimen + \ifx\eTeXversion\undefined\else % etex gives us more logging + \tracingscantokens1 + \tracingifs1 + \tracinggroups1 + \tracingnesting2 + \tracingassigns1 + \fi + \tracingcommands3 % 3 gives us more in etex + \errorcontextlines16 +}% + +% add check for \lastpenalty to plain's definitions. If the last thing +% we did was a \nobreak, we don't want to insert more space. +% +\def\smallbreak{\ifnum\lastpenalty<10000\par\ifdim\lastskip<\smallskipamount + \removelastskip\penalty-50\smallskip\fi\fi} +\def\medbreak{\ifnum\lastpenalty<10000\par\ifdim\lastskip<\medskipamount + \removelastskip\penalty-100\medskip\fi\fi} +\def\bigbreak{\ifnum\lastpenalty<10000\par\ifdim\lastskip<\bigskipamount + \removelastskip\penalty-200\bigskip\fi\fi} + +% For @cropmarks command. +% Do @cropmarks to get crop marks. +% +\newif\ifcropmarks +\let\cropmarks = \cropmarkstrue +% +% Dimensions to add cropmarks at corners. +% Added by P. A. MacKay, 12 Nov. 1986 +% +\newdimen\outerhsize \newdimen\outervsize % set by the paper size routines +\newdimen\cornerlong \cornerlong=1pc +\newdimen\cornerthick \cornerthick=.3pt +\newdimen\topandbottommargin \topandbottommargin=.75in + +% Main output routine. +\chardef\PAGE = 255 +\output = {\onepageout{\pagecontents\PAGE}} + +\newbox\headlinebox +\newbox\footlinebox + +% \onepageout takes a vbox as an argument. Note that \pagecontents +% does insertions, but you have to call it yourself. +\def\onepageout#1{% + \ifcropmarks \hoffset=0pt \else \hoffset=\normaloffset \fi + % + \ifodd\pageno \advance\hoffset by \bindingoffset + \else \advance\hoffset by -\bindingoffset\fi + % + % Do this outside of the \shipout so @code etc. will be expanded in + % the headline as they should be, not taken literally (outputting ''code). + \setbox\headlinebox = \vbox{\let\hsize=\pagewidth \makeheadline}% + \setbox\footlinebox = \vbox{\let\hsize=\pagewidth \makefootline}% + % + {% + % Have to do this stuff outside the \shipout because we want it to + % take effect in \write's, yet the group defined by the \vbox ends + % before the \shipout runs. + % + \indexdummies % don't expand commands in the output. + \shipout\vbox{% + % Do this early so pdf references go to the beginning of the page. + \ifpdfmakepagedest \pdfdest name{\the\pageno} xyz\fi + % + \ifcropmarks \vbox to \outervsize\bgroup + \hsize = \outerhsize + \vskip-\topandbottommargin + \vtop to0pt{% + \line{\ewtop\hfil\ewtop}% + \nointerlineskip + \line{% + \vbox{\moveleft\cornerthick\nstop}% + \hfill + \vbox{\moveright\cornerthick\nstop}% + }% + \vss}% + \vskip\topandbottommargin + \line\bgroup + \hfil % center the page within the outer (page) hsize. + \ifodd\pageno\hskip\bindingoffset\fi + \vbox\bgroup + \fi + % + \unvbox\headlinebox + \pagebody{#1}% + \ifdim\ht\footlinebox > 0pt + % Only leave this space if the footline is nonempty. + % (We lessened \vsize for it in \oddfootingxxx.) + % The \baselineskip=24pt in plain's \makefootline has no effect. + \vskip 2\baselineskip + \unvbox\footlinebox + \fi + % + \ifcropmarks + \egroup % end of \vbox\bgroup + \hfil\egroup % end of (centering) \line\bgroup + \vskip\topandbottommargin plus1fill minus1fill + \boxmaxdepth = \cornerthick + \vbox to0pt{\vss + \line{% + \vbox{\moveleft\cornerthick\nsbot}% + \hfill + \vbox{\moveright\cornerthick\nsbot}% + }% + \nointerlineskip + \line{\ewbot\hfil\ewbot}% + }% + \egroup % \vbox from first cropmarks clause + \fi + }% end of \shipout\vbox + }% end of group with \indexdummies + \advancepageno + \ifnum\outputpenalty>-20000 \else\dosupereject\fi +} + +\newinsert\margin \dimen\margin=\maxdimen + +\def\pagebody#1{\vbox to\pageheight{\boxmaxdepth=\maxdepth #1}} +{\catcode`\@ =11 +\gdef\pagecontents#1{\ifvoid\topins\else\unvbox\topins\fi +% marginal hacks, juha@viisa.uucp (Juha Takala) +\ifvoid\margin\else % marginal info is present + \rlap{\kern\hsize\vbox to\z@{\kern1pt\box\margin \vss}}\fi +\dimen@=\dp#1 \unvbox#1 +\ifvoid\footins\else\vskip\skip\footins\footnoterule \unvbox\footins\fi +\ifr@ggedbottom \kern-\dimen@ \vfil \fi} +} + +% Here are the rules for the cropmarks. Note that they are +% offset so that the space between them is truly \outerhsize or \outervsize +% (P. A. MacKay, 12 November, 1986) +% +\def\ewtop{\vrule height\cornerthick depth0pt width\cornerlong} +\def\nstop{\vbox + {\hrule height\cornerthick depth\cornerlong width\cornerthick}} +\def\ewbot{\vrule height0pt depth\cornerthick width\cornerlong} +\def\nsbot{\vbox + {\hrule height\cornerlong depth\cornerthick width\cornerthick}} + +% Parse an argument, then pass it to #1. The argument is the rest of +% the input line (except we remove a trailing comment). #1 should be a +% macro which expects an ordinary undelimited TeX argument. +% +\def\parsearg{\parseargusing{}} +\def\parseargusing#1#2{% + \def\next{#2}% + \begingroup + \obeylines + \spaceisspace + #1% + \parseargline\empty% Insert the \empty token, see \finishparsearg below. +} + +{\obeylines % + \gdef\parseargline#1^^M{% + \endgroup % End of the group started in \parsearg. + \argremovecomment #1\comment\ArgTerm% + }% +} + +% First remove any @comment, then any @c comment. +\def\argremovecomment#1\comment#2\ArgTerm{\argremovec #1\c\ArgTerm} +\def\argremovec#1\c#2\ArgTerm{\argcheckspaces#1\^^M\ArgTerm} + +% Each occurence of `\^^M' or `\^^M' is replaced by a single space. +% +% \argremovec might leave us with trailing space, e.g., +% @end itemize @c foo +% This space token undergoes the same procedure and is eventually removed +% by \finishparsearg. +% +\def\argcheckspaces#1\^^M{\argcheckspacesX#1\^^M \^^M} +\def\argcheckspacesX#1 \^^M{\argcheckspacesY#1\^^M} +\def\argcheckspacesY#1\^^M#2\^^M#3\ArgTerm{% + \def\temp{#3}% + \ifx\temp\empty + % We cannot use \next here, as it holds the macro to run; + % thus we reuse \temp. + \let\temp\finishparsearg + \else + \let\temp\argcheckspaces + \fi + % Put the space token in: + \temp#1 #3\ArgTerm +} + +% If a _delimited_ argument is enclosed in braces, they get stripped; so +% to get _exactly_ the rest of the line, we had to prevent such situation. +% We prepended an \empty token at the very beginning and we expand it now, +% just before passing the control to \next. +% (Similarily, we have to think about #3 of \argcheckspacesY above: it is +% either the null string, or it ends with \^^M---thus there is no danger +% that a pair of braces would be stripped. +% +% But first, we have to remove the trailing space token. +% +\def\finishparsearg#1 \ArgTerm{\expandafter\next\expandafter{#1}} + +% \parseargdef\foo{...} +% is roughly equivalent to +% \def\foo{\parsearg\Xfoo} +% \def\Xfoo#1{...} +% +% Actually, I use \csname\string\foo\endcsname, ie. \\foo, as it is my +% favourite TeX trick. --kasal, 16nov03 + +\def\parseargdef#1{% + \expandafter \doparseargdef \csname\string#1\endcsname #1% +} +\def\doparseargdef#1#2{% + \def#2{\parsearg#1}% + \def#1##1% +} + +% Several utility definitions with active space: +{ + \obeyspaces + \gdef\obeyedspace{ } + + % Make each space character in the input produce a normal interword + % space in the output. Don't allow a line break at this space, as this + % is used only in environments like @example, where each line of input + % should produce a line of output anyway. + % + \gdef\sepspaces{\obeyspaces\let =\tie} + + % If an index command is used in an @example environment, any spaces + % therein should become regular spaces in the raw index file, not the + % expansion of \tie (\leavevmode \penalty \@M \ ). + \gdef\unsepspaces{\let =\space} +} + + +\def\flushcr{\ifx\par\lisppar \def\next##1{}\else \let\next=\relax \fi \next} + +% Define the framework for environments in texinfo.tex. It's used like this: +% +% \envdef\foo{...} +% \def\Efoo{...} +% +% It's the responsibility of \envdef to insert \begingroup before the +% actual body; @end closes the group after calling \Efoo. \envdef also +% defines \thisenv, so the current environment is known; @end checks +% whether the environment name matches. The \checkenv macro can also be +% used to check whether the current environment is the one expected. +% +% Non-false conditionals (@iftex, @ifset) don't fit into this, so they +% are not treated as enviroments; they don't open a group. (The +% implementation of @end takes care not to call \endgroup in this +% special case.) + + +% At runtime, environments start with this: +\def\startenvironment#1{\begingroup\def\thisenv{#1}} +% initialize +\let\thisenv\empty + +% ... but they get defined via ``\envdef\foo{...}'': +\long\def\envdef#1#2{\def#1{\startenvironment#1#2}} +\def\envparseargdef#1#2{\parseargdef#1{\startenvironment#1#2}} + +% Check whether we're in the right environment: +\def\checkenv#1{% + \def\temp{#1}% + \ifx\thisenv\temp + \else + \badenverr + \fi +} + +% Evironment mismatch, #1 expected: +\def\badenverr{% + \errhelp = \EMsimple + \errmessage{This command can appear only \inenvironment\temp, + not \inenvironment\thisenv}% +} +\def\inenvironment#1{% + \ifx#1\empty + out of any environment% + \else + in environment \expandafter\string#1% + \fi +} + +% @end foo executes the definition of \Efoo. +% But first, it executes a specialized version of \checkenv +% +\parseargdef\end{% + \if 1\csname iscond.#1\endcsname + \else + % The general wording of \badenverr may not be ideal, but... --kasal, 06nov03 + \expandafter\checkenv\csname#1\endcsname + \csname E#1\endcsname + \endgroup + \fi +} + +\newhelp\EMsimple{Press RETURN to continue.} + + +%% Simple single-character @ commands + +% @@ prints an @ +% Kludge this until the fonts are right (grr). +\def\@{{\tt\char64}} + +% This is turned off because it was never documented +% and you can use @w{...} around a quote to suppress ligatures. +%% Define @` and @' to be the same as ` and ' +%% but suppressing ligatures. +%\def\`{{`}} +%\def\'{{'}} + +% Used to generate quoted braces. +\def\mylbrace {{\tt\char123}} +\def\myrbrace {{\tt\char125}} +\let\{=\mylbrace +\let\}=\myrbrace +\begingroup + % Definitions to produce \{ and \} commands for indices, + % and @{ and @} for the aux/toc files. + \catcode`\{ = \other \catcode`\} = \other + \catcode`\[ = 1 \catcode`\] = 2 + \catcode`\! = 0 \catcode`\\ = \other + !gdef!lbracecmd[\{]% + !gdef!rbracecmd[\}]% + !gdef!lbraceatcmd[@{]% + !gdef!rbraceatcmd[@}]% +!endgroup + +% @comma{} to avoid , parsing problems. +\let\comma = , + +% Accents: @, @dotaccent @ringaccent @ubaraccent @udotaccent +% Others are defined by plain TeX: @` @' @" @^ @~ @= @u @v @H. +\let\, = \c +\let\dotaccent = \. +\def\ringaccent#1{{\accent23 #1}} +\let\tieaccent = \t +\let\ubaraccent = \b +\let\udotaccent = \d + +% Other special characters: @questiondown @exclamdown @ordf @ordm +% Plain TeX defines: @AA @AE @O @OE @L (plus lowercase versions) @ss. +\def\questiondown{?`} +\def\exclamdown{!`} +\def\ordf{\leavevmode\raise1ex\hbox{\selectfonts\lllsize \underbar{a}}} +\def\ordm{\leavevmode\raise1ex\hbox{\selectfonts\lllsize \underbar{o}}} + +% Dotless i and dotless j, used for accents. +\def\imacro{i} +\def\jmacro{j} +\def\dotless#1{% + \def\temp{#1}% + \ifx\temp\imacro \ptexi + \else\ifx\temp\jmacro \j + \else \errmessage{@dotless can be used only with i or j}% + \fi\fi +} + +% The \TeX{} logo, as in plain, but resetting the spacing so that a +% period following counts as ending a sentence. (Idea found in latex.) +% +\edef\TeX{\TeX \spacefactor=1000 } + +% @LaTeX{} logo. Not quite the same results as the definition in +% latex.ltx, since we use a different font for the raised A; it's most +% convenient for us to use an explicitly smaller font, rather than using +% the \scriptstyle font (since we don't reset \scriptstyle and +% \scriptscriptstyle). +% +\def\LaTeX{% + L\kern-.36em + {\setbox0=\hbox{T}% + \vbox to \ht0{\hbox{\selectfonts\lllsize A}\vss}}% + \kern-.15em + \TeX +} + +% Be sure we're in horizontal mode when doing a tie, since we make space +% equivalent to this in @example-like environments. Otherwise, a space +% at the beginning of a line will start with \penalty -- and +% since \penalty is valid in vertical mode, we'd end up putting the +% penalty on the vertical list instead of in the new paragraph. +{\catcode`@ = 11 + % Avoid using \@M directly, because that causes trouble + % if the definition is written into an index file. + \global\let\tiepenalty = \@M + \gdef\tie{\leavevmode\penalty\tiepenalty\ } +} + +% @: forces normal size whitespace following. +\def\:{\spacefactor=1000 } + +% @* forces a line break. +\def\*{\hfil\break\hbox{}\ignorespaces} + +% @/ allows a line break. +\let\/=\allowbreak + +% @. is an end-of-sentence period. +\def\.{.\spacefactor=\endofsentencespacefactor\space} + +% @! is an end-of-sentence bang. +\def\!{!\spacefactor=\endofsentencespacefactor\space} + +% @? is an end-of-sentence query. +\def\?{?\spacefactor=\endofsentencespacefactor\space} + +% @frenchspacing on|off says whether to put extra space after punctuation. +% +\def\onword{on} +\def\offword{off} +% +\parseargdef\frenchspacing{% + \def\temp{#1}% + \ifx\temp\onword \plainfrenchspacing + \else\ifx\temp\offword \plainnonfrenchspacing + \else + \errhelp = \EMsimple + \errmessage{Unknown @frenchspacing option `\temp', must be on/off}% + \fi\fi +} + +% @w prevents a word break. Without the \leavevmode, @w at the +% beginning of a paragraph, when TeX is still in vertical mode, would +% produce a whole line of output instead of starting the paragraph. +\def\w#1{\leavevmode\hbox{#1}} + +% @group ... @end group forces ... to be all on one page, by enclosing +% it in a TeX vbox. We use \vtop instead of \vbox to construct the box +% to keep its height that of a normal line. According to the rules for +% \topskip (p.114 of the TeXbook), the glue inserted is +% max (\topskip - \ht (first item), 0). If that height is large, +% therefore, no glue is inserted, and the space between the headline and +% the text is small, which looks bad. +% +% Another complication is that the group might be very large. This can +% cause the glue on the previous page to be unduly stretched, because it +% does not have much material. In this case, it's better to add an +% explicit \vfill so that the extra space is at the bottom. The +% threshold for doing this is if the group is more than \vfilllimit +% percent of a page (\vfilllimit can be changed inside of @tex). +% +\newbox\groupbox +\def\vfilllimit{0.7} +% +\envdef\group{% + \ifnum\catcode`\^^M=\active \else + \errhelp = \groupinvalidhelp + \errmessage{@group invalid in context where filling is enabled}% + \fi + \startsavinginserts + % + \setbox\groupbox = \vtop\bgroup + % Do @comment since we are called inside an environment such as + % @example, where each end-of-line in the input causes an + % end-of-line in the output. We don't want the end-of-line after + % the `@group' to put extra space in the output. Since @group + % should appear on a line by itself (according to the Texinfo + % manual), we don't worry about eating any user text. + \comment +} +% +% The \vtop produces a box with normal height and large depth; thus, TeX puts +% \baselineskip glue before it, and (when the next line of text is done) +% \lineskip glue after it. Thus, space below is not quite equal to space +% above. But it's pretty close. +\def\Egroup{% + % To get correct interline space between the last line of the group + % and the first line afterwards, we have to propagate \prevdepth. + \endgraf % Not \par, as it may have been set to \lisppar. + \global\dimen1 = \prevdepth + \egroup % End the \vtop. + % \dimen0 is the vertical size of the group's box. + \dimen0 = \ht\groupbox \advance\dimen0 by \dp\groupbox + % \dimen2 is how much space is left on the page (more or less). + \dimen2 = \pageheight \advance\dimen2 by -\pagetotal + % if the group doesn't fit on the current page, and it's a big big + % group, force a page break. + \ifdim \dimen0 > \dimen2 + \ifdim \pagetotal < \vfilllimit\pageheight + \page + \fi + \fi + \box\groupbox + \prevdepth = \dimen1 + \checkinserts +} +% +% TeX puts in an \escapechar (i.e., `@') at the beginning of the help +% message, so this ends up printing `@group can only ...'. +% +\newhelp\groupinvalidhelp{% +group can only be used in environments such as @example,^^J% +where each line of input produces a line of output.} + +% @need space-in-mils +% forces a page break if there is not space-in-mils remaining. + +\newdimen\mil \mil=0.001in + +% Old definition--didn't work. +%\parseargdef\need{\par % +%% This method tries to make TeX break the page naturally +%% if the depth of the box does not fit. +%{\baselineskip=0pt% +%\vtop to #1\mil{\vfil}\kern -#1\mil\nobreak +%\prevdepth=-1000pt +%}} + +\parseargdef\need{% + % Ensure vertical mode, so we don't make a big box in the middle of a + % paragraph. + \par + % + % If the @need value is less than one line space, it's useless. + \dimen0 = #1\mil + \dimen2 = \ht\strutbox + \advance\dimen2 by \dp\strutbox + \ifdim\dimen0 > \dimen2 + % + % Do a \strut just to make the height of this box be normal, so the + % normal leading is inserted relative to the preceding line. + % And a page break here is fine. + \vtop to #1\mil{\strut\vfil}% + % + % TeX does not even consider page breaks if a penalty added to the + % main vertical list is 10000 or more. But in order to see if the + % empty box we just added fits on the page, we must make it consider + % page breaks. On the other hand, we don't want to actually break the + % page after the empty box. So we use a penalty of 9999. + % + % There is an extremely small chance that TeX will actually break the + % page at this \penalty, if there are no other feasible breakpoints in + % sight. (If the user is using lots of big @group commands, which + % almost-but-not-quite fill up a page, TeX will have a hard time doing + % good page breaking, for example.) However, I could not construct an + % example where a page broke at this \penalty; if it happens in a real + % document, then we can reconsider our strategy. + \penalty9999 + % + % Back up by the size of the box, whether we did a page break or not. + \kern -#1\mil + % + % Do not allow a page break right after this kern. + \nobreak + \fi +} + +% @br forces paragraph break (and is undocumented). + +\let\br = \par + +% @page forces the start of a new page. +% +\def\page{\par\vfill\supereject} + +% @exdent text.... +% outputs text on separate line in roman font, starting at standard page margin + +% This records the amount of indent in the innermost environment. +% That's how much \exdent should take out. +\newskip\exdentamount + +% This defn is used inside fill environments such as @defun. +\parseargdef\exdent{\hfil\break\hbox{\kern -\exdentamount{\rm#1}}\hfil\break} + +% This defn is used inside nofill environments such as @example. +\parseargdef\nofillexdent{{\advance \leftskip by -\exdentamount + \leftline{\hskip\leftskip{\rm#1}}}} + +% @inmargin{WHICH}{TEXT} puts TEXT in the WHICH margin next to the current +% paragraph. For more general purposes, use the \margin insertion +% class. WHICH is `l' or `r'. +% +\newskip\inmarginspacing \inmarginspacing=1cm +\def\strutdepth{\dp\strutbox} +% +\def\doinmargin#1#2{\strut\vadjust{% + \nobreak + \kern-\strutdepth + \vtop to \strutdepth{% + \baselineskip=\strutdepth + \vss + % if you have multiple lines of stuff to put here, you'll need to + % make the vbox yourself of the appropriate size. + \ifx#1l% + \llap{\ignorespaces #2\hskip\inmarginspacing}% + \else + \rlap{\hskip\hsize \hskip\inmarginspacing \ignorespaces #2}% + \fi + \null + }% +}} +\def\inleftmargin{\doinmargin l} +\def\inrightmargin{\doinmargin r} +% +% @inmargin{TEXT [, RIGHT-TEXT]} +% (if RIGHT-TEXT is given, use TEXT for left page, RIGHT-TEXT for right; +% else use TEXT for both). +% +\def\inmargin#1{\parseinmargin #1,,\finish} +\def\parseinmargin#1,#2,#3\finish{% not perfect, but better than nothing. + \setbox0 = \hbox{\ignorespaces #2}% + \ifdim\wd0 > 0pt + \def\lefttext{#1}% have both texts + \def\righttext{#2}% + \else + \def\lefttext{#1}% have only one text + \def\righttext{#1}% + \fi + % + \ifodd\pageno + \def\temp{\inrightmargin\righttext}% odd page -> outside is right margin + \else + \def\temp{\inleftmargin\lefttext}% + \fi + \temp +} + +% @include file insert text of that file as input. +% +\def\include{\parseargusing\filenamecatcodes\includezzz} +\def\includezzz#1{% + \pushthisfilestack + \def\thisfile{#1}% + {% + \makevalueexpandable + \def\temp{\input #1 }% + \expandafter + }\temp + \popthisfilestack +} +\def\filenamecatcodes{% + \catcode`\\=\other + \catcode`~=\other + \catcode`^=\other + \catcode`_=\other + \catcode`|=\other + \catcode`<=\other + \catcode`>=\other + \catcode`+=\other + \catcode`-=\other +} + +\def\pushthisfilestack{% + \expandafter\pushthisfilestackX\popthisfilestack\StackTerm +} +\def\pushthisfilestackX{% + \expandafter\pushthisfilestackY\thisfile\StackTerm +} +\def\pushthisfilestackY #1\StackTerm #2\StackTerm {% + \gdef\popthisfilestack{\gdef\thisfile{#1}\gdef\popthisfilestack{#2}}% +} + +\def\popthisfilestack{\errthisfilestackempty} +\def\errthisfilestackempty{\errmessage{Internal error: + the stack of filenames is empty.}} + +\def\thisfile{} + +% @center line +% outputs that line, centered. +% +\parseargdef\center{% + \ifhmode + \let\next\centerH + \else + \let\next\centerV + \fi + \next{\hfil \ignorespaces#1\unskip \hfil}% +} +\def\centerH#1{% + {% + \hfil\break + \advance\hsize by -\leftskip + \advance\hsize by -\rightskip + \line{#1}% + \break + }% +} +\def\centerV#1{\line{\kern\leftskip #1\kern\rightskip}} + +% @sp n outputs n lines of vertical space + +\parseargdef\sp{\vskip #1\baselineskip} + +% @comment ...line which is ignored... +% @c is the same as @comment +% @ignore ... @end ignore is another way to write a comment + +\def\comment{\begingroup \catcode`\^^M=\other% +\catcode`\@=\other \catcode`\{=\other \catcode`\}=\other% +\commentxxx} +{\catcode`\^^M=\other \gdef\commentxxx#1^^M{\endgroup}} + +\let\c=\comment + +% @paragraphindent NCHARS +% We'll use ems for NCHARS, close enough. +% NCHARS can also be the word `asis' or `none'. +% We cannot feasibly implement @paragraphindent asis, though. +% +\def\asisword{asis} % no translation, these are keywords +\def\noneword{none} +% +\parseargdef\paragraphindent{% + \def\temp{#1}% + \ifx\temp\asisword + \else + \ifx\temp\noneword + \defaultparindent = 0pt + \else + \defaultparindent = #1em + \fi + \fi + \parindent = \defaultparindent +} + +% @exampleindent NCHARS +% We'll use ems for NCHARS like @paragraphindent. +% It seems @exampleindent asis isn't necessary, but +% I preserve it to make it similar to @paragraphindent. +\parseargdef\exampleindent{% + \def\temp{#1}% + \ifx\temp\asisword + \else + \ifx\temp\noneword + \lispnarrowing = 0pt + \else + \lispnarrowing = #1em + \fi + \fi +} + +% @firstparagraphindent WORD +% If WORD is `none', then suppress indentation of the first paragraph +% after a section heading. If WORD is `insert', then do indent at such +% paragraphs. +% +% The paragraph indentation is suppressed or not by calling +% \suppressfirstparagraphindent, which the sectioning commands do. +% We switch the definition of this back and forth according to WORD. +% By default, we suppress indentation. +% +\def\suppressfirstparagraphindent{\dosuppressfirstparagraphindent} +\def\insertword{insert} +% +\parseargdef\firstparagraphindent{% + \def\temp{#1}% + \ifx\temp\noneword + \let\suppressfirstparagraphindent = \dosuppressfirstparagraphindent + \else\ifx\temp\insertword + \let\suppressfirstparagraphindent = \relax + \else + \errhelp = \EMsimple + \errmessage{Unknown @firstparagraphindent option `\temp'}% + \fi\fi +} + +% Here is how we actually suppress indentation. Redefine \everypar to +% \kern backwards by \parindent, and then reset itself to empty. +% +% We also make \indent itself not actually do anything until the next +% paragraph. +% +\gdef\dosuppressfirstparagraphindent{% + \gdef\indent{% + \restorefirstparagraphindent + \indent + }% + \gdef\noindent{% + \restorefirstparagraphindent + \noindent + }% + \global\everypar = {% + \kern -\parindent + \restorefirstparagraphindent + }% +} + +\gdef\restorefirstparagraphindent{% + \global \let \indent = \ptexindent + \global \let \noindent = \ptexnoindent + \global \everypar = {}% +} + + +% @asis just yields its argument. Used with @table, for example. +% +\def\asis#1{#1} + +% @math outputs its argument in math mode. +% +% One complication: _ usually means subscripts, but it could also mean +% an actual _ character, as in @math{@var{some_variable} + 1}. So make +% _ active, and distinguish by seeing if the current family is \slfam, +% which is what @var uses. +{ + \catcode\underChar = \active + \gdef\mathunderscore{% + \catcode\underChar=\active + \def_{\ifnum\fam=\slfam \_\else\sb\fi}% + } +} +% Another complication: we want \\ (and @\) to output a \ character. +% FYI, plain.tex uses \\ as a temporary control sequence (why?), but +% this is not advertised and we don't care. Texinfo does not +% otherwise define @\. +% +% The \mathchar is class=0=ordinary, family=7=ttfam, position=5C=\. +\def\mathbackslash{\ifnum\fam=\ttfam \mathchar"075C \else\backslash \fi} +% +\def\math{% + \tex + \mathunderscore + \let\\ = \mathbackslash + \mathactive + $\finishmath +} +\def\finishmath#1{#1$\endgroup} % Close the group opened by \tex. + +% Some active characters (such as <) are spaced differently in math. +% We have to reset their definitions in case the @math was an argument +% to a command which sets the catcodes (such as @item or @section). +% +{ + \catcode`^ = \active + \catcode`< = \active + \catcode`> = \active + \catcode`+ = \active + \gdef\mathactive{% + \let^ = \ptexhat + \let< = \ptexless + \let> = \ptexgtr + \let+ = \ptexplus + } +} + +% @bullet and @minus need the same treatment as @math, just above. +\def\bullet{$\ptexbullet$} +\def\minus{$-$} + +% @dots{} outputs an ellipsis using the current font. +% We do .5em per period so that it has the same spacing in a typewriter +% font as three actual period characters. +% +\def\dots{% + \leavevmode + \hbox to 1.5em{% + \hskip 0pt plus 0.25fil + .\hfil.\hfil.% + \hskip 0pt plus 0.5fil + }% +} + +% @enddots{} is an end-of-sentence ellipsis. +% +\def\enddots{% + \dots + \spacefactor=\endofsentencespacefactor +} + +% @comma{} is so commas can be inserted into text without messing up +% Texinfo's parsing. +% +\let\comma = , + +% @refill is a no-op. +\let\refill=\relax + +% If working on a large document in chapters, it is convenient to +% be able to disable indexing, cross-referencing, and contents, for test runs. +% This is done with @novalidate (before @setfilename). +% +\newif\iflinks \linkstrue % by default we want the aux files. +\let\novalidate = \linksfalse + +% @setfilename is done at the beginning of every texinfo file. +% So open here the files we need to have open while reading the input. +% This makes it possible to make a .fmt file for texinfo. +\def\setfilename{% + \fixbackslash % Turn off hack to swallow `\input texinfo'. + \iflinks + \tryauxfile + % Open the new aux file. TeX will close it automatically at exit. + \immediate\openout\auxfile=\jobname.aux + \fi % \openindices needs to do some work in any case. + \openindices + \let\setfilename=\comment % Ignore extra @setfilename cmds. + % + % If texinfo.cnf is present on the system, read it. + % Useful for site-wide @afourpaper, etc. + \openin 1 texinfo.cnf + \ifeof 1 \else \input texinfo.cnf \fi + \closein 1 + % + \comment % Ignore the actual filename. +} + +% Called from \setfilename. +% +\def\openindices{% + \newindex{cp}% + \newcodeindex{fn}% + \newcodeindex{vr}% + \newcodeindex{tp}% + \newcodeindex{ky}% + \newcodeindex{pg}% +} + +% @bye. +\outer\def\bye{\pagealignmacro\tracingstats=1\ptexend} + + +\message{pdf,} +% adobe `portable' document format +\newcount\tempnum +\newcount\lnkcount +\newtoks\filename +\newcount\filenamelength +\newcount\pgn +\newtoks\toksA +\newtoks\toksB +\newtoks\toksC +\newtoks\toksD +\newbox\boxA +\newcount\countA +\newif\ifpdf +\newif\ifpdfmakepagedest + +% when pdftex is run in dvi mode, \pdfoutput is defined (so \pdfoutput=1 +% can be set). So we test for \relax and 0 as well as \undefined, +% borrowed from ifpdf.sty. +\ifx\pdfoutput\undefined +\else + \ifx\pdfoutput\relax + \else + \ifcase\pdfoutput + \else + \pdftrue + \fi + \fi +\fi + +% PDF uses PostScript string constants for the names of xref targets, to +% for display in the outlines, and in other places. Thus, we have to +% double any backslashes. Otherwise, a name like "\node" will be +% interpreted as a newline (\n), followed by o, d, e. Not good. +% http://www.ntg.nl/pipermail/ntg-pdftex/2004-July/000654.html +% (and related messages, the final outcome is that it is up to the TeX +% user to double the backslashes and otherwise make the string valid, so +% that's we do). + +% double active backslashes. +% +{\catcode`\@=0 \catcode`\\=\active + @gdef@activebackslash{@catcode`@\=@active @otherbackslash} + @gdef@activebackslashdouble{% + @catcode@backChar=@active + @let\=@doublebackslash} +} + +% To handle parens, we must adopt a different approach, since parens are +% not active characters. hyperref.dtx (which has the same problem as +% us) handles it with this amazing macro to replace tokens. I've +% tinkered with it a little for texinfo, but it's definitely from there. +% +% #1 is the tokens to replace. +% #2 is the replacement. +% #3 is the control sequence with the string. +% +\def\HyPsdSubst#1#2#3{% + \def\HyPsdReplace##1#1##2\END{% + ##1% + \ifx\\##2\\% + \else + #2% + \HyReturnAfterFi{% + \HyPsdReplace##2\END + }% + \fi + }% + \xdef#3{\expandafter\HyPsdReplace#3#1\END}% +} +\long\def\HyReturnAfterFi#1\fi{\fi#1} + +% #1 is a control sequence in which to do the replacements. +\def\backslashparens#1{% + \xdef#1{#1}% redefine it as its expansion; the definition is simply + % \lastnode when called from \setref -> \pdfmkdest. + \HyPsdSubst{(}{\backslashlparen}{#1}% + \HyPsdSubst{)}{\backslashrparen}{#1}% +} + +{\catcode\exclamChar = 0 \catcode\backChar = \other + !gdef!backslashlparen{\(}% + !gdef!backslashrparen{\)}% +} + +\ifpdf + \input pdfcolor + \pdfcatalog{/PageMode /UseOutlines}% + \def\dopdfimage#1#2#3{% + \def\imagewidth{#2}% + \def\imageheight{#3}% + % without \immediate, pdftex seg faults when the same image is + % included twice. (Version 3.14159-pre-1.0-unofficial-20010704.) + \ifnum\pdftexversion < 14 + \immediate\pdfimage + \else + \immediate\pdfximage + \fi + \ifx\empty\imagewidth\else width \imagewidth \fi + \ifx\empty\imageheight\else height \imageheight \fi + \ifnum\pdftexversion<13 + #1.pdf% + \else + {#1.pdf}% + \fi + \ifnum\pdftexversion < 14 \else + \pdfrefximage \pdflastximage + \fi} + \def\pdfmkdest#1{{% + % We have to set dummies so commands such as @code, and characters + % such as \, aren't expanded when present in a section title. + \atdummies + \activebackslashdouble + \def\pdfdestname{#1}% + \backslashparens\pdfdestname + \pdfdest name{\pdfdestname} xyz% + }}% + % + % used to mark target names; must be expandable. + \def\pdfmkpgn#1{#1}% + % + \let\linkcolor = \Blue % was Cyan, but that seems light? + \def\endlink{\Black\pdfendlink} + % Adding outlines to PDF; macros for calculating structure of outlines + % come from Petr Olsak + \def\expnumber#1{\expandafter\ifx\csname#1\endcsname\relax 0% + \else \csname#1\endcsname \fi} + \def\advancenumber#1{\tempnum=\expnumber{#1}\relax + \advance\tempnum by 1 + \expandafter\xdef\csname#1\endcsname{\the\tempnum}} + % + % #1 is the section text, which is what will be displayed in the + % outline by the pdf viewer. #2 is the pdf expression for the number + % of subentries (or empty, for subsubsections). #3 is the node text, + % which might be empty if this toc entry had no corresponding node. + % #4 is the page number + % + \def\dopdfoutline#1#2#3#4{% + % Generate a link to the node text if that exists; else, use the + % page number. We could generate a destination for the section + % text in the case where a section has no node, but it doesn't + % seem worth the trouble, since most documents are normally structured. + \def\pdfoutlinedest{#3}% + \ifx\pdfoutlinedest\empty + \def\pdfoutlinedest{#4}% + \else + % Doubled backslashes in the name. + {\activebackslashdouble \xdef\pdfoutlinedest{#3}% + \backslashparens\pdfoutlinedest}% + \fi + % + % Also double the backslashes in the display string. + {\activebackslashdouble \xdef\pdfoutlinetext{#1}% + \backslashparens\pdfoutlinetext}% + % + \pdfoutline goto name{\pdfmkpgn{\pdfoutlinedest}}#2{\pdfoutlinetext}% + } + % + \def\pdfmakeoutlines{% + \begingroup + % Thanh's hack / proper braces in bookmarks + \edef\mylbrace{\iftrue \string{\else}\fi}\let\{=\mylbrace + \edef\myrbrace{\iffalse{\else\string}\fi}\let\}=\myrbrace + % + % Read toc silently, to get counts of subentries for \pdfoutline. + \def\numchapentry##1##2##3##4{% + \def\thischapnum{##2}% + \def\thissecnum{0}% + \def\thissubsecnum{0}% + }% + \def\numsecentry##1##2##3##4{% + \advancenumber{chap\thischapnum}% + \def\thissecnum{##2}% + \def\thissubsecnum{0}% + }% + \def\numsubsecentry##1##2##3##4{% + \advancenumber{sec\thissecnum}% + \def\thissubsecnum{##2}% + }% + \def\numsubsubsecentry##1##2##3##4{% + \advancenumber{subsec\thissubsecnum}% + }% + \def\thischapnum{0}% + \def\thissecnum{0}% + \def\thissubsecnum{0}% + % + % use \def rather than \let here because we redefine \chapentry et + % al. a second time, below. + \def\appentry{\numchapentry}% + \def\appsecentry{\numsecentry}% + \def\appsubsecentry{\numsubsecentry}% + \def\appsubsubsecentry{\numsubsubsecentry}% + \def\unnchapentry{\numchapentry}% + \def\unnsecentry{\numsecentry}% + \def\unnsubsecentry{\numsubsecentry}% + \def\unnsubsubsecentry{\numsubsubsecentry}% + \readdatafile{toc}% + % + % Read toc second time, this time actually producing the outlines. + % The `-' means take the \expnumber as the absolute number of + % subentries, which we calculated on our first read of the .toc above. + % + % We use the node names as the destinations. + \def\numchapentry##1##2##3##4{% + \dopdfoutline{##1}{count-\expnumber{chap##2}}{##3}{##4}}% + \def\numsecentry##1##2##3##4{% + \dopdfoutline{##1}{count-\expnumber{sec##2}}{##3}{##4}}% + \def\numsubsecentry##1##2##3##4{% + \dopdfoutline{##1}{count-\expnumber{subsec##2}}{##3}{##4}}% + \def\numsubsubsecentry##1##2##3##4{% count is always zero + \dopdfoutline{##1}{}{##3}{##4}}% + % + % PDF outlines are displayed using system fonts, instead of + % document fonts. Therefore we cannot use special characters, + % since the encoding is unknown. For example, the eogonek from + % Latin 2 (0xea) gets translated to a | character. Info from + % Staszek Wawrykiewicz, 19 Jan 2004 04:09:24 +0100. + % + % xx to do this right, we have to translate 8-bit characters to + % their "best" equivalent, based on the @documentencoding. Right + % now, I guess we'll just let the pdf reader have its way. + \indexnofonts + \setupdatafile + \activebackslash + \input \jobname.toc + \endgroup + } + % + \def\skipspaces#1{\def\PP{#1}\def\D{|}% + \ifx\PP\D\let\nextsp\relax + \else\let\nextsp\skipspaces + \ifx\p\space\else\addtokens{\filename}{\PP}% + \advance\filenamelength by 1 + \fi + \fi + \nextsp} + \def\getfilename#1{\filenamelength=0\expandafter\skipspaces#1|\relax} + \ifnum\pdftexversion < 14 + \let \startlink \pdfannotlink + \else + \let \startlink \pdfstartlink + \fi + \def\pdfurl#1{% + \begingroup + \normalturnoffactive\def\@{@}% + \makevalueexpandable + \leavevmode\Red + \startlink attr{/Border [0 0 0]}% + user{/Subtype /Link /A << /S /URI /URI (#1) >>}% + \endgroup} + \def\pdfgettoks#1.{\setbox\boxA=\hbox{\toksA={#1.}\toksB={}\maketoks}} + \def\addtokens#1#2{\edef\addtoks{\noexpand#1={\the#1#2}}\addtoks} + \def\adn#1{\addtokens{\toksC}{#1}\global\countA=1\let\next=\maketoks} + \def\poptoks#1#2|ENDTOKS|{\let\first=#1\toksD={#1}\toksA={#2}} + \def\maketoks{% + \expandafter\poptoks\the\toksA|ENDTOKS|\relax + \ifx\first0\adn0 + \else\ifx\first1\adn1 \else\ifx\first2\adn2 \else\ifx\first3\adn3 + \else\ifx\first4\adn4 \else\ifx\first5\adn5 \else\ifx\first6\adn6 + \else\ifx\first7\adn7 \else\ifx\first8\adn8 \else\ifx\first9\adn9 + \else + \ifnum0=\countA\else\makelink\fi + \ifx\first.\let\next=\done\else + \let\next=\maketoks + \addtokens{\toksB}{\the\toksD} + \ifx\first,\addtokens{\toksB}{\space}\fi + \fi + \fi\fi\fi\fi\fi\fi\fi\fi\fi\fi + \next} + \def\makelink{\addtokens{\toksB}% + {\noexpand\pdflink{\the\toksC}}\toksC={}\global\countA=0} + \def\pdflink#1{% + \startlink attr{/Border [0 0 0]} goto name{\pdfmkpgn{#1}} + \linkcolor #1\endlink} + \def\done{\edef\st{\global\noexpand\toksA={\the\toksB}}\st} +\else + \let\pdfmkdest = \gobble + \let\pdfurl = \gobble + \let\endlink = \relax + \let\linkcolor = \relax + \let\pdfmakeoutlines = \relax +\fi % \ifx\pdfoutput + + +\message{fonts,} + +% Change the current font style to #1, remembering it in \curfontstyle. +% For now, we do not accumulate font styles: @b{@i{foo}} prints foo in +% italics, not bold italics. +% +\def\setfontstyle#1{% + \def\curfontstyle{#1}% not as a control sequence, because we are \edef'd. + \csname ten#1\endcsname % change the current font +} + +% Select #1 fonts with the current style. +% +\def\selectfonts#1{\csname #1fonts\endcsname \csname\curfontstyle\endcsname} + +\def\rm{\fam=0 \setfontstyle{rm}} +\def\it{\fam=\itfam \setfontstyle{it}} +\def\sl{\fam=\slfam \setfontstyle{sl}} +\def\bf{\fam=\bffam \setfontstyle{bf}}\def\bfstylename{bf} +\def\tt{\fam=\ttfam \setfontstyle{tt}} + +% Texinfo sort of supports the sans serif font style, which plain TeX does not. +% So we set up a \sf. +\newfam\sffam +\def\sf{\fam=\sffam \setfontstyle{sf}} +\let\li = \sf % Sometimes we call it \li, not \sf. + +% We don't need math for this font style. +\def\ttsl{\setfontstyle{ttsl}} + +% Default leading. +\newdimen\textleading \textleading = 13.2pt + +% Set the baselineskip to #1, and the lineskip and strut size +% correspondingly. There is no deep meaning behind these magic numbers +% used as factors; they just match (closely enough) what Knuth defined. +% +\def\lineskipfactor{.08333} +\def\strutheightpercent{.70833} +\def\strutdepthpercent {.29167} +% +\def\setleading#1{% + \normalbaselineskip = #1\relax + \normallineskip = \lineskipfactor\normalbaselineskip + \normalbaselines + \setbox\strutbox =\hbox{% + \vrule width0pt height\strutheightpercent\baselineskip + depth \strutdepthpercent \baselineskip + }% +} + +% Set the font macro #1 to the font named #2, adding on the +% specified font prefix (normally `cm'). +% #3 is the font's design size, #4 is a scale factor +\def\setfont#1#2#3#4{\font#1=\fontprefix#2#3 scaled #4} + +% Use cm as the default font prefix. +% To specify the font prefix, you must define \fontprefix +% before you read in texinfo.tex. +\ifx\fontprefix\undefined +\def\fontprefix{cm} +\fi +% Support font families that don't use the same naming scheme as CM. +\def\rmshape{r} +\def\rmbshape{bx} %where the normal face is bold +\def\bfshape{b} +\def\bxshape{bx} +\def\ttshape{tt} +\def\ttbshape{tt} +\def\ttslshape{sltt} +\def\itshape{ti} +\def\itbshape{bxti} +\def\slshape{sl} +\def\slbshape{bxsl} +\def\sfshape{ss} +\def\sfbshape{ss} +\def\scshape{csc} +\def\scbshape{csc} + +% Text fonts (11.2pt, magstep1). +\def\textnominalsize{11pt} +\edef\mainmagstep{\magstephalf} +\setfont\textrm\rmshape{10}{\mainmagstep} +\setfont\texttt\ttshape{10}{\mainmagstep} +\setfont\textbf\bfshape{10}{\mainmagstep} +\setfont\textit\itshape{10}{\mainmagstep} +\setfont\textsl\slshape{10}{\mainmagstep} +\setfont\textsf\sfshape{10}{\mainmagstep} +\setfont\textsc\scshape{10}{\mainmagstep} +\setfont\textttsl\ttslshape{10}{\mainmagstep} +\font\texti=cmmi10 scaled \mainmagstep +\font\textsy=cmsy10 scaled \mainmagstep + +% A few fonts for @defun names and args. +\setfont\defbf\bfshape{10}{\magstep1} +\setfont\deftt\ttshape{10}{\magstep1} +\setfont\defttsl\ttslshape{10}{\magstep1} +\def\df{\let\tentt=\deftt \let\tenbf = \defbf \let\tenttsl=\defttsl \bf} + +% Fonts for indices, footnotes, small examples (9pt). +\def\smallnominalsize{9pt} +\setfont\smallrm\rmshape{9}{1000} +\setfont\smalltt\ttshape{9}{1000} +\setfont\smallbf\bfshape{10}{900} +\setfont\smallit\itshape{9}{1000} +\setfont\smallsl\slshape{9}{1000} +\setfont\smallsf\sfshape{9}{1000} +\setfont\smallsc\scshape{10}{900} +\setfont\smallttsl\ttslshape{10}{900} +\font\smalli=cmmi9 +\font\smallsy=cmsy9 + +% Fonts for small examples (8pt). +\def\smallernominalsize{8pt} +\setfont\smallerrm\rmshape{8}{1000} +\setfont\smallertt\ttshape{8}{1000} +\setfont\smallerbf\bfshape{10}{800} +\setfont\smallerit\itshape{8}{1000} +\setfont\smallersl\slshape{8}{1000} +\setfont\smallersf\sfshape{8}{1000} +\setfont\smallersc\scshape{10}{800} +\setfont\smallerttsl\ttslshape{10}{800} +\font\smalleri=cmmi8 +\font\smallersy=cmsy8 + +% Fonts for title page (20.4pt): +\def\titlenominalsize{20pt} +\setfont\titlerm\rmbshape{12}{\magstep3} +\setfont\titleit\itbshape{10}{\magstep4} +\setfont\titlesl\slbshape{10}{\magstep4} +\setfont\titlett\ttbshape{12}{\magstep3} +\setfont\titlettsl\ttslshape{10}{\magstep4} +\setfont\titlesf\sfbshape{17}{\magstep1} +\let\titlebf=\titlerm +\setfont\titlesc\scbshape{10}{\magstep4} +\font\titlei=cmmi12 scaled \magstep3 +\font\titlesy=cmsy10 scaled \magstep4 +\def\authorrm{\secrm} +\def\authortt{\sectt} + +% Chapter (and unnumbered) fonts (17.28pt). +\def\chapnominalsize{17pt} +\setfont\chaprm\rmbshape{12}{\magstep2} +\setfont\chapit\itbshape{10}{\magstep3} +\setfont\chapsl\slbshape{10}{\magstep3} +\setfont\chaptt\ttbshape{12}{\magstep2} +\setfont\chapttsl\ttslshape{10}{\magstep3} +\setfont\chapsf\sfbshape{17}{1000} +\let\chapbf=\chaprm +\setfont\chapsc\scbshape{10}{\magstep3} +\font\chapi=cmmi12 scaled \magstep2 +\font\chapsy=cmsy10 scaled \magstep3 + +% Section fonts (14.4pt). +\def\secnominalsize{14pt} +\setfont\secrm\rmbshape{12}{\magstep1} +\setfont\secit\itbshape{10}{\magstep2} +\setfont\secsl\slbshape{10}{\magstep2} +\setfont\sectt\ttbshape{12}{\magstep1} +\setfont\secttsl\ttslshape{10}{\magstep2} +\setfont\secsf\sfbshape{12}{\magstep1} +\let\secbf\secrm +\setfont\secsc\scbshape{10}{\magstep2} +\font\seci=cmmi12 scaled \magstep1 +\font\secsy=cmsy10 scaled \magstep2 + +% Subsection fonts (13.15pt). +\def\ssecnominalsize{13pt} +\setfont\ssecrm\rmbshape{12}{\magstephalf} +\setfont\ssecit\itbshape{10}{1315} +\setfont\ssecsl\slbshape{10}{1315} +\setfont\ssectt\ttbshape{12}{\magstephalf} +\setfont\ssecttsl\ttslshape{10}{1315} +\setfont\ssecsf\sfbshape{12}{\magstephalf} +\let\ssecbf\ssecrm +\setfont\ssecsc\scbshape{10}{1315} +\font\sseci=cmmi12 scaled \magstephalf +\font\ssecsy=cmsy10 scaled 1315 + +% Reduced fonts for @acro in text (10pt). +\def\reducednominalsize{10pt} +\setfont\reducedrm\rmshape{10}{1000} +\setfont\reducedtt\ttshape{10}{1000} +\setfont\reducedbf\bfshape{10}{1000} +\setfont\reducedit\itshape{10}{1000} +\setfont\reducedsl\slshape{10}{1000} +\setfont\reducedsf\sfshape{10}{1000} +\setfont\reducedsc\scshape{10}{1000} +\setfont\reducedttsl\ttslshape{10}{1000} +\font\reducedi=cmmi10 +\font\reducedsy=cmsy10 + +% In order for the font changes to affect most math symbols and letters, +% we have to define the \textfont of the standard families. Since +% texinfo doesn't allow for producing subscripts and superscripts except +% in the main text, we don't bother to reset \scriptfont and +% \scriptscriptfont (which would also require loading a lot more fonts). +% +\def\resetmathfonts{% + \textfont0=\tenrm \textfont1=\teni \textfont2=\tensy + \textfont\itfam=\tenit \textfont\slfam=\tensl \textfont\bffam=\tenbf + \textfont\ttfam=\tentt \textfont\sffam=\tensf +} + +% The font-changing commands redefine the meanings of \tenSTYLE, instead +% of just \STYLE. We do this because \STYLE needs to also set the +% current \fam for math mode. Our \STYLE (e.g., \rm) commands hardwire +% \tenSTYLE to set the current font. +% +% Each font-changing command also sets the names \lsize (one size lower) +% and \lllsize (three sizes lower). These relative commands are used in +% the LaTeX logo and acronyms. +% +% This all needs generalizing, badly. +% +\def\textfonts{% + \let\tenrm=\textrm \let\tenit=\textit \let\tensl=\textsl + \let\tenbf=\textbf \let\tentt=\texttt \let\smallcaps=\textsc + \let\tensf=\textsf \let\teni=\texti \let\tensy=\textsy + \let\tenttsl=\textttsl + \def\curfontsize{text}% + \def\lsize{reduced}\def\lllsize{smaller}% + \resetmathfonts \setleading{\textleading}} +\def\titlefonts{% + \let\tenrm=\titlerm \let\tenit=\titleit \let\tensl=\titlesl + \let\tenbf=\titlebf \let\tentt=\titlett \let\smallcaps=\titlesc + \let\tensf=\titlesf \let\teni=\titlei \let\tensy=\titlesy + \let\tenttsl=\titlettsl + \def\curfontsize{title}% + \def\lsize{chap}\def\lllsize{subsec}% + \resetmathfonts \setleading{25pt}} +\def\titlefont#1{{\titlefonts\rm #1}} +\def\chapfonts{% + \let\tenrm=\chaprm \let\tenit=\chapit \let\tensl=\chapsl + \let\tenbf=\chapbf \let\tentt=\chaptt \let\smallcaps=\chapsc + \let\tensf=\chapsf \let\teni=\chapi \let\tensy=\chapsy + \let\tenttsl=\chapttsl + \def\curfontsize{chap}% + \def\lsize{sec}\def\lllsize{text}% + \resetmathfonts \setleading{19pt}} +\def\secfonts{% + \let\tenrm=\secrm \let\tenit=\secit \let\tensl=\secsl + \let\tenbf=\secbf \let\tentt=\sectt \let\smallcaps=\secsc + \let\tensf=\secsf \let\teni=\seci \let\tensy=\secsy + \let\tenttsl=\secttsl + \def\curfontsize{sec}% + \def\lsize{subsec}\def\lllsize{reduced}% + \resetmathfonts \setleading{16pt}} +\def\subsecfonts{% + \let\tenrm=\ssecrm \let\tenit=\ssecit \let\tensl=\ssecsl + \let\tenbf=\ssecbf \let\tentt=\ssectt \let\smallcaps=\ssecsc + \let\tensf=\ssecsf \let\teni=\sseci \let\tensy=\ssecsy + \let\tenttsl=\ssecttsl + \def\curfontsize{ssec}% + \def\lsize{text}\def\lllsize{small}% + \resetmathfonts \setleading{15pt}} +\let\subsubsecfonts = \subsecfonts +\def\reducedfonts{% + \let\tenrm=\reducedrm \let\tenit=\reducedit \let\tensl=\reducedsl + \let\tenbf=\reducedbf \let\tentt=\reducedtt \let\reducedcaps=\reducedsc + \let\tensf=\reducedsf \let\teni=\reducedi \let\tensy=\reducedsy + \let\tenttsl=\reducedttsl + \def\curfontsize{reduced}% + \def\lsize{small}\def\lllsize{smaller}% + \resetmathfonts \setleading{10.5pt}} +\def\smallfonts{% + \let\tenrm=\smallrm \let\tenit=\smallit \let\tensl=\smallsl + \let\tenbf=\smallbf \let\tentt=\smalltt \let\smallcaps=\smallsc + \let\tensf=\smallsf \let\teni=\smalli \let\tensy=\smallsy + \let\tenttsl=\smallttsl + \def\curfontsize{small}% + \def\lsize{smaller}\def\lllsize{smaller}% + \resetmathfonts \setleading{10.5pt}} +\def\smallerfonts{% + \let\tenrm=\smallerrm \let\tenit=\smallerit \let\tensl=\smallersl + \let\tenbf=\smallerbf \let\tentt=\smallertt \let\smallcaps=\smallersc + \let\tensf=\smallersf \let\teni=\smalleri \let\tensy=\smallersy + \let\tenttsl=\smallerttsl + \def\curfontsize{smaller}% + \def\lsize{smaller}\def\lllsize{smaller}% + \resetmathfonts \setleading{9.5pt}} + +% Set the fonts to use with the @small... environments. +\let\smallexamplefonts = \smallfonts + +% About \smallexamplefonts. If we use \smallfonts (9pt), @smallexample +% can fit this many characters: +% 8.5x11=86 smallbook=72 a4=90 a5=69 +% If we use \scriptfonts (8pt), then we can fit this many characters: +% 8.5x11=90+ smallbook=80 a4=90+ a5=77 +% For me, subjectively, the few extra characters that fit aren't worth +% the additional smallness of 8pt. So I'm making the default 9pt. +% +% By the way, for comparison, here's what fits with @example (10pt): +% 8.5x11=71 smallbook=60 a4=75 a5=58 +% +% I wish the USA used A4 paper. +% --karl, 24jan03. + + +% Set up the default fonts, so we can use them for creating boxes. +% +\textfonts \rm + +% Define these so they can be easily changed for other fonts. +\def\angleleft{$\langle$} +\def\angleright{$\rangle$} + +% Count depth in font-changes, for error checks +\newcount\fontdepth \fontdepth=0 + +% Fonts for short table of contents. +\setfont\shortcontrm\rmshape{12}{1000} +\setfont\shortcontbf\bfshape{10}{\magstep1} % no cmb12 +\setfont\shortcontsl\slshape{12}{1000} +\setfont\shortconttt\ttshape{12}{1000} + +%% Add scribe-like font environments, plus @l for inline lisp (usually sans +%% serif) and @ii for TeX italic + +% \smartitalic{ARG} outputs arg in italics, followed by an italic correction +% unless the following character is such as not to need one. +\def\smartitalicx{\ifx\next,\else\ifx\next-\else\ifx\next.\else + \ptexslash\fi\fi\fi} +\def\smartslanted#1{{\ifusingtt\ttsl\sl #1}\futurelet\next\smartitalicx} +\def\smartitalic#1{{\ifusingtt\ttsl\it #1}\futurelet\next\smartitalicx} + +% like \smartslanted except unconditionally uses \ttsl. +% @var is set to this for defun arguments. +\def\ttslanted#1{{\ttsl #1}\futurelet\next\smartitalicx} + +% like \smartslanted except unconditionally use \sl. We never want +% ttsl for book titles, do we? +\def\cite#1{{\sl #1}\futurelet\next\smartitalicx} + +\let\i=\smartitalic +\let\slanted=\smartslanted +\let\var=\smartslanted +\let\dfn=\smartslanted +\let\emph=\smartitalic + +% @b, explicit bold. +\def\b#1{{\bf #1}} +\let\strong=\b + +% @sansserif, explicit sans. +\def\sansserif#1{{\sf #1}} + +% We can't just use \exhyphenpenalty, because that only has effect at +% the end of a paragraph. Restore normal hyphenation at the end of the +% group within which \nohyphenation is presumably called. +% +\def\nohyphenation{\hyphenchar\font = -1 \aftergroup\restorehyphenation} +\def\restorehyphenation{\hyphenchar\font = `- } + +% Set sfcode to normal for the chars that usually have another value. +% Can't use plain's \frenchspacing because it uses the `\x notation, and +% sometimes \x has an active definition that messes things up. +% +\catcode`@=11 + \def\plainfrenchspacing{% + \sfcode\dotChar =\@m \sfcode\questChar=\@m \sfcode\exclamChar=\@m + \sfcode\colonChar=\@m \sfcode\semiChar =\@m \sfcode\commaChar =\@m + \def\endofsentencespacefactor{1000}% for @. and friends + } + \def\plainnonfrenchspacing{% + \sfcode`\.3000\sfcode`\?3000\sfcode`\!3000 + \sfcode`\:2000\sfcode`\;1500\sfcode`\,1250 + \def\endofsentencespacefactor{3000}% for @. and friends + } +\catcode`@=\other +\def\endofsentencespacefactor{3000}% default + +\def\t#1{% + {\tt \rawbackslash \plainfrenchspacing #1}% + \null +} +\def\samp#1{`\tclose{#1}'\null} +\setfont\keyrm\rmshape{8}{1000} +\font\keysy=cmsy9 +\def\key#1{{\keyrm\textfont2=\keysy \leavevmode\hbox{% + \raise0.4pt\hbox{\angleleft}\kern-.08em\vtop{% + \vbox{\hrule\kern-0.4pt + \hbox{\raise0.4pt\hbox{\vphantom{\angleleft}}#1}}% + \kern-0.4pt\hrule}% + \kern-.06em\raise0.4pt\hbox{\angleright}}}} +% The old definition, with no lozenge: +%\def\key #1{{\ttsl \nohyphenation \uppercase{#1}}\null} +\def\ctrl #1{{\tt \rawbackslash \hat}#1} + +% @file, @option are the same as @samp. +\let\file=\samp +\let\option=\samp + +% @code is a modification of @t, +% which makes spaces the same size as normal in the surrounding text. +\def\tclose#1{% + {% + % Change normal interword space to be same as for the current font. + \spaceskip = \fontdimen2\font + % + % Switch to typewriter. + \tt + % + % But `\ ' produces the large typewriter interword space. + \def\ {{\spaceskip = 0pt{} }}% + % + % Turn off hyphenation. + \nohyphenation + % + \rawbackslash + \plainfrenchspacing + #1% + }% + \null +} + +% We *must* turn on hyphenation at `-' and `_' in @code. +% Otherwise, it is too hard to avoid overfull hboxes +% in the Emacs manual, the Library manual, etc. + +% Unfortunately, TeX uses one parameter (\hyphenchar) to control +% both hyphenation at - and hyphenation within words. +% We must therefore turn them both off (\tclose does that) +% and arrange explicitly to hyphenate at a dash. +% -- rms. +{ + \catcode`\-=\active + \catcode`\_=\active + % + \global\def\code{\begingroup + \catcode`\-=\active \catcode`\_=\active + \ifallowcodebreaks + \let-\codedash + \let_\codeunder + \else + \let-\realdash + \let_\realunder + \fi + \codex + } +} + +\def\realdash{-} +\def\codedash{-\discretionary{}{}{}} +\def\codeunder{% + % this is all so @math{@code{var_name}+1} can work. In math mode, _ + % is "active" (mathcode"8000) and \normalunderscore (or \char95, etc.) + % will therefore expand the active definition of _, which is us + % (inside @code that is), therefore an endless loop. + \ifusingtt{\ifmmode + \mathchar"075F % class 0=ordinary, family 7=ttfam, pos 0x5F=_. + \else\normalunderscore \fi + \discretionary{}{}{}}% + {\_}% +} +\def\codex #1{\tclose{#1}\endgroup} + +% An additional complication: the above will allow breaks after, e.g., +% each of the four underscores in __typeof__. This is undesirable in +% some manuals, especially if they don't have long identifiers in +% general. @allowcodebreaks provides a way to control this. +% +\newif\ifallowcodebreaks \allowcodebreakstrue + +\def\keywordtrue{true} +\def\keywordfalse{false} + +\parseargdef\allowcodebreaks{% + \def\txiarg{#1}% + \ifx\txiarg\keywordtrue + \allowcodebreakstrue + \else\ifx\txiarg\keywordfalse + \allowcodebreaksfalse + \else + \errhelp = \EMsimple + \errmessage{Unknown @allowcodebreaks option `\txiarg'}% + \fi\fi +} + +% @kbd is like @code, except that if the argument is just one @key command, +% then @kbd has no effect. + +% @kbdinputstyle -- arg is `distinct' (@kbd uses slanted tty font always), +% `example' (@kbd uses ttsl only inside of @example and friends), +% or `code' (@kbd uses normal tty font always). +\parseargdef\kbdinputstyle{% + \def\txiarg{#1}% + \ifx\txiarg\worddistinct + \gdef\kbdexamplefont{\ttsl}\gdef\kbdfont{\ttsl}% + \else\ifx\txiarg\wordexample + \gdef\kbdexamplefont{\ttsl}\gdef\kbdfont{\tt}% + \else\ifx\txiarg\wordcode + \gdef\kbdexamplefont{\tt}\gdef\kbdfont{\tt}% + \else + \errhelp = \EMsimple + \errmessage{Unknown @kbdinputstyle option `\txiarg'}% + \fi\fi\fi +} +\def\worddistinct{distinct} +\def\wordexample{example} +\def\wordcode{code} + +% Default is `distinct.' +\kbdinputstyle distinct + +\def\xkey{\key} +\def\kbdfoo#1#2#3\par{\def\one{#1}\def\three{#3}\def\threex{??}% +\ifx\one\xkey\ifx\threex\three \key{#2}% +\else{\tclose{\kbdfont\look}}\fi +\else{\tclose{\kbdfont\look}}\fi} + +% For @indicateurl, @env, @command quotes seem unnecessary, so use \code. +\let\indicateurl=\code +\let\env=\code +\let\command=\code + +% @uref (abbreviation for `urlref') takes an optional (comma-separated) +% second argument specifying the text to display and an optional third +% arg as text to display instead of (rather than in addition to) the url +% itself. First (mandatory) arg is the url. Perhaps eventually put in +% a hypertex \special here. +% +\def\uref#1{\douref #1,,,\finish} +\def\douref#1,#2,#3,#4\finish{\begingroup + \unsepspaces + \pdfurl{#1}% + \setbox0 = \hbox{\ignorespaces #3}% + \ifdim\wd0 > 0pt + \unhbox0 % third arg given, show only that + \else + \setbox0 = \hbox{\ignorespaces #2}% + \ifdim\wd0 > 0pt + \ifpdf + \unhbox0 % PDF: 2nd arg given, show only it + \else + \unhbox0\ (\code{#1})% DVI: 2nd arg given, show both it and url + \fi + \else + \code{#1}% only url given, so show it + \fi + \fi + \endlink +\endgroup} + +% @url synonym for @uref, since that's how everyone uses it. +% +\let\url=\uref + +% rms does not like angle brackets --karl, 17may97. +% So now @email is just like @uref, unless we are pdf. +% +%\def\email#1{\angleleft{\tt #1}\angleright} +\ifpdf + \def\email#1{\doemail#1,,\finish} + \def\doemail#1,#2,#3\finish{\begingroup + \unsepspaces + \pdfurl{mailto:#1}% + \setbox0 = \hbox{\ignorespaces #2}% + \ifdim\wd0>0pt\unhbox0\else\code{#1}\fi + \endlink + \endgroup} +\else + \let\email=\uref +\fi + +% Check if we are currently using a typewriter font. Since all the +% Computer Modern typewriter fonts have zero interword stretch (and +% shrink), and it is reasonable to expect all typewriter fonts to have +% this property, we can check that font parameter. +% +\def\ifmonospace{\ifdim\fontdimen3\font=0pt } + +% Typeset a dimension, e.g., `in' or `pt'. The only reason for the +% argument is to make the input look right: @dmn{pt} instead of @dmn{}pt. +% +\def\dmn#1{\thinspace #1} + +\def\kbd#1{\def\look{#1}\expandafter\kbdfoo\look??\par} + +% @l was never documented to mean ``switch to the Lisp font'', +% and it is not used as such in any manual I can find. We need it for +% Polish suppressed-l. --karl, 22sep96. +%\def\l#1{{\li #1}\null} + +% Explicit font changes: @r, @sc, undocumented @ii. +\def\r#1{{\rm #1}} % roman font +\def\sc#1{{\smallcaps#1}} % smallcaps font +\def\ii#1{{\it #1}} % italic font + +% @acronym for "FBI", "NATO", and the like. +% We print this one point size smaller, since it's intended for +% all-uppercase. +% +\def\acronym#1{\doacronym #1,,\finish} +\def\doacronym#1,#2,#3\finish{% + {\selectfonts\lsize #1}% + \def\temp{#2}% + \ifx\temp\empty \else + \space ({\unsepspaces \ignorespaces \temp \unskip})% + \fi +} + +% @abbr for "Comput. J." and the like. +% No font change, but don't do end-of-sentence spacing. +% +\def\abbr#1{\doabbr #1,,\finish} +\def\doabbr#1,#2,#3\finish{% + {\plainfrenchspacing #1}% + \def\temp{#2}% + \ifx\temp\empty \else + \space ({\unsepspaces \ignorespaces \temp \unskip})% + \fi +} + +% @pounds{} is a sterling sign, which Knuth put in the CM italic font. +% +\def\pounds{{\it\$}} + +% @euro{} comes from a separate font, depending on the current style. +% We use the free feym* fonts from the eurosym package by Henrik +% Theiling, which support regular, slanted, bold and bold slanted (and +% "outlined" (blackboard board, sort of) versions, which we don't need). +% It is available from http://www.ctan.org/tex-archive/fonts/eurosym. +% +% Although only regular is the truly official Euro symbol, we ignore +% that. The Euro is designed to be slightly taller than the regular +% font height. +% +% feymr - regular +% feymo - slanted +% feybr - bold +% feybo - bold slanted +% +% There is no good (free) typewriter version, to my knowledge. +% A feymr10 euro is ~7.3pt wide, while a normal cmtt10 char is ~5.25pt wide. +% Hmm. +% +% Also doesn't work in math. Do we need to do math with euro symbols? +% Hope not. +% +% +\def\euro{{\eurofont e}} +\def\eurofont{% + % We set the font at each command, rather than predefining it in + % \textfonts and the other font-switching commands, so that + % installations which never need the symbol don't have to have the + % font installed. + % + % There is only one designed size (nominal 10pt), so we always scale + % that to the current nominal size. + % + % By the way, simply using "at 1em" works for cmr10 and the like, but + % does not work for cmbx10 and other extended/shrunken fonts. + % + \def\eurosize{\csname\curfontsize nominalsize\endcsname}% + % + \ifx\curfontstyle\bfstylename + % bold: + \font\thiseurofont = \ifusingit{feybo10}{feybr10} at \eurosize + \else + % regular: + \font\thiseurofont = \ifusingit{feymo10}{feymr10} at \eurosize + \fi + \thiseurofont +} + +% @registeredsymbol - R in a circle. The font for the R should really +% be smaller yet, but lllsize is the best we can do for now. +% Adapted from the plain.tex definition of \copyright. +% +\def\registeredsymbol{% + $^{{\ooalign{\hfil\raise.07ex\hbox{\selectfonts\lllsize R}% + \hfil\crcr\Orb}}% + }$% +} + +% Laurent Siebenmann reports \Orb undefined with: +% Textures 1.7.7 (preloaded format=plain 93.10.14) (68K) 16 APR 2004 02:38 +% so we'll define it if necessary. +% +\ifx\Orb\undefined +\def\Orb{\mathhexbox20D} +\fi + + +\message{page headings,} + +\newskip\titlepagetopglue \titlepagetopglue = 1.5in +\newskip\titlepagebottomglue \titlepagebottomglue = 2pc + +% First the title page. Must do @settitle before @titlepage. +\newif\ifseenauthor +\newif\iffinishedtitlepage + +% Do an implicit @contents or @shortcontents after @end titlepage if the +% user says @setcontentsaftertitlepage or @setshortcontentsaftertitlepage. +% +\newif\ifsetcontentsaftertitlepage + \let\setcontentsaftertitlepage = \setcontentsaftertitlepagetrue +\newif\ifsetshortcontentsaftertitlepage + \let\setshortcontentsaftertitlepage = \setshortcontentsaftertitlepagetrue + +\parseargdef\shorttitlepage{\begingroup\hbox{}\vskip 1.5in \chaprm \centerline{#1}% + \endgroup\page\hbox{}\page} + +\envdef\titlepage{% + % Open one extra group, as we want to close it in the middle of \Etitlepage. + \begingroup + \parindent=0pt \textfonts + % Leave some space at the very top of the page. + \vglue\titlepagetopglue + % No rule at page bottom unless we print one at the top with @title. + \finishedtitlepagetrue + % + % Most title ``pages'' are actually two pages long, with space + % at the top of the second. We don't want the ragged left on the second. + \let\oldpage = \page + \def\page{% + \iffinishedtitlepage\else + \finishtitlepage + \fi + \let\page = \oldpage + \page + \null + }% +} + +\def\Etitlepage{% + \iffinishedtitlepage\else + \finishtitlepage + \fi + % It is important to do the page break before ending the group, + % because the headline and footline are only empty inside the group. + % If we use the new definition of \page, we always get a blank page + % after the title page, which we certainly don't want. + \oldpage + \endgroup + % + % Need this before the \...aftertitlepage checks so that if they are + % in effect the toc pages will come out with page numbers. + \HEADINGSon + % + % If they want short, they certainly want long too. + \ifsetshortcontentsaftertitlepage + \shortcontents + \contents + \global\let\shortcontents = \relax + \global\let\contents = \relax + \fi + % + \ifsetcontentsaftertitlepage + \contents + \global\let\contents = \relax + \global\let\shortcontents = \relax + \fi +} + +\def\finishtitlepage{% + \vskip4pt \hrule height 2pt width \hsize + \vskip\titlepagebottomglue + \finishedtitlepagetrue +} + +%%% Macros to be used within @titlepage: + +\let\subtitlerm=\tenrm +\def\subtitlefont{\subtitlerm \normalbaselineskip = 13pt \normalbaselines} + +\def\authorfont{\authorrm \normalbaselineskip = 16pt \normalbaselines + \let\tt=\authortt} + +\parseargdef\title{% + \checkenv\titlepage + \leftline{\titlefonts\rm #1} + % print a rule at the page bottom also. + \finishedtitlepagefalse + \vskip4pt \hrule height 4pt width \hsize \vskip4pt +} + +\parseargdef\subtitle{% + \checkenv\titlepage + {\subtitlefont \rightline{#1}}% +} + +% @author should come last, but may come many times. +% It can also be used inside @quotation. +% +\parseargdef\author{% + \def\temp{\quotation}% + \ifx\thisenv\temp + \def\quotationauthor{#1}% printed in \Equotation. + \else + \checkenv\titlepage + \ifseenauthor\else \vskip 0pt plus 1filll \seenauthortrue \fi + {\authorfont \leftline{#1}}% + \fi +} + + +%%% Set up page headings and footings. + +\let\thispage=\folio + +\newtoks\evenheadline % headline on even pages +\newtoks\oddheadline % headline on odd pages +\newtoks\evenfootline % footline on even pages +\newtoks\oddfootline % footline on odd pages + +% Now make TeX use those variables +\headline={{\textfonts\rm \ifodd\pageno \the\oddheadline + \else \the\evenheadline \fi}} +\footline={{\textfonts\rm \ifodd\pageno \the\oddfootline + \else \the\evenfootline \fi}\HEADINGShook} +\let\HEADINGShook=\relax + +% Commands to set those variables. +% For example, this is what @headings on does +% @evenheading @thistitle|@thispage|@thischapter +% @oddheading @thischapter|@thispage|@thistitle +% @evenfooting @thisfile|| +% @oddfooting ||@thisfile + + +\def\evenheading{\parsearg\evenheadingxxx} +\def\evenheadingxxx #1{\evenheadingyyy #1\|\|\|\|\finish} +\def\evenheadingyyy #1\|#2\|#3\|#4\finish{% +\global\evenheadline={\rlap{\centerline{#2}}\line{#1\hfil#3}}} + +\def\oddheading{\parsearg\oddheadingxxx} +\def\oddheadingxxx #1{\oddheadingyyy #1\|\|\|\|\finish} +\def\oddheadingyyy #1\|#2\|#3\|#4\finish{% +\global\oddheadline={\rlap{\centerline{#2}}\line{#1\hfil#3}}} + +\parseargdef\everyheading{\oddheadingxxx{#1}\evenheadingxxx{#1}}% + +\def\evenfooting{\parsearg\evenfootingxxx} +\def\evenfootingxxx #1{\evenfootingyyy #1\|\|\|\|\finish} +\def\evenfootingyyy #1\|#2\|#3\|#4\finish{% +\global\evenfootline={\rlap{\centerline{#2}}\line{#1\hfil#3}}} + +\def\oddfooting{\parsearg\oddfootingxxx} +\def\oddfootingxxx #1{\oddfootingyyy #1\|\|\|\|\finish} +\def\oddfootingyyy #1\|#2\|#3\|#4\finish{% + \global\oddfootline = {\rlap{\centerline{#2}}\line{#1\hfil#3}}% + % + % Leave some space for the footline. Hopefully ok to assume + % @evenfooting will not be used by itself. + \global\advance\pageheight by -\baselineskip + \global\advance\vsize by -\baselineskip +} + +\parseargdef\everyfooting{\oddfootingxxx{#1}\evenfootingxxx{#1}} + + +% @headings double turns headings on for double-sided printing. +% @headings single turns headings on for single-sided printing. +% @headings off turns them off. +% @headings on same as @headings double, retained for compatibility. +% @headings after turns on double-sided headings after this page. +% @headings doubleafter turns on double-sided headings after this page. +% @headings singleafter turns on single-sided headings after this page. +% By default, they are off at the start of a document, +% and turned `on' after @end titlepage. + +\def\headings #1 {\csname HEADINGS#1\endcsname} + +\def\HEADINGSoff{% +\global\evenheadline={\hfil} \global\evenfootline={\hfil} +\global\oddheadline={\hfil} \global\oddfootline={\hfil}} +\HEADINGSoff +% When we turn headings on, set the page number to 1. +% For double-sided printing, put current file name in lower left corner, +% chapter name on inside top of right hand pages, document +% title on inside top of left hand pages, and page numbers on outside top +% edge of all pages. +\def\HEADINGSdouble{% +\global\pageno=1 +\global\evenfootline={\hfil} +\global\oddfootline={\hfil} +\global\evenheadline={\line{\folio\hfil\thistitle}} +\global\oddheadline={\line{\thischapter\hfil\folio}} +\global\let\contentsalignmacro = \chapoddpage +} +\let\contentsalignmacro = \chappager + +% For single-sided printing, chapter title goes across top left of page, +% page number on top right. +\def\HEADINGSsingle{% +\global\pageno=1 +\global\evenfootline={\hfil} +\global\oddfootline={\hfil} +\global\evenheadline={\line{\thischapter\hfil\folio}} +\global\oddheadline={\line{\thischapter\hfil\folio}} +\global\let\contentsalignmacro = \chappager +} +\def\HEADINGSon{\HEADINGSdouble} + +\def\HEADINGSafter{\let\HEADINGShook=\HEADINGSdoublex} +\let\HEADINGSdoubleafter=\HEADINGSafter +\def\HEADINGSdoublex{% +\global\evenfootline={\hfil} +\global\oddfootline={\hfil} +\global\evenheadline={\line{\folio\hfil\thistitle}} +\global\oddheadline={\line{\thischapter\hfil\folio}} +\global\let\contentsalignmacro = \chapoddpage +} + +\def\HEADINGSsingleafter{\let\HEADINGShook=\HEADINGSsinglex} +\def\HEADINGSsinglex{% +\global\evenfootline={\hfil} +\global\oddfootline={\hfil} +\global\evenheadline={\line{\thischapter\hfil\folio}} +\global\oddheadline={\line{\thischapter\hfil\folio}} +\global\let\contentsalignmacro = \chappager +} + +% Subroutines used in generating headings +% This produces Day Month Year style of output. +% Only define if not already defined, in case a txi-??.tex file has set +% up a different format (e.g., txi-cs.tex does this). +\ifx\today\undefined +\def\today{% + \number\day\space + \ifcase\month + \or\putwordMJan\or\putwordMFeb\or\putwordMMar\or\putwordMApr + \or\putwordMMay\or\putwordMJun\or\putwordMJul\or\putwordMAug + \or\putwordMSep\or\putwordMOct\or\putwordMNov\or\putwordMDec + \fi + \space\number\year} +\fi + +% @settitle line... specifies the title of the document, for headings. +% It generates no output of its own. +\def\thistitle{\putwordNoTitle} +\def\settitle{\parsearg{\gdef\thistitle}} + + +\message{tables,} +% Tables -- @table, @ftable, @vtable, @item(x). + +% default indentation of table text +\newdimen\tableindent \tableindent=.8in +% default indentation of @itemize and @enumerate text +\newdimen\itemindent \itemindent=.3in +% margin between end of table item and start of table text. +\newdimen\itemmargin \itemmargin=.1in + +% used internally for \itemindent minus \itemmargin +\newdimen\itemmax + +% Note @table, @ftable, and @vtable define @item, @itemx, etc., with +% these defs. +% They also define \itemindex +% to index the item name in whatever manner is desired (perhaps none). + +\newif\ifitemxneedsnegativevskip + +\def\itemxpar{\par\ifitemxneedsnegativevskip\nobreak\vskip-\parskip\nobreak\fi} + +\def\internalBitem{\smallbreak \parsearg\itemzzz} +\def\internalBitemx{\itemxpar \parsearg\itemzzz} + +\def\itemzzz #1{\begingroup % + \advance\hsize by -\rightskip + \advance\hsize by -\tableindent + \setbox0=\hbox{\itemindicate{#1}}% + \itemindex{#1}% + \nobreak % This prevents a break before @itemx. + % + % If the item text does not fit in the space we have, put it on a line + % by itself, and do not allow a page break either before or after that + % line. We do not start a paragraph here because then if the next + % command is, e.g., @kindex, the whatsit would get put into the + % horizontal list on a line by itself, resulting in extra blank space. + \ifdim \wd0>\itemmax + % + % Make this a paragraph so we get the \parskip glue and wrapping, + % but leave it ragged-right. + \begingroup + \advance\leftskip by-\tableindent + \advance\hsize by\tableindent + \advance\rightskip by0pt plus1fil + \leavevmode\unhbox0\par + \endgroup + % + % We're going to be starting a paragraph, but we don't want the + % \parskip glue -- logically it's part of the @item we just started. + \nobreak \vskip-\parskip + % + % Stop a page break at the \parskip glue coming up. However, if + % what follows is an environment such as @example, there will be no + % \parskip glue; then the negative vskip we just inserted would + % cause the example and the item to crash together. So we use this + % bizarre value of 10001 as a signal to \aboveenvbreak to insert + % \parskip glue after all. Section titles are handled this way also. + % + \penalty 10001 + \endgroup + \itemxneedsnegativevskipfalse + \else + % The item text fits into the space. Start a paragraph, so that the + % following text (if any) will end up on the same line. + \noindent + % Do this with kerns and \unhbox so that if there is a footnote in + % the item text, it can migrate to the main vertical list and + % eventually be printed. + \nobreak\kern-\tableindent + \dimen0 = \itemmax \advance\dimen0 by \itemmargin \advance\dimen0 by -\wd0 + \unhbox0 + \nobreak\kern\dimen0 + \endgroup + \itemxneedsnegativevskiptrue + \fi +} + +\def\item{\errmessage{@item while not in a list environment}} +\def\itemx{\errmessage{@itemx while not in a list environment}} + +% @table, @ftable, @vtable. +\envdef\table{% + \let\itemindex\gobble + \tablecheck{table}% +} +\envdef\ftable{% + \def\itemindex ##1{\doind {fn}{\code{##1}}}% + \tablecheck{ftable}% +} +\envdef\vtable{% + \def\itemindex ##1{\doind {vr}{\code{##1}}}% + \tablecheck{vtable}% +} +\def\tablecheck#1{% + \ifnum \the\catcode`\^^M=\active + \endgroup + \errmessage{This command won't work in this context; perhaps the problem is + that we are \inenvironment\thisenv}% + \def\next{\doignore{#1}}% + \else + \let\next\tablex + \fi + \next +} +\def\tablex#1{% + \def\itemindicate{#1}% + \parsearg\tabley +} +\def\tabley#1{% + {% + \makevalueexpandable + \edef\temp{\noexpand\tablez #1\space\space\space}% + \expandafter + }\temp \endtablez +} +\def\tablez #1 #2 #3 #4\endtablez{% + \aboveenvbreak + \ifnum 0#1>0 \advance \leftskip by #1\mil \fi + \ifnum 0#2>0 \tableindent=#2\mil \fi + \ifnum 0#3>0 \advance \rightskip by #3\mil \fi + \itemmax=\tableindent + \advance \itemmax by -\itemmargin + \advance \leftskip by \tableindent + \exdentamount=\tableindent + \parindent = 0pt + \parskip = \smallskipamount + \ifdim \parskip=0pt \parskip=2pt \fi + \let\item = \internalBitem + \let\itemx = \internalBitemx +} +\def\Etable{\endgraf\afterenvbreak} +\let\Eftable\Etable +\let\Evtable\Etable +\let\Eitemize\Etable +\let\Eenumerate\Etable + +% This is the counter used by @enumerate, which is really @itemize + +\newcount \itemno + +\envdef\itemize{\parsearg\doitemize} + +\def\doitemize#1{% + \aboveenvbreak + \itemmax=\itemindent + \advance\itemmax by -\itemmargin + \advance\leftskip by \itemindent + \exdentamount=\itemindent + \parindent=0pt + \parskip=\smallskipamount + \ifdim\parskip=0pt \parskip=2pt \fi + \def\itemcontents{#1}% + % @itemize with no arg is equivalent to @itemize @bullet. + \ifx\itemcontents\empty\def\itemcontents{\bullet}\fi + \let\item=\itemizeitem +} + +% Definition of @item while inside @itemize and @enumerate. +% +\def\itemizeitem{% + \advance\itemno by 1 % for enumerations + {\let\par=\endgraf \smallbreak}% reasonable place to break + {% + % If the document has an @itemize directly after a section title, a + % \nobreak will be last on the list, and \sectionheading will have + % done a \vskip-\parskip. In that case, we don't want to zero + % parskip, or the item text will crash with the heading. On the + % other hand, when there is normal text preceding the item (as there + % usually is), we do want to zero parskip, or there would be too much + % space. In that case, we won't have a \nobreak before. At least + % that's the theory. + \ifnum\lastpenalty<10000 \parskip=0in \fi + \noindent + \hbox to 0pt{\hss \itemcontents \kern\itemmargin}% + \vadjust{\penalty 1200}}% not good to break after first line of item. + \flushcr +} + +% \splitoff TOKENS\endmark defines \first to be the first token in +% TOKENS, and \rest to be the remainder. +% +\def\splitoff#1#2\endmark{\def\first{#1}\def\rest{#2}}% + +% Allow an optional argument of an uppercase letter, lowercase letter, +% or number, to specify the first label in the enumerated list. No +% argument is the same as `1'. +% +\envparseargdef\enumerate{\enumeratey #1 \endenumeratey} +\def\enumeratey #1 #2\endenumeratey{% + % If we were given no argument, pretend we were given `1'. + \def\thearg{#1}% + \ifx\thearg\empty \def\thearg{1}\fi + % + % Detect if the argument is a single token. If so, it might be a + % letter. Otherwise, the only valid thing it can be is a number. + % (We will always have one token, because of the test we just made. + % This is a good thing, since \splitoff doesn't work given nothing at + % all -- the first parameter is undelimited.) + \expandafter\splitoff\thearg\endmark + \ifx\rest\empty + % Only one token in the argument. It could still be anything. + % A ``lowercase letter'' is one whose \lccode is nonzero. + % An ``uppercase letter'' is one whose \lccode is both nonzero, and + % not equal to itself. + % Otherwise, we assume it's a number. + % + % We need the \relax at the end of the \ifnum lines to stop TeX from + % continuing to look for a . + % + \ifnum\lccode\expandafter`\thearg=0\relax + \numericenumerate % a number (we hope) + \else + % It's a letter. + \ifnum\lccode\expandafter`\thearg=\expandafter`\thearg\relax + \lowercaseenumerate % lowercase letter + \else + \uppercaseenumerate % uppercase letter + \fi + \fi + \else + % Multiple tokens in the argument. We hope it's a number. + \numericenumerate + \fi +} + +% An @enumerate whose labels are integers. The starting integer is +% given in \thearg. +% +\def\numericenumerate{% + \itemno = \thearg + \startenumeration{\the\itemno}% +} + +% The starting (lowercase) letter is in \thearg. +\def\lowercaseenumerate{% + \itemno = \expandafter`\thearg + \startenumeration{% + % Be sure we're not beyond the end of the alphabet. + \ifnum\itemno=0 + \errmessage{No more lowercase letters in @enumerate; get a bigger + alphabet}% + \fi + \char\lccode\itemno + }% +} + +% The starting (uppercase) letter is in \thearg. +\def\uppercaseenumerate{% + \itemno = \expandafter`\thearg + \startenumeration{% + % Be sure we're not beyond the end of the alphabet. + \ifnum\itemno=0 + \errmessage{No more uppercase letters in @enumerate; get a bigger + alphabet} + \fi + \char\uccode\itemno + }% +} + +% Call \doitemize, adding a period to the first argument and supplying the +% common last two arguments. Also subtract one from the initial value in +% \itemno, since @item increments \itemno. +% +\def\startenumeration#1{% + \advance\itemno by -1 + \doitemize{#1.}\flushcr +} + +% @alphaenumerate and @capsenumerate are abbreviations for giving an arg +% to @enumerate. +% +\def\alphaenumerate{\enumerate{a}} +\def\capsenumerate{\enumerate{A}} +\def\Ealphaenumerate{\Eenumerate} +\def\Ecapsenumerate{\Eenumerate} + + +% @multitable macros +% Amy Hendrickson, 8/18/94, 3/6/96 +% +% @multitable ... @end multitable will make as many columns as desired. +% Contents of each column will wrap at width given in preamble. Width +% can be specified either with sample text given in a template line, +% or in percent of \hsize, the current width of text on page. + +% Table can continue over pages but will only break between lines. + +% To make preamble: +% +% Either define widths of columns in terms of percent of \hsize: +% @multitable @columnfractions .25 .3 .45 +% @item ... +% +% Numbers following @columnfractions are the percent of the total +% current hsize to be used for each column. You may use as many +% columns as desired. + + +% Or use a template: +% @multitable {Column 1 template} {Column 2 template} {Column 3 template} +% @item ... +% using the widest term desired in each column. + +% Each new table line starts with @item, each subsequent new column +% starts with @tab. Empty columns may be produced by supplying @tab's +% with nothing between them for as many times as empty columns are needed, +% ie, @tab@tab@tab will produce two empty columns. + +% @item, @tab do not need to be on their own lines, but it will not hurt +% if they are. + +% Sample multitable: + +% @multitable {Column 1 template} {Column 2 template} {Column 3 template} +% @item first col stuff @tab second col stuff @tab third col +% @item +% first col stuff +% @tab +% second col stuff +% @tab +% third col +% @item first col stuff @tab second col stuff +% @tab Many paragraphs of text may be used in any column. +% +% They will wrap at the width determined by the template. +% @item@tab@tab This will be in third column. +% @end multitable + +% Default dimensions may be reset by user. +% @multitableparskip is vertical space between paragraphs in table. +% @multitableparindent is paragraph indent in table. +% @multitablecolmargin is horizontal space to be left between columns. +% @multitablelinespace is space to leave between table items, baseline +% to baseline. +% 0pt means it depends on current normal line spacing. +% +\newskip\multitableparskip +\newskip\multitableparindent +\newdimen\multitablecolspace +\newskip\multitablelinespace +\multitableparskip=0pt +\multitableparindent=6pt +\multitablecolspace=12pt +\multitablelinespace=0pt + +% Macros used to set up halign preamble: +% +\let\endsetuptable\relax +\def\xendsetuptable{\endsetuptable} +\let\columnfractions\relax +\def\xcolumnfractions{\columnfractions} +\newif\ifsetpercent + +% #1 is the @columnfraction, usually a decimal number like .5, but might +% be just 1. We just use it, whatever it is. +% +\def\pickupwholefraction#1 {% + \global\advance\colcount by 1 + \expandafter\xdef\csname col\the\colcount\endcsname{#1\hsize}% + \setuptable +} + +\newcount\colcount +\def\setuptable#1{% + \def\firstarg{#1}% + \ifx\firstarg\xendsetuptable + \let\go = \relax + \else + \ifx\firstarg\xcolumnfractions + \global\setpercenttrue + \else + \ifsetpercent + \let\go\pickupwholefraction + \else + \global\advance\colcount by 1 + \setbox0=\hbox{#1\unskip\space}% Add a normal word space as a + % separator; typically that is always in the input, anyway. + \expandafter\xdef\csname col\the\colcount\endcsname{\the\wd0}% + \fi + \fi + \ifx\go\pickupwholefraction + % Put the argument back for the \pickupwholefraction call, so + % we'll always have a period there to be parsed. + \def\go{\pickupwholefraction#1}% + \else + \let\go = \setuptable + \fi% + \fi + \go +} + +% multitable-only commands. +% +% @headitem starts a heading row, which we typeset in bold. +% Assignments have to be global since we are inside the implicit group +% of an alignment entry. Note that \everycr resets \everytab. +\def\headitem{\checkenv\multitable \crcr \global\everytab={\bf}\the\everytab}% +% +% A \tab used to include \hskip1sp. But then the space in a template +% line is not enough. That is bad. So let's go back to just `&' until +% we encounter the problem it was intended to solve again. +% --karl, nathan@acm.org, 20apr99. +\def\tab{\checkenv\multitable &\the\everytab}% + +% @multitable ... @end multitable definitions: +% +\newtoks\everytab % insert after every tab. +% +\envdef\multitable{% + \vskip\parskip + \startsavinginserts + % + % @item within a multitable starts a normal row. + % We use \def instead of \let so that if one of the multitable entries + % contains an @itemize, we don't choke on the \item (seen as \crcr aka + % \endtemplate) expanding \doitemize. + \def\item{\crcr}% + % + \tolerance=9500 + \hbadness=9500 + \setmultitablespacing + \parskip=\multitableparskip + \parindent=\multitableparindent + \overfullrule=0pt + \global\colcount=0 + % + \everycr = {% + \noalign{% + \global\everytab={}% + \global\colcount=0 % Reset the column counter. + % Check for saved footnotes, etc. + \checkinserts + % Keeps underfull box messages off when table breaks over pages. + %\filbreak + % Maybe so, but it also creates really weird page breaks when the + % table breaks over pages. Wouldn't \vfil be better? Wait until the + % problem manifests itself, so it can be fixed for real --karl. + }% + }% + % + \parsearg\domultitable +} +\def\domultitable#1{% + % To parse everything between @multitable and @item: + \setuptable#1 \endsetuptable + % + % This preamble sets up a generic column definition, which will + % be used as many times as user calls for columns. + % \vtop will set a single line and will also let text wrap and + % continue for many paragraphs if desired. + \halign\bgroup &% + \global\advance\colcount by 1 + \multistrut + \vtop{% + % Use the current \colcount to find the correct column width: + \hsize=\expandafter\csname col\the\colcount\endcsname + % + % In order to keep entries from bumping into each other + % we will add a \leftskip of \multitablecolspace to all columns after + % the first one. + % + % If a template has been used, we will add \multitablecolspace + % to the width of each template entry. + % + % If the user has set preamble in terms of percent of \hsize we will + % use that dimension as the width of the column, and the \leftskip + % will keep entries from bumping into each other. Table will start at + % left margin and final column will justify at right margin. + % + % Make sure we don't inherit \rightskip from the outer environment. + \rightskip=0pt + \ifnum\colcount=1 + % The first column will be indented with the surrounding text. + \advance\hsize by\leftskip + \else + \ifsetpercent \else + % If user has not set preamble in terms of percent of \hsize + % we will advance \hsize by \multitablecolspace. + \advance\hsize by \multitablecolspace + \fi + % In either case we will make \leftskip=\multitablecolspace: + \leftskip=\multitablecolspace + \fi + % Ignoring space at the beginning and end avoids an occasional spurious + % blank line, when TeX decides to break the line at the space before the + % box from the multistrut, so the strut ends up on a line by itself. + % For example: + % @multitable @columnfractions .11 .89 + % @item @code{#} + % @tab Legal holiday which is valid in major parts of the whole country. + % Is automatically provided with highlighting sequences respectively + % marking characters. + \noindent\ignorespaces##\unskip\multistrut + }\cr +} +\def\Emultitable{% + \crcr + \egroup % end the \halign + \global\setpercentfalse +} + +\def\setmultitablespacing{% + \def\multistrut{\strut}% just use the standard line spacing + % + % Compute \multitablelinespace (if not defined by user) for use in + % \multitableparskip calculation. We used define \multistrut based on + % this, but (ironically) that caused the spacing to be off. + % See bug-texinfo report from Werner Lemberg, 31 Oct 2004 12:52:20 +0100. +\ifdim\multitablelinespace=0pt +\setbox0=\vbox{X}\global\multitablelinespace=\the\baselineskip +\global\advance\multitablelinespace by-\ht0 +\fi +%% Test to see if parskip is larger than space between lines of +%% table. If not, do nothing. +%% If so, set to same dimension as multitablelinespace. +\ifdim\multitableparskip>\multitablelinespace +\global\multitableparskip=\multitablelinespace +\global\advance\multitableparskip-7pt %% to keep parskip somewhat smaller + %% than skip between lines in the table. +\fi% +\ifdim\multitableparskip=0pt +\global\multitableparskip=\multitablelinespace +\global\advance\multitableparskip-7pt %% to keep parskip somewhat smaller + %% than skip between lines in the table. +\fi} + + +\message{conditionals,} + +% @iftex, @ifnotdocbook, @ifnothtml, @ifnotinfo, @ifnotplaintext, +% @ifnotxml always succeed. They currently do nothing; we don't +% attempt to check whether the conditionals are properly nested. But we +% have to remember that they are conditionals, so that @end doesn't +% attempt to close an environment group. +% +\def\makecond#1{% + \expandafter\let\csname #1\endcsname = \relax + \expandafter\let\csname iscond.#1\endcsname = 1 +} +\makecond{iftex} +\makecond{ifnotdocbook} +\makecond{ifnothtml} +\makecond{ifnotinfo} +\makecond{ifnotplaintext} +\makecond{ifnotxml} + +% Ignore @ignore, @ifhtml, @ifinfo, and the like. +% +\def\direntry{\doignore{direntry}} +\def\documentdescription{\doignore{documentdescription}} +\def\docbook{\doignore{docbook}} +\def\html{\doignore{html}} +\def\ifdocbook{\doignore{ifdocbook}} +\def\ifhtml{\doignore{ifhtml}} +\def\ifinfo{\doignore{ifinfo}} +\def\ifnottex{\doignore{ifnottex}} +\def\ifplaintext{\doignore{ifplaintext}} +\def\ifxml{\doignore{ifxml}} +\def\ignore{\doignore{ignore}} +\def\menu{\doignore{menu}} +\def\xml{\doignore{xml}} + +% Ignore text until a line `@end #1', keeping track of nested conditionals. +% +% A count to remember the depth of nesting. +\newcount\doignorecount + +\def\doignore#1{\begingroup + % Scan in ``verbatim'' mode: + \catcode`\@ = \other + \catcode`\{ = \other + \catcode`\} = \other + % + % Make sure that spaces turn into tokens that match what \doignoretext wants. + \spaceisspace + % + % Count number of #1's that we've seen. + \doignorecount = 0 + % + % Swallow text until we reach the matching `@end #1'. + \dodoignore{#1}% +} + +{ \catcode`_=11 % We want to use \_STOP_ which cannot appear in texinfo source. + \obeylines % + % + \gdef\dodoignore#1{% + % #1 contains the command name as a string, e.g., `ifinfo'. + % + % Define a command to find the next `@end #1', which must be on a line + % by itself. + \long\def\doignoretext##1^^M@end #1{\doignoretextyyy##1^^M@#1\_STOP_}% + % And this command to find another #1 command, at the beginning of a + % line. (Otherwise, we would consider a line `@c @ifset', for + % example, to count as an @ifset for nesting.) + \long\def\doignoretextyyy##1^^M@#1##2\_STOP_{\doignoreyyy{##2}\_STOP_}% + % + % And now expand that command. + \obeylines % + \doignoretext ^^M% + }% +} + +\def\doignoreyyy#1{% + \def\temp{#1}% + \ifx\temp\empty % Nothing found. + \let\next\doignoretextzzz + \else % Found a nested condition, ... + \advance\doignorecount by 1 + \let\next\doignoretextyyy % ..., look for another. + % If we're here, #1 ends with ^^M\ifinfo (for example). + \fi + \next #1% the token \_STOP_ is present just after this macro. +} + +% We have to swallow the remaining "\_STOP_". +% +\def\doignoretextzzz#1{% + \ifnum\doignorecount = 0 % We have just found the outermost @end. + \let\next\enddoignore + \else % Still inside a nested condition. + \advance\doignorecount by -1 + \let\next\doignoretext % Look for the next @end. + \fi + \next +} + +% Finish off ignored text. +\def\enddoignore{\endgroup\ignorespaces} + + +% @set VAR sets the variable VAR to an empty value. +% @set VAR REST-OF-LINE sets VAR to the value REST-OF-LINE. +% +% Since we want to separate VAR from REST-OF-LINE (which might be +% empty), we can't just use \parsearg; we have to insert a space of our +% own to delimit the rest of the line, and then take it out again if we +% didn't need it. +% We rely on the fact that \parsearg sets \catcode`\ =10. +% +\parseargdef\set{\setyyy#1 \endsetyyy} +\def\setyyy#1 #2\endsetyyy{% + {% + \makevalueexpandable + \def\temp{#2}% + \edef\next{\gdef\makecsname{SET#1}}% + \ifx\temp\empty + \next{}% + \else + \setzzz#2\endsetzzz + \fi + }% +} +% Remove the trailing space \setxxx inserted. +\def\setzzz#1 \endsetzzz{\next{#1}} + +% @clear VAR clears (i.e., unsets) the variable VAR. +% +\parseargdef\clear{% + {% + \makevalueexpandable + \global\expandafter\let\csname SET#1\endcsname=\relax + }% +} + +% @value{foo} gets the text saved in variable foo. +\def\value{\begingroup\makevalueexpandable\valuexxx} +\def\valuexxx#1{\expandablevalue{#1}\endgroup} +{ + \catcode`\- = \active \catcode`\_ = \active + % + \gdef\makevalueexpandable{% + \let\value = \expandablevalue + % We don't want these characters active, ... + \catcode`\-=\other \catcode`\_=\other + % ..., but we might end up with active ones in the argument if + % we're called from @code, as @code{@value{foo-bar_}}, though. + % So \let them to their normal equivalents. + \let-\realdash \let_\normalunderscore + } +} + +% We have this subroutine so that we can handle at least some @value's +% properly in indexes (we call \makevalueexpandable in \indexdummies). +% The command has to be fully expandable (if the variable is set), since +% the result winds up in the index file. This means that if the +% variable's value contains other Texinfo commands, it's almost certain +% it will fail (although perhaps we could fix that with sufficient work +% to do a one-level expansion on the result, instead of complete). +% +\def\expandablevalue#1{% + \expandafter\ifx\csname SET#1\endcsname\relax + {[No value for ``#1'']}% + \message{Variable `#1', used in @value, is not set.}% + \else + \csname SET#1\endcsname + \fi +} + +% @ifset VAR ... @end ifset reads the `...' iff VAR has been defined +% with @set. +% +% To get special treatment of `@end ifset,' call \makeond and the redefine. +% +\makecond{ifset} +\def\ifset{\parsearg{\doifset{\let\next=\ifsetfail}}} +\def\doifset#1#2{% + {% + \makevalueexpandable + \let\next=\empty + \expandafter\ifx\csname SET#2\endcsname\relax + #1% If not set, redefine \next. + \fi + \expandafter + }\next +} +\def\ifsetfail{\doignore{ifset}} + +% @ifclear VAR ... @end ifclear reads the `...' iff VAR has never been +% defined with @set, or has been undefined with @clear. +% +% The `\else' inside the `\doifset' parameter is a trick to reuse the +% above code: if the variable is not set, do nothing, if it is set, +% then redefine \next to \ifclearfail. +% +\makecond{ifclear} +\def\ifclear{\parsearg{\doifset{\else \let\next=\ifclearfail}}} +\def\ifclearfail{\doignore{ifclear}} + +% @dircategory CATEGORY -- specify a category of the dir file +% which this file should belong to. Ignore this in TeX. +\let\dircategory=\comment + +% @defininfoenclose. +\let\definfoenclose=\comment + + +\message{indexing,} +% Index generation facilities + +% Define \newwrite to be identical to plain tex's \newwrite +% except not \outer, so it can be used within macros and \if's. +\edef\newwrite{\makecsname{ptexnewwrite}} + +% \newindex {foo} defines an index named foo. +% It automatically defines \fooindex such that +% \fooindex ...rest of line... puts an entry in the index foo. +% It also defines \fooindfile to be the number of the output channel for +% the file that accumulates this index. The file's extension is foo. +% The name of an index should be no more than 2 characters long +% for the sake of vms. +% +\def\newindex#1{% + \iflinks + \expandafter\newwrite \csname#1indfile\endcsname + \openout \csname#1indfile\endcsname \jobname.#1 % Open the file + \fi + \expandafter\xdef\csname#1index\endcsname{% % Define @#1index + \noexpand\doindex{#1}} +} + +% @defindex foo == \newindex{foo} +% +\def\defindex{\parsearg\newindex} + +% Define @defcodeindex, like @defindex except put all entries in @code. +% +\def\defcodeindex{\parsearg\newcodeindex} +% +\def\newcodeindex#1{% + \iflinks + \expandafter\newwrite \csname#1indfile\endcsname + \openout \csname#1indfile\endcsname \jobname.#1 + \fi + \expandafter\xdef\csname#1index\endcsname{% + \noexpand\docodeindex{#1}}% +} + + +% @synindex foo bar makes index foo feed into index bar. +% Do this instead of @defindex foo if you don't want it as a separate index. +% +% @syncodeindex foo bar similar, but put all entries made for index foo +% inside @code. +% +\def\synindex#1 #2 {\dosynindex\doindex{#1}{#2}} +\def\syncodeindex#1 #2 {\dosynindex\docodeindex{#1}{#2}} + +% #1 is \doindex or \docodeindex, #2 the index getting redefined (foo), +% #3 the target index (bar). +\def\dosynindex#1#2#3{% + % Only do \closeout if we haven't already done it, else we'll end up + % closing the target index. + \expandafter \ifx\csname donesynindex#2\endcsname \undefined + % The \closeout helps reduce unnecessary open files; the limit on the + % Acorn RISC OS is a mere 16 files. + \expandafter\closeout\csname#2indfile\endcsname + \expandafter\let\csname\donesynindex#2\endcsname = 1 + \fi + % redefine \fooindfile: + \expandafter\let\expandafter\temp\expandafter=\csname#3indfile\endcsname + \expandafter\let\csname#2indfile\endcsname=\temp + % redefine \fooindex: + \expandafter\xdef\csname#2index\endcsname{\noexpand#1{#3}}% +} + +% Define \doindex, the driver for all \fooindex macros. +% Argument #1 is generated by the calling \fooindex macro, +% and it is "foo", the name of the index. + +% \doindex just uses \parsearg; it calls \doind for the actual work. +% This is because \doind is more useful to call from other macros. + +% There is also \dosubind {index}{topic}{subtopic} +% which makes an entry in a two-level index such as the operation index. + +\def\doindex#1{\edef\indexname{#1}\parsearg\singleindexer} +\def\singleindexer #1{\doind{\indexname}{#1}} + +% like the previous two, but they put @code around the argument. +\def\docodeindex#1{\edef\indexname{#1}\parsearg\singlecodeindexer} +\def\singlecodeindexer #1{\doind{\indexname}{\code{#1}}} + +% Take care of Texinfo commands that can appear in an index entry. +% Since there are some commands we want to expand, and others we don't, +% we have to laboriously prevent expansion for those that we don't. +% +\def\indexdummies{% + \escapechar = `\\ % use backslash in output files. + \def\@{@}% change to @@ when we switch to @ as escape char in index files. + \def\ {\realbackslash\space }% + % Need these in case \tex is in effect and \{ is a \delimiter again. + % But can't use \lbracecmd and \rbracecmd because texindex assumes + % braces and backslashes are used only as delimiters. + \let\{ = \mylbrace + \let\} = \myrbrace + % + % Do the redefinitions. + \commondummies +} + +% For the aux and toc files, @ is the escape character. So we want to +% redefine everything using @ as the escape character (instead of +% \realbackslash, still used for index files). When everything uses @, +% this will be simpler. +% +\def\atdummies{% + \def\@{@@}% + \def\ {@ }% + \let\{ = \lbraceatcmd + \let\} = \rbraceatcmd + % + % Do the redefinitions. + \commondummies +} + +% Called from \indexdummies and \atdummies. +% +\def\commondummies{% + % + % \definedummyword defines \#1 as \string\#1\space, thus effectively + % preventing its expansion. This is used only for control% words, + % not control letters, because the \space would be incorrect for + % control characters, but is needed to separate the control word + % from whatever follows. + % + % For control letters, we have \definedummyletter, which omits the + % space. + % + % These can be used both for control words that take an argument and + % those that do not. If it is followed by {arg} in the input, then + % that will dutifully get written to the index (or wherever). + % + \def\definedummyword ##1{\def##1{\string##1\space}}% + \def\definedummyletter##1{\def##1{\string##1}}% + \let\definedummyaccent\definedummyletter + % + \commondummiesnofonts + % + \definedummyletter\_% + % + % Non-English letters. + \definedummyword\AA + \definedummyword\AE + \definedummyword\L + \definedummyword\OE + \definedummyword\O + \definedummyword\aa + \definedummyword\ae + \definedummyword\l + \definedummyword\oe + \definedummyword\o + \definedummyword\ss + \definedummyword\exclamdown + \definedummyword\questiondown + \definedummyword\ordf + \definedummyword\ordm + % + % Although these internal commands shouldn't show up, sometimes they do. + \definedummyword\bf + \definedummyword\gtr + \definedummyword\hat + \definedummyword\less + \definedummyword\sf + \definedummyword\sl + \definedummyword\tclose + \definedummyword\tt + % + \definedummyword\LaTeX + \definedummyword\TeX + % + % Assorted special characters. + \definedummyword\bullet + \definedummyword\comma + \definedummyword\copyright + \definedummyword\registeredsymbol + \definedummyword\dots + \definedummyword\enddots + \definedummyword\equiv + \definedummyword\error + \definedummyword\euro + \definedummyword\expansion + \definedummyword\minus + \definedummyword\pounds + \definedummyword\point + \definedummyword\print + \definedummyword\result + % + % We want to disable all macros so that they are not expanded by \write. + \macrolist + % + \normalturnoffactive + % + % Handle some cases of @value -- where it does not contain any + % (non-fully-expandable) commands. + \makevalueexpandable +} + +% \commondummiesnofonts: common to \commondummies and \indexnofonts. +% +% Better have this without active chars. +{ + \catcode`\~=\other + \gdef\commondummiesnofonts{% + % Control letters and accents. + \definedummyletter\!% + \definedummyaccent\"% + \definedummyaccent\'% + \definedummyletter\*% + \definedummyaccent\,% + \definedummyletter\.% + \definedummyletter\/% + \definedummyletter\:% + \definedummyaccent\=% + \definedummyletter\?% + \definedummyaccent\^% + \definedummyaccent\`% + \definedummyaccent\~% + \definedummyword\u + \definedummyword\v + \definedummyword\H + \definedummyword\dotaccent + \definedummyword\ringaccent + \definedummyword\tieaccent + \definedummyword\ubaraccent + \definedummyword\udotaccent + \definedummyword\dotless + % + % Texinfo font commands. + \definedummyword\b + \definedummyword\i + \definedummyword\r + \definedummyword\sc + \definedummyword\t + % + % Commands that take arguments. + \definedummyword\acronym + \definedummyword\cite + \definedummyword\code + \definedummyword\command + \definedummyword\dfn + \definedummyword\emph + \definedummyword\env + \definedummyword\file + \definedummyword\kbd + \definedummyword\key + \definedummyword\math + \definedummyword\option + \definedummyword\samp + \definedummyword\strong + \definedummyword\tie + \definedummyword\uref + \definedummyword\url + \definedummyword\var + \definedummyword\verb + \definedummyword\w + } +} + +% \indexnofonts is used when outputting the strings to sort the index +% by, and when constructing control sequence names. It eliminates all +% control sequences and just writes whatever the best ASCII sort string +% would be for a given command (usually its argument). +% +\def\indexnofonts{% + % Accent commands should become @asis. + \def\definedummyaccent##1{\let##1\asis}% + % We can just ignore other control letters. + \def\definedummyletter##1{\let##1\empty}% + % Hopefully, all control words can become @asis. + \let\definedummyword\definedummyaccent + % + \commondummiesnofonts + % + % Don't no-op \tt, since it isn't a user-level command + % and is used in the definitions of the active chars like <, >, |, etc. + % Likewise with the other plain tex font commands. + %\let\tt=\asis + % + \def\ { }% + \def\@{@}% + % how to handle braces? + \def\_{\normalunderscore}% + % + % Non-English letters. + \def\AA{AA}% + \def\AE{AE}% + \def\L{L}% + \def\OE{OE}% + \def\O{O}% + \def\aa{aa}% + \def\ae{ae}% + \def\l{l}% + \def\oe{oe}% + \def\o{o}% + \def\ss{ss}% + \def\exclamdown{!}% + \def\questiondown{?}% + \def\ordf{a}% + \def\ordm{o}% + % + \def\LaTeX{LaTeX}% + \def\TeX{TeX}% + % + % Assorted special characters. + % (The following {} will end up in the sort string, but that's ok.) + \def\bullet{bullet}% + \def\comma{,}% + \def\copyright{copyright}% + \def\registeredsymbol{R}% + \def\dots{...}% + \def\enddots{...}% + \def\equiv{==}% + \def\error{error}% + \def\euro{euro}% + \def\expansion{==>}% + \def\minus{-}% + \def\pounds{pounds}% + \def\point{.}% + \def\print{-|}% + \def\result{=>}% + % + % We need to get rid of all macros, leaving only the arguments (if present). + % Of course this is not nearly correct, but it is the best we can do for now. + % makeinfo does not expand macros in the argument to @deffn, which ends up + % writing an index entry, and texindex isn't prepared for an index sort entry + % that starts with \. + % + % Since macro invocations are followed by braces, we can just redefine them + % to take a single TeX argument. The case of a macro invocation that + % goes to end-of-line is not handled. + % + \macrolist +} + +\let\indexbackslash=0 %overridden during \printindex. +\let\SETmarginindex=\relax % put index entries in margin (undocumented)? + +% Most index entries go through here, but \dosubind is the general case. +% #1 is the index name, #2 is the entry text. +\def\doind#1#2{\dosubind{#1}{#2}{}} + +% Workhorse for all \fooindexes. +% #1 is name of index, #2 is stuff to put there, #3 is subentry -- +% empty if called from \doind, as we usually are (the main exception +% is with most defuns, which call us directly). +% +\def\dosubind#1#2#3{% + \iflinks + {% + % Store the main index entry text (including the third arg). + \toks0 = {#2}% + % If third arg is present, precede it with a space. + \def\thirdarg{#3}% + \ifx\thirdarg\empty \else + \toks0 = \expandafter{\the\toks0 \space #3}% + \fi + % + \edef\writeto{\csname#1indfile\endcsname}% + % + \ifvmode + \dosubindsanitize + \else + \dosubindwrite + \fi + }% + \fi +} + +% Write the entry in \toks0 to the index file: +% +\def\dosubindwrite{% + % Put the index entry in the margin if desired. + \ifx\SETmarginindex\relax\else + \insert\margin{\hbox{\vrule height8pt depth3pt width0pt \the\toks0}}% + \fi + % + % Remember, we are within a group. + \indexdummies % Must do this here, since \bf, etc expand at this stage + \def\backslashcurfont{\indexbackslash}% \indexbackslash isn't defined now + % so it will be output as is; and it will print as backslash. + % + % Process the index entry with all font commands turned off, to + % get the string to sort by. + {\indexnofonts + \edef\temp{\the\toks0}% need full expansion + \xdef\indexsorttmp{\temp}% + }% + % + % Set up the complete index entry, with both the sort key and + % the original text, including any font commands. We write + % three arguments to \entry to the .?? file (four in the + % subentry case), texindex reduces to two when writing the .??s + % sorted result. + \edef\temp{% + \write\writeto{% + \string\entry{\indexsorttmp}{\noexpand\folio}{\the\toks0}}% + }% + \temp +} + +% Take care of unwanted page breaks: +% +% If a skip is the last thing on the list now, preserve it +% by backing up by \lastskip, doing the \write, then inserting +% the skip again. Otherwise, the whatsit generated by the +% \write will make \lastskip zero. The result is that sequences +% like this: +% @end defun +% @tindex whatever +% @defun ... +% will have extra space inserted, because the \medbreak in the +% start of the @defun won't see the skip inserted by the @end of +% the previous defun. +% +% But don't do any of this if we're not in vertical mode. We +% don't want to do a \vskip and prematurely end a paragraph. +% +% Avoid page breaks due to these extra skips, too. +% +% But wait, there is a catch there: +% We'll have to check whether \lastskip is zero skip. \ifdim is not +% sufficient for this purpose, as it ignores stretch and shrink parts +% of the skip. The only way seems to be to check the textual +% representation of the skip. +% +% The following is almost like \def\zeroskipmacro{0.0pt} except that +% the ``p'' and ``t'' characters have catcode \other, not 11 (letter). +% +\edef\zeroskipmacro{\expandafter\the\csname z@skip\endcsname} +% +% ..., ready, GO: +% +\def\dosubindsanitize{% + % \lastskip and \lastpenalty cannot both be nonzero simultaneously. + \skip0 = \lastskip + \edef\lastskipmacro{\the\lastskip}% + \count255 = \lastpenalty + % + % If \lastskip is nonzero, that means the last item was a + % skip. And since a skip is discardable, that means this + % -\skip0 glue we're inserting is preceded by a + % non-discardable item, therefore it is not a potential + % breakpoint, therefore no \nobreak needed. + \ifx\lastskipmacro\zeroskipmacro + \else + \vskip-\skip0 + \fi + % + \dosubindwrite + % + \ifx\lastskipmacro\zeroskipmacro + % If \lastskip was zero, perhaps the last item was a penalty, and + % perhaps it was >=10000, e.g., a \nobreak. In that case, we want + % to re-insert the same penalty (values >10000 are used for various + % signals); since we just inserted a non-discardable item, any + % following glue (such as a \parskip) would be a breakpoint. For example: + % + % @deffn deffn-whatever + % @vindex index-whatever + % Description. + % would allow a break between the index-whatever whatsit + % and the "Description." paragraph. + \ifnum\count255>9999 \penalty\count255 \fi + \else + % On the other hand, if we had a nonzero \lastskip, + % this make-up glue would be preceded by a non-discardable item + % (the whatsit from the \write), so we must insert a \nobreak. + \nobreak\vskip\skip0 + \fi +} + +% The index entry written in the file actually looks like +% \entry {sortstring}{page}{topic} +% or +% \entry {sortstring}{page}{topic}{subtopic} +% The texindex program reads in these files and writes files +% containing these kinds of lines: +% \initial {c} +% before the first topic whose initial is c +% \entry {topic}{pagelist} +% for a topic that is used without subtopics +% \primary {topic} +% for the beginning of a topic that is used with subtopics +% \secondary {subtopic}{pagelist} +% for each subtopic. + +% Define the user-accessible indexing commands +% @findex, @vindex, @kindex, @cindex. + +\def\findex {\fnindex} +\def\kindex {\kyindex} +\def\cindex {\cpindex} +\def\vindex {\vrindex} +\def\tindex {\tpindex} +\def\pindex {\pgindex} + +\def\cindexsub {\begingroup\obeylines\cindexsub} +{\obeylines % +\gdef\cindexsub "#1" #2^^M{\endgroup % +\dosubind{cp}{#2}{#1}}} + +% Define the macros used in formatting output of the sorted index material. + +% @printindex causes a particular index (the ??s file) to get printed. +% It does not print any chapter heading (usually an @unnumbered). +% +\parseargdef\printindex{\begingroup + \dobreak \chapheadingskip{10000}% + % + \smallfonts \rm + \tolerance = 9500 + \everypar = {}% don't want the \kern\-parindent from indentation suppression. + % + % See if the index file exists and is nonempty. + % Change catcode of @ here so that if the index file contains + % \initial {@} + % as its first line, TeX doesn't complain about mismatched braces + % (because it thinks @} is a control sequence). + \catcode`\@ = 11 + \openin 1 \jobname.#1s + \ifeof 1 + % \enddoublecolumns gets confused if there is no text in the index, + % and it loses the chapter title and the aux file entries for the + % index. The easiest way to prevent this problem is to make sure + % there is some text. + \putwordIndexNonexistent + \else + % + % If the index file exists but is empty, then \openin leaves \ifeof + % false. We have to make TeX try to read something from the file, so + % it can discover if there is anything in it. + \read 1 to \temp + \ifeof 1 + \putwordIndexIsEmpty + \else + % Index files are almost Texinfo source, but we use \ as the escape + % character. It would be better to use @, but that's too big a change + % to make right now. + \def\indexbackslash{\backslashcurfont}% + \catcode`\\ = 0 + \escapechar = `\\ + \begindoublecolumns + \input \jobname.#1s + \enddoublecolumns + \fi + \fi + \closein 1 +\endgroup} + +% These macros are used by the sorted index file itself. +% Change them to control the appearance of the index. + +\def\initial#1{{% + % Some minor font changes for the special characters. + \let\tentt=\sectt \let\tt=\sectt \let\sf=\sectt + % + % Remove any glue we may have, we'll be inserting our own. + \removelastskip + % + % We like breaks before the index initials, so insert a bonus. + \nobreak + \vskip 0pt plus 3\baselineskip + \penalty 0 + \vskip 0pt plus -3\baselineskip + % + % Typeset the initial. Making this add up to a whole number of + % baselineskips increases the chance of the dots lining up from column + % to column. It still won't often be perfect, because of the stretch + % we need before each entry, but it's better. + % + % No shrink because it confuses \balancecolumns. + \vskip 1.67\baselineskip plus .5\baselineskip + \leftline{\secbf #1}% + % Do our best not to break after the initial. + \nobreak + \vskip .33\baselineskip plus .1\baselineskip +}} + +% \entry typesets a paragraph consisting of the text (#1), dot leaders, and +% then page number (#2) flushed to the right margin. It is used for index +% and table of contents entries. The paragraph is indented by \leftskip. +% +% A straightforward implementation would start like this: +% \def\entry#1#2{... +% But this frozes the catcodes in the argument, and can cause problems to +% @code, which sets - active. This problem was fixed by a kludge--- +% ``-'' was active throughout whole index, but this isn't really right. +% +% The right solution is to prevent \entry from swallowing the whole text. +% --kasal, 21nov03 +\def\entry{% + \begingroup + % + % Start a new paragraph if necessary, so our assignments below can't + % affect previous text. + \par + % + % Do not fill out the last line with white space. + \parfillskip = 0in + % + % No extra space above this paragraph. + \parskip = 0in + % + % Do not prefer a separate line ending with a hyphen to fewer lines. + \finalhyphendemerits = 0 + % + % \hangindent is only relevant when the entry text and page number + % don't both fit on one line. In that case, bob suggests starting the + % dots pretty far over on the line. Unfortunately, a large + % indentation looks wrong when the entry text itself is broken across + % lines. So we use a small indentation and put up with long leaders. + % + % \hangafter is reset to 1 (which is the value we want) at the start + % of each paragraph, so we need not do anything with that. + \hangindent = 2em + % + % When the entry text needs to be broken, just fill out the first line + % with blank space. + \rightskip = 0pt plus1fil + % + % A bit of stretch before each entry for the benefit of balancing + % columns. + \vskip 0pt plus1pt + % + % Swallow the left brace of the text (first parameter): + \afterassignment\doentry + \let\temp = +} +\def\doentry{% + \bgroup % Instead of the swallowed brace. + \noindent + \aftergroup\finishentry + % And now comes the text of the entry. +} +\def\finishentry#1{% + % #1 is the page number. + % + % The following is kludged to not output a line of dots in the index if + % there are no page numbers. The next person who breaks this will be + % cursed by a Unix daemon. + \def\tempa{{\rm }}% + \def\tempb{#1}% + \edef\tempc{\tempa}% + \edef\tempd{\tempb}% + \ifx\tempc\tempd + \ % + \else + % + % If we must, put the page number on a line of its own, and fill out + % this line with blank space. (The \hfil is overwhelmed with the + % fill leaders glue in \indexdotfill if the page number does fit.) + \hfil\penalty50 + \null\nobreak\indexdotfill % Have leaders before the page number. + % + % The `\ ' here is removed by the implicit \unskip that TeX does as + % part of (the primitive) \par. Without it, a spurious underfull + % \hbox ensues. + \ifpdf + \pdfgettoks#1.% + \ \the\toksA + \else + \ #1% + \fi + \fi + \par + \endgroup +} + +% Like \dotfill except takes at least 1 em. +\def\indexdotfill{\cleaders + \hbox{$\mathsurround=0pt \mkern1.5mu ${\it .}$ \mkern1.5mu$}\hskip 1em plus 1fill} + +\def\primary #1{\line{#1\hfil}} + +\newskip\secondaryindent \secondaryindent=0.5cm +\def\secondary#1#2{{% + \parfillskip=0in + \parskip=0in + \hangindent=1in + \hangafter=1 + \noindent\hskip\secondaryindent\hbox{#1}\indexdotfill + \ifpdf + \pdfgettoks#2.\ \the\toksA % The page number ends the paragraph. + \else + #2 + \fi + \par +}} + +% Define two-column mode, which we use to typeset indexes. +% Adapted from the TeXbook, page 416, which is to say, +% the manmac.tex format used to print the TeXbook itself. +\catcode`\@=11 + +\newbox\partialpage +\newdimen\doublecolumnhsize + +\def\begindoublecolumns{\begingroup % ended by \enddoublecolumns + % Grab any single-column material above us. + \output = {% + % + % Here is a possibility not foreseen in manmac: if we accumulate a + % whole lot of material, we might end up calling this \output + % routine twice in a row (see the doublecol-lose test, which is + % essentially a couple of indexes with @setchapternewpage off). In + % that case we just ship out what is in \partialpage with the normal + % output routine. Generally, \partialpage will be empty when this + % runs and this will be a no-op. See the indexspread.tex test case. + \ifvoid\partialpage \else + \onepageout{\pagecontents\partialpage}% + \fi + % + \global\setbox\partialpage = \vbox{% + % Unvbox the main output page. + \unvbox\PAGE + \kern-\topskip \kern\baselineskip + }% + }% + \eject % run that output routine to set \partialpage + % + % Use the double-column output routine for subsequent pages. + \output = {\doublecolumnout}% + % + % Change the page size parameters. We could do this once outside this + % routine, in each of @smallbook, @afourpaper, and the default 8.5x11 + % format, but then we repeat the same computation. Repeating a couple + % of assignments once per index is clearly meaningless for the + % execution time, so we may as well do it in one place. + % + % First we halve the line length, less a little for the gutter between + % the columns. We compute the gutter based on the line length, so it + % changes automatically with the paper format. The magic constant + % below is chosen so that the gutter has the same value (well, +-<1pt) + % as it did when we hard-coded it. + % + % We put the result in a separate register, \doublecolumhsize, so we + % can restore it in \pagesofar, after \hsize itself has (potentially) + % been clobbered. + % + \doublecolumnhsize = \hsize + \advance\doublecolumnhsize by -.04154\hsize + \divide\doublecolumnhsize by 2 + \hsize = \doublecolumnhsize + % + % Double the \vsize as well. (We don't need a separate register here, + % since nobody clobbers \vsize.) + \vsize = 2\vsize +} + +% The double-column output routine for all double-column pages except +% the last. +% +\def\doublecolumnout{% + \splittopskip=\topskip \splitmaxdepth=\maxdepth + % Get the available space for the double columns -- the normal + % (undoubled) page height minus any material left over from the + % previous page. + \dimen@ = \vsize + \divide\dimen@ by 2 + \advance\dimen@ by -\ht\partialpage + % + % box0 will be the left-hand column, box2 the right. + \setbox0=\vsplit255 to\dimen@ \setbox2=\vsplit255 to\dimen@ + \onepageout\pagesofar + \unvbox255 + \penalty\outputpenalty +} +% +% Re-output the contents of the output page -- any previous material, +% followed by the two boxes we just split, in box0 and box2. +\def\pagesofar{% + \unvbox\partialpage + % + \hsize = \doublecolumnhsize + \wd0=\hsize \wd2=\hsize + \hbox to\pagewidth{\box0\hfil\box2}% +} +% +% All done with double columns. +\def\enddoublecolumns{% + \output = {% + % Split the last of the double-column material. Leave it on the + % current page, no automatic page break. + \balancecolumns + % + % If we end up splitting too much material for the current page, + % though, there will be another page break right after this \output + % invocation ends. Having called \balancecolumns once, we do not + % want to call it again. Therefore, reset \output to its normal + % definition right away. (We hope \balancecolumns will never be + % called on to balance too much material, but if it is, this makes + % the output somewhat more palatable.) + \global\output = {\onepageout{\pagecontents\PAGE}}% + }% + \eject + \endgroup % started in \begindoublecolumns + % + % \pagegoal was set to the doubled \vsize above, since we restarted + % the current page. We're now back to normal single-column + % typesetting, so reset \pagegoal to the normal \vsize (after the + % \endgroup where \vsize got restored). + \pagegoal = \vsize +} +% +% Called at the end of the double column material. +\def\balancecolumns{% + \setbox0 = \vbox{\unvbox255}% like \box255 but more efficient, see p.120. + \dimen@ = \ht0 + \advance\dimen@ by \topskip + \advance\dimen@ by-\baselineskip + \divide\dimen@ by 2 % target to split to + %debug\message{final 2-column material height=\the\ht0, target=\the\dimen@.}% + \splittopskip = \topskip + % Loop until we get a decent breakpoint. + {% + \vbadness = 10000 + \loop + \global\setbox3 = \copy0 + \global\setbox1 = \vsplit3 to \dimen@ + \ifdim\ht3>\dimen@ + \global\advance\dimen@ by 1pt + \repeat + }% + %debug\message{split to \the\dimen@, column heights: \the\ht1, \the\ht3.}% + \setbox0=\vbox to\dimen@{\unvbox1}% + \setbox2=\vbox to\dimen@{\unvbox3}% + % + \pagesofar +} +\catcode`\@ = \other + + +\message{sectioning,} +% Chapters, sections, etc. + +% \unnumberedno is an oxymoron, of course. But we count the unnumbered +% sections so that we can refer to them unambiguously in the pdf +% outlines by their "section number". We avoid collisions with chapter +% numbers by starting them at 10000. (If a document ever has 10000 +% chapters, we're in trouble anyway, I'm sure.) +\newcount\unnumberedno \unnumberedno = 10000 +\newcount\chapno +\newcount\secno \secno=0 +\newcount\subsecno \subsecno=0 +\newcount\subsubsecno \subsubsecno=0 + +% This counter is funny since it counts through charcodes of letters A, B, ... +\newcount\appendixno \appendixno = `\@ +% +% \def\appendixletter{\char\the\appendixno} +% We do the following ugly conditional instead of the above simple +% construct for the sake of pdftex, which needs the actual +% letter in the expansion, not just typeset. +% +\def\appendixletter{% + \ifnum\appendixno=`A A% + \else\ifnum\appendixno=`B B% + \else\ifnum\appendixno=`C C% + \else\ifnum\appendixno=`D D% + \else\ifnum\appendixno=`E E% + \else\ifnum\appendixno=`F F% + \else\ifnum\appendixno=`G G% + \else\ifnum\appendixno=`H H% + \else\ifnum\appendixno=`I I% + \else\ifnum\appendixno=`J J% + \else\ifnum\appendixno=`K K% + \else\ifnum\appendixno=`L L% + \else\ifnum\appendixno=`M M% + \else\ifnum\appendixno=`N N% + \else\ifnum\appendixno=`O O% + \else\ifnum\appendixno=`P P% + \else\ifnum\appendixno=`Q Q% + \else\ifnum\appendixno=`R R% + \else\ifnum\appendixno=`S S% + \else\ifnum\appendixno=`T T% + \else\ifnum\appendixno=`U U% + \else\ifnum\appendixno=`V V% + \else\ifnum\appendixno=`W W% + \else\ifnum\appendixno=`X X% + \else\ifnum\appendixno=`Y Y% + \else\ifnum\appendixno=`Z Z% + % The \the is necessary, despite appearances, because \appendixletter is + % expanded while writing the .toc file. \char\appendixno is not + % expandable, thus it is written literally, thus all appendixes come out + % with the same letter (or @) in the toc without it. + \else\char\the\appendixno + \fi\fi\fi\fi\fi\fi\fi\fi\fi\fi\fi\fi\fi + \fi\fi\fi\fi\fi\fi\fi\fi\fi\fi\fi\fi\fi} + +% Each @chapter defines this as the name of the chapter. +% page headings and footings can use it. @section does likewise. +% However, they are not reliable, because we don't use marks. +\def\thischapter{} +\def\thissection{} + +\newcount\absseclevel % used to calculate proper heading level +\newcount\secbase\secbase=0 % @raisesections/@lowersections modify this count + +% @raisesections: treat @section as chapter, @subsection as section, etc. +\def\raisesections{\global\advance\secbase by -1} +\let\up=\raisesections % original BFox name + +% @lowersections: treat @chapter as section, @section as subsection, etc. +\def\lowersections{\global\advance\secbase by 1} +\let\down=\lowersections % original BFox name + +% we only have subsub. +\chardef\maxseclevel = 3 +% +% A numbered section within an unnumbered changes to unnumbered too. +% To achive this, remember the "biggest" unnum. sec. we are currently in: +\chardef\unmlevel = \maxseclevel +% +% Trace whether the current chapter is an appendix or not: +% \chapheadtype is "N" or "A", unnumbered chapters are ignored. +\def\chapheadtype{N} + +% Choose a heading macro +% #1 is heading type +% #2 is heading level +% #3 is text for heading +\def\genhead#1#2#3{% + % Compute the abs. sec. level: + \absseclevel=#2 + \advance\absseclevel by \secbase + % Make sure \absseclevel doesn't fall outside the range: + \ifnum \absseclevel < 0 + \absseclevel = 0 + \else + \ifnum \absseclevel > 3 + \absseclevel = 3 + \fi + \fi + % The heading type: + \def\headtype{#1}% + \if \headtype U% + \ifnum \absseclevel < \unmlevel + \chardef\unmlevel = \absseclevel + \fi + \else + % Check for appendix sections: + \ifnum \absseclevel = 0 + \edef\chapheadtype{\headtype}% + \else + \if \headtype A\if \chapheadtype N% + \errmessage{@appendix... within a non-appendix chapter}% + \fi\fi + \fi + % Check for numbered within unnumbered: + \ifnum \absseclevel > \unmlevel + \def\headtype{U}% + \else + \chardef\unmlevel = 3 + \fi + \fi + % Now print the heading: + \if \headtype U% + \ifcase\absseclevel + \unnumberedzzz{#3}% + \or \unnumberedseczzz{#3}% + \or \unnumberedsubseczzz{#3}% + \or \unnumberedsubsubseczzz{#3}% + \fi + \else + \if \headtype A% + \ifcase\absseclevel + \appendixzzz{#3}% + \or \appendixsectionzzz{#3}% + \or \appendixsubseczzz{#3}% + \or \appendixsubsubseczzz{#3}% + \fi + \else + \ifcase\absseclevel + \chapterzzz{#3}% + \or \seczzz{#3}% + \or \numberedsubseczzz{#3}% + \or \numberedsubsubseczzz{#3}% + \fi + \fi + \fi + \suppressfirstparagraphindent +} + +% an interface: +\def\numhead{\genhead N} +\def\apphead{\genhead A} +\def\unnmhead{\genhead U} + +% @chapter, @appendix, @unnumbered. Increment top-level counter, reset +% all lower-level sectioning counters to zero. +% +% Also set \chaplevelprefix, which we prepend to @float sequence numbers +% (e.g., figures), q.v. By default (before any chapter), that is empty. +\let\chaplevelprefix = \empty +% +\outer\parseargdef\chapter{\numhead0{#1}} % normally numhead0 calls chapterzzz +\def\chapterzzz#1{% + % section resetting is \global in case the chapter is in a group, such + % as an @include file. + \global\secno=0 \global\subsecno=0 \global\subsubsecno=0 + \global\advance\chapno by 1 + % + % Used for \float. + \gdef\chaplevelprefix{\the\chapno.}% + \resetallfloatnos + % + \message{\putwordChapter\space \the\chapno}% + % + % Write the actual heading. + \chapmacro{#1}{Ynumbered}{\the\chapno}% + % + % So @section and the like are numbered underneath this chapter. + \global\let\section = \numberedsec + \global\let\subsection = \numberedsubsec + \global\let\subsubsection = \numberedsubsubsec +} + +\outer\parseargdef\appendix{\apphead0{#1}} % normally apphead0 calls appendixzzz +\def\appendixzzz#1{% + \global\secno=0 \global\subsecno=0 \global\subsubsecno=0 + \global\advance\appendixno by 1 + \gdef\chaplevelprefix{\appendixletter.}% + \resetallfloatnos + % + \def\appendixnum{\putwordAppendix\space \appendixletter}% + \message{\appendixnum}% + % + \chapmacro{#1}{Yappendix}{\appendixletter}% + % + \global\let\section = \appendixsec + \global\let\subsection = \appendixsubsec + \global\let\subsubsection = \appendixsubsubsec +} + +\outer\parseargdef\unnumbered{\unnmhead0{#1}} % normally unnmhead0 calls unnumberedzzz +\def\unnumberedzzz#1{% + \global\secno=0 \global\subsecno=0 \global\subsubsecno=0 + \global\advance\unnumberedno by 1 + % + % Since an unnumbered has no number, no prefix for figures. + \global\let\chaplevelprefix = \empty + \resetallfloatnos + % + % This used to be simply \message{#1}, but TeX fully expands the + % argument to \message. Therefore, if #1 contained @-commands, TeX + % expanded them. For example, in `@unnumbered The @cite{Book}', TeX + % expanded @cite (which turns out to cause errors because \cite is meant + % to be executed, not expanded). + % + % Anyway, we don't want the fully-expanded definition of @cite to appear + % as a result of the \message, we just want `@cite' itself. We use + % \the to achieve this: TeX expands \the only once, + % simply yielding the contents of . (We also do this for + % the toc entries.) + \toks0 = {#1}% + \message{(\the\toks0)}% + % + \chapmacro{#1}{Ynothing}{\the\unnumberedno}% + % + \global\let\section = \unnumberedsec + \global\let\subsection = \unnumberedsubsec + \global\let\subsubsection = \unnumberedsubsubsec +} + +% @centerchap is like @unnumbered, but the heading is centered. +\outer\parseargdef\centerchap{% + % Well, we could do the following in a group, but that would break + % an assumption that \chapmacro is called at the outermost level. + % Thus we are safer this way: --kasal, 24feb04 + \let\centerparametersmaybe = \centerparameters + \unnmhead0{#1}% + \let\centerparametersmaybe = \relax +} + +% @top is like @unnumbered. +\let\top\unnumbered + +% Sections. +\outer\parseargdef\numberedsec{\numhead1{#1}} % normally calls seczzz +\def\seczzz#1{% + \global\subsecno=0 \global\subsubsecno=0 \global\advance\secno by 1 + \sectionheading{#1}{sec}{Ynumbered}{\the\chapno.\the\secno}% +} + +\outer\parseargdef\appendixsection{\apphead1{#1}} % normally calls appendixsectionzzz +\def\appendixsectionzzz#1{% + \global\subsecno=0 \global\subsubsecno=0 \global\advance\secno by 1 + \sectionheading{#1}{sec}{Yappendix}{\appendixletter.\the\secno}% +} +\let\appendixsec\appendixsection + +\outer\parseargdef\unnumberedsec{\unnmhead1{#1}} % normally calls unnumberedseczzz +\def\unnumberedseczzz#1{% + \global\subsecno=0 \global\subsubsecno=0 \global\advance\secno by 1 + \sectionheading{#1}{sec}{Ynothing}{\the\unnumberedno.\the\secno}% +} + +% Subsections. +\outer\parseargdef\numberedsubsec{\numhead2{#1}} % normally calls numberedsubseczzz +\def\numberedsubseczzz#1{% + \global\subsubsecno=0 \global\advance\subsecno by 1 + \sectionheading{#1}{subsec}{Ynumbered}{\the\chapno.\the\secno.\the\subsecno}% +} + +\outer\parseargdef\appendixsubsec{\apphead2{#1}} % normally calls appendixsubseczzz +\def\appendixsubseczzz#1{% + \global\subsubsecno=0 \global\advance\subsecno by 1 + \sectionheading{#1}{subsec}{Yappendix}% + {\appendixletter.\the\secno.\the\subsecno}% +} + +\outer\parseargdef\unnumberedsubsec{\unnmhead2{#1}} %normally calls unnumberedsubseczzz +\def\unnumberedsubseczzz#1{% + \global\subsubsecno=0 \global\advance\subsecno by 1 + \sectionheading{#1}{subsec}{Ynothing}% + {\the\unnumberedno.\the\secno.\the\subsecno}% +} + +% Subsubsections. +\outer\parseargdef\numberedsubsubsec{\numhead3{#1}} % normally numberedsubsubseczzz +\def\numberedsubsubseczzz#1{% + \global\advance\subsubsecno by 1 + \sectionheading{#1}{subsubsec}{Ynumbered}% + {\the\chapno.\the\secno.\the\subsecno.\the\subsubsecno}% +} + +\outer\parseargdef\appendixsubsubsec{\apphead3{#1}} % normally appendixsubsubseczzz +\def\appendixsubsubseczzz#1{% + \global\advance\subsubsecno by 1 + \sectionheading{#1}{subsubsec}{Yappendix}% + {\appendixletter.\the\secno.\the\subsecno.\the\subsubsecno}% +} + +\outer\parseargdef\unnumberedsubsubsec{\unnmhead3{#1}} %normally unnumberedsubsubseczzz +\def\unnumberedsubsubseczzz#1{% + \global\advance\subsubsecno by 1 + \sectionheading{#1}{subsubsec}{Ynothing}% + {\the\unnumberedno.\the\secno.\the\subsecno.\the\subsubsecno}% +} + +% These macros control what the section commands do, according +% to what kind of chapter we are in (ordinary, appendix, or unnumbered). +% Define them by default for a numbered chapter. +\let\section = \numberedsec +\let\subsection = \numberedsubsec +\let\subsubsection = \numberedsubsubsec + +% Define @majorheading, @heading and @subheading + +% NOTE on use of \vbox for chapter headings, section headings, and such: +% 1) We use \vbox rather than the earlier \line to permit +% overlong headings to fold. +% 2) \hyphenpenalty is set to 10000 because hyphenation in a +% heading is obnoxious; this forbids it. +% 3) Likewise, headings look best if no \parindent is used, and +% if justification is not attempted. Hence \raggedright. + + +\def\majorheading{% + {\advance\chapheadingskip by 10pt \chapbreak }% + \parsearg\chapheadingzzz +} + +\def\chapheading{\chapbreak \parsearg\chapheadingzzz} +\def\chapheadingzzz#1{% + {\chapfonts \vbox{\hyphenpenalty=10000\tolerance=5000 + \parindent=0pt\raggedright + \rm #1\hfill}}% + \bigskip \par\penalty 200\relax + \suppressfirstparagraphindent +} + +% @heading, @subheading, @subsubheading. +\parseargdef\heading{\sectionheading{#1}{sec}{Yomitfromtoc}{} + \suppressfirstparagraphindent} +\parseargdef\subheading{\sectionheading{#1}{subsec}{Yomitfromtoc}{} + \suppressfirstparagraphindent} +\parseargdef\subsubheading{\sectionheading{#1}{subsubsec}{Yomitfromtoc}{} + \suppressfirstparagraphindent} + +% These macros generate a chapter, section, etc. heading only +% (including whitespace, linebreaking, etc. around it), +% given all the information in convenient, parsed form. + +%%% Args are the skip and penalty (usually negative) +\def\dobreak#1#2{\par\ifdim\lastskip<#1\removelastskip\penalty#2\vskip#1\fi} + +%%% Define plain chapter starts, and page on/off switching for it +% Parameter controlling skip before chapter headings (if needed) + +\newskip\chapheadingskip + +\def\chapbreak{\dobreak \chapheadingskip {-4000}} +\def\chappager{\par\vfill\supereject} +\def\chapoddpage{\chappager \ifodd\pageno \else \hbox to 0pt{} \chappager\fi} + +\def\setchapternewpage #1 {\csname CHAPPAG#1\endcsname} + +\def\CHAPPAGoff{% +\global\let\contentsalignmacro = \chappager +\global\let\pchapsepmacro=\chapbreak +\global\let\pagealignmacro=\chappager} + +\def\CHAPPAGon{% +\global\let\contentsalignmacro = \chappager +\global\let\pchapsepmacro=\chappager +\global\let\pagealignmacro=\chappager +\global\def\HEADINGSon{\HEADINGSsingle}} + +\def\CHAPPAGodd{% +\global\let\contentsalignmacro = \chapoddpage +\global\let\pchapsepmacro=\chapoddpage +\global\let\pagealignmacro=\chapoddpage +\global\def\HEADINGSon{\HEADINGSdouble}} + +\CHAPPAGon + +% Chapter opening. +% +% #1 is the text, #2 is the section type (Ynumbered, Ynothing, +% Yappendix, Yomitfromtoc), #3 the chapter number. +% +% To test against our argument. +\def\Ynothingkeyword{Ynothing} +\def\Yomitfromtockeyword{Yomitfromtoc} +\def\Yappendixkeyword{Yappendix} +% +\def\chapmacro#1#2#3{% + \pchapsepmacro + {% + \chapfonts \rm + % + % Have to define \thissection before calling \donoderef, because the + % xref code eventually uses it. On the other hand, it has to be called + % after \pchapsepmacro, or the headline will change too soon. + \gdef\thissection{#1}% + \gdef\thischaptername{#1}% + % + % Only insert the separating space if we have a chapter/appendix + % number, and don't print the unnumbered ``number''. + \def\temptype{#2}% + \ifx\temptype\Ynothingkeyword + \setbox0 = \hbox{}% + \def\toctype{unnchap}% + \gdef\thischapter{#1}% + \else\ifx\temptype\Yomitfromtockeyword + \setbox0 = \hbox{}% contents like unnumbered, but no toc entry + \def\toctype{omit}% + \gdef\thischapter{}% + \else\ifx\temptype\Yappendixkeyword + \setbox0 = \hbox{\putwordAppendix{} #3\enspace}% + \def\toctype{app}% + % We don't substitute the actual chapter name into \thischapter + % because we don't want its macros evaluated now. And we don't + % use \thissection because that changes with each section. + % + \xdef\thischapter{\putwordAppendix{} \appendixletter: + \noexpand\thischaptername}% + \else + \setbox0 = \hbox{#3\enspace}% + \def\toctype{numchap}% + \xdef\thischapter{\putwordChapter{} \the\chapno: + \noexpand\thischaptername}% + \fi\fi\fi + % + % Write the toc entry for this chapter. Must come before the + % \donoderef, because we include the current node name in the toc + % entry, and \donoderef resets it to empty. + \writetocentry{\toctype}{#1}{#3}% + % + % For pdftex, we have to write out the node definition (aka, make + % the pdfdest) after any page break, but before the actual text has + % been typeset. If the destination for the pdf outline is after the + % text, then jumping from the outline may wind up with the text not + % being visible, for instance under high magnification. + \donoderef{#2}% + % + % Typeset the actual heading. + \vbox{\hyphenpenalty=10000 \tolerance=5000 \parindent=0pt \raggedright + \hangindent=\wd0 \centerparametersmaybe + \unhbox0 #1\par}% + }% + \nobreak\bigskip % no page break after a chapter title + \nobreak +} + +% @centerchap -- centered and unnumbered. +\let\centerparametersmaybe = \relax +\def\centerparameters{% + \advance\rightskip by 3\rightskip + \leftskip = \rightskip + \parfillskip = 0pt +} + + +% I don't think this chapter style is supported any more, so I'm not +% updating it with the new noderef stuff. We'll see. --karl, 11aug03. +% +\def\setchapterstyle #1 {\csname CHAPF#1\endcsname} +% +\def\unnchfopen #1{% +\chapoddpage {\chapfonts \vbox{\hyphenpenalty=10000\tolerance=5000 + \parindent=0pt\raggedright + \rm #1\hfill}}\bigskip \par\nobreak +} +\def\chfopen #1#2{\chapoddpage {\chapfonts +\vbox to 3in{\vfil \hbox to\hsize{\hfil #2} \hbox to\hsize{\hfil #1} \vfil}}% +\par\penalty 5000 % +} +\def\centerchfopen #1{% +\chapoddpage {\chapfonts \vbox{\hyphenpenalty=10000\tolerance=5000 + \parindent=0pt + \hfill {\rm #1}\hfill}}\bigskip \par\nobreak +} +\def\CHAPFopen{% + \global\let\chapmacro=\chfopen + \global\let\centerchapmacro=\centerchfopen} + + +% Section titles. These macros combine the section number parts and +% call the generic \sectionheading to do the printing. +% +\newskip\secheadingskip +\def\secheadingbreak{\dobreak \secheadingskip{-1000}} + +% Subsection titles. +\newskip\subsecheadingskip +\def\subsecheadingbreak{\dobreak \subsecheadingskip{-500}} + +% Subsubsection titles. +\def\subsubsecheadingskip{\subsecheadingskip} +\def\subsubsecheadingbreak{\subsecheadingbreak} + + +% Print any size, any type, section title. +% +% #1 is the text, #2 is the section level (sec/subsec/subsubsec), #3 is +% the section type for xrefs (Ynumbered, Ynothing, Yappendix), #4 is the +% section number. +% +\def\sectionheading#1#2#3#4{% + {% + % Switch to the right set of fonts. + \csname #2fonts\endcsname \rm + % + % Insert space above the heading. + \csname #2headingbreak\endcsname + % + % Only insert the space after the number if we have a section number. + \def\sectionlevel{#2}% + \def\temptype{#3}% + % + \ifx\temptype\Ynothingkeyword + \setbox0 = \hbox{}% + \def\toctype{unn}% + \gdef\thissection{#1}% + \else\ifx\temptype\Yomitfromtockeyword + % for @headings -- no section number, don't include in toc, + % and don't redefine \thissection. + \setbox0 = \hbox{}% + \def\toctype{omit}% + \let\sectionlevel=\empty + \else\ifx\temptype\Yappendixkeyword + \setbox0 = \hbox{#4\enspace}% + \def\toctype{app}% + \gdef\thissection{#1}% + \else + \setbox0 = \hbox{#4\enspace}% + \def\toctype{num}% + \gdef\thissection{#1}% + \fi\fi\fi + % + % Write the toc entry (before \donoderef). See comments in \chfplain. + \writetocentry{\toctype\sectionlevel}{#1}{#4}% + % + % Write the node reference (= pdf destination for pdftex). + % Again, see comments in \chfplain. + \donoderef{#3}% + % + % Output the actual section heading. + \vbox{\hyphenpenalty=10000 \tolerance=5000 \parindent=0pt \raggedright + \hangindent=\wd0 % zero if no section number + \unhbox0 #1}% + }% + % Add extra space after the heading -- half of whatever came above it. + % Don't allow stretch, though. + \kern .5 \csname #2headingskip\endcsname + % + % Do not let the kern be a potential breakpoint, as it would be if it + % was followed by glue. + \nobreak + % + % We'll almost certainly start a paragraph next, so don't let that + % glue accumulate. (Not a breakpoint because it's preceded by a + % discardable item.) + \vskip-\parskip + % + % This is purely so the last item on the list is a known \penalty > + % 10000. This is so \startdefun can avoid allowing breakpoints after + % section headings. Otherwise, it would insert a valid breakpoint between: + % + % @section sec-whatever + % @deffn def-whatever + \penalty 10001 +} + + +\message{toc,} +% Table of contents. +\newwrite\tocfile + +% Write an entry to the toc file, opening it if necessary. +% Called from @chapter, etc. +% +% Example usage: \writetocentry{sec}{Section Name}{\the\chapno.\the\secno} +% We append the current node name (if any) and page number as additional +% arguments for the \{chap,sec,...}entry macros which will eventually +% read this. The node name is used in the pdf outlines as the +% destination to jump to. +% +% We open the .toc file for writing here instead of at @setfilename (or +% any other fixed time) so that @contents can be anywhere in the document. +% But if #1 is `omit', then we don't do anything. This is used for the +% table of contents chapter openings themselves. +% +\newif\iftocfileopened +\def\omitkeyword{omit}% +% +\def\writetocentry#1#2#3{% + \edef\writetoctype{#1}% + \ifx\writetoctype\omitkeyword \else + \iftocfileopened\else + \immediate\openout\tocfile = \jobname.toc + \global\tocfileopenedtrue + \fi + % + \iflinks + {\atdummies + \edef\temp{% + \write\tocfile{@#1entry{#2}{#3}{\lastnode}{\noexpand\folio}}}% + \temp + } + \fi + \fi + % + % Tell \shipout to create a pdf destination on each page, if we're + % writing pdf. These are used in the table of contents. We can't + % just write one on every page because the title pages are numbered + % 1 and 2 (the page numbers aren't printed), and so are the first + % two pages of the document. Thus, we'd have two destinations named + % `1', and two named `2'. + \ifpdf \global\pdfmakepagedesttrue \fi +} + + +% These characters do not print properly in the Computer Modern roman +% fonts, so we must take special care. This is more or less redundant +% with the Texinfo input format setup at the end of this file. +% +\def\activecatcodes{% + \catcode`\"=\active + \catcode`\$=\active + \catcode`\<=\active + \catcode`\>=\active + \catcode`\\=\active + \catcode`\^=\active + \catcode`\_=\active + \catcode`\|=\active + \catcode`\~=\active +} + + +% Read the toc file, which is essentially Texinfo input. +\def\readtocfile{% + \setupdatafile + \activecatcodes + \input \jobname.toc +} + +\newskip\contentsrightmargin \contentsrightmargin=1in +\newcount\savepageno +\newcount\lastnegativepageno \lastnegativepageno = -1 + +% Prepare to read what we've written to \tocfile. +% +\def\startcontents#1{% + % If @setchapternewpage on, and @headings double, the contents should + % start on an odd page, unlike chapters. Thus, we maintain + % \contentsalignmacro in parallel with \pagealignmacro. + % From: Torbjorn Granlund + \contentsalignmacro + \immediate\closeout\tocfile + % + % Don't need to put `Contents' or `Short Contents' in the headline. + % It is abundantly clear what they are. + \def\thischapter{}% + \chapmacro{#1}{Yomitfromtoc}{}% + % + \savepageno = \pageno + \begingroup % Set up to handle contents files properly. + \raggedbottom % Worry more about breakpoints than the bottom. + \advance\hsize by -\contentsrightmargin % Don't use the full line length. + % + % Roman numerals for page numbers. + \ifnum \pageno>0 \global\pageno = \lastnegativepageno \fi +} + + +% Normal (long) toc. +\def\contents{% + \startcontents{\putwordTOC}% + \openin 1 \jobname.toc + \ifeof 1 \else + \readtocfile + \fi + \vfill \eject + \contentsalignmacro % in case @setchapternewpage odd is in effect + \ifeof 1 \else + \pdfmakeoutlines + \fi + \closein 1 + \endgroup + \lastnegativepageno = \pageno + \global\pageno = \savepageno +} + +% And just the chapters. +\def\summarycontents{% + \startcontents{\putwordShortTOC}% + % + \let\numchapentry = \shortchapentry + \let\appentry = \shortchapentry + \let\unnchapentry = \shortunnchapentry + % We want a true roman here for the page numbers. + \secfonts + \let\rm=\shortcontrm \let\bf=\shortcontbf + \let\sl=\shortcontsl \let\tt=\shortconttt + \rm + \hyphenpenalty = 10000 + \advance\baselineskip by 1pt % Open it up a little. + \def\numsecentry##1##2##3##4{} + \let\appsecentry = \numsecentry + \let\unnsecentry = \numsecentry + \let\numsubsecentry = \numsecentry + \let\appsubsecentry = \numsecentry + \let\unnsubsecentry = \numsecentry + \let\numsubsubsecentry = \numsecentry + \let\appsubsubsecentry = \numsecentry + \let\unnsubsubsecentry = \numsecentry + \openin 1 \jobname.toc + \ifeof 1 \else + \readtocfile + \fi + \closein 1 + \vfill \eject + \contentsalignmacro % in case @setchapternewpage odd is in effect + \endgroup + \lastnegativepageno = \pageno + \global\pageno = \savepageno +} +\let\shortcontents = \summarycontents + +% Typeset the label for a chapter or appendix for the short contents. +% The arg is, e.g., `A' for an appendix, or `3' for a chapter. +% +\def\shortchaplabel#1{% + % This space should be enough, since a single number is .5em, and the + % widest letter (M) is 1em, at least in the Computer Modern fonts. + % But use \hss just in case. + % (This space doesn't include the extra space that gets added after + % the label; that gets put in by \shortchapentry above.) + % + % We'd like to right-justify chapter numbers, but that looks strange + % with appendix letters. And right-justifying numbers and + % left-justifying letters looks strange when there is less than 10 + % chapters. Have to read the whole toc once to know how many chapters + % there are before deciding ... + \hbox to 1em{#1\hss}% +} + +% These macros generate individual entries in the table of contents. +% The first argument is the chapter or section name. +% The last argument is the page number. +% The arguments in between are the chapter number, section number, ... + +% Chapters, in the main contents. +\def\numchapentry#1#2#3#4{\dochapentry{#2\labelspace#1}{#4}} +% +% Chapters, in the short toc. +% See comments in \dochapentry re vbox and related settings. +\def\shortchapentry#1#2#3#4{% + \tocentry{\shortchaplabel{#2}\labelspace #1}{\doshortpageno\bgroup#4\egroup}% +} + +% Appendices, in the main contents. +% Need the word Appendix, and a fixed-size box. +% +\def\appendixbox#1{% + % We use M since it's probably the widest letter. + \setbox0 = \hbox{\putwordAppendix{} M}% + \hbox to \wd0{\putwordAppendix{} #1\hss}} +% +\def\appentry#1#2#3#4{\dochapentry{\appendixbox{#2}\labelspace#1}{#4}} + +% Unnumbered chapters. +\def\unnchapentry#1#2#3#4{\dochapentry{#1}{#4}} +\def\shortunnchapentry#1#2#3#4{\tocentry{#1}{\doshortpageno\bgroup#4\egroup}} + +% Sections. +\def\numsecentry#1#2#3#4{\dosecentry{#2\labelspace#1}{#4}} +\let\appsecentry=\numsecentry +\def\unnsecentry#1#2#3#4{\dosecentry{#1}{#4}} + +% Subsections. +\def\numsubsecentry#1#2#3#4{\dosubsecentry{#2\labelspace#1}{#4}} +\let\appsubsecentry=\numsubsecentry +\def\unnsubsecentry#1#2#3#4{\dosubsecentry{#1}{#4}} + +% And subsubsections. +\def\numsubsubsecentry#1#2#3#4{\dosubsubsecentry{#2\labelspace#1}{#4}} +\let\appsubsubsecentry=\numsubsubsecentry +\def\unnsubsubsecentry#1#2#3#4{\dosubsubsecentry{#1}{#4}} + +% This parameter controls the indentation of the various levels. +% Same as \defaultparindent. +\newdimen\tocindent \tocindent = 15pt + +% Now for the actual typesetting. In all these, #1 is the text and #2 is the +% page number. +% +% If the toc has to be broken over pages, we want it to be at chapters +% if at all possible; hence the \penalty. +\def\dochapentry#1#2{% + \penalty-300 \vskip1\baselineskip plus.33\baselineskip minus.25\baselineskip + \begingroup + \chapentryfonts + \tocentry{#1}{\dopageno\bgroup#2\egroup}% + \endgroup + \nobreak\vskip .25\baselineskip plus.1\baselineskip +} + +\def\dosecentry#1#2{\begingroup + \secentryfonts \leftskip=\tocindent + \tocentry{#1}{\dopageno\bgroup#2\egroup}% +\endgroup} + +\def\dosubsecentry#1#2{\begingroup + \subsecentryfonts \leftskip=2\tocindent + \tocentry{#1}{\dopageno\bgroup#2\egroup}% +\endgroup} + +\def\dosubsubsecentry#1#2{\begingroup + \subsubsecentryfonts \leftskip=3\tocindent + \tocentry{#1}{\dopageno\bgroup#2\egroup}% +\endgroup} + +% We use the same \entry macro as for the index entries. +\let\tocentry = \entry + +% Space between chapter (or whatever) number and the title. +\def\labelspace{\hskip1em \relax} + +\def\dopageno#1{{\rm #1}} +\def\doshortpageno#1{{\rm #1}} + +\def\chapentryfonts{\secfonts \rm} +\def\secentryfonts{\textfonts} +\def\subsecentryfonts{\textfonts} +\def\subsubsecentryfonts{\textfonts} + + +\message{environments,} +% @foo ... @end foo. + +% @point{}, @result{}, @expansion{}, @print{}, @equiv{}. +% +% Since these characters are used in examples, it should be an even number of +% \tt widths. Each \tt character is 1en, so two makes it 1em. +% +\def\point{$\star$} +\def\result{\leavevmode\raise.15ex\hbox to 1em{\hfil$\Rightarrow$\hfil}} +\def\expansion{\leavevmode\raise.1ex\hbox to 1em{\hfil$\mapsto$\hfil}} +\def\print{\leavevmode\lower.1ex\hbox to 1em{\hfil$\dashv$\hfil}} +\def\equiv{\leavevmode\lower.1ex\hbox to 1em{\hfil$\ptexequiv$\hfil}} + +% The @error{} command. +% Adapted from the TeXbook's \boxit. +% +\newbox\errorbox +% +{\tentt \global\dimen0 = 3em}% Width of the box. +\dimen2 = .55pt % Thickness of rules +% The text. (`r' is open on the right, `e' somewhat less so on the left.) +\setbox0 = \hbox{\kern-.75pt \tensf error\kern-1.5pt} +% +\setbox\errorbox=\hbox to \dimen0{\hfil + \hsize = \dimen0 \advance\hsize by -5.8pt % Space to left+right. + \advance\hsize by -2\dimen2 % Rules. + \vbox{% + \hrule height\dimen2 + \hbox{\vrule width\dimen2 \kern3pt % Space to left of text. + \vtop{\kern2.4pt \box0 \kern2.4pt}% Space above/below. + \kern3pt\vrule width\dimen2}% Space to right. + \hrule height\dimen2} + \hfil} +% +\def\error{\leavevmode\lower.7ex\copy\errorbox} + +% @tex ... @end tex escapes into raw Tex temporarily. +% One exception: @ is still an escape character, so that @end tex works. +% But \@ or @@ will get a plain tex @ character. + +\envdef\tex{% + \catcode `\\=0 \catcode `\{=1 \catcode `\}=2 + \catcode `\$=3 \catcode `\&=4 \catcode `\#=6 + \catcode `\^=7 \catcode `\_=8 \catcode `\~=\active \let~=\tie + \catcode `\%=14 + \catcode `\+=\other + \catcode `\"=\other + \catcode `\|=\other + \catcode `\<=\other + \catcode `\>=\other + \escapechar=`\\ + % + \let\b=\ptexb + \let\bullet=\ptexbullet + \let\c=\ptexc + \let\,=\ptexcomma + \let\.=\ptexdot + \let\dots=\ptexdots + \let\equiv=\ptexequiv + \let\!=\ptexexclam + \let\i=\ptexi + \let\indent=\ptexindent + \let\noindent=\ptexnoindent + \let\{=\ptexlbrace + \let\+=\tabalign + \let\}=\ptexrbrace + \let\/=\ptexslash + \let\*=\ptexstar + \let\t=\ptext + \let\frenchspacing=\plainfrenchspacing + % + \def\endldots{\mathinner{\ldots\ldots\ldots\ldots}}% + \def\enddots{\relax\ifmmode\endldots\else$\mathsurround=0pt \endldots\,$\fi}% + \def\@{@}% +} +% There is no need to define \Etex. + +% Define @lisp ... @end lisp. +% @lisp environment forms a group so it can rebind things, +% including the definition of @end lisp (which normally is erroneous). + +% Amount to narrow the margins by for @lisp. +\newskip\lispnarrowing \lispnarrowing=0.4in + +% This is the definition that ^^M gets inside @lisp, @example, and other +% such environments. \null is better than a space, since it doesn't +% have any width. +\def\lisppar{\null\endgraf} + +% This space is always present above and below environments. +\newskip\envskipamount \envskipamount = 0pt + +% Make spacing and below environment symmetrical. We use \parskip here +% to help in doing that, since in @example-like environments \parskip +% is reset to zero; thus the \afterenvbreak inserts no space -- but the +% start of the next paragraph will insert \parskip. +% +\def\aboveenvbreak{{% + % =10000 instead of <10000 because of a special case in \itemzzz and + % \sectionheading, q.v. + \ifnum \lastpenalty=10000 \else + \advance\envskipamount by \parskip + \endgraf + \ifdim\lastskip<\envskipamount + \removelastskip + % it's not a good place to break if the last penalty was \nobreak + % or better ... + \ifnum\lastpenalty<10000 \penalty-50 \fi + \vskip\envskipamount + \fi + \fi +}} + +\let\afterenvbreak = \aboveenvbreak + +% \nonarrowing is a flag. If "set", @lisp etc don't narrow margins; it will +% also clear it, so that its embedded environments do the narrowing again. +\let\nonarrowing=\relax + +% @cartouche ... @end cartouche: draw rectangle w/rounded corners around +% environment contents. +\font\circle=lcircle10 +\newdimen\circthick +\newdimen\cartouter\newdimen\cartinner +\newskip\normbskip\newskip\normpskip\newskip\normlskip +\circthick=\fontdimen8\circle +% +\def\ctl{{\circle\char'013\hskip -6pt}}% 6pt from pl file: 1/2charwidth +\def\ctr{{\hskip 6pt\circle\char'010}} +\def\cbl{{\circle\char'012\hskip -6pt}} +\def\cbr{{\hskip 6pt\circle\char'011}} +\def\carttop{\hbox to \cartouter{\hskip\lskip + \ctl\leaders\hrule height\circthick\hfil\ctr + \hskip\rskip}} +\def\cartbot{\hbox to \cartouter{\hskip\lskip + \cbl\leaders\hrule height\circthick\hfil\cbr + \hskip\rskip}} +% +\newskip\lskip\newskip\rskip + +\envdef\cartouche{% + \ifhmode\par\fi % can't be in the midst of a paragraph. + \startsavinginserts + \lskip=\leftskip \rskip=\rightskip + \leftskip=0pt\rightskip=0pt % we want these *outside*. + \cartinner=\hsize \advance\cartinner by-\lskip + \advance\cartinner by-\rskip + \cartouter=\hsize + \advance\cartouter by 18.4pt % allow for 3pt kerns on either + % side, and for 6pt waste from + % each corner char, and rule thickness + \normbskip=\baselineskip \normpskip=\parskip \normlskip=\lineskip + % Flag to tell @lisp, etc., not to narrow margin. + \let\nonarrowing = t% + \vbox\bgroup + \baselineskip=0pt\parskip=0pt\lineskip=0pt + \carttop + \hbox\bgroup + \hskip\lskip + \vrule\kern3pt + \vbox\bgroup + \kern3pt + \hsize=\cartinner + \baselineskip=\normbskip + \lineskip=\normlskip + \parskip=\normpskip + \vskip -\parskip + \comment % For explanation, see the end of \def\group. +} +\def\Ecartouche{% + \ifhmode\par\fi + \kern3pt + \egroup + \kern3pt\vrule + \hskip\rskip + \egroup + \cartbot + \egroup + \checkinserts +} + + +% This macro is called at the beginning of all the @example variants, +% inside a group. +\def\nonfillstart{% + \aboveenvbreak + \hfuzz = 12pt % Don't be fussy + \sepspaces % Make spaces be word-separators rather than space tokens. + \let\par = \lisppar % don't ignore blank lines + \obeylines % each line of input is a line of output + \parskip = 0pt + \parindent = 0pt + \emergencystretch = 0pt % don't try to avoid overfull boxes + \ifx\nonarrowing\relax + \advance \leftskip by \lispnarrowing + \exdentamount=\lispnarrowing + \else + \let\nonarrowing = \relax + \fi + \let\exdent=\nofillexdent +} + +% If you want all examples etc. small: @set dispenvsize small. +% If you want even small examples the full size: @set dispenvsize nosmall. +% This affects the following displayed environments: +% @example, @display, @format, @lisp +% +\def\smallword{small} +\def\nosmallword{nosmall} +\let\SETdispenvsize\relax +\def\setnormaldispenv{% + \ifx\SETdispenvsize\smallword + \smallexamplefonts \rm + \fi +} +\def\setsmalldispenv{% + \ifx\SETdispenvsize\nosmallword + \else + \smallexamplefonts \rm + \fi +} + +% We often define two environments, @foo and @smallfoo. +% Let's do it by one command: +\def\makedispenv #1#2{ + \expandafter\envdef\csname#1\endcsname {\setnormaldispenv #2} + \expandafter\envdef\csname small#1\endcsname {\setsmalldispenv #2} + \expandafter\let\csname E#1\endcsname \afterenvbreak + \expandafter\let\csname Esmall#1\endcsname \afterenvbreak +} + +% Define two synonyms: +\def\maketwodispenvs #1#2#3{ + \makedispenv{#1}{#3} + \makedispenv{#2}{#3} +} + +% @lisp: indented, narrowed, typewriter font; @example: same as @lisp. +% +% @smallexample and @smalllisp: use smaller fonts. +% Originally contributed by Pavel@xerox. +% +\maketwodispenvs {lisp}{example}{% + \nonfillstart + \tt + \let\kbdfont = \kbdexamplefont % Allow @kbd to do something special. + \gobble % eat return +} + +% @display/@smalldisplay: same as @lisp except keep current font. +% +\makedispenv {display}{% + \nonfillstart + \gobble +} + +% @format/@smallformat: same as @display except don't narrow margins. +% +\makedispenv{format}{% + \let\nonarrowing = t% + \nonfillstart + \gobble +} + +% @flushleft: same as @format, but doesn't obey \SETdispenvsize. +\envdef\flushleft{% + \let\nonarrowing = t% + \nonfillstart + \gobble +} +\let\Eflushleft = \afterenvbreak + +% @flushright. +% +\envdef\flushright{% + \let\nonarrowing = t% + \nonfillstart + \advance\leftskip by 0pt plus 1fill + \gobble +} +\let\Eflushright = \afterenvbreak + + +% @quotation does normal linebreaking (hence we can't use \nonfillstart) +% and narrows the margins. We keep \parskip nonzero in general, since +% we're doing normal filling. So, when using \aboveenvbreak and +% \afterenvbreak, temporarily make \parskip 0. +% +\envdef\quotation{% + {\parskip=0pt \aboveenvbreak}% because \aboveenvbreak inserts \parskip + \parindent=0pt + % + % @cartouche defines \nonarrowing to inhibit narrowing at next level down. + \ifx\nonarrowing\relax + \advance\leftskip by \lispnarrowing + \advance\rightskip by \lispnarrowing + \exdentamount = \lispnarrowing + \else + \let\nonarrowing = \relax + \fi + \parsearg\quotationlabel +} + +% We have retained a nonzero parskip for the environment, since we're +% doing normal filling. +% +\def\Equotation{% + \par + \ifx\quotationauthor\undefined\else + % indent a bit. + \leftline{\kern 2\leftskip \sl ---\quotationauthor}% + \fi + {\parskip=0pt \afterenvbreak}% +} + +% If we're given an argument, typeset it in bold with a colon after. +\def\quotationlabel#1{% + \def\temp{#1}% + \ifx\temp\empty \else + {\bf #1: }% + \fi +} + + +% LaTeX-like @verbatim...@end verbatim and @verb{...} +% If we want to allow any as delimiter, +% we need the curly braces so that makeinfo sees the @verb command, eg: +% `@verbx...x' would look like the '@verbx' command. --janneke@gnu.org +% +% [Knuth]: Donald Ervin Knuth, 1996. The TeXbook. +% +% [Knuth] p.344; only we need to do the other characters Texinfo sets +% active too. Otherwise, they get lost as the first character on a +% verbatim line. +\def\dospecials{% + \do\ \do\\\do\{\do\}\do\$\do\&% + \do\#\do\^\do\^^K\do\_\do\^^A\do\%\do\~% + \do\<\do\>\do\|\do\@\do+\do\"% +} +% +% [Knuth] p. 380 +\def\uncatcodespecials{% + \def\do##1{\catcode`##1=\other}\dospecials} +% +% [Knuth] pp. 380,381,391 +% Disable Spanish ligatures ?` and !` of \tt font +\begingroup + \catcode`\`=\active\gdef`{\relax\lq} +\endgroup +% +% Setup for the @verb command. +% +% Eight spaces for a tab +\begingroup + \catcode`\^^I=\active + \gdef\tabeightspaces{\catcode`\^^I=\active\def^^I{\ \ \ \ \ \ \ \ }} +\endgroup +% +\def\setupverb{% + \tt % easiest (and conventionally used) font for verbatim + \def\par{\leavevmode\endgraf}% + \catcode`\`=\active + \tabeightspaces + % Respect line breaks, + % print special symbols as themselves, and + % make each space count + % must do in this order: + \obeylines \uncatcodespecials \sepspaces +} + +% Setup for the @verbatim environment +% +% Real tab expansion +\newdimen\tabw \setbox0=\hbox{\tt\space} \tabw=8\wd0 % tab amount +% +\def\starttabbox{\setbox0=\hbox\bgroup} +\begingroup + \catcode`\^^I=\active + \gdef\tabexpand{% + \catcode`\^^I=\active + \def^^I{\leavevmode\egroup + \dimen0=\wd0 % the width so far, or since the previous tab + \divide\dimen0 by\tabw + \multiply\dimen0 by\tabw % compute previous multiple of \tabw + \advance\dimen0 by\tabw % advance to next multiple of \tabw + \wd0=\dimen0 \box0 \starttabbox + }% + } +\endgroup +\def\setupverbatim{% + \let\nonarrowing = t% + \nonfillstart + % Easiest (and conventionally used) font for verbatim + \tt + \def\par{\leavevmode\egroup\box0\endgraf}% + \catcode`\`=\active + \tabexpand + % Respect line breaks, + % print special symbols as themselves, and + % make each space count + % must do in this order: + \obeylines \uncatcodespecials \sepspaces + \everypar{\starttabbox}% +} + +% Do the @verb magic: verbatim text is quoted by unique +% delimiter characters. Before first delimiter expect a +% right brace, after last delimiter expect closing brace: +% +% \def\doverb'{'#1'}'{#1} +% +% [Knuth] p. 382; only eat outer {} +\begingroup + \catcode`[=1\catcode`]=2\catcode`\{=\other\catcode`\}=\other + \gdef\doverb{#1[\def\next##1#1}[##1\endgroup]\next] +\endgroup +% +\def\verb{\begingroup\setupverb\doverb} +% +% +% Do the @verbatim magic: define the macro \doverbatim so that +% the (first) argument ends when '@end verbatim' is reached, ie: +% +% \def\doverbatim#1@end verbatim{#1} +% +% For Texinfo it's a lot easier than for LaTeX, +% because texinfo's \verbatim doesn't stop at '\end{verbatim}': +% we need not redefine '\', '{' and '}'. +% +% Inspired by LaTeX's verbatim command set [latex.ltx] +% +\begingroup + \catcode`\ =\active + \obeylines % + % ignore everything up to the first ^^M, that's the newline at the end + % of the @verbatim input line itself. Otherwise we get an extra blank + % line in the output. + \xdef\doverbatim#1^^M#2@end verbatim{#2\noexpand\end\gobble verbatim}% + % We really want {...\end verbatim} in the body of the macro, but + % without the active space; thus we have to use \xdef and \gobble. +\endgroup +% +\envdef\verbatim{% + \setupverbatim\doverbatim +} +\let\Everbatim = \afterenvbreak + + +% @verbatiminclude FILE - insert text of file in verbatim environment. +% +\def\verbatiminclude{\parseargusing\filenamecatcodes\doverbatiminclude} +% +\def\doverbatiminclude#1{% + {% + \makevalueexpandable + \setupverbatim + \input #1 + \afterenvbreak + }% +} + +% @copying ... @end copying. +% Save the text away for @insertcopying later. +% +% We save the uninterpreted tokens, rather than creating a box. +% Saving the text in a box would be much easier, but then all the +% typesetting commands (@smallbook, font changes, etc.) have to be done +% beforehand -- and a) we want @copying to be done first in the source +% file; b) letting users define the frontmatter in as flexible order as +% possible is very desirable. +% +\def\copying{\checkenv{}\begingroup\scanargctxt\docopying} +\def\docopying#1@end copying{\endgroup\def\copyingtext{#1}} +% +\def\insertcopying{% + \begingroup + \parindent = 0pt % paragraph indentation looks wrong on title page + \scanexp\copyingtext + \endgroup +} + +\message{defuns,} +% @defun etc. + +\newskip\defbodyindent \defbodyindent=.4in +\newskip\defargsindent \defargsindent=50pt +\newskip\deflastargmargin \deflastargmargin=18pt + +% Start the processing of @deffn: +\def\startdefun{% + \ifnum\lastpenalty<10000 + \medbreak + \else + % If there are two @def commands in a row, we'll have a \nobreak, + % which is there to keep the function description together with its + % header. But if there's nothing but headers, we need to allow a + % break somewhere. Check specifically for penalty 10002, inserted + % by \defargscommonending, instead of 10000, since the sectioning + % commands also insert a nobreak penalty, and we don't want to allow + % a break between a section heading and a defun. + % + \ifnum\lastpenalty=10002 \penalty2000 \fi + % + % Similarly, after a section heading, do not allow a break. + % But do insert the glue. + \medskip % preceded by discardable penalty, so not a breakpoint + \fi + % + \parindent=0in + \advance\leftskip by \defbodyindent + \exdentamount=\defbodyindent +} + +\def\dodefunx#1{% + % First, check whether we are in the right environment: + \checkenv#1% + % + % As above, allow line break if we have multiple x headers in a row. + % It's not a great place, though. + \ifnum\lastpenalty=10002 \penalty3000 \fi + % + % And now, it's time to reuse the body of the original defun: + \expandafter\gobbledefun#1% +} +\def\gobbledefun#1\startdefun{} + +% \printdefunline \deffnheader{text} +% +\def\printdefunline#1#2{% + \begingroup + % call \deffnheader: + #1#2 \endheader + % common ending: + \interlinepenalty = 10000 + \advance\rightskip by 0pt plus 1fil + \endgraf + \nobreak\vskip -\parskip + \penalty 10002 % signal to \startdefun and \dodefunx + % Some of the @defun-type tags do not enable magic parentheses, + % rendering the following check redundant. But we don't optimize. + \checkparencounts + \endgroup +} + +\def\Edefun{\endgraf\medbreak} + +% \makedefun{deffn} creates \deffn, \deffnx and \Edeffn; +% the only thing remainnig is to define \deffnheader. +% +\def\makedefun#1{% + \expandafter\let\csname E#1\endcsname = \Edefun + \edef\temp{\noexpand\domakedefun + \makecsname{#1}\makecsname{#1x}\makecsname{#1header}}% + \temp +} + +% \domakedefun \deffn \deffnx \deffnheader +% +% Define \deffn and \deffnx, without parameters. +% \deffnheader has to be defined explicitly. +% +\def\domakedefun#1#2#3{% + \envdef#1{% + \startdefun + \parseargusing\activeparens{\printdefunline#3}% + }% + \def#2{\dodefunx#1}% + \def#3% +} + +%%% Untyped functions: + +% @deffn category name args +\makedefun{deffn}{\deffngeneral{}} + +% @deffn category class name args +\makedefun{defop}#1 {\defopon{#1\ \putwordon}} + +% \defopon {category on}class name args +\def\defopon#1#2 {\deffngeneral{\putwordon\ \code{#2}}{#1\ \code{#2}} } + +% \deffngeneral {subind}category name args +% +\def\deffngeneral#1#2 #3 #4\endheader{% + % Remember that \dosubind{fn}{foo}{} is equivalent to \doind{fn}{foo}. + \dosubind{fn}{\code{#3}}{#1}% + \defname{#2}{}{#3}\magicamp\defunargs{#4\unskip}% +} + +%%% Typed functions: + +% @deftypefn category type name args +\makedefun{deftypefn}{\deftypefngeneral{}} + +% @deftypeop category class type name args +\makedefun{deftypeop}#1 {\deftypeopon{#1\ \putwordon}} + +% \deftypeopon {category on}class type name args +\def\deftypeopon#1#2 {\deftypefngeneral{\putwordon\ \code{#2}}{#1\ \code{#2}} } + +% \deftypefngeneral {subind}category type name args +% +\def\deftypefngeneral#1#2 #3 #4 #5\endheader{% + \dosubind{fn}{\code{#4}}{#1}% + \defname{#2}{#3}{#4}\defunargs{#5\unskip}% +} + +%%% Typed variables: + +% @deftypevr category type var args +\makedefun{deftypevr}{\deftypecvgeneral{}} + +% @deftypecv category class type var args +\makedefun{deftypecv}#1 {\deftypecvof{#1\ \putwordof}} + +% \deftypecvof {category of}class type var args +\def\deftypecvof#1#2 {\deftypecvgeneral{\putwordof\ \code{#2}}{#1\ \code{#2}} } + +% \deftypecvgeneral {subind}category type var args +% +\def\deftypecvgeneral#1#2 #3 #4 #5\endheader{% + \dosubind{vr}{\code{#4}}{#1}% + \defname{#2}{#3}{#4}\defunargs{#5\unskip}% +} + +%%% Untyped variables: + +% @defvr category var args +\makedefun{defvr}#1 {\deftypevrheader{#1} {} } + +% @defcv category class var args +\makedefun{defcv}#1 {\defcvof{#1\ \putwordof}} + +% \defcvof {category of}class var args +\def\defcvof#1#2 {\deftypecvof{#1}#2 {} } + +%%% Type: +% @deftp category name args +\makedefun{deftp}#1 #2 #3\endheader{% + \doind{tp}{\code{#2}}% + \defname{#1}{}{#2}\defunargs{#3\unskip}% +} + +% Remaining @defun-like shortcuts: +\makedefun{defun}{\deffnheader{\putwordDeffunc} } +\makedefun{defmac}{\deffnheader{\putwordDefmac} } +\makedefun{defspec}{\deffnheader{\putwordDefspec} } +\makedefun{deftypefun}{\deftypefnheader{\putwordDeffunc} } +\makedefun{defvar}{\defvrheader{\putwordDefvar} } +\makedefun{defopt}{\defvrheader{\putwordDefopt} } +\makedefun{deftypevar}{\deftypevrheader{\putwordDefvar} } +\makedefun{defmethod}{\defopon\putwordMethodon} +\makedefun{deftypemethod}{\deftypeopon\putwordMethodon} +\makedefun{defivar}{\defcvof\putwordInstanceVariableof} +\makedefun{deftypeivar}{\deftypecvof\putwordInstanceVariableof} + +% \defname, which formats the name of the @def (not the args). +% #1 is the category, such as "Function". +% #2 is the return type, if any. +% #3 is the function name. +% +% We are followed by (but not passed) the arguments, if any. +% +\def\defname#1#2#3{% + % Get the values of \leftskip and \rightskip as they were outside the @def... + \advance\leftskip by -\defbodyindent + % + % How we'll format the type name. Putting it in brackets helps + % distinguish it from the body text that may end up on the next line + % just below it. + \def\temp{#1}% + \setbox0=\hbox{\kern\deflastargmargin \ifx\temp\empty\else [\rm\temp]\fi} + % + % Figure out line sizes for the paragraph shape. + % The first line needs space for \box0; but if \rightskip is nonzero, + % we need only space for the part of \box0 which exceeds it: + \dimen0=\hsize \advance\dimen0 by -\wd0 \advance\dimen0 by \rightskip + % The continuations: + \dimen2=\hsize \advance\dimen2 by -\defargsindent + % (plain.tex says that \dimen1 should be used only as global.) + \parshape 2 0in \dimen0 \defargsindent \dimen2 + % + % Put the type name to the right margin. + \noindent + \hbox to 0pt{% + \hfil\box0 \kern-\hsize + % \hsize has to be shortened this way: + \kern\leftskip + % Intentionally do not respect \rightskip, since we need the space. + }% + % + % Allow all lines to be underfull without complaint: + \tolerance=10000 \hbadness=10000 + \exdentamount=\defbodyindent + {% + % defun fonts. We use typewriter by default (used to be bold) because: + % . we're printing identifiers, they should be in tt in principle. + % . in languages with many accents, such as Czech or French, it's + % common to leave accents off identifiers. The result looks ok in + % tt, but exceedingly strange in rm. + % . we don't want -- and --- to be treated as ligatures. + % . this still does not fix the ?` and !` ligatures, but so far no + % one has made identifiers using them :). + \df \tt + \def\temp{#2}% return value type + \ifx\temp\empty\else \tclose{\temp} \fi + #3% output function name + }% + {\rm\enskip}% hskip 0.5 em of \tenrm + % + \boldbrax + % arguments will be output next, if any. +} + +% Print arguments in slanted roman (not ttsl), inconsistently with using +% tt for the name. This is because literal text is sometimes needed in +% the argument list (groff manual), and ttsl and tt are not very +% distinguishable. Prevent hyphenation at `-' chars. +% +\def\defunargs#1{% + % use sl by default (not ttsl), + % tt for the names. + \df \sl \hyphenchar\font=0 + % + % On the other hand, if an argument has two dashes (for instance), we + % want a way to get ttsl. Let's try @var for that. + \let\var=\ttslanted + #1% + \sl\hyphenchar\font=45 +} + +% We want ()&[] to print specially on the defun line. +% +\def\activeparens{% + \catcode`\(=\active \catcode`\)=\active + \catcode`\[=\active \catcode`\]=\active + \catcode`\&=\active +} + +% Make control sequences which act like normal parenthesis chars. +\let\lparen = ( \let\rparen = ) + +% Be sure that we always have a definition for `(', etc. For example, +% if the fn name has parens in it, \boldbrax will not be in effect yet, +% so TeX would otherwise complain about undefined control sequence. +{ + \activeparens + \global\let(=\lparen \global\let)=\rparen + \global\let[=\lbrack \global\let]=\rbrack + \global\let& = \& + + \gdef\boldbrax{\let(=\opnr\let)=\clnr\let[=\lbrb\let]=\rbrb} + \gdef\magicamp{\let&=\amprm} +} + +\newcount\parencount + +% If we encounter &foo, then turn on ()-hacking afterwards +\newif\ifampseen +\def\amprm#1 {\ampseentrue{\bf\ }} + +\def\parenfont{% + \ifampseen + % At the first level, print parens in roman, + % otherwise use the default font. + \ifnum \parencount=1 \rm \fi + \else + % The \sf parens (in \boldbrax) actually are a little bolder than + % the contained text. This is especially needed for [ and ] . + \sf + \fi +} +\def\infirstlevel#1{% + \ifampseen + \ifnum\parencount=1 + #1% + \fi + \fi +} +\def\bfafterword#1 {#1 \bf} + +\def\opnr{% + \global\advance\parencount by 1 + {\parenfont(}% + \infirstlevel \bfafterword +} +\def\clnr{% + {\parenfont)}% + \infirstlevel \sl + \global\advance\parencount by -1 +} + +\newcount\brackcount +\def\lbrb{% + \global\advance\brackcount by 1 + {\bf[}% +} +\def\rbrb{% + {\bf]}% + \global\advance\brackcount by -1 +} + +\def\checkparencounts{% + \ifnum\parencount=0 \else \badparencount \fi + \ifnum\brackcount=0 \else \badbrackcount \fi +} +\def\badparencount{% + \errmessage{Unbalanced parentheses in @def}% + \global\parencount=0 +} +\def\badbrackcount{% + \errmessage{Unbalanced square braces in @def}% + \global\brackcount=0 +} + + +\message{macros,} +% @macro. + +% To do this right we need a feature of e-TeX, \scantokens, +% which we arrange to emulate with a temporary file in ordinary TeX. +\ifx\eTeXversion\undefined + \newwrite\macscribble + \def\scantokens#1{% + \toks0={#1}% + \immediate\openout\macscribble=\jobname.tmp + \immediate\write\macscribble{\the\toks0}% + \immediate\closeout\macscribble + \input \jobname.tmp + } +\fi + +\def\scanmacro#1{% + \begingroup + \newlinechar`\^^M + \let\xeatspaces\eatspaces + % Undo catcode changes of \startcontents and \doprintindex + % When called from @insertcopying or (short)caption, we need active + % backslash to get it printed correctly. Previously, we had + % \catcode`\\=\other instead. We'll see whether a problem appears + % with macro expansion. --kasal, 19aug04 + \catcode`\@=0 \catcode`\\=\active \escapechar=`\@ + % ... and \example + \spaceisspace + % + % Append \endinput to make sure that TeX does not see the ending newline. + % + % I've verified that it is necessary both for e-TeX and for ordinary TeX + % --kasal, 29nov03 + \scantokens{#1\endinput}% + \endgroup +} + +\def\scanexp#1{% + \edef\temp{\noexpand\scanmacro{#1}}% + \temp +} + +\newcount\paramno % Count of parameters +\newtoks\macname % Macro name +\newif\ifrecursive % Is it recursive? + +% List of all defined macros in the form +% \definedummyword\macro1\definedummyword\macro2... +% Currently is also contains all @aliases; the list can be split +% if there is a need. +\def\macrolist{} + +% Add the macro to \macrolist +\def\addtomacrolist#1{\expandafter \addtomacrolistxxx \csname#1\endcsname} +\def\addtomacrolistxxx#1{% + \toks0 = \expandafter{\macrolist\definedummyword#1}% + \xdef\macrolist{\the\toks0}% +} + +% Utility routines. +% This does \let #1 = #2, with \csnames; that is, +% \let \csname#1\endcsname = \csname#2\endcsname +% (except of course we have to play expansion games). +% +\def\cslet#1#2{% + \expandafter\let + \csname#1\expandafter\endcsname + \csname#2\endcsname +} + +% Trim leading and trailing spaces off a string. +% Concepts from aro-bend problem 15 (see CTAN). +{\catcode`\@=11 +\gdef\eatspaces #1{\expandafter\trim@\expandafter{#1 }} +\gdef\trim@ #1{\trim@@ @#1 @ #1 @ @@} +\gdef\trim@@ #1@ #2@ #3@@{\trim@@@\empty #2 @} +\def\unbrace#1{#1} +\unbrace{\gdef\trim@@@ #1 } #2@{#1} +} + +% Trim a single trailing ^^M off a string. +{\catcode`\^^M=\other \catcode`\Q=3% +\gdef\eatcr #1{\eatcra #1Q^^MQ}% +\gdef\eatcra#1^^MQ{\eatcrb#1Q}% +\gdef\eatcrb#1Q#2Q{#1}% +} + +% Macro bodies are absorbed as an argument in a context where +% all characters are catcode 10, 11 or 12, except \ which is active +% (as in normal texinfo). It is necessary to change the definition of \. + +% It's necessary to have hard CRs when the macro is executed. This is +% done by making ^^M (\endlinechar) catcode 12 when reading the macro +% body, and then making it the \newlinechar in \scanmacro. + +\def\scanctxt{% + \catcode`\"=\other + \catcode`\+=\other + \catcode`\<=\other + \catcode`\>=\other + \catcode`\@=\other + \catcode`\^=\other + \catcode`\_=\other + \catcode`\|=\other + \catcode`\~=\other +} + +\def\scanargctxt{% + \scanctxt + \catcode`\\=\other + \catcode`\^^M=\other +} + +\def\macrobodyctxt{% + \scanctxt + \catcode`\{=\other + \catcode`\}=\other + \catcode`\^^M=\other + \usembodybackslash +} + +\def\macroargctxt{% + \scanctxt + \catcode`\\=\other +} + +% \mbodybackslash is the definition of \ in @macro bodies. +% It maps \foo\ => \csname macarg.foo\endcsname => #N +% where N is the macro parameter number. +% We define \csname macarg.\endcsname to be \realbackslash, so +% \\ in macro replacement text gets you a backslash. + +{\catcode`@=0 @catcode`@\=@active + @gdef@usembodybackslash{@let\=@mbodybackslash} + @gdef@mbodybackslash#1\{@csname macarg.#1@endcsname} +} +\expandafter\def\csname macarg.\endcsname{\realbackslash} + +\def\macro{\recursivefalse\parsearg\macroxxx} +\def\rmacro{\recursivetrue\parsearg\macroxxx} + +\def\macroxxx#1{% + \getargs{#1}% now \macname is the macname and \argl the arglist + \ifx\argl\empty % no arguments + \paramno=0% + \else + \expandafter\parsemargdef \argl;% + \fi + \if1\csname ismacro.\the\macname\endcsname + \message{Warning: redefining \the\macname}% + \else + \expandafter\ifx\csname \the\macname\endcsname \relax + \else \errmessage{Macro name \the\macname\space already defined}\fi + \global\cslet{macsave.\the\macname}{\the\macname}% + \global\expandafter\let\csname ismacro.\the\macname\endcsname=1% + \addtomacrolist{\the\macname}% + \fi + \begingroup \macrobodyctxt + \ifrecursive \expandafter\parsermacbody + \else \expandafter\parsemacbody + \fi} + +\parseargdef\unmacro{% + \if1\csname ismacro.#1\endcsname + \global\cslet{#1}{macsave.#1}% + \global\expandafter\let \csname ismacro.#1\endcsname=0% + % Remove the macro name from \macrolist: + \begingroup + \expandafter\let\csname#1\endcsname \relax + \let\definedummyword\unmacrodo + \xdef\macrolist{\macrolist}% + \endgroup + \else + \errmessage{Macro #1 not defined}% + \fi +} + +% Called by \do from \dounmacro on each macro. The idea is to omit any +% macro definitions that have been changed to \relax. +% +\def\unmacrodo#1{% + \ifx #1\relax + % remove this + \else + \noexpand\definedummyword \noexpand#1% + \fi +} + +% This makes use of the obscure feature that if the last token of a +% is #, then the preceding argument is delimited by +% an opening brace, and that opening brace is not consumed. +\def\getargs#1{\getargsxxx#1{}} +\def\getargsxxx#1#{\getmacname #1 \relax\getmacargs} +\def\getmacname #1 #2\relax{\macname={#1}} +\def\getmacargs#1{\def\argl{#1}} + +% Parse the optional {params} list. Set up \paramno and \paramlist +% so \defmacro knows what to do. Define \macarg.blah for each blah +% in the params list, to be ##N where N is the position in that list. +% That gets used by \mbodybackslash (above). + +% We need to get `macro parameter char #' into several definitions. +% The technique used is stolen from LaTeX: let \hash be something +% unexpandable, insert that wherever you need a #, and then redefine +% it to # just before using the token list produced. +% +% The same technique is used to protect \eatspaces till just before +% the macro is used. + +\def\parsemargdef#1;{\paramno=0\def\paramlist{}% + \let\hash\relax\let\xeatspaces\relax\parsemargdefxxx#1,;,} +\def\parsemargdefxxx#1,{% + \if#1;\let\next=\relax + \else \let\next=\parsemargdefxxx + \advance\paramno by 1% + \expandafter\edef\csname macarg.\eatspaces{#1}\endcsname + {\xeatspaces{\hash\the\paramno}}% + \edef\paramlist{\paramlist\hash\the\paramno,}% + \fi\next} + +% These two commands read recursive and nonrecursive macro bodies. +% (They're different since rec and nonrec macros end differently.) + +\long\def\parsemacbody#1@end macro% +{\xdef\temp{\eatcr{#1}}\endgroup\defmacro}% +\long\def\parsermacbody#1@end rmacro% +{\xdef\temp{\eatcr{#1}}\endgroup\defmacro}% + +% This defines the macro itself. There are six cases: recursive and +% nonrecursive macros of zero, one, and many arguments. +% Much magic with \expandafter here. +% \xdef is used so that macro definitions will survive the file +% they're defined in; @include reads the file inside a group. +\def\defmacro{% + \let\hash=##% convert placeholders to macro parameter chars + \ifrecursive + \ifcase\paramno + % 0 + \expandafter\xdef\csname\the\macname\endcsname{% + \noexpand\scanmacro{\temp}}% + \or % 1 + \expandafter\xdef\csname\the\macname\endcsname{% + \bgroup\noexpand\macroargctxt + \noexpand\braceorline + \expandafter\noexpand\csname\the\macname xxx\endcsname}% + \expandafter\xdef\csname\the\macname xxx\endcsname##1{% + \egroup\noexpand\scanmacro{\temp}}% + \else % many + \expandafter\xdef\csname\the\macname\endcsname{% + \bgroup\noexpand\macroargctxt + \noexpand\csname\the\macname xx\endcsname}% + \expandafter\xdef\csname\the\macname xx\endcsname##1{% + \expandafter\noexpand\csname\the\macname xxx\endcsname ##1,}% + \expandafter\expandafter + \expandafter\xdef + \expandafter\expandafter + \csname\the\macname xxx\endcsname + \paramlist{\egroup\noexpand\scanmacro{\temp}}% + \fi + \else + \ifcase\paramno + % 0 + \expandafter\xdef\csname\the\macname\endcsname{% + \noexpand\norecurse{\the\macname}% + \noexpand\scanmacro{\temp}\egroup}% + \or % 1 + \expandafter\xdef\csname\the\macname\endcsname{% + \bgroup\noexpand\macroargctxt + \noexpand\braceorline + \expandafter\noexpand\csname\the\macname xxx\endcsname}% + \expandafter\xdef\csname\the\macname xxx\endcsname##1{% + \egroup + \noexpand\norecurse{\the\macname}% + \noexpand\scanmacro{\temp}\egroup}% + \else % many + \expandafter\xdef\csname\the\macname\endcsname{% + \bgroup\noexpand\macroargctxt + \expandafter\noexpand\csname\the\macname xx\endcsname}% + \expandafter\xdef\csname\the\macname xx\endcsname##1{% + \expandafter\noexpand\csname\the\macname xxx\endcsname ##1,}% + \expandafter\expandafter + \expandafter\xdef + \expandafter\expandafter + \csname\the\macname xxx\endcsname + \paramlist{% + \egroup + \noexpand\norecurse{\the\macname}% + \noexpand\scanmacro{\temp}\egroup}% + \fi + \fi} + +\def\norecurse#1{\bgroup\cslet{#1}{macsave.#1}} + +% \braceorline decides whether the next nonwhitespace character is a +% {. If so it reads up to the closing }, if not, it reads the whole +% line. Whatever was read is then fed to the next control sequence +% as an argument (by \parsebrace or \parsearg) +\def\braceorline#1{\let\next=#1\futurelet\nchar\braceorlinexxx} +\def\braceorlinexxx{% + \ifx\nchar\bgroup\else + \expandafter\parsearg + \fi \next} + + +% @alias. +% We need some trickery to remove the optional spaces around the equal +% sign. Just make them active and then expand them all to nothing. +\def\alias{\parseargusing\obeyspaces\aliasxxx} +\def\aliasxxx #1{\aliasyyy#1\relax} +\def\aliasyyy #1=#2\relax{% + {% + \expandafter\let\obeyedspace=\empty + \addtomacrolist{#1}% + \xdef\next{\global\let\makecsname{#1}=\makecsname{#2}}% + }% + \next +} + + +\message{cross references,} + +\newwrite\auxfile + +\newif\ifhavexrefs % True if xref values are known. +\newif\ifwarnedxrefs % True if we warned once that they aren't known. + +% @inforef is relatively simple. +\def\inforef #1{\inforefzzz #1,,,,**} +\def\inforefzzz #1,#2,#3,#4**{\putwordSee{} \putwordInfo{} \putwordfile{} \file{\ignorespaces #3{}}, + node \samp{\ignorespaces#1{}}} + +% @node's only job in TeX is to define \lastnode, which is used in +% cross-references. The @node line might or might not have commas, and +% might or might not have spaces before the first comma, like: +% @node foo , bar , ... +% We don't want such trailing spaces in the node name. +% +\parseargdef\node{\checkenv{}\donode #1 ,\finishnodeparse} +% +% also remove a trailing comma, in case of something like this: +% @node Help-Cross, , , Cross-refs +\def\donode#1 ,#2\finishnodeparse{\dodonode #1,\finishnodeparse} +\def\dodonode#1,#2\finishnodeparse{\gdef\lastnode{#1}} + +\let\nwnode=\node +\let\lastnode=\empty + +% Write a cross-reference definition for the current node. #1 is the +% type (Ynumbered, Yappendix, Ynothing). +% +\def\donoderef#1{% + \ifx\lastnode\empty\else + \setref{\lastnode}{#1}% + \global\let\lastnode=\empty + \fi +} + +% @anchor{NAME} -- define xref target at arbitrary point. +% +\newcount\savesfregister +% +\def\savesf{\relax \ifhmode \savesfregister=\spacefactor \fi} +\def\restoresf{\relax \ifhmode \spacefactor=\savesfregister \fi} +\def\anchor#1{\savesf \setref{#1}{Ynothing}\restoresf \ignorespaces} + +% \setref{NAME}{SNT} defines a cross-reference point NAME (a node or an +% anchor), which consists of three parts: +% 1) NAME-title - the current sectioning name taken from \thissection, +% or the anchor name. +% 2) NAME-snt - section number and type, passed as the SNT arg, or +% empty for anchors. +% 3) NAME-pg - the page number. +% +% This is called from \donoderef, \anchor, and \dofloat. In the case of +% floats, there is an additional part, which is not written here: +% 4) NAME-lof - the text as it should appear in a @listoffloats. +% +\def\setref#1#2{% + \pdfmkdest{#1}% + \iflinks + {% + \atdummies % preserve commands, but don't expand them + \edef\writexrdef##1##2{% + \write\auxfile{@xrdef{#1-% #1 of \setref, expanded by the \edef + ##1}{##2}}% these are parameters of \writexrdef + }% + \toks0 = \expandafter{\thissection}% + \immediate \writexrdef{title}{\the\toks0 }% + \immediate \writexrdef{snt}{\csname #2\endcsname}% \Ynumbered etc. + \writexrdef{pg}{\folio}% will be written later, during \shipout + }% + \fi +} + +% @xref, @pxref, and @ref generate cross-references. For \xrefX, #1 is +% the node name, #2 the name of the Info cross-reference, #3 the printed +% node name, #4 the name of the Info file, #5 the name of the printed +% manual. All but the node name can be omitted. +% +\def\pxref#1{\putwordsee{} \xrefX[#1,,,,,,,]} +\def\xref#1{\putwordSee{} \xrefX[#1,,,,,,,]} +\def\ref#1{\xrefX[#1,,,,,,,]} +\def\xrefX[#1,#2,#3,#4,#5,#6]{\begingroup + \unsepspaces + \def\printedmanual{\ignorespaces #5}% + \def\printedrefname{\ignorespaces #3}% + \setbox1=\hbox{\printedmanual\unskip}% + \setbox0=\hbox{\printedrefname\unskip}% + \ifdim \wd0 = 0pt + % No printed node name was explicitly given. + \expandafter\ifx\csname SETxref-automatic-section-title\endcsname\relax + % Use the node name inside the square brackets. + \def\printedrefname{\ignorespaces #1}% + \else + % Use the actual chapter/section title appear inside + % the square brackets. Use the real section title if we have it. + \ifdim \wd1 > 0pt + % It is in another manual, so we don't have it. + \def\printedrefname{\ignorespaces #1}% + \else + \ifhavexrefs + % We know the real title if we have the xref values. + \def\printedrefname{\refx{#1-title}{}}% + \else + % Otherwise just copy the Info node name. + \def\printedrefname{\ignorespaces #1}% + \fi% + \fi + \fi + \fi + % + % Make link in pdf output. + \ifpdf + \leavevmode + \getfilename{#4}% + {\turnoffactive + % See comments at \activebackslashdouble. + {\activebackslashdouble \xdef\pdfxrefdest{#1}% + \backslashparens\pdfxrefdest}% + % + \ifnum\filenamelength>0 + \startlink attr{/Border [0 0 0]}% + goto file{\the\filename.pdf} name{\pdfxrefdest}% + \else + \startlink attr{/Border [0 0 0]}% + goto name{\pdfmkpgn{\pdfxrefdest}}% + \fi + }% + \linkcolor + \fi + % + % Float references are printed completely differently: "Figure 1.2" + % instead of "[somenode], p.3". We distinguish them by the + % LABEL-title being set to a magic string. + {% + % Have to otherify everything special to allow the \csname to + % include an _ in the xref name, etc. + \indexnofonts + \turnoffactive + \expandafter\global\expandafter\let\expandafter\Xthisreftitle + \csname XR#1-title\endcsname + }% + \iffloat\Xthisreftitle + % If the user specified the print name (third arg) to the ref, + % print it instead of our usual "Figure 1.2". + \ifdim\wd0 = 0pt + \refx{#1-snt}% + \else + \printedrefname + \fi + % + % if the user also gave the printed manual name (fifth arg), append + % "in MANUALNAME". + \ifdim \wd1 > 0pt + \space \putwordin{} \cite{\printedmanual}% + \fi + \else + % node/anchor (non-float) references. + % + % If we use \unhbox0 and \unhbox1 to print the node names, TeX does not + % insert empty discretionaries after hyphens, which means that it will + % not find a line break at a hyphen in a node names. Since some manuals + % are best written with fairly long node names, containing hyphens, this + % is a loss. Therefore, we give the text of the node name again, so it + % is as if TeX is seeing it for the first time. + \ifdim \wd1 > 0pt + \putwordsection{} ``\printedrefname'' \putwordin{} \cite{\printedmanual}% + \else + % _ (for example) has to be the character _ for the purposes of the + % control sequence corresponding to the node, but it has to expand + % into the usual \leavevmode...\vrule stuff for purposes of + % printing. So we \turnoffactive for the \refx-snt, back on for the + % printing, back off for the \refx-pg. + {\turnoffactive + % Only output a following space if the -snt ref is nonempty; for + % @unnumbered and @anchor, it won't be. + \setbox2 = \hbox{\ignorespaces \refx{#1-snt}{}}% + \ifdim \wd2 > 0pt \refx{#1-snt}\space\fi + }% + % output the `[mynode]' via a macro so it can be overridden. + \xrefprintnodename\printedrefname + % + % But we always want a comma and a space: + ,\space + % + % output the `page 3'. + \turnoffactive \putwordpage\tie\refx{#1-pg}{}% + \fi + \fi + \endlink +\endgroup} + +% This macro is called from \xrefX for the `[nodename]' part of xref +% output. It's a separate macro only so it can be changed more easily, +% since square brackets don't work well in some documents. Particularly +% one that Bob is working on :). +% +\def\xrefprintnodename#1{[#1]} + +% Things referred to by \setref. +% +\def\Ynothing{} +\def\Yomitfromtoc{} +\def\Ynumbered{% + \ifnum\secno=0 + \putwordChapter@tie \the\chapno + \else \ifnum\subsecno=0 + \putwordSection@tie \the\chapno.\the\secno + \else \ifnum\subsubsecno=0 + \putwordSection@tie \the\chapno.\the\secno.\the\subsecno + \else + \putwordSection@tie \the\chapno.\the\secno.\the\subsecno.\the\subsubsecno + \fi\fi\fi +} +\def\Yappendix{% + \ifnum\secno=0 + \putwordAppendix@tie @char\the\appendixno{}% + \else \ifnum\subsecno=0 + \putwordSection@tie @char\the\appendixno.\the\secno + \else \ifnum\subsubsecno=0 + \putwordSection@tie @char\the\appendixno.\the\secno.\the\subsecno + \else + \putwordSection@tie + @char\the\appendixno.\the\secno.\the\subsecno.\the\subsubsecno + \fi\fi\fi +} + +% Define \refx{NAME}{SUFFIX} to reference a cross-reference string named NAME. +% If its value is nonempty, SUFFIX is output afterward. +% +\def\refx#1#2{% + {% + \indexnofonts + \otherbackslash + \expandafter\global\expandafter\let\expandafter\thisrefX + \csname XR#1\endcsname + }% + \ifx\thisrefX\relax + % If not defined, say something at least. + \angleleft un\-de\-fined\angleright + \iflinks + \ifhavexrefs + \message{\linenumber Undefined cross reference `#1'.}% + \else + \ifwarnedxrefs\else + \global\warnedxrefstrue + \message{Cross reference values unknown; you must run TeX again.}% + \fi + \fi + \fi + \else + % It's defined, so just use it. + \thisrefX + \fi + #2% Output the suffix in any case. +} + +% This is the macro invoked by entries in the aux file. Usually it's +% just a \def (we prepend XR to the control sequence name to avoid +% collisions). But if this is a float type, we have more work to do. +% +\def\xrdef#1#2{% + \expandafter\gdef\csname XR#1\endcsname{#2}% remember this xref value. + % + % Was that xref control sequence that we just defined for a float? + \expandafter\iffloat\csname XR#1\endcsname + % it was a float, and we have the (safe) float type in \iffloattype. + \expandafter\let\expandafter\floatlist + \csname floatlist\iffloattype\endcsname + % + % Is this the first time we've seen this float type? + \expandafter\ifx\floatlist\relax + \toks0 = {\do}% yes, so just \do + \else + % had it before, so preserve previous elements in list. + \toks0 = \expandafter{\floatlist\do}% + \fi + % + % Remember this xref in the control sequence \floatlistFLOATTYPE, + % for later use in \listoffloats. + \expandafter\xdef\csname floatlist\iffloattype\endcsname{\the\toks0{#1}}% + \fi +} + +% Read the last existing aux file, if any. No error if none exists. +% +\def\tryauxfile{% + \openin 1 \jobname.aux + \ifeof 1 \else + \readdatafile{aux}% + \global\havexrefstrue + \fi + \closein 1 +} + +\def\setupdatafile{% + \catcode`\^^@=\other + \catcode`\^^A=\other + \catcode`\^^B=\other + \catcode`\^^C=\other + \catcode`\^^D=\other + \catcode`\^^E=\other + \catcode`\^^F=\other + \catcode`\^^G=\other + \catcode`\^^H=\other + \catcode`\^^K=\other + \catcode`\^^L=\other + \catcode`\^^N=\other + \catcode`\^^P=\other + \catcode`\^^Q=\other + \catcode`\^^R=\other + \catcode`\^^S=\other + \catcode`\^^T=\other + \catcode`\^^U=\other + \catcode`\^^V=\other + \catcode`\^^W=\other + \catcode`\^^X=\other + \catcode`\^^Z=\other + \catcode`\^^[=\other + \catcode`\^^\=\other + \catcode`\^^]=\other + \catcode`\^^^=\other + \catcode`\^^_=\other + % It was suggested to set the catcode of ^ to 7, which would allow ^^e4 etc. + % in xref tags, i.e., node names. But since ^^e4 notation isn't + % supported in the main text, it doesn't seem desirable. Furthermore, + % that is not enough: for node names that actually contain a ^ + % character, we would end up writing a line like this: 'xrdef {'hat + % b-title}{'hat b} and \xrdef does a \csname...\endcsname on the first + % argument, and \hat is not an expandable control sequence. It could + % all be worked out, but why? Either we support ^^ or we don't. + % + % The other change necessary for this was to define \auxhat: + % \def\auxhat{\def^{'hat }}% extra space so ok if followed by letter + % and then to call \auxhat in \setq. + % + \catcode`\^=\other + % + % Special characters. Should be turned off anyway, but... + \catcode`\~=\other + \catcode`\[=\other + \catcode`\]=\other + \catcode`\"=\other + \catcode`\_=\other + \catcode`\|=\other + \catcode`\<=\other + \catcode`\>=\other + \catcode`\$=\other + \catcode`\#=\other + \catcode`\&=\other + \catcode`\%=\other + \catcode`+=\other % avoid \+ for paranoia even though we've turned it off + % + % This is to support \ in node names and titles, since the \ + % characters end up in a \csname. It's easier than + % leaving it active and making its active definition an actual \ + % character. What I don't understand is why it works in the *value* + % of the xrdef. Seems like it should be a catcode12 \, and that + % should not typeset properly. But it works, so I'm moving on for + % now. --karl, 15jan04. + \catcode`\\=\other + % + % Make the characters 128-255 be printing characters. + {% + \count1=128 + \def\loop{% + \catcode\count1=\other + \advance\count1 by 1 + \ifnum \count1<256 \loop \fi + }% + }% + % + % @ is our escape character in .aux files, and we need braces. + \catcode`\{=1 + \catcode`\}=2 + \catcode`\@=0 +} + +\def\readdatafile#1{% +\begingroup + \setupdatafile + \input\jobname.#1 +\endgroup} + +\message{insertions,} +% including footnotes. + +\newcount \footnoteno + +% The trailing space in the following definition for supereject is +% vital for proper filling; pages come out unaligned when you do a +% pagealignmacro call if that space before the closing brace is +% removed. (Generally, numeric constants should always be followed by a +% space to prevent strange expansion errors.) +\def\supereject{\par\penalty -20000\footnoteno =0 } + +% @footnotestyle is meaningful for info output only. +\let\footnotestyle=\comment + +{\catcode `\@=11 +% +% Auto-number footnotes. Otherwise like plain. +\gdef\footnote{% + \let\indent=\ptexindent + \let\noindent=\ptexnoindent + \global\advance\footnoteno by \@ne + \edef\thisfootno{$^{\the\footnoteno}$}% + % + % In case the footnote comes at the end of a sentence, preserve the + % extra spacing after we do the footnote number. + \let\@sf\empty + \ifhmode\edef\@sf{\spacefactor\the\spacefactor}\ptexslash\fi + % + % Remove inadvertent blank space before typesetting the footnote number. + \unskip + \thisfootno\@sf + \dofootnote +}% + +% Don't bother with the trickery in plain.tex to not require the +% footnote text as a parameter. Our footnotes don't need to be so general. +% +% Oh yes, they do; otherwise, @ifset (and anything else that uses +% \parseargline) fails inside footnotes because the tokens are fixed when +% the footnote is read. --karl, 16nov96. +% +\gdef\dofootnote{% + \insert\footins\bgroup + % We want to typeset this text as a normal paragraph, even if the + % footnote reference occurs in (for example) a display environment. + % So reset some parameters. + \hsize=\pagewidth + \interlinepenalty\interfootnotelinepenalty + \splittopskip\ht\strutbox % top baseline for broken footnotes + \splitmaxdepth\dp\strutbox + \floatingpenalty\@MM + \leftskip\z@skip + \rightskip\z@skip + \spaceskip\z@skip + \xspaceskip\z@skip + \parindent\defaultparindent + % + \smallfonts \rm + % + % Because we use hanging indentation in footnotes, a @noindent appears + % to exdent this text, so make it be a no-op. makeinfo does not use + % hanging indentation so @noindent can still be needed within footnote + % text after an @example or the like (not that this is good style). + \let\noindent = \relax + % + % Hang the footnote text off the number. Use \everypar in case the + % footnote extends for more than one paragraph. + \everypar = {\hang}% + \textindent{\thisfootno}% + % + % Don't crash into the line above the footnote text. Since this + % expands into a box, it must come within the paragraph, lest it + % provide a place where TeX can split the footnote. + \footstrut + \futurelet\next\fo@t +} +}%end \catcode `\@=11 + +% In case a @footnote appears in a vbox, save the footnote text and create +% the real \insert just after the vbox finished. Otherwise, the insertion +% would be lost. +% Similarily, if a @footnote appears inside an alignment, save the footnote +% text to a box and make the \insert when a row of the table is finished. +% And the same can be done for other insert classes. --kasal, 16nov03. + +% Replace the \insert primitive by a cheating macro. +% Deeper inside, just make sure that the saved insertions are not spilled +% out prematurely. +% +\def\startsavinginserts{% + \ifx \insert\ptexinsert + \let\insert\saveinsert + \else + \let\checkinserts\relax + \fi +} + +% This \insert replacement works for both \insert\footins{foo} and +% \insert\footins\bgroup foo\egroup, but it doesn't work for \insert27{foo}. +% +\def\saveinsert#1{% + \edef\next{\noexpand\savetobox \makeSAVEname#1}% + \afterassignment\next + % swallow the left brace + \let\temp = +} +\def\makeSAVEname#1{\makecsname{SAVE\expandafter\gobble\string#1}} +\def\savetobox#1{\global\setbox#1 = \vbox\bgroup \unvbox#1} + +\def\checksaveins#1{\ifvoid#1\else \placesaveins#1\fi} + +\def\placesaveins#1{% + \ptexinsert \csname\expandafter\gobblesave\string#1\endcsname + {\box#1}% +} + +% eat @SAVE -- beware, all of them have catcode \other: +{ + \def\dospecials{\do S\do A\do V\do E} \uncatcodespecials % ;-) + \gdef\gobblesave @SAVE{} +} + +% initialization: +\def\newsaveins #1{% + \edef\next{\noexpand\newsaveinsX \makeSAVEname#1}% + \next +} +\def\newsaveinsX #1{% + \csname newbox\endcsname #1% + \expandafter\def\expandafter\checkinserts\expandafter{\checkinserts + \checksaveins #1}% +} + +% initialize: +\let\checkinserts\empty +\newsaveins\footins +\newsaveins\margin + + +% @image. We use the macros from epsf.tex to support this. +% If epsf.tex is not installed and @image is used, we complain. +% +% Check for and read epsf.tex up front. If we read it only at @image +% time, we might be inside a group, and then its definitions would get +% undone and the next image would fail. +\openin 1 = epsf.tex +\ifeof 1 \else + % Do not bother showing banner with epsf.tex v2.7k (available in + % doc/epsf.tex and on ctan). + \def\epsfannounce{\toks0 = }% + \input epsf.tex +\fi +\closein 1 +% +% We will only complain once about lack of epsf.tex. +\newif\ifwarnednoepsf +\newhelp\noepsfhelp{epsf.tex must be installed for images to + work. It is also included in the Texinfo distribution, or you can get + it from ftp://tug.org/tex/epsf.tex.} +% +\def\image#1{% + \ifx\epsfbox\undefined + \ifwarnednoepsf \else + \errhelp = \noepsfhelp + \errmessage{epsf.tex not found, images will be ignored}% + \global\warnednoepsftrue + \fi + \else + \imagexxx #1,,,,,\finish + \fi +} +% +% Arguments to @image: +% #1 is (mandatory) image filename; we tack on .eps extension. +% #2 is (optional) width, #3 is (optional) height. +% #4 is (ignored optional) html alt text. +% #5 is (ignored optional) extension. +% #6 is just the usual extra ignored arg for parsing this stuff. +\newif\ifimagevmode +\def\imagexxx#1,#2,#3,#4,#5,#6\finish{\begingroup + \catcode`\^^M = 5 % in case we're inside an example + \normalturnoffactive % allow _ et al. in names + % If the image is by itself, center it. + \ifvmode + \imagevmodetrue + \nobreak\bigskip + % Usually we'll have text after the image which will insert + % \parskip glue, so insert it here too to equalize the space + % above and below. + \nobreak\vskip\parskip + \nobreak + \line\bgroup\hss + \fi + % + % Output the image. + \ifpdf + \dopdfimage{#1}{#2}{#3}% + \else + % \epsfbox itself resets \epsf?size at each figure. + \setbox0 = \hbox{\ignorespaces #2}\ifdim\wd0 > 0pt \epsfxsize=#2\relax \fi + \setbox0 = \hbox{\ignorespaces #3}\ifdim\wd0 > 0pt \epsfysize=#3\relax \fi + \epsfbox{#1.eps}% + \fi + % + \ifimagevmode \hss \egroup \bigbreak \fi % space after the image +\endgroup} + + +% @float FLOATTYPE,LABEL,LOC ... @end float for displayed figures, tables, +% etc. We don't actually implement floating yet, we always include the +% float "here". But it seemed the best name for the future. +% +\envparseargdef\float{\eatcommaspace\eatcommaspace\dofloat#1, , ,\finish} + +% There may be a space before second and/or third parameter; delete it. +\def\eatcommaspace#1, {#1,} + +% #1 is the optional FLOATTYPE, the text label for this float, typically +% "Figure", "Table", "Example", etc. Can't contain commas. If omitted, +% this float will not be numbered and cannot be referred to. +% +% #2 is the optional xref label. Also must be present for the float to +% be referable. +% +% #3 is the optional positioning argument; for now, it is ignored. It +% will somehow specify the positions allowed to float to (here, top, bottom). +% +% We keep a separate counter for each FLOATTYPE, which we reset at each +% chapter-level command. +\let\resetallfloatnos=\empty +% +\def\dofloat#1,#2,#3,#4\finish{% + \let\thiscaption=\empty + \let\thisshortcaption=\empty + % + % don't lose footnotes inside @float. + % + % BEWARE: when the floats start float, we have to issue warning whenever an + % insert appears inside a float which could possibly float. --kasal, 26may04 + % + \startsavinginserts + % + % We can't be used inside a paragraph. + \par + % + \vtop\bgroup + \def\floattype{#1}% + \def\floatlabel{#2}% + \def\floatloc{#3}% we do nothing with this yet. + % + \ifx\floattype\empty + \let\safefloattype=\empty + \else + {% + % the floattype might have accents or other special characters, + % but we need to use it in a control sequence name. + \indexnofonts + \turnoffactive + \xdef\safefloattype{\floattype}% + }% + \fi + % + % If label is given but no type, we handle that as the empty type. + \ifx\floatlabel\empty \else + % We want each FLOATTYPE to be numbered separately (Figure 1, + % Table 1, Figure 2, ...). (And if no label, no number.) + % + \expandafter\getfloatno\csname\safefloattype floatno\endcsname + \global\advance\floatno by 1 + % + {% + % This magic value for \thissection is output by \setref as the + % XREFLABEL-title value. \xrefX uses it to distinguish float + % labels (which have a completely different output format) from + % node and anchor labels. And \xrdef uses it to construct the + % lists of floats. + % + \edef\thissection{\floatmagic=\safefloattype}% + \setref{\floatlabel}{Yfloat}% + }% + \fi + % + % start with \parskip glue, I guess. + \vskip\parskip + % + % Don't suppress indentation if a float happens to start a section. + \restorefirstparagraphindent +} + +% we have these possibilities: +% @float Foo,lbl & @caption{Cap}: Foo 1.1: Cap +% @float Foo,lbl & no caption: Foo 1.1 +% @float Foo & @caption{Cap}: Foo: Cap +% @float Foo & no caption: Foo +% @float ,lbl & Caption{Cap}: 1.1: Cap +% @float ,lbl & no caption: 1.1 +% @float & @caption{Cap}: Cap +% @float & no caption: +% +\def\Efloat{% + \let\floatident = \empty + % + % In all cases, if we have a float type, it comes first. + \ifx\floattype\empty \else \def\floatident{\floattype}\fi + % + % If we have an xref label, the number comes next. + \ifx\floatlabel\empty \else + \ifx\floattype\empty \else % if also had float type, need tie first. + \appendtomacro\floatident{\tie}% + \fi + % the number. + \appendtomacro\floatident{\chaplevelprefix\the\floatno}% + \fi + % + % Start the printed caption with what we've constructed in + % \floatident, but keep it separate; we need \floatident again. + \let\captionline = \floatident + % + \ifx\thiscaption\empty \else + \ifx\floatident\empty \else + \appendtomacro\captionline{: }% had ident, so need a colon between + \fi + % + % caption text. + \appendtomacro\captionline{\scanexp\thiscaption}% + \fi + % + % If we have anything to print, print it, with space before. + % Eventually this needs to become an \insert. + \ifx\captionline\empty \else + \vskip.5\parskip + \captionline + % + % Space below caption. + \vskip\parskip + \fi + % + % If have an xref label, write the list of floats info. Do this + % after the caption, to avoid chance of it being a breakpoint. + \ifx\floatlabel\empty \else + % Write the text that goes in the lof to the aux file as + % \floatlabel-lof. Besides \floatident, we include the short + % caption if specified, else the full caption if specified, else nothing. + {% + \atdummies + % since we read the caption text in the macro world, where ^^M + % is turned into a normal character, we have to scan it back, so + % we don't write the literal three characters "^^M" into the aux file. + \scanexp{% + \xdef\noexpand\gtemp{% + \ifx\thisshortcaption\empty + \thiscaption + \else + \thisshortcaption + \fi + }% + }% + \immediate\write\auxfile{@xrdef{\floatlabel-lof}{\floatident + \ifx\gtemp\empty \else : \gtemp \fi}}% + }% + \fi + \egroup % end of \vtop + % + % place the captured inserts + % + % BEWARE: when the floats start float, we have to issue warning whenever an + % insert appears inside a float which could possibly float. --kasal, 26may04 + % + \checkinserts +} + +% Append the tokens #2 to the definition of macro #1, not expanding either. +% +\def\appendtomacro#1#2{% + \expandafter\def\expandafter#1\expandafter{#1#2}% +} + +% @caption, @shortcaption +% +\def\caption{\docaption\thiscaption} +\def\shortcaption{\docaption\thisshortcaption} +\def\docaption{\checkenv\float \bgroup\scanargctxt\defcaption} +\def\defcaption#1#2{\egroup \def#1{#2}} + +% The parameter is the control sequence identifying the counter we are +% going to use. Create it if it doesn't exist and assign it to \floatno. +\def\getfloatno#1{% + \ifx#1\relax + % Haven't seen this figure type before. + \csname newcount\endcsname #1% + % + % Remember to reset this floatno at the next chap. + \expandafter\gdef\expandafter\resetallfloatnos + \expandafter{\resetallfloatnos #1=0 }% + \fi + \let\floatno#1% +} + +% \setref calls this to get the XREFLABEL-snt value. We want an @xref +% to the FLOATLABEL to expand to "Figure 3.1". We call \setref when we +% first read the @float command. +% +\def\Yfloat{\floattype@tie \chaplevelprefix\the\floatno}% + +% Magic string used for the XREFLABEL-title value, so \xrefX can +% distinguish floats from other xref types. +\def\floatmagic{!!float!!} + +% #1 is the control sequence we are passed; we expand into a conditional +% which is true if #1 represents a float ref. That is, the magic +% \thissection value which we \setref above. +% +\def\iffloat#1{\expandafter\doiffloat#1==\finish} +% +% #1 is (maybe) the \floatmagic string. If so, #2 will be the +% (safe) float type for this float. We set \iffloattype to #2. +% +\def\doiffloat#1=#2=#3\finish{% + \def\temp{#1}% + \def\iffloattype{#2}% + \ifx\temp\floatmagic +} + +% @listoffloats FLOATTYPE - print a list of floats like a table of contents. +% +\parseargdef\listoffloats{% + \def\floattype{#1}% floattype + {% + % the floattype might have accents or other special characters, + % but we need to use it in a control sequence name. + \indexnofonts + \turnoffactive + \xdef\safefloattype{\floattype}% + }% + % + % \xrdef saves the floats as a \do-list in \floatlistSAFEFLOATTYPE. + \expandafter\ifx\csname floatlist\safefloattype\endcsname \relax + \ifhavexrefs + % if the user said @listoffloats foo but never @float foo. + \message{\linenumber No `\safefloattype' floats to list.}% + \fi + \else + \begingroup + \leftskip=\tocindent % indent these entries like a toc + \let\do=\listoffloatsdo + \csname floatlist\safefloattype\endcsname + \endgroup + \fi +} + +% This is called on each entry in a list of floats. We're passed the +% xref label, in the form LABEL-title, which is how we save it in the +% aux file. We strip off the -title and look up \XRLABEL-lof, which +% has the text we're supposed to typeset here. +% +% Figures without xref labels will not be included in the list (since +% they won't appear in the aux file). +% +\def\listoffloatsdo#1{\listoffloatsdoentry#1\finish} +\def\listoffloatsdoentry#1-title\finish{{% + % Can't fully expand XR#1-lof because it can contain anything. Just + % pass the control sequence. On the other hand, XR#1-pg is just the + % page number, and we want to fully expand that so we can get a link + % in pdf output. + \toksA = \expandafter{\csname XR#1-lof\endcsname}% + % + % use the same \entry macro we use to generate the TOC and index. + \edef\writeentry{\noexpand\entry{\the\toksA}{\csname XR#1-pg\endcsname}}% + \writeentry +}} + +\message{localization,} +% and i18n. + +% @documentlanguage is usually given very early, just after +% @setfilename. If done too late, it may not override everything +% properly. Single argument is the language abbreviation. +% It would be nice if we could set up a hyphenation file here. +% +\parseargdef\documentlanguage{% + \tex % read txi-??.tex file in plain TeX. + % Read the file if it exists. + \openin 1 txi-#1.tex + \ifeof 1 + \errhelp = \nolanghelp + \errmessage{Cannot read language file txi-#1.tex}% + \else + \input txi-#1.tex + \fi + \closein 1 + \endgroup +} +\newhelp\nolanghelp{The given language definition file cannot be found or +is empty. Maybe you need to install it? In the current directory +should work if nowhere else does.} + + +% @documentencoding should change something in TeX eventually, most +% likely, but for now just recognize it. +\let\documentencoding = \comment + + +% Page size parameters. +% +\newdimen\defaultparindent \defaultparindent = 15pt + +\chapheadingskip = 15pt plus 4pt minus 2pt +\secheadingskip = 12pt plus 3pt minus 2pt +\subsecheadingskip = 9pt plus 2pt minus 2pt + +% Prevent underfull vbox error messages. +\vbadness = 10000 + +% Don't be so finicky about underfull hboxes, either. +\hbadness = 2000 + +% Following George Bush, just get rid of widows and orphans. +\widowpenalty=10000 +\clubpenalty=10000 + +% Use TeX 3.0's \emergencystretch to help line breaking, but if we're +% using an old version of TeX, don't do anything. We want the amount of +% stretch added to depend on the line length, hence the dependence on +% \hsize. We call this whenever the paper size is set. +% +\def\setemergencystretch{% + \ifx\emergencystretch\thisisundefined + % Allow us to assign to \emergencystretch anyway. + \def\emergencystretch{\dimen0}% + \else + \emergencystretch = .15\hsize + \fi +} + +% Parameters in order: 1) textheight; 2) textwidth; +% 3) voffset; 4) hoffset; 5) binding offset; 6) topskip; +% 7) physical page height; 8) physical page width. +% +% We also call \setleading{\textleading}, so the caller should define +% \textleading. The caller should also set \parskip. +% +\def\internalpagesizes#1#2#3#4#5#6#7#8{% + \voffset = #3\relax + \topskip = #6\relax + \splittopskip = \topskip + % + \vsize = #1\relax + \advance\vsize by \topskip + \outervsize = \vsize + \advance\outervsize by 2\topandbottommargin + \pageheight = \vsize + % + \hsize = #2\relax + \outerhsize = \hsize + \advance\outerhsize by 0.5in + \pagewidth = \hsize + % + \normaloffset = #4\relax + \bindingoffset = #5\relax + % + \ifpdf + \pdfpageheight #7\relax + \pdfpagewidth #8\relax + \fi + % + \setleading{\textleading} + % + \parindent = \defaultparindent + \setemergencystretch +} + +% @letterpaper (the default). +\def\letterpaper{{\globaldefs = 1 + \parskip = 3pt plus 2pt minus 1pt + \textleading = 13.2pt + % + % If page is nothing but text, make it come out even. + \internalpagesizes{46\baselineskip}{6in}% + {\voffset}{.25in}% + {\bindingoffset}{36pt}% + {11in}{8.5in}% +}} + +% Use @smallbook to reset parameters for 7x9.25 trim size. +\def\smallbook{{\globaldefs = 1 + \parskip = 2pt plus 1pt + \textleading = 12pt + % + \internalpagesizes{7.5in}{5in}% + {\voffset}{.25in}% + {\bindingoffset}{16pt}% + {9.25in}{7in}% + % + \lispnarrowing = 0.3in + \tolerance = 700 + \hfuzz = 1pt + \contentsrightmargin = 0pt + \defbodyindent = .5cm +}} + +% Use @smallerbook to reset parameters for 6x9 trim size. +% (Just testing, parameters still in flux.) +\def\smallerbook{{\globaldefs = 1 + \parskip = 1.5pt plus 1pt + \textleading = 12pt + % + \internalpagesizes{7.4in}{4.8in}% + {-.2in}{-.4in}% + {0pt}{14pt}% + {9in}{6in}% + % + \lispnarrowing = 0.25in + \tolerance = 700 + \hfuzz = 1pt + \contentsrightmargin = 0pt + \defbodyindent = .4cm +}} + +% Use @afourpaper to print on European A4 paper. +\def\afourpaper{{\globaldefs = 1 + \parskip = 3pt plus 2pt minus 1pt + \textleading = 13.2pt + % + % Double-side printing via postscript on Laserjet 4050 + % prints double-sided nicely when \bindingoffset=10mm and \hoffset=-6mm. + % To change the settings for a different printer or situation, adjust + % \normaloffset until the front-side and back-side texts align. Then + % do the same for \bindingoffset. You can set these for testing in + % your texinfo source file like this: + % @tex + % \global\normaloffset = -6mm + % \global\bindingoffset = 10mm + % @end tex + \internalpagesizes{51\baselineskip}{160mm} + {\voffset}{\hoffset}% + {\bindingoffset}{44pt}% + {297mm}{210mm}% + % + \tolerance = 700 + \hfuzz = 1pt + \contentsrightmargin = 0pt + \defbodyindent = 5mm +}} + +% Use @afivepaper to print on European A5 paper. +% From romildo@urano.iceb.ufop.br, 2 July 2000. +% He also recommends making @example and @lisp be small. +\def\afivepaper{{\globaldefs = 1 + \parskip = 2pt plus 1pt minus 0.1pt + \textleading = 12.5pt + % + \internalpagesizes{160mm}{120mm}% + {\voffset}{\hoffset}% + {\bindingoffset}{8pt}% + {210mm}{148mm}% + % + \lispnarrowing = 0.2in + \tolerance = 800 + \hfuzz = 1.2pt + \contentsrightmargin = 0pt + \defbodyindent = 2mm + \tableindent = 12mm +}} + +% A specific text layout, 24x15cm overall, intended for A4 paper. +\def\afourlatex{{\globaldefs = 1 + \afourpaper + \internalpagesizes{237mm}{150mm}% + {\voffset}{4.6mm}% + {\bindingoffset}{7mm}% + {297mm}{210mm}% + % + % Must explicitly reset to 0 because we call \afourpaper. + \globaldefs = 0 +}} + +% Use @afourwide to print on A4 paper in landscape format. +\def\afourwide{{\globaldefs = 1 + \afourpaper + \internalpagesizes{241mm}{165mm}% + {\voffset}{-2.95mm}% + {\bindingoffset}{7mm}% + {297mm}{210mm}% + \globaldefs = 0 +}} + +% @pagesizes TEXTHEIGHT[,TEXTWIDTH] +% Perhaps we should allow setting the margins, \topskip, \parskip, +% and/or leading, also. Or perhaps we should compute them somehow. +% +\parseargdef\pagesizes{\pagesizesyyy #1,,\finish} +\def\pagesizesyyy#1,#2,#3\finish{{% + \setbox0 = \hbox{\ignorespaces #2}\ifdim\wd0 > 0pt \hsize=#2\relax \fi + \globaldefs = 1 + % + \parskip = 3pt plus 2pt minus 1pt + \setleading{\textleading}% + % + \dimen0 = #1 + \advance\dimen0 by \voffset + % + \dimen2 = \hsize + \advance\dimen2 by \normaloffset + % + \internalpagesizes{#1}{\hsize}% + {\voffset}{\normaloffset}% + {\bindingoffset}{44pt}% + {\dimen0}{\dimen2}% +}} + +% Set default to letter. +% +\letterpaper + + +\message{and turning on texinfo input format.} + +% Define macros to output various characters with catcode for normal text. +\catcode`\"=\other +\catcode`\~=\other +\catcode`\^=\other +\catcode`\_=\other +\catcode`\|=\other +\catcode`\<=\other +\catcode`\>=\other +\catcode`\+=\other +\catcode`\$=\other +\def\normaldoublequote{"} +\def\normaltilde{~} +\def\normalcaret{^} +\def\normalunderscore{_} +\def\normalverticalbar{|} +\def\normalless{<} +\def\normalgreater{>} +\def\normalplus{+} +\def\normaldollar{$}%$ font-lock fix + +% This macro is used to make a character print one way in \tt +% (where it can probably be output as-is), and another way in other fonts, +% where something hairier probably needs to be done. +% +% #1 is what to print if we are indeed using \tt; #2 is what to print +% otherwise. Since all the Computer Modern typewriter fonts have zero +% interword stretch (and shrink), and it is reasonable to expect all +% typewriter fonts to have this, we can check that font parameter. +% +\def\ifusingtt#1#2{\ifdim \fontdimen3\font=0pt #1\else #2\fi} + +% Same as above, but check for italic font. Actually this also catches +% non-italic slanted fonts since it is impossible to distinguish them from +% italic fonts. But since this is only used by $ and it uses \sl anyway +% this is not a problem. +\def\ifusingit#1#2{\ifdim \fontdimen1\font>0pt #1\else #2\fi} + +% Turn off all special characters except @ +% (and those which the user can use as if they were ordinary). +% Most of these we simply print from the \tt font, but for some, we can +% use math or other variants that look better in normal text. + +\catcode`\"=\active +\def\activedoublequote{{\tt\char34}} +\let"=\activedoublequote +\catcode`\~=\active +\def~{{\tt\char126}} +\chardef\hat=`\^ +\catcode`\^=\active +\def^{{\tt \hat}} + +\catcode`\_=\active +\def_{\ifusingtt\normalunderscore\_} +\let\realunder=_ +% Subroutine for the previous macro. +\def\_{\leavevmode \kern.07em \vbox{\hrule width.3em height.1ex}\kern .07em } + +\catcode`\|=\active +\def|{{\tt\char124}} +\chardef \less=`\< +\catcode`\<=\active +\def<{{\tt \less}} +\chardef \gtr=`\> +\catcode`\>=\active +\def>{{\tt \gtr}} +\catcode`\+=\active +\def+{{\tt \char 43}} +\catcode`\$=\active +\def${\ifusingit{{\sl\$}}\normaldollar}%$ font-lock fix + +% If a .fmt file is being used, characters that might appear in a file +% name cannot be active until we have parsed the command line. +% So turn them off again, and have \everyjob (or @setfilename) turn them on. +% \otherifyactive is called near the end of this file. +\def\otherifyactive{\catcode`+=\other \catcode`\_=\other} + +\catcode`\@=0 + +% \backslashcurfont outputs one backslash character in current font, +% as in \char`\\. +\global\chardef\backslashcurfont=`\\ +\global\let\rawbackslashxx=\backslashcurfont % let existing .??s files work + +% \rawbackslash defines an active \ to do \backslashcurfont. +% \otherbackslash defines an active \ to be a literal `\' character with +% catcode other. +{\catcode`\\=\active + @gdef@rawbackslash{@let\=@backslashcurfont} + @gdef@otherbackslash{@let\=@realbackslash} +} + +% \realbackslash is an actual character `\' with catcode other, and +% \doublebackslash is two of them (for the pdf outlines). +{\catcode`\\=\other @gdef@realbackslash{\} @gdef@doublebackslash{\\}} + +% \normalbackslash outputs one backslash in fixed width font. +\def\normalbackslash{{\tt\backslashcurfont}} + +\catcode`\\=\active + +% Used sometimes to turn off (effectively) the active characters +% even after parsing them. +@def@turnoffactive{% + @let"=@normaldoublequote + @let\=@realbackslash + @let~=@normaltilde + @let^=@normalcaret + @let_=@normalunderscore + @let|=@normalverticalbar + @let<=@normalless + @let>=@normalgreater + @let+=@normalplus + @let$=@normaldollar %$ font-lock fix + @unsepspaces +} + +% Same as @turnoffactive except outputs \ as {\tt\char`\\} instead of +% the literal character `\'. (Thus, \ is not expandable when this is in +% effect.) +% +@def@normalturnoffactive{@turnoffactive @let\=@normalbackslash} + +% Make _ and + \other characters, temporarily. +% This is canceled by @fixbackslash. +@otherifyactive + +% If a .fmt file is being used, we don't want the `\input texinfo' to show up. +% That is what \eatinput is for; after that, the `\' should revert to printing +% a backslash. +% +@gdef@eatinput input texinfo{@fixbackslash} +@global@let\ = @eatinput + +% On the other hand, perhaps the file did not have a `\input texinfo'. Then +% the first `\{ in the file would cause an error. This macro tries to fix +% that, assuming it is called before the first `\' could plausibly occur. +% Also turn back on active characters that might appear in the input +% file name, in case not using a pre-dumped format. +% +@gdef@fixbackslash{% + @ifx\@eatinput @let\ = @normalbackslash @fi + @catcode`+=@active + @catcode`@_=@active +} + +% Say @foo, not \foo, in error messages. +@escapechar = `@@ + +% These look ok in all fonts, so just make them not special. +@catcode`@& = @other +@catcode`@# = @other +@catcode`@% = @other + + +@c Local variables: +@c eval: (add-hook 'write-file-hooks 'time-stamp) +@c page-delimiter: "^\\\\message" +@c time-stamp-start: "def\\\\texinfoversion{" +@c time-stamp-format: "%:y-%02m-%02d.%02H" +@c time-stamp-end: "}" +@c End: + +@c vim:sw=2: + +@ignore + arch-tag: e1b36e32-c96e-4135-a41a-0b2efa2ea115 +@end ignore diff --git a/check.m4 b/check.m4 new file mode 100644 index 0000000..9515ae0 --- /dev/null +++ b/check.m4 @@ -0,0 +1,132 @@ +dnl AM_PATH_CHECK([MINIMUM-VERSION, [ACTION-IF-FOUND [, ACTION-IF-NOT-FOUND]]]) +dnl Test for check, and define CHECK_CFLAGS and CHECK_LIBS +dnl + +AC_DEFUN([AM_PATH_CHECK], +[ + AC_MSG_WARN([A@&t@M_PATH_CHECK() is deprecated]) + AC_MSG_WARN([[use P@&t@KG_CHECK_MODULES([CHECK], [check >= 0.9.4]) instead]]) + AC_ARG_WITH([check], + [ --with-check=PATH prefix where check is installed [default=auto]]) + + min_check_version=ifelse([$1], ,0.8.2,$1) + + AC_MSG_CHECKING(for check - version >= $min_check_version) + + if test x$with_check = xno; then + AC_MSG_RESULT(disabled) + ifelse([$3], , AC_MSG_ERROR([disabling check is not supported]), [$3]) + else + if test "x$with_check" != x; then + CHECK_CFLAGS="-I$with_check/include" + CHECK_LIBS="-L$with_check/lib -lcheck" + else + CHECK_CFLAGS="" + CHECK_LIBS="-lcheck" + fi + + ac_save_CFLAGS="$CFLAGS" + ac_save_LIBS="$LIBS" + + CFLAGS="$CFLAGS $CHECK_CFLAGS" + LIBS="$CHECK_LIBS $LIBS" + + rm -f conf.check-test + AC_COMPILE_IFELSE([AC_LANG_SOURCE([AC_INCLUDES_DEFAULT([]) +#include + +int main () +{ + int major, minor, micro; + char *tmp_version; + + system ("touch conf.check-test"); + + /* HP/UX 9 (%@#!) writes to sscanf strings */ + tmp_version = strdup("$min_check_version"); + if (sscanf(tmp_version, "%d.%d.%d", &major, &minor, µ) != 3) { + printf("%s, bad version string\n", "$min_check_version"); + return 1; + } + + if ((CHECK_MAJOR_VERSION != check_major_version) || + (CHECK_MINOR_VERSION != check_minor_version) || + (CHECK_MICRO_VERSION != check_micro_version)) + { + printf("\n*** The check header file (version %d.%d.%d) does not match\n", + CHECK_MAJOR_VERSION, CHECK_MINOR_VERSION, CHECK_MICRO_VERSION); + printf("*** the check library (version %d.%d.%d).\n", + check_major_version, check_minor_version, check_micro_version); + return 1; + } + + if ((check_major_version > major) || + ((check_major_version == major) && (check_minor_version > minor)) || + ((check_major_version == major) && (check_minor_version == minor) && (check_micro_version >= micro))) + { + return 0; + } + else + { + printf("\n*** An old version of check (%d.%d.%d) was found.\n", + check_major_version, check_minor_version, check_micro_version); + printf("*** You need a version of check being at least %d.%d.%d.\n", major, minor, micro); + printf("***\n"); + printf("*** If you have already installed a sufficiently new version, this error\n"); + printf("*** probably means that the wrong copy of the check library and header\n"); + printf("*** file is being found. Rerun configure with the --with-check=PATH option\n"); + printf("*** to specify the prefix where the correct version was installed.\n"); + } + + return 1; +} +])],, no_check=yes, [echo $ac_n "cross compiling; assumed OK... $ac_c"]) + + CFLAGS="$ac_save_CFLAGS" + LIBS="$ac_save_LIBS" + + if test "x$no_check" = x ; then + AC_MSG_RESULT(yes) + ifelse([$2], , :, [$2]) + else + AC_MSG_RESULT(no) + if test -f conf.check-test ; then + : + else + echo "*** Could not run check test program, checking why..." + CFLAGS="$CFLAGS $CHECK_CFLAGS" + LIBS="$CHECK_LIBS $LIBS" + AC_TRY_LINK([ +#include +#include + +#include +], , [ echo "*** The test program compiled, but did not run. This usually means" + echo "*** that the run-time linker is not finding check. You'll need to set your" + echo "*** LD_LIBRARY_PATH environment variable, or edit /etc/ld.so.conf to point" + echo "*** to the installed location Also, make sure you have run ldconfig if that" + echo "*** is required on your system" + echo "***" + echo "*** If you have an old version installed, it is best to remove it, although" + echo "*** you may also be able to get things to work by modifying LD_LIBRARY_PATH"], + [ echo "*** The test program failed to compile or link. See the file config.log for" + echo "*** the exact error that occured." ]) + + CFLAGS="$ac_save_CFLAGS" + LIBS="$ac_save_LIBS" + fi + + CHECK_CFLAGS="" + CHECK_LIBS="" + + rm -f conf.check-test + ifelse([$3], , AC_MSG_ERROR([check not found]), [$3]) + fi + + AC_SUBST(CHECK_CFLAGS) + AC_SUBST(CHECK_LIBS) + + rm -f conf.check-test + + fi +]) diff --git a/check.pc.in b/check.pc.in new file mode 100644 index 0000000..0d84bf6 --- /dev/null +++ b/check.pc.in @@ -0,0 +1,11 @@ +prefix=@prefix@ +exec_prefix=@exec_prefix@ +libdir=@libdir@ +includedir=@includedir@ + +Name: Check +Description: A unit test framework for C +URL: http://check.sourceforge.net +Version: @VERSION@ +Libs: -L${libdir} -lcheck +Cflags: -I${includedir} diff --git a/configure.ac b/configure.ac new file mode 100644 index 0000000..4d36049 --- /dev/null +++ b/configure.ac @@ -0,0 +1,102 @@ +# -*- Autoconf -*- +# Process this file with autoconf to produce a configure script. + +# Prelude. +AC_PREREQ([2.59]) +AC_INIT([Check], [0.9.4], [check-devel@lists.sourceforge.net]) + +# unique source file --- primitive safety check +AC_CONFIG_SRCDIR([src/check.c]) + +# place to put some extra build scripts installed +AC_CONFIG_AUX_DIR([build-aux]) + +# really severe build strictness +AM_INIT_AUTOMAKE([-Wall -Werror gnits 1.9.6]) + +# FIXME: find the other places this stuff is used + +CHECK_MAJOR_VERSION=0 +CHECK_MINOR_VERSION=9 +CHECK_MICRO_VERSION=4 +CHECK_VERSION=$CHECK_MAJOR_VERSION.$CHECK_MINOR_VERSION.$CHECK_MICRO_VERSION + +AC_SUBST(CHECK_MAJOR_VERSION) +AC_SUBST(CHECK_MINOR_VERSION) +AC_SUBST(CHECK_MICRO_VERSION) +AC_SUBST(CHECK_VERSION) + +# Configure options. + +AC_ARG_ENABLE(gcov, +AC_HELP_STRING([--enable-gcov], + [turn on test coverage @<:@default=no@:>@]), +[case "${enableval}" in + yes) enable_gcov=true ;; + no) enable_gcov=false ;; + *) AC_MSG_ERROR(bad value ${enableval} for --enable-gcov) ;; +esac], [enable_gcov=false ]) + +AM_CONDITIONAL(ENABLE_GCOV, test x"$enable_gcov" = "xtrue") + +AC_ARG_ENABLE(timeout-tests, +AC_HELP_STRING([--enable-timeout-tests], + [turn on timeout tests @<:@default=yes@:>@]), +[case "${enableval}" in + yes) enable_timeout_tests=true ;; + no) enable_timeout_tests=false ;; + *) AC_MSG_ERROR(bad value ${enableval} for --enable-timeout-tests) ;; +esac], [enable_timeout_tests=true ]) + +AM_CONDITIONAL(NO_TIMEOUT_TESTS, test x"$enable_timeout_tests" = "xfalse") + +# Checks for programs. +AC_PROG_AWK +AM_PROG_CC_C_O +AC_PROG_INSTALL +AC_PROG_LN_S +AC_PROG_LIBTOOL +if test -n "$GCC"; then + CFLAGS="$CFLAGS -Wall -Wstrict-prototypes -Wmissing-prototypes -Wwrite-strings" +fi +AC_CHECK_PROGS(GCOV, gcov, false) +AC_CHECK_PROGS(LCOV, lcov, false) +AC_CHECK_PROGS(GENHTML, genhtml, false) + +# Checks for libraries. + +# Checks for header files. +AC_HEADER_STDC +AC_HEADER_SYS_WAIT +AC_CHECK_HEADERS([fcntl.h stddef.h stdint.h stdlib.h string.h sys/time.h unistd.h]) + +# Checks for typedefs, structures, and compiler characteristics. +AC_C_CONST +AC_TYPE_PID_T +AC_TYPE_SIZE_T +AC_HEADER_TIME +AC_STRUCT_TM + +AC_CHECK_SIZEOF(int, 4) +AC_CHECK_SIZEOF(short, 2) +AC_CHECK_SIZEOF(long, 4) + +# Checks for library functions. +AC_FUNC_FORK +AC_FUNC_MALLOC +AC_FUNC_REALLOC +AC_FUNC_STRFTIME +AC_FUNC_VPRINTF +AC_CHECK_FUNCS([alarm gettimeofday localtime_r memmove memset putenv setenv strdup strerror strrchr strstr]) + +# Output files +AC_CONFIG_HEADERS([config.h]) + +AC_CONFIG_FILES([check.pc + Makefile + doc/Makefile + src/check.h + src/Makefile + tests/Makefile]) + +AC_OUTPUT diff --git a/debian/README.Debian b/debian/README.Debian new file mode 100644 index 0000000..d0d7565 --- /dev/null +++ b/debian/README.Debian @@ -0,0 +1,23 @@ +P I C S U P P O R T +===================== + +In addition to the non-PIC static library, check now also ships a PIC- +enabled library libcheck_pic.a, this is e.g. needed if you want to link +libcheck against a dynamic library on x86_64 + +U P G R A D E N O T I C E +=========================== + +This version of check makes tcase_free and suite_free static and not +available to your programs anymore. this is not an error, but intended +since these are freed by srunner_free now. a deprecation period would +have been nice, but here we are. so: just delete the calls and make +sure you run srunner_free! + +D O C U M E N T A T I O N +========================= + +In this version of check, all relevant documentation is in texinfo format, so +just type "info check" to get to the manual. + +cu robert diff --git a/debian/changelog b/debian/changelog new file mode 100644 index 0000000..b21e8d5 --- /dev/null +++ b/debian/changelog @@ -0,0 +1,140 @@ +check (0.9.4-5) unstable; urgency=low + + * Remove autotools pakcaging + * Git: 165.213.180.234:slp/pkgs/c/check + * Tag: check_0.9.4-5 + + -- SooChan Lim Fri, 12 Aug 2011 13:30:21 +0900 + +check (0.9.4-4) unstable; urgency=low + + * Import debian package and update version not to make version problem + + -- Sung-Jin Park Fri, 04 Dec 2009 10:17:03 +0900 + +check (0.9.4-3) unstable; urgency=high + + * Fixed a bug that breaks all loop tests that use "i" as a variable name + (closes: #404118) + + -- Robert Lemmen Thu, 21 Dec 2006 21:03:44 +0100 + +check (0.9.4-2) unstable; urgency=low + + * Fixed check.m4, thanks josh! (closes: #395466, #395467) + * Added binary-indep target (closes: #395677) + + -- Robert Lemmen Mon, 30 Oct 2006 11:19:36 +0100 + +check (0.9.4-1) unstable; urgency=low + + * New upstream release + + -- Robert Lemmen Sun, 15 Oct 2006 14:21:41 +0200 + +check (0.9.3-2) unstable; urgency=low + + * Also ships a PIC library (closes: #344309) + + -- Robert Lemmen Thu, 22 Dec 2005 10:47:07 +0100 + +check (0.9.3-1) unstable; urgency=low + + * New upstream release including many fixes about threading and forking + functionality + * Some spurious files were removed in the debian/ dir (closes: #195607) + + -- Robert Lemmen Tue, 30 Aug 2005 12:06:32 +0200 + +check (0.9.2-6) unstable; urgency=low + + * Rebuild for g++ transition + * Updated to newer standards version + + -- Robert Lemmen Tue, 19 Jul 2005 10:53:23 +0200 + +check (0.9.2-5) unstable; urgency=low + + * fixed documentation (Closes: #301214) + * added include to check.h (Closes: #301319) + + -- Robert Lemmen Wed, 8 Jun 2005 14:50:11 +0200 + +check (0.9.2-4) unstable; urgency=low + + * added an upgrade notice that was missing + + -- Robert Lemmen Mon, 14 Mar 2005 19:12:09 +0100 + +check (0.9.2-3) unstable; urgency=low + + * fixed some problems with upstream files in debian/ + + -- Robert Lemmen Tue, 15 Feb 2005 16:11:59 +0100 + +check (0.9.2-2) unstable; urgency=low + + * fixed FTBFS error when trying to copy the example data + + -- Robert Lemmen Thu, 13 Jan 2005 13:46:25 +0100 + +check (0.9.2-1) unstable; urgency=low + + * New upstream release (Closes: #261420) + * Took over maintenance (Closes: #288213) + * Updated to new policy version + * Fixed copyright files (Closes: #187986) + * General cleanups in debian/ + * Added watch file + + -- Robert Lemmen Sat, 8 Jan 2005 20:22:17 +0100 + +check (0.8.4-1) unstable; urgency=low + + * Changed Author(s): to Author: in copyright file to keep lintian + happy. + + * debian/rules now uses upstream configure, DH_COMPAT=4, install + target is simplified by additional use of debhelper, irrelevant + dh_ program calls commented out. + + * New upstream release. Closes: bug#85195. + + -- Britton Leo Kerin Sun, 08 Dec 2002 23:53:02 -0900 + +check (0.8.3-2) unstable; urgency=low + + * Corrected typos in check.h. closes: #151599 + + -- Muhammad Hussain Yusuf Mon, 1 Jul 2002 16:21:57 +0100 + +check (0.8.3-1) unstable; urgency=low + + * New Upstream release + * Added check.m4 to /usr/share/aclocal. Closes: #148044 + + -- Muhammad Hussain Yusuf Sat, 25 May 2002 10:59:11 +0100 + +check (0.8.2-1) unstable; urgency=low + + * New Upstream Release. Closes: #144186 + + -- Muhammad Hussain Yusuf Fri, 26 Apr 2002 10:54:45 +0100 + +check (0.8.1-2) unstable; urgency=low + + * Changed copyright details to LGPL. Closes: #141952 + + -- Muhammad Hussain Yusuf Wed, 10 Apr 2002 12:55:49 +0100 + +check (0.8.1-1) unstable; urgency=low + + * New Upstream Release. Closes: #138898 + + -- Muhammad Hussain Yusuf Fri, 22 Mar 2002 12:41:16 +0000 + +check (0.8.0-1) unstable; urgency=low + + * Initial Release. Closes: #132568 + + -- Muhammad Hussain Yusuf Sun, 10 Feb 2002 15:55:59 +0000 diff --git a/debian/check.dirs b/debian/check.dirs new file mode 100644 index 0000000..9204b74 --- /dev/null +++ b/debian/check.dirs @@ -0,0 +1,5 @@ +usr/lib +usr/lib/pkgconfig +usr/include +usr/share/aclocal +usr/share/doc/check diff --git a/debian/check.files b/debian/check.files new file mode 100644 index 0000000..27678e2 --- /dev/null +++ b/debian/check.files @@ -0,0 +1,5 @@ +usr/include/check.h +usr/lib/libcheck.a +usr/share/aclocal/check.m4 +usr/share/doc/check +usr/lib/pkgconfig/check.pc diff --git a/debian/compat b/debian/compat new file mode 100644 index 0000000..b8626c4 --- /dev/null +++ b/debian/compat @@ -0,0 +1 @@ +4 diff --git a/debian/control b/debian/control new file mode 100644 index 0000000..98587e6 --- /dev/null +++ b/debian/control @@ -0,0 +1,16 @@ +Source: check +Section: devel +Priority: optional +Maintainer: Robert Lemmen +Uploaders: Sung-Jin Park , SooChan Lim +Build-Depends: debhelper (>> 4.0.0) +Standards-Version: 3.7.2 + +Package: check +Architecture: any +Description: unit test framework for C + Check features a simple interface for defining unit tests, putting + little in the way of the developer. Tests are run in a separate + address space, so Check can catch both assertion failures and code + errors that cause segmentation faults or other signals. The output + from unit tests can be used within source code editors and IDEs. diff --git a/debian/copyright b/debian/copyright new file mode 100644 index 0000000..9a3e317 --- /dev/null +++ b/debian/copyright @@ -0,0 +1,31 @@ +This package is now maintained by Robert Lemmen + +It was originally debianized by Muhammad Hussain Yusuf +on Sun, 10 Feb 2002 15:55:59 +0000 and maintained after him for a while by +Britton Leo Kerin + +The upstream source was downloaded from http://sourceforge.net/projects/check + +Upstream Authors: Arien Malec , + Sven Neumann , + Fred L. Drake, Jr. + +Copyright: 2001-2005 check authors (see above) and others + + This library is free software; you can redistribute it and/or + modify it under the terms of the GNU Lesser General Public + License as published by the Free Software Foundation; either + version 2.1 of the License, or (at your option) any later version. + + This library 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 + Lesser General Public License for more details. + + You should have received a copy of the GNU Lesser General Public + License along with this library; if not, write to the Free Software + Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301, + USA. + + On Debian systems, the complete text of the GNU Lesser General Public + License can be found in /usr/share/common-licenses/LGPL. diff --git a/debian/dirs b/debian/dirs new file mode 100644 index 0000000..d379f3c --- /dev/null +++ b/debian/dirs @@ -0,0 +1,3 @@ +/usr/share/doc/check +/usr/include +/usr/lib diff --git a/debian/docs b/debian/docs new file mode 100644 index 0000000..29f6f41 --- /dev/null +++ b/debian/docs @@ -0,0 +1,2 @@ +NEWS +ChangeLogOld diff --git a/debian/example_makefile b/debian/example_makefile new file mode 100644 index 0000000..fa63917 --- /dev/null +++ b/debian/example_makefile @@ -0,0 +1,11 @@ +# this is a very simple makefile for the +# check examples. in a real-world situation +# you would have to modify your make setup accordingly. + +LDFLAGS=-lcheck + +check_example: check_money.o money.o + $(CC) $(CFLAGS) -o $@ $^ $(LDFLAGS) + +%.o: %.c + $(CC) $(CFLAGS) -c $< diff --git a/debian/examples b/debian/examples new file mode 100644 index 0000000..2dbdf7e --- /dev/null +++ b/debian/examples @@ -0,0 +1 @@ +doc/money/* diff --git a/debian/rules b/debian/rules new file mode 100755 index 0000000..e5e0d5a --- /dev/null +++ b/debian/rules @@ -0,0 +1,86 @@ +#!/usr/bin/make -f + +# Uncomment this to turn on verbose mode. +#export DH_VERBOSE=1 + +export DESTDIR=$(shell pwd)/debian/check + +configure: configure-stamp +configure-stamp: + dh_testdir + ./autogen.sh + ./configure --prefix=/usr --infodir=/usr/share/info --enable-plain-docdir + touch configure-stamp + +configure-pic: configure-stamp-pic +configure-stamp-pic: + dh_testdir + ./autogen.sh + CFLAGS="-g -O2 -fPIC" ./configure --prefix=/usr --infodir=/usr/share/info \ + --enable-plain-docdir + touch configure-stamp-pic + +build: build-pic configure-stamp build-stamp +build-stamp: + dh_testdir + $(MAKE) + touch build-stamp + +build-pic: configure-stamp-pic build-stamp-pic +build-stamp-pic: + dh_testdir + $(MAKE) + mv src/.libs/libcheck.a src/libcheck_pic.a + touch build-stamp-pic + +clean: + dh_testdir + dh_testroot + rm -f build-stamp configure-stamp build-stamp-pic configure-stamp-pic + -$(MAKE) distclean + rm -f src/libcheck_pic.a + # hack! + rm -f debian/files + dh_clean + +install: build + dh_testdir + dh_testroot + dh_installdirs + + $(MAKE) DESTDIR=$(DESTDIR) install + # fix the installation + rm -f debian/check/usr/share/doc/check/COPYING* + +install-pic: build-pic + dh_testdir + dh_testroot + dh_clean -k + dh_installdirs + cp src/libcheck_pic.a debian/check/usr/lib/ + +binary-arch: install-pic install + dh_testdir + dh_testroot + dh_installdocs -XTODO + dh_installexamples + dh_installchangelogs ChangeLog + dh_compress -XMakefile + # fix the setup + rm -f debian/check/usr/share/doc/check/ChangeLog.gz + rm -f debian/check/usr/lib/libcheck.so.* + rm -f debian/check/usr/lib/libcheck.so + rm -f debian/check/usr/lib/libcheck.la + dh_link + dh_strip + dh_fixperms + dh_installdeb + dh_gencontrol + dh_md5sums + dh_builddeb + +binary-indep: + # nothing to do + +binary: binary-arch +.PHONY: build clean binary-indep binary-arch binary install configure diff --git a/debian/watch b/debian/watch new file mode 100644 index 0000000..ac06598 --- /dev/null +++ b/debian/watch @@ -0,0 +1,6 @@ +# Example watch control file for uscan +# Rename this file to "watch" and then you can run the "uscan" command +# to check for upstream updates and more. +# Site Directory Pattern Version Script +version=2 +http://prdownloads.sourceforge.net/check/ /check/check-(.*).tar.gz diff --git a/doc/Makefile.am b/doc/Makefile.am new file mode 100644 index 0000000..69f2dec --- /dev/null +++ b/doc/Makefile.am @@ -0,0 +1,120 @@ +## Process this file with automake to produce Makefile.in + +info_TEXINFOS = check.texi +check_TEXINFOS = fdl.texi + +## we need to include several diffs as we evolve the example in the +## tutorial. this means we'll generate them from the example source. + +check.texi: money.1-2.h.diff \ + money.1-3.c.diff \ + money.3-4.c.diff \ + money.4-5.c.diff \ + money.5-6.c.diff \ + check_money.1-2.c.diff \ + check_money.2-3.c.diff \ + check_money.3-6.c.diff \ + check_money.6-7.c.diff + +eg_root = $(top_srcdir)/doc/example +eg_src = $(eg_root)/src +eg_tests = $(eg_root)/tests + +## now a rule for each diff. the redundancy here can probably be +## parameterized, but I don't know how. if you know, please tell us! + +money.1-2.h.diff: $(eg_src)/money.1.h $(eg_src)/money.2.h + cd $(eg_root); \ + diff -u src/money.1.h src/money.2.h > @abs_builddir@/$@; \ + cd -; + +money.1-3.c.diff: $(eg_src)/money.1.c $(eg_src)/money.3.c + cd $(eg_root); \ + diff -u src/money.1.c src/money.3.c > @abs_builddir@/$@; \ + cd -; + +money.3-4.c.diff: $(eg_src)/money.3.c $(eg_src)/money.4.c + cd $(eg_root); \ + diff -u src/money.3.c src/money.4.c > @abs_builddir@/$@; \ + cd -; + +money.4-5.c.diff: $(eg_src)/money.4.c $(eg_src)/money.5.c + cd $(eg_root); \ + diff -u src/money.4.c src/money.5.c > @abs_builddir@/$@; \ + cd -; + +money.5-6.c.diff: $(eg_src)/money.5.c $(eg_src)/money.6.c + cd $(eg_root); \ + diff -u src/money.5.c src/money.6.c > @abs_builddir@/$@; \ + cd -; + +check_money.1-2.c.diff: $(eg_tests)/check_money.1.c $(eg_tests)/check_money.2.c + cd $(eg_root); \ + diff -u tests/check_money.1.c tests/check_money.2.c > @abs_builddir@/$@; \ + cd -; + +check_money.2-3.c.diff: $(eg_tests)/check_money.2.c $(eg_tests)/check_money.3.c + cd $(eg_root); \ + diff -u tests/check_money.2.c tests/check_money.3.c > @abs_builddir@/$@; \ + cd -; + +check_money.3-6.c.diff: $(eg_tests)/check_money.3.c $(eg_tests)/check_money.6.c + cd $(eg_root); \ + diff -u tests/check_money.3.c tests/check_money.6.c > @abs_builddir@/$@; \ + cd -; + +check_money.6-7.c.diff: $(eg_tests)/check_money.6.c $(eg_tests)/check_money.7.c + cd $(eg_root); \ + diff -u tests/check_money.6.c tests/check_money.7.c > @abs_builddir@/$@; \ + cd -; + +# explicitly list every file in the example. + +example_docs = example/Makefile.am \ + example/README \ + example/configure.ac + +example_src_docs = example/src/Makefile.am \ + example/src/main.c \ + example/src/money.c \ + example/src/money.h \ + example/src/money.1.h \ + example/src/money.2.h \ + example/src/money.1.c \ + example/src/money.3.c \ + example/src/money.4.c \ + example/src/money.5.c \ + example/src/money.6.c + +example_tests_docs = example/tests/Makefile.am \ + example/tests/check_money.c \ + example/tests/check_money.1.c \ + example/tests/check_money.2.c \ + example/tests/check_money.3.c \ + example/tests/check_money.6.c \ + example/tests/check_money.7.c + +## what to clean + +CLEANFILES = *~ *.diff + +## what to distribute + +EXTRA_DIST = $(example_docs) \ + $(example_src_docs) \ + $(example_tests_docs) + +## what to install + +docdir = $(datadir)/doc/$(PACKAGE) + +# install money example + +exampledir = $(docdir)/example +example_DATA = $(example_docs) + +examplesrcdir = $(docdir)/example/src +examplesrc_DATA = $(example_src_docs) + +exampletestsdir = $(docdir)/example/tests +exampletests_DATA = $(example_tests_docs) diff --git a/doc/check.texi b/doc/check.texi new file mode 100644 index 0000000..0b09422 --- /dev/null +++ b/doc/check.texi @@ -0,0 +1,1318 @@ +\input texinfo @c -*-texinfo-*- +@c %**start of header +@setfilename check.info +@include version.texi +@settitle Check @value{VERSION} +@syncodeindex fn cp +@syncodeindex tp cp +@syncodeindex vr cp +@c %**end of header + +@copying +This manual is for Check +(version @value{VERSION}, @value{UPDATED}), +a unit test framework for C programs. + +Copyright @copyright{} 2001--2006 Arien Malec, Chris Pickett, Fredrik +Hugosson, and Robert Lemmen. + +@quotation +Permission is granted to copy, distribute and/or modify this document +under the terms of the @acronym{GNU} Free Documentation License, +Version 1.2 or any later version published by the Free Software +Foundation; with no Invariant Sections, no Front-Cover texts, and no +Back-Cover Texts. A copy of the license is included in the section +entitled ``@acronym{GNU} Free Documentation License.'' +@end quotation +@end copying + +@dircategory Software development +@direntry +* Check: (check)Introduction. +@end direntry + +@titlepage +@title Check +@subtitle A Unit Test Framework for C +@subtitle for version @value{VERSION}, @value{UPDATED} +@author Arien Malec +@author Chris Pickett +@author Fredrik Hugosson +@author Robert Lemmen + +@c The following two commands start the copyright page. +@page +@vskip 0pt plus 1filll +@insertcopying +@end titlepage + +@c Output the table of contents at the beginning. +@contents + +@ifnottex +@node Top, Introduction, (dir), (dir) +@top Check + +@insertcopying + +Please send corrections to this manual to +@email{check-devel@@lists.sourceforge.net}. We'd prefer it if you can +send a unified diff (@command{diff -u}) against the +@file{doc/check.texi} file that ships with Check, but something is +still better than nothing if you can't manage that. +@end ifnottex + +@menu +* Introduction:: +* Unit Testing in C:: +* Tutorial:: +* Advanced Features:: +* Conclusion and References:: +* AM_PATH_CHECK:: +* Copying This Manual:: +* Index:: + +@detailmenu + --- The Detailed Node Listing --- + +Unit Testing in C + +* Other Frameworks for C:: + +Tutorial: Basic Unit Testing + +* How to Write a Test:: +* Setting Up the Money Build:: +* Test a Little:: +* Creating a Suite:: +* SRunner Output:: + +Advanced Features + +* Running Multiple Cases:: +* No Fork Mode:: +* Test Fixtures:: +* Multiple Suites in one SRunner:: +* Testing Signal Handling:: +* Looping Tests:: +* Test Timeouts:: +* Determining Test Coverage:: +* Test Logging:: + +Test Fixtures + +* Test Fixture Examples:: +* Checked vs Unchecked Fixtures:: + +Test Logging + +* XML Logging:: + +Copying This Manual + +* GNU Free Documentation License:: License for copying this manual. + +@end detailmenu +@end menu + +@node Introduction, Unit Testing in C, Top, Top +@chapter Introduction +@cindex introduction + +Check is a unit testing framework for C. It was inspired by similar +frameworks that currently exist for most programming languages; the +most famous example being @uref{http://www.junit.org, JUnit} for Java. +There is a list of unit test frameworks for multiple languages at +@uref{http://www.xprogramming.com/software.htm}. Unit testing has a +long history as part of formal quality assurance methodologies, but +has recently been associated with the lightweight methodology called +Extreme Programming. In that methodology, the characteristic practice +involves interspersing unit test writing with coding (``test a +little, code a little''). While the incremental unit test/code +approach is indispensable to Extreme Programming, it is also +applicable, and perhaps indispensable, outside of that methodology. + +The incremental test/code approach provides three main benefits to the +developer: + +@enumerate +@item +Because the unit tests use the interface to the unit being tested, +they allow the developer to think about how the interface should be +designed for usage early in the coding process. + +@item +They help the developer think early about aberrant cases, and code +accordingly. + +@item +By providing a documented level of correctness, they allow the +developer to refactor (see @uref{http://www.refactoring.com}) +aggressively. +@end enumerate + +That third reason is the one that turns people into unit testing +addicts. There is nothing so satisfying as doing a wholesale +replacement of an implementation, and having the unit tests reassure +you at each step of that change that all is well. It is like the +difference between exploring the wilderness with and without a good +map and compass: without the proper gear, you are more likely to +proceed cautiously and stick to the marked trails; with it, you can +take the most direct path to where you want to go. + +Look at the Check homepage for the latest information on Check: +@uref{http://check.sourceforge.net}. + +The Check project page is at: +@uref{http://sourceforge.net/projects/check/}. + +@node Unit Testing in C, Tutorial, Introduction, Top +@chapter Unit Testing in C +@ C unit testing + +The approach to unit testing frameworks used for Check originated with +Smalltalk, which is a late binding object-oriented language supporting +reflection. Writing a framework for C requires solving some special +problems that frameworks for Smalltalk, Java or Python don't have to +face. In all of those language, the worst that a unit test can do is +fail miserably, throwing an exception of some sort. In C, a unit test +is just as likely to trash its address space as it is to fail to meet +its test requirements, and if the test framework sits in the same +address space, goodbye test framework. + +To solve this problem, Check uses the @code{fork()} system call to +create a new address space in which to run each unit test, and then +uses message queues to send information on the testing process back to +the test framework. That way, your unit test can do all sorts of +nasty things with pointers, and throw a segmentation fault, and the +test framework will happily note a unit test error, and chug along. + +The Check framework is also designed to play happily with common +development environments for C programming. The author designed Check +around Autoconf/Automake (thus the name Check: @command{make check} is +the idiom used for testing with Autoconf/Automake), and the test +failure messages thrown up by Check use the common idiom of +@samp{filename:linenumber:message} used by @command{gcc} and family to +report problems in source code. With (X)Emacs, the output of Check +allows one to quickly navigate to the location of the unit test that +failed; presumably that also works in VI and IDEs. + +@menu +* Other Frameworks for C:: +@end menu + +@node Other Frameworks for C, , Unit Testing in C, Unit Testing in C +@section Other Frameworks for C +@cindex other frameworks +@cindex frameworks + +The authors know of the following additional unit testing frameworks +for C: + +@table @asis + +@item GNU Autounit +Much along the same lines as Check, including forking to run unit +tests in a separate address space (in fact, the original author of +Check borrowed the idea from @acronym{GNU} Autounit). @acronym{GNU} +Autounit uses GLib extensively, which means that linking and such need +special options, but this may not be a big problem to you, especially +if you are already using GTK or GLib. See the +@uref{http://www.recursism.com/s2004/zp/products/gnu+autounit, GNU +Autounit homepage}. + +@item cUnit +Also uses GLib, but does not fork to protect the address space of unit +tests. See the +@uref{http://web.archive.org/web/*/http://people.codefactory.se/~spotty/cunit/, +archived cUnit homepage}. + +@item CUnit +Standard C, with plans for a Win32 GUI implementation. Does not +currently fork or otherwise protect the address space of unit tests. +In early development. See the @uref{http://cunit.sourceforge.net, +CUnit homepage}. + +@item CppUnit +The premier unit test framework for C++; you can also use it to test C +code. It is stable, actively developed, and has a GUI interface. The +primary reasons not to use CppUnit for C are first that it is quite +big, and second you have to write your tests in C++, which means you +need a C++ compiler. If these don't sound like concerns, it is +definitely worth considering, along with other C++ unit testing +frameworks. See the +@uref{http://cppunit.sourceforge.net/cppunit-wikie, CppUnit homepage}. + +@item MinUnit +A minimal set of macros and that's it! The point is to +show how easy it is to unit test your code. See the +@uref{http://www.jera.com/techinfo/jtns/jtn002.html, MinUnit +homepage}. + +@item CUnit for Mr. Ando +A CUnit implementation that is fairly new, and apparently still in +early development. See the +@uref{http://park.ruru.ne.jp/ando/work/CUnitForAndo/html/, CUnit for +Mr. Ando homepage}. +@end table + +This list was last updated in March 2006. If you know of other C unit +test frameworks, please send an email plus description to +@email{check-devel@@lists.sourceforge.net} and we will add the entry +to this list. + +It is the authors' considered opinion that forking or otherwise +trapping and reporting signals is indispensable for unit testing (but +it probably wouldn't be hard to add that to frameworks without that +feature). Try 'em all out: adapt this tutorial to use all of the +frameworks above, and use whichever you like. Contribute, spread the +word, and make one a standard. Languages such as Java and Python are +fortunate to have standard unit test frameworks; it would be desirable +that C have one as well. + +@node Tutorial, Advanced Features, Unit Testing in C, Top +@chapter Tutorial: Basic Unit Testing + +This tutorial will use the JUnit +@uref{http://junit.sourceforge.net/doc/testinfected/testing.htm, Test +Infected} article as a starting point. We will be creating a library +to represent money, @code{libmoney}, that allows conversions between +different currency types. The development style will be ``test a +little, code a little'', with unit test writing preceding coding. +This constantly gives us insights into module usage, and also makes +sure we are constantly thinking about how to test our code. + +@menu +* How to Write a Test:: +* Setting Up the Money Build:: +* Test a Little:: +* Creating a Suite:: +* SRunner Output:: +@end menu + +@node How to Write a Test, Setting Up the Money Build, Tutorial, Tutorial +@section How to Write a Test + +Test writing using Check is very simple. The file in which the checks +are defined must include @file{check.h} as so: +@example +@verbatim +#include +@end verbatim +@end example + +The basic unit test looks as follows: +@example +@verbatim +START_TEST (test_name) +{ + /* unit test code */ +} +END_TEST +@end verbatim +@end example + +The @code{START_TEST}/@code{END_TEST} pair are macros that setup basic +structures to permit testing. It is a mistake to leave off the +@code{END_TEST} marker; doing so produces all sorts of strange errors +when the check is compiled. + +@node Setting Up the Money Build, Test a Little, How to Write a Test, Tutorial +@section Setting Up the Money Build + +Since we are creating a library to handle money, we will first create +an interface in @file{money.h}, an implementation in @file{money.c}, +and a place to store our unit tests, @file{check_money.c}. We want to +integrate these core files into our build system, and will need some +additional structure. To manage everything we'll use Autoconf, +Automake, and friends (collectively known as Autotools) for this +example. One could do something similar with ordinary Makefiles, but +in the authors' opinion, it is generally easier to use Autotools than +bare Makefiles, and they provide built-in support for running tests. + +Note that this is not the place to explain how Autotools works. If +you need help understanding what's going on beyond the explanations +here, the best place to start is probably Alexandre Duret-Lutz's +excellent +@uref{http://www-src.lip6.fr/homepages/Alexandre.Duret-Lutz/autotools.html, +Autotools tutorial}. + +The examples in this section are part of the Check distribution; you +don't need to spend time cutting and pasting or (worse) retyping them. +Locate the Check documentation on your system and look in the +@samp{example} directory. The standard directory for GNU/Linux +distributions should be @samp{/usr/share/doc/check/example}. This +directory contains the final version reached the end of the tutorial. If +you want to follow along, create backups of @file{money.h}, +@file{money.c}, and @file{check_money.c}, and then delete the originals. + +We set up a directory structure as follows: +@example +@verbatim +. +|-- Makefile.am +|-- README +|-- configure.ac +|-- src +| |-- Makefile.am +| |-- main.c +| |-- money.c +| `-- money.h +`-- tests + |-- Makefile.am + `-- check_money.c +@end verbatim +@end example + +Note that this is the output of @command{tree}, a great directory +visualization tool. The top-level @file{Makefile.am} is simple; it +merely tells Automake how to process subdirectories: +@example +@verbatim +SUBDIRS = src . tests +@end verbatim +@end example + +Note that @code{tests} comes last, because the code should be testing +an already compiled library. @file{configure.ac} is standard Autoconf +boilerplate, as specified by the Autotools tutorial and as suggested +by @command{autoscan}. The @code{AM_PATH_CHECK()} is the only line +particular to Check @pxref{AM_PATH_CHECK}. + +@file{src/Makefile.am} builds @samp{libmoney} as a Libtool archive, +and links it to an application simply called @command{main}. The +application's behaviour is not important to this tutorial; what's +important is that none of the functions we want to unit test appear in +@file{main.c}; this probably means that the only function in +@file{main.c} should be @code{main()} itself. In order to test the +whole application, unit testing is not appropriate: you should use a +system testing tool like Autotest. If you really want to test +@code{main()} using Check, rename it to something like +@code{_myproject_main()} and write a wrapper around it. + +The primary build instructions for our unit tests are in +@file{tests/Makefile.am}: + +@example +@verbatiminclude example/tests/Makefile.am +@end example + +@code{TESTS} tells Automake which test programs to run for +@command{make check}. Similarly, the @code{check_} prefix in +@code{check_PROGRAMS} actually comes from Automake; it says to build +these programs only when @command{make check} is run. (Recall that +Automake's @code{check} target is the origin of Check's name.) The +@command{check_money} test is a program that we will build from +@file{tests/check_money.c}, linking it against both +@file{src/libmoney.la} and the installed @file{libcheck.la} on our +system. The appropriate compiler and linker flags for using Check are +found in @code{@@CHECK_CFLAGS@@} and @code{@@CHECK_LIBS@@}, values +defined by the @code{AM_PATH_CHECK} macro. + +Now that all this infrastructure is out of the way, we can get on with +development. @file{src/money.h} should only contain standard C header +boilerplate: + +@example +@verbatiminclude example/src/money.1.h +@end example + +@file{src/money.c} should be empty, and @file{tests/check_money.c} +should only contain an empty @code{main()} function: + +@example +@verbatiminclude example/tests/check_money.1.c +@end example + +Create the GNU Build System for the project and then build @file{main} +and @file{libmoney.la} as follows: +@example +@verbatim +$ autoreconf --install +$ ./configure +$ make +@end verbatim +@end example + +(@command{autoreconf} determines which commands are needed in order +for @command{configure} to be created or brought up to date. +Previously one would use a script called @command{autogen.sh} or +@command{bootstrap}, but that practice is unnecessary now.) + +Now build and run the @command{check_money} test with @command{make +check}. If all goes well, @command{make} should report that our tests +passed. No surprise, because there aren't any tests to fail. If you +have problems, make sure to see @ref{AM_PATH_CHECK}. + +This was tested on the i386 ``testing'' distribution of Debian +GNU/Linux (etch) in March 2006, using Autoconf 2.59, Automake 1.9.6, +and Libtool 1.5.22. Please report any problems to +@email{check-devel@@lists.sourceforge.net}. + +@node Test a Little, Creating a Suite, Setting Up the Money Build, Tutorial +@section Test a Little, Code a Little + +The @uref{http://junit.sourceforge.net/doc/testinfected/testing.htm, +Test Infected} article starts out with a @code{Money} class, and so +will we. Of course, we can't do classes with C, but we don't really +need to. The Test Infected approach to writing code says that we +should write the unit test @emph{before} we write the code, and in +this case, we will be even more dogmatic and doctrinaire than the +authors of Test Infected (who clearly don't really get this stuff, +only being some of the originators of the Patterns approach to +software development and OO design). + +Here are the changes to @file{check_money.c} for our first unit test: + +@example +@verbatiminclude check_money.1-2.c.diff +@end example + +@findex fail_unless() +A unit test should just chug along and complete. If it exits early, +or is signaled, it will fail with a generic error message. (Note: it +is conceivable that you expect an early exit, or a signal. There is +currently nothing in Check to specifically assert that we should +expect either --- if that is valuable, it may be worth while adding to +Check.) If we want to get some information about what failed, we need +to use the @code{fail_unless()} function. The function (actually a +macro) takes a first Boolean argument, and an error message to send if +the condition is not true. + +@findex fail() +If the Boolean argument is too complicated to elegantly express within +@code{fail_unless()}, there is an alternate function @code{fail()} +that unconditionally fails. The second test inside +@code{test_money_create} above could be rewritten as follows: +@example +@verbatim +if (strcmp (money_currency (m), "USD") != 0) + { + fail ("Currency not set correctly on creation"); + } +@end verbatim +@end example + +@findex fail_if() +There is also a @code{fail_if()} function, which is the +inverse of @code{fail_unless()}. Using it, the above test then +looks like this: +@example +@verbatim +fail_if (strcmp (money_currency (m), "USD") != 0, + "Currency not set correctly on creation"); +@end verbatim +@end example + +For your convenience all fail functions also accepts NULL as the msg +argument and substitutes a suitable message for you. So you could also +write a test as follows: +@example +@verbatim +fail_unless (money_amount (m) == 5, NULL); +@end verbatim +@end example + +This is equivalent to: +@example +@verbatim +fail_unless (money_amount (m) == 5, + "Assertion 'money_amount (m) == 5' failed"); +@end verbatim +@end example + +All fail functions also support @code{varargs} and accept +@code{printf}-style format strings and arguments. This is especially +useful while debugging. With @code{printf}-style formatting the +message could look like this: +@example +@verbatim +fail_unless(money_amount (m) == 5, + "Amount was %d, instead of 5", money_amount (m)); +@end verbatim +@end example + +When we try to compile and run the test suite now using @command{make +check}, we get a whole host of compilation errors. It may seem a bit +strange to deliberately write code that won't compile, but notice what +we are doing: in creating the unit test, we are also defining +requirements for the money interface. Compilation errors are, in a +way, unit test failures of their own, telling us that the +implementation does not match the specification. If all we do is edit +the sources so that the unit test compiles, we are actually making +progress, guided by the unit tests, so that's what we will now do. + +We will patch our header @file{money.h} as follows: + +@example +@verbatiminclude money.1-2.h.diff +@end example + +Our code compiles now, and again passes all of the tests. However, +once we try to @emph{use} the functions in @code{libmoney} in the +@code{main()} of @code{check_money}, we'll run into more problems, as +they haven't actually been implemented yet. + +@node Creating a Suite, SRunner Output, Test a Little, Tutorial +@section Creating a Suite + +To run unit tests with Check, we must create some test cases, +aggregate them into a suite, and run them with a suite runner. That's +a bit of overhead, but it is mostly one-off. Here's a diff for the +new version of @file{check_money.c}. Note that we include stdlib.h to +get the definitions of @code{EXIT_SUCCESS} and @code{EXIT_FAILURE}. + +@example +@verbatiminclude check_money.2-3.c.diff +@end example + +Most of the @code{money_suite()} code should be self-explanatory. We are +creating a suite, creating a test case, adding the test case to the +suite, and adding the unit test we created above to the test case. +Why separate this off into a separate function, rather than inline it +in @code{main()}? Because any new tests will get added in +@code{money_suite()}, but nothing will need to change in @code{main()} +for the rest of this example, so main will stay relatively clean and +simple. + +Unit tests are internally defined as static functions. This means +that the code to add unit tests to test cases must be in the same +compilation unit as the unit tests themselves. This provides another +reason to put the creation of the test suite in a separate function: +you may later want to keep one source file per suite; defining a +uniquely named suite creation function allows you later to define a +header file giving prototypes for all the suite creation functions, +and encapsulate the details of where and how unit tests are defined +behind those functions. See the test program defined for Check itself +for an example of this strategy. + +The code in @code{main()} bears some explanation. We are creating a +suite runner object of type @code{SRunner} from the @code{Suite} we +created in @code{money_suite()}. We then run the suite, using the +@code{CK_NORMAL} flag to specify that we should print a summary of the +run, and list any failures that may have occurred. We capture the +number of failures that occurred during the run, and use that to +decide how to return. The @code{check} target created by Automake +uses the return value to decide whether the tests passed or failed. + +Now that the tests are actually being run by @command{check_money}, we +encounter linker errors again we try out @code{make check}. Try it +for yourself and see. The reason is that the @file{money.c} +implementation of the @file{money.h} interface hasn't been created +yet. Let's go with the fastest solution possible and implement stubs +for each of the functions in @code{money.c}: + +@example +@verbatiminclude money.1-3.c.diff +@end example + +Note that we @code{#include } to get the definition of +@code{NULL}. Now, the code compiles and links when we run @code{make +check}, but our unit test fails. Still, this is progress, and we can +focus on making the test pass. + +@node SRunner Output, , Creating a Suite, Tutorial +@section SRunner Output + +@findex srunner_run_all() +The function to run tests in an @code{SRunner} is defined as follows: +@example +@verbatim +void srunner_run_all (SRunner * sr, enum print_output print_mode); +@end verbatim +@end example + +This function does two things: + +@enumerate +@item +It runs all of the unit tests for all of the test cases defined for all +of the suites in the SRunner, and collects the results in the SRunner + +@item +It prints the results according to the @code{print_mode} specified. +@end enumerate + +For SRunners that have already been run, there is also a separate +printing function defined as follows: +@example +@verbatim +void srunner_print (SRunner *sr, enum print_output print_mode); +@end verbatim +@end example + +The enumeration values of @code{print_output} defined in Check that +parameter @code{print_mode} can assume are as follows: + +@table @code +@vindex CK_SILENT +@item CK_SILENT +Specifies that no output is to be generated. If you use this flag, you +either need to programmatically examine the SRunner object, print +separately, or use test logging (@pxref{Test Logging}.) + +@vindex CK_MINIMAL +@item CK_MINIMAL +Only a summary of the test run will be printed (number run, passed, +failed, errors). + +@vindex CK_NORMAL +@item CK_NORMAL +Prints the summary of the run, and prints one message per failed +test. + +@vindex CK_VERBOSE +@item CK_VERBOSE +Prints the summary, and one message per test (passed or failed) + +@vindex CK_ENV +@vindex CK_VERBOSITY +@item CK_ENV +Gets the print mode from the environment variable @code{CK_VERBOSITY}, +which can have the values "silent", "minimal", "normal", "verbose". If +the variable is not found or the value is not recognized, the print +mode is set to @code{CK_NORMAL}. +@end table + +With the @code{CK_NORMAL} flag specified in our @code{main()}, let's +rerun make check now. As before, we get the following satisfying +output: +@example +@verbatim +Running suite(s): Money +0%: Checks: 1, Failures: 1, Errors: 0 +check_money.c:10:F:Core:test_money_create: Amount not set correctly on +creation +FAIL: check_money +================================================== +1 of 1 tests failed +Please report to check-devel@lists.sourceforge.net +================================================== +@end verbatim +@end example + +The first number in the summary line tells us that 0% of our tests +passed, and the rest of the line tells us that there was one check in +total, and of those checks, one failure and zero errors. The next +line tells us exactly where that failure occurred, and what kind of +failure it was (P for pass, F for failure, E for error). + +After that we have some higher level output generated by Automake: the +@code{check_money} program failed, and the bug-report address given in +@file{configure.ac} is printed. + +Let's implement the @code{money_amount} function, so that it will pass +its tests. We first have to create a Money structure to hold the +amount, and then implement the function to return the correct amount: + +@example +@verbatiminclude money.3-4.c.diff +@end example + +We will now rerun make check and@dots{} what's this? The output is +now as follows: +@example +@verbatim +Running suite(s): Money +0%: Checks: 1, Failures: 0, Errors: 1 +check_money.c:5:E:Core:test_money_create: (after this point) Received +signal 11 (Segmentation fault) +@end verbatim +@end example + +@findex mark_point() +What does this mean? Note that we now have an error, rather than a +failure. This means that our unit test either exited early, or was +signaled. Next note that the failure message says ``after this +point''; This means that somewhere after the point noted +(@file{check_money.c}, line 5) there was a problem: signal 11 (a.k.a. +segmentation fault). The last point reached is set on entry to the +unit test, and after every call to @code{fail_unless()}, +@code{fail()}, or the special function @code{mark_point()}. For +example, if we wrote some test code as follows: +@example +@verbatim +stuff_that_works (); +mark_point (); +stuff_that_dies (); +@end verbatim +@end example + +then the point returned will be that marked by @code{mark_point()}. + +The reason our test failed so horribly is that we haven't implemented +@code{money_create()} to create any @code{Money}. We'll go ahead and +implement that, the symmetric @code{money_free()}, and +@code{money_currency()} too, in order to make our unit test pass again: + +@example +@verbatiminclude money.4-5.c.diff +@end example + +@node Advanced Features, Conclusion and References, Tutorial, Top +@chapter Advanced Features + +What you've seen so far is all you need for basic unit testing. The +features described in this section are additions to Check that make it +easier for the developer to write, run, and analyse tests. + +@menu +* Running Multiple Cases:: +* No Fork Mode:: +* Test Fixtures:: +* Multiple Suites in one SRunner:: +* Testing Signal Handling:: +* Looping Tests:: +* Test Timeouts:: +* Determining Test Coverage:: +* Test Logging:: +@end menu + +@node Running Multiple Cases, No Fork Mode, Advanced Features, Advanced Features +@section Running Multiple Cases + +What happens if we pass @code{-1} as the @code{amount} in +@code{money_create()}? What should happen? Let's write a unit test. +Since we are now testing limits, we should also test what happens when +we create @code{Money} where @code{amount == 0}. Let's put these in a +separate test case called ``Limits'' so that @code{money_suite} is +changed like so: + +@example +@verbatiminclude check_money.3-6.c.diff +@end example + +Now we can rerun our suite, and fix the problem(s). Note that errors +in the ``Core'' test case will be reported as ``Core'', and errors in +the ``Limits'' test case will be reported as ``Limits'', giving you +additional information about where things broke. + +@example +@verbatiminclude money.5-6.c.diff +@end example + +@node No Fork Mode, Test Fixtures, Running Multiple Cases, Advanced Features +@section No Fork Mode + +Check normally forks to create a separate address space. This allows +a signal or early exit to be caught and reported, rather than taking +down the entire test program, and is normally very useful. However, +when you are trying to debug why the segmentation fault or other +program error occurred, forking makes it difficult to use debugging +tools. To define fork mode for an @code{SRunner} object, you can do +one of the following: + +@vindex CK_FORK +@findex srunner_set_fork_status() +@enumerate +@item +Define the CK_FORK environment variable to equal ``no''. + +@item +Explicitly define the fork status through the use of the following +function: + +@verbatim +void srunner_set_fork_status (SRunner * sr, enum fork_status fstat); +@end verbatim +@end enumerate + +The enum @code{fork_status} allows the @code{fstat} parameter to +assume the following values: @code{CK_FORK} and @code{CK_NOFORK}. An +explicit call to @code{srunner_set_fork_status()} overrides the +@code{CK_FORK} environment variable. + +@node Test Fixtures, Multiple Suites in one SRunner, No Fork Mode, Advanced Features +@section Test Fixtures + +We may want multiple tests that all use the same Money. In such +cases, rather than setting up and tearing down objects for each unit +test, it may be convenient to add some setup that is constant across +all the tests in a test case. In the Extreme Programming (XP) +approach to unit tests, each such setup is called a @dfn{test +fixture}. + +A fixture is created by defining a setup and/or a teardown function, +and associating it with a test case. There are two kinds of test +fixtures in Check: checked and unchecked fixtures. These are defined +as follows: + +@table @asis +@item Checked fixtures +are run inside the address space created by the fork to create the +unit test. Before each unit test in a test case, the @code{setup()} +function is run, if defined. After each unit test, the @code{teardown()} +function is run, if defined. Since they run inside the forked address +space, if checked fixtures signal or otherwise fail, they will be +caught and reported by the @code{SRunner}. + +@item Unchecked fixtures +are run in the same address space as the test program. Therefore they +may not signal or exit, but may use the fail functions. The unchecked +@code{setup()}, if defined, is run before the test case is +started. The unchecked @code{teardown()}, if defined, is run after the +test case is done. +@end table + +@menu +* Test Fixture Examples:: +* Checked vs Unchecked Fixtures:: +@end menu + +@node Test Fixture Examples, Checked vs Unchecked Fixtures, Test Fixtures, Test Fixtures +@subsection Test Fixture Examples + +We create a test fixture in Check as follows: + +@enumerate +@item +Define global variables, and functions to setup and teardown the +globals. The functions both take @code{void} and return @code{void}. +In our example, we'll make @code{five_dollars} be a global created and +freed by @code{setup()} and @code{teardown()} respectively. + +@findex tcase_add_checked_fixture() +@item +Add the @code{setup()} and @code{teardown()} functions to the test +case with @code{tcase_add_checked_fixture()}. In our example, this +belongs in the suite setup function @code{money_suite}. + +@item +Rewrite tests to use the globals. We'll rewrite our first to use +@code{five_dollars}. +@end enumerate + +Note that the functions used for setup and teardown do not need to be +named @code{setup()} and @code{teardown()}, but they must take +@code{void} and return @code{void}. We'll update @file{check_money.c} +as follows: + +@example +@verbatiminclude check_money.6-7.c.diff +@end example + +@node Checked vs Unchecked Fixtures, , Test Fixture Examples, Test Fixtures +@subsection Checked vs Unchecked Fixtures + +Checked fixtures run once for each unit test in a test case, and so +they should not be used for expensive setup. On the other hand, since +unchecked fixtures may take down the entire test program, they should +only be used if they are known to be safe. Recall that unchecked +fixtures run once per test case, as opposed to once per unit test. + +Additionally, checked and unchecked fixtures may behave differently in +@code{CK_NOFORK} mode: + +@itemize +@item +Normally, in @code{CK_FORK} mode, unit tests may abuse the objects +created in an unchecked fixture with impunity, without affecting other +unit tests in the same test case, because the fork creates a separate +address space. + +@item +However, in @code{CK_NOFORK} mode, all tests live in the same address +space, and side effects in one test will affect the unchecked fixture +for the other tests. +@end itemize + +A checked fixture will generally not be affected by unit test side +effects, since the @code{setup()} is run before each unit test. There +is an exception for side effects to the total environment in which the +test program lives: for example, if the @code{setup()} function +initializes a file that a unit test then changes, the combination of +the @code{teardown()} function and @code{setup} fuction must be able +to restore the environment for the next unit test. + +If the @code{setup} function in a fixture fails, in either checked or +unchecked fixtures, the unit tests for the test case, and the teardown +function for the fixture will not be run. A fixture error will be +created and reported to the @code{SRunner}. + +@node Multiple Suites in one SRunner, Testing Signal Handling, Test Fixtures, Advanced Features +@section Multiple Suites in one SRunner + +In a large program, it will be convenient to create multiple suites, +each testing a module of the program. While one can create several +test programs, each running one @code{Suite}, it may be convenient to +create one main test program, and use it to run multiple suites. The +Check test suite provides an example of how to do this. The main +testing program is called @code{check_check}, and has a header file +that declares suite creation functions for all the module tests: +@example +@verbatim +Suite *make_sub_suite (void); +Suite *make_sub2_suite (void); +Suite *make_master_suite (void); +Suite *make_list_suite (void); +Suite *make_msg_suite (void); +Suite *make_log_suite (void); +Suite *make_limit_suite (void); +Suite *make_fork_suite (void); +Suite *make_fixture_suite (void); +Suite *make_pack_suite (void); +@end verbatim +@end example + +@findex srunner_add_suite() +The function @code{srunner_add_suite()} is used to add additional +suites to an @code{SRunner}. Here is the code that sets up and runs +the @code{SRunner} in the @code{main()} function in +@file{check_check_main.c}: +@example +@verbatim +SRunner *sr; +sr = srunner_create (make_master_suite ()); +srunner_add_suite (sr, make_list_suite ()); +srunner_add_suite (sr, make_msg_suite ()); +srunner_add_suite (sr, make_log_suite ()); +srunner_add_suite (sr, make_limit_suite ()); +srunner_add_suite (sr, make_fork_suite ()); +srunner_add_suite (sr, make_fixture_suite ()); +srunner_add_suite (sr, make_pack_suite ()); +@end verbatim +@end example + +@node Testing Signal Handling, Looping Tests, Multiple Suites in one SRunner, Advanced Features +@section Testing Signal Handling + +@findex tcase_add_test_raise_signal() + +To enable testing of signal handling, there is a function +@code{tcase_add_test_raise_signal()} which is used instead of +@code{tcase_add_test()}. This function takes an additional signal +argument, specifying a signal that the test expects to receive. If no +signal is received this is logged as a failure. If a different signal +is received this is logged as an error. + +The signal handling functionality only works in CK_FORK mode. + +@node Looping Tests, Test Timeouts, Testing Signal Handling, Advanced Features +@section Looping Tests + +Looping tests are tests that are called with a new context for each +loop iteration. This makes them ideal for table based tests. If +loops are used inside ordinary tests to test multiple values, only the +first error will be shown before the test exits. However, looping +tests allow for all errors to be shown at once, which can help out +with debugging. + +@findex tcase_add_loop_test() +Adding a normal test with @code{tcase_add_loop_test()} instead of +@code{tcase_add_test()} will make the test function the body of a +@code{for} loop, with the addition of a fork before each call. The +loop variable @code{_i} is available for use inside the test function; +for example, it could serve as an index into a table. For failures, +the iteration which caused the failure is available in error messages +and logs. + +Start and end values for the loop are supplied when adding the test. +The values are used as in a normal @code{for} loop. Below is some +pseudo-code to show the concept: +@example +@verbatim +for (_i = tfun->loop_start; _i < tfun->loop_end; _i++) +{ + fork(); /* New context */ + tfun->f(_i); /* Call test function */ + wait(); /* Wait for child to terminate */ +} +@end verbatim +@end example + +An example of looping test usage follows: +@example +@verbatim +static const int primes[5] = {2,3,5,7,11}; + +START_TEST (check_is_prime) +{ + fail_unless (is_prime (primes[_i])); +} +END_TEST + +... + +tcase_add_loop_test (tcase, check_is_prime, 0, 5); +@end verbatim +@end example + +Looping tests work in @code{CK_NOFORK} mode as well, but without the +forking. This means that only the first error will be shown. + +@node Test Timeouts, Determining Test Coverage, Looping Tests, Advanced Features +@section Test Timeouts + +@findex tcase_set_timeout() +@vindex CK_DEFAULT_TIMEOUT +To be certain that a test won't hang indefinitely, all tests are run +with a timeout, the default being 3 seconds. If the test is not +finished within that time, it is killed and logged as an error. + +The timeout for a specific test case, which may contain multiple unit +tests, can be changed with the @code{tcase_set_timeout()} function. +The default timeout used for all test cases can be changed with the +environment variable @code{CK_DEFAULT_TIMEOUT}, but this will not +override an explicitly set timeout. All timeout arguments are in +seconds and a timeout of 0 seconds turns off the timeout +functionality. + +Test timeouts are only available in CK_FORK mode. + +@node Determining Test Coverage, Test Logging, Test Timeouts, Advanced Features +@section Determining Test Coverage + +The term @dfn{code coverage} refers to the extent that the statements +of a program are executed during a run. Thus, @dfn{test coverage} +refers to code coverage when executing unit tests. This information +can help you to do two things: + +@itemize +@item +Write better tests that more fully exercise your code, thereby +improving confidence in it. + +@item +Detect dead code that could be factored away. +@end itemize + +Check itself does not provide any means to determine this test +coverage; rather, this is the job of the compiler and its related +tools. In the case of @command{gcc} this information is easy to +obtain, and other compilers should provide similar facilities. + +Using @command{gcc}, first enable test coverage profiling when +building your source by specifying the @option{-fprofile-arcs} and +@option{-ftest-coverage} switches: +@example +@verbatim +$ gcc -g -Wall -fprofile-arcs -ftest-coverage -o foo foo.c foo_check.c +@end verbatim +@end example + +You will see that an additional @file{.gcno} file is created for each +@file{.c} input file. After running your tests the normal way, a +@file{.gcda} file is created for each @file{.gcno} file. These +contain the coverage data in a raw format. To combine this +information and a source file into a more readable format you can use +the @command{gcov} utility: +@example +@verbatim +$ gcov foo.c +@end verbatim +@end example + +This will produce the file @file{foo.c.gcov} which looks like this: +@example +@verbatim + -: 41: * object */ + 18: 42: if (ht->table[p] != NULL) { + -: 43: /* replaces the current entry */ + #####: 44: ht->count--; + #####: 45: ht->size -= ht->table[p]->size + + #####: 46: sizeof(struct hashtable_entry); +@end verbatim +@end example + +As you can see this is an annotated source file with three columns: +usage information, line numbers, and the original source. The usage +information in the first column can either be '-', which means that +this line does not contain code that could be executed; '#####', which +means this line was never executed altough it does contain +code---these are the lines that are probably most interesting for you; +or a number, which indicates how often that line was executed. + +This is of course only a very brief overview, but it should illustrate +how determining test coverage generally works, and how it can help +you. For more information or help with other compilers, please refer +to the relevant manuals. + +@node Test Logging, , Determining Test Coverage, Advanced Features +@section Test Logging + +@findex srunner_set_log() +Check supports an operation to log the results of a test run. To use +test logging, call the @code{srunner_set_log()} function with the name +of the log file you wish to create: +@example +@verbatim +SRunner *sr; +sr = srunner_create (make_s1_suite ()); +srunner_add_suite (sr, make_s2_suite ()); +srunner_set_log (sr, "test.log"); +srunner_run_all (sr, CK_NORMAL); +@end verbatim +@end example + +In this example, Check will write the results of the run to +@file{test.log}. The @code{print_mode} argument to +@code{srunner_run_all()} is ignored during test logging; the log will +contain a result entry, organized by suite, for every test run. Here +is an example of test log output: +@example +@verbatim +Running suite S1 +ex_log_output.c:8:P:Core:test_pass: Test passed +ex_log_output.c:14:F:Core:test_fail: Failure +ex_log_output.c:18:E:Core:test_exit: (after this point) Early exit +with return value 1 +Running suite S2 +ex_log_output.c:26:P:Core:test_pass2: Test passed +Results for all suites run: +50%: Checks: 4, Failures: 1, Errors: 1 +@end verbatim +@end example + +@menu +* XML Logging:: +@end menu + +@node XML Logging, , Test Logging, Test Logging +@subsection XML Logging + +@findex srunner_set_xml() +@findex srunner_has_xml() +@findex srunner_xml_fname() +The log can also be written in XML. The following functions define +the interface for XML logs: +@example +@verbatim +void srunner_set_xml (SRunner *sr, const char *fname); +int srunner_has_xml (SRunner *sr); +const char *srunner_xml_fname (SRunner *sr); +@end verbatim +@end example + +The only thing you need to do to get XML output is call +@code{srunner_set_xml()} before the tests are run. Here is an example +of the same log output as before but in XML: +@example +@verbatim + + + 2004-08-20 12:53:32 + + S1 + + . + ex_xml_output.c:8 + test_pass + Core + Passed + + + . + ex_xml_output.c:14 + test_fail + Core + Failure + + + . + ex_xml_output.c:18 + test_exit + Core + Early exit with return value 1 + + + + S2 + + . + ex_xml_output.c:26 + test_pass2 + Core + Passed + + + 0.304875 + +@end verbatim +@end example + +@node Conclusion and References, AM_PATH_CHECK, Advanced Features, Top +@chapter Conclusion and References +The tutorial and description of advanced features has provided an +introduction to all of the functionality available in Check. +Hopefully, this is enough to get you started writing unit tests with +Check. All the rest is simply application of what has been learned so +far with repeated application of the ``test a little, code a little'' +strategy. + +For further reference, see Kent Beck, ``Test-Driven Development: By +Example'', 1st ed., Addison-Wesley, 2003. ISBN 0-321-14653-0. + +If you know of other authoritative references to unit testing and +test-driven development, please send us a patch to this manual. + +@node AM_PATH_CHECK, Copying This Manual, Conclusion and References, Top +@chapter AM_PATH_CHECK +@findex AM_PATH_CHECK() + +The @code{AM_PATH_CHECK()} macro is defined in the file +@file{check.m4} which is installed by Check. It has some optional +parameters that you might find useful in your @file{configure.ac}: +@verbatim +AM_PATH_CHECK([MINIMUM-VERSION, + [ACTION-IF-FOUND[,ACTION-IF-NOT-FOUND]]]) +@end verbatim + +@code{AM_PATH_CHECK} does several things: + +@enumerate +@item +It ensures check.h is available + +@item +It ensures a compatible version of Check is installed + +@item +It sets @env{CHECK_CFLAGS} and @env{CHECK_LIBS} for use by Automake. +@end enumerate + +If you include @code{AM_PATH_CHECK()} in @file{configure.ac} and +subsequently see warnings when attempting to create +@command{configure}, it probably means one of the following things: + +@enumerate +@item +You forgot to call @command{aclocal}. @command{autoreconf} will do +this for you. + +@item +@command{aclocal} can't find @file{check.m4}. Here are some possible +solutions: + +@enumerate a +@item +Call @command{aclocal} with @option{-I} set to the location of +@file{check.m4}. This means you have to call both @command{aclocal} and +@command{autoreconf}. + +@item +Add the location of @file{check.m4} to the @samp{dirlist} used by +@command{aclocal} and then call @command{autoreconf}. This means you +need permission to modify the @samp{dirlist}. + +@item +Set @code{ACLOCAL_AMFLAGS} in your top-level @file{Makefile.am} to +include @option{-I DIR} with @code{DIR} being the location of +@file{check.m4}. Then call @command{autoreconf}. +@end enumerate +@end enumerate + +@node Copying This Manual, Index, AM_PATH_CHECK, Top +@appendix Copying This Manual + +@menu +* GNU Free Documentation License:: License for copying this manual. +@end menu + +@include fdl.texi + +@node Index, , Copying This Manual, Top +@unnumbered Index + +@printindex cp + +@bye diff --git a/doc/example/Makefile.am b/doc/example/Makefile.am new file mode 100644 index 0000000..8376833 --- /dev/null +++ b/doc/example/Makefile.am @@ -0,0 +1,3 @@ +## Process this file with automake to produce Makefile.in + +SUBDIRS = src . tests \ No newline at end of file diff --git a/doc/example/README b/doc/example/README new file mode 100644 index 0000000..06282b2 --- /dev/null +++ b/doc/example/README @@ -0,0 +1,24 @@ +This is the "money example" from the Check tutorial. + +You need the following programs installed on your system: + -- Autoconf 2.59 + -- Automake 1.9.6 + -- Libtool 1.5.22 + -- Check 0.9.3 + +Somewhat earlier versions of these programs might work. + +Then, do as follows: + +$ autoreconf --install +$ ./configure +$ make +$ make check + +Don't do "make install" unless you want to install the money example. + +money.c and money.h are built as a library. src/main.c:main() is a +client of libmoney.la, just as tests/check_money.c:main() is a client +of libmoney.la + +Please send bug reports to check-devel@lists.sourceforge.net. diff --git a/doc/example/configure.ac b/doc/example/configure.ac new file mode 100644 index 0000000..e513a73 --- /dev/null +++ b/doc/example/configure.ac @@ -0,0 +1,46 @@ +# Process this file with autoconf to produce a configure script. + +# Prelude. +AC_PREREQ([2.59]) +AC_INIT([Money], [0.3], [check-devel@lists.sourceforge.net]) + +# unique source file --- primitive safety check +AC_CONFIG_SRCDIR([src/money.c]) + +# place to put some extra build scripts installed +AC_CONFIG_AUX_DIR([build-aux]) + +# fairly severe build strictness +# change foreign to gnu or gnits to comply with gnu standards +AM_INIT_AUTOMAKE([-Wall -Werror foreign 1.9.6]) + +# Checks for programs. +AC_PROG_CC +AC_PROG_LIBTOOL + +# Checks for libraries. + +# This macro is defined in check.m4 and tests if check.h and +# libcheck.a are installed in your system. It sets CHECK_CFLAGS and +# CHECK_LIBS accordingly. +# AM_PATH_CHECK([MINIMUM-VERSION, +# [ACTION-IF-FOUND [, ACTION-IF-NOT-FOUND]]]) +AM_PATH_CHECK() + +# Checks for header files. +AC_HEADER_STDC +AC_CHECK_HEADERS([stdlib.h]) + +# Checks for typedefs, structures, and compiler characteristics. + +# Checks for library functions. +AC_FUNC_MALLOC + +# Output files +AC_CONFIG_HEADERS([config.h]) + +AC_CONFIG_FILES([Makefile + src/Makefile + tests/Makefile]) + +AC_OUTPUT diff --git a/doc/example/src/Makefile.am b/doc/example/src/Makefile.am new file mode 100644 index 0000000..0ab2add --- /dev/null +++ b/doc/example/src/Makefile.am @@ -0,0 +1,8 @@ +## Process this file with automake to produce Makefile.in + +lib_LTLIBRARIES = libmoney.la +libmoney_la_SOURCES = money.c money.h + +bin_PROGRAMS = main +main_SOURCES = main.c +main_LDADD = libmoney.la diff --git a/doc/example/src/main.c b/doc/example/src/main.c new file mode 100644 index 0000000..caeae4a --- /dev/null +++ b/doc/example/src/main.c @@ -0,0 +1,12 @@ +#include "money.h" + +/* only main should be in this file, to make all other functions in + the prograble testable by Check. in order to test main(), use a + whole program testing framework like Autotest. +*/ + +int +main (void) +{ + return 0; +} diff --git a/doc/example/src/money.1.c b/doc/example/src/money.1.c new file mode 100644 index 0000000..12cae4b --- /dev/null +++ b/doc/example/src/money.1.c @@ -0,0 +1 @@ +#include "money.1.h" diff --git a/doc/example/src/money.1.h b/doc/example/src/money.1.h new file mode 100644 index 0000000..d1b2094 --- /dev/null +++ b/doc/example/src/money.1.h @@ -0,0 +1,4 @@ +#ifndef MONEY_H +#define MONEY_H + +#endif /* MONEY_H */ diff --git a/doc/example/src/money.2.h b/doc/example/src/money.2.h new file mode 100644 index 0000000..1897415 --- /dev/null +++ b/doc/example/src/money.2.h @@ -0,0 +1,11 @@ +#ifndef MONEY_H +#define MONEY_H + +typedef struct Money Money; + +Money *money_create (int amount, char *currency); +int money_amount (Money * m); +char *money_currency (Money * m); +void money_free (Money * m); + +#endif /* MONEY_H */ diff --git a/doc/example/src/money.3.c b/doc/example/src/money.3.c new file mode 100644 index 0000000..52ac9ea --- /dev/null +++ b/doc/example/src/money.3.c @@ -0,0 +1,26 @@ +#include +#include "money.h" + +Money * +money_create (int amount, char *currency) +{ + return NULL; +} + +int +money_amount (Money * m) +{ + return 0; +} + +char * +money_currency (Money * m) +{ + return NULL; +} + +void +money_free (Money * m) +{ + return; +} diff --git a/doc/example/src/money.4.c b/doc/example/src/money.4.c new file mode 100644 index 0000000..e925672 --- /dev/null +++ b/doc/example/src/money.4.c @@ -0,0 +1,31 @@ +#include +#include "money.h" + +struct Money +{ + int amount; +}; + +Money * +money_create (int amount, char *currency) +{ + return NULL; +} + +int +money_amount (Money * m) +{ + return m->amount; +} + +char * +money_currency (Money * m) +{ + return NULL; +} + +void +money_free (Money * m) +{ + return; +} diff --git a/doc/example/src/money.5.c b/doc/example/src/money.5.c new file mode 100644 index 0000000..64267a9 --- /dev/null +++ b/doc/example/src/money.5.c @@ -0,0 +1,41 @@ +#include +#include "money.h" + +struct Money +{ + int amount; + char *currency; +}; + +Money * +money_create (int amount, char *currency) +{ + Money *m = malloc (sizeof (Money)); + if (m == NULL) + { + return NULL; + } + + m->amount = amount; + m->currency = currency; + return m; +} + +int +money_amount (Money * m) +{ + return m->amount; +} + +char * +money_currency (Money * m) +{ + return m->currency; +} + +void +money_free (Money * m) +{ + free (m); + return; +} diff --git a/doc/example/src/money.6.c b/doc/example/src/money.6.c new file mode 100644 index 0000000..47f09bb --- /dev/null +++ b/doc/example/src/money.6.c @@ -0,0 +1,46 @@ +#include +#include "money.h" + +struct Money +{ + int amount; + char *currency; +}; + +Money * +money_create (int amount, char *currency) +{ + if (amount < 0) + { + return NULL; + } + + Money *m = malloc (sizeof (Money)); + if (m == NULL) + { + return NULL; + } + + m->amount = amount; + m->currency = currency; + return m; +} + +int +money_amount (Money * m) +{ + return m->amount; +} + +char * +money_currency (Money * m) +{ + return m->currency; +} + +void +money_free (Money * m) +{ + free (m); + return; +} diff --git a/doc/example/src/money.c b/doc/example/src/money.c new file mode 100644 index 0000000..47f09bb --- /dev/null +++ b/doc/example/src/money.c @@ -0,0 +1,46 @@ +#include +#include "money.h" + +struct Money +{ + int amount; + char *currency; +}; + +Money * +money_create (int amount, char *currency) +{ + if (amount < 0) + { + return NULL; + } + + Money *m = malloc (sizeof (Money)); + if (m == NULL) + { + return NULL; + } + + m->amount = amount; + m->currency = currency; + return m; +} + +int +money_amount (Money * m) +{ + return m->amount; +} + +char * +money_currency (Money * m) +{ + return m->currency; +} + +void +money_free (Money * m) +{ + free (m); + return; +} diff --git a/doc/example/src/money.h b/doc/example/src/money.h new file mode 100644 index 0000000..1897415 --- /dev/null +++ b/doc/example/src/money.h @@ -0,0 +1,11 @@ +#ifndef MONEY_H +#define MONEY_H + +typedef struct Money Money; + +Money *money_create (int amount, char *currency); +int money_amount (Money * m); +char *money_currency (Money * m); +void money_free (Money * m); + +#endif /* MONEY_H */ diff --git a/doc/example/tests/Makefile.am b/doc/example/tests/Makefile.am new file mode 100644 index 0000000..7c3fdd0 --- /dev/null +++ b/doc/example/tests/Makefile.am @@ -0,0 +1,7 @@ +## Process this file with automake to produce Makefile.in + +TESTS = check_money +check_PROGRAMS = check_money +check_money_SOURCES = check_money.c $(top_builddir)/src/money.h +check_money_CFLAGS = @CHECK_CFLAGS@ +check_money_LDADD = @CHECK_LIBS@ $(top_builddir)/src/libmoney.la diff --git a/doc/example/tests/check_money.1.c b/doc/example/tests/check_money.1.c new file mode 100644 index 0000000..398ec67 --- /dev/null +++ b/doc/example/tests/check_money.1.c @@ -0,0 +1,5 @@ +int +main (void) +{ + return 0; +} diff --git a/doc/example/tests/check_money.2.c b/doc/example/tests/check_money.2.c new file mode 100644 index 0000000..7c7c9d4 --- /dev/null +++ b/doc/example/tests/check_money.2.c @@ -0,0 +1,20 @@ +#include +#include "../src/money.h" + +START_TEST (test_money_create) +{ + Money *m; + m = money_create (5, "USD"); + fail_unless (money_amount (m) == 5, + "Amount not set correctly on creation"); + fail_unless (strcmp (money_currency (m), "USD") == 0, + "Currency not set correctly on creation"); + money_free (m); +} +END_TEST + +int +main (void) +{ + return 0; +} diff --git a/doc/example/tests/check_money.3.c b/doc/example/tests/check_money.3.c new file mode 100644 index 0000000..a19cf8b --- /dev/null +++ b/doc/example/tests/check_money.3.c @@ -0,0 +1,40 @@ +#include +#include +#include "../src/money.h" + +START_TEST (test_money_create) +{ + Money *m; + m = money_create (5, "USD"); + fail_unless (money_amount (m) == 5, + "Amount not set correctly on creation"); + fail_unless (strcmp (money_currency (m), "USD") == 0, + "Currency not set correctly on creation"); + money_free (m); +} +END_TEST + +Suite * +money_suite (void) +{ + Suite *s = suite_create ("Money"); + + /* Core test case */ + TCase *tc_core = tcase_create ("Core"); + tcase_add_test (tc_core, test_money_create); + suite_add_tcase (s, tc_core); + + return s; +} + +int +main (void) +{ + int number_failed; + Suite *s = money_suite (); + SRunner *sr = srunner_create (s); + srunner_run_all (sr, CK_NORMAL); + number_failed = srunner_ntests_failed (sr); + srunner_free (sr); + return (number_failed == 0) ? EXIT_SUCCESS : EXIT_FAILURE; +} diff --git a/doc/example/tests/check_money.6.c b/doc/example/tests/check_money.6.c new file mode 100644 index 0000000..f47fc77 --- /dev/null +++ b/doc/example/tests/check_money.6.c @@ -0,0 +1,63 @@ +#include +#include +#include "../src/money.h" + +START_TEST (test_money_create) +{ + Money *m; + m = money_create (5, "USD"); + fail_unless (money_amount (m) == 5, + "Amount not set correctly on creation"); + fail_unless (strcmp (money_currency (m), "USD") == 0, + "Currency not set correctly on creation"); + money_free (m); +} +END_TEST + +START_TEST (test_money_create_neg) +{ + Money *m = money_create (-1, "USD"); + fail_unless (m == NULL, + "NULL should be returned on attempt to create with " + "a negative amount"); +} +END_TEST + +START_TEST (test_money_create_zero) +{ + Money *m = money_create (0, "USD"); + fail_unless (money_amount (m) == 0, + "Zero is a valid amount of money"); +} +END_TEST + +Suite * +money_suite (void) +{ + Suite *s = suite_create ("Money"); + + /* Core test case */ + TCase *tc_core = tcase_create ("Core"); + tcase_add_test (tc_core, test_money_create); + suite_add_tcase (s, tc_core); + + /* Limits test case */ + TCase *tc_limits = tcase_create ("Limits"); + tcase_add_test (tc_limits, test_money_create_neg); + tcase_add_test (tc_limits, test_money_create_zero); + suite_add_tcase (s, tc_limits); + + return s; +} + +int +main (void) +{ + int number_failed; + Suite *s = money_suite (); + SRunner *sr = srunner_create (s); + srunner_run_all (sr, CK_NORMAL); + number_failed = srunner_ntests_failed (sr); + srunner_free (sr); + return (number_failed == 0) ? EXIT_SUCCESS : EXIT_FAILURE; +} diff --git a/doc/example/tests/check_money.7.c b/doc/example/tests/check_money.7.c new file mode 100644 index 0000000..b935998 --- /dev/null +++ b/doc/example/tests/check_money.7.c @@ -0,0 +1,75 @@ +#include +#include +#include "../src/money.h" + +Money *five_dollars; + +void +setup (void) +{ + five_dollars = money_create (5, "USD"); +} + +void +teardown (void) +{ + money_free (five_dollars); +} + +START_TEST (test_money_create) +{ + fail_unless (money_amount (five_dollars) == 5, + "Amount not set correctly on creation"); + fail_unless (strcmp (money_currency (five_dollars), "USD") == 0, + "Currency not set correctly on creation"); +} +END_TEST + +START_TEST (test_money_create_neg) +{ + Money *m = money_create (-1, "USD"); + fail_unless (m == NULL, + "NULL should be returned on attempt to create with " + "a negative amount"); +} +END_TEST + +START_TEST (test_money_create_zero) +{ + Money *m = money_create (0, "USD"); + fail_unless (money_amount (m) == 0, + "Zero is a valid amount of money"); +} +END_TEST + +Suite * +money_suite (void) +{ + Suite *s = suite_create ("Money"); + + /* Core test case */ + TCase *tc_core = tcase_create ("Core"); + tcase_add_checked_fixture (tc_core, setup, teardown); + tcase_add_test (tc_core, test_money_create); + suite_add_tcase (s, tc_core); + + /* Limits test case */ + TCase *tc_limits = tcase_create ("Limits"); + tcase_add_test (tc_limits, test_money_create_neg); + tcase_add_test (tc_limits, test_money_create_zero); + suite_add_tcase (s, tc_limits); + + return s; +} + +int +main (void) +{ + int number_failed; + Suite *s = money_suite (); + SRunner *sr = srunner_create (s); + srunner_run_all (sr, CK_NORMAL); + number_failed = srunner_ntests_failed (sr); + srunner_free (sr); + return (number_failed == 0) ? EXIT_SUCCESS : EXIT_FAILURE; +} diff --git a/doc/example/tests/check_money.c b/doc/example/tests/check_money.c new file mode 100644 index 0000000..b935998 --- /dev/null +++ b/doc/example/tests/check_money.c @@ -0,0 +1,75 @@ +#include +#include +#include "../src/money.h" + +Money *five_dollars; + +void +setup (void) +{ + five_dollars = money_create (5, "USD"); +} + +void +teardown (void) +{ + money_free (five_dollars); +} + +START_TEST (test_money_create) +{ + fail_unless (money_amount (five_dollars) == 5, + "Amount not set correctly on creation"); + fail_unless (strcmp (money_currency (five_dollars), "USD") == 0, + "Currency not set correctly on creation"); +} +END_TEST + +START_TEST (test_money_create_neg) +{ + Money *m = money_create (-1, "USD"); + fail_unless (m == NULL, + "NULL should be returned on attempt to create with " + "a negative amount"); +} +END_TEST + +START_TEST (test_money_create_zero) +{ + Money *m = money_create (0, "USD"); + fail_unless (money_amount (m) == 0, + "Zero is a valid amount of money"); +} +END_TEST + +Suite * +money_suite (void) +{ + Suite *s = suite_create ("Money"); + + /* Core test case */ + TCase *tc_core = tcase_create ("Core"); + tcase_add_checked_fixture (tc_core, setup, teardown); + tcase_add_test (tc_core, test_money_create); + suite_add_tcase (s, tc_core); + + /* Limits test case */ + TCase *tc_limits = tcase_create ("Limits"); + tcase_add_test (tc_limits, test_money_create_neg); + tcase_add_test (tc_limits, test_money_create_zero); + suite_add_tcase (s, tc_limits); + + return s; +} + +int +main (void) +{ + int number_failed; + Suite *s = money_suite (); + SRunner *sr = srunner_create (s); + srunner_run_all (sr, CK_NORMAL); + number_failed = srunner_ntests_failed (sr); + srunner_free (sr); + return (number_failed == 0) ? EXIT_SUCCESS : EXIT_FAILURE; +} diff --git a/doc/fdl.texi b/doc/fdl.texi new file mode 100644 index 0000000..fe78df8 --- /dev/null +++ b/doc/fdl.texi @@ -0,0 +1,452 @@ + +@node GNU Free Documentation License +@appendixsec GNU Free Documentation License + +@cindex FDL, GNU Free Documentation License +@center Version 1.2, November 2002 + +@display +Copyright @copyright{} 2000,2001,2002 Free Software Foundation, Inc. +51 Franklin St, Fifth Floor, Boston, MA 02110-1301, USA + +Everyone is permitted to copy and distribute verbatim copies +of this license document, but changing it is not allowed. +@end display + +@enumerate 0 +@item +PREAMBLE + +The purpose of this License is to make a manual, textbook, or other +functional and useful document @dfn{free} in the sense of freedom: to +assure everyone the effective freedom to copy and redistribute it, +with or without modifying it, either commercially or noncommercially. +Secondarily, this License preserves for the author and publisher a way +to get credit for their work, while not being considered responsible +for modifications made by others. + +This License is a kind of ``copyleft'', which means that derivative +works of the document must themselves be free in the same sense. It +complements the GNU General Public License, which is a copyleft +license designed for free software. + +We have designed this License in order to use it for manuals for free +software, because free software needs free documentation: a free +program should come with manuals providing the same freedoms that the +software does. But this License is not limited to software manuals; +it can be used for any textual work, regardless of subject matter or +whether it is published as a printed book. We recommend this License +principally for works whose purpose is instruction or reference. + +@item +APPLICABILITY AND DEFINITIONS + +This License applies to any manual or other work, in any medium, that +contains a notice placed by the copyright holder saying it can be +distributed under the terms of this License. Such a notice grants a +world-wide, royalty-free license, unlimited in duration, to use that +work under the conditions stated herein. The ``Document'', below, +refers to any such manual or work. Any member of the public is a +licensee, and is addressed as ``you''. You accept the license if you +copy, modify or distribute the work in a way requiring permission +under copyright law. + +A ``Modified Version'' of the Document means any work containing the +Document or a portion of it, either copied verbatim, or with +modifications and/or translated into another language. + +A ``Secondary Section'' is a named appendix or a front-matter section +of the Document that deals exclusively with the relationship of the +publishers or authors of the Document to the Document's overall +subject (or to related matters) and contains nothing that could fall +directly within that overall subject. (Thus, if the Document is in +part a textbook of mathematics, a Secondary Section may not explain +any mathematics.) The relationship could be a matter of historical +connection with the subject or with related matters, or of legal, +commercial, philosophical, ethical or political position regarding +them. + +The ``Invariant Sections'' are certain Secondary Sections whose titles +are designated, as being those of Invariant Sections, in the notice +that says that the Document is released under this License. If a +section does not fit the above definition of Secondary then it is not +allowed to be designated as Invariant. The Document may contain zero +Invariant Sections. If the Document does not identify any Invariant +Sections then there are none. + +The ``Cover Texts'' are certain short passages of text that are listed, +as Front-Cover Texts or Back-Cover Texts, in the notice that says that +the Document is released under this License. A Front-Cover Text may +be at most 5 words, and a Back-Cover Text may be at most 25 words. + +A ``Transparent'' copy of the Document means a machine-readable copy, +represented in a format whose specification is available to the +general public, that is suitable for revising the document +straightforwardly with generic text editors or (for images composed of +pixels) generic paint programs or (for drawings) some widely available +drawing editor, and that is suitable for input to text formatters or +for automatic translation to a variety of formats suitable for input +to text formatters. A copy made in an otherwise Transparent file +format whose markup, or absence of markup, has been arranged to thwart +or discourage subsequent modification by readers is not Transparent. +An image format is not Transparent if used for any substantial amount +of text. A copy that is not ``Transparent'' is called ``Opaque''. + +Examples of suitable formats for Transparent copies include plain +@sc{ascii} without markup, Texinfo input format, La@TeX{} input +format, @acronym{SGML} or @acronym{XML} using a publicly available +@acronym{DTD}, and standard-conforming simple @acronym{HTML}, +PostScript or @acronym{PDF} designed for human modification. Examples +of transparent image formats include @acronym{PNG}, @acronym{XCF} and +@acronym{JPG}. Opaque formats include proprietary formats that can be +read and edited only by proprietary word processors, @acronym{SGML} or +@acronym{XML} for which the @acronym{DTD} and/or processing tools are +not generally available, and the machine-generated @acronym{HTML}, +PostScript or @acronym{PDF} produced by some word processors for +output purposes only. + +The ``Title Page'' means, for a printed book, the title page itself, +plus such following pages as are needed to hold, legibly, the material +this License requires to appear in the title page. For works in +formats which do not have any title page as such, ``Title Page'' means +the text near the most prominent appearance of the work's title, +preceding the beginning of the body of the text. + +A section ``Entitled XYZ'' means a named subunit of the Document whose +title either is precisely XYZ or contains XYZ in parentheses following +text that translates XYZ in another language. (Here XYZ stands for a +specific section name mentioned below, such as ``Acknowledgements'', +``Dedications'', ``Endorsements'', or ``History''.) To ``Preserve the Title'' +of such a section when you modify the Document means that it remains a +section ``Entitled XYZ'' according to this definition. + +The Document may include Warranty Disclaimers next to the notice which +states that this License applies to the Document. These Warranty +Disclaimers are considered to be included by reference in this +License, but only as regards disclaiming warranties: any other +implication that these Warranty Disclaimers may have is void and has +no effect on the meaning of this License. + +@item +VERBATIM COPYING + +You may copy and distribute the Document in any medium, either +commercially or noncommercially, provided that this License, the +copyright notices, and the license notice saying this License applies +to the Document are reproduced in all copies, and that you add no other +conditions whatsoever to those of this License. You may not use +technical measures to obstruct or control the reading or further +copying of the copies you make or distribute. However, you may accept +compensation in exchange for copies. If you distribute a large enough +number of copies you must also follow the conditions in section 3. + +You may also lend copies, under the same conditions stated above, and +you may publicly display copies. + +@item +COPYING IN QUANTITY + +If you publish printed copies (or copies in media that commonly have +printed covers) of the Document, numbering more than 100, and the +Document's license notice requires Cover Texts, you must enclose the +copies in covers that carry, clearly and legibly, all these Cover +Texts: Front-Cover Texts on the front cover, and Back-Cover Texts on +the back cover. Both covers must also clearly and legibly identify +you as the publisher of these copies. The front cover must present +the full title with all words of the title equally prominent and +visible. You may add other material on the covers in addition. +Copying with changes limited to the covers, as long as they preserve +the title of the Document and satisfy these conditions, can be treated +as verbatim copying in other respects. + +If the required texts for either cover are too voluminous to fit +legibly, you should put the first ones listed (as many as fit +reasonably) on the actual cover, and continue the rest onto adjacent +pages. + +If you publish or distribute Opaque copies of the Document numbering +more than 100, you must either include a machine-readable Transparent +copy along with each Opaque copy, or state in or with each Opaque copy +a computer-network location from which the general network-using +public has access to download using public-standard network protocols +a complete Transparent copy of the Document, free of added material. +If you use the latter option, you must take reasonably prudent steps, +when you begin distribution of Opaque copies in quantity, to ensure +that this Transparent copy will remain thus accessible at the stated +location until at least one year after the last time you distribute an +Opaque copy (directly or through your agents or retailers) of that +edition to the public. + +It is requested, but not required, that you contact the authors of the +Document well before redistributing any large number of copies, to give +them a chance to provide you with an updated version of the Document. + +@item +MODIFICATIONS + +You may copy and distribute a Modified Version of the Document under +the conditions of sections 2 and 3 above, provided that you release +the Modified Version under precisely this License, with the Modified +Version filling the role of the Document, thus licensing distribution +and modification of the Modified Version to whoever possesses a copy +of it. In addition, you must do these things in the Modified Version: + +@enumerate A +@item +Use in the Title Page (and on the covers, if any) a title distinct +from that of the Document, and from those of previous versions +(which should, if there were any, be listed in the History section +of the Document). You may use the same title as a previous version +if the original publisher of that version gives permission. + +@item +List on the Title Page, as authors, one or more persons or entities +responsible for authorship of the modifications in the Modified +Version, together with at least five of the principal authors of the +Document (all of its principal authors, if it has fewer than five), +unless they release you from this requirement. + +@item +State on the Title page the name of the publisher of the +Modified Version, as the publisher. + +@item +Preserve all the copyright notices of the Document. + +@item +Add an appropriate copyright notice for your modifications +adjacent to the other copyright notices. + +@item +Include, immediately after the copyright notices, a license notice +giving the public permission to use the Modified Version under the +terms of this License, in the form shown in the Addendum below. + +@item +Preserve in that license notice the full lists of Invariant Sections +and required Cover Texts given in the Document's license notice. + +@item +Include an unaltered copy of this License. + +@item +Preserve the section Entitled ``History'', Preserve its Title, and add +to it an item stating at least the title, year, new authors, and +publisher of the Modified Version as given on the Title Page. If +there is no section Entitled ``History'' in the Document, create one +stating the title, year, authors, and publisher of the Document as +given on its Title Page, then add an item describing the Modified +Version as stated in the previous sentence. + +@item +Preserve the network location, if any, given in the Document for +public access to a Transparent copy of the Document, and likewise +the network locations given in the Document for previous versions +it was based on. These may be placed in the ``History'' section. +You may omit a network location for a work that was published at +least four years before the Document itself, or if the original +publisher of the version it refers to gives permission. + +@item +For any section Entitled ``Acknowledgements'' or ``Dedications'', Preserve +the Title of the section, and preserve in the section all the +substance and tone of each of the contributor acknowledgements and/or +dedications given therein. + +@item +Preserve all the Invariant Sections of the Document, +unaltered in their text and in their titles. Section numbers +or the equivalent are not considered part of the section titles. + +@item +Delete any section Entitled ``Endorsements''. Such a section +may not be included in the Modified Version. + +@item +Do not retitle any existing section to be Entitled ``Endorsements'' or +to conflict in title with any Invariant Section. + +@item +Preserve any Warranty Disclaimers. +@end enumerate + +If the Modified Version includes new front-matter sections or +appendices that qualify as Secondary Sections and contain no material +copied from the Document, you may at your option designate some or all +of these sections as invariant. To do this, add their titles to the +list of Invariant Sections in the Modified Version's license notice. +These titles must be distinct from any other section titles. + +You may add a section Entitled ``Endorsements'', provided it contains +nothing but endorsements of your Modified Version by various +parties---for example, statements of peer review or that the text has +been approved by an organization as the authoritative definition of a +standard. + +You may add a passage of up to five words as a Front-Cover Text, and a +passage of up to 25 words as a Back-Cover Text, to the end of the list +of Cover Texts in the Modified Version. Only one passage of +Front-Cover Text and one of Back-Cover Text may be added by (or +through arrangements made by) any one entity. If the Document already +includes a cover text for the same cover, previously added by you or +by arrangement made by the same entity you are acting on behalf of, +you may not add another; but you may replace the old one, on explicit +permission from the previous publisher that added the old one. + +The author(s) and publisher(s) of the Document do not by this License +give permission to use their names for publicity for or to assert or +imply endorsement of any Modified Version. + +@item +COMBINING DOCUMENTS + +You may combine the Document with other documents released under this +License, under the terms defined in section 4 above for modified +versions, provided that you include in the combination all of the +Invariant Sections of all of the original documents, unmodified, and +list them all as Invariant Sections of your combined work in its +license notice, and that you preserve all their Warranty Disclaimers. + +The combined work need only contain one copy of this License, and +multiple identical Invariant Sections may be replaced with a single +copy. If there are multiple Invariant Sections with the same name but +different contents, make the title of each such section unique by +adding at the end of it, in parentheses, the name of the original +author or publisher of that section if known, or else a unique number. +Make the same adjustment to the section titles in the list of +Invariant Sections in the license notice of the combined work. + +In the combination, you must combine any sections Entitled ``History'' +in the various original documents, forming one section Entitled +``History''; likewise combine any sections Entitled ``Acknowledgements'', +and any sections Entitled ``Dedications''. You must delete all +sections Entitled ``Endorsements.'' + +@item +COLLECTIONS OF DOCUMENTS + +You may make a collection consisting of the Document and other documents +released under this License, and replace the individual copies of this +License in the various documents with a single copy that is included in +the collection, provided that you follow the rules of this License for +verbatim copying of each of the documents in all other respects. + +You may extract a single document from such a collection, and distribute +it individually under this License, provided you insert a copy of this +License into the extracted document, and follow this License in all +other respects regarding verbatim copying of that document. + +@item +AGGREGATION WITH INDEPENDENT WORKS + +A compilation of the Document or its derivatives with other separate +and independent documents or works, in or on a volume of a storage or +distribution medium, is called an ``aggregate'' if the copyright +resulting from the compilation is not used to limit the legal rights +of the compilation's users beyond what the individual works permit. +When the Document is included in an aggregate, this License does not +apply to the other works in the aggregate which are not themselves +derivative works of the Document. + +If the Cover Text requirement of section 3 is applicable to these +copies of the Document, then if the Document is less than one half of +the entire aggregate, the Document's Cover Texts may be placed on +covers that bracket the Document within the aggregate, or the +electronic equivalent of covers if the Document is in electronic form. +Otherwise they must appear on printed covers that bracket the whole +aggregate. + +@item +TRANSLATION + +Translation is considered a kind of modification, so you may +distribute translations of the Document under the terms of section 4. +Replacing Invariant Sections with translations requires special +permission from their copyright holders, but you may include +translations of some or all Invariant Sections in addition to the +original versions of these Invariant Sections. You may include a +translation of this License, and all the license notices in the +Document, and any Warranty Disclaimers, provided that you also include +the original English version of this License and the original versions +of those notices and disclaimers. In case of a disagreement between +the translation and the original version of this License or a notice +or disclaimer, the original version will prevail. + +If a section in the Document is Entitled ``Acknowledgements'', +``Dedications'', or ``History'', the requirement (section 4) to Preserve +its Title (section 1) will typically require changing the actual +title. + +@item +TERMINATION + +You may not copy, modify, sublicense, or distribute the Document except +as expressly provided for under this License. Any other attempt to +copy, modify, sublicense or distribute the Document is void, and will +automatically terminate your rights under this License. However, +parties who have received copies, or rights, from you under this +License will not have their licenses terminated so long as such +parties remain in full compliance. + +@item +FUTURE REVISIONS OF THIS LICENSE + +The Free Software Foundation may publish new, revised versions +of the GNU Free Documentation 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. See +@uref{http://www.gnu.org/copyleft/}. + +Each version of the License is given a distinguishing version number. +If the Document specifies that a particular numbered version of this +License ``or any later version'' applies to it, you have the option of +following the terms and conditions either of that specified version or +of any later version that has been published (not as a draft) by the +Free Software Foundation. If the Document does not specify a version +number of this License, you may choose any version ever published (not +as a draft) by the Free Software Foundation. +@end enumerate + +@page +@appendixsubsec ADDENDUM: How to use this License for your documents + +To use this License in a document you have written, include a copy of +the License in the document and put the following copyright and +license notices just after the title page: + +@smallexample +@group + Copyright (C) @var{year} @var{your name}. + Permission is granted to copy, distribute and/or modify this document + under the terms of the GNU Free Documentation License, Version 1.2 + or any later version published by the Free Software Foundation; + with no Invariant Sections, no Front-Cover Texts, and no Back-Cover + Texts. A copy of the license is included in the section entitled ``GNU + Free Documentation License''. +@end group +@end smallexample + +If you have Invariant Sections, Front-Cover Texts and Back-Cover Texts, +replace the ``with...Texts.'' line with this: + +@smallexample +@group + with the Invariant Sections being @var{list their titles}, with + the Front-Cover Texts being @var{list}, and with the Back-Cover Texts + being @var{list}. +@end group +@end smallexample + +If you have Invariant Sections without Cover Texts, or some other +combination of the three, merge those two alternatives to suit the +situation. + +If your document contains nontrivial examples of program code, we +recommend releasing these examples in parallel under your choice of +free software license, such as the GNU General Public License, +to permit their use in free software. + +@c Local Variables: +@c ispell-local-pdict: "ispell-dict" +@c End: + diff --git a/packaging/check.spec b/packaging/check.spec new file mode 100644 index 0000000..09aa9b7 --- /dev/null +++ b/packaging/check.spec @@ -0,0 +1,75 @@ + +Name: check +Summary: A unit test framework for C +Version: 0.9.8 +Release: 1 +Group: Development/Tools +License: LGPLv2+ +URL: http://check.sourceforge.net/ +Source0: http://download.sourceforge.net/check/%{name}-%{version}.tar.gz +Source100: check.yaml +Requires(post): /sbin/ldconfig +Requires(postun): /sbin/ldconfig + +BuildRoot: %{_tmppath}/%{name}-%{version}-build + +%description +Check is a unit test framework for C. It features a simple interface for +defining unit tests, putting little in the way of the developer. Tests +are run in a separate address space, so Check can catch both assertion +failures and code errors that cause segmentation faults or other signals. +The output from unit tests can be used within source code editors and IDEs. + + + +%package devel +Summary: Libraries and headers for developing programs with check +Group: Development/Libraries +Requires: %{name} = %{version}-%{release} +Requires: pkgconfig + +%description devel +Libraries and headers for developing programs with check + + +%prep +%setup -q -n %{name}-%{version} + +%build + +%configure --disable-static +# Call make instruction with smp support +make %{?jobs:-j%jobs} + +%install +rm -rf %{buildroot} +%make_install + +rm -rf $RPM_BUILD_ROOT%{_infodir}/dir + +%clean +rm -rf %{buildroot} + + + +%post -p /sbin/ldconfig + +%postun -p /sbin/ldconfig + + + +%files +%defattr(-,root,root,-) +%doc COPYING.LESSER README +%{_libdir}/libcheck.so.* +%doc %{_infodir}/check* +%doc /usr/share/doc/check + + +%files devel +%defattr(-,root,root,-) +%{_includedir}/check.h +%{_libdir}/libcheck.so +%{_libdir}/pkgconfig/check.pc +%{_datadir}/aclocal/check.m4 + diff --git a/src/Makefile.am b/src/Makefile.am new file mode 100644 index 0000000..30224e7 --- /dev/null +++ b/src/Makefile.am @@ -0,0 +1,57 @@ +## Process this file with automake to produce Makefile.in + +lib_LTLIBRARIES=libcheck.la + +include_HEADERS=check.h + +if ENABLE_GCOV +libcheck_la_CFLAGS=-fprofile-arcs -ftest-coverage +endif + +libcheck_la_SOURCES=\ + check.h \ + check.c \ + check_error.h \ + check_error.c \ + check_impl.h \ + check_list.h \ + check_list.c \ + check_log.h \ + check_log.c \ + check_msg.h \ + check_msg.c \ + check_pack.h \ + check_pack.c \ + check_print.h \ + check_print.c \ + check_run.c \ + check_str.h \ + check_str.c + +EXTRA_DIST=check.h.in + +CLEANFILES=*~ *.bb *.bbg *.da + +LCOV_OUTPUT = lcov.info +LCOV_HTML = lcov_html +LCOV_LCOV = @LCOV@ +LCOV_GENHTML = @GENHTML@ + +lcov: $(LCOV_HTML) + +# Running the tests twice is a fix for a bug in gcc3.3 coverage support. +$(LCOV_OUTPUT): libcheck.la + @$(MAKE) -C $(top_builddir)/tests check &> /dev/null + @$(MAKE) -C $(top_builddir)/tests check + $(LCOV_LCOV) --capture --directory . --output-file $(LCOV_OUTPUT) + +$(LCOV_HTML): $(LCOV_OUTPUT) + -$(RM) -r $(LCOV_HTML) + LANG=C $(LCOV_GENHTML) --output-directory $(LCOV_HTML) --title "Check Code Coverage" --show-details $(LCOV_OUTPUT) + @echo "Point a web browser at $(LCOV_HTML)/index.html to see results." + +clean-local: lcov-clean + +.PHONY: lcov-clean +lcov-clean: + -$(RM) -r $(LCOV_HTML) $(LCOV_OUTPUT) diff --git a/src/check.c b/src/check.c new file mode 100644 index 0000000..59d7492 --- /dev/null +++ b/src/check.c @@ -0,0 +1,382 @@ +/* + * Check: a unit test framework for C + * Copyright (C) 2001, 2002 Arien Malec + * + * This library is free software; you can redistribute it and/or + * modify it under the terms of the GNU Lesser General Public + * License as published by the Free Software Foundation; either + * version 2.1 of the License, or (at your option) any later version. + * + * This library 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 + * Lesser General Public License for more details. + * + * You should have received a copy of the GNU Lesser General Public + * License along with this library; if not, write to the + * Free Software Foundation, Inc., 59 Temple Place - Suite 330, + * Boston, MA 02111-1307, USA. + */ + +#include "config.h" + +#include +#include +#include +#include + +#include "check.h" +#include "check_error.h" +#include "check_list.h" +#include "check_impl.h" +#include "check_msg.h" + +#ifndef DEFAULT_TIMEOUT +#define DEFAULT_TIMEOUT 3 +#endif + +int check_major_version = CHECK_MAJOR_VERSION; +int check_minor_version = CHECK_MINOR_VERSION; +int check_micro_version = CHECK_MICRO_VERSION; + +static int non_pass (int val); +static Fixture *fixture_create (SFun fun, int ischecked); +static void tcase_add_fixture (TCase *tc, SFun setup, SFun teardown, + int ischecked); +static void tr_init (TestResult *tr); +static void suite_free (Suite *s); +static void tcase_free (TCase *tc); + +Suite *suite_create (const char *name) +{ + Suite *s; + s = emalloc (sizeof(Suite)); /* freed in suite_free */ + if (name == NULL) + s->name = ""; + else + s->name = name; + s->tclst = check_list_create(); + return s; +} + +static void suite_free (Suite *s) +{ + List *l; + if (s == NULL) + return; + l = s->tclst; + for (list_front(l); !list_at_end(l); list_advance (l)) { + tcase_free (list_val(l)); + } + list_free (s->tclst); + free(s); +} + +TCase *tcase_create (const char *name) +{ + char *env; + int timeout = DEFAULT_TIMEOUT; + TCase *tc = emalloc (sizeof(TCase)); /*freed in tcase_free */ + if (name == NULL) + tc->name = ""; + else + tc->name = name; + + env = getenv("CK_DEFAULT_TIMEOUT"); + if (env != NULL) { + int tmp = atoi(env); + if (tmp >= 0) { + timeout = tmp; + } + } + + tc->timeout = timeout; + tc->tflst = check_list_create(); + tc->unch_sflst = check_list_create(); + tc->ch_sflst = check_list_create(); + tc->unch_tflst = check_list_create(); + tc->ch_tflst = check_list_create(); + + return tc; +} + + +static void tcase_free (TCase *tc) +{ + list_apply (tc->tflst, free); + list_apply (tc->unch_sflst, free); + list_apply (tc->ch_sflst, free); + list_apply (tc->unch_tflst, free); + list_apply (tc->ch_tflst, free); + list_free(tc->tflst); + list_free(tc->unch_sflst); + list_free(tc->ch_sflst); + list_free(tc->unch_tflst); + list_free(tc->ch_tflst); + + free(tc); +} + +void suite_add_tcase (Suite *s, TCase *tc) +{ + if (s == NULL || tc == NULL) + return; + list_add_end (s->tclst, tc); +} + +void _tcase_add_test (TCase *tc, TFun fn, const char *name, int signal, int start, int end) +{ + TF * tf; + if (tc == NULL || fn == NULL || name == NULL) + return; + tf = emalloc (sizeof(TF)); /* freed in tcase_free */ + tf->fn = fn; + tf->loop_start = start; + tf->loop_end = end; + tf->signal = signal; /* 0 means no signal expected */ + tf->name = name; + list_add_end (tc->tflst, tf); +} + +static Fixture *fixture_create (SFun fun, int ischecked) +{ + Fixture *f; + f = emalloc (sizeof(Fixture)); + f->fun = fun; + f->ischecked = ischecked; + + return f; +} + +void tcase_add_unchecked_fixture (TCase *tc, SFun setup, SFun teardown) +{ + tcase_add_fixture(tc,setup,teardown,0); +} + +void tcase_add_checked_fixture (TCase *tc, SFun setup, SFun teardown) +{ + tcase_add_fixture (tc,setup,teardown,1); +} + +static void tcase_add_fixture (TCase *tc, SFun setup, SFun teardown, + int ischecked) +{ + if (setup) { + if (ischecked) + list_add_end (tc->ch_sflst, fixture_create(setup, ischecked)); + else + list_add_end (tc->unch_sflst, fixture_create(setup, ischecked)); + } + + /* Add teardowns at front so they are run in reverse order. */ + if (teardown) { + if (ischecked) + list_add_front (tc->ch_tflst, fixture_create(teardown, ischecked)); + else + list_add_front (tc->unch_tflst, fixture_create(teardown, ischecked)); + } +} + +void tcase_set_timeout (TCase *tc, int timeout) +{ + if (timeout >= 0) + tc->timeout = timeout; +} + +void tcase_fn_start (const char *fname, const char *file, int line) +{ + send_ctx_info (CK_CTX_TEST); + send_loc_info (file, line); +} + +void _mark_point (const char *file, int line) +{ + send_loc_info (file, line); +} + +void _fail_unless (int result, const char *file, + int line, const char *expr, ...) +{ + const char *msg; + + send_loc_info (file, line); + if (!result) { + va_list ap; + char buf[BUFSIZ]; + + va_start(ap,expr); + msg = (const char*)va_arg(ap, char *); + if (msg == NULL) + msg = expr; + vsnprintf(buf, BUFSIZ, msg, ap); + va_end(ap); + send_failure_info (buf); + if (cur_fork_status() == CK_FORK) + exit(1); + } +} + +SRunner *srunner_create (Suite *s) +{ + SRunner *sr = emalloc (sizeof(SRunner)); /* freed in srunner_free */ + sr->slst = check_list_create(); + if (s != NULL) + list_add_end(sr->slst, s); + sr->stats = emalloc (sizeof(TestStats)); /* freed in srunner_free */ + sr->stats->n_checked = sr->stats->n_failed = sr->stats->n_errors = 0; + sr->resultlst = check_list_create(); + sr->log_fname = NULL; + sr->xml_fname = NULL; + sr->loglst = NULL; + sr->fstat = CK_FORK_UNSPECIFIED; + return sr; +} + +void srunner_add_suite (SRunner *sr, Suite *s) +{ + list_add_end(sr->slst, s); +} + +void srunner_free (SRunner *sr) +{ + List *l; + TestResult *tr; + if (sr == NULL) + return; + + free (sr->stats); + l = sr->slst; + for (list_front(l); !list_at_end(l); list_advance(l)) { + suite_free(list_val(l)); + } + list_free(sr->slst); + + l = sr->resultlst; + for (list_front(l); !list_at_end(l); list_advance(l)) { + tr = list_val(l); + free(tr->file); + free(tr->msg); + free(tr); + } + list_free (sr->resultlst); + + free (sr); +} + +int srunner_ntests_failed (SRunner *sr) +{ + return sr->stats->n_failed + sr->stats->n_errors; +} + +int srunner_ntests_run (SRunner *sr) +{ + return sr->stats->n_checked; +} + +TestResult **srunner_failures (SRunner *sr) +{ + int i = 0; + TestResult **trarray; + List *rlst; + trarray = malloc (sizeof(trarray[0]) * srunner_ntests_failed (sr)); + + rlst = sr->resultlst; + for (list_front(rlst); !list_at_end(rlst); list_advance(rlst)) { + TestResult *tr = list_val(rlst); + if (non_pass(tr->rtype)) + trarray[i++] = tr; + + } + return trarray; +} + +TestResult **srunner_results (SRunner *sr) +{ + int i = 0; + TestResult **trarray; + List *rlst; + + trarray = malloc (sizeof(trarray[0]) * srunner_ntests_run (sr)); + + rlst = sr->resultlst; + for (list_front(rlst); !list_at_end(rlst); list_advance(rlst)) { + trarray[i++] = list_val(rlst); + } + return trarray; +} + +static int non_pass (int val) +{ + return val != CK_PASS; +} + +TestResult *tr_create(void) +{ + TestResult *tr; + + tr = emalloc (sizeof(TestResult)); + tr_init (tr); + return tr; +} + +void tr_reset(TestResult *tr) +{ + tr_init(tr); +} + +static void tr_init (TestResult *tr) +{ + tr->ctx = -1; + tr->line = -1; + tr->rtype = -1; + tr->msg = NULL; + tr->file = NULL; + tr->tcname = NULL; + tr->tname = NULL; +} + + +const char *tr_msg (TestResult *tr) +{ + return tr->msg; +} + +int tr_lno (TestResult *tr) +{ + return tr->line; +} + +const char *tr_lfile (TestResult *tr) +{ + return tr->file; +} + +int tr_rtype (TestResult *tr) +{ + return tr->rtype; +} + +enum ck_result_ctx tr_ctx (TestResult *tr) +{ + return tr->ctx; +} + +const char *tr_tcname (TestResult *tr) +{ + return tr->tcname; +} + +static int _fstat = CK_FORK; + +void set_fork_status (enum fork_status fstat) +{ + if (fstat == CK_FORK || fstat == CK_NOFORK) + _fstat = fstat; + else + eprintf ("Bad status in set_fork_status", __FILE__, __LINE__); +} + +enum fork_status cur_fork_status (void) +{ + return _fstat; +} diff --git a/src/check.h.in b/src/check.h.in new file mode 100644 index 0000000..5acb28d --- /dev/null +++ b/src/check.h.in @@ -0,0 +1,364 @@ +/*-*- mode:C; -*- */ +/* + * Check: a unit test framework for C + * Copyright (C) 2001, 2002, Arien Malec + * + * This library is free software; you can redistribute it and/or + * modify it under the terms of the GNU Lesser General Public + * License as published by the Free Software Foundation; either + * version 2.1 of the License, or (at your option) any later version. + * + * This library 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 + * Lesser General Public License for more details. + * + * You should have received a copy of the GNU Lesser General Public + * License along with this library; if not, write to the + * Free Software Foundation, Inc., 59 Temple Place - Suite 330, + * Boston, MA 02111-1307, USA. + */ + +#ifndef CHECK_H +#define CHECK_H + +#include + +/* Check: a unit test framework for C + + Check is a unit test framework for C. It features a simple + interface for defining unit tests, putting little in the way of the + developer. Tests are run in a separate address space, so Check can + catch both assertion failures and code errors that cause + segmentation faults or other signals. The output from unit tests + can be used within source code editors and IDEs. + + Unit tests are created with the START_TEST/END_TEST macro + pair. The fail_unless and fail macros are used for creating + checks within unit tests; the mark_point macro is useful for + trapping the location of signals and/or early exits. + + + Test cases are created with tcase_create, unit tests are added + with tcase_add_test + + + Suites are created with suite_create; test cases are added + with suite_add_tcase + + Suites are run through an SRunner, which is created with + srunner_create. Additional suites can be added to an SRunner with + srunner_add_suite. An SRunner is freed with srunner_free, which also + frees all suites added to the runner. + + Use srunner_run_all to run a suite and print results. + +*/ + + +#ifdef __cplusplus +#define CK_CPPSTART extern "C" { +CK_CPPSTART +#endif + +#include + +/* check version numbers */ + +#define CHECK_MAJOR_VERSION (@CHECK_MAJOR_VERSION@) +#define CHECK_MINOR_VERSION (@CHECK_MINOR_VERSION@) +#define CHECK_MICRO_VERSION (@CHECK_MICRO_VERSION@) + +extern int check_major_version; +extern int check_minor_version; +extern int check_micro_version; + +#ifndef NULL +#define NULL ((void*)0) +#endif + +/* opaque type for a test case + + A TCase represents a test case. Create with tcase_create, free + with tcase_free. For the moment, test cases can only be run + through a suite +*/ +typedef struct TCase TCase; + +/* type for a test function */ +typedef void (*TFun) (int); + +/* type for a setup/teardown function */ +typedef void (*SFun) (void); + +/* Opaque type for a test suite */ +typedef struct Suite Suite; + +/* Creates a test suite with the given name */ +Suite *suite_create (const char *name); + +/* Add a test case to a suite */ +void suite_add_tcase (Suite *s, TCase *tc); + +/* Create a test case */ +TCase *tcase_create (const char *name); + +/* Add a test function to a test case (macro version) */ +#define tcase_add_test(tc,tf) tcase_add_test_raise_signal(tc,tf,0) + +/* Add a test function with signal handling to a test case (macro version) */ +#define tcase_add_test_raise_signal(tc,tf,signal) \ + _tcase_add_test((tc),(tf),"" # tf "",(signal), 0, 1) + +/* Add a looping test function to a test case (macro version) + + The test will be called in a for(i = s; i < e; i++) loop with each + iteration being executed in a new context. The loop variable 'i' is + available in the test. + */ +#define tcase_add_loop_test(tc,tf,s,e) \ + _tcase_add_test((tc),(tf),"" # tf "",0,(s),(e)) + +/* Signal version of loop test. + FIXME: add a test case; this is untested as part of Check's tests. + */ +#define tcase_add_loop_test_raise_signal(tc,tf,signal,s,e) \ + _tcase_add_test((tc),(tf),"" # tf "",(signal),(s),(e)) + +/* Add a test function to a test case + (function version -- use this when the macro won't work +*/ +void _tcase_add_test (TCase *tc, TFun tf, const char *fname, int signal, int start, int end); + +/* Add unchecked fixture setup/teardown functions to a test case + + If unchecked fixture functions are run at the start and end of the + test case, and not before and after unit tests. Note that unchecked + setup/teardown functions are not run in a separate address space, + like test functions, and so must not exit or signal (e.g., + segfault) + + Also, when run in CK_NOFORK mode, unchecked fixture functions may + lead to different unit test behavior IF unit tests change data + setup by the fixture functions. +*/ +void tcase_add_unchecked_fixture (TCase *tc, SFun setup, SFun teardown); + +/* Add fixture setup/teardown functions to a test case + + Checked fixture functions are run before and after unit + tests. Unlike unchecked fixture functions, checked fixture + functions are run in the same separate address space as the test + program, and thus the test function will survive signals or + unexpected exits in the fixture function. Also, IF the setup + function is idempotent, unit test behavior will be the same in + CK_FORK and CK_NOFORK modes. + + However, since fixture functions are run before and after each unit + test, they should not be expensive code. + +*/ +void tcase_add_checked_fixture (TCase *tc, SFun setup, SFun teardown); + +/* Set the timeout for all tests in a test case. A test that lasts longer + than the timeout (in seconds) will be killed and thus fail with an error. + The timeout can also be set globaly with the environment variable + CK_DEFAULT_TIMEOUT, the specific setting always takes precedence. +*/ +void tcase_set_timeout (TCase *tc, int timeout); + +/* Internal function to mark the start of a test function */ +void tcase_fn_start (const char *fname, const char *file, int line); + +/* Start a unit test with START_TEST(unit_name), end with END_TEST + One must use braces within a START_/END_ pair to declare new variables +*/ +#define START_TEST(__testname)\ +static void __testname (int _i __attribute__((unused)))\ +{\ + tcase_fn_start (""# __testname, __FILE__, __LINE__); + +/* End a unit test */ +#define END_TEST } + +/* Fail the test case unless expr is true */ +/* The space before the comma sign before ## is essential to be compatible + with gcc 2.95.3 and earlier. +*/ +#define fail_unless(expr, ...)\ + _fail_unless(expr, __FILE__, __LINE__,\ + "Assertion '"#expr"' failed" , ## __VA_ARGS__, NULL) + +/* Fail the test case if expr is true */ +/* The space before the comma sign before ## is essential to be compatible + with gcc 2.95.3 and earlier. +*/ + +/* FIXME: these macros may conflict with C89 if expr is + FIXME: strcmp (str1, str2) due to excessive string length. */ +#define fail_if(expr, ...)\ + _fail_unless(!(expr), __FILE__, __LINE__,\ + "Failure '"#expr"' occured" , ## __VA_ARGS__, NULL) + +/* Always fail */ +#define fail(...) _fail_unless(0, __FILE__, __LINE__, "Failed" , ## __VA_ARGS__, NULL) + +/* Non macro version of #fail_unless, with more complicated interface */ +void _fail_unless (int result, const char *file, + int line, const char *expr, ...); + +/* Mark the last point reached in a unit test + (useful for tracking down where a segfault, etc. occurs) +*/ +#define mark_point() _mark_point(__FILE__,__LINE__) + +/* Non macro version of #mark_point */ +void _mark_point (const char *file, int line); + +/* Result of a test */ +enum test_result { + CK_PASS, /* Test passed*/ + CK_FAILURE, /* Test completed but failed */ + CK_ERROR /* Test failed to complete + (unexpected signal or non-zero early exit) */ +}; + +/* Specifies the how much output an SRunner should produce */ +enum print_output { + CK_SILENT, /* No output */ + CK_MINIMAL, /* Only summary output */ + CK_NORMAL, /* All failed tests */ + CK_VERBOSE, /* All tests */ + CK_ENV, /* Look at environment var */ + CK_LAST +}; + +/* Holds state for a running of a test suite */ +typedef struct SRunner SRunner; + +/* Opaque type for a test failure */ +typedef struct TestResult TestResult; + +/* accessors for tr fields */ + enum ck_result_ctx { + CK_CTX_SETUP, + CK_CTX_TEST, + CK_CTX_TEARDOWN +}; + +/* Type of result */ +int tr_rtype (TestResult *tr); +/* Context in which the result occurred */ +enum ck_result_ctx tr_ctx (TestResult *tr); +/* Failure message */ +const char *tr_msg (TestResult *tr); +/* Line number at which failure occured */ +int tr_lno (TestResult *tr); +/* File name at which failure occured */ +const char *tr_lfile (TestResult *tr); +/* Test case in which unit test was run */ +const char *tr_tcname (TestResult *tr); + +/* Creates an SRunner for the given suite */ +SRunner *srunner_create (Suite *s); + +/* Adds a Suite to an SRunner */ +void srunner_add_suite (SRunner *sr, Suite *s); + +/* Frees an SRunner, all suites added to it and all contained test cases */ +void srunner_free (SRunner *sr); + + +/* Test running */ + +/* Runs an SRunner, printing results as specified (see enum print_output) */ +void srunner_run_all (SRunner *sr, enum print_output print_mode); + + +/* Next functions are valid only after the suite has been + completely run, of course */ + +/* Number of failed tests in a run suite. Includes failures + errors */ +int srunner_ntests_failed (SRunner *sr); + +/* Total number of tests run in a run suite */ +int srunner_ntests_run (SRunner *sr); + +/* Return an array of results for all failures + + Number of failures is equal to srunner_nfailed_tests. Memory for + the array is malloc'ed and must be freed, but individual TestResults + must not +*/ +TestResult **srunner_failures (SRunner *sr); + +/* Return an array of results for all run tests + + Number of results is equal to srunner_ntests_run, and excludes + failures due to setup function failure. + + Memory is malloc'ed and must be freed, but individual TestResults + must not +*/ +TestResult **srunner_results (SRunner *sr); + + +/* Printing */ + +/* Print the results contained in an SRunner */ +void srunner_print (SRunner *sr, enum print_output print_mode); + + +/* Set a log file to which to write during test running. + + Log file setting is an initialize only operation -- it should be + done immediatly after SRunner creation, and the log file can't be + changed after being set. +*/ +void srunner_set_log (SRunner *sr, const char *fname); + +/* Does the SRunner have a log file? */ +int srunner_has_log (SRunner *sr); + +/* Return the name of the log file, or NULL if none */ +const char *srunner_log_fname (SRunner *sr); + +/* Set a xml file to which to write during test running. + + XML file setting is an initialize only operation -- it should be + done immediatly after SRunner creation, and the XML file can't be + changed after being set. +*/ +void srunner_set_xml (SRunner *sr, const char *fname); + +/* Does the SRunner have an XML log file? */ +int srunner_has_xml (SRunner *sr); + +/* Return the name of the XML file, or NULL if none */ +const char *srunner_xml_fname (SRunner *sr); + + +/* Control forking */ +enum fork_status { + CK_FORK, + CK_NOFORK +}; + +/* Get the current fork status */ +enum fork_status srunner_fork_status (SRunner *sr); + +/* Set the current fork status */ +void srunner_set_fork_status (SRunner *sr, enum fork_status fstat); + +/* Fork in a test and make sure messaging and tests work. */ +pid_t check_fork(void); + +/* Wait for the pid and exit. If pid is zero, just exit. */ +void check_waitpid_and_exit(pid_t pid); + +#ifdef __cplusplus +#define CK_CPPEND } +CK_CPPEND +#endif + +#endif /* CHECK_H */ diff --git a/src/check_error.c b/src/check_error.c new file mode 100644 index 0000000..6ad0481 --- /dev/null +++ b/src/check_error.c @@ -0,0 +1,66 @@ +/* + * Check: a unit test framework for C + * Copyright (C) 2001, 2002 Arien Malec + * + * This library is free software; you can redistribute it and/or + * modify it under the terms of the GNU Lesser General Public + * License as published by the Free Software Foundation; either + * version 2.1 of the License, or (at your option) any later version. + * + * This library 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 + * Lesser General Public License for more details. + * + * You should have received a copy of the GNU Lesser General Public + * License along with this library; if not, write to the + * Free Software Foundation, Inc., 59 Temple Place - Suite 330, + * Boston, MA 02111-1307, USA. + */ + +#include "config.h" + +#include +#include +#include +#include +#include + +#include "check_error.h" + + +void eprintf (const char *fmt, const char *file, int line, ...) +{ + va_list args; + fflush(stderr); + + fprintf(stderr,"%s:%d: ",file,line); + va_start(args, line); + vfprintf(stderr, fmt, args); + va_end(args); + + /*include system error information if format ends in colon */ + if (fmt[0] != '\0' && fmt[strlen(fmt)-1] == ':') + fprintf(stderr, " %s", strerror(errno)); + fprintf(stderr, "\n"); + + exit(2); +} + +void *emalloc (size_t n) +{ + void *p; + p = malloc(n); + if (p == NULL) + eprintf("malloc of %u bytes failed:", __FILE__, __LINE__, n); + return p; +} + +void *erealloc (void * ptr, size_t n) +{ + void *p; + p = realloc (ptr, n); + if (p == NULL) + eprintf("realloc of %u bytes failed:", __FILE__, __LINE__, n); + return p; +} diff --git a/src/check_error.h b/src/check_error.h new file mode 100644 index 0000000..2e1e211 --- /dev/null +++ b/src/check_error.h @@ -0,0 +1,33 @@ +/* + * Check: a unit test framework for C + * Copyright (C) 2001, 2002 Arien Malec + * + * This library is free software; you can redistribute it and/or + * modify it under the terms of the GNU Lesser General Public + * License as published by the Free Software Foundation; either + * version 2.1 of the License, or (at your option) any later version. + * + * This library 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 + * Lesser General Public License for more details. + * + * You should have received a copy of the GNU Lesser General Public + * License along with this library; if not, write to the + * Free Software Foundation, Inc., 59 Temple Place - Suite 330, + * Boston, MA 02111-1307, USA. + */ + +#ifndef ERROR_H +#define ERROR_H + +/* Include stdlib.h beforehand */ + +/* Print error message and die + If fmt ends in colon, include system error information */ +void eprintf (const char *fmt, const char *file, int line,...); +/* malloc or die */ +void *emalloc(size_t n); +void *erealloc(void *, size_t n); + +#endif /*ERROR_H*/ diff --git a/src/check_impl.h b/src/check_impl.h new file mode 100644 index 0000000..2a0dde9 --- /dev/null +++ b/src/check_impl.h @@ -0,0 +1,121 @@ +/* + * Check: a unit test framework for C + * Copyright (C) 2001,2002 Arien Malec + * + * This library is free software; you can redistribute it and/or + * modify it under the terms of the GNU Lesser General Public + * License as published by the Free Software Foundation; either + * version 2.1 of the License, or (at your option) any later version. + * + * This library 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 + * Lesser General Public License for more details. + * + * You should have received a copy of the GNU Lesser General Public + * License along with this library; if not, write to the + * Free Software Foundation, Inc., 59 Temple Place - Suite 330, + * Boston, MA 02111-1307, USA. + */ + +#ifndef CHECK_IMPL_H +#define CHECK_IMPL_H + + +/* This header should be included by any module that needs + to know the implementation details of the check structures + Include stdio.h & list.h before this header +*/ + +/* magic values */ + +/* Unspecified fork status, used only internally */ +#define CK_FORK_UNSPECIFIED -1 + + +typedef struct TF { + TFun fn; + int loop_start; + int loop_end; + const char *name; + int signal; +} TF; + +struct Suite { + const char *name; + List *tclst; /* List of test cases */ +}; + +typedef struct Fixture +{ + int ischecked; + SFun fun; +} Fixture; + +struct TCase { + const char *name; + int timeout; + List *tflst; /* list of test functions */ + List *unch_sflst; + List *unch_tflst; + List *ch_sflst; + List *ch_tflst; +}; + +typedef struct TestStats { + int n_checked; + int n_failed; + int n_errors; +} TestStats; + +struct TestResult { + enum test_result rtype; /* Type of result */ + enum ck_result_ctx ctx; /* When the result occurred */ + char *file; /* File where the test occured */ + int line; /* Line number where the test occurred */ + int iter; /* The iteration value for looping tests */ + const char *tcname; /* Test case that generated the result */ + const char *tname; /* Test that generated the result */ + char *msg; /* Failure message */ +}; + +TestResult *tr_create(void); +void tr_reset(TestResult *tr); + +enum cl_event { + CLINITLOG_SR, + CLENDLOG_SR, + CLSTART_SR, + CLSTART_S, + CLEND_SR, + CLEND_S, + CLEND_T +}; + +typedef void (*LFun) (SRunner *, FILE*, enum print_output, + void *, enum cl_event); + +typedef struct Log { + FILE *lfile; + LFun lfun; + int close; + enum print_output mode; +} Log; + +struct SRunner { + List *slst; /* List of Suite objects */ + TestStats *stats; /* Run statistics */ + List *resultlst; /* List of unit test results */ + const char *log_fname; /* name of log file */ + const char *xml_fname; /* name of xml output file */ + List *loglst; /* list of Log objects */ + enum fork_status fstat; /* controls if suites are forked or not + NOTE: Don't use this value directly, + instead use srunner_fork_status */ +}; + + +void set_fork_status(enum fork_status fstat); +enum fork_status cur_fork_status (void); + +#endif /* CHECK_IMPL_H */ diff --git a/src/check_list.c b/src/check_list.c new file mode 100644 index 0000000..30cee01 --- /dev/null +++ b/src/check_list.c @@ -0,0 +1,141 @@ +/* + * Check: a unit test framework for C + * Copyright (C) 2001, 2002 Arien Malec + * + * This library is free software; you can redistribute it and/or + * modify it under the terms of the GNU Lesser General Public + * License as published by the Free Software Foundation; either + * version 2.1 of the License, or (at your option) any later version. + * + * This library 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 + * Lesser General Public License for more details. + * + * You should have received a copy of the GNU Lesser General Public + * License along with this library; if not, write to the + * Free Software Foundation, Inc., 59 Temple Place - Suite 330, + * Boston, MA 02111-1307, USA. + */ + +#include "config.h" + +#include +#include + +#include "check_list.h" +#include "check_error.h" + + +enum { + LINIT = 1, + LGROW = 2 +}; + +struct List { + int n_elts; + int max_elts; + int current; /* pointer to the current node */ + int last; /* pointer to the node before END */ + const void **data; +}; + +static void maybe_grow (List *lp) +{ + if (lp->n_elts >= lp->max_elts) { + lp->max_elts *= LGROW; + lp->data = erealloc (lp->data, lp->max_elts * sizeof(lp->data[0])); + } +} + +List *check_list_create (void) +{ + List *lp; + lp = emalloc (sizeof(List)); + lp->n_elts = 0; + lp->max_elts = LINIT; + lp->data = emalloc(sizeof(lp->data[0]) * LINIT); + lp->current = lp->last = -1; + return lp; +} + +void list_add_front (List *lp, const void *val) +{ + if (lp == NULL) + return; + maybe_grow(lp); + memmove(lp->data + 1, lp->data, lp->n_elts * sizeof lp->data[0]); + lp->last++; + lp->n_elts++; + lp->current = 0; + lp->data[lp->current] = val; +} + +void list_add_end (List *lp, const void *val) +{ + if (lp == NULL) + return; + maybe_grow(lp); + lp->last++; + lp->n_elts++; + lp->current = lp->last; + lp->data[lp->current] = val; +} + +int list_at_end (List *lp) +{ + if (lp->current == -1) + return 1; + else + return (lp->current > lp->last); +} + +void list_front (List *lp) +{ + if (lp->current == -1) + return; + lp->current = 0; +} + + +void list_free (List *lp) +{ + if (lp == NULL) + return; + + free(lp->data); + free (lp); +} + +void *list_val (List *lp) +{ + if (lp == NULL) + return NULL; + if (lp->current == -1 || lp->current > lp->last) + return NULL; + + return (void*) lp->data[lp->current]; +} + +void list_advance (List *lp) +{ + if (lp == NULL) + return; + if (list_at_end(lp)) + return; + lp->current++; +} + + +void list_apply (List *lp, void (*fp) (void *)) +{ + if (lp == NULL || fp == NULL) + return; + + for (list_front(lp); !list_at_end(lp); list_advance(lp)) + fp (list_val(lp)); + +} + + + diff --git a/src/check_list.h b/src/check_list.h new file mode 100644 index 0000000..e40f4f8 --- /dev/null +++ b/src/check_list.h @@ -0,0 +1,56 @@ +/* + * Check: a unit test framework for C + * Copyright (C) 2001, 2002 Arien Malec + * + * This library is free software; you can redistribute it and/or + * modify it under the terms of the GNU Lesser General Public + * License as published by the Free Software Foundation; either + * version 2.1 of the License, or (at your option) any later version. + * + * This library 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 + * Lesser General Public License for more details. + * + * You should have received a copy of the GNU Lesser General Public + * License along with this library; if not, write to the + * Free Software Foundation, Inc., 59 Temple Place - Suite 330, + * Boston, MA 02111-1307, USA. + */ + +#ifndef CHECK_LIST_H +#define CHECK_LIST_H + +typedef struct List List; + +/* Create an empty list */ +List * check_list_create (void); + +/* Is list at end? */ +int list_at_end (List * lp); + +/* Position list at front */ +void list_front(List *lp); + +/* Add a value to the front of the list, + positioning newly added value as current value. + More expensive than list_add_end, as it uses memmove. */ +void list_add_front (List *lp, const void *val); + +/* Add a value to the end of the list, + positioning newly added value as current value */ +void list_add_end (List *lp, const void *val); + +/* Give the value of the current node */ +void *list_val (List * lp); + +/* Position the list at the next node */ +void list_advance (List * lp); + +/* Free a list, but don't free values */ +void list_free (List * lp); + +void list_apply (List *lp, void (*fp) (void *)); + + +#endif /* CHECK_LIST_H */ diff --git a/src/check_log.c b/src/check_log.c new file mode 100644 index 0000000..edb5cb0 --- /dev/null +++ b/src/check_log.c @@ -0,0 +1,323 @@ +/* + * Check: a unit test framework for C + * Copyright (C) 2001, 2002 Arien Malec + * + * This library is free software; you can redistribute it and/or + * modify it under the terms of the GNU Lesser General Public + * License as published by the Free Software Foundation; either + * version 2.1 of the License, or (at your option) any later version. + * + * This library 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 + * Lesser General Public License for more details. + * + * You should have received a copy of the GNU Lesser General Public + * License along with this library; if not, write to the + * Free Software Foundation, Inc., 59 Temple Place - Suite 330, + * Boston, MA 02111-1307, USA. + */ + +#include "config.h" + +#include +#include +#include +#include +#include + +#include "check_error.h" +#include "check_list.h" +#include "check_impl.h" +#include "check_log.h" +#include "check_print.h" + + +static void srunner_send_evt (SRunner *sr, void *obj, enum cl_event evt); + +void srunner_set_log (SRunner *sr, const char *fname) +{ + if (sr->log_fname) + return; + sr->log_fname = fname; +} + +int srunner_has_log (SRunner *sr) +{ + return sr->log_fname != NULL; +} + +const char *srunner_log_fname (SRunner *sr) +{ + return sr->log_fname; +} + + +void srunner_set_xml (SRunner *sr, const char *fname) +{ + if (sr->xml_fname) + return; + sr->xml_fname = fname; +} + +int srunner_has_xml (SRunner *sr) +{ + return sr->xml_fname != NULL; +} + +const char *srunner_xml_fname (SRunner *sr) +{ + return sr->xml_fname; +} + +void srunner_register_lfun (SRunner *sr, FILE *lfile, int close, + LFun lfun, enum print_output printmode) +{ + Log *l = emalloc (sizeof(Log)); + + if (printmode == CK_ENV) { + printmode = get_env_printmode(); + } + + l->lfile = lfile; + l->lfun = lfun; + l->close = close; + l->mode = printmode; + list_add_end (sr->loglst, l); + return; +} + +void log_srunner_start (SRunner *sr) +{ + srunner_send_evt (sr, NULL, CLSTART_SR); +} + +void log_srunner_end (SRunner *sr) +{ + srunner_send_evt (sr, NULL, CLEND_SR); +} + +void log_suite_start (SRunner *sr, Suite *s) +{ + srunner_send_evt (sr, s, CLSTART_S); +} + +void log_suite_end (SRunner *sr, Suite *s) +{ + srunner_send_evt (sr, s, CLEND_S); +} + +void log_test_end (SRunner *sr, TestResult *tr) +{ + srunner_send_evt (sr, tr, CLEND_T); +} + +static void srunner_send_evt (SRunner *sr, void *obj, enum cl_event evt) +{ + List *l; + Log *lg; + l = sr->loglst; + for (list_front(l); !list_at_end(l); list_advance(l)) { + lg = list_val(l); + fflush(lg->lfile); + lg->lfun (sr, lg->lfile, lg->mode, obj, evt); + fflush(lg->lfile); + } +} + +void stdout_lfun (SRunner *sr, FILE *file, enum print_output printmode, + void *obj, enum cl_event evt) +{ + TestResult *tr; + Suite *s; + + if (printmode == CK_ENV) { + printmode = get_env_printmode(); + } + + switch (evt) { + case CLINITLOG_SR: + break; + case CLENDLOG_SR: + break; + case CLSTART_SR: + if (printmode > CK_SILENT) { + fprintf(file, "Running suite(s):"); + } + break; + case CLSTART_S: + s = obj; + if (printmode > CK_SILENT) { + fprintf(file, " %s\n", s->name); + } + break; + case CLEND_SR: + if (printmode > CK_SILENT) { + /* we don't want a newline before printing here, newlines should + come after printing a string, not before. it's better to add + the newline above in CLSTART_S. + */ + srunner_fprint (file, sr, printmode); + } + break; + case CLEND_S: + s = obj; + break; + case CLEND_T: + tr = obj; + break; + default: + eprintf("Bad event type received in stdout_lfun", __FILE__, __LINE__); + } + + +} + +void lfile_lfun (SRunner *sr, FILE *file, enum print_output printmode, + void *obj, enum cl_event evt) +{ + TestResult *tr; + Suite *s; + + switch (evt) { + case CLINITLOG_SR: + break; + case CLENDLOG_SR: + break; + case CLSTART_SR: + break; + case CLSTART_S: + s = obj; + fprintf(file, "Running suite %s\n", s->name); + break; + case CLEND_SR: + fprintf (file, "Results for all suites run:\n"); + srunner_fprint (file, sr, CK_MINIMAL); + break; + case CLEND_S: + s = obj; + break; + case CLEND_T: + tr = obj; + tr_fprint(file, tr, CK_VERBOSE); + break; + default: + eprintf("Bad event type received in stdout_lfun", __FILE__, __LINE__); + } + + +} + +void xml_lfun (SRunner *sr, FILE *file, enum print_output printmode, + void *obj, enum cl_event evt) +{ + TestResult *tr; + Suite *s; + static struct timeval inittv, endtv; + static char t[sizeof "yyyy-mm-dd hh:mm:ss"] = {0}; + + if (t[0] == 0) + { + struct tm now; + gettimeofday(&inittv, NULL); + localtime_r(&(inittv.tv_sec), &now); + strftime(t, sizeof("yyyy-mm-dd hh:mm:ss"), "%Y-%m-%d %H:%M:%S", &now); + } + + switch (evt) { + case CLINITLOG_SR: + fprintf(file, "\n"); + fprintf(file, "\n"); + fprintf(file, " %s\n", t); + break; + case CLENDLOG_SR: + gettimeofday(&endtv, NULL); + fprintf(file, " %f\n", + (endtv.tv_sec + (float)(endtv.tv_usec)/1000000) - \ + (inittv.tv_sec + (float)(inittv.tv_usec/1000000))); + fprintf(file, "\n"); + break; + case CLSTART_SR: + break; + case CLSTART_S: + s = obj; + fprintf(file, " \n"); + fprintf(file, " %s\n", s->name); + break; + case CLEND_SR: + break; + case CLEND_S: + fprintf(file, " \n"); + s = obj; + break; + case CLEND_T: + tr = obj; + tr_xmlprint(file, tr, CK_VERBOSE); + break; + default: + eprintf("Bad event type received in xml_lfun", __FILE__, __LINE__); + } + +} + + +FILE *srunner_open_lfile (SRunner *sr) +{ + FILE *f = NULL; + if (srunner_has_log (sr)) { + f = fopen(sr->log_fname, "w"); + if (f == NULL) + eprintf ("Could not open log file %s:", __FILE__, __LINE__, + sr->log_fname); + } + return f; +} + +FILE *srunner_open_xmlfile (SRunner *sr) +{ + FILE *f = NULL; + if (srunner_has_xml (sr)) { + f = fopen(sr->xml_fname, "w"); + if (f == NULL) + eprintf ("Could not open xml file %s:", __FILE__, __LINE__, + sr->xml_fname); + } + return f; +} + +void srunner_init_logging (SRunner *sr, enum print_output print_mode) +{ + FILE *f; + sr->loglst = check_list_create(); + srunner_register_lfun (sr, stdout, 0, stdout_lfun, print_mode); + f = srunner_open_lfile (sr); + if (f) { + srunner_register_lfun (sr, f, 1, lfile_lfun, print_mode); + } + f = srunner_open_xmlfile (sr); + if (f) { + srunner_register_lfun (sr, f, 2, xml_lfun, print_mode); + } + srunner_send_evt (sr, NULL, CLINITLOG_SR); +} + +void srunner_end_logging (SRunner *sr) +{ + List *l; + int rval; + + srunner_send_evt (sr, NULL, CLENDLOG_SR); + + l = sr->loglst; + for (list_front(l); !list_at_end(l); list_advance(l)) { + Log *lg = list_val(l); + if (lg->close) { + rval = fclose (lg->lfile); + if (rval != 0) + eprintf ("Error closing log file:", __FILE__, __LINE__); + } + free (lg); + } + list_free(l); + sr->loglst = NULL; +} diff --git a/src/check_log.h b/src/check_log.h new file mode 100644 index 0000000..e0a4b29 --- /dev/null +++ b/src/check_log.h @@ -0,0 +1,47 @@ +/* + * Check: a unit test framework for C + * Copyright (C) 2001,2002 Arien Malec + * + * This library is free software; you can redistribute it and/or + * modify it under the terms of the GNU Lesser General Public + * License as published by the Free Software Foundation; either + * version 2.1 of the License, or (at your option) any later version. + * + * This library 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 + * Lesser General Public License for more details. + * + * You should have received a copy of the GNU Lesser General Public + * License along with this library; if not, write to the + * Free Software Foundation, Inc., 59 Temple Place - Suite 330, + * Boston, MA 02111-1307, USA. + */ + +#ifndef CHECK_LOG_H +#define CHECK_LOG_H + +void log_srunner_start (SRunner *sr); +void log_srunner_end (SRunner *sr); +void log_suite_start (SRunner *sr, Suite *s); +void log_suite_end (SRunner *sr, Suite *s); +void log_test_end (SRunner *sr, TestResult *tr); + +void stdout_lfun (SRunner *sr, FILE *file, enum print_output, + void *obj, enum cl_event evt); + +void lfile_lfun (SRunner *sr, FILE *file, enum print_output, + void *obj, enum cl_event evt); + +void xml_lfun (SRunner *sr, FILE *file, enum print_output, + void *obj, enum cl_event evt); + +void srunner_register_lfun (SRunner *sr, FILE *lfile, int close, + LFun lfun, enum print_output); + +FILE *srunner_open_lfile (SRunner *sr); +FILE *srunner_open_xmlfile (SRunner *sr); +void srunner_init_logging (SRunner *sr, enum print_output print_mode); +void srunner_end_logging (SRunner *sr); + +#endif /* CHECK_LOG_H */ diff --git a/src/check_msg.c b/src/check_msg.c new file mode 100644 index 0000000..ef2c543 --- /dev/null +++ b/src/check_msg.c @@ -0,0 +1,201 @@ +/* + * Check: a unit test framework for C + * Copyright (C) 2001 2002, Arien Malec + * + * This library is free software; you can redistribute it and/or + * modify it under the terms of the GNU Lesser General Public + * License as published by the Free Software Foundation; either + * version 2.1 of the License, or (at your option) any later version. + * + * This library 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 + * Lesser General Public License for more details. + * + * You should have received a copy of the GNU Lesser General Public + * License along with this library; if not, write to the + * Free Software Foundation, Inc., 59 Temple Place - Suite 330, + * Boston, MA 02111-1307, USA. + */ + +#include "config.h" + +#include +#include +#include +#include +#include + +#include "check_error.h" +#include "check.h" +#include "check_list.h" +#include "check_impl.h" +#include "check_msg.h" +#include "check_pack.h" + + +/* 'Pipe' is implemented as a temporary file to overcome message + * volume limitations outlined in bug #482012. This scheme works well + * with the existing usage wherein the parent does not begin reading + * until the child has done writing and exited. + * + * Pipe life cycle: + * - The parent creates a tmpfile(). + * - The fork() call has the effect of duplicating the file descriptor + * and copying (on write) the FILE* data structures. + * - The child writes to the file, and its dup'ed file descriptor and + * data structures are cleaned up on child process exit. + * - Before reading, the parent rewind()'s the file to reset both + * FILE* and underlying file descriptor location data. + * - When finished, the parent fclose()'s the FILE*, deleting the + * temporary file, per tmpfile()'s semantics. + * + * This scheme may break down if the usage changes to asynchronous + * reading and writing. + */ + +FILE *send_file1; +FILE *send_file2; + +static FILE * get_pipe(void); +static void setup_pipe (void); +static void teardown_pipe (void); +static TestResult *construct_test_result (RcvMsg *rmsg, int waserror); +static void tr_set_loc_by_ctx (TestResult *tr, enum ck_result_ctx ctx, + RcvMsg *rmsg); +static FILE * get_pipe(void) +{ + if (send_file2 != 0) { + return send_file2; + } + + if (send_file1 != 0) { + return send_file1; + } + + eprintf("No messaging setup", __FILE__, __LINE__); + + return NULL; +} + +void send_failure_info(const char *msg) +{ + FailMsg fmsg; + + fmsg.msg = (char *) msg; + ppack(fileno(get_pipe()), CK_MSG_FAIL, (CheckMsg *) &fmsg); +} + +void send_loc_info(const char * file, int line) +{ + LocMsg lmsg; + + lmsg.file = (char *) file; + lmsg.line = line; + ppack(fileno(get_pipe()), CK_MSG_LOC, (CheckMsg *) &lmsg); +} + +void send_ctx_info(enum ck_result_ctx ctx) +{ + CtxMsg cmsg; + + cmsg.ctx = ctx; + ppack(fileno(get_pipe()), CK_MSG_CTX, (CheckMsg *) &cmsg); +} + +TestResult *receive_test_result (int waserror) +{ + FILE *fp; + RcvMsg *rmsg; + TestResult *result; + + fp = get_pipe(); + if (fp == NULL) + eprintf ("Couldn't find pipe",__FILE__, __LINE__); + rewind(fp); + rmsg = punpack (fileno(fp)); + teardown_pipe(); + setup_pipe(); + + result = construct_test_result (rmsg, waserror); + rcvmsg_free(rmsg); + return result; +} + +static void tr_set_loc_by_ctx (TestResult *tr, enum ck_result_ctx ctx, + RcvMsg *rmsg) +{ + if (ctx == CK_CTX_TEST) { + tr->file = rmsg->test_file; + tr->line = rmsg->test_line; + rmsg->test_file = NULL; + rmsg->test_line = -1; + } else { + tr->file = rmsg->fixture_file; + tr->line = rmsg->fixture_line; + rmsg->fixture_file = NULL; + rmsg->fixture_line = -1; + } +} + +static TestResult *construct_test_result (RcvMsg *rmsg, int waserror) +{ + TestResult *tr; + + if (rmsg == NULL) + return NULL; + + tr = tr_create(); + + if (rmsg->msg != NULL || waserror) { + tr->ctx = (cur_fork_status () == CK_FORK) ? rmsg->lastctx : rmsg->failctx; + tr->msg = rmsg->msg; + rmsg->msg = NULL; + tr_set_loc_by_ctx (tr, tr->ctx, rmsg); + } else if (rmsg->lastctx == CK_CTX_SETUP) { + tr->ctx = CK_CTX_SETUP; + tr->msg = NULL; + tr_set_loc_by_ctx (tr, CK_CTX_SETUP, rmsg); + } else { + tr->ctx = CK_CTX_TEST; + tr->msg = NULL; + tr_set_loc_by_ctx (tr, CK_CTX_TEST, rmsg); + } + + return tr; +} + +void setup_messaging(void) +{ + setup_pipe(); +} + +void teardown_messaging(void) +{ + teardown_pipe(); +} + +static void setup_pipe(void) +{ + if (send_file1 != 0) { + if (send_file2 != 0) + eprintf("Only one nesting of suite runs supported", __FILE__, __LINE__); + send_file2 = tmpfile(); + } else { + send_file1 = tmpfile(); + } +} + +static void teardown_pipe(void) +{ + if (send_file2 != 0) { + fclose(send_file2); + send_file2 = 0; + } else if (send_file1 != 0) { + fclose(send_file1); + send_file1 = 0; + } else { + eprintf("No messaging setup", __FILE__, __LINE__); + } +} + diff --git a/src/check_msg.h b/src/check_msg.h new file mode 100644 index 0000000..c4d7f25 --- /dev/null +++ b/src/check_msg.h @@ -0,0 +1,36 @@ +/* + * Check: a unit test framework for C + * Copyright (C) 2001, 2002 Arien Malec + * + * This library is free software; you can redistribute it and/or + * modify it under the terms of the GNU Lesser General Public + * License as published by the Free Software Foundation; either + * version 2.1 of the License, or (at your option) any later version. + * + * This library 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 + * Lesser General Public License for more details. + * + * You should have received a copy of the GNU Lesser General Public + * License along with this library; if not, write to the + * Free Software Foundation, Inc., 59 Temple Place - Suite 330, + * Boston, MA 02111-1307, USA. + */ + +#ifndef CHECK_MSG_NEW_H +#define CHECK_MSG_NEW_H + + +/* Functions implementing messaging during test runs */ + +void send_failure_info(const char *msg); +void send_loc_info(const char *file, int line); +void send_ctx_info(enum ck_result_ctx ctx); + +TestResult *receive_test_result(int waserror); + +void setup_messaging(void); +void teardown_messaging(void); + +#endif /*CHECK_MSG_NEW_H */ diff --git a/src/check_pack.c b/src/check_pack.c new file mode 100644 index 0000000..1c2d689 --- /dev/null +++ b/src/check_pack.c @@ -0,0 +1,417 @@ +/* + * Check: a unit test framework for C + * Copyright (C) 2001, 2002 Arien Malec + * + * This library is free software; you can redistribute it and/or + * modify it under the terms of the GNU Lesser General Public + * License as published by the Free Software Foundation; either + * version 2.1 of the License, or (at your option) any later version. + * + * This library 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 + * Lesser General Public License for more details. + * + * You should have received a copy of the GNU Lesser General Public + * License along with this library; if not, write to the + * Free Software Foundation, Inc., 59 Temple Place - Suite 330, + * Boston, MA 02111-1307, USA. + */ + +#include "config.h" + +#include +#include +#include + +#ifdef HAVE_UNISTD_H +#include +#endif + +#ifdef HAVE_STDINT_H +#include +#endif + +#include "check.h" +#include "check_error.h" +#include "check_list.h" +#include "check_impl.h" +#include "check_pack.h" + +/* typedef an unsigned int that has at least 4 bytes */ +typedef uint32_t ck_uint32; + + +static void pack_int (char **buf, int val); +static int upack_int (char **buf); +static void pack_str (char **buf, const char *str); +static char *upack_str (char **buf); + +static int pack_ctx (char **buf, CtxMsg *cmsg); +static int pack_loc (char **buf, LocMsg *lmsg); +static int pack_fail (char **buf, FailMsg *fmsg); +static void upack_ctx (char **buf, CtxMsg *cmsg); +static void upack_loc (char **buf, LocMsg *lmsg); +static void upack_fail (char **buf, FailMsg *fmsg); + +static void check_type (int type, const char *file, int line); +static enum ck_msg_type upack_type (char **buf); +static void pack_type (char **buf, enum ck_msg_type type); + +static int read_buf (int fdes, char **buf); +static int get_result (char *buf, RcvMsg *rmsg); +static void rcvmsg_update_ctx (RcvMsg *rmsg, enum ck_result_ctx ctx); +static void rcvmsg_update_loc (RcvMsg *rmsg, const char *file, int line); +static RcvMsg *rcvmsg_create (void); +void rcvmsg_free (RcvMsg *rmsg); + +typedef int (*pfun) (char **, CheckMsg *); +typedef void (*upfun) (char **, CheckMsg *); + +static pfun pftab [] = { + (pfun) pack_ctx, + (pfun) pack_fail, + (pfun) pack_loc +}; + +static upfun upftab [] = { + (upfun) upack_ctx, + (upfun) upack_fail, + (upfun) upack_loc +}; + +int pack (enum ck_msg_type type, char **buf, CheckMsg *msg) +{ + if (buf == NULL) + return -1; + if (msg == NULL) + return 0; + + check_type (type, __FILE__, __LINE__); + + return pftab[type] (buf, msg); +} + +int upack (char *buf, CheckMsg *msg, enum ck_msg_type *type) +{ + char *obuf; + int nread; + + if (buf == NULL) + return -1; + + obuf = buf; + + *type = upack_type (&buf); + + check_type (*type, __FILE__, __LINE__); + + upftab[*type] (&buf, msg); + + nread = buf - obuf; + return nread; +} + +static void pack_int (char **buf, int val) +{ + unsigned char *ubuf = (unsigned char *) *buf; + ck_uint32 uval = val; + + ubuf[0] = (uval >> 24) & 0xFF; + ubuf[1] = (uval >> 16) & 0xFF; + ubuf[2] = (uval >> 8) & 0xFF; + ubuf[3] = uval & 0xFF; + + *buf += 4; +} + +static int upack_int (char **buf) +{ + unsigned char *ubuf = (unsigned char *) *buf; + ck_uint32 uval; + + uval = ((ubuf[0] << 24) | (ubuf[1] << 16) | (ubuf[2] << 8) | ubuf[3]); + + *buf += 4; + + return (int) uval; +} + +static void pack_str (char **buf, const char *val) +{ + int strsz; + + if (val == NULL) + strsz = 0; + else + strsz = strlen (val); + + pack_int (buf, strsz); + + if (strsz > 0) { + memcpy (*buf, val, strsz); + *buf += strsz; + } +} + +static char *upack_str (char **buf) +{ + char *val; + int strsz; + + strsz = upack_int (buf); + + if (strsz > 0) { + val = emalloc (strsz + 1); + memcpy (val, *buf, strsz); + val[strsz] = 0; + *buf += strsz; + } else { + val = emalloc (1); + *val = 0; + } + + return val; +} + +static void pack_type (char **buf, enum ck_msg_type type) +{ + pack_int (buf, (int) type); +} + +static enum ck_msg_type upack_type (char **buf) +{ + return (enum ck_msg_type) upack_int (buf); +} + + +static int pack_ctx (char **buf, CtxMsg *cmsg) +{ + char *ptr; + int len; + + len = 4 + 4; + *buf = ptr = emalloc (len); + + pack_type (&ptr, CK_MSG_CTX); + pack_int (&ptr, (int) cmsg->ctx); + + return len; +} + +static void upack_ctx (char **buf, CtxMsg *cmsg) +{ + cmsg->ctx = upack_int (buf); +} + +static int pack_loc (char **buf, LocMsg *lmsg) +{ + char *ptr; + int len; + + len = 4 + 4 + (lmsg->file ? strlen (lmsg->file) : 0) + 4; + *buf = ptr = emalloc (len); + + pack_type (&ptr, CK_MSG_LOC); + pack_str (&ptr, lmsg->file); + pack_int (&ptr, lmsg->line); + + return len; +} + +static void upack_loc (char **buf, LocMsg *lmsg) +{ + lmsg->file = upack_str (buf); + lmsg->line = upack_int (buf); +} + +static int pack_fail (char **buf, FailMsg *fmsg) +{ + char *ptr; + int len; + + len = 4 + 4 + (fmsg->msg ? strlen (fmsg->msg) : 0); + *buf = ptr = emalloc (len); + + pack_type (&ptr, CK_MSG_FAIL); + pack_str (&ptr, fmsg->msg); + + return len; +} + +static void upack_fail (char **buf, FailMsg *fmsg) +{ + fmsg->msg = upack_str (buf); +} + +static void check_type (int type, const char *file, int line) +{ + if (type < 0 || type >= CK_MSG_LAST) + eprintf ("Bad message type arg", file, line); +} + +void ppack (int fdes, enum ck_msg_type type, CheckMsg *msg) +{ + char *buf; + int n; + ssize_t r; + + n = pack (type, &buf, msg); + r = write (fdes, buf, n); + if (r == -1) + eprintf ("Error in ppack:",__FILE__,__LINE__); + + free (buf); +} + +static int read_buf (int fdes, char **buf) +{ + char *readloc; + int n; + int nread = 0; + int size = 1; + int grow = 2; + + *buf = emalloc(size); + readloc = *buf; + while (1) { + n = read (fdes, readloc, size - nread); + if (n == 0) + break; + if (n == -1) + eprintf ("Error in read_buf:", __FILE__, __LINE__); + + nread += n; + size *= grow; + *buf = erealloc (*buf,size); + readloc = *buf + nread; + } + + return nread; +} + + +static int get_result (char *buf, RcvMsg *rmsg) +{ + enum ck_msg_type type; + CheckMsg msg; + int n; + + n = upack (buf, &msg, &type); + if (n == -1) + eprintf ("Error in upack", __FILE__, __LINE__); + + if (type == CK_MSG_CTX) { + CtxMsg *cmsg = (CtxMsg *) &msg; + rcvmsg_update_ctx (rmsg, cmsg->ctx); + } else if (type == CK_MSG_LOC) { + LocMsg *lmsg = (LocMsg *) &msg; + if (rmsg->failctx == -1) + { + rcvmsg_update_loc (rmsg, lmsg->file, lmsg->line); + } + free (lmsg->file); + } else if (type == CK_MSG_FAIL) { + FailMsg *fmsg = (FailMsg *) &msg; + if (rmsg->msg == NULL) + { + rmsg->msg = emalloc (strlen (fmsg->msg) + 1); + strcpy (rmsg->msg, fmsg->msg); + rmsg->failctx = rmsg->lastctx; + } + else + { + /* Skip subsequent failure messages, only happens for CK_NOFORK */ + } + free (fmsg->msg); + } else + check_type (type, __FILE__, __LINE__); + + return n; +} + +static void reset_rcv_test (RcvMsg *rmsg) +{ + rmsg->test_line = -1; + rmsg->test_file = NULL; +} + +static void reset_rcv_fixture (RcvMsg *rmsg) +{ + rmsg->fixture_line = -1; + rmsg->fixture_file = NULL; +} + +static RcvMsg *rcvmsg_create (void) +{ + RcvMsg *rmsg; + + rmsg = emalloc (sizeof (RcvMsg)); + rmsg->lastctx = -1; + rmsg->failctx = -1; + rmsg->msg = NULL; + reset_rcv_test (rmsg); + reset_rcv_fixture (rmsg); + return rmsg; +} + +void rcvmsg_free (RcvMsg *rmsg) +{ + free(rmsg->fixture_file); + free(rmsg->test_file); + free(rmsg->msg); + free(rmsg); +} + +static void rcvmsg_update_ctx (RcvMsg *rmsg, enum ck_result_ctx ctx) +{ + if (rmsg->lastctx != -1) + { + free(rmsg->fixture_file); + reset_rcv_fixture (rmsg); + } + rmsg->lastctx = ctx; +} + +static void rcvmsg_update_loc (RcvMsg *rmsg, const char *file, int line) +{ + int flen = strlen(file); + + if (rmsg->lastctx == CK_CTX_TEST) { + free(rmsg->test_file); + rmsg->test_line = line; + rmsg->test_file = emalloc (flen + 1); + strcpy (rmsg->test_file, file); + } else { + free(rmsg->fixture_file); + rmsg->fixture_line = line; + rmsg->fixture_file = emalloc (flen + 1); + strcpy (rmsg->fixture_file, file); + } +} + +RcvMsg *punpack (int fdes) +{ + int nread, n; + char *buf; + char *obuf; + RcvMsg *rmsg; + + nread = read_buf (fdes, &buf); + obuf = buf; + rmsg = rcvmsg_create (); + + while (nread > 0) { + n = get_result (buf, rmsg); + nread -= n; + buf += n; + } + + free (obuf); + if (rmsg->lastctx == -1) { + free (rmsg); + rmsg = NULL; + } + + return rmsg; +} diff --git a/src/check_pack.h b/src/check_pack.h new file mode 100644 index 0000000..0b78695 --- /dev/null +++ b/src/check_pack.h @@ -0,0 +1,76 @@ +/* + * Check: a unit test framework for C + * Copyright (C) 2001, 2002 Arien Malec + * + * This library is free software; you can redistribute it and/or + * modify it under the terms of the GNU Lesser General Public + * License as published by the Free Software Foundation; either + * version 2.1 of the License, or (at your option) any later version. + * + * This library 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 + * Lesser General Public License for more details. + * + * You should have received a copy of the GNU Lesser General Public + * License along with this library; if not, write to the + * Free Software Foundation, Inc., 59 Temple Place - Suite 330, + * Boston, MA 02111-1307, USA. + */ + +#ifndef CHECK_PACK_H +#define CHECK_PACK_H + + +enum ck_msg_type { + CK_MSG_CTX, + CK_MSG_FAIL, + CK_MSG_LOC, + CK_MSG_LAST +}; + +typedef struct CtxMsg +{ + enum ck_result_ctx ctx; +} CtxMsg; + +typedef struct LocMsg +{ + int line; + char *file; +} LocMsg; + +typedef struct FailMsg +{ + char *msg; +} FailMsg; + +typedef union +{ + CtxMsg ctx_msg; + FailMsg fail_msg; + LocMsg loc_msg; +} CheckMsg; + +typedef struct RcvMsg +{ + enum ck_result_ctx lastctx; + enum ck_result_ctx failctx; + char *fixture_file; + int fixture_line; + char *test_file; + int test_line; + char *msg; +} RcvMsg; + +void rcvmsg_free (RcvMsg *rmsg); + + +int pack (enum ck_msg_type type, char **buf, CheckMsg *msg); +int upack (char *buf, CheckMsg *msg, enum ck_msg_type *type); + +void ppack (int fdes, enum ck_msg_type type, CheckMsg *msg); +RcvMsg *punpack (int fdes); + + +#endif /*CHECK_PACK_H */ diff --git a/src/check_print.c b/src/check_print.c new file mode 100644 index 0000000..3e011ea --- /dev/null +++ b/src/check_print.c @@ -0,0 +1,151 @@ +/* + * Check: a unit test framework for C + * Copyright (C) 2001, 2002 Arien Malec + * + * This library is free software; you can redistribute it and/or + * modify it under the terms of the GNU Lesser General Public + * License as published by the Free Software Foundation; either + * version 2.1 of the License, or (at your option) any later version. + * + * This library 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 + * Lesser General Public License for more details. + * + * You should have received a copy of the GNU Lesser General Public + * License along with this library; if not, write to the + * Free Software Foundation, Inc., 59 Temple Place - Suite 330, + * Boston, MA 02111-1307, USA. + */ + +#include "config.h" + +#include +#include +#include + +#include "check.h" +#include "check_list.h" +#include "check_impl.h" +#include "check_str.h" +#include "check_print.h" + +static void srunner_fprint_summary (FILE *file, SRunner *sr, + enum print_output print_mode); +static void srunner_fprint_results (FILE *file, SRunner *sr, + enum print_output print_mode); + + +void srunner_print (SRunner *sr, enum print_output print_mode) +{ + srunner_fprint (stdout, sr, print_mode); +} + +void srunner_fprint (FILE *file, SRunner *sr, enum print_output print_mode) +{ + if (print_mode == CK_ENV) { + print_mode = get_env_printmode(); + } + + srunner_fprint_summary (file, sr, print_mode); + srunner_fprint_results (file, sr, print_mode); +} + +static void srunner_fprint_summary (FILE *file, SRunner *sr, + enum print_output print_mode) +{ + if (print_mode >= CK_MINIMAL) { + char *str; + + str = sr_stat_str (sr); + fprintf (file, "%s\n", str); + free(str); + } + return; +} + +static void srunner_fprint_results (FILE *file, SRunner *sr, + enum print_output print_mode) +{ + List *resultlst; + + resultlst = sr->resultlst; + + for (list_front(resultlst); !list_at_end(resultlst); list_advance(resultlst)) { + TestResult *tr = list_val(resultlst); + tr_fprint (file, tr, print_mode); + } + return; +} + +void tr_fprint (FILE *file, TestResult *tr, enum print_output print_mode) +{ + if (print_mode == CK_ENV) { + print_mode = get_env_printmode(); + } + + if ((print_mode >= CK_VERBOSE && tr->rtype == CK_PASS) || + (tr->rtype != CK_PASS && print_mode >= CK_NORMAL)) { + char *trstr = tr_str (tr); + fprintf (file,"%s\n", trstr); + free(trstr); + } +} + +void tr_xmlprint (FILE *file, TestResult *tr, enum print_output print_mode) +{ + char result[10]; + char *path_name; + char *file_name; + char *slash; + + switch (tr->rtype) { + case CK_PASS: + strcpy(result, "success"); + break; + case CK_FAILURE: + strcpy(result, "failure"); + break; + case CK_ERROR: + strcpy(result, "error"); + break; + } + + slash = strrchr(tr->file, '/'); + if (slash == NULL) { + path_name = (char*)"."; + file_name = tr->file; + } else { + path_name = strdup(tr->file); + path_name[slash - tr->file] = 0; /* Terminate the temporary string. */ + file_name = slash + 1; + } + + + fprintf(file, " \n", result); + fprintf(file, " %s\n", path_name); + fprintf(file, " %s:%d\n", file_name, tr->line); + fprintf(file, " %s\n", tr->tname); + fprintf(file, " %d\n", tr->iter); + fprintf(file, " %s\n", tr->tcname); + fprintf(file, " %s\n", tr->msg); + fprintf(file, " \n"); + + if (slash != NULL) { + free(path_name); + } +} + +enum print_output get_env_printmode (void) +{ + char *env = getenv ("CK_VERBOSITY"); + if (env == NULL) + return CK_NORMAL; + if (strcmp (env, "silent") == 0) + return CK_SILENT; + if (strcmp (env, "minimal") == 0) + return CK_MINIMAL; + if (strcmp (env, "verbose") == 0) + return CK_VERBOSE; + return CK_NORMAL; +} diff --git a/src/check_print.h b/src/check_print.h new file mode 100644 index 0000000..f4b02da --- /dev/null +++ b/src/check_print.h @@ -0,0 +1,30 @@ +/* + * Check: a unit test framework for C + * Copyright (C) 2001, 2002 Arien Malec + * + * This library is free software; you can redistribute it and/or + * modify it under the terms of the GNU Lesser General Public + * License as published by the Free Software Foundation; either + * version 2.1 of the License, or (at your option) any later version. + * + * This library 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 + * Lesser General Public License for more details. + * + * You should have received a copy of the GNU Lesser General Public + * License along with this library; if not, write to the + * Free Software Foundation, Inc., 59 Temple Place - Suite 330, + * Boston, MA 02111-1307, USA. + */ + +#ifndef CHECK_PRINT_H +#define CHECK_PRINT_H + +void tr_fprint (FILE *file, TestResult *tr, enum print_output print_mode); +void tr_xmlprint (FILE *file, TestResult *tr, enum print_output print_mode); +void srunner_fprint (FILE *file, SRunner *sr, enum print_output print_mode); +enum print_output get_env_printmode (void); + + +#endif /* CHECK_PRINT_H */ diff --git a/src/check_run.c b/src/check_run.c new file mode 100644 index 0000000..72942ad --- /dev/null +++ b/src/check_run.c @@ -0,0 +1,550 @@ +/* + * Check: a unit test framework for C + * Copyright (C) 2001, 2002 Arien Malec + * + * This library is free software; you can redistribute it and/or + * modify it under the terms of the GNU Lesser General Public + * License as published by the Free Software Foundation; either + * version 2.1 of the License, or (at your option) any later version. + * + * This library 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 + * Lesser General Public License for more details. + * + * You should have received a copy of the GNU Lesser General Public + * License along with this library; if not, write to the + * Free Software Foundation, Inc., 59 Temple Place - Suite 330, + * Boston, MA 02111-1307, USA. + */ + +#define _GNU_SOURCE +#include "config.h" + +#include +#include +#include +#include +#include +#include +#include +#include + +#include "check.h" +#include "check_error.h" +#include "check_list.h" +#include "check_impl.h" +#include "check_msg.h" +#include "check_log.h" + + +enum rinfo { + CK_R_SIG, + CK_R_PASS, + CK_R_EXIT, + CK_R_FAIL_TEST, + CK_R_FAIL_FIXTURE +}; + +enum tf_type { + CK_FORK_TEST, + CK_NOFORK_TEST, + CK_NOFORK_FIXTURE +}; + +static void srunner_run_init (SRunner *sr, enum print_output print_mode); +static void srunner_run_end (SRunner *sr, enum print_output print_mode); +static void srunner_iterate_suites (SRunner *sr, + enum print_output print_mode); +static void srunner_run_tcase (SRunner *sr, TCase *tc); +static int srunner_run_unchecked_setup (SRunner *sr, TCase *tc); +static void srunner_run_unchecked_teardown (SRunner *sr, TCase *tc); +static TestResult * tcase_run_checked_setup (SRunner *sr, TCase *tc); +static void tcase_run_checked_teardown (TCase *tc); +static void srunner_iterate_tcase_tfuns (SRunner *sr, TCase *tc); +static void srunner_add_failure (SRunner *sr, TestResult *tf); +static TestResult *tcase_run_tfun_fork (SRunner *sr, TCase *tc, TF *tf, int i); +static TestResult *tcase_run_tfun_nofork (SRunner *sr, TCase *tc, TF *tf, int i); +static TestResult *receive_result_info_fork (const char *tcname, + const char *tname, + int iter, + int status, int expected_signal); +static TestResult *receive_result_info_nofork (const char *tcname, + const char *tname, + int iter); +static void set_fork_info (TestResult *tr, int status, int expected_signal); +static void set_nofork_info (TestResult *tr); +static char *signal_msg (int sig); +static char *signal_error_msg (int signal_received, int signal_expected); +static char *pass_msg (void); +static char *exit_msg (int exitstatus); +static int waserror (int status, int expected_signal); + +#define MSG_LEN 100 + +static int alarm_received; +static pid_t group_pid; + +static void sig_handler(int sig_nr) +{ + switch (sig_nr) { + case SIGALRM: + alarm_received = 1; + killpg(group_pid, SIGKILL); + break; + default: + eprintf("Unhandled signal: %d", __FILE__, __LINE__, sig_nr); + break; + } +} + +static void srunner_run_init (SRunner *sr, enum print_output print_mode) +{ + set_fork_status(srunner_fork_status(sr)); + setup_messaging(); + srunner_init_logging (sr, print_mode); + log_srunner_start (sr); +} + +static void srunner_run_end (SRunner *sr, enum print_output print_mode) +{ + log_srunner_end (sr); + srunner_end_logging (sr); + teardown_messaging(); + set_fork_status(CK_FORK); +} + +static void srunner_iterate_suites (SRunner *sr, + enum print_output print_mode) + +{ + List *slst; + List *tcl; + TCase *tc; + + slst = sr->slst; + + for (list_front(slst); !list_at_end(slst); list_advance(slst)) { + Suite *s = list_val(slst); + + log_suite_start (sr, s); + + tcl = s->tclst; + + for (list_front(tcl);!list_at_end (tcl); list_advance (tcl)) { + tc = list_val (tcl); + srunner_run_tcase (sr, tc); + } + + log_suite_end (sr, s); + } +} + +void srunner_run_all (SRunner *sr, enum print_output print_mode) +{ + struct sigaction old_action; + struct sigaction new_action; + + if (sr == NULL) + return; + if (print_mode < 0 || print_mode >= CK_LAST) + eprintf("Bad print_mode argument to srunner_run_all: %d", + __FILE__, __LINE__, print_mode); + + memset(&new_action, 0, sizeof new_action); + new_action.sa_handler = sig_handler; + sigaction(SIGALRM, &new_action, &old_action); + srunner_run_init (sr, print_mode); + srunner_iterate_suites (sr, print_mode); + srunner_run_end (sr, print_mode); + sigaction(SIGALRM, &old_action, NULL); +} + +static void srunner_add_failure (SRunner *sr, TestResult *tr) +{ + list_add_end (sr->resultlst, tr); + /* If the context is either of these, the test has run. */ + if ((tr->ctx == CK_CTX_TEST) || (tr->ctx == CK_CTX_TEARDOWN)) + sr->stats->n_checked++; + if (tr->rtype == CK_FAILURE) + sr->stats->n_failed++; + else if (tr->rtype == CK_ERROR) + sr->stats->n_errors++; + +} + +static void srunner_iterate_tcase_tfuns (SRunner *sr, TCase *tc) +{ + List *tfl; + TF *tfun; + TestResult *tr = NULL; + + tfl = tc->tflst; + + for (list_front(tfl); !list_at_end (tfl); list_advance (tfl)) { + int i; + tfun = list_val (tfl); + + for (i = tfun->loop_start; i < tfun->loop_end; i++) + { + switch (srunner_fork_status(sr)) { + case CK_FORK: + tr = tcase_run_tfun_fork (sr, tc, tfun, i); + break; + case CK_NOFORK: + tr = tcase_run_tfun_nofork (sr, tc, tfun, i); + break; + default: + eprintf("Bad fork status in SRunner", __FILE__, __LINE__); + } + srunner_add_failure (sr, tr); + log_test_end(sr, tr); + } + } +} + +static int srunner_run_unchecked_setup (SRunner *sr, TCase *tc) +{ + TestResult *tr; + List *l; + Fixture *f; + int rval = 1; + + set_fork_status(CK_NOFORK); + + l = tc->unch_sflst; + + for (list_front(l); !list_at_end(l); list_advance(l)) { + send_ctx_info(CK_CTX_SETUP); + f = list_val(l); + f->fun(); + + tr = receive_result_info_nofork (tc->name, "unchecked_setup", 0); + + if (tr->rtype != CK_PASS) { + srunner_add_failure(sr, tr); + rval = 0; + break; + } + free(tr->file); + free(tr->msg); + free(tr); + } + + set_fork_status(srunner_fork_status(sr)); + return rval; +} + +static TestResult * tcase_run_checked_setup (SRunner *sr, TCase *tc) +{ + TestResult *tr = NULL; + List *l; + Fixture *f; + enum fork_status fstat = srunner_fork_status(sr); + + l = tc->ch_sflst; + if (fstat == CK_FORK) { + send_ctx_info(CK_CTX_SETUP); + } + + for (list_front(l); !list_at_end(l); list_advance(l)) { + if (fstat == CK_NOFORK) { + send_ctx_info(CK_CTX_SETUP); + } + f = list_val(l); + f->fun(); + + /* Stop the setup and return the failure if nofork mode. */ + if (fstat == CK_NOFORK) { + tr = receive_result_info_nofork (tc->name, "checked_setup", 0); + if (tr->rtype != CK_PASS) { + break; + } + + free(tr->file); + free(tr->msg); + free(tr); + tr = NULL; + } + } + + return tr; +} + +static void tcase_run_checked_teardown (TCase *tc) +{ + List *l; + Fixture *f; + + l = tc->ch_tflst; + + send_ctx_info(CK_CTX_TEARDOWN); + + for (list_front(l); !list_at_end(l); list_advance(l)) { + f = list_val(l); + f->fun(); + } +} + +static void srunner_run_unchecked_teardown (SRunner *sr, TCase *tc) +{ + List *l; + Fixture *f; + + set_fork_status(CK_NOFORK); + l = tc->unch_tflst; + + for (list_front(l); !list_at_end(l); list_advance(l)) { + + f = list_val(l); + send_ctx_info(CK_CTX_TEARDOWN); + f->fun (); + } + set_fork_status(srunner_fork_status(sr)); +} + +static void srunner_run_tcase (SRunner *sr, TCase *tc) +{ + if (srunner_run_unchecked_setup(sr,tc)) { + srunner_iterate_tcase_tfuns(sr,tc); + srunner_run_unchecked_teardown(sr, tc); + } +} + +static TestResult *receive_result_info_fork (const char *tcname, + const char *tname, + int iter, + int status, int expected_signal) +{ + TestResult *tr; + + tr = receive_test_result(waserror(status, expected_signal)); + if (tr == NULL) + eprintf("Failed to receive test result", __FILE__, __LINE__); + tr->tcname = tcname; + tr->tname = tname; + tr->iter = iter; + set_fork_info(tr, status, expected_signal); + + return tr; +} + +static TestResult *receive_result_info_nofork (const char *tcname, + const char *tname, + int iter) +{ + TestResult *tr; + + tr = receive_test_result(0); + if (tr == NULL) + eprintf("Failed to receive test result", __FILE__, __LINE__); + tr->tcname = tcname; + tr->tname = tname; + tr->iter = iter; + set_nofork_info(tr); + + return tr; +} + +static void set_fork_info (TestResult *tr, int status, int signal_expected) +{ + int was_sig = WIFSIGNALED(status); + int was_exit = WIFEXITED(status); + int exit_status = WEXITSTATUS(status); + int signal_received = WTERMSIG(status); + + if (was_sig) { + if (signal_expected == signal_received) { + if (alarm_received) { + /* Got alarm instead of signal */ + tr->rtype = CK_ERROR; + tr->msg = signal_error_msg(signal_received, signal_expected); + } else { + tr->rtype = CK_PASS; + tr->msg = pass_msg(); + } + } else if (signal_expected != 0) { + /* signal received, but not the expected one */ + tr->rtype = CK_ERROR; + tr->msg = signal_error_msg(signal_received, signal_expected); + } else { + /* signal received and none expected */ + tr->rtype = CK_ERROR; + tr->msg = signal_msg(signal_received); + } + } else if (signal_expected == 0) { + if (was_exit && exit_status == 0) { + tr->rtype = CK_PASS; + tr->msg = pass_msg(); + } else if (was_exit && exit_status != 0) { + if (tr->msg == NULL) { /* early exit */ + tr->rtype = CK_ERROR; + tr->msg = exit_msg(exit_status); + } else { + tr->rtype = CK_FAILURE; + } + } + } else { /* a signal was expected and none raised */ + if (was_exit) { + tr->msg = exit_msg(exit_status); + if (exit_status == 0) + tr->rtype = CK_FAILURE; /* normal exit status */ + else + tr->rtype = CK_FAILURE; /* early exit */ + } + } +} + +static void set_nofork_info (TestResult *tr) +{ + if (tr->msg == NULL) { + tr->rtype = CK_PASS; + tr->msg = pass_msg(); + } else { + tr->rtype = CK_FAILURE; + } +} + +static TestResult *tcase_run_tfun_nofork (SRunner *sr, TCase *tc, TF *tfun, int i) +{ + TestResult *tr; + + tr = tcase_run_checked_setup(sr, tc); + if (tr == NULL) { + tfun->fn(i); + tcase_run_checked_teardown(tc); + return receive_result_info_nofork(tc->name, tfun->name, i); + } + + return tr; +} + + +static TestResult *tcase_run_tfun_fork (SRunner *sr, TCase *tc, TF *tfun, int i) +{ + pid_t pid_w; + pid_t pid; + int status = 0; + pid = fork(); + if (pid == -1) + eprintf("Unable to fork:",__FILE__,__LINE__); + if (pid == 0) { + setpgid(0, 0); + group_pid = getpgid(0); + tcase_run_checked_setup(sr, tc); + tfun->fn(i); + tcase_run_checked_teardown(tc); + exit(EXIT_SUCCESS); + } else { + group_pid = getpgid(pid); + } + + alarm_received = 0; + alarm(tc->timeout); + do { + pid_w = waitpid(pid, &status, 0); + } while (pid_w == -1); + + killpg(pid, SIGKILL); /* Kill remaining processes. */ + + return receive_result_info_fork(tc->name, tfun->name, i, status, tfun->signal); +} + +static char *signal_error_msg (int signal_received, int signal_expected) +{ + char *sig_r_str; + char *sig_e_str; + char *msg = emalloc (MSG_LEN); /* free'd by caller */ + sig_r_str = strdup(strsignal(signal_received)); + sig_e_str = strdup(strsignal(signal_expected)); + if (alarm_received) { + snprintf (msg, MSG_LEN, "Test timeout expired, expected signal %d (%s)", + signal_expected, sig_e_str); + } else { + snprintf (msg, MSG_LEN, "Received signal %d (%s), expected %d (%s)", + signal_received, sig_r_str, signal_expected, sig_e_str); + } + free(sig_r_str); + free(sig_e_str); + return msg; +} + +static char *signal_msg (int signal) +{ + char *msg = emalloc(MSG_LEN); /* free'd by caller */ + if (alarm_received) { + snprintf(msg, MSG_LEN, "Test timeout expired"); + } else { + snprintf(msg, MSG_LEN, "Received signal %d (%s)", + signal, strsignal(signal)); + } + return msg; +} + +static char *exit_msg (int exitval) +{ + char *msg = emalloc(MSG_LEN); /* free'd by caller */ + snprintf (msg, MSG_LEN, + "Early exit with return value %d", exitval); + return msg; +} + +static char *pass_msg (void) +{ + char *msg = emalloc(sizeof("Passed")); + strcpy (msg, "Passed"); + return msg; +} + +enum fork_status srunner_fork_status (SRunner *sr) +{ + if (sr->fstat == CK_FORK_UNSPECIFIED) { + char *env = getenv ("CK_FORK"); + if (env == NULL) + return CK_FORK; + if (strcmp (env,"no") == 0) + return CK_NOFORK; + else + return CK_FORK; + } else + return sr->fstat; +} + +void srunner_set_fork_status (SRunner *sr, enum fork_status fstat) +{ + sr->fstat = fstat; +} + +pid_t check_fork (void) +{ + pid_t pid = fork(); + /* Set the process to a process group to be able to kill it easily. */ + setpgid(pid, group_pid); + return pid; +} + +void check_waitpid_and_exit (pid_t pid) +{ + pid_t pid_w; + int status; + + if (pid > 0) { + do { + pid_w = waitpid(pid, &status, 0); + } while (pid_w == -1); + if (waserror(status, 0)) + exit(EXIT_FAILURE); + } + exit(EXIT_SUCCESS); +} + +static int waserror (int status, int signal_expected) +{ + int was_sig = WIFSIGNALED (status); + int was_exit = WIFEXITED (status); + int exit_status = WEXITSTATUS (status); + int signal_received = WTERMSIG(status); + + return ((was_sig && (signal_received != signal_expected)) || + (was_exit && exit_status != 0)); +} diff --git a/src/check_str.c b/src/check_str.c new file mode 100644 index 0000000..4d3b456 --- /dev/null +++ b/src/check_str.c @@ -0,0 +1,118 @@ +/* + * Check: a unit test framework for C + * Copyright (C) 2001, 2002 Arien Malec + * + * This library is free software; you can redistribute it and/or + * modify it under the terms of the GNU Lesser General Public + * License as published by the Free Software Foundation; either + * version 2.1 of the License, or (at your option) any later version. + * + * This library 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 + * Lesser General Public License for more details. + * + * You should have received a copy of the GNU Lesser General Public + * License along with this library; if not, write to the + * Free Software Foundation, Inc., 59 Temple Place - Suite 330, + * Boston, MA 02111-1307, USA. + */ + +#include "config.h" + +#include +#include + +#include "check.h" +#include "check_list.h" +#include "check_error.h" +#include "check_impl.h" +#include "check_str.h" + +static const char *tr_type_str (TestResult *tr); +static int percent_passed (TestStats *t); + +char *tr_str (TestResult *tr) +{ + const char *exact_msg; + char *rstr; + + exact_msg = (tr->rtype == CK_ERROR) ? "(after this point) ": ""; + + rstr = ck_strdup_printf ("%s:%d:%s:%s:%s:%d: %s%s", + tr->file, tr->line, + tr_type_str(tr), tr->tcname, tr->tname, tr->iter, + exact_msg, tr->msg); + + return rstr; +} + +char *sr_stat_str (SRunner *sr) +{ + char *str; + TestStats *ts; + + ts = sr->stats; + + str = ck_strdup_printf ("%d%%: Checks: %d, Failures: %d, Errors: %d", + percent_passed (ts), ts->n_checked, ts->n_failed, + ts->n_errors); + + return str; +} + +char *ck_strdup_printf (const char *fmt, ...) +{ + /* Guess we need no more than 100 bytes. */ + int n, size = 100; + char *p; + va_list ap; + + p = emalloc (size); + + while (1) + { + /* Try to print in the allocated space. */ + va_start(ap, fmt); + n = vsnprintf (p, size, fmt, ap); + va_end(ap); + /* If that worked, return the string. */ + if (n > -1 && n < size) + return p; + + /* Else try again with more space. */ + if (n > -1) /* C99 conform vsnprintf() */ + size = n+1; /* precisely what is needed */ + else /* glibc 2.0 */ + size *= 2; /* twice the old size */ + + p = erealloc (p, size); + } +} + +static const char *tr_type_str (TestResult *tr) +{ + const char *str = NULL; + if (tr->ctx == CK_CTX_TEST) { + if (tr->rtype == CK_PASS) + str = "P"; + else if (tr->rtype == CK_FAILURE) + str = "F"; + else if (tr->rtype == CK_ERROR) + str = "E"; + } else + str = "S"; + + return str; +} + +static int percent_passed (TestStats *t) +{ + if (t->n_failed == 0 && t->n_errors == 0) + return 100; + else if (t->n_checked == 0) + return 0; + else + return (int) ( (float) (t->n_checked - (t->n_failed + t->n_errors)) / + (float) t->n_checked * 100); +} diff --git a/src/check_str.h b/src/check_str.h new file mode 100644 index 0000000..bef230f --- /dev/null +++ b/src/check_str.h @@ -0,0 +1,36 @@ +/* + * Check: a unit test framework for C + * Copyright (C) 2001, 2002 Arien Malec + * + * This library is free software; you can redistribute it and/or + * modify it under the terms of the GNU Lesser General Public + * License as published by the Free Software Foundation; either + * version 2.1 of the License, or (at your option) any later version. + * + * This library 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 + * Lesser General Public License for more details. + * + * You should have received a copy of the GNU Lesser General Public + * License along with this library; if not, write to the + * Free Software Foundation, Inc., 59 Temple Place - Suite 330, + * Boston, MA 02111-1307, USA. + */ + +#ifndef CHECK_STR_H +#define CHECK_STR_H + +/* Return a string representation of the given TestResult. Return + value has been malloc'd, and must be freed by the caller */ +char *tr_str (TestResult *tr); + +/* Return a string representation of the given SRunner's run + statistics (% passed, num run, passed, errors, failures). Return + value has been malloc'd, and must be freed by the caller +*/ +char *sr_stat_str (SRunner *sr); + +char *ck_strdup_printf (const char *fmt, ...); + +#endif /* CHECK_STR_H */ diff --git a/tests/Makefile.am b/tests/Makefile.am new file mode 100644 index 0000000..a0aa9fd --- /dev/null +++ b/tests/Makefile.am @@ -0,0 +1,43 @@ +## Process this file with automake to produce Makefile.in + +TESTS = \ + check_check \ + test_output.sh \ + test_xml_output.sh \ + test_log_output.sh + +noinst_PROGRAMS = \ + check_check \ + check_stress \ + ex_output \ + ex_xml_output \ + ex_log_output + +EXTRA_DIST = test_output.sh test_log_output.sh test_xml_output.sh + +if NO_TIMEOUT_TESTS +check_check_CFLAGS = -DTIMEOUT_TESTS_ENABLED=0 +endif + +check_check_SOURCES = \ + check_check.h \ + check_list.c \ + check_check_sub.c \ + check_check_master.c \ + check_check_msg.c \ + check_check_log.c \ + check_check_limit.c \ + check_check_fork.c \ + check_check_fixture.c \ + check_check_pack.c \ + check_check_main.c + +check_stress_SOURCES = check_stress.c +ex_output_SOURCES = ex_output.c +ex_log_output_SOURCES = ex_log_output.c +ex_xml_output_SOURCES = ex_xml_output.c + +AM_CPPFLAGS = -I$(top_srcdir)/src +LDADD = $(top_builddir)/src/libcheck.la + +CLEANFILES = *~ *.log *.xml test_logfile diff --git a/tests/check_check.h b/tests/check_check.h new file mode 100644 index 0000000..3a5b586 --- /dev/null +++ b/tests/check_check.h @@ -0,0 +1,28 @@ +#ifndef CHECK_CHECK_H +#define CHECK_CHECK_H + +#ifndef TIMEOUT_TESTS_ENABLED +#define TIMEOUT_TESTS_ENABLED 1 +#endif + +int sub_nfailed; +int sub_ntests; + +void fork_setup (void); +void fork_teardown (void); +void setup_fixture(void); +void teardown_fixture (void); +void setup (void); +void cleanup (void); +Suite *make_sub_suite(void); +Suite *make_sub2_suite(void); +Suite *make_master_suite(void); +Suite *make_list_suite(void); +Suite *make_msg_suite(void); +Suite *make_log_suite(void); +Suite *make_limit_suite(void); +Suite *make_fork_suite(void); +Suite *make_fixture_suite(void); +Suite *make_pack_suite(void); + +#endif /* CHECK_CHECK_H */ diff --git a/tests/check_check_fixture.c b/tests/check_check_fixture.c new file mode 100644 index 0000000..23175d8 --- /dev/null +++ b/tests/check_check_fixture.c @@ -0,0 +1,524 @@ +#include +#include +#include +#include +#include +#include "check_error.h" +#include "check_str.h" +#include "check_check.h" + +static char errm[200]; + +static void fixture_sub_setup (void) +{ + fail("Test failure in fixture"); +} + +static SRunner *fixture_sr; + +void setup_fixture (void) +{ + TCase *tc; + Suite *fixture_s; + + fixture_s = suite_create("Fix Sub"); + tc = tcase_create("Fix Sub"); + tcase_add_unchecked_fixture(tc, fixture_sub_setup, NULL); + suite_add_tcase (fixture_s, tc); + fixture_sr = srunner_create(fixture_s); + srunner_run_all(fixture_sr,CK_VERBOSE); +} + +void teardown_fixture (void) +{ + srunner_free(fixture_sr); +} + +START_TEST(test_fixture_fail_counts) +{ + int nrun, nfail; + + nrun = srunner_ntests_run(fixture_sr); + nfail = srunner_ntests_failed(fixture_sr); + + fail_unless (nrun == 0 && nfail == 1, + "Counts for run and fail for fixture failure not correct"); +} +END_TEST + +START_TEST(test_print_counts) +{ + char *srstat = sr_stat_str(fixture_sr); + const char *exp = "0%: Checks: 0, Failures: 1, Errors: 0"; + + fail_unless(strcmp(srstat, exp) == 0, + "SRunner stat string incorrect with setup failure"); + free(srstat); +} +END_TEST + +START_TEST(test_setup_failure_msg) +{ + TestResult **tra; + char *trm; + const char *trmexp = "check_check_fixture.c:14:S:Fix Sub:unchecked_setup:0: Test failure in fixture"; + + tra = srunner_failures(fixture_sr); + trm = tr_str(tra[0]); + free(tra); + + if (strstr(trm, trmexp) == 0) { + snprintf(errm, sizeof(errm), + "Bad setup tr msg (%s)", trm); + + fail (errm); + } + free(trm); +} +END_TEST + +int testval_up; +int testval_down; + +static void sub_ch_setup_norm (void) +{ + testval_up += 2; +} + +static void sub_ch_teardown_norm(void) +{ + testval_down += 2; +} + +START_TEST(test_sub_ch_setup_norm) +{ + if (testval_up == 1) + fail("Setup not run correctly"); + else if (testval_up > 3) + fail("Test side-effects persist across runs"); + testval_up++; +} +END_TEST + +START_TEST(test_ch_setup) +{ + TCase *tc; + Suite *s; + SRunner *sr; + + s = suite_create("Fixture Norm Sub"); + tc = tcase_create("Fixture Norm Sub"); + sr = srunner_create(s); + suite_add_tcase(s, tc); + tcase_add_test(tc,test_sub_ch_setup_norm); + tcase_add_test(tc,test_sub_ch_setup_norm); + tcase_add_checked_fixture(tc,sub_ch_setup_norm,sub_ch_teardown_norm); + srunner_run_all(sr, CK_VERBOSE); + + fail_unless(srunner_ntests_failed(sr) == 0, + "Checked setup not being run correctly"); + + srunner_free(sr); +} +END_TEST + +static void setup_sub_fail (void) +{ + fail("Failed setup"); /* check_check_fixture.c:127 */ +} + +static void teardown_sub_fail (void) +{ + fail("Failed teardown"); +} + +static void setup_sub_signal (void) +{ + mark_point(); + raise(SIGFPE); +} + +static void teardown_sub_signal(void) +{ + mark_point(); + raise(SIGFPE); +} + +START_TEST(test_sub_fail) +{ + fail("Should never run"); +} +END_TEST + +START_TEST(test_sub_pass) +{ + fail_unless(1 == 1, "Always pass"); +} +END_TEST + +START_TEST(test_ch_setup_fail) +{ + TCase *tc; + Suite *s; + SRunner *sr; + char *strstat; + char *trm; + + s = suite_create("Setup Fail"); + tc = tcase_create("Setup Fail"); + suite_add_tcase(s, tc); + tcase_add_test(tc,test_sub_fail); + tcase_add_checked_fixture(tc,setup_sub_fail, NULL); + sr = srunner_create(s); + srunner_run_all(sr,CK_VERBOSE); + + fail_unless (srunner_ntests_run(sr) == 0, + "Test run counts not correct for checked setup failure"); + fail_unless (srunner_ntests_failed(sr) == 1, + "Failure counts not correct for checked setup failure"); + + strstat= sr_stat_str(sr); + + fail_unless(strcmp(strstat, + "0%: Checks: 0, Failures: 1, Errors: 0") == 0, + "SRunner stat string incorrect with checked setup failure"); + + + trm = tr_str(srunner_failures(sr)[0]); + /* Search for check_check_fixture.c:127 if this fails. */ + if (strstr(trm, + "check_check_fixture.c:127:S:Setup Fail:test_sub_fail:0: Failed setup") + == 0) { + snprintf(errm, sizeof(errm), + "Bad failed checked setup tr msg (%s)", trm); + + fail (errm); + } +} +END_TEST + +START_TEST(test_ch_setup_fail_nofork) +{ + TCase *tc; + Suite *s; + SRunner *sr; + + s = suite_create("Setup Fail Nofork"); + tc = tcase_create("Setup Fail Nofork"); + suite_add_tcase(s, tc); + tcase_add_test(tc, test_sub_fail); + tcase_add_checked_fixture(tc, setup_sub_fail, NULL); + sr = srunner_create(s); + srunner_set_fork_status(sr, CK_NOFORK); + srunner_run_all(sr, CK_VERBOSE); + + fail_unless (srunner_ntests_run(sr) == 0, + "Test run counts not correct for checked setup failure"); + fail_unless (srunner_ntests_failed(sr) == 1, + "Failure counts not correct for checked setup failure"); +} +END_TEST + +START_TEST(test_ch_setup_fail_nofork_2) +{ + TCase *tc; + Suite *s; + SRunner *sr; + + s = suite_create("Setup Fail Nofork 2"); + tc = tcase_create("Setup Fail Nofork 2"); + suite_add_tcase(s, tc); + tcase_add_test(tc, test_sub_fail); + tcase_add_checked_fixture(tc, sub_ch_setup_norm, NULL); + tcase_add_checked_fixture(tc, setup_sub_fail, NULL); + sr = srunner_create(s); + srunner_set_fork_status(sr, CK_NOFORK); + srunner_run_all(sr, CK_VERBOSE); + + fail_unless (srunner_ntests_run(sr) == 0, + "Test run counts not correct for checked setup failure"); + fail_unless (srunner_ntests_failed(sr) == 1, + "Failure counts not correct for checked setup failure"); +} +END_TEST + +START_TEST(test_ch_setup_pass_nofork) +{ + TCase *tc; + Suite *s; + SRunner *sr; + + s = suite_create("Setup Pass Multiple fixtures"); + tc = tcase_create("Setup Pass Multiple fixtures"); + suite_add_tcase(s, tc); + tcase_add_test(tc, test_sub_pass); + tcase_add_checked_fixture(tc, sub_ch_setup_norm, sub_ch_teardown_norm); + tcase_add_checked_fixture(tc, sub_ch_setup_norm, sub_ch_teardown_norm); + tcase_add_checked_fixture(tc, sub_ch_setup_norm, sub_ch_teardown_norm); + sr = srunner_create(s); + srunner_set_fork_status(sr, CK_NOFORK); + testval_up = 1; + testval_down = 1; + srunner_run_all(sr, CK_VERBOSE); + fail_unless(testval_up == 7, "Multiple setups failed"); + fail_unless(testval_down == 7, "Multiple teardowns failed"); + + fail_unless (srunner_ntests_run(sr) == 1, + "Test run counts not correct for checked setup failure"); + fail_unless (srunner_ntests_failed(sr) == 0, + "Failure counts not correct for checked setup failure"); +} +END_TEST + +START_TEST(test_ch_setup_sig) +{ + TCase *tc; + Suite *s; + SRunner *sr; + char *strstat; + char *trm; + + s = suite_create("Setup Sig"); + tc = tcase_create("Setup Sig"); + suite_add_tcase(s, tc); + tcase_add_test(tc,test_sub_fail); + tcase_add_checked_fixture(tc,setup_sub_signal, NULL); + sr = srunner_create(s); + srunner_run_all(sr,CK_VERBOSE); + + fail_unless (srunner_ntests_failed(sr) == 1, + "Failure counts not correct for checked setup signal"); + fail_unless (srunner_ntests_run(sr) == 0, + "Test run counts not correct for checked setup signal"); + + strstat= sr_stat_str(sr); + + fail_unless(strcmp(strstat, + "0%: Checks: 0, Failures: 0, Errors: 1") == 0, + "SRunner stat string incorrect with checked setup signal"); + + + trm = tr_str(srunner_failures(sr)[0]); + + if (strstr(trm, + "check_check_fixture.c:137:S:Setup Sig:test_sub_fail:0: " + "(after this point) Received signal 8") + == 0) { + snprintf(errm, sizeof(errm), + "Msg was (%s)", trm); + + fail (errm); + } +} +END_TEST + +static void sub_ch_setup_dual_1(void) +{ + fail_unless(testval_up == 1, "Wrong start value"); + testval_up += 2; +} + +static void sub_ch_setup_dual_2(void) +{ + fail_unless(testval_up == 3, "First setup failed"); + testval_up += 3; +} + +START_TEST(test_sub_two_setups) +{ + fail_unless(testval_up == 6, "Multiple setups failed"); +} +END_TEST + +START_TEST(test_ch_setup_two_setups_fork) +{ + TCase *tc; + Suite *s; + SRunner *sr; + + s = suite_create("Fixture Two setups"); + tc = tcase_create("Fixture Two setups"); + sr = srunner_create(s); + suite_add_tcase(s, tc); + tcase_add_test(tc,test_sub_two_setups); + tcase_add_checked_fixture(tc,sub_ch_setup_dual_1,NULL); + tcase_add_checked_fixture(tc,sub_ch_setup_dual_2,NULL); + testval_up = 1; + srunner_run_all(sr, CK_VERBOSE); + + fail_unless(srunner_ntests_failed(sr) == 0, + "Problem with several setups"); + + srunner_free(sr); +} +END_TEST + +START_TEST(test_ch_teardown_fail) +{ + TCase *tc; + Suite *s; + SRunner *sr; + char *strstat; + char *trm; + + s = suite_create("Teardown Fail"); + tc = tcase_create("Teardown Fail"); + suite_add_tcase(s, tc); + tcase_add_test(tc,test_sub_pass); + tcase_add_checked_fixture(tc,NULL, teardown_sub_fail); + sr = srunner_create(s); + srunner_run_all(sr,CK_VERBOSE); + + fail_unless (srunner_ntests_failed(sr) == 1, + "Failure counts not correct for checked teardown failure"); + fail_unless (srunner_ntests_run(sr) == 1, + "Test run counts not correct for checked teardown failure"); + + strstat= sr_stat_str(sr); + + fail_unless(strcmp(strstat, + "0%: Checks: 1, Failures: 1, Errors: 0") == 0, + "SRunner stat string incorrect with checked setup failure"); + + + trm = tr_str(srunner_failures(sr)[0]); + + if (strstr(trm, + "check_check_fixture.c:132:S:Teardown Fail:test_sub_pass:0: Failed teardown") + == 0) { + snprintf(errm, sizeof(errm), + "Bad failed checked teardown tr msg (%s)", trm); + + fail (errm); + } + +} +END_TEST + +START_TEST(test_ch_teardown_sig) +{ + TCase *tc; + Suite *s; + SRunner *sr; + char *strstat; + char *trm; + + s = suite_create("Teardown Sig"); + tc = tcase_create("Teardown Sig"); + suite_add_tcase(s, tc); + tcase_add_test(tc,test_sub_pass); + tcase_add_checked_fixture(tc,NULL, teardown_sub_signal); + sr = srunner_create(s); + srunner_run_all(sr,CK_VERBOSE); + + fail_unless (srunner_ntests_failed(sr) == 1, + "Failure counts not correct for checked teardown signal"); + fail_unless (srunner_ntests_run(sr) == 1, + "Test run counts not correct for checked teardown signal"); + + strstat= sr_stat_str(sr); + + fail_unless(strcmp(strstat, + "0%: Checks: 1, Failures: 0, Errors: 1") == 0, + "SRunner stat string incorrect with checked teardown signal"); + + + trm = tr_str(srunner_failures(sr)[0]); + + if (strstr(trm, + "check_check_fixture.c:143:S:Teardown Sig:test_sub_pass:0: " + "(after this point) Received signal 8") + == 0) { + snprintf(errm, sizeof(errm), + "Bad msg (%s)", trm); + + fail (errm); + } + +} +END_TEST + +/* Teardowns are run in reverse order */ +static void sub_ch_teardown_dual_1(void) +{ + fail_unless(testval_down == 6, "Second teardown failed"); +} + +static void sub_ch_teardown_dual_2(void) +{ + fail_unless(testval_down == 3, "First teardown failed"); + testval_down += 3; +} + +START_TEST(test_sub_two_teardowns) +{ + testval_down += 2; +} +END_TEST + +START_TEST(test_ch_teardown_two_teardowns_fork) +{ + TCase *tc; + Suite *s; + SRunner *sr; + int nr_of_failures; + char errm[1024] = {0}; + + s = suite_create("Fixture Two teardowns"); + tc = tcase_create("Fixture Two teardowns"); + sr = srunner_create(s); + suite_add_tcase(s, tc); + tcase_add_test(tc,test_sub_two_teardowns); + tcase_add_checked_fixture(tc,NULL,sub_ch_teardown_dual_1); + tcase_add_checked_fixture(tc,NULL,sub_ch_teardown_dual_2); + testval_down = 1; + srunner_run_all(sr, CK_VERBOSE); + + nr_of_failures = srunner_ntests_failed(sr); + if (nr_of_failures > 0) { + TestResult **tra = srunner_failures(sr); + int i; + + for (i = 0; i < nr_of_failures; i++) { + char *trm = tr_str(tra[i]); + if (strlen(errm) + strlen(trm) > 1022) { + break; + } + strcat(errm, trm); + strcat(errm, "\n"); + free(trm); + } + free(tra); + } + fail_unless(nr_of_failures == 0, "Problem with several teardowns\n %s", + errm); + + srunner_free(sr); +} +END_TEST + +Suite *make_fixture_suite (void) +{ + + Suite *s; + TCase *tc; + + s = suite_create("Fixture"); + tc = tcase_create("Core"); + + suite_add_tcase (s, tc); + tcase_add_test(tc,test_fixture_fail_counts); + tcase_add_test(tc,test_print_counts); + tcase_add_test(tc,test_setup_failure_msg); + tcase_add_test(tc,test_ch_setup); + tcase_add_test(tc,test_ch_setup_fail); + tcase_add_test(tc,test_ch_setup_fail_nofork); + tcase_add_test(tc,test_ch_setup_fail_nofork_2); + tcase_add_test(tc,test_ch_setup_pass_nofork); + tcase_add_test(tc,test_ch_setup_sig); + tcase_add_test(tc,test_ch_setup_two_setups_fork); + tcase_add_test(tc,test_ch_teardown_fail); + tcase_add_test(tc,test_ch_teardown_sig); + tcase_add_test(tc,test_ch_teardown_two_teardowns_fork); + return s; +} diff --git a/tests/check_check_fork.c b/tests/check_check_fork.c new file mode 100644 index 0000000..d5d2507 --- /dev/null +++ b/tests/check_check_fork.c @@ -0,0 +1,127 @@ +#include +#include +#include +#include +#include "check_check.h" + + +static int counter; +static pid_t mypid; + +static void fork_sub_setup (void) +{ + counter = 0; + mypid = getpid(); +} + +START_TEST(test_inc) +{ + counter++; +} +END_TEST + +START_TEST(test_nofork_sideeffects) +{ + fail_unless(counter == 1, + "Side effects not seen across tests"); +} +END_TEST + +START_TEST(test_nofork_pid) +{ + fail_unless(mypid == getpid(), + "Unit test is in a different adresss space from setup code"); +} +END_TEST + +static Suite *make_fork_sub_suite (void) +{ + + Suite *s; + TCase *tc; + + s = suite_create("Fork Sub"); + tc = tcase_create("Core"); + + suite_add_tcase (s, tc); + tcase_add_unchecked_fixture(tc, fork_sub_setup,NULL); + tcase_add_test(tc,test_inc); + tcase_add_test(tc,test_nofork_sideeffects); + tcase_add_test(tc,test_nofork_pid); + + return s; +} + +static SRunner *fork_sr; +static SRunner *fork_dummy_sr; + +void fork_setup (void) +{ + fork_sr = srunner_create(make_fork_sub_suite()); + fork_dummy_sr = srunner_create (make_fork_sub_suite()); + srunner_set_fork_status(fork_sr,CK_NOFORK); + srunner_run_all(fork_sr,CK_VERBOSE); +} + +void fork_teardown (void) +{ + srunner_free(fork_sr); +} + +START_TEST(test_default_fork) +{ + fail_unless(srunner_fork_status(fork_dummy_sr) == CK_FORK, + "Default fork status not set correctly"); +} +END_TEST + +START_TEST(test_set_fork) +{ + srunner_set_fork_status(fork_dummy_sr, CK_NOFORK); + fail_unless(srunner_fork_status(fork_dummy_sr) == CK_NOFORK, + "Fork status not changed correctly"); +} +END_TEST + +START_TEST(test_env) +{ + putenv((char *) "CK_FORK=no"); + fail_unless(srunner_fork_status(fork_dummy_sr) == CK_NOFORK, + "Fork status does not obey environment variable"); +} +END_TEST + +START_TEST(test_env_and_set) +{ + putenv((char *) "CK_FORK=no"); + srunner_set_fork_status(fork_dummy_sr, CK_FORK); + fail_unless(srunner_fork_status(fork_dummy_sr) == CK_FORK, + "Explicit setting of fork status should override env"); +} +END_TEST + + +START_TEST(test_nofork) +{ + fail_unless(srunner_ntests_failed(fork_sr) == 0, + "Errors on nofork test"); +} +END_TEST + +Suite *make_fork_suite(void) +{ + Suite *s; + TCase *tc; + + s = suite_create("Fork"); + tc = tcase_create("Core"); + + suite_add_tcase(s, tc); + tcase_add_test(tc,test_default_fork); + tcase_add_test(tc,test_set_fork); + tcase_add_test(tc,test_env); + tcase_add_test(tc,test_env_and_set); + tcase_add_test(tc,test_nofork); + + return s; +} diff --git a/tests/check_check_limit.c b/tests/check_check_limit.c new file mode 100644 index 0000000..a64685b --- /dev/null +++ b/tests/check_check_limit.c @@ -0,0 +1,41 @@ +#include +#include +#include +#include "check_check.h" +#include "check_str.h" + + +static SRunner *sr; + +static void limit_setup (void) +{ + Suite *s = suite_create("Empty"); + sr = srunner_create(s); + srunner_run_all(sr, CK_VERBOSE); +} + +static void limit_teardown (void) +{ + srunner_free(sr); +} + +START_TEST(test_summary) +{ + fail_unless(strcmp(sr_stat_str(sr), + "100%: Checks: 0, Failures: 0, Errors: 0") == 0, + "Bad statistics string for empty suite"); +} +END_TEST + +Suite *make_limit_suite (void) +{ + Suite *s = suite_create("Limit"); + TCase *tc = tcase_create("Empty"); + + tcase_add_test(tc,test_summary); + tcase_add_unchecked_fixture(tc,limit_setup,limit_teardown); + + suite_add_tcase(s, tc); + + return s; +} diff --git a/tests/check_check_log.c b/tests/check_check_log.c new file mode 100644 index 0000000..0cc002f --- /dev/null +++ b/tests/check_check_log.c @@ -0,0 +1,103 @@ +#include +#include +#include +#include +#include "check_check.h" + + +START_TEST(test_set_log) +{ + Suite *s = suite_create("Suite"); + SRunner *sr = srunner_create(s); + + srunner_set_log (sr, "test_log"); + + fail_unless (srunner_has_log (sr), "SRunner not logging"); + fail_unless (strcmp(srunner_log_fname(sr), "test_log") == 0, + "Bad file name returned"); +} +END_TEST + +START_TEST(test_no_set_log) +{ + Suite *s = suite_create("Suite"); + SRunner *sr = srunner_create(s); + + fail_unless (!srunner_has_log (sr), "SRunner not logging"); + fail_unless (srunner_log_fname(sr) == NULL, "Bad file name returned"); +} +END_TEST + +START_TEST(test_double_set_log) +{ + Suite *s = suite_create("Suite"); + SRunner *sr = srunner_create(s); + + srunner_set_log (sr, "test_log"); + srunner_set_log (sr, "test2_log"); + + fail_unless(strcmp(srunner_log_fname(sr), "test_log") == 0, + "Log file is initialize only and shouldn't be changeable once set"); +} +END_TEST + + +START_TEST(test_set_xml) +{ + Suite *s = suite_create("Suite"); + SRunner *sr = srunner_create(s); + + srunner_set_xml (sr, "test_log.xml"); + + fail_unless (srunner_has_xml (sr), "SRunner not logging XML"); + fail_unless (strcmp(srunner_xml_fname(sr), "test_log.xml") == 0, + "Bad file name returned"); +} +END_TEST + +START_TEST(test_no_set_xml) +{ + Suite *s = suite_create("Suite"); + SRunner *sr = srunner_create(s); + + fail_unless (!srunner_has_xml (sr), "SRunner not logging XML"); + fail_unless (srunner_xml_fname(sr) == NULL, "Bad file name returned"); +} +END_TEST + +START_TEST(test_double_set_xml) +{ + Suite *s = suite_create("Suite"); + SRunner *sr = srunner_create(s); + + srunner_set_xml (sr, "test_log.xml"); + srunner_set_xml (sr, "test2_log.xml"); + + fail_unless(strcmp(srunner_xml_fname(sr), "test_log.xml") == 0, + "XML Log file is initialize only and shouldn't be changeable once set"); +} +END_TEST + +Suite *make_log_suite(void) +{ + + Suite *s; + TCase *tc_core, *tc_core_xml; + + s = suite_create("Log"); + tc_core = tcase_create("Core"); + tc_core_xml = tcase_create("Core XML"); + + suite_add_tcase(s, tc_core); + tcase_add_test(tc_core, test_set_log); + tcase_add_test(tc_core, test_no_set_log); + tcase_add_test(tc_core, test_double_set_log); + + suite_add_tcase(s, tc_core_xml); + tcase_add_test(tc_core_xml, test_set_xml); + tcase_add_test(tc_core_xml, test_no_set_xml); + tcase_add_test(tc_core_xml, test_double_set_xml); + + return s; +} + diff --git a/tests/check_check_main.c b/tests/check_check_main.c new file mode 100644 index 0000000..74949bf --- /dev/null +++ b/tests/check_check_main.c @@ -0,0 +1,31 @@ +#include +#include +#include +#include "check_check.h" + +int main (void) +{ + int n; + SRunner *sr; + + fork_setup(); + setup_fixture(); + sr = srunner_create (make_master_suite()); + srunner_add_suite(sr, make_list_suite()); + srunner_add_suite(sr, make_msg_suite()); + srunner_add_suite(sr, make_log_suite()); + srunner_add_suite(sr, make_limit_suite()); + srunner_add_suite(sr, make_fork_suite()); + srunner_add_suite(sr, make_fixture_suite()); + srunner_add_suite(sr, make_pack_suite()); + + setup(); + printf ("Ran %d tests in subordinate suite\n", sub_ntests); + srunner_run_all (sr, CK_VERBOSE); + cleanup(); + fork_teardown(); + teardown_fixture(); + n = srunner_ntests_failed(sr); + srunner_free(sr); + return (n == 0) ? EXIT_SUCCESS : EXIT_FAILURE; +} diff --git a/tests/check_check_master.c b/tests/check_check_master.c new file mode 100644 index 0000000..d8a79f6 --- /dev/null +++ b/tests/check_check_master.c @@ -0,0 +1,317 @@ +#include +#include +#include +#include +#include "check_check.h" + + +TestResult **tr_fail_array; +TestResult **tr_all_array; + + +#define MAXSTR 300 + +typedef struct { + const char *tcname; + int line_nos; + int failure_type; + const char *msg; +} master_test_t; + +static master_test_t master_tests[] = { + { "Simple Tests", 18, CK_FAILURE, "Failure expected" }, + { "Simple Tests", 24, CK_ERROR, "Early exit with return value 1" }, + { "Simple Tests", -1, CK_PASS, "Passed" }, + { "Simple Tests", -1, CK_FAILURE, "This test should fail" }, + { "Simple Tests", -1, CK_PASS, "Passed" }, + { "Simple Tests", -1, CK_FAILURE, "This test should fail" }, + { "Simple Tests", -1, CK_FAILURE, "Assertion '2 == 3' failed" }, + { "Simple Tests", -1, CK_FAILURE, "Assertion '4 == 5' failed" }, + { "Simple Tests", -1, CK_FAILURE, "Failure '2 != 3' occured" }, + { "Simple Tests", -1, CK_FAILURE, "Failure '4 != 5' occured" }, + { "Simple Tests", -1, CK_FAILURE, "3 != 4" }, + { "Simple Tests", -1, CK_FAILURE, "5 != 6" }, + { "Simple Tests", -1, CK_FAILURE, "7 == 7" }, + { "Simple Tests", -1, CK_FAILURE, "Failed" }, + + { "Signal Tests", -1, CK_ERROR, "Received signal 11 (Segmentation fault)" }, + { "Signal Tests", -1, CK_PASS, "Passed" }, + { "Signal Tests", 111, CK_ERROR, "Received signal 11 (Segmentation fault), expected 8 (Floating point exception)" }, + { "Signal Tests", -1, CK_FAILURE, "Early exit with return value 0" }, + { "Signal Tests", -1, CK_FAILURE, "Early exit with return value 1" }, + { "Signal Tests", -1, CK_ERROR, "Received signal 8 (Floating point exception)" }, + { "Signal Tests", -1, CK_ERROR, "Received signal 8 (Floating point exception)" }, + +#if TIMEOUT_TESTS_ENABLED + { "Environment Timeout Tests", 139, CK_ERROR, "Test timeout expired" }, + { "Environment Timeout Tests", -1, CK_PASS, "Passed" }, + { "Environment Timeout Tests", -1, CK_PASS, "Passed" }, + { "Environment Timeout Tests", 158, CK_ERROR, "Test timeout expired" }, + { "Timeout Tests", 139, CK_ERROR, "Test timeout expired" }, + { "Timeout Tests", -1, CK_PASS, "Passed" }, + { "Timeout Tests", 152, CK_ERROR, "Test timeout expired" }, + { "Timeout Tests", 158, CK_ERROR, "Test timeout expired" }, + { "User Timeout Tests", 139, CK_ERROR, "Test timeout expired" }, + { "User Timeout Tests", -1, CK_PASS, "Passed" }, + { "User Timeout Tests", -1, CK_PASS, "Passed" }, + { "User Timeout Tests", 158, CK_ERROR, "Test timeout expired" }, + /* Timeout tests are run twice , see check_check_sub.c:make_sub_suite() */ + { "Timeout Tests", 139, CK_ERROR, "Test timeout expired" }, + { "Timeout Tests", -1, CK_PASS, "Passed" }, + { "Timeout Tests", 152, CK_ERROR, "Test timeout expired" }, + { "Timeout Tests", 158, CK_ERROR, "Test timeout expired" }, +#endif + + { "Limit Tests", -1, CK_ERROR, "Early exit with return value 1" }, + { "Limit Tests", -1, CK_FAILURE, "Completed properly" }, + { "Limit Tests", -1, CK_FAILURE, "Completed properly" }, + + { "Msg and fork Tests", -1, CK_PASS, "Passed" }, + { "Msg and fork Tests", -1, CK_FAILURE, "Expected fail" }, + { "Msg and fork Tests", -1, CK_PASS, "Passed" }, + { "Msg and fork Tests", -1, CK_FAILURE, "Expected fail" }, + { "Msg and fork Tests", -1, CK_PASS, "Passed" }, + { "Msg and fork Tests", -1, CK_FAILURE, "Expected fail" }, + + { "Core", -1, CK_FAILURE, "We failed" } +}; + +static int nr_of_master_tests = sizeof master_tests /sizeof master_tests[0]; + +START_TEST(test_check_nfailures) +{ + int i; + int failed = 0; + + for (i = 0; i < nr_of_master_tests; i++) { + if (master_tests[i].failure_type != CK_PASS) { + failed++; + } + } + fail_unless (sub_nfailed == failed, + "Unexpected number of failures received, %d, expected %d.", + sub_nfailed, failed); +} +END_TEST + +START_TEST(test_check_ntests_run) +{ + fail_unless (sub_ntests == nr_of_master_tests, + "Unexpected number of tests run, %d.", sub_ntests); +} +END_TEST + +START_TEST(test_check_failure_msgs) +{ + int i; + int passed = 0; + const char *got_msg; + const char *expected_msg; + TestResult *tr; + + for (i = 0; i < sub_ntests; i++) { + if (master_tests[i].failure_type == CK_PASS) { + passed++; + continue; + } + + fail_if(i - passed > sub_nfailed); + tr = tr_fail_array[i - passed]; + fail_unless(tr != NULL); + got_msg = tr_msg(tr); + expected_msg = master_tests[i].msg; + if (strcmp(got_msg, expected_msg) != 0) { + char *emsg = malloc(MAXSTR); + snprintf(emsg, MAXSTR,"For test %d: Expected %s, got %s", + i, expected_msg, got_msg); + fail(emsg); + free(emsg); + } + } +} +END_TEST + +START_TEST(test_check_failure_lnos) +{ + int i; + int line_no; + int passed = 0; + TestResult *tr; + + for (i = 0; i < sub_ntests; i++) { + if (master_tests[i].failure_type == CK_PASS) { + passed++; + continue; + } + + fail_if(i - passed > sub_nfailed); + tr = tr_fail_array[i - passed]; + fail_unless(tr != NULL); + line_no = master_tests[i].line_nos; + if (line_no > 0 && tr_lno(tr) != line_no) { + char *emsg = malloc(MAXSTR); + snprintf(emsg, MAXSTR, "For test %d: Expected lno %d, got %d", + i, line_no, tr_lno(tr)); + fail(emsg); + free(emsg); + } + } +} +END_TEST + +START_TEST(test_check_failure_ftypes) +{ + int i; + int passed = 0; + TestResult *tr; + + for (i = 0; i < sub_ntests; i++) { + if (master_tests[i].failure_type == CK_PASS) { + passed++; + continue; + } + + fail_if(i - passed > sub_nfailed); + tr = tr_fail_array[i - passed]; + fail_unless(tr != NULL); + fail_unless(master_tests[i].failure_type == tr_rtype(tr), + "Failure type wrong for test %d", i); + } +} +END_TEST + +START_TEST(test_check_failure_lfiles) +{ + int i; + for (i = 0; i < sub_nfailed; i++) { + TestResult *tr = tr_fail_array[i]; + fail_unless(tr != NULL); + fail_unless(tr_lfile(tr) != NULL, "Bad file name for test %d", i); + fail_unless(strstr(tr_lfile(tr), "check_check_sub.c") != 0, + "Bad file name for test %d", i); + } +} +END_TEST + +START_TEST(test_check_tcnames) +{ + int i; + + for (i = 0; i < sub_ntests; i++) { + const char *tcname; + tcname = tr_tcname(tr_all_array[_i]); + if (strcmp(tcname, master_tests[_i].tcname) != 0) { + char *emsg = malloc (MAXSTR); + snprintf(emsg, MAXSTR,"For test %d: Expected %s, got %s", + i, master_tests[_i].tcname, tcname); + fail(emsg); + free(emsg); + } + } +} +END_TEST + + +START_TEST(test_check_all_msgs) +{ + int i; + + for (i = 0; i < sub_ntests; i++) { + const char *msg; + msg = tr_msg(tr_all_array[_i]); + if (strcmp(msg, master_tests[_i].msg) != 0) { + char *emsg = malloc (MAXSTR); + snprintf(emsg, MAXSTR,"For test %d: Expected %s, got %s", + i, master_tests[_i].msg, msg); + fail(emsg); + free(emsg); + } + } +} +END_TEST + +START_TEST(test_check_all_ftypes) +{ + fail_unless(master_tests[_i].failure_type == tr_rtype(tr_all_array[_i]), + "Failure type wrong for test %d", _i); +} +END_TEST + +int test_fixture_val = 0; +static void test_fixture_setup(void) +{ + test_fixture_val = 1; +} + +START_TEST(test_setup) +{ + fail_unless (test_fixture_val == 1, + "Value not setup or changed across tests correctly"); + test_fixture_val = 2; +} +END_TEST + +static void test_fixture_teardown (void) +{ + test_fixture_val = 3; +} + +START_TEST(test_teardown) +{ + fail_unless (test_fixture_val == 3, + "Value not changed correctly in teardown"); +} +END_TEST + + +Suite *make_master_suite (void) +{ + Suite *s; + TCase *tc_core; + TCase *tc_fixture; + TCase *tc_post_teardown; + + s = suite_create("Master"); + tc_core = tcase_create("Core Tests"); + tc_fixture = tcase_create("Fixture Setup Tests"); + suite_add_tcase (s, tc_core); + tcase_add_test (tc_core, test_check_nfailures); + tcase_add_test (tc_core, test_check_ntests_run); + tcase_add_test (tc_core, test_check_failure_msgs); + tcase_add_test (tc_core, test_check_failure_ftypes); + tcase_add_test (tc_core, test_check_failure_lnos); + tcase_add_test (tc_core, test_check_failure_lfiles); + tcase_add_test (tc_core, test_check_tcnames); + tcase_add_test (tc_core, test_check_all_msgs); + tcase_add_loop_test (tc_core, test_check_all_ftypes, 0, nr_of_master_tests); + tcase_add_unchecked_fixture(tc_fixture, test_fixture_setup, + test_fixture_teardown); + /* add the test 3 times to make sure we adequately test + preservation of fixture values across tests, regardless + of the order in which tests are added to the test case */ + tcase_add_test (tc_fixture, test_setup); + tcase_add_test (tc_fixture, test_setup); + tcase_add_test (tc_fixture, test_setup); + suite_add_tcase (s, tc_fixture); + tc_post_teardown = tcase_create ("Fixture Teardown Tests"); + tcase_add_test (tc_post_teardown, test_teardown); + suite_add_tcase (s, tc_post_teardown); + return s; +} + +void setup (void) +{ + Suite *s = make_sub_suite(); + SRunner *sr = srunner_create(s); + srunner_add_suite(sr, make_sub2_suite()); + srunner_run_all(sr, CK_VERBOSE); + tr_fail_array = srunner_failures(sr); + tr_all_array = srunner_results(sr); + sub_nfailed = srunner_ntests_failed(sr); + sub_ntests = srunner_ntests_run(sr); +} + +void cleanup (void) +{ + return; +} diff --git a/tests/check_check_msg.c b/tests/check_check_msg.c new file mode 100644 index 0000000..5f75047 --- /dev/null +++ b/tests/check_check_msg.c @@ -0,0 +1,164 @@ +#include +#include +#include + +#include "check.h" +#include "check_msg.h" +#include "check_check.h" + +START_TEST(test_send) +{ + TestResult *tr; + setup_messaging(); + send_ctx_info(CK_CTX_SETUP); + send_loc_info("abc123.c", 10); + send_ctx_info(CK_CTX_TEST); + send_loc_info("abc124.c", 22); + send_loc_info("abc125.c", 25); + send_failure_info("Oops"); + tr = receive_test_result(0); + teardown_messaging(); + + fail_unless (tr != NULL, + "No test result received"); + fail_unless (tr_ctx(tr) == CK_CTX_TEST, + "Bad CTX received"); + fail_unless (strcmp(tr_msg(tr), "Oops") == 0, + "Bad failure msg received"); + fail_unless (strcmp(tr_lfile(tr), "abc125.c") == 0, + "Bad loc file received"); + fail_unless (tr_lno(tr) == 25, + "Bad loc line received"); + if (tr != NULL) + free(tr); +} +END_TEST + +START_TEST(test_send_big) +{ + TestResult *tr; + int i; + + setup_messaging(); + send_ctx_info(CK_CTX_SETUP); + send_loc_info("abc123.c", 10); + for (i = 0; i < 10000; i++) { + send_ctx_info(CK_CTX_TEST); + send_loc_info("abc124.c", i); + } + + tr = receive_test_result(0); + teardown_messaging(); + + fail_unless (tr != NULL, + "No test result received"); + fail_unless (tr_ctx(tr) == CK_CTX_TEST, + "Bad CTX received"); + fail_unless (strcmp(tr_lfile(tr), "abc124.c") == 0, + "Bad loc file received"); + fail_unless (tr_lno(tr) == i -1, + "Bad loc line received"); + if (tr != NULL) + free(tr); +} +END_TEST + + +START_TEST(test_send_test_error) +{ + TestResult *tr; + setup_messaging(); + send_ctx_info(CK_CTX_SETUP); + send_loc_info("abc123.c", 10); + send_ctx_info(CK_CTX_TEST); + send_loc_info("abc124.c", 22); + send_loc_info("abc125.c", 25); + tr = receive_test_result(1); + teardown_messaging(); + + fail_unless (tr != NULL, + "No test result received"); + fail_unless (tr_ctx(tr) == CK_CTX_TEST, + "Bad CTX received"); + fail_unless (strcmp(tr_lfile(tr), "abc125.c") == 0, + "Bad loc file received"); + fail_unless (tr_lno(tr) == 25, + "Bad loc line received"); + if (tr != NULL) + free(tr); +} +END_TEST + +START_TEST(test_send_with_passing_teardown) +{ + TestResult *tr; + setup_messaging(); + send_ctx_info(CK_CTX_SETUP); + send_loc_info("abc123.c", 10); + send_ctx_info(CK_CTX_TEST); + send_loc_info("abc124.c", 22); + send_loc_info("abc125.c", 25); + send_ctx_info(CK_CTX_TEARDOWN); + send_loc_info("abc126.c", 54); + tr = receive_test_result(0); + teardown_messaging(); + + fail_unless (tr != NULL, + "No test result received"); + fail_unless (tr_ctx(tr) == CK_CTX_TEST, + "Bad CTX received"); + fail_unless (tr_msg(tr) == NULL, + "Bad failure msg received"); + fail_unless (strcmp(tr_lfile(tr), "abc125.c") == 0, + "Bad loc file received"); + fail_unless (tr_lno(tr) == 25, + "Bad loc line received"); + if (tr != NULL) + free(tr); +} +END_TEST + +START_TEST(test_send_with_error_teardown) +{ + TestResult *tr; + setup_messaging(); + send_ctx_info(CK_CTX_SETUP); + send_loc_info("abc123.c", 10); + send_ctx_info(CK_CTX_TEST); + send_loc_info("abc124.c", 22); + send_loc_info("abc125.c", 25); + send_ctx_info(CK_CTX_TEARDOWN); + send_loc_info("abc126.c", 54); + tr = receive_test_result(1); + teardown_messaging(); + + fail_unless (tr != NULL, + "No test result received"); + fail_unless (tr_ctx(tr) == CK_CTX_TEARDOWN, + "Bad CTX received"); + fail_unless (tr_msg(tr) == NULL, + "Bad failure msg received"); + fail_unless (strcmp(tr_lfile(tr), "abc126.c") == 0, + "Bad loc file received"); + fail_unless (tr_lno(tr) == 54, + "Bad loc line received"); + if (tr != NULL) + free(tr); +} +END_TEST + + +Suite *make_msg_suite (void) +{ + Suite *s; + TCase *tc; + s = suite_create("Msg"); + tc = tcase_create("Core Tests"); + tcase_add_test(tc, test_send); + tcase_add_test(tc, test_send_big); + tcase_add_test(tc, test_send_test_error); + tcase_add_test(tc, test_send_with_passing_teardown); + tcase_add_test(tc, test_send_with_error_teardown); + suite_add_tcase(s, tc); + return s; +} diff --git a/tests/check_check_pack.c b/tests/check_check_pack.c new file mode 100644 index 0000000..56b3ed6 --- /dev/null +++ b/tests/check_check_pack.c @@ -0,0 +1,402 @@ +#include +#include +#include +#include + +#include "check.h" +#include "check_pack.h" +#include "check_error.h" +#include "check_check.h" + +static char errm[512]; + + +START_TEST(test_pack_fmsg) +{ + FailMsg *fmsg; + char *buf; + enum ck_msg_type type; + + fmsg = emalloc (sizeof (FailMsg)); + + fmsg->msg = (char *) "Hello, world!"; + pack (CK_MSG_FAIL, &buf, (CheckMsg *) fmsg); + + fmsg->msg = (char *) ""; + upack (buf, (CheckMsg *) fmsg, &type); + + fail_unless (type == CK_MSG_FAIL, + "Bad type unpacked for FailMsg"); + + if (strcmp (fmsg->msg, "Hello, world!") != 0) { + snprintf (errm, sizeof(errm), + "Unpacked string is %s, should be Hello, World!", + fmsg->msg); + fail (errm); + } + + free (fmsg->msg); + free (fmsg); + free (buf); +} +END_TEST + +START_TEST(test_pack_loc) +{ + LocMsg *lmsg; + char *buf; + enum ck_msg_type type; + + lmsg = emalloc (sizeof (LocMsg)); + lmsg->file = (char *) "abc123.c"; + lmsg->line = 125; + + pack (CK_MSG_LOC, &buf, (CheckMsg *) lmsg); + lmsg->file = NULL; + lmsg->line = 0; + upack (buf, (CheckMsg *) lmsg, &type); + + fail_unless (type == CK_MSG_LOC, + "Bad type unpacked for LocMsg"); + + if (lmsg->line != 125) { + snprintf (errm, sizeof (errm), + "LocMsg line was %d, should be %d", + lmsg->line, 125); + fail (errm); + } + + if (strcmp (lmsg->file, "abc123.c") != 0) { + snprintf (errm, sizeof (errm), + "LocMsg file was %s, should be abc123.c", + lmsg->file); + fail (errm); + } + + free (lmsg->file); + free (lmsg); + free (buf); +} +END_TEST + +START_TEST(test_pack_ctx) +{ + CtxMsg cmsg; + char *buf; + enum ck_msg_type type; + int npk, nupk; + + cmsg.ctx = CK_CTX_SETUP; + npk = pack (CK_MSG_CTX, &buf, (CheckMsg *) &cmsg); + + cmsg.ctx = CK_CTX_TEARDOWN; + nupk = upack (buf, (CheckMsg *) &cmsg, &type); + + fail_unless (type == CK_MSG_CTX, + "Bad type unpacked for CtxMsg"); + + if (cmsg.ctx != CK_CTX_SETUP) { + snprintf (errm, sizeof (errm), + "CtxMsg ctx got %d, expected %d", + cmsg.ctx, CK_CTX_SETUP); + fail (errm); + } + + free (buf); +} +END_TEST + + +START_TEST(test_pack_len) +{ + CtxMsg cmsg; + char *buf; + int n = 0; + enum ck_msg_type type; + + cmsg.ctx = CK_CTX_TEST; + n = pack (CK_MSG_CTX, &buf, (CheckMsg *) &cmsg); + fail_unless (n > 0, "Return val from pack not set correctly"); + + /* Value below may change with different implementations of pack */ + fail_unless (n == 8, "Return val from pack not correct"); + n = 0; + n = upack (buf, (CheckMsg *) &cmsg, &type); + if (n != 8) { + snprintf (errm, sizeof (errm), "%d bytes read from upack, should be 8", n); + fail (errm); + } + + free (buf); +} +END_TEST + +START_TEST(test_pack_ctx_limit) +{ + CtxMsg cmsg; + CtxMsg *cmsgp = NULL; + char *buf; + + cmsg.ctx = -1; + pack (CK_MSG_CTX, &buf, (CheckMsg *) &cmsg); + pack (CK_MSG_CTX, &buf, (CheckMsg *) cmsgp); +} +END_TEST + +START_TEST(test_pack_fail_limit) +{ + FailMsg fmsg; + FailMsg *fmsgp = NULL; + char *buf; + enum ck_msg_type type; + + fmsg.msg = (char *) ""; + pack (CK_MSG_FAIL, &buf, (CheckMsg *) &fmsg); + fmsg.msg = (char *) "abc"; + upack (buf, (CheckMsg *) &fmsg, &type); + free (buf); + fail_unless (strcmp (fmsg.msg, "") == 0, + "Empty string not handled properly"); + + free (fmsg.msg); + fmsg.msg = NULL; + + pack (CK_MSG_FAIL, &buf, (CheckMsg *) &fmsg); + pack (CK_MSG_FAIL, &buf, (CheckMsg *) fmsgp); +} +END_TEST + +START_TEST(test_pack_loc_limit) +{ + LocMsg lmsg; + LocMsg *lmsgp = NULL; + char *buf; + enum ck_msg_type type; + + lmsg.file = (char *) ""; + lmsg.line = 0; + pack (CK_MSG_LOC, &buf, (CheckMsg *) &lmsg); + lmsg.file = (char *) "abc"; + upack (buf, (CheckMsg *) &lmsg, &type); + fail_unless (strcmp (lmsg.file, "") == 0, + "Empty string not handled properly"); + free (lmsg.file); + lmsg.file = NULL; + + pack (CK_MSG_LOC, &buf, (CheckMsg *) &lmsg); + pack (CK_MSG_LOC, &buf, (CheckMsg *) lmsgp); +} +END_TEST + +START_TEST(test_ppack) +{ + int filedes[2]; + CtxMsg cmsg; + LocMsg lmsg; + FailMsg fmsg; + RcvMsg *rmsg; + + cmsg.ctx = CK_CTX_TEST; + lmsg.file = (char *) "abc123.c"; + lmsg.line = 10; + fmsg.msg = (char *) "oops"; + pipe (filedes); + ppack (filedes[1], CK_MSG_CTX, (CheckMsg *) &cmsg); + ppack (filedes[1], CK_MSG_LOC, (CheckMsg *) &lmsg); + ppack (filedes[1], CK_MSG_FAIL, (CheckMsg *) &fmsg); + close (filedes[1]); + rmsg = punpack (filedes[0]); + + fail_unless (rmsg != NULL, + "Return value from ppack should always be malloc'ed"); + fail_unless (rmsg->lastctx == CK_CTX_TEST, + "CTX not set correctly in ppack"); + fail_unless (rmsg->fixture_line == -1, + "Default fixture loc not correct"); + fail_unless (rmsg->fixture_file == NULL, + "Default fixture loc not correct"); + fail_unless (rmsg->test_line == 10, + "Test line not received correctly"); + fail_unless (strcmp(rmsg->test_file,"abc123.c") == 0, + "Test file not received correctly"); + fail_unless (strcmp(rmsg->msg, "oops") == 0, + "Failure message not received correctly"); + + free(rmsg); +} +END_TEST + +START_TEST(test_ppack_noctx) +{ + int filedes[2]; + LocMsg lmsg; + FailMsg fmsg; + RcvMsg *rmsg; + + lmsg.file = (char *) "abc123.c"; + lmsg.line = 10; + fmsg.msg = (char *) "oops"; + pipe (filedes); + ppack (filedes[1], CK_MSG_LOC, (CheckMsg *) &lmsg); + ppack (filedes[1], CK_MSG_FAIL, (CheckMsg *) &fmsg); + close (filedes[1]); + rmsg = punpack (filedes[0]); + + fail_unless (rmsg == NULL, + "Result should be NULL with no CTX"); + + if (rmsg != NULL) + free (rmsg); +} +END_TEST + +START_TEST(test_ppack_onlyctx) +{ + int filedes[2]; + CtxMsg cmsg; + RcvMsg *rmsg; + + cmsg.ctx = CK_CTX_SETUP; + pipe (filedes); + ppack (filedes[1], CK_MSG_CTX, (CheckMsg *) &cmsg); + close (filedes[1]); + rmsg = punpack (filedes[0]); + + fail_unless (rmsg->msg == NULL, + "Result message should be NULL with only CTX"); + fail_unless (rmsg->fixture_line == -1, + "Result loc line should be -1 with only CTX"); + fail_unless (rmsg->test_line == -1, + "Result loc line should be -1 with only CTX"); + + if (rmsg != NULL) + free (rmsg); +} +END_TEST + +START_TEST(test_ppack_multictx) +{ + int filedes[2]; + CtxMsg cmsg; + LocMsg lmsg; + RcvMsg *rmsg; + + cmsg.ctx = CK_CTX_SETUP; + lmsg.line = 5; + lmsg.file = (char *) "abc123.c"; + pipe (filedes); + ppack (filedes[1], CK_MSG_CTX, (CheckMsg *) &cmsg); + ppack (filedes[1], CK_MSG_LOC, (CheckMsg *) &lmsg); + cmsg.ctx = CK_CTX_TEST; + ppack (filedes[1], CK_MSG_CTX, (CheckMsg *) &cmsg); + ppack (filedes[1], CK_MSG_LOC, (CheckMsg *) &lmsg); + cmsg.ctx = CK_CTX_TEARDOWN; + ppack (filedes[1], CK_MSG_CTX, (CheckMsg *) &cmsg); + close (filedes[1]); + rmsg = punpack (filedes[0]); + + fail_unless (rmsg->test_line == 5, + "Test loc not being preserved on CTX change"); + + fail_unless (rmsg->fixture_line == -1, + "Fixture not reset on CTX change"); + if (rmsg != NULL) + free (rmsg); +} +END_TEST + +START_TEST(test_ppack_nofail) +{ + int filedes[2]; + CtxMsg cmsg; + LocMsg lmsg; + RcvMsg *rmsg; + + lmsg.file = (char *) "abc123.c"; + lmsg.line = 10; + cmsg.ctx = CK_CTX_SETUP; + pipe (filedes); + ppack (filedes[1], CK_MSG_CTX, (CheckMsg *) &cmsg); + ppack (filedes[1], CK_MSG_LOC, (CheckMsg *) &lmsg); + close (filedes[1]); + rmsg = punpack (filedes[0]); + + fail_unless (rmsg->msg == NULL, + "Failure result should be NULL with no failure message"); + if (rmsg != NULL) + free (rmsg); +} +END_TEST + + +#define BIG_MSG_LEN 1037 + +START_TEST(test_ppack_big) +{ + int filedes[2]; + CtxMsg cmsg; + LocMsg lmsg; + FailMsg fmsg; + RcvMsg *rmsg; + + cmsg.ctx = CK_CTX_TEST; + lmsg.file = emalloc (BIG_MSG_LEN); + memset (lmsg.file,'a',BIG_MSG_LEN - 1); + lmsg.file[BIG_MSG_LEN - 1] = '\0'; + lmsg.line = 10; + fmsg.msg = emalloc (BIG_MSG_LEN); + memset (fmsg.msg, 'a', BIG_MSG_LEN - 1); + fmsg.msg[BIG_MSG_LEN - 1] = '\0'; + pipe (filedes); + ppack (filedes[1], CK_MSG_CTX, (CheckMsg *) &cmsg); + ppack (filedes[1], CK_MSG_LOC, (CheckMsg *) &lmsg); + ppack (filedes[1], CK_MSG_FAIL, (CheckMsg *) &fmsg); + close (filedes[1]); + rmsg = punpack (filedes[0]); + + fail_unless (rmsg != NULL, + "Return value from ppack should always be malloc'ed"); + fail_unless (rmsg->lastctx == CK_CTX_TEST, + "CTX not set correctly in ppack"); + fail_unless (rmsg->test_line == 10, + "Test line not received correctly"); + fail_unless (strcmp (rmsg->test_file, lmsg.file) == 0, + "Test file not received correctly"); + fail_unless (strcmp (rmsg->msg, fmsg.msg) == 0, + "Failure message not received correctly"); + + free (rmsg); + free (lmsg.file); + free (fmsg.msg); +} +END_TEST + +Suite *make_pack_suite(void) +{ + + Suite *s; + TCase *tc_core; + TCase *tc_limit; + + s = suite_create ("Pack"); + tc_core = tcase_create ("Core"); + tc_limit = tcase_create ("Limit"); + + suite_add_tcase (s, tc_core); + tcase_add_test (tc_core, test_pack_fmsg); + tcase_add_test (tc_core, test_pack_loc); + tcase_add_test (tc_core, test_pack_ctx); + tcase_add_test (tc_core, test_pack_len); + tcase_add_test (tc_core, test_ppack); + tcase_add_test (tc_core, test_ppack_noctx); + tcase_add_test (tc_core, test_ppack_onlyctx); + tcase_add_test (tc_core, test_ppack_multictx); + tcase_add_test (tc_core, test_ppack_nofail); + suite_add_tcase (s, tc_limit); + tcase_add_test (tc_limit, test_pack_ctx_limit); + tcase_add_test (tc_limit, test_pack_fail_limit); + tcase_add_test (tc_limit, test_pack_loc_limit); + tcase_add_test (tc_limit, test_ppack_big); + + return s; +} diff --git a/tests/check_check_sub.c b/tests/check_check_sub.c new file mode 100644 index 0000000..a7d4883 --- /dev/null +++ b/tests/check_check_sub.c @@ -0,0 +1,410 @@ +#include +#include +#include +#include +#include +#include +#include "check_check.h" + + + + + + + + +START_TEST(test_lno) +{ + fail("Failure expected"); /*line 18*/ +} +END_TEST + +START_TEST(test_mark_lno) +{ + mark_point(); /*line 24*/ + exit(EXIT_FAILURE); /*should fail at line 24*/ +} +END_TEST + +START_TEST(test_pass) +{ + fail_unless(1 == 1, "This test should pass"); + fail_unless(9999, "This test should pass"); +} +END_TEST + +START_TEST(test_fail) +{ + fail_unless(1 == 2, "This test should fail"); +} +END_TEST + +START_TEST(test_fail_if_pass) +{ + fail_if(1 == 2, "This test should pass"); + fail_if(0, "This test should pass"); +} +END_TEST + +START_TEST(test_fail_if_fail) +{ + fail_if(1 == 1, "This test should fail"); +} +END_TEST + +START_TEST(test_fail_null_msg) +{ + fail_unless(2 == 3, NULL); +} +END_TEST + + +START_TEST(test_fail_no_msg) +{ + fail_unless(4 == 5); +} +END_TEST + +START_TEST(test_fail_if_null_msg) +{ + fail_if(2 != 3, NULL); +} +END_TEST + + +START_TEST(test_fail_if_no_msg) +{ + fail_if(4 != 5); +} +END_TEST + +START_TEST(test_fail_vararg_msg_1) +{ + int x = 3; + int y = 4; + fail_unless(x == y, "%d != %d", x, y); +} +END_TEST + +START_TEST(test_fail_vararg_msg_2) +{ + int x = 5; + int y = 6; + fail_if(x != y, "%d != %d", x, y); +} +END_TEST + +START_TEST(test_fail_vararg_msg_3) +{ + int x = 7; + int y = 7; + fail("%d == %d", x, y); +} +END_TEST + +START_TEST(test_fail_empty) +{ + fail(); +} +END_TEST + +START_TEST(test_segv) /* line 111 */ +{ + raise (SIGSEGV); +} +END_TEST + + +START_TEST(test_fpe) +{ + raise (SIGFPE); +} +END_TEST + +/* TODO: + unit test running the same suite in succession */ + +START_TEST(test_mark_point) +{ + int i; + i = 0; + i++; + mark_point(); + raise(SIGFPE); + fail("Shouldn't reach here"); +} +END_TEST + +#if TIMEOUT_TESTS_ENABLED +START_TEST(test_eternal) /* line 139 */ +{ + for (;;) + ; +} +END_TEST + +START_TEST(test_sleep2) +{ + sleep(2); +} +END_TEST + +START_TEST(test_sleep5) /* line 152 */ +{ + sleep(5); +} +END_TEST + +START_TEST(test_sleep8) /* line 158 */ +{ + sleep(8); +} +END_TEST +#endif + +START_TEST(test_early_exit) +{ + exit(EXIT_FAILURE); +} +END_TEST + +START_TEST(test_null) +{ + Suite *s; + TCase *tc; + SRunner *sr; + + s = suite_create(NULL); + tc = tcase_create(NULL); + suite_add_tcase (s, NULL); + tcase_add_test (tc, NULL); + sr = srunner_create(NULL); + srunner_run_all (NULL, -1); + srunner_free (NULL); + fail("Completed properly"); +} +END_TEST + +START_TEST(test_null_2) +{ + SRunner *sr = srunner_create(NULL); + srunner_run_all (sr, CK_NORMAL); + srunner_free (sr); + fail("Completed properly"); +} +END_TEST + +START_TEST(test_fork1p_pass) +{ + pid_t pid; + + if((pid = fork()) < 0) { + fail("Failed to fork new process"); + } else if (pid > 0) { + fail_unless(1); + kill(pid, SIGKILL); + } else { + for (;;) { + sleep(1); + } + } +} +END_TEST + +START_TEST(test_fork1p_fail) +{ + pid_t pid; + + if((pid = fork()) < 0) { + fail("Failed to fork new process"); + } else if (pid > 0) { + fail("Expected fail"); + kill(pid, SIGKILL); + } else { + for (;;) { + sleep(1); + } + } +} +END_TEST + +START_TEST(test_fork1c_pass) +{ + pid_t pid; + + if((pid = check_fork()) < 0) { + fail("Failed to fork new process"); + } else if (pid > 0) { + check_waitpid_and_exit(pid); + } else { + fail_unless(1); + check_waitpid_and_exit(0); + } +} +END_TEST + +START_TEST(test_fork1c_fail) +{ + pid_t pid; + + if((pid = check_fork()) < 0) { + fail("Failed to fork new process"); + } else if (pid == 0) { + fail("Expected fail"); + check_waitpid_and_exit(0); + } + check_waitpid_and_exit(pid); +} +END_TEST + +START_TEST(test_fork2_pass) +{ + pid_t pid; + pid_t pid2; + + if((pid = check_fork()) < 0) { + fail("Failed to fork new process"); + } else if (pid > 0) { + if((pid2 = check_fork()) < 0) { + fail("Failed to fork new process"); + } else if (pid2 == 0) { + fail_unless(1); + check_waitpid_and_exit(0); + } + check_waitpid_and_exit(pid2); + } + check_waitpid_and_exit(pid); +} +END_TEST + +START_TEST(test_fork2_fail) +{ + pid_t pid; + pid_t pid2; + + if((pid = check_fork()) < 0) { + fail("Failed to fork new process"); + } else if (pid > 0) { + if((pid2 = check_fork()) < 0) { + fail("Failed to fork new process"); + } else if (pid2 == 0) { + fail("Expected fail"); + check_waitpid_and_exit(0); + } + check_waitpid_and_exit(pid2); + fail("Expected fail"); + } + check_waitpid_and_exit(pid); +} +END_TEST + +START_TEST(test_2nd_suite) +{ + fail("We failed"); +} +END_TEST + +Suite *make_sub2_suite(void) +{ + Suite *s = suite_create("Check Servant2"); + TCase *tc = tcase_create("Core"); + suite_add_tcase(s, tc); + tcase_add_test(tc, test_2nd_suite); + + return s; +} + +Suite *make_sub_suite(void) +{ + Suite *s; + + TCase *tc_simple; + TCase *tc_signal; +#if TIMEOUT_TESTS_ENABLED + TCase *tc_timeout_env; + TCase *tc_timeout; + TCase *tc_timeout_usr; +#endif + TCase *tc_limit; + TCase *tc_messaging_and_fork; + + s = suite_create("Check Servant"); + + tc_simple = tcase_create("Simple Tests"); + tc_signal = tcase_create("Signal Tests"); +#if TIMEOUT_TESTS_ENABLED + setenv("CK_DEFAULT_TIMEOUT", "6", 1); + tc_timeout_env = tcase_create("Environment Timeout Tests"); + unsetenv("CK_DEFAULT_TIMEOUT"); + tc_timeout = tcase_create("Timeout Tests"); + tc_timeout_usr = tcase_create("User Timeout Tests"); +#endif + tc_limit = tcase_create("Limit Tests"); + tc_messaging_and_fork = tcase_create("Msg and fork Tests"); + + suite_add_tcase (s, tc_simple); + suite_add_tcase (s, tc_signal); +#if TIMEOUT_TESTS_ENABLED + suite_add_tcase (s, tc_timeout_env); + suite_add_tcase (s, tc_timeout); + suite_add_tcase (s, tc_timeout_usr); + /* Add a second time to make sure tcase_set_timeout doesn't contaminate it. */ + suite_add_tcase (s, tc_timeout); +#endif + suite_add_tcase (s, tc_limit); + suite_add_tcase (s, tc_messaging_and_fork); + + tcase_add_test (tc_simple, test_lno); + tcase_add_test (tc_simple, test_mark_lno); + tcase_add_test (tc_simple, test_pass); + tcase_add_test (tc_simple, test_fail); + tcase_add_test (tc_simple, test_fail_if_pass); + tcase_add_test (tc_simple, test_fail_if_fail); + tcase_add_test (tc_simple, test_fail_null_msg); + tcase_add_test (tc_simple, test_fail_no_msg); + tcase_add_test (tc_simple, test_fail_if_null_msg); + tcase_add_test (tc_simple, test_fail_if_no_msg); + tcase_add_test (tc_simple, test_fail_vararg_msg_1); + tcase_add_test (tc_simple, test_fail_vararg_msg_2); + tcase_add_test (tc_simple, test_fail_vararg_msg_3); + tcase_add_test (tc_simple, test_fail_empty); + + tcase_add_test (tc_signal, test_segv); + tcase_add_test_raise_signal (tc_signal, test_segv, 11); /* pass */ + tcase_add_test_raise_signal (tc_signal, test_segv, 8); /* error */ + tcase_add_test_raise_signal (tc_signal, test_pass, 8); /* fail */ + tcase_add_test_raise_signal (tc_signal, test_fail, 8); /* fail */ + tcase_add_test (tc_signal, test_fpe); + tcase_add_test (tc_signal, test_mark_point); + +#if TIMEOUT_TESTS_ENABLED + tcase_add_test (tc_timeout_env, test_eternal); + tcase_add_test (tc_timeout_env, test_sleep2); + tcase_add_test (tc_timeout_env, test_sleep5); + tcase_add_test (tc_timeout_env, test_sleep8); + + tcase_add_test (tc_timeout, test_eternal); + tcase_add_test (tc_timeout, test_sleep2); + tcase_add_test (tc_timeout, test_sleep5); + tcase_add_test (tc_timeout, test_sleep8); + + tcase_set_timeout (tc_timeout_usr, 6); + tcase_add_test (tc_timeout_usr, test_eternal); + tcase_add_test (tc_timeout_usr, test_sleep2); + tcase_add_test (tc_timeout_usr, test_sleep5); + tcase_add_test (tc_timeout_usr, test_sleep8); +#endif + + tcase_add_test (tc_limit, test_early_exit); + tcase_add_test (tc_limit, test_null); + tcase_add_test (tc_limit, test_null_2); + + tcase_add_test (tc_messaging_and_fork, test_fork1p_pass); + tcase_add_test (tc_messaging_and_fork, test_fork1p_fail); + tcase_add_test (tc_messaging_and_fork, test_fork1c_pass); + tcase_add_test (tc_messaging_and_fork, test_fork1c_fail); + tcase_add_test (tc_messaging_and_fork, test_fork2_pass); + tcase_add_test (tc_messaging_and_fork, test_fork2_fail); + + return s; +} diff --git a/tests/check_list.c b/tests/check_list.c new file mode 100644 index 0000000..6ad71f4 --- /dev/null +++ b/tests/check_list.c @@ -0,0 +1,148 @@ +#include +#include + +#include "check.h" +#include "check_list.h" +#include "check_check.h" + +START_TEST(test_create) +{ + List *lp = NULL; + + fail_unless (list_val(lp) == NULL, + "Current list value should be NULL for NULL list"); + + lp = check_list_create(); + + fail_unless (list_val(lp) == NULL, + "Current list value should be NULL for newly created list"); + + fail_unless (list_at_end(lp), + "Newly created list should be at end"); + list_advance(lp); + fail_unless (list_at_end(lp), + "Advancing a list at end should produce a list at end"); + list_free (lp); +} +END_TEST + +START_TEST(test_free) +{ + List *lp = check_list_create(); + list_add_end (lp, "abc"); + list_add_end (lp, "123"); + list_add_end (lp, NULL); + list_free (lp); +} +END_TEST + +START_TEST(test_add_end) +{ + List * lp = check_list_create(); + const char * tval = "abc"; + + list_add_end (lp, tval); + + fail_unless (list_val (lp) != NULL, + "List current val should not be null after new insertion"); + fail_unless (!list_at_end (lp), + "List should be at end after new insertion"); + fail_unless (strcmp(tval, (char *) list_val (lp)) == 0, + "List current val should equal newly inserted val"); + list_free (lp); +} +END_TEST + +START_TEST(test_add_front) +{ + List * lp = check_list_create(); + const char * tval = "abc"; + + list_add_front (lp, tval); + + fail_unless (list_val (lp) != NULL, + "List current val should not be null after new insertion"); + fail_unless (strcmp(tval, (char *) list_val (lp)) == 0, + "List current val should equal newly inserted val"); + list_free (lp); +} +END_TEST + +START_TEST(test_add_end_and_next) +{ + List *lp = check_list_create(); + const char *tval1 = "abc"; + const char *tval2 = "123"; + + list_add_end (lp, tval1); + list_add_end (lp, tval2); + list_front(lp); + fail_unless (strcmp (tval1, list_val (lp)) == 0, + "List head val should equal first inserted val"); + list_advance (lp); + fail_unless (!list_at_end (lp), + "List should not be at end after two adds and one next"); + fail_unless (strcmp (tval2, list_val (lp)) == 0, + "List val should equal second inserted val"); + list_advance(lp); + fail_unless (list_at_end (lp), + "List should be at and after two adds and two nexts"); + list_free (lp); +} +END_TEST + + +START_TEST(test_add_front_and_next) +{ + List * lp = check_list_create(); + const char *tval1 = "abc"; + const char *tval2 = "123"; + + list_add_front (lp, tval1); + list_add_front (lp, tval2); + list_front(lp); + fail_unless (strcmp (tval2, list_val (lp)) == 0, + "List head val should equal last inserted val"); + list_advance (lp); + fail_unless (!list_at_end (lp), + "List should not be at end after two adds and one next"); + fail_unless (strcmp (tval1, list_val (lp)) == 0, + "List val should equal first inserted val"); + list_advance(lp); + fail_unless (list_at_end (lp), + "List should be at and after two adds and two nexts"); + list_free (lp); +} +END_TEST + +START_TEST(test_add_a_bunch) +{ + List *lp; + int i, j; + for (i = 0; i < 3; i++) { + lp = check_list_create(); + for (j = 0; j < 1000; j++) { + list_add_end (lp, "abc"); + list_add_front (lp, "123"); + } + list_free(lp); + } +} +END_TEST + + +Suite *make_list_suite (void) +{ + Suite *s = suite_create("Lists"); + TCase * tc = tcase_create("Core"); + + suite_add_tcase (s, tc); + tcase_add_test (tc, test_create); + tcase_add_test (tc, test_free); + tcase_add_test (tc, test_add_end); + tcase_add_test (tc, test_add_front); + tcase_add_test (tc, test_add_end_and_next); + tcase_add_test (tc, test_add_front_and_next); + tcase_add_test (tc, test_add_a_bunch); + return s; +} diff --git a/tests/check_stress.c b/tests/check_stress.c new file mode 100644 index 0000000..512c5e0 --- /dev/null +++ b/tests/check_stress.c @@ -0,0 +1,60 @@ +#include +#include +#include +#include + + +Suite *s; +TCase *tc; +SRunner *sr; + +START_TEST(test_pass) +{ + fail_unless(1,"Shouldn't see this message"); +} +END_TEST + +START_TEST(test_fail) +{ + fail("This test fails"); +} +END_TEST + + +static void run (int num_iters) +{ + int i; + s = suite_create ("Stress"); + tc = tcase_create ("Stress"); + sr = srunner_create (s); + suite_add_tcase(s, tc); + + for (i = 0; i < num_iters; i++) { + tcase_add_test (tc, test_pass); + tcase_add_test (tc, test_fail); + } + + srunner_run_all(sr, CK_SILENT); + if (srunner_ntests_failed (sr) != num_iters) { + printf ("Error: expected %d failures, got %d\n", + num_iters, srunner_ntests_failed(sr)); + return; + } + + srunner_free(sr); +} + + +int main(void) +{ + int i; + time_t t1; + int iters[] = {1, 100, 1000, 2000, 4000, 8000, 10000, 20000, 40000, -1}; + + for (i = 0; iters[i] != -1; i++) { + t1 = time(NULL); + run(iters[i]); + printf ("%d, %d\n", iters[i], (int) difftime(time(NULL), t1)); + } + return 0; +} diff --git a/tests/ex_log_output.c b/tests/ex_log_output.c new file mode 100644 index 0000000..bae65f4 --- /dev/null +++ b/tests/ex_log_output.c @@ -0,0 +1,98 @@ +#include +#include +#include +#include + +START_TEST(test_pass) +{ + fail_unless (1==1, "Shouldn't see this"); +} +END_TEST + +START_TEST(test_fail) +{ + fail("Failure"); +} +END_TEST + +START_TEST(test_exit) +{ + exit(1); +} +END_TEST + +START_TEST(test_pass2) +{ + fail_unless (1==1, "Shouldn't see this"); +} +END_TEST + +static Suite *make_s1_suite (void) +{ + Suite *s; + TCase *tc; + + s = suite_create("S1"); + tc = tcase_create ("Core"); + suite_add_tcase(s, tc); + tcase_add_test (tc, test_pass); + tcase_add_test (tc, test_fail); + tcase_add_test (tc, test_exit); + + return s; +} + +static Suite *make_s2_suite (void) +{ + Suite *s; + TCase *tc; + + s = suite_create("S2"); + tc = tcase_create ("Core"); + suite_add_tcase(s, tc); + tcase_add_test (tc, test_pass2); + + return s; +} + +static void run_tests (int printmode) +{ + SRunner *sr; + + sr = srunner_create(make_s1_suite()); + srunner_add_suite(sr, make_s2_suite()); + srunner_set_log(sr, "test.log"); + srunner_run_all(sr, printmode); + srunner_free(sr); +} + +static void usage(void) +{ + printf ("Usage: ex_output (CRSILENT | CRMINIMAL | CRNORMAL | CRVERBOSE)\n"); +} + +int main (int argc, char **argv) +{ + + if (argc != 2) { + usage(); + return EXIT_FAILURE; + } + + if (strcmp (argv[1], "CK_SILENT") == 0) + run_tests(CK_SILENT); + else if (strcmp (argv[1], "CK_MINIMAL") == 0) + run_tests(CK_MINIMAL); + else if (strcmp (argv[1], "CK_NORMAL") == 0) + run_tests(CK_NORMAL); + else if (strcmp (argv[1], "CK_VERBOSE") == 0) + run_tests(CK_VERBOSE); + else { + usage(); + return EXIT_FAILURE; + } + + + return EXIT_SUCCESS; +} + diff --git a/tests/ex_output.c b/tests/ex_output.c new file mode 100644 index 0000000..66c611b --- /dev/null +++ b/tests/ex_output.c @@ -0,0 +1,74 @@ +#include +#include +#include +#include + +START_TEST(test_pass) +{ + fail_unless (1==1, "Shouldn't see this"); +} +END_TEST + +START_TEST(test_fail) +{ + fail("Failure"); +} +END_TEST + +START_TEST(test_exit) +{ + exit(1); +} +END_TEST + +static Suite *make_suite (void) +{ + Suite *s; + TCase *tc; + + s = suite_create("Master"); + tc = tcase_create ("Core"); + suite_add_tcase(s, tc); + tcase_add_test (tc, test_pass); + tcase_add_test (tc, test_fail); + tcase_add_test (tc, test_exit); + + return s; +} + +static void run_tests (int printmode) +{ + SRunner *sr; + Suite *s; + + s = make_suite(); + sr = srunner_create(s); + srunner_run_all(sr, printmode); + srunner_free(sr); +} + +int main (int argc, char **argv) +{ + + if (argc != 2) { + printf ("Usage: ex_output (CK_SILENT | CK_MINIMAL | CK_NORMAL | CK_VERBOSE)\n"); + return EXIT_FAILURE; + } + + if (strcmp (argv[1], "CK_SILENT") == 0) + run_tests(CK_SILENT); + else if (strcmp (argv[1], "CK_MINIMAL") == 0) + run_tests(CK_MINIMAL); + else if (strcmp (argv[1], "CK_NORMAL") == 0) + run_tests(CK_NORMAL); + else if (strcmp (argv[1], "CK_VERBOSE") == 0) + run_tests(CK_VERBOSE); + else { + printf ("Usage: ex_output (CK_SILENT | CK_MINIMAL | CK_NORMAL | CK_VERBOSE)\n"); + return EXIT_FAILURE; + } + + + return EXIT_SUCCESS; +} + diff --git a/tests/ex_xml_output.c b/tests/ex_xml_output.c new file mode 100644 index 0000000..818f94e --- /dev/null +++ b/tests/ex_xml_output.c @@ -0,0 +1,83 @@ +#include +#include +#include +#include + +START_TEST(test_pass) +{ + fail_unless (1==1, "Shouldn't see this"); +} +END_TEST + +START_TEST(test_fail) +{ + fail("Failure"); +} +END_TEST + +START_TEST(test_exit) +{ + exit(1); +} +END_TEST + +START_TEST(test_pass2) +{ + fail_unless (1==1, "Shouldn't see this"); +} +END_TEST + +START_TEST(test_loop) +{ + fail_unless (_i==1, "Iteration %d failed", _i); +} +END_TEST + +static Suite *make_s1_suite (void) +{ + Suite *s; + TCase *tc; + + s = suite_create("S1"); + tc = tcase_create ("Core"); + suite_add_tcase(s, tc); + tcase_add_test (tc, test_pass); + tcase_add_test (tc, test_fail); + tcase_add_test (tc, test_exit); + + return s; +} + +static Suite *make_s2_suite (void) +{ + Suite *s; + TCase *tc; + + s = suite_create("S2"); + tc = tcase_create ("Core"); + suite_add_tcase(s, tc); + tcase_add_test (tc, test_pass2); + tcase_add_loop_test(tc, test_loop, 0, 3); + + return s; +} + +static void run_tests (int printmode) +{ + SRunner *sr; + + sr = srunner_create(make_s1_suite()); + srunner_add_suite(sr, make_s2_suite()); + srunner_set_xml(sr, "test.log.xml"); + srunner_run_all(sr, printmode); + srunner_free(sr); +} + + +int main (int argc, char **argv) +{ + run_tests(CK_SILENT); /* not considered in XML output */ + + return EXIT_SUCCESS; +} + diff --git a/tests/test_log_output.sh b/tests/test_log_output.sh new file mode 100755 index 0000000..d96b860 --- /dev/null +++ b/tests/test_log_output.sh @@ -0,0 +1,38 @@ +#!/bin/sh + +if [ "${srcdir}" = "." ]; then + lsrc="" +else + lsrc="${srcdir}/" +fi + +expected="Running suite S1 +${lsrc}ex_log_output.c:8:P:Core:test_pass:0: Passed +${lsrc}ex_log_output.c:14:F:Core:test_fail:0: Failure +${lsrc}ex_log_output.c:18:E:Core:test_exit:0: (after this point) Early exit with return value 1 +Running suite S2 +${lsrc}ex_log_output.c:26:P:Core:test_pass2:0: Passed +Results for all suites run: +50%: Checks: 4, Failures: 1, Errors: 1" + + +test_log_output ( ) { + + ./ex_log_output "${1}" > /dev/null + actual=`cat test.log` + if [ x"${expected}" != x"${actual}" ]; then + echo "Problem with ex_log_output ${3}"; + echo "Expected:"; + echo "${expected}"; + echo "Got:"; + echo "${actual}"; + exit 1; + fi + +} + +test_log_output "CK_SILENT"; +test_log_output "CK_MINIMAL"; +test_log_output "CK_NORMAL"; +test_log_output "CK_VERBOSE"; +exit 0 diff --git a/tests/test_output.sh b/tests/test_output.sh new file mode 100755 index 0000000..f6f93f5 --- /dev/null +++ b/tests/test_output.sh @@ -0,0 +1,44 @@ +#!/bin/sh + +if [ "${srcdir}" = "." ]; then + lsrc="" +else + lsrc="${srcdir}/" +fi + +t0="x" +t1="xRunning suite(s): Master +33%: Checks: 3, Failures: 1, Errors: 1" +t2="xRunning suite(s): Master +33%: Checks: 3, Failures: 1, Errors: 1 +${lsrc}ex_output.c:14:F:Core:test_fail:0: Failure +${lsrc}ex_output.c:18:E:Core:test_exit:0: (after this point) Early exit with return value 1" +t3="xRunning suite(s): Master +33%: Checks: 3, Failures: 1, Errors: 1 +${lsrc}ex_output.c:8:P:Core:test_pass:0: Passed +${lsrc}ex_output.c:14:F:Core:test_fail:0: Failure +${lsrc}ex_output.c:18:E:Core:test_exit:0: (after this point) Early exit with return value 1" + +op0=`./ex_output CK_SILENT` +op1=`./ex_output CK_MINIMAL` +op2=`./ex_output CK_NORMAL` +op3=`./ex_output CK_VERBOSE` + + +test_output ( ) { + if [ "${1}" != "${2}" ]; then + echo "Problem with ex_output ${3}"; + echo "Expected:"; + echo "${1}"; + echo "Got:"; + echo "${2}"; + exit 1; + fi + +} + +test_output "$t0" x"$op0" "CK_SILENT"; +test_output "$t1" x"$op1" "CK_MINIMAL"; +test_output "$t2" x"$op2" "CK_NORMAL"; +test_output "$t3" x"$op3" "CK_VERBOSE"; +exit 0 diff --git a/tests/test_xml_output.sh b/tests/test_xml_output.sh new file mode 100755 index 0000000..595e9f0 --- /dev/null +++ b/tests/test_xml_output.sh @@ -0,0 +1,79 @@ +#!/bin/sh + +if [ "${srcdir}" = "." ]; then + lsrc="" +else + lsrc="${srcdir}/" +fi + +expected=" + + + S1 + + ex_xml_output.c:8 + test_pass + 0 + Core + Passed + + + ex_xml_output.c:14 + test_fail + 0 + Core + Failure + + + ex_xml_output.c:18 + test_exit + 0 + Core + Early exit with return value 1 + + + + S2 + + ex_xml_output.c:26 + test_pass2 + 0 + Core + Passed + + + ex_xml_output.c:32 + test_loop + 0 + Core + Iteration 0 failed + + + ex_xml_output.c:32 + test_loop + 1 + Core + Passed + + + ex_xml_output.c:32 + test_loop + 2 + Core + Iteration 2 failed + + +" + +./ex_xml_output > /dev/null +actual=`cat test.log.xml | grep -v \ | grep -v \ | grep -v \` +if [ x"${expected}" != x"${actual}" ]; then + echo "Problem with ex_xml_output ${3}"; + echo "Expected:"; + echo "${expected}"; + echo "Got:"; + echo "${actual}"; + exit 1; +fi + +exit 0