@@ -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 <patrick.foubet@nife-project.org> | |||||
* Original program author, stable series maintainer. | |||||
* Cohesion of language supervisor. Multiple platform maintainer. | |||||
* Stack to Stack protocol developper, and much more. | |||||
Christophe Ondrejec <christophe.ondrejec@nife-project.org> | |||||
* Administrator of the site nife-project.org. | |||||
* Internationalization support head. | |||||
* Package tester. | |||||
Claude Mauvais <claude.mauvais@.nife-project.org> | |||||
* Mathematical functions supervisor and developper. | |||||
* Package tester. | |||||
Bruno Guilbert <bruno.guilbert@nife-project.org> | |||||
* Devices interface tester and developper. | |||||
* Package tester. | |||||
@@ -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. | |||||
<one line to give the program's name and a brief idea of what it does.> | |||||
Copyright (C) <year> <name of author> | |||||
This program is free software; you can redistribute it and/or modify | |||||
it under the terms of the GNU General Public License as published by | |||||
the Free Software Foundation; either version 2 of the License, or | |||||
(at your option) any later version. | |||||
This program is distributed in the hope that it will be useful, | |||||
but WITHOUT ANY WARRANTY; without even the implied warranty of | |||||
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the | |||||
GNU General Public License for more details. | |||||
You should have received a copy of the GNU General Public License | |||||
along with this program; if not, write to the Free Software | |||||
Foundation, Inc., 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. | |||||
<signature of Ty Coon>, 1 April 1989 | |||||
Ty Coon, President of Vice | |||||
This General Public License does not permit incorporating your program into | |||||
proprietary programs. If your program is a subroutine library, you may | |||||
consider it more useful to permit linking proprietary applications with the | |||||
library. If this is what you want to do, use the GNU Library General | |||||
Public License instead of this License. |
@@ -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 | |||||
@@ -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. | |||||
@@ -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 | |||||
@@ -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: |
@@ -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. | |||||
@@ -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) | |||||
@@ -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) | |||||
@@ -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 <conftest.tar]) | |||||
grep GrepMe conftest.dir/file >/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 | |||||
@@ -0,0 +1,143 @@ | |||||
/* config.h.in. Generated from configure.ac by autoheader. */ | |||||
/* Define to 1 if you have the <arpa/inet.h> 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 <comedilib.h> 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 <fcntl.h> 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 <inttypes.h> 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 <memory.h> header file. */ | |||||
#undef HAVE_MEMORY_H | |||||
/* Define to 1 if you have the <netdb.h> 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 <pthread.h> 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 <stdint.h> header file. */ | |||||
#undef HAVE_STDINT_H | |||||
/* Define to 1 if you have the <stdlib.h> 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 <strings.h> header file. */ | |||||
#undef HAVE_STRINGS_H | |||||
/* Define to 1 if you have the <string.h> header file. */ | |||||
#undef HAVE_STRING_H | |||||
/* Define to 1 if you have the <sys/socket.h> header file. */ | |||||
#undef HAVE_SYS_SOCKET_H | |||||
/* Define to 1 if you have the <sys/stat.h> header file. */ | |||||
#undef HAVE_SYS_STAT_H | |||||
/* Define to 1 if you have the <sys/time.h> header file. */ | |||||
#undef HAVE_SYS_TIME_H | |||||
/* Define to 1 if you have the <sys/types.h> header file. */ | |||||
#undef HAVE_SYS_TYPES_H | |||||
/* Define to 1 if you have the <termios.h> header file. */ | |||||
#undef HAVE_TERMIOS_H | |||||
/* Define to 1 if you have the <unistd.h> 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 <vfork.h> 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 <sys/types.h> does not define. */ | |||||
#undef pid_t | |||||
/* Define as `fork' if `vfork' does not work. */ | |||||
#undef vfork |
@@ -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 |
@@ -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 <oliva@dcc.unicamp.br>. | |||||
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 <bug-automake@gnu.org>. | |||||
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: |
@@ -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: |
@@ -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 <pinard@iro.umontreal.ca>, 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 <bug-automake@gnu.org>." | |||||
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: |
@@ -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 | |||||
@@ -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: |
@@ -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 | |||||
@@ -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 <http://www.gnu.org/licenses/> | |||||
*******************************************************************/ | |||||
/* 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 |
@@ -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 <http://www.gnu.org/licenses/> | |||||
*******************************************************************/ | |||||
/* debug.c */ | |||||
#include "conf.h" | |||||
#include <stdio.h> | |||||
#include <stdlib.h> | |||||
#include <unistd.h> | |||||
#include <string.h> | |||||
#include <sys/types.h> | |||||
#include <sys/stat.h> | |||||
#include <fcntl.h> | |||||
#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); | |||||
} | |||||
@@ -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 <http://www.gnu.org/licenses/> | |||||
*******************************************************************/ | |||||
/* 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 |
@@ -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 <http://www.gnu.org/licenses/> | |||||
*******************************************************************/ | |||||
/* dev.c */ | |||||
#ifdef HAVE_CONFIG_H | |||||
#include "../config.h" | |||||
#endif | |||||
#ifdef HAVE_COMEDILIB_H | |||||
#define _WITH_COMEDILIB | |||||
#endif | |||||
#include <stdio.h> | |||||
#include <string.h> | |||||
static int DFL_did=0, DFL_sid=0, DFL_cid=0; | |||||
#ifdef _WITH_COMEDILIB | |||||
#include <comedilib.h> | |||||
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;chan++){ | |||||
printf(" chan%d: %lu\n",chan, | |||||
(unsigned long)comedi_get_maxdata(it,i,chan)); | |||||
} | |||||
} | |||||
if (V >= 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;j<n_ranges;j++){ | |||||
rng=comedi_get_range(it,i,0,j); | |||||
printf(" [%g,%g]",rng->min,rng->max); | |||||
} | |||||
printf("\n"); | |||||
} else { | |||||
printf("\n"); | |||||
for (chan=0;chan<n_chans;chan++){ | |||||
n_ranges=comedi_get_n_ranges(it,i,chan); | |||||
printf(" chan%d:",chan); | |||||
for (j=0;j<n_ranges;j++){ | |||||
rng=comedi_get_range(it,i,chan,j); | |||||
printf(" [%g,%g]",rng->min,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; | |||||
} | |||||
@@ -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 <http://www.gnu.org/licenses/> | |||||
*******************************************************************/ | |||||
/* 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 |
@@ -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 <http://www.gnu.org/licenses/> | |||||
*******************************************************************/ | |||||
#include "conf.h" | |||||
/* err.c */ | |||||
#include <stdio.h> | |||||
#include <stdlib.h> | |||||
#include <unistd.h> | |||||
#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]); | |||||
} | |||||
@@ -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 <http://www.gnu.org/licenses/> | |||||
*******************************************************************/ | |||||
/* 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 |
@@ -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 ; | |||||
@@ -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 | |||||
; | |||||
@@ -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 | |||||
@@ -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 <http://www.gnu.org/licenses/> | |||||
*******************************************************************/ | |||||
/* foncs.c liste des fonctions systeme */ | |||||
#include "conf.h" | |||||
#include <stdio.h> | |||||
#include <stdlib.h> | |||||
#include <string.h> | |||||
#include <signal.h> | |||||
#include <unistd.h> | |||||
#include <time.h> | |||||
#include <sys/time.h> | |||||
#include <sys/resource.h> | |||||
#include <sys/types.h> | |||||
#include <sys/wait.h> | |||||
#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"); | |||||
} | |||||
@@ -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 <http://www.gnu.org/licenses/> | |||||
*******************************************************************/ | |||||
/* 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 |
@@ -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 <http://www.gnu.org/licenses/> | |||||
*******************************************************************/ | |||||
/* liste des fonctions liees a gnuplot */ | |||||
/* gplot.c */ | |||||
#include <stdio.h> | |||||
#include <stdlib.h> | |||||
#include <string.h> | |||||
#include <signal.h> | |||||
#include <unistd.h> | |||||
#include <sys/types.h> | |||||
#include <sys/stat.h> | |||||
#include <fcntl.h> | |||||
#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("<end of GNUPlot list>\n"); | |||||
} | |||||
@@ -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 <http://www.gnu.org/licenses/> | |||||
*******************************************************************/ | |||||
/* 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 |
@@ -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 <http://www.gnu.org/licenses/> | |||||
*******************************************************************/ | |||||
/* help.c */ | |||||
#include <stdio.h> | |||||
#include <string.h> | |||||
#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); | |||||
} |
@@ -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 <http://www.gnu.org/licenses/> | |||||
*******************************************************************/ | |||||
/* help.h */ | |||||
#ifndef __NIFE_HELP_H__ | |||||
#define __NIFE_HELP_H__ | |||||
extern void IF_help(void); | |||||
#endif |
@@ -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 <http://www.gnu.org/licenses/> | |||||
*******************************************************************/ | |||||
/* histo.c */ | |||||
#include "conf.h" | |||||
#include <stdio.h> | |||||
#include <stdlib.h> | |||||
#include <string.h> | |||||
#include <signal.h> | |||||
#include <sys/types.h> | |||||
#include <sys/wait.h> | |||||
#include <sys/stat.h> | |||||
#include <fcntl.h> | |||||
#include <termios.h> | |||||
#include <unistd.h> | |||||
#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<iH;i++) free((void*)HIST[i]); | |||||
iH=0; | |||||
} | |||||
void putHisto(char *C) | |||||
{ | |||||
int L; | |||||
if ((L=strlen(C)) == 0) return; | |||||
HIST[iH] = (char*)malloc(L+1); | |||||
if (HIST[iH] != NULL) { | |||||
strcpy(HIST[iH],C); | |||||
iHt=iH; /* depart recherche */ | |||||
iH++; | |||||
iHl=iH; | |||||
if (iH == HISTOMAX) { | |||||
iHFull=1; | |||||
iH=0; | |||||
} | |||||
} | |||||
} | |||||
char * getHisto(char S) /* Sens A remonte, B descend */ | |||||
{ | |||||
char * C; | |||||
if (S == 'B') { | |||||
if (iHt == iH-1) { | |||||
iHl=iH; | |||||
printf("\a"); | |||||
fflush(stdout); | |||||
C = NULL; | |||||
} else { | |||||
iHt++; | |||||
if (iHt == HISTOMAX) iHt=0; | |||||
if (iHl==iHt) iHt++; | |||||
C = HIST[iHt]; | |||||
iHl=iHt; | |||||
} | |||||
} else { /* A */ | |||||
if (iHt == -1) { | |||||
iHl=iHt; | |||||
printf("\a"); | |||||
fflush(stdout); | |||||
C = NULL; | |||||
} else { | |||||
if (iHl==iHt) iHt--; | |||||
iHl=iHt; | |||||
C = HIST[iHt--]; | |||||
if ((iHt < 0) && (iHFull)) iHt = HISTOMAX-1; | |||||
} | |||||
} | |||||
return(C); | |||||
} | |||||
static struct termios t0, t1; | |||||
int iTERM=0; | |||||
void termInit(void) | |||||
{ | |||||
for (iTERM=0; iTERM<3; iTERM++) { | |||||
if (tcgetattr(iTERM, &t0) != -1) break; | |||||
if (iTERM<2) continue; | |||||
perror("No terminal found ! tcgetattr"); /* sauvegarde */ | |||||
exit(2); | |||||
} | |||||
if (tcgetattr(iTERM, &t1) == -1) perror("tcgetattr"); | |||||
/* cfmakeraw(&t1); */ | |||||
t1.c_iflag &= ~(IGNBRK | BRKINT | PARMRK | ISTRIP | |||||
| INLCR | IGNCR | ICRNL | IXON); | |||||
/* t1.c_oflag &= ~OPOST; */ | |||||
t1.c_lflag &= ~(ECHO | ECHONL | ICANON | ISIG | IEXTEN); | |||||
t1.c_cflag &= ~(CSIZE | PARENB); | |||||
t1.c_cflag |= CS8; | |||||
if (tcsetattr(iTERM, TCSAFLUSH, &t1) == -1) perror("tcsetattr"); /* raw */ | |||||
} | |||||
void termReset(void) | |||||
{ | |||||
if (tcsetattr(iTERM, TCSAFLUSH, &t0) == -1) perror("tcsetattr");/*restaure*/ | |||||
} | |||||
void enleve1(char * s) | |||||
{ | |||||
char * w; | |||||
w=s; | |||||
while (*w != '\0') *w++ = *(w+1); | |||||
} | |||||
void insertC(char c, char * s) | |||||
{ | |||||
char *w; | |||||
w=s; | |||||
while (*w != '\0') w++; | |||||
while (w >= 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<f-ls) { | |||||
if (noErr()) { | |||||
n = -1; | |||||
break; | |||||
} | |||||
/* fprintf(stderr,"d-b=%d ins=%d s=<%s> 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; j<strlen(s); j++) printf("\b"); | |||||
} | |||||
} | |||||
} | |||||
fflush(stdout); | |||||
d++; | |||||
} else { | |||||
switch (c) { | |||||
case '\t': /* tab */ | |||||
if (d>b) { | |||||
*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<strlen(s); j++) printf("\b"); | |||||
fflush(stdout); | |||||
} | |||||
break; | |||||
case 'A' : | |||||
case 'B' : | |||||
ins = 0; | |||||
/* efface la ligne en cours */ | |||||
l=d-b; | |||||
for(i=0;i<l;i++) printf("\b \b"); | |||||
fflush(stdout); | |||||
d=b; | |||||
*d = '\0'; | |||||
if ((h=getHisto(c3)) != NULL) { | |||||
strcpy(b,h); | |||||
d=b+strlen(h); | |||||
/* | |||||
printf("\n%s (iH=%d iHt=%d)\n",h,iH,iHt); | |||||
*d='\0'; | |||||
*/ | |||||
printf("%s",b); | |||||
fflush(stdout); | |||||
} | |||||
break; | |||||
case 'C' : /* -> */ | |||||
if (ins) { | |||||
*d = *s; | |||||
printf("%c",*d++); | |||||
enleve1(s); | |||||
if(*s =='\0') ins=0; | |||||
else { | |||||
printf("%s",s); | |||||
for (j=0; j<strlen(s); j++) printf("\b"); | |||||
} | |||||
fflush(stdout); | |||||
} | |||||
break; | |||||
case 'D' : /* <- */ | |||||
if (d>b) { | |||||
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)); | |||||
} | |||||
@@ -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 <http://www.gnu.org/licenses/> | |||||
*******************************************************************/ | |||||
/* 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 |
@@ -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 <http://www.gnu.org/licenses/> | |||||
*******************************************************************/ | |||||
#include "conf.h" | |||||
/* lib.c librairie de base */ | |||||
#include <stdio.h> | |||||
#include <stdlib.h> | |||||
#include <string.h> | |||||
#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;i<NbF;i++) { | |||||
/* printf("%-13s",Fonctions[i].nam);*/ | |||||
printf("%-13s",ListFonc[i]); | |||||
j++; | |||||
if (j == 6) { | |||||
j=0; | |||||
printf("\n"); | |||||
} | |||||
} | |||||
if (j) printf("\n"); | |||||
} | |||||
static int triList(short F) | |||||
{ | |||||
void * M; | |||||
char * T; | |||||
int i,j, NbF; | |||||
if (ListFonc != (char**)NULL) free((void*)ListFonc); | |||||
if ((M = malloc(sizeof(char*)* NBFonc)) == NULL) stopErr("triList","malloc"); | |||||
ListFonc = (char**)M; | |||||
j=0; | |||||
for(i=0;i<NBFonc;i++) { | |||||
if (Fonctions[i].fam & F) ListFonc[j++]=Fonctions[i].nam; | |||||
} | |||||
NbF = j; | |||||
for(i=0; i<NbF-1; i++) /* avant NbF-2 */ | |||||
for(j=i+1; j<NbF; j++) | |||||
if(strcmp(ListFonc[j],ListFonc[i]) < 0) { | |||||
T=ListFonc[i]; ListFonc[i]=ListFonc[j]; ListFonc[j]=T; | |||||
} | |||||
return NbF; | |||||
} | |||||
void listLibBegin(char * b) | |||||
{ | |||||
int i,j=0,l,n; | |||||
l=strlen(b); | |||||
n=triList(0xFF); | |||||
for(i=0;i<n;i++) { | |||||
if (strncmp(ListFonc[i],b,l)==0){ | |||||
printf("%-13s",ListFonc[i]); | |||||
j++; | |||||
if (j == 6) { | |||||
j=0; | |||||
printf("\n"); | |||||
} | |||||
} else | |||||
if (strncmp(ListFonc[i],b,l)>0) break; | |||||
} | |||||
if (j) printf("\n"); | |||||
} | |||||
char * getLibBegin(char * b) | |||||
{ | |||||
int i,l; | |||||
l=strlen(b); | |||||
for(i=0;i<NBFonc;i++) { | |||||
if (strncmp(Fonctions[i].nam,b,l)==0) break; | |||||
} | |||||
if (i==NBFonc) return NULL; | |||||
return Fonctions[i].nam; | |||||
} | |||||
static char Rac[20]; /* longueur maxi d'une commande */ | |||||
int nbLibBegin(char * b, char ** r) | |||||
{ | |||||
int i,n, first=1; | |||||
unsigned int j, l,t=0; | |||||
n=triList(0xFF); | |||||
l=strlen(b); | |||||
*Rac='\0'; | |||||
for (i=0;i<n;i++) { | |||||
if (strncmp(ListFonc[i],b,l)>0) 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<strlen(Rac);j++) | |||||
if (strncmp(Rac,ListFonc[i],j) != 0) break; | |||||
if (j!=strlen(Rac)) Rac[j-1]='\0'; | |||||
else | |||||
if (Rac[j-1] != ListFonc[i][j-1]) Rac[j-1]='\0'; | |||||
} | |||||
} | |||||
} | |||||
} | |||||
if (strlen(Rac) > 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<NBFonc;i++) { | |||||
if (strcmp(L,Fonctions[i].nam) == 0) { | |||||
if (Fonctions[i].typ) break; | |||||
else return((void*)Fonctions[i].fct); | |||||
} | |||||
} | |||||
return VIDE; | |||||
} | |||||
int execLibNrpc(char *C) | |||||
{ | |||||
int i; | |||||
if (sigsetjmp(ENV_INT,1)) { | |||||
return 0; | |||||
} | |||||
if (IF_execFct(C)) return 1; | |||||
for (i=0;i<NBFonc;i++) { | |||||
if (strcmp(C,Fonctions[i].nam) == 0) { | |||||
switch (Fonctions[i].typ) { | |||||
case 1: | |||||
case 3: /* usr fct */ | |||||
return 0; | |||||
break; | |||||
default: /* typ = 0 et 2 */ | |||||
Fonctions[i].fct(); | |||||
break; | |||||
} | |||||
return 1; | |||||
} | |||||
} | |||||
if (IF_execVar(C)) return 1; /* VARS DOWN */ | |||||
return 0; | |||||
} | |||||
int execLib(char *C) | |||||
{ | |||||
int i; | |||||
void * A; | |||||
short T=0; | |||||
InExec = C; | |||||
D_Trace(C); | |||||
if (sigsetjmp(ENV_INT,1)) { | |||||
interInfos("execLib",C); | |||||
return 1; | |||||
} | |||||
if (InstallOn) { | |||||
switch (InstallOn) { | |||||
case 1 : /* lib first */ | |||||
A=libByName(C); | |||||
if (A==VIDE) { | |||||
A=fctByName(C); | |||||
if (A!=VIDE) T=2; | |||||
} else T=1; | |||||
break; | |||||
case 2 : /* user functions first */ | |||||
A=fctByName(C); | |||||
if (A==VIDE) { | |||||
A=libByName(C); | |||||
if (A!=VIDE) T=1; | |||||
} else T=2; | |||||
break; | |||||
case 3 : /* variables only */ | |||||
A=varByName(C); | |||||
if (A!=VIDE) T=3; | |||||
break; | |||||
case 8 : /* df_init */ | |||||
A=fctByName(C); | |||||
updDynFct(A,0); | |||||
break; | |||||
case 9 : /* df_start */ | |||||
A=fctByName(C); | |||||
updDynFct(A,1); | |||||
break; | |||||
case 10 : /* df_stop */ | |||||
A=fctByName(C); | |||||
updDynFct(A,2); | |||||
break; | |||||
default : | |||||
break; | |||||
} | |||||
_MODIF_FCT_INST_(A); | |||||
_MODIF_FCT_TYP_(T); | |||||
InstallOn=0; | |||||
return 1; | |||||
} | |||||
if ((VARS==2) && (IF_execVar(C))) return 1; /* VARS UP */ | |||||
if (IF_execFct(C)) return 1; | |||||
for (i=0;i<NBFonc;i++) { | |||||
/* printf("execLib : teste %s !\n", Fonctions[i].nam); */ | |||||
if (strcmp(C,Fonctions[i].nam) == 0) { | |||||
switch (Fonctions[i].typ) { | |||||
case 1: | |||||
if (fctEnCours) Fonctions[i].fct(); | |||||
else messErr(13); | |||||
break; | |||||
case 2: | |||||
if (fctEnCours) messErr(25); | |||||
else Fonctions[i].fct(); | |||||
break; | |||||
case 3: /* usr fct */ | |||||
break; | |||||
default: /* typ = 0 */ | |||||
if (fctEnCours) { | |||||
if (strcmp(C,":") == 0) messErr(15); | |||||
else { | |||||
if (strcmp(C,"\"") == 0) Fonctions[i].fct(); | |||||
else makeFct(T_LIB,(void*)Fonctions[i].fct); | |||||
} | |||||
} else Fonctions[i].fct(); | |||||
break; | |||||
} | |||||
return 1; | |||||
} | |||||
} | |||||
if ((VARS==1) && (IF_execVar(C))) return 1; /* VARS DOWN */ | |||||
/* printf("execLib : appel putVal(%s)\n",C); */ | |||||
return(putVal(C)); | |||||
} | |||||
char * libByAddr(void *A) | |||||
{ | |||||
PFC f; | |||||
int i; | |||||
f = (PFC)A; | |||||
for (i=0;i<NBFonc;i++) { | |||||
if (f == (PFC)(Fonctions[i].fct)) return Fonctions[i].nam; | |||||
} | |||||
return NULL; | |||||
} | |||||
@@ -0,0 +1,33 @@ | |||||
/* 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 <http://www.gnu.org/licenses/> | |||||
*******************************************************************/ | |||||
/* 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 |
@@ -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 <http://www.gnu.org/licenses/> | |||||
*******************************************************************/ | |||||
/* libmath.c */ | |||||
#include "conf.h" | |||||
#include <stdio.h> | |||||
#include <stdlib.h> | |||||
#include <inttypes.h> | |||||
#include <math.h> | |||||
#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); } | |||||
@@ -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 <http://www.gnu.org/licenses/> | |||||
*******************************************************************/ | |||||
/* 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 |
@@ -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 <http://www.gnu.org/licenses/> | |||||
*******************************************************************/ | |||||
/* libmathc99.c */ | |||||
#include "conf.h" | |||||
#define _ISOC99_SOURCE | |||||
#include <stdio.h> | |||||
#include <stdlib.h> | |||||
#include <inttypes.h> | |||||
#include <math.h> | |||||
#include "stackN.h" | |||||
void IF_abs(void) { IF_fctB_1(llabs,fabs); } | |||||
@@ -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 <http://www.gnu.org/licenses/> | |||||
*******************************************************************/ | |||||
/* mth.c : for multi-threading implementation */ | |||||
#include "conf.h" | |||||
#include <stdio.h> | |||||
#include <stdlib.h> | |||||
#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_ */ | |||||
@@ -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 <http://www.gnu.org/licenses/> | |||||
*******************************************************************/ | |||||
/* mth.h : for multi-threading implementation */ | |||||
extern void TH_init(void); | |||||
#ifndef __NIFE_MTH_H__ | |||||
#define __NIFE_MTH_H__ | |||||
#include <stdio.h> | |||||
#include <stdint.h> | |||||
#include <setjmp.h> | |||||
#include <pthread.h> | |||||
#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 | |||||
@@ -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 <http://www.gnu.org/licenses/> | |||||
*******************************************************************/ | |||||
/* net.h */ | |||||
#ifndef __NIFE_NET_H__ | |||||
#define __NIFE_NET_H__ | |||||
#include <stdint.h> | |||||
#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 |
@@ -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 <http://www.gnu.org/licenses/> | |||||
*******************************************************************/ | |||||
/* nife.c */ | |||||
#include "conf.h" | |||||
#include <stdio.h> | |||||
#include <stdlib.h> | |||||
#include <string.h> | |||||
#include <signal.h> | |||||
#include <sys/types.h> | |||||
#include <sys/wait.h> | |||||
#include <sys/stat.h> | |||||
#include <fcntl.h> | |||||
#include <unistd.h> | |||||
#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<strlen(sepa);i++) | |||||
if (c == sepa[i]) return 1; | |||||
return 0; | |||||
} | |||||
int traiteMot(char *M) | |||||
{ | |||||
int Err=0; | |||||
PFC tS; | |||||
if (sigsetjmp(ENV_INT,1)) { | |||||
interInfos("traiteMot",M); | |||||
return 1; | |||||
} | |||||
/* printf("traiteMot <%s> 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 (d<f) { | |||||
if (noErr()) break; | |||||
/* recherche du 1er mot */ | |||||
if (stringEnCours) { | |||||
mot = d; | |||||
while (1) { | |||||
if((d = strchr(d,'"')) == NULL) { | |||||
d=mot+strlen(mot); | |||||
break; | |||||
} | |||||
if (*(d-1) == '\\') { | |||||
w = d-1; | |||||
while (*w != '\0') { | |||||
*w = *(w+1); | |||||
w++; | |||||
} | |||||
continue; | |||||
} | |||||
d++; | |||||
if (!isSepa(*d,1)) continue; | |||||
break; | |||||
} | |||||
} else { | |||||
/* on ignore les commentaires */ | |||||
if ((mot = strchr(d, (int)'#')) != NULL) { | |||||
*mot = '\0'; | |||||
f = mot; | |||||
} | |||||
while (isSepa(*d,0)) d++; /* on avance tant que separateurs */ | |||||
mot = d; | |||||
while (!isSepa(*d,1)) d++; /* on avance si nonSepa ET non \0 */ | |||||
} | |||||
*d++ = '\0'; /* fin de la commande */ | |||||
if (strlen(mot)>0) | |||||
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; | |||||
} | |||||
@@ -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 <http://www.gnu.org/licenses/> | |||||
*******************************************************************/ | |||||
/* nife.h */ | |||||
#ifndef __NIFE_NIFE_H__ | |||||
#define __NIFE_NIFE_H__ | |||||
#include <setjmp.h> | |||||
#include <errno.h> | |||||
#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 |
@@ -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. | |||||
@@ -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 <http://www.gnu.org/licenses/> | |||||
*******************************************************************/ | |||||
/* scs.c */ | |||||
/* Scs means Sister Chip Signature */ | |||||
#include <stdio.h> | |||||
#include <sys/types.h> | |||||
#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<l; i++) { | |||||
/* printf("%d : k=%d %u r=0x%.8lx\n",i,(int)k,(unsigned int)t[i],r);*/ | |||||
switch(k) { | |||||
case 0: | |||||
r+=(unsigned int)t[i]; | |||||
break; | |||||
case 1: | |||||
r+=(unsigned int)(((int)t[i])<<5); | |||||
break; | |||||
case 2: | |||||
r+=(unsigned int)(((int)t[i])<<10); | |||||
break; | |||||
default: | |||||
r+=(unsigned int)(((int)t[i])<<15); | |||||
break; | |||||
} | |||||
if (++k==4) k=0; | |||||
} | |||||
/* printf("Key : l=%d r=%lu (0x%.8lx)\n",l,r,r); */ | |||||
MyScs = r + (uint32_t)(l<<24); | |||||
} | |||||
return MyScs; | |||||
} | |||||
/* ******************** for tests ************************************ | |||||
int main(int N, char*P[]) | |||||
{ | |||||
int i; | |||||
unsigned char *d, *f; | |||||
unsigned short *ds, *fs; | |||||
unsigned int *di, *fi; | |||||
unsigned long long *dl, *fl; | |||||
printf("short : %.2d\n", sizeof(short)); | |||||
printf("int : %.2d\n", sizeof(int)); | |||||
printf("size_t : %.2d\n", sizeof(size_t)); | |||||
printf("long : %.2d\n", sizeof(long)); | |||||
printf("long long : %.2d\n", sizeof(long long)); | |||||
printf("float : %.2d\n", sizeof(float)); | |||||
printf("double : %.2d\n", sizeof(double)); | |||||
printf("long double : %.2d\n", sizeof(long double)); | |||||
printf("E : %.2d\n", sizeof(E)); | |||||
Scs_init(); | |||||
d=(char*)&E; | |||||
f=d+sizeof(E); | |||||
while (d < f) printf("%.2x",(int)*d++); | |||||
printf("\n"); | |||||
ds=(short*)&E; | |||||
fs=ds+(sizeof(E)/sizeof(short)); | |||||
while (ds < fs) printf("%4x",(int)*ds++); | |||||
printf("\n"); | |||||
di=(int*)&E; | |||||
fi=di+(sizeof(E)/sizeof(int)); | |||||
while (di < fi) printf("%8x",*di++); | |||||
printf("\n"); | |||||
dl=(long long*)&E; | |||||
fl=dl+(sizeof(E)/sizeof(long long)); | |||||
while (dl < fl) printf("%.16llx",*dl++); | |||||
printf("\n"); | |||||
printf("D : %.2d s=%.2d\n",(void*)(&E.D)-(void*)(&E),sizeof(E.D)); | |||||
printf("S : %.2d s=%.2d\n",(void*)(&E.S)-(void*)(&E),sizeof(E.S)); | |||||
printf("I : %.2d s=%.2d\n",(void*)(&E.I)-(void*)(&E),sizeof(E.I)); | |||||
printf("LL: %.2d s=%.2d\n",(void*)(&E.LL)-(void*)(&E),sizeof(E.LL)); | |||||
printf("MyScs = 0x%.8lx\n",getScs()); | |||||
printf("MyScs = 0x%.8lx\n",getScs()); | |||||
} | |||||
****************/ | |||||
@@ -0,0 +1,26 @@ | |||||
/* 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 <http://www.gnu.org/licenses/> | |||||
*******************************************************************/ | |||||
/* scs.h */ | |||||
/* Scs means Sister Chip Signature */ | |||||
#ifndef __NIFE_SCS_H__ | |||||
#define __NIFE_SCS_H__ | |||||
#include <stdint.h> | |||||
extern uint32_t getScs(void); | |||||
#endif |
@@ -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 <http://www.gnu.org/licenses/> | |||||
*******************************************************************/ | |||||
#include "conf.h" | |||||
/* stackC.c */ | |||||
#include <stdio.h> | |||||
#include <stdlib.h> | |||||
#include <string.h> | |||||
#include <time.h> | |||||
#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("<end of character stack>\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); | |||||
} | |||||
@@ -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 <http://www.gnu.org/licenses/> | |||||
*******************************************************************/ | |||||
/* 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 |
@@ -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 <http://www.gnu.org/licenses/> | |||||
*******************************************************************/ | |||||
/* 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 |
@@ -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 <http://www.gnu.org/licenses/> | |||||
*******************************************************************/ | |||||
/* stackL.c */ | |||||
#include "conf.h" | |||||
#include <stdio.h> | |||||
#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("<end of logical stack>\n"); | |||||
} | |||||
@@ -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 <http://www.gnu.org/licenses/> | |||||
*******************************************************************/ | |||||
/* 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 |
@@ -0,0 +1,125 @@ | |||||
/* 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 <http://www.gnu.org/licenses/> | |||||
*******************************************************************/ | |||||
/* stackN.h */ | |||||
#ifndef __NIFE_STACKN_H__ | |||||
#define __NIFE_STACKN_H__ | |||||
#include <stdint.h> | |||||
#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 |
@@ -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 <http://www.gnu.org/licenses/> | |||||
*******************************************************************/ | |||||
#include "conf.h" | |||||
/* stackV.c */ | |||||
#include <stdio.h> | |||||
#include <stdlib.h> | |||||
#include <string.h> | |||||
#include <strings.h> | |||||
#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("<end of variable list>\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; | |||||
} | |||||
@@ -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 <http://www.gnu.org/licenses/> | |||||
*******************************************************************/ | |||||
/* 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 |
@@ -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 <http://www.gnu.org/licenses/> | |||||
*******************************************************************/ | |||||
#include "conf.h" | |||||
/* task.c gestion des taches */ | |||||
#include <stdio.h> | |||||
#include <stdlib.h> | |||||
#include <unistd.h> | |||||
#include <time.h> | |||||
#include <signal.h> | |||||
#include <sys/time.h> | |||||
#include <sys/resource.h> | |||||
#include <sys/types.h> | |||||
#include <sys/wait.h> | |||||
#include <sys/stat.h> | |||||
#include <fcntl.h> | |||||
#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<MAX_TASK;i++) if (TASKp[i]==0) break; | |||||
if (i<MAX_TASK) { | |||||
FctInTask = i+1; | |||||
} else { | |||||
FctInTask = -1; | |||||
messErr(26); | |||||
} | |||||
} | |||||
static char FLib[24]; | |||||
static char * FicCons(int t) | |||||
{ | |||||
sprintf(FLib,".nife/Cons%d.log",t); | |||||
return FLib; | |||||
} | |||||
int MakeTask (void * A) | |||||
{ | |||||
int i, pid; | |||||
char * NF; | |||||
i = FctInTask-1; | |||||
if ((pid = fork()) == -1) stopErr("IF_NewTask","fork"); | |||||
if (pid == 0) { /* fils */ | |||||
ITASK=FctInTask; /* TASK 0 is the interractive */ | |||||
NF = FicCons(ITASK); | |||||
if ((i=open(NF,O_CREAT|O_RDWR|O_TRUNC,0600)) < 0) perror(NF); | |||||
else { | |||||
dup2(i,1); | |||||
dup2(i,2); | |||||
close(i); | |||||
close(0); | |||||
} | |||||
} else { | |||||
TASKp[i] = pid; | |||||
putLong(FctInTask); | |||||
TASKf[i]=A; | |||||
FctInTask=0; | |||||
} | |||||
return(pid); | |||||
} | |||||
void IF_show_Tasks(void) | |||||
{ | |||||
int i; | |||||
for (i=0;i<MAX_TASK;i++) { | |||||
if (TASKp[i] != 0) { | |||||
printf(" %.2d : %s (",i+1,codByAddr(TASKf[i])); | |||||
if (kill(TASKp[i],SIGUSR1) ==0) printf("running"); | |||||
else printf("stopped"); | |||||
printf(")\n"); | |||||
} | |||||
} | |||||
printf("<end of tasks list>\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); | |||||
} | |||||
} | |||||
@@ -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 <http://www.gnu.org/licenses/> | |||||
*******************************************************************/ | |||||
/* 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 |
@@ -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." |