From 4c67895371a2eb6e78fc3dfb0bc22d8106373857 Mon Sep 17 00:00:00 2001 From: "Patrick H. E. Foubet" Date: Sun, 2 Mar 2014 17:58:16 +0100 Subject: [PATCH] Version 0.44 --- AUTHORS | 22 + COPYING | 340 +++ ChangeLog | 19 + INSTALL | 236 ++ Makefile.am | 8 + Makefile.in | 586 +++++ NEWS | 154 ++ README | 106 + README.md | 106 + aclocal.m4 | 850 +++++++ config.h.in | 143 ++ configure | 6289 ++++++++++++++++++++++++++++++++++++++++++++++ configure.ac | 39 + depcomp | 530 ++++ install-sh | 323 +++ missing | 360 +++ src/Makefile.am | 27 + src/Makefile.in | 446 ++++ src/benchm.nif | 15 + src/conf.h | 37 + src/debug.c | 82 + src/debug.h | 29 + src/dev.c | 318 +++ src/dev.h | 30 + src/err.c | 189 ++ src/err.h | 34 + src/ex/gp.nif | 49 + src/ex/rpc.nif | 21 + src/ex/rpc2.nif | 9 + src/foncs.c | 270 ++ src/foncs.h | 35 + src/gplot.c | 370 +++ src/gplot.h | 31 + src/help.c | 55 + src/help.h | 23 + src/histo.c | 460 ++++ src/histo.h | 32 + src/lib.c | 642 +++++ src/lib.h | 33 + src/libmath.c | 82 + src/libmath.h | 53 + src/libmathc99.c | 28 + src/mth.c | 212 ++ src/mth.h | 210 ++ src/net.c | 1034 ++++++++ src/net.h | 45 + src/nife.c | 325 +++ src/nife.h | 44 + src/nife.hlp | 642 +++++ src/scs.c | 123 + src/scs.h | 26 + src/stackC.c | 243 ++ src/stackC.h | 38 + src/stackF.c | 1333 ++++++++++ src/stackF.h | 120 + src/stackL.c | 180 ++ src/stackL.h | 40 + src/stackN.c | 1897 ++++++++++++++ src/stackN.h | 125 + src/stackV.c | 390 +++ src/stackV.h | 39 + src/tasks.c | 167 ++ src/tasks.h | 32 + src/test.sh | 12 + 64 files changed, 20788 insertions(+) create mode 100644 AUTHORS create mode 100644 COPYING create mode 100644 ChangeLog create mode 100644 INSTALL create mode 100644 Makefile.am create mode 100644 Makefile.in create mode 100644 NEWS create mode 100644 README create mode 100644 README.md create mode 100644 aclocal.m4 create mode 100644 config.h.in create mode 100755 configure create mode 100644 configure.ac create mode 100755 depcomp create mode 100755 install-sh create mode 100755 missing create mode 100644 src/Makefile.am create mode 100644 src/Makefile.in create mode 100644 src/benchm.nif create mode 100644 src/conf.h create mode 100644 src/debug.c create mode 100644 src/debug.h create mode 100644 src/dev.c create mode 100644 src/dev.h create mode 100644 src/err.c create mode 100644 src/err.h create mode 100644 src/ex/gp.nif create mode 100644 src/ex/rpc.nif create mode 100644 src/ex/rpc2.nif create mode 100644 src/foncs.c create mode 100644 src/foncs.h create mode 100644 src/gplot.c create mode 100644 src/gplot.h create mode 100644 src/help.c create mode 100644 src/help.h create mode 100644 src/histo.c create mode 100644 src/histo.h create mode 100644 src/lib.c create mode 100644 src/lib.h create mode 100644 src/libmath.c create mode 100644 src/libmath.h create mode 100644 src/libmathc99.c create mode 100644 src/mth.c create mode 100644 src/mth.h create mode 100644 src/net.c create mode 100644 src/net.h create mode 100644 src/nife.c create mode 100644 src/nife.h create mode 100644 src/nife.hlp create mode 100644 src/scs.c create mode 100644 src/scs.h create mode 100644 src/stackC.c create mode 100644 src/stackC.h create mode 100644 src/stackF.c create mode 100644 src/stackF.h create mode 100644 src/stackL.c create mode 100644 src/stackL.h create mode 100644 src/stackN.c create mode 100644 src/stackN.h create mode 100644 src/stackV.c create mode 100644 src/stackV.h create mode 100644 src/tasks.c create mode 100644 src/tasks.h create mode 100755 src/test.sh diff --git a/AUTHORS b/AUTHORS new file mode 100644 index 0000000..8115717 --- /dev/null +++ b/AUTHORS @@ -0,0 +1,22 @@ +This file lists people who have made significant contribution in the nife +project. Please see the ChangeLog for specific changes by author. +------------------------------------------------------------------------- + +Patrick H. E. Foubet + * Original program author, stable series maintainer. + * Cohesion of language supervisor. Multiple platform maintainer. + * Stack to Stack protocol developper, and much more. + +Christophe Ondrejec + * Administrator of the site nife-project.org. + * Internationalization support head. + * Package tester. + +Claude Mauvais + * Mathematical functions supervisor and developper. + * Package tester. + +Bruno Guilbert + * Devices interface tester and developper. + * Package tester. + diff --git a/COPYING b/COPYING new file mode 100644 index 0000000..8868387 --- /dev/null +++ b/COPYING @@ -0,0 +1,340 @@ + GNU GENERAL PUBLIC LICENSE + Version 2, June 1991 + + Copyright (C) 1989, 1991 Free Software Foundation, Inc. + 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA + Everyone is permitted to copy and distribute verbatim copies + of this license document, but changing it is not allowed. + + Preamble + + The licenses for most software are designed to take away your +freedom to share and change it. By contrast, the GNU General Public +License is intended to guarantee your freedom to share and change free +software--to make sure the software is free for all its users. This +General Public License applies to most of the Free Software +Foundation's software and to any other program whose authors commit to +using it. (Some other Free Software Foundation software is covered by +the GNU Library General Public License instead.) You can apply it to +your programs, too. + + When we speak of free software, we are referring to freedom, not +price. Our General Public Licenses are designed to make sure that you +have the freedom to distribute copies of free software (and charge for +this service if you wish), that you receive source code or can get it +if you want it, that you can change the software or use pieces of it +in new free programs; and that you know you can do these things. + + To protect your rights, we need to make restrictions that forbid +anyone to deny you these rights or to ask you to surrender the rights. +These restrictions translate to certain responsibilities for you if you +distribute copies of the software, or if you modify it. + + For example, if you distribute copies of such a program, whether +gratis or for a fee, you must give the recipients all the rights that +you have. You must make sure that they, too, receive or can get the +source code. And you must show them these terms so they know their +rights. + + We protect your rights with two steps: (1) copyright the software, and +(2) offer you this license which gives you legal permission to copy, +distribute and/or modify the software. + + Also, for each author's protection and ours, we want to make certain +that everyone understands that there is no warranty for this free +software. If the software is modified by someone else and passed on, we +want its recipients to know that what they have is not the original, so +that any problems introduced by others will not reflect on the original +authors' reputations. + + Finally, any free program is threatened constantly by software +patents. We wish to avoid the danger that redistributors of a free +program will individually obtain patent licenses, in effect making the +program proprietary. To prevent this, we have made it clear that any +patent must be licensed for everyone's free use or not licensed at all. + + The precise terms and conditions for copying, distribution and +modification follow. + + GNU GENERAL PUBLIC LICENSE + TERMS AND CONDITIONS FOR COPYING, DISTRIBUTION AND MODIFICATION + + 0. This License applies to any program or other work which contains +a notice placed by the copyright holder saying it may be distributed +under the terms of this General Public License. The "Program", below, +refers to any such program or work, and a "work based on the Program" +means either the Program or any derivative work under copyright law: +that is to say, a work containing the Program or a portion of it, +either verbatim or with modifications and/or translated into another +language. (Hereinafter, translation is included without limitation in +the term "modification".) Each licensee is addressed as "you". + +Activities other than copying, distribution and modification are not +covered by this License; they are outside its scope. The act of +running the Program is not restricted, and the output from the Program +is covered only if its contents constitute a work based on the +Program (independent of having been made by running the Program). +Whether that is true depends on what the Program does. + + 1. You may copy and distribute verbatim copies of the Program's +source code as you receive it, in any medium, provided that you +conspicuously and appropriately publish on each copy an appropriate +copyright notice and disclaimer of warranty; keep intact all the +notices that refer to this License and to the absence of any warranty; +and give any other recipients of the Program a copy of this License +along with the Program. + +You may charge a fee for the physical act of transferring a copy, and +you may at your option offer warranty protection in exchange for a fee. + + 2. You may modify your copy or copies of the Program or any portion +of it, thus forming a work based on the Program, and copy and +distribute such modifications or work under the terms of Section 1 +above, provided that you also meet all of these conditions: + + a) You must cause the modified files to carry prominent notices + stating that you changed the files and the date of any change. + + b) You must cause any work that you distribute or publish, that in + whole or in part contains or is derived from the Program or any + part thereof, to be licensed as a whole at no charge to all third + parties under the terms of this License. + + c) If the modified program normally reads commands interactively + when run, you must cause it, when started running for such + interactive use in the most ordinary way, to print or display an + announcement including an appropriate copyright notice and a + notice that there is no warranty (or else, saying that you provide + a warranty) and that users may redistribute the program under + these conditions, and telling the user how to view a copy of this + License. (Exception: if the Program itself is interactive but + does not normally print such an announcement, your work based on + the Program is not required to print an announcement.) + +These requirements apply to the modified work as a whole. If +identifiable sections of that work are not derived from the Program, +and can be reasonably considered independent and separate works in +themselves, then this License, and its terms, do not apply to those +sections when you distribute them as separate works. But when you +distribute the same sections as part of a whole which is a work based +on the Program, the distribution of the whole must be on the terms of +this License, whose permissions for other licensees extend to the +entire whole, and thus to each and every part regardless of who wrote it. + +Thus, it is not the intent of this section to claim rights or contest +your rights to work written entirely by you; rather, the intent is to +exercise the right to control the distribution of derivative or +collective works based on the Program. + +In addition, mere aggregation of another work not based on the Program +with the Program (or with a work based on the Program) on a volume of +a storage or distribution medium does not bring the other work under +the scope of this License. + + 3. You may copy and distribute the Program (or a work based on it, +under Section 2) in object code or executable form under the terms of +Sections 1 and 2 above provided that you also do one of the following: + + a) Accompany it with the complete corresponding machine-readable + source code, which must be distributed under the terms of Sections + 1 and 2 above on a medium customarily used for software interchange; or, + + b) Accompany it with a written offer, valid for at least three + years, to give any third party, for a charge no more than your + cost of physically performing source distribution, a complete + machine-readable copy of the corresponding source code, to be + distributed under the terms of Sections 1 and 2 above on a medium + customarily used for software interchange; or, + + c) Accompany it with the information you received as to the offer + to distribute corresponding source code. (This alternative is + allowed only for noncommercial distribution and only if you + received the program in object code or executable form with such + an offer, in accord with Subsection b above.) + +The source code for a work means the preferred form of the work for +making modifications to it. For an executable work, complete source +code means all the source code for all modules it contains, plus any +associated interface definition files, plus the scripts used to +control compilation and installation of the executable. However, as a +special exception, the source code distributed need not include +anything that is normally distributed (in either source or binary +form) with the major components (compiler, kernel, and so on) of the +operating system on which the executable runs, unless that component +itself accompanies the executable. + +If distribution of executable or object code is made by offering +access to copy from a designated place, then offering equivalent +access to copy the source code from the same place counts as +distribution of the source code, even though third parties are not +compelled to copy the source along with the object code. + + 4. You may not copy, modify, sublicense, or distribute the Program +except as expressly provided under this License. Any attempt +otherwise to copy, modify, sublicense or distribute the Program is +void, and will automatically terminate your rights under this License. +However, parties who have received copies, or rights, from you under +this License will not have their licenses terminated so long as such +parties remain in full compliance. + + 5. You are not required to accept this License, since you have not +signed it. However, nothing else grants you permission to modify or +distribute the Program or its derivative works. These actions are +prohibited by law if you do not accept this License. Therefore, by +modifying or distributing the Program (or any work based on the +Program), you indicate your acceptance of this License to do so, and +all its terms and conditions for copying, distributing or modifying +the Program or works based on it. + + 6. Each time you redistribute the Program (or any work based on the +Program), the recipient automatically receives a license from the +original licensor to copy, distribute or modify the Program subject to +these terms and conditions. You may not impose any further +restrictions on the recipients' exercise of the rights granted herein. +You are not responsible for enforcing compliance by third parties to +this License. + + 7. If, as a consequence of a court judgment or allegation of patent +infringement or for any other reason (not limited to patent issues), +conditions are imposed on you (whether by court order, agreement or +otherwise) that contradict the conditions of this License, they do not +excuse you from the conditions of this License. If you cannot +distribute so as to satisfy simultaneously your obligations under this +License and any other pertinent obligations, then as a consequence you +may not distribute the Program at all. For example, if a patent +license would not permit royalty-free redistribution of the Program by +all those who receive copies directly or indirectly through you, then +the only way you could satisfy both it and this License would be to +refrain entirely from distribution of the Program. + +If any portion of this section is held invalid or unenforceable under +any particular circumstance, the balance of the section is intended to +apply and the section as a whole is intended to apply in other +circumstances. + +It is not the purpose of this section to induce you to infringe any +patents or other property right claims or to contest validity of any +such claims; this section has the sole purpose of protecting the +integrity of the free software distribution system, which is +implemented by public license practices. Many people have made +generous contributions to the wide range of software distributed +through that system in reliance on consistent application of that +system; it is up to the author/donor to decide if he or she is willing +to distribute software through any other system and a licensee cannot +impose that choice. + +This section is intended to make thoroughly clear what is believed to +be a consequence of the rest of this License. + + 8. If the distribution and/or use of the Program is restricted in +certain countries either by patents or by copyrighted interfaces, the +original copyright holder who places the Program under this License +may add an explicit geographical distribution limitation excluding +those countries, so that distribution is permitted only in or among +countries not thus excluded. In such case, this License incorporates +the limitation as if written in the body of this License. + + 9. The Free Software Foundation may publish revised and/or new versions +of the General Public License from time to time. Such new versions will +be similar in spirit to the present version, but may differ in detail to +address new problems or concerns. + +Each version is given a distinguishing version number. If the Program +specifies a version number of this License which applies to it and "any +later version", you have the option of following the terms and conditions +either of that version or of any later version published by the Free +Software Foundation. If the Program does not specify a version number of +this License, you may choose any version ever published by the Free Software +Foundation. + + 10. If you wish to incorporate parts of the Program into other free +programs whose distribution conditions are different, write to the author +to ask for permission. For software which is copyrighted by the Free +Software Foundation, write to the Free Software Foundation; we sometimes +make exceptions for this. Our decision will be guided by the two goals +of preserving the free status of all derivatives of our free software and +of promoting the sharing and reuse of software generally. + + NO WARRANTY + + 11. BECAUSE THE PROGRAM IS LICENSED FREE OF CHARGE, THERE IS NO WARRANTY +FOR THE PROGRAM, TO THE EXTENT PERMITTED BY APPLICABLE LAW. EXCEPT WHEN +OTHERWISE STATED IN WRITING THE COPYRIGHT HOLDERS AND/OR OTHER PARTIES +PROVIDE THE PROGRAM "AS IS" WITHOUT WARRANTY OF ANY KIND, EITHER EXPRESSED +OR IMPLIED, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF +MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE. THE ENTIRE RISK AS +TO THE QUALITY AND PERFORMANCE OF THE PROGRAM IS WITH YOU. SHOULD THE +PROGRAM PROVE DEFECTIVE, YOU ASSUME THE COST OF ALL NECESSARY SERVICING, +REPAIR OR CORRECTION. + + 12. IN NO EVENT UNLESS REQUIRED BY APPLICABLE LAW OR AGREED TO IN WRITING +WILL ANY COPYRIGHT HOLDER, OR ANY OTHER PARTY WHO MAY MODIFY AND/OR +REDISTRIBUTE THE PROGRAM AS PERMITTED ABOVE, BE LIABLE TO YOU FOR DAMAGES, +INCLUDING ANY GENERAL, SPECIAL, INCIDENTAL OR CONSEQUENTIAL DAMAGES ARISING +OUT OF THE USE OR INABILITY TO USE THE PROGRAM (INCLUDING BUT NOT LIMITED +TO LOSS OF DATA OR DATA BEING RENDERED INACCURATE OR LOSSES SUSTAINED BY +YOU OR THIRD PARTIES OR A FAILURE OF THE PROGRAM TO OPERATE WITH ANY OTHER +PROGRAMS), EVEN IF SUCH HOLDER OR OTHER PARTY HAS BEEN ADVISED OF THE +POSSIBILITY OF SUCH DAMAGES. + + END OF TERMS AND CONDITIONS + + How to Apply These Terms to Your New Programs + + If you develop a new program, and you want it to be of the greatest +possible use to the public, the best way to achieve this is to make it +free software which everyone can redistribute and change under these terms. + + To do so, attach the following notices to the program. It is safest +to attach them to the start of each source file to most effectively +convey the exclusion of warranty; and each file should have at least +the "copyright" line and a pointer to where the full notice is found. + + + Copyright (C) + + This program is free software; you can redistribute it and/or modify + it under the terms of the GNU General Public License as published by + the Free Software Foundation; either version 2 of the License, or + (at your option) any later version. + + This program is distributed in the hope that it will be useful, + but WITHOUT ANY WARRANTY; without even the implied warranty of + MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + GNU General Public License for more details. + + You should have received a copy of the GNU General Public License + along with this program; if not, write to the Free Software + Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA + + +Also add information on how to contact you by electronic and paper mail. + +If the program is interactive, make it output a short notice like this +when it starts in an interactive mode: + + Gnomovision version 69, Copyright (C) year name of author + Gnomovision comes with ABSOLUTELY NO WARRANTY; for details type `show w'. + This is free software, and you are welcome to redistribute it + under certain conditions; type `show c' for details. + +The hypothetical commands `show w' and `show c' should show the appropriate +parts of the General Public License. Of course, the commands you use may +be called something other than `show w' and `show c'; they could even be +mouse-clicks or menu items--whatever suits your program. + +You should also get your employer (if you work as a programmer) or your +school, if any, to sign a "copyright disclaimer" for the program, if +necessary. Here is a sample; alter the names: + + Yoyodyne, Inc., hereby disclaims all copyright interest in the program + `Gnomovision' (which makes passes at compilers) written by James Hacker. + + , 1 April 1989 + Ty Coon, President of Vice + +This General Public License does not permit incorporating your program into +proprietary programs. If your program is a subroutine library, you may +consider it more useful to permit linking proprietary applications with the +library. If this is what you want to do, use the GNU Library General +Public License instead of this License. diff --git a/ChangeLog b/ChangeLog new file mode 100644 index 0000000..9c4c387 --- /dev/null +++ b/ChangeLog @@ -0,0 +1,19 @@ +0.9.27 12 January 2005 + + This has been a long time in the making... Release highlights: + o New stdio implementation + o New optimized string functions + o Major improvements to the shared lib loader + o Shared libraries work properly on powerpc + o Debugging works on mips + o New architectures: frv, nios, nios2, bfin + o Linux 2.6.x kernel support + o Lots and lots of bug fixes + + This release is NOT binary compatible with uClibc 0.9.26 or any earlier + release, so be prepared to recompile your software if you are still using + an old version of uClibc. + + -Erik + + 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..3703e86 --- /dev/null +++ b/Makefile.am @@ -0,0 +1,8 @@ +################################################## +# Makefile.am for nife project : upper derectory # +################################################## + +EXTRA_DIST = src/nife.hlp src/test.sh src/benchm.nif src/ex + +SUBDIRS=src + diff --git a/Makefile.in b/Makefile.in new file mode 100644 index 0000000..9c6affc --- /dev/null +++ b/Makefile.in @@ -0,0 +1,586 @@ +# Makefile.in generated by automake 1.9.6 from Makefile.am. +# @configure_input@ + +# Copyright (C) 1994, 1995, 1996, 1997, 1998, 1999, 2000, 2001, 2002, +# 2003, 2004, 2005 Free Software Foundation, Inc. +# This Makefile.in is free software; the Free Software Foundation +# gives unlimited permission to copy and/or distribute it, +# with or without modifications, as long as this notice is preserved. + +# This program is distributed in the hope that it will be useful, +# but WITHOUT ANY WARRANTY, to the extent permitted by law; without +# even the implied warranty of MERCHANTABILITY or FITNESS FOR A +# PARTICULAR PURPOSE. + +@SET_MAKE@ + +################################################## +# Makefile.am for nife project : upper derectory # +################################################## +srcdir = @srcdir@ +top_srcdir = @top_srcdir@ +VPATH = @srcdir@ +pkgdatadir = $(datadir)/@PACKAGE@ +pkglibdir = $(libdir)/@PACKAGE@ +pkgincludedir = $(includedir)/@PACKAGE@ +top_builddir = . +am__cd = CDPATH="$${ZSH_VERSION+.}$(PATH_SEPARATOR)" && cd +INSTALL = @INSTALL@ +install_sh_DATA = $(install_sh) -c -m 644 +install_sh_PROGRAM = $(install_sh) -c +install_sh_SCRIPT = $(install_sh) -c +INSTALL_HEADER = $(INSTALL_DATA) +transform = $(program_transform_name) +NORMAL_INSTALL = : +PRE_INSTALL = : +POST_INSTALL = : +NORMAL_UNINSTALL = : +PRE_UNINSTALL = : +POST_UNINSTALL = : +subdir = . +DIST_COMMON = README $(am__configure_deps) $(srcdir)/Makefile.am \ + $(srcdir)/Makefile.in $(srcdir)/config.h.in \ + $(top_srcdir)/configure AUTHORS COPYING ChangeLog INSTALL NEWS \ + depcomp install-sh missing +ACLOCAL_M4 = $(top_srcdir)/aclocal.m4 +am__aclocal_m4_deps = $(top_srcdir)/configure.ac +am__configure_deps = $(am__aclocal_m4_deps) $(CONFIGURE_DEPENDENCIES) \ + $(ACLOCAL_M4) +am__CONFIG_DISTCLEAN_FILES = config.status config.cache config.log \ + configure.lineno configure.status.lineno +mkinstalldirs = $(install_sh) -d +CONFIG_HEADER = config.h +CONFIG_CLEAN_FILES = +SOURCES = +DIST_SOURCES = +RECURSIVE_TARGETS = all-recursive check-recursive dvi-recursive \ + html-recursive info-recursive install-data-recursive \ + install-exec-recursive install-info-recursive \ + install-recursive installcheck-recursive installdirs-recursive \ + pdf-recursive ps-recursive uninstall-info-recursive \ + uninstall-recursive +ETAGS = etags +CTAGS = ctags +DIST_SUBDIRS = $(SUBDIRS) +DISTFILES = $(DIST_COMMON) $(DIST_SOURCES) $(TEXINFOS) $(EXTRA_DIST) +distdir = $(PACKAGE)-$(VERSION) +top_distdir = $(distdir) +am__remove_distdir = \ + { test ! -d $(distdir) \ + || { find $(distdir) -type d ! -perm -200 -exec chmod u+w {} ';' \ + && rm -fr $(distdir); }; } +DIST_ARCHIVES = $(distdir).tar.gz +GZIP_ENV = --best +distuninstallcheck_listfiles = find . -type f -print +distcleancheck_listfiles = find . -type f -print +ACLOCAL = @ACLOCAL@ +AMDEP_FALSE = @AMDEP_FALSE@ +AMDEP_TRUE = @AMDEP_TRUE@ +AMTAR = @AMTAR@ +AUTOCONF = @AUTOCONF@ +AUTOHEADER = @AUTOHEADER@ +AUTOMAKE = @AUTOMAKE@ +AWK = @AWK@ +CC = @CC@ +CCDEPMODE = @CCDEPMODE@ +CFLAGS = @CFLAGS@ +CPP = @CPP@ +CPPFLAGS = @CPPFLAGS@ +CYGPATH_W = @CYGPATH_W@ +DEFS = @DEFS@ +DEPDIR = @DEPDIR@ +ECHO_C = @ECHO_C@ +ECHO_N = @ECHO_N@ +ECHO_T = @ECHO_T@ +EGREP = @EGREP@ +EXEEXT = @EXEEXT@ +GREP = @GREP@ +INSTALL_DATA = @INSTALL_DATA@ +INSTALL_PROGRAM = @INSTALL_PROGRAM@ +INSTALL_SCRIPT = @INSTALL_SCRIPT@ +INSTALL_STRIP_PROGRAM = @INSTALL_STRIP_PROGRAM@ +LDFLAGS = @LDFLAGS@ +LIBOBJS = @LIBOBJS@ +LIBS = @LIBS@ +LTLIBOBJS = @LTLIBOBJS@ +MAKEINFO = @MAKEINFO@ +OBJEXT = @OBJEXT@ +PACKAGE = @PACKAGE@ +PACKAGE_BUGREPORT = @PACKAGE_BUGREPORT@ +PACKAGE_NAME = @PACKAGE_NAME@ +PACKAGE_STRING = @PACKAGE_STRING@ +PACKAGE_TARNAME = @PACKAGE_TARNAME@ +PACKAGE_URL = @PACKAGE_URL@ +PACKAGE_VERSION = @PACKAGE_VERSION@ +PATH_SEPARATOR = @PATH_SEPARATOR@ +POW_LIB = @POW_LIB@ +SET_MAKE = @SET_MAKE@ +SHELL = @SHELL@ +STRIP = @STRIP@ +VERSION = @VERSION@ +ac_ct_CC = @ac_ct_CC@ +am__fastdepCC_FALSE = @am__fastdepCC_FALSE@ +am__fastdepCC_TRUE = @am__fastdepCC_TRUE@ +am__include = @am__include@ +am__leading_dot = @am__leading_dot@ +am__quote = @am__quote@ +am__tar = @am__tar@ +am__untar = @am__untar@ +bindir = @bindir@ +build_alias = @build_alias@ +datadir = @datadir@ +datarootdir = @datarootdir@ +docdir = @docdir@ +dvidir = @dvidir@ +exec_prefix = @exec_prefix@ +host_alias = @host_alias@ +htmldir = @htmldir@ +includedir = @includedir@ +infodir = @infodir@ +install_sh = @install_sh@ +libdir = @libdir@ +libexecdir = @libexecdir@ +localedir = @localedir@ +localstatedir = @localstatedir@ +mandir = @mandir@ +mkdir_p = @mkdir_p@ +oldincludedir = @oldincludedir@ +pdfdir = @pdfdir@ +prefix = @prefix@ +program_transform_name = @program_transform_name@ +psdir = @psdir@ +sbindir = @sbindir@ +sharedstatedir = @sharedstatedir@ +sysconfdir = @sysconfdir@ +target_alias = @target_alias@ +EXTRA_DIST = src/nife.hlp src/test.sh src/benchm.nif src/ex +SUBDIRS = src +all: config.h + $(MAKE) $(AM_MAKEFLAGS) all-recursive + +.SUFFIXES: +am--refresh: + @: +$(srcdir)/Makefile.in: $(srcdir)/Makefile.am $(am__configure_deps) + @for dep in $?; do \ + case '$(am__configure_deps)' in \ + *$$dep*) \ + echo ' cd $(srcdir) && $(AUTOMAKE) --gnu '; \ + cd $(srcdir) && $(AUTOMAKE) --gnu \ + && exit 0; \ + exit 1;; \ + esac; \ + done; \ + echo ' cd $(top_srcdir) && $(AUTOMAKE) --gnu Makefile'; \ + cd $(top_srcdir) && \ + $(AUTOMAKE) --gnu Makefile +.PRECIOUS: Makefile +Makefile: $(srcdir)/Makefile.in $(top_builddir)/config.status + @case '$?' in \ + *config.status*) \ + echo ' $(SHELL) ./config.status'; \ + $(SHELL) ./config.status;; \ + *) \ + echo ' cd $(top_builddir) && $(SHELL) ./config.status $@ $(am__depfiles_maybe)'; \ + cd $(top_builddir) && $(SHELL) ./config.status $@ $(am__depfiles_maybe);; \ + esac; + +$(top_builddir)/config.status: $(top_srcdir)/configure $(CONFIG_STATUS_DEPENDENCIES) + $(SHELL) ./config.status --recheck + +$(top_srcdir)/configure: $(am__configure_deps) + cd $(srcdir) && $(AUTOCONF) +$(ACLOCAL_M4): $(am__aclocal_m4_deps) + cd $(srcdir) && $(ACLOCAL) $(ACLOCAL_AMFLAGS) + +config.h: stamp-h1 + @if test ! -f $@; then \ + rm -f stamp-h1; \ + $(MAKE) stamp-h1; \ + else :; fi + +stamp-h1: $(srcdir)/config.h.in $(top_builddir)/config.status + @rm -f stamp-h1 + cd $(top_builddir) && $(SHELL) ./config.status config.h +$(srcdir)/config.h.in: $(am__configure_deps) + cd $(top_srcdir) && $(AUTOHEADER) + rm -f stamp-h1 + touch $@ + +distclean-hdr: + -rm -f config.h stamp-h1 +uninstall-info-am: + +# This directory's subdirectories are mostly independent; you can cd +# into them and run `make' without going through this Makefile. +# To change the values of `make' variables: instead of editing Makefiles, +# (1) if the variable is set in `config.status', edit `config.status' +# (which will cause the Makefiles to be regenerated when you run `make'); +# (2) otherwise, pass the desired values on the `make' command line. +$(RECURSIVE_TARGETS): + @failcom='exit 1'; \ + for f in x $$MAKEFLAGS; do \ + case $$f in \ + *=* | --[!k]*);; \ + *k*) failcom='fail=yes';; \ + esac; \ + done; \ + dot_seen=no; \ + target=`echo $@ | sed s/-recursive//`; \ + list='$(SUBDIRS)'; for subdir in $$list; do \ + echo "Making $$target in $$subdir"; \ + if test "$$subdir" = "."; then \ + dot_seen=yes; \ + local_target="$$target-am"; \ + else \ + local_target="$$target"; \ + fi; \ + (cd $$subdir && $(MAKE) $(AM_MAKEFLAGS) $$local_target) \ + || eval $$failcom; \ + done; \ + if test "$$dot_seen" = "no"; then \ + $(MAKE) $(AM_MAKEFLAGS) "$$target-am" || exit 1; \ + fi; test -z "$$fail" + +mostlyclean-recursive clean-recursive distclean-recursive \ +maintainer-clean-recursive: + @failcom='exit 1'; \ + for f in x $$MAKEFLAGS; do \ + case $$f in \ + *=* | --[!k]*);; \ + *k*) failcom='fail=yes';; \ + esac; \ + done; \ + dot_seen=no; \ + case "$@" in \ + distclean-* | maintainer-clean-*) list='$(DIST_SUBDIRS)' ;; \ + *) list='$(SUBDIRS)' ;; \ + esac; \ + rev=''; for subdir in $$list; do \ + if test "$$subdir" = "."; then :; else \ + rev="$$subdir $$rev"; \ + fi; \ + done; \ + rev="$$rev ."; \ + target=`echo $@ | sed s/-recursive//`; \ + for subdir in $$rev; do \ + echo "Making $$target in $$subdir"; \ + if test "$$subdir" = "."; then \ + local_target="$$target-am"; \ + else \ + local_target="$$target"; \ + fi; \ + (cd $$subdir && $(MAKE) $(AM_MAKEFLAGS) $$local_target) \ + || eval $$failcom; \ + done && test -z "$$fail" +tags-recursive: + list='$(SUBDIRS)'; for subdir in $$list; do \ + test "$$subdir" = . || (cd $$subdir && $(MAKE) $(AM_MAKEFLAGS) tags); \ + done +ctags-recursive: + list='$(SUBDIRS)'; for subdir in $$list; do \ + test "$$subdir" = . || (cd $$subdir && $(MAKE) $(AM_MAKEFLAGS) ctags); \ + done + +ID: $(HEADERS) $(SOURCES) $(LISP) $(TAGS_FILES) + list='$(SOURCES) $(HEADERS) $(LISP) $(TAGS_FILES)'; \ + unique=`for i in $$list; do \ + if test -f "$$i"; then echo $$i; else echo $(srcdir)/$$i; fi; \ + done | \ + $(AWK) ' { files[$$0] = 1; } \ + END { for (i in files) print i; }'`; \ + mkid -fID $$unique +tags: TAGS + +TAGS: tags-recursive $(HEADERS) $(SOURCES) config.h.in $(TAGS_DEPENDENCIES) \ + $(TAGS_FILES) $(LISP) + tags=; \ + here=`pwd`; \ + if ($(ETAGS) --etags-include --version) >/dev/null 2>&1; then \ + include_option=--etags-include; \ + empty_fix=.; \ + else \ + include_option=--include; \ + empty_fix=; \ + fi; \ + list='$(SUBDIRS)'; for subdir in $$list; do \ + if test "$$subdir" = .; then :; else \ + test ! -f $$subdir/TAGS || \ + tags="$$tags $$include_option=$$here/$$subdir/TAGS"; \ + fi; \ + done; \ + list='$(SOURCES) $(HEADERS) config.h.in $(LISP) $(TAGS_FILES)'; \ + unique=`for i in $$list; do \ + if test -f "$$i"; then echo $$i; else echo $(srcdir)/$$i; fi; \ + done | \ + $(AWK) ' { files[$$0] = 1; } \ + END { for (i in files) print i; }'`; \ + if test -z "$(ETAGS_ARGS)$$tags$$unique"; then :; else \ + test -n "$$unique" || unique=$$empty_fix; \ + $(ETAGS) $(ETAGSFLAGS) $(AM_ETAGSFLAGS) $(ETAGS_ARGS) \ + $$tags $$unique; \ + fi +ctags: CTAGS +CTAGS: ctags-recursive $(HEADERS) $(SOURCES) config.h.in $(TAGS_DEPENDENCIES) \ + $(TAGS_FILES) $(LISP) + tags=; \ + here=`pwd`; \ + list='$(SOURCES) $(HEADERS) config.h.in $(LISP) $(TAGS_FILES)'; \ + unique=`for i in $$list; do \ + if test -f "$$i"; then echo $$i; else echo $(srcdir)/$$i; fi; \ + done | \ + $(AWK) ' { files[$$0] = 1; } \ + END { for (i in files) print i; }'`; \ + test -z "$(CTAGS_ARGS)$$tags$$unique" \ + || $(CTAGS) $(CTAGSFLAGS) $(AM_CTAGSFLAGS) $(CTAGS_ARGS) \ + $$tags $$unique + +GTAGS: + here=`$(am__cd) $(top_builddir) && pwd` \ + && cd $(top_srcdir) \ + && gtags -i $(GTAGS_ARGS) $$here + +distclean-tags: + -rm -f TAGS ID GTAGS GRTAGS GSYMS GPATH tags + +distdir: $(DISTFILES) + $(am__remove_distdir) + mkdir $(distdir) + $(mkdir_p) $(distdir)/src + @srcdirstrip=`echo "$(srcdir)" | sed 's|.|.|g'`; \ + topsrcdirstrip=`echo "$(top_srcdir)" | sed 's|.|.|g'`; \ + list='$(DISTFILES)'; for file in $$list; do \ + case $$file in \ + $(srcdir)/*) file=`echo "$$file" | sed "s|^$$srcdirstrip/||"`;; \ + $(top_srcdir)/*) file=`echo "$$file" | sed "s|^$$topsrcdirstrip/|$(top_builddir)/|"`;; \ + esac; \ + if test -f $$file || test -d $$file; then d=.; else d=$(srcdir); fi; \ + dir=`echo "$$file" | sed -e 's,/[^/]*$$,,'`; \ + if test "$$dir" != "$$file" && test "$$dir" != "."; then \ + dir="/$$dir"; \ + $(mkdir_p) "$(distdir)$$dir"; \ + else \ + dir=''; \ + fi; \ + if test -d $$d/$$file; then \ + if test -d $(srcdir)/$$file && test $$d != $(srcdir); then \ + cp -pR $(srcdir)/$$file $(distdir)$$dir || exit 1; \ + fi; \ + cp -pR $$d/$$file $(distdir)$$dir || exit 1; \ + else \ + test -f $(distdir)/$$file \ + || cp -p $$d/$$file $(distdir)/$$file \ + || exit 1; \ + fi; \ + done + list='$(DIST_SUBDIRS)'; for subdir in $$list; do \ + if test "$$subdir" = .; then :; else \ + test -d "$(distdir)/$$subdir" \ + || $(mkdir_p) "$(distdir)/$$subdir" \ + || exit 1; \ + distdir=`$(am__cd) $(distdir) && pwd`; \ + top_distdir=`$(am__cd) $(top_distdir) && pwd`; \ + (cd $$subdir && \ + $(MAKE) $(AM_MAKEFLAGS) \ + top_distdir="$$top_distdir" \ + distdir="$$distdir/$$subdir" \ + distdir) \ + || exit 1; \ + fi; \ + done + -find "$(distdir)" -type d ! -perm -755 \ + -exec chmod u+rwx,go+rx {} \; -o \ + ! -type d ! -perm -444 -links 1 -exec chmod a+r {} \; -o \ + ! -type d ! -perm -400 -exec chmod a+r {} \; -o \ + ! -type d ! -perm -444 -exec $(SHELL) $(install_sh) -c -m a+r {} {} \; \ + || chmod -R a+r $(distdir) +dist-gzip: distdir + tardir=$(distdir) && $(am__tar) | GZIP=$(GZIP_ENV) gzip -c >$(distdir).tar.gz + $(am__remove_distdir) + +dist-bzip2: distdir + tardir=$(distdir) && $(am__tar) | bzip2 -9 -c >$(distdir).tar.bz2 + $(am__remove_distdir) + +dist-tarZ: distdir + tardir=$(distdir) && $(am__tar) | compress -c >$(distdir).tar.Z + $(am__remove_distdir) + +dist-shar: distdir + shar $(distdir) | GZIP=$(GZIP_ENV) gzip -c >$(distdir).shar.gz + $(am__remove_distdir) + +dist-zip: distdir + -rm -f $(distdir).zip + zip -rq $(distdir).zip $(distdir) + $(am__remove_distdir) + +dist dist-all: distdir + tardir=$(distdir) && $(am__tar) | GZIP=$(GZIP_ENV) gzip -c >$(distdir).tar.gz + $(am__remove_distdir) + +# This target untars the dist file and tries a VPATH configuration. Then +# it guarantees that the distribution is self-contained by making another +# tarfile. +distcheck: dist + case '$(DIST_ARCHIVES)' in \ + *.tar.gz*) \ + GZIP=$(GZIP_ENV) gunzip -c $(distdir).tar.gz | $(am__untar) ;;\ + *.tar.bz2*) \ + bunzip2 -c $(distdir).tar.bz2 | $(am__untar) ;;\ + *.tar.Z*) \ + uncompress -c $(distdir).tar.Z | $(am__untar) ;;\ + *.shar.gz*) \ + GZIP=$(GZIP_ENV) gunzip -c $(distdir).shar.gz | unshar ;;\ + *.zip*) \ + unzip $(distdir).zip ;;\ + esac + chmod -R a-w $(distdir); chmod a+w $(distdir) + mkdir $(distdir)/_build + mkdir $(distdir)/_inst + chmod a-w $(distdir) + dc_install_base=`$(am__cd) $(distdir)/_inst && pwd | sed -e 's,^[^:\\/]:[\\/],/,'` \ + && dc_destdir="$${TMPDIR-/tmp}/am-dc-$$$$/" \ + && cd $(distdir)/_build \ + && ../configure --srcdir=.. --prefix="$$dc_install_base" \ + $(DISTCHECK_CONFIGURE_FLAGS) \ + && $(MAKE) $(AM_MAKEFLAGS) \ + && $(MAKE) $(AM_MAKEFLAGS) dvi \ + && $(MAKE) $(AM_MAKEFLAGS) check \ + && $(MAKE) $(AM_MAKEFLAGS) install \ + && $(MAKE) $(AM_MAKEFLAGS) installcheck \ + && $(MAKE) $(AM_MAKEFLAGS) uninstall \ + && $(MAKE) $(AM_MAKEFLAGS) distuninstallcheck_dir="$$dc_install_base" \ + distuninstallcheck \ + && chmod -R a-w "$$dc_install_base" \ + && ({ \ + (cd ../.. && umask 077 && mkdir "$$dc_destdir") \ + && $(MAKE) $(AM_MAKEFLAGS) DESTDIR="$$dc_destdir" install \ + && $(MAKE) $(AM_MAKEFLAGS) DESTDIR="$$dc_destdir" uninstall \ + && $(MAKE) $(AM_MAKEFLAGS) DESTDIR="$$dc_destdir" \ + distuninstallcheck_dir="$$dc_destdir" distuninstallcheck; \ + } || { rm -rf "$$dc_destdir"; exit 1; }) \ + && rm -rf "$$dc_destdir" \ + && $(MAKE) $(AM_MAKEFLAGS) dist \ + && rm -rf $(DIST_ARCHIVES) \ + && $(MAKE) $(AM_MAKEFLAGS) distcleancheck + $(am__remove_distdir) + @(echo "$(distdir) archives ready for distribution: "; \ + list='$(DIST_ARCHIVES)'; for i in $$list; do echo $$i; done) | \ + sed -e '1{h;s/./=/g;p;x;}' -e '$${p;x;}' +distuninstallcheck: + @cd $(distuninstallcheck_dir) \ + && test `$(distuninstallcheck_listfiles) | wc -l` -le 1 \ + || { echo "ERROR: files left after uninstall:" ; \ + if test -n "$(DESTDIR)"; then \ + echo " (check DESTDIR support)"; \ + fi ; \ + $(distuninstallcheck_listfiles) ; \ + exit 1; } >&2 +distcleancheck: distclean + @if test '$(srcdir)' = . ; then \ + echo "ERROR: distcleancheck can only run from a VPATH build" ; \ + exit 1 ; \ + fi + @test `$(distcleancheck_listfiles) | wc -l` -eq 0 \ + || { echo "ERROR: files left in build directory after distclean:" ; \ + $(distcleancheck_listfiles) ; \ + exit 1; } >&2 +check-am: all-am +check: check-recursive +all-am: Makefile config.h +installdirs: installdirs-recursive +installdirs-am: +install: install-recursive +install-exec: install-exec-recursive +install-data: install-data-recursive +uninstall: uninstall-recursive + +install-am: all-am + @$(MAKE) $(AM_MAKEFLAGS) install-exec-am install-data-am + +installcheck: installcheck-recursive +install-strip: + $(MAKE) $(AM_MAKEFLAGS) INSTALL_PROGRAM="$(INSTALL_STRIP_PROGRAM)" \ + install_sh_PROGRAM="$(INSTALL_STRIP_PROGRAM)" INSTALL_STRIP_FLAG=-s \ + `test -z '$(STRIP)' || \ + echo "INSTALL_PROGRAM_ENV=STRIPPROG='$(STRIP)'"` install +mostlyclean-generic: + +clean-generic: + +distclean-generic: + -test -z "$(CONFIG_CLEAN_FILES)" || rm -f $(CONFIG_CLEAN_FILES) + +maintainer-clean-generic: + @echo "This command is intended for maintainers to use" + @echo "it deletes files that may require special tools to rebuild." +clean: clean-recursive + +clean-am: clean-generic mostlyclean-am + +distclean: distclean-recursive + -rm -f $(am__CONFIG_DISTCLEAN_FILES) + -rm -f Makefile +distclean-am: clean-am distclean-generic distclean-hdr distclean-tags + +dvi: dvi-recursive + +dvi-am: + +html: html-recursive + +info: info-recursive + +info-am: + +install-data-am: + +install-exec-am: + +install-info: install-info-recursive + +install-man: + +installcheck-am: + +maintainer-clean: maintainer-clean-recursive + -rm -f $(am__CONFIG_DISTCLEAN_FILES) + -rm -rf $(top_srcdir)/autom4te.cache + -rm -f Makefile +maintainer-clean-am: distclean-am maintainer-clean-generic + +mostlyclean: mostlyclean-recursive + +mostlyclean-am: mostlyclean-generic + +pdf: pdf-recursive + +pdf-am: + +ps: ps-recursive + +ps-am: + +uninstall-am: uninstall-info-am + +uninstall-info: uninstall-info-recursive + +.PHONY: $(RECURSIVE_TARGETS) CTAGS GTAGS all all-am am--refresh check \ + check-am clean clean-generic clean-recursive ctags \ + ctags-recursive dist dist-all dist-bzip2 dist-gzip dist-shar \ + dist-tarZ dist-zip distcheck distclean distclean-generic \ + distclean-hdr distclean-recursive distclean-tags \ + distcleancheck distdir distuninstallcheck dvi dvi-am html \ + html-am info info-am install install-am install-data \ + install-data-am install-exec install-exec-am install-info \ + install-info-am install-man install-strip installcheck \ + installcheck-am installdirs installdirs-am maintainer-clean \ + maintainer-clean-generic maintainer-clean-recursive \ + mostlyclean mostlyclean-generic mostlyclean-recursive pdf \ + pdf-am ps ps-am tags tags-recursive uninstall uninstall-am \ + uninstall-info-am + +# Tell versions [3.59,3.63) of GNU make to not export all variables. +# Otherwise a system limit (for SysV at least) may be exceeded. +.NOEXPORT: diff --git a/NEWS b/NEWS new file mode 100644 index 0000000..a6506cc --- /dev/null +++ b/NEWS @@ -0,0 +1,154 @@ +History of Nife releases : + +2013-09-25 - Nife 0.44 is released. + * Fixed a bug causing a "segmentation violation" during compilation + of the Nife code on some systems as Raspberry Pi A and B and others. + This bug was reported by Bernard Bonno during tests on a Raspberry Pi + Model A with 256 Mo of memory. + * The installation has been tested by Bernard Bonno on a PC i484 + with a Linux Porteus 2.0. + All information about Porteus at http://www.porteus.org/. + +2013-09-09 - Nife 0.43 is released. + * Establishment of a sub-directory .nife to facilitate debugging and + store temporary files. + * Update some functions dependant on working directory. + * Fixed some bugs in the gplot tools due to new versions of gnuplot. + * The installation has been tested by Patrick Foubet on a Raspberry Pi + board Model B with standard Raspbian (Squeeze). + All information about the board at http://www.raspberrypi.org/faqs. + +2012-10-23 - Nife 0.405 is released. + * Fixed a bug in the data transfer protocol STSP. + * Adding Dt indicators in the list giving by ?n function. + * Fixed a bug in the netDt> function. + * The installation has been tested by Patrick Foubet on a Beaglebone + board (Linux beaglebone 3.2.5+ #1 ... armv7l GNU/Linux) lended by the + school ESME Sudria for preparing a course on Linux drivers. + All information about the board at http://beagleboard.org/bone. + +2012-09-01 - Nife 0.401 is released. + * Beginning the multi-threading mechanisms based on POSIX thread. + * Adding programmation tools end: and goto_end. + * Increasing error tracking : + - giving the file name and the line number, + - stopping compilation at first error, + - allowing load in load. + - adding functions ?err, noerr, messerr, ?lasterr and onerr: label. + * Dynamic code tools : + - "load to load a file in a user function, + - "exec to compile some code in a user function, + - functions ' and ` to specify names to be executed latter. + * Limit for all names at 24 characters. + * Modifying install variables functions to work in user functions. + * Adding the free-context loop with do mechanisms : + - do_next to bypass a loop in free-context, + - do_leave and *do_leave to leave one or many loops in free-context, + * Updating the sh command to use the SHELL environment variable. + +2012-07-05 - Nife 0.341 is released. + * Adding more fonctions to deal with devices with Comedilib : + - write fonction available, + - define a default set of parameters to simplify programs. + * Update documentation for theses new commands. + +2012-06-10 - Nife 0.323 is released. + * Continuing distributed systems tools elaborated with Thomas Pabst : + - Adding netCompile to load a Nife file on a remote Nife using NetKey. + If this file contains a call of one or more functions, they will be + executed, and the result will be send on the Net using NetKey. + - Adding NetErr to get the Net Error value. + * Adding the ex directory in src with some program examples : + - gp.nif, an example for gplot functions, + - rpc.nif and rpc2.nif for Nife RPC example. + +2012-06-06 - Nife 0.320 is released. + * Beginning of the gplot module for use of gnuplot (www.gnuplot.info). + * adding theses functions : + - gplot and gplotM (multiple) to create gplots, + - gplotCmd to append text to the plot command, + - ?gp to list the gplots, + - del_gplot to delete a gplot, + - gplotAdd and gplotRepl (with replacement) to add values to plots, + - gplotClear to clear a display panel. + * The installation has been tested by Bruno Guilbert on a Fox board G20 + (Debian debarm 2.6.38 with CPU Atmel AT91SAM9G20 based on ARM926EJ-S) + with the students TRSE2 of Ingesup-Paris : + All information about the board at www.acmesystems.it. + +2012-05-22 - Nife 0.317 is released. + * Adding ndepth giving network stack depth using NetKey, + * Definition of principles for Nife RPC (remote procedure call). + * Adding netExec to execute a function on a remote Nife using NetKey. + * The installation has been tested by Dr Alain Empain (ulg.ac.be) on + Ubuntu Lucid 10.O4 (Linux 2.6.38-15 - x86_64) + * The installation has been tested by Paul Bartoldi (unige.ch) on + Ubuntu 12.O4 LTS (Linux 3.0.0-12 - x86_32) + +2012-05-11 - Nife 0.315 is released. + * Beginning of distributed systems tools elaborated with Thomas Pabst : + - automatic evaluation of the dt values at network connection, + - adding netDt> to get the clock difference value beetween "network" + and Nife system. + * The installation has been tested on + Debian Wheezy Testing (Linux 3.2.0-2 - x86_32) + +2012-05-04 - Nife 0.311 is released. + * Modifying errors traps to get a better bug resolution. + * The installation has been tested by Bernard Perrin (csem.ch) on + MacOS X Snow Leopard 10.6.8 (Darwin Kernel Vers 10.8.0 - x86_32) + +2012-03-16 - Nife 0.307 is released. + * Adding auto-convergent loop : do ... loop + * Adding standards loop : do ... +loop + * Possibility to test the loop level and use indexes I, J and K. + * Adding del_ofunc to delete, by name, the oldest function, + * Adding del_afunc to delete all functions beginning by a prefix, + * Adding "exec to execute a user function giving her name on the + character stack. + * Adding "Var to create a variable giving her name on the character + stack. + * Rename functions sub[] in []-sub and *sub[] in *[]-sub to adopt a + more logical notation. + +2012-03-08 - Nife 0.303 is released. + * This release is specially dedicated to my wife Christine. + * Now you can use nife with redirection or pîpe : + nife < fic.nif or cat fic.nif | nife + Thank you to Denis Bodor for the idea ! + +2012-02-22 - Nife 0.302 is released. + * Christophe Ondrejec has validate the site nife-project.org + * Updating README, NEWS and all informations files. + * The installation has been tested on : + - Debian Lenny (Linux 2.6.26-2 - x86_32) + - Debian Squeeze (Linux 2.6.32-5 - x86_64) + - Mac OS X (Darwin Kernel Version 8.11.1 - x86_32) + - Open BSD (Version 5.0 GENERIC#43 - x86_32) + - Solaris 11 (SunOS v 5.11 - x86_32) + - Fedora Core 15 (Linux 2.6.38-6 - x86_32) + - Open Suze 12.1 (Linux 3.1.0-1 - x86_64) + * Adding a benchmark test. + +2012-02-13 - Nife 0.300 is released (internal). + * Upgrading for working on both 32 or 64 bits. + * Upgrading SCS (Sister Chip Signature) to accept data from machine + differents on code or addresses but using compatible datas. + * Integration of the GNU Autotools to generate the packages. + +2011-11-13 - Nife 0.212 is released. + * Network tools with STSP (stack to stack protocol) v0.5 : + ie WITH ScS (Sister chip signature) v 1. + * correction of function []trot. + * new function []transp to transpose matrix. + +2011-11-09 - Nife 0.209 is released. + * Network tools with STSP (stack to stack protocol) v.0 : + ie without ScS (Sister chip signature). + +2011-10-31 - Nife 0.204 is released. + +2011-10-26 - Nife 0.200 is released. + +2011-09-18 - Nife 0.113 the first public release on Sourceforge.net. + diff --git a/README b/README new file mode 100644 index 0000000..5403ad7 --- /dev/null +++ b/README @@ -0,0 +1,106 @@ + + nife - Networking Industrial Forth-like Environment. + +Overview + + Nife is a programming language based on the principles set of Forth + defined by Charles H. Moore in the 1960s. It does not include the + full functionality of Forth, that is the reason why it is considered + as a "Forth-like" language. + + His ambition is to offer people who are not computer scientists, and + need to make measurements, control of remote devices to monitor industrial + processes, handling of large collections of data, make calculations, of + filtering, statistics, can easily make their needs in a Linux environment + at low cost. + + The simplicity of this language that anyone can understand how it works + in a few minutes and totally control a few hours to a week at most. + It can also be used more modestly as a super calculator, just to make its + accounts or calculations of matrix inversion. The public concerned is + very large. + + It keeps the forth the following characteristics: + - Mode operation interpretation: as a shell. + - Loading source files and compilation and execution. + - Using stacks (digital, logical and characters) requiring the use of + notation called "reverse-Polish." + - How to write new features. + + It adds the following possibilities: + - A true "context-free" language to compile code on the fly. + - Installation compatible on all Unix-like systems including Linux. + - Ease of interfacing to additional commands in a program Nife use many + free tools available in a Linux environment (eg xgraph). + - Integration of a consistent mathematical library to easily perform + calculations on a large number of data. + - Ability to easily add other functions to the base library. + - Automatic recognition of cards or devices compatible with the library + COMEDI (http://www.comedi.org) to make data acquisition, signal + processing, automatic pilot. This is one of its sides "industrial". + - Variable definition of variable geometry (which may in turn contain + a scalar, an array of numeric values, a boolean, a string ...) and + can also become executable variables (ie referring to the code that + will be called when using the variable). This aspect gives the term + Nife dynamic language with all that this implies (code compact and + fast, scalable performance). + - Management of multi-tasking with the command task that can initiate + parallel execution of functions, control (whether it is complete, + refer to the consoles, delete, etc.). + - Nife programs can communicate with each other via the communication + tools offered by traditional Unix, internally (within the same system) + or external interface based on TCP/IP. For this, it has its own + protocol STSP (stack to stack protocol) for exchanging data directly + from a numerical stack to an other one. This is one of its aspects + "Networking". + - The possible opening towards the use of other devices through the + integration of specific drivers. + + +How to compile and install nife + + Download the nife source code, then: + tar zxvf nife-x.y.z.tar.gz + cd nife-x.y.z + ./configure + make + + WARNING !! + make install is not preconized in beta version !! + + You can use it by positionning in the source directory and call the + command : + cd src + ./nife + + You can also lauch the benchmark test : + ./test.sh + + +Web Page + + http://www.nife-project.org + +Mailing List and Bug Reports + + nife-project.org hosts all the nife-related mailing-lists. + + help-nife@nife-project.org is for those seeking to get help without + wanting to hear about the technical details of its development. + + + nife-devel@nife-project.org is the list used by the people + that make Nife and a general development discussion list, with + moderate traffic. + + To subscribe, go directely to : + http://nife-project.org/general/newsletter/subone/view-subscribe + + For general bug reports, send a description of the problem to + nife@seriane.fr or directly to the development list. + +Current Status + + nife is still in beta version. + + Patrick Foubet (patrick.foubet@nife-project.org) + + diff --git a/README.md b/README.md new file mode 100644 index 0000000..5403ad7 --- /dev/null +++ b/README.md @@ -0,0 +1,106 @@ + + nife - Networking Industrial Forth-like Environment. + +Overview + + Nife is a programming language based on the principles set of Forth + defined by Charles H. Moore in the 1960s. It does not include the + full functionality of Forth, that is the reason why it is considered + as a "Forth-like" language. + + His ambition is to offer people who are not computer scientists, and + need to make measurements, control of remote devices to monitor industrial + processes, handling of large collections of data, make calculations, of + filtering, statistics, can easily make their needs in a Linux environment + at low cost. + + The simplicity of this language that anyone can understand how it works + in a few minutes and totally control a few hours to a week at most. + It can also be used more modestly as a super calculator, just to make its + accounts or calculations of matrix inversion. The public concerned is + very large. + + It keeps the forth the following characteristics: + - Mode operation interpretation: as a shell. + - Loading source files and compilation and execution. + - Using stacks (digital, logical and characters) requiring the use of + notation called "reverse-Polish." + - How to write new features. + + It adds the following possibilities: + - A true "context-free" language to compile code on the fly. + - Installation compatible on all Unix-like systems including Linux. + - Ease of interfacing to additional commands in a program Nife use many + free tools available in a Linux environment (eg xgraph). + - Integration of a consistent mathematical library to easily perform + calculations on a large number of data. + - Ability to easily add other functions to the base library. + - Automatic recognition of cards or devices compatible with the library + COMEDI (http://www.comedi.org) to make data acquisition, signal + processing, automatic pilot. This is one of its sides "industrial". + - Variable definition of variable geometry (which may in turn contain + a scalar, an array of numeric values, a boolean, a string ...) and + can also become executable variables (ie referring to the code that + will be called when using the variable). This aspect gives the term + Nife dynamic language with all that this implies (code compact and + fast, scalable performance). + - Management of multi-tasking with the command task that can initiate + parallel execution of functions, control (whether it is complete, + refer to the consoles, delete, etc.). + - Nife programs can communicate with each other via the communication + tools offered by traditional Unix, internally (within the same system) + or external interface based on TCP/IP. For this, it has its own + protocol STSP (stack to stack protocol) for exchanging data directly + from a numerical stack to an other one. This is one of its aspects + "Networking". + - The possible opening towards the use of other devices through the + integration of specific drivers. + + +How to compile and install nife + + Download the nife source code, then: + tar zxvf nife-x.y.z.tar.gz + cd nife-x.y.z + ./configure + make + + WARNING !! + make install is not preconized in beta version !! + + You can use it by positionning in the source directory and call the + command : + cd src + ./nife + + You can also lauch the benchmark test : + ./test.sh + + +Web Page + + http://www.nife-project.org + +Mailing List and Bug Reports + + nife-project.org hosts all the nife-related mailing-lists. + + help-nife@nife-project.org is for those seeking to get help without + wanting to hear about the technical details of its development. + + + nife-devel@nife-project.org is the list used by the people + that make Nife and a general development discussion list, with + moderate traffic. + + To subscribe, go directely to : + http://nife-project.org/general/newsletter/subone/view-subscribe + + For general bug reports, send a description of the problem to + nife@seriane.fr or directly to the development list. + +Current Status + + nife is still in beta version. + + Patrick Foubet (patrick.foubet@nife-project.org) + + diff --git a/aclocal.m4 b/aclocal.m4 new file mode 100644 index 0000000..aef181a --- /dev/null +++ b/aclocal.m4 @@ -0,0 +1,850 @@ +# generated automatically by aclocal 1.9.6 -*- Autoconf -*- + +# Copyright (C) 1996, 1997, 1998, 1999, 2000, 2001, 2002, 2003, 2004, +# 2005 Free Software Foundation, Inc. +# This file is free software; the Free Software Foundation +# gives unlimited permission to copy and/or distribute it, +# with or without modifications, as long as this notice is preserved. + +# This program is distributed in the hope that it will be useful, +# but WITHOUT ANY WARRANTY, to the extent permitted by law; without +# even the implied warranty of MERCHANTABILITY or FITNESS FOR A +# PARTICULAR PURPOSE. + +# Copyright (C) 2002, 2003, 2005 Free Software Foundation, Inc. +# +# This file is free software; the Free Software Foundation +# gives unlimited permission to copy and/or distribute it, +# with or without modifications, as long as this notice is preserved. + +# AM_AUTOMAKE_VERSION(VERSION) +# ---------------------------- +# Automake X.Y traces this macro to ensure aclocal.m4 has been +# generated from the m4 files accompanying Automake X.Y. +AC_DEFUN([AM_AUTOMAKE_VERSION], [am__api_version="1.9"]) + +# AM_SET_CURRENT_AUTOMAKE_VERSION +# ------------------------------- +# Call AM_AUTOMAKE_VERSION so it can be traced. +# This function is AC_REQUIREd by AC_INIT_AUTOMAKE. +AC_DEFUN([AM_SET_CURRENT_AUTOMAKE_VERSION], + [AM_AUTOMAKE_VERSION([1.9.6])]) + +# AM_AUX_DIR_EXPAND -*- Autoconf -*- + +# Copyright (C) 2001, 2003, 2005 Free Software Foundation, Inc. +# +# This file is free software; the Free Software Foundation +# gives unlimited permission to copy and/or distribute it, +# with or without modifications, as long as this notice is preserved. + +# For projects using AC_CONFIG_AUX_DIR([foo]), Autoconf sets +# $ac_aux_dir to `$srcdir/foo'. In other projects, it is set to +# `$srcdir', `$srcdir/..', or `$srcdir/../..'. +# +# Of course, Automake must honor this variable whenever it calls a +# tool from the auxiliary directory. The problem is that $srcdir (and +# therefore $ac_aux_dir as well) can be either absolute or relative, +# depending on how configure is run. This is pretty annoying, since +# it makes $ac_aux_dir quite unusable in subdirectories: in the top +# source directory, any form will work fine, but in subdirectories a +# relative path needs to be adjusted first. +# +# $ac_aux_dir/missing +# fails when called from a subdirectory if $ac_aux_dir is relative +# $top_srcdir/$ac_aux_dir/missing +# fails if $ac_aux_dir is absolute, +# fails when called from a subdirectory in a VPATH build with +# a relative $ac_aux_dir +# +# The reason of the latter failure is that $top_srcdir and $ac_aux_dir +# are both prefixed by $srcdir. In an in-source build this is usually +# harmless because $srcdir is `.', but things will broke when you +# start a VPATH build or use an absolute $srcdir. +# +# So we could use something similar to $top_srcdir/$ac_aux_dir/missing, +# iff we strip the leading $srcdir from $ac_aux_dir. That would be: +# am_aux_dir='\$(top_srcdir)/'`expr "$ac_aux_dir" : "$srcdir//*\(.*\)"` +# and then we would define $MISSING as +# MISSING="\${SHELL} $am_aux_dir/missing" +# This will work as long as MISSING is not called from configure, because +# unfortunately $(top_srcdir) has no meaning in configure. +# However there are other variables, like CC, which are often used in +# configure, and could therefore not use this "fixed" $ac_aux_dir. +# +# Another solution, used here, is to always expand $ac_aux_dir to an +# absolute PATH. The drawback is that using absolute paths prevent a +# configured tree to be moved without reconfiguration. + +AC_DEFUN([AM_AUX_DIR_EXPAND], +[dnl Rely on autoconf to set up CDPATH properly. +AC_PREREQ([2.50])dnl +# expand $ac_aux_dir to an absolute path +am_aux_dir=`cd $ac_aux_dir && pwd` +]) + +# AM_CONDITIONAL -*- Autoconf -*- + +# Copyright (C) 1997, 2000, 2001, 2003, 2004, 2005 +# Free Software Foundation, Inc. +# +# This file is free software; the Free Software Foundation +# gives unlimited permission to copy and/or distribute it, +# with or without modifications, as long as this notice is preserved. + +# serial 7 + +# AM_CONDITIONAL(NAME, SHELL-CONDITION) +# ------------------------------------- +# Define a conditional. +AC_DEFUN([AM_CONDITIONAL], +[AC_PREREQ(2.52)dnl + ifelse([$1], [TRUE], [AC_FATAL([$0: invalid condition: $1])], + [$1], [FALSE], [AC_FATAL([$0: invalid condition: $1])])dnl +AC_SUBST([$1_TRUE]) +AC_SUBST([$1_FALSE]) +if $2; then + $1_TRUE= + $1_FALSE='#' +else + $1_TRUE='#' + $1_FALSE= +fi +AC_CONFIG_COMMANDS_PRE( +[if test -z "${$1_TRUE}" && test -z "${$1_FALSE}"; then + AC_MSG_ERROR([[conditional "$1" was never defined. +Usually this means the macro was only invoked conditionally.]]) +fi])]) + + +# Copyright (C) 1999, 2000, 2001, 2002, 2003, 2004, 2005 +# Free Software Foundation, Inc. +# +# This file is free software; the Free Software Foundation +# gives unlimited permission to copy and/or distribute it, +# with or without modifications, as long as this notice is preserved. + +# serial 8 + +# There are a few dirty hacks below to avoid letting `AC_PROG_CC' be +# written in clear, in which case automake, when reading aclocal.m4, +# will think it sees a *use*, and therefore will trigger all it's +# C support machinery. Also note that it means that autoscan, seeing +# CC etc. in the Makefile, will ask for an AC_PROG_CC use... + + +# _AM_DEPENDENCIES(NAME) +# ---------------------- +# See how the compiler implements dependency checking. +# NAME is "CC", "CXX", "GCJ", or "OBJC". +# We try a few techniques and use that to set a single cache variable. +# +# We don't AC_REQUIRE the corresponding AC_PROG_CC since the latter was +# modified to invoke _AM_DEPENDENCIES(CC); we would have a circular +# dependency, and given that the user is not expected to run this macro, +# just rely on AC_PROG_CC. +AC_DEFUN([_AM_DEPENDENCIES], +[AC_REQUIRE([AM_SET_DEPDIR])dnl +AC_REQUIRE([AM_OUTPUT_DEPENDENCY_COMMANDS])dnl +AC_REQUIRE([AM_MAKE_INCLUDE])dnl +AC_REQUIRE([AM_DEP_TRACK])dnl + +ifelse([$1], CC, [depcc="$CC" am_compiler_list=], + [$1], CXX, [depcc="$CXX" am_compiler_list=], + [$1], OBJC, [depcc="$OBJC" am_compiler_list='gcc3 gcc'], + [$1], GCJ, [depcc="$GCJ" am_compiler_list='gcc3 gcc'], + [depcc="$$1" am_compiler_list=]) + +AC_CACHE_CHECK([dependency style of $depcc], + [am_cv_$1_dependencies_compiler_type], +[if test -z "$AMDEP_TRUE" && test -f "$am_depcomp"; then + # We make a subdir and do the tests there. Otherwise we can end up + # making bogus files that we don't know about and never remove. For + # instance it was reported that on HP-UX the gcc test will end up + # making a dummy file named `D' -- because `-MD' means `put the output + # in D'. + mkdir conftest.dir + # Copy depcomp to subdir because otherwise we won't find it if we're + # using a relative directory. + cp "$am_depcomp" conftest.dir + cd conftest.dir + # We will build objects and dependencies in a subdirectory because + # it helps to detect inapplicable dependency modes. For instance + # both Tru64's cc and ICC support -MD to output dependencies as a + # side effect of compilation, but ICC will put the dependencies in + # the current directory while Tru64 will put them in the object + # directory. + mkdir sub + + am_cv_$1_dependencies_compiler_type=none + if test "$am_compiler_list" = ""; then + am_compiler_list=`sed -n ['s/^#*\([a-zA-Z0-9]*\))$/\1/p'] < ./depcomp` + fi + for depmode in $am_compiler_list; do + # Setup a source with many dependencies, because some compilers + # like to wrap large dependency lists on column 80 (with \), and + # we should not choose a depcomp mode which is confused by this. + # + # We need to recreate these files for each test, as the compiler may + # overwrite some of them when testing with obscure command lines. + # This happens at least with the AIX C compiler. + : > sub/conftest.c + for i in 1 2 3 4 5 6; do + echo '#include "conftst'$i'.h"' >> sub/conftest.c + # Using `: > sub/conftst$i.h' creates only sub/conftst1.h with + # Solaris 8's {/usr,}/bin/sh. + touch sub/conftst$i.h + done + echo "${am__include} ${am__quote}sub/conftest.Po${am__quote}" > confmf + + case $depmode in + nosideeffect) + # after this tag, mechanisms are not by side-effect, so they'll + # only be used when explicitly requested + if test "x$enable_dependency_tracking" = xyes; then + continue + else + break + fi + ;; + none) break ;; + esac + # We check with `-c' and `-o' for the sake of the "dashmstdout" + # mode. It turns out that the SunPro C++ compiler does not properly + # handle `-M -o', and we need to detect this. + if depmode=$depmode \ + source=sub/conftest.c object=sub/conftest.${OBJEXT-o} \ + depfile=sub/conftest.Po tmpdepfile=sub/conftest.TPo \ + $SHELL ./depcomp $depcc -c -o sub/conftest.${OBJEXT-o} sub/conftest.c \ + >/dev/null 2>conftest.err && + grep sub/conftst6.h sub/conftest.Po > /dev/null 2>&1 && + grep sub/conftest.${OBJEXT-o} sub/conftest.Po > /dev/null 2>&1 && + ${MAKE-make} -s -f confmf > /dev/null 2>&1; then + # icc doesn't choke on unknown options, it will just issue warnings + # or remarks (even with -Werror). So we grep stderr for any message + # that says an option was ignored or not supported. + # When given -MP, icc 7.0 and 7.1 complain thusly: + # icc: Command line warning: ignoring option '-M'; no argument required + # The diagnosis changed in icc 8.0: + # icc: Command line remark: option '-MP' not supported + if (grep 'ignoring option' conftest.err || + grep 'not supported' conftest.err) >/dev/null 2>&1; then :; else + am_cv_$1_dependencies_compiler_type=$depmode + break + fi + fi + done + + cd .. + rm -rf conftest.dir +else + am_cv_$1_dependencies_compiler_type=none +fi +]) +AC_SUBST([$1DEPMODE], [depmode=$am_cv_$1_dependencies_compiler_type]) +AM_CONDITIONAL([am__fastdep$1], [ + test "x$enable_dependency_tracking" != xno \ + && test "$am_cv_$1_dependencies_compiler_type" = gcc3]) +]) + + +# AM_SET_DEPDIR +# ------------- +# Choose a directory name for dependency files. +# This macro is AC_REQUIREd in _AM_DEPENDENCIES +AC_DEFUN([AM_SET_DEPDIR], +[AC_REQUIRE([AM_SET_LEADING_DOT])dnl +AC_SUBST([DEPDIR], ["${am__leading_dot}deps"])dnl +]) + + +# AM_DEP_TRACK +# ------------ +AC_DEFUN([AM_DEP_TRACK], +[AC_ARG_ENABLE(dependency-tracking, +[ --disable-dependency-tracking speeds up one-time build + --enable-dependency-tracking do not reject slow dependency extractors]) +if test "x$enable_dependency_tracking" != xno; then + am_depcomp="$ac_aux_dir/depcomp" + AMDEPBACKSLASH='\' +fi +AM_CONDITIONAL([AMDEP], [test "x$enable_dependency_tracking" != xno]) +AC_SUBST([AMDEPBACKSLASH]) +]) + +# Generate code to set up dependency tracking. -*- Autoconf -*- + +# Copyright (C) 1999, 2000, 2001, 2002, 2003, 2004, 2005 +# Free Software Foundation, Inc. +# +# This file is free software; the Free Software Foundation +# gives unlimited permission to copy and/or distribute it, +# with or without modifications, as long as this notice is preserved. + +#serial 3 + +# _AM_OUTPUT_DEPENDENCY_COMMANDS +# ------------------------------ +AC_DEFUN([_AM_OUTPUT_DEPENDENCY_COMMANDS], +[for mf in $CONFIG_FILES; do + # Strip MF so we end up with the name of the file. + mf=`echo "$mf" | sed -e 's/:.*$//'` + # Check whether this is an Automake generated Makefile or not. + # We used to match only the files named `Makefile.in', but + # some people rename them; so instead we look at the file content. + # Grep'ing the first line is not enough: some people post-process + # each Makefile.in and add a new line on top of each file to say so. + # So let's grep whole file. + if grep '^#.*generated by automake' $mf > /dev/null 2>&1; then + dirpart=`AS_DIRNAME("$mf")` + else + continue + fi + # Extract the definition of DEPDIR, am__include, and am__quote + # from the Makefile without running `make'. + DEPDIR=`sed -n 's/^DEPDIR = //p' < "$mf"` + test -z "$DEPDIR" && continue + am__include=`sed -n 's/^am__include = //p' < "$mf"` + test -z "am__include" && continue + am__quote=`sed -n 's/^am__quote = //p' < "$mf"` + # When using ansi2knr, U may be empty or an underscore; expand it + U=`sed -n 's/^U = //p' < "$mf"` + # Find all dependency output files, they are included files with + # $(DEPDIR) in their names. We invoke sed twice because it is the + # simplest approach to changing $(DEPDIR) to its actual value in the + # expansion. + for file in `sed -n " + s/^$am__include $am__quote\(.*(DEPDIR).*\)$am__quote"'$/\1/p' <"$mf" | \ + sed -e 's/\$(DEPDIR)/'"$DEPDIR"'/g' -e 's/\$U/'"$U"'/g'`; do + # Make sure the directory exists. + test -f "$dirpart/$file" && continue + fdir=`AS_DIRNAME(["$file"])` + AS_MKDIR_P([$dirpart/$fdir]) + # echo "creating $dirpart/$file" + echo '# dummy' > "$dirpart/$file" + done +done +])# _AM_OUTPUT_DEPENDENCY_COMMANDS + + +# AM_OUTPUT_DEPENDENCY_COMMANDS +# ----------------------------- +# This macro should only be invoked once -- use via AC_REQUIRE. +# +# This code is only required when automatic dependency tracking +# is enabled. FIXME. This creates each `.P' file that we will +# need in order to bootstrap the dependency handling code. +AC_DEFUN([AM_OUTPUT_DEPENDENCY_COMMANDS], +[AC_CONFIG_COMMANDS([depfiles], + [test x"$AMDEP_TRUE" != x"" || _AM_OUTPUT_DEPENDENCY_COMMANDS], + [AMDEP_TRUE="$AMDEP_TRUE" ac_aux_dir="$ac_aux_dir"]) +]) + +# Do all the work for Automake. -*- Autoconf -*- + +# Copyright (C) 1996, 1997, 1998, 1999, 2000, 2001, 2002, 2003, 2004, 2005 +# Free Software Foundation, Inc. +# +# This file is free software; the Free Software Foundation +# gives unlimited permission to copy and/or distribute it, +# with or without modifications, as long as this notice is preserved. + +# serial 12 + +# This macro actually does too much. Some checks are only needed if +# your package does certain things. But this isn't really a big deal. + +# AM_INIT_AUTOMAKE(PACKAGE, VERSION, [NO-DEFINE]) +# AM_INIT_AUTOMAKE([OPTIONS]) +# ----------------------------------------------- +# The call with PACKAGE and VERSION arguments is the old style +# call (pre autoconf-2.50), which is being phased out. PACKAGE +# and VERSION should now be passed to AC_INIT and removed from +# the call to AM_INIT_AUTOMAKE. +# We support both call styles for the transition. After +# the next Automake release, Autoconf can make the AC_INIT +# arguments mandatory, and then we can depend on a new Autoconf +# release and drop the old call support. +AC_DEFUN([AM_INIT_AUTOMAKE], +[AC_PREREQ([2.58])dnl +dnl Autoconf wants to disallow AM_ names. We explicitly allow +dnl the ones we care about. +m4_pattern_allow([^AM_[A-Z]+FLAGS$])dnl +AC_REQUIRE([AM_SET_CURRENT_AUTOMAKE_VERSION])dnl +AC_REQUIRE([AC_PROG_INSTALL])dnl +# test to see if srcdir already configured +if test "`cd $srcdir && pwd`" != "`pwd`" && + test -f $srcdir/config.status; then + AC_MSG_ERROR([source directory already configured; run "make distclean" there first]) +fi + +# test whether we have cygpath +if test -z "$CYGPATH_W"; then + if (cygpath --version) >/dev/null 2>/dev/null; then + CYGPATH_W='cygpath -w' + else + CYGPATH_W=echo + fi +fi +AC_SUBST([CYGPATH_W]) + +# Define the identity of the package. +dnl Distinguish between old-style and new-style calls. +m4_ifval([$2], +[m4_ifval([$3], [_AM_SET_OPTION([no-define])])dnl + AC_SUBST([PACKAGE], [$1])dnl + AC_SUBST([VERSION], [$2])], +[_AM_SET_OPTIONS([$1])dnl + AC_SUBST([PACKAGE], ['AC_PACKAGE_TARNAME'])dnl + AC_SUBST([VERSION], ['AC_PACKAGE_VERSION'])])dnl + +_AM_IF_OPTION([no-define],, +[AC_DEFINE_UNQUOTED(PACKAGE, "$PACKAGE", [Name of package]) + AC_DEFINE_UNQUOTED(VERSION, "$VERSION", [Version number of package])])dnl + +# Some tools Automake needs. +AC_REQUIRE([AM_SANITY_CHECK])dnl +AC_REQUIRE([AC_ARG_PROGRAM])dnl +AM_MISSING_PROG(ACLOCAL, aclocal-${am__api_version}) +AM_MISSING_PROG(AUTOCONF, autoconf) +AM_MISSING_PROG(AUTOMAKE, automake-${am__api_version}) +AM_MISSING_PROG(AUTOHEADER, autoheader) +AM_MISSING_PROG(MAKEINFO, makeinfo) +AM_PROG_INSTALL_SH +AM_PROG_INSTALL_STRIP +AC_REQUIRE([AM_PROG_MKDIR_P])dnl +# We need awk for the "check" target. The system "awk" is bad on +# some platforms. +AC_REQUIRE([AC_PROG_AWK])dnl +AC_REQUIRE([AC_PROG_MAKE_SET])dnl +AC_REQUIRE([AM_SET_LEADING_DOT])dnl +_AM_IF_OPTION([tar-ustar], [_AM_PROG_TAR([ustar])], + [_AM_IF_OPTION([tar-pax], [_AM_PROG_TAR([pax])], + [_AM_PROG_TAR([v7])])]) +_AM_IF_OPTION([no-dependencies],, +[AC_PROVIDE_IFELSE([AC_PROG_CC], + [_AM_DEPENDENCIES(CC)], + [define([AC_PROG_CC], + defn([AC_PROG_CC])[_AM_DEPENDENCIES(CC)])])dnl +AC_PROVIDE_IFELSE([AC_PROG_CXX], + [_AM_DEPENDENCIES(CXX)], + [define([AC_PROG_CXX], + defn([AC_PROG_CXX])[_AM_DEPENDENCIES(CXX)])])dnl +]) +]) + + +# When config.status generates a header, we must update the stamp-h file. +# This file resides in the same directory as the config header +# that is generated. The stamp files are numbered to have different names. + +# Autoconf calls _AC_AM_CONFIG_HEADER_HOOK (when defined) in the +# loop where config.status creates the headers, so we can generate +# our stamp files there. +AC_DEFUN([_AC_AM_CONFIG_HEADER_HOOK], +[# Compute $1's index in $config_headers. +_am_stamp_count=1 +for _am_header in $config_headers :; do + case $_am_header in + $1 | $1:* ) + break ;; + * ) + _am_stamp_count=`expr $_am_stamp_count + 1` ;; + esac +done +echo "timestamp for $1" >`AS_DIRNAME([$1])`/stamp-h[]$_am_stamp_count]) + +# Copyright (C) 2001, 2003, 2005 Free Software Foundation, Inc. +# +# This file is free software; the Free Software Foundation +# gives unlimited permission to copy and/or distribute it, +# with or without modifications, as long as this notice is preserved. + +# AM_PROG_INSTALL_SH +# ------------------ +# Define $install_sh. +AC_DEFUN([AM_PROG_INSTALL_SH], +[AC_REQUIRE([AM_AUX_DIR_EXPAND])dnl +install_sh=${install_sh-"$am_aux_dir/install-sh"} +AC_SUBST(install_sh)]) + +# Copyright (C) 2003, 2005 Free Software Foundation, Inc. +# +# This file is free software; the Free Software Foundation +# gives unlimited permission to copy and/or distribute it, +# with or without modifications, as long as this notice is preserved. + +# serial 2 + +# Check whether the underlying file-system supports filenames +# with a leading dot. For instance MS-DOS doesn't. +AC_DEFUN([AM_SET_LEADING_DOT], +[rm -rf .tst 2>/dev/null +mkdir .tst 2>/dev/null +if test -d .tst; then + am__leading_dot=. +else + am__leading_dot=_ +fi +rmdir .tst 2>/dev/null +AC_SUBST([am__leading_dot])]) + +# Check to see how 'make' treats includes. -*- Autoconf -*- + +# Copyright (C) 2001, 2002, 2003, 2005 Free Software Foundation, Inc. +# +# This file is free software; the Free Software Foundation +# gives unlimited permission to copy and/or distribute it, +# with or without modifications, as long as this notice is preserved. + +# serial 3 + +# AM_MAKE_INCLUDE() +# ----------------- +# Check to see how make treats includes. +AC_DEFUN([AM_MAKE_INCLUDE], +[am_make=${MAKE-make} +cat > confinc << 'END' +am__doit: + @echo done +.PHONY: am__doit +END +# If we don't find an include directive, just comment out the code. +AC_MSG_CHECKING([for style of include used by $am_make]) +am__include="#" +am__quote= +_am_result=none +# First try GNU make style include. +echo "include confinc" > confmf +# We grep out `Entering directory' and `Leaving directory' +# messages which can occur if `w' ends up in MAKEFLAGS. +# In particular we don't look at `^make:' because GNU make might +# be invoked under some other name (usually "gmake"), in which +# case it prints its new name instead of `make'. +if test "`$am_make -s -f confmf 2> /dev/null | grep -v 'ing directory'`" = "done"; then + am__include=include + am__quote= + _am_result=GNU +fi +# Now try BSD make style include. +if test "$am__include" = "#"; then + echo '.include "confinc"' > confmf + if test "`$am_make -s -f confmf 2> /dev/null`" = "done"; then + am__include=.include + am__quote="\"" + _am_result=BSD + fi +fi +AC_SUBST([am__include]) +AC_SUBST([am__quote]) +AC_MSG_RESULT([$_am_result]) +rm -f confinc confmf +]) + +# Fake the existence of programs that GNU maintainers use. -*- Autoconf -*- + +# Copyright (C) 1997, 1999, 2000, 2001, 2003, 2005 +# Free Software Foundation, Inc. +# +# This file is free software; the Free Software Foundation +# gives unlimited permission to copy and/or distribute it, +# with or without modifications, as long as this notice is preserved. + +# serial 4 + +# AM_MISSING_PROG(NAME, PROGRAM) +# ------------------------------ +AC_DEFUN([AM_MISSING_PROG], +[AC_REQUIRE([AM_MISSING_HAS_RUN]) +$1=${$1-"${am_missing_run}$2"} +AC_SUBST($1)]) + + +# AM_MISSING_HAS_RUN +# ------------------ +# Define MISSING if not defined so far and test if it supports --run. +# If it does, set am_missing_run to use it, otherwise, to nothing. +AC_DEFUN([AM_MISSING_HAS_RUN], +[AC_REQUIRE([AM_AUX_DIR_EXPAND])dnl +test x"${MISSING+set}" = xset || MISSING="\${SHELL} $am_aux_dir/missing" +# Use eval to expand $SHELL +if eval "$MISSING --run true"; then + am_missing_run="$MISSING --run " +else + am_missing_run= + AC_MSG_WARN([`missing' script is too old or missing]) +fi +]) + +# Copyright (C) 2003, 2004, 2005 Free Software Foundation, Inc. +# +# This file is free software; the Free Software Foundation +# gives unlimited permission to copy and/or distribute it, +# with or without modifications, as long as this notice is preserved. + +# AM_PROG_MKDIR_P +# --------------- +# Check whether `mkdir -p' is supported, fallback to mkinstalldirs otherwise. +# +# Automake 1.8 used `mkdir -m 0755 -p --' to ensure that directories +# created by `make install' are always world readable, even if the +# installer happens to have an overly restrictive umask (e.g. 077). +# This was a mistake. There are at least two reasons why we must not +# use `-m 0755': +# - it causes special bits like SGID to be ignored, +# - it may be too restrictive (some setups expect 775 directories). +# +# Do not use -m 0755 and let people choose whatever they expect by +# setting umask. +# +# We cannot accept any implementation of `mkdir' that recognizes `-p'. +# Some implementations (such as Solaris 8's) are not thread-safe: if a +# parallel make tries to run `mkdir -p a/b' and `mkdir -p a/c' +# concurrently, both version can detect that a/ is missing, but only +# one can create it and the other will error out. Consequently we +# restrict ourselves to GNU make (using the --version option ensures +# this.) +AC_DEFUN([AM_PROG_MKDIR_P], +[if mkdir -p --version . >/dev/null 2>&1 && test ! -d ./--version; then + # We used to keeping the `.' as first argument, in order to + # allow $(mkdir_p) to be used without argument. As in + # $(mkdir_p) $(somedir) + # where $(somedir) is conditionally defined. However this is wrong + # for two reasons: + # 1. if the package is installed by a user who cannot write `.' + # make install will fail, + # 2. the above comment should most certainly read + # $(mkdir_p) $(DESTDIR)$(somedir) + # so it does not work when $(somedir) is undefined and + # $(DESTDIR) is not. + # To support the latter case, we have to write + # test -z "$(somedir)" || $(mkdir_p) $(DESTDIR)$(somedir), + # so the `.' trick is pointless. + mkdir_p='mkdir -p --' +else + # On NextStep and OpenStep, the `mkdir' command does not + # recognize any option. It will interpret all options as + # directories to create, and then abort because `.' already + # exists. + for d in ./-p ./--version; + do + test -d $d && rmdir $d + done + # $(mkinstalldirs) is defined by Automake if mkinstalldirs exists. + if test -f "$ac_aux_dir/mkinstalldirs"; then + mkdir_p='$(mkinstalldirs)' + else + mkdir_p='$(install_sh) -d' + fi +fi +AC_SUBST([mkdir_p])]) + +# Helper functions for option handling. -*- Autoconf -*- + +# Copyright (C) 2001, 2002, 2003, 2005 Free Software Foundation, Inc. +# +# This file is free software; the Free Software Foundation +# gives unlimited permission to copy and/or distribute it, +# with or without modifications, as long as this notice is preserved. + +# serial 3 + +# _AM_MANGLE_OPTION(NAME) +# ----------------------- +AC_DEFUN([_AM_MANGLE_OPTION], +[[_AM_OPTION_]m4_bpatsubst($1, [[^a-zA-Z0-9_]], [_])]) + +# _AM_SET_OPTION(NAME) +# ------------------------------ +# Set option NAME. Presently that only means defining a flag for this option. +AC_DEFUN([_AM_SET_OPTION], +[m4_define(_AM_MANGLE_OPTION([$1]), 1)]) + +# _AM_SET_OPTIONS(OPTIONS) +# ---------------------------------- +# OPTIONS is a space-separated list of Automake options. +AC_DEFUN([_AM_SET_OPTIONS], +[AC_FOREACH([_AM_Option], [$1], [_AM_SET_OPTION(_AM_Option)])]) + +# _AM_IF_OPTION(OPTION, IF-SET, [IF-NOT-SET]) +# ------------------------------------------- +# Execute IF-SET if OPTION is set, IF-NOT-SET otherwise. +AC_DEFUN([_AM_IF_OPTION], +[m4_ifset(_AM_MANGLE_OPTION([$1]), [$2], [$3])]) + +# Check to make sure that the build environment is sane. -*- Autoconf -*- + +# Copyright (C) 1996, 1997, 2000, 2001, 2003, 2005 +# Free Software Foundation, Inc. +# +# This file is free software; the Free Software Foundation +# gives unlimited permission to copy and/or distribute it, +# with or without modifications, as long as this notice is preserved. + +# serial 4 + +# AM_SANITY_CHECK +# --------------- +AC_DEFUN([AM_SANITY_CHECK], +[AC_MSG_CHECKING([whether build environment is sane]) +# Just in case +sleep 1 +echo timestamp > conftest.file +# Do `set' in a subshell so we don't clobber the current shell's +# arguments. Must try -L first in case configure is actually a +# symlink; some systems play weird games with the mod time of symlinks +# (eg FreeBSD returns the mod time of the symlink's containing +# directory). +if ( + set X `ls -Lt $srcdir/configure conftest.file 2> /dev/null` + if test "$[*]" = "X"; then + # -L didn't work. + set X `ls -t $srcdir/configure conftest.file` + fi + rm -f conftest.file + if test "$[*]" != "X $srcdir/configure conftest.file" \ + && test "$[*]" != "X conftest.file $srcdir/configure"; then + + # If neither matched, then we have a broken ls. This can happen + # if, for instance, CONFIG_SHELL is bash and it inherits a + # broken ls alias from the environment. This has actually + # happened. Such a system could not be considered "sane". + AC_MSG_ERROR([ls -t appears to fail. Make sure there is not a broken +alias in your environment]) + fi + + test "$[2]" = conftest.file + ) +then + # Ok. + : +else + AC_MSG_ERROR([newly created file is older than distributed files! +Check your system clock]) +fi +AC_MSG_RESULT(yes)]) + +# Copyright (C) 2001, 2003, 2005 Free Software Foundation, Inc. +# +# This file is free software; the Free Software Foundation +# gives unlimited permission to copy and/or distribute it, +# with or without modifications, as long as this notice is preserved. + +# AM_PROG_INSTALL_STRIP +# --------------------- +# One issue with vendor `install' (even GNU) is that you can't +# specify the program used to strip binaries. This is especially +# annoying in cross-compiling environments, where the build's strip +# is unlikely to handle the host's binaries. +# Fortunately install-sh will honor a STRIPPROG variable, so we +# always use install-sh in `make install-strip', and initialize +# STRIPPROG with the value of the STRIP variable (set by the user). +AC_DEFUN([AM_PROG_INSTALL_STRIP], +[AC_REQUIRE([AM_PROG_INSTALL_SH])dnl +# Installed binaries are usually stripped using `strip' when the user +# run `make install-strip'. However `strip' might not be the right +# tool to use in cross-compilation environments, therefore Automake +# will honor the `STRIP' environment variable to overrule this program. +dnl Don't test for $cross_compiling = yes, because it might be `maybe'. +if test "$cross_compiling" != no; then + AC_CHECK_TOOL([STRIP], [strip], :) +fi +INSTALL_STRIP_PROGRAM="\${SHELL} \$(install_sh) -c -s" +AC_SUBST([INSTALL_STRIP_PROGRAM])]) + +# Check how to create a tarball. -*- Autoconf -*- + +# Copyright (C) 2004, 2005 Free Software Foundation, Inc. +# +# This file is free software; the Free Software Foundation +# gives unlimited permission to copy and/or distribute it, +# with or without modifications, as long as this notice is preserved. + +# serial 2 + +# _AM_PROG_TAR(FORMAT) +# -------------------- +# Check how to create a tarball in format FORMAT. +# FORMAT should be one of `v7', `ustar', or `pax'. +# +# Substitute a variable $(am__tar) that is a command +# writing to stdout a FORMAT-tarball containing the directory +# $tardir. +# tardir=directory && $(am__tar) > result.tar +# +# Substitute a variable $(am__untar) that extract such +# a tarball read from stdin. +# $(am__untar) < result.tar +AC_DEFUN([_AM_PROG_TAR], +[# Always define AMTAR for backward compatibility. +AM_MISSING_PROG([AMTAR], [tar]) +m4_if([$1], [v7], + [am__tar='${AMTAR} chof - "$$tardir"'; am__untar='${AMTAR} xf -'], + [m4_case([$1], [ustar],, [pax],, + [m4_fatal([Unknown tar format])]) +AC_MSG_CHECKING([how to create a $1 tar archive]) +# Loop over all known methods to create a tar archive until one works. +_am_tools='gnutar m4_if([$1], [ustar], [plaintar]) pax cpio none' +_am_tools=${am_cv_prog_tar_$1-$_am_tools} +# Do not fold the above two line into one, because Tru64 sh and +# Solaris sh will not grok spaces in the rhs of `-'. +for _am_tool in $_am_tools +do + case $_am_tool in + gnutar) + for _am_tar in tar gnutar gtar; + do + AM_RUN_LOG([$_am_tar --version]) && break + done + am__tar="$_am_tar --format=m4_if([$1], [pax], [posix], [$1]) -chf - "'"$$tardir"' + am__tar_="$_am_tar --format=m4_if([$1], [pax], [posix], [$1]) -chf - "'"$tardir"' + am__untar="$_am_tar -xf -" + ;; + plaintar) + # Must skip GNU tar: if it does not support --format= it doesn't create + # ustar tarball either. + (tar --version) >/dev/null 2>&1 && continue + am__tar='tar chf - "$$tardir"' + am__tar_='tar chf - "$tardir"' + am__untar='tar xf -' + ;; + pax) + am__tar='pax -L -x $1 -w "$$tardir"' + am__tar_='pax -L -x $1 -w "$tardir"' + am__untar='pax -r' + ;; + cpio) + am__tar='find "$$tardir" -print | cpio -o -H $1 -L' + am__tar_='find "$tardir" -print | cpio -o -H $1 -L' + am__untar='cpio -i -H $1 -d' + ;; + none) + am__tar=false + am__tar_=false + am__untar=false + ;; + esac + + # If the value was cached, stop now. We just wanted to have am__tar + # and am__untar set. + test -n "${am_cv_prog_tar_$1}" && break + + # tar/untar a dummy directory, and stop if the command works + rm -rf conftest.dir + mkdir conftest.dir + echo GrepMe > conftest.dir/file + AM_RUN_LOG([tardir=conftest.dir && eval $am__tar_ >conftest.tar]) + rm -rf conftest.dir + if test -s conftest.tar; then + AM_RUN_LOG([$am__untar /dev/null 2>&1 && break + fi +done +rm -rf conftest.dir + +AC_CACHE_VAL([am_cv_prog_tar_$1], [am_cv_prog_tar_$1=$_am_tool]) +AC_MSG_RESULT([$am_cv_prog_tar_$1])]) +AC_SUBST([am__tar]) +AC_SUBST([am__untar]) +]) # _AM_PROG_TAR + diff --git a/config.h.in b/config.h.in new file mode 100644 index 0000000..90045e3 --- /dev/null +++ b/config.h.in @@ -0,0 +1,143 @@ +/* config.h.in. Generated from configure.ac by autoheader. */ + +/* Define to 1 if you have the header file. */ +#undef HAVE_ARPA_INET_H + +/* Define to 1 if you have the `bzero' function. */ +#undef HAVE_BZERO + +/* Define to 1 if you have the header file. */ +#undef HAVE_COMEDILIB_H + +/* Define to 1 if you have the `dup2' function. */ +#undef HAVE_DUP2 + +/* Define to 1 if you have the header file. */ +#undef HAVE_FCNTL_H + +/* Define to 1 if you have the `floor' function. */ +#undef HAVE_FLOOR + +/* Define to 1 if you have the `fork' function. */ +#undef HAVE_FORK + +/* Define to 1 if you have the `gethostbyname' function. */ +#undef HAVE_GETHOSTBYNAME + +/* Define to 1 if you have the `gettimeofday' function. */ +#undef HAVE_GETTIMEOFDAY + +/* Define to 1 if you have the `inet_ntoa' function. */ +#undef HAVE_INET_NTOA + +/* Define to 1 if you have the header file. */ +#undef HAVE_INTTYPES_H + +/* Define to 1 if your system has a GNU libc compatible `malloc' function, and + to 0 otherwise. */ +#undef HAVE_MALLOC + +/* Define to 1 if you have the header file. */ +#undef HAVE_MEMORY_H + +/* Define to 1 if you have the header file. */ +#undef HAVE_NETDB_H + +/* Define to 1 if you have the `pow' function. */ +#undef HAVE_POW + +/* Define to 1 if you have the header file. */ +#undef HAVE_PTHREAD_H + +/* Define to 1 if you have the `rint' function. */ +#undef HAVE_RINT + +/* Define to 1 if you have the `socket' function. */ +#undef HAVE_SOCKET + +/* Define to 1 if stdbool.h conforms to C99. */ +#undef HAVE_STDBOOL_H + +/* Define to 1 if you have the header file. */ +#undef HAVE_STDINT_H + +/* Define to 1 if you have the header file. */ +#undef HAVE_STDLIB_H + +/* Define to 1 if you have the `strchr' function. */ +#undef HAVE_STRCHR + +/* Define to 1 if you have the header file. */ +#undef HAVE_STRINGS_H + +/* Define to 1 if you have the header file. */ +#undef HAVE_STRING_H + +/* Define to 1 if you have the header file. */ +#undef HAVE_SYS_SOCKET_H + +/* Define to 1 if you have the header file. */ +#undef HAVE_SYS_STAT_H + +/* Define to 1 if you have the header file. */ +#undef HAVE_SYS_TIME_H + +/* Define to 1 if you have the header file. */ +#undef HAVE_SYS_TYPES_H + +/* Define to 1 if you have the header file. */ +#undef HAVE_TERMIOS_H + +/* Define to 1 if you have the header file. */ +#undef HAVE_UNISTD_H + +/* Define to 1 if you have the `vfork' function. */ +#undef HAVE_VFORK + +/* Define to 1 if you have the header file. */ +#undef HAVE_VFORK_H + +/* Define to 1 if `fork' works. */ +#undef HAVE_WORKING_FORK + +/* Define to 1 if `vfork' works. */ +#undef HAVE_WORKING_VFORK + +/* Define to 1 if the system has the type `_Bool'. */ +#undef HAVE__BOOL + +/* Name of package */ +#undef PACKAGE + +/* Define to the address where bug reports for this package should be sent. */ +#undef PACKAGE_BUGREPORT + +/* Define to the full name of this package. */ +#undef PACKAGE_NAME + +/* Define to the full name and version of this package. */ +#undef PACKAGE_STRING + +/* Define to the one symbol short name of this package. */ +#undef PACKAGE_TARNAME + +/* Define to the home page for this package. */ +#undef PACKAGE_URL + +/* Define to the version of this package. */ +#undef PACKAGE_VERSION + +/* Define to 1 if you have the ANSI C header files. */ +#undef STDC_HEADERS + +/* Version number of package */ +#undef VERSION + +/* Define to rpl_malloc if the replacement function should be used. */ +#undef malloc + +/* Define to `int' if does not define. */ +#undef pid_t + +/* Define as `fork' if `vfork' does not work. */ +#undef vfork diff --git a/configure b/configure new file mode 100755 index 0000000..c8db414 --- /dev/null +++ b/configure @@ -0,0 +1,6289 @@ +#! /bin/sh +# Guess values for system-dependent variables and create Makefiles. +# Generated by GNU Autoconf 2.67 for nife 0.44. +# +# Report bugs to . +# +# +# Copyright (C) 1992, 1993, 1994, 1995, 1996, 1998, 1999, 2000, 2001, +# 2002, 2003, 2004, 2005, 2006, 2007, 2008, 2009, 2010 Free Software +# Foundation, Inc. +# +# +# This configure script is free software; the Free Software Foundation +# gives unlimited permission to copy, distribute and modify it. +## -------------------- ## +## M4sh Initialization. ## +## -------------------- ## + +# Be more Bourne compatible +DUALCASE=1; export DUALCASE # for MKS sh +if test -n "${ZSH_VERSION+set}" && (emulate sh) >/dev/null 2>&1; then : + emulate sh + NULLCMD=: + # Pre-4.2 versions of Zsh do word splitting on ${1+"$@"}, which + # is contrary to our usage. Disable this feature. + alias -g '${1+"$@"}'='"$@"' + setopt NO_GLOB_SUBST +else + case `(set -o) 2>/dev/null` in #( + *posix*) : + set -o posix ;; #( + *) : + ;; +esac +fi + + +as_nl=' +' +export as_nl +# Printing a long string crashes Solaris 7 /usr/bin/printf. +as_echo='\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\' +as_echo=$as_echo$as_echo$as_echo$as_echo$as_echo +as_echo=$as_echo$as_echo$as_echo$as_echo$as_echo$as_echo +# Prefer a ksh shell builtin over an external printf program on Solaris, +# but without wasting forks for bash or zsh. +if test -z "$BASH_VERSION$ZSH_VERSION" \ + && (test "X`print -r -- $as_echo`" = "X$as_echo") 2>/dev/null; then + as_echo='print -r --' + as_echo_n='print -rn --' +elif (test "X`printf %s $as_echo`" = "X$as_echo") 2>/dev/null; then + as_echo='printf %s\n' + as_echo_n='printf %s' +else + if test "X`(/usr/ucb/echo -n -n $as_echo) 2>/dev/null`" = "X-n $as_echo"; then + as_echo_body='eval /usr/ucb/echo -n "$1$as_nl"' + as_echo_n='/usr/ucb/echo -n' + else + as_echo_body='eval expr "X$1" : "X\\(.*\\)"' + as_echo_n_body='eval + arg=$1; + case $arg in #( + *"$as_nl"*) + expr "X$arg" : "X\\(.*\\)$as_nl"; + arg=`expr "X$arg" : ".*$as_nl\\(.*\\)"`;; + esac; + expr "X$arg" : "X\\(.*\\)" | tr -d "$as_nl" + ' + export as_echo_n_body + as_echo_n='sh -c $as_echo_n_body as_echo' + fi + export as_echo_body + as_echo='sh -c $as_echo_body as_echo' +fi + +# The user is always right. +if test "${PATH_SEPARATOR+set}" != set; then + PATH_SEPARATOR=: + (PATH='/bin;/bin'; FPATH=$PATH; sh -c :) >/dev/null 2>&1 && { + (PATH='/bin:/bin'; FPATH=$PATH; sh -c :) >/dev/null 2>&1 || + PATH_SEPARATOR=';' + } +fi + + +# IFS +# We need space, tab and new line, in precisely that order. Quoting is +# there to prevent editors from complaining about space-tab. +# (If _AS_PATH_WALK were called with IFS unset, it would disable word +# splitting by setting IFS to empty value.) +IFS=" "" $as_nl" + +# Find who we are. Look in the path if we contain no directory separator. +case $0 in #(( + *[\\/]* ) as_myself=$0 ;; + *) as_save_IFS=$IFS; IFS=$PATH_SEPARATOR +for as_dir in $PATH +do + IFS=$as_save_IFS + test -z "$as_dir" && as_dir=. + test -r "$as_dir/$0" && as_myself=$as_dir/$0 && break + done +IFS=$as_save_IFS + + ;; +esac +# We did not find ourselves, most probably we were run as `sh COMMAND' +# in which case we are not to be found in the path. +if test "x$as_myself" = x; then + as_myself=$0 +fi +if test ! -f "$as_myself"; then + $as_echo "$as_myself: error: cannot find myself; rerun with an absolute file name" >&2 + exit 1 +fi + +# Unset variables that we do not need and which cause bugs (e.g. in +# pre-3.0 UWIN ksh). But do not cause bugs in bash 2.01; the "|| exit 1" +# suppresses any "Segmentation fault" message there. '((' could +# trigger a bug in pdksh 5.2.14. +for as_var in BASH_ENV ENV MAIL MAILPATH +do eval test x\${$as_var+set} = xset \ + && ( (unset $as_var) || exit 1) >/dev/null 2>&1 && unset $as_var || : +done +PS1='$ ' +PS2='> ' +PS4='+ ' + +# NLS nuisances. +LC_ALL=C +export LC_ALL +LANGUAGE=C +export LANGUAGE + +# CDPATH. +(unset CDPATH) >/dev/null 2>&1 && unset CDPATH + +if test "x$CONFIG_SHELL" = x; then + as_bourne_compatible="if test -n \"\${ZSH_VERSION+set}\" && (emulate sh) >/dev/null 2>&1; then : + emulate sh + NULLCMD=: + # Pre-4.2 versions of Zsh do word splitting on \${1+\"\$@\"}, which + # is contrary to our usage. Disable this feature. + alias -g '\${1+\"\$@\"}'='\"\$@\"' + setopt NO_GLOB_SUBST +else + case \`(set -o) 2>/dev/null\` in #( + *posix*) : + set -o posix ;; #( + *) : + ;; +esac +fi +" + as_required="as_fn_return () { (exit \$1); } +as_fn_success () { as_fn_return 0; } +as_fn_failure () { as_fn_return 1; } +as_fn_ret_success () { return 0; } +as_fn_ret_failure () { return 1; } + +exitcode=0 +as_fn_success || { exitcode=1; echo as_fn_success failed.; } +as_fn_failure && { exitcode=1; echo as_fn_failure succeeded.; } +as_fn_ret_success || { exitcode=1; echo as_fn_ret_success failed.; } +as_fn_ret_failure && { exitcode=1; echo as_fn_ret_failure succeeded.; } +if ( set x; as_fn_ret_success y && test x = \"\$1\" ); then : + +else + exitcode=1; echo positional parameters were not saved. +fi +test x\$exitcode = x0 || exit 1" + as_suggested=" as_lineno_1=";as_suggested=$as_suggested$LINENO;as_suggested=$as_suggested" as_lineno_1a=\$LINENO + as_lineno_2=";as_suggested=$as_suggested$LINENO;as_suggested=$as_suggested" as_lineno_2a=\$LINENO + eval 'test \"x\$as_lineno_1'\$as_run'\" != \"x\$as_lineno_2'\$as_run'\" && + test \"x\`expr \$as_lineno_1'\$as_run' + 1\`\" = \"x\$as_lineno_2'\$as_run'\"' || exit 1 +test \$(( 1 + 1 )) = 2 || exit 1" + if (eval "$as_required") 2>/dev/null; then : + as_have_required=yes +else + as_have_required=no +fi + if test x$as_have_required = xyes && (eval "$as_suggested") 2>/dev/null; then : + +else + as_save_IFS=$IFS; IFS=$PATH_SEPARATOR +as_found=false +for as_dir in /bin$PATH_SEPARATOR/usr/bin$PATH_SEPARATOR$PATH +do + IFS=$as_save_IFS + test -z "$as_dir" && as_dir=. + as_found=: + case $as_dir in #( + /*) + for as_base in sh bash ksh sh5; do + # Try only shells that exist, to save several forks. + as_shell=$as_dir/$as_base + if { test -f "$as_shell" || test -f "$as_shell.exe"; } && + { $as_echo "$as_bourne_compatible""$as_required" | as_run=a "$as_shell"; } 2>/dev/null; then : + CONFIG_SHELL=$as_shell as_have_required=yes + if { $as_echo "$as_bourne_compatible""$as_suggested" | as_run=a "$as_shell"; } 2>/dev/null; then : + break 2 +fi +fi + done;; + esac + as_found=false +done +$as_found || { if { test -f "$SHELL" || test -f "$SHELL.exe"; } && + { $as_echo "$as_bourne_compatible""$as_required" | as_run=a "$SHELL"; } 2>/dev/null; then : + CONFIG_SHELL=$SHELL as_have_required=yes +fi; } +IFS=$as_save_IFS + + + if test "x$CONFIG_SHELL" != x; then : + # We cannot yet assume a decent shell, so we have to provide a + # neutralization value for shells without unset; and this also + # works around shells that cannot unset nonexistent variables. + BASH_ENV=/dev/null + ENV=/dev/null + (unset BASH_ENV) >/dev/null 2>&1 && unset BASH_ENV ENV + export CONFIG_SHELL + exec "$CONFIG_SHELL" "$as_myself" ${1+"$@"} +fi + + if test x$as_have_required = xno; then : + $as_echo "$0: This script requires a shell more modern than all" + $as_echo "$0: the shells that I found on your system." + if test x${ZSH_VERSION+set} = xset ; then + $as_echo "$0: In particular, zsh $ZSH_VERSION has bugs and should" + $as_echo "$0: be upgraded to zsh 4.3.4 or later." + else + $as_echo "$0: Please tell bug-autoconf@gnu.org and nife@seriane.fr +$0: about your system, including any error possibly output +$0: before this message. Then install a modern shell, or +$0: manually run the script under such a shell if you do +$0: have one." + fi + exit 1 +fi +fi +fi +SHELL=${CONFIG_SHELL-/bin/sh} +export SHELL +# Unset more variables known to interfere with behavior of common tools. +CLICOLOR_FORCE= GREP_OPTIONS= +unset CLICOLOR_FORCE GREP_OPTIONS + +## --------------------- ## +## M4sh Shell Functions. ## +## --------------------- ## +# as_fn_unset VAR +# --------------- +# Portably unset VAR. +as_fn_unset () +{ + { eval $1=; unset $1;} +} +as_unset=as_fn_unset + +# as_fn_set_status STATUS +# ----------------------- +# Set $? to STATUS, without forking. +as_fn_set_status () +{ + return $1 +} # as_fn_set_status + +# as_fn_exit STATUS +# ----------------- +# Exit the shell with STATUS, even in a "trap 0" or "set -e" context. +as_fn_exit () +{ + set +e + as_fn_set_status $1 + exit $1 +} # as_fn_exit + +# as_fn_mkdir_p +# ------------- +# Create "$as_dir" as a directory, including parents if necessary. +as_fn_mkdir_p () +{ + + case $as_dir in #( + -*) as_dir=./$as_dir;; + esac + test -d "$as_dir" || eval $as_mkdir_p || { + as_dirs= + while :; do + case $as_dir in #( + *\'*) as_qdir=`$as_echo "$as_dir" | sed "s/'/'\\\\\\\\''/g"`;; #'( + *) as_qdir=$as_dir;; + esac + as_dirs="'$as_qdir' $as_dirs" + as_dir=`$as_dirname -- "$as_dir" || +$as_expr X"$as_dir" : 'X\(.*[^/]\)//*[^/][^/]*/*$' \| \ + X"$as_dir" : 'X\(//\)[^/]' \| \ + X"$as_dir" : 'X\(//\)$' \| \ + X"$as_dir" : 'X\(/\)' \| . 2>/dev/null || +$as_echo X"$as_dir" | + sed '/^X\(.*[^/]\)\/\/*[^/][^/]*\/*$/{ + s//\1/ + q + } + /^X\(\/\/\)[^/].*/{ + s//\1/ + q + } + /^X\(\/\/\)$/{ + s//\1/ + q + } + /^X\(\/\).*/{ + s//\1/ + q + } + s/.*/./; q'` + test -d "$as_dir" && break + done + test -z "$as_dirs" || eval "mkdir $as_dirs" + } || test -d "$as_dir" || as_fn_error $? "cannot create directory $as_dir" + + +} # as_fn_mkdir_p +# as_fn_append VAR VALUE +# ---------------------- +# Append the text in VALUE to the end of the definition contained in VAR. Take +# advantage of any shell optimizations that allow amortized linear growth over +# repeated appends, instead of the typical quadratic growth present in naive +# implementations. +if (eval "as_var=1; as_var+=2; test x\$as_var = x12") 2>/dev/null; then : + eval 'as_fn_append () + { + eval $1+=\$2 + }' +else + as_fn_append () + { + eval $1=\$$1\$2 + } +fi # as_fn_append + +# as_fn_arith ARG... +# ------------------ +# Perform arithmetic evaluation on the ARGs, and store the result in the +# global $as_val. Take advantage of shells that can avoid forks. The arguments +# must be portable across $(()) and expr. +if (eval "test \$(( 1 + 1 )) = 2") 2>/dev/null; then : + eval 'as_fn_arith () + { + as_val=$(( $* )) + }' +else + as_fn_arith () + { + as_val=`expr "$@" || test $? -eq 1` + } +fi # as_fn_arith + + +# as_fn_error STATUS ERROR [LINENO LOG_FD] +# ---------------------------------------- +# Output "`basename $0`: error: ERROR" to stderr. If LINENO and LOG_FD are +# provided, also output the error to LOG_FD, referencing LINENO. Then exit the +# script with STATUS, using 1 if that was 0. +as_fn_error () +{ + as_status=$1; test $as_status -eq 0 && as_status=1 + if test "$4"; then + as_lineno=${as_lineno-"$3"} as_lineno_stack=as_lineno_stack=$as_lineno_stack + $as_echo "$as_me:${as_lineno-$LINENO}: error: $2" >&$4 + fi + $as_echo "$as_me: error: $2" >&2 + as_fn_exit $as_status +} # as_fn_error + +if expr a : '\(a\)' >/dev/null 2>&1 && + test "X`expr 00001 : '.*\(...\)'`" = X001; then + as_expr=expr +else + as_expr=false +fi + +if (basename -- /) >/dev/null 2>&1 && test "X`basename -- / 2>&1`" = "X/"; then + as_basename=basename +else + as_basename=false +fi + +if (as_dir=`dirname -- /` && test "X$as_dir" = X/) >/dev/null 2>&1; then + as_dirname=dirname +else + as_dirname=false +fi + +as_me=`$as_basename -- "$0" || +$as_expr X/"$0" : '.*/\([^/][^/]*\)/*$' \| \ + X"$0" : 'X\(//\)$' \| \ + X"$0" : 'X\(/\)' \| . 2>/dev/null || +$as_echo X/"$0" | + sed '/^.*\/\([^/][^/]*\)\/*$/{ + s//\1/ + q + } + /^X\/\(\/\/\)$/{ + s//\1/ + q + } + /^X\/\(\/\).*/{ + s//\1/ + q + } + s/.*/./; q'` + +# Avoid depending upon Character Ranges. +as_cr_letters='abcdefghijklmnopqrstuvwxyz' +as_cr_LETTERS='ABCDEFGHIJKLMNOPQRSTUVWXYZ' +as_cr_Letters=$as_cr_letters$as_cr_LETTERS +as_cr_digits='0123456789' +as_cr_alnum=$as_cr_Letters$as_cr_digits + + + as_lineno_1=$LINENO as_lineno_1a=$LINENO + as_lineno_2=$LINENO as_lineno_2a=$LINENO + eval 'test "x$as_lineno_1'$as_run'" != "x$as_lineno_2'$as_run'" && + test "x`expr $as_lineno_1'$as_run' + 1`" = "x$as_lineno_2'$as_run'"' || { + # Blame Lee E. McMahon (1931-1989) for sed's syntax. :-) + sed -n ' + p + /[$]LINENO/= + ' <$as_myself | + sed ' + s/[$]LINENO.*/&-/ + t lineno + b + :lineno + N + :loop + s/[$]LINENO\([^'$as_cr_alnum'_].*\n\)\(.*\)/\2\1\2/ + t loop + s/-\n.*// + ' >$as_me.lineno && + chmod +x "$as_me.lineno" || + { $as_echo "$as_me: error: cannot create $as_me.lineno; rerun with a POSIX shell" >&2; as_fn_exit 1; } + + # Don't try to exec as it changes $[0], causing all sort of problems + # (the dirname of $[0] is not the place where we might find the + # original and so on. Autoconf is especially sensitive to this). + . "./$as_me.lineno" + # Exit status is that of the last command. + exit +} + +ECHO_C= ECHO_N= ECHO_T= +case `echo -n x` in #((((( +-n*) + case `echo 'xy\c'` in + *c*) ECHO_T=' ';; # ECHO_T is single tab character. + xy) ECHO_C='\c';; + *) echo `echo ksh88 bug on AIX 6.1` > /dev/null + ECHO_T=' ';; + esac;; +*) + ECHO_N='-n';; +esac + +rm -f conf$$ conf$$.exe conf$$.file +if test -d conf$$.dir; then + rm -f conf$$.dir/conf$$.file +else + rm -f conf$$.dir + mkdir conf$$.dir 2>/dev/null +fi +if (echo >conf$$.file) 2>/dev/null; then + if ln -s conf$$.file conf$$ 2>/dev/null; then + as_ln_s='ln -s' + # ... but there are two gotchas: + # 1) On MSYS, both `ln -s file dir' and `ln file dir' fail. + # 2) DJGPP < 2.04 has no symlinks; `ln -s' creates a wrapper executable. + # In both cases, we have to default to `cp -p'. + ln -s conf$$.file conf$$.dir 2>/dev/null && test ! -f conf$$.exe || + as_ln_s='cp -p' + elif ln conf$$.file conf$$ 2>/dev/null; then + as_ln_s=ln + else + as_ln_s='cp -p' + fi +else + as_ln_s='cp -p' +fi +rm -f conf$$ conf$$.exe conf$$.dir/conf$$.file conf$$.file +rmdir conf$$.dir 2>/dev/null + +if mkdir -p . 2>/dev/null; then + as_mkdir_p='mkdir -p "$as_dir"' +else + test -d ./-p && rmdir ./-p + as_mkdir_p=false +fi + +if test -x / >/dev/null 2>&1; then + as_test_x='test -x' +else + if ls -dL / >/dev/null 2>&1; then + as_ls_L_option=L + else + as_ls_L_option= + fi + as_test_x=' + eval sh -c '\'' + if test -d "$1"; then + test -d "$1/."; + else + case $1 in #( + -*)set "./$1";; + esac; + case `ls -ld'$as_ls_L_option' "$1" 2>/dev/null` in #(( + ???[sx]*):;;*)false;;esac;fi + '\'' sh + ' +fi +as_executable_p=$as_test_x + +# Sed expression to map a string onto a valid CPP name. +as_tr_cpp="eval sed 'y%*$as_cr_letters%P$as_cr_LETTERS%;s%[^_$as_cr_alnum]%_%g'" + +# Sed expression to map a string onto a valid variable name. +as_tr_sh="eval sed 'y%*+%pp%;s%[^_$as_cr_alnum]%_%g'" + + +test -n "$DJDIR" || exec 7<&0 &1 + +# Name of the host. +# hostname on some systems (SVR3.2, old GNU/Linux) returns a bogus exit status, +# so uname gets run too. +ac_hostname=`(hostname || uname -n) 2>/dev/null | sed 1q` + +# +# Initializations. +# +ac_default_prefix=/usr/local +ac_clean_files= +ac_config_libobj_dir=. +LIBOBJS= +cross_compiling=no +subdirs= +MFLAGS= +MAKEFLAGS= + +# Identity of this package. +PACKAGE_NAME='nife' +PACKAGE_TARNAME='nife' +PACKAGE_VERSION='0.44' +PACKAGE_STRING='nife 0.44' +PACKAGE_BUGREPORT='nife@seriane.fr' +PACKAGE_URL='' + +ac_unique_file="src/tasks.c" +# Factoring default headers for most tests. +ac_includes_default="\ +#include +#ifdef HAVE_SYS_TYPES_H +# include +#endif +#ifdef HAVE_SYS_STAT_H +# include +#endif +#ifdef STDC_HEADERS +# include +# include +#else +# ifdef HAVE_STDLIB_H +# include +# endif +#endif +#ifdef HAVE_STRING_H +# if !defined STDC_HEADERS && defined HAVE_MEMORY_H +# include +# endif +# include +#endif +#ifdef HAVE_STRINGS_H +# include +#endif +#ifdef HAVE_INTTYPES_H +# include +#endif +#ifdef HAVE_STDINT_H +# include +#endif +#ifdef HAVE_UNISTD_H +# include +#endif" + +ac_subst_vars='LTLIBOBJS +POW_LIB +LIBOBJS +EGREP +GREP +CPP +am__fastdepCC_FALSE +am__fastdepCC_TRUE +CCDEPMODE +AMDEPBACKSLASH +AMDEP_FALSE +AMDEP_TRUE +am__quote +am__include +DEPDIR +OBJEXT +EXEEXT +ac_ct_CC +CPPFLAGS +LDFLAGS +CFLAGS +CC +am__untar +am__tar +AMTAR +am__leading_dot +SET_MAKE +AWK +mkdir_p +INSTALL_STRIP_PROGRAM +STRIP +install_sh +MAKEINFO +AUTOHEADER +AUTOMAKE +AUTOCONF +ACLOCAL +VERSION +PACKAGE +CYGPATH_W +INSTALL_DATA +INSTALL_SCRIPT +INSTALL_PROGRAM +target_alias +host_alias +build_alias +LIBS +ECHO_T +ECHO_N +ECHO_C +DEFS +mandir +localedir +libdir +psdir +pdfdir +dvidir +htmldir +infodir +docdir +oldincludedir +includedir +localstatedir +sharedstatedir +sysconfdir +datadir +datarootdir +libexecdir +sbindir +bindir +program_transform_name +prefix +exec_prefix +PACKAGE_URL +PACKAGE_BUGREPORT +PACKAGE_STRING +PACKAGE_VERSION +PACKAGE_TARNAME +PACKAGE_NAME +PATH_SEPARATOR +SHELL' +ac_subst_files='' +ac_user_opts=' +enable_option_checking +enable_dependency_tracking +' + ac_precious_vars='build_alias +host_alias +target_alias +CC +CFLAGS +LDFLAGS +LIBS +CPPFLAGS +CPP' + + +# Initialize some variables set by options. +ac_init_help= +ac_init_version=false +ac_unrecognized_opts= +ac_unrecognized_sep= +# The variables have the same names as the options, with +# dashes changed to underlines. +cache_file=/dev/null +exec_prefix=NONE +no_create= +no_recursion= +prefix=NONE +program_prefix=NONE +program_suffix=NONE +program_transform_name=s,x,x, +silent= +site= +srcdir= +verbose= +x_includes=NONE +x_libraries=NONE + +# Installation directory options. +# These are left unexpanded so users can "make install exec_prefix=/foo" +# and all the variables that are supposed to be based on exec_prefix +# by default will actually change. +# Use braces instead of parens because sh, perl, etc. also accept them. +# (The list follows the same order as the GNU Coding Standards.) +bindir='${exec_prefix}/bin' +sbindir='${exec_prefix}/sbin' +libexecdir='${exec_prefix}/libexec' +datarootdir='${prefix}/share' +datadir='${datarootdir}' +sysconfdir='${prefix}/etc' +sharedstatedir='${prefix}/com' +localstatedir='${prefix}/var' +includedir='${prefix}/include' +oldincludedir='/usr/include' +docdir='${datarootdir}/doc/${PACKAGE_TARNAME}' +infodir='${datarootdir}/info' +htmldir='${docdir}' +dvidir='${docdir}' +pdfdir='${docdir}' +psdir='${docdir}' +libdir='${exec_prefix}/lib' +localedir='${datarootdir}/locale' +mandir='${datarootdir}/man' + +ac_prev= +ac_dashdash= +for ac_option +do + # If the previous option needs an argument, assign it. + if test -n "$ac_prev"; then + eval $ac_prev=\$ac_option + ac_prev= + continue + fi + + case $ac_option in + *=?*) ac_optarg=`expr "X$ac_option" : '[^=]*=\(.*\)'` ;; + *=) ac_optarg= ;; + *) ac_optarg=yes ;; + esac + + # Accept the important Cygnus configure options, so we can diagnose typos. + + case $ac_dashdash$ac_option in + --) + ac_dashdash=yes ;; + + -bindir | --bindir | --bindi | --bind | --bin | --bi) + ac_prev=bindir ;; + -bindir=* | --bindir=* | --bindi=* | --bind=* | --bin=* | --bi=*) + bindir=$ac_optarg ;; + + -build | --build | --buil | --bui | --bu) + ac_prev=build_alias ;; + -build=* | --build=* | --buil=* | --bui=* | --bu=*) + build_alias=$ac_optarg ;; + + -cache-file | --cache-file | --cache-fil | --cache-fi \ + | --cache-f | --cache- | --cache | --cach | --cac | --ca | --c) + ac_prev=cache_file ;; + -cache-file=* | --cache-file=* | --cache-fil=* | --cache-fi=* \ + | --cache-f=* | --cache-=* | --cache=* | --cach=* | --cac=* | --ca=* | --c=*) + cache_file=$ac_optarg ;; + + --config-cache | -C) + cache_file=config.cache ;; + + -datadir | --datadir | --datadi | --datad) + ac_prev=datadir ;; + -datadir=* | --datadir=* | --datadi=* | --datad=*) + datadir=$ac_optarg ;; + + -datarootdir | --datarootdir | --datarootdi | --datarootd | --dataroot \ + | --dataroo | --dataro | --datar) + ac_prev=datarootdir ;; + -datarootdir=* | --datarootdir=* | --datarootdi=* | --datarootd=* \ + | --dataroot=* | --dataroo=* | --dataro=* | --datar=*) + datarootdir=$ac_optarg ;; + + -disable-* | --disable-*) + ac_useropt=`expr "x$ac_option" : 'x-*disable-\(.*\)'` + # Reject names that are not valid shell variable names. + expr "x$ac_useropt" : ".*[^-+._$as_cr_alnum]" >/dev/null && + as_fn_error $? "invalid feature name: $ac_useropt" + ac_useropt_orig=$ac_useropt + ac_useropt=`$as_echo "$ac_useropt" | sed 's/[-+.]/_/g'` + case $ac_user_opts in + *" +"enable_$ac_useropt" +"*) ;; + *) ac_unrecognized_opts="$ac_unrecognized_opts$ac_unrecognized_sep--disable-$ac_useropt_orig" + ac_unrecognized_sep=', ';; + esac + eval enable_$ac_useropt=no ;; + + -docdir | --docdir | --docdi | --doc | --do) + ac_prev=docdir ;; + -docdir=* | --docdir=* | --docdi=* | --doc=* | --do=*) + docdir=$ac_optarg ;; + + -dvidir | --dvidir | --dvidi | --dvid | --dvi | --dv) + ac_prev=dvidir ;; + -dvidir=* | --dvidir=* | --dvidi=* | --dvid=* | --dvi=* | --dv=*) + dvidir=$ac_optarg ;; + + -enable-* | --enable-*) + ac_useropt=`expr "x$ac_option" : 'x-*enable-\([^=]*\)'` + # Reject names that are not valid shell variable names. + expr "x$ac_useropt" : ".*[^-+._$as_cr_alnum]" >/dev/null && + as_fn_error $? "invalid feature name: $ac_useropt" + ac_useropt_orig=$ac_useropt + ac_useropt=`$as_echo "$ac_useropt" | sed 's/[-+.]/_/g'` + case $ac_user_opts in + *" +"enable_$ac_useropt" +"*) ;; + *) ac_unrecognized_opts="$ac_unrecognized_opts$ac_unrecognized_sep--enable-$ac_useropt_orig" + ac_unrecognized_sep=', ';; + esac + eval enable_$ac_useropt=\$ac_optarg ;; + + -exec-prefix | --exec_prefix | --exec-prefix | --exec-prefi \ + | --exec-pref | --exec-pre | --exec-pr | --exec-p | --exec- \ + | --exec | --exe | --ex) + ac_prev=exec_prefix ;; + -exec-prefix=* | --exec_prefix=* | --exec-prefix=* | --exec-prefi=* \ + | --exec-pref=* | --exec-pre=* | --exec-pr=* | --exec-p=* | --exec-=* \ + | --exec=* | --exe=* | --ex=*) + exec_prefix=$ac_optarg ;; + + -gas | --gas | --ga | --g) + # Obsolete; use --with-gas. + with_gas=yes ;; + + -help | --help | --hel | --he | -h) + ac_init_help=long ;; + -help=r* | --help=r* | --hel=r* | --he=r* | -hr*) + ac_init_help=recursive ;; + -help=s* | --help=s* | --hel=s* | --he=s* | -hs*) + ac_init_help=short ;; + + -host | --host | --hos | --ho) + ac_prev=host_alias ;; + -host=* | --host=* | --hos=* | --ho=*) + host_alias=$ac_optarg ;; + + -htmldir | --htmldir | --htmldi | --htmld | --html | --htm | --ht) + ac_prev=htmldir ;; + -htmldir=* | --htmldir=* | --htmldi=* | --htmld=* | --html=* | --htm=* \ + | --ht=*) + htmldir=$ac_optarg ;; + + -includedir | --includedir | --includedi | --included | --include \ + | --includ | --inclu | --incl | --inc) + ac_prev=includedir ;; + -includedir=* | --includedir=* | --includedi=* | --included=* | --include=* \ + | --includ=* | --inclu=* | --incl=* | --inc=*) + includedir=$ac_optarg ;; + + -infodir | --infodir | --infodi | --infod | --info | --inf) + ac_prev=infodir ;; + -infodir=* | --infodir=* | --infodi=* | --infod=* | --info=* | --inf=*) + infodir=$ac_optarg ;; + + -libdir | --libdir | --libdi | --libd) + ac_prev=libdir ;; + -libdir=* | --libdir=* | --libdi=* | --libd=*) + libdir=$ac_optarg ;; + + -libexecdir | --libexecdir | --libexecdi | --libexecd | --libexec \ + | --libexe | --libex | --libe) + ac_prev=libexecdir ;; + -libexecdir=* | --libexecdir=* | --libexecdi=* | --libexecd=* | --libexec=* \ + | --libexe=* | --libex=* | --libe=*) + libexecdir=$ac_optarg ;; + + -localedir | --localedir | --localedi | --localed | --locale) + ac_prev=localedir ;; + -localedir=* | --localedir=* | --localedi=* | --localed=* | --locale=*) + localedir=$ac_optarg ;; + + -localstatedir | --localstatedir | --localstatedi | --localstated \ + | --localstate | --localstat | --localsta | --localst | --locals) + ac_prev=localstatedir ;; + -localstatedir=* | --localstatedir=* | --localstatedi=* | --localstated=* \ + | --localstate=* | --localstat=* | --localsta=* | --localst=* | --locals=*) + localstatedir=$ac_optarg ;; + + -mandir | --mandir | --mandi | --mand | --man | --ma | --m) + ac_prev=mandir ;; + -mandir=* | --mandir=* | --mandi=* | --mand=* | --man=* | --ma=* | --m=*) + mandir=$ac_optarg ;; + + -nfp | --nfp | --nf) + # Obsolete; use --without-fp. + with_fp=no ;; + + -no-create | --no-create | --no-creat | --no-crea | --no-cre \ + | --no-cr | --no-c | -n) + no_create=yes ;; + + -no-recursion | --no-recursion | --no-recursio | --no-recursi \ + | --no-recurs | --no-recur | --no-recu | --no-rec | --no-re | --no-r) + no_recursion=yes ;; + + -oldincludedir | --oldincludedir | --oldincludedi | --oldincluded \ + | --oldinclude | --oldinclud | --oldinclu | --oldincl | --oldinc \ + | --oldin | --oldi | --old | --ol | --o) + ac_prev=oldincludedir ;; + -oldincludedir=* | --oldincludedir=* | --oldincludedi=* | --oldincluded=* \ + | --oldinclude=* | --oldinclud=* | --oldinclu=* | --oldincl=* | --oldinc=* \ + | --oldin=* | --oldi=* | --old=* | --ol=* | --o=*) + oldincludedir=$ac_optarg ;; + + -prefix | --prefix | --prefi | --pref | --pre | --pr | --p) + ac_prev=prefix ;; + -prefix=* | --prefix=* | --prefi=* | --pref=* | --pre=* | --pr=* | --p=*) + prefix=$ac_optarg ;; + + -program-prefix | --program-prefix | --program-prefi | --program-pref \ + | --program-pre | --program-pr | --program-p) + ac_prev=program_prefix ;; + -program-prefix=* | --program-prefix=* | --program-prefi=* \ + | --program-pref=* | --program-pre=* | --program-pr=* | --program-p=*) + program_prefix=$ac_optarg ;; + + -program-suffix | --program-suffix | --program-suffi | --program-suff \ + | --program-suf | --program-su | --program-s) + ac_prev=program_suffix ;; + -program-suffix=* | --program-suffix=* | --program-suffi=* \ + | --program-suff=* | --program-suf=* | --program-su=* | --program-s=*) + program_suffix=$ac_optarg ;; + + -program-transform-name | --program-transform-name \ + | --program-transform-nam | --program-transform-na \ + | --program-transform-n | --program-transform- \ + | --program-transform | --program-transfor \ + | --program-transfo | --program-transf \ + | --program-trans | --program-tran \ + | --progr-tra | --program-tr | --program-t) + ac_prev=program_transform_name ;; + -program-transform-name=* | --program-transform-name=* \ + | --program-transform-nam=* | --program-transform-na=* \ + | --program-transform-n=* | --program-transform-=* \ + | --program-transform=* | --program-transfor=* \ + | --program-transfo=* | --program-transf=* \ + | --program-trans=* | --program-tran=* \ + | --progr-tra=* | --program-tr=* | --program-t=*) + program_transform_name=$ac_optarg ;; + + -pdfdir | --pdfdir | --pdfdi | --pdfd | --pdf | --pd) + ac_prev=pdfdir ;; + -pdfdir=* | --pdfdir=* | --pdfdi=* | --pdfd=* | --pdf=* | --pd=*) + pdfdir=$ac_optarg ;; + + -psdir | --psdir | --psdi | --psd | --ps) + ac_prev=psdir ;; + -psdir=* | --psdir=* | --psdi=* | --psd=* | --ps=*) + psdir=$ac_optarg ;; + + -q | -quiet | --quiet | --quie | --qui | --qu | --q \ + | -silent | --silent | --silen | --sile | --sil) + silent=yes ;; + + -sbindir | --sbindir | --sbindi | --sbind | --sbin | --sbi | --sb) + ac_prev=sbindir ;; + -sbindir=* | --sbindir=* | --sbindi=* | --sbind=* | --sbin=* \ + | --sbi=* | --sb=*) + sbindir=$ac_optarg ;; + + -sharedstatedir | --sharedstatedir | --sharedstatedi \ + | --sharedstated | --sharedstate | --sharedstat | --sharedsta \ + | --sharedst | --shareds | --shared | --share | --shar \ + | --sha | --sh) + ac_prev=sharedstatedir ;; + -sharedstatedir=* | --sharedstatedir=* | --sharedstatedi=* \ + | --sharedstated=* | --sharedstate=* | --sharedstat=* | --sharedsta=* \ + | --sharedst=* | --shareds=* | --shared=* | --share=* | --shar=* \ + | --sha=* | --sh=*) + sharedstatedir=$ac_optarg ;; + + -site | --site | --sit) + ac_prev=site ;; + -site=* | --site=* | --sit=*) + site=$ac_optarg ;; + + -srcdir | --srcdir | --srcdi | --srcd | --src | --sr) + ac_prev=srcdir ;; + -srcdir=* | --srcdir=* | --srcdi=* | --srcd=* | --src=* | --sr=*) + srcdir=$ac_optarg ;; + + -sysconfdir | --sysconfdir | --sysconfdi | --sysconfd | --sysconf \ + | --syscon | --sysco | --sysc | --sys | --sy) + ac_prev=sysconfdir ;; + -sysconfdir=* | --sysconfdir=* | --sysconfdi=* | --sysconfd=* | --sysconf=* \ + | --syscon=* | --sysco=* | --sysc=* | --sys=* | --sy=*) + sysconfdir=$ac_optarg ;; + + -target | --target | --targe | --targ | --tar | --ta | --t) + ac_prev=target_alias ;; + -target=* | --target=* | --targe=* | --targ=* | --tar=* | --ta=* | --t=*) + target_alias=$ac_optarg ;; + + -v | -verbose | --verbose | --verbos | --verbo | --verb) + verbose=yes ;; + + -version | --version | --versio | --versi | --vers | -V) + ac_init_version=: ;; + + -with-* | --with-*) + ac_useropt=`expr "x$ac_option" : 'x-*with-\([^=]*\)'` + # Reject names that are not valid shell variable names. + expr "x$ac_useropt" : ".*[^-+._$as_cr_alnum]" >/dev/null && + as_fn_error $? "invalid package name: $ac_useropt" + ac_useropt_orig=$ac_useropt + ac_useropt=`$as_echo "$ac_useropt" | sed 's/[-+.]/_/g'` + case $ac_user_opts in + *" +"with_$ac_useropt" +"*) ;; + *) ac_unrecognized_opts="$ac_unrecognized_opts$ac_unrecognized_sep--with-$ac_useropt_orig" + ac_unrecognized_sep=', ';; + esac + eval with_$ac_useropt=\$ac_optarg ;; + + -without-* | --without-*) + ac_useropt=`expr "x$ac_option" : 'x-*without-\(.*\)'` + # Reject names that are not valid shell variable names. + expr "x$ac_useropt" : ".*[^-+._$as_cr_alnum]" >/dev/null && + as_fn_error $? "invalid package name: $ac_useropt" + ac_useropt_orig=$ac_useropt + ac_useropt=`$as_echo "$ac_useropt" | sed 's/[-+.]/_/g'` + case $ac_user_opts in + *" +"with_$ac_useropt" +"*) ;; + *) ac_unrecognized_opts="$ac_unrecognized_opts$ac_unrecognized_sep--without-$ac_useropt_orig" + ac_unrecognized_sep=', ';; + esac + eval with_$ac_useropt=no ;; + + --x) + # Obsolete; use --with-x. + with_x=yes ;; + + -x-includes | --x-includes | --x-include | --x-includ | --x-inclu \ + | --x-incl | --x-inc | --x-in | --x-i) + ac_prev=x_includes ;; + -x-includes=* | --x-includes=* | --x-include=* | --x-includ=* | --x-inclu=* \ + | --x-incl=* | --x-inc=* | --x-in=* | --x-i=*) + x_includes=$ac_optarg ;; + + -x-libraries | --x-libraries | --x-librarie | --x-librari \ + | --x-librar | --x-libra | --x-libr | --x-lib | --x-li | --x-l) + ac_prev=x_libraries ;; + -x-libraries=* | --x-libraries=* | --x-librarie=* | --x-librari=* \ + | --x-librar=* | --x-libra=* | --x-libr=* | --x-lib=* | --x-li=* | --x-l=*) + x_libraries=$ac_optarg ;; + + -*) as_fn_error $? "unrecognized option: \`$ac_option' +Try \`$0 --help' for more information" + ;; + + *=*) + ac_envvar=`expr "x$ac_option" : 'x\([^=]*\)='` + # Reject names that are not valid shell variable names. + case $ac_envvar in #( + '' | [0-9]* | *[!_$as_cr_alnum]* ) + as_fn_error $? "invalid variable name: \`$ac_envvar'" ;; + esac + eval $ac_envvar=\$ac_optarg + export $ac_envvar ;; + + *) + # FIXME: should be removed in autoconf 3.0. + $as_echo "$as_me: WARNING: you should use --build, --host, --target" >&2 + expr "x$ac_option" : ".*[^-._$as_cr_alnum]" >/dev/null && + $as_echo "$as_me: WARNING: invalid host type: $ac_option" >&2 + : ${build_alias=$ac_option} ${host_alias=$ac_option} ${target_alias=$ac_option} + ;; + + esac +done + +if test -n "$ac_prev"; then + ac_option=--`echo $ac_prev | sed 's/_/-/g'` + as_fn_error $? "missing argument to $ac_option" +fi + +if test -n "$ac_unrecognized_opts"; then + case $enable_option_checking in + no) ;; + fatal) as_fn_error $? "unrecognized options: $ac_unrecognized_opts" ;; + *) $as_echo "$as_me: WARNING: unrecognized options: $ac_unrecognized_opts" >&2 ;; + esac +fi + +# Check all directory arguments for consistency. +for ac_var in exec_prefix prefix bindir sbindir libexecdir datarootdir \ + datadir sysconfdir sharedstatedir localstatedir includedir \ + oldincludedir docdir infodir htmldir dvidir pdfdir psdir \ + libdir localedir mandir +do + eval ac_val=\$$ac_var + # Remove trailing slashes. + case $ac_val in + */ ) + ac_val=`expr "X$ac_val" : 'X\(.*[^/]\)' \| "X$ac_val" : 'X\(.*\)'` + eval $ac_var=\$ac_val;; + esac + # Be sure to have absolute directory names. + case $ac_val in + [\\/$]* | ?:[\\/]* ) continue;; + NONE | '' ) case $ac_var in *prefix ) continue;; esac;; + esac + as_fn_error $? "expected an absolute directory name for --$ac_var: $ac_val" +done + +# There might be people who depend on the old broken behavior: `$host' +# used to hold the argument of --host etc. +# FIXME: To remove some day. +build=$build_alias +host=$host_alias +target=$target_alias + +# FIXME: To remove some day. +if test "x$host_alias" != x; then + if test "x$build_alias" = x; then + cross_compiling=maybe + $as_echo "$as_me: WARNING: if you wanted to set the --build type, don't use --host. + If a cross compiler is detected then cross compile mode will be used" >&2 + elif test "x$build_alias" != "x$host_alias"; then + cross_compiling=yes + fi +fi + +ac_tool_prefix= +test -n "$host_alias" && ac_tool_prefix=$host_alias- + +test "$silent" = yes && exec 6>/dev/null + + +ac_pwd=`pwd` && test -n "$ac_pwd" && +ac_ls_di=`ls -di .` && +ac_pwd_ls_di=`cd "$ac_pwd" && ls -di .` || + as_fn_error $? "working directory cannot be determined" +test "X$ac_ls_di" = "X$ac_pwd_ls_di" || + as_fn_error $? "pwd does not report name of working directory" + + +# Find the source files, if location was not specified. +if test -z "$srcdir"; then + ac_srcdir_defaulted=yes + # Try the directory containing this script, then the parent directory. + ac_confdir=`$as_dirname -- "$as_myself" || +$as_expr X"$as_myself" : 'X\(.*[^/]\)//*[^/][^/]*/*$' \| \ + X"$as_myself" : 'X\(//\)[^/]' \| \ + X"$as_myself" : 'X\(//\)$' \| \ + X"$as_myself" : 'X\(/\)' \| . 2>/dev/null || +$as_echo X"$as_myself" | + sed '/^X\(.*[^/]\)\/\/*[^/][^/]*\/*$/{ + s//\1/ + q + } + /^X\(\/\/\)[^/].*/{ + s//\1/ + q + } + /^X\(\/\/\)$/{ + s//\1/ + q + } + /^X\(\/\).*/{ + s//\1/ + q + } + s/.*/./; q'` + srcdir=$ac_confdir + if test ! -r "$srcdir/$ac_unique_file"; then + srcdir=.. + fi +else + ac_srcdir_defaulted=no +fi +if test ! -r "$srcdir/$ac_unique_file"; then + test "$ac_srcdir_defaulted" = yes && srcdir="$ac_confdir or .." + as_fn_error $? "cannot find sources ($ac_unique_file) in $srcdir" +fi +ac_msg="sources are in $srcdir, but \`cd $srcdir' does not work" +ac_abs_confdir=`( + cd "$srcdir" && test -r "./$ac_unique_file" || as_fn_error $? "$ac_msg" + pwd)` +# When building in place, set srcdir=. +if test "$ac_abs_confdir" = "$ac_pwd"; then + srcdir=. +fi +# Remove unnecessary trailing slashes from srcdir. +# Double slashes in file names in object file debugging info +# mess up M-x gdb in Emacs. +case $srcdir in +*/) srcdir=`expr "X$srcdir" : 'X\(.*[^/]\)' \| "X$srcdir" : 'X\(.*\)'`;; +esac +for ac_var in $ac_precious_vars; do + eval ac_env_${ac_var}_set=\${${ac_var}+set} + eval ac_env_${ac_var}_value=\$${ac_var} + eval ac_cv_env_${ac_var}_set=\${${ac_var}+set} + eval ac_cv_env_${ac_var}_value=\$${ac_var} +done + +# +# Report the --help message. +# +if test "$ac_init_help" = "long"; then + # Omit some internal or obsolete options to make the list less imposing. + # This message is too long to be a string in the A/UX 3.1 sh. + cat <<_ACEOF +\`configure' configures nife 0.44 to adapt to many kinds of systems. + +Usage: $0 [OPTION]... [VAR=VALUE]... + +To assign environment variables (e.g., CC, CFLAGS...), specify them as +VAR=VALUE. See below for descriptions of some of the useful variables. + +Defaults for the options are specified in brackets. + +Configuration: + -h, --help display this help and exit + --help=short display options specific to this package + --help=recursive display the short help of all the included packages + -V, --version display version information and exit + -q, --quiet, --silent do not print \`checking ...' messages + --cache-file=FILE cache test results in FILE [disabled] + -C, --config-cache alias for \`--cache-file=config.cache' + -n, --no-create do not create output files + --srcdir=DIR find the sources in DIR [configure dir or \`..'] + +Installation directories: + --prefix=PREFIX install architecture-independent files in PREFIX + [$ac_default_prefix] + --exec-prefix=EPREFIX install architecture-dependent files in EPREFIX + [PREFIX] + +By default, \`make install' will install all the files in +\`$ac_default_prefix/bin', \`$ac_default_prefix/lib' etc. You can specify +an installation prefix other than \`$ac_default_prefix' using \`--prefix', +for instance \`--prefix=\$HOME'. + +For better control, use the options below. + +Fine tuning of the installation directories: + --bindir=DIR user executables [EPREFIX/bin] + --sbindir=DIR system admin executables [EPREFIX/sbin] + --libexecdir=DIR program executables [EPREFIX/libexec] + --sysconfdir=DIR read-only single-machine data [PREFIX/etc] + --sharedstatedir=DIR modifiable architecture-independent data [PREFIX/com] + --localstatedir=DIR modifiable single-machine data [PREFIX/var] + --libdir=DIR object code libraries [EPREFIX/lib] + --includedir=DIR C header files [PREFIX/include] + --oldincludedir=DIR C header files for non-gcc [/usr/include] + --datarootdir=DIR read-only arch.-independent data root [PREFIX/share] + --datadir=DIR read-only architecture-independent data [DATAROOTDIR] + --infodir=DIR info documentation [DATAROOTDIR/info] + --localedir=DIR locale-dependent data [DATAROOTDIR/locale] + --mandir=DIR man documentation [DATAROOTDIR/man] + --docdir=DIR documentation root [DATAROOTDIR/doc/nife] + --htmldir=DIR html documentation [DOCDIR] + --dvidir=DIR dvi documentation [DOCDIR] + --pdfdir=DIR pdf documentation [DOCDIR] + --psdir=DIR ps documentation [DOCDIR] +_ACEOF + + cat <<\_ACEOF + +Program names: + --program-prefix=PREFIX prepend PREFIX to installed program names + --program-suffix=SUFFIX append SUFFIX to installed program names + --program-transform-name=PROGRAM run sed PROGRAM on installed program names +_ACEOF +fi + +if test -n "$ac_init_help"; then + case $ac_init_help in + short | recursive ) echo "Configuration of nife 0.44:";; + esac + cat <<\_ACEOF + +Optional Features: + --disable-option-checking ignore unrecognized --enable/--with options + --disable-FEATURE do not include FEATURE (same as --enable-FEATURE=no) + --enable-FEATURE[=ARG] include FEATURE [ARG=yes] + --disable-dependency-tracking speeds up one-time build + --enable-dependency-tracking do not reject slow dependency extractors + +Some influential environment variables: + CC C compiler command + CFLAGS C compiler flags + LDFLAGS linker flags, e.g. -L if you have libraries in a + nonstandard directory + LIBS libraries to pass to the linker, e.g. -l + CPPFLAGS (Objective) C/C++ preprocessor flags, e.g. -I if + you have headers in a nonstandard directory + CPP C preprocessor + +Use these variables to override the choices made by `configure' or to help +it to find libraries and programs with nonstandard names/locations. + +Report bugs to . +_ACEOF +ac_status=$? +fi + +if test "$ac_init_help" = "recursive"; then + # If there are subdirs, report their specific --help. + for ac_dir in : $ac_subdirs_all; do test "x$ac_dir" = x: && continue + test -d "$ac_dir" || + { cd "$srcdir" && ac_pwd=`pwd` && srcdir=. && test -d "$ac_dir"; } || + continue + ac_builddir=. + +case "$ac_dir" in +.) ac_dir_suffix= ac_top_builddir_sub=. ac_top_build_prefix= ;; +*) + ac_dir_suffix=/`$as_echo "$ac_dir" | sed 's|^\.[\\/]||'` + # A ".." for each directory in $ac_dir_suffix. + ac_top_builddir_sub=`$as_echo "$ac_dir_suffix" | sed 's|/[^\\/]*|/..|g;s|/||'` + case $ac_top_builddir_sub in + "") ac_top_builddir_sub=. ac_top_build_prefix= ;; + *) ac_top_build_prefix=$ac_top_builddir_sub/ ;; + esac ;; +esac +ac_abs_top_builddir=$ac_pwd +ac_abs_builddir=$ac_pwd$ac_dir_suffix +# for backward compatibility: +ac_top_builddir=$ac_top_build_prefix + +case $srcdir in + .) # We are building in place. + ac_srcdir=. + ac_top_srcdir=$ac_top_builddir_sub + ac_abs_top_srcdir=$ac_pwd ;; + [\\/]* | ?:[\\/]* ) # Absolute name. + ac_srcdir=$srcdir$ac_dir_suffix; + ac_top_srcdir=$srcdir + ac_abs_top_srcdir=$srcdir ;; + *) # Relative name. + ac_srcdir=$ac_top_build_prefix$srcdir$ac_dir_suffix + ac_top_srcdir=$ac_top_build_prefix$srcdir + ac_abs_top_srcdir=$ac_pwd/$srcdir ;; +esac +ac_abs_srcdir=$ac_abs_top_srcdir$ac_dir_suffix + + cd "$ac_dir" || { ac_status=$?; continue; } + # Check for guested configure. + if test -f "$ac_srcdir/configure.gnu"; then + echo && + $SHELL "$ac_srcdir/configure.gnu" --help=recursive + elif test -f "$ac_srcdir/configure"; then + echo && + $SHELL "$ac_srcdir/configure" --help=recursive + else + $as_echo "$as_me: WARNING: no configuration information is in $ac_dir" >&2 + fi || ac_status=$? + cd "$ac_pwd" || { ac_status=$?; break; } + done +fi + +test -n "$ac_init_help" && exit $ac_status +if $ac_init_version; then + cat <<\_ACEOF +nife configure 0.44 +generated by GNU Autoconf 2.67 + +Copyright (C) 2010 Free Software Foundation, Inc. +This configure script is free software; the Free Software Foundation +gives unlimited permission to copy, distribute and modify it. +_ACEOF + exit +fi + +## ------------------------ ## +## Autoconf initialization. ## +## ------------------------ ## + +# ac_fn_c_try_compile LINENO +# -------------------------- +# Try to compile conftest.$ac_ext, and return whether this succeeded. +ac_fn_c_try_compile () +{ + as_lineno=${as_lineno-"$1"} as_lineno_stack=as_lineno_stack=$as_lineno_stack + rm -f conftest.$ac_objext + if { { ac_try="$ac_compile" +case "(($ac_try" in + *\"* | *\`* | *\\*) ac_try_echo=\$ac_try;; + *) ac_try_echo=$ac_try;; +esac +eval ac_try_echo="\"\$as_me:${as_lineno-$LINENO}: $ac_try_echo\"" +$as_echo "$ac_try_echo"; } >&5 + (eval "$ac_compile") 2>conftest.err + ac_status=$? + if test -s conftest.err; then + grep -v '^ *+' conftest.err >conftest.er1 + cat conftest.er1 >&5 + mv -f conftest.er1 conftest.err + fi + $as_echo "$as_me:${as_lineno-$LINENO}: \$? = $ac_status" >&5 + test $ac_status = 0; } && { + test -z "$ac_c_werror_flag" || + test ! -s conftest.err + } && test -s conftest.$ac_objext; then : + ac_retval=0 +else + $as_echo "$as_me: failed program was:" >&5 +sed 's/^/| /' conftest.$ac_ext >&5 + + ac_retval=1 +fi + eval $as_lineno_stack; test "x$as_lineno_stack" = x && { as_lineno=; unset as_lineno;} + as_fn_set_status $ac_retval + +} # ac_fn_c_try_compile + +# ac_fn_c_try_cpp LINENO +# ---------------------- +# Try to preprocess conftest.$ac_ext, and return whether this succeeded. +ac_fn_c_try_cpp () +{ + as_lineno=${as_lineno-"$1"} as_lineno_stack=as_lineno_stack=$as_lineno_stack + if { { ac_try="$ac_cpp conftest.$ac_ext" +case "(($ac_try" in + *\"* | *\`* | *\\*) ac_try_echo=\$ac_try;; + *) ac_try_echo=$ac_try;; +esac +eval ac_try_echo="\"\$as_me:${as_lineno-$LINENO}: $ac_try_echo\"" +$as_echo "$ac_try_echo"; } >&5 + (eval "$ac_cpp conftest.$ac_ext") 2>conftest.err + ac_status=$? + if test -s conftest.err; then + grep -v '^ *+' conftest.err >conftest.er1 + cat conftest.er1 >&5 + mv -f conftest.er1 conftest.err + fi + $as_echo "$as_me:${as_lineno-$LINENO}: \$? = $ac_status" >&5 + test $ac_status = 0; } > conftest.i && { + test -z "$ac_c_preproc_warn_flag$ac_c_werror_flag" || + test ! -s conftest.err + }; then : + ac_retval=0 +else + $as_echo "$as_me: failed program was:" >&5 +sed 's/^/| /' conftest.$ac_ext >&5 + + ac_retval=1 +fi + eval $as_lineno_stack; test "x$as_lineno_stack" = x && { as_lineno=; unset as_lineno;} + as_fn_set_status $ac_retval + +} # ac_fn_c_try_cpp + +# ac_fn_c_check_header_mongrel LINENO HEADER VAR INCLUDES +# ------------------------------------------------------- +# Tests whether HEADER exists, giving a warning if it cannot be compiled using +# the include files in INCLUDES and setting the cache variable VAR +# accordingly. +ac_fn_c_check_header_mongrel () +{ + as_lineno=${as_lineno-"$1"} as_lineno_stack=as_lineno_stack=$as_lineno_stack + if eval "test \"\${$3+set}\"" = set; then : + { $as_echo "$as_me:${as_lineno-$LINENO}: checking for $2" >&5 +$as_echo_n "checking for $2... " >&6; } +if eval "test \"\${$3+set}\"" = set; then : + $as_echo_n "(cached) " >&6 +fi +eval ac_res=\$$3 + { $as_echo "$as_me:${as_lineno-$LINENO}: result: $ac_res" >&5 +$as_echo "$ac_res" >&6; } +else + # Is the header compilable? +{ $as_echo "$as_me:${as_lineno-$LINENO}: checking $2 usability" >&5 +$as_echo_n "checking $2 usability... " >&6; } +cat confdefs.h - <<_ACEOF >conftest.$ac_ext +/* end confdefs.h. */ +$4 +#include <$2> +_ACEOF +if ac_fn_c_try_compile "$LINENO"; then : + ac_header_compiler=yes +else + ac_header_compiler=no +fi +rm -f core conftest.err conftest.$ac_objext conftest.$ac_ext +{ $as_echo "$as_me:${as_lineno-$LINENO}: result: $ac_header_compiler" >&5 +$as_echo "$ac_header_compiler" >&6; } + +# Is the header present? +{ $as_echo "$as_me:${as_lineno-$LINENO}: checking $2 presence" >&5 +$as_echo_n "checking $2 presence... " >&6; } +cat confdefs.h - <<_ACEOF >conftest.$ac_ext +/* end confdefs.h. */ +#include <$2> +_ACEOF +if ac_fn_c_try_cpp "$LINENO"; then : + ac_header_preproc=yes +else + ac_header_preproc=no +fi +rm -f conftest.err conftest.i conftest.$ac_ext +{ $as_echo "$as_me:${as_lineno-$LINENO}: result: $ac_header_preproc" >&5 +$as_echo "$ac_header_preproc" >&6; } + +# So? What about this header? +case $ac_header_compiler:$ac_header_preproc:$ac_c_preproc_warn_flag in #(( + yes:no: ) + { $as_echo "$as_me:${as_lineno-$LINENO}: WARNING: $2: accepted by the compiler, rejected by the preprocessor!" >&5 +$as_echo "$as_me: WARNING: $2: accepted by the compiler, rejected by the preprocessor!" >&2;} + { $as_echo "$as_me:${as_lineno-$LINENO}: WARNING: $2: proceeding with the compiler's result" >&5 +$as_echo "$as_me: WARNING: $2: proceeding with the compiler's result" >&2;} + ;; + no:yes:* ) + { $as_echo "$as_me:${as_lineno-$LINENO}: WARNING: $2: present but cannot be compiled" >&5 +$as_echo "$as_me: WARNING: $2: present but cannot be compiled" >&2;} + { $as_echo "$as_me:${as_lineno-$LINENO}: WARNING: $2: check for missing prerequisite headers?" >&5 +$as_echo "$as_me: WARNING: $2: check for missing prerequisite headers?" >&2;} + { $as_echo "$as_me:${as_lineno-$LINENO}: WARNING: $2: see the Autoconf documentation" >&5 +$as_echo "$as_me: WARNING: $2: see the Autoconf documentation" >&2;} + { $as_echo "$as_me:${as_lineno-$LINENO}: WARNING: $2: section \"Present But Cannot Be Compiled\"" >&5 +$as_echo "$as_me: WARNING: $2: section \"Present But Cannot Be Compiled\"" >&2;} + { $as_echo "$as_me:${as_lineno-$LINENO}: WARNING: $2: proceeding with the compiler's result" >&5 +$as_echo "$as_me: WARNING: $2: proceeding with the compiler's result" >&2;} +( $as_echo "## ------------------------------ ## +## Report this to nife@seriane.fr ## +## ------------------------------ ##" + ) | sed "s/^/$as_me: WARNING: /" >&2 + ;; +esac + { $as_echo "$as_me:${as_lineno-$LINENO}: checking for $2" >&5 +$as_echo_n "checking for $2... " >&6; } +if eval "test \"\${$3+set}\"" = set; then : + $as_echo_n "(cached) " >&6 +else + eval "$3=\$ac_header_compiler" +fi +eval ac_res=\$$3 + { $as_echo "$as_me:${as_lineno-$LINENO}: result: $ac_res" >&5 +$as_echo "$ac_res" >&6; } +fi + eval $as_lineno_stack; test "x$as_lineno_stack" = x && { as_lineno=; unset as_lineno;} + +} # ac_fn_c_check_header_mongrel + +# ac_fn_c_try_run LINENO +# ---------------------- +# Try to link conftest.$ac_ext, and return whether this succeeded. Assumes +# that executables *can* be run. +ac_fn_c_try_run () +{ + as_lineno=${as_lineno-"$1"} as_lineno_stack=as_lineno_stack=$as_lineno_stack + if { { ac_try="$ac_link" +case "(($ac_try" in + *\"* | *\`* | *\\*) ac_try_echo=\$ac_try;; + *) ac_try_echo=$ac_try;; +esac +eval ac_try_echo="\"\$as_me:${as_lineno-$LINENO}: $ac_try_echo\"" +$as_echo "$ac_try_echo"; } >&5 + (eval "$ac_link") 2>&5 + ac_status=$? + $as_echo "$as_me:${as_lineno-$LINENO}: \$? = $ac_status" >&5 + test $ac_status = 0; } && { ac_try='./conftest$ac_exeext' + { { case "(($ac_try" in + *\"* | *\`* | *\\*) ac_try_echo=\$ac_try;; + *) ac_try_echo=$ac_try;; +esac +eval ac_try_echo="\"\$as_me:${as_lineno-$LINENO}: $ac_try_echo\"" +$as_echo "$ac_try_echo"; } >&5 + (eval "$ac_try") 2>&5 + ac_status=$? + $as_echo "$as_me:${as_lineno-$LINENO}: \$? = $ac_status" >&5 + test $ac_status = 0; }; }; then : + ac_retval=0 +else + $as_echo "$as_me: program exited with status $ac_status" >&5 + $as_echo "$as_me: failed program was:" >&5 +sed 's/^/| /' conftest.$ac_ext >&5 + + ac_retval=$ac_status +fi + rm -rf conftest.dSYM conftest_ipa8_conftest.oo + eval $as_lineno_stack; test "x$as_lineno_stack" = x && { as_lineno=; unset as_lineno;} + as_fn_set_status $ac_retval + +} # ac_fn_c_try_run + +# ac_fn_c_check_header_compile LINENO HEADER VAR INCLUDES +# ------------------------------------------------------- +# Tests whether HEADER exists and can be compiled using the include files in +# INCLUDES, setting the cache variable VAR accordingly. +ac_fn_c_check_header_compile () +{ + as_lineno=${as_lineno-"$1"} as_lineno_stack=as_lineno_stack=$as_lineno_stack + { $as_echo "$as_me:${as_lineno-$LINENO}: checking for $2" >&5 +$as_echo_n "checking for $2... " >&6; } +if eval "test \"\${$3+set}\"" = set; then : + $as_echo_n "(cached) " >&6 +else + cat confdefs.h - <<_ACEOF >conftest.$ac_ext +/* end confdefs.h. */ +$4 +#include <$2> +_ACEOF +if ac_fn_c_try_compile "$LINENO"; then : + eval "$3=yes" +else + eval "$3=no" +fi +rm -f core conftest.err conftest.$ac_objext conftest.$ac_ext +fi +eval ac_res=\$$3 + { $as_echo "$as_me:${as_lineno-$LINENO}: result: $ac_res" >&5 +$as_echo "$ac_res" >&6; } + eval $as_lineno_stack; test "x$as_lineno_stack" = x && { as_lineno=; unset as_lineno;} + +} # ac_fn_c_check_header_compile + +# ac_fn_c_check_type LINENO TYPE VAR INCLUDES +# ------------------------------------------- +# Tests whether TYPE exists after having included INCLUDES, setting cache +# variable VAR accordingly. +ac_fn_c_check_type () +{ + as_lineno=${as_lineno-"$1"} as_lineno_stack=as_lineno_stack=$as_lineno_stack + { $as_echo "$as_me:${as_lineno-$LINENO}: checking for $2" >&5 +$as_echo_n "checking for $2... " >&6; } +if eval "test \"\${$3+set}\"" = set; then : + $as_echo_n "(cached) " >&6 +else + eval "$3=no" + cat confdefs.h - <<_ACEOF >conftest.$ac_ext +/* end confdefs.h. */ +$4 +int +main () +{ +if (sizeof ($2)) + return 0; + ; + return 0; +} +_ACEOF +if ac_fn_c_try_compile "$LINENO"; then : + cat confdefs.h - <<_ACEOF >conftest.$ac_ext +/* end confdefs.h. */ +$4 +int +main () +{ +if (sizeof (($2))) + return 0; + ; + return 0; +} +_ACEOF +if ac_fn_c_try_compile "$LINENO"; then : + +else + eval "$3=yes" +fi +rm -f core conftest.err conftest.$ac_objext conftest.$ac_ext +fi +rm -f core conftest.err conftest.$ac_objext conftest.$ac_ext +fi +eval ac_res=\$$3 + { $as_echo "$as_me:${as_lineno-$LINENO}: result: $ac_res" >&5 +$as_echo "$ac_res" >&6; } + eval $as_lineno_stack; test "x$as_lineno_stack" = x && { as_lineno=; unset as_lineno;} + +} # ac_fn_c_check_type + +# ac_fn_c_try_link LINENO +# ----------------------- +# Try to link conftest.$ac_ext, and return whether this succeeded. +ac_fn_c_try_link () +{ + as_lineno=${as_lineno-"$1"} as_lineno_stack=as_lineno_stack=$as_lineno_stack + rm -f conftest.$ac_objext conftest$ac_exeext + if { { ac_try="$ac_link" +case "(($ac_try" in + *\"* | *\`* | *\\*) ac_try_echo=\$ac_try;; + *) ac_try_echo=$ac_try;; +esac +eval ac_try_echo="\"\$as_me:${as_lineno-$LINENO}: $ac_try_echo\"" +$as_echo "$ac_try_echo"; } >&5 + (eval "$ac_link") 2>conftest.err + ac_status=$? + if test -s conftest.err; then + grep -v '^ *+' conftest.err >conftest.er1 + cat conftest.er1 >&5 + mv -f conftest.er1 conftest.err + fi + $as_echo "$as_me:${as_lineno-$LINENO}: \$? = $ac_status" >&5 + test $ac_status = 0; } && { + test -z "$ac_c_werror_flag" || + test ! -s conftest.err + } && test -s conftest$ac_exeext && { + test "$cross_compiling" = yes || + $as_test_x conftest$ac_exeext + }; then : + ac_retval=0 +else + $as_echo "$as_me: failed program was:" >&5 +sed 's/^/| /' conftest.$ac_ext >&5 + + ac_retval=1 +fi + # Delete the IPA/IPO (Inter Procedural Analysis/Optimization) information + # created by the PGI compiler (conftest_ipa8_conftest.oo), as it would + # interfere with the next link command; also delete a directory that is + # left behind by Apple's compiler. We do this before executing the actions. + rm -rf conftest.dSYM conftest_ipa8_conftest.oo + eval $as_lineno_stack; test "x$as_lineno_stack" = x && { as_lineno=; unset as_lineno;} + as_fn_set_status $ac_retval + +} # ac_fn_c_try_link + +# ac_fn_c_check_func LINENO FUNC VAR +# ---------------------------------- +# Tests whether FUNC exists, setting the cache variable VAR accordingly +ac_fn_c_check_func () +{ + as_lineno=${as_lineno-"$1"} as_lineno_stack=as_lineno_stack=$as_lineno_stack + { $as_echo "$as_me:${as_lineno-$LINENO}: checking for $2" >&5 +$as_echo_n "checking for $2... " >&6; } +if eval "test \"\${$3+set}\"" = set; then : + $as_echo_n "(cached) " >&6 +else + cat confdefs.h - <<_ACEOF >conftest.$ac_ext +/* end confdefs.h. */ +/* Define $2 to an innocuous variant, in case declares $2. + For example, HP-UX 11i declares gettimeofday. */ +#define $2 innocuous_$2 + +/* System header to define __stub macros and hopefully few prototypes, + which can conflict with char $2 (); below. + Prefer to if __STDC__ is defined, since + exists even on freestanding compilers. */ + +#ifdef __STDC__ +# include +#else +# include +#endif + +#undef $2 + +/* Override any GCC internal prototype to avoid an error. + Use char because int might match the return type of a GCC + builtin and then its argument prototype would still apply. */ +#ifdef __cplusplus +extern "C" +#endif +char $2 (); +/* The GNU C library defines this for functions which it implements + to always fail with ENOSYS. Some functions are actually named + something starting with __ and the normal name is an alias. */ +#if defined __stub_$2 || defined __stub___$2 +choke me +#endif + +int +main () +{ +return $2 (); + ; + return 0; +} +_ACEOF +if ac_fn_c_try_link "$LINENO"; then : + eval "$3=yes" +else + eval "$3=no" +fi +rm -f core conftest.err conftest.$ac_objext \ + conftest$ac_exeext conftest.$ac_ext +fi +eval ac_res=\$$3 + { $as_echo "$as_me:${as_lineno-$LINENO}: result: $ac_res" >&5 +$as_echo "$ac_res" >&6; } + eval $as_lineno_stack; test "x$as_lineno_stack" = x && { as_lineno=; unset as_lineno;} + +} # ac_fn_c_check_func +cat >config.log <<_ACEOF +This file contains any messages produced by compilers while +running configure, to aid debugging if configure makes a mistake. + +It was created by nife $as_me 0.44, which was +generated by GNU Autoconf 2.67. Invocation command line was + + $ $0 $@ + +_ACEOF +exec 5>>config.log +{ +cat <<_ASUNAME +## --------- ## +## Platform. ## +## --------- ## + +hostname = `(hostname || uname -n) 2>/dev/null | sed 1q` +uname -m = `(uname -m) 2>/dev/null || echo unknown` +uname -r = `(uname -r) 2>/dev/null || echo unknown` +uname -s = `(uname -s) 2>/dev/null || echo unknown` +uname -v = `(uname -v) 2>/dev/null || echo unknown` + +/usr/bin/uname -p = `(/usr/bin/uname -p) 2>/dev/null || echo unknown` +/bin/uname -X = `(/bin/uname -X) 2>/dev/null || echo unknown` + +/bin/arch = `(/bin/arch) 2>/dev/null || echo unknown` +/usr/bin/arch -k = `(/usr/bin/arch -k) 2>/dev/null || echo unknown` +/usr/convex/getsysinfo = `(/usr/convex/getsysinfo) 2>/dev/null || echo unknown` +/usr/bin/hostinfo = `(/usr/bin/hostinfo) 2>/dev/null || echo unknown` +/bin/machine = `(/bin/machine) 2>/dev/null || echo unknown` +/usr/bin/oslevel = `(/usr/bin/oslevel) 2>/dev/null || echo unknown` +/bin/universe = `(/bin/universe) 2>/dev/null || echo unknown` + +_ASUNAME + +as_save_IFS=$IFS; IFS=$PATH_SEPARATOR +for as_dir in $PATH +do + IFS=$as_save_IFS + test -z "$as_dir" && as_dir=. + $as_echo "PATH: $as_dir" + done +IFS=$as_save_IFS + +} >&5 + +cat >&5 <<_ACEOF + + +## ----------- ## +## Core tests. ## +## ----------- ## + +_ACEOF + + +# Keep a trace of the command line. +# Strip out --no-create and --no-recursion so they do not pile up. +# Strip out --silent because we don't want to record it for future runs. +# Also quote any args containing shell meta-characters. +# Make two passes to allow for proper duplicate-argument suppression. +ac_configure_args= +ac_configure_args0= +ac_configure_args1= +ac_must_keep_next=false +for ac_pass in 1 2 +do + for ac_arg + do + case $ac_arg in + -no-create | --no-c* | -n | -no-recursion | --no-r*) continue ;; + -q | -quiet | --quiet | --quie | --qui | --qu | --q \ + | -silent | --silent | --silen | --sile | --sil) + continue ;; + *\'*) + ac_arg=`$as_echo "$ac_arg" | sed "s/'/'\\\\\\\\''/g"` ;; + esac + case $ac_pass in + 1) as_fn_append ac_configure_args0 " '$ac_arg'" ;; + 2) + as_fn_append ac_configure_args1 " '$ac_arg'" + if test $ac_must_keep_next = true; then + ac_must_keep_next=false # Got value, back to normal. + else + case $ac_arg in + *=* | --config-cache | -C | -disable-* | --disable-* \ + | -enable-* | --enable-* | -gas | --g* | -nfp | --nf* \ + | -q | -quiet | --q* | -silent | --sil* | -v | -verb* \ + | -with-* | --with-* | -without-* | --without-* | --x) + case "$ac_configure_args0 " in + "$ac_configure_args1"*" '$ac_arg' "* ) continue ;; + esac + ;; + -* ) ac_must_keep_next=true ;; + esac + fi + as_fn_append ac_configure_args " '$ac_arg'" + ;; + esac + done +done +{ ac_configure_args0=; unset ac_configure_args0;} +{ ac_configure_args1=; unset ac_configure_args1;} + +# When interrupted or exit'd, cleanup temporary files, and complete +# config.log. We remove comments because anyway the quotes in there +# would cause problems or look ugly. +# WARNING: Use '\'' to represent an apostrophe within the trap. +# WARNING: Do not start the trap code with a newline, due to a FreeBSD 4.0 bug. +trap 'exit_status=$? + # Save into config.log some information that might help in debugging. + { + echo + + $as_echo "## ---------------- ## +## Cache variables. ## +## ---------------- ##" + echo + # The following way of writing the cache mishandles newlines in values, +( + for ac_var in `(set) 2>&1 | sed -n '\''s/^\([a-zA-Z_][a-zA-Z0-9_]*\)=.*/\1/p'\''`; do + eval ac_val=\$$ac_var + case $ac_val in #( + *${as_nl}*) + case $ac_var in #( + *_cv_*) { $as_echo "$as_me:${as_lineno-$LINENO}: WARNING: cache variable $ac_var contains a newline" >&5 +$as_echo "$as_me: WARNING: cache variable $ac_var contains a newline" >&2;} ;; + esac + case $ac_var in #( + _ | IFS | as_nl) ;; #( + BASH_ARGV | BASH_SOURCE) eval $ac_var= ;; #( + *) { eval $ac_var=; unset $ac_var;} ;; + esac ;; + esac + done + (set) 2>&1 | + case $as_nl`(ac_space='\'' '\''; set) 2>&1` in #( + *${as_nl}ac_space=\ *) + sed -n \ + "s/'\''/'\''\\\\'\'''\''/g; + s/^\\([_$as_cr_alnum]*_cv_[_$as_cr_alnum]*\\)=\\(.*\\)/\\1='\''\\2'\''/p" + ;; #( + *) + sed -n "/^[_$as_cr_alnum]*_cv_[_$as_cr_alnum]*=/p" + ;; + esac | + sort +) + echo + + $as_echo "## ----------------- ## +## Output variables. ## +## ----------------- ##" + echo + for ac_var in $ac_subst_vars + do + eval ac_val=\$$ac_var + case $ac_val in + *\'\''*) ac_val=`$as_echo "$ac_val" | sed "s/'\''/'\''\\\\\\\\'\'''\''/g"`;; + esac + $as_echo "$ac_var='\''$ac_val'\''" + done | sort + echo + + if test -n "$ac_subst_files"; then + $as_echo "## ------------------- ## +## File substitutions. ## +## ------------------- ##" + echo + for ac_var in $ac_subst_files + do + eval ac_val=\$$ac_var + case $ac_val in + *\'\''*) ac_val=`$as_echo "$ac_val" | sed "s/'\''/'\''\\\\\\\\'\'''\''/g"`;; + esac + $as_echo "$ac_var='\''$ac_val'\''" + done | sort + echo + fi + + if test -s confdefs.h; then + $as_echo "## ----------- ## +## confdefs.h. ## +## ----------- ##" + echo + cat confdefs.h + echo + fi + test "$ac_signal" != 0 && + $as_echo "$as_me: caught signal $ac_signal" + $as_echo "$as_me: exit $exit_status" + } >&5 + rm -f core *.core core.conftest.* && + rm -f -r conftest* confdefs* conf$$* $ac_clean_files && + exit $exit_status +' 0 +for ac_signal in 1 2 13 15; do + trap 'ac_signal='$ac_signal'; as_fn_exit 1' $ac_signal +done +ac_signal=0 + +# confdefs.h avoids OS command line length limits that DEFS can exceed. +rm -f -r conftest* confdefs.h + +$as_echo "/* confdefs.h */" > confdefs.h + +# Predefined preprocessor variables. + +cat >>confdefs.h <<_ACEOF +#define PACKAGE_NAME "$PACKAGE_NAME" +_ACEOF + +cat >>confdefs.h <<_ACEOF +#define PACKAGE_TARNAME "$PACKAGE_TARNAME" +_ACEOF + +cat >>confdefs.h <<_ACEOF +#define PACKAGE_VERSION "$PACKAGE_VERSION" +_ACEOF + +cat >>confdefs.h <<_ACEOF +#define PACKAGE_STRING "$PACKAGE_STRING" +_ACEOF + +cat >>confdefs.h <<_ACEOF +#define PACKAGE_BUGREPORT "$PACKAGE_BUGREPORT" +_ACEOF + +cat >>confdefs.h <<_ACEOF +#define PACKAGE_URL "$PACKAGE_URL" +_ACEOF + + +# Let the site file select an alternate cache file if it wants to. +# Prefer an explicitly selected file to automatically selected ones. +ac_site_file1=NONE +ac_site_file2=NONE +if test -n "$CONFIG_SITE"; then + # We do not want a PATH search for config.site. + case $CONFIG_SITE in #(( + -*) ac_site_file1=./$CONFIG_SITE;; + */*) ac_site_file1=$CONFIG_SITE;; + *) ac_site_file1=./$CONFIG_SITE;; + esac +elif test "x$prefix" != xNONE; then + ac_site_file1=$prefix/share/config.site + ac_site_file2=$prefix/etc/config.site +else + ac_site_file1=$ac_default_prefix/share/config.site + ac_site_file2=$ac_default_prefix/etc/config.site +fi +for ac_site_file in "$ac_site_file1" "$ac_site_file2" +do + test "x$ac_site_file" = xNONE && continue + if test /dev/null != "$ac_site_file" && test -r "$ac_site_file"; then + { $as_echo "$as_me:${as_lineno-$LINENO}: loading site script $ac_site_file" >&5 +$as_echo "$as_me: loading site script $ac_site_file" >&6;} + sed 's/^/| /' "$ac_site_file" >&5 + . "$ac_site_file" \ + || { { $as_echo "$as_me:${as_lineno-$LINENO}: error: in \`$ac_pwd':" >&5 +$as_echo "$as_me: error: in \`$ac_pwd':" >&2;} +as_fn_error $? "failed to load site script $ac_site_file +See \`config.log' for more details" "$LINENO" 5 ; } + fi +done + +if test -r "$cache_file"; then + # Some versions of bash will fail to source /dev/null (special files + # actually), so we avoid doing that. DJGPP emulates it as a regular file. + if test /dev/null != "$cache_file" && test -f "$cache_file"; then + { $as_echo "$as_me:${as_lineno-$LINENO}: loading cache $cache_file" >&5 +$as_echo "$as_me: loading cache $cache_file" >&6;} + case $cache_file in + [\\/]* | ?:[\\/]* ) . "$cache_file";; + *) . "./$cache_file";; + esac + fi +else + { $as_echo "$as_me:${as_lineno-$LINENO}: creating cache $cache_file" >&5 +$as_echo "$as_me: creating cache $cache_file" >&6;} + >$cache_file +fi + +# Check that the precious variables saved in the cache have kept the same +# value. +ac_cache_corrupted=false +for ac_var in $ac_precious_vars; do + eval ac_old_set=\$ac_cv_env_${ac_var}_set + eval ac_new_set=\$ac_env_${ac_var}_set + eval ac_old_val=\$ac_cv_env_${ac_var}_value + eval ac_new_val=\$ac_env_${ac_var}_value + case $ac_old_set,$ac_new_set in + set,) + { $as_echo "$as_me:${as_lineno-$LINENO}: error: \`$ac_var' was set to \`$ac_old_val' in the previous run" >&5 +$as_echo "$as_me: error: \`$ac_var' was set to \`$ac_old_val' in the previous run" >&2;} + ac_cache_corrupted=: ;; + ,set) + { $as_echo "$as_me:${as_lineno-$LINENO}: error: \`$ac_var' was not set in the previous run" >&5 +$as_echo "$as_me: error: \`$ac_var' was not set in the previous run" >&2;} + ac_cache_corrupted=: ;; + ,);; + *) + if test "x$ac_old_val" != "x$ac_new_val"; then + # differences in whitespace do not lead to failure. + ac_old_val_w=`echo x $ac_old_val` + ac_new_val_w=`echo x $ac_new_val` + if test "$ac_old_val_w" != "$ac_new_val_w"; then + { $as_echo "$as_me:${as_lineno-$LINENO}: error: \`$ac_var' has changed since the previous run:" >&5 +$as_echo "$as_me: error: \`$ac_var' has changed since the previous run:" >&2;} + ac_cache_corrupted=: + else + { $as_echo "$as_me:${as_lineno-$LINENO}: warning: ignoring whitespace changes in \`$ac_var' since the previous run:" >&5 +$as_echo "$as_me: warning: ignoring whitespace changes in \`$ac_var' since the previous run:" >&2;} + eval $ac_var=\$ac_old_val + fi + { $as_echo "$as_me:${as_lineno-$LINENO}: former value: \`$ac_old_val'" >&5 +$as_echo "$as_me: former value: \`$ac_old_val'" >&2;} + { $as_echo "$as_me:${as_lineno-$LINENO}: current value: \`$ac_new_val'" >&5 +$as_echo "$as_me: current value: \`$ac_new_val'" >&2;} + fi;; + esac + # Pass precious variables to config.status. + if test "$ac_new_set" = set; then + case $ac_new_val in + *\'*) ac_arg=$ac_var=`$as_echo "$ac_new_val" | sed "s/'/'\\\\\\\\''/g"` ;; + *) ac_arg=$ac_var=$ac_new_val ;; + esac + case " $ac_configure_args " in + *" '$ac_arg' "*) ;; # Avoid dups. Use of quotes ensures accuracy. + *) as_fn_append ac_configure_args " '$ac_arg'" ;; + esac + fi +done +if $ac_cache_corrupted; then + { $as_echo "$as_me:${as_lineno-$LINENO}: error: in \`$ac_pwd':" >&5 +$as_echo "$as_me: error: in \`$ac_pwd':" >&2;} + { $as_echo "$as_me:${as_lineno-$LINENO}: error: changes in the environment can compromise the build" >&5 +$as_echo "$as_me: error: changes in the environment can compromise the build" >&2;} + as_fn_error $? "run \`make distclean' and/or \`rm $cache_file' and start over" "$LINENO" 5 +fi +## -------------------- ## +## Main body of script. ## +## -------------------- ## + +ac_ext=c +ac_cpp='$CPP $CPPFLAGS' +ac_compile='$CC -c $CFLAGS $CPPFLAGS conftest.$ac_ext >&5' +ac_link='$CC -o conftest$ac_exeext $CFLAGS $CPPFLAGS $LDFLAGS conftest.$ac_ext $LIBS >&5' +ac_compiler_gnu=$ac_cv_c_compiler_gnu + + +am__api_version="1.9" +ac_aux_dir= +for ac_dir in "$srcdir" "$srcdir/.." "$srcdir/../.."; do + if test -f "$ac_dir/install-sh"; then + ac_aux_dir=$ac_dir + ac_install_sh="$ac_aux_dir/install-sh -c" + break + elif test -f "$ac_dir/install.sh"; then + ac_aux_dir=$ac_dir + ac_install_sh="$ac_aux_dir/install.sh -c" + break + elif test -f "$ac_dir/shtool"; then + ac_aux_dir=$ac_dir + ac_install_sh="$ac_aux_dir/shtool install -c" + break + fi +done +if test -z "$ac_aux_dir"; then + as_fn_error $? "cannot find install-sh, install.sh, or shtool in \"$srcdir\" \"$srcdir/..\" \"$srcdir/../..\"" "$LINENO" 5 +fi + +# These three variables are undocumented and unsupported, +# and are intended to be withdrawn in a future Autoconf release. +# They can cause serious problems if a builder's source tree is in a directory +# whose full name contains unusual characters. +ac_config_guess="$SHELL $ac_aux_dir/config.guess" # Please don't use this var. +ac_config_sub="$SHELL $ac_aux_dir/config.sub" # Please don't use this var. +ac_configure="$SHELL $ac_aux_dir/configure" # Please don't use this var. + + +# Find a good install program. We prefer a C program (faster), +# so one script is as good as another. But avoid the broken or +# incompatible versions: +# SysV /etc/install, /usr/sbin/install +# SunOS /usr/etc/install +# IRIX /sbin/install +# AIX /bin/install +# AmigaOS /C/install, which installs bootblocks on floppy discs +# AIX 4 /usr/bin/installbsd, which doesn't work without a -g flag +# AFS /usr/afsws/bin/install, which mishandles nonexistent args +# SVR4 /usr/ucb/install, which tries to use the nonexistent group "staff" +# OS/2's system install, which has a completely different semantic +# ./install, which can be erroneously created by make from ./install.sh. +# Reject install programs that cannot install multiple files. +{ $as_echo "$as_me:${as_lineno-$LINENO}: checking for a BSD-compatible install" >&5 +$as_echo_n "checking for a BSD-compatible install... " >&6; } +if test -z "$INSTALL"; then +if test "${ac_cv_path_install+set}" = set; then : + $as_echo_n "(cached) " >&6 +else + as_save_IFS=$IFS; IFS=$PATH_SEPARATOR +for as_dir in $PATH +do + IFS=$as_save_IFS + test -z "$as_dir" && as_dir=. + # Account for people who put trailing slashes in PATH elements. +case $as_dir/ in #(( + ./ | .// | /[cC]/* | \ + /etc/* | /usr/sbin/* | /usr/etc/* | /sbin/* | /usr/afsws/bin/* | \ + ?:[\\/]os2[\\/]install[\\/]* | ?:[\\/]OS2[\\/]INSTALL[\\/]* | \ + /usr/ucb/* ) ;; + *) + # OSF1 and SCO ODT 3.0 have their own names for install. + # Don't use installbsd from OSF since it installs stuff as root + # by default. + for ac_prog in ginstall scoinst install; do + for ac_exec_ext in '' $ac_executable_extensions; do + if { test -f "$as_dir/$ac_prog$ac_exec_ext" && $as_test_x "$as_dir/$ac_prog$ac_exec_ext"; }; then + if test $ac_prog = install && + grep dspmsg "$as_dir/$ac_prog$ac_exec_ext" >/dev/null 2>&1; then + # AIX install. It has an incompatible calling convention. + : + elif test $ac_prog = install && + grep pwplus "$as_dir/$ac_prog$ac_exec_ext" >/dev/null 2>&1; then + # program-specific install script used by HP pwplus--don't use. + : + else + rm -rf conftest.one conftest.two conftest.dir + echo one > conftest.one + echo two > conftest.two + mkdir conftest.dir + if "$as_dir/$ac_prog$ac_exec_ext" -c conftest.one conftest.two "`pwd`/conftest.dir" && + test -s conftest.one && test -s conftest.two && + test -s conftest.dir/conftest.one && + test -s conftest.dir/conftest.two + then + ac_cv_path_install="$as_dir/$ac_prog$ac_exec_ext -c" + break 3 + fi + fi + fi + done + done + ;; +esac + + done +IFS=$as_save_IFS + +rm -rf conftest.one conftest.two conftest.dir + +fi + if test "${ac_cv_path_install+set}" = set; then + INSTALL=$ac_cv_path_install + else + # As a last resort, use the slow shell script. Don't cache a + # value for INSTALL within a source directory, because that will + # break other packages using the cache if that directory is + # removed, or if the value is a relative name. + INSTALL=$ac_install_sh + fi +fi +{ $as_echo "$as_me:${as_lineno-$LINENO}: result: $INSTALL" >&5 +$as_echo "$INSTALL" >&6; } + +# Use test -z because SunOS4 sh mishandles braces in ${var-val}. +# It thinks the first close brace ends the variable substitution. +test -z "$INSTALL_PROGRAM" && INSTALL_PROGRAM='${INSTALL}' + +test -z "$INSTALL_SCRIPT" && INSTALL_SCRIPT='${INSTALL}' + +test -z "$INSTALL_DATA" && INSTALL_DATA='${INSTALL} -m 644' + +{ $as_echo "$as_me:${as_lineno-$LINENO}: checking whether build environment is sane" >&5 +$as_echo_n "checking whether build environment is sane... " >&6; } +# Just in case +sleep 1 +echo timestamp > conftest.file +# Do `set' in a subshell so we don't clobber the current shell's +# arguments. Must try -L first in case configure is actually a +# symlink; some systems play weird games with the mod time of symlinks +# (eg FreeBSD returns the mod time of the symlink's containing +# directory). +if ( + set X `ls -Lt $srcdir/configure conftest.file 2> /dev/null` + if test "$*" = "X"; then + # -L didn't work. + set X `ls -t $srcdir/configure conftest.file` + fi + rm -f conftest.file + if test "$*" != "X $srcdir/configure conftest.file" \ + && test "$*" != "X conftest.file $srcdir/configure"; then + + # If neither matched, then we have a broken ls. This can happen + # if, for instance, CONFIG_SHELL is bash and it inherits a + # broken ls alias from the environment. This has actually + # happened. Such a system could not be considered "sane". + as_fn_error $? "ls -t appears to fail. Make sure there is not a broken +alias in your environment" "$LINENO" 5 + fi + + test "$2" = conftest.file + ) +then + # Ok. + : +else + as_fn_error $? "newly created file is older than distributed files! +Check your system clock" "$LINENO" 5 +fi +{ $as_echo "$as_me:${as_lineno-$LINENO}: result: yes" >&5 +$as_echo "yes" >&6; } +test "$program_prefix" != NONE && + program_transform_name="s&^&$program_prefix&;$program_transform_name" +# Use a double $ so make ignores it. +test "$program_suffix" != NONE && + program_transform_name="s&\$&$program_suffix&;$program_transform_name" +# Double any \ or $. +# By default was `s,x,x', remove it if useless. +ac_script='s/[\\$]/&&/g;s/;s,x,x,$//' +program_transform_name=`$as_echo "$program_transform_name" | sed "$ac_script"` + +# expand $ac_aux_dir to an absolute path +am_aux_dir=`cd $ac_aux_dir && pwd` + +test x"${MISSING+set}" = xset || MISSING="\${SHELL} $am_aux_dir/missing" +# Use eval to expand $SHELL +if eval "$MISSING --run true"; then + am_missing_run="$MISSING --run " +else + am_missing_run= + { $as_echo "$as_me:${as_lineno-$LINENO}: WARNING: \`missing' script is too old or missing" >&5 +$as_echo "$as_me: WARNING: \`missing' script is too old or missing" >&2;} +fi + +if mkdir -p --version . >/dev/null 2>&1 && test ! -d ./--version; then + # We used to keeping the `.' as first argument, in order to + # allow $(mkdir_p) to be used without argument. As in + # $(mkdir_p) $(somedir) + # where $(somedir) is conditionally defined. However this is wrong + # for two reasons: + # 1. if the package is installed by a user who cannot write `.' + # make install will fail, + # 2. the above comment should most certainly read + # $(mkdir_p) $(DESTDIR)$(somedir) + # so it does not work when $(somedir) is undefined and + # $(DESTDIR) is not. + # To support the latter case, we have to write + # test -z "$(somedir)" || $(mkdir_p) $(DESTDIR)$(somedir), + # so the `.' trick is pointless. + mkdir_p='mkdir -p --' +else + # On NextStep and OpenStep, the `mkdir' command does not + # recognize any option. It will interpret all options as + # directories to create, and then abort because `.' already + # exists. + for d in ./-p ./--version; + do + test -d $d && rmdir $d + done + # $(mkinstalldirs) is defined by Automake if mkinstalldirs exists. + if test -f "$ac_aux_dir/mkinstalldirs"; then + mkdir_p='$(mkinstalldirs)' + else + mkdir_p='$(install_sh) -d' + fi +fi + +for ac_prog in gawk mawk nawk awk +do + # Extract the first word of "$ac_prog", so it can be a program name with args. +set dummy $ac_prog; ac_word=$2 +{ $as_echo "$as_me:${as_lineno-$LINENO}: checking for $ac_word" >&5 +$as_echo_n "checking for $ac_word... " >&6; } +if test "${ac_cv_prog_AWK+set}" = set; then : + $as_echo_n "(cached) " >&6 +else + if test -n "$AWK"; then + ac_cv_prog_AWK="$AWK" # Let the user override the test. +else +as_save_IFS=$IFS; IFS=$PATH_SEPARATOR +for as_dir in $PATH +do + IFS=$as_save_IFS + test -z "$as_dir" && as_dir=. + for ac_exec_ext in '' $ac_executable_extensions; do + if { test -f "$as_dir/$ac_word$ac_exec_ext" && $as_test_x "$as_dir/$ac_word$ac_exec_ext"; }; then + ac_cv_prog_AWK="$ac_prog" + $as_echo "$as_me:${as_lineno-$LINENO}: found $as_dir/$ac_word$ac_exec_ext" >&5 + break 2 + fi +done + done +IFS=$as_save_IFS + +fi +fi +AWK=$ac_cv_prog_AWK +if test -n "$AWK"; then + { $as_echo "$as_me:${as_lineno-$LINENO}: result: $AWK" >&5 +$as_echo "$AWK" >&6; } +else + { $as_echo "$as_me:${as_lineno-$LINENO}: result: no" >&5 +$as_echo "no" >&6; } +fi + + + test -n "$AWK" && break +done + +{ $as_echo "$as_me:${as_lineno-$LINENO}: checking whether ${MAKE-make} sets \$(MAKE)" >&5 +$as_echo_n "checking whether ${MAKE-make} sets \$(MAKE)... " >&6; } +set x ${MAKE-make} +ac_make=`$as_echo "$2" | sed 's/+/p/g; s/[^a-zA-Z0-9_]/_/g'` +if eval "test \"\${ac_cv_prog_make_${ac_make}_set+set}\"" = set; then : + $as_echo_n "(cached) " >&6 +else + cat >conftest.make <<\_ACEOF +SHELL = /bin/sh +all: + @echo '@@@%%%=$(MAKE)=@@@%%%' +_ACEOF +# GNU make sometimes prints "make[1]: Entering ...", which would confuse us. +case `${MAKE-make} -f conftest.make 2>/dev/null` in + *@@@%%%=?*=@@@%%%*) + eval ac_cv_prog_make_${ac_make}_set=yes;; + *) + eval ac_cv_prog_make_${ac_make}_set=no;; +esac +rm -f conftest.make +fi +if eval test \$ac_cv_prog_make_${ac_make}_set = yes; then + { $as_echo "$as_me:${as_lineno-$LINENO}: result: yes" >&5 +$as_echo "yes" >&6; } + SET_MAKE= +else + { $as_echo "$as_me:${as_lineno-$LINENO}: result: no" >&5 +$as_echo "no" >&6; } + SET_MAKE="MAKE=${MAKE-make}" +fi + +rm -rf .tst 2>/dev/null +mkdir .tst 2>/dev/null +if test -d .tst; then + am__leading_dot=. +else + am__leading_dot=_ +fi +rmdir .tst 2>/dev/null + +# test to see if srcdir already configured +if test "`cd $srcdir && pwd`" != "`pwd`" && + test -f $srcdir/config.status; then + as_fn_error $? "source directory already configured; run \"make distclean\" there first" "$LINENO" 5 +fi + +# test whether we have cygpath +if test -z "$CYGPATH_W"; then + if (cygpath --version) >/dev/null 2>/dev/null; then + CYGPATH_W='cygpath -w' + else + CYGPATH_W=echo + fi +fi + + +# Define the identity of the package. + PACKAGE='nife' + VERSION='0.44' + + +cat >>confdefs.h <<_ACEOF +#define PACKAGE "$PACKAGE" +_ACEOF + + +cat >>confdefs.h <<_ACEOF +#define VERSION "$VERSION" +_ACEOF + +# Some tools Automake needs. + +ACLOCAL=${ACLOCAL-"${am_missing_run}aclocal-${am__api_version}"} + + +AUTOCONF=${AUTOCONF-"${am_missing_run}autoconf"} + + +AUTOMAKE=${AUTOMAKE-"${am_missing_run}automake-${am__api_version}"} + + +AUTOHEADER=${AUTOHEADER-"${am_missing_run}autoheader"} + + +MAKEINFO=${MAKEINFO-"${am_missing_run}makeinfo"} + +install_sh=${install_sh-"$am_aux_dir/install-sh"} + +# Installed binaries are usually stripped using `strip' when the user +# run `make install-strip'. However `strip' might not be the right +# tool to use in cross-compilation environments, therefore Automake +# will honor the `STRIP' environment variable to overrule this program. +if test "$cross_compiling" != no; then + if test -n "$ac_tool_prefix"; then + # Extract the first word of "${ac_tool_prefix}strip", so it can be a program name with args. +set dummy ${ac_tool_prefix}strip; ac_word=$2 +{ $as_echo "$as_me:${as_lineno-$LINENO}: checking for $ac_word" >&5 +$as_echo_n "checking for $ac_word... " >&6; } +if test "${ac_cv_prog_STRIP+set}" = set; then : + $as_echo_n "(cached) " >&6 +else + if test -n "$STRIP"; then + ac_cv_prog_STRIP="$STRIP" # Let the user override the test. +else +as_save_IFS=$IFS; IFS=$PATH_SEPARATOR +for as_dir in $PATH +do + IFS=$as_save_IFS + test -z "$as_dir" && as_dir=. + for ac_exec_ext in '' $ac_executable_extensions; do + if { test -f "$as_dir/$ac_word$ac_exec_ext" && $as_test_x "$as_dir/$ac_word$ac_exec_ext"; }; then + ac_cv_prog_STRIP="${ac_tool_prefix}strip" + $as_echo "$as_me:${as_lineno-$LINENO}: found $as_dir/$ac_word$ac_exec_ext" >&5 + break 2 + fi +done + done +IFS=$as_save_IFS + +fi +fi +STRIP=$ac_cv_prog_STRIP +if test -n "$STRIP"; then + { $as_echo "$as_me:${as_lineno-$LINENO}: result: $STRIP" >&5 +$as_echo "$STRIP" >&6; } +else + { $as_echo "$as_me:${as_lineno-$LINENO}: result: no" >&5 +$as_echo "no" >&6; } +fi + + +fi +if test -z "$ac_cv_prog_STRIP"; then + ac_ct_STRIP=$STRIP + # Extract the first word of "strip", so it can be a program name with args. +set dummy strip; ac_word=$2 +{ $as_echo "$as_me:${as_lineno-$LINENO}: checking for $ac_word" >&5 +$as_echo_n "checking for $ac_word... " >&6; } +if test "${ac_cv_prog_ac_ct_STRIP+set}" = set; then : + $as_echo_n "(cached) " >&6 +else + if test -n "$ac_ct_STRIP"; then + ac_cv_prog_ac_ct_STRIP="$ac_ct_STRIP" # Let the user override the test. +else +as_save_IFS=$IFS; IFS=$PATH_SEPARATOR +for as_dir in $PATH +do + IFS=$as_save_IFS + test -z "$as_dir" && as_dir=. + for ac_exec_ext in '' $ac_executable_extensions; do + if { test -f "$as_dir/$ac_word$ac_exec_ext" && $as_test_x "$as_dir/$ac_word$ac_exec_ext"; }; then + ac_cv_prog_ac_ct_STRIP="strip" + $as_echo "$as_me:${as_lineno-$LINENO}: found $as_dir/$ac_word$ac_exec_ext" >&5 + break 2 + fi +done + done +IFS=$as_save_IFS + +fi +fi +ac_ct_STRIP=$ac_cv_prog_ac_ct_STRIP +if test -n "$ac_ct_STRIP"; then + { $as_echo "$as_me:${as_lineno-$LINENO}: result: $ac_ct_STRIP" >&5 +$as_echo "$ac_ct_STRIP" >&6; } +else + { $as_echo "$as_me:${as_lineno-$LINENO}: result: no" >&5 +$as_echo "no" >&6; } +fi + + if test "x$ac_ct_STRIP" = x; then + STRIP=":" + else + case $cross_compiling:$ac_tool_warned in +yes:) +{ $as_echo "$as_me:${as_lineno-$LINENO}: WARNING: using cross tools not prefixed with host triplet" >&5 +$as_echo "$as_me: WARNING: using cross tools not prefixed with host triplet" >&2;} +ac_tool_warned=yes ;; +esac + STRIP=$ac_ct_STRIP + fi +else + STRIP="$ac_cv_prog_STRIP" +fi + +fi +INSTALL_STRIP_PROGRAM="\${SHELL} \$(install_sh) -c -s" + +# We need awk for the "check" target. The system "awk" is bad on +# some platforms. +# Always define AMTAR for backward compatibility. + +AMTAR=${AMTAR-"${am_missing_run}tar"} + +am__tar='${AMTAR} chof - "$$tardir"'; am__untar='${AMTAR} xf -' + + + + + + + +ac_config_headers="$ac_config_headers config.h" + + +# Checks for programs. +ac_ext=c +ac_cpp='$CPP $CPPFLAGS' +ac_compile='$CC -c $CFLAGS $CPPFLAGS conftest.$ac_ext >&5' +ac_link='$CC -o conftest$ac_exeext $CFLAGS $CPPFLAGS $LDFLAGS conftest.$ac_ext $LIBS >&5' +ac_compiler_gnu=$ac_cv_c_compiler_gnu +if test -n "$ac_tool_prefix"; then + # Extract the first word of "${ac_tool_prefix}gcc", so it can be a program name with args. +set dummy ${ac_tool_prefix}gcc; ac_word=$2 +{ $as_echo "$as_me:${as_lineno-$LINENO}: checking for $ac_word" >&5 +$as_echo_n "checking for $ac_word... " >&6; } +if test "${ac_cv_prog_CC+set}" = set; then : + $as_echo_n "(cached) " >&6 +else + if test -n "$CC"; then + ac_cv_prog_CC="$CC" # Let the user override the test. +else +as_save_IFS=$IFS; IFS=$PATH_SEPARATOR +for as_dir in $PATH +do + IFS=$as_save_IFS + test -z "$as_dir" && as_dir=. + for ac_exec_ext in '' $ac_executable_extensions; do + if { test -f "$as_dir/$ac_word$ac_exec_ext" && $as_test_x "$as_dir/$ac_word$ac_exec_ext"; }; then + ac_cv_prog_CC="${ac_tool_prefix}gcc" + $as_echo "$as_me:${as_lineno-$LINENO}: found $as_dir/$ac_word$ac_exec_ext" >&5 + break 2 + fi +done + done +IFS=$as_save_IFS + +fi +fi +CC=$ac_cv_prog_CC +if test -n "$CC"; then + { $as_echo "$as_me:${as_lineno-$LINENO}: result: $CC" >&5 +$as_echo "$CC" >&6; } +else + { $as_echo "$as_me:${as_lineno-$LINENO}: result: no" >&5 +$as_echo "no" >&6; } +fi + + +fi +if test -z "$ac_cv_prog_CC"; then + ac_ct_CC=$CC + # Extract the first word of "gcc", so it can be a program name with args. +set dummy gcc; ac_word=$2 +{ $as_echo "$as_me:${as_lineno-$LINENO}: checking for $ac_word" >&5 +$as_echo_n "checking for $ac_word... " >&6; } +if test "${ac_cv_prog_ac_ct_CC+set}" = set; then : + $as_echo_n "(cached) " >&6 +else + if test -n "$ac_ct_CC"; then + ac_cv_prog_ac_ct_CC="$ac_ct_CC" # Let the user override the test. +else +as_save_IFS=$IFS; IFS=$PATH_SEPARATOR +for as_dir in $PATH +do + IFS=$as_save_IFS + test -z "$as_dir" && as_dir=. + for ac_exec_ext in '' $ac_executable_extensions; do + if { test -f "$as_dir/$ac_word$ac_exec_ext" && $as_test_x "$as_dir/$ac_word$ac_exec_ext"; }; then + ac_cv_prog_ac_ct_CC="gcc" + $as_echo "$as_me:${as_lineno-$LINENO}: found $as_dir/$ac_word$ac_exec_ext" >&5 + break 2 + fi +done + done +IFS=$as_save_IFS + +fi +fi +ac_ct_CC=$ac_cv_prog_ac_ct_CC +if test -n "$ac_ct_CC"; then + { $as_echo "$as_me:${as_lineno-$LINENO}: result: $ac_ct_CC" >&5 +$as_echo "$ac_ct_CC" >&6; } +else + { $as_echo "$as_me:${as_lineno-$LINENO}: result: no" >&5 +$as_echo "no" >&6; } +fi + + if test "x$ac_ct_CC" = x; then + CC="" + else + case $cross_compiling:$ac_tool_warned in +yes:) +{ $as_echo "$as_me:${as_lineno-$LINENO}: WARNING: using cross tools not prefixed with host triplet" >&5 +$as_echo "$as_me: WARNING: using cross tools not prefixed with host triplet" >&2;} +ac_tool_warned=yes ;; +esac + CC=$ac_ct_CC + fi +else + CC="$ac_cv_prog_CC" +fi + +if test -z "$CC"; then + if test -n "$ac_tool_prefix"; then + # Extract the first word of "${ac_tool_prefix}cc", so it can be a program name with args. +set dummy ${ac_tool_prefix}cc; ac_word=$2 +{ $as_echo "$as_me:${as_lineno-$LINENO}: checking for $ac_word" >&5 +$as_echo_n "checking for $ac_word... " >&6; } +if test "${ac_cv_prog_CC+set}" = set; then : + $as_echo_n "(cached) " >&6 +else + if test -n "$CC"; then + ac_cv_prog_CC="$CC" # Let the user override the test. +else +as_save_IFS=$IFS; IFS=$PATH_SEPARATOR +for as_dir in $PATH +do + IFS=$as_save_IFS + test -z "$as_dir" && as_dir=. + for ac_exec_ext in '' $ac_executable_extensions; do + if { test -f "$as_dir/$ac_word$ac_exec_ext" && $as_test_x "$as_dir/$ac_word$ac_exec_ext"; }; then + ac_cv_prog_CC="${ac_tool_prefix}cc" + $as_echo "$as_me:${as_lineno-$LINENO}: found $as_dir/$ac_word$ac_exec_ext" >&5 + break 2 + fi +done + done +IFS=$as_save_IFS + +fi +fi +CC=$ac_cv_prog_CC +if test -n "$CC"; then + { $as_echo "$as_me:${as_lineno-$LINENO}: result: $CC" >&5 +$as_echo "$CC" >&6; } +else + { $as_echo "$as_me:${as_lineno-$LINENO}: result: no" >&5 +$as_echo "no" >&6; } +fi + + + fi +fi +if test -z "$CC"; then + # Extract the first word of "cc", so it can be a program name with args. +set dummy cc; ac_word=$2 +{ $as_echo "$as_me:${as_lineno-$LINENO}: checking for $ac_word" >&5 +$as_echo_n "checking for $ac_word... " >&6; } +if test "${ac_cv_prog_CC+set}" = set; then : + $as_echo_n "(cached) " >&6 +else + if test -n "$CC"; then + ac_cv_prog_CC="$CC" # Let the user override the test. +else + ac_prog_rejected=no +as_save_IFS=$IFS; IFS=$PATH_SEPARATOR +for as_dir in $PATH +do + IFS=$as_save_IFS + test -z "$as_dir" && as_dir=. + for ac_exec_ext in '' $ac_executable_extensions; do + if { test -f "$as_dir/$ac_word$ac_exec_ext" && $as_test_x "$as_dir/$ac_word$ac_exec_ext"; }; then + if test "$as_dir/$ac_word$ac_exec_ext" = "/usr/ucb/cc"; then + ac_prog_rejected=yes + continue + fi + ac_cv_prog_CC="cc" + $as_echo "$as_me:${as_lineno-$LINENO}: found $as_dir/$ac_word$ac_exec_ext" >&5 + break 2 + fi +done + done +IFS=$as_save_IFS + +if test $ac_prog_rejected = yes; then + # We found a bogon in the path, so make sure we never use it. + set dummy $ac_cv_prog_CC + shift + if test $# != 0; then + # We chose a different compiler from the bogus one. + # However, it has the same basename, so the bogon will be chosen + # first if we set CC to just the basename; use the full file name. + shift + ac_cv_prog_CC="$as_dir/$ac_word${1+' '}$@" + fi +fi +fi +fi +CC=$ac_cv_prog_CC +if test -n "$CC"; then + { $as_echo "$as_me:${as_lineno-$LINENO}: result: $CC" >&5 +$as_echo "$CC" >&6; } +else + { $as_echo "$as_me:${as_lineno-$LINENO}: result: no" >&5 +$as_echo "no" >&6; } +fi + + +fi +if test -z "$CC"; then + if test -n "$ac_tool_prefix"; then + for ac_prog in cl.exe + do + # Extract the first word of "$ac_tool_prefix$ac_prog", so it can be a program name with args. +set dummy $ac_tool_prefix$ac_prog; ac_word=$2 +{ $as_echo "$as_me:${as_lineno-$LINENO}: checking for $ac_word" >&5 +$as_echo_n "checking for $ac_word... " >&6; } +if test "${ac_cv_prog_CC+set}" = set; then : + $as_echo_n "(cached) " >&6 +else + if test -n "$CC"; then + ac_cv_prog_CC="$CC" # Let the user override the test. +else +as_save_IFS=$IFS; IFS=$PATH_SEPARATOR +for as_dir in $PATH +do + IFS=$as_save_IFS + test -z "$as_dir" && as_dir=. + for ac_exec_ext in '' $ac_executable_extensions; do + if { test -f "$as_dir/$ac_word$ac_exec_ext" && $as_test_x "$as_dir/$ac_word$ac_exec_ext"; }; then + ac_cv_prog_CC="$ac_tool_prefix$ac_prog" + $as_echo "$as_me:${as_lineno-$LINENO}: found $as_dir/$ac_word$ac_exec_ext" >&5 + break 2 + fi +done + done +IFS=$as_save_IFS + +fi +fi +CC=$ac_cv_prog_CC +if test -n "$CC"; then + { $as_echo "$as_me:${as_lineno-$LINENO}: result: $CC" >&5 +$as_echo "$CC" >&6; } +else + { $as_echo "$as_me:${as_lineno-$LINENO}: result: no" >&5 +$as_echo "no" >&6; } +fi + + + test -n "$CC" && break + done +fi +if test -z "$CC"; then + ac_ct_CC=$CC + for ac_prog in cl.exe +do + # Extract the first word of "$ac_prog", so it can be a program name with args. +set dummy $ac_prog; ac_word=$2 +{ $as_echo "$as_me:${as_lineno-$LINENO}: checking for $ac_word" >&5 +$as_echo_n "checking for $ac_word... " >&6; } +if test "${ac_cv_prog_ac_ct_CC+set}" = set; then : + $as_echo_n "(cached) " >&6 +else + if test -n "$ac_ct_CC"; then + ac_cv_prog_ac_ct_CC="$ac_ct_CC" # Let the user override the test. +else +as_save_IFS=$IFS; IFS=$PATH_SEPARATOR +for as_dir in $PATH +do + IFS=$as_save_IFS + test -z "$as_dir" && as_dir=. + for ac_exec_ext in '' $ac_executable_extensions; do + if { test -f "$as_dir/$ac_word$ac_exec_ext" && $as_test_x "$as_dir/$ac_word$ac_exec_ext"; }; then + ac_cv_prog_ac_ct_CC="$ac_prog" + $as_echo "$as_me:${as_lineno-$LINENO}: found $as_dir/$ac_word$ac_exec_ext" >&5 + break 2 + fi +done + done +IFS=$as_save_IFS + +fi +fi +ac_ct_CC=$ac_cv_prog_ac_ct_CC +if test -n "$ac_ct_CC"; then + { $as_echo "$as_me:${as_lineno-$LINENO}: result: $ac_ct_CC" >&5 +$as_echo "$ac_ct_CC" >&6; } +else + { $as_echo "$as_me:${as_lineno-$LINENO}: result: no" >&5 +$as_echo "no" >&6; } +fi + + + test -n "$ac_ct_CC" && break +done + + if test "x$ac_ct_CC" = x; then + CC="" + else + case $cross_compiling:$ac_tool_warned in +yes:) +{ $as_echo "$as_me:${as_lineno-$LINENO}: WARNING: using cross tools not prefixed with host triplet" >&5 +$as_echo "$as_me: WARNING: using cross tools not prefixed with host triplet" >&2;} +ac_tool_warned=yes ;; +esac + CC=$ac_ct_CC + fi +fi + +fi + + +test -z "$CC" && { { $as_echo "$as_me:${as_lineno-$LINENO}: error: in \`$ac_pwd':" >&5 +$as_echo "$as_me: error: in \`$ac_pwd':" >&2;} +as_fn_error $? "no acceptable C compiler found in \$PATH +See \`config.log' for more details" "$LINENO" 5 ; } + +# Provide some information about the compiler. +$as_echo "$as_me:${as_lineno-$LINENO}: checking for C compiler version" >&5 +set X $ac_compile +ac_compiler=$2 +for ac_option in --version -v -V -qversion; do + { { ac_try="$ac_compiler $ac_option >&5" +case "(($ac_try" in + *\"* | *\`* | *\\*) ac_try_echo=\$ac_try;; + *) ac_try_echo=$ac_try;; +esac +eval ac_try_echo="\"\$as_me:${as_lineno-$LINENO}: $ac_try_echo\"" +$as_echo "$ac_try_echo"; } >&5 + (eval "$ac_compiler $ac_option >&5") 2>conftest.err + ac_status=$? + if test -s conftest.err; then + sed '10a\ +... rest of stderr output deleted ... + 10q' conftest.err >conftest.er1 + cat conftest.er1 >&5 + fi + rm -f conftest.er1 conftest.err + $as_echo "$as_me:${as_lineno-$LINENO}: \$? = $ac_status" >&5 + test $ac_status = 0; } +done + +cat confdefs.h - <<_ACEOF >conftest.$ac_ext +/* end confdefs.h. */ + +int +main () +{ + + ; + return 0; +} +_ACEOF +ac_clean_files_save=$ac_clean_files +ac_clean_files="$ac_clean_files a.out a.out.dSYM a.exe b.out" +# Try to create an executable without -o first, disregard a.out. +# It will help us diagnose broken compilers, and finding out an intuition +# of exeext. +{ $as_echo "$as_me:${as_lineno-$LINENO}: checking whether the C compiler works" >&5 +$as_echo_n "checking whether the C compiler works... " >&6; } +ac_link_default=`$as_echo "$ac_link" | sed 's/ -o *conftest[^ ]*//'` + +# The possible output files: +ac_files="a.out conftest.exe conftest a.exe a_out.exe b.out conftest.*" + +ac_rmfiles= +for ac_file in $ac_files +do + case $ac_file in + *.$ac_ext | *.xcoff | *.tds | *.d | *.pdb | *.xSYM | *.bb | *.bbg | *.map | *.inf | *.dSYM | *.o | *.obj ) ;; + * ) ac_rmfiles="$ac_rmfiles $ac_file";; + esac +done +rm -f $ac_rmfiles + +if { { ac_try="$ac_link_default" +case "(($ac_try" in + *\"* | *\`* | *\\*) ac_try_echo=\$ac_try;; + *) ac_try_echo=$ac_try;; +esac +eval ac_try_echo="\"\$as_me:${as_lineno-$LINENO}: $ac_try_echo\"" +$as_echo "$ac_try_echo"; } >&5 + (eval "$ac_link_default") 2>&5 + ac_status=$? + $as_echo "$as_me:${as_lineno-$LINENO}: \$? = $ac_status" >&5 + test $ac_status = 0; }; then : + # Autoconf-2.13 could set the ac_cv_exeext variable to `no'. +# So ignore a value of `no', otherwise this would lead to `EXEEXT = no' +# in a Makefile. We should not override ac_cv_exeext if it was cached, +# so that the user can short-circuit this test for compilers unknown to +# Autoconf. +for ac_file in $ac_files '' +do + test -f "$ac_file" || continue + case $ac_file in + *.$ac_ext | *.xcoff | *.tds | *.d | *.pdb | *.xSYM | *.bb | *.bbg | *.map | *.inf | *.dSYM | *.o | *.obj ) + ;; + [ab].out ) + # We found the default executable, but exeext='' is most + # certainly right. + break;; + *.* ) + if test "${ac_cv_exeext+set}" = set && test "$ac_cv_exeext" != no; + then :; else + ac_cv_exeext=`expr "$ac_file" : '[^.]*\(\..*\)'` + fi + # We set ac_cv_exeext here because the later test for it is not + # safe: cross compilers may not add the suffix if given an `-o' + # argument, so we may need to know it at that point already. + # Even if this section looks crufty: it has the advantage of + # actually working. + break;; + * ) + break;; + esac +done +test "$ac_cv_exeext" = no && ac_cv_exeext= + +else + ac_file='' +fi +if test -z "$ac_file"; then : + { $as_echo "$as_me:${as_lineno-$LINENO}: result: no" >&5 +$as_echo "no" >&6; } +$as_echo "$as_me: failed program was:" >&5 +sed 's/^/| /' conftest.$ac_ext >&5 + +{ { $as_echo "$as_me:${as_lineno-$LINENO}: error: in \`$ac_pwd':" >&5 +$as_echo "$as_me: error: in \`$ac_pwd':" >&2;} +as_fn_error 77 "C compiler cannot create executables +See \`config.log' for more details" "$LINENO" 5 ; } +else + { $as_echo "$as_me:${as_lineno-$LINENO}: result: yes" >&5 +$as_echo "yes" >&6; } +fi +{ $as_echo "$as_me:${as_lineno-$LINENO}: checking for C compiler default output file name" >&5 +$as_echo_n "checking for C compiler default output file name... " >&6; } +{ $as_echo "$as_me:${as_lineno-$LINENO}: result: $ac_file" >&5 +$as_echo "$ac_file" >&6; } +ac_exeext=$ac_cv_exeext + +rm -f -r a.out a.out.dSYM a.exe conftest$ac_cv_exeext b.out +ac_clean_files=$ac_clean_files_save +{ $as_echo "$as_me:${as_lineno-$LINENO}: checking for suffix of executables" >&5 +$as_echo_n "checking for suffix of executables... " >&6; } +if { { ac_try="$ac_link" +case "(($ac_try" in + *\"* | *\`* | *\\*) ac_try_echo=\$ac_try;; + *) ac_try_echo=$ac_try;; +esac +eval ac_try_echo="\"\$as_me:${as_lineno-$LINENO}: $ac_try_echo\"" +$as_echo "$ac_try_echo"; } >&5 + (eval "$ac_link") 2>&5 + ac_status=$? + $as_echo "$as_me:${as_lineno-$LINENO}: \$? = $ac_status" >&5 + test $ac_status = 0; }; then : + # If both `conftest.exe' and `conftest' are `present' (well, observable) +# catch `conftest.exe'. For instance with Cygwin, `ls conftest' will +# work properly (i.e., refer to `conftest.exe'), while it won't with +# `rm'. +for ac_file in conftest.exe conftest conftest.*; do + test -f "$ac_file" || continue + case $ac_file in + *.$ac_ext | *.xcoff | *.tds | *.d | *.pdb | *.xSYM | *.bb | *.bbg | *.map | *.inf | *.dSYM | *.o | *.obj ) ;; + *.* ) ac_cv_exeext=`expr "$ac_file" : '[^.]*\(\..*\)'` + break;; + * ) break;; + esac +done +else + { { $as_echo "$as_me:${as_lineno-$LINENO}: error: in \`$ac_pwd':" >&5 +$as_echo "$as_me: error: in \`$ac_pwd':" >&2;} +as_fn_error $? "cannot compute suffix of executables: cannot compile and link +See \`config.log' for more details" "$LINENO" 5 ; } +fi +rm -f conftest conftest$ac_cv_exeext +{ $as_echo "$as_me:${as_lineno-$LINENO}: result: $ac_cv_exeext" >&5 +$as_echo "$ac_cv_exeext" >&6; } + +rm -f conftest.$ac_ext +EXEEXT=$ac_cv_exeext +ac_exeext=$EXEEXT +cat confdefs.h - <<_ACEOF >conftest.$ac_ext +/* end confdefs.h. */ +#include +int +main () +{ +FILE *f = fopen ("conftest.out", "w"); + return ferror (f) || fclose (f) != 0; + + ; + return 0; +} +_ACEOF +ac_clean_files="$ac_clean_files conftest.out" +# Check that the compiler produces executables we can run. If not, either +# the compiler is broken, or we cross compile. +{ $as_echo "$as_me:${as_lineno-$LINENO}: checking whether we are cross compiling" >&5 +$as_echo_n "checking whether we are cross compiling... " >&6; } +if test "$cross_compiling" != yes; then + { { ac_try="$ac_link" +case "(($ac_try" in + *\"* | *\`* | *\\*) ac_try_echo=\$ac_try;; + *) ac_try_echo=$ac_try;; +esac +eval ac_try_echo="\"\$as_me:${as_lineno-$LINENO}: $ac_try_echo\"" +$as_echo "$ac_try_echo"; } >&5 + (eval "$ac_link") 2>&5 + ac_status=$? + $as_echo "$as_me:${as_lineno-$LINENO}: \$? = $ac_status" >&5 + test $ac_status = 0; } + if { ac_try='./conftest$ac_cv_exeext' + { { case "(($ac_try" in + *\"* | *\`* | *\\*) ac_try_echo=\$ac_try;; + *) ac_try_echo=$ac_try;; +esac +eval ac_try_echo="\"\$as_me:${as_lineno-$LINENO}: $ac_try_echo\"" +$as_echo "$ac_try_echo"; } >&5 + (eval "$ac_try") 2>&5 + ac_status=$? + $as_echo "$as_me:${as_lineno-$LINENO}: \$? = $ac_status" >&5 + test $ac_status = 0; }; }; then + cross_compiling=no + else + if test "$cross_compiling" = maybe; then + cross_compiling=yes + else + { { $as_echo "$as_me:${as_lineno-$LINENO}: error: in \`$ac_pwd':" >&5 +$as_echo "$as_me: error: in \`$ac_pwd':" >&2;} +as_fn_error $? "cannot run C compiled programs. +If you meant to cross compile, use \`--host'. +See \`config.log' for more details" "$LINENO" 5 ; } + fi + fi +fi +{ $as_echo "$as_me:${as_lineno-$LINENO}: result: $cross_compiling" >&5 +$as_echo "$cross_compiling" >&6; } + +rm -f conftest.$ac_ext conftest$ac_cv_exeext conftest.out +ac_clean_files=$ac_clean_files_save +{ $as_echo "$as_me:${as_lineno-$LINENO}: checking for suffix of object files" >&5 +$as_echo_n "checking for suffix of object files... " >&6; } +if test "${ac_cv_objext+set}" = set; then : + $as_echo_n "(cached) " >&6 +else + cat confdefs.h - <<_ACEOF >conftest.$ac_ext +/* end confdefs.h. */ + +int +main () +{ + + ; + return 0; +} +_ACEOF +rm -f conftest.o conftest.obj +if { { ac_try="$ac_compile" +case "(($ac_try" in + *\"* | *\`* | *\\*) ac_try_echo=\$ac_try;; + *) ac_try_echo=$ac_try;; +esac +eval ac_try_echo="\"\$as_me:${as_lineno-$LINENO}: $ac_try_echo\"" +$as_echo "$ac_try_echo"; } >&5 + (eval "$ac_compile") 2>&5 + ac_status=$? + $as_echo "$as_me:${as_lineno-$LINENO}: \$? = $ac_status" >&5 + test $ac_status = 0; }; then : + for ac_file in conftest.o conftest.obj conftest.*; do + test -f "$ac_file" || continue; + case $ac_file in + *.$ac_ext | *.xcoff | *.tds | *.d | *.pdb | *.xSYM | *.bb | *.bbg | *.map | *.inf | *.dSYM ) ;; + *) ac_cv_objext=`expr "$ac_file" : '.*\.\(.*\)'` + break;; + esac +done +else + $as_echo "$as_me: failed program was:" >&5 +sed 's/^/| /' conftest.$ac_ext >&5 + +{ { $as_echo "$as_me:${as_lineno-$LINENO}: error: in \`$ac_pwd':" >&5 +$as_echo "$as_me: error: in \`$ac_pwd':" >&2;} +as_fn_error $? "cannot compute suffix of object files: cannot compile +See \`config.log' for more details" "$LINENO" 5 ; } +fi +rm -f conftest.$ac_cv_objext conftest.$ac_ext +fi +{ $as_echo "$as_me:${as_lineno-$LINENO}: result: $ac_cv_objext" >&5 +$as_echo "$ac_cv_objext" >&6; } +OBJEXT=$ac_cv_objext +ac_objext=$OBJEXT +{ $as_echo "$as_me:${as_lineno-$LINENO}: checking whether we are using the GNU C compiler" >&5 +$as_echo_n "checking whether we are using the GNU C compiler... " >&6; } +if test "${ac_cv_c_compiler_gnu+set}" = set; then : + $as_echo_n "(cached) " >&6 +else + cat confdefs.h - <<_ACEOF >conftest.$ac_ext +/* end confdefs.h. */ + +int +main () +{ +#ifndef __GNUC__ + choke me +#endif + + ; + return 0; +} +_ACEOF +if ac_fn_c_try_compile "$LINENO"; then : + ac_compiler_gnu=yes +else + ac_compiler_gnu=no +fi +rm -f core conftest.err conftest.$ac_objext conftest.$ac_ext +ac_cv_c_compiler_gnu=$ac_compiler_gnu + +fi +{ $as_echo "$as_me:${as_lineno-$LINENO}: result: $ac_cv_c_compiler_gnu" >&5 +$as_echo "$ac_cv_c_compiler_gnu" >&6; } +if test $ac_compiler_gnu = yes; then + GCC=yes +else + GCC= +fi +ac_test_CFLAGS=${CFLAGS+set} +ac_save_CFLAGS=$CFLAGS +{ $as_echo "$as_me:${as_lineno-$LINENO}: checking whether $CC accepts -g" >&5 +$as_echo_n "checking whether $CC accepts -g... " >&6; } +if test "${ac_cv_prog_cc_g+set}" = set; then : + $as_echo_n "(cached) " >&6 +else + ac_save_c_werror_flag=$ac_c_werror_flag + ac_c_werror_flag=yes + ac_cv_prog_cc_g=no + CFLAGS="-g" + cat confdefs.h - <<_ACEOF >conftest.$ac_ext +/* end confdefs.h. */ + +int +main () +{ + + ; + return 0; +} +_ACEOF +if ac_fn_c_try_compile "$LINENO"; then : + ac_cv_prog_cc_g=yes +else + CFLAGS="" + cat confdefs.h - <<_ACEOF >conftest.$ac_ext +/* end confdefs.h. */ + +int +main () +{ + + ; + return 0; +} +_ACEOF +if ac_fn_c_try_compile "$LINENO"; then : + +else + ac_c_werror_flag=$ac_save_c_werror_flag + CFLAGS="-g" + cat confdefs.h - <<_ACEOF >conftest.$ac_ext +/* end confdefs.h. */ + +int +main () +{ + + ; + return 0; +} +_ACEOF +if ac_fn_c_try_compile "$LINENO"; then : + ac_cv_prog_cc_g=yes +fi +rm -f core conftest.err conftest.$ac_objext conftest.$ac_ext +fi +rm -f core conftest.err conftest.$ac_objext conftest.$ac_ext +fi +rm -f core conftest.err conftest.$ac_objext conftest.$ac_ext + ac_c_werror_flag=$ac_save_c_werror_flag +fi +{ $as_echo "$as_me:${as_lineno-$LINENO}: result: $ac_cv_prog_cc_g" >&5 +$as_echo "$ac_cv_prog_cc_g" >&6; } +if test "$ac_test_CFLAGS" = set; then + CFLAGS=$ac_save_CFLAGS +elif test $ac_cv_prog_cc_g = yes; then + if test "$GCC" = yes; then + CFLAGS="-g -O2" + else + CFLAGS="-g" + fi +else + if test "$GCC" = yes; then + CFLAGS="-O2" + else + CFLAGS= + fi +fi +{ $as_echo "$as_me:${as_lineno-$LINENO}: checking for $CC option to accept ISO C89" >&5 +$as_echo_n "checking for $CC option to accept ISO C89... " >&6; } +if test "${ac_cv_prog_cc_c89+set}" = set; then : + $as_echo_n "(cached) " >&6 +else + ac_cv_prog_cc_c89=no +ac_save_CC=$CC +cat confdefs.h - <<_ACEOF >conftest.$ac_ext +/* end confdefs.h. */ +#include +#include +#include +#include +/* Most of the following tests are stolen from RCS 5.7's src/conf.sh. */ +struct buf { int x; }; +FILE * (*rcsopen) (struct buf *, struct stat *, int); +static char *e (p, i) + char **p; + int i; +{ + return p[i]; +} +static char *f (char * (*g) (char **, int), char **p, ...) +{ + char *s; + va_list v; + va_start (v,p); + s = g (p, va_arg (v,int)); + va_end (v); + return s; +} + +/* OSF 4.0 Compaq cc is some sort of almost-ANSI by default. It has + function prototypes and stuff, but not '\xHH' hex character constants. + These don't provoke an error unfortunately, instead are silently treated + as 'x'. The following induces an error, until -std is added to get + proper ANSI mode. Curiously '\x00'!='x' always comes out true, for an + array size at least. It's necessary to write '\x00'==0 to get something + that's true only with -std. */ +int osf4_cc_array ['\x00' == 0 ? 1 : -1]; + +/* IBM C 6 for AIX is almost-ANSI by default, but it replaces macro parameters + inside strings and character constants. */ +#define FOO(x) 'x' +int xlc6_cc_array[FOO(a) == 'x' ? 1 : -1]; + +int test (int i, double x); +struct s1 {int (*f) (int a);}; +struct s2 {int (*f) (double a);}; +int pairnames (int, char **, FILE *(*)(struct buf *, struct stat *, int), int, int); +int argc; +char **argv; +int +main () +{ +return f (e, argv, 0) != argv[0] || f (e, argv, 1) != argv[1]; + ; + return 0; +} +_ACEOF +for ac_arg in '' -qlanglvl=extc89 -qlanglvl=ansi -std \ + -Ae "-Aa -D_HPUX_SOURCE" "-Xc -D__EXTENSIONS__" +do + CC="$ac_save_CC $ac_arg" + if ac_fn_c_try_compile "$LINENO"; then : + ac_cv_prog_cc_c89=$ac_arg +fi +rm -f core conftest.err conftest.$ac_objext + test "x$ac_cv_prog_cc_c89" != "xno" && break +done +rm -f conftest.$ac_ext +CC=$ac_save_CC + +fi +# AC_CACHE_VAL +case "x$ac_cv_prog_cc_c89" in + x) + { $as_echo "$as_me:${as_lineno-$LINENO}: result: none needed" >&5 +$as_echo "none needed" >&6; } ;; + xno) + { $as_echo "$as_me:${as_lineno-$LINENO}: result: unsupported" >&5 +$as_echo "unsupported" >&6; } ;; + *) + CC="$CC $ac_cv_prog_cc_c89" + { $as_echo "$as_me:${as_lineno-$LINENO}: result: $ac_cv_prog_cc_c89" >&5 +$as_echo "$ac_cv_prog_cc_c89" >&6; } ;; +esac +if test "x$ac_cv_prog_cc_c89" != xno; then : + +fi + +ac_ext=c +ac_cpp='$CPP $CPPFLAGS' +ac_compile='$CC -c $CFLAGS $CPPFLAGS conftest.$ac_ext >&5' +ac_link='$CC -o conftest$ac_exeext $CFLAGS $CPPFLAGS $LDFLAGS conftest.$ac_ext $LIBS >&5' +ac_compiler_gnu=$ac_cv_c_compiler_gnu +DEPDIR="${am__leading_dot}deps" + +ac_config_commands="$ac_config_commands depfiles" + + +am_make=${MAKE-make} +cat > confinc << 'END' +am__doit: + @echo done +.PHONY: am__doit +END +# If we don't find an include directive, just comment out the code. +{ $as_echo "$as_me:${as_lineno-$LINENO}: checking for style of include used by $am_make" >&5 +$as_echo_n "checking for style of include used by $am_make... " >&6; } +am__include="#" +am__quote= +_am_result=none +# First try GNU make style include. +echo "include confinc" > confmf +# We grep out `Entering directory' and `Leaving directory' +# messages which can occur if `w' ends up in MAKEFLAGS. +# In particular we don't look at `^make:' because GNU make might +# be invoked under some other name (usually "gmake"), in which +# case it prints its new name instead of `make'. +if test "`$am_make -s -f confmf 2> /dev/null | grep -v 'ing directory'`" = "done"; then + am__include=include + am__quote= + _am_result=GNU +fi +# Now try BSD make style include. +if test "$am__include" = "#"; then + echo '.include "confinc"' > confmf + if test "`$am_make -s -f confmf 2> /dev/null`" = "done"; then + am__include=.include + am__quote="\"" + _am_result=BSD + fi +fi + + +{ $as_echo "$as_me:${as_lineno-$LINENO}: result: $_am_result" >&5 +$as_echo "$_am_result" >&6; } +rm -f confinc confmf + +# Check whether --enable-dependency-tracking was given. +if test "${enable_dependency_tracking+set}" = set; then : + enableval=$enable_dependency_tracking; +fi + +if test "x$enable_dependency_tracking" != xno; then + am_depcomp="$ac_aux_dir/depcomp" + AMDEPBACKSLASH='\' +fi + + +if test "x$enable_dependency_tracking" != xno; then + AMDEP_TRUE= + AMDEP_FALSE='#' +else + AMDEP_TRUE='#' + AMDEP_FALSE= +fi + + + + +depcc="$CC" am_compiler_list= + +{ $as_echo "$as_me:${as_lineno-$LINENO}: checking dependency style of $depcc" >&5 +$as_echo_n "checking dependency style of $depcc... " >&6; } +if test "${am_cv_CC_dependencies_compiler_type+set}" = set; then : + $as_echo_n "(cached) " >&6 +else + if test -z "$AMDEP_TRUE" && test -f "$am_depcomp"; then + # We make a subdir and do the tests there. Otherwise we can end up + # making bogus files that we don't know about and never remove. For + # instance it was reported that on HP-UX the gcc test will end up + # making a dummy file named `D' -- because `-MD' means `put the output + # in D'. + mkdir conftest.dir + # Copy depcomp to subdir because otherwise we won't find it if we're + # using a relative directory. + cp "$am_depcomp" conftest.dir + cd conftest.dir + # We will build objects and dependencies in a subdirectory because + # it helps to detect inapplicable dependency modes. For instance + # both Tru64's cc and ICC support -MD to output dependencies as a + # side effect of compilation, but ICC will put the dependencies in + # the current directory while Tru64 will put them in the object + # directory. + mkdir sub + + am_cv_CC_dependencies_compiler_type=none + if test "$am_compiler_list" = ""; then + am_compiler_list=`sed -n 's/^#*\([a-zA-Z0-9]*\))$/\1/p' < ./depcomp` + fi + for depmode in $am_compiler_list; do + # Setup a source with many dependencies, because some compilers + # like to wrap large dependency lists on column 80 (with \), and + # we should not choose a depcomp mode which is confused by this. + # + # We need to recreate these files for each test, as the compiler may + # overwrite some of them when testing with obscure command lines. + # This happens at least with the AIX C compiler. + : > sub/conftest.c + for i in 1 2 3 4 5 6; do + echo '#include "conftst'$i'.h"' >> sub/conftest.c + # Using `: > sub/conftst$i.h' creates only sub/conftst1.h with + # Solaris 8's {/usr,}/bin/sh. + touch sub/conftst$i.h + done + echo "${am__include} ${am__quote}sub/conftest.Po${am__quote}" > confmf + + case $depmode in + nosideeffect) + # after this tag, mechanisms are not by side-effect, so they'll + # only be used when explicitly requested + if test "x$enable_dependency_tracking" = xyes; then + continue + else + break + fi + ;; + none) break ;; + esac + # We check with `-c' and `-o' for the sake of the "dashmstdout" + # mode. It turns out that the SunPro C++ compiler does not properly + # handle `-M -o', and we need to detect this. + if depmode=$depmode \ + source=sub/conftest.c object=sub/conftest.${OBJEXT-o} \ + depfile=sub/conftest.Po tmpdepfile=sub/conftest.TPo \ + $SHELL ./depcomp $depcc -c -o sub/conftest.${OBJEXT-o} sub/conftest.c \ + >/dev/null 2>conftest.err && + grep sub/conftst6.h sub/conftest.Po > /dev/null 2>&1 && + grep sub/conftest.${OBJEXT-o} sub/conftest.Po > /dev/null 2>&1 && + ${MAKE-make} -s -f confmf > /dev/null 2>&1; then + # icc doesn't choke on unknown options, it will just issue warnings + # or remarks (even with -Werror). So we grep stderr for any message + # that says an option was ignored or not supported. + # When given -MP, icc 7.0 and 7.1 complain thusly: + # icc: Command line warning: ignoring option '-M'; no argument required + # The diagnosis changed in icc 8.0: + # icc: Command line remark: option '-MP' not supported + if (grep 'ignoring option' conftest.err || + grep 'not supported' conftest.err) >/dev/null 2>&1; then :; else + am_cv_CC_dependencies_compiler_type=$depmode + break + fi + fi + done + + cd .. + rm -rf conftest.dir +else + am_cv_CC_dependencies_compiler_type=none +fi + +fi +{ $as_echo "$as_me:${as_lineno-$LINENO}: result: $am_cv_CC_dependencies_compiler_type" >&5 +$as_echo "$am_cv_CC_dependencies_compiler_type" >&6; } +CCDEPMODE=depmode=$am_cv_CC_dependencies_compiler_type + + + +if + test "x$enable_dependency_tracking" != xno \ + && test "$am_cv_CC_dependencies_compiler_type" = gcc3; then + am__fastdepCC_TRUE= + am__fastdepCC_FALSE='#' +else + am__fastdepCC_TRUE='#' + am__fastdepCC_FALSE= +fi + + +{ $as_echo "$as_me:${as_lineno-$LINENO}: checking whether ${MAKE-make} sets \$(MAKE)" >&5 +$as_echo_n "checking whether ${MAKE-make} sets \$(MAKE)... " >&6; } +set x ${MAKE-make} +ac_make=`$as_echo "$2" | sed 's/+/p/g; s/[^a-zA-Z0-9_]/_/g'` +if eval "test \"\${ac_cv_prog_make_${ac_make}_set+set}\"" = set; then : + $as_echo_n "(cached) " >&6 +else + cat >conftest.make <<\_ACEOF +SHELL = /bin/sh +all: + @echo '@@@%%%=$(MAKE)=@@@%%%' +_ACEOF +# GNU make sometimes prints "make[1]: Entering ...", which would confuse us. +case `${MAKE-make} -f conftest.make 2>/dev/null` in + *@@@%%%=?*=@@@%%%*) + eval ac_cv_prog_make_${ac_make}_set=yes;; + *) + eval ac_cv_prog_make_${ac_make}_set=no;; +esac +rm -f conftest.make +fi +if eval test \$ac_cv_prog_make_${ac_make}_set = yes; then + { $as_echo "$as_me:${as_lineno-$LINENO}: result: yes" >&5 +$as_echo "yes" >&6; } + SET_MAKE= +else + { $as_echo "$as_me:${as_lineno-$LINENO}: result: no" >&5 +$as_echo "no" >&6; } + SET_MAKE="MAKE=${MAKE-make}" +fi + + +# Checks for libraries. + +# Checks for header files. + +ac_ext=c +ac_cpp='$CPP $CPPFLAGS' +ac_compile='$CC -c $CFLAGS $CPPFLAGS conftest.$ac_ext >&5' +ac_link='$CC -o conftest$ac_exeext $CFLAGS $CPPFLAGS $LDFLAGS conftest.$ac_ext $LIBS >&5' +ac_compiler_gnu=$ac_cv_c_compiler_gnu +{ $as_echo "$as_me:${as_lineno-$LINENO}: checking how to run the C preprocessor" >&5 +$as_echo_n "checking how to run the C preprocessor... " >&6; } +# On Suns, sometimes $CPP names a directory. +if test -n "$CPP" && test -d "$CPP"; then + CPP= +fi +if test -z "$CPP"; then + if test "${ac_cv_prog_CPP+set}" = set; then : + $as_echo_n "(cached) " >&6 +else + # Double quotes because CPP needs to be expanded + for CPP in "$CC -E" "$CC -E -traditional-cpp" "/lib/cpp" + do + ac_preproc_ok=false +for ac_c_preproc_warn_flag in '' yes +do + # Use a header file that comes with gcc, so configuring glibc + # with a fresh cross-compiler works. + # Prefer to if __STDC__ is defined, since + # exists even on freestanding compilers. + # On the NeXT, cc -E runs the code through the compiler's parser, + # not just through cpp. "Syntax error" is here to catch this case. + cat confdefs.h - <<_ACEOF >conftest.$ac_ext +/* end confdefs.h. */ +#ifdef __STDC__ +# include +#else +# include +#endif + Syntax error +_ACEOF +if ac_fn_c_try_cpp "$LINENO"; then : + +else + # Broken: fails on valid input. +continue +fi +rm -f conftest.err conftest.i conftest.$ac_ext + + # OK, works on sane cases. Now check whether nonexistent headers + # can be detected and how. + cat confdefs.h - <<_ACEOF >conftest.$ac_ext +/* end confdefs.h. */ +#include +_ACEOF +if ac_fn_c_try_cpp "$LINENO"; then : + # Broken: success on invalid input. +continue +else + # Passes both tests. +ac_preproc_ok=: +break +fi +rm -f conftest.err conftest.i conftest.$ac_ext + +done +# Because of `break', _AC_PREPROC_IFELSE's cleaning code was skipped. +rm -f conftest.i conftest.err conftest.$ac_ext +if $ac_preproc_ok; then : + break +fi + + done + ac_cv_prog_CPP=$CPP + +fi + CPP=$ac_cv_prog_CPP +else + ac_cv_prog_CPP=$CPP +fi +{ $as_echo "$as_me:${as_lineno-$LINENO}: result: $CPP" >&5 +$as_echo "$CPP" >&6; } +ac_preproc_ok=false +for ac_c_preproc_warn_flag in '' yes +do + # Use a header file that comes with gcc, so configuring glibc + # with a fresh cross-compiler works. + # Prefer to if __STDC__ is defined, since + # exists even on freestanding compilers. + # On the NeXT, cc -E runs the code through the compiler's parser, + # not just through cpp. "Syntax error" is here to catch this case. + cat confdefs.h - <<_ACEOF >conftest.$ac_ext +/* end confdefs.h. */ +#ifdef __STDC__ +# include +#else +# include +#endif + Syntax error +_ACEOF +if ac_fn_c_try_cpp "$LINENO"; then : + +else + # Broken: fails on valid input. +continue +fi +rm -f conftest.err conftest.i conftest.$ac_ext + + # OK, works on sane cases. Now check whether nonexistent headers + # can be detected and how. + cat confdefs.h - <<_ACEOF >conftest.$ac_ext +/* end confdefs.h. */ +#include +_ACEOF +if ac_fn_c_try_cpp "$LINENO"; then : + # Broken: success on invalid input. +continue +else + # Passes both tests. +ac_preproc_ok=: +break +fi +rm -f conftest.err conftest.i conftest.$ac_ext + +done +# Because of `break', _AC_PREPROC_IFELSE's cleaning code was skipped. +rm -f conftest.i conftest.err conftest.$ac_ext +if $ac_preproc_ok; then : + +else + { { $as_echo "$as_me:${as_lineno-$LINENO}: error: in \`$ac_pwd':" >&5 +$as_echo "$as_me: error: in \`$ac_pwd':" >&2;} +as_fn_error $? "C preprocessor \"$CPP\" fails sanity check +See \`config.log' for more details" "$LINENO" 5 ; } +fi + +ac_ext=c +ac_cpp='$CPP $CPPFLAGS' +ac_compile='$CC -c $CFLAGS $CPPFLAGS conftest.$ac_ext >&5' +ac_link='$CC -o conftest$ac_exeext $CFLAGS $CPPFLAGS $LDFLAGS conftest.$ac_ext $LIBS >&5' +ac_compiler_gnu=$ac_cv_c_compiler_gnu + + +{ $as_echo "$as_me:${as_lineno-$LINENO}: checking for grep that handles long lines and -e" >&5 +$as_echo_n "checking for grep that handles long lines and -e... " >&6; } +if test "${ac_cv_path_GREP+set}" = set; then : + $as_echo_n "(cached) " >&6 +else + if test -z "$GREP"; then + ac_path_GREP_found=false + # Loop through the user's path and test for each of PROGNAME-LIST + as_save_IFS=$IFS; IFS=$PATH_SEPARATOR +for as_dir in $PATH$PATH_SEPARATOR/usr/xpg4/bin +do + IFS=$as_save_IFS + test -z "$as_dir" && as_dir=. + for ac_prog in grep ggrep; do + for ac_exec_ext in '' $ac_executable_extensions; do + ac_path_GREP="$as_dir/$ac_prog$ac_exec_ext" + { test -f "$ac_path_GREP" && $as_test_x "$ac_path_GREP"; } || continue +# Check for GNU ac_path_GREP and select it if it is found. + # Check for GNU $ac_path_GREP +case `"$ac_path_GREP" --version 2>&1` in +*GNU*) + ac_cv_path_GREP="$ac_path_GREP" ac_path_GREP_found=:;; +*) + ac_count=0 + $as_echo_n 0123456789 >"conftest.in" + while : + do + cat "conftest.in" "conftest.in" >"conftest.tmp" + mv "conftest.tmp" "conftest.in" + cp "conftest.in" "conftest.nl" + $as_echo 'GREP' >> "conftest.nl" + "$ac_path_GREP" -e 'GREP$' -e '-(cannot match)-' < "conftest.nl" >"conftest.out" 2>/dev/null || break + diff "conftest.out" "conftest.nl" >/dev/null 2>&1 || break + as_fn_arith $ac_count + 1 && ac_count=$as_val + if test $ac_count -gt ${ac_path_GREP_max-0}; then + # Best one so far, save it but keep looking for a better one + ac_cv_path_GREP="$ac_path_GREP" + ac_path_GREP_max=$ac_count + fi + # 10*(2^10) chars as input seems more than enough + test $ac_count -gt 10 && break + done + rm -f conftest.in conftest.tmp conftest.nl conftest.out;; +esac + + $ac_path_GREP_found && break 3 + done + done + done +IFS=$as_save_IFS + if test -z "$ac_cv_path_GREP"; then + as_fn_error $? "no acceptable grep could be found in $PATH$PATH_SEPARATOR/usr/xpg4/bin" "$LINENO" 5 + fi +else + ac_cv_path_GREP=$GREP +fi + +fi +{ $as_echo "$as_me:${as_lineno-$LINENO}: result: $ac_cv_path_GREP" >&5 +$as_echo "$ac_cv_path_GREP" >&6; } + GREP="$ac_cv_path_GREP" + + +{ $as_echo "$as_me:${as_lineno-$LINENO}: checking for egrep" >&5 +$as_echo_n "checking for egrep... " >&6; } +if test "${ac_cv_path_EGREP+set}" = set; then : + $as_echo_n "(cached) " >&6 +else + if echo a | $GREP -E '(a|b)' >/dev/null 2>&1 + then ac_cv_path_EGREP="$GREP -E" + else + if test -z "$EGREP"; then + ac_path_EGREP_found=false + # Loop through the user's path and test for each of PROGNAME-LIST + as_save_IFS=$IFS; IFS=$PATH_SEPARATOR +for as_dir in $PATH$PATH_SEPARATOR/usr/xpg4/bin +do + IFS=$as_save_IFS + test -z "$as_dir" && as_dir=. + for ac_prog in egrep; do + for ac_exec_ext in '' $ac_executable_extensions; do + ac_path_EGREP="$as_dir/$ac_prog$ac_exec_ext" + { test -f "$ac_path_EGREP" && $as_test_x "$ac_path_EGREP"; } || continue +# Check for GNU ac_path_EGREP and select it if it is found. + # Check for GNU $ac_path_EGREP +case `"$ac_path_EGREP" --version 2>&1` in +*GNU*) + ac_cv_path_EGREP="$ac_path_EGREP" ac_path_EGREP_found=:;; +*) + ac_count=0 + $as_echo_n 0123456789 >"conftest.in" + while : + do + cat "conftest.in" "conftest.in" >"conftest.tmp" + mv "conftest.tmp" "conftest.in" + cp "conftest.in" "conftest.nl" + $as_echo 'EGREP' >> "conftest.nl" + "$ac_path_EGREP" 'EGREP$' < "conftest.nl" >"conftest.out" 2>/dev/null || break + diff "conftest.out" "conftest.nl" >/dev/null 2>&1 || break + as_fn_arith $ac_count + 1 && ac_count=$as_val + if test $ac_count -gt ${ac_path_EGREP_max-0}; then + # Best one so far, save it but keep looking for a better one + ac_cv_path_EGREP="$ac_path_EGREP" + ac_path_EGREP_max=$ac_count + fi + # 10*(2^10) chars as input seems more than enough + test $ac_count -gt 10 && break + done + rm -f conftest.in conftest.tmp conftest.nl conftest.out;; +esac + + $ac_path_EGREP_found && break 3 + done + done + done +IFS=$as_save_IFS + if test -z "$ac_cv_path_EGREP"; then + as_fn_error $? "no acceptable egrep could be found in $PATH$PATH_SEPARATOR/usr/xpg4/bin" "$LINENO" 5 + fi +else + ac_cv_path_EGREP=$EGREP +fi + + fi +fi +{ $as_echo "$as_me:${as_lineno-$LINENO}: result: $ac_cv_path_EGREP" >&5 +$as_echo "$ac_cv_path_EGREP" >&6; } + EGREP="$ac_cv_path_EGREP" + + +{ $as_echo "$as_me:${as_lineno-$LINENO}: checking for ANSI C header files" >&5 +$as_echo_n "checking for ANSI C header files... " >&6; } +if test "${ac_cv_header_stdc+set}" = set; then : + $as_echo_n "(cached) " >&6 +else + cat confdefs.h - <<_ACEOF >conftest.$ac_ext +/* end confdefs.h. */ +#include +#include +#include +#include + +int +main () +{ + + ; + return 0; +} +_ACEOF +if ac_fn_c_try_compile "$LINENO"; then : + ac_cv_header_stdc=yes +else + ac_cv_header_stdc=no +fi +rm -f core conftest.err conftest.$ac_objext conftest.$ac_ext + +if test $ac_cv_header_stdc = yes; then + # SunOS 4.x string.h does not declare mem*, contrary to ANSI. + cat confdefs.h - <<_ACEOF >conftest.$ac_ext +/* end confdefs.h. */ +#include + +_ACEOF +if (eval "$ac_cpp conftest.$ac_ext") 2>&5 | + $EGREP "memchr" >/dev/null 2>&1; then : + +else + ac_cv_header_stdc=no +fi +rm -f conftest* + +fi + +if test $ac_cv_header_stdc = yes; then + # ISC 2.0.2 stdlib.h does not declare free, contrary to ANSI. + cat confdefs.h - <<_ACEOF >conftest.$ac_ext +/* end confdefs.h. */ +#include + +_ACEOF +if (eval "$ac_cpp conftest.$ac_ext") 2>&5 | + $EGREP "free" >/dev/null 2>&1; then : + +else + ac_cv_header_stdc=no +fi +rm -f conftest* + +fi + +if test $ac_cv_header_stdc = yes; then + # /bin/cc in Irix-4.0.5 gets non-ANSI ctype macros unless using -ansi. + if test "$cross_compiling" = yes; then : + : +else + cat confdefs.h - <<_ACEOF >conftest.$ac_ext +/* end confdefs.h. */ +#include +#include +#if ((' ' & 0x0FF) == 0x020) +# define ISLOWER(c) ('a' <= (c) && (c) <= 'z') +# define TOUPPER(c) (ISLOWER(c) ? 'A' + ((c) - 'a') : (c)) +#else +# define ISLOWER(c) \ + (('a' <= (c) && (c) <= 'i') \ + || ('j' <= (c) && (c) <= 'r') \ + || ('s' <= (c) && (c) <= 'z')) +# define TOUPPER(c) (ISLOWER(c) ? ((c) | 0x40) : (c)) +#endif + +#define XOR(e, f) (((e) && !(f)) || (!(e) && (f))) +int +main () +{ + int i; + for (i = 0; i < 256; i++) + if (XOR (islower (i), ISLOWER (i)) + || toupper (i) != TOUPPER (i)) + return 2; + return 0; +} +_ACEOF +if ac_fn_c_try_run "$LINENO"; then : + +else + ac_cv_header_stdc=no +fi +rm -f core *.core core.conftest.* gmon.out bb.out conftest$ac_exeext \ + conftest.$ac_objext conftest.beam conftest.$ac_ext +fi + +fi +fi +{ $as_echo "$as_me:${as_lineno-$LINENO}: result: $ac_cv_header_stdc" >&5 +$as_echo "$ac_cv_header_stdc" >&6; } +if test $ac_cv_header_stdc = yes; then + +$as_echo "#define STDC_HEADERS 1" >>confdefs.h + +fi + +# On IRIX 5.3, sys/types and inttypes.h are conflicting. +for ac_header in sys/types.h sys/stat.h stdlib.h string.h memory.h strings.h \ + inttypes.h stdint.h unistd.h +do : + as_ac_Header=`$as_echo "ac_cv_header_$ac_header" | $as_tr_sh` +ac_fn_c_check_header_compile "$LINENO" "$ac_header" "$as_ac_Header" "$ac_includes_default +" +if eval test \"x\$"$as_ac_Header"\" = x"yes"; then : + cat >>confdefs.h <<_ACEOF +#define `$as_echo "HAVE_$ac_header" | $as_tr_cpp` 1 +_ACEOF + +fi + +done + + +for ac_header in arpa/inet.h fcntl.h inttypes.h netdb.h stdlib.h string.h strings.h sys/socket.h sys/time.h termios.h unistd.h +do : + as_ac_Header=`$as_echo "ac_cv_header_$ac_header" | $as_tr_sh` +ac_fn_c_check_header_mongrel "$LINENO" "$ac_header" "$as_ac_Header" "$ac_includes_default" +if eval test \"x\$"$as_ac_Header"\" = x"yes"; then : + cat >>confdefs.h <<_ACEOF +#define `$as_echo "HAVE_$ac_header" | $as_tr_cpp` 1 +_ACEOF + +fi + +done + +for ac_header in pthread.h +do : + ac_fn_c_check_header_mongrel "$LINENO" "pthread.h" "ac_cv_header_pthread_h" "$ac_includes_default" +if test "x$ac_cv_header_pthread_h" = x""yes; then : + cat >>confdefs.h <<_ACEOF +#define HAVE_PTHREAD_H 1 +_ACEOF + +fi + +done + +for ac_header in comedilib.h +do : + ac_fn_c_check_header_mongrel "$LINENO" "comedilib.h" "ac_cv_header_comedilib_h" "$ac_includes_default" +if test "x$ac_cv_header_comedilib_h" = x""yes; then : + cat >>confdefs.h <<_ACEOF +#define HAVE_COMEDILIB_H 1 +_ACEOF + +fi + +done + + +# Checks for typedefs, structures, and compiler characteristics. +{ $as_echo "$as_me:${as_lineno-$LINENO}: checking for stdbool.h that conforms to C99" >&5 +$as_echo_n "checking for stdbool.h that conforms to C99... " >&6; } +if test "${ac_cv_header_stdbool_h+set}" = set; then : + $as_echo_n "(cached) " >&6 +else + cat confdefs.h - <<_ACEOF >conftest.$ac_ext +/* end confdefs.h. */ + +#include +#ifndef bool + "error: bool is not defined" +#endif +#ifndef false + "error: false is not defined" +#endif +#if false + "error: false is not 0" +#endif +#ifndef true + "error: true is not defined" +#endif +#if true != 1 + "error: true is not 1" +#endif +#ifndef __bool_true_false_are_defined + "error: __bool_true_false_are_defined is not defined" +#endif + + struct s { _Bool s: 1; _Bool t; } s; + + char a[true == 1 ? 1 : -1]; + char b[false == 0 ? 1 : -1]; + char c[__bool_true_false_are_defined == 1 ? 1 : -1]; + char d[(bool) 0.5 == true ? 1 : -1]; + bool e = &s; + char f[(_Bool) 0.0 == false ? 1 : -1]; + char g[true]; + char h[sizeof (_Bool)]; + char i[sizeof s.t]; + enum { j = false, k = true, l = false * true, m = true * 256 }; + /* The following fails for + HP aC++/ANSI C B3910B A.05.55 [Dec 04 2003]. */ + _Bool n[m]; + char o[sizeof n == m * sizeof n[0] ? 1 : -1]; + char p[-1 - (_Bool) 0 < 0 && -1 - (bool) 0 < 0 ? 1 : -1]; +# if defined __xlc__ || defined __GNUC__ + /* Catch a bug in IBM AIX xlc compiler version 6.0.0.0 + reported by James Lemley on 2005-10-05; see + http://lists.gnu.org/archive/html/bug-coreutils/2005-10/msg00086.html + This test is not quite right, since xlc is allowed to + reject this program, as the initializer for xlcbug is + not one of the forms that C requires support for. + However, doing the test right would require a runtime + test, and that would make cross-compilation harder. + Let us hope that IBM fixes the xlc bug, and also adds + support for this kind of constant expression. In the + meantime, this test will reject xlc, which is OK, since + our stdbool.h substitute should suffice. We also test + this with GCC, where it should work, to detect more + quickly whether someone messes up the test in the + future. */ + char digs[] = "0123456789"; + int xlcbug = 1 / (&(digs + 5)[-2 + (bool) 1] == &digs[4] ? 1 : -1); +# endif + /* Catch a bug in an HP-UX C compiler. See + http://gcc.gnu.org/ml/gcc-patches/2003-12/msg02303.html + http://lists.gnu.org/archive/html/bug-coreutils/2005-11/msg00161.html + */ + _Bool q = true; + _Bool *pq = &q; + +int +main () +{ + + *pq |= q; + *pq |= ! q; + /* Refer to every declared value, to avoid compiler optimizations. */ + return (!a + !b + !c + !d + !e + !f + !g + !h + !i + !!j + !k + !!l + + !m + !n + !o + !p + !q + !pq); + + ; + return 0; +} +_ACEOF +if ac_fn_c_try_compile "$LINENO"; then : + ac_cv_header_stdbool_h=yes +else + ac_cv_header_stdbool_h=no +fi +rm -f core conftest.err conftest.$ac_objext conftest.$ac_ext +fi +{ $as_echo "$as_me:${as_lineno-$LINENO}: result: $ac_cv_header_stdbool_h" >&5 +$as_echo "$ac_cv_header_stdbool_h" >&6; } +ac_fn_c_check_type "$LINENO" "_Bool" "ac_cv_type__Bool" "$ac_includes_default" +if test "x$ac_cv_type__Bool" = x""yes; then : + +cat >>confdefs.h <<_ACEOF +#define HAVE__BOOL 1 +_ACEOF + + +fi + +if test $ac_cv_header_stdbool_h = yes; then + +$as_echo "#define HAVE_STDBOOL_H 1" >>confdefs.h + +fi + +ac_fn_c_check_type "$LINENO" "pid_t" "ac_cv_type_pid_t" "$ac_includes_default" +if test "x$ac_cv_type_pid_t" = x""yes; then : + +else + +cat >>confdefs.h <<_ACEOF +#define pid_t int +_ACEOF + +fi + + +# Checks for library functions. +for ac_header in vfork.h +do : + ac_fn_c_check_header_mongrel "$LINENO" "vfork.h" "ac_cv_header_vfork_h" "$ac_includes_default" +if test "x$ac_cv_header_vfork_h" = x""yes; then : + cat >>confdefs.h <<_ACEOF +#define HAVE_VFORK_H 1 +_ACEOF + +fi + +done + +for ac_func in fork vfork +do : + as_ac_var=`$as_echo "ac_cv_func_$ac_func" | $as_tr_sh` +ac_fn_c_check_func "$LINENO" "$ac_func" "$as_ac_var" +if eval test \"x\$"$as_ac_var"\" = x"yes"; then : + cat >>confdefs.h <<_ACEOF +#define `$as_echo "HAVE_$ac_func" | $as_tr_cpp` 1 +_ACEOF + +fi +done + +if test "x$ac_cv_func_fork" = xyes; then + { $as_echo "$as_me:${as_lineno-$LINENO}: checking for working fork" >&5 +$as_echo_n "checking for working fork... " >&6; } +if test "${ac_cv_func_fork_works+set}" = set; then : + $as_echo_n "(cached) " >&6 +else + if test "$cross_compiling" = yes; then : + ac_cv_func_fork_works=cross +else + cat confdefs.h - <<_ACEOF >conftest.$ac_ext +/* end confdefs.h. */ +$ac_includes_default +int +main () +{ + + /* By Ruediger Kuhlmann. */ + return fork () < 0; + + ; + return 0; +} +_ACEOF +if ac_fn_c_try_run "$LINENO"; then : + ac_cv_func_fork_works=yes +else + ac_cv_func_fork_works=no +fi +rm -f core *.core core.conftest.* gmon.out bb.out conftest$ac_exeext \ + conftest.$ac_objext conftest.beam conftest.$ac_ext +fi + +fi +{ $as_echo "$as_me:${as_lineno-$LINENO}: result: $ac_cv_func_fork_works" >&5 +$as_echo "$ac_cv_func_fork_works" >&6; } + +else + ac_cv_func_fork_works=$ac_cv_func_fork +fi +if test "x$ac_cv_func_fork_works" = xcross; then + case $host in + *-*-amigaos* | *-*-msdosdjgpp*) + # Override, as these systems have only a dummy fork() stub + ac_cv_func_fork_works=no + ;; + *) + ac_cv_func_fork_works=yes + ;; + esac + { $as_echo "$as_me:${as_lineno-$LINENO}: WARNING: result $ac_cv_func_fork_works guessed because of cross compilation" >&5 +$as_echo "$as_me: WARNING: result $ac_cv_func_fork_works guessed because of cross compilation" >&2;} +fi +ac_cv_func_vfork_works=$ac_cv_func_vfork +if test "x$ac_cv_func_vfork" = xyes; then + { $as_echo "$as_me:${as_lineno-$LINENO}: checking for working vfork" >&5 +$as_echo_n "checking for working vfork... " >&6; } +if test "${ac_cv_func_vfork_works+set}" = set; then : + $as_echo_n "(cached) " >&6 +else + if test "$cross_compiling" = yes; then : + ac_cv_func_vfork_works=cross +else + cat confdefs.h - <<_ACEOF >conftest.$ac_ext +/* end confdefs.h. */ +/* Thanks to Paul Eggert for this test. */ +$ac_includes_default +#include +#ifdef HAVE_VFORK_H +# include +#endif +/* On some sparc systems, changes by the child to local and incoming + argument registers are propagated back to the parent. The compiler + is told about this with #include , but some compilers + (e.g. gcc -O) don't grok . Test for this by using a + static variable whose address is put into a register that is + clobbered by the vfork. */ +static void +#ifdef __cplusplus +sparc_address_test (int arg) +# else +sparc_address_test (arg) int arg; +#endif +{ + static pid_t child; + if (!child) { + child = vfork (); + if (child < 0) { + perror ("vfork"); + _exit(2); + } + if (!child) { + arg = getpid(); + write(-1, "", 0); + _exit (arg); + } + } +} + +int +main () +{ + pid_t parent = getpid (); + pid_t child; + + sparc_address_test (0); + + child = vfork (); + + if (child == 0) { + /* Here is another test for sparc vfork register problems. This + test uses lots of local variables, at least as many local + variables as main has allocated so far including compiler + temporaries. 4 locals are enough for gcc 1.40.3 on a Solaris + 4.1.3 sparc, but we use 8 to be safe. A buggy compiler should + reuse the register of parent for one of the local variables, + since it will think that parent can't possibly be used any more + in this routine. Assigning to the local variable will thus + munge parent in the parent process. */ + pid_t + p = getpid(), p1 = getpid(), p2 = getpid(), p3 = getpid(), + p4 = getpid(), p5 = getpid(), p6 = getpid(), p7 = getpid(); + /* Convince the compiler that p..p7 are live; otherwise, it might + use the same hardware register for all 8 local variables. */ + if (p != p1 || p != p2 || p != p3 || p != p4 + || p != p5 || p != p6 || p != p7) + _exit(1); + + /* On some systems (e.g. IRIX 3.3), vfork doesn't separate parent + from child file descriptors. If the child closes a descriptor + before it execs or exits, this munges the parent's descriptor + as well. Test for this by closing stdout in the child. */ + _exit(close(fileno(stdout)) != 0); + } else { + int status; + struct stat st; + + while (wait(&status) != child) + ; + return ( + /* Was there some problem with vforking? */ + child < 0 + + /* Did the child fail? (This shouldn't happen.) */ + || status + + /* Did the vfork/compiler bug occur? */ + || parent != getpid() + + /* Did the file descriptor bug occur? */ + || fstat(fileno(stdout), &st) != 0 + ); + } +} +_ACEOF +if ac_fn_c_try_run "$LINENO"; then : + ac_cv_func_vfork_works=yes +else + ac_cv_func_vfork_works=no +fi +rm -f core *.core core.conftest.* gmon.out bb.out conftest$ac_exeext \ + conftest.$ac_objext conftest.beam conftest.$ac_ext +fi + +fi +{ $as_echo "$as_me:${as_lineno-$LINENO}: result: $ac_cv_func_vfork_works" >&5 +$as_echo "$ac_cv_func_vfork_works" >&6; } + +fi; +if test "x$ac_cv_func_fork_works" = xcross; then + ac_cv_func_vfork_works=$ac_cv_func_vfork + { $as_echo "$as_me:${as_lineno-$LINENO}: WARNING: result $ac_cv_func_vfork_works guessed because of cross compilation" >&5 +$as_echo "$as_me: WARNING: result $ac_cv_func_vfork_works guessed because of cross compilation" >&2;} +fi + +if test "x$ac_cv_func_vfork_works" = xyes; then + +$as_echo "#define HAVE_WORKING_VFORK 1" >>confdefs.h + +else + +$as_echo "#define vfork fork" >>confdefs.h + +fi +if test "x$ac_cv_func_fork_works" = xyes; then + +$as_echo "#define HAVE_WORKING_FORK 1" >>confdefs.h + +fi + +for ac_header in stdlib.h +do : + ac_fn_c_check_header_mongrel "$LINENO" "stdlib.h" "ac_cv_header_stdlib_h" "$ac_includes_default" +if test "x$ac_cv_header_stdlib_h" = x""yes; then : + cat >>confdefs.h <<_ACEOF +#define HAVE_STDLIB_H 1 +_ACEOF + +fi + +done + +{ $as_echo "$as_me:${as_lineno-$LINENO}: checking for GNU libc compatible malloc" >&5 +$as_echo_n "checking for GNU libc compatible malloc... " >&6; } +if test "${ac_cv_func_malloc_0_nonnull+set}" = set; then : + $as_echo_n "(cached) " >&6 +else + if test "$cross_compiling" = yes; then : + ac_cv_func_malloc_0_nonnull=no +else + cat confdefs.h - <<_ACEOF >conftest.$ac_ext +/* end confdefs.h. */ +#if defined STDC_HEADERS || defined HAVE_STDLIB_H +# include +#else +char *malloc (); +#endif + +int +main () +{ +return ! malloc (0); + ; + return 0; +} +_ACEOF +if ac_fn_c_try_run "$LINENO"; then : + ac_cv_func_malloc_0_nonnull=yes +else + ac_cv_func_malloc_0_nonnull=no +fi +rm -f core *.core core.conftest.* gmon.out bb.out conftest$ac_exeext \ + conftest.$ac_objext conftest.beam conftest.$ac_ext +fi + +fi +{ $as_echo "$as_me:${as_lineno-$LINENO}: result: $ac_cv_func_malloc_0_nonnull" >&5 +$as_echo "$ac_cv_func_malloc_0_nonnull" >&6; } +if test $ac_cv_func_malloc_0_nonnull = yes; then : + +$as_echo "#define HAVE_MALLOC 1" >>confdefs.h + +else + $as_echo "#define HAVE_MALLOC 0" >>confdefs.h + + case " $LIBOBJS " in + *" malloc.$ac_objext "* ) ;; + *) LIBOBJS="$LIBOBJS malloc.$ac_objext" + ;; +esac + + +$as_echo "#define malloc rpl_malloc" >>confdefs.h + +fi + + +{ $as_echo "$as_me:${as_lineno-$LINENO}: checking for working strtod" >&5 +$as_echo_n "checking for working strtod... " >&6; } +if test "${ac_cv_func_strtod+set}" = set; then : + $as_echo_n "(cached) " >&6 +else + if test "$cross_compiling" = yes; then : + ac_cv_func_strtod=no +else + cat confdefs.h - <<_ACEOF >conftest.$ac_ext +/* end confdefs.h. */ + +$ac_includes_default +#ifndef strtod +double strtod (); +#endif +int +main() +{ + { + /* Some versions of Linux strtod mis-parse strings with leading '+'. */ + char *string = " +69"; + char *term; + double value; + value = strtod (string, &term); + if (value != 69 || term != (string + 4)) + return 1; + } + + { + /* Under Solaris 2.4, strtod returns the wrong value for the + terminating character under some conditions. */ + char *string = "NaN"; + char *term; + strtod (string, &term); + if (term != string && *(term - 1) == 0) + return 1; + } + return 0; +} + +_ACEOF +if ac_fn_c_try_run "$LINENO"; then : + ac_cv_func_strtod=yes +else + ac_cv_func_strtod=no +fi +rm -f core *.core core.conftest.* gmon.out bb.out conftest$ac_exeext \ + conftest.$ac_objext conftest.beam conftest.$ac_ext +fi + +fi +{ $as_echo "$as_me:${as_lineno-$LINENO}: result: $ac_cv_func_strtod" >&5 +$as_echo "$ac_cv_func_strtod" >&6; } +if test $ac_cv_func_strtod = no; then + case " $LIBOBJS " in + *" strtod.$ac_objext "* ) ;; + *) LIBOBJS="$LIBOBJS strtod.$ac_objext" + ;; +esac + +ac_fn_c_check_func "$LINENO" "pow" "ac_cv_func_pow" +if test "x$ac_cv_func_pow" = x""yes; then : + +fi + +if test $ac_cv_func_pow = no; then + { $as_echo "$as_me:${as_lineno-$LINENO}: checking for pow in -lm" >&5 +$as_echo_n "checking for pow in -lm... " >&6; } +if test "${ac_cv_lib_m_pow+set}" = set; then : + $as_echo_n "(cached) " >&6 +else + ac_check_lib_save_LIBS=$LIBS +LIBS="-lm $LIBS" +cat confdefs.h - <<_ACEOF >conftest.$ac_ext +/* end confdefs.h. */ + +/* Override any GCC internal prototype to avoid an error. + Use char because int might match the return type of a GCC + builtin and then its argument prototype would still apply. */ +#ifdef __cplusplus +extern "C" +#endif +char pow (); +int +main () +{ +return pow (); + ; + return 0; +} +_ACEOF +if ac_fn_c_try_link "$LINENO"; then : + ac_cv_lib_m_pow=yes +else + ac_cv_lib_m_pow=no +fi +rm -f core conftest.err conftest.$ac_objext \ + conftest$ac_exeext conftest.$ac_ext +LIBS=$ac_check_lib_save_LIBS +fi +{ $as_echo "$as_me:${as_lineno-$LINENO}: result: $ac_cv_lib_m_pow" >&5 +$as_echo "$ac_cv_lib_m_pow" >&6; } +if test "x$ac_cv_lib_m_pow" = x""yes; then : + POW_LIB=-lm +else + { $as_echo "$as_me:${as_lineno-$LINENO}: WARNING: cannot find library containing definition of pow" >&5 +$as_echo "$as_me: WARNING: cannot find library containing definition of pow" >&2;} +fi + +fi + +fi + +for ac_func in bzero dup2 floor gethostbyname gettimeofday inet_ntoa pow rint socket strchr +do : + as_ac_var=`$as_echo "ac_cv_func_$ac_func" | $as_tr_sh` +ac_fn_c_check_func "$LINENO" "$ac_func" "$as_ac_var" +if eval test \"x\$"$as_ac_var"\" = x"yes"; then : + cat >>confdefs.h <<_ACEOF +#define `$as_echo "HAVE_$ac_func" | $as_tr_cpp` 1 +_ACEOF + +fi +done + + +{ $as_echo "$as_me:${as_lineno-$LINENO}: checking for library containing pow" >&5 +$as_echo_n "checking for library containing pow... " >&6; } +if test "${ac_cv_search_pow+set}" = set; then : + $as_echo_n "(cached) " >&6 +else + ac_func_search_save_LIBS=$LIBS +cat confdefs.h - <<_ACEOF >conftest.$ac_ext +/* end confdefs.h. */ + +/* Override any GCC internal prototype to avoid an error. + Use char because int might match the return type of a GCC + builtin and then its argument prototype would still apply. */ +#ifdef __cplusplus +extern "C" +#endif +char pow (); +int +main () +{ +return pow (); + ; + return 0; +} +_ACEOF +for ac_lib in '' m; do + if test -z "$ac_lib"; then + ac_res="none required" + else + ac_res=-l$ac_lib + LIBS="-l$ac_lib $ac_func_search_save_LIBS" + fi + if ac_fn_c_try_link "$LINENO"; then : + ac_cv_search_pow=$ac_res +fi +rm -f core conftest.err conftest.$ac_objext \ + conftest$ac_exeext + if test "${ac_cv_search_pow+set}" = set; then : + break +fi +done +if test "${ac_cv_search_pow+set}" = set; then : + +else + ac_cv_search_pow=no +fi +rm conftest.$ac_ext +LIBS=$ac_func_search_save_LIBS +fi +{ $as_echo "$as_me:${as_lineno-$LINENO}: result: $ac_cv_search_pow" >&5 +$as_echo "$ac_cv_search_pow" >&6; } +ac_res=$ac_cv_search_pow +if test "$ac_res" != no; then : + test "$ac_res" = "none required" || LIBS="$ac_res $LIBS" + +fi + +{ $as_echo "$as_me:${as_lineno-$LINENO}: checking for library containing comedi_get_cmd_src_mask" >&5 +$as_echo_n "checking for library containing comedi_get_cmd_src_mask... " >&6; } +if test "${ac_cv_search_comedi_get_cmd_src_mask+set}" = set; then : + $as_echo_n "(cached) " >&6 +else + ac_func_search_save_LIBS=$LIBS +cat confdefs.h - <<_ACEOF >conftest.$ac_ext +/* end confdefs.h. */ + +/* Override any GCC internal prototype to avoid an error. + Use char because int might match the return type of a GCC + builtin and then its argument prototype would still apply. */ +#ifdef __cplusplus +extern "C" +#endif +char comedi_get_cmd_src_mask (); +int +main () +{ +return comedi_get_cmd_src_mask (); + ; + return 0; +} +_ACEOF +for ac_lib in '' comedi; do + if test -z "$ac_lib"; then + ac_res="none required" + else + ac_res=-l$ac_lib + LIBS="-l$ac_lib $ac_func_search_save_LIBS" + fi + if ac_fn_c_try_link "$LINENO"; then : + ac_cv_search_comedi_get_cmd_src_mask=$ac_res +fi +rm -f core conftest.err conftest.$ac_objext \ + conftest$ac_exeext + if test "${ac_cv_search_comedi_get_cmd_src_mask+set}" = set; then : + break +fi +done +if test "${ac_cv_search_comedi_get_cmd_src_mask+set}" = set; then : + +else + ac_cv_search_comedi_get_cmd_src_mask=no +fi +rm conftest.$ac_ext +LIBS=$ac_func_search_save_LIBS +fi +{ $as_echo "$as_me:${as_lineno-$LINENO}: result: $ac_cv_search_comedi_get_cmd_src_mask" >&5 +$as_echo "$ac_cv_search_comedi_get_cmd_src_mask" >&6; } +ac_res=$ac_cv_search_comedi_get_cmd_src_mask +if test "$ac_res" != no; then : + test "$ac_res" = "none required" || LIBS="$ac_res $LIBS" + +fi + +{ $as_echo "$as_me:${as_lineno-$LINENO}: checking for library containing socket" >&5 +$as_echo_n "checking for library containing socket... " >&6; } +if test "${ac_cv_search_socket+set}" = set; then : + $as_echo_n "(cached) " >&6 +else + ac_func_search_save_LIBS=$LIBS +cat confdefs.h - <<_ACEOF >conftest.$ac_ext +/* end confdefs.h. */ + +/* Override any GCC internal prototype to avoid an error. + Use char because int might match the return type of a GCC + builtin and then its argument prototype would still apply. */ +#ifdef __cplusplus +extern "C" +#endif +char socket (); +int +main () +{ +return socket (); + ; + return 0; +} +_ACEOF +for ac_lib in '' socket; do + if test -z "$ac_lib"; then + ac_res="none required" + else + ac_res=-l$ac_lib + LIBS="-l$ac_lib $ac_func_search_save_LIBS" + fi + if ac_fn_c_try_link "$LINENO"; then : + ac_cv_search_socket=$ac_res +fi +rm -f core conftest.err conftest.$ac_objext \ + conftest$ac_exeext + if test "${ac_cv_search_socket+set}" = set; then : + break +fi +done +if test "${ac_cv_search_socket+set}" = set; then : + +else + ac_cv_search_socket=no +fi +rm conftest.$ac_ext +LIBS=$ac_func_search_save_LIBS +fi +{ $as_echo "$as_me:${as_lineno-$LINENO}: result: $ac_cv_search_socket" >&5 +$as_echo "$ac_cv_search_socket" >&6; } +ac_res=$ac_cv_search_socket +if test "$ac_res" != no; then : + test "$ac_res" = "none required" || LIBS="$ac_res $LIBS" + +fi + +{ $as_echo "$as_me:${as_lineno-$LINENO}: checking for library containing pthread_create" >&5 +$as_echo_n "checking for library containing pthread_create... " >&6; } +if test "${ac_cv_search_pthread_create+set}" = set; then : + $as_echo_n "(cached) " >&6 +else + ac_func_search_save_LIBS=$LIBS +cat confdefs.h - <<_ACEOF >conftest.$ac_ext +/* end confdefs.h. */ + +/* Override any GCC internal prototype to avoid an error. + Use char because int might match the return type of a GCC + builtin and then its argument prototype would still apply. */ +#ifdef __cplusplus +extern "C" +#endif +char pthread_create (); +int +main () +{ +return pthread_create (); + ; + return 0; +} +_ACEOF +for ac_lib in '' pthread; do + if test -z "$ac_lib"; then + ac_res="none required" + else + ac_res=-l$ac_lib + LIBS="-l$ac_lib $ac_func_search_save_LIBS" + fi + if ac_fn_c_try_link "$LINENO"; then : + ac_cv_search_pthread_create=$ac_res +fi +rm -f core conftest.err conftest.$ac_objext \ + conftest$ac_exeext + if test "${ac_cv_search_pthread_create+set}" = set; then : + break +fi +done +if test "${ac_cv_search_pthread_create+set}" = set; then : + +else + ac_cv_search_pthread_create=no +fi +rm conftest.$ac_ext +LIBS=$ac_func_search_save_LIBS +fi +{ $as_echo "$as_me:${as_lineno-$LINENO}: result: $ac_cv_search_pthread_create" >&5 +$as_echo "$ac_cv_search_pthread_create" >&6; } +ac_res=$ac_cv_search_pthread_create +if test "$ac_res" != no; then : + test "$ac_res" = "none required" || LIBS="$ac_res $LIBS" + +fi + +{ $as_echo "$as_me:${as_lineno-$LINENO}: checking for library containing inet_ntoa" >&5 +$as_echo_n "checking for library containing inet_ntoa... " >&6; } +if test "${ac_cv_search_inet_ntoa+set}" = set; then : + $as_echo_n "(cached) " >&6 +else + ac_func_search_save_LIBS=$LIBS +cat confdefs.h - <<_ACEOF >conftest.$ac_ext +/* end confdefs.h. */ + +/* Override any GCC internal prototype to avoid an error. + Use char because int might match the return type of a GCC + builtin and then its argument prototype would still apply. */ +#ifdef __cplusplus +extern "C" +#endif +char inet_ntoa (); +int +main () +{ +return inet_ntoa (); + ; + return 0; +} +_ACEOF +for ac_lib in '' nsl; do + if test -z "$ac_lib"; then + ac_res="none required" + else + ac_res=-l$ac_lib + LIBS="-l$ac_lib $ac_func_search_save_LIBS" + fi + if ac_fn_c_try_link "$LINENO"; then : + ac_cv_search_inet_ntoa=$ac_res +fi +rm -f core conftest.err conftest.$ac_objext \ + conftest$ac_exeext + if test "${ac_cv_search_inet_ntoa+set}" = set; then : + break +fi +done +if test "${ac_cv_search_inet_ntoa+set}" = set; then : + +else + ac_cv_search_inet_ntoa=no +fi +rm conftest.$ac_ext +LIBS=$ac_func_search_save_LIBS +fi +{ $as_echo "$as_me:${as_lineno-$LINENO}: result: $ac_cv_search_inet_ntoa" >&5 +$as_echo "$ac_cv_search_inet_ntoa" >&6; } +ac_res=$ac_cv_search_inet_ntoa +if test "$ac_res" != no; then : + test "$ac_res" = "none required" || LIBS="$ac_res $LIBS" + +fi + + +ac_config_files="$ac_config_files Makefile src/Makefile" + +cat >confcache <<\_ACEOF +# This file is a shell script that caches the results of configure +# tests run on this system so they can be shared between configure +# scripts and configure runs, see configure's option --config-cache. +# It is not useful on other systems. If it contains results you don't +# want to keep, you may remove or edit it. +# +# config.status only pays attention to the cache file if you give it +# the --recheck option to rerun configure. +# +# `ac_cv_env_foo' variables (set or unset) will be overridden when +# loading this file, other *unset* `ac_cv_foo' will be assigned the +# following values. + +_ACEOF + +# The following way of writing the cache mishandles newlines in values, +# but we know of no workaround that is simple, portable, and efficient. +# So, we kill variables containing newlines. +# Ultrix sh set writes to stderr and can't be redirected directly, +# and sets the high bit in the cache file unless we assign to the vars. +( + for ac_var in `(set) 2>&1 | sed -n 's/^\([a-zA-Z_][a-zA-Z0-9_]*\)=.*/\1/p'`; do + eval ac_val=\$$ac_var + case $ac_val in #( + *${as_nl}*) + case $ac_var in #( + *_cv_*) { $as_echo "$as_me:${as_lineno-$LINENO}: WARNING: cache variable $ac_var contains a newline" >&5 +$as_echo "$as_me: WARNING: cache variable $ac_var contains a newline" >&2;} ;; + esac + case $ac_var in #( + _ | IFS | as_nl) ;; #( + BASH_ARGV | BASH_SOURCE) eval $ac_var= ;; #( + *) { eval $ac_var=; unset $ac_var;} ;; + esac ;; + esac + done + + (set) 2>&1 | + case $as_nl`(ac_space=' '; set) 2>&1` in #( + *${as_nl}ac_space=\ *) + # `set' does not quote correctly, so add quotes: double-quote + # substitution turns \\\\ into \\, and sed turns \\ into \. + sed -n \ + "s/'/'\\\\''/g; + s/^\\([_$as_cr_alnum]*_cv_[_$as_cr_alnum]*\\)=\\(.*\\)/\\1='\\2'/p" + ;; #( + *) + # `set' quotes correctly as required by POSIX, so do not add quotes. + sed -n "/^[_$as_cr_alnum]*_cv_[_$as_cr_alnum]*=/p" + ;; + esac | + sort +) | + sed ' + /^ac_cv_env_/b end + t clear + :clear + s/^\([^=]*\)=\(.*[{}].*\)$/test "${\1+set}" = set || &/ + t end + s/^\([^=]*\)=\(.*\)$/\1=${\1=\2}/ + :end' >>confcache +if diff "$cache_file" confcache >/dev/null 2>&1; then :; else + if test -w "$cache_file"; then + test "x$cache_file" != "x/dev/null" && + { $as_echo "$as_me:${as_lineno-$LINENO}: updating cache $cache_file" >&5 +$as_echo "$as_me: updating cache $cache_file" >&6;} + cat confcache >$cache_file + else + { $as_echo "$as_me:${as_lineno-$LINENO}: not updating unwritable cache $cache_file" >&5 +$as_echo "$as_me: not updating unwritable cache $cache_file" >&6;} + fi +fi +rm -f confcache + +test "x$prefix" = xNONE && prefix=$ac_default_prefix +# Let make expand exec_prefix. +test "x$exec_prefix" = xNONE && exec_prefix='${prefix}' + +DEFS=-DHAVE_CONFIG_H + +ac_libobjs= +ac_ltlibobjs= +U= +for ac_i in : $LIBOBJS; do test "x$ac_i" = x: && continue + # 1. Remove the extension, and $U if already installed. + ac_script='s/\$U\././;s/\.o$//;s/\.obj$//' + ac_i=`$as_echo "$ac_i" | sed "$ac_script"` + # 2. Prepend LIBOBJDIR. When used with automake>=1.10 LIBOBJDIR + # will be set to the directory where LIBOBJS objects are built. + as_fn_append ac_libobjs " \${LIBOBJDIR}$ac_i\$U.$ac_objext" + as_fn_append ac_ltlibobjs " \${LIBOBJDIR}$ac_i"'$U.lo' +done +LIBOBJS=$ac_libobjs + +LTLIBOBJS=$ac_ltlibobjs + + +if test -z "${AMDEP_TRUE}" && test -z "${AMDEP_FALSE}"; then + as_fn_error $? "conditional \"AMDEP\" was never defined. +Usually this means the macro was only invoked conditionally." "$LINENO" 5 +fi +if test -z "${am__fastdepCC_TRUE}" && test -z "${am__fastdepCC_FALSE}"; then + as_fn_error $? "conditional \"am__fastdepCC\" was never defined. +Usually this means the macro was only invoked conditionally." "$LINENO" 5 +fi + +: ${CONFIG_STATUS=./config.status} +ac_write_fail=0 +ac_clean_files_save=$ac_clean_files +ac_clean_files="$ac_clean_files $CONFIG_STATUS" +{ $as_echo "$as_me:${as_lineno-$LINENO}: creating $CONFIG_STATUS" >&5 +$as_echo "$as_me: creating $CONFIG_STATUS" >&6;} +as_write_fail=0 +cat >$CONFIG_STATUS <<_ASEOF || as_write_fail=1 +#! $SHELL +# Generated by $as_me. +# Run this file to recreate the current configuration. +# Compiler output produced by configure, useful for debugging +# configure, is in config.log if it exists. + +debug=false +ac_cs_recheck=false +ac_cs_silent=false + +SHELL=\${CONFIG_SHELL-$SHELL} +export SHELL +_ASEOF +cat >>$CONFIG_STATUS <<\_ASEOF || as_write_fail=1 +## -------------------- ## +## M4sh Initialization. ## +## -------------------- ## + +# Be more Bourne compatible +DUALCASE=1; export DUALCASE # for MKS sh +if test -n "${ZSH_VERSION+set}" && (emulate sh) >/dev/null 2>&1; then : + emulate sh + NULLCMD=: + # Pre-4.2 versions of Zsh do word splitting on ${1+"$@"}, which + # is contrary to our usage. Disable this feature. + alias -g '${1+"$@"}'='"$@"' + setopt NO_GLOB_SUBST +else + case `(set -o) 2>/dev/null` in #( + *posix*) : + set -o posix ;; #( + *) : + ;; +esac +fi + + +as_nl=' +' +export as_nl +# Printing a long string crashes Solaris 7 /usr/bin/printf. +as_echo='\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\' +as_echo=$as_echo$as_echo$as_echo$as_echo$as_echo +as_echo=$as_echo$as_echo$as_echo$as_echo$as_echo$as_echo +# Prefer a ksh shell builtin over an external printf program on Solaris, +# but without wasting forks for bash or zsh. +if test -z "$BASH_VERSION$ZSH_VERSION" \ + && (test "X`print -r -- $as_echo`" = "X$as_echo") 2>/dev/null; then + as_echo='print -r --' + as_echo_n='print -rn --' +elif (test "X`printf %s $as_echo`" = "X$as_echo") 2>/dev/null; then + as_echo='printf %s\n' + as_echo_n='printf %s' +else + if test "X`(/usr/ucb/echo -n -n $as_echo) 2>/dev/null`" = "X-n $as_echo"; then + as_echo_body='eval /usr/ucb/echo -n "$1$as_nl"' + as_echo_n='/usr/ucb/echo -n' + else + as_echo_body='eval expr "X$1" : "X\\(.*\\)"' + as_echo_n_body='eval + arg=$1; + case $arg in #( + *"$as_nl"*) + expr "X$arg" : "X\\(.*\\)$as_nl"; + arg=`expr "X$arg" : ".*$as_nl\\(.*\\)"`;; + esac; + expr "X$arg" : "X\\(.*\\)" | tr -d "$as_nl" + ' + export as_echo_n_body + as_echo_n='sh -c $as_echo_n_body as_echo' + fi + export as_echo_body + as_echo='sh -c $as_echo_body as_echo' +fi + +# The user is always right. +if test "${PATH_SEPARATOR+set}" != set; then + PATH_SEPARATOR=: + (PATH='/bin;/bin'; FPATH=$PATH; sh -c :) >/dev/null 2>&1 && { + (PATH='/bin:/bin'; FPATH=$PATH; sh -c :) >/dev/null 2>&1 || + PATH_SEPARATOR=';' + } +fi + + +# IFS +# We need space, tab and new line, in precisely that order. Quoting is +# there to prevent editors from complaining about space-tab. +# (If _AS_PATH_WALK were called with IFS unset, it would disable word +# splitting by setting IFS to empty value.) +IFS=" "" $as_nl" + +# Find who we are. Look in the path if we contain no directory separator. +case $0 in #(( + *[\\/]* ) as_myself=$0 ;; + *) as_save_IFS=$IFS; IFS=$PATH_SEPARATOR +for as_dir in $PATH +do + IFS=$as_save_IFS + test -z "$as_dir" && as_dir=. + test -r "$as_dir/$0" && as_myself=$as_dir/$0 && break + done +IFS=$as_save_IFS + + ;; +esac +# We did not find ourselves, most probably we were run as `sh COMMAND' +# in which case we are not to be found in the path. +if test "x$as_myself" = x; then + as_myself=$0 +fi +if test ! -f "$as_myself"; then + $as_echo "$as_myself: error: cannot find myself; rerun with an absolute file name" >&2 + exit 1 +fi + +# Unset variables that we do not need and which cause bugs (e.g. in +# pre-3.0 UWIN ksh). But do not cause bugs in bash 2.01; the "|| exit 1" +# suppresses any "Segmentation fault" message there. '((' could +# trigger a bug in pdksh 5.2.14. +for as_var in BASH_ENV ENV MAIL MAILPATH +do eval test x\${$as_var+set} = xset \ + && ( (unset $as_var) || exit 1) >/dev/null 2>&1 && unset $as_var || : +done +PS1='$ ' +PS2='> ' +PS4='+ ' + +# NLS nuisances. +LC_ALL=C +export LC_ALL +LANGUAGE=C +export LANGUAGE + +# CDPATH. +(unset CDPATH) >/dev/null 2>&1 && unset CDPATH + + +# as_fn_error STATUS ERROR [LINENO LOG_FD] +# ---------------------------------------- +# Output "`basename $0`: error: ERROR" to stderr. If LINENO and LOG_FD are +# provided, also output the error to LOG_FD, referencing LINENO. Then exit the +# script with STATUS, using 1 if that was 0. +as_fn_error () +{ + as_status=$1; test $as_status -eq 0 && as_status=1 + if test "$4"; then + as_lineno=${as_lineno-"$3"} as_lineno_stack=as_lineno_stack=$as_lineno_stack + $as_echo "$as_me:${as_lineno-$LINENO}: error: $2" >&$4 + fi + $as_echo "$as_me: error: $2" >&2 + as_fn_exit $as_status +} # as_fn_error + + +# as_fn_set_status STATUS +# ----------------------- +# Set $? to STATUS, without forking. +as_fn_set_status () +{ + return $1 +} # as_fn_set_status + +# as_fn_exit STATUS +# ----------------- +# Exit the shell with STATUS, even in a "trap 0" or "set -e" context. +as_fn_exit () +{ + set +e + as_fn_set_status $1 + exit $1 +} # as_fn_exit + +# as_fn_unset VAR +# --------------- +# Portably unset VAR. +as_fn_unset () +{ + { eval $1=; unset $1;} +} +as_unset=as_fn_unset +# as_fn_append VAR VALUE +# ---------------------- +# Append the text in VALUE to the end of the definition contained in VAR. Take +# advantage of any shell optimizations that allow amortized linear growth over +# repeated appends, instead of the typical quadratic growth present in naive +# implementations. +if (eval "as_var=1; as_var+=2; test x\$as_var = x12") 2>/dev/null; then : + eval 'as_fn_append () + { + eval $1+=\$2 + }' +else + as_fn_append () + { + eval $1=\$$1\$2 + } +fi # as_fn_append + +# as_fn_arith ARG... +# ------------------ +# Perform arithmetic evaluation on the ARGs, and store the result in the +# global $as_val. Take advantage of shells that can avoid forks. The arguments +# must be portable across $(()) and expr. +if (eval "test \$(( 1 + 1 )) = 2") 2>/dev/null; then : + eval 'as_fn_arith () + { + as_val=$(( $* )) + }' +else + as_fn_arith () + { + as_val=`expr "$@" || test $? -eq 1` + } +fi # as_fn_arith + + +if expr a : '\(a\)' >/dev/null 2>&1 && + test "X`expr 00001 : '.*\(...\)'`" = X001; then + as_expr=expr +else + as_expr=false +fi + +if (basename -- /) >/dev/null 2>&1 && test "X`basename -- / 2>&1`" = "X/"; then + as_basename=basename +else + as_basename=false +fi + +if (as_dir=`dirname -- /` && test "X$as_dir" = X/) >/dev/null 2>&1; then + as_dirname=dirname +else + as_dirname=false +fi + +as_me=`$as_basename -- "$0" || +$as_expr X/"$0" : '.*/\([^/][^/]*\)/*$' \| \ + X"$0" : 'X\(//\)$' \| \ + X"$0" : 'X\(/\)' \| . 2>/dev/null || +$as_echo X/"$0" | + sed '/^.*\/\([^/][^/]*\)\/*$/{ + s//\1/ + q + } + /^X\/\(\/\/\)$/{ + s//\1/ + q + } + /^X\/\(\/\).*/{ + s//\1/ + q + } + s/.*/./; q'` + +# Avoid depending upon Character Ranges. +as_cr_letters='abcdefghijklmnopqrstuvwxyz' +as_cr_LETTERS='ABCDEFGHIJKLMNOPQRSTUVWXYZ' +as_cr_Letters=$as_cr_letters$as_cr_LETTERS +as_cr_digits='0123456789' +as_cr_alnum=$as_cr_Letters$as_cr_digits + +ECHO_C= ECHO_N= ECHO_T= +case `echo -n x` in #((((( +-n*) + case `echo 'xy\c'` in + *c*) ECHO_T=' ';; # ECHO_T is single tab character. + xy) ECHO_C='\c';; + *) echo `echo ksh88 bug on AIX 6.1` > /dev/null + ECHO_T=' ';; + esac;; +*) + ECHO_N='-n';; +esac + +rm -f conf$$ conf$$.exe conf$$.file +if test -d conf$$.dir; then + rm -f conf$$.dir/conf$$.file +else + rm -f conf$$.dir + mkdir conf$$.dir 2>/dev/null +fi +if (echo >conf$$.file) 2>/dev/null; then + if ln -s conf$$.file conf$$ 2>/dev/null; then + as_ln_s='ln -s' + # ... but there are two gotchas: + # 1) On MSYS, both `ln -s file dir' and `ln file dir' fail. + # 2) DJGPP < 2.04 has no symlinks; `ln -s' creates a wrapper executable. + # In both cases, we have to default to `cp -p'. + ln -s conf$$.file conf$$.dir 2>/dev/null && test ! -f conf$$.exe || + as_ln_s='cp -p' + elif ln conf$$.file conf$$ 2>/dev/null; then + as_ln_s=ln + else + as_ln_s='cp -p' + fi +else + as_ln_s='cp -p' +fi +rm -f conf$$ conf$$.exe conf$$.dir/conf$$.file conf$$.file +rmdir conf$$.dir 2>/dev/null + + +# as_fn_mkdir_p +# ------------- +# Create "$as_dir" as a directory, including parents if necessary. +as_fn_mkdir_p () +{ + + case $as_dir in #( + -*) as_dir=./$as_dir;; + esac + test -d "$as_dir" || eval $as_mkdir_p || { + as_dirs= + while :; do + case $as_dir in #( + *\'*) as_qdir=`$as_echo "$as_dir" | sed "s/'/'\\\\\\\\''/g"`;; #'( + *) as_qdir=$as_dir;; + esac + as_dirs="'$as_qdir' $as_dirs" + as_dir=`$as_dirname -- "$as_dir" || +$as_expr X"$as_dir" : 'X\(.*[^/]\)//*[^/][^/]*/*$' \| \ + X"$as_dir" : 'X\(//\)[^/]' \| \ + X"$as_dir" : 'X\(//\)$' \| \ + X"$as_dir" : 'X\(/\)' \| . 2>/dev/null || +$as_echo X"$as_dir" | + sed '/^X\(.*[^/]\)\/\/*[^/][^/]*\/*$/{ + s//\1/ + q + } + /^X\(\/\/\)[^/].*/{ + s//\1/ + q + } + /^X\(\/\/\)$/{ + s//\1/ + q + } + /^X\(\/\).*/{ + s//\1/ + q + } + s/.*/./; q'` + test -d "$as_dir" && break + done + test -z "$as_dirs" || eval "mkdir $as_dirs" + } || test -d "$as_dir" || as_fn_error $? "cannot create directory $as_dir" + + +} # as_fn_mkdir_p +if mkdir -p . 2>/dev/null; then + as_mkdir_p='mkdir -p "$as_dir"' +else + test -d ./-p && rmdir ./-p + as_mkdir_p=false +fi + +if test -x / >/dev/null 2>&1; then + as_test_x='test -x' +else + if ls -dL / >/dev/null 2>&1; then + as_ls_L_option=L + else + as_ls_L_option= + fi + as_test_x=' + eval sh -c '\'' + if test -d "$1"; then + test -d "$1/."; + else + case $1 in #( + -*)set "./$1";; + esac; + case `ls -ld'$as_ls_L_option' "$1" 2>/dev/null` in #(( + ???[sx]*):;;*)false;;esac;fi + '\'' sh + ' +fi +as_executable_p=$as_test_x + +# Sed expression to map a string onto a valid CPP name. +as_tr_cpp="eval sed 'y%*$as_cr_letters%P$as_cr_LETTERS%;s%[^_$as_cr_alnum]%_%g'" + +# Sed expression to map a string onto a valid variable name. +as_tr_sh="eval sed 'y%*+%pp%;s%[^_$as_cr_alnum]%_%g'" + + +exec 6>&1 +## ----------------------------------- ## +## Main body of $CONFIG_STATUS script. ## +## ----------------------------------- ## +_ASEOF +test $as_write_fail = 0 && chmod +x $CONFIG_STATUS || ac_write_fail=1 + +cat >>$CONFIG_STATUS <<\_ACEOF || ac_write_fail=1 +# Save the log message, to keep $0 and so on meaningful, and to +# report actual input values of CONFIG_FILES etc. instead of their +# values after options handling. +ac_log=" +This file was extended by nife $as_me 0.44, which was +generated by GNU Autoconf 2.67. Invocation command line was + + CONFIG_FILES = $CONFIG_FILES + CONFIG_HEADERS = $CONFIG_HEADERS + CONFIG_LINKS = $CONFIG_LINKS + CONFIG_COMMANDS = $CONFIG_COMMANDS + $ $0 $@ + +on `(hostname || uname -n) 2>/dev/null | sed 1q` +" + +_ACEOF + +case $ac_config_files in *" +"*) set x $ac_config_files; shift; ac_config_files=$*;; +esac + +case $ac_config_headers in *" +"*) set x $ac_config_headers; shift; ac_config_headers=$*;; +esac + + +cat >>$CONFIG_STATUS <<_ACEOF || ac_write_fail=1 +# Files that config.status was made for. +config_files="$ac_config_files" +config_headers="$ac_config_headers" +config_commands="$ac_config_commands" + +_ACEOF + +cat >>$CONFIG_STATUS <<\_ACEOF || ac_write_fail=1 +ac_cs_usage="\ +\`$as_me' instantiates files and other configuration actions +from templates according to the current configuration. Unless the files +and actions are specified as TAGs, all are instantiated by default. + +Usage: $0 [OPTION]... [TAG]... + + -h, --help print this help, then exit + -V, --version print version number and configuration settings, then exit + --config print configuration, then exit + -q, --quiet, --silent + do not print progress messages + -d, --debug don't remove temporary files + --recheck update $as_me by reconfiguring in the same conditions + --file=FILE[:TEMPLATE] + instantiate the configuration file FILE + --header=FILE[:TEMPLATE] + instantiate the configuration header FILE + +Configuration files: +$config_files + +Configuration headers: +$config_headers + +Configuration commands: +$config_commands + +Report bugs to ." + +_ACEOF +cat >>$CONFIG_STATUS <<_ACEOF || ac_write_fail=1 +ac_cs_config="`$as_echo "$ac_configure_args" | sed 's/^ //; s/[\\""\`\$]/\\\\&/g'`" +ac_cs_version="\\ +nife config.status 0.44 +configured by $0, generated by GNU Autoconf 2.67, + with options \\"\$ac_cs_config\\" + +Copyright (C) 2010 Free Software Foundation, Inc. +This config.status script is free software; the Free Software Foundation +gives unlimited permission to copy, distribute and modify it." + +ac_pwd='$ac_pwd' +srcdir='$srcdir' +INSTALL='$INSTALL' +AWK='$AWK' +test -n "\$AWK" || AWK=awk +_ACEOF + +cat >>$CONFIG_STATUS <<\_ACEOF || ac_write_fail=1 +# The default lists apply if the user does not specify any file. +ac_need_defaults=: +while test $# != 0 +do + case $1 in + --*=?*) + ac_option=`expr "X$1" : 'X\([^=]*\)='` + ac_optarg=`expr "X$1" : 'X[^=]*=\(.*\)'` + ac_shift=: + ;; + --*=) + ac_option=`expr "X$1" : 'X\([^=]*\)='` + ac_optarg= + ac_shift=: + ;; + *) + ac_option=$1 + ac_optarg=$2 + ac_shift=shift + ;; + esac + + case $ac_option in + # Handling of the options. + -recheck | --recheck | --rechec | --reche | --rech | --rec | --re | --r) + ac_cs_recheck=: ;; + --version | --versio | --versi | --vers | --ver | --ve | --v | -V ) + $as_echo "$ac_cs_version"; exit ;; + --config | --confi | --conf | --con | --co | --c ) + $as_echo "$ac_cs_config"; exit ;; + --debug | --debu | --deb | --de | --d | -d ) + debug=: ;; + --file | --fil | --fi | --f ) + $ac_shift + case $ac_optarg in + *\'*) ac_optarg=`$as_echo "$ac_optarg" | sed "s/'/'\\\\\\\\''/g"` ;; + '') as_fn_error $? "missing file argument" ;; + esac + as_fn_append CONFIG_FILES " '$ac_optarg'" + ac_need_defaults=false;; + --header | --heade | --head | --hea ) + $ac_shift + case $ac_optarg in + *\'*) ac_optarg=`$as_echo "$ac_optarg" | sed "s/'/'\\\\\\\\''/g"` ;; + esac + as_fn_append CONFIG_HEADERS " '$ac_optarg'" + ac_need_defaults=false;; + --he | --h) + # Conflict between --help and --header + as_fn_error $? "ambiguous option: \`$1' +Try \`$0 --help' for more information.";; + --help | --hel | -h ) + $as_echo "$ac_cs_usage"; exit ;; + -q | -quiet | --quiet | --quie | --qui | --qu | --q \ + | -silent | --silent | --silen | --sile | --sil | --si | --s) + ac_cs_silent=: ;; + + # This is an error. + -*) as_fn_error $? "unrecognized option: \`$1' +Try \`$0 --help' for more information." ;; + + *) as_fn_append ac_config_targets " $1" + ac_need_defaults=false ;; + + esac + shift +done + +ac_configure_extra_args= + +if $ac_cs_silent; then + exec 6>/dev/null + ac_configure_extra_args="$ac_configure_extra_args --silent" +fi + +_ACEOF +cat >>$CONFIG_STATUS <<_ACEOF || ac_write_fail=1 +if \$ac_cs_recheck; then + set X '$SHELL' '$0' $ac_configure_args \$ac_configure_extra_args --no-create --no-recursion + shift + \$as_echo "running CONFIG_SHELL=$SHELL \$*" >&6 + CONFIG_SHELL='$SHELL' + export CONFIG_SHELL + exec "\$@" +fi + +_ACEOF +cat >>$CONFIG_STATUS <<\_ACEOF || ac_write_fail=1 +exec 5>>config.log +{ + echo + sed 'h;s/./-/g;s/^.../## /;s/...$/ ##/;p;x;p;x' <<_ASBOX +## Running $as_me. ## +_ASBOX + $as_echo "$ac_log" +} >&5 + +_ACEOF +cat >>$CONFIG_STATUS <<_ACEOF || ac_write_fail=1 +# +# INIT-COMMANDS +# +AMDEP_TRUE="$AMDEP_TRUE" ac_aux_dir="$ac_aux_dir" + +_ACEOF + +cat >>$CONFIG_STATUS <<\_ACEOF || ac_write_fail=1 + +# Handling of arguments. +for ac_config_target in $ac_config_targets +do + case $ac_config_target in + "config.h") CONFIG_HEADERS="$CONFIG_HEADERS config.h" ;; + "depfiles") CONFIG_COMMANDS="$CONFIG_COMMANDS depfiles" ;; + "Makefile") CONFIG_FILES="$CONFIG_FILES Makefile" ;; + "src/Makefile") CONFIG_FILES="$CONFIG_FILES src/Makefile" ;; + + *) as_fn_error $? "invalid argument: \`$ac_config_target'" "$LINENO" 5 ;; + esac +done + + +# If the user did not use the arguments to specify the items to instantiate, +# then the envvar interface is used. Set only those that are not. +# We use the long form for the default assignment because of an extremely +# bizarre bug on SunOS 4.1.3. +if $ac_need_defaults; then + test "${CONFIG_FILES+set}" = set || CONFIG_FILES=$config_files + test "${CONFIG_HEADERS+set}" = set || CONFIG_HEADERS=$config_headers + test "${CONFIG_COMMANDS+set}" = set || CONFIG_COMMANDS=$config_commands +fi + +# Have a temporary directory for convenience. Make it in the build tree +# simply because there is no reason against having it here, and in addition, +# creating and moving files from /tmp can sometimes cause problems. +# Hook for its removal unless debugging. +# Note that there is a small window in which the directory will not be cleaned: +# after its creation but before its name has been assigned to `$tmp'. +$debug || +{ + tmp= + trap 'exit_status=$? + { test -z "$tmp" || test ! -d "$tmp" || rm -fr "$tmp"; } && exit $exit_status +' 0 + trap 'as_fn_exit 1' 1 2 13 15 +} +# Create a (secure) tmp directory for tmp files. + +{ + tmp=`(umask 077 && mktemp -d "./confXXXXXX") 2>/dev/null` && + test -n "$tmp" && test -d "$tmp" +} || +{ + tmp=./conf$$-$RANDOM + (umask 077 && mkdir "$tmp") +} || as_fn_error $? "cannot create a temporary directory in ." "$LINENO" 5 + +# Set up the scripts for CONFIG_FILES section. +# No need to generate them if there are no CONFIG_FILES. +# This happens for instance with `./config.status config.h'. +if test -n "$CONFIG_FILES"; then + + +ac_cr=`echo X | tr X '\015'` +# On cygwin, bash can eat \r inside `` if the user requested igncr. +# But we know of no other shell where ac_cr would be empty at this +# point, so we can use a bashism as a fallback. +if test "x$ac_cr" = x; then + eval ac_cr=\$\'\\r\' +fi +ac_cs_awk_cr=`$AWK 'BEGIN { print "a\rb" }' /dev/null` +if test "$ac_cs_awk_cr" = "a${ac_cr}b"; then + ac_cs_awk_cr='\\r' +else + ac_cs_awk_cr=$ac_cr +fi + +echo 'BEGIN {' >"$tmp/subs1.awk" && +_ACEOF + + +{ + echo "cat >conf$$subs.awk <<_ACEOF" && + echo "$ac_subst_vars" | sed 's/.*/&!$&$ac_delim/' && + echo "_ACEOF" +} >conf$$subs.sh || + as_fn_error $? "could not make $CONFIG_STATUS" "$LINENO" 5 +ac_delim_num=`echo "$ac_subst_vars" | grep -c '^'` +ac_delim='%!_!# ' +for ac_last_try in false false false false false :; do + . ./conf$$subs.sh || + as_fn_error $? "could not make $CONFIG_STATUS" "$LINENO" 5 + + ac_delim_n=`sed -n "s/.*$ac_delim\$/X/p" conf$$subs.awk | grep -c X` + if test $ac_delim_n = $ac_delim_num; then + break + elif $ac_last_try; then + as_fn_error $? "could not make $CONFIG_STATUS" "$LINENO" 5 + else + ac_delim="$ac_delim!$ac_delim _$ac_delim!! " + fi +done +rm -f conf$$subs.sh + +cat >>$CONFIG_STATUS <<_ACEOF || ac_write_fail=1 +cat >>"\$tmp/subs1.awk" <<\\_ACAWK && +_ACEOF +sed -n ' +h +s/^/S["/; s/!.*/"]=/ +p +g +s/^[^!]*!// +:repl +t repl +s/'"$ac_delim"'$// +t delim +:nl +h +s/\(.\{148\}\)..*/\1/ +t more1 +s/["\\]/\\&/g; s/^/"/; s/$/\\n"\\/ +p +n +b repl +:more1 +s/["\\]/\\&/g; s/^/"/; s/$/"\\/ +p +g +s/.\{148\}// +t nl +:delim +h +s/\(.\{148\}\)..*/\1/ +t more2 +s/["\\]/\\&/g; s/^/"/; s/$/"/ +p +b +:more2 +s/["\\]/\\&/g; s/^/"/; s/$/"\\/ +p +g +s/.\{148\}// +t delim +' >$CONFIG_STATUS || ac_write_fail=1 +rm -f conf$$subs.awk +cat >>$CONFIG_STATUS <<_ACEOF || ac_write_fail=1 +_ACAWK +cat >>"\$tmp/subs1.awk" <<_ACAWK && + for (key in S) S_is_set[key] = 1 + FS = "" + +} +{ + line = $ 0 + nfields = split(line, field, "@") + substed = 0 + len = length(field[1]) + for (i = 2; i < nfields; i++) { + key = field[i] + keylen = length(key) + if (S_is_set[key]) { + value = S[key] + line = substr(line, 1, len) "" value "" substr(line, len + keylen + 3) + len += length(value) + length(field[++i]) + substed = 1 + } else + len += 1 + keylen + } + + print line +} + +_ACAWK +_ACEOF +cat >>$CONFIG_STATUS <<\_ACEOF || ac_write_fail=1 +if sed "s/$ac_cr//" < /dev/null > /dev/null 2>&1; then + sed "s/$ac_cr\$//; s/$ac_cr/$ac_cs_awk_cr/g" +else + cat +fi < "$tmp/subs1.awk" > "$tmp/subs.awk" \ + || as_fn_error $? "could not setup config files machinery" "$LINENO" 5 +_ACEOF + +# VPATH may cause trouble with some makes, so we remove sole $(srcdir), +# ${srcdir} and @srcdir@ entries from VPATH if srcdir is ".", strip leading and +# trailing colons and then remove the whole line if VPATH becomes empty +# (actually we leave an empty line to preserve line numbers). +if test "x$srcdir" = x.; then + ac_vpsub='/^[ ]*VPATH[ ]*=[ ]*/{ +h +s/// +s/^/:/ +s/[ ]*$/:/ +s/:\$(srcdir):/:/g +s/:\${srcdir}:/:/g +s/:@srcdir@:/:/g +s/^:*// +s/:*$// +x +s/\(=[ ]*\).*/\1/ +G +s/\n// +s/^[^=]*=[ ]*$// +}' +fi + +cat >>$CONFIG_STATUS <<\_ACEOF || ac_write_fail=1 +fi # test -n "$CONFIG_FILES" + +# Set up the scripts for CONFIG_HEADERS section. +# No need to generate them if there are no CONFIG_HEADERS. +# This happens for instance with `./config.status Makefile'. +if test -n "$CONFIG_HEADERS"; then +cat >"$tmp/defines.awk" <<\_ACAWK || +BEGIN { +_ACEOF + +# Transform confdefs.h into an awk script `defines.awk', embedded as +# here-document in config.status, that substitutes the proper values into +# config.h.in to produce config.h. + +# Create a delimiter string that does not exist in confdefs.h, to ease +# handling of long lines. +ac_delim='%!_!# ' +for ac_last_try in false false :; do + ac_t=`sed -n "/$ac_delim/p" confdefs.h` + if test -z "$ac_t"; then + break + elif $ac_last_try; then + as_fn_error $? "could not make $CONFIG_HEADERS" "$LINENO" 5 + else + ac_delim="$ac_delim!$ac_delim _$ac_delim!! " + fi +done + +# For the awk script, D is an array of macro values keyed by name, +# likewise P contains macro parameters if any. Preserve backslash +# newline sequences. + +ac_word_re=[_$as_cr_Letters][_$as_cr_alnum]* +sed -n ' +s/.\{148\}/&'"$ac_delim"'/g +t rset +:rset +s/^[ ]*#[ ]*define[ ][ ]*/ / +t def +d +:def +s/\\$// +t bsnl +s/["\\]/\\&/g +s/^ \('"$ac_word_re"'\)\(([^()]*)\)[ ]*\(.*\)/P["\1"]="\2"\ +D["\1"]=" \3"/p +s/^ \('"$ac_word_re"'\)[ ]*\(.*\)/D["\1"]=" \2"/p +d +:bsnl +s/["\\]/\\&/g +s/^ \('"$ac_word_re"'\)\(([^()]*)\)[ ]*\(.*\)/P["\1"]="\2"\ +D["\1"]=" \3\\\\\\n"\\/p +t cont +s/^ \('"$ac_word_re"'\)[ ]*\(.*\)/D["\1"]=" \2\\\\\\n"\\/p +t cont +d +:cont +n +s/.\{148\}/&'"$ac_delim"'/g +t clear +:clear +s/\\$// +t bsnlc +s/["\\]/\\&/g; s/^/"/; s/$/"/p +d +:bsnlc +s/["\\]/\\&/g; s/^/"/; s/$/\\\\\\n"\\/p +b cont +' >$CONFIG_STATUS || ac_write_fail=1 + +cat >>$CONFIG_STATUS <<_ACEOF || ac_write_fail=1 + for (key in D) D_is_set[key] = 1 + FS = "" +} +/^[\t ]*#[\t ]*(define|undef)[\t ]+$ac_word_re([\t (]|\$)/ { + line = \$ 0 + split(line, arg, " ") + if (arg[1] == "#") { + defundef = arg[2] + mac1 = arg[3] + } else { + defundef = substr(arg[1], 2) + mac1 = arg[2] + } + split(mac1, mac2, "(") #) + macro = mac2[1] + prefix = substr(line, 1, index(line, defundef) - 1) + if (D_is_set[macro]) { + # Preserve the white space surrounding the "#". + print prefix "define", macro P[macro] D[macro] + next + } else { + # Replace #undef with comments. This is necessary, for example, + # in the case of _POSIX_SOURCE, which is predefined and required + # on some systems where configure will not decide to define it. + if (defundef == "undef") { + print "/*", prefix defundef, macro, "*/" + next + } + } +} +{ print } +_ACAWK +_ACEOF +cat >>$CONFIG_STATUS <<\_ACEOF || ac_write_fail=1 + as_fn_error $? "could not setup config headers machinery" "$LINENO" 5 +fi # test -n "$CONFIG_HEADERS" + + +eval set X " :F $CONFIG_FILES :H $CONFIG_HEADERS :C $CONFIG_COMMANDS" +shift +for ac_tag +do + case $ac_tag in + :[FHLC]) ac_mode=$ac_tag; continue;; + esac + case $ac_mode$ac_tag in + :[FHL]*:*);; + :L* | :C*:*) as_fn_error $? "invalid tag \`$ac_tag'" "$LINENO" 5 ;; + :[FH]-) ac_tag=-:-;; + :[FH]*) ac_tag=$ac_tag:$ac_tag.in;; + esac + ac_save_IFS=$IFS + IFS=: + set x $ac_tag + IFS=$ac_save_IFS + shift + ac_file=$1 + shift + + case $ac_mode in + :L) ac_source=$1;; + :[FH]) + ac_file_inputs= + for ac_f + do + case $ac_f in + -) ac_f="$tmp/stdin";; + *) # Look for the file first in the build tree, then in the source tree + # (if the path is not absolute). The absolute path cannot be DOS-style, + # because $ac_f cannot contain `:'. + test -f "$ac_f" || + case $ac_f in + [\\/$]*) false;; + *) test -f "$srcdir/$ac_f" && ac_f="$srcdir/$ac_f";; + esac || + as_fn_error 1 "cannot find input file: \`$ac_f'" "$LINENO" 5 ;; + esac + case $ac_f in *\'*) ac_f=`$as_echo "$ac_f" | sed "s/'/'\\\\\\\\''/g"`;; esac + as_fn_append ac_file_inputs " '$ac_f'" + done + + # Let's still pretend it is `configure' which instantiates (i.e., don't + # use $as_me), people would be surprised to read: + # /* config.h. Generated by config.status. */ + configure_input='Generated from '` + $as_echo "$*" | sed 's|^[^:]*/||;s|:[^:]*/|, |g' + `' by configure.' + if test x"$ac_file" != x-; then + configure_input="$ac_file. $configure_input" + { $as_echo "$as_me:${as_lineno-$LINENO}: creating $ac_file" >&5 +$as_echo "$as_me: creating $ac_file" >&6;} + fi + # Neutralize special characters interpreted by sed in replacement strings. + case $configure_input in #( + *\&* | *\|* | *\\* ) + ac_sed_conf_input=`$as_echo "$configure_input" | + sed 's/[\\\\&|]/\\\\&/g'`;; #( + *) ac_sed_conf_input=$configure_input;; + esac + + case $ac_tag in + *:-:* | *:-) cat >"$tmp/stdin" \ + || as_fn_error $? "could not create $ac_file" "$LINENO" 5 ;; + esac + ;; + esac + + ac_dir=`$as_dirname -- "$ac_file" || +$as_expr X"$ac_file" : 'X\(.*[^/]\)//*[^/][^/]*/*$' \| \ + X"$ac_file" : 'X\(//\)[^/]' \| \ + X"$ac_file" : 'X\(//\)$' \| \ + X"$ac_file" : 'X\(/\)' \| . 2>/dev/null || +$as_echo X"$ac_file" | + sed '/^X\(.*[^/]\)\/\/*[^/][^/]*\/*$/{ + s//\1/ + q + } + /^X\(\/\/\)[^/].*/{ + s//\1/ + q + } + /^X\(\/\/\)$/{ + s//\1/ + q + } + /^X\(\/\).*/{ + s//\1/ + q + } + s/.*/./; q'` + as_dir="$ac_dir"; as_fn_mkdir_p + ac_builddir=. + +case "$ac_dir" in +.) ac_dir_suffix= ac_top_builddir_sub=. ac_top_build_prefix= ;; +*) + ac_dir_suffix=/`$as_echo "$ac_dir" | sed 's|^\.[\\/]||'` + # A ".." for each directory in $ac_dir_suffix. + ac_top_builddir_sub=`$as_echo "$ac_dir_suffix" | sed 's|/[^\\/]*|/..|g;s|/||'` + case $ac_top_builddir_sub in + "") ac_top_builddir_sub=. ac_top_build_prefix= ;; + *) ac_top_build_prefix=$ac_top_builddir_sub/ ;; + esac ;; +esac +ac_abs_top_builddir=$ac_pwd +ac_abs_builddir=$ac_pwd$ac_dir_suffix +# for backward compatibility: +ac_top_builddir=$ac_top_build_prefix + +case $srcdir in + .) # We are building in place. + ac_srcdir=. + ac_top_srcdir=$ac_top_builddir_sub + ac_abs_top_srcdir=$ac_pwd ;; + [\\/]* | ?:[\\/]* ) # Absolute name. + ac_srcdir=$srcdir$ac_dir_suffix; + ac_top_srcdir=$srcdir + ac_abs_top_srcdir=$srcdir ;; + *) # Relative name. + ac_srcdir=$ac_top_build_prefix$srcdir$ac_dir_suffix + ac_top_srcdir=$ac_top_build_prefix$srcdir + ac_abs_top_srcdir=$ac_pwd/$srcdir ;; +esac +ac_abs_srcdir=$ac_abs_top_srcdir$ac_dir_suffix + + + case $ac_mode in + :F) + # + # CONFIG_FILE + # + + case $INSTALL in + [\\/$]* | ?:[\\/]* ) ac_INSTALL=$INSTALL ;; + *) ac_INSTALL=$ac_top_build_prefix$INSTALL ;; + esac +_ACEOF + +cat >>$CONFIG_STATUS <<\_ACEOF || ac_write_fail=1 +# If the template does not know about datarootdir, expand it. +# FIXME: This hack should be removed a few years after 2.60. +ac_datarootdir_hack=; ac_datarootdir_seen= +ac_sed_dataroot=' +/datarootdir/ { + p + q +} +/@datadir@/p +/@docdir@/p +/@infodir@/p +/@localedir@/p +/@mandir@/p' +case `eval "sed -n \"\$ac_sed_dataroot\" $ac_file_inputs"` in +*datarootdir*) ac_datarootdir_seen=yes;; +*@datadir@*|*@docdir@*|*@infodir@*|*@localedir@*|*@mandir@*) + { $as_echo "$as_me:${as_lineno-$LINENO}: WARNING: $ac_file_inputs seems to ignore the --datarootdir setting" >&5 +$as_echo "$as_me: WARNING: $ac_file_inputs seems to ignore the --datarootdir setting" >&2;} +_ACEOF +cat >>$CONFIG_STATUS <<_ACEOF || ac_write_fail=1 + ac_datarootdir_hack=' + s&@datadir@&$datadir&g + s&@docdir@&$docdir&g + s&@infodir@&$infodir&g + s&@localedir@&$localedir&g + s&@mandir@&$mandir&g + s&\\\${datarootdir}&$datarootdir&g' ;; +esac +_ACEOF + +# Neutralize VPATH when `$srcdir' = `.'. +# Shell code in configure.ac might set extrasub. +# FIXME: do we really want to maintain this feature? +cat >>$CONFIG_STATUS <<_ACEOF || ac_write_fail=1 +ac_sed_extra="$ac_vpsub +$extrasub +_ACEOF +cat >>$CONFIG_STATUS <<\_ACEOF || ac_write_fail=1 +:t +/@[a-zA-Z_][a-zA-Z_0-9]*@/!b +s|@configure_input@|$ac_sed_conf_input|;t t +s&@top_builddir@&$ac_top_builddir_sub&;t t +s&@top_build_prefix@&$ac_top_build_prefix&;t t +s&@srcdir@&$ac_srcdir&;t t +s&@abs_srcdir@&$ac_abs_srcdir&;t t +s&@top_srcdir@&$ac_top_srcdir&;t t +s&@abs_top_srcdir@&$ac_abs_top_srcdir&;t t +s&@builddir@&$ac_builddir&;t t +s&@abs_builddir@&$ac_abs_builddir&;t t +s&@abs_top_builddir@&$ac_abs_top_builddir&;t t +s&@INSTALL@&$ac_INSTALL&;t t +$ac_datarootdir_hack +" +eval sed \"\$ac_sed_extra\" "$ac_file_inputs" | $AWK -f "$tmp/subs.awk" >$tmp/out \ + || as_fn_error $? "could not create $ac_file" "$LINENO" 5 + +test -z "$ac_datarootdir_hack$ac_datarootdir_seen" && + { ac_out=`sed -n '/\${datarootdir}/p' "$tmp/out"`; test -n "$ac_out"; } && + { ac_out=`sed -n '/^[ ]*datarootdir[ ]*:*=/p' "$tmp/out"`; test -z "$ac_out"; } && + { $as_echo "$as_me:${as_lineno-$LINENO}: WARNING: $ac_file contains a reference to the variable \`datarootdir' +which seems to be undefined. Please make sure it is defined" >&5 +$as_echo "$as_me: WARNING: $ac_file contains a reference to the variable \`datarootdir' +which seems to be undefined. Please make sure it is defined" >&2;} + + rm -f "$tmp/stdin" + case $ac_file in + -) cat "$tmp/out" && rm -f "$tmp/out";; + *) rm -f "$ac_file" && mv "$tmp/out" "$ac_file";; + esac \ + || as_fn_error $? "could not create $ac_file" "$LINENO" 5 + ;; + :H) + # + # CONFIG_HEADER + # + if test x"$ac_file" != x-; then + { + $as_echo "/* $configure_input */" \ + && eval '$AWK -f "$tmp/defines.awk"' "$ac_file_inputs" + } >"$tmp/config.h" \ + || as_fn_error $? "could not create $ac_file" "$LINENO" 5 + if diff "$ac_file" "$tmp/config.h" >/dev/null 2>&1; then + { $as_echo "$as_me:${as_lineno-$LINENO}: $ac_file is unchanged" >&5 +$as_echo "$as_me: $ac_file is unchanged" >&6;} + else + rm -f "$ac_file" + mv "$tmp/config.h" "$ac_file" \ + || as_fn_error $? "could not create $ac_file" "$LINENO" 5 + fi + else + $as_echo "/* $configure_input */" \ + && eval '$AWK -f "$tmp/defines.awk"' "$ac_file_inputs" \ + || as_fn_error $? "could not create -" "$LINENO" 5 + fi +# Compute "$ac_file"'s index in $config_headers. +_am_stamp_count=1 +for _am_header in $config_headers :; do + case $_am_header in + "$ac_file" | "$ac_file":* ) + break ;; + * ) + _am_stamp_count=`expr $_am_stamp_count + 1` ;; + esac +done +echo "timestamp for "$ac_file"" >`$as_dirname -- "$ac_file" || +$as_expr X"$ac_file" : 'X\(.*[^/]\)//*[^/][^/]*/*$' \| \ + X"$ac_file" : 'X\(//\)[^/]' \| \ + X"$ac_file" : 'X\(//\)$' \| \ + X"$ac_file" : 'X\(/\)' \| . 2>/dev/null || +$as_echo X"$ac_file" | + sed '/^X\(.*[^/]\)\/\/*[^/][^/]*\/*$/{ + s//\1/ + q + } + /^X\(\/\/\)[^/].*/{ + s//\1/ + q + } + /^X\(\/\/\)$/{ + s//\1/ + q + } + /^X\(\/\).*/{ + s//\1/ + q + } + s/.*/./; q'`/stamp-h$_am_stamp_count + ;; + + :C) { $as_echo "$as_me:${as_lineno-$LINENO}: executing $ac_file commands" >&5 +$as_echo "$as_me: executing $ac_file commands" >&6;} + ;; + esac + + + case $ac_file$ac_mode in + "depfiles":C) test x"$AMDEP_TRUE" != x"" || for mf in $CONFIG_FILES; do + # Strip MF so we end up with the name of the file. + mf=`echo "$mf" | sed -e 's/:.*$//'` + # Check whether this is an Automake generated Makefile or not. + # We used to match only the files named `Makefile.in', but + # some people rename them; so instead we look at the file content. + # Grep'ing the first line is not enough: some people post-process + # each Makefile.in and add a new line on top of each file to say so. + # So let's grep whole file. + if grep '^#.*generated by automake' $mf > /dev/null 2>&1; then + dirpart=`$as_dirname -- "$mf" || +$as_expr X"$mf" : 'X\(.*[^/]\)//*[^/][^/]*/*$' \| \ + X"$mf" : 'X\(//\)[^/]' \| \ + X"$mf" : 'X\(//\)$' \| \ + X"$mf" : 'X\(/\)' \| . 2>/dev/null || +$as_echo X"$mf" | + sed '/^X\(.*[^/]\)\/\/*[^/][^/]*\/*$/{ + s//\1/ + q + } + /^X\(\/\/\)[^/].*/{ + s//\1/ + q + } + /^X\(\/\/\)$/{ + s//\1/ + q + } + /^X\(\/\).*/{ + s//\1/ + q + } + s/.*/./; q'` + else + continue + fi + # Extract the definition of DEPDIR, am__include, and am__quote + # from the Makefile without running `make'. + DEPDIR=`sed -n 's/^DEPDIR = //p' < "$mf"` + test -z "$DEPDIR" && continue + am__include=`sed -n 's/^am__include = //p' < "$mf"` + test -z "am__include" && continue + am__quote=`sed -n 's/^am__quote = //p' < "$mf"` + # When using ansi2knr, U may be empty or an underscore; expand it + U=`sed -n 's/^U = //p' < "$mf"` + # Find all dependency output files, they are included files with + # $(DEPDIR) in their names. We invoke sed twice because it is the + # simplest approach to changing $(DEPDIR) to its actual value in the + # expansion. + for file in `sed -n " + s/^$am__include $am__quote\(.*(DEPDIR).*\)$am__quote"'$/\1/p' <"$mf" | \ + sed -e 's/\$(DEPDIR)/'"$DEPDIR"'/g' -e 's/\$U/'"$U"'/g'`; do + # Make sure the directory exists. + test -f "$dirpart/$file" && continue + fdir=`$as_dirname -- "$file" || +$as_expr X"$file" : 'X\(.*[^/]\)//*[^/][^/]*/*$' \| \ + X"$file" : 'X\(//\)[^/]' \| \ + X"$file" : 'X\(//\)$' \| \ + X"$file" : 'X\(/\)' \| . 2>/dev/null || +$as_echo X"$file" | + sed '/^X\(.*[^/]\)\/\/*[^/][^/]*\/*$/{ + s//\1/ + q + } + /^X\(\/\/\)[^/].*/{ + s//\1/ + q + } + /^X\(\/\/\)$/{ + s//\1/ + q + } + /^X\(\/\).*/{ + s//\1/ + q + } + s/.*/./; q'` + as_dir=$dirpart/$fdir; as_fn_mkdir_p + # echo "creating $dirpart/$file" + echo '# dummy' > "$dirpart/$file" + done +done + ;; + + esac +done # for ac_tag + + +as_fn_exit 0 +_ACEOF +ac_clean_files=$ac_clean_files_save + +test $ac_write_fail = 0 || + as_fn_error $? "write failure creating $CONFIG_STATUS" "$LINENO" 5 + + +# configure is writing to config.log, and then calls config.status. +# config.status does its own redirection, appending to config.log. +# Unfortunately, on DOS this fails, as config.log is still kept open +# by configure, so config.status won't be able to write to it; its +# output is simply discarded. So we exec the FD to /dev/null, +# effectively closing config.log, so it can be properly (re)opened and +# appended to by config.status. When coming back to configure, we +# need to make the FD available again. +if test "$no_create" != yes; then + ac_cs_success=: + ac_config_status_args= + test "$silent" = yes && + ac_config_status_args="$ac_config_status_args --quiet" + exec 5>/dev/null + $SHELL $CONFIG_STATUS $ac_config_status_args || ac_cs_success=false + exec 5>>config.log + # Use ||, not &&, to avoid exiting from the if with $? = 1, which + # would make configure fail if this is the last instruction. + $ac_cs_success || as_fn_exit 1 +fi +if test -n "$ac_unrecognized_opts" && test "$enable_option_checking" != no; then + { $as_echo "$as_me:${as_lineno-$LINENO}: WARNING: unrecognized options: $ac_unrecognized_opts" >&5 +$as_echo "$as_me: WARNING: unrecognized options: $ac_unrecognized_opts" >&2;} +fi + diff --git a/configure.ac b/configure.ac new file mode 100644 index 0000000..8ee165b --- /dev/null +++ b/configure.ac @@ -0,0 +1,39 @@ +# -*- Autoconf -*- +# Process this file with autoconf to produce a configure script. + +AC_PREREQ([2.67]) +AC_INIT([nife], [0.44], [nife@seriane.fr]) +AM_INIT_AUTOMAKE + +AC_CONFIG_SRCDIR([src/tasks.c]) +AC_CONFIG_HEADERS([config.h]) + +# Checks for programs. +AC_PROG_CC +AC_PROG_MAKE_SET + +# Checks for libraries. + +# Checks for header files. +AC_CHECK_HEADERS([arpa/inet.h fcntl.h inttypes.h netdb.h stdlib.h string.h strings.h sys/socket.h sys/time.h termios.h unistd.h]) +AC_CHECK_HEADERS([pthread.h]) +AC_CHECK_HEADERS([comedilib.h]) + +# Checks for typedefs, structures, and compiler characteristics. +AC_HEADER_STDBOOL +AC_TYPE_PID_T + +# Checks for library functions. +AC_FUNC_FORK +AC_FUNC_MALLOC +AC_FUNC_STRTOD +AC_CHECK_FUNCS([bzero dup2 floor gethostbyname gettimeofday inet_ntoa pow rint socket strchr]) + +AC_SEARCH_LIBS(pow,m) +AC_SEARCH_LIBS(comedi_get_cmd_src_mask,comedi) +AC_SEARCH_LIBS(socket,socket) +AC_SEARCH_LIBS(pthread_create,pthread) +AC_SEARCH_LIBS(inet_ntoa,nsl) + +AC_CONFIG_FILES([Makefile src/Makefile]) +AC_OUTPUT diff --git a/depcomp b/depcomp new file mode 100755 index 0000000..04701da --- /dev/null +++ b/depcomp @@ -0,0 +1,530 @@ +#! /bin/sh +# depcomp - compile a program generating dependencies as side-effects + +scriptversion=2005-07-09.11 + +# Copyright (C) 1999, 2000, 2003, 2004, 2005 Free Software Foundation, Inc. + +# This program is free software; you can redistribute it and/or modify +# it under the terms of the GNU General Public License as published by +# the Free Software Foundation; either version 2, or (at your option) +# any later version. + +# This program is distributed in the hope that it will be useful, +# but WITHOUT ANY WARRANTY; without even the implied warranty of +# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +# GNU General Public License for more details. + +# You should have received a copy of the GNU General Public License +# along with this program; if not, write to the Free Software +# Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA +# 02110-1301, USA. + +# As a special exception to the GNU General Public License, if you +# distribute this file as part of a program that contains a +# configuration script generated by Autoconf, you may include it under +# the same distribution terms that you use for the rest of that program. + +# Originally written by Alexandre Oliva . + +case $1 in + '') + echo "$0: No command. Try \`$0 --help' for more information." 1>&2 + exit 1; + ;; + -h | --h*) + cat <<\EOF +Usage: depcomp [--help] [--version] PROGRAM [ARGS] + +Run PROGRAMS ARGS to compile a file, generating dependencies +as side-effects. + +Environment variables: + depmode Dependency tracking mode. + source Source file read by `PROGRAMS ARGS'. + object Object file output by `PROGRAMS ARGS'. + DEPDIR directory where to store dependencies. + depfile Dependency file to output. + tmpdepfile Temporary file to use when outputing dependencies. + libtool Whether libtool is used (yes/no). + +Report bugs to . +EOF + exit $? + ;; + -v | --v*) + echo "depcomp $scriptversion" + exit $? + ;; +esac + +if test -z "$depmode" || test -z "$source" || test -z "$object"; then + echo "depcomp: Variables source, object and depmode must be set" 1>&2 + exit 1 +fi + +# Dependencies for sub/bar.o or sub/bar.obj go into sub/.deps/bar.Po. +depfile=${depfile-`echo "$object" | + sed 's|[^\\/]*$|'${DEPDIR-.deps}'/&|;s|\.\([^.]*\)$|.P\1|;s|Pobj$|Po|'`} +tmpdepfile=${tmpdepfile-`echo "$depfile" | sed 's/\.\([^.]*\)$/.T\1/'`} + +rm -f "$tmpdepfile" + +# Some modes work just like other modes, but use different flags. We +# parameterize here, but still list the modes in the big case below, +# to make depend.m4 easier to write. Note that we *cannot* use a case +# here, because this file can only contain one case statement. +if test "$depmode" = hp; then + # HP compiler uses -M and no extra arg. + gccflag=-M + depmode=gcc +fi + +if test "$depmode" = dashXmstdout; then + # This is just like dashmstdout with a different argument. + dashmflag=-xM + depmode=dashmstdout +fi + +case "$depmode" in +gcc3) +## gcc 3 implements dependency tracking that does exactly what +## we want. Yay! Note: for some reason libtool 1.4 doesn't like +## it if -MD -MP comes after the -MF stuff. Hmm. + "$@" -MT "$object" -MD -MP -MF "$tmpdepfile" + stat=$? + if test $stat -eq 0; then : + else + rm -f "$tmpdepfile" + exit $stat + fi + mv "$tmpdepfile" "$depfile" + ;; + +gcc) +## There are various ways to get dependency output from gcc. Here's +## why we pick this rather obscure method: +## - Don't want to use -MD because we'd like the dependencies to end +## up in a subdir. Having to rename by hand is ugly. +## (We might end up doing this anyway to support other compilers.) +## - The DEPENDENCIES_OUTPUT environment variable makes gcc act like +## -MM, not -M (despite what the docs say). +## - Using -M directly means running the compiler twice (even worse +## than renaming). + if test -z "$gccflag"; then + gccflag=-MD, + fi + "$@" -Wp,"$gccflag$tmpdepfile" + stat=$? + if test $stat -eq 0; then : + else + rm -f "$tmpdepfile" + exit $stat + fi + rm -f "$depfile" + echo "$object : \\" > "$depfile" + alpha=ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz +## The second -e expression handles DOS-style file names with drive letters. + sed -e 's/^[^:]*: / /' \ + -e 's/^['$alpha']:\/[^:]*: / /' < "$tmpdepfile" >> "$depfile" +## This next piece of magic avoids the `deleted header file' problem. +## The problem is that when a header file which appears in a .P file +## is deleted, the dependency causes make to die (because there is +## typically no way to rebuild the header). We avoid this by adding +## dummy dependencies for each header file. Too bad gcc doesn't do +## this for us directly. + tr ' ' ' +' < "$tmpdepfile" | +## Some versions of gcc put a space before the `:'. On the theory +## that the space means something, we add a space to the output as +## well. +## Some versions of the HPUX 10.20 sed can't process this invocation +## correctly. Breaking it into two sed invocations is a workaround. + sed -e 's/^\\$//' -e '/^$/d' -e '/:$/d' | sed -e 's/$/ :/' >> "$depfile" + rm -f "$tmpdepfile" + ;; + +hp) + # This case exists only to let depend.m4 do its work. It works by + # looking at the text of this script. This case will never be run, + # since it is checked for above. + exit 1 + ;; + +sgi) + if test "$libtool" = yes; then + "$@" "-Wp,-MDupdate,$tmpdepfile" + else + "$@" -MDupdate "$tmpdepfile" + fi + stat=$? + if test $stat -eq 0; then : + else + rm -f "$tmpdepfile" + exit $stat + fi + rm -f "$depfile" + + if test -f "$tmpdepfile"; then # yes, the sourcefile depend on other files + echo "$object : \\" > "$depfile" + + # Clip off the initial element (the dependent). Don't try to be + # clever and replace this with sed code, as IRIX sed won't handle + # lines with more than a fixed number of characters (4096 in + # IRIX 6.2 sed, 8192 in IRIX 6.5). We also remove comment lines; + # the IRIX cc adds comments like `#:fec' to the end of the + # dependency line. + tr ' ' ' +' < "$tmpdepfile" \ + | sed -e 's/^.*\.o://' -e 's/#.*$//' -e '/^$/ d' | \ + tr ' +' ' ' >> $depfile + echo >> $depfile + + # The second pass generates a dummy entry for each header file. + tr ' ' ' +' < "$tmpdepfile" \ + | sed -e 's/^.*\.o://' -e 's/#.*$//' -e '/^$/ d' -e 's/$/:/' \ + >> $depfile + else + # The sourcefile does not contain any dependencies, so just + # store a dummy comment line, to avoid errors with the Makefile + # "include basename.Plo" scheme. + echo "#dummy" > "$depfile" + fi + rm -f "$tmpdepfile" + ;; + +aix) + # The C for AIX Compiler uses -M and outputs the dependencies + # in a .u file. In older versions, this file always lives in the + # current directory. Also, the AIX compiler puts `$object:' at the + # start of each line; $object doesn't have directory information. + # Version 6 uses the directory in both cases. + stripped=`echo "$object" | sed 's/\(.*\)\..*$/\1/'` + tmpdepfile="$stripped.u" + if test "$libtool" = yes; then + "$@" -Wc,-M + else + "$@" -M + fi + stat=$? + + if test -f "$tmpdepfile"; then : + else + stripped=`echo "$stripped" | sed 's,^.*/,,'` + tmpdepfile="$stripped.u" + fi + + if test $stat -eq 0; then : + else + rm -f "$tmpdepfile" + exit $stat + fi + + if test -f "$tmpdepfile"; then + outname="$stripped.o" + # Each line is of the form `foo.o: dependent.h'. + # Do two passes, one to just change these to + # `$object: dependent.h' and one to simply `dependent.h:'. + sed -e "s,^$outname:,$object :," < "$tmpdepfile" > "$depfile" + sed -e "s,^$outname: \(.*\)$,\1:," < "$tmpdepfile" >> "$depfile" + else + # The sourcefile does not contain any dependencies, so just + # store a dummy comment line, to avoid errors with the Makefile + # "include basename.Plo" scheme. + echo "#dummy" > "$depfile" + fi + rm -f "$tmpdepfile" + ;; + +icc) + # Intel's C compiler understands `-MD -MF file'. However on + # icc -MD -MF foo.d -c -o sub/foo.o sub/foo.c + # ICC 7.0 will fill foo.d with something like + # foo.o: sub/foo.c + # foo.o: sub/foo.h + # which is wrong. We want: + # sub/foo.o: sub/foo.c + # sub/foo.o: sub/foo.h + # sub/foo.c: + # sub/foo.h: + # ICC 7.1 will output + # foo.o: sub/foo.c sub/foo.h + # and will wrap long lines using \ : + # foo.o: sub/foo.c ... \ + # sub/foo.h ... \ + # ... + + "$@" -MD -MF "$tmpdepfile" + stat=$? + if test $stat -eq 0; then : + else + rm -f "$tmpdepfile" + exit $stat + fi + rm -f "$depfile" + # Each line is of the form `foo.o: dependent.h', + # or `foo.o: dep1.h dep2.h \', or ` dep3.h dep4.h \'. + # Do two passes, one to just change these to + # `$object: dependent.h' and one to simply `dependent.h:'. + sed "s,^[^:]*:,$object :," < "$tmpdepfile" > "$depfile" + # Some versions of the HPUX 10.20 sed can't process this invocation + # correctly. Breaking it into two sed invocations is a workaround. + sed 's,^[^:]*: \(.*\)$,\1,;s/^\\$//;/^$/d;/:$/d' < "$tmpdepfile" | + sed -e 's/$/ :/' >> "$depfile" + rm -f "$tmpdepfile" + ;; + +tru64) + # The Tru64 compiler uses -MD to generate dependencies as a side + # effect. `cc -MD -o foo.o ...' puts the dependencies into `foo.o.d'. + # At least on Alpha/Redhat 6.1, Compaq CCC V6.2-504 seems to put + # dependencies in `foo.d' instead, so we check for that too. + # Subdirectories are respected. + dir=`echo "$object" | sed -e 's|/[^/]*$|/|'` + test "x$dir" = "x$object" && dir= + base=`echo "$object" | sed -e 's|^.*/||' -e 's/\.o$//' -e 's/\.lo$//'` + + if test "$libtool" = yes; then + # With Tru64 cc, shared objects can also be used to make a + # static library. This mecanism is used in libtool 1.4 series to + # handle both shared and static libraries in a single compilation. + # With libtool 1.4, dependencies were output in $dir.libs/$base.lo.d. + # + # With libtool 1.5 this exception was removed, and libtool now + # generates 2 separate objects for the 2 libraries. These two + # compilations output dependencies in in $dir.libs/$base.o.d and + # in $dir$base.o.d. We have to check for both files, because + # one of the two compilations can be disabled. We should prefer + # $dir$base.o.d over $dir.libs/$base.o.d because the latter is + # automatically cleaned when .libs/ is deleted, while ignoring + # the former would cause a distcleancheck panic. + tmpdepfile1=$dir.libs/$base.lo.d # libtool 1.4 + tmpdepfile2=$dir$base.o.d # libtool 1.5 + tmpdepfile3=$dir.libs/$base.o.d # libtool 1.5 + tmpdepfile4=$dir.libs/$base.d # Compaq CCC V6.2-504 + "$@" -Wc,-MD + else + tmpdepfile1=$dir$base.o.d + tmpdepfile2=$dir$base.d + tmpdepfile3=$dir$base.d + tmpdepfile4=$dir$base.d + "$@" -MD + fi + + stat=$? + if test $stat -eq 0; then : + else + rm -f "$tmpdepfile1" "$tmpdepfile2" "$tmpdepfile3" "$tmpdepfile4" + exit $stat + fi + + for tmpdepfile in "$tmpdepfile1" "$tmpdepfile2" "$tmpdepfile3" "$tmpdepfile4" + do + test -f "$tmpdepfile" && break + done + if test -f "$tmpdepfile"; then + sed -e "s,^.*\.[a-z]*:,$object:," < "$tmpdepfile" > "$depfile" + # That's a tab and a space in the []. + sed -e 's,^.*\.[a-z]*:[ ]*,,' -e 's,$,:,' < "$tmpdepfile" >> "$depfile" + else + echo "#dummy" > "$depfile" + fi + rm -f "$tmpdepfile" + ;; + +#nosideeffect) + # This comment above is used by automake to tell side-effect + # dependency tracking mechanisms from slower ones. + +dashmstdout) + # Important note: in order to support this mode, a compiler *must* + # always write the preprocessed file to stdout, regardless of -o. + "$@" || exit $? + + # Remove the call to Libtool. + if test "$libtool" = yes; then + while test $1 != '--mode=compile'; do + shift + done + shift + fi + + # Remove `-o $object'. + IFS=" " + for arg + do + case $arg in + -o) + shift + ;; + $object) + shift + ;; + *) + set fnord "$@" "$arg" + shift # fnord + shift # $arg + ;; + esac + done + + test -z "$dashmflag" && dashmflag=-M + # Require at least two characters before searching for `:' + # in the target name. This is to cope with DOS-style filenames: + # a dependency such as `c:/foo/bar' could be seen as target `c' otherwise. + "$@" $dashmflag | + sed 's:^[ ]*[^: ][^:][^:]*\:[ ]*:'"$object"'\: :' > "$tmpdepfile" + rm -f "$depfile" + cat < "$tmpdepfile" > "$depfile" + tr ' ' ' +' < "$tmpdepfile" | \ +## Some versions of the HPUX 10.20 sed can't process this invocation +## correctly. Breaking it into two sed invocations is a workaround. + sed -e 's/^\\$//' -e '/^$/d' -e '/:$/d' | sed -e 's/$/ :/' >> "$depfile" + rm -f "$tmpdepfile" + ;; + +dashXmstdout) + # This case only exists to satisfy depend.m4. It is never actually + # run, as this mode is specially recognized in the preamble. + exit 1 + ;; + +makedepend) + "$@" || exit $? + # Remove any Libtool call + if test "$libtool" = yes; then + while test $1 != '--mode=compile'; do + shift + done + shift + fi + # X makedepend + shift + cleared=no + for arg in "$@"; do + case $cleared in + no) + set ""; shift + cleared=yes ;; + esac + case "$arg" in + -D*|-I*) + set fnord "$@" "$arg"; shift ;; + # Strip any option that makedepend may not understand. Remove + # the object too, otherwise makedepend will parse it as a source file. + -*|$object) + ;; + *) + set fnord "$@" "$arg"; shift ;; + esac + done + obj_suffix="`echo $object | sed 's/^.*\././'`" + touch "$tmpdepfile" + ${MAKEDEPEND-makedepend} -o"$obj_suffix" -f"$tmpdepfile" "$@" + rm -f "$depfile" + cat < "$tmpdepfile" > "$depfile" + sed '1,2d' "$tmpdepfile" | tr ' ' ' +' | \ +## Some versions of the HPUX 10.20 sed can't process this invocation +## correctly. Breaking it into two sed invocations is a workaround. + sed -e 's/^\\$//' -e '/^$/d' -e '/:$/d' | sed -e 's/$/ :/' >> "$depfile" + rm -f "$tmpdepfile" "$tmpdepfile".bak + ;; + +cpp) + # Important note: in order to support this mode, a compiler *must* + # always write the preprocessed file to stdout. + "$@" || exit $? + + # Remove the call to Libtool. + if test "$libtool" = yes; then + while test $1 != '--mode=compile'; do + shift + done + shift + fi + + # Remove `-o $object'. + IFS=" " + for arg + do + case $arg in + -o) + shift + ;; + $object) + shift + ;; + *) + set fnord "$@" "$arg" + shift # fnord + shift # $arg + ;; + esac + done + + "$@" -E | + sed -n -e '/^# [0-9][0-9]* "\([^"]*\)".*/ s:: \1 \\:p' \ + -e '/^#line [0-9][0-9]* "\([^"]*\)".*/ s:: \1 \\:p' | + sed '$ s: \\$::' > "$tmpdepfile" + rm -f "$depfile" + echo "$object : \\" > "$depfile" + cat < "$tmpdepfile" >> "$depfile" + sed < "$tmpdepfile" '/^$/d;s/^ //;s/ \\$//;s/$/ :/' >> "$depfile" + rm -f "$tmpdepfile" + ;; + +msvisualcpp) + # Important note: in order to support this mode, a compiler *must* + # always write the preprocessed file to stdout, regardless of -o, + # because we must use -o when running libtool. + "$@" || exit $? + IFS=" " + for arg + do + case "$arg" in + "-Gm"|"/Gm"|"-Gi"|"/Gi"|"-ZI"|"/ZI") + set fnord "$@" + shift + shift + ;; + *) + set fnord "$@" "$arg" + shift + shift + ;; + esac + done + "$@" -E | + sed -n '/^#line [0-9][0-9]* "\([^"]*\)"/ s::echo "`cygpath -u \\"\1\\"`":p' | sort | uniq > "$tmpdepfile" + rm -f "$depfile" + echo "$object : \\" > "$depfile" + . "$tmpdepfile" | sed 's% %\\ %g' | sed -n '/^\(.*\)$/ s:: \1 \\:p' >> "$depfile" + echo " " >> "$depfile" + . "$tmpdepfile" | sed 's% %\\ %g' | sed -n '/^\(.*\)$/ s::\1\::p' >> "$depfile" + rm -f "$tmpdepfile" + ;; + +none) + exec "$@" + ;; + +*) + echo "Unknown depmode $depmode" 1>&2 + exit 1 + ;; +esac + +exit 0 + +# Local Variables: +# mode: shell-script +# sh-indentation: 2 +# eval: (add-hook 'write-file-hooks 'time-stamp) +# time-stamp-start: "scriptversion=" +# time-stamp-format: "%:y-%02m-%02d.%02H" +# time-stamp-end: "$" +# End: diff --git a/install-sh b/install-sh new file mode 100755 index 0000000..4d4a951 --- /dev/null +++ b/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/missing b/missing new file mode 100755 index 0000000..894e786 --- /dev/null +++ b/missing @@ -0,0 +1,360 @@ +#! /bin/sh +# Common stub for a few missing GNU programs while installing. + +scriptversion=2005-06-08.21 + +# Copyright (C) 1996, 1997, 1999, 2000, 2002, 2003, 2004, 2005 +# Free Software Foundation, Inc. +# Originally by Fran,cois Pinard , 1996. + +# This program is free software; you can redistribute it and/or modify +# it under the terms of the GNU General Public License as published by +# the Free Software Foundation; either version 2, or (at your option) +# any later version. + +# This program is distributed in the hope that it will be useful, +# but WITHOUT ANY WARRANTY; without even the implied warranty of +# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +# GNU General Public License for more details. + +# You should have received a copy of the GNU General Public License +# along with this program; if not, write to the Free Software +# Foundation, Inc., 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. + +if test $# -eq 0; then + echo 1>&2 "Try \`$0 --help' for more information" + exit 1 +fi + +run=: + +# In the cases where this matters, `missing' is being run in the +# srcdir already. +if test -f configure.ac; then + configure_ac=configure.ac +else + configure_ac=configure.in +fi + +msg="missing on your system" + +case "$1" in +--run) + # Try to run requested program, and just exit if it succeeds. + run= + shift + "$@" && exit 0 + # Exit code 63 means version mismatch. This often happens + # when the user try to use an ancient version of a tool on + # a file that requires a minimum version. In this case we + # we should proceed has if the program had been absent, or + # if --run hadn't been passed. + if test $? = 63; then + run=: + msg="probably too old" + fi + ;; + + -h|--h|--he|--hel|--help) + echo "\ +$0 [OPTION]... PROGRAM [ARGUMENT]... + +Handle \`PROGRAM [ARGUMENT]...' for when PROGRAM is missing, or return an +error status if there is no known handling for PROGRAM. + +Options: + -h, --help display this help and exit + -v, --version output version information and exit + --run try to run the given command, and emulate it if it fails + +Supported PROGRAM values: + aclocal touch file \`aclocal.m4' + autoconf touch file \`configure' + autoheader touch file \`config.h.in' + automake touch all \`Makefile.in' files + bison create \`y.tab.[ch]', if possible, from existing .[ch] + flex create \`lex.yy.c', if possible, from existing .c + help2man touch the output file + lex create \`lex.yy.c', if possible, from existing .c + makeinfo touch the output file + tar try tar, gnutar, gtar, then tar without non-portable flags + yacc create \`y.tab.[ch]', if possible, from existing .[ch] + +Send bug reports to ." + exit $? + ;; + + -v|--v|--ve|--ver|--vers|--versi|--versio|--version) + echo "missing $scriptversion (GNU Automake)" + exit $? + ;; + + -*) + echo 1>&2 "$0: Unknown \`$1' option" + echo 1>&2 "Try \`$0 --help' for more information" + exit 1 + ;; + +esac + +# Now exit if we have it, but it failed. Also exit now if we +# don't have it and --version was passed (most likely to detect +# the program). +case "$1" in + lex|yacc) + # Not GNU programs, they don't have --version. + ;; + + tar) + if test -n "$run"; then + echo 1>&2 "ERROR: \`tar' requires --run" + exit 1 + elif test "x$2" = "x--version" || test "x$2" = "x--help"; then + exit 1 + fi + ;; + + *) + if test -z "$run" && ($1 --version) > /dev/null 2>&1; then + # We have it, but it failed. + exit 1 + elif test "x$2" = "x--version" || test "x$2" = "x--help"; then + # Could not run --version or --help. This is probably someone + # running `$TOOL --version' or `$TOOL --help' to check whether + # $TOOL exists and not knowing $TOOL uses missing. + exit 1 + fi + ;; +esac + +# If it does not exist, or fails to run (possibly an outdated version), +# try to emulate it. +case "$1" in + aclocal*) + echo 1>&2 "\ +WARNING: \`$1' is $msg. You should only need it if + you modified \`acinclude.m4' or \`${configure_ac}'. You might want + to install the \`Automake' and \`Perl' packages. Grab them from + any GNU archive site." + touch aclocal.m4 + ;; + + autoconf) + echo 1>&2 "\ +WARNING: \`$1' is $msg. You should only need it if + you modified \`${configure_ac}'. You might want to install the + \`Autoconf' and \`GNU m4' packages. Grab them from any GNU + archive site." + touch configure + ;; + + autoheader) + echo 1>&2 "\ +WARNING: \`$1' is $msg. You should only need it if + you modified \`acconfig.h' or \`${configure_ac}'. You might want + to install the \`Autoconf' and \`GNU m4' packages. Grab them + from any GNU archive site." + files=`sed -n 's/^[ ]*A[CM]_CONFIG_HEADER(\([^)]*\)).*/\1/p' ${configure_ac}` + test -z "$files" && files="config.h" + touch_files= + for f in $files; do + case "$f" in + *:*) touch_files="$touch_files "`echo "$f" | + sed -e 's/^[^:]*://' -e 's/:.*//'`;; + *) touch_files="$touch_files $f.in";; + esac + done + touch $touch_files + ;; + + automake*) + echo 1>&2 "\ +WARNING: \`$1' is $msg. You should only need it if + you modified \`Makefile.am', \`acinclude.m4' or \`${configure_ac}'. + You might want to install the \`Automake' and \`Perl' packages. + Grab them from any GNU archive site." + find . -type f -name Makefile.am -print | + sed 's/\.am$/.in/' | + while read f; do touch "$f"; done + ;; + + autom4te) + echo 1>&2 "\ +WARNING: \`$1' is needed, but is $msg. + You might have modified some files without having the + proper tools for further handling them. + You can get \`$1' as part of \`Autoconf' from any GNU + archive site." + + file=`echo "$*" | sed -n 's/.*--output[ =]*\([^ ]*\).*/\1/p'` + test -z "$file" && file=`echo "$*" | sed -n 's/.*-o[ ]*\([^ ]*\).*/\1/p'` + if test -f "$file"; then + touch $file + else + test -z "$file" || exec >$file + echo "#! /bin/sh" + echo "# Created by GNU Automake missing as a replacement of" + echo "# $ $@" + echo "exit 0" + chmod +x $file + exit 1 + fi + ;; + + bison|yacc) + echo 1>&2 "\ +WARNING: \`$1' $msg. You should only need it if + you modified a \`.y' file. You may need the \`Bison' package + in order for those modifications to take effect. You can get + \`Bison' from any GNU archive site." + rm -f y.tab.c y.tab.h + if [ $# -ne 1 ]; then + eval LASTARG="\${$#}" + case "$LASTARG" in + *.y) + SRCFILE=`echo "$LASTARG" | sed 's/y$/c/'` + if [ -f "$SRCFILE" ]; then + cp "$SRCFILE" y.tab.c + fi + SRCFILE=`echo "$LASTARG" | sed 's/y$/h/'` + if [ -f "$SRCFILE" ]; then + cp "$SRCFILE" y.tab.h + fi + ;; + esac + fi + if [ ! -f y.tab.h ]; then + echo >y.tab.h + fi + if [ ! -f y.tab.c ]; then + echo 'main() { return 0; }' >y.tab.c + fi + ;; + + lex|flex) + echo 1>&2 "\ +WARNING: \`$1' is $msg. You should only need it if + you modified a \`.l' file. You may need the \`Flex' package + in order for those modifications to take effect. You can get + \`Flex' from any GNU archive site." + rm -f lex.yy.c + if [ $# -ne 1 ]; then + eval LASTARG="\${$#}" + case "$LASTARG" in + *.l) + SRCFILE=`echo "$LASTARG" | sed 's/l$/c/'` + if [ -f "$SRCFILE" ]; then + cp "$SRCFILE" lex.yy.c + fi + ;; + esac + fi + if [ ! -f lex.yy.c ]; then + echo 'main() { return 0; }' >lex.yy.c + fi + ;; + + help2man) + echo 1>&2 "\ +WARNING: \`$1' is $msg. You should only need it if + you modified a dependency of a manual page. You may need the + \`Help2man' package in order for those modifications to take + effect. You can get \`Help2man' from any GNU archive site." + + file=`echo "$*" | sed -n 's/.*-o \([^ ]*\).*/\1/p'` + if test -z "$file"; then + file=`echo "$*" | sed -n 's/.*--output=\([^ ]*\).*/\1/p'` + fi + if [ -f "$file" ]; then + touch $file + else + test -z "$file" || exec >$file + echo ".ab help2man is required to generate this page" + exit 1 + fi + ;; + + makeinfo) + echo 1>&2 "\ +WARNING: \`$1' is $msg. You should only need it if + you modified a \`.texi' or \`.texinfo' file, or any other file + indirectly affecting the aspect of the manual. The spurious + call might also be the consequence of using a buggy \`make' (AIX, + DU, IRIX). You might want to install the \`Texinfo' package or + the \`GNU make' package. Grab either from any GNU archive site." + # The file to touch is that specified with -o ... + file=`echo "$*" | sed -n 's/.*-o \([^ ]*\).*/\1/p'` + if test -z "$file"; then + # ... or it is the one specified with @setfilename ... + infile=`echo "$*" | sed 's/.* \([^ ]*\) *$/\1/'` + file=`sed -n '/^@setfilename/ { s/.* \([^ ]*\) *$/\1/; p; q; }' $infile` + # ... or it is derived from the source name (dir/f.texi becomes f.info) + test -z "$file" && file=`echo "$infile" | sed 's,.*/,,;s,.[^.]*$,,'`.info + fi + # If the file does not exist, the user really needs makeinfo; + # let's fail without touching anything. + test -f $file || exit 1 + touch $file + ;; + + tar) + shift + + # We have already tried tar in the generic part. + # Look for gnutar/gtar before invocation to avoid ugly error + # messages. + if (gnutar --version > /dev/null 2>&1); then + gnutar "$@" && exit 0 + fi + if (gtar --version > /dev/null 2>&1); then + gtar "$@" && exit 0 + fi + firstarg="$1" + if shift; then + case "$firstarg" in + *o*) + firstarg=`echo "$firstarg" | sed s/o//` + tar "$firstarg" "$@" && exit 0 + ;; + esac + case "$firstarg" in + *h*) + firstarg=`echo "$firstarg" | sed s/h//` + tar "$firstarg" "$@" && exit 0 + ;; + esac + fi + + echo 1>&2 "\ +WARNING: I can't seem to be able to run \`tar' with the given arguments. + You may want to install GNU tar or Free paxutils, or check the + command line arguments." + exit 1 + ;; + + *) + echo 1>&2 "\ +WARNING: \`$1' is needed, and is $msg. + You might have modified some files without having the + proper tools for further handling them. Check the \`README' file, + it often tells you about the needed prerequisites for installing + this package. You may also peek at any GNU archive site, in case + some other package would contain this missing \`$1' program." + exit 1 + ;; +esac + +exit 0 + +# Local variables: +# eval: (add-hook 'write-file-hooks 'time-stamp) +# time-stamp-start: "scriptversion=" +# time-stamp-format: "%:y-%02m-%02d.%02H" +# time-stamp-end: "$" +# End: diff --git a/src/Makefile.am b/src/Makefile.am new file mode 100644 index 0000000..7f4ffcc --- /dev/null +++ b/src/Makefile.am @@ -0,0 +1,27 @@ +################################ +# Makefile.am for nife project # +################################ + +bin_PROGRAMS = nife +nife_SOURCES = nife.c nife.h conf.h \ + mth.c mth.h \ + err.c err.h \ + histo.c histo.h \ + lib.c lib.h \ + foncs.c foncs.h \ + stackN.c stackN.h \ + stackL.c stackL.h \ + stackC.c stackC.h \ + stackF.c stackF.h \ + stackV.c stackV.h \ + tasks.c tasks.h \ + libmath.c libmath.h \ + libmathc99.c \ + help.c help.h \ + dev.c dev.h \ + net.c net.h \ + gplot.c gplot.h \ + scs.c scs.h \ + debug.c debug.h +# nife_LDADD = libm.a + diff --git a/src/Makefile.in b/src/Makefile.in new file mode 100644 index 0000000..6d742f8 --- /dev/null +++ b/src/Makefile.in @@ -0,0 +1,446 @@ +# Makefile.in generated by automake 1.9.6 from Makefile.am. +# @configure_input@ + +# Copyright (C) 1994, 1995, 1996, 1997, 1998, 1999, 2000, 2001, 2002, +# 2003, 2004, 2005 Free Software Foundation, Inc. +# This Makefile.in is free software; the Free Software Foundation +# gives unlimited permission to copy and/or distribute it, +# with or without modifications, as long as this notice is preserved. + +# This program is distributed in the hope that it will be useful, +# but WITHOUT ANY WARRANTY, to the extent permitted by law; without +# even the implied warranty of MERCHANTABILITY or FITNESS FOR A +# PARTICULAR PURPOSE. + +@SET_MAKE@ + +################################ +# Makefile.am for nife project # +################################ + +srcdir = @srcdir@ +top_srcdir = @top_srcdir@ +VPATH = @srcdir@ +pkgdatadir = $(datadir)/@PACKAGE@ +pkglibdir = $(libdir)/@PACKAGE@ +pkgincludedir = $(includedir)/@PACKAGE@ +top_builddir = .. +am__cd = CDPATH="$${ZSH_VERSION+.}$(PATH_SEPARATOR)" && cd +INSTALL = @INSTALL@ +install_sh_DATA = $(install_sh) -c -m 644 +install_sh_PROGRAM = $(install_sh) -c +install_sh_SCRIPT = $(install_sh) -c +INSTALL_HEADER = $(INSTALL_DATA) +transform = $(program_transform_name) +NORMAL_INSTALL = : +PRE_INSTALL = : +POST_INSTALL = : +NORMAL_UNINSTALL = : +PRE_UNINSTALL = : +POST_UNINSTALL = : +bin_PROGRAMS = nife$(EXEEXT) +subdir = src +DIST_COMMON = $(srcdir)/Makefile.am $(srcdir)/Makefile.in +ACLOCAL_M4 = $(top_srcdir)/aclocal.m4 +am__aclocal_m4_deps = $(top_srcdir)/configure.ac +am__configure_deps = $(am__aclocal_m4_deps) $(CONFIGURE_DEPENDENCIES) \ + $(ACLOCAL_M4) +mkinstalldirs = $(install_sh) -d +CONFIG_HEADER = $(top_builddir)/config.h +CONFIG_CLEAN_FILES = +am__installdirs = "$(DESTDIR)$(bindir)" +binPROGRAMS_INSTALL = $(INSTALL_PROGRAM) +PROGRAMS = $(bin_PROGRAMS) +am_nife_OBJECTS = nife.$(OBJEXT) mth.$(OBJEXT) err.$(OBJEXT) \ + histo.$(OBJEXT) lib.$(OBJEXT) foncs.$(OBJEXT) stackN.$(OBJEXT) \ + stackL.$(OBJEXT) stackC.$(OBJEXT) stackF.$(OBJEXT) \ + stackV.$(OBJEXT) tasks.$(OBJEXT) libmath.$(OBJEXT) \ + libmathc99.$(OBJEXT) help.$(OBJEXT) dev.$(OBJEXT) \ + net.$(OBJEXT) gplot.$(OBJEXT) scs.$(OBJEXT) debug.$(OBJEXT) +nife_OBJECTS = $(am_nife_OBJECTS) +nife_LDADD = $(LDADD) +DEFAULT_INCLUDES = -I. -I$(srcdir) -I$(top_builddir) +depcomp = $(SHELL) $(top_srcdir)/depcomp +am__depfiles_maybe = depfiles +COMPILE = $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) \ + $(CPPFLAGS) $(AM_CFLAGS) $(CFLAGS) +CCLD = $(CC) +LINK = $(CCLD) $(AM_CFLAGS) $(CFLAGS) $(AM_LDFLAGS) $(LDFLAGS) -o $@ +SOURCES = $(nife_SOURCES) +DIST_SOURCES = $(nife_SOURCES) +ETAGS = etags +CTAGS = ctags +DISTFILES = $(DIST_COMMON) $(DIST_SOURCES) $(TEXINFOS) $(EXTRA_DIST) +ACLOCAL = @ACLOCAL@ +AMDEP_FALSE = @AMDEP_FALSE@ +AMDEP_TRUE = @AMDEP_TRUE@ +AMTAR = @AMTAR@ +AUTOCONF = @AUTOCONF@ +AUTOHEADER = @AUTOHEADER@ +AUTOMAKE = @AUTOMAKE@ +AWK = @AWK@ +CC = @CC@ +CCDEPMODE = @CCDEPMODE@ +CFLAGS = @CFLAGS@ +CPP = @CPP@ +CPPFLAGS = @CPPFLAGS@ +CYGPATH_W = @CYGPATH_W@ +DEFS = @DEFS@ +DEPDIR = @DEPDIR@ +ECHO_C = @ECHO_C@ +ECHO_N = @ECHO_N@ +ECHO_T = @ECHO_T@ +EGREP = @EGREP@ +EXEEXT = @EXEEXT@ +GREP = @GREP@ +INSTALL_DATA = @INSTALL_DATA@ +INSTALL_PROGRAM = @INSTALL_PROGRAM@ +INSTALL_SCRIPT = @INSTALL_SCRIPT@ +INSTALL_STRIP_PROGRAM = @INSTALL_STRIP_PROGRAM@ +LDFLAGS = @LDFLAGS@ +LIBOBJS = @LIBOBJS@ +LIBS = @LIBS@ +LTLIBOBJS = @LTLIBOBJS@ +MAKEINFO = @MAKEINFO@ +OBJEXT = @OBJEXT@ +PACKAGE = @PACKAGE@ +PACKAGE_BUGREPORT = @PACKAGE_BUGREPORT@ +PACKAGE_NAME = @PACKAGE_NAME@ +PACKAGE_STRING = @PACKAGE_STRING@ +PACKAGE_TARNAME = @PACKAGE_TARNAME@ +PACKAGE_URL = @PACKAGE_URL@ +PACKAGE_VERSION = @PACKAGE_VERSION@ +PATH_SEPARATOR = @PATH_SEPARATOR@ +POW_LIB = @POW_LIB@ +SET_MAKE = @SET_MAKE@ +SHELL = @SHELL@ +STRIP = @STRIP@ +VERSION = @VERSION@ +ac_ct_CC = @ac_ct_CC@ +am__fastdepCC_FALSE = @am__fastdepCC_FALSE@ +am__fastdepCC_TRUE = @am__fastdepCC_TRUE@ +am__include = @am__include@ +am__leading_dot = @am__leading_dot@ +am__quote = @am__quote@ +am__tar = @am__tar@ +am__untar = @am__untar@ +bindir = @bindir@ +build_alias = @build_alias@ +datadir = @datadir@ +datarootdir = @datarootdir@ +docdir = @docdir@ +dvidir = @dvidir@ +exec_prefix = @exec_prefix@ +host_alias = @host_alias@ +htmldir = @htmldir@ +includedir = @includedir@ +infodir = @infodir@ +install_sh = @install_sh@ +libdir = @libdir@ +libexecdir = @libexecdir@ +localedir = @localedir@ +localstatedir = @localstatedir@ +mandir = @mandir@ +mkdir_p = @mkdir_p@ +oldincludedir = @oldincludedir@ +pdfdir = @pdfdir@ +prefix = @prefix@ +program_transform_name = @program_transform_name@ +psdir = @psdir@ +sbindir = @sbindir@ +sharedstatedir = @sharedstatedir@ +sysconfdir = @sysconfdir@ +target_alias = @target_alias@ +nife_SOURCES = nife.c nife.h conf.h \ + mth.c mth.h \ + err.c err.h \ + histo.c histo.h \ + lib.c lib.h \ + foncs.c foncs.h \ + stackN.c stackN.h \ + stackL.c stackL.h \ + stackC.c stackC.h \ + stackF.c stackF.h \ + stackV.c stackV.h \ + tasks.c tasks.h \ + libmath.c libmath.h \ + libmathc99.c \ + help.c help.h \ + dev.c dev.h \ + net.c net.h \ + gplot.c gplot.h \ + scs.c scs.h \ + debug.c debug.h + +all: all-am + +.SUFFIXES: +.SUFFIXES: .c .o .obj +$(srcdir)/Makefile.in: $(srcdir)/Makefile.am $(am__configure_deps) + @for dep in $?; do \ + case '$(am__configure_deps)' in \ + *$$dep*) \ + cd $(top_builddir) && $(MAKE) $(AM_MAKEFLAGS) am--refresh \ + && exit 0; \ + exit 1;; \ + esac; \ + done; \ + echo ' cd $(top_srcdir) && $(AUTOMAKE) --gnu src/Makefile'; \ + cd $(top_srcdir) && \ + $(AUTOMAKE) --gnu src/Makefile +.PRECIOUS: Makefile +Makefile: $(srcdir)/Makefile.in $(top_builddir)/config.status + @case '$?' in \ + *config.status*) \ + cd $(top_builddir) && $(MAKE) $(AM_MAKEFLAGS) am--refresh;; \ + *) \ + echo ' cd $(top_builddir) && $(SHELL) ./config.status $(subdir)/$@ $(am__depfiles_maybe)'; \ + cd $(top_builddir) && $(SHELL) ./config.status $(subdir)/$@ $(am__depfiles_maybe);; \ + esac; + +$(top_builddir)/config.status: $(top_srcdir)/configure $(CONFIG_STATUS_DEPENDENCIES) + cd $(top_builddir) && $(MAKE) $(AM_MAKEFLAGS) am--refresh + +$(top_srcdir)/configure: $(am__configure_deps) + cd $(top_builddir) && $(MAKE) $(AM_MAKEFLAGS) am--refresh +$(ACLOCAL_M4): $(am__aclocal_m4_deps) + cd $(top_builddir) && $(MAKE) $(AM_MAKEFLAGS) am--refresh +install-binPROGRAMS: $(bin_PROGRAMS) + @$(NORMAL_INSTALL) + test -z "$(bindir)" || $(mkdir_p) "$(DESTDIR)$(bindir)" + @list='$(bin_PROGRAMS)'; for p in $$list; do \ + p1=`echo $$p|sed 's/$(EXEEXT)$$//'`; \ + if test -f $$p \ + ; then \ + f=`echo "$$p1" | sed 's,^.*/,,;$(transform);s/$$/$(EXEEXT)/'`; \ + echo " $(INSTALL_PROGRAM_ENV) $(binPROGRAMS_INSTALL) '$$p' '$(DESTDIR)$(bindir)/$$f'"; \ + $(INSTALL_PROGRAM_ENV) $(binPROGRAMS_INSTALL) "$$p" "$(DESTDIR)$(bindir)/$$f" || exit 1; \ + else :; fi; \ + done + +uninstall-binPROGRAMS: + @$(NORMAL_UNINSTALL) + @list='$(bin_PROGRAMS)'; for p in $$list; do \ + f=`echo "$$p" | sed 's,^.*/,,;s/$(EXEEXT)$$//;$(transform);s/$$/$(EXEEXT)/'`; \ + echo " rm -f '$(DESTDIR)$(bindir)/$$f'"; \ + rm -f "$(DESTDIR)$(bindir)/$$f"; \ + done + +clean-binPROGRAMS: + -test -z "$(bin_PROGRAMS)" || rm -f $(bin_PROGRAMS) +nife$(EXEEXT): $(nife_OBJECTS) $(nife_DEPENDENCIES) + @rm -f nife$(EXEEXT) + $(LINK) $(nife_LDFLAGS) $(nife_OBJECTS) $(nife_LDADD) $(LIBS) + +mostlyclean-compile: + -rm -f *.$(OBJEXT) + +distclean-compile: + -rm -f *.tab.c + +@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/debug.Po@am__quote@ +@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/dev.Po@am__quote@ +@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/err.Po@am__quote@ +@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/foncs.Po@am__quote@ +@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/gplot.Po@am__quote@ +@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/help.Po@am__quote@ +@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/histo.Po@am__quote@ +@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/lib.Po@am__quote@ +@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/libmath.Po@am__quote@ +@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/libmathc99.Po@am__quote@ +@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/mth.Po@am__quote@ +@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/net.Po@am__quote@ +@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/nife.Po@am__quote@ +@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/scs.Po@am__quote@ +@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/stackC.Po@am__quote@ +@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/stackF.Po@am__quote@ +@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/stackL.Po@am__quote@ +@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/stackN.Po@am__quote@ +@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/stackV.Po@am__quote@ +@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/tasks.Po@am__quote@ + +.c.o: +@am__fastdepCC_TRUE@ if $(COMPILE) -MT $@ -MD -MP -MF "$(DEPDIR)/$*.Tpo" -c -o $@ $<; \ +@am__fastdepCC_TRUE@ then mv -f "$(DEPDIR)/$*.Tpo" "$(DEPDIR)/$*.Po"; else rm -f "$(DEPDIR)/$*.Tpo"; exit 1; fi +@AMDEP_TRUE@@am__fastdepCC_FALSE@ source='$<' object='$@' libtool=no @AMDEPBACKSLASH@ +@AMDEP_TRUE@@am__fastdepCC_FALSE@ DEPDIR=$(DEPDIR) $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@ +@am__fastdepCC_FALSE@ $(COMPILE) -c $< + +.c.obj: +@am__fastdepCC_TRUE@ if $(COMPILE) -MT $@ -MD -MP -MF "$(DEPDIR)/$*.Tpo" -c -o $@ `$(CYGPATH_W) '$<'`; \ +@am__fastdepCC_TRUE@ then mv -f "$(DEPDIR)/$*.Tpo" "$(DEPDIR)/$*.Po"; else rm -f "$(DEPDIR)/$*.Tpo"; exit 1; fi +@AMDEP_TRUE@@am__fastdepCC_FALSE@ source='$<' object='$@' libtool=no @AMDEPBACKSLASH@ +@AMDEP_TRUE@@am__fastdepCC_FALSE@ DEPDIR=$(DEPDIR) $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@ +@am__fastdepCC_FALSE@ $(COMPILE) -c `$(CYGPATH_W) '$<'` +uninstall-info-am: + +ID: $(HEADERS) $(SOURCES) $(LISP) $(TAGS_FILES) + list='$(SOURCES) $(HEADERS) $(LISP) $(TAGS_FILES)'; \ + unique=`for i in $$list; do \ + if test -f "$$i"; then echo $$i; else echo $(srcdir)/$$i; fi; \ + done | \ + $(AWK) ' { files[$$0] = 1; } \ + END { for (i in files) print i; }'`; \ + mkid -fID $$unique +tags: TAGS + +TAGS: $(HEADERS) $(SOURCES) $(TAGS_DEPENDENCIES) \ + $(TAGS_FILES) $(LISP) + tags=; \ + here=`pwd`; \ + list='$(SOURCES) $(HEADERS) $(LISP) $(TAGS_FILES)'; \ + unique=`for i in $$list; do \ + if test -f "$$i"; then echo $$i; else echo $(srcdir)/$$i; fi; \ + done | \ + $(AWK) ' { files[$$0] = 1; } \ + END { for (i in files) print i; }'`; \ + if test -z "$(ETAGS_ARGS)$$tags$$unique"; then :; else \ + test -n "$$unique" || unique=$$empty_fix; \ + $(ETAGS) $(ETAGSFLAGS) $(AM_ETAGSFLAGS) $(ETAGS_ARGS) \ + $$tags $$unique; \ + fi +ctags: CTAGS +CTAGS: $(HEADERS) $(SOURCES) $(TAGS_DEPENDENCIES) \ + $(TAGS_FILES) $(LISP) + tags=; \ + here=`pwd`; \ + list='$(SOURCES) $(HEADERS) $(LISP) $(TAGS_FILES)'; \ + unique=`for i in $$list; do \ + if test -f "$$i"; then echo $$i; else echo $(srcdir)/$$i; fi; \ + done | \ + $(AWK) ' { files[$$0] = 1; } \ + END { for (i in files) print i; }'`; \ + test -z "$(CTAGS_ARGS)$$tags$$unique" \ + || $(CTAGS) $(CTAGSFLAGS) $(AM_CTAGSFLAGS) $(CTAGS_ARGS) \ + $$tags $$unique + +GTAGS: + here=`$(am__cd) $(top_builddir) && pwd` \ + && cd $(top_srcdir) \ + && gtags -i $(GTAGS_ARGS) $$here + +distclean-tags: + -rm -f TAGS ID GTAGS GRTAGS GSYMS GPATH tags + +distdir: $(DISTFILES) + @srcdirstrip=`echo "$(srcdir)" | sed 's|.|.|g'`; \ + topsrcdirstrip=`echo "$(top_srcdir)" | sed 's|.|.|g'`; \ + list='$(DISTFILES)'; for file in $$list; do \ + case $$file in \ + $(srcdir)/*) file=`echo "$$file" | sed "s|^$$srcdirstrip/||"`;; \ + $(top_srcdir)/*) file=`echo "$$file" | sed "s|^$$topsrcdirstrip/|$(top_builddir)/|"`;; \ + esac; \ + if test -f $$file || test -d $$file; then d=.; else d=$(srcdir); fi; \ + dir=`echo "$$file" | sed -e 's,/[^/]*$$,,'`; \ + if test "$$dir" != "$$file" && test "$$dir" != "."; then \ + dir="/$$dir"; \ + $(mkdir_p) "$(distdir)$$dir"; \ + else \ + dir=''; \ + fi; \ + if test -d $$d/$$file; then \ + if test -d $(srcdir)/$$file && test $$d != $(srcdir); then \ + cp -pR $(srcdir)/$$file $(distdir)$$dir || exit 1; \ + fi; \ + cp -pR $$d/$$file $(distdir)$$dir || exit 1; \ + else \ + test -f $(distdir)/$$file \ + || cp -p $$d/$$file $(distdir)/$$file \ + || exit 1; \ + fi; \ + done +check-am: all-am +check: check-am +all-am: Makefile $(PROGRAMS) +installdirs: + for dir in "$(DESTDIR)$(bindir)"; do \ + test -z "$$dir" || $(mkdir_p) "$$dir"; \ + done +install: install-am +install-exec: install-exec-am +install-data: install-data-am +uninstall: uninstall-am + +install-am: all-am + @$(MAKE) $(AM_MAKEFLAGS) install-exec-am install-data-am + +installcheck: installcheck-am +install-strip: + $(MAKE) $(AM_MAKEFLAGS) INSTALL_PROGRAM="$(INSTALL_STRIP_PROGRAM)" \ + install_sh_PROGRAM="$(INSTALL_STRIP_PROGRAM)" INSTALL_STRIP_FLAG=-s \ + `test -z '$(STRIP)' || \ + echo "INSTALL_PROGRAM_ENV=STRIPPROG='$(STRIP)'"` install +mostlyclean-generic: + +clean-generic: + +distclean-generic: + -test -z "$(CONFIG_CLEAN_FILES)" || rm -f $(CONFIG_CLEAN_FILES) + +maintainer-clean-generic: + @echo "This command is intended for maintainers to use" + @echo "it deletes files that may require special tools to rebuild." +clean: clean-am + +clean-am: clean-binPROGRAMS clean-generic mostlyclean-am + +distclean: distclean-am + -rm -rf ./$(DEPDIR) + -rm -f Makefile +distclean-am: clean-am distclean-compile distclean-generic \ + distclean-tags + +dvi: dvi-am + +dvi-am: + +html: html-am + +info: info-am + +info-am: + +install-data-am: + +install-exec-am: install-binPROGRAMS + +install-info: install-info-am + +install-man: + +installcheck-am: + +maintainer-clean: maintainer-clean-am + -rm -rf ./$(DEPDIR) + -rm -f Makefile +maintainer-clean-am: distclean-am maintainer-clean-generic + +mostlyclean: mostlyclean-am + +mostlyclean-am: mostlyclean-compile mostlyclean-generic + +pdf: pdf-am + +pdf-am: + +ps: ps-am + +ps-am: + +uninstall-am: uninstall-binPROGRAMS uninstall-info-am + +.PHONY: CTAGS GTAGS all all-am check check-am clean clean-binPROGRAMS \ + clean-generic ctags distclean distclean-compile \ + distclean-generic distclean-tags distdir dvi dvi-am html \ + html-am info info-am install install-am install-binPROGRAMS \ + install-data install-data-am install-exec install-exec-am \ + install-info install-info-am install-man install-strip \ + installcheck installcheck-am installdirs maintainer-clean \ + maintainer-clean-generic mostlyclean mostlyclean-compile \ + mostlyclean-generic pdf pdf-am ps ps-am tags uninstall \ + uninstall-am uninstall-binPROGRAMS uninstall-info-am + +# nife_LDADD = libm.a +# Tell versions [3.59,3.63) of GNU make to not export all variables. +# Otherwise a system limit (for SysV at least) may be exceeded. +.NOEXPORT: diff --git a/src/benchm.nif b/src/benchm.nif new file mode 100644 index 0000000..69156fe --- /dev/null +++ b/src/benchm.nif @@ -0,0 +1,15 @@ +# Benchmark test v 1 +echo_off +about +: f +time 1000000 ramp 1 - .1 * sin time +; +: test + f rot - # call the function and put result on the top + .000001 * # transform it in secondes + cr " Result =" "type . # print the result + " secs" "type cr # add S.I legend +; +test +exit + diff --git a/src/conf.h b/src/conf.h new file mode 100644 index 0000000..8060d02 --- /dev/null +++ b/src/conf.h @@ -0,0 +1,37 @@ +/* Copyright (C) 2011-2013 Patrick H. E. Foubet - S.E.R.I.A.N.E. + +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 3 of the License, or 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, see +*******************************************************************/ +/* conf.h */ +#ifndef __NIFE_CONF_H__ +#define __NIFE_CONF_H__ + +#ifdef HAVE_CONFIG_H +#include "../config.h" +#else +#define VERSION "0.44" +#endif + +#ifdef HAVE_COMEDILIB_H +#define _WITH_COMEDILIB +#endif + +/* +#ifdef HAVE_PTHREAD_H +#define _MULTI_THREADING_ +#define _REENTRANT +#endif +*/ + +#endif diff --git a/src/debug.c b/src/debug.c new file mode 100644 index 0000000..64e4f4c --- /dev/null +++ b/src/debug.c @@ -0,0 +1,82 @@ +/* Copyright (C) 2011-2013 Patrick H. E. Foubet - S.E.R.I.A.N.E. + +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 3 of the License, or 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, see +*******************************************************************/ +/* debug.c */ +#include "conf.h" + +#include +#include +#include +#include +#include +#include +#include + +#include "nife.h" +#include "mth.h" +#include "debug.h" + +int Debug=1; /* OK by default */ + +void D_Reset(void) +{ +int fd; +char NF[24]; + chdir(".nife"); + if (Debug) { + sprintf(NF,".nife_%d.log",getpid()); + if ((fd=open(NF,O_CREAT|O_RDWR|O_TRUNC,0644)) < 0) perror(NF); + else { + dup2(fd,2); + close(fd); + } + } else dup2(1,2); + chdir(".."); +} + +void D_Update(void) +{ + if (Debug) Debug=0; + else Debug=1; + D_Reset(); +} + +void D_Trace(char * M) +{ + if (Debug) { + fprintf(stderr," %s",M); + fflush(stderr); + } +} + +static char D_Mes[20]; +void * Malloc(int s) +{ +void * M; + D_Trace("\n"); + M=malloc(s); + sprintf(D_Mes,"Malloc %d : %lx\n",s,(long)M); + D_Trace(D_Mes); + return M; +} + +void Free(void *A) +{ + D_Trace("\n"); + sprintf(D_Mes,"Free : %lx\n",(long)A); + D_Trace(D_Mes); + free(A); +} + diff --git a/src/debug.h b/src/debug.h new file mode 100644 index 0000000..a9177fb --- /dev/null +++ b/src/debug.h @@ -0,0 +1,29 @@ +/* Copyright (C) 2011-2013 Patrick H. E. Foubet - S.E.R.I.A.N.E. + +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 3 of the License, or 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, see +*******************************************************************/ +/* debug.h */ + +#ifndef __NIFE_DEBUG_H__ +#define __NIFE_DEBUG_H__ +extern int Debug; + +extern void D_Reset(void); +extern void D_Update(void); +extern void D_Trace(char * M); + +extern void * Malloc(int s); +extern void Free(void * A); + +#endif diff --git a/src/dev.c b/src/dev.c new file mode 100644 index 0000000..0766e32 --- /dev/null +++ b/src/dev.c @@ -0,0 +1,318 @@ +/* Copyright (C) 2011-2013 Patrick H. E. Foubet - S.E.R.I.A.N.E. + +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 3 of the License, or 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, see +*******************************************************************/ +/* dev.c */ + +#ifdef HAVE_CONFIG_H +#include "../config.h" +#endif + +#ifdef HAVE_COMEDILIB_H +#define _WITH_COMEDILIB +#endif + +#include +#include +static int DFL_did=0, DFL_sid=0, DFL_cid=0; + +#ifdef _WITH_COMEDILIB + +#include + +static char *subdev_types[]={ + "unused", + "analog input", + "analog output", + "digital input", + "digital output", + "digital I/O", + "counter", + "timer", + "memory", + "calibration", + "processor", + "serial digital I/O" +}; + +static comedi_t *it; +static long n_it = -1; + +static char *cmd_src(int src,char *buf) +{ + buf[0]=0; + + if(src&TRIG_NONE)strcat(buf,"none|"); + if(src&TRIG_NOW)strcat(buf,"now|"); + if(src&TRIG_FOLLOW)strcat(buf, "follow|"); + if(src&TRIG_TIME)strcat(buf, "time|"); + if(src&TRIG_TIMER)strcat(buf, "timer|"); + if(src&TRIG_COUNT)strcat(buf, "count|"); + if(src&TRIG_EXT)strcat(buf, "ext|"); + if(src&TRIG_INT)strcat(buf, "int|"); +#ifdef TRIG_OTHER + if(src&TRIG_OTHER)strcat(buf, "other|"); +#endif + if(strlen(buf)==0){ + sprintf(buf,"unknown(0x%08x)",src); + }else{ + buf[strlen(buf)-1]=0; + } + return buf; +} + +static void probe_max_1chan(comedi_t *it,int s) +{ + comedi_cmd cmd; + char buf[100]; + + printf(" command fast 1chan:\n"); + if(comedi_get_cmd_generic_timed(it, s, &cmd, 1, 1)<0){ + printf(" not supported\n"); + }else{ + printf(" start: %s %d\n", + cmd_src(cmd.start_src,buf),cmd.start_arg); + printf(" scan_begin: %s %d\n", + cmd_src(cmd.scan_begin_src,buf),cmd.scan_begin_arg); + printf(" convert: %s %d\n", + cmd_src(cmd.convert_src,buf),cmd.convert_arg); + printf(" scan_end: %s %d\n", + cmd_src(cmd.scan_end_src,buf),cmd.scan_end_arg); + printf(" stop: %s %d\n", + cmd_src(cmd.stop_src,buf),cmd.stop_arg); + } +} + +static void get_command_stuff(comedi_t *it,int s) +{ +comedi_cmd cmd; +char buf[100]; + + if(comedi_get_cmd_src_mask(it,s,&cmd)<0){ + printf("not supported\n"); + }else{ + printf("\n"); + printf(" start: %s\n",cmd_src(cmd.start_src,buf)); + printf(" scan_begin: %s\n",cmd_src(cmd.scan_begin_src,buf)); + printf(" convert: %s\n",cmd_src(cmd.convert_src,buf)); + printf(" scan_end: %s\n",cmd_src(cmd.scan_end_src,buf)); + printf(" stop: %s\n",cmd_src(cmd.stop_src,buf)); + + probe_max_1chan(it,s); + } +} + +static int devOpen(long n) +{ +char filename[24]; + if (n == n_it) return 1; /* deja fait */ + n_it=-1; + sprintf(filename,"/dev/comedi%ld",n); + if (! (it = comedi_open(filename))) { + printf("%s : Error access !\n",filename); + return 0; + } + n_it = n; + return 1; +} + +#endif /* for _WITH_COMEDILIB */ +/* *********************************************************************/ + +#include "stackN.h" +#include "dev.h" +#include "err.h" +#define LBUFD 200 +static char buf[LBUFD]; + +void IF_listDev (void) +{ +FILE * fd; +int id,ns; +char driver[24], nomdev[24]; + if ((fd = fopen("/proc/comedi","r")) == NULL) + printf("No devices !\n"); + else { + while (fgets(buf,LBUFD,fd) != NULL) { + ns = -1; + sscanf(buf,"%d: %s %s %d\n",&id,driver,nomdev,&ns); + if (ns != -1) + printf(" %2d : %-20s driver %-20s %4d subdevices\n",id,nomdev,driver,ns); + } + } +} + +#ifdef _WITH_COMEDILIB +static void show_subdev(int i, int V) +{ +int j, type, chan,n_chans, n_ranges, subdev_flags; +comedi_range *rng; + printf("subdevice %d :",i); + type = comedi_get_subdevice_type(it, i); + printf(" type %d (%s) ",type,subdev_types[type]); + if (type==COMEDI_SUBD_UNUSED) return; + subdev_flags = comedi_get_subdevice_flags(it, i); + printf("- flags 0x%08x\n",subdev_flags); + n_chans=comedi_get_n_channels(it,i); + printf(" nb of channels : %d",n_chans); + if(!comedi_maxdata_is_chan_specific(it,i)){ + printf(" - max data value = %lu\n",(unsigned long)comedi_get_maxdata(it,i,0)); + } else { + printf("\n max data value: (channel specific)\n"); + for(chan=0;chan= n_chans) { + printf("Error : CId must be < %d !!\n", n_chans); + return; + } + printf(" ranges (Volts) :"); + if(!comedi_range_is_chan_specific(it,i)){ + n_ranges=comedi_get_n_ranges(it,i,0); + printf(" all chans:"); + for(j=0;jmin,rng->max); + } + printf("\n"); + } else { + printf("\n"); + for (chan=0;chanmin,rng->max); + } + printf("\n"); + } + } + printf(" command : "); + get_command_stuff(it,i); +} +#endif + +void IF_showDev (void) +{ +long n; + if (!getParLong(&n)) return; + +#ifdef _WITH_COMEDILIB +int i, n_subdev; + + if (! devOpen(n)) return; + printf("overall info:\n"); + printf(" version code : 0x%06x\n", comedi_get_version_code(it)); + printf(" driver name : %s\n", comedi_get_driver_name(it)); + printf(" board name : %s\n", comedi_get_board_name(it)); + printf(" nb subdevices : %d\n", n_subdev = comedi_get_n_subdevices(it)); + for (i = 0; i < n_subdev; i++) { + show_subdev(i,0); + } +#else + messErr(17); +#endif +} + +void IF_devShowDflt (void) +{ +#ifdef _WITH_COMEDILIB +int n_subdev; + printf("Default : DId=%d, SId=%d CId=%d\n", DFL_did, DFL_sid, DFL_cid); + if (! devOpen(DFL_did)) return; + printf("overall info:\n"); + printf(" version code : 0x%06x\n", comedi_get_version_code(it)); + printf(" driver name : %s\n", comedi_get_driver_name(it)); + printf(" board name : %s\n", comedi_get_board_name(it)); + printf(" nb subdevices : %d\n", n_subdev = comedi_get_n_subdevices(it)); + if (DFL_sid < n_subdev) + show_subdev(DFL_sid,DFL_cid); + else printf("Error : SId must be < %d !!\n", n_subdev); +#else + messErr(17); +#endif +} + +static void dev_read(int did, int sid, int cid) +{ +#ifdef _WITH_COMEDILIB +lsampl_t data; + if (! devOpen(did)) return; + if (comedi_data_read(it,sid,cid,0,0,&data) < 0) + messErr(18); + else putLong((long)data); +#else + messErr(17); +#endif +} + +void IF_devDflR (void) +{ + dev_read(DFL_did, DFL_sid, DFL_cid); +} + +void IF_devRead (void) +{ +long n, sd, ch; + if (!getParLong(&ch)) return; + if (!getParLong(&sd)) return; + if (!getParLong(&n)) return; + dev_read(n, sd, ch); +} + +void IF_devDflt (void) +{ +long n, sd, ch; + if (!getParLong(&ch)) return; + if (!getParLong(&sd)) return; + if (!getParLong(&n)) return; + DFL_did=n; + DFL_sid=sd; + DFL_cid=ch; +} + +static void dev_write(int did, int sid, int cid, long d) +{ +#ifdef _WITH_COMEDILIB +lsampl_t data; + if (! devOpen(did)) return; + data = (lsampl_t)d; + if (comedi_data_write(it,sid,cid,0,0,data) < 0) + messErr(18); +#else + messErr(17); +#endif +} + +void IF_devWrite (void) +{ +long d, n, sd, ch; + if (!getParLong(&ch)) return; + if (!getParLong(&sd)) return; + if (!getParLong(&n)) return; + if (!getParLong(&d)) return; + dev_write(n, sd, ch, d); + return; +} + +void IF_devDflW (void) +{ +long d; + if (!getParLong(&d)) return; + dev_write(DFL_did, DFL_sid, DFL_cid, d); + return; +} + diff --git a/src/dev.h b/src/dev.h new file mode 100644 index 0000000..a59b0a8 --- /dev/null +++ b/src/dev.h @@ -0,0 +1,30 @@ +/* Copyright (C) 2011-2013 Patrick H. E. Foubet - S.E.R.I.A.N.E. + +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 3 of the License, or 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, see +*******************************************************************/ +/* dev.h */ + +#ifndef __NIFE_DEV_H__ +#define __NIFE_DEV_H__ + +extern void IF_listDev (void); +extern void IF_showDev (void); +extern void IF_devRead (void); +extern void IF_devWrite (void); +extern void IF_devDflt (void); +extern void IF_devShowDflt (void); +extern void IF_devDflW (void); +extern void IF_devDflR (void); + +#endif diff --git a/src/err.c b/src/err.c new file mode 100644 index 0000000..0bd580c --- /dev/null +++ b/src/err.c @@ -0,0 +1,189 @@ +/* Copyright (C) 2011-2013 Patrick H. E. Foubet - S.E.R.I.A.N.E. + +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 3 of the License, or 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, see +*******************************************************************/ +#include "conf.h" +/* err.c */ + +#include +#include +#include + +#include "nife.h" +#include "mth.h" +#include "err.h" +#include "histo.h" +#include "stackF.h" +#include "stackN.h" +#include "stackL.h" +#include "stackC.h" + +char * InExec; +static int ERROR=0, LASTERR=0; +static void *ADDRERR=VIDE, *ADDRONE=VIDE; + +void tellOnErr (void*A) +{ + ADDRONE=A; + if (A != VIDE) LASTERR=0; +} + +void majLastErr(void*A) +{ +/* if (LASTERR != ERROR) {*/ + LASTERR=ERROR; + ADDRERR=A; +/* }*/ +} + +void razErr(void) +{ + ERROR=0; +} + +int noErr(void) +{ + return ERROR; +} + +static char *TabErr[] = { + "No error", + "no such error", + "empty stack", + "sizes are differents", + "not enought elements on the stack", + "empty logical stack", + "empty character stack", + "empty function stack", + "function code is present", + "string too long", + "command not found", /* 10 */ + "code type invalid", + "need one array on top", + "only allowed in a function code", + "IF instruction missing", + "already in function", + "loading error", + "no comedilib", + "invalid argument", + "not enought elements on the character stack", + "not enought elements on the logical stack", /* 20 */ + "function not found", + "BEGIN instruction missing", + "empty variable stack", + "variable not found", + "not possible in function code", + "no more task possible", + "task is running", + "task not exists", + "value must be greater than zero", + "value must be greater than 1", /* 30 */ + "create socket error", + "net is off", + "gethostbyname error, server not found", + "start server error", + "net message error", + "need a scalar on the top", + "not possible with Universal NetKey", + "not a Sister Chip System", + "DO instruction missing", + "net protocol error", /* 40 */ + "network system unknown", + "gnuplot not found", + "file open error", + "back compile limit missing", + "too many loads", + "label onerr: already found", + "label end: already found", + "inside compilation aborted" +}; +#define ERR_MAX 48 + +void stopErr(char *M, char *F) +{ + fprintf(stderr,"ERREUR : %s !!\n",M); + if (F != NULL) perror(F); + if (inSonProc) exit(1); + termReset(); + exit(1); +} + +static void traiteErr(int n, char * L) +{ + ERROR=n; + if (D_Cod==0) { + if (ECHOOFF) printf("\n"); + printf("%s : %s !!\a\n",L,TabErr[n]); + } + if (inSonProc) exit(1); + if (fctEnCours) { + if (D_Cod==0) printf("Compilation aborted !\n"); + else + if (ADDRONE == VIDE) printf("Inside compilation aborted !\n"); + _MODIF_fctEnCours_(0); + rmLastFct(); + } + if (ADDRONE != VIDE) return; + if (FD_IN) { + printf("In loading file %s : line %d !\n", getFDname(),getFDlig()); + closeFD(); + } + if (iTERM) { + printf("In loading stdin : line %d !\n", getFDlig()); + close(FD_IN); /* pipe ou autre */ + dup(iTERM); /* stdin on term */ + iTERM = 0; + } +} + +void messErr(int n) +{ +char M[50]; + if ((n < 0) || (n > ERR_MAX)) n = 1; + sprintf(M,"Error in '%s'",InExec); + traiteErr(n,M); +} + +void messErr2(int n, char * M) +{ + if ((n < 0) || (n > ERR_MAX)) n = 1; + traiteErr(n,M); +} + +void IF_NoError(void) +{ + putLong((long)LASTERR); +} + +void IF_LibError(void) +{ +long P; + getParLong(&P); + putString(TabErr[(int)P]); +} + +void IF_IsError(void) +{ + if (LASTERR) putBool(TRUE); + else putBool(FALSE); +} + +void IF_showError(void) +{ + if (ERROR) + printf("%s : %s !!\n",InExec,TabErr[ERROR]); + else + printf("%s : %s.\n",codByAddr(ADDRERR),TabErr[LASTERR]); +} + diff --git a/src/err.h b/src/err.h new file mode 100644 index 0000000..91f6dba --- /dev/null +++ b/src/err.h @@ -0,0 +1,34 @@ +/* Copyright (C) 2011-2013 Patrick H. E. Foubet - S.E.R.I.A.N.E. + +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 3 of the License, or 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, see +*******************************************************************/ +/* err.h */ + +#ifndef __NIFE_ERR_H__ +#define __NIFE_ERR_H__ + +extern char * InExec; +extern void tellOnErr (void*A); +extern void razErr(void); +extern void majLastErr(void*A); +extern int noErr(void); +extern void stopErr(char *M, char *NomFctSystem); +extern void messErr(int N); +extern void messErr2(int N, char * Lib); +extern void IF_showError(void); +extern void IF_IsError(void); +extern void IF_NoError(void); +extern void IF_LibError(void); + +#endif diff --git a/src/ex/gp.nif b/src/ex/gp.nif new file mode 100644 index 0000000..fb8b8ab --- /dev/null +++ b/src/ex/gp.nif @@ -0,0 +1,49 @@ +# test gplot +# Ci-dessous des exemples d'utilisation des commandes de la librairie gplot.c +# dont les noms apparaissent dans les "tools" (?libT). + +echo_off + +# creation d'un gplot simple (1 seule courbe) +" plot1.dat" " Essai de Courbe" gplot +# ajout d'un texte supplémentaire dans la commande plot +" smooth csplines, cos(x)" 1 gplotCmd +# creation d'un plot de 4 courbes +" plotM.dat" " Essai multi Courbes" 4 gplotM + +# fonction qui ajoute 100 pts dans le gplot no 1, un par seconde. +# chaque pt est compose du temps (t) en x et de sin(t) en y. +: test 100 0 do +time 10000000. / dup sin 2 >array 1 gplotAdd 1 sleep loop ; + +# la meme chose mais en replaçant, c'est a dire en enlevant le pt le plus ancien +# a chaque fois que l'on en ajoute un. +: test2 100 0 do +time 10000000. / dup sin 2 >array 1 gplotRepl 1 sleep loop ; + +# fonction qui ajoute 100 pts dans le gplot no 2, un par seconde. +# chaque pt est compose de t en x et de sin(t), cos(t), sin2(t), cos2(t) en y. +: testM +100 0 do time 10000000. / dup dup sin swap dup cos swap dup sin dup * swap cos +dup * 5 >array 2 gplotAdd 1 sleep loop ; + +# la meme chose que testM mais en replaçant, c'est a dire en enlevant le pt le +# plus ancien a chaque fois que l'on en ajoute un. +: testM2 +100 0 do time 10000000. / dup dup sin swap dup cos swap dup sin dup * swap cos +dup * 5 >array 2 gplotRepl 1 sleep loop ; + +# Ici on fait en parrallele test ET testM, c'est-à-dire un affichage sur les 2! +: testG +100 0 do time 10000000. / +dup dup sin 2 >array 1 gplotAdd +dup dup sin swap dup cos swap dup sin dup * swap cos +dup * 5 >array 2 gplotAdd 1 sleep loop ; + +# Meme chose que testG en remplaçant. +: testG2 +100 0 do time 10000000. / +dup dup sin 2 >array 1 gplotRepl +dup dup sin swap dup cos swap dup sin dup * swap cos +dup * 5 >array 2 gplotRepl 1 sleep loop ; + diff --git a/src/ex/rpc.nif b/src/ex/rpc.nif new file mode 100644 index 0000000..986d82b --- /dev/null +++ b/src/ex/rpc.nif @@ -0,0 +1,21 @@ +# exemple de Nife RPC +echo_off + +# 1) Mettre les fichiers rep.nif et rep2.nif dans le repertoire de nife +# 2) Connecter la machine au reseau (Me netOn) +# 3) Puis en connecter une autre (par exemple Test) +# 4) Sur la machine locale faire : load rpc.nif +# Puis : titi +# Puis : " rpc2.nif" " Test" netCompile +# 5) Verifier avec : ?s ?ns +# 6) Recuperer le resultat et nettoyer le reseau : net> ndrop + +# titi met NetKey a 0xcafe puis fabrique une rampe de 30 elts +# et l'envoie sur le Net stack + +: titi +0xcafe NetKey +30 ramp 1 >net +; + + diff --git a/src/ex/rpc2.nif b/src/ex/rpc2.nif new file mode 100644 index 0000000..827005d --- /dev/null +++ b/src/ex/rpc2.nif @@ -0,0 +1,9 @@ +# exemple 2 de Nife RPC +echo_off +# envoi d'une autre fct titi et execution +# titi calcule 2sin2(x)/cos(2x) +: titi +dup sin dup * 2 * swap 2 * cos / ; + +titi + diff --git a/src/foncs.c b/src/foncs.c new file mode 100644 index 0000000..8268a90 --- /dev/null +++ b/src/foncs.c @@ -0,0 +1,270 @@ +/* Copyright (C) 2011-2013 Patrick H. E. Foubet - S.E.R.I.A.N.E. + +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 3 of the License, or 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, see +*******************************************************************/ +/* foncs.c liste des fonctions systeme */ +#include "conf.h" + +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include + +#include "nife.h" +#include "mth.h" +#include "err.h" +#include "foncs.h" +#include "histo.h" +#include "stackN.h" +#include "stackC.h" + + +void IF_exit(void) { _MODIF_RUN_(0); } + +long long Nife_time(struct timeval tv) +{ +long long v; + /* il y a 10958 jours entre le 1/1/1970 et le 1/1/2000 */ + v=(long long)((long)tv.tv_usec) + + ((long long)(tv.tv_sec - 946771200L)*(long long)1000000); + return v; +} + +void IF_time(void) +{ +struct timeval tv; +long long v; + gettimeofday(&tv,NULL); + v=Nife_time(tv); + putLong(v); +} + +void IF_sleep(void) +{ +long t; + if (getParLong(&t)) sleep((unsigned int)t); +} + +void IF_sh (void) +{ +int pid; +char * Sh; + _MODIF_WAITPID_(1); + if ((pid = fork()) == -1) stopErr("IF_sh","fork"); + if (pid == 0) { /* fils */ + _MODIF_inSonProc_(1); + termReset(); + dup2(1,2); + if ((Sh=getenv("SHELL")) == NULL) execlp("sh", "nife-sh",NULL); + else execlp(Sh,"nife-sh",NULL); + perror("sh"); + exit(1); + } + waitpid(pid,NULL,0); + _MODIF_WAITPID_(0); + termInit(); + printf("Come back to nife !\n"); +} + +void runCommand (char * com) +{ +int pid; +char * Sh; + _MODIF_WAITPID_(1); + if ((pid = fork()) == -1) stopErr("runComm","fork"); + if (pid == 0) { /* fils */ + _MODIF_inSonProc_(1); + termReset(); + if ((Sh=getenv("SHELL")) == NULL) execlp("sh","sh","-c",com,NULL); + else execlp(Sh,"sh","-c",com,NULL); + perror("sh"); + exit(1); + } + waitpid(pid,NULL,0); + _MODIF_WAITPID_(0); + termInit(); + printf("\n"); +} + +void IF_toCsv(void) +{ +int i, lib=0; +long t; +char *f, *s, *e; +void *M; +FILE * fd; + if (getParLong(&t)) { + if (!isNTabSameDim((int)t)) { + messErr(3); + return; + } + if (!isNString(1)) { + messErr(6); + return; + } + f = getString(); + s = f; + e = f + strlen(f); + while (s < e) { + if (*s == ';') { *s= '\0'; s++; break; } + s++; + } + if (strlen(s) > 0) lib=1; + if ((M = malloc(strlen(f)+5)) == NULL) stopErr("IF_toCsv","malloc"); + sprintf((char*)M,"%s.csv",f); + fd = fopen((char*)M,"w+"); + free(M); + for (i=0; i<(int)t; i++) { + if (lib) { + if (strlen(s) > 0) { + f = s; + while (s < e) { + if (*s == ';') { *s= '\0'; s++; break; } + s++; + } + fprintf(fd,"%s;",f); + } else + fprintf(fd,"lig%d;",i+1); + } + IF_inFile_1d(fd, ';', 1); + } + fclose(fd); + free((void*)f); + } +} + +static void lanceXgraph(int mode, int tit) +{ +FILE * fd; +char nf[30]; + sprintf(nf,".nife/Nife_%d.gx",getpid()); + fd = fopen(nf,"w+"); + fprintf(fd,"Device: Postscript\nDisposition: To File\nTitleText: "); + if (tit) fprintf(fd,"%s\n",getString()); + else fprintf(fd,"Data from Nife %s\n",VERSION); + if (mode) IF_inFile_2(fd); else IF_inFile_1(fd); + fclose(fd); + execlp("xgraph","xgraph",nf,NULL); +} + +static void gen_Xgraph (int m, int t) +{ +int pid; + if (m) { + if (!isNTabSameDim(2)) { + messErr(3); + return; + } + } else { + if (!is1Tab()) { + messErr(12); + return; + } + } + if (t) { + if (!isNString(1)) { + messErr(6); + return; + } + } + if ((pid = fork()) == -1) stopErr("IF_yXgraph","fork"); + if (pid == 0) { /* fils */ + _MODIF_inSonProc_(1); + setsid(); + lanceXgraph(m,t); + perror("xgraph"); + exit(1); + } + IF_drop(); + if (m) IF_drop(); + if (t) IF_dropC(); + /* test if xgraph is executed */ + if (kill(pid,SIGWINCH) == -1) + if (errno == ESRCH) messErr(10); +} + +void IF_yXgraph (void) +{ + gen_Xgraph(0,0); +} +void IF_ytXgraph (void) +{ + gen_Xgraph(0,1); +} +void IF_xyXgraph (void) +{ + gen_Xgraph(1,0); +} +void IF_xytXgraph (void) +{ + gen_Xgraph(1,1); +} + +static void printLimits(char * M,char *U, struct rlimit * L) +{ + printf("Limites %-10s : ",M); + if (L->rlim_cur == RLIM_INFINITY) printf("infini"); + else printf("%ld",L->rlim_cur); + if (L->rlim_cur == RLIM_INFINITY) printf("/infini"); + else printf("/%ld",L->rlim_cur); + printf(" %s\n",U); +} + + +void IF_resUsage(void) +{ +struct rusage R; +struct rlimit L; + if (getrusage(RUSAGE_SELF,&R) == 0) { + printf("Temps processus : %ld.%.6ld\n",R.ru_utime.tv_sec,R.ru_utime.tv_usec); + printf("Temps système : %ld.%.6ld\n",R.ru_utime.tv_sec,R.ru_utime.tv_usec); +/* non significatif ************** + printf("Taille résidente maximale : %ld\n",R.ru_maxrss); + printf("Taille des données non partagées : %ld\n",R.ru_idrss); + printf("Taille de Pile : %ld\n",R.ru_isrss); +**********************************/ + printf("Demandes de pages : %ld\n",R.ru_minflt); + printf("Nombre de fautes de pages : %ld\n",R.ru_majflt); + printf("Changts de contexte volontaires : %ld\n",R.ru_nvcsw); + printf("Changts de contexte involontaires: %ld\n",R.ru_nivcsw); + } else perror("getrusage"); +/* + if (getrlimit(RLIMIT_AS,&L) == 0) { printLimits("AS","octets",&L); + } else perror("getrlimit AS"); +***************/ + if (getrlimit(RLIMIT_CORE,&L) == 0) { printLimits("CORE","octets",&L); + } else perror("getrlimit CORE"); + if (getrlimit(RLIMIT_CPU,&L) == 0) { printLimits("CPU","sec.",&L); + } else perror("getrlimit CPU"); +/* not in Solaris *************** + if (getrlimit(RLIMIT_RSS,&L) == 0) { printLimits("RSS","pages",&L); + } else perror("getrlimit RSS"); */ + if (getrlimit(RLIMIT_DATA,&L) == 0) { printLimits("DATA","pages",&L); + } else perror("getrlimit DATA"); + if (getrlimit(RLIMIT_STACK,&L) == 0) { printLimits("STACK","octets",&L); + } else perror("getrlimit STACK"); +/* not in Solaris *************** + if (getrlimit(RLIMIT_NPROC,&L) == 0) { printLimits("NPROC","processus",&L); + } else perror("getrlimit NPROC"); */ + if (getrlimit(RLIMIT_NOFILE,&L) == 0) { printLimits("NOFILE","file desc.",&L); + } else perror("getrlimit NOFILE"); + +} + diff --git a/src/foncs.h b/src/foncs.h new file mode 100644 index 0000000..d7830db --- /dev/null +++ b/src/foncs.h @@ -0,0 +1,35 @@ +/* Copyright (C) 2011-2013 Patrick H. E. Foubet - S.E.R.I.A.N.E. + +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 3 of the License, or 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, see +*******************************************************************/ +/* liste des fonctions systeme */ + +#ifndef __NIFE_FONCS_H__ +#define __NIFE_FONCS_H__ +extern long long Nife_time(struct timeval); + +extern void IF_exit(void); +extern void IF_time(void); +extern void IF_sleep(void); +extern void IF_sh(void); +extern void IF_toCsv(void); +extern void IF_yXgraph(void); +extern void IF_ytXgraph(void); +extern void IF_xyXgraph(void); +extern void IF_xytXgraph(void); +extern void IF_resUsage(void); + +extern void runCommand( char * C); + +#endif diff --git a/src/gplot.c b/src/gplot.c new file mode 100644 index 0000000..b77a188 --- /dev/null +++ b/src/gplot.c @@ -0,0 +1,370 @@ +/* Copyright (C) 2011-2013 Patrick H. E. Foubet - S.E.R.I.A.N.E. + +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 3 of the License, or 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, see +*******************************************************************/ +/* liste des fonctions liees a gnuplot */ +/* gplot.c */ +#include +#include +#include +#include +#include +#include +#include +#include + +#include "gplot.h" +#include "nife.h" +#include "mth.h" +#include "stackN.h" +#include "stackC.h" +#include "err.h" + +#define GPO_STD 0 /* standard */ +#define GPO_MRG 0x100 /* merge */ + +struct GPlot { + short id; + short op;/* options + nb plots */ + FILE *p; /* pipe */ + char *t; /* title */ + char *f; /* file */ + char *a; /* command append */ + int pid; /* pid */ + void *n; /* next */ +}; + +static short GPid=0; + +static void *stackGP = VIDE; + +/* file manipulations */ +static void GPF_init(char *f) +{ +int fd; + chdir(".nife"); + if ((fd = creat(f,0600)) != -1) { + write(fd,"# Nife auto-generated GNUplot file !\n",37); + close(fd); + } + chdir(".."); +} + +static void GPF_del(char *f) +{ + unlink(f); +} + +static void GPF_supL(char * f, int n) +{ +void * M; +char *f2; +char l[512]; +FILE *fIn, *fOut; +int i=1; + if ((M = malloc(strlen(f)+5)) == NULL) stopErr("GPF_supL","malloc"); + f2 = (char*)M; + strcpy(f2,f); + f2 += strlen(f); + strcpy(f2,".wni"); + f2 = (char*)M; + if ((fIn = fopen(f, "r")) != NULL) { + if ((fOut = fopen(f2, "w")) != NULL) { + while (fgets(l, sizeof(l), fIn)) { + if (i != n) fputs(l, fOut); + i++; + } + fclose(fOut); + } + fclose(fIn); + rename(f2, f); + } + free(M); +} + +/* struct GPlot functions */ + +static void eraseGP(struct GPlot *F) +{ + GPF_del(F->f); + free((void*)F->t); + free((void*)F->f); + if (F->a != NULL) free((void*)F->a); + free((void*)F); +} + +static void GP_initial(struct GPlot * N) +{ + fprintf(N->p, "set term x11 title \"Nife GPlot %d\" size 400,300\n", N->id); + fprintf(N->p, "unset mouse\n"); +} + +static void GP_create(short op, char *T, char *F) +{ +int pid, p[2]; +void * M; +struct GPlot *N; + if ((M = malloc(sizeof(struct GPlot)))==NULL) stopErr("GP_create","malloc"); + N = (struct GPlot*)M; + N->id = ++GPid; + N->op = op; + N->t = T; + N->f = F; + N->a = NULL; + N->n = stackGP; + GPF_init(N->f); + /* Old method ********** + N->p = popen("gnuplot -p -raise","w"); + *********/ + if (pipe(p) != 0) stopErr("GP_create","pipe"); + N->p = fdopen(p[1], "w"); /* w side */ + if ((pid = fork()) == -1) { + fprintf(stderr,"GP_create : error fork !\n"); + eraseGP(N); + } else { + if (pid == 0) { /* fils */ + dup2(p[0],0); + close(p[0]); + close(p[1]); + _MODIF_inSonProc_(1); + setsid(); + execlp("gnuplot", "Nife_gplot", "-p", "-raise", NULL); + perror("gnuplot"); + exit(1); + } else { + N->pid = pid; + close(p[0]); + stackGP = M; + GP_initial(N); + } + } +} + +static void GP_del(short id) +{ +void ** PNext; +struct GPlot * N; + PNext = &stackGP; + while (*PNext != VIDE) { + N = (struct GPlot*) *PNext; + if (N->id == id) { + *PNext = N->n; + /* stop gnuplot */ + fprintf(N->p,"exit\n"); + fflush(N->p); + kill(N->pid,SIGKILL); + eraseGP(N); + return; + } + PNext = &N->n; + } + messErr(42); +} + +void IF_delAllGP(void) +{ +struct GPlot * N; + while (stackGP != VIDE) { + N = (struct GPlot*) stackGP; + stackGP = N->n; + /* stop gnuplot */ + fprintf(N->p,"exit\n"); + fflush(N->p); + kill(N->pid,SIGKILL); + eraseGP(N); + } + GPid=0; +} + +static struct GPlot * GP_getPlot(short id) +{ +void ** PNext; +struct GPlot * N; + PNext = &stackGP; + while (*PNext != VIDE) { + N = (struct GPlot*) *PNext; + if (N->id == id) { + return N; + } + PNext = &N->n; + } + messErr(42); + return NULL; +} + + +static void GP_plot(struct GPlot * N) +{ +int i; + fprintf(N->p, "set term x11 title \"Nife GPlot %d\"\n", N->id); + fprintf(N->p, "plot "); + for (i=0; i<(N->op&0xFF); i++) { + if (i) fprintf(N->p,", "); + fprintf(N->p,"\"%s\" using 1:%d title \"",N->f, i+2); + if (i) fprintf(N->p,"col %d",i+1); + else fprintf(N->p,"%s",N->t); + fprintf(N->p,"\" with lines "); + if (N->a != NULL) fprintf(N->p,"%s",N->a); + } + fprintf(N->p,"\n"); + fflush(N->p); +} + +static void GP_updApp(short id, char * a) +{ +struct GPlot * N; + if ((N = GP_getPlot(id)) != NULL) { + if (N->a != NULL) free((void*)N->a); + N->a = a; + /* redraw gnuplot */ + GP_plot(N); + return; + } + free((void*)a); +} + +static void GP_addData(short id) +{ +struct GPlot * N; +FILE *fd; + if ((N = GP_getPlot(id)) != NULL) { + /* Add data to file */ + fd = fopen(N->f,"a"); + IF_inFile_1d(fd, ' ', 0); + fclose(fd); + /* redraw gnuplot */ + GP_plot(N); + } +} + +static void GP_replData(short id) +{ +struct GPlot * N; +FILE *fd; + if ((N = GP_getPlot(id)) != NULL) { + /* delete the second line */ + GPF_supL(N->f,2); + /* Add data to file */ + fd = fopen(N->f,"a"); + IF_inFile_1d(fd, ' ', 0); + fclose(fd); + /* redraw gnuplot */ + GP_plot(N); + } +} + +void IF_gplot_new(void) +{ +char *t, *f; + if (!isNString(2)) { + messErr(6); + return; + } + t = getString(); + f = getString(); + GP_create(GPO_STD|1,t,f); +} + +void IF_gplot_newM(void) +{ +char *t, *f; +long n; + if (getParLong(&n)) { + if (!isNString(2)) { + messErr(6); + return; + } + t = getString(); + f = getString(); + GP_create(GPO_STD|(short)n,t,f); + } +} + +void IF_gplot_del(void) +{ +long t; + if (getParLong(&t)) { + GP_del((short)t); + } +} + +void IF_gplot_clear(void) +{ +long t; +struct GPlot * N; + if (getParLong(&t)) { + if ((N = GP_getPlot((short)t)) != NULL) { + GPF_init(N->f); + /* redraw gnuplot */ + GP_plot(N); + } + } +} + +void IF_gplot_commapp(void) +{ +long t; +char *a; + if (getParLong(&t)) { + if (!isNString(1)) { + messErr(6); + return; + } + a = getString(); + GP_updApp((short)t,a); + } +} + +void IF_gplot_append(void) +{ +long t; + if (getParLong(&t)) { + if (!is1Tab()) { + messErr(12); + return; + } + GP_addData((short)t); + } +} + +void IF_gplot_replace(void) +{ +long t; + if (getParLong(&t)) { + if (!is1Tab()) { + messErr(12); + return; + } + GP_replData((short)t); + } +} + +void IF_show_stackGP(void) +{ +void * Next; +struct GPlot * N; + if (stackGP != VIDE) + printf(" id |NbP| filename | Title | Options\n"); + Next = stackGP; + while (Next != VIDE) { + N = (struct GPlot*) Next; + printf("%5d|%3d|%-12s|%-25s|%s\n",N->id,N->op&0xFF,N->f, N->t, N->a); + Next = N->n; + } + printf("\n"); +} + + + + diff --git a/src/gplot.h b/src/gplot.h new file mode 100644 index 0000000..3025421 --- /dev/null +++ b/src/gplot.h @@ -0,0 +1,31 @@ +/* Copyright (C) 2011-2013 Patrick H. E. Foubet - S.E.R.I.A.N.E. + +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 3 of the License, or 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, see +*******************************************************************/ +/* liste des fonctions liees a gnuplot */ + +#ifndef __NIFE_GPLOT_H__ +#define __NIFE_GPLOT_H__ + +extern void IF_delAllGP(void); +extern void IF_gplot_new(void); +extern void IF_gplot_newM(void); +extern void IF_gplot_del(void); +extern void IF_gplot_clear(void); +extern void IF_gplot_commapp(void); +extern void IF_gplot_append(void); +extern void IF_gplot_replace(void); +extern void IF_show_stackGP(void); + +#endif diff --git a/src/help.c b/src/help.c new file mode 100644 index 0000000..c51a2d3 --- /dev/null +++ b/src/help.c @@ -0,0 +1,55 @@ +/* Copyright (C) 2011-2013 Patrick H. E. Foubet - S.E.R.I.A.N.E. + +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 3 of the License, or 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, see +*******************************************************************/ +/* help.c */ +#include +#include + +#include "help.h" +#include "nife.h" + +#define LHLP 200 /* longueur MAX des lignes du fichier hlp */ +static char buf[LHLP]; +void helpStd(char * L) +{ +FILE * fd; +int debut=0,l; + dropTrSuite(); + if ((fd = fopen("nife.hlp","r")) == NULL) { + perror("help file"); + return; + } else { + while (fgets(buf,LHLP,fd) != NULL) { + if (debut) { + if (buf[0] != ' ') break; + } else { + if (buf[0] == ' ') continue; + l=strlen(L); + if (strncmp(L,buf,l)!=0) continue; + if (buf[l]!=' ') continue; + debut=1; + } + printf("%s",buf); + } + } + if (debut==0) printf("No help find !\n"); + fclose(fd); +} + + +void IF_help(void) +{ + putTrSuite(helpStd); +} diff --git a/src/help.h b/src/help.h new file mode 100644 index 0000000..bcaa2c0 --- /dev/null +++ b/src/help.h @@ -0,0 +1,23 @@ +/* Copyright (C) 2011-2013 Patrick H. E. Foubet - S.E.R.I.A.N.E. + +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 3 of the License, or 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, see +*******************************************************************/ +/* help.h */ + +#ifndef __NIFE_HELP_H__ +#define __NIFE_HELP_H__ + +extern void IF_help(void); + +#endif diff --git a/src/histo.c b/src/histo.c new file mode 100644 index 0000000..dec002c --- /dev/null +++ b/src/histo.c @@ -0,0 +1,460 @@ +/* Copyright (C) 2011-2013 Patrick H. E. Foubet - S.E.R.I.A.N.E. + +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 3 of the License, or 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, see +*******************************************************************/ +/* histo.c */ +#include "conf.h" + +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include + +#include "histo.h" +#include "nife.h" +#include "mth.h" +#include "err.h" +#include "lib.h" +#include "debug.h" + + +#define HISTOMAX 100 +static char * HIST[HISTOMAX]; +static int iH=0, iHt, iHl, iHFull=0; + +#define FDMAX 128 +static int iFD=0; +static int FD_T[FDMAX], FD_L[FDMAX]; /* fd table and line numbers */ +static void *FD_N[FDMAX]; + +void IF_showFD(void) +{ + printf("iFD=%d FD_T=%d FD_L=%d\n",iFD, FD_T[iFD], FD_L[iFD]); +} + +void addFD(int fd, char*S) +{ +void *M; + iFD++; + /* printf("addFD iFD=%d\n",iFD); */ + if (iFD == FDMAX) { + iFD--; + messErr(45); + return; + } + _MODIF_FD_IN_(fd); + FD_T[iFD]=fd; + FD_L[iFD]=0; + if ((M = malloc(strlen(S)+1)) == NULL) stopErr("addFD","malloc"); +#ifdef DEBUG_M + printf("New String address : %lu \n",(unsigned long)M); +#endif + strcpy((char*)M,S); + FD_N[iFD]=M; +} + +void closeFD(void) +{ + /* printf("closeFD iFD=%d\n",iFD); */ + close(FD_IN); + free(FD_N[iFD]); + iFD--; + if (iFD) _MODIF_FD_IN_(FD_T[iFD]); + else _MODIF_FD_IN_(0); +} + +int getFDlig(void) +{ + return FD_L[iFD]; +} + +char * getFDname(void) +{ + return (char*)FD_N[iFD]; +} + +void incFDlig(void) +{ + FD_L[iFD]++; +} + + +void razHisto(void) +{ +int i; + for(i=0;i= s) { *(w+1) = *w; w--; } + *s=c; +} + +int lireLigne(int fd, char *b, char *s, int nc) +/* fd = file descriptor + b = adresse du buffer + nc = nb de caracteres possible (longueur du buffer */ +{ +char *d, *f, c, c2, c3, *h, *w, *Wl, *rac; +int n, i, l, ls=0, ins=0, ignTild=0, nbT=0; +unsigned int j; + /* printf("lireLigne ... \n"); */ + d = b; + f = b+nc; + while(d b=<%s>\n",d-b,ins,s,b); */ + if ((n=read(fd,d,1)) != 1) break; + c=*d; + if (ignTild && (c == '~')) { + ignTild=0; continue; + } + if ((c > 31) && (c < 127)) { /* de SPACE a TILDE */ + if (!((FD_IN || iTERM) && ECHOOFF)) { + printf("%c",c); + if (ins) { + if (ins==2) /* rewrite */ + enleve1(s); + if(*s =='\0') ins=0; + else { + printf("%s",s); + for (j=0; jb) { + *d='\0'; + w=d-1; + while ((w>b) && (!(isSepa(*w,1)))) w--; + if (isSepa(*w,0)) w++; + /* fprintf(stderr,"d-b=%d w=<%s>\n",d-b,w); */ + if (strlen(w) > 0) { + j=nbLibBegin(w, &rac); + /* fprintf(stderr,"j=%d w=<%s>\n",j,w); */ + if (j==0) printf("\a"); + else { + if (j==1) { + Wl=getLibBegin(w); + i=strlen(Wl)-strlen(w); + /* fprintf(stderr,"i=%d Wl=<%s>\n",i,Wl); */ + if (i>0) { + strcpy(w,Wl); + printf("%s ",d); + d+=i; + *d++ = ' '; + if (ins) { + printf("%s ",s); + for (j=0; j<(strlen(s)+1); j++) printf("\b"); + } + } else { /* XXXX */ + if (i==0) { + printf (" "); + *d++ = ' '; + } + } + } else { + if (rac != NULL) { + i=strlen(rac)-strlen(w); + strcpy(w,rac); + printf("%s",d); + d+=i; + if (ins) { + printf("%s ",s); + for (j=0; j<(strlen(s)+1); j++) printf("\b"); + } + } else { + nbT++; + if (nbT>1) { + nbT=0; + printf("\n"); + listLibBegin(w); + *d='\0'; + printf("> %s",b); + if (ins) { + printf("%s ",s); + for (j=0; j<(strlen(s)+1); j++) printf("\b"); + } + fflush(stdout); + } + } + } + } + fflush(stdout); + } + } + break; + case '\177': + if (d>b) { + printf("\b \b"); + if (ins) { + printf("%s ",s); + for (j=0; j<(strlen(s)+1); j++) printf("\b"); + } + fflush(stdout); + d--; + } + break; + case '\n': + case '\r': + if ((FD_IN || iTERM) && ECHOOFF) printf("."); + else { + printf("\n"); + if (ins) { + if (d+strlen(s) < f) { + sprintf(d,"%s",s); + d+=strlen(s); + } else return(-1); + } + } + goto finBoucle; + /* gestion des caracteres speciaux */ + case '\033': /* ESCAPE */ + ignTild=1; + read(fd,&c2,1); + read(fd,&c3,1); + if (c2 == '[') { + switch(c3) { + case '2' : /* Insert */ + if (ins) { + ins++; + if (ins==3) ins=1; + } + break; + case '3' : /* Suppr */ + if (ins) { + enleve1(s); + if(*s =='\0') ins=0; + printf("%s \b",s); + for (j=0; j */ + if (ins) { + *d = *s; + printf("%c",*d++); + enleve1(s); + if(*s =='\0') ins=0; + else { + printf("%s",s); + for (j=0; jb) { + if (ins==0) { + ins=1; + *d='\0'; + strcpy(s,d-1); + } else insertC(*(d-1),s); + d--; + printf("\b"); + fflush(stdout); + } + break; + default: + printf("\nESC [ %d (%c) !\n",(int)c3, c3); + *d='\0'; + printf("> %s",b); + fflush(stdout); + } + } else { + if (c2 == 'O') { + switch(c3) { + case 'P' : /* F1 */ + break; + case 'Q' : /* F2 */ + break; + case 'R' : /* F3 */ + break; + case 'S' : /* F4 */ + break; + } + } else { + printf("\nESC %d %d (%c) !\n",(int)c2,(int)c3, c3); + *d='\0'; + printf("> %s",b); + fflush(stdout); + } + } + break; + default : +/* + printf("\nCar = %d !\n",(int)c); + *d='\0'; + printf("> %s",b); + fflush(stdout); +*/ + break; + } + } + if (ins) ls = strlen(s); + } +finBoucle: + /* printf("fin lireLigne!\n"); */ + if ((n<1) && (FD_IN !=0)) { + closeFD(); /* fichier loader */ + if (ECHOOFF) printf("\n"); + return 0; + } + if ((n<1) && iTERM) { + close(FD_IN); /* pipe ou autre */ + dup(iTERM); /* stdin on term */ + iTERM = 0; + if (ECHOOFF) printf("\n"); + return 0; + } + if (d == f) { /* cas du buffer trop petit */ +/* d=b; + while (*d != '\n') read(fd,d,1); +**** not in raw mode */ +#ifdef DEBUG + printf("lireLigne : erreur !\n"); +#endif + return(-1); + } + *d = '\0'; +#ifdef DEBUG + printf("lireLigne : retour <%s> !\n",b); +#endif + if (!FD_IN) putHisto(b); + incFDlig(); + return(strlen(b)); +} + + diff --git a/src/histo.h b/src/histo.h new file mode 100644 index 0000000..4dd3c1d --- /dev/null +++ b/src/histo.h @@ -0,0 +1,32 @@ +/* Copyright (C) 2011-2013 Patrick H. E. Foubet - S.E.R.I.A.N.E. + +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 3 of the License, or 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, see +*******************************************************************/ +/* histo.h */ + +#ifndef __NIFE_HISTO_H__ +#define __NIFE_HISTO_H__ + +extern int iTERM; + +extern void IF_showFD(void); +extern void addFD(int fd, char *N); +extern void closeFD(void); +extern int getFDlig(void); +extern char * getFDname(void); +extern int lireLigne(int fd, char * buf, char * buf2, int max); +extern void termInit(void); +extern void termReset(void); + +#endif diff --git a/src/lib.c b/src/lib.c new file mode 100644 index 0000000..510c1f5 --- /dev/null +++ b/src/lib.c @@ -0,0 +1,642 @@ +/* Copyright (C) 2011-2013 Patrick H. E. Foubet - S.E.R.I.A.N.E. + +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 3 of the License, or 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, see +*******************************************************************/ +#include "conf.h" +/* lib.c librairie de base */ +#include +#include +#include + +#include "nife.h" +#include "mth.h" +#include "err.h" +#include "histo.h" +#include "foncs.h" +#include "tasks.h" +#include "stackN.h" +#include "stackL.h" +#include "stackC.h" +#include "stackF.h" +#include "stackV.h" +#include "libmath.h" +#include "help.h" +#include "dev.h" +#include "net.h" +#include "gplot.h" +#include "debug.h" + +/* familles des fonctions */ +#define F_CORE 1 /* Core */ +#define F_MATH 2 /* Mathematiques */ +#define F_PROG 4 /* Programmation, variables, tasks, ... */ +#define F_TOOL 8 /* External Tools Graphical or others */ +#define F_DEV 16 /* devices, comedi interfaces, ... */ +#define F_NET 32 /* networking functions */ +#define F_USR 64 /* user system functions */ + +struct fonction { + char * nam; + void (* fct)(void); + short typ; /* 0 fct, 1 instruction, 2 externe, 3 usr fct */ + short fam; /* cf F_xxx ci-dessus */ +}; + +#define NBFONC 400 +#define NBCMOY 12 /* nb de car. en moyenne */ +static char Libelles[NBFONC*NBCMOY], *pLibs=Libelles; +static struct fonction Fonctions[NBFONC]; +static int NBFonc=0; +int InstallOn=0; + +static void IF_INSTALL(void) { InstallOn=1; } +static void IF_INSTALLF(void) { InstallOn=2; } +static void IF_INSTALLV(void) { InstallOn=3; } +/* for dynamic functions */ +static void IF_DF_INIT(void) { InstallOn=8; } +static void IF_DF_START(void) { InstallOn=9; } +static void IF_DF_STOP(void) { InstallOn=10; } + +static void addFoncT(char *l, void (*f)(void), short T, short F) +{ +char *LMax; + if (NBFonc >= NBFONC) stopErr("addFonc : NBFONC !",NULL); + LMax = Libelles + (NBFONC*NBCMOY); + if (pLibs + strlen(l) + 1 >= LMax) stopErr("addFonc : Libelles !",NULL); + Fonctions[NBFonc].nam = pLibs; + Fonctions[NBFonc].typ = T; + Fonctions[NBFonc].fam = F; + Fonctions[NBFonc++].fct = f; + strcpy(pLibs,l); + pLibs += strlen(l); + *pLibs++ = '\0'; +} +static void addFonc(char *l, void (*f)(void)) +{ + addFoncT(l,f,0,F_CORE); +} +static void addFonM(char *l, void (*f)(void)) +{ + addFoncT(l,f,0,F_MATH); +} +static void addFonP(char *l, void (*f)(void)) +{ + addFoncT(l,f,0,F_PROG); +} +static void addFonG(char *l, void (*f)(void)) +{ + addFoncT(l,f,0,F_TOOL); +} +static void addFonD(char *l, void (*f)(void)) +{ + addFoncT(l,f,0,F_DEV); +} +static void addFonN(char *l, void (*f)(void)) +{ + addFoncT(l,f,0,F_NET); +} +void addFonU(char *l, void *A) +{ +PFV f; + f = (PFV)A; + addFoncT(l,f,0,F_USR); +} +static void addFonE(char *l, void (*f)(void), short F) /* External functions */ +{ /* not beetween : and ;*/ + addFoncT(l,f,2,F); +} +static void addInst(char *l, void (*f)(void)) +{ + addFoncT(l,f,1,F_PROG); +} + +static char **ListFonc = (char**)NULL; + +static void Show_library(int NbF) +{ +int i,j=0; + for (i=0;i0) break; + } + if (j) printf("\n"); +} + +char * getLibBegin(char * b) +{ +int i,l; + l=strlen(b); + for(i=0;i0) break; + if (strncmp(ListFonc[i],b,l)==0) { + t++; + if (first) { + strcpy(Rac,ListFonc[i]); + first=0; + } else { + if (strlen(Rac) > l) { + for(j=l;j l) *r = Rac; + else *r = NULL; + return(t); +} + +void IF_show_liball(void) +{ + Show_library(triList(0xFF)); +} +void IF_show_libstd(void) +{ + Show_library(triList(F_CORE)); +} +void IF_show_libmath(void) +{ + Show_library(triList(F_MATH)); +} +void IF_show_libprog(void) +{ + Show_library(triList(F_PROG)); +} +void IF_show_libtools(void) +{ + Show_library(triList(F_TOOL)); +} +void IF_show_libdev(void) +{ + Show_library(triList(F_DEV)); +} +void IF_show_libnet(void) +{ + Show_library(triList(F_NET)); +} +void IF_show_libusr(void) +{ + Show_library(triList(F_USR)); +} + +void initLib(void) +{ + addFonc(".",IF_point); + addFonc("+",IF_plus); + addFonc("-",IF_moins); + addFonc("=",IF_Legal); + addFonc("<>",IF_Ldiff); + addFonc(">",IF_Lsup); + addFonc("<",IF_Linf); + addFonc(">=",IF_Lsupeg); + addFonc("<=",IF_Linfeg); + addFonc("*",IF_mult); + addFonc("/",IF_div); + addFonc("neg",IF_neg); + addFonc("min",IF_min); + addFonc("max",IF_max); + addFonc("modulo",IF_modulo); + addFonc("**",IF_puiss); + addFonc("[]-sub",IF_subTab); + addFonc("[]sub",IF_subTabR); + addFonc("*[]-sub",IF_NsubTab); + addFonc("*[]sub",IF_NsubTabR); + addFonc("[]rev",IF_TabRev); + addFonc("*[]rev",IF_NTabRev); + addFonc("[]crot",IF_TabTransp); + addFonc("[]transp",IF_TabTranspN); + addFonc("[]trot",IF_TabTranspT); + addFonc("[]>>",IF_TNShiftR); + addFonc("[]<<",IF_TNShiftL); + addFonc("*[]>>",IF_NTNShiftR); + addFonc("*[]<<",IF_NTNShiftL); + addFonc("[]>",IF_TShiftR); + addFonc("[]<",IF_TShiftL); + addFonc("*[]>",IF_NTShiftR); + addFonc("*[]<",IF_NTShiftL); + addFonc("[]min",IF_TABMin); + addFonc("[]max",IF_TABMax); + addFonc("[]sum",IF_TABSum); + addFonc("[]prod",IF_TABProd); + addFonc("[]min/max",IF_TABMinMax); + addFonc(">array",IF_toArray); + addFonc(">scalar",IF_toScalar); + addFonc(">-scalar",IF_toScalarR); + addFonc("\"",IF_debString); + addFonc("\"drop",IF_dropC); + addFonc("\"dup",IF_dupC); + addFonc("\"over",IF_overC); + addFonc("\"swap",IF_swapC); + addFonc("\"type",IF_typeC); + addFonc("\"cat",IF_catC); + addFonc("\"cats",IF_catsC); + addFonc("cr",IF_crC); + addFonc("\"time",IF_timeC); + addFonc("\"date",IF_dateC); + addFonc("sleep",IF_sleep); + addFonc("sh",IF_sh); + addFonc("?drop",IF_dropL); + addFonc("?dup",IF_dupL); + addFonc("?swap",IF_swapL); + addFonc("?over",IF_overL); + addFonc("?t/f",IF_typeL); + addFonc("and",IF_andL); + addFonc("or",IF_orL); + addFonc("xor",IF_xorL); + addFonP("fdrop",rmLastFct); + addFonE("del_func",IF_delFct, F_PROG); + addFonE("del_afunc",IF_delAFct, F_PROG); + addFonE("del_ofunc",IF_delOFct, F_PROG); + addFonE("fscan",IF_scanFct, F_PROG); + addFonc("?cs",IF_show_stackC); + addFonP("?f",IF_show_stackF); + /* addFonP("?l",IF_showFD); for debugging */ + addFonP("?v",IF_show_stackV); + addFonE("del_var",IF_delVar,F_PROG); + addFonP("vdrop",rmLastVar); + addFonP("reset_var",IF_setVarI); + addFonP(">v",IF_setVarN); + addFonP("?>v",IF_setVarB); + addFonP("\">v",IF_setVarC); + addFonP("in",IF_setVarLF); + addFonP("install",IF_INSTALL); + addFonP("install_f",IF_INSTALLF); + addFonP("install_v",IF_INSTALLV); + addFonP("df_init",IF_DF_INIT); + addFonP("df_start",IF_DF_START); + addFonP("df_stop",IF_DF_STOP); + addFonc("?ls",IF_show_stackL); + addFonc("?s",IF_show_stack); + addFonc("?libs",IF_show_liball); + addFonc("?lib",IF_show_libstd); + addFonc("?libM",IF_show_libmath); + addFonc("?libT",IF_show_libtools); + addFonc("?libP",IF_show_libprog); + addFonc("?libD",IF_show_libdev); + addFonc("?libN",IF_show_libnet); + addFonc("?libU",IF_show_libusr); + addFonc("?lasterr",IF_showError); + addFonc("?err",IF_IsError); + addFonc("noerr",IF_NoError); + addFonc("messerr",IF_LibError); + addFonc("ls_clear",IF_stackL_clear); + addFonc("cs_clear",IF_stackC_clear); + addFonc("REAL",IF_REAL); + addFonc("INTEGER",IF_INTEGER); + addFonc("echo_on",IF_ECHOON); + addFonc("echo_off",IF_ECHOFF); + addFonc("DEBUG_I/O",D_Update); + addFonc("NBTAB",IF_NBTAB); + addFonc("NBLIG",IF_NBLIG); + addFonE("Var",IF_debVar, F_PROG); + addFonc("\"Var",IF_debVarCS); + addFonP("var_off",IF_VAROFF); + addFonP("var_up",IF_VARUP); + addFonP("var_down",IF_VARDOWN); + addFonc("?vars",IF_vars); + addFonc("drop",IF_drop); + addFonc("dup",IF_dup); + addFonc("swap",IF_swap); + addFonc("over",IF_over); + addFonc("pick",IF_pick); + addFonc("rot",IF_rot); + addFonc("unrot",IF_unrot); + addFonc("roll",IF_roll); + addFonc("unroll",IF_unroll); + addFonc("*drop",IF_Ndrop); + addFonc("*dup",IF_Ndup); + addFonc("depth",IF_depth); + addFonc("exit",IF_exit); + addFonc("false",IF_false); + addFonc("not",negBool); + addFonc("ramp",IF_ramp); + addFonc("dramp",IF_dramp); + addFonc("rusage",IF_resUsage); + addFonc("s_clear",IF_stack_clear); + addFonM("inv",IF_inv); + addFonM("sqrt",IF_sqrt); + addFonM("cbrt",IF_cbrt); + addFonM("round",IF_round); + addFonM("floor",IF_floor); + addFonM("ceil",IF_ceil); + addFonM("sgn",IF_sgn); + addFonM("abs",IF_abs); + addFonM("pi",IF_pi); + addFonM("sin",IF_sin); + addFonM("cos",IF_cos); + addFonM("tan",IF_tan); + addFonM("asin",IF_asin); + addFonM("acos",IF_acos); + addFonM("atan",IF_atan); + addFonM("sinh",IF_sinh); + addFonM("cosh",IF_cosh); + addFonM("tanh",IF_tanh); + addFonM("asinh",IF_asinh); + addFonM("acosh",IF_acosh); + addFonM("atanh",IF_atanh); + addFonM("ln",IF_ln); + addFonM("log",IF_log); + addFonM("exp",IF_exp); + addFonM("j0",IF_j0); + addFonM("j1",IF_j1); + addFonM("y0",IF_y0); + addFonM("y1",IF_y1); + addFonc("time",IF_time); + addFonc("true",IF_true); + addFonc("about",IF_about); + addFonc("vers",IF_vers); + addFonE("load",IF_Load, F_PROG); + addFonP("\"load",IF_LoadCS); + addFonP("\"exec",IF_ExecCS); + addFonP("\"execf",IF_ExecCSf); + addInst("\"execk",IF_EXEK); + addFonG(">csv",IF_toCsv); + addFonG("y_xgraph",IF_yXgraph); + addFonG("yt_xgraph",IF_ytXgraph); + addFonG("xy_xgraph",IF_xyXgraph); + addFonG("xyt_xgraph",IF_xytXgraph); + addFonG("?gp",IF_show_stackGP); + addFonG("gplot",IF_gplot_new); + addFonG("gplotM",IF_gplot_newM); + addFonG("gplotRaz",IF_delAllGP); + addFonG("gplotCmd",IF_gplot_commapp); + addFonG("gplotAdd",IF_gplot_append); + addFonG("gplotRepl",IF_gplot_replace); + addFonG("del_gplot",IF_gplot_del); + addFonG("gplotClear",IF_gplot_clear); + addFonP(":",IF_debFct); + addFonP(":!",IF_debFctS); + addFonP("Task",IF_NewTask); + addFonP("?t",IF_show_Tasks); + addFonP("?task_run",IF_statusTask); + addFonP("del_task",IF_delTask); + addFonP("\"f",IF_execCS); + addFonP("\"v",IF_execCSv); + addFonP("\"f?",IF_execCSl); + addFonP("\"v?",IF_execCSvl); + addFonP("stop_task",IF_stopTask); + addFonP("?console",IF_showCons); + addInst(";",IF_finFct); + addInst("'",IF_debBackC); + addInst("`",IF_debBackC1); + addInst("return",IF_RET); + addInst("if",IF_IF); + addInst("else",IF_ELSE); + addInst("then",IF_THEN); + addInst("begin",IF_BEGIN); + addInst("again",IF_AGAIN); + addInst("until",IF_UNTIL); + addInst("while",IF_WHILE); + addInst("repeat",IF_REPEAT); + addInst("do",IF_DO); + addFonc("do_leave",IF_DO_Leave); + addFonc("*do_leave",IF_DO_MLeave); + addFonc("do_next",IF_DO_Next); + /* addFonc("?do",IF_DO_Show); for debugging */ + addFonc("ndo",IF_nDO); + addInst("loop",IF_LOOP); + addInst("+loop",IF_PLOOP); + addInst("I",IF_I_DO); + addInst("J",IF_J_DO); + addInst("K",IF_K_DO); + addInst("break",IF_BREAK); + addInst("myself",IF_MYSELF); + addInst("onerr:",IF_ONERR); + addInst("end:",IF_END); + addInst("goto_end",IF_JEND); + addFonE("help",IF_help, F_CORE); + addFonD("?dev",IF_listDev); + addFonD("dev_info",IF_showDev); + addFonD("dev_read",IF_devRead); + addFonD("dev_write",IF_devWrite); + addFonD("dev_dflt",IF_devDflt); + addFonD("?dev_dflt",IF_devShowDflt); + addFonD("dev_dflW",IF_devDflW); + addFonD("dev_dflR",IF_devDflR); + addFonN("?n",IF_netList); + addFonN("netOn",IF_netOn); + addFonN("netOff",IF_netOff); + addFonN("netDt>",IF_netDt); + addFonN("netExec",IF_netExec); + addFonN("netCompile",IF_netCompile); + addFonN("ndepth",IF_netDepth); + addFonN("stopServer",IF_netStopS); + addFonN("NetServer",IF_NetServer); + addFonN("srusage",IF_netRusage); + addFonN("NetKey",IF_NetKey); + addFonN("NetErr",IF_NetErrVal); + addFonN("Me",IF_Me); + addFonN("?ns",IF_netStackList); + addFonN(">net",IF_netU2S); + addFonN("net>",IF_netS2U); + addFonN("ndrop",IF_netDropS); + /* triList(); */ +} + +void * libByName(char * L) +{ +int i; + for (i=0;i +*******************************************************************/ +/* lib.h */ + +#ifndef __NIFE_LIB_H__ +#define __NIFE_LIB_H__ + +#define LCOM 30 /* longueur maxi d'une commande */ + +extern int InstallOn; +extern void initLib(void); +extern int execLibNrpc(char * C); +extern int execLib(char * C); +extern char * libByAddr(void *A); +extern void listLibBegin(char *b); +extern char * getLibBegin(char *b); +extern int nbLibBegin(char *b, char **rac); +extern void addFonU(char *l, void *A); + +#endif diff --git a/src/libmath.c b/src/libmath.c new file mode 100644 index 0000000..8e0f383 --- /dev/null +++ b/src/libmath.c @@ -0,0 +1,82 @@ +/* Copyright (C) 2011-2013 Patrick H. E. Foubet - S.E.R.I.A.N.E. + +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 3 of the License, or 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, see +*******************************************************************/ +/* libmath.c */ +#include "conf.h" + +#include +#include +#include +#include +#include "stackN.h" + +static double inv(double a) +{ +double v; + if (a==0.0) v=HUGE; + else v = (double)1.0/a; + return v; +} + +static long long L_round(double v) { return (long long)rint(v); } +static long long L_floor(double v) { return (long long)floor(v); } +static long long L_ceil(double v) { return (long long)ceil(v); } +static long long L_sgn(double v) +{ + if (v > 0.0) return (long long)1; + if (v < 0.0) return (long long)-1; + return (long long)0; +} + +void IF_pi(void) +{ + putDouble(M_PI); +} + + +void IF_inv(void) { IF_fctD_1(inv); } +void IF_sqrt(void) { IF_fctD_1(sqrt); } +void IF_cbrt(void) { IF_fctD_1(cbrt); } +void IF_round(void) { IF_fctD_1L(L_round); } +void IF_floor(void) { IF_fctD_1L(L_floor); } +void IF_ceil(void) { IF_fctD_1L(L_ceil); } +void IF_sgn(void) { IF_fctD_1LB(L_sgn); } + +/* fct trigonometriques */ +void IF_sin(void) { IF_fctD_1(sin); } +void IF_asin(void) { IF_fctD_1(asin); } +void IF_cos(void) { IF_fctD_1(cos); } +void IF_acos(void) { IF_fctD_1(acos); } +void IF_tan(void) { IF_fctD_1(tan); } +void IF_atan(void) { IF_fctD_1(atan); } +void IF_sinh(void) { IF_fctD_1(sinh); } +void IF_asinh(void) { IF_fctD_1(asinh); } +void IF_cosh(void) { IF_fctD_1(cosh); } +void IF_acosh(void) { IF_fctD_1(acosh); } +void IF_tanh(void) { IF_fctD_1(tanh); } +void IF_atanh(void) { IF_fctD_1(atanh); } + +/* fct logarithmiques et exponentielles */ +void IF_ln(void) { IF_fctD_1(log); } +void IF_log(void) { IF_fctD_1(log10); } +void IF_exp(void) { IF_fctD_1(exp); } + + +/* fonctions de Bessel */ +void IF_j0(void) { IF_fctD_1(j0); } +void IF_j1(void) { IF_fctD_1(j1); } +void IF_y0(void) { IF_fctD_1(y0); } +void IF_y1(void) { IF_fctD_1(y1); } + diff --git a/src/libmath.h b/src/libmath.h new file mode 100644 index 0000000..f5baa1d --- /dev/null +++ b/src/libmath.h @@ -0,0 +1,53 @@ +/* Copyright (C) 2011-2013 Patrick H. E. Foubet - S.E.R.I.A.N.E. + +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 3 of the License, or 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, see +*******************************************************************/ +/* libmath.h */ + +#ifndef __NIFE_LIBMATH_H__ +#define __NIFE_LIBMATH_H__ + +extern void IF_inv(void); +extern void IF_sqrt(void); +extern void IF_cbrt(void); +extern void IF_round(void); +extern void IF_floor(void); +extern void IF_ceil(void); +extern void IF_sgn(void); +extern void IF_abs(void); + +extern void IF_pi(void); +extern void IF_sin(void); +extern void IF_cos(void); +extern void IF_tan(void); +extern void IF_asin(void); +extern void IF_acos(void); +extern void IF_atan(void); +extern void IF_sinh(void); +extern void IF_cosh(void); +extern void IF_tanh(void); +extern void IF_asinh(void); +extern void IF_acosh(void); +extern void IF_atanh(void); + +extern void IF_ln(void); +extern void IF_log(void); +extern void IF_exp(void); + +extern void IF_j0(void); +extern void IF_j1(void); +extern void IF_y0(void); +extern void IF_y1(void); + +#endif diff --git a/src/libmathc99.c b/src/libmathc99.c new file mode 100644 index 0000000..d8a2dd3 --- /dev/null +++ b/src/libmathc99.c @@ -0,0 +1,28 @@ +/* Copyright (C) 2011-2013 Patrick H. E. Foubet - S.E.R.I.A.N.E. + +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 3 of the License, or 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, see +*******************************************************************/ +/* libmathc99.c */ +#include "conf.h" + +#define _ISOC99_SOURCE + +#include +#include +#include +#include +#include "stackN.h" + +void IF_abs(void) { IF_fctB_1(llabs,fabs); } + diff --git a/src/mth.c b/src/mth.c new file mode 100644 index 0000000..77ff319 --- /dev/null +++ b/src/mth.c @@ -0,0 +1,212 @@ +/* Copyright (C) 2011-2013 Patrick H. E. Foubet - S.E.R.I.A.N.E. + +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 3 of the License, or 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, see +*******************************************************************/ +/* mth.c : for multi-threading implementation */ +#include "conf.h" + +#include +#include + +#include "nife.h" +#include "mth.h" +#include "err.h" + +#ifdef _MULTI_THREADING_ + +struct TH_Base { + void * stk_N; + void * Fct_Inst; + uint32_t netKEY; + int i_stkL; + int i_stkC; + int Fd_In; + int i_Ts; + char * stk_C[LSTACKC]; + short NbLig; + short NbTab; + short Vars; + short FcType; + bool stk_L[LSTACKL]; + bool Double; + bool EchoOff; + bool Run; + bool WaitPid; + bool fctEnC; + bool strEnC; + bool inSonP; + char BufC[MAXSTRING]; + char BufP[LBUF]; + char BufP2[LBUF]; + PFC trSuite[NBTRSUITE]; + jmp_buf Env_Int; +}; + +pthread_key_t + k_Base, /* the base structure */ + k_StkN, /* Numerical stack */ + k_StkL, /* Logical stack */ + k_iStL, /* index of Logical stack */ + k_StkC, /* Character stack */ + k_iStC, /* index of Character stack */ + k_FdIn, /* File Descriptor input */ + k_iTs, /* index of TraiteSuite */ + k_bufC, /* buffer for Character stack */ + k_bufP, /* buffer for Principal Input */ + k_bufP2, /* buffer for Secondary Input */ + k_trSu, /* table PFC traiteSuite */ + k_FIns, /* Fct_Inst Fct to be install Lib or User */ + k_EnvI, /* Env_Int */ + k_NetK, /* NetKey */ + k_NLig, /* NbLig */ + k_NTab, /* NbTab */ + k_Vars, /* VARS */ + k_FTyp, /* FCT_TYP */ + k_Doub, /* Double On/Off */ + k_Run, /* RUN On/Off */ + k_WPid, /* WAITPID On/Off */ + k_fEnC, /* fctEnCours On/Off */ + k_sEnC, /* stringEnCours On/Off */ + k_inSP, /* inSonProc On/Off */ + k_Echo; /* EchoOff On/Off */ + +static pthread_once_t k_Init = PTHREAD_ONCE_INIT; +static void make_keys() +{ + pthread_key_create(&k_Base, free); + pthread_key_create(&k_StkN, NULL); + pthread_key_create(&k_StkL, NULL); + pthread_key_create(&k_iStL, NULL); + pthread_key_create(&k_StkC, NULL); + pthread_key_create(&k_iStC, NULL); + pthread_key_create(&k_FdIn, NULL); + pthread_key_create(&k_iTs, NULL); + pthread_key_create(&k_bufC, NULL); + pthread_key_create(&k_bufP, NULL); + pthread_key_create(&k_bufP2, NULL); + pthread_key_create(&k_trSu, NULL); + pthread_key_create(&k_FIns, NULL); + pthread_key_create(&k_EnvI, NULL); + pthread_key_create(&k_NetK, NULL); + pthread_key_create(&k_NLig, NULL); + pthread_key_create(&k_NTab, NULL); + pthread_key_create(&k_Vars, NULL); + pthread_key_create(&k_FTyp, NULL); + pthread_key_create(&k_Doub, NULL); + pthread_key_create(&k_Run, NULL); + pthread_key_create(&k_WPid, NULL); + pthread_key_create(&k_fEnC, NULL); + pthread_key_create(&k_sEnC, NULL); + pthread_key_create(&k_inSP, NULL); + pthread_key_create(&k_Echo, NULL); +} + + +void TH_create(void) /* create current thread variables */ +{ +void * M; +struct TH_Base * A; + pthread_once(&k_Init, make_keys); + if ((M = pthread_getspecific(k_Base)) == NULL) { + if ((M=malloc(sizeof(struct TH_Base)))==NULL) + stopErr("TH_create","malloc"); + pthread_setspecific(k_Base, M); + /* initialisation */ + A = (struct TH_Base *)M; + A->stk_N = VIDE; + A->Fct_Inst = VIDE; + A->netKEY = 0; + A->NbLig = 10; + A->NbTab = 6; + A->Vars = 1; + A->FcType = 0; + A->EchoOff = 0; + A->Double = 0; + A->Run = 1; + A->WaitPid = 0; + A->fctEnC = 0; + A->strEnC = 0; + A->inSonP = 0; + A->i_stkL = 0; + A->i_stkC = 0; + A->Fd_In = 0; + A->i_Ts = 0; + pthread_setspecific(k_StkN, (void*)&(A->stk_N)); + pthread_setspecific(k_FIns, (void*)&(A->Fct_Inst)); + pthread_setspecific(k_NetK, (void*)&(A->netKEY)); + pthread_setspecific(k_NLig, (void*)&(A->NbLig)); + pthread_setspecific(k_NTab, (void*)&(A->NbTab)); + pthread_setspecific(k_Vars, (void*)&(A->Vars)); + pthread_setspecific(k_FTyp, (void*)&(A->FcType)); + pthread_setspecific(k_Echo, (void*)&(A->EchoOff)); + pthread_setspecific(k_Doub, (void*)&(A->Double)); + pthread_setspecific(k_StkL, (void*)(A->stk_L)); + pthread_setspecific(k_iStL, (void*)&(A->i_stkL)); + pthread_setspecific(k_StkC, (void*)(A->stk_C)); + pthread_setspecific(k_iStC, (void*)&(A->i_stkC)); + pthread_setspecific(k_FdIn, (void*)&(A->Fd_In)); + pthread_setspecific(k_iTs, (void*)&(A->i_Ts)); + pthread_setspecific(k_bufC, (void*)(A->BufC)); + pthread_setspecific(k_bufP, (void*)(A->BufP)); + pthread_setspecific(k_bufP2, (void*)(A->BufP2)); + pthread_setspecific(k_trSu, (void*)(A->trSuite)); + pthread_setspecific(k_Run, (void*)&(A->Run)); + pthread_setspecific(k_WPid, (void*)&(A->WaitPid)); + pthread_setspecific(k_fEnC, (void*)&(A->fctEnC)); + pthread_setspecific(k_sEnC, (void*)&(A->strEnC)); + pthread_setspecific(k_inSP, (void*)&(A->inSonP)); + pthread_setspecific(k_EnvI, (void*)&(A->Env_Int)); + } +} + +void TH_init(void) +{ + TH_create(); +} + + +#else /* NOT _MULTI_THREADING_ */ + +void * G_StackN = VIDE; +int G_Double=0; /* 0 si LONG, 1 si DOUBLE */ +int G_EchoOff=0; /* 0 si echo on, 1 si echo off */ +int G_NBTAB=6; /* nb d'elements de tableau affiches */ +int G_NBLIG=10; /* nb de lignes du stack affichees */ +short G_VARS=1, /* 0 VAR_OFF , 1 VAR_DOWN (default), 2 VAR_UP */ + G_FCT_TYP=0; /* 0 None (default) , 1 Lib Fct , 2 User Fct */ +void * G_F_INS=VIDE; /* fct lib ou usr a installer */ +uint32_t G_NetKey=0; +bool G_stackL[LSTACKL]; +int G_i_stackL=0; +char * G_stackC[LSTACKC]; +int G_i_stackC=0; +char G_bufC[MAXSTRING]; +short G_Run=1; +short G_WAITPID=0; +short G_strEnCours=0; +short G_fctEnCours=0; +short G_inSonProc=0; +int G_FD_IN = 0; /* lecture sur stdin par defaut */ +int G_iTS=0; +char G_bufP[LBUF]; +char G_bufP2[LBUF]; +PFC G_traiteSuite [NBTRSUITE]; +jmp_buf G_ENV_INT; + +void TH_init(void) /* do nothing */ +{ + return; +} +#endif /* _MULTI_THREADING_ */ + diff --git a/src/mth.h b/src/mth.h new file mode 100644 index 0000000..39d110d --- /dev/null +++ b/src/mth.h @@ -0,0 +1,210 @@ +/* Copyright (C) 2011-2013 Patrick H. E. Foubet - S.E.R.I.A.N.E. + +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 3 of the License, or 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, see +*******************************************************************/ +/* mth.h : for multi-threading implementation */ + +extern void TH_init(void); + +#ifndef __NIFE_MTH_H__ +#define __NIFE_MTH_H__ + +#include +#include +#include +#include + +#define LSTACKL 512 +#define LSTACKC 512 +#define MAXSTRING 512 +#define NBTRSUITE 10 +#define LBUF 512 +#define VIDE ((void*)NULL) + + +#ifdef _MULTI_THREADING_ +extern pthread_key_t k_Base, k_StkN, k_FIns, k_NetK, k_NLig, k_NTab, k_Vars, + k_FTyp, k_Doub, k_Echo, k_StkL, k_iStL, k_StkC, k_iStC, k_bufC, k_Run, + k_WPid, k_fEnC, k_sEnC, k_inSP, k_iTs, k_FdIn, k_bufP, k_bufP2, k_trSu, + k_EnvI; + +#define StackN *((void**)pthread_getspecific(k_StkN)) +#define _MODIF_STACKN_(x) *((void**)pthread_getspecific(k_StkN))=x +#define _ADDR_STACKN_ (void**)pthread_getspecific(k_StkN) + +#define DOUBLE *((bool*)pthread_getspecific(k_Doub)) +#define _MODIF_DOUBLE_(x) *((bool*)pthread_getspecific(k_Doub))=x + +#define ECHOOFF *((bool*)pthread_getspecific(k_Echo)) +#define _MODIF_ECHOOFF_(x) *((bool*)pthread_getspecific(k_Echo))=x + +#define NBLIG *((short*)pthread_getspecific(k_NLig)) +#define _MODIF_NBLIG_(x) *((short*)pthread_getspecific(k_NLig))=x + +#define NBTAB *((short*)pthread_getspecific(k_NTab)) +#define _MODIF_NBTAB_(x) *((short*)pthread_getspecific(k_NTab))=x + +#define VARS *((short*)pthread_getspecific(k_Vars)) +#define _MODIF_VARS_(x) *((short*)pthread_getspecific(k_Vars))=x + +#define FCT_TYP *((short*)pthread_getspecific(k_FTyp)) +#define _MODIF_FCT_TYP_(x) *((short*)pthread_getspecific(k_FTyp))=x + +#define FCT_INST *((void**)pthread_getspecific(k_FIns)) +#define _MODIF_FCT_INST_(x) *((void**)pthread_getspecific(k_FIns))=x + +#define NetKey *((uint32_t*)pthread_getspecific(k_NetK)) +#define _MODIF_NetKey_(x) *((uint32_t*)pthread_getspecific(k_NetK))=x +#define _ADDV_NetKey_ pthread_getspecific(k_NetK) + +#define stackL ((bool*)pthread_getspecific(k_StkL)) + +#define i_StackL *((int*)pthread_getspecific(k_iStL)) +#define _MODIF_i_StackL_(x) *((int*)pthread_getspecific(k_iStL))=x + +#define stackC ((char**)pthread_getspecific(k_StkC)) + +#define i_StackC *((int*)pthread_getspecific(k_iStC)) +#define _MODIF_i_StackC_(x) *((int*)pthread_getspecific(k_iStC))=x + +#define bufC ((char*)pthread_getspecific(k_bufC)) +#define bufP ((char*)pthread_getspecific(k_bufP)) +#define bufP2 ((char*)pthread_getspecific(k_bufP2)) +#define traiteSuite ((PFC*)pthread_getspecific(k_trSu)) + +#define RUN *((bool*)pthread_getspecific(k_Run)) +#define _MODIF_RUN_(x) *((bool*)pthread_getspecific(k_Run))=x + +#define WAITPID *((bool*)pthread_getspecific(k_WPid)) +#define _MODIF_WAITPID_(x) *((bool*)pthread_getspecific(k_WPid))=x + +#define stringEnCours *((bool*)pthread_getspecific(k_sEnC)) +#define _MODIF_stringEnCours_(x) *((bool*)pthread_getspecific(k_sEnC))=x + +#define fctEnCours *((bool*)pthread_getspecific(k_fEnC)) +#define _MODIF_fctEnCours_(x) *((bool*)pthread_getspecific(k_fEnC))=x + +#define inSonProc *((bool*)pthread_getspecific(k_inSP)) +#define _MODIF_inSonProc_(x) *((bool*)pthread_getspecific(k_inSP))=x + +#define FD_IN *((int*)pthread_getspecific(k_FdIn)) +#define _MODIF_FD_IN_(x) *((int*)pthread_getspecific(k_FdIn))=x + +#define iTS *((int*)pthread_getspecific(k_iTs)) +#define _MODIF_iTS_(x) *((int*)pthread_getspecific(k_iTs))=x + +#define ENV_INT (jmp_buf*)pthread_getspecific(k_EnvI) + +#else /* *************** NOT _MULTI_THREADING_ ******************** */ + +extern void * G_StackN; +extern int G_Double; +extern int G_EchoOff; +extern int G_NBTAB; +extern int G_NBLIG; +extern short G_VARS; +extern short G_FCT_TYP; +extern void * G_F_INS; +extern uint32_t G_NetKey; +extern bool G_stackL[]; +extern int G_i_stackL; +extern char * G_stackC[]; +extern int G_i_stackC; +extern char G_bufC[]; +extern short G_Run; +extern short G_WAITPID; +extern short G_strEnCours; +extern short G_fctEnCours; +extern short G_inSonProc; +extern int G_FD_IN; +extern int G_iTS; +extern char G_bufP[]; +extern char G_bufP2[]; +extern PFC G_traiteSuite[]; +/* a regler */ +extern jmp_buf G_ENV_INT; + + +#define RUN G_Run +#define _MODIF_RUN_(x) G_Run=(x) + +#define WAITPID G_WAITPID +#define _MODIF_WAITPID_(x) G_WAITPID=(x) + +#define stringEnCours G_strEnCours +#define _MODIF_stringEnCours_(x) G_strEnCours=(x) + +#define fctEnCours G_fctEnCours +#define _MODIF_fctEnCours_(x) G_fctEnCours=(x) + +#define inSonProc G_inSonProc +#define _MODIF_inSonProc_(x) G_inSonProc=(x) + +#define FD_IN G_FD_IN +#define _MODIF_FD_IN_(x) G_FD_IN=(x) + +#define iTS G_iTS +#define _MODIF_iTS_(x) G_iTS=(x) + +#define stackL G_stackL + +#define i_StackL G_i_stackL +#define _MODIF_i_StackL_(x) G_i_stackL=(x) + +#define stackC G_stackC + +#define i_StackC G_i_stackC +#define _MODIF_i_StackC_(x) G_i_stackC=(x) + +#define bufC G_bufC +#define bufP G_bufP +#define bufP2 G_bufP2 +#define traiteSuite G_traiteSuite + +#define StackN G_StackN +#define _MODIF_STACKN_(x) G_StackN=(x) +#define _ADDR_STACKN_ &G_StackN + +#define DOUBLE G_Double +#define _MODIF_DOUBLE_(x) G_Double=(x) + +#define ECHOOFF G_EchoOff +#define _MODIF_ECHOOFF_(x) G_EchoOff=(x) + +#define NBLIG G_NBLIG +#define _MODIF_NBLIG_(x) G_NBLIG=(x) + +#define NBTAB G_NBTAB +#define _MODIF_NBTAB_(x) G_NBTAB=(x) + +#define VARS G_VARS +#define _MODIF_VARS_(x) G_VARS=(x) + +#define FCT_TYP G_FCT_TYP +#define _MODIF_FCT_TYP_(x) G_FCT_TYP=(x) + +#define FCT_INST G_F_INS +#define _MODIF_FCT_INST_(x) G_F_INS=(x) + +#define NetKey G_NetKey +#define _MODIF_NetKey_(x) G_NetKey=(x) +#define _ADDV_NetKey_ (void*)&G_NetKey + +#define ENV_INT G_ENV_INT + +#endif /* _MULTI_THREADING_ */ + + +#endif + diff --git a/src/net.c b/src/net.c new file mode 100644 index 0000000..96ea245 --- /dev/null +++ b/src/net.c @@ -0,0 +1,1034 @@ +/* Copyright (C) 2011-2013 Patrick H. E. Foubet - S.E.R.I.A.N.E. + +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 3 of the License, or 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, see +*******************************************************************/ +/* net.c */ +#include "conf.h" + +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +/* +*/ +#include +#include +#include + +#include "nife.h" +#include "mth.h" +#include "net.h" +#include "lib.h" +#include "debug.h" +#include "stackC.h" +#include "stackN.h" +#include "stackL.h" +#include "foncs.h" +#include "scs.h" +#include "err.h" + +#define LOCALS "localhost" +#define MAXCLI 200 +#define LLIB 24 +static char *NetName=NULL; +/* for messages */ +struct Mess1 { + uint32_t pid; + union { + char lib[LLIB]; + in_port_t port; + }; +}; + +/* RPC structures */ +struct Nrpc { + uint32_t nkey; /* netkey */ + char fct[LLIB]; /* function */ + struct Nrpc *next; +}; +/* Table for Server */ +struct Client { + uint32_t pid; + long long dt; /* delta time local - remote */ + struct in_addr ip; /* net order */ + in_port_t port; /* Nrpc port in net order */ + struct Nrpc *ff; /* first function */ + char lib[LLIB]; +} TCli[MAXCLI]; + +static int NCli, STS=0, SameSaS=0; + +static void initCli(void) +{ +int i; + for(i=0;i 0) S='+'; else S='-'; + } + printf("%3d : %6d %15s:%d %c %s\n",j,TCli[i].pid,inet_ntoa(TCli[i].ip), + (int)ntohs(TCli[i].port), S, TCli[i].lib); + /* with dt */ +/* + printf("%3d : %6d %15s %15ld %s\n",j,TCli[i].pid,inet_ntoa(TCli[i].ip), + (long)TCli[i].dt, TCli[i].lib); +*/ + } +} + +#define SERV_PORT 32011 /* Stack to Stack Protocol port */ + +/* commands list (default 1+1) */ +#define NET_SLI '?' /* ask the stack list */ +#define NET_DRS '-' /* 1+0 drop net stack */ +#define NET_ONR 'a' /* remote login */ +#define NET_ON 'A' /* login */ +#define NET_CAL 'C' /* calcul of dt */ +#define NET_DPH 'd' /* depth */ +#define NET_DAT 'D' /* data */ +#define NET_OFF 'E' /* logoff */ +#define NET_U2S 'F' /* From user to server */ +#define NET_FIL 'f' /* ok to send file */ +#define NET_GDT 'G' /* get dt */ +#define NET_LI 'L' /* ask the list */ +#define NET_NRP 'N' /* NRpc Port */ +#define NET_PAR 'P' /* call distant parser */ +#define NET_RUS 'R' /* ask to Ressources Usage */ +#define NET_STS 'S' /* ask to Stop The Server */ +#define NET_S2U 'T' /* from server To user */ +#define NET_EXE 'X' /* send a RPC command */ +#define NET_ERR 'Z' /* Error */ +#define NET_EOM (char)3 /* End Of Message */ + +#define LNBUF 200 +#define LNSRV 24 + +char NetServer[24]=LOCALS; +static int Sock, NET=0; +static struct sockaddr_in Sin, SinSav; + +static int connSock2(int n) /* connect to Nife RPC Client */ +{ + if ((Sock = socket(AF_INET, SOCK_STREAM, IPPROTO_TCP)) == -1) return 1; + bcopy(&SinSav,&Sin,sizeof(Sin)); + bcopy(&TCli[n].ip,&Sin.sin_addr,sizeof(Sin.sin_addr)); + bcopy(&TCli[n].port,&Sin.sin_port,sizeof(Sin.sin_port)); + if(connect(Sock,(struct sockaddr *)&Sin,sizeof(Sin)) < 0) return 1; + return 0; /* OK */ +} + +void IF_Me(void) +{ +char * Me; +void * NM; +int i=0; +static char *ve[] = { "NIFENAME", "LOGNAME", "USERNAME", "USER", "" }; +static char Nobody[] = "Nobody"; + if (NetName == NULL) { + Me=NULL; + while (Me == NULL) { + if (strlen(ve[i])==0) break; + Me = getenv(ve[i++]); + } + if (Me == NULL) Me=Nobody; + if ((NM = malloc(strlen(Me)+1)) != NULL) + strcpy((char*)NM,Me); + NetName=(char*)NM; + } + putString(NetName); +} + +void IF_NetServer(void) +{ +char *s; +int i; + if (!isNString(1)) { + messErr(6); return; + } + s = getString(); + i=LNSRV-1; + strncpy(NetServer,s,i); + NetServer[i]='\0'; + free((void*)s); +} + +static void stopServ(int TS, char * m, int n) +{ +char buf[20]; + perror(m); + if (TS) sprintf(buf,"main_Serv : Erreur %d %s\n",n,m); + else sprintf(buf,"main_Nrpc : Erreur %d %s\n",n,m); + D_Trace(buf); + exit(n); +} + +static char NET_BUF[LNBUF]; + +static int readMess(int s) +{ +char * b, *f; + b = NET_BUF; + f = b + LNBUF - 1; + while (1) { + if (read(s,(void*)b,1) <= 0) break; + if (*b == NET_EOM) break; + b++; + if (b>f) { b--; break; } + } + if (*b != NET_EOM) return -1; + b++; + return(b-NET_BUF); +} + +static void readAff(int s, char C) +{ +char b[2]; +int ok=0; + if (read(s,(void*)b,1) <= 0) return; + if (*b == C) ok=1; + while (*b != NET_EOM) { + if (read(s,(void*)b,1) <= 0) break; + else { + if (ok) write(1,(void*)b,1); + } + } +} + +static void sendC(char c) +{ + write(Sock,(void*)&c,1); +} + +static void sendBuf(int s, void * b, size_t no) +{ + write(s,b,no); +} + +static void rcvBuf(int s, void * b, uint32_t no) +{ +int r,ar; +void *t; + ar = no; + r = 0; + t = b; + while ((r=read(s,t,ar)) != ar) { + if (r<0) break; + ar -= r; + t += r; + } +} + +void sendData(int s, void * b, uint32_t n) +{ +char c; + c=NET_DAT; + write(s,(void*)&c,1); + n -= lAdrNum(); /* don't send the addresse */ + sendBuf(s,&n,sizeof(n)); + /* sendBuf(s,b,(size_t)n); */ + sendBuf(s,b,sizeof(uint32_t)*2); + b+=(sizeof(uint32_t)*2)+lAdrNum(); + n-=(sizeof(uint32_t)*2); + sendBuf(s,b,(size_t)n); +} + +void sendDataC(void *b, uint32_t n) +{ + sendData(Sock,b,n); +} + +void sendFile(int s, int fid) +{ +int n; +char Buf[LNBUF]; + while ((n = read(fid,(void*)Buf,LNBUF)) > 0) + sendBuf(s,(void*)Buf,(size_t)n); + close(fid); +} + +static void sendInsc(void) +{ +char *s; +struct Mess1 M1; +uint32_t scs; +struct timeval tv; +long long v; + + scs = getScs(); + s = getString(); + M1.pid = getpid(); + strncpy(M1.lib,s,LLIB-1); + M1.lib[LLIB-1]='\0'; + if (SameSaS) sendC(NET_ON); + else sendC(NET_ONR); + write(Sock,(void*)&scs,sizeof(scs)); + write(Sock,(void*)&M1,sizeof(M1)); + sendC(NET_EOM); + /* update NetName */ + if (NetName != NULL) free((void*)NetName); + NetName=s; + if (SameSaS==0) { + if (readMess(Sock) == 2) { + if (*NET_BUF == (NET_CAL)) { + gettimeofday(&tv,NULL); + v=Nife_time(tv); + sendC(NET_CAL+1); + write(Sock,(void*)&v,sizeof(v)); + sendC(NET_EOM); + } + } + } else SameSaS=0; +} + +static void sendGetStd(char Code) +{ +struct Mess1 M1; + switch(Code) { + case NET_OFF : + case NET_GDT : + M1.pid = getpid(); + break; + default : + M1.pid = NetKey; + } + strcpy(M1.lib,"-"); + sendC(Code); + write(Sock,(void*)&M1,sizeof(M1)); + sendC(NET_EOM); +} + +static void sendNrpcPort(in_port_t P) +{ +struct Mess1 M1; + M1.pid = getppid(); /* parent pid ! */ + M1.port = P; + sendC(NET_NRP); + write(Sock,(void*)&M1,sizeof(M1)); + sendC(NET_EOM); +} + +static void send1car(int s, char c) +{ +char b[2]; + b[0]=c; + b[1]=NET_EOM; + write(s,b,2); +} + +void NTraceM1(char * A) +{ +struct Mess1 M1; +char buf[50]; + bcopy((void*)(A+1),(void*)&M1,sizeof(M1)); + sprintf(buf,"TraceM1 %c %d %s !",*A, M1.pid, M1.lib); + D_Trace(buf); +} + +void NTraceData(char A, long n) +{ +char buf[50]; + sprintf(buf,"TraceData %c %ld !",A, n); + D_Trace(buf); +} + +static void RemotExecBegin(long long k) +{ + putLong(k); + IF_NetKey(); + IF_netS2U(); + IF_netDropS(); +} + +static void RemotExecEnd(void) +{ + if (noErr()) { + razErr(); + IF_stack_clear(); /* clear all stacks */ + IF_stackL_clear(); + IF_stackC_clear(); + IF_NetErrVal(); + } + IF_depth(); + IF_netU2S(); + IF_stack_clear(); /* don't eat any bread ! */ + IF_stackL_clear(); + IF_stackC_clear(); +} + +static void net_servrpc(int s) +{ +int i, j, fid; +uint32_t k; +char *sF, nF[30]; + i=readMess(s); + NET_BUF[i]='\0'; + /* D_Trace(NET_BUF); */ + switch(*NET_BUF) { + case NET_OFF : + send1car(s, NET_OFF+1); + exit(0); /* stop the Nrpc client */ + break; + case NET_EXE : + bcopy((void*)(NET_BUF+1),(void*)&k,sizeof(k)); + sF = (char *)(NET_BUF+sizeof(k)+1); + /* execute the function call */ + /* fprintf(stderr,"Nife_RPC : %s NetKey=%x !\n",sF,k);*/ + RemotExecBegin((long long)k); + if (!execLibNrpc(sF)) IF_NetErrVal(); + RemotExecEnd(); + break; + case NET_PAR : + bcopy((void*)(NET_BUF+1),(void*)&k,sizeof(k)); + sprintf(nF,"w_%d.nif",getpid()); + if ((fid = open(nF,O_CREAT|O_TRUNC|O_RDWR,0600)) != -1) { + j=1; + while ((j==1) && ((i=read(s,NET_BUF,LNBUF)) > 0)) { + if (NET_BUF[i-1] == NET_EOM){ + j=0; i--; + } + write(fid, NET_BUF, i); + } + close(fid); + RemotExecBegin((long long)k); + compileFile(nF); + RemotExecEnd(); + unlink(nF); + } + break; + default : + break; + } +} + + +static void net_service(int s) +{ +int i, CalDT=0; +uint32_t n, k,scs; +void *M; +struct Mess1 M1; +struct timeval tv; +long long v1, v2, vm, vr, dt; +char c, *sN, *sF; + + i=readMess(s); + NET_BUF[i]='\0'; + /* D_Trace(NET_BUF); */ + switch(*NET_BUF) { + case NET_ONR : + CalDT=1; + case NET_ON : + /* NTraceM1(NET_BUF); */ + bcopy((void*)(NET_BUF+1),(void*)&k,sizeof(k)); + scs = getScs(); + if (k==scs) { + bcopy((void*)(NET_BUF+sizeof(k)+1),(void*)&M1,sizeof(M1)); + if (CalDT) { + gettimeofday(&tv,NULL); + send1car(s, NET_CAL); + v1=Nife_time(tv); + i=readMess(s); + gettimeofday(&tv,NULL); + v2=Nife_time(tv); + if (*NET_BUF == NET_CAL+1) { + bcopy((void*)(NET_BUF+1),(void*)&vr,sizeof(vr)); + vm = v1 + ((v2-v1)/2); + addCli(M1.pid, Sin.sin_addr, M1.lib, (int)(vm-vr)); + } + else + addCli(M1.pid, Sin.sin_addr, M1.lib, -9); + send1car(s, NET_ON+1); + } else { + addCli(M1.pid, Sin.sin_addr, M1.lib, 0); + send1car(s, NET_ON+1); + } + } + else + send1car(s, NET_OFF); + break; + case NET_OFF : + bcopy((void*)(NET_BUF+1),(void*)&M1,sizeof(M1)); + delCli(M1.pid, Sin.sin_addr); + send1car(s, NET_OFF+1); + if (STS) { + if (NCli == 0) exit(0); /* stop the server */ + STS=0; + } + break; + case NET_NRP : + bcopy((void*)(NET_BUF+1),(void*)&M1,sizeof(M1)); + majNRP(M1.pid, M1.port); + send1car(s, NET_NRP+1); + break; + case NET_DPH : + bcopy((void*)(NET_BUF+1),(void*)&M1,sizeof(M1)); + dt=NetDepth(M1.pid); + c=*NET_BUF+1; + write(s,(void*)&c,1); + write(s,(void*)&dt,sizeof(dt)); + c=NET_EOM; + write(s,(void*)&c,1); + break; + case NET_GDT : + bcopy((void*)(NET_BUF+1),(void*)&M1,sizeof(M1)); + dt=getDt(M1.pid, Sin.sin_addr); + c=*NET_BUF+1; + write(s,(void*)&c,1); + write(s,(void*)&dt,sizeof(dt)); + c=NET_EOM; + write(s,(void*)&c,1); + break; + case NET_EXE : + bcopy((void*)(NET_BUF+1),(void*)&k,sizeof(k)); + sN = (char *)(NET_BUF+sizeof(k)+1); + sF = sN+strlen(sN)+1; + if (strlen(sN)>=LLIB) sN[LLIB-1]='\0'; + i=getCliId(sN); + if (i>=0) { + send1car(s, NET_EXE+1); + /* send the call */ + if (!connSock2(i)) { + sendC(NET_EXE); + sendBuf(Sock,(void*)&k, sizeof(k)); + sendBuf(Sock,(void*)sF, strlen(sF)+1); + sendC(NET_EOM); + } + } + else send1car(s, NET_ERR); + break; + case NET_PAR : + bcopy((void*)(NET_BUF+1),(void*)&k,sizeof(k)); + sN = (char *)(NET_BUF+sizeof(k)+1); + if (strlen(sN)>=LLIB) sN[LLIB-1]='\0'; + i=getCliId(sN); + if (i>=0) { + /* connect to client */ + if (!connSock2(i)) { + send1car(s, NET_FIL); /* tell ok to sender */ + sendC(NET_PAR); + sendBuf(Sock,(void*)&k, sizeof(k)); + sendC(NET_EOM); + while ((i=read(s,NET_BUF,LNBUF)) > 0) { + sendBuf(Sock, NET_BUF, i); + if (NET_BUF[i-1] == NET_EOM) break; + } + send1car(s, NET_PAR+1); + } + else send1car(s, NET_ERR); + } + else send1car(s, NET_ERR); + break; + case NET_STS : + STS=1; + send1car(s, NET_STS+1); + break; + case NET_DRS : + bcopy((void*)(NET_BUF+1),(void*)&k,sizeof(k)); + IF_netDrop(k); + break; + case NET_LI : + c=*NET_BUF+1; + write(s,(void*)&c,1); + dup2(s,1); + listCli(); + close(1); + c=NET_EOM; + write(s,(void*)&c,1); + break; + case NET_SLI : + bcopy((void*)(NET_BUF+1),(void*)&k,sizeof(k)); + c=*NET_BUF+1; + write(s,(void*)&c,1); + dup2(s,1); + IF_show_netStack(k); + close(1); + c=NET_EOM; + write(s,(void*)&c,1); + break; + case NET_RUS : + c=*NET_BUF+1; + write(s,(void*)&c,1); + dup2(s,1); + IF_resUsage(); + close(1); + c=NET_EOM; + write(s,(void*)&c,1); + break; + case NET_U2S : + while (1) { + read(s,(void*)&c,1); + if (c == NET_EOM) break; + if (c != NET_DAT) { + D_Trace("Erreur NET_DAT !"); break; + } + read(s,(void*)&n,sizeof(n)); + /* NTraceData(c, n);*/ + /* add the addresse */ + if ((M = malloc((size_t)n+lAdrNum())) != NULL) { + rcvBuf(s,M,(sizeof(uint32_t)*2)); + rcvBuf(s,M+((sizeof(uint32_t)*2)+lAdrNum()), + n-(sizeof(uint32_t)*2)); + putVar(M); + } + } + break; + case NET_S2U : + bcopy((void*)(NET_BUF+1),(void*)&k,sizeof(k)); + /* NTraceData(NET_S2U, k);*/ + NetToStack(s,k); + c=NET_EOM; + write(s,(void*)&c,1); + break; + default : + break; + } +} + +static int connSock(void) +{ + if ((Sock = socket(AF_INET, SOCK_STREAM, IPPROTO_TCP)) == -1) { + messErr(31); + return 1; + } + bcopy(&SinSav,&Sin,sizeof(Sin)); + if(connect(Sock,(struct sockaddr *)&Sin,sizeof(Sin)) < 0) { + messErr(34); + return 1; + } + return 0; /* OK */ +} + +void main_Nrpc(void) /* main function for Nrpc client */ +{ +int sock, nsock; +socklen_t ln; +struct sockaddr_in Nsin; + + signal(SIGTERM, SIG_DFL); + if ((sock = socket(AF_INET, SOCK_STREAM, IPPROTO_TCP)) < 0) + stopServ(0, "socket",1); + bzero(&Nsin,sizeof(Nsin)); + Nsin.sin_family = AF_INET; + if (bind(sock, (struct sockaddr *)&Nsin, sizeof(Nsin)) < 0) + stopServ(0, "bind",2); + /* send Nrpc port */ + ln = sizeof(Nsin); + if (getsockname(sock, (struct sockaddr *)&Nsin, &ln) < 0) + stopServ(0, "gsname",3); + if (connSock()) return; + sendNrpcPort(Nsin.sin_port); + if (readMess(Sock) != 2) { messErr(35); return; } + close(Sock); + if (*NET_BUF != (NET_NRP+1)) { messErr(40); return; } + /* listen and wait demands */ + if (listen(sock,5) < 0) stopServ(0, "listen",4); + ln = sizeof(Nsin); + for (;;) { + if((nsock=accept(sock,(struct sockaddr *)&Nsin,(socklen_t*)&ln)) < 0) + stopServ(0, "accept",5); + net_servrpc(nsock); + close(nsock); + } +} + +int Nrpc_pid=-1; +static void startNrpc(void) +{ + + if ((Nrpc_pid = fork()) == -1) stopErr("startNrpc","fork"); + if (Nrpc_pid == 0) { /* fils */ + close(0); + close(1); + /* close(2); */ + D_Reset(); + IF_stack_clear(); /* clear all stacks */ + IF_stackL_clear(); + IF_stackC_clear(); + main_Nrpc(); + exit(1); + } +} + +void main_Serv(void) /* main function of Server */ +{ +int ln, sock, nsock; + + initCli(); + if ((sock = socket(AF_INET, SOCK_STREAM, IPPROTO_TCP)) < 0) + stopServ(1, "socket",1); + bzero(&Sin.sin_addr,sizeof(Sin.sin_addr)); + if (bind(sock, (struct sockaddr *)&Sin, sizeof(Sin)) < 0) + stopServ(1, "bind",2); + if (listen(sock,5) < 0) stopServ(1, "listen",3); + ln = sizeof(Sin); + for (;;) { + if((nsock=accept(sock,(struct sockaddr *)&Sin,(socklen_t*)&ln)) < 0) + stopServ(1, "accept",4); + net_service(nsock); + close(nsock); + } +} + +static void startServer(void) +{ +int pid; + if ((pid = fork()) == -1) stopErr("startServer","fork"); + if (pid == 0) { /* fils */ + setsid(); + close(0); + close(1); + /* close(2); */ + D_Reset(); + close(Sock); + IF_stack_clear(); /* clear all stacks */ + IF_stackL_clear(); + IF_stackC_clear(); + main_Serv(); + } + sleep(2); /* wait for server initialization */ +} + +static void IF_netGetVal (char Code) +{ +long long v; + if (NET) { + if (connSock()) return; + sendGetStd(Code); + if (readMess(Sock) != 2+sizeof(v)) { messErr(35); return; } + close(Sock); + if (*NET_BUF != (Code+1)) { messErr(40); return; } + bcopy((void*)(NET_BUF+1),(void*)&v,sizeof(v)); + putLong(v); + } else messErr(32); +} + +void IF_netDt (void) +{ + IF_netGetVal(NET_GDT); +} + + +void IF_netDepth (void) +{ + IF_netGetVal(NET_DPH); +} + +void IF_netOff (void) +{ + if (NET) { + if (connSock()) return; + sendGetStd(NET_OFF); + if (readMess(Sock) != 2) { messErr(35); return; } + close(Sock); + if (*NET_BUF != (NET_OFF+1)) { messErr(40); return; } + if (Nrpc_pid > -1) { /* stop Nrpc local server */ + kill(Nrpc_pid, SIGTERM); + Nrpc_pid=-1; + } + NET=0; + } +} + +void IF_netOn (void) +{ +struct hostent *h; + if (!isNString(1)) { + messErr(6); return; + } + if (NET) { + IF_dropC(); return; + } + if ((Sock = socket(AF_INET, SOCK_STREAM, IPPROTO_TCP)) != -1) { + if(!(h=gethostbyname(NetServer))) { + messErr(33); + return; + } + bzero(&Sin,sizeof(Sin)); + Sin.sin_family = AF_INET; + bcopy(h->h_addr,&Sin.sin_addr,h->h_length); + Sin.sin_port = htons(SERV_PORT); + bcopy(&Sin,&SinSav,sizeof(Sin)); + if (strcmp(NetServer,LOCALS) == 0) /* localhost */ + SameSaS=1; /* same system as server */ + if(connect(Sock,(struct sockaddr *)&Sin,sizeof(Sin)) < 0) { + if (strcmp(NetServer,LOCALS) != 0) { /* not localhost */ + messErr(34); + return; + } + /* Server is absent : fork it ! */ + startServer(); + if(connect(Sock,(struct sockaddr *)&Sin,sizeof(Sin)) < 0) { + messErr(34); + return; + } + } + sendInsc(); + if (readMess(Sock) != 2) { messErr(35); return; } + close(Sock); + if (*NET_BUF == (NET_OFF)) { messErr(38); return; } + if (*NET_BUF != (NET_ON+1)) { messErr(40); return; } + NET=1; /* net on !! */ + /* start RPC local server */ + startNrpc(); + } else messErr(31); +} + +void IF_netExec (void) +{ +char *sN, *sF; + if (!isNString(2)) { + messErr(6); return; + } + sN=getString(); + sF=getString(); + if (NET) { + if (!connSock()) { + sendC(NET_EXE); + sendBuf(Sock,_ADDV_NetKey_, sizeof(NetKey)); + sendBuf(Sock,(void*)sN, strlen(sN)+1); + sendBuf(Sock,(void*)sF, strlen(sF)+1); + sendC(NET_EOM); + if (readMess(Sock) != 2) messErr(35); + close(Sock); + if (*NET_BUF != (NET_EXE+1)) { + if (*NET_BUF == (NET_ERR)) messErr(41); + else messErr(40); + } + } + } + free((void*)sN); + free((void*)sF); +} + +void IF_netCompile (void) +{ +char *sN, *sF; +int fid; + if (!isNString(2)) { + messErr(6); return; + } + sN=getString(); + sF=getString(); + if ((fid=open(sF,O_RDONLY)) == -1) messErr(43); + else + if (NET) { + if (!connSock()) { + sendC(NET_PAR); + sendBuf(Sock,_ADDV_NetKey_, sizeof(NetKey)); + sendBuf(Sock,(void*)sN, strlen(sN)+1); + sendC(NET_EOM); + /* wait for invitation */ + if (readMess(Sock) != 2) messErr(35); + else { + if (*NET_BUF == (NET_FIL)) { + sendFile(Sock, fid); + sendC(NET_EOM); + if (readMess(Sock) != 2) messErr(35); + } + } + close(Sock); + if (*NET_BUF != (NET_PAR+1)) { + if (*NET_BUF == (NET_ERR)) messErr(41); + else messErr(40); + } + } + } + free((void*)sN); + free((void*)sF); +} + +void IF_netList (void) +{ + if (NET) { + if (connSock()) return; + send1car(Sock,NET_LI); + readAff(Sock, NET_LI+1); + close(Sock); + } + printf("\n"); +} + +void IF_netStackList (void) +{ + if (NET) { + if (connSock()) return; + sendC(NET_SLI); + sendBuf(Sock,_ADDV_NetKey_, sizeof(NetKey)); + sendC(NET_EOM); + readAff(Sock, NET_SLI+1); + close(Sock); + } + /* printf("\n"); */ +} + +void IF_netDropS (void) +{ + if (NET) { + if (NetKey == UNI_KEY) { + messErr(37); + return; + } + if (connSock()) return; + sendC(NET_DRS); + sendBuf(Sock,_ADDV_NetKey_, sizeof(NetKey)); + sendC(NET_EOM); + close(Sock); + } +} + +void IF_netRusage (void) +{ + if (NET) { + if (connSock()) return; + send1car(Sock,NET_RUS); + readAff(Sock, NET_RUS+1); + close(Sock); + } + printf("\n"); +} + +void IF_netStopS (void) +{ + if (NET) { + if (connSock()) return; + send1car(Sock,NET_STS); + if (readMess(Sock) != 2) { messErr(35); return; } + close(Sock); + if (*NET_BUF != (NET_STS+1)) { messErr(40); return; } + } +} + +void IF_netU2S(void) +{ +long n; + if (NET) { + if (!getParLong(&n)) return; + if (n==0) return; + if (NetKey == UNI_KEY) { + messErr(37); + return; + } + if (connSock()) return; + send1car(Sock,NET_U2S); + StackToNet(n); + sendC(NET_EOM); + close(Sock); + } else messErr(32); +} + +void IF_netS2U(void) +{ +uint32_t n; +void *M; +char c; + if (NET) { + if (connSock()) return; + sendC(NET_S2U); + sendBuf(Sock,_ADDV_NetKey_, sizeof(NetKey)); + sendC(NET_EOM); + while (1) { + read(Sock,(void*)&c,1); + if (c == NET_EOM) break; + if (c != NET_DAT) { + messErr(40); break; + } + read(Sock,(void*)&n,sizeof(n)); + /* add the addresse */ + if ((M = malloc((size_t)n+lAdrNum())) != NULL) { + rcvBuf(Sock,M,(sizeof(uint32_t)*2)); + rcvBuf(Sock,M+((sizeof(uint32_t)*2)+lAdrNum()), + n-(sizeof(uint32_t)*2)); + putVar(M); + } else stopErr("IF_netS2U","malloc"); + } + close(Sock); + } else messErr(32); +} + + + diff --git a/src/net.h b/src/net.h new file mode 100644 index 0000000..29985ea --- /dev/null +++ b/src/net.h @@ -0,0 +1,45 @@ +/* Copyright (C) 2011-2013 Patrick H. E. Foubet - S.E.R.I.A.N.E. + +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 3 of the License, or 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, see +*******************************************************************/ +/* net.h */ + +#ifndef __NIFE_NET_H__ +#define __NIFE_NET_H__ + +#include + +#define UNI_KEY 0xffffffff + +extern char NetServer[]; + +extern void IF_NetServer(void); +extern void IF_Me(void); +extern void IF_netOn(void); +extern void IF_netOff(void); +extern void IF_netDt(void); +extern void IF_netDepth(void); +extern void IF_netList(void); +extern void IF_netStopS(void); +extern void IF_netDropS(void); +extern void IF_netRusage (void); +extern void IF_netStackList (void); +extern void IF_netU2S (void); +extern void IF_netS2U (void); +extern void IF_netExec (void); +extern void IF_netCompile (void); +extern void sendData(int s, void * b, uint32_t n); +extern void sendDataC(void * b, uint32_t n); + +#endif diff --git a/src/nife.c b/src/nife.c new file mode 100644 index 0000000..31ef3bc --- /dev/null +++ b/src/nife.c @@ -0,0 +1,325 @@ +/* Copyright (C) 2011-2013 Patrick H. E. Foubet - S.E.R.I.A.N.E. + +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 3 of the License, or 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, see +*******************************************************************/ +/* nife.c */ +#include "conf.h" + +#include +#include +#include +#include +#include +#include +#include +#include +#include + +#include "nife.h" +#include "mth.h" +#include "err.h" +#include "lib.h" +#include "stackC.h" +#include "stackF.h" +#include "histo.h" +#include "tasks.h" +#include "debug.h" +#include "net.h" +#include "gplot.h" + +static char sepa[] = " \t\n"; + +void putTrSuite(void (*f)(char*)) +{ +int i; + i=iTS; + traiteSuite[i++]=f; + _MODIF_iTS_(i); + if (iTS==NBTRSUITE) fprintf(stderr,"traiteSuite limit raise !\n"); +} +void dropTrSuite(void) +{ +int i; + i=iTS-1; + _MODIF_iTS_(i); + if (iTS < 0) fprintf(stderr,"traiteSuite index negative !\n"); +} +PFC getTrSuite(void) +{ + if (iTS<1) return (PFC)NULL; + else return(traiteSuite[iTS-1]); +} + +void interInfos(char *F, char*P) +{ + fprintf(stderr, " Error in %s ( %s ) !!\n",F,P); + if (errno) perror(F); + if (inSonProc) { + sleep(2); exit(1); + } +} + +void Interrupt(int S) +{ +int status; + switch(S) { + case SIGCHLD : + if(WAITPID) return; + while (waitpid(-1, &status, WNOHANG) > 0); + return; + break; + case SIGSEGV : + printf("Segmentation Error !!\n"); + exit(1); + break; + case SIGPIPE : + printf("Pipe is broken"); + break; + case SIGFPE : + printf("Floating Point"); + break; + case SIGALRM : + printf("Compilation"); + break; + default : + printf("Signal %d",S); + break; + } + siglongjmp(ENV_INT,1); +} + +void IF_about(void) +{ +char Lib[8]; + *Lib='\0'; +#ifdef _MULTI_THREADING_ + strcpy(Lib,"mt-"); +#endif + printf("nife (Networking Industrial Forth-like Environment) - version %s%s-%ld/%ld\n\t (c) S.E.R.I.A.N.E. 2009-13\n",Lib,VERSION,sizeof(long)*8,sizeof(double)*8); +} + +int isSepa(char c, int m) +{ +unsigned int i; + if (m == 1) /* '\0 fait partie du lot */ + if (c == (char)'\0') return 1; + for (i=0; i iTS=%d\n",M,iTS); */ + tS = getTrSuite(); + if (tS != (PFC)NULL) tS(M); + else + if (! execLib(M)) { Err=1; messErr2(10,M); } + if (ITASK) exit(0); /* non interpretation in task ! */ + return Err; +} + +static void traiteLigne(char *b) +{ +char *mot, *d, *f, *w; + d=b; f=b+strlen(d); +#ifdef DEBUG + printf("traiteLigne : <%s>\n",d); +#endif + while (d0) + if (traiteMot(mot)) break; /* abort if error */ + } +} + +void compileFile(char * f) +{ +FILE *F; +int i=0; + if ((F = fopen(f,"r")) != NULL) { + while (fgets(bufP, LBUF,F)) { + if (noErr()) { + printf("In file %s line %d !\n",f,i); + break; + } + traiteLigne(bufP); + i++; + } + fclose(F); + } +} + +static void lectFic(char *L) +{ +int fd; + dropTrSuite(); + if ((fd = open(L,O_RDONLY)) == -1) { + perror(L); + messErr(16); + } else addFD(fd,L); +} + +void IF_LoadCS(void) +{ +char * f; + f = getString(); + if (f != NULL) { + compileFile(f); + free((void*)f); + } +} + +void IF_ExecCS(void) +{ +char * f; + f = getString(); + if (f != NULL) { + if (strlen(f)>0) traiteLigne(f); + free((void*)f); + } +} + +void * makeFunction(char * f) +{ +void *M; + if ((M = malloc(strlen(f)+8)) == NULL) stopErr("makeFunction","malloc"); + sprintf((char*)M,": _f %s ;",f); + traiteLigne((char*)M); + free(M); + if (noErr() == 0) { + M = fctByName("_f"); + return M; + } + messErr(48); + return VIDE; +} + +void IF_ExecCSf(void) +{ +char * f; +void *C; + f = getString(); + if (f != NULL) { + C = VIDE; + if (strlen(f)>0) C = makeFunction(f); + free((void*)f); + if (C != VIDE) { + IF_execFct("_f"); + rmLastFct(); + } + } +} + +void IF_Load(void) +{ + putTrSuite(lectFic); +} + +int main(int N, char *P[]) +{ +int n; +char *dirW = ".nife"; + if (N > 2) { + fprintf(stderr,"nife [nif-file]\n"); + return(1); + } + if ((sizeof(void*) != sizeof(long)) || + (sizeof(double) != sizeof(long long))) { + fprintf(stderr,"Nife open-source don't runs on these machine !\n"); + return(2); + } + signal(SIGUSR1,SIG_IGN); + signal(SIGINT,Interrupt); + signal(SIGTERM,Interrupt); + signal(SIGPIPE,Interrupt); + signal(SIGCHLD,Interrupt); + signal(SIGQUIT,Interrupt); + signal(SIGSEGV,Interrupt); + signal(SIGFPE,Interrupt); + signal(SIGALRM,Interrupt); + /* work in ./.nife for facilities of debugging !! */ + if (chdir(dirW) != 0) { + if (mkdir(dirW, 0755) == -1) { + perror("mkdir"); return 1; + } + if (chdir(dirW) != 0) { + perror("chdir"); return 1; + } + } + termInit(); /* may stop if no term found */ + TH_init(); + initLib(); + D_Reset(); + if (N==2) { + IF_Load(); + lectFic(P[1]); + } else + printf("Welcome to Nife : Just stack it !\n"); + while (RUN) { + if ((FD_IN+iTERM) == 0) { + printf("> "); + fflush(stdout); + } + razErr(); + if ((n=lireLigne(FD_IN,bufP,bufP2,LBUF)) == -1) + printf("Line too long!\n"); + else + if (n>0) traiteLigne(bufP); + } + IF_delAllGP(); + IF_netStopS(); + IF_netOff(); + termReset(); + printf("Bye !\n"); + return 0; +} + diff --git a/src/nife.h b/src/nife.h new file mode 100644 index 0000000..8e4dddf --- /dev/null +++ b/src/nife.h @@ -0,0 +1,44 @@ +/* Copyright (C) 2011-2013 Patrick H. E. Foubet - S.E.R.I.A.N.E. + +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 3 of the License, or 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, see +*******************************************************************/ +/* nife.h */ +#ifndef __NIFE_NIFE_H__ +#define __NIFE_NIFE_H__ + +#include +#include + +#define LDFLT 24 /* default length for names */ + +extern jmp_buf ENV_INT; +extern void interInfos(char *P, char*M); + +typedef void (*PFV) (void); +typedef void (*PFC) (char *); +typedef unsigned char bool; + +extern int isSepa(char c, int m); +extern void IF_about(void); +extern void IF_Load(void); +extern void IF_LoadCS(void); +extern void * makeFunction(char *S); +extern void IF_ExecCS(void); +extern void IF_ExecCSf(void); +extern void putTrSuite(PFC); +extern void dropTrSuite(void); +extern void compileFile(char *); +extern PFC getTrSuite(void); + +#endif diff --git a/src/nife.hlp b/src/nife.hlp new file mode 100644 index 0000000..711bbba --- /dev/null +++ b/src/nife.hlp @@ -0,0 +1,642 @@ +" { -- string } + begins a string wich is terminated by itself. The first blank is a separator. + The character \ masks the character " as end of string. +' : { string -- } + begins, into a function (beetween : and ;), a string which represents a name of + a user function, or a variable. This string will be interpreted and executed + during the function execution. + There is no verification : if the name does not exist, it does nothing. +` : { string -- } + begins, into a function (beetween : and ;), a string which represents a name of + a user function, or a variable. This string will be interpreted and executed + during the function execution. At the first time the code is updated if the + function or the variable is found. + There is no verification : if the name does not exist, it does nothing. +"cat : { str1 str2 -- 'str1str2' } + catenates the two elements on the top string stack entry. +"cats : { str1 str2 -- 'str1 str2' } + catenates the two elements on the top string stack entry with a space beetween. +"date : { -- date_string } + puts the date string (JJ/MM/AAAA) on the top string stack entry. +"drop : { str1 -- } + removes the top string stack entry. +"dup : { str1 -- str1 str1 } + duplicates the top string stack entry. +"over : { str2 str1 -- str2 str1 str2 } + duplicates the second string stack entry onto the top of the stack. +"swap : { str2 str1 -- str1 str2 } + exchanges the top two string stack entries. +"time : { -- time_string } + put the time string (hh:mm:ss) on the top string stack entry. +"type : { str1 -- } + displays and removes the top string stack entry. +"f : { fname -- } + executes the function fname. An error occurs if the function does not exist. +"v : { vname -- } + executes the variable vname. An error occurs if the variable does not exist. +"f? : { fname -- } ( -- T/F ) + executes the function fname. In succes TRUE is putting on the logical stack, if + not FALSE. +"v? : { vname -- } ( -- T/F ) + executes the variable vname. In succes TRUE is putting on the logical stack, if + not FALSE. +"exec : { "code" -- } + executes the code in a string on the top of the character stack. + Does nothing if the string is empty. +"execf : { "code" -- } + executes the code in a string on the top of the character stack as the content + of a function. At each time the function is dynamicaly compiled and executed. + Does nothing if the string is empty. +"execk : { "code" -- } + compiles the code in a string on the top of the character stack as the content + of a function. At the first time the function is dynamicaly compiled, keep as + a user function and executed. On other times the string is removed and the user + function is simply executed. + Does nothing if the string is empty. +* : [ e1 e2 -- result ] + calculates the multiplication : e1 * e2. + If e1 and e2 are arrays, they must have the same dimension and the result will + be an array of this dimension with result[i] = e1[i] * e2[i]. + If e1 or e2 is an array the function adapts itself. + As this operation is commutative the result will be the same if the array is in + first or second position. +** : [ e1 e2 -- result ] + calculates the power : e1 ** e2. + If e1 and e2 are arrays, they must have the same dimension and the result will + be an array of this dimension with result[i] = e1[i] ** e2[i]. + If e1 or e2 is an array the function adapts itself. + WARNING : As this operation is NOT commutative the result will NOT be the same + if the array is in first or second position. +*[]< : [ tab1 tab2 ... tabn n -- tab1 tab2 ... tabn ] + left shift n arrays. The same as []< with n tabs. +*[]<< : [ tab1 tab2 ... tabn n i -- tab1 tab2 ... tabn ] + left shift of i elements on n array. The same as []<< with n tabs. +*[]> : [ tab1 tab2 ... tabn n -- tab1 tab2 ... tabn ] + right shift n arrays. The same as []> with n tabs. +*[]>> : [ tab1 tab2 ... tabn n i -- tab1 tab2 ... tabn ] + right shift of i elements on n array. The same as []>> with n tabs. +*[]rev : [ tab1 tab2 ... tabn n -- tab1 tab2 ... tabn ] + reverse n arrays. The same as []rev with n tabs. +*drop : [ En+1 En ... E1 n -- En+1 ] + removes the top n number stack entries from the stack. +*dup : [ En ... E1 n -- En ... E1 En ... E1 ] + duplicates the top n entries on the number stack. ++ : [ e1 e2 -- result ] + calculates the addition : e1 + e2. + If e1 and e2 are arrays, they must have the same dimension and the result will + be an array of this dimension with result[i] = e1[i] + e2[i]. + If e1 or e2 is an array the function adapts itself. + As this operation is commutative the result will be the same if the array is in + first or second position. +- : [ e1 e2 -- result ] + calculates the soustraction : e1 - e2. + If e1 and e2 are arrays, they must have the same dimension and the result will + be an array of this dimension with result[i] = e1[i] - e2[i]. + If e1 or e2 is an array the function adapts itself. + WARNING : As this operation is NOT commutative the result will NOT be the same + if the array is in first or second position. +. : [ e -- ] + displays and removes the top number stack entry. +/ : [ e1 e2 -- result ] + calculates the division : e1 / e2. + If e1 and e2 are arrays, they must have the same dimension and the result will + be an array of this dimension with result[i] = e1[i] / e2[i]. + If e1 or e2 is an array the function adapts itself. + WARNING : As this operation is NOT commutative the result will NOT be the same + if the array is in first or second position. +< : [ e1 e2 -- ] ( -- bool ) + evaluates the less than test and put the result, true or false, on the logical + stack. + If e1 and e2 are arrays, they must have the same dimension and the result will + be a AND of the comparison of each elements : e1[i] < e2[i]. + If e1 or e2 is an array the function adapts itself. + WARNING : As this operation is NOT commutative the result will NOT be the same + if the array is in first or second position. +<= : [ e1 e2 -- ] ( -- bool ) + evaluates the less or equal than test and put the result, true or false, on the + logical stack. + If e1 and e2 are arrays, they must have the same dimension and the result will + be a AND of the comparison of each elements : e1[i] < e2[i]. + If e1 or e2 is an array the function adapts itself. + WARNING : As this operation is NOT commutative the result will NOT be the same + if the array is in first or second position. +<> : [ e1 e2 -- ] ( -- bool ) + evaluates the not equal test and put the result, true or false, on the logical + stack. + If e1 and e2 are arrays, they must have the same dimension and the result will + be a AND of the comparison of each elements : e1[i] < e2[i]. + If e1 or e2 is an array the function adapts itself. + WARNING : As this operation is NOT commutative the result will NOT be the same + if the array is in first or second position. += : [ e1 e2 -- ] ( -- bool ) + evaluates the equal test and put the result on the logical stack. + If e1 and e2 are arrays, they must have the same dimension and the result will + be a AND of the comparison of each elements : e1[i] < e2[i]. + If e1 or e2 is an array the function adapts itself. + As this operation is commutative the result will be the same if the array is in + first or second position. +> : [ e1 e2 -- ] ( -- bool ) + evaluates the greater than test and put the result on the logical stack. + If e1 and e2 are arrays, they must have the same dimension and the result will + be a AND of the comparison of each elements : e1[i] < e2[i]. + If e1 or e2 is an array the function adapts itself. + WARNING : As this operation is NOT commutative the result will NOT be the same + if the array is in first or second position. +>-scalar : [ [v1, ... ,vn] -- vn ... v2 v1 ] + transforms the array, on the top of the stack, with n elements, in n scalars. + The first value of the array will be the scalar on the top. +>= : [ e1 e2 -- ] ( -- bool ) + evaluates the greater or equal than test and put the result, true or false, on + the logical stack. + If e1 and e2 are arrays, they must have the same dimension and the result will + be a AND of the comparison of each elements : e1[i] < e2[i]. + If e1 or e2 is an array the function adapts itself. + WARNING : As this operation is NOT commutative the result will NOT be the same + if the array is in first or second position. +>array : [ e1 e2 .... eN n -- array ] + take n elements to make an array. Each element ei may be an array. +>scalar : [ [v1, ... ,vn] -- v1 v2 ... vn ] + transforms the array, on the top of the stack, with n elements, in n scalars. + The last value of the array will be the scalar on the top. +?cs : + displays the character (string) stack. +?drop : ( bool1 -- ) + removes the top logical stack entry. +?dup : ( bool1 -- bool1 bool1 ) + duplicates the top logical stack entry. +?lib : + displays the names of base library functions. +?libD : + displays the names of devices library functions. +?libN : + displays the names of network library functions. +?libT : + displays the names of tools library functions. Theses tools are built on extern + Linux tools (gnuplot, xgraph, ...). +?libM : + displays the names of math library functions. +?libP : + displays the names of programming library functions. +?libU : + displays the names of user system functions. +?libs : + displays the names of all libraries functions. +?ls : + displays the logical stack. +?over : ( bool2 bool1 -- bool2 bool1 bool2 ) + duplicates the second logical stack entry onto the top of the stack. +?s : + display the number stack. +?swap : ( bool2 bool1 -- bool1 bool2 ) + exchanges the top two logical stack entries. +?t/f : ( bool -- ) + displays and removes the top logical stack entry. +?vars : + display the list of constants of the system environment. +DEBUG_I/O : + toggle to set debug mode on or off. +INTEGER : + sets the default type to INTEGER. +NBLIG : [ n -- ] + sets the variable NBLIG to n. + NBLIG is used to limit the display of the stack. +NBTAB : [ n -- ] + sets the variable NBTAB to n. + NBTAB is used to limit the display of the stack. +REAL : + sets the default type to REAL. +[]< : [ [v1,v2,...vn] -- [v2, ... ,vn,v1] ] + left shift of 1 element on an array. +[]<< : [ [v1,v2,...vn] i -- [vi+1, ... ,vn,v1,v2 ... vi] ] + left shift of i elements on an array. +[]> : [ [v1,v2,...vn] -- [vn,v1,v2, ... ,vn-1] ] + right shift of 1 element on an array. +[]>> : [ [vn,vn-1,...,v2,v1] i -- [vi, ... ,v2,v1,vn ... vi+1] ] + right shift of i elements on an array. +[]crot : [ tab1 tab2 ... tabN n -- Ntab1 ... NtabP ] + clock rotation on n arrays of P elements. Ntab1 will be composed with the lasts + elements of tab1 ... tabN and NtabP with firsts elements of tab1 ... tabN. +[]max : [ [v1,v2,...vn] -- vMax ] + replace the array on the top of the stack by the maximum value. +[]min : [ [v1,v2,...vn] -- vMin ] + replace the array on the top of the stack by the minimum value. +[]min/max : [ [v1,v2,...vn] -- vMin vMax ] + replace the array on the top of the stack by the minimum and maximum values. +[]prod : [ [v1,v2,...vn] -- v1*v2*...*vn ] + replace the array on the top of the stack by the product of all values. +[]rev : [ [v1,v2,...vn] -- [vn ... v2,v1] ] + reverse an array. +[]sum : [ [v1,v2,...vn] -- v1+v2+...+vn ] + replace the array on the top of the stack by the sum of all values. +[]trot : [ tab1 tab2 ... tabN n -- Ntab1 ... NtabP ] + trigonometric rotation with n arrays of P elements. Ntab1 will be composed with + the firsts elements of tabN ... tab1 and NtabP with firsts elements of tabN ... + tab1. +[]transp : [ tab1 tab2 ... tabN n -- Ntab1 ... NtabP ] + computes the transpose of the matrix composed with n arrays of P elements. + Ntab1 will be composed by the last line of this matrix and NtabP with the first + line. +about : + displays the name of the system and the version. +and : ( A B -- AandB ) + replaces the two booleans on the top of logical stack by the AND. +cr : + displays carriage-return (new line). +depth : [ -- Stack_Depth ] + returns the number of entries on the current number stack to the number stack. +dramp : [ n -- [-n, ...,-1,0,1,2, ...,n] ] + builds an array with 2n+1 elements and initialize it with a ramp (-n to n). It is in fact a double ramp. +drop : [ E -- ] + removes the top number stack entry. +dup : [ E -- E E ] + duplicates the top number stack entry. +echo_off : + sets the echo mode off. +echo_on : + sets the echo mode off. +exit : + terminates the program. +false : ( -- false ) + puts false on the top of the logical stack. +help : + this help !! Need a word following. +ls_clear : ( bool1 bool2 ... boolN -- ) + clears the logical stack. +cs_clear : { str1 ... strn -- } + clears the character stack. +max : [ e1 e2 -- result ] + calculates the maximun of e1 and e2. + If e1 and e2 are arrays, they must have the same dimension and the result will + be an array of this dimension with result[i] = max(e1[i], e2[i]). + If e1 or e2 is an array the function adapts itself. + As this operation is commutative the result will be the same if the array is in + first or second position. +min : [ e1 e2 -- result ] + calculates the minimun of e1 and e2. + If e1 and e2 are arrays, they must have the same dimension and the result will + be an array of this dimension with result[i] = min(e1[i], e2[i]). + If e1 or e2 is an array the function adapts itself. + As this operation is commutative the result will be the same if the array is in + first or second position. +modulo : [ e1 e2 -- result ] + calculates the rest of the division : e1 / e2. + If e1 and e2 are arrays, they must have the same dimension and the result will + be an array of this dimension with result[i] = e1[i] modulo e2[i]. + If e1 or e2 is an array the function adapts itself. + WARNING : As this operation is NOT commutative the result will NOT be the same + if the array is in first or second position. +abs : [ v -- |v| ] + take absolute value of the value on the top of the stack. +neg : [ v -- -v ] + negates the value on the top of the stack. Equivalent to "-1 *". +not : ( A -- notA ) + replaces the boolean on the top of logical stack by his negation. +or : ( A B -- AorB ) + replaces the two booleans on the top of logical stack by the OR. +over : [ E2 E1 -- E2 E1 E2 ] + duplicates the second number stack entry onto the top of the stack. +pick : [ En ... E1 n -- En ... E1 En ] + copies the n-th number stack entry onto the top of the stack. +ramp : [ n -- [1,2, ...,n] ] + builds an array with n elements and initialize it with a ramp (1 to n). +roll : [ En En-1 ... E1 n -- En-1 ... E1 En ] + moves the n-th number stack entry to the top of the stack. +rot : [ E3 E2 E1 -- E2 E1 E3 ] + rotates the third number stack entry to the top of the stack. +rusage : + display a board of ressources usage. +s_clear : [ e1 ... en -- ] + clears the number stack. +sh : + puts nife in background and open a shell. To come back in the program just exit + the shell. +sleep : [ n -- ] + sleep during n seconds. +swap : [ E2 E1 -- E1 E2 ] + exchanges the top two number stack entries. +time : [ -- N ] + puts the time in microseconds on the top of the stack. +true : ( -- true ) + puts true on the top of the logical stack. +unroll : [ En-1 ... E2 E1 n -- E1 En-1 ... E2 ] + moves the top number stack entry to the n-th position on the stack. +unrot : [ E3 E2 E1 -- E1 E3 E2 ] + rotates the top number stack entry to the third position on the stack. This is + the reverse effect of "rot". +xor : ( A B -- AxorB ) + replaces the two booleans on the top of logical stack by the XOR. +vers : [ -- version ] + puts the version value on the top of the stack. +">v : { string -- } + initializes a variable with the top character stack entry. + The name of the variable must follow this instruction. His previous content is + lost. +: : + begins a function definition which the name is the first word following it. The end is indicate by ;. +:! : + begins a system function definition which the name is the first word following + it. The end is indicate by ;. A such function take place in the User System + functions list and cannot be removed. +; : + ends a function definition that was begin by :. +>v : [ E -- ] + initializes a variable with the top stack entry. + The name of the variable must follow this instruction. His previous content is + lost. +?>v : ( boolean -- ) + initializes a variable with the top logical stack entry. + The name of the variable must follow this instruction. His previous content is + lost. +?console : [ n -- ] + displays the background console of task number n. +?f : + display the function stack. +?t : + display the task stack. +?task_run : [ n -- ] ( -- true/false ) + tests if the task number n is running and put a boolean on the logical stack. +?v : + display the variable stack. +Task : [ -- no_task ] + creates a task from a function. The name of the function must following it. + The avaibles names are thoses giving by ?f. In success, the task number is on + the numerical stack. +Var : + creates an empty global variable which the name is the first word following it. + The variables are multiforms and can content scalar, array, boolean, string or + a function name. In this case, it is an executable variable. +"Var : + creates an empty global variable which the name is on the character stack. + The variables are multiforms and can content scalar, array, boolean, string or + a function name. In this case, it is an executable variable. +again : + use in function programmation to create an infinite loop. For example : + : f1 ... begin ... again ... ; + This must be done into a function (beetween : and ;). +begin : + use in function programmation to create a loop. For example : + : f1 ... begin ... [condition] while ... repeat ... ; + : f2 ... begin ... [condition] until ... ; + or infinite loop : + : f3 ... begin ... again ... ; + This must be done into a function (beetween : and ;). +break : + use in function programmation to exit a loop. For example : + : f1 ... begin ... [condition] if ... break then ... again ... ; + This must be done into a function (beetween : and ;). +del_func : + delete the more recent version of a function. + The name of the function must follow this instruction. +del_afunc : + delete all functions beginning by a prefix. + The prefix of the function must follow this instruction. +del_ofunc : + delete the oldest version of a function. + The name of the function must follow this instruction. +del_task : [ n -- ] + delete the task number n. +del_var : + delete a variable. The name of the variable must follow this instruction. +else : + use to make a test. For example : + toto 1 > if 12 else -7 then + At execution time, if toto is greater than 1 12 is put on the stack else -7 is + put. Then dup is executed. + This must be done into a function (beetween : and ;). +fdrop : + removes the top function stack entry. In fact, the last function created. +fscan : + display the result of reverse engineering scanner for a function. + The name of the function must follow this instruction. +if : + use to make a test. For example : + toto 1 > if 12 else -7 then + At execution time, if toto is greater than 1 12 is put on the stack else -7 is + put. Then dup is executed. + This must be done into a function (beetween : and ;). +in : + used to complete the install commands. + Example : install f1 in var +install : + installs a function in a variable. The name must follow this instruction. + This name will be search first in libraries and after in user functions. + Example : install drop in var +install_f : + installs a function in a variable. The name must follow this instruction. + This name will be search first in user functions and after in libraries. + Example : install_f f1 in var +install_v : + installs the content of a variable in another variable. The source name must + follow this instruction. + This name will be search only in variables list. + Example : install_v v1 in v2 +load : + loads a source file. The name of the file must follow this instruction. +"load : { "filename" -- } + loads a source file taking the name of the file on the top of character stack. +myself : + use in a function definition to call the function herself (recursive case). + This must be done into a function (beetween : and ;). +repeat : + use in function programmation to create a loop. For example : + : fonction ... begin ... [condition] while ... repeat ... ; + This must be done into a function (beetween : and ;). +reset_var : + resets a variable. The name of the variable must follow this instruction. +return : + ends the execution into a function. +stop_task : [ n -- ] + stop the task number n. +then : + use to make a test. For example : + toto 1 > if 12 else -7 then + At execution time, if toto is greater than 1 12 is put on the stack else -7 is + put. Then dup is executed. + This must be done into a function (beetween : and ;). +until : + use in function programmation to create a loop. For example : + : f1 ... begin ... [condition] until ... ; + This must be done into a function (beetween : and ;). +var_down : + set DOWN execution of variables. + To execute an instruction seach first in user functions, and then in system + libraries, and finaly in variables. +var_off : + set OFF execution of variables. + To execute an instruction seach first in user functions and then in system + libraries. No seach in variables. +var_up : + set UP execution of variables. + To execute an instruction seach first in variables, then in user functions and + finaly in system libraries. +while : + use in function programmation to create a loop. For example : + : fonction ... begin ... [condition] while ... repeat ... ; + This must be done into a function (beetween : and ;). +vdrop : + removes the top variable stack entry. In fact, the last variable created. +>csv [ tab1 tab2 ... tabn n -- ] { "filename;libtabn; ... ;libtab1" -- } + create a file filename.csv with the n arrays on the top of the stack. The title of each line can be present after the filename without ".csv", separate by ';'. +>net : [ E1 E2 ... En n -- ] + transfert the n elements from local stack to Net stack using NetKey. +?n : + display the Net informations. +?ns : + display the Net stack using NetKey. +ndepth : [ -- Net_Stack_Depth ] + returns the number of entries on the Net stack using NetKey. +NetKey : [ key -- ] + change the value of NetKey. It is a 32 bits INTEGER. +NetErr : [ -- err_value ] + put the Net Error value on the top of the stack. It is the negative of NetKey! +NetServer : { "ServerName" -- } + change the default NetServer (localhost). +ndrop : + drop the elements on the Net stack using NetKey. +net> : [ -- E1 E2 ... En ] + transfert all elements from Net stack to local stack using NetKey. +netDt> : [ -- dt ] + get the dt value. It represents the difference between the clock of the network + and the local clock. + This value must be used before sending time value to the net stack, or after + getting time value from the net stack. For examples : + On system A : + time netDt> + 1 >net # transform the local time in network scale and send it. + On system B : + net> netDt> - # get the time of A and translate it in local scale. +netOff : + disconnect from Nife network. +netOn : { "UserName" -- } + connect to Nife network using the NetServer variable. The UserName is memorized + and can be get by Me. +Me : { -- "UserName" } + put on the top of character stack the username. It is the name given with the + last netOn command, or, if absent, the content of environment variables, in + order : NIFENAME, LOGNAME, USERNAME, USER or "Nobody" if variables are absent. +netExec : { "func_name" "UserName" -- } + send a Nife RPC call to execute the function func_name on the system Username. + The result will be send on the network using the current NetKey. If UserName is + not existant, an error occurs. But if func_name does not exist, or fails in the + execution, the negative value of NetKey (NetErr) is returned on the net stack. +netCompile : { "source_file" "UserName" -- } + send a Nife source file to compile it (like load) on the system Username. + If source file does not exist, or UserName is absent an error occurs. If the + file containts function call, the result will be send on the network using + the current NetKey. + If an error occurs during the compilation or the execution, the negative value + of NetKey (NetErr) is returned on the net stack. +srusage : + display a board of NetServer ressources usage. +stopServer : + Tell the NetServer to stop after netOff if no other user is present. +[]-sub : [ [v1,v2,...,vl,...,vn] l -- [v1,v2,...,vl] ] + extract a left sub-array from an array. If l > n fill zeros on left side. +[]sub : [ [vn,...,vl,...,v2,v1] l -- [vl,...,v2,v1] ] + extract a right sub-array from an array. If l > n fill zeros on right side. +*[]-sub : [ tab1 tab2 ... tabN N l -- tabl1 tabl2 ... tablN ] + extract a left sub-array like sub[] from N arrays. The N arrays have l elements after execution. +*[]sub : [ tab1 tab2 ... tabN N l -- tabl1 tabl2 ... tablN ] + extract a right sub-array like []sub from N arrays. All arrays have l elements after execution. +do : [ limit val -- ] + use in function programmation to create a loop with an index going from val to + limit. Use loop for auto-convergent loop. For examples : + : f1 5 0 do ... loop ... ; + a loop with an index going from 0 to 4 incremented by 1 (i = 0,1,2,3,4). + : f 0 5 do ... loop ... ; + a loop with an index going from 5 to 1 decremented by 1 (i = 5,4,3,2,1). + : f2 15 1 do ... 3 +loop ... ; + a loop with an index going from 1 to 15 incremented by 3 (i = 1,4,7,10,13). + This must be done into a function (beetween : and ;). +loop : + use in function programmation to create an auto-convergent loop with do using + the default 1 by 1 progression. For example : + : f 5 0 do ... loop ... ; + a loop with an index going from 0 to 4 incremented by 1 (i = 0,1,2,3,4). + : f 0 5 do ... loop ... ; + a loop with an index going from 5 to 1 decremented by 1 (i = 5,4,3,2,1). + This must be done into a function (beetween : and ;). ++loop : [ inc -- ] + use in function programmation to create a loop with do using the value inc for + incrementation. For example : + : f 15 1 do ... 3 +loop ... ; + a loop with an index going from 1 to 15 incremented by 3 (i = 1,4,7,10,13). + This must be done into a function (beetween : and ;). +ndo : [ n -- ] + returns the number of do-loop in the running context. + It's usefull before using the indexes I J or K. +I : [ -- val ] + returns the value of the index of the current do-loop. + This must be done into a function (beetween : and ;). +J : [ -- val ] + returns the value of the index of the do-loop containing the current one. + This must be done into a function (beetween : and ;). +K : [ -- val ] + returns the value of the index of the second level do-loop containing the + current one. + This must be done into a function (beetween : and ;). +do_next : [ -- ] + free-context instruction to bypass the end of a loop and go to the next step. +do_leave : [ -- ] + free-context instruction to finish the current loop. +*do_leave : [ n -- ] + free-context instruction to finish the n currents loops. +?gp : + display the gplot stack. +del_gplot : [ n -- ] + delete the gplot number n. The file is deleted but the screen is keeped. +gplot : { "filename" "title" -- } + create a gplot for one plot having as title "title" and working with the file + filename. +gplotM : [ n -- ] { "filename" "title" -- } + create a gplot for n (Multiple) plots having as title "title" and working with + the file filename. +gplotCmd : [ n -- ] { "options" -- } + updating the string command option of gplot number n. +gplotClear : [ n -- ] + clear the file of the gplot number n. +gplotAdd : [ tab n -- ] + add at the end of the file of gplot number n, a line with data of tab. +gplotRepl : [ tab n -- ] + remove the first line and add at the end of the file of gplot number n, a line + with data of tab. +gplotRaz : + remove all gplots. The files are deleted but the screens are keeped. +?dev : + lists all the devices available. The DID is at the beginning of the lines. +dev_dflt : [ DID SID CID -- ] + defines default values in order Device ID, Subdevice ID and Channel ID. +?dev_dflt : + shows informations about the default values device (DID, SID, CID). +dev_dflR : [ -- VAL ] + read the device using the default values DID, SID and CID. +dev_dflW : [ VAL -- ] + write the value VAL on the device using the default values DID, SID and CID. +dev_info : [ DID -- ] + shows informations about device DID. +dev_read : [ DID SID CID -- VAL ] + read the device DID, sub-device SID and channel CID, and put the value on the + numeric stack. +dev_write : [ VAL DID SID CID -- ] + write the value VAL on the device DID, subdevice SID and channel CID. +cos : [ v -- cos(v) ] + compute the cosinus of the value on the top of the stack. +sin : [ v -- sin(v) ] + compute the sinus of the value on the top of the stack. +onerr: : + defines, into a function (beetween : and ;), a label for programming an errors + treatment in case of an error occurs. +end: : + defines, into a function (beetween : and ;), a label for programming a end + treatment. In case of an error occurs, theses instructions will be executed if + this label is AFTER the onerr: label. +goto_end : + instruction, into a function (beetween : and ;), to go to the end: label. +?err : ( -- T/F ) + tests if an error have occured and put true or false, on the logical stack. +?lasterr : + displays the last error elements. +messerr : [ n -- ] { -- "error message" } + puts on the character stack the error message number n. +noerr : [ -- n ] + gives the number of last error. + diff --git a/src/scs.c b/src/scs.c new file mode 100644 index 0000000..763aad8 --- /dev/null +++ b/src/scs.c @@ -0,0 +1,123 @@ +/* Copyright (C) 2011-2013 Patrick H. E. Foubet - S.E.R.I.A.N.E. + +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 3 of the License, or 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, see +*******************************************************************/ +/* scs.c */ +/* Scs means Sister Chip Signature */ +#include +#include + +#include "scs.h" + +static struct Ref { /* Representatives data */ + double D; + char C1; + char C2; + short S; + char C3; + int I; + char C4; + long long LL; +} E; +static uint32_t MyScs=0; + +static void Scs_init(void) +{ + E.C1 = 'N'; + E.C2 = 'i'; + E.C3 = 'f'; + E.C4 = 'e'; + E.D = 2.7182818284590452354; /* e */ + E.S = 763; + E.I = 33497; + E.LL = (long long) 762572642; +} + +uint32_t getScs(void) +{ +int i,l; +unsigned char *t, k; +uint32_t r; + if (MyScs == 0) { + Scs_init(); + l = sizeof(E); + t =(unsigned char*)&E; + r=0; + k=0; + for (i=0; i +*******************************************************************/ +/* scs.h */ +/* Scs means Sister Chip Signature */ + +#ifndef __NIFE_SCS_H__ +#define __NIFE_SCS_H__ + +#include + +extern uint32_t getScs(void); + +#endif diff --git a/src/stackC.c b/src/stackC.c new file mode 100644 index 0000000..95361e4 --- /dev/null +++ b/src/stackC.c @@ -0,0 +1,243 @@ +/* Copyright (C) 2011-2013 Patrick H. E. Foubet - S.E.R.I.A.N.E. + +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 3 of the License, or 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, see +*******************************************************************/ +#include "conf.h" +/* stackC.c */ + +#include +#include +#include +#include + +#include "nife.h" +#include "mth.h" +#include "err.h" +#include "stackC.h" +#include "stackF.h" + +/* #define DEBUG_M */ + + +void putString(char * S) +{ +void * M; +int i; + i = i_StackC; + if (i == LSTACKC) stopErr("putString",NULL); + if ((M = malloc(strlen(S)+1)) == NULL) stopErr("putString","malloc"); +#ifdef DEBUG_M + printf("New String address : %lu \n",(unsigned long)M); +#endif + strcpy((char*)M,S); + if (fctEnCours) makeFct(T_CHA,M); + else { + stackC[i++] = (char*)M; + _MODIF_i_StackC_(i); + } +} + +char * getString(void) /* NOT free() !!! */ +{ +int i; + i = i_StackC; + if (i) { + i--; + _MODIF_i_StackC_(i); + return(stackC[i]); + } + messErr(6); + return NULL; +} + +int isNString(int n) +{ + if (i_StackC >= n) return 1; + return 0; +} + + +void IF_dropC(void) +{ +char * S; + S=getString(); +#ifdef DEBUG_M + printf("Del String address : %lu \n",(unsigned long)S); +#endif + if (S != NULL) free((void*)S); +} + +static void IF_dupC_i(int i) +{ +char * S; +int I; + I = i_StackC; + if (I>=i) { + S = stackC[I-i]; + putString(S); + } + else messErr(19); +} + +void IF_dupC(void) +{ + IF_dupC_i(1); +} + +void IF_overC(void) +{ + IF_dupC_i(2); +} + +void IF_swapC(void) +{ +char * S; +int I; + I = i_StackC; + if (I>1) { + S = stackC[I-1]; + stackC[I-1] = stackC[I-2]; + stackC[I-2] = S; + } + else messErr(19); +} + +void IF_stackC_clear(void) +{ + while (i_StackC) IF_dropC(); +} + +static void IF_catC_i(int i) +{ +char * S1, * S2, *S; +int l, I; + I = i_StackC; + if (I>1) { + S1 = stackC[I-2]; + S2 = stackC[I-1]; + l = strlen(S1) + strlen(S2) + i + 1; + if ((S = (char*)malloc(l+1)) == NULL) stopErr("IF_catC_i","malloc"); + strcpy(S,S1); + if (i) strcat(S, " "); + strcat(S,S2); + IF_dropC(); + IF_dropC(); + I = i_StackC; + stackC[I++]=S; + _MODIF_i_StackC_(I); + } + else messErr(19); +} + +void IF_catC(void) +{ + IF_catC_i(0); +} + +void IF_catsC(void) +{ + IF_catC_i(1); +} + +void IF_crC(void) +{ + printf("\n"); +} + +static void Get_Date_Time(int x) +{ +struct tm * T; +time_t t0; +char b[12]; + t0 = time(NULL); + T = localtime(&t0); + if (x) sprintf(b,"%.2d/%.2d/%.4d",T->tm_mday,T->tm_mon+1,T->tm_year+1900); + else sprintf(b,"%.2d:%.2d:%.2d",T->tm_hour,T->tm_min,T->tm_sec); + putString(b); +} + +void IF_dateC(void) +{ + Get_Date_Time(1); +} + +void IF_timeC(void) +{ + Get_Date_Time(0); +} + +void IF_typeC(void) +{ +int i; + i = i_StackC; + if (i) { + printf("%s",stackC[i-1]); + IF_dropC(); + } + else messErr(6); +} + +void IF_show_stackC(void) +{ +int i,j=0,I; +char s; + I=i_StackC; + for(i=I-1;i>=0;i--) { +#ifdef DEBUG_M + printf(" %.5d : \"%s\" Add=%lu",strlen(stackC[i]),stackC[i], + (unsigned long)(stackC[i])); +#else + printf(" %.5d : \"%s\"",(int)strlen(stackC[i]),stackC[i]); +#endif + if (j==0) printf(" <- top"); + printf("\n"); + j++; + if (j==NBLIG) break; + } + if (i>0) { + if (i==1) s=' '; + else s='s'; + printf(" ... and %d other%c string%c !\n",I-NBLIG,s,s); + } else printf("\n"); +} + + +void suiteString(char *S) +{ +int end=0; + if ((strlen(bufC)+strlen(S)+1) > MAXSTRING) { + dropTrSuite(); + _MODIF_stringEnCours_(0); + messErr(9); + return; + } + if (S[strlen(S)-1] == '"') { + S[strlen(S)-1] = '\0'; + end=1; + } + strcat(bufC,S); + if (end) { + dropTrSuite(); + _MODIF_stringEnCours_(0); + putString(bufC); + } +} + +void IF_debString(void) +{ + bufC[0]='\0'; + putTrSuite(suiteString); + _MODIF_stringEnCours_(1); +} + diff --git a/src/stackC.h b/src/stackC.h new file mode 100644 index 0000000..b77a45a --- /dev/null +++ b/src/stackC.h @@ -0,0 +1,38 @@ +/* Copyright (C) 2011-2013 Patrick H. E. Foubet - S.E.R.I.A.N.E. + +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 3 of the License, or 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, see +*******************************************************************/ +/* stackC.h */ + +#ifndef __NIFE_STACKC_H__ +#define __NIFE_STACKC_H__ + +extern void IF_stackC_clear(void); +extern void putString(char * S); +extern char * getString(void); +extern int isNString(int n); +extern void IF_dropC(void); +extern void IF_dupC(void); +extern void IF_overC(void); +extern void IF_swapC(void); +extern void IF_catC(void); +extern void IF_catsC(void); +extern void IF_crC(void); +extern void IF_typeC(void); +extern void IF_timeC(void); +extern void IF_dateC(void); +extern void IF_show_stackC(void); +extern void IF_debString(void); + +#endif diff --git a/src/stackF.c b/src/stackF.c new file mode 100644 index 0000000..271b113 --- /dev/null +++ b/src/stackF.c @@ -0,0 +1,1333 @@ +/* Copyright (C) 2011-2013 Patrick H. E. Foubet - S.E.R.I.A.N.E. + +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 3 of the License, or 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, see +*******************************************************************/ +/* stackF.c */ +#include "conf.h" + +#include +#include +#include +#include + +#include "nife.h" +#include "mth.h" +#include "err.h" +#include "lib.h" +#include "stackF.h" +#include "stackN.h" +#include "stackC.h" +#include "stackL.h" +#include "stackV.h" +#include "tasks.h" + +#define MAXCODE 2048 + +int FctInTask=0; + +static void * stackF = VIDE; + +struct Fct { + char *l; /* libelle */ + void *n; /* next */ + void *c; /* code */ + short typ; /* type : 0 std, 1 sys in compilation, 2 sys terminated */ +}; + +void initFct(char *Lib, int typ) +{ +void * M, *L; +struct Fct * N; + if ((M = malloc(sizeof(struct Fct))) == NULL) stopErr("initFct","malloc"); + if ((L = malloc(strlen(Lib)+1)) == NULL) stopErr("initFct","malloc"); + strcpy((char*)L,Lib); + N = (struct Fct*)M; + N->l = (char*)L; + N->n = stackF; + N->c = VIDE; + N->typ = typ; + stackF = M; +} + +static void eraseFct(struct Fct *F) +{ +int i,n; +char *C, *E; +void *A, *W; +struct Fct *FD; + /* printf("eraseFct(%s) at 0x%lx\n", F->l, (long)F); */ + free((void*)F->l); + /* free associates memories */ + if (F->c != VIDE) { + A = F->c; + n = sizeof(A); + i = *(int*)A; + C = (char*)A+(3*sizeof(int)); + E = C+i; + while (C < E) { + switch((Code)*C) { + case T_CHA : + case T_CHAS : + case T_NUM : + case T_BKC : + case T_BKC1 : + bcopy((void*)(C+1),(void*)&W,n); + free(W); + break; + case T_FCTD : + case T_FCTDS : + case T_FCTDW : + case T_FCTDWS : + bcopy((void*)(C+1),(void*)&W,n); + FD = (struct Fct*)W; + eraseFct(FD); + break; + default: + break; + } + C+= n+1; + } + free(A); + } + free((void*)F); +} + +void updDynFct(void *AF, int M) /* M:0=init, 1=start, 2=stop */ +{ +int i,n; +char *C, *E; +void *A, *W; +struct Fct *F, *FD; + F = (struct Fct *)AF; + /* printf("updDynFct(%s) at 0x%lx\n", F->l, (long)F); */ + if (F->c == VIDE) return; + A = F->c; + n = sizeof(A); + i = *(int*)A; + C = (char*)A+(3*sizeof(int)); + E = C+i; + switch(M) { + case 0 : /* init */ + while (C < E) { + switch((Code)*C) { + case T_CHAS : + *C=T_CHA; + break; + case T_VARS : + *C=T_VAR; + break; + case T_EXEKS : + *C=T_EXEK; + break; + case T_FCTD : + case T_FCTDS : + case T_FCTDW : + case T_FCTDWS : + *C=T_EXEK; + bcopy((void*)(C+1),(void*)&W,n); + FD = (struct Fct*)W; + eraseFct(FD); + break; + default: + break; + } + C+= n+1; + } + break; + case 1 : /* start */ + while (C < E) { + switch((Code)*C) { + case T_FCTDS : + *C=T_FCTD; + break; + case T_FCTDWS : + *C=T_FCTDW; + break; + default: + break; + } + C+= n+1; + } + break; + case 2 : /* stop */ + while (C < E) { + switch((Code)*C) { + case T_EXEK : + *C=T_EXEKS; + break; + case T_FCTD : + *C=T_FCTDS; + break; + case T_FCTDW : + *C=T_FCTDWS; + break; + default: + break; + } + C+= n+1; + } + break; + default: + break; + } +} + +void rmLastFct(void) +{ +struct Fct *Elt; + if (stackF != VIDE) { + Elt = (struct Fct *)stackF; + if (Elt->typ==2) return; + stackF = Elt->n; + eraseFct(Elt); + } else messErr(7); +} + +static void unlinkLastFct(void) +{ +struct Fct *Elt; + if (stackF != VIDE) { + Elt = (struct Fct *)stackF; + stackF = Elt->n; + } +} + +struct Fct *putCodeFct(void* C) +{ +struct Fct *Elt; + if (stackF != VIDE) { + Elt = (struct Fct *)stackF; + if (Elt->c == VIDE) Elt->c = C; + else messErr(8); + } + else messErr(7); + return Elt; +} + +void IF_show_stackF(void) +{ +void * Next; +struct Fct * N; +char Ctyp; + Next = stackF; + while (Next != VIDE) { + N = (struct Fct*) Next; + if (N->typ) Ctyp='S'; else Ctyp=' '; + printf(" %-25s%c %d octets\n",N->l,Ctyp,*((int*)N->c)); + Next = N->n; + } + printf("\n"); +} + +static char cod[MAXCODE]; +static int i_cod; +/* pile pour IF ELSE THEN */ +static int i_adr; +static void * adr[MAXCODE/4]; +static char tad[MAXCODE/4]; +/* pile pour BEGIN ... WHILE ... REPEAT / BEGIN ... AGAIN / BEGIN ... UNTIL */ +static int i_adB; +static int adB[MAXCODE/4]; +static char tcB[MAXCODE/4]; +/* pile pour DO ... LOOP / +LOOP */ +static int i_adD; +static int adD[MAXCODE/4]; +static char tcD[MAXCODE/4]; +/* pour l'execution */ +static int I_DO=-1; +static char S_DO[MAXCODE/4]; +static long D_DO[MAXCODE/4], L_DO[MAXCODE/4]; + +void IF_nDO (void) +{ + putLong((long long)(I_DO+1)); +} + +static void IF_getIndDo(int v) +{ +int i = I_DO - v; + if (i<0) putLong((long long)0); + else putLong((long long)D_DO[i]); +} + +int tadExist(Code c) +{ +int i=0; + while (ityp) { + F->typ=2; + addFonU(F->l,M); + } + /* printf("Total Fct : %d + %d !\n",i_cod,(3*sizeof(int))); */ + _MODIF_fctEnCours_(0); +} + +void makeFct(Code c,void *A) +{ +int d,i; +long L, L2, LE; + d = sizeof(A); + /* printf("makeFct Entree : code %d + %d\n",(int)c,i_cod); */ + switch(c) { + case T_RET : + case T_NUM : + case T_CHA : + case T_LIB : + case T_FCT : + case T_MYSF : + case T_DO_I : + case T_DO_J : + case T_DO_K : + case T_VAR : + case T_BKC : + case T_BKC1 : + case T_ONER : + case T_END : + case T_JEND : + case T_EXEK : + cod[i_cod++] = c; + bcopy((void*)&A,(void*)&cod[i_cod],d); + i_cod+=d; + break; + case T_IF : + cod[i_cod++] = c; + adr[i_adr]=(void*)&cod[i_cod]; + i_cod+=d; + tad[i_adr++]=c; + break; + case T_ELSE : + if (tad[i_adr-1] == T_IF) { + cod[i_cod++] = T_JMP; + adr[i_adr]=(void*)&cod[i_cod]; + L = (void*)&(cod[i_cod]) - adr[i_adr-1]; + i_cod+=d; + bcopy((void*)&L,adr[i_adr-1],d); + tad[i_adr++]=c; + } else messErr(14); + break; + case T_THEN : + if ((tad[i_adr-1] == T_IF) || (tad[i_adr-1] == T_ELSE)) { + L = (void*)&cod[i_cod+1] - adr[i_adr-1] - (sizeof(void*)+1);/*AV5*/ + bcopy((void*)&L,adr[i_adr-1],d); + tad[i_adr]='\0'; + while (tad[i_adr] != T_IF) i_adr--; /* depile adr */ + } else messErr(14); + break; + case T_BEGI : + adB[i_adB]=i_cod; + tcB[i_adB++]=c; + break; + case T_DO : + cod[i_cod++] = c; + i_cod+=d; + adD[i_adD]=i_cod; + tcD[i_adD++]=c; + cod[i_cod++] = T_IFD; + L = d+1; + bcopy((void*)&L,(void*)&cod[i_cod],d); + i_cod+=d; + cod[i_cod++] = T_GOTO; + L = -1; + bcopy((void*)&L,(void*)&cod[i_cod],d); + i_cod+=d; + break; + case T_PLOO : + case T_LOOP : + if (tcD[i_adD-1] == T_DO) { + i_adD--; /* on depile */ + cod[i_cod++] = c; + i_cod+=d; + cod[i_cod++] = T_GOTO; + L = adD[i_adD]; + bcopy((void*)&L,(void*)&cod[i_cod],d); + i_cod+=d; + /* maj des breaks GOTO -1 */ + LE = i_cod; + for(i=L;i i) P=i; + Do_Evts=P; + } +} + +void IF_DO_Leave (void) +{ + if (I_DO>=0) Do_Evts=1; +} + +void IF_DO_Next (void) +{ + if (I_DO>=0) Do_Evts=-1; +} + +void IF_DO_Show (void) +{ + printf("do vars : I_DO=%d Evts=%d\n",I_DO, Do_Evts); +} + +void execCod(void *A) +{ +int i,n, ea, Ea, *ai, InDo=0, OnErr=0, mFCTP; +long L, P; +char * C, *D, *F, *W, *S, *ADo_Next, *ADo_Leave; +void * T, *T2; +void (*f)(void); +struct Fct * FR; + + /* printf("pid = %d ITASK=%d FctInTask=%d\n",getpid(),ITASK,FctInTask);*/ + if (FctInTask) { + if (ITASK==0) { + if (FctInTask==-1) { + FctInTask=0; return; + } + if (MakeTask(A)) return; + } + if (ITASK!=FctInTask) return; + } + D_Cod++; + ai = (int*)A; + i = *ai++; + ea = *ai++; + Ea = *ai; + if (ea) tellOnErr(A); + C = (char*)A+(3*sizeof(int)); + D = C; + F = C+i; + n = sizeof(T); + while (C <= F) { + /* printf("execCod : %s %d - %x : %ld\n", + codByAddr(A),(int)(C-D),*C,(long)*(C+1)); + */ + if (noErr() && ((C==F) || ((Code)*C != T_ONER)) ) { /* to find onerr: */ + if (ea && (OnErr==0)) { + C = D+ea; + } else { + printf("Called in %s err=%d i=%d/%d cod=<%x>\n", + codByAddr(A),noErr(),(int)(C-D),i,*C); + break; /* end of while */ + } + } + if (C==F) break; /* end of code */ + switch((Code)*C) { + case T_ONER : + if (noErr()==0) { /* jmp end: */ + if (Ea) C = D+Ea; + else C = F; /* to break */ + } else { + if (OnErr==0) { + OnErr=1; + majLastErr(A); + razErr(); + } else C = F; + } + break; + case T_RET : + C = F; /* to break */ + break; + case T_END : + break; /* nothing */ + case T_JEND : + if (Ea) C = D+Ea; + else C = F; /* to break */ + break; + case T_NUM : + bcopy((void*)(C+1),(void*)&T,n); + insertVal(T); + break; + case T_CHA : + bcopy((void*)(C+1),(void*)&W,n); + putString(W); + break; + case T_LIB : + if (InstallOn) { + if (InstallOn < 3) { + bcopy((void*)(C+1),(void*)&T,n); + _MODIF_FCT_INST_(T); + _MODIF_FCT_TYP_(1); + } else { + _MODIF_FCT_INST_(VIDE); + _MODIF_FCT_TYP_(0); + } + InstallOn=0; + } else { + bcopy((void*)(C+1),(void*)&f,n); + f(); + /* free context loops */ + if (Do_Evts) { /* quit or cut */ + /*printf("execCod T_LIB : Evts %d\n",Do_Evts);*/ + if (InDo) { + if (Do_Evts>0) { + C=ADo_Leave; + I_DO--; + InDo = 0; + Do_Evts--; + } else { + C=ADo_Next; + Do_Evts=0; + } + } else { /* quit */ + C = F; + } + } + } + break; + case T_FCT : + if (InstallOn) { + if (InstallOn < 3) { + bcopy((void*)(C+1),(void*)&T,n); + T2=fctByCode(T); + _MODIF_FCT_INST_(T2); + _MODIF_FCT_TYP_(2); + } else { + _MODIF_FCT_INST_(VIDE); + _MODIF_FCT_TYP_(0); + } + InstallOn=0; + } else { + bcopy((void*)(C+1),(void*)&T,n); + execCod(T); + /* free context loops */ + if (Do_Evts) { /* quit or cut */ + /*printf("execCod T_FCT : Evts %d\n",Do_Evts);*/ + if (InDo) { + if (Do_Evts>0) { + C=ADo_Leave; + I_DO--; + InDo = 0; + Do_Evts--; + } else { + C=ADo_Next; + Do_Evts=0; + } + } else { /* quit */ + C = F; + } + } + } + break; + case T_FCTDS : + case T_EXEKS : + if ((S = getString()) != NULL) + free((void*)S); /* remove the string */ + break; + case T_FCTD : + if ((S = getString()) != NULL) + free((void*)S); /* remove the string */ + if (noErr()) break; + case T_FCTDW : + case T_FCTP : + bcopy((void*)(C+1),(void*)&T,n); + FR = (struct Fct *)T; + execCod(FR->c); + /* free context loops */ + if (Do_Evts) { /* quit or cut */ + /*printf("execCod T_FCTD : Evts %d\n",Do_Evts);*/ + if (InDo) { + if (Do_Evts>0) { + C=ADo_Leave; + I_DO--; + InDo = 0; + Do_Evts--; + } else { + C=ADo_Next; + Do_Evts=0; + } + } else { /* quit */ + C = F; + } + } + if (*C == T_FCTP) { + if (mFCTP) *C = T_FCTDW; + else *C = T_FCTD; + } + break; + case T_EXEK : + if ((S = getString()) != NULL) { + if (strlen(S)>0) { /* to do with T_FCTD */ + mFCTP=0; + T = makeFunction(S); + if (T != VIDE) { + bcopy((void*)&T, (void*)(C+1),n); + *C = T_FCTP; + C -= (n+1); + unlinkLastFct(); + /* upgrading precedent code ? not always ! */ + if (C >= D) { + if (*C == T_CHA) { /* case of a string */ + *C = T_CHAS; + mFCTP=1; + } + if (*C == T_VAR) { /* case of a variable string */ + bcopy((void*)(C+1),(void*)&W,n); + if (isVarChar(W)) { + *C = T_VARS; + mFCTP=1; + } + } + } + } else /* error in compilation */ + *C = T_EXEKS; + } + free((void*)S); + } + break; + case T_IF : + if (!getBool()) { + bcopy((void*)(C+1),(void*)&L,n); + C += L; + } + break; + case T_IFN : + if (getBool()) { + bcopy((void*)(C+1),(void*)&L,n); + C += L; + } + break; + case T_DO : + I_DO++; + InDo=1; + /* maj do_adresses */ + W = C + (2*(n+1)); + bcopy((void*)(W+1),(void*)&L,n); + ADo_Leave=D+L-n-1; + ADo_Next=ADo_Leave-(2*(n+1)); + /* printf("execCod T_DO : AL= %d AN=%d\n", + (int)(ADo_Leave-D), (int)(ADo_Next-D));*/ + getParLong(&P); + D_DO[I_DO] = P; + getParLong(&P); + L_DO[I_DO] = P; + if (P > D_DO[I_DO]) S_DO[I_DO]=0; + else S_DO[I_DO]=1; + break; + case T_DO_I : + IF_getIndDo(0); + break; + case T_DO_J : + IF_getIndDo(1); + break; + case T_DO_K : + IF_getIndDo(2); + break; + case T_IFD : + if (S_DO[I_DO]) { + if (D_DO[I_DO] > L_DO[I_DO]) { + bcopy((void*)(C+1),(void*)&L,n); + C += L; + } else { + I_DO--; + InDo=0; + } + } else { + if (D_DO[I_DO] < L_DO[I_DO]) { + bcopy((void*)(C+1),(void*)&L,n); + C += L; + } else { + I_DO--; + InDo=0; + } + } + break; + case T_LOOP : + if (S_DO[I_DO]) D_DO[I_DO]--; + else D_DO[I_DO]++; + break; + case T_PLOO : + getParLong(&P); + D_DO[I_DO]+=P; + break; + case T_JMP : + bcopy((void*)(C+1),(void*)&L,n); + C += L; + break; + case T_GOTO : + bcopy((void*)(C+1),(void*)&L,n); + C = D + L - n-1; + break; + case T_VAR : + if (InstallOn) { + if (InstallOn == 3) { + bcopy((void*)(C+1),(void*)&T,n); + _MODIF_FCT_INST_(T); + _MODIF_FCT_TYP_(3); + } else { + _MODIF_FCT_INST_(VIDE); + _MODIF_FCT_TYP_(0); + } + InstallOn=0; + } else { + bcopy((void*)(C+1),(void*)&W,n); + executeVar(W); + /* free context loops */ + if (Do_Evts) { /* quit or cut */ + /*printf("execCod T_VAR : Evts %d\n",Do_Evts);*/ + if (InDo) { + if (Do_Evts>0) { + C=ADo_Leave; + I_DO--; + InDo = 0; + Do_Evts--; + } else { + C=ADo_Next; + Do_Evts=0; + } + } else { /* quit */ + C = F; + } + } + } + break; + case T_BKC : + bcopy((void*)(C+1),(void*)&W,n); + execLib(W); + break; + case T_BKC1 : /* like makeFct */ + bcopy((void*)(C+1),(void*)&W,n); + /* try to modify the code */ + if (VARS==2) { /* VARS UP */ + if ((T = varByName(W)) != VIDE) { + *C = T_VAR; + } else { + if ((T = fctByName(W)) != VIDE) { + *C = T_FCT; + FR = (struct Fct *)T; + T = FR->c; + } + } + } else { + if ((T = fctByName(W)) != VIDE) { + *C = T_FCT; + FR = (struct Fct *)T; + T = FR->c; + } else { + if ((VARS==1) && ((T = varByName(W)) != VIDE)) { + *C = T_VAR; + } + } + } + if ((Code)*C != T_BKC1) { /* code is updated */ + bcopy((void*)&T, (void*)(C+1),n); + C-=(n+1); /* it must be executed */ + } + break; + case T_NOP : + case T_CHAS : + case T_VARS : + case T_FCTDWS : + break; + default : + messErr(11); + } + C+= n+1; + } + D_Cod--; + if (ea) tellOnErr(VIDE); +} + +void execFctV(void * A) +{ +struct Fct * N; + N = (struct Fct*) A; + execCod(N->c); +} + +int IF_execFct(char * L) +{ +void * Next; +struct Fct * N; + Next = stackF; + while (Next != VIDE) { + N = (struct Fct*) Next; + if (strcmp(N->l,L)==0) { + if (fctEnCours) makeFct(T_FCT,N->c); + else execCod(N->c); + return 1; + } + Next = N->n; + } + return 0; +} + +void * fctByName(char * L) +{ +void * Next; +struct Fct * N; + Next = stackF; + while (Next != VIDE) { + N = (struct Fct*) Next; + if (strcmp(N->l,L)==0) return Next; + Next = N->n; + } + return VIDE; +} + +void * fctByCode(void * C) +{ +void * Next; +struct Fct * N; + Next = stackF; + while (Next != VIDE) { + N = (struct Fct*) Next; + if (N->c==C) return Next; + Next = N->n; + } + return VIDE; +} + +static void rmFct(char * L) +{ +void ** PNext; +struct Fct * N; + dropTrSuite(); + PNext = &stackF; + while (*PNext != VIDE) { + N = (struct Fct*) *PNext; + if (N->typ==0) + if (strcmp(N->l,L)==0) { + *PNext = N->n; + eraseFct(N); + return; + } + PNext = &N->n; + } + messErr(21); +} +static void rmAFct(char * L) +{ +void ** PNext; +struct Fct * N; + dropTrSuite(); + PNext = &stackF; + while (*PNext != VIDE) { + N = (struct Fct*) *PNext; + if ((N->typ==0) && (strncmp(N->l,L,strlen(L))==0)) { + *PNext = N->n; + eraseFct(N); + } + else PNext = &N->n; + } +} +static void rmOFct(char * L) +{ +void ** PNext, ** FP; +struct Fct * N, * F; + dropTrSuite(); + F = VIDE; + PNext = &stackF; + while (*PNext != VIDE) { + N = (struct Fct*) *PNext; + if (N->typ==0) + if (strcmp(N->l,L)==0) { + FP = PNext; + F = N; + } + PNext = &N->n; + } + if (F != VIDE) { + *FP = F->n; + eraseFct(F); + } + else messErr(21); +} + +char * fctByAddr(void * A) +{ +void * Next; +struct Fct * N; + Next = stackF; + while (Next != VIDE) { + N = (struct Fct*) Next; + if (Next==A) return N->l; + Next = N->n; + } + return NULL; +} + +char * codByAddr(void * A) +{ +void * Next; +struct Fct * N; + Next = stackF; + while (Next != VIDE) { + N = (struct Fct*) Next; + if (N->c==A) return N->l; + Next = N->n; + } + return NULL; +} + +void prMarge(int n) +{ +int N, i; + N = n*3; + for(i=0;ic; + ai = (int*)A; + i = *ai++; + ea = *ai++; + Ea = *ai; + C = (char*)A+(3*sizeof(int)); + D = C; + F = C+i; + n = sizeof(A); + if (marge) prMarge(marge); + if (N->typ) printf ("System "); + printf("Fonction : %s (%d) : 0x%lx\n", N->l, i, (unsigned long)A ); + if (ea+Ea) { + if (ea) printf("Catching error at %d",ea); + if (Ea) { + if (ea) printf(" - "); + printf("End label at %d",Ea); + } + printf("\n"); + } + while (C < F) { + if (marge) prMarge(marge); + printf(" %.4d : ",(int)(C-D)); + switch((Code)*C) { + case T_NOP : + case T_CHAS : + case T_VARS : + case T_FCTDWS : + printf("NOP\n"); + break; + case T_FCTDS : + case T_EXEKS : + printf("\"drop\n"); + break; + case T_RET : + printf("RETURN\n"); + break; + case T_ONER : + printf("onerr: label\n"); + break; + case T_END : + printf("end: label\n"); + break; + case T_JEND : + printf("goto end:\n"); + break; + case T_NUM : + bcopy((void*)(C+1),(void*)&W,n); + printf("Number value : "); + printNumber(W); + printf("\n"); + break; + case T_CHA : + bcopy((void*)(C+1),(void*)&W,n); + printf("Character String \"%s\"\n",(char*)W); + break; + case T_LIB : + bcopy((void*)(C+1),(void*)&W,n); + printf("Call to library : %s\n", libByAddr(W)); + break; + case T_FCT : + bcopy((void*)(C+1),(void*)&W,n); + printf("Function : %s\n", codByAddr(W)); + break; + case T_FCTD : + printf("\"drop + "); + case T_FCTDW : + bcopy((void*)(C+1),(void*)&W,n); + N = (struct Fct *)W; + printf("Dynamic Function at 0x%lx\n", (long)W); + scanFoncI(W,marge+1); + break; + case T_IF : + bcopy((void*)(C+1),(void*)&L,n); + printf("IF false goto %ld\n",(C-D)+L+n+1); + break; + case T_DO : + printf("DO [ LIMIT I -- ]\n"); + break; + case T_DO_I : + printf("GET I [ -- I ]\n"); + break; + case T_DO_J : + printf("GET J [ -- J ]\n"); + break; + case T_DO_K : + printf("GET K [ -- K ]\n"); + break; + case T_LOOP : + printf("I=+/-1\n"); + break; + case T_PLOO : + printf("I += V [ V -- ]\n"); + break; + case T_IFN : + bcopy((void*)(C+1),(void*)&L,n); + printf("IF true goto %ld\n",(C-D)+L+n+1); + break; + case T_IFD : + bcopy((void*)(C+1),(void*)&L,n); + printf("IF (LIMIT NOT REACHED) goto %ld\n",(C-D)+L+n+1); + break; + case T_JMP : + bcopy((void*)(C+1),(void*)&L,n); + printf("JMP $+%ld\n",L); + break; + case T_GOTO : + bcopy((void*)(C+1),(void*)&L,n); + printf("GOTO %ld\n",L); + break; + case T_EXEK : + printf("Dynamic Compile (\"execk) !\n"); + break; + case T_VAR : + bcopy((void*)(C+1),(void*)&W,n); + printf("Call variable : %s\n", varByAddr(W)); + break; + case T_BKC1 : + strcpy(lm,"1st "); + case T_BKC : + bcopy((void*)(C+1),(void*)&W,n); + printf("Back Compile %s: \"%s\"\n",lm, (char*)W); + break; + default : + printf("0x%x : code inconnu !!\n",(int)*C); + } + C+= n+1; + } +} + +static void scanFonc(char * Lib) +{ +void ** PNext; +struct Fct * N; + dropTrSuite(); + PNext = &stackF; + while (*PNext != VIDE) { + N = (struct Fct*) *PNext; + if (strcmp(N->l,Lib)==0) break; + PNext = &N->n; + } + if (strcmp(N->l,Lib)!=0) { + messErr(21); + return; + } + scanFoncI((void*)N ,0); +} + +void IF_execCS(void) +{ +char * f; + f = getString(); + if (f != NULL) { + if (!IF_execFct(f)) { + printf("%s - ",f); messErr(21); + } + free((void*)f); + } +} + +void IF_execCSl(void) +{ +char * f; + f = getString(); + if (f != NULL) { + if (IF_execFct(f)) putBool(TRUE); + else putBool(FALSE); + free((void*)f); + } + else putBool(FALSE); +} + +void IF_execCSv(void) +{ +char * f; + f = getString(); + if (f != NULL) { + if (!IF_execVar(f)) { + printf("%s - ",f); messErr(24); + } + free((void*)f); + } +} + +void IF_execCSvl(void) +{ +char * f; + f = getString(); + if (f != NULL) { + if (IF_execVar(f)) putBool(TRUE); + else putBool(FALSE); + free((void*)f); + } + else putBool(FALSE); +} + +void IF_delFct(void) +{ + putTrSuite(rmFct); +} +void IF_delAFct(void) +{ + putTrSuite(rmAFct); +} +void IF_delOFct(void) +{ + putTrSuite(rmOFct); +} + +void IF_scanFct(void) +{ + putTrSuite(scanFonc); +} + +static void IF_instruct(Code C) +{ + if (fctEnCours) makeFct(C,NULL); + else messErr(13); +} + +void IF_RET(void) { IF_instruct(T_RET); } +void IF_IF(void) { IF_instruct(T_IF); } +void IF_THEN(void) { IF_instruct(T_THEN); } +void IF_ELSE(void) { IF_instruct(T_ELSE); } +void IF_BEGIN(void) { IF_instruct(T_BEGI); } +void IF_AGAIN(void) { IF_instruct(T_AGAI); } +void IF_UNTIL(void) { IF_instruct(T_UNTI); } +void IF_WHILE(void) { IF_instruct(T_WHIL); } +void IF_REPEAT(void) { IF_instruct(T_REPE); } +void IF_BREAK(void) { IF_instruct(T_BREA); } +void IF_MYSELF(void) { IF_instruct(T_MYSF); } +void IF_DO(void) { IF_instruct(T_DO); } +void IF_LOOP(void) { IF_instruct(T_LOOP); } +void IF_PLOOP(void) { IF_instruct(T_PLOO); } +void IF_I_DO(void) { IF_instruct(T_DO_I); } +void IF_J_DO(void) { IF_instruct(T_DO_J); } +void IF_K_DO(void) { IF_instruct(T_DO_K); } +void IF_ONERR(void) { IF_instruct(T_ONER); } +void IF_END(void) { IF_instruct(T_END); } +void IF_JEND(void) { IF_instruct(T_JEND); } +void IF_EXEK(void) { IF_instruct(T_EXEK); } + +/* code for back compilation of calling functions and variables */ + +void suiteBackC(char *S) +{ +void * M; + dropTrSuite(); + if (strlen(S) > LDFLT) { + messErr(9); + return; + } + if (S[strlen(S)-1] != '\'') { + messErr(44); + return; + } + S[strlen(S)-1] = '\0'; + if ((M = malloc(strlen(S)+1)) == NULL) stopErr("suiteBackC","malloc"); +#ifdef DEBUG_M + printf("New String address : %lu \n",(unsigned long)M); +#endif + strcpy((char*)M,S); + if (fctEnCours) makeFct(T_BKC,M); + else messErr(13); +} + +void IF_debBackC(void) +{ + putTrSuite(suiteBackC); +} + +void suiteBackC1(char *S) +{ +void * M; + dropTrSuite(); + if (strlen(S) > LDFLT) { + messErr(9); + return; + } + if (S[strlen(S)-1] != '`') { + messErr(44); + return; + } + S[strlen(S)-1] = '\0'; + if ((M = malloc(strlen(S)+1)) == NULL) stopErr("suiteBackC1","malloc"); +#ifdef DEBUG_M + printf("New String address : %lu \n",(unsigned long)M); +#endif + strcpy((char*)M,S); + if (fctEnCours) makeFct(T_BKC1,M); + else messErr(13); +} + +void IF_debBackC1(void) +{ + putTrSuite(suiteBackC1); +} + + diff --git a/src/stackF.h b/src/stackF.h new file mode 100644 index 0000000..4f30691 --- /dev/null +++ b/src/stackF.h @@ -0,0 +1,120 @@ +/* Copyright (C) 2011-2013 Patrick H. E. Foubet - S.E.R.I.A.N.E. + +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 3 of the License, or 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, see +*******************************************************************/ +/* stackF.h */ + +#ifndef __NIFE_STACKF_H__ +#define __NIFE_STACKF_H__ + +extern int FctInTask; + +typedef unsigned char Code; +#define T_NOP ((Code)0) /* No OPeration */ +#define T_RET ((Code)1) /* RETURN in function */ +#define T_NUM ((Code)2) /* Numeric element */ +#define T_CHA ((Code)3) /* Character element */ +#define T_LIB ((Code)4) /* Standard Library function */ +#define T_FCT ((Code)5) /* User function */ +#define T_IF ((Code)6) /* IF */ +#define T_ELSE ((Code)7) /* THEN */ +#define T_THEN ((Code)8) /* ELSE */ +#define T_JMP ((Code)9) /* JUMP depl */ +#define T_BEGI ((Code)10)/* BEGIN */ +#define T_AGAI ((Code)11)/* AGAIN */ +#define T_UNTI ((Code)12)/* UNTIL */ +#define T_WHIL ((Code)13)/* WHILE */ +#define T_REPE ((Code)14)/* REPEAT */ +#define T_DO ((Code)15)/* DO */ +#define T_LOOP ((Code)16)/* LOOP */ +#define T_PLOO ((Code)17)/* +LOOP */ +#define T_BREA ((Code)18)/* BREAK in all loops */ +#define T_GOTO ((Code)19)/* GOTO */ +#define T_MYSF ((Code)20)/* MYSELF for current function */ +#define T_IFN ((Code)21)/* IF NOT */ +#define T_IFD ((Code)22)/* IF in DO */ +#define T_DO_I ((Code)23)/* INDEX of DO */ +#define T_DO_J ((Code)24)/* INDEX of DO PREVIOUS LEVEL */ +#define T_DO_K ((Code)25)/* INDEX of DO 2 LEVELS UP */ +#define T_VAR ((Code)26)/* Variable */ +#define T_BKC ((Code)27)/* Back Compilation */ +#define T_BKC1 ((Code)28)/* Back Compilation on 1st time */ +#define T_ONER ((Code)29)/* onerr: for current function */ +#define T_END ((Code)30)/* end: for current function */ +#define T_JEND ((Code)31)/* goto end: for current function */ +#define T_EXEK ((Code)32)/* "execk code */ +#define T_FCTD ((Code)33)/* Dynamic User function */ +#define T_FCTP ((Code)34)/* Primary Dynamic User function */ +#define T_FCTDW ((Code)35)/* Dynamic User function without remove string */ +#define T_CHAS ((Code)36)/* Character element Stopped */ +#define T_VARS ((Code)37)/* Variable Stopped */ +#define T_FCTDS ((Code)38)/* Dynamic User funct. Stopped */ +#define T_FCTDWS ((Code)39)/* Dynamic User funct. Stopped without remove str. */ +#define T_EXEKS ((Code)40)/* "execk code Stopped */ + +extern int D_Cod; +extern void IF_show_stackF(void); +extern void IF_debFct(void); +extern void IF_debFctS(void); +extern void IF_finFct(void); +extern void updDynFct(void *A, int Mode); +extern void rmLastFct(void); +extern void makeFct(Code c, void * E); +extern int IF_execFct(char * L); +extern void IF_delFct(void); +extern void IF_delAFct(void); +extern void IF_delOFct(void); +extern void IF_scanFct(void); +extern void IF_DO_Leave(void); +extern void IF_DO_MLeave(void); +extern void IF_DO_Next(void); +extern void IF_DO_Show(void); +extern void execCode(void *C); +extern void * fctByName(char *L); +extern void * fctByCode(void *C); +extern void execFctV(void * A); +extern char * fctByAddr(void *A); +extern char * codByAddr(void *A); +extern void IF_nDO(void); + +extern void IF_execCS(void); +extern void IF_execCSv(void); +extern void IF_execCSl(void); +extern void IF_execCSvl(void); +extern void IF_RET(void); +extern void IF_IF(void); +extern void IF_THEN(void); +extern void IF_ELSE(void); +extern void IF_BEGIN(void); +extern void IF_AGAIN(void); +extern void IF_UNTIL(void); +extern void IF_WHILE(void); +extern void IF_REPEAT(void); +extern void IF_BREAK(void); +extern void IF_MYSELF(void); +extern void IF_ONERR(void); +extern void IF_END(void); +extern void IF_JEND(void); +extern void IF_DO(void); +extern void IF_LOOP(void); +extern void IF_PLOOP(void); +extern void IF_I_DO(void); +extern void IF_J_DO(void); +extern void IF_K_DO(void); +extern void IF_EXEK(void); + +extern void IF_debBackC(void); +extern void IF_debBackC1(void); + +#endif diff --git a/src/stackL.c b/src/stackL.c new file mode 100644 index 0000000..883ae59 --- /dev/null +++ b/src/stackL.c @@ -0,0 +1,180 @@ +/* Copyright (C) 2011-2013 Patrick H. E. Foubet - S.E.R.I.A.N.E. + +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 3 of the License, or 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, see +*******************************************************************/ +/* stackL.c */ +#include "conf.h" + +#include + +#include "nife.h" +#include "mth.h" +#include "err.h" +#include "stackL.h" + + +void IF_stackL_clear(void) +{ + _MODIF_i_StackL_(0); +} + +void putBool(bool B) +{ +int i; + i=i_StackL; + stackL[i++] = B; + _MODIF_i_StackL_(i); + if (i == LSTACKL) stopErr("putBool",NULL); +} + +void IF_dupL(void) +{ +int i; + i=i_StackL; + if (i) { + putBool(stackL[i-1]); + } else messErr(5); +} + +void IF_swapL(void) +{ +bool B; +int i; + i=i_StackL; + if (i > 1) { + B = stackL[i-1]; + stackL[i-1] = stackL[i-2]; + stackL[i-2] = B; + } else messErr(20); +} + +void IF_andL(void) +{ +bool B; +int i; + i=i_StackL; + if (i > 1) { + B = stackL[i-1] & stackL[i-2]; + stackL[i-2] = B; + i--; + _MODIF_i_StackL_(i); + } else messErr(20); +} + +void IF_orL(void) +{ +bool B; +int i; + i=i_StackL; + if (i > 1) { + B = stackL[i-1] | stackL[i-2]; + stackL[i-2] = B; + i--; + _MODIF_i_StackL_(i); + } else messErr(20); +} + +void IF_xorL(void) +{ +bool B; +int i; + i=i_StackL; + if (i> 1) { + if (stackL[i-1] == stackL[i-2]) B=FALSE; + else B = TRUE; + stackL[i-2] = B; + i--; + _MODIF_i_StackL_(i); + } else messErr(20); +} + +void IF_overL(void) +{ +int i; + i=i_StackL; + if (i > 1) { + putBool(stackL[i-2]); + } else messErr(20); +} + +bool getBool(void) +{ +int i; + i=i_StackL; + if (i) { + i--; + _MODIF_i_StackL_(i); + return(stackL[i]); + } else messErr(5); + return -1; +} + +void IF_typeL(void) +{ +int i; + i=i_StackL; + if (i) { + i--; + _MODIF_i_StackL_(i); + if(stackL[i]) printf("true\n"); + else printf("false\n"); + } else messErr(5); +} + +void negBool(void) +{ +int i; + i=i_StackL; + if (i) { + i--; + if(stackL[i]) stackL[i]= FALSE; + else stackL[i]= TRUE; + } else messErr(5); +} + +void IF_true(void) +{ + putBool(TRUE); +} + +void IF_false(void) +{ + putBool(FALSE); +} + +void IF_dropL(void) +{ + getBool(); +} + +void IF_show_stackL(void) +{ +int i,j=0,I; +char s; + I=i_StackL; + for(i=I-1;i>=0;i--) { + if (stackL[i]) printf(" TRUE"); + else printf(" FALSE"); + if (j==0) printf(" <- top"); + printf("\n"); + j++; + if (j==NBLIG) break; + } + if (i>0) { + if (i==1) s=' '; + else s='s'; + printf(" ... and %d other%c boolean%c !\n",I-NBLIG,s,s); + } else printf("\n"); +} + diff --git a/src/stackL.h b/src/stackL.h new file mode 100644 index 0000000..56cb1bc --- /dev/null +++ b/src/stackL.h @@ -0,0 +1,40 @@ +/* Copyright (C) 2011-2013 Patrick H. E. Foubet - S.E.R.I.A.N.E. + +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 3 of the License, or 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, see +*******************************************************************/ +/* stackL.h */ + +#ifndef __NIFE_STACKL_H__ +#define __NIFE_STACKL_H__ + +#define TRUE ((bool)1) +#define FALSE ((bool)0) + +extern void IF_stackL_clear(void); +extern void putBool(bool); +extern bool getBool(void); +extern void negBool(void); +extern void IF_dropL(void); +extern void IF_dupL(void); +extern void IF_swapL(void); +extern void IF_overL(void); +extern void IF_typeL(void); +extern void IF_andL(void); +extern void IF_orL(void); +extern void IF_xorL(void); +extern void IF_true(void); +extern void IF_false(void); +extern void IF_show_stackL(void); + +#endif diff --git a/src/stackN.c b/src/stackN.c new file mode 100644 index 0000000..ffffb16 --- /dev/null +++ b/src/stackN.c @@ -0,0 +1,1897 @@ +/* Copyright (C) 2011-2013 Patrick H. E. Foubet - S.E.R.I.A.N.E. + +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 3 of the License, or 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, see +*******************************************************************/ +/* stackN.c */ +#include "conf.h" + +#include +#include +#include +#include +#include +#include + +#include "nife.h" +#include "mth.h" +#include "err.h" +#include "lib.h" +#include "stackN.h" +#include "stackL.h" +#include "stackF.h" +#include "stackV.h" +#include "debug.h" +#include "net.h" +#include "scs.h" + +#define _VERIF_STACK_ if (StackN == VIDE) { messErr(2); return; } + + +void IF_vars(void) +{ +char * L; + printf("DEBUG : "); + if (Debug) printf("ON"); else printf("OFF"); + printf("\nDefault type="); + if (DOUBLE) printf("REAL"); else printf("INTEGER"); + printf("\nDefault echo="); + if (ECHOOFF) printf("OFF"); else printf("ON"); + printf("\nNetServer : \"%s\"",NetServer); + printf("\nSCS Key : 0x%lx",(long)getScs()); + printf("\nNetKey : 0x%lx",(long)NetKey); + printf("\nVARS : "); + switch(VARS) { + case 1 : + printf("DOWN"); + break; + case 2 : + printf("UP"); + break; + default : + printf("OFF"); + break; + } + printf("\nVariable Function : "); + if ((L=libByAddr(FCT_INST)) != NULL) printf("%s (std lib)",L); + else { + if ((L=fctByAddr(FCT_INST)) != NULL) printf("%s (user function)",L); + else { + if ((L=varByAddr(FCT_INST)) != NULL) printf("%s (variable)",L); + else printf("none"); + } + } + printf("\nNBTAB=%d\nNBLIG=%d\n",NBTAB,NBLIG); +} + +void IF_REAL(void) { _MODIF_DOUBLE_(1); } +void IF_INTEGER(void) { _MODIF_DOUBLE_(0); } + +void IF_ECHOFF(void) { _MODIF_ECHOOFF_(1); } +void IF_ECHOON(void) { _MODIF_ECHOOFF_(0); } + +/* IMPORTANT ************************** + la taille t est codee sur 30 bits + a droite + B31 = 1 si Var + B32 = 1 si REAL +**********************/ +#define MSK_T (uint32_t)(0x3FFFFFFF) +#define MSK_V (uint32_t)(0x40000000) +#define MSK_R (uint32_t)(0x80000000) + +struct Num { + uint32_t t; /* taille : cf precisions ci-dessus */ + uint32_t key; /* net key */ + void *n; + union { + long long l; + double d; + }; +}; + +int lAdrNum(void) +{ +struct Num N; + return((char*)&(N.l) - (char*)&(N.n)); +} + +void putLong(long long l) +{ +void * M; +struct Num * N; + if ((M = malloc(sizeof(struct Num))) == NULL) stopErr("putLong","malloc"); + N = (struct Num*)M; + N->t = 1; + N->n = StackN; + N->l = l; + _MODIF_STACKN_(M); +} + +void putDouble(double d) +{ +void * M; +struct Num * N; + if ((M = malloc(sizeof(struct Num))) == NULL) stopErr("putDouble","malloc"); + N = (struct Num*)M; + N->t = 1 | MSK_R; + N->n = StackN; + N->d = d; + _MODIF_STACKN_(M); +} + +int putVal(char *V) +{ +void * M; +char * R; +struct Num * N; +long long l; +double d; +#ifdef DEBUG + printf("putVal (%s) \n",V); +#endif + l = strtoll(V,&R,0); + if (strlen(R)==0) { + if ((M = malloc(sizeof(struct Num))) == NULL) stopErr("putVal","malloc"); + N = (struct Num*)M; + N->t = 1; + N->n = StackN; + N->l = l; + if (fctEnCours) makeFct(T_NUM,M); + else _MODIF_STACKN_(M); + return 1; + } else { + d = strtod(V,&R); + if (strlen(R)==0) { + if ((M=malloc(sizeof(struct Num))) == NULL) stopErr("putVal","malloc"); + N = (struct Num*)M; + N->t = 1 | MSK_R; + N->n = StackN; + N->d = d; + if (fctEnCours) makeFct(T_NUM,M); + else _MODIF_STACKN_(M); + return 1; + } + } + return 0; +} + +static int isScalar(void) +{ +struct Num *Elt; +int t; + if(StackN == VIDE) return 0; + Elt = (struct Num *)StackN; + if ((t = Elt->t&MSK_T) == 1) return 1; + return 0; +} + +static int dropElt(void) +{ +struct Num *Elt; + if(StackN == VIDE) return 0; + Elt = (struct Num *)StackN; + _MODIF_STACKN_(Elt->n); + if (!(Elt->t&MSK_V)) free((void*)Elt); + return 1; +} + +void IF_drop(void) +{ + _VERIF_STACK_ + dropElt(); +} + + +static long long getVal(void) +{ +struct Num *Elt; + Elt = (struct Num *)StackN; + if (Elt->t & MSK_R) return((long long)Elt->d); + else return(Elt->l); +} + +void IF_vers(void) +{ + putDouble(atof(VERSION)); +} + +/* fonction pour les autres */ +int getParLong(long *V) +{ + if (StackN == VIDE) { + messErr(2); return 0 ; + } + if (!isScalar()) { + messErr(36); return 0 ; + } + *V = (long)getVal(); + dropElt(); + return 1; +} + + +void putVar(void * V) +{ +struct Num *Elt; + if (V==VIDE) return; + Elt = (struct Num *)V; + Elt->n = StackN; + _MODIF_STACKN_(V); +} + +void * getVar(void) +{ +void * N; +struct Num *Elt; + N = StackN; + if (N != VIDE) { + Elt = (struct Num *)N; + _MODIF_STACKN_(Elt->n); /* drop no free !! */ + Elt->n = VIDE; + Elt->t = Elt->t|MSK_V; /* VARIABLE ! */ + } + return N; +} + +void IF_NBTAB(void) +{ +long V; + if (getParLong(&V)) _MODIF_NBTAB_(V); +} + +void IF_NBLIG(void) +{ +long V; + if (getParLong(&V)) _MODIF_NBLIG_(V); +} + +void IF_VAROFF(void) { _MODIF_VARS_(0); } +void IF_VARDOWN(void) { _MODIF_VARS_(1); } +void IF_VARUP(void) { _MODIF_VARS_(2); } + +void insertVal(void*A) +{ +void * M; +struct Num *Elt; + if ((M = malloc(sizeof(struct Num))) == NULL) stopErr("insertVal","malloc"); + bcopy(A,M,sizeof(struct Num)); + Elt=(struct Num*)M; + Elt->n = StackN; + _MODIF_STACKN_(M); +} + +static void Ramp(int D) +{ +long n, i, dep=1; +void * M; +struct Num * N; +long long *T; + _VERIF_STACK_ + if (!isScalar()) { + messErr(36); return; + } + n = (long)getVal(); + dropElt(); + if (n > 1) { + if (D) { /* double ramp */ + dep = -n; + n = (2*n) +1; + } + if ((M = malloc(sizeof(struct Num)+((n-1)*(sizeof(double))))) == NULL) + stopErr("Ramp","malloc"); + N = (struct Num*)M; + N->t = n; + N->n = StackN; + _MODIF_STACKN_(M); + T = &(N->l); + for(i=0;it&MSK_T; + if (IB < 0) nt = 3; + else nt = NBTAB; + if (n > nt) m=nt-1; + else m=n-1; + if (I==ELT_POINT) { + IB=0; + n=2; + m=1; + } + if (IB) printf(" "); + if(N->t & MSK_R) { + if (n==1) printf("%g (REAL)",N->d); + else { + d = &N->d; + for(i=0;i nt) printf("... "); + printf("%g (REAL)[%ld]",*(&N->d+(n-1)),n); + } + } else { + if (n==1) printf("%lld (INTEGER)",N->l); + else { + l = &N->l; + for(i=0;i nt) printf("... "); + printf("%lld (INTEGER)[%ld]",*(&N->l+(n-1)),n); + } + } + if ((IB>0) && (N->t&MSK_V)) printf(" Var. %s",varByAddrA((void*)N)); + if (IB==1) printf(" <- top"); + if (IB) printf("\n"); +} + +void printNumber(void * E) +{ + printElt((struct Num*)E, 0); +} + +void numVarOff(void * A) +{ +struct Num * N; + N = (struct Num*) A; + N->t = N->t & ~MSK_V; +} + +void IF_show_stack(void) +{ +void * Next; +struct Num * N; +long i=0,Nbl; +char s; + Nbl=NBLIG; + Next = StackN; + while (Next != VIDE) { + N = (struct Num*) Next; + i++; + if (i<=Nbl) printElt(N,i); + Next = N->n; + } + if (i<=Nbl) printf("\n"); + else { + if (i==Nbl+1) s = ' '; + else s = 's'; + printf(" ... and %ld other%c element%c !\n",i-Nbl,s,s); + } +} + +void IF_point(void) +{ +struct Num *Elt; + _VERIF_STACK_ + Elt = (struct Num *)StackN; + printElt(Elt,ELT_POINT); + /* printf("\n"); */ + dropElt(); +} + +void * duplicateNum(void * S, int vSoff) +{ +struct Num *Elt, *NElt; +void * M; +uint32_t n; +int s; + Elt = (struct Num*)S; + n = Elt->t&MSK_T; + s = sizeof(struct Num)+((n-1)*(sizeof(double))); + if ((M = malloc(s)) == NULL) stopErr("dupElt","malloc"); + bcopy((void*)Elt,M,s); + NElt = (struct Num *)M; + NElt->n = VIDE; + NElt->t = Elt->t; + if (vSoff) Elt->t = Elt->t & ~MSK_V; /* Source no more a Var */ + return(M); +} + +static void dupElt(struct Num * Elt) +{ +struct Num *NElt; +void * M; +uint32_t n; +int s; + n = Elt->t&MSK_T; + s = sizeof(struct Num)+((n-1)*(sizeof(double))); + if ((M = malloc(s)) == NULL) stopErr("dupElt","malloc"); + bcopy((void*)Elt,M,s); + NElt = (struct Num *)M; + NElt->n = StackN; + NElt->t = Elt->t & ~MSK_V; /* au cas ou Var */ + _MODIF_STACKN_(M); + ; +} + +void IF_dup(void) +{ + _VERIF_STACK_ + dupElt((struct Num *)StackN); +} + +void IF_swap(void) +{ +struct Num *Elt, *Elt2; + _VERIF_STACK_ + Elt = (struct Num *)StackN; + if (Elt->n != VIDE) { + _MODIF_STACKN_(Elt->n); + Elt2 = (struct Num *)StackN; + Elt->n = Elt2->n; + Elt2->n = (void*)Elt; + } + else messErr(4); +} + +void IF_over (void) +{ +struct Num *Elt; + _VERIF_STACK_ + Elt = (struct Num *)StackN; + if (Elt->n != VIDE) + dupElt((struct Num *)Elt->n); + else messErr(4); +} + +void IF_pick(void) +{ +void * Next; +struct Num * N; +long n, i; + _VERIF_STACK_ + if (!isScalar()) { + messErr(36); return; + } + n = (long)getVal(); + dropElt(); + if (n>0) { + Next = StackN; + i=1; + while (Next != VIDE) { + if (i==n) break; + N = (struct Num*) Next; + Next = N->n; + i++; + } + if (Next != VIDE) dupElt((struct Num *)Next); + else messErr(4); + } else messErr(29); +} + +static int rotateBid(long n, int d) /* d=0 : rot d=1 : unrot */ +{ +void **ANext; +struct Num * N, *N1; +long i; + ANext = _ADDR_STACKN_; + i=1; + while (*ANext != VIDE) { + if (i==n) break; + N = (struct Num*) *ANext; + ANext = &N->n; + i++; + } + if (*ANext != VIDE) { + N = (struct Num*) *ANext; + if (d) { /* unrot */ + N1 = (struct Num*) StackN; + _MODIF_STACKN_(N1->n); + N1->n = N->n; + N->n = (void*)N1; + } else { /* rot */ + *ANext = N->n; + N->n = StackN; + _MODIF_STACKN_((void*)N); + } + return 1; + } else return 0; +} + +void IF_rot(void) +{ + if (!rotateBid(3L,0)) messErr(4); +} + +void IF_unrot(void) +{ + if (!rotateBid(3L,1)) messErr(4); +} + +void IF_roll(void) +{ +long n; + _VERIF_STACK_ + if (!isScalar()) { + messErr(36); return; + } + n = (long)getVal(); + dropElt(); + if (n>1) { + if (!rotateBid(n,0)) messErr(4); + } else messErr(30); +} + +void IF_unroll(void) +{ +long n; + _VERIF_STACK_ + if (!isScalar()) { + messErr(36); return; + } + n = (long)getVal(); + dropElt(); + if (n>1) { + if (!rotateBid(n,1)) messErr(4); + } else messErr(30); +} + +void IF_depth(void) +{ +void * Next; +struct Num * N; +long long i=0; + Next = StackN; + while (Next != VIDE) { + N = (struct Num*) Next; + i++; + Next = N->n; + } + putLong(i); +} + +int nbOnStack(void* A) +{ +void * Next; +struct Num * N; +int i=0; + Next = StackN; + while (Next != VIDE) { + N = (struct Num*) Next; + if (Next == A) i++; + Next = N->n; + } + return i; +} + +static uint32_t nbSizeTypeOnStack(uint32_t n,uint32_t *T) +{ +void * Next; +struct Num * N; +uint32_t i=0, D=0, S=0; + Next = StackN; + while (Next != VIDE) { + N = (struct Num*) Next; + S += N->t&MSK_T; + if (N->t&MSK_R) D=1; + Next = N->n; + i++; + if (i==n) break; + } + if (D) S = S|MSK_R; + *T = S; + return i; +} + +void IF_Ndrop(void) +{ +long n, i; + _VERIF_STACK_ + if (!isScalar()) { + messErr(36); return; + } + n = (long)getVal(); + dropElt(); + for(i=0;i0) { + NewS=VIDE; + P=&NewS; + Next = StackN; + while (Next != VIDE) { + Elt = (struct Num*) Next; + t = Elt->t&MSK_T; + s = sizeof(struct Num)+((t-1)*(sizeof(double))); + if ((M = malloc(s)) == NULL) stopErr("IF_Ndup","malloc"); + bcopy(Next,M,s); + *P = M; + NElt = (struct Num *)M; + NElt->t = NElt->t & ~MSK_V; /* au cas ou Var */ + P=&NElt->n; + i++; + if (i==n) break; + Next = Elt->n; + } + NElt->n = StackN; + _MODIF_STACKN_(NewS); + if (it & MSK_R) return; + n = N->t&MSK_T; + d = &N->d; + l = &N->l; + for(i=0; it = N->t|MSK_R; +} + +/* NET Functions for STSP */ + +void IF_NetKey (void) +{ + _VERIF_STACK_ + if (!isScalar()) { + messErr(36); return; + } + _MODIF_NetKey_((uint32_t)getVal()); + dropElt(); +} + +void IF_NetErrVal (void) +{ + putLong(-(long long)NetKey); +} + +void StackToNet(long n) +{ +struct Num *Elt; +int i; +uint32_t t, l; + for (i=0; it&MSK_T; + l=(sizeof(struct Num)+((t-1)*(sizeof(double)))); + Elt->key = NetKey; + sendDataC(StackN, l); + dropElt(); + } +} + +int NetDepth(uint32_t k) +{ +void * Next; +struct Num * N; +int v=0; + Next = StackN; + while (Next != VIDE) { + N = (struct Num*) Next; + if (N->key == k) v++; + Next = N->n; + } + return v; +} + +void NetToStack(int s, uint32_t k) +{ +void * Next; +struct Num * N; +uint32_t t, l; + Next = StackN; + while (Next != VIDE) { + N = (struct Num*) Next; + if (N->key == k) { + t = N->t&MSK_T; + l=(sizeof(struct Num)+((t-1)*(sizeof(double)))); + sendData(s, Next, l); + } + Next = N->n; + } +} + +void IF_show_netStack(uint32_t k) +{ +void * Next; +struct Num * N; + Next = StackN; + printf("\n"); + while (Next != VIDE) { + N = (struct Num*) Next; + if (k == UNI_KEY) { + printf("<0x%.8lx> ",(long)N->key); + printElt(N,(long)-1); + } else { + if (N->key == k) printElt(N,(long)-1); + } + Next = N->n; + } + printf(" key=0x%lx\n",(long)k); +} + +void IF_netDrop(uint32_t k) +{ +void * Next, **ANext; +struct Num * N; + Next = StackN; + ANext = _ADDR_STACKN_; + while (Next != VIDE) { + N = (struct Num*) Next; + if (k == N->key) { + *ANext = N->n; + free(Next); + Next = *ANext; + continue; + } + Next = N->n; + ANext = &(N->n); + } +} + +/* end of Net functions */ + +static void IF_fct_2(char O) +{ +struct Num *Elt, *Elt2; +long long ConstL, *l1, *l2; +double ConstD, *d1, *d2; +int D1=0, D2=0, T1, T2, i; +int M_C, M_D, M_S; /* Mode Const : 1 ou 0 | Double : 1 ou 0 | Swap : 1 ou 0 */ +bool B=TRUE; + + _VERIF_STACK_ + Elt = (struct Num *)StackN; + T1 = Elt->t&MSK_T; + D1 = Elt->t&MSK_R; + if (Elt->n == VIDE) { + messErr(4); + return; + } + Elt2 = (struct Num *)Elt->n; + T2 = Elt2->t&MSK_T; + D2 = Elt2->t&MSK_R; + /* si 2 tab de dim diff pas possible !! */ + if ((T1>1) && (T2>1) && (T1!=T2)) { + messErr(3); + return; + } + M_S = M_C = M_D = 0; + if ((T1>1) && (T2==1)) { /* on swap */ + IF_swap(); + D1=D2=0; + Elt = (struct Num *)StackN; + T1 = Elt->t&MSK_T; + D1 = Elt->t&MSK_R; + Elt2 = (struct Num *)Elt->n; + T2 = Elt2->t&MSK_T; + D2 = Elt2->t&MSK_R; + M_S=1; + } + if (D1!=D2) { /* on transforme long en double */ + if (D2) toDouble(Elt); else toDouble(Elt2); + M_D = 1; + } else if(D1) M_D = 1; + l1 = &Elt->l; + l2 = &Elt2->l; + d1 = &Elt->d; + d2 = &Elt2->d; + if (T1==1) { + M_C=1; + if (M_D) ConstD = *d1; + else ConstL = *l1; + } +/* pour debug + printf("T1=%d T2=%d M_C=%d M_D=%d M_S=%d ",T1,T2,M_C,M_D,M_S); + if (M_C) + if (M_D) printf("ConstD=%g",ConstD); else printf("ConstL=%lld",ConstL); + printf("\n"); +*****/ + switch(O) { + case '+' : + if (M_C) { + if (M_D) for (i=0;iConstD) *d2=ConstD; d2++; } + else for(i=0;iConstL) *l2=ConstL; l2++; } + } else { + if (M_D) for (i=0;i*d1) *d2=*d1; d2++; d1++; } + else for (i=0;i*l1) *l2=*l1; l2++; l1++; } + } + break; + case 'M' : /* max */ + if (M_C) { + if (M_D) for(i=0;i= ConstD) {B=FALSE; break;} d2++; } + else for (i=0;i= ConstL) {B=FALSE; break;} l2++; } + } + } else { + if (M_D) for (i=0;i= *d1) {B=FALSE; break;} d1++; d2++; } + else for (i=0;i= *l1) {B=FALSE; break;} l1++; l2++; } + } + putBool(B); + dropElt(); /* suppression des 2 !! */ + break; + case '>' : /* test sup */ + if (M_C) { + if (M_S) { + if (M_D) for(i=0;i ConstD) {B=FALSE; break;} d2++; } + else for (i=0;i ConstL) {B=FALSE; break;} l2++; } + } else { + if (M_D) for(i=0;i ConstD) {B=FALSE; break;} d2++; } + else for (i=0;i ConstL) {B=FALSE; break;} l2++; } + } + } else { + if (M_D) for (i=0;i *d1) {B=FALSE; break;} d1++; d2++; } + else for (i=0;i *l1) {B=FALSE; break;} l1++; l2++; } + } + putBool(B); + dropElt(); /* suppression des 2 !! */ + break; + case 's' : /* test sup ou egal */ + if (M_C) { + if (M_S) { + if (M_D) for(i=0;i= ConstD) {B=FALSE; break;} d2++; } + else for (i=0;i= ConstL) {B=FALSE; break;} l2++; } + } else { + if (M_D) for(i=0;i'); } +void IF_Linf(void) { IF_fct_2('<'); } +void IF_Lsupeg(void) { IF_fct_2('s'); } +void IF_Linfeg(void) { IF_fct_2('i'); } + +void IF_fctD_1(double(*f)(double)) +{ +struct Num *Elt; +uint32_t n; +long long *L; +double *D; +int i; + _VERIF_STACK_ + Elt = (struct Num *)StackN; + n = Elt->t&MSK_T; + if (Elt->t&MSK_R) { /* double */ + D = &(Elt->d); + for(i=0;id); + L = &(Elt->l); + for(i=0;it = Elt->t | MSK_R; + } +} + +void IF_fctB_1(long long (*f1)(long long), double(*f2)(double)) +{ +struct Num *Elt; +uint32_t n; +long long *L; +double *D; +int i; + _VERIF_STACK_ + Elt = (struct Num *)StackN; + n = Elt->t&MSK_T; + if (Elt->t&MSK_R) { /* double */ + D = &(Elt->d); + for(i=0;il); + for(i=0;it&MSK_T; + if (Elt->t&MSK_R) { /* double */ + D = &(Elt->d); + L = &(Elt->l); + for(i=0;it = Elt->t & ~MSK_R; /* change type */ + } + /* rien si long */ +} + +void IF_fctD_1LB(long long(*f)(double)) +{ +struct Num *Elt; +uint32_t n; +long long *L; +double *D; +int i; + _VERIF_STACK_ + Elt = (struct Num *)StackN; + n = Elt->t&MSK_T; + D = &(Elt->d); + L = &(Elt->l); + if (Elt->t&MSK_R) { /* double */ + for(i=0;it = Elt->t & ~MSK_R; /* change type */ + } else { + for(i=0;it&MSK_T; + if (Elt->t&MSK_R) { /* double */ + D = &(Elt->d); + for(i=0;il); + for(i=0;it&MSK_T; + if (Elt->t&MSK_R) { /* double */ + D = &(Elt->d); + for(i=0;il); + for(i=0;it&MSK_T; + Elt2 = Elt->n; + n2 = Elt2->t&MSK_T; + if (n>n2) n=n2; + if (Elt->t&MSK_R) { /* double */ + D = &(Elt->d); + if (Elt2->t&MSK_R) { /* double */ + D2 = &(Elt2->d); + for(i=0;il); + for(i=0;il); + if (Elt2->t&MSK_R) { /* double */ + D2 = &(Elt2->d); + for(i=0;il); + for(i=0;it&MSK_T; + return (int)l; +} + +static long transLongTo(long long * C) +{ +struct Num *Elt; +int i; +uint32_t l; +long long *L; +double *D; + Elt = (struct Num *)StackN; + l = Elt->t&MSK_T; + L = &(Elt->l)+l-1; + D = &(Elt->d)+l-1; + if (Elt->t & MSK_R) + for (i=0;it&MSK_T; + L = &(Elt->l)+l-1; + D = &(Elt->d)+l-1; + if (Elt->t & MSK_R) + for (i=0;i1) { + i = nbSizeTypeOnStack(n,&t); + if (it = t; + if (t & MSK_R) { + D = &(N->d)+(T-1); + for(i=0;il)+(T-1); + for(i=0;in = StackN; + _MODIF_STACKN_(M); + } + } else messErr(30); +} + +static void toScalar( int s ) +{ +struct Num *Elt; +uint32_t l; +int i; +double *D; +long long * L; + _VERIF_STACK_ + Elt = (struct Num *)StackN; + l = Elt->t&MSK_T; + if (l==1) return; + _MODIF_STACKN_(Elt->n); /* depile */ + if (s) { + L = &(Elt->l); + D = &(Elt->d); + if (Elt->t & MSK_R) + for(i=0;il)+l-1; + D = &(Elt->d)+l-1; + if (Elt->t & MSK_R) + for(i=0;it&MSK_V)) free((void*)Elt); +} + +void IF_toScalar( void ) +{ + toScalar(1); +} + +void IF_toScalarR( void ) +{ + toScalar(0); +} + +static void tabShift(void **A,long s) +{ +struct Num *Elt, *NElt; +void * M; +long j, k; +uint32_t l; +long long *L, *NL; + _VERIF_STACK_ + Elt = (struct Num *)*A; + l = Elt->t&MSK_T; + if (l==1) return; + if (s>0) + while (s>=l) s-=l; + else while (-s>=l) s+=l; + if (s==0) return; + if (s>0) j=s; + else j=l+s; + k = sizeof(struct Num)+((l-1)*(sizeof(double))); + if ((M = malloc(k)) == NULL) stopErr("tabShift","malloc"); + NElt = (struct Num *)M; + *A = M; + NElt->t = Elt->t; + NElt->n = Elt->n; + L = &(Elt->l); + NL = &(NElt->l); + k=l-j; + bcopy((void*)&L[0],(void*)&NL[j],k*sizeof(long long)); + bcopy((void*)&L[k],(void*)&NL[0],j*sizeof(long long)); + if (!(Elt->t&MSK_V)) free((void*)Elt); +} + +void IF_TShiftR( void ) +{ + tabShift(_ADDR_STACKN_,1); +} + +void IF_TShiftL( void ) +{ + tabShift(_ADDR_STACKN_,-1); +} + +static void nTabShift( int v ) +{ +void ** ANext; +struct Num * N; +long i=0, n; + _VERIF_STACK_ + if (!isScalar()) { + messErr(36); return; + } + n = (long)getVal(); + dropElt(); + if (n>0) { + ANext = _ADDR_STACKN_; + while (*ANext != VIDE) { + tabShift(ANext,v); + N = (struct Num*) *ANext; + ANext = &(N->n); + i++; + if (i==n) break; + } + } else messErr(29); +} + +void IF_NTShiftR( void ) +{ + nTabShift(1); +} + +void IF_NTShiftL( void ) +{ + nTabShift(-1); +} + +void IF_TNShiftR( void ) +{ +long n; + _VERIF_STACK_ + if (!isScalar()) { + messErr(36); return; + } + n = (long)getVal(); + dropElt(); + tabShift(_ADDR_STACKN_,n); +} + +void IF_TNShiftL( void ) +{ +long n; + _VERIF_STACK_ + if (!isScalar()) { + messErr(36); return; + } + n = (long)getVal(); + dropElt(); + tabShift(_ADDR_STACKN_,-n); +} + +static void nTNShift( int s ) +{ +long n; + _VERIF_STACK_ + if (!isScalar()) { + messErr(36); return; + } + n = (long)getVal(); + dropElt(); + nTabShift(n*s); +} + +void IF_NTNShiftR( void ) +{ + nTNShift(1); +} + +void IF_NTNShiftL( void ) +{ + nTNShift(-1); +} + +static void subTab(void **pA , long n, char r) /* r=1 : right else left */ +{ +struct Num *Elt, *Elt2; +uint32_t l; +long k; +long long *L, *Lf; +void *A, * M; +double *D, *Df; + + _VERIF_STACK_ + A = *pA; + Elt = (struct Num *)A; + l = Elt->t&MSK_T; + if (l==n) return; + k = sizeof(struct Num)+((n-1)*(sizeof(long long))); + if ((M = malloc(k)) == NULL) stopErr("subTab","malloc"); + Elt2 = (struct Num *)M; + Elt2->n = Elt->n; + Elt2->t = (Elt->t&MSK_R) | n; + *pA = M; + if (nl); + if (r) L += (l-n); + bcopy((void*)L,(void*)&(Elt2->l),n*sizeof(long long)); + } else { /* fill with zero */ + L = &(Elt2->l); + if (!r) L += (n-l); + bcopy((void*)&(Elt->l),(void*)L,l*sizeof(long long)); + if (Elt->t&MSK_R) { + D = &(Elt2->d); + if (r) D += l; + Df = D + (n-l); + while (D < Df) *D++ = (double)0; + } else { + L = &(Elt2->l); + if (r) L += l; + Lf = L + (n-l); + while (L < Lf) *L++ = 0L; + } + } + if (!(Elt->t&MSK_V)) free(A); +} + +void IF_subTab(void) +{ +long n; + _VERIF_STACK_ + if (!isScalar()) { + messErr(36); return; + } + n = (long)getVal(); + dropElt(); + if (n>0) subTab(_ADDR_STACKN_, n, 0); + else messErr(29); +} + +void IF_subTabR(void) +{ +long n; + _VERIF_STACK_ + if (!isScalar()) { + messErr(36); return; + } + n = (long)getVal(); + dropElt(); + if (n>0) subTab(_ADDR_STACKN_, n, (char)1); + else messErr(29); +} + +static void NSubTab( char r ) +{ +void **pNext; +struct Num * N; +long i=0, n, l; + _VERIF_STACK_ + if (!isScalar()) { + messErr(36); return; + } + l = (long)getVal(); + dropElt(); + if (l>0) { + if (!isScalar()) { + messErr(36); return; + } + n = (long)getVal(); + dropElt(); + if (n>0) { + pNext = _ADDR_STACKN_; + while (*pNext != VIDE) { + subTab(pNext,l,r); + N = (struct Num*) *pNext; + pNext = &(N->n); + i++; + if (i==n) break; + } + } else messErr(29); + } else messErr(29); +} + +void IF_NsubTab(void) +{ + NSubTab((char)0); +} + +void IF_NsubTabR(void) +{ + NSubTab((char)1); +} + +static void tabRev( void* A ) +{ +struct Num *Elt; +uint32_t l; +double *D, *FD, vD; +long long * L, *FL, vL; + _VERIF_STACK_ + Elt = (struct Num *)A; + l = Elt->t&MSK_T; + if (l==1) return; + if (Elt->t & MSK_R) { + D = &(Elt->d); + FD = D+l-1; + while (Dl); + FL=L+l-1; + while (L0) { + Next = StackN; + while (Next != VIDE) { + N = (struct Num*) Next; + tabRev(Next); + Next = N->n; + i++; + if (i==n) break; + } + } else messErr(29); +} + +static void tabTransp (int sens) +{ +void * Next, *Next2, **Suiv, *SNext, **Last; +struct Num * N, *N2; +long i=0, j, n; +uint32_t l; +short Doub=0; +double *D, *D2; +long long *L, *L2; + _VERIF_STACK_ + if (!isScalar()) { + messErr(36); return; + } + n = (long)getVal(); + dropElt(); + if (n>0) { + if (n==1) { + if (sens) toScalar(1); + else toScalar(0); + return; + } + /* the n elts on stack must have the same dim */ + Next = StackN; + while (Next != VIDE) { + N = (struct Num*) Next; + if (i) { + if (l != (N->t&MSK_T)) break; + } else l = N->t&MSK_T; + if (N->t&MSK_R) Doub=1; + i++; + if (i==n) break; + Next = N->n; + } + if (i!=n) { + if (Next == VIDE) messErr(4); + else messErr(3); + } else { + /* make l elts of dim n */ + Suiv = &Next2; + for (i=0;it = n; + if (Doub) N2->t |= MSK_R; + /* remplissage */ + if (sens) { + j=0; + if (sens==1) { + N2->n = SNext; + SNext = Next2; + if (i==0) Last = &(N2->n); + } else + Suiv = &N2->n; + } else { + j=n-1; + Suiv = &N2->n; + } + if (Doub) { + D2 = &(N2->d); + } else { + L2 = &(N2->l); + } + Next = StackN; + while (Next != VIDE) { + N = (struct Num*) Next; + if (Doub) { + if (N->t&MSK_R) { + D = &(N->d); + if (sens) D+=(l-i-1); + else D+=i; + *(D2+j) = *D; + } else { + L = &(N->l); + if (sens) L+=(l-i-1); + else L+=i; + *(D2+j) = (double)*L; + } + } else { + L = &(N->l); + if (sens) L+=(l-i-1); + else L+=i; + *(L2+j) = *L; + /* printf("%ld ",*L); */ + } + if (sens) { + j++; + if (j>=n) break; + } else { + j--; + if (j<0) break; + } + Next = N->n; + } + /* printf("\n"); */ + } + if (sens!=1) Last = &(N2->n); + /* drop n elts */ + for (i=0;in) < 2L) return 0; + return 1; +} + +int isNTabSameDim(int n) +{ +void * Next; +struct Num * N; +long i=0; +uint32_t l; + /* the n elts on stack must have the same dim */ + Next = StackN; + while (Next != VIDE) { + N = (struct Num*) Next; + if (i) { + if (l != (long)(N->t&MSK_T)) break; + } else l = N->t&MSK_T; + i++; + if (i==n) return 1; /* OK */ + Next = N->n; + } + return 0; +} + +/* []functions ****/ + +static void TAB_Fct(char C) +{ +struct Num *Elt; +uint32_t n; +long long *L, L1, L2; +double *D, D1, D2; +int i; + _VERIF_STACK_ + Elt = (struct Num *)StackN; + n = Elt->t&MSK_T; + if (n>1) { + if (Elt->t&MSK_R) { /* double */ + switch(C) { + case 'm' : + D1 = Elt->d; + D = &(Elt->d)+1; + for(i=1;id; + D = &(Elt->d)+1; + for(i=1;iD1) D1=*D; D++; } + putDouble(D1); + break; + case '+' : + D1 = Elt->d; + D = &(Elt->d)+1; + for(i=1;id; + D = &(Elt->d)+1; + for(i=1;id; + D = &(Elt->d)+1; + for(i=1;iD2) D2=*D; + if (*Dl; + L = &(Elt->l)+1; + for(i=1;il; + L = &(Elt->l)+1; + for(i=1;iL1) L1=*L; L++; } + putLong(L1); + break; + case '+' : + L1 = Elt->l; + L = &(Elt->l)+1; + for(i=1;il; + L = &(Elt->l)+1; + for(i=1;il; + L = &(Elt->l)+1; + for(i=1;iL2) L2=*L; + if (*L +*******************************************************************/ +/* stackN.h */ + +#ifndef __NIFE_STACKN_H__ +#define __NIFE_STACKN_H__ + +#include + +#define _VERIF_STACK_ if (StackN == VIDE) { messErr(2); return; } + +extern int lAdrNum(void); +extern int putVal(char *V); +extern void putLong(long long V); +extern void putDouble(double d); +extern int getParLong(long *V); +extern void insertVal(void *A); +extern void putVar(void *A); +extern void * getVar(void); +extern void IF_vers(void); +extern void IF_drop(void); +extern void IF_stack_clear(void); +extern void printNumber(void * N); +extern void numVarOff(void * N); +extern void * duplicateNum(void * S, int vSoff); +extern void IF_show_stack(void); +extern void IF_ramp(void); +extern void IF_dramp(void); +extern void IF_REAL(void); +extern void IF_INTEGER(void); +extern void IF_ECHOFF(void); +extern void IF_ECHOON(void); +extern void IF_NBTAB(void); +extern void IF_NBLIG(void); +extern void IF_VAROFF(void); +extern void IF_VARUP(void); +extern void IF_VARDOWN(void); +extern void IF_vars(void); +extern void IF_point(void); +extern void IF_swap(void); +extern void IF_dup(void); +extern void IF_over(void); +extern void IF_pick(void); +extern void IF_rot(void); +extern void IF_unrot(void); +extern void IF_roll(void); +extern void IF_unroll(void); +extern void IF_Ndrop(void); +extern void IF_Ndup(void); +extern void IF_depth(void); +extern int nbOnStack(void *A); +extern void IF_toArray(void); +extern void IF_toScalar(void); +extern void IF_toScalarR(void); +extern void IF_fctD_1(double(*f)(double)); +extern void IF_fctD_1L(long long(*f)(double)); +extern void IF_fctD_1LB(long long(*f)(double)); +extern void IF_fctB_1(long long (*f1)(long long), double(*f2)(double)); +extern void IF_plus(void); +extern void IF_moins(void); +extern void IF_mult(void); +extern void IF_div(void); +extern void IF_neg(void); +extern void IF_min(void); +extern void IF_max(void); +extern void IF_modulo(void); +extern void IF_puiss(void); +extern void IF_Legal(void); +extern void IF_Ldiff(void); +extern void IF_Lsup(void); +extern void IF_Linf(void); +extern void IF_Lsupeg(void); +extern void IF_Linfeg(void); +extern void IF_inFile_1(FILE * fd); +extern void IF_inFile_1d(FILE * fd, char delim, int virg); +extern void IF_inFile_2(FILE * fd); +void IF_TShiftR(void); +void IF_TShiftL(void); +void IF_NTShiftR(void); +void IF_NTShiftL(void); +void IF_TNShiftR(void); +void IF_TNShiftL(void); +void IF_NTNShiftR(void); +void IF_NTNShiftL(void); +void IF_subTab(void); +void IF_subTabR(void); +void IF_NsubTab(void); +void IF_NsubTabR(void); +void IF_TabRev(void); +void IF_NTabRev(void); +void IF_TabTransp(void); +void IF_TabTranspN(void); +void IF_TabTranspT(void); +extern int is1Tab(void); +extern int is2Tab(void); +extern int isNTabSameDim(int n); +extern void IF_TABMin(void); +extern void IF_TABMax(void); +extern void IF_TABProd(void); +extern void IF_TABSum(void); +extern void IF_TABMinMax(void); + +/* net functions */ +extern void IF_NetKey(void); +extern void IF_NetErrVal(void); +extern void StackToNet(long n); +extern void NetToStack(int s, uint32_t k); +extern int NetDepth(uint32_t k); +extern void IF_show_netStack(uint32_t k); +extern void IF_netDrop(uint32_t k); + +#endif diff --git a/src/stackV.c b/src/stackV.c new file mode 100644 index 0000000..7a2fd2f --- /dev/null +++ b/src/stackV.c @@ -0,0 +1,390 @@ +/* Copyright (C) 2011-2013 Patrick H. E. Foubet - S.E.R.I.A.N.E. + +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 3 of the License, or 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, see +*******************************************************************/ +#include "conf.h" +/* stackV.c */ +#include +#include +#include +#include + +#include "nife.h" +#include "mth.h" +#include "err.h" +#include "lib.h" +#include "stackV.h" +#include "stackF.h" +#include "stackN.h" +#include "stackC.h" +#include "stackL.h" + +/* types of var */ +#define VT_I 0 /* Initial = INTERGER NULL */ +#define VT_B 1 /* BOOLEAN */ +#define VT_C 2 /* CHARACTER STRING */ +#define VT_N 3 /* NUMBER */ +#define VT_L 4 /* LIB FUNCTION */ +#define VT_F 5 /* USER FUNCTION */ + +#define VT_V 9 /* VARIABLE (for "install_v ... in" only) */ + +#define VT_NO -1 /* cf ci-dessous */ + +static void * stackV = VIDE; +/* modeExeVar guide le traitement des variables + * si affectation : un des VT_x sinon -1 + * *************************************/ + +static int modeExeVar=VT_NO; + +struct Var { + char *l; /* libelle */ + void *n; /* next */ + union { + bool b; + void *a; /* adresse num/char/code */ + }; + short t; /* type */ +}; + +static void cpVar(void * S, void *D) +{ +struct Var *vS, *vD; + if (S==D) return; + vS = (struct Var *)S; + vD = (struct Var *)D; + vD->t = vS->t; + vD->a = vS->a; + /* duplication if number !! */ + if (vD->t == VT_N) + vD->a = duplicateNum(vS->a, 0); +} + +void initVar(char *Lib) +{ +void * M, *L; +struct Var * N; + if ((M = malloc(sizeof(struct Var))) == NULL) stopErr("initVar","malloc"); + if ((L = malloc(strlen(Lib)+1)) == NULL) stopErr("initVar","malloc"); + strcpy((char*)L,Lib); + N = (struct Var*)M; + N->l = (char*)L; + N->n = stackV; + N->t = VT_I; + stackV = M; +} + +static void setCodeVar(struct Var * Elt, short t, void* A) +{ + switch (Elt->t) { /* TODO VT_F */ + case VT_C : + free(Elt->a); + break; + case VT_N : + if (nbOnStack(Elt->a) == 0) free(Elt->a); + else numVarOff(Elt->a); + break; + default : /* VT_I, VT_B, VT_L, VT_F */ + break; + } + Elt->t = t; + Elt->a = A; +} + +static void rmVar(void **Ref, struct Var * Elt) +{ + if (Elt->t==VT_N) setCodeVar(Elt, VT_I, VIDE); + *Ref = Elt->n; + free((void*)Elt->l); + free((void*)Elt); +} + +void rmLastVar(void) +{ + if (stackV != VIDE) rmVar(&stackV, (struct Var *)stackV); + else messErr(23); +} + +void IF_show_stackV(void) +{ +void * Next; +struct Var * N; + Next = stackV; + while (Next != VIDE) { + N = (struct Var*) Next; + printf(" %-25s : Type ",N->l); + switch(N->t) { + case VT_I : + printf("initial (NULL)"); + break; + case VT_B : + printf("Boolean "); + if (N->b) printf("TRUE"); else printf("FALSE"); + break; + case VT_C : + printf("String \"%s\"", (char*)N->a); + break; + case VT_N : + printf("Number "); + printNumber(N->a); + break; + case VT_L : + printf("Lib. Fct. %s", libByAddr(N->a)); + break; + case VT_F : + printf("User Fct. %s", fctByAddr(N->a)); + break; + } + printf("\n"); + Next = N->n; + } + printf("\n"); +} + +static void newVar(char * S) +{ +char Lib[LDFLT+1]; + strncpy(Lib,S,LDFLT); + Lib[LDFLT]='\0'; + initVar(Lib); + dropTrSuite(); +} + +void IF_debVar(void) +{ + putTrSuite(newVar); +} +void IF_debVarCS(void) +{ +char *v; + v = getString(); + if (v != NULL) { + initVar(v); + free((void*)v); + } +} + +void * varByName(char * L) +{ +void * Next; +struct Var * N; + Next = stackV; + while (Next != VIDE) { + N = (struct Var*) Next; + if (strcmp(N->l,L)==0) return(Next); + Next = N->n; + } + return VIDE; +} + +char * varByAddr(void * A) /* non optimise mais C'EST FAIT EXPRES !! */ +{ +void * Next; +struct Var * N; + Next = stackV; + while (Next != VIDE) { + N = (struct Var*) Next; + if (Next==A) return(N->l); + Next = N->n; + } + return NULL; +} + +char * varByAddrA(void * A) +{ +void * Next; +struct Var * N; + Next = stackV; + while (Next != VIDE) { + N = (struct Var*) Next; + if (N->a==A) return(N->l); + Next = N->n; + } + return NULL; +} + +int isVarChar(void * A) +{ +struct Var * N; + N = (struct Var*) A; + if (N->t == VT_C) return 1; + return 0; +} + +static void exec_Var(void * A) +{ +void * C; +struct Var * N; +void (*f) (void); + N = (struct Var*) A; + /* printf("executeVar %s %d !!\n",N->l, N->t);*/ + switch(N->t) { + case VT_B : + putBool(N->b); + break; + case VT_C : + putString((char*)N->a); + break; + case VT_N : + if (nbOnStack(N->a) > 0) { + C = duplicateNum(N->a,1); + N->a = C; + } + putVar(N->a); + break; + case VT_L : + f = (PFV)(N->a); + f(); + break; + case VT_F : + execFctV(N->a); + break; + default : /* VT_I */ + break; + } +} + +static void delVar(char * L) +{ +void ** PNext; +struct Var * N; + dropTrSuite(); + PNext = &stackV; + while (*PNext != VIDE) { + N = (struct Var*) *PNext; + if (strcmp(N->l,L)==0) { + rmVar(PNext, N); + return; + } + PNext = &N->n; + } + messErr(24); +} + +void IF_delVar(void) +{ + putTrSuite(delVar); +} + +void putInVar(void * A, short t) +{ +struct Var * N; + N = (struct Var*) A; + switch(t) { + case VT_B : + setCodeVar(N, t, VIDE); + N->b = getBool(); + break; + case VT_C : + setCodeVar(N, t, getString()); + break; + case VT_N : + setCodeVar(N, t, getVar()); + break; + case VT_L : + case VT_F : + setCodeVar(N, t, FCT_INST); + break; + default : + setCodeVar(N, VT_I, VIDE); + break; + } +} + +/* PLUS UTILISEE *********************** +static void updateVar(char * L, short t) +{ +void * Next; +struct Var * N; + Next = stackV; + while (Next != VIDE) { + N = (struct Var*) Next; + if (strcmp(N->l,L)==0) { + putInVar(Next, t); + return; + } + Next = N->n; + } + messErr(24); +} +*****************/ + +void IF_setVarN(void) +{ + modeExeVar=VT_N; +} + +void IF_setVarC(void) +{ + modeExeVar=VT_C; +} + +void IF_setVarB(void) +{ + modeExeVar=VT_B; +} + +void IF_setVarI(void) +{ + modeExeVar=VT_I; +} + +void IF_setVarLF(void) +{ + switch (FCT_TYP) { + case 0 : + modeExeVar=VT_I; + break; + case 1 : + modeExeVar=VT_L; + break; + case 2 : + modeExeVar=VT_F; + break; + case 3 : + modeExeVar=VT_V; + break; + } +} + +void executeVar(void * A) +{ + if (fctEnCours) makeFct(T_VAR, A); + else { + if (modeExeVar == VT_NO) exec_Var(A); + else { + if (modeExeVar == VT_V) cpVar(FCT_INST,A); + else putInVar(A, modeExeVar); + modeExeVar=VT_NO; + } + } +} + +int IF_execVar(char * L) +{ +void * Next; +struct Var * N; + Next = stackV; + while (Next != VIDE) { + N = (struct Var*) Next; + if (strcmp(N->l,L)==0) { + executeVar(Next); + return 1; + } + Next = N->n; + } + return 0; +} + diff --git a/src/stackV.h b/src/stackV.h new file mode 100644 index 0000000..2d42065 --- /dev/null +++ b/src/stackV.h @@ -0,0 +1,39 @@ +/* Copyright (C) 2011-2013 Patrick H. E. Foubet - S.E.R.I.A.N.E. + +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 3 of the License, or 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, see +*******************************************************************/ +/* stackV.h */ + +#ifndef __NIFE_STACKV_H__ +#define __NIFE_STACKV_H__ + +extern void IF_debVar(void); +extern void IF_debVarCS(void); +extern void IF_show_stackV(void); +extern void IF_delVar(void); +extern void rmLastVar(void); +extern int IF_execVar(char *L); +extern int isVarChar(void *A); +extern void * varByName(char *L); +extern char * varByAddr(void *A); +extern char * varByAddrA(void *A); +extern void putInVar(void *A, short t); +extern void IF_setVarI(void); +extern void IF_setVarB(void); +extern void IF_setVarC(void); +extern void IF_setVarN(void); +extern void IF_setVarLF(void); +extern void executeVar(void *); + +#endif diff --git a/src/tasks.c b/src/tasks.c new file mode 100644 index 0000000..1c8e3fa --- /dev/null +++ b/src/tasks.c @@ -0,0 +1,167 @@ +/* Copyright (C) 2011-2013 Patrick H. E. Foubet - S.E.R.I.A.N.E. + +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 3 of the License, or 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, see +*******************************************************************/ +#include "conf.h" +/* task.c gestion des taches */ + +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include + +#include "nife.h" +#include "mth.h" +#include "err.h" +#include "tasks.h" +#include "foncs.h" +#include "histo.h" +#include "stackN.h" +#include "stackF.h" +#include "stackL.h" + +int ITASK=0; /* no de tache */ +#define MAX_TASK 10 +static pid_t TASKp[MAX_TASK]; /* pid */ +static void * TASKf[MAX_TASK]; /* func */ + +void IF_NewTask (void) +{ +int i; + for (i=0;i\n"); +} + +void IF_statusTask(void) +{ +long V; +int i; + if (getParLong(&V)) { + i = V -1; + if (TASKp[i] != 0) { + if (kill(TASKp[i],SIGUSR1)==0) { + putBool(TRUE); + return; + } + } + } + putBool(FALSE); +} + +void IF_stopTask(void) +{ +long V; +int i; + if (getParLong(&V)) { + i = V -1; + if (TASKp[i] != 0) { + _MODIF_WAITPID_(1); + if (kill(TASKp[i],SIGKILL) == 0) + waitpid(TASKp[i],NULL,0); + _MODIF_WAITPID_(0); + } + } +} + +void IF_delTask(void) +{ +long V; +int i; + if (getParLong(&V)) { + i = V -1; + if (TASKp[i] != 0) { + if (kill(TASKp[i],SIGUSR1)==0) { + messErr(27); + return; + } + } + } + TASKp[i] = 0; +} + +void IF_showCons( void) +{ +long V; +int i; +char * NF, comm[30]; + if (getParLong(&V)) { + i = V -1; + if (TASKp[i] != 0) { + NF = FicCons((int)V); + sprintf(comm,"more %s",NF); + runCommand(comm); + } + else messErr(28); + } +} + + diff --git a/src/tasks.h b/src/tasks.h new file mode 100644 index 0000000..29a9513 --- /dev/null +++ b/src/tasks.h @@ -0,0 +1,32 @@ +/* Copyright (C) 2011-2013 Patrick H. E. Foubet - S.E.R.I.A.N.E. + +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 3 of the License, or 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, see +*******************************************************************/ +/* tasks.h */ + +#ifndef __NIFE_TASKS_H__ +#define __NIFE_TASKS_H__ + +extern int ITASK; + +extern void IF_NewTask(void); +extern void IF_show_Tasks(void); +extern void IF_statusTask(void); +extern void IF_stopTask(void); +extern void IF_delTask(void); +extern void IF_showCons(void); + +extern int MakeTask(void * A); + +#endif diff --git a/src/test.sh b/src/test.sh new file mode 100755 index 0000000..458be37 --- /dev/null +++ b/src/test.sh @@ -0,0 +1,12 @@ +#! /bin/sh +if test -x nife +then +./nife benchm.nif +uname -a +echo "If your system is not present in the NEWS file, and if you have some time" +echo "Take a screen-shot and send your test at nife@seriane.fr" +echo "Thank you helping us in this challenge !" +else +echo "You are not in the src directory or you have not run 'make'" +fi +echo "The Nife Team."