Compare commits
42 Commits
release-6-
...
release-6-
| Author | SHA1 | Date | |
|---|---|---|---|
|
|
58e5e12ead | ||
|
|
54ce3f451b | ||
|
|
663f4f2fb5 | ||
|
|
78777e802b | ||
|
|
df088c184b | ||
|
|
868b8c5075 | ||
|
|
eb4ea1e761 | ||
|
|
494d9a3e4a | ||
|
|
6127ddf024 | ||
|
|
9d0f0a8fdd | ||
|
|
c9d7f7ef23 | ||
|
|
a7323e1a8b | ||
|
|
3a4147a37d | ||
|
|
be8baf3da6 | ||
|
|
013f58f94e | ||
|
|
0d8578410c | ||
|
|
7f266d6b4e | ||
|
|
440d6faadd | ||
|
|
24ea8aee3d | ||
|
|
bc5ccee8d5 | ||
|
|
bfeb736c35 | ||
|
|
740940c9fc | ||
|
|
f6085fb234 | ||
|
|
b8e1348f2a | ||
|
|
413880c52d | ||
|
|
ae9ac25f45 | ||
|
|
f471d2e618 | ||
|
|
67c4f3de87 | ||
|
|
9b920e59cb | ||
|
|
9710c14c93 | ||
|
|
921c55968c | ||
|
|
1c83baa702 | ||
|
|
b66d66b597 | ||
|
|
2a367fa192 | ||
|
|
f4e37e1319 | ||
|
|
400c475c03 | ||
|
|
b500b1a7b7 | ||
|
|
201c66879d | ||
|
|
04860c08a8 | ||
|
|
daee8da3c4 | ||
|
|
4428647786 | ||
|
|
d77b4ce97c |
32
.distr
32
.distr
@@ -1,4 +1,5 @@
|
||||
README
|
||||
CHANGES
|
||||
Copyright
|
||||
pm
|
||||
pmfile
|
||||
@@ -29,7 +30,7 @@ util/cmisc
|
||||
util/ack
|
||||
lib/descr/fe
|
||||
util/arch
|
||||
util/cpp
|
||||
#util/cpp
|
||||
util/cgg
|
||||
util/ncgg
|
||||
util/misc
|
||||
@@ -41,33 +42,16 @@ util/led
|
||||
lang/cem
|
||||
lang/pc
|
||||
lang/m2
|
||||
lang/occam
|
||||
lang/basic
|
||||
#lang/occam
|
||||
#lang/basic
|
||||
|
||||
mach/proto
|
||||
mach/i80
|
||||
mach/i86
|
||||
mach/i386
|
||||
|
||||
plat/cpm
|
||||
plat/pc86
|
||||
plat/linux386
|
||||
|
||||
examples
|
||||
|
||||
#Action
|
||||
#NEW
|
||||
#README
|
||||
#TODO
|
||||
#TakeAction
|
||||
#bin
|
||||
#doc
|
||||
#emtest
|
||||
#etc
|
||||
#fast
|
||||
#fcc
|
||||
#first
|
||||
#h
|
||||
#include
|
||||
#modules
|
||||
#lang
|
||||
#lib
|
||||
#mach
|
||||
#man
|
||||
#util
|
||||
|
||||
30
CHANGES
Normal file
30
CHANGES
Normal file
@@ -0,0 +1,30 @@
|
||||
# $Source$
|
||||
# $State$
|
||||
# $Revision$
|
||||
|
||||
6.0pre3
|
||||
|
||||
Added the cpm platform. Made some optimisations to the i80 code generator,
|
||||
including getting topgen up and running and adding some peephole optimiser
|
||||
rules. Fixed loads of bugs in ego so that it now works on platforms that
|
||||
support it (pc86 and linux386). Made the floating point work on platforms
|
||||
that support it (pc86 and linux386 again). Made stdint.h work. Lots and lots
|
||||
of bugfixes and tweaks everywhere.
|
||||
|
||||
6.0pre2
|
||||
|
||||
Much simplified the syscall interface by disabling libmon and instead
|
||||
calling the syscalls directly. Disabled the K&R C compiler and libc because
|
||||
it doesn't actually gain us anything and has a high maintenance load --- the
|
||||
ANSI C compiler works fine with K&R C. Adapted the rest of the system to
|
||||
build with the ANSI C compiler. Rewrote the pc86 syscall interface and added
|
||||
linux386 support, using the i386 code generator. Lots and lots of bugfixes
|
||||
and tweaks everywhere.
|
||||
|
||||
6.0pre1
|
||||
|
||||
First working version of the 6.0 release stream. Working frontends: both C
|
||||
compilers, Pascal, Modula-2, Basic and Occam. Working backends: i86. Working
|
||||
platforms: pc86, the very noddy testbed setup that produces floppy disk
|
||||
images.
|
||||
|
||||
26
README
26
README
@@ -2,11 +2,11 @@
|
||||
# $State$
|
||||
# $Revision$
|
||||
|
||||
THE AMSTERDAM COMPILER KIT V6.0pre1
|
||||
THE AMSTERDAM COMPILER KIT V6.0pre3
|
||||
===================================
|
||||
|
||||
© 1987-2005 Vrije Universiteit, Amsterdam
|
||||
2007-02-25
|
||||
2007-04-29
|
||||
|
||||
|
||||
INTRODUCTION
|
||||
@@ -28,11 +28,13 @@ SUPPORT
|
||||
|
||||
Languages:
|
||||
|
||||
ANSI C, K&R C, Pascal, Modula 2, Occam 1, and a Basic variant.
|
||||
ANSI C, Pascal, Modula 2. K&R is supported via the ANSI C compiler.
|
||||
|
||||
Platforms:
|
||||
|
||||
pc86 produces bootable floppy disk images for 8086 PCs
|
||||
linux386 produces ELF executables for PC Linux systems
|
||||
cpm produces i80 CP/M .COM files
|
||||
|
||||
|
||||
INSTALLATION
|
||||
@@ -114,6 +116,9 @@ For further information, see the man page (which actually does get
|
||||
installed, but is rather out of date).
|
||||
|
||||
There are some (known working) example programs in the 'examples' directory.
|
||||
A sample command line is:
|
||||
|
||||
ack -mlinux386 -O examples/paranoia.c
|
||||
|
||||
|
||||
GOTCHAS
|
||||
@@ -121,16 +126,11 @@ GOTCHAS
|
||||
|
||||
There are some things you should be aware of.
|
||||
|
||||
- The only platform supported so far is pc86, which generates 8086 tiny mode
|
||||
executables that will work as floppy disk boot images. So, to run, simply dd
|
||||
the output file (pc86.img by default) onto a floppy disk and boot from it.
|
||||
Be aware that very little functionality is supported and that the entire
|
||||
program, heap and stack and code and all, must fit within 64kB. See
|
||||
plat/pc86/README for more information.
|
||||
- Look at plat/<PLATFORMNAME>/README for information about the two supported
|
||||
platforms.
|
||||
|
||||
- By default, the ack tool will compile K&R C. Practically all C source these
|
||||
days is ANSI C --- use the -ansi switch to enable ANSI mode. No, the ACK is
|
||||
not C99 compatible.
|
||||
- The library support is fairly limited; for C, it's at roughly the ANSI C
|
||||
level, and for the other languages it's similar.
|
||||
|
||||
- When compiling languages other than C, the ACK will usually look at the
|
||||
first character of the file. If it's a #, then the file will be run through
|
||||
@@ -167,4 +167,4 @@ Please enjoy.
|
||||
|
||||
David Given (dtrg on Sourceforge)
|
||||
dg@cowlark.com
|
||||
2007-02-25
|
||||
2007-04-29
|
||||
|
||||
11
distr/mkdist
11
distr/mkdist
@@ -61,7 +61,7 @@ while [ "$1" != "" ]; do
|
||||
shift
|
||||
done
|
||||
|
||||
if [ "$destdir" == "" ]; then
|
||||
if [ "$destdir" = "" ]; then
|
||||
echo "You must specify a destination directory. (Try --help for help.)"
|
||||
exit 1
|
||||
fi
|
||||
@@ -131,7 +131,7 @@ if !(strings $arch | grep archiver > /dev/null); then
|
||||
echo "architecture.)"
|
||||
echo ""
|
||||
echo "Press RETURN to go ahead anyway, or CTRL+C to abort."
|
||||
read
|
||||
read ignored
|
||||
fi
|
||||
|
||||
# Actually do the work.
|
||||
@@ -141,7 +141,7 @@ echo " into destination tree: $destdir"
|
||||
echo ""
|
||||
|
||||
if [ -e $destdir ]; then
|
||||
if [ "$delete" == "yes" ]; then
|
||||
if [ "$delete" = "yes" ]; then
|
||||
echo "Press RETURN to erase $destdir and its contents, or CTRL+C to abort."
|
||||
read
|
||||
echo "Erasing..."
|
||||
@@ -159,7 +159,10 @@ echo "Done."
|
||||
|
||||
# Revision history
|
||||
# $Log$
|
||||
# Revision 1.4 2007-02-25 20:56:41 dtrg
|
||||
# Revision 1.5 2007-04-24 19:48:41 dtrg
|
||||
# Removed bashish.
|
||||
#
|
||||
# Revision 1.4 2007/02/25 20:56:41 dtrg
|
||||
# Performed major renovations to make the script work on OpenBSD.
|
||||
#
|
||||
# Revision 1.3 2007/02/24 02:05:56 dtrg
|
||||
|
||||
@@ -3,5 +3,8 @@ hilo.c
|
||||
hilo.mod
|
||||
hilo.ocm
|
||||
hilo.p
|
||||
mandelbrot.c
|
||||
paranoia.c
|
||||
startrek.c
|
||||
startrek.doc
|
||||
README
|
||||
|
||||
@@ -6,7 +6,7 @@ A few notes on the examples
|
||||
---------------------------
|
||||
|
||||
This directory contains a handful of working example programs that can be
|
||||
built with the ACK. They're intended as a convention source of test code
|
||||
built with the ACK. They're intended as a convenient source of test code
|
||||
and as a starting point when writing your own programs.
|
||||
|
||||
They consist of:
|
||||
@@ -17,10 +17,17 @@ hilo.mod Modula-2 version of the Hi/Lo game
|
||||
hilo.ocm Occam 1 version of the Hi/Lo game
|
||||
hilo.p Pascal version of the Hi/Lo game
|
||||
|
||||
mandelbrot.c A simple Mandelbrot generator, using floating-point maths
|
||||
paranoia.c An ancient public domain K&R C adventure game
|
||||
startrek.c An even more ancient public domain ANSI C game
|
||||
(uses the FPU for distance calculation)
|
||||
startrek.doc Manual for above (plus in current directory when running)
|
||||
|
||||
Enjoy.
|
||||
|
||||
(startrek.c was written by David Ahl and converted to C by Chris Nystrom. See
|
||||
http://www.cactus.org/%7Enystrom/startrek.html for more info.)
|
||||
|
||||
David Given
|
||||
dg@cowlark.com
|
||||
2007-02-25
|
||||
|
||||
@@ -2,7 +2,7 @@
|
||||
2 ' $State$
|
||||
3 ' $Revision$
|
||||
|
||||
10 print "Hi there! Before we start, what is your name?"
|
||||
10 print "Hi there! I'm written in Basic. Before we start, what is your name?"
|
||||
20 input "> ", PlayerName$
|
||||
30 print
|
||||
40 print "Hello, "; PlayerName$; "!"
|
||||
|
||||
@@ -59,7 +59,7 @@ void game(void)
|
||||
|
||||
int main(int argc, char* argv[])
|
||||
{
|
||||
printf("\nHi there! Before we start, what is your name?\n");
|
||||
printf("\nHi there! I'm written in C. Before we start, what is your name?\n");
|
||||
reads();
|
||||
strcpy(PlayerName, buffer);
|
||||
printf("\nHello, %s! ", PlayerName);
|
||||
|
||||
@@ -66,7 +66,7 @@ VAR
|
||||
finished : BOOLEAN;
|
||||
BEGIN
|
||||
WriteLn;
|
||||
WriteString("Hi there! Before we start, what is your name?");
|
||||
WriteString("Hi there! I'm written in Modula-2. Before we start, what is your name?");
|
||||
WriteLn;
|
||||
reads;
|
||||
WriteLn;
|
||||
|
||||
@@ -56,7 +56,7 @@ proc random(value range, var result) =
|
||||
proc getname =
|
||||
var seed, buffer[128]:
|
||||
seq
|
||||
puts("*nHi there! Before we start, what is your name?*n")
|
||||
puts("*nHi there! I'm written in Occam. Before we start, what is your name?*n")
|
||||
puts("> ")
|
||||
gets(buffer)
|
||||
|
||||
|
||||
@@ -29,10 +29,12 @@ function random(range : integer) : integer;
|
||||
random := seed mod range;
|
||||
end;
|
||||
|
||||
{ Pascal doesn't provide string input, so we interface to the _read() syscall
|
||||
and do it manually. }
|
||||
{ Pascal doesn't provide string input, so we interface to the read() syscall
|
||||
and do it manually. But... we can't interface to read() directly because
|
||||
that conflicts with a Pascal keyword. Luckily there's a private function
|
||||
uread() in the ACK Pascal library that we can use instead. }
|
||||
|
||||
function _read(fd : integer; var buffer : char; count : integer) : integer;
|
||||
function uread(fd : integer; var buffer : char; count : integer) : integer;
|
||||
extern;
|
||||
|
||||
function readchar : char;
|
||||
@@ -42,7 +44,7 @@ function readchar : char;
|
||||
|
||||
begin
|
||||
c := chr(0);
|
||||
dummy := _read(0, c, 1);
|
||||
dummy := uread(0, c, 1);
|
||||
readchar := c;
|
||||
end;
|
||||
|
||||
@@ -79,7 +81,7 @@ procedure getname;
|
||||
|
||||
begin
|
||||
writeln;
|
||||
writeln('Hi there! Before we start, what is your name?');
|
||||
writeln('Hi there! I''m written in Pascal. Before we start, what is your name?');
|
||||
writeln;
|
||||
readstring(name, namelen);
|
||||
writeln;
|
||||
|
||||
73
examples/mandelbrot.c
Normal file
73
examples/mandelbrot.c
Normal file
@@ -0,0 +1,73 @@
|
||||
/* $Source$
|
||||
* $State$
|
||||
* $Revision$
|
||||
*/
|
||||
|
||||
/* Adapted from code by Chris Losinger. (This is the non-obfuscated
|
||||
* version...
|
||||
*
|
||||
* http://www.codeproject.com/cpp/mandelbrot_obfuscation.asp
|
||||
*/
|
||||
|
||||
#include <stdlib.h>
|
||||
#include <unistd.h>
|
||||
|
||||
enum
|
||||
{
|
||||
ROWS = 40,
|
||||
COLUMNS = 60,
|
||||
|
||||
MAX_ITERATIONS = 255
|
||||
};
|
||||
|
||||
void nl(void)
|
||||
{
|
||||
write(1, "\n", 1);
|
||||
}
|
||||
|
||||
void out(int n)
|
||||
{
|
||||
const char* chars = "****++++++---- ";
|
||||
write(1, chars + (n/16), 1);
|
||||
}
|
||||
|
||||
int main(int argc, const char* argv[])
|
||||
{
|
||||
/* Size and position of the visible area. */
|
||||
|
||||
double view_r = -2.3, view_i = -1.0;
|
||||
double zoom = 0.05;
|
||||
int x, y, n;
|
||||
|
||||
for (y=0; y < ROWS; y++)
|
||||
{
|
||||
double c_i = view_i + y * zoom;
|
||||
|
||||
for (x=0; x < COLUMNS; x++)
|
||||
{
|
||||
double c_r = view_r + x*zoom;
|
||||
double z_r = c_r;
|
||||
double z_i = c_i;
|
||||
|
||||
for (n=0; n < MAX_ITERATIONS; n++)
|
||||
{
|
||||
double z_r2 = z_r * z_r;
|
||||
double z_i2 = z_i * z_i;
|
||||
|
||||
/* Have we escaped? */
|
||||
|
||||
if (z_r2 + z_i2 > 4)
|
||||
break;
|
||||
|
||||
/* z = z^2 + c */
|
||||
z_i = 2 * z_r * z_i + c_i;
|
||||
z_r = z_r2 - z_i2 + c_r;
|
||||
}
|
||||
|
||||
out(n);
|
||||
}
|
||||
nl();
|
||||
}
|
||||
|
||||
return 0;
|
||||
}
|
||||
1954
examples/startrek.c
Normal file
1954
examples/startrek.c
Normal file
File diff suppressed because it is too large
Load Diff
105
examples/startrek.doc
Normal file
105
examples/startrek.doc
Normal file
@@ -0,0 +1,105 @@
|
||||
|
||||
1. When you see _Command?_ printed, enter one of the legal commands
|
||||
(nav, srs, lrs, pha, tor, she, dam, com, or xxx).
|
||||
|
||||
2. If you should type in an illegal command, you'll get a short list of
|
||||
the legal commands printed out.
|
||||
|
||||
3. Some commands require you to enter data (for example, the 'nav' command
|
||||
comes back with 'Course(1-9) ?'.) If you type in illegal data (like
|
||||
negative numbers), that command will be aborted.
|
||||
|
||||
The galaxy is divided into an 8 X 8 quadrant grid, and each quadrant
|
||||
is further divided into an 8 x 8 sector grid.
|
||||
|
||||
You will be assigned a starting point somewhere in the galaxy to begin
|
||||
a tour of duty as commander of the starship _Enterprise_; your mission:
|
||||
to seek out and destroy the fleet of Klingon warships which are menacing
|
||||
the United Federation of Planets.
|
||||
|
||||
You have the following commands available to you as Captain of the Starship
|
||||
Enterprise:
|
||||
|
||||
\nav\ Command = Warp Engine Control --
|
||||
|
||||
Course is in a circular numerical vector 4 3 2
|
||||
arrangement as shown. Integer and real . . .
|
||||
values may be used. (Thus course 1.5 is ...
|
||||
half-way between 1 and 2. 5 ---*--- 1
|
||||
...
|
||||
Values may approach 9.0, which itself is . . .
|
||||
equivalent to 1.0. 6 7 8
|
||||
|
||||
One warp factor is the size of one quadrant. COURSE
|
||||
Therefore, to get from quadrant 6,5 to 5,5
|
||||
you would use course 3, warp factor 1.
|
||||
|
||||
\srs\ Command = Short Range Sensor Scan
|
||||
|
||||
Shows you a scan of your present quadrant.
|
||||
|
||||
Symbology on your sensor screen is as follows:
|
||||
<*> = Your starship's position
|
||||
+K+ = Klingon battlecruiser
|
||||
>!< = Federation starbase (Refuel/Repair/Re-Arm here)
|
||||
* = Star
|
||||
|
||||
A condensed 'Status Report' will also be presented.
|
||||
|
||||
\lrs\ Command = Long Range Sensor Scan
|
||||
|
||||
Shows conditions in space for one quadrant on each side of the Enterprise
|
||||
(which is in the middle of the scan). The scan is coded in the form \###\
|
||||
where the units digit is the number of stars, the tens digit is the number
|
||||
of starbases, and the hundreds digit is the number of Klingons.
|
||||
|
||||
Example - 207 = 2 Klingons, No Starbases, & 7 stars.
|
||||
|
||||
\pha\ Command = Phaser Control.
|
||||
|
||||
Allows you to destroy the Klingon Battle Cruisers by zapping them with
|
||||
suitably large units of energy to deplete their shield power. (Remember,
|
||||
Klingons have phasers, too!)
|
||||
|
||||
\tor\ Command = Photon Torpedo Control
|
||||
|
||||
Torpedo course is the same as used in warp engine control. If you hit
|
||||
the Klingon vessel, he is destroyed and cannot fire back at you. If you
|
||||
miss, you are subject to the phaser fire of all other Klingons in the
|
||||
quadrant.
|
||||
|
||||
The Library-Computer (\com\ command) has an option to compute torpedo
|
||||
trajectory for you (option 2).
|
||||
|
||||
\she\ Command = Shield Control
|
||||
|
||||
Defines the number of energy units to be assigned to the shields. Energy
|
||||
is taken from total ship's energy. Note that the status display total
|
||||
energy includes shield energy.
|
||||
|
||||
\dam\ Command = Damage Control report
|
||||
Gives the state of repair of all devices. Where a negative 'State of Repair'
|
||||
shows that the device is temporarily damaged.
|
||||
|
||||
\com\ Command = Library-Computer
|
||||
The Library-Computer contains six options:
|
||||
Option 0 = Cumulative Galactic Record
|
||||
This option shows computer memory of the results of all previous
|
||||
short and long range sensor scans.
|
||||
Option 1 = Status Report
|
||||
This option shows the number of Klingons, stardates, and starbases
|
||||
remaining in the game.
|
||||
Option 2 = Photon Torpedo Data
|
||||
Which gives directions and distance from Enterprise to all Klingons
|
||||
in your quadrant.
|
||||
Option 3 = Starbase Nav Data
|
||||
This option gives direction and distance to any starbase in your
|
||||
quadrant.
|
||||
Option 4 = Direction/Distance Calculator
|
||||
This option allows you to enter coordinates for direction/distance
|
||||
calculations.
|
||||
Option 5 = Galactic /Region Name/ Map
|
||||
This option prints the names of the sixteen major galactic regions
|
||||
referred to in the game.
|
||||
|
||||
|
||||
@@ -6,6 +6,12 @@
|
||||
#define LINO_AD 0
|
||||
#define FILN_AD 4
|
||||
|
||||
/* ERANGE conflicts with a symbol in the ANSI C library. */
|
||||
|
||||
#ifdef ERANGE
|
||||
#undef ERANGE
|
||||
#endif
|
||||
|
||||
#define LINO (*(int *)(_hol0()+LINO_AD))
|
||||
#define FILN (*(char **)(_hol0()+FILN_AD))
|
||||
|
||||
|
||||
@@ -3,6 +3,13 @@
|
||||
* (c) copyright 1987 by the Vrije Universiteit, Amsterdam, The Netherlands.
|
||||
* See the copyright notice in the ACK home directory, in the file "Copyright".
|
||||
*/
|
||||
|
||||
/* EBADF conflicts with the ANSI C definition. */
|
||||
|
||||
#ifdef EBADF
|
||||
#undef EBADF
|
||||
#endif
|
||||
|
||||
#define EARGC 64
|
||||
#define EEXP 65
|
||||
#define ELOG 66
|
||||
|
||||
@@ -41,5 +41,5 @@ lang_basic_runtime = acklibrary {
|
||||
ackfile (d.."trap.c"),
|
||||
ackfile (d.."write.c"),
|
||||
|
||||
install = pm.install("%BINDIR%%PLATIND%/%PLATFORM%/tail_bc")
|
||||
install = pm.install("%BINDIR%%PLATIND%/%PLATFORM%/libbasic.a")
|
||||
}
|
||||
|
||||
@@ -2,5 +2,5 @@ pmfile
|
||||
cemcom.ansi
|
||||
cpp.ansi
|
||||
libcc.ansi
|
||||
cemcom
|
||||
libcc
|
||||
#cemcom
|
||||
#libcc
|
||||
|
||||
@@ -5,6 +5,8 @@
|
||||
/* $Id$ */
|
||||
/* PREPROCESSOR DRIVER */
|
||||
|
||||
#include <stdlib.h>
|
||||
#include <stdio.h>
|
||||
#include <system.h>
|
||||
#include <alloc.h>
|
||||
#include "input.h"
|
||||
@@ -160,57 +162,58 @@ preprocess(fn)
|
||||
while (startline) {
|
||||
/* first flush the saved pragma's */
|
||||
if (pragma_nr) {
|
||||
register int i = 0;
|
||||
int LiNo = LineNumber;
|
||||
char *FiNam = FileName;
|
||||
|
||||
while (i < pragma_nr) {
|
||||
register char *c_ptr = "#pragma";
|
||||
|
||||
LineNumber = pragma_tab[i].pr_linnr;
|
||||
FileName = pragma_tab[i].pr_fil;
|
||||
do_line_dir(lineno, fn);
|
||||
while (*c_ptr) { echo(*c_ptr++); }
|
||||
c_ptr = pragma_tab[i].pr_text;
|
||||
while (*c_ptr) { echo(*c_ptr++); }
|
||||
newline(); lineno++;
|
||||
free(pragma_tab[i].pr_text);
|
||||
i++;
|
||||
}
|
||||
free((char *) pragma_tab);
|
||||
pragma_tab = (struct prag_info *)0;
|
||||
pragma_nr = 0;
|
||||
LineNumber = LiNo;
|
||||
FileName = FiNam;
|
||||
do_line_dir(lineno, fn);
|
||||
register int i = 0;
|
||||
int LiNo = LineNumber;
|
||||
char *FiNam = FileName;
|
||||
|
||||
while (i < pragma_nr) {
|
||||
register char *c_ptr = "#pragma";
|
||||
|
||||
LineNumber = pragma_tab[i].pr_linnr;
|
||||
FileName = pragma_tab[i].pr_fil;
|
||||
do_line_dir(lineno, fn);
|
||||
while (*c_ptr) { echo(*c_ptr++); }
|
||||
c_ptr = pragma_tab[i].pr_text;
|
||||
while (*c_ptr) { echo(*c_ptr++); }
|
||||
newline(); lineno++;
|
||||
free(pragma_tab[i].pr_text);
|
||||
i++;
|
||||
}
|
||||
free((char *) pragma_tab);
|
||||
pragma_tab = (struct prag_info *)0;
|
||||
pragma_nr = 0;
|
||||
LineNumber = LiNo;
|
||||
FileName = FiNam;
|
||||
do_line_dir(lineno, fn);
|
||||
}
|
||||
|
||||
|
||||
while (class(c) == STSKIP || c == '/') {
|
||||
if (c == '/') {
|
||||
if (!InputLevel) {
|
||||
c = GetChar();
|
||||
if (c == '*') {
|
||||
op = SkipComment(op, &lineno);
|
||||
if (!op) return;
|
||||
if (!options['C']) { echo(' '); }
|
||||
c = GetChar();
|
||||
continue;
|
||||
if (c == '/') {
|
||||
if (!InputLevel) {
|
||||
c = GetChar();
|
||||
if (c == '*') {
|
||||
op = SkipComment(op, &lineno);
|
||||
if (!op) return;
|
||||
if (!options['C']) { echo(' '); }
|
||||
c = GetChar();
|
||||
continue;
|
||||
}
|
||||
UnGetChar();
|
||||
c = '/';
|
||||
}
|
||||
break;
|
||||
}
|
||||
UnGetChar();
|
||||
c = '/';
|
||||
}
|
||||
break;
|
||||
}
|
||||
echo(c);
|
||||
c = GetChar();
|
||||
echo(c);
|
||||
c = GetChar();
|
||||
}
|
||||
|
||||
if (c == '#') {
|
||||
domacro();
|
||||
lineno++;
|
||||
newline();
|
||||
c = GetChar();
|
||||
domacro();
|
||||
lineno++;
|
||||
newline();
|
||||
do_line_dir(lineno, fn);
|
||||
c = GetChar();
|
||||
} else startline = 0;
|
||||
}
|
||||
do_line_dir(lineno, fn);
|
||||
|
||||
@@ -17,13 +17,13 @@
|
||||
*
|
||||
*/
|
||||
|
||||
/* Disabled catch handler --- this is the platform's job. dtrg */
|
||||
#undef CATCHHANDLER
|
||||
|
||||
mes 2,_EM_WSIZE,_EM_PSIZE
|
||||
|
||||
exa environ
|
||||
exa _end
|
||||
exa _penvp
|
||||
_penvp
|
||||
bss _EM_PSIZE,0,0
|
||||
|
||||
exp $_m_a_i_n
|
||||
pro $_m_a_i_n,0
|
||||
@@ -31,35 +31,14 @@ _penvp
|
||||
sim ; ignored
|
||||
lal _EM_WSIZE+_EM_PSIZE
|
||||
loi _EM_PSIZE
|
||||
lae _penvp
|
||||
sti _EM_PSIZE
|
||||
/* Now test if environ is our own environ, or some user defined environ.
|
||||
* First test if environ < _end. This is done for separate I&D systems.
|
||||
*/
|
||||
lae environ
|
||||
lae _end
|
||||
cmp
|
||||
zge *1
|
||||
/* Now environ < end, which means that we can derefence it without trouble
|
||||
* on separate I&D systems.
|
||||
*/
|
||||
lae environ
|
||||
loi 2
|
||||
loc 2
|
||||
loc _EM_WSIZE
|
||||
cii
|
||||
loc 21331 /* == 0x5353 */
|
||||
bne *1
|
||||
/* environ contains the magic value. Assume it's our own environ */
|
||||
lae _penvp
|
||||
loi _EM_PSIZE
|
||||
lae environ
|
||||
sti _EM_PSIZE
|
||||
1
|
||||
#ifdef CATCHHANDLER
|
||||
#if __unix && ! (__em22 || __em24 || __em44)
|
||||
lpi $_ctch_
|
||||
sig
|
||||
asp _EM_PSIZE
|
||||
#endif
|
||||
#endif
|
||||
lal _EM_WSIZE+_EM_PSIZE
|
||||
loi _EM_PSIZE
|
||||
@@ -73,6 +52,7 @@ _penvp
|
||||
cal $exit
|
||||
end
|
||||
|
||||
#ifdef CATCHHANDLER
|
||||
#if __unix && ! (__em22 || __em24 || __em44)
|
||||
exp $_ctch_
|
||||
pro $_ctch_,0
|
||||
@@ -87,9 +67,9 @@ _penvp
|
||||
bra *3
|
||||
1
|
||||
loc 8
|
||||
cal $_getpid
|
||||
cal $getpid
|
||||
lfr _EM_WSIZE
|
||||
cal $_kill
|
||||
cal $kill
|
||||
asp 2*_EM_WSIZE
|
||||
3
|
||||
lpi $_ctch_
|
||||
@@ -98,3 +78,4 @@ _penvp
|
||||
rtt
|
||||
end 0
|
||||
#endif
|
||||
#endif
|
||||
|
||||
@@ -1,21 +1,22 @@
|
||||
sys/time.h
|
||||
sys/ioctl.h
|
||||
assert.h
|
||||
ctype.h
|
||||
dirent.h
|
||||
errno.h
|
||||
float.h
|
||||
grp.h
|
||||
limits.h
|
||||
locale.h
|
||||
math.h
|
||||
mathconst.h
|
||||
setjmp.h
|
||||
signal.h
|
||||
stdarg.h
|
||||
stddef.h
|
||||
stdint.h
|
||||
stdio.h
|
||||
stdlib.h
|
||||
string.h
|
||||
time.h
|
||||
varargs.h
|
||||
sys/dirent.h
|
||||
sys/errno.h
|
||||
iso646.h
|
||||
stdbool.h
|
||||
fcntl.h
|
||||
tgmath.h
|
||||
locale.h
|
||||
|
||||
@@ -1,20 +0,0 @@
|
||||
assert.h
|
||||
ctype.h
|
||||
dirent.h
|
||||
errno.h
|
||||
float.h
|
||||
grp.h
|
||||
limits.h
|
||||
locale.h
|
||||
math.h
|
||||
mathconst.h
|
||||
setjmp.h
|
||||
signal.h
|
||||
stdarg.h
|
||||
stddef.h
|
||||
stdio.h
|
||||
stdlib.h
|
||||
string.h
|
||||
time.h
|
||||
sys/dirent.h
|
||||
sys/errno.h
|
||||
@@ -1,2 +0,0 @@
|
||||
clean:
|
||||
rm -f OLIST
|
||||
@@ -6,7 +6,10 @@
|
||||
*/
|
||||
/* $Id$ */
|
||||
|
||||
void __bad_assertion(const char *_mess);
|
||||
#ifndef _ASSERT_H
|
||||
#define _ASSERT_H
|
||||
|
||||
extern void __bad_assertion(const char *_mess);
|
||||
|
||||
#undef assert
|
||||
|
||||
@@ -21,3 +24,5 @@ void __bad_assertion(const char *_mess);
|
||||
"\" failed, file " __xstr(__FILE__) \
|
||||
", line " __xstr(__LINE__) "\n"))
|
||||
#endif /* NDEBUG */
|
||||
|
||||
#endif
|
||||
|
||||
@@ -3,7 +3,7 @@
|
||||
*/
|
||||
/* $Id$ */
|
||||
|
||||
#if !defined(_CTYPE_H)
|
||||
#ifndef _CTYPE_H
|
||||
#define _CTYPE_H
|
||||
|
||||
extern char __ctype[]; /* located in chartab.c */
|
||||
@@ -16,19 +16,19 @@ extern char __ctype[]; /* located in chartab.c */
|
||||
#define _C 0x20 /* this bit is for control characters */
|
||||
#define _X 0x40 /* this bit is for hex digits [a-f] and [A-F]*/
|
||||
|
||||
int isalnum(int _c); /* alphanumeric [a-z], [A-Z], [0-9] */
|
||||
int isalpha(int _c); /* alphabetic */
|
||||
int iscntrl(int _c); /* control characters */
|
||||
int isdigit(int _c); /* digit [0-9] */
|
||||
int isgraph(int _c); /* graphic character */
|
||||
int islower(int _c); /* lower-case letter [a-z] */
|
||||
int isprint(int _c); /* printable character */
|
||||
int ispunct(int _c); /* punctuation mark */
|
||||
int isspace(int _c); /* white space sp, \f, \n, \r, \t, \v */
|
||||
int isupper(int _c); /* upper-case letter [A-Z] */
|
||||
int isxdigit(int _c); /* hex digit [0-9], [a-f], [A-F] */
|
||||
int tolower(int _c); /* convert to lower case character */
|
||||
int toupper(int _c); /* convert to upper case character */
|
||||
extern int isalnum(int _c); /* alphanumeric [a-z], [A-Z], [0-9] */
|
||||
extern int isalpha(int _c); /* alphabetic */
|
||||
extern int iscntrl(int _c); /* control characters */
|
||||
extern int isdigit(int _c); /* digit [0-9] */
|
||||
extern int isgraph(int _c); /* graphic character */
|
||||
extern int islower(int _c); /* lower-case letter [a-z] */
|
||||
extern int isprint(int _c); /* printable character */
|
||||
extern int ispunct(int _c); /* punctuation mark */
|
||||
extern int isspace(int _c); /* white space sp, \f, \n, \r, \t, \v */
|
||||
extern int isupper(int _c); /* upper-case letter [A-Z] */
|
||||
extern int isxdigit(int _c); /* hex digit [0-9], [a-f], [A-F] */
|
||||
extern int tolower(int _c); /* convert to lower case character */
|
||||
extern int toupper(int _c); /* convert to upper case character */
|
||||
|
||||
#define isalpha(c) ((__ctype+1)[c]&(_U|_L))
|
||||
#define isspace(c) ((__ctype+1)[c]&_S)
|
||||
|
||||
@@ -1,34 +0,0 @@
|
||||
/*
|
||||
<dirent.h> -- definitions for SVR3 directory access routines
|
||||
|
||||
last edit: 25-Apr-1987 D A Gwyn
|
||||
|
||||
Prerequisite: <sys/types.h>
|
||||
*/
|
||||
/* $Id$ */
|
||||
|
||||
#if !defined(_DIRENT_H)
|
||||
#define _DIRENT_H
|
||||
#include <sys/dirent.h>
|
||||
|
||||
#define DIRBUF 8192 /* buffer size for fs-indep. dirs */
|
||||
/* must in general be larger than the filesystem buffer size */
|
||||
|
||||
typedef struct
|
||||
{
|
||||
int dd_fd; /* file descriptor */
|
||||
int dd_loc; /* offset in block */
|
||||
int dd_size; /* amount of valid data */
|
||||
char *dd_buf; /* -> directory block */
|
||||
} DIR; /* stream data from opendir() */
|
||||
|
||||
DIR *opendir(const char *_dirname);
|
||||
struct dirent *readdir(DIR *_dirp);
|
||||
void rewinddir(DIR *_dirp);
|
||||
int closedir(DIR *_dirp);
|
||||
off_t telldir(DIR *_dirp);
|
||||
void seekdir(DIR *_dirp, off_t _loc);
|
||||
|
||||
#define NULL ((void *)0) /* DAG -- added for convenience */
|
||||
|
||||
#endif /* _DIRENT_H */
|
||||
@@ -3,18 +3,51 @@
|
||||
*/
|
||||
/* $Id$ */
|
||||
|
||||
#if !defined(_ERRNO_H)
|
||||
#ifndef _ERRNO_H
|
||||
#define _ERRNO_H
|
||||
|
||||
#include <sys/errno.h>
|
||||
/* These values are defined by the ANSI standard. */
|
||||
|
||||
/* The standard requires the next two definitions. If they are also in
|
||||
* <sys/errno.h>, their values should be equal. The <sys/errno.h> supplied
|
||||
* with the compiler doesn't contain them.
|
||||
*/
|
||||
#define EDOM 33 /* math arg out of domain of func */
|
||||
#define ERANGE 34 /* math result not representable */
|
||||
#define EDOM 33
|
||||
#define ERANGE 34
|
||||
#define EILSEQ 88
|
||||
|
||||
extern int errno; /* error number */
|
||||
/* These are not, but most platforms standardise on these numbers, so we
|
||||
* define them here. */
|
||||
|
||||
#define EPERM 1 /* Not owner */
|
||||
#define ENOENT 2 /* No such file or directory */
|
||||
#define ESRCH 3 /* No such process */
|
||||
#define EINTR 4 /* Interrupted system call */
|
||||
#define EIO 5 /* I/O error */
|
||||
#define ENXIO 6 /* No such device or address */
|
||||
#define E2BIG 7 /* Arg list too long */
|
||||
#define ENOEXEC 8 /* Exec format error */
|
||||
#define EBADF 9 /* Bad file number */
|
||||
#define ECHILD 10 /* No children */
|
||||
#define EAGAIN 11 /* No more processes */
|
||||
#define ENOMEM 12 /* Not enough core */
|
||||
#define EACCES 13 /* Permission denied */
|
||||
#define EFAULT 14 /* Bad address */
|
||||
#define ENOTBLK 15 /* Block device required */
|
||||
#define EBUSY 16 /* Mount device busy */
|
||||
#define EEXIST 17 /* File exists */
|
||||
#define EXDEV 18 /* Cross-device link */
|
||||
#define ENODEV 19 /* No such device */
|
||||
#define ENOTDIR 20 /* Not a directory*/
|
||||
#define EISDIR 21 /* Is a directory */
|
||||
#define EINVAL 22 /* Invalid argument */
|
||||
#define ENFILE 23 /* File table overflow */
|
||||
#define EMFILE 24 /* Too many open files */
|
||||
#define ENOTTY 25 /* Not a typewriter */
|
||||
#define ETXTBSY 26 /* Text file busy */
|
||||
#define EFBIG 27 /* File too large */
|
||||
#define ENOSPC 28 /* No space left on device */
|
||||
#define ESPIPE 29 /* Illegal seek */
|
||||
#define EROFS 30 /* Read-only file system */
|
||||
#define EMLINK 31 /* Too many links */
|
||||
#define EPIPE 32 /* Broken pipe */
|
||||
|
||||
extern int errno;
|
||||
|
||||
#endif /* _ERRNO_H */
|
||||
#endif
|
||||
|
||||
11
lang/cem/libcc.ansi/headers/fcntl.h
Normal file
11
lang/cem/libcc.ansi/headers/fcntl.h
Normal file
@@ -0,0 +1,11 @@
|
||||
/*
|
||||
* fcntl.h - file I/O primitives
|
||||
*/
|
||||
/* $Id$ */
|
||||
|
||||
#ifndef _FCNTL_H
|
||||
#define _FCNTL_H
|
||||
|
||||
#include <unistd.h>
|
||||
|
||||
#endif
|
||||
@@ -1,79 +1,43 @@
|
||||
/*
|
||||
* float.h - implementation limits
|
||||
*/
|
||||
/* $Id$ */
|
||||
<float.h> -- simple version used by "gimplify"
|
||||
|
||||
#if !defined(_FLOAT_H)
|
||||
#define _FLOAT_H
|
||||
last edit: 2007-02-12 D A Gwyn
|
||||
*/
|
||||
|
||||
#if defined(__vax) || defined(__pdp)
|
||||
#define FLT_DIG 6
|
||||
#define FLT_EPSILON 5.96046448e-08F
|
||||
#define FLT_MANT_DIG 8
|
||||
#define FLT_MAX 1.70141173e+38F
|
||||
#define FLT_MAX_10_EXP 38
|
||||
#define FLT_MAX_EXP 127
|
||||
#define FLT_MIN 2.93873588e-39F
|
||||
#define FLT_MIN_10_EXP (-38)
|
||||
#define FLT_MIN_EXP (-127)
|
||||
/* Does not exactly fit any model, and is minimal for "universality". */
|
||||
|
||||
#define DBL_DIG 16
|
||||
#define DBL_EPSILON 1.38777878078144568e-17
|
||||
#define DBL_MANT_DIG 8
|
||||
#define DBL_MAX 1.70141183460469229e+38
|
||||
#define DBL_MAX_10_EXP 38
|
||||
#define DBL_MAX_EXP 127
|
||||
#define DBL_MIN 2.93873587705571877e-39
|
||||
#define DBL_MIN_10_EXP (-38)
|
||||
#define DBL_MIN_EXP (-127)
|
||||
#define FLT_ROUNDS (-1)
|
||||
#define FLT_EVAL_METHOD (-1)
|
||||
#define FLT_RADIX 2
|
||||
#define DECIMAL_DIG 10
|
||||
|
||||
#define LDBL_DIG 16
|
||||
#define LDBL_EPSILON 1.38777878078144568e-17L
|
||||
#define LDBL_MANT_DIG 8
|
||||
#define LDBL_MAX 1.70141183460469229e+38L
|
||||
#define LDBL_MAX_10_EXP 38
|
||||
#define LDBL_MAX_EXP 127
|
||||
#define LDBL_MIN 2.93873587705571877e-39L
|
||||
#define LDBL_MIN_10_EXP (-38)
|
||||
#define LDBL_MIN_EXP (-127)
|
||||
/* assumes that "gimplify" specifies "-Dfloat=double" */
|
||||
#define FLT_MANT_DIG 10
|
||||
#define FLT_EPSILON (1E-9F)
|
||||
#define FLT_DIG 10
|
||||
#define FLT_MIN_EXP (-31)
|
||||
#define FLT_MIN (1E-37F)
|
||||
#define FLT_MIN_10_EXP (-37)
|
||||
#define FLT_MAX_EXP 37
|
||||
#define FLT_MAX (1E+37F)
|
||||
#define FLT_MAX_10_EXP 37
|
||||
|
||||
#define FLT_ROUNDS 1
|
||||
#define FLT_RADIX 2
|
||||
#define DBL_MANT_DIG 10
|
||||
#define DBL_EPSILON (1E-9)
|
||||
#define DBL_DIG 10
|
||||
#define DBL_MIN_EXP (-31)
|
||||
#define DBL_MIN (1E-37)
|
||||
#define DBL_MIN_10_EXP (-37)
|
||||
#define DBL_MAX_EXP 37
|
||||
#define DBL_MAX (1E+37)
|
||||
#define DBL_MAX_10_EXP 37
|
||||
|
||||
#else /* IEEE format */
|
||||
#define FLT_DIG 6
|
||||
#define FLT_EPSILON 1.19209290e-07F
|
||||
#define FLT_MANT_DIG 24
|
||||
#define FLT_MAX 3.40282347e+38F
|
||||
#define FLT_MAX_10_EXP 38
|
||||
#define FLT_MAX_EXP 128
|
||||
#define FLT_MIN 1.17549435e-38F
|
||||
#define FLT_MIN_10_EXP (-37)
|
||||
#define FLT_MIN_EXP (-125)
|
||||
|
||||
#define DBL_DIG 15
|
||||
#define DBL_EPSILON 2.2204460492503131e-16
|
||||
#define DBL_MANT_DIG 53
|
||||
#define DBL_MAX 1.7976931348623157e+308
|
||||
#define DBL_MAX_10_EXP 308
|
||||
#define DBL_MAX_EXP 1024
|
||||
#define DBL_MIN 2.2250738585072014e-308
|
||||
#define DBL_MIN_10_EXP (-307)
|
||||
#define DBL_MIN_EXP (-1021)
|
||||
|
||||
#define LDBL_DIG 15
|
||||
#define LDBL_EPSILON 2.2204460492503131e-16L
|
||||
#define LDBL_MANT_DIG 53
|
||||
#define LDBL_MAX 1.7976931348623157e+308L
|
||||
#define LDBL_MAX_10_EXP 308
|
||||
#define LDBL_MAX_EXP 1024
|
||||
#define LDBL_MIN 2.2250738585072014e-308L
|
||||
#define LDBL_MIN_10_EXP (-307)
|
||||
#define LDBL_MIN_EXP (-1021)
|
||||
|
||||
#define FLT_ROUNDS 1
|
||||
#define FLT_RADIX 2
|
||||
|
||||
#endif /* vax, pdp or ieee */
|
||||
|
||||
#endif /* _FLOAT_H */
|
||||
#define LDBL_MANT_DIG 10
|
||||
#define LDBL_EPSILON (1E-9L)
|
||||
#define LDBL_DIG 10
|
||||
#define LDBL_MIN_EXP (-31)
|
||||
#define LDBL_MIN (1E-37L)
|
||||
#define LDBL_MIN_10_EXP (-37)
|
||||
#define LDBL_MAX_EXP 37
|
||||
#define LDBL_MAX (1E+37L)
|
||||
#define LDBL_MAX_10_EXP 37
|
||||
|
||||
@@ -1,21 +0,0 @@
|
||||
/* $Id$ */
|
||||
|
||||
#if !defined(_GRP_H)
|
||||
#define _GRP_H
|
||||
|
||||
struct group { /* see getgrent(3) */
|
||||
char *gr_name;
|
||||
char *gr_passwd;
|
||||
#if defined(_POSIX_SOURCE) && defined(_MINIX)
|
||||
char gr_gid;
|
||||
#else
|
||||
int gr_gid;
|
||||
#endif
|
||||
char **gr_mem;
|
||||
};
|
||||
|
||||
struct group *getgrent(void);
|
||||
struct group *getgrgid(int _gid);
|
||||
struct group *getgrnam(const char *_name);
|
||||
|
||||
#endif /* _GRP_H */
|
||||
21
lang/cem/libcc.ansi/headers/iso646.h
Normal file
21
lang/cem/libcc.ansi/headers/iso646.h
Normal file
@@ -0,0 +1,21 @@
|
||||
/*
|
||||
* limits.h - implementation limits
|
||||
*/
|
||||
/* $Id$ */
|
||||
|
||||
#ifndef _ISO646_H
|
||||
#define _ISO646_H
|
||||
|
||||
#define and &&
|
||||
#define and_eq &=
|
||||
#define bitand &
|
||||
#define bitor |
|
||||
#define compl ~
|
||||
#define not !
|
||||
#define not_eq !=
|
||||
#define or ||
|
||||
#define or_eq |=
|
||||
#define xor ^
|
||||
#define xor_eq ^=
|
||||
|
||||
#endif
|
||||
@@ -3,41 +3,47 @@
|
||||
*/
|
||||
/* $Id$ */
|
||||
|
||||
#if !defined(_LOCALE_H)
|
||||
#define _LOCALE_H
|
||||
#ifndef _LOCALE_H
|
||||
#define _LOCALE_H
|
||||
|
||||
struct lconv {
|
||||
char *decimal_point; /* "." */
|
||||
char *thousands_sep; /* "" */
|
||||
char *grouping; /* "" */
|
||||
char *int_curr_symbol; /* "" */
|
||||
char *currency_symbol; /* "" */
|
||||
char *mon_decimal_point; /* "" */
|
||||
char *mon_thousands_sep; /* "" */
|
||||
char *mon_grouping; /* "" */
|
||||
char *positive_sign; /* "" */
|
||||
char *negative_sign; /* "" */
|
||||
char int_frac_digits; /* CHAR_MAX */
|
||||
char frac_digits; /* CHAR_MAX */
|
||||
char p_cs_precedes; /* CHAR_MAX */
|
||||
char p_sep_by_space; /* CHAR_MAX */
|
||||
char n_cs_precedes; /* CHAR_MAX */
|
||||
char n_sep_by_space; /* CHAR_MAX */
|
||||
char p_sign_posn; /* CHAR_MAX */
|
||||
char n_sign_posn; /* CHAR_MAX */
|
||||
#include <stddef.h>
|
||||
|
||||
struct lconv
|
||||
{
|
||||
char * decimal_point;
|
||||
char * thousands_sep;
|
||||
char * grouping;
|
||||
char * mon_decimal_point;
|
||||
char * mon_thousands_sep;
|
||||
char * mon_grouping;
|
||||
char * positive_sign;
|
||||
char * negative_sign;
|
||||
char * currency_symbol;
|
||||
char frac_digits;
|
||||
char p_cs_precedes;
|
||||
char n_cs_precedes;
|
||||
char p_sep_by_space;
|
||||
char n_sep_by_space;
|
||||
char p_sign_posn;
|
||||
char n_sign_posn;
|
||||
char * int_curr_symbol;
|
||||
char int_frac_digits;
|
||||
char int_p_cs_precedes;
|
||||
char int_n_cs_precedes;
|
||||
char int_p_sep_by_space;
|
||||
char int_n_sep_by_space;
|
||||
char int_p_sign_posn;
|
||||
char int_n_sign_posn;
|
||||
};
|
||||
|
||||
#define NULL ((void *)0)
|
||||
#define LC_ALL 0
|
||||
#define LC_COLLATE 2
|
||||
#define LC_CTYPE 1
|
||||
#define LC_MONETARY 5
|
||||
#define LC_NUMERIC 4
|
||||
#define LC_TIME 3
|
||||
|
||||
#define LC_ALL 1
|
||||
#define LC_COLLATE 2
|
||||
#define LC_CTYPE 3
|
||||
#define LC_MONETARY 4
|
||||
#define LC_NUMERIC 5
|
||||
#define LC_TIME 6
|
||||
extern char* setlocale(int, const char *);
|
||||
extern struct lconv* localeconv(void);
|
||||
|
||||
|
||||
char *setlocale(int _category, const char *_locale);
|
||||
struct lconv *localeconv(void);
|
||||
|
||||
#endif /* _LOCALE_H */
|
||||
#endif
|
||||
|
||||
@@ -3,41 +3,62 @@
|
||||
*/
|
||||
/* $Id$ */
|
||||
|
||||
#if !defined(_MATH_H)
|
||||
#ifndef _MATH_H
|
||||
#define _MATH_H
|
||||
|
||||
double __huge_val(void); /* may be infinity */
|
||||
#define HUGE_VAL (__huge_val())
|
||||
extern double __huge_val;
|
||||
#define HUGE_VAL (__huge_val)
|
||||
|
||||
int __IsNan(double d); /* test for Not A Number */
|
||||
extern int __IsNan(double d); /* test for Not A Number */
|
||||
|
||||
double acos(double _x);
|
||||
double asin(double _x);
|
||||
double atan(double _x);
|
||||
double atan2(double _y, double _x);
|
||||
extern double acos(double _x);
|
||||
extern double asin(double _x);
|
||||
extern double atan(double _x);
|
||||
extern double atan2(double _y, double _x);
|
||||
|
||||
double cos(double _x);
|
||||
double sin(double _x);
|
||||
double tan(double _x);
|
||||
extern double cos(double _x);
|
||||
extern double sin(double _x);
|
||||
extern double tan(double _x);
|
||||
|
||||
double cosh(double _x);
|
||||
double sinh(double _x);
|
||||
double tanh(double _x);
|
||||
extern double cosh(double _x);
|
||||
extern double sinh(double _x);
|
||||
extern double tanh(double _x);
|
||||
|
||||
double exp(double _x);
|
||||
double log(double _x);
|
||||
double log10(double _x);
|
||||
extern double exp(double _x);
|
||||
extern double log(double _x);
|
||||
extern double log10(double _x);
|
||||
|
||||
double sqrt(double _x);
|
||||
double ceil(double _x);
|
||||
double fabs(double _x);
|
||||
double floor(double _x);
|
||||
extern double sqrt(double _x);
|
||||
extern double ceil(double _x);
|
||||
extern double fabs(double _x);
|
||||
extern double floor(double _x);
|
||||
|
||||
double pow(double _x, double _y);
|
||||
extern double pow(double _x, double _y);
|
||||
|
||||
double frexp(double _x, int *_exp);
|
||||
double ldexp(double _x, int _exp);
|
||||
double modf(double _x, double *_iptr);
|
||||
double fmod(double _x, double _y);
|
||||
extern double frexp(double _x, int *_exp);
|
||||
extern double ldexp(double _x, int _exp);
|
||||
extern double modf(double _x, double *_iptr);
|
||||
extern double fmod(double _x, double _y);
|
||||
|
||||
/* Some constants (Hart & Cheney). */
|
||||
|
||||
#define M_PI 3.14159265358979323846264338327950288
|
||||
#define M_2PI 6.28318530717958647692528676655900576
|
||||
#define M_3PI_4 2.35619449019234492884698253745962716
|
||||
#define M_PI_2 1.57079632679489661923132169163975144
|
||||
#define M_3PI_8 1.17809724509617246442349126872981358
|
||||
#define M_PI_4 0.78539816339744830961566084581987572
|
||||
#define M_PI_8 0.39269908169872415480783042290993786
|
||||
#define M_1_PI 0.31830988618379067153776752674502872
|
||||
#define M_2_PI 0.63661977236758134307553505349005744
|
||||
#define M_4_PI 1.27323954473516268615107010698011488
|
||||
#define M_E 2.71828182845904523536028747135266250
|
||||
#define M_LOG2E 1.44269504088896340735992468100189213
|
||||
#define M_LOG10E 0.43429448190325182765112891891660508
|
||||
#define M_LN2 0.69314718055994530941723212145817657
|
||||
#define M_LN10 2.30258509299404568401799145468436421
|
||||
#define M_SQRT2 1.41421356237309504880168872420969808
|
||||
#define M_1_SQRT2 0.70710678118654752440084436210484904
|
||||
#define M_EULER 0.57721566490153286060651209008240243
|
||||
|
||||
#endif /* _MATH_H */
|
||||
|
||||
@@ -1,29 +0,0 @@
|
||||
/*
|
||||
* mathconst.h - mathematic constants
|
||||
*/
|
||||
/* $Id$ */
|
||||
|
||||
#if !defined(_MATHCONST_H)
|
||||
#define _MATHCONST_H
|
||||
|
||||
/* some constants (Hart & Cheney) */
|
||||
#define M_PI 3.14159265358979323846264338327950288
|
||||
#define M_2PI 6.28318530717958647692528676655900576
|
||||
#define M_3PI_4 2.35619449019234492884698253745962716
|
||||
#define M_PI_2 1.57079632679489661923132169163975144
|
||||
#define M_3PI_8 1.17809724509617246442349126872981358
|
||||
#define M_PI_4 0.78539816339744830961566084581987572
|
||||
#define M_PI_8 0.39269908169872415480783042290993786
|
||||
#define M_1_PI 0.31830988618379067153776752674502872
|
||||
#define M_2_PI 0.63661977236758134307553505349005744
|
||||
#define M_4_PI 1.27323954473516268615107010698011488
|
||||
#define M_E 2.71828182845904523536028747135266250
|
||||
#define M_LOG2E 1.44269504088896340735992468100189213
|
||||
#define M_LOG10E 0.43429448190325182765112891891660508
|
||||
#define M_LN2 0.69314718055994530941723212145817657
|
||||
#define M_LN10 2.30258509299404568401799145468436421
|
||||
#define M_SQRT2 1.41421356237309504880168872420969808
|
||||
#define M_1_SQRT2 0.70710678118654752440084436210484904
|
||||
#define M_EULER 0.57721566490153286060651209008240243
|
||||
|
||||
#endif /* _MATHCONST_H */
|
||||
@@ -25,15 +25,9 @@ typedef struct {
|
||||
void *__lb;
|
||||
} jmp_buf[1];
|
||||
|
||||
int __setjmp(jmp_buf _env, int _savemask);
|
||||
extern int __setjmp(jmp_buf _env, int _savemask);
|
||||
|
||||
#define setjmp(env) __setjmp(env, 0)
|
||||
void longjmp(jmp_buf _env, int _val);
|
||||
|
||||
#if defined(_POSIX_SOURCE)
|
||||
typedef jmp_buf sigjmp_buf;
|
||||
#define sigsetjmp(env, savemask) __setjmp(env, savemask)
|
||||
int siglongjmp(sigjmp_buf _env, int _val);
|
||||
#endif
|
||||
extern void longjmp(jmp_buf _env, int _val);
|
||||
|
||||
#endif /* _SETJMP_H */
|
||||
|
||||
@@ -6,92 +6,9 @@
|
||||
*/
|
||||
/* $Id$ */
|
||||
|
||||
#if !defined(_SIGNAL_H)
|
||||
#define _SIGNAL_H
|
||||
#ifndef _SIGNAL_H
|
||||
#define _SIGNAL_H
|
||||
|
||||
typedef int sig_atomic_t;
|
||||
#include <unistd.h>
|
||||
|
||||
#if defined(_POSIX_SOURCE)
|
||||
#if defined(_MINIX)
|
||||
typedef unsigned short sigset_t;
|
||||
|
||||
#define SIG_BLOCK 0 /* for blocking signals */
|
||||
#define SIG_UNBLOCK 1 /* for unblocking signals */
|
||||
#define SIG_SETMASK 2 /* for setting the signal mask */
|
||||
|
||||
struct sigaction {
|
||||
void (*sa_handler)(int);/* SIG_DFL, SIG_IGN or pointer to function */
|
||||
sigset_t sa_mask; /* signals blocked during handling */
|
||||
int sa_flags; /* special flags */
|
||||
};
|
||||
#endif
|
||||
#endif
|
||||
|
||||
#define SIG_ERR ((void (*)(int))-1)
|
||||
#if defined(__em22) || defined(__em24) || defined(__em44)
|
||||
#define SIG_DFL ((void (*)(int))-2)
|
||||
#define SIG_IGN ((void (*)(int))-3)
|
||||
#else
|
||||
#define SIG_DFL ((void (*)(int))0)
|
||||
#define SIG_IGN ((void (*)(int))1)
|
||||
#endif /* no interpretation */
|
||||
|
||||
#define SIGHUP 1 /* hangup */
|
||||
#define SIGINT 2 /* interrupt */
|
||||
#define SIGQUIT 3 /* quit */
|
||||
#define SIGILL 4 /* illegal instruction (not reset when caught) */
|
||||
#define SIGTRAP 5 /* trace trap (not reset when caught) */
|
||||
#define SIGIOT 6 /* IOT instruction */
|
||||
#define SIGABRT 6 /* ANSI abort trap */
|
||||
#define SIGEMT 7 /* EMT instruction */
|
||||
#define SIGFPE 8 /* floating point exception */
|
||||
#define SIGKILL 9 /* kill (cannot be caught or ignored) */
|
||||
#define SIGBUS 10 /* bus error */
|
||||
#define SIGSEGV 11 /* segmentation violation */
|
||||
#define SIGSYS 12 /* bad argument to system call */
|
||||
#define SIGPIPE 13 /* write on a pipe with no one to read it */
|
||||
#define SIGALRM 14 /* alarm clock */
|
||||
#define SIGTERM 15 /* software termination signal from kill */
|
||||
#if defined(__USG)
|
||||
#define SIGUSR1 16 /* user defined signal 1 */
|
||||
#define SIGUSR2 17 /* user defined signal 2 */
|
||||
#define SIGCLD 18 /* death of a child */
|
||||
#define SIGPWR 19 /* power-fail signal */
|
||||
#define _NSIG 20
|
||||
#elif defined(__BSD4_2)
|
||||
#define SIGURG 16 /* urgent condition */
|
||||
#define SIGSTOP 17 /* stop signal not from tty */
|
||||
#define SIGTSTP 18 /* stop signal from tty */
|
||||
#define SIGCONT 19 /* continue a stopped process */
|
||||
#define SIGCHLD 20 /* death of a child */
|
||||
#define SIGCLD 20 /* System V compat. */
|
||||
#define SIGTTIN 21 /* background tty read */
|
||||
#define SIGTTOU 22 /* background tty write */
|
||||
#define SIGIO 23 /* I/O possible signal */
|
||||
#define SIGPOLL SIGIO /* System V compat. */
|
||||
#define SIGXCPU 24 /* exceeded CPU time limit */
|
||||
#define SIGXFSZ 25 /* exceeded file size limit */
|
||||
#define SIGVTALRM 26 /* virtual time alarm */
|
||||
#define SIGPROF 27 /* profiling time alarm */
|
||||
#define SIGWINCH 28 /* window has changed */
|
||||
#define SIGLOST 29 /* resource lost */
|
||||
#define SIGUSR1 30 /* user defined signal 1 */
|
||||
#define SIGUSR2 31 /* user defined signal 2 */
|
||||
#define _NSIG 32
|
||||
#elif defined(_MINIX)
|
||||
/* The following signals are defined but not supported */
|
||||
#define SIGCHLD 17 /* child process terminated or stopped */
|
||||
#define SIGCONT 18 /* continue if stopped */
|
||||
#define SIGSTOP 19 /* stop signal */
|
||||
#define SIGTSTP 20 /* interactive stop signal */
|
||||
#define SIGTTIN 21 /* background process wants to read */
|
||||
#define SIGTTOU 22 /* background process wants to write */
|
||||
#define _NSIG 16
|
||||
#else
|
||||
#define _NSIG 16
|
||||
#endif /* __USG or __BSD4_2 */
|
||||
|
||||
void (*signal(int _sig, void (*_func)(int)))(int);
|
||||
int raise(int _sig);
|
||||
|
||||
#endif /* _SIGNAL_H */
|
||||
|
||||
@@ -6,10 +6,10 @@
|
||||
*/
|
||||
/* $Id$ */
|
||||
|
||||
#if !defined(_STDARG_H)
|
||||
#ifndef _STDARG_H
|
||||
#define _STDARG_H
|
||||
|
||||
typedef char *va_list;
|
||||
typedef char* va_list;
|
||||
|
||||
#define __vasz(x) ((sizeof(x)+sizeof(int)-1) & ~(sizeof(int) -1))
|
||||
|
||||
@@ -17,4 +17,4 @@ typedef char *va_list;
|
||||
#define va_arg(ap, type) (*((type *)(void *)((ap += __vasz(type)) - __vasz(type))))
|
||||
#define va_end(ap)
|
||||
|
||||
#endif /* _STDARG_H */
|
||||
#endif
|
||||
|
||||
18
lang/cem/libcc.ansi/headers/stdbool.h
Normal file
18
lang/cem/libcc.ansi/headers/stdbool.h
Normal file
@@ -0,0 +1,18 @@
|
||||
/*
|
||||
* stdarg.h - variable arguments
|
||||
*
|
||||
* (c) copyright 1987 by the Vrije Universiteit, Amsterdam, The Netherlands.
|
||||
* See the copyright notice in the ACK home directory, in the file "Copyright".
|
||||
*/
|
||||
/* $Id$ */
|
||||
|
||||
#ifndef _STDBOOL_H
|
||||
#define _STDBOOL_H
|
||||
|
||||
typedef int bool;
|
||||
|
||||
#define bool int
|
||||
#define true 1
|
||||
#define false 0
|
||||
|
||||
#endif
|
||||
@@ -6,29 +6,16 @@
|
||||
*/
|
||||
/* $Id$ */
|
||||
|
||||
#if !defined(_STDDEF_H)
|
||||
#ifndef _STDDEF_H
|
||||
#define _STDDEF_H
|
||||
|
||||
#define NULL ((void *)0)
|
||||
#include <stdint.h>
|
||||
|
||||
#define NULL 0
|
||||
|
||||
#define offsetof(type, ident) ((size_t) (unsigned long) &((type *)0)->ident)
|
||||
|
||||
#if _EM_PSIZE == _EM_WSIZE
|
||||
typedef int ptrdiff_t; /* result of substracting two pointers */
|
||||
#elif _EM_PSIZE == _EM_LSIZE
|
||||
typedef long ptrdiff_t; /* result of substracting two pointers */
|
||||
#else
|
||||
#error garbage pointer size
|
||||
#endif /* _EM_PSIZE */
|
||||
typedef char wchar_t; /* type of a wide character */
|
||||
typedef long off_t; /* type of a position offset */
|
||||
|
||||
#if !defined(_SIZE_T)
|
||||
#define _SIZE_T
|
||||
typedef unsigned int size_t; /* type returned by sizeof */
|
||||
#endif /* _SIZE_T */
|
||||
|
||||
#if !defined(_WCHAR_T)
|
||||
#define _WCHAR_T
|
||||
typedef char wchar_t; /* type expanded character set */
|
||||
#endif /* _WCHAR_T */
|
||||
|
||||
#endif /* _STDDEF_H */
|
||||
#endif
|
||||
|
||||
80
lang/cem/libcc.ansi/headers/stdint.h
Normal file
80
lang/cem/libcc.ansi/headers/stdint.h
Normal file
@@ -0,0 +1,80 @@
|
||||
/*
|
||||
* stdint.h - standard types
|
||||
*/
|
||||
/* $Id$ */
|
||||
|
||||
#ifndef _STDINT_H
|
||||
#define _STDINT_H
|
||||
|
||||
/* int8_t is always a char, on all ACK platforms. */
|
||||
|
||||
typedef signed char int8_t;
|
||||
typedef unsigned char uint8_t;
|
||||
#define INT8_MAX 127
|
||||
#define INT8_MIN (-128)
|
||||
#define UINT8_MAX 255
|
||||
|
||||
/* int16_t is always a short, on all ACK platforms. */
|
||||
|
||||
typedef signed short int16_t;
|
||||
typedef unsigned short uint16_t;
|
||||
#define INT16_MAX 32767
|
||||
#define INT16_MIN (-32768)
|
||||
#define UINT16_MAX 65535
|
||||
|
||||
/* int32_t is either a int or a long. */
|
||||
|
||||
#if _EM_WSIZE == 4
|
||||
typedef signed int int32_t;
|
||||
typedef unsigned short uint32_t;
|
||||
#else
|
||||
typedef signed long int32_t;
|
||||
typedef unsigned long uint32_t;
|
||||
#endif
|
||||
#define INT32_MAX 2147483647
|
||||
#define INT32_MIN (-2147483648)
|
||||
#define UINT32_MAX 4294967295
|
||||
|
||||
/* We only get int64_t if longs are 8 bytes. */
|
||||
|
||||
#if _EM_LSIZE == 8
|
||||
typedef signed long int64_t;
|
||||
typedef unsigned long uint64_t;
|
||||
#define INT64_MAX 2147483647LL
|
||||
#define INT64_MIN (-2147483648LL)
|
||||
#define UINT64_MAX 4294967295ULL
|
||||
|
||||
typedef int64_t intmax_t;
|
||||
typedef uint64_t uintmax_t;
|
||||
#else
|
||||
typedef int32_t intmax_t;
|
||||
typedef uint32_t uintmax_t;
|
||||
#endif
|
||||
|
||||
/* Pointers can be either 16 or 32 bits. */
|
||||
|
||||
#if _EM_PSIZE == 2
|
||||
typedef int16_t intptr_t;
|
||||
typedef uint16_t uintptr_t;
|
||||
typedef int16_t ptrdiff_t;
|
||||
typedef uint16_t size_t;
|
||||
#define INTPTR_MAX 32767
|
||||
#define INTPTR_MIN (-32768)
|
||||
#define UINTPTR_MAX 65535
|
||||
#else
|
||||
typedef int32_t intptr_t;
|
||||
typedef uint32_t uintptr_t;
|
||||
typedef int32_t ptrdiff_t;
|
||||
typedef uint32_t size_t;
|
||||
#define INTPTR_MAX 2147483647
|
||||
#define INTPTR_MIN (-2147483647)
|
||||
#define UINTPTR_MAX 4294967295
|
||||
#endif
|
||||
|
||||
/* Now those have been defined, these are always the same. */
|
||||
|
||||
#define PTRDIFF_MAX INTPTR_MAX
|
||||
#define PTRDIFF_MIN INTPTR_MIN
|
||||
#define SIZE_MAX UINTPTR_MAX
|
||||
|
||||
#endif
|
||||
@@ -6,9 +6,11 @@
|
||||
*/
|
||||
/* $Id$ */
|
||||
|
||||
#if !defined(_STDIO_H)
|
||||
#ifndef _STDIO_H
|
||||
#define _STDIO_H
|
||||
|
||||
#include <stddef.h>
|
||||
|
||||
/*
|
||||
* Focus point of all stdio activity.
|
||||
*/
|
||||
@@ -33,86 +35,72 @@ typedef struct __iobuf {
|
||||
#define _IOWRITING 0x100
|
||||
#define _IOAPPEND 0x200
|
||||
|
||||
/* The following definitions are also in <unistd.h>. They should not
|
||||
* conflict.
|
||||
*/
|
||||
#define SEEK_SET 0
|
||||
#define SEEK_CUR 1
|
||||
#define SEEK_END 2
|
||||
#define SEEK_SET 0
|
||||
#define SEEK_CUR 1
|
||||
#define SEEK_END 2
|
||||
|
||||
#define stdin (&__stdin)
|
||||
#define stdout (&__stdout)
|
||||
#define stderr (&__stderr)
|
||||
#define stdin (&__stdin)
|
||||
#define stdout (&__stdout)
|
||||
#define stderr (&__stderr)
|
||||
|
||||
#define BUFSIZ 1024
|
||||
#define NULL ((void *)0)
|
||||
#define EOF (-1)
|
||||
#define BUFSIZ 1024
|
||||
#define EOF (-1)
|
||||
|
||||
#define FOPEN_MAX 20
|
||||
|
||||
#if defined(__BSD4_2)
|
||||
#define FILENAME_MAX 255
|
||||
#else
|
||||
#define FILENAME_MAX 14
|
||||
#endif /* __BSD4_2 */
|
||||
#define TMP_MAX 999
|
||||
#define L_tmpnam (sizeof("/tmp/") + 15)
|
||||
#define FILENAME_MAX 255
|
||||
#define TMP_MAX 999
|
||||
#define L_tmpnam (sizeof("/tmp/") + 15)
|
||||
|
||||
typedef long int fpos_t;
|
||||
|
||||
#if !defined(_SIZE_T)
|
||||
#define _SIZE_T
|
||||
typedef unsigned int size_t; /* type returned by sizeof */
|
||||
#endif /* _SIZE_T */
|
||||
typedef long int fpos_t;
|
||||
|
||||
extern FILE *__iotab[FOPEN_MAX];
|
||||
extern FILE __stdin, __stdout, __stderr;
|
||||
|
||||
int remove(const char *_filename);
|
||||
int rename(const char *_old, const char *_new);
|
||||
FILE *tmpfile(void);
|
||||
char *tmpnam(char *_s);
|
||||
int fclose(FILE *_stream);
|
||||
int fflush(FILE *_stream);
|
||||
FILE *fopen(const char *_filename, const char *_mode);
|
||||
FILE *freopen(const char *_filename, const char *_mode, FILE *_stream);
|
||||
void setbuf(FILE *_stream, char *_buf);
|
||||
int setvbuf(FILE *_stream, char *_buf, int _mode, size_t _size);
|
||||
int fprintf(FILE *_stream, const char *_format, ...);
|
||||
int fscanf(FILE *_stream, const char *_format, ...);
|
||||
int printf(const char *_format, ...);
|
||||
int scanf(const char *_format, ...);
|
||||
int sprintf(char *_s, const char *_format, ...);
|
||||
int sscanf(const char *_s, const char *_format, ...);
|
||||
int vfprintf(FILE *_stream, const char *_format, char *_arg);
|
||||
int vprintf(const char *_format, char *_arg);
|
||||
int vsprintf(char *_s, const char *_format, char *_arg);
|
||||
int fgetc(FILE *_stream);
|
||||
char *fgets(char *_s, int _n, FILE *_stream);
|
||||
int fputc(int _c, FILE *_stream);
|
||||
int fputs(const char *_s, FILE *_stream);
|
||||
int getc(FILE *_stream);
|
||||
int getchar(void);
|
||||
char *gets(char *_s);
|
||||
int putc(int _c, FILE *_stream);
|
||||
int putchar(int _c);
|
||||
int puts(const char *_s);
|
||||
int ungetc(int _c, FILE *_stream);
|
||||
size_t fread(void *_ptr, size_t _size, size_t _nmemb, FILE *_stream);
|
||||
size_t fwrite(const void *_ptr, size_t _size, size_t _nmemb, FILE *_stream);
|
||||
int fgetpos(FILE *_stream, fpos_t *_pos);
|
||||
int fseek(FILE *_stream, long _offset, int _whence);
|
||||
int fsetpos(FILE *_stream, fpos_t *_pos);
|
||||
long ftell(FILE *_stream);
|
||||
void rewind(FILE *_stream);
|
||||
void clearerr(FILE *_stream);
|
||||
int feof(FILE *_stream);
|
||||
int ferror(FILE *_stream);
|
||||
void perror(const char *_s);
|
||||
|
||||
int __fillbuf(FILE *_stream);
|
||||
int __flushbuf(int _c, FILE *_stream);
|
||||
extern int remove(const char *_filename);
|
||||
extern int rename(const char *_old, const char *_new);
|
||||
extern FILE *tmpfile(void);
|
||||
extern char *tmpnam(char *_s);
|
||||
extern int fclose(FILE *_stream);
|
||||
extern int fflush(FILE *_stream);
|
||||
extern FILE *fopen(const char *_filename, const char *_mode);
|
||||
extern FILE *freopen(const char *_filename, const char *_mode, FILE *_stream);
|
||||
extern void setbuf(FILE *_stream, char *_buf);
|
||||
extern int setvbuf(FILE *_stream, char *_buf, int _mode, size_t _size);
|
||||
extern int fprintf(FILE *_stream, const char *_format, ...);
|
||||
extern int fscanf(FILE *_stream, const char *_format, ...);
|
||||
extern int printf(const char *_format, ...);
|
||||
extern int scanf(const char *_format, ...);
|
||||
extern int sprintf(char *_s, const char *_format, ...);
|
||||
extern int sscanf(const char *_s, const char *_format, ...);
|
||||
extern int vfprintf(FILE *_stream, const char *_format, char *_arg);
|
||||
extern int vprintf(const char *_format, char *_arg);
|
||||
extern int vsprintf(char *_s, const char *_format, char *_arg);
|
||||
extern int fgetc(FILE *_stream);
|
||||
extern char *fgets(char *_s, int _n, FILE *_stream);
|
||||
extern int fputc(int _c, FILE *_stream);
|
||||
extern int fputs(const char *_s, FILE *_stream);
|
||||
extern int getc(FILE *_stream);
|
||||
extern int getchar(void);
|
||||
extern char *gets(char *_s);
|
||||
extern int putc(int _c, FILE *_stream);
|
||||
extern int putchar(int _c);
|
||||
extern int puts(const char *_s);
|
||||
extern int ungetc(int _c, FILE *_stream);
|
||||
extern size_t fread(void *_ptr, size_t _size, size_t _nmemb, FILE *_stream);
|
||||
extern size_t fwrite(const void *_ptr, size_t _size, size_t _nmemb, FILE *_stream);
|
||||
extern int fgetpos(FILE *_stream, fpos_t *_pos);
|
||||
extern int fseek(FILE *_stream, long _offset, int _whence);
|
||||
extern int fsetpos(FILE *_stream, fpos_t *_pos);
|
||||
extern long ftell(FILE *_stream);
|
||||
extern void rewind(FILE *_stream);
|
||||
extern void clearerr(FILE *_stream);
|
||||
extern int feof(FILE *_stream);
|
||||
extern int ferror(FILE *_stream);
|
||||
extern void perror(const char *_s);
|
||||
|
||||
extern int __fillbuf(FILE *_stream);
|
||||
extern int __flushbuf(int _c, FILE *_stream);
|
||||
|
||||
#define getchar() getc(stdin)
|
||||
#define putchar(c) putc(c,stdout)
|
||||
@@ -126,10 +114,10 @@ int __flushbuf(int _c, FILE *_stream);
|
||||
#define ferror(p) (((p)->_flags & _IOERR) != 0)
|
||||
#define clearerr(p) ((p)->_flags &= ~(_IOERR|_IOEOF))
|
||||
|
||||
#if defined(__BSD4_2) || defined(__USG) || defined(_POSIX_SOURCE)
|
||||
int fileno(FILE *_stream);
|
||||
FILE *fdopen(int fildes, const char *type);
|
||||
#define fileno(stream) ((stream)->_fd)
|
||||
#endif /* __BSD4_2 || __USG || _POSIX_SOURCE */
|
||||
/* Non-standard extensions */
|
||||
|
||||
extern int fileno(FILE *_stream);
|
||||
extern FILE* fdopen(int fildes, const char *type);
|
||||
#define fileno(stream) ((stream)->_fd)
|
||||
|
||||
#endif /* _STDIO_H */
|
||||
|
||||
@@ -6,59 +6,58 @@
|
||||
*/
|
||||
/* $Id$ */
|
||||
|
||||
#if !defined(_STDLIB_H)
|
||||
#ifndef _STDLIB_H
|
||||
#define _STDLIB_H
|
||||
|
||||
#define NULL ((void *)0)
|
||||
#include <stddef.h>
|
||||
|
||||
#define EXIT_FAILURE 1
|
||||
#define EXIT_SUCCESS 0
|
||||
#define RAND_MAX 32767
|
||||
#define MB_CUR_MAX 1
|
||||
#define EXIT_FAILURE 1
|
||||
#define EXIT_SUCCESS 0
|
||||
#define RAND_MAX 32767
|
||||
#define MB_CUR_MAX sizeof(wchar_t)
|
||||
|
||||
typedef struct { int quot, rem; } div_t;
|
||||
typedef struct { long quot, rem; } ldiv_t;
|
||||
|
||||
#if !defined(_SIZE_T)
|
||||
#define _SIZE_T
|
||||
typedef unsigned int size_t; /* type returned by sizeof */
|
||||
#endif /* _SIZE_T */
|
||||
|
||||
#if !defined(_WCHAR_T)
|
||||
#define _WCHAR_T
|
||||
typedef char wchar_t;
|
||||
#endif /* _WCHAR_T */
|
||||
|
||||
double atof(const char *_nptr);
|
||||
int atoi(const char *_nptr);
|
||||
long atol(const char *_nptr);
|
||||
double strtod(const char *_nptr, char **_endptr);
|
||||
long strtol(const char *_nptr, char **_endptr, int _base);
|
||||
unsigned long int strtoul(const char *_nptr, char **_endptr, int _base);
|
||||
int rand(void);
|
||||
void srand(unsigned int _seed);
|
||||
void *calloc(size_t _nmemb, size_t _size);
|
||||
void free(void *_ptr);
|
||||
void *malloc(size_t _size);
|
||||
void *realloc(void *_ptr, size_t _size);
|
||||
void abort(void);
|
||||
int atexit(void (*_func)(void));
|
||||
void exit(int _status);
|
||||
char *getenv(const char *_name);
|
||||
int system(const char *_string);
|
||||
void *bsearch(const void *_key, const void *_base,
|
||||
extern double atof(const char *_nptr);
|
||||
extern int atoi(const char *_nptr);
|
||||
extern long atol(const char *_nptr);
|
||||
extern double strtod(const char *_nptr, char **_endptr);
|
||||
extern long strtol(const char *_nptr, char **_endptr, int _base);
|
||||
extern unsigned long strtoul(const char *_nptr, char **_endptr, int _base);
|
||||
extern int rand(void);
|
||||
extern void srand(unsigned int _seed);
|
||||
extern void* calloc(size_t _nmemb, size_t _size);
|
||||
extern void free(void *_ptr);
|
||||
extern void* malloc(size_t _size);
|
||||
extern void* realloc(void *_ptr, size_t _size);
|
||||
extern void abort(void);
|
||||
extern int atexit(void (*_func)(void));
|
||||
extern void exit(int _status);
|
||||
extern void _Exit(int _status);
|
||||
extern char* getenv(const char *_name);
|
||||
extern int system(const char *_string);
|
||||
extern void* bsearch(const void *_key, const void *_base,
|
||||
size_t _nmemb, size_t _size,
|
||||
int (*_compar)(const void *, const void *));
|
||||
void qsort(void *_base, size_t _nmemb, size_t _size,
|
||||
extern void qsort(void *_base, size_t _nmemb, size_t _size,
|
||||
int (*_compar)(const void *, const void *));
|
||||
int abs(int _j);
|
||||
div_t div(int _numer, int _denom);
|
||||
long labs(long _j);
|
||||
ldiv_t ldiv(long _numer, long _denom);
|
||||
int mblen(const char *_s, size_t _n);
|
||||
int mbtowc(wchar_t *_pwc, const char *_s, size_t _n);
|
||||
int wctomb(char *_s, wchar_t _wchar);
|
||||
size_t mbstowcs(wchar_t *_pwcs, const char *_s, size_t _n);
|
||||
size_t wcstombs(char *_s, const wchar_t *_pwcs, size_t _n);
|
||||
extern int abs(int _j);
|
||||
extern div_t div(int _numer, int _denom);
|
||||
extern long labs(long _j);
|
||||
extern ldiv_t ldiv(long _numer, long _denom);
|
||||
extern int mblen(const char *_s, size_t _n);
|
||||
extern int mbtowc(wchar_t *_pwc, const char *_s, size_t _n);
|
||||
extern int wctomb(char *_s, wchar_t _wchar);
|
||||
extern size_t mbstowcs(wchar_t *_pwcs, const char *_s, size_t _n);
|
||||
extern size_t wcstombs(char *_s, const wchar_t *_pwcs, size_t _n);
|
||||
|
||||
#endif /* _STDLIB_H */
|
||||
/* Extensions (not part of the standard) */
|
||||
|
||||
#define atof(n) strtod(n, (char **)NULL)
|
||||
#define atoi(n) ((int)strtol(n, (char **)NULL, 10))
|
||||
#define atol(n) strtol(n, (char **)NULL, 10)
|
||||
#define atoll(n) strtoll(n, (char **)NULL, 10)
|
||||
#define mblen(s, n) mbtowc((wchar_t *)0, s, n)
|
||||
|
||||
#endif
|
||||
|
||||
@@ -6,37 +6,32 @@
|
||||
*/
|
||||
/* $Id$ */
|
||||
|
||||
#if !defined(_STRING_H)
|
||||
#ifndef _STRING_H
|
||||
#define _STRING_H
|
||||
|
||||
#define NULL ((void *)0)
|
||||
#include <stddef.h>
|
||||
|
||||
#if !defined(_SIZE_T)
|
||||
#define _SIZE_T
|
||||
typedef unsigned int size_t; /* type returned by sizeof */
|
||||
#endif /* _SIZE_T */
|
||||
extern void *memcpy(void *_s1, const void *_s2, size_t _n);
|
||||
extern void *memmove(void *_s1, const void *_s2, size_t _n);
|
||||
extern char *strcpy(char *_s1, const char *_s2);
|
||||
extern char *strncpy(char *_s1, const char *_s2, size_t _n);
|
||||
extern char *strcat(char *_s1, const char *_s2);
|
||||
extern char *strncat(char *_s1, const char *_s2, size_t _n);
|
||||
extern int memcmp(const void *_s1, const void *_s2, size_t _n);
|
||||
extern int strcmp(const char *_s1, const char *_s2);
|
||||
extern int strcoll(const char *_s1, const char *_s2);
|
||||
extern int strncmp(const char *_s1, const char *_s2, size_t _n);
|
||||
extern size_t strxfrm(char *_s1, const char *_s2, size_t _n);
|
||||
extern void *memchr(const void *_s, int _c, size_t _n);
|
||||
extern char *strchr(const char *_s, int _c);
|
||||
extern size_t strcspn(const char *_s1, const char *_s2);
|
||||
extern char *strpbrk(const char *_s1, const char *_s2);
|
||||
extern char *strrchr(const char *_s, int _c);
|
||||
extern size_t strspn(const char *_s1, const char *_s2);
|
||||
extern char *strstr(const char *_s1, const char *_s2);
|
||||
extern char *strtok(char *_s1, const char *_s2);
|
||||
extern void *memset(void *_s, int _c, size_t _n);
|
||||
extern char *strerror(int _errnum);
|
||||
extern size_t strlen(const char *_s);
|
||||
|
||||
void *memcpy(void *_s1, const void *_s2, size_t _n);
|
||||
void *memmove(void *_s1, const void *_s2, size_t _n);
|
||||
char *strcpy(char *_s1, const char *_s2);
|
||||
char *strncpy(char *_s1, const char *_s2, size_t _n);
|
||||
char *strcat(char *_s1, const char *_s2);
|
||||
char *strncat(char *_s1, const char *_s2, size_t _n);
|
||||
int memcmp(const void *_s1, const void *_s2, size_t _n);
|
||||
int strcmp(const char *_s1, const char *_s2);
|
||||
int strcoll(const char *_s1, const char *_s2);
|
||||
int strncmp(const char *_s1, const char *_s2, size_t _n);
|
||||
size_t strxfrm(char *_s1, const char *_s2, size_t _n);
|
||||
void *memchr(const void *_s, int _c, size_t _n);
|
||||
char *strchr(const char *_s, int _c);
|
||||
size_t strcspn(const char *_s1, const char *_s2);
|
||||
char *strpbrk(const char *_s1, const char *_s2);
|
||||
char *strrchr(const char *_s, int _c);
|
||||
size_t strspn(const char *_s1, const char *_s2);
|
||||
char *strstr(const char *_s1, const char *_s2);
|
||||
char *strtok(char *_s1, const char *_s2);
|
||||
void *memset(void *_s, int _c, size_t _n);
|
||||
char *strerror(int _errnum);
|
||||
size_t strlen(const char *_s);
|
||||
|
||||
#endif /* _STRING_H */
|
||||
#endif
|
||||
|
||||
@@ -1,35 +0,0 @@
|
||||
/*
|
||||
<sys/dirent.h> -- file system independent directory entry (SVR3)
|
||||
|
||||
last edit: 25-Apr-1987 D A Gwyn
|
||||
|
||||
prerequisite: <sys/types.h>
|
||||
*/
|
||||
/* $Id$ */
|
||||
|
||||
#if !defined(_SYS_DIRENT_H)
|
||||
#define _SYS_DIRENT_H
|
||||
|
||||
struct dirent /* data from getdents()/readdir() */
|
||||
{
|
||||
long d_ino; /* inode number of entry */
|
||||
off_t d_off; /* offset of disk directory entry */
|
||||
unsigned short d_reclen; /* length of this record */
|
||||
char d_name[1]; /* name of file */ /* non-POSIX */
|
||||
};
|
||||
|
||||
/* The following nonportable ugliness could have been avoided by defining
|
||||
DIRENTSIZ and DIRENTBASESIZ to also have (struct dirent *) arguments. */
|
||||
#define DIRENTBASESIZ (((struct dirent *)0)->d_name \
|
||||
- (char *)&((struct dirent *)0)->d_ino)
|
||||
#define DIRENTSIZ( namlen ) ((DIRENTBASESIZ + sizeof(long) + (namlen)) \
|
||||
/ sizeof(long) * sizeof(long))
|
||||
|
||||
/* DAG -- the following was moved from <dirent.h>, which was the wrong place */
|
||||
#define MAXNAMLEN 512 /* maximum filename length */
|
||||
|
||||
#if !defined(NAME_MAX)
|
||||
#define NAME_MAX (MAXNAMLEN - 1) /* DAG -- added for POSIX */
|
||||
#endif
|
||||
|
||||
#endif /* _SYS_DIRENT_H */
|
||||
@@ -1,144 +0,0 @@
|
||||
/*
|
||||
* sys/errno.h - error numbers
|
||||
*/
|
||||
/* $Id$ */
|
||||
|
||||
#if !defined(_SYS_ERRNO_H)
|
||||
#define _SYS_ERRNO_H
|
||||
|
||||
#define EPERM 1 /* Not owner */
|
||||
#define ENOENT 2 /* No such file or directory */
|
||||
#define ESRCH 3 /* No such process */
|
||||
#define EINTR 4 /* Interrupted system call */
|
||||
#define EIO 5 /* I/O error */
|
||||
#define ENXIO 6 /* No such device or address */
|
||||
#define E2BIG 7 /* Arg list too long */
|
||||
#define ENOEXEC 8 /* Exec format error */
|
||||
#define EBADF 9 /* Bad file number */
|
||||
#define ECHILD 10 /* No children */
|
||||
#define EAGAIN 11 /* No more processes */
|
||||
#define ENOMEM 12 /* Not enough core */
|
||||
#define EACCES 13 /* Permission denied */
|
||||
#define EFAULT 14 /* Bad address */
|
||||
#define ENOTBLK 15 /* Block device required */
|
||||
#define EBUSY 16 /* Mount device busy */
|
||||
#define EEXIST 17 /* File exists */
|
||||
#define EXDEV 18 /* Cross-device link */
|
||||
#define ENODEV 19 /* No such device */
|
||||
#define ENOTDIR 20 /* Not a directory*/
|
||||
#define EISDIR 21 /* Is a directory */
|
||||
#define EINVAL 22 /* Invalid argument */
|
||||
#define ENFILE 23 /* File table overflow */
|
||||
#define EMFILE 24 /* Too many open files */
|
||||
#define ENOTTY 25 /* Not a typewriter */
|
||||
#define ETXTBSY 26 /* Text file busy */
|
||||
#define EFBIG 27 /* File too large */
|
||||
#define ENOSPC 28 /* No space left on device */
|
||||
#define ESPIPE 29 /* Illegal seek */
|
||||
#define EROFS 30 /* Read-only file system */
|
||||
#define EMLINK 31 /* Too many links */
|
||||
#define EPIPE 32 /* Broken pipe */
|
||||
|
||||
#if defined(__USG)
|
||||
/* Only ENOMSG, EIDRM and EDEADLK are documented */
|
||||
#define ENOMSG 35 /* No message of desired type */
|
||||
#define EIDRM 36 /* Identifier Removed */
|
||||
#define ECHRNG 37 /* Channel number out of range */
|
||||
#define EL2NSYNC 38 /* Level 2 not synchronized */
|
||||
#define EL3HLT 39 /* Level 3 halted */
|
||||
#define EL3RST 40 /* Level 3 reset */
|
||||
#define ELNRNG 41 /* Link number out of range */
|
||||
#define EUNATCH 42 /* Protocol driver not attached */
|
||||
#define ENOCSI 43 /* No CSI structure available */
|
||||
#define EL2HLT 44 /* Level 2 halted */
|
||||
#define EDEADLK 45 /* DeadLock */
|
||||
#endif /* __USG */
|
||||
|
||||
#if defined(__BSD4_2)
|
||||
/* non-blocking and interrupt i/o */
|
||||
#define EWOULDBLOCK 35 /* Operation would block */
|
||||
#define EINPROGRESS 36 /* Operation now in progress */
|
||||
#define EALREADY 37 /* Operation already in progress */
|
||||
/* ipc/network software */
|
||||
|
||||
/* argument errors */
|
||||
#define ENOTSOCK 38 /* Socket operation on non-socket */
|
||||
#define EDESTADDRREQ 39 /* Destination address required */
|
||||
#define EMSGSIZE 40 /* Message too long */
|
||||
#define EPROTOTYPE 41 /* Protocol wrong type for socket */
|
||||
#define ENOPROTOOPT 42 /* Protocol not available */
|
||||
#define EPROTONOSUPPORT 43 /* Protocol not supported */
|
||||
#define ESOCKTNOSUPPORT 44 /* Socket type not supported */
|
||||
#define EOPNOTSUPP 45 /* Operation not supported on socket */
|
||||
#define EPFNOSUPPORT 46 /* Protocol family not supported */
|
||||
#define EAFNOSUPPORT 47 /* Address family not supported by protocol family */
|
||||
#define EADDRINUSE 48 /* Address already in use */
|
||||
#define EADDRNOTAVAIL 49 /* Can't assign requested address */
|
||||
|
||||
/* operational errors */
|
||||
#define ENETDOWN 50 /* Network is down */
|
||||
#define ENETUNREACH 51 /* Network is unreachable */
|
||||
#define ENETRESET 52 /* Network dropped connection on reset */
|
||||
#define ECONNABORTED 53 /* Software caused connection abort */
|
||||
#define ECONNRESET 54 /* Connection reset by peer */
|
||||
#define ENOBUFS 55 /* No buffer space available */
|
||||
#define EISCONN 56 /* Socket is already connected */
|
||||
#define ENOTCONN 57 /* Socket is not connected */
|
||||
#define ESHUTDOWN 58 /* Can't send after socket shutdown */
|
||||
/* ETOOMANYREFS is not documented */
|
||||
#define ETOOMANYREFS 59 /* Too many references: can't splice */
|
||||
#define ETIMEDOUT 60 /* Connection timed out */
|
||||
#define ECONNREFUSED 61 /* Connection refused */
|
||||
|
||||
/* */
|
||||
#define ELOOP 62 /* Too many levels of symbolic links */
|
||||
#define ENAMETOOLONG 63 /* File name too long */
|
||||
|
||||
/* In BSD4.2, ENOTEMPTY is defined as 64. */
|
||||
/* Just use BSD4.3 & Sun UNIX 4.2 definitions */
|
||||
#define EHOSTDOWN 64 /* Host is down */
|
||||
#define EHOSTUNREACH 65 /* No route to host */
|
||||
#define ENOTEMPTY 66 /* Directory not empty */
|
||||
|
||||
/* quotas & mush */
|
||||
/* EPROCLIM and EUSERS are not documented */
|
||||
#define EPROCLIM 67 /* Too many processes */
|
||||
#define EUSERS 68 /* Too many users */
|
||||
#define EDQUOT 69 /* Disc quota exceeded */
|
||||
|
||||
/* Network File System */
|
||||
#define ESTALE 70 /* Stale NFS file handle */
|
||||
#define EREMOTE 71 /* Too many levels of remote in path */
|
||||
|
||||
/* streams */
|
||||
/* only ENOMSG is documented */
|
||||
#define ENOSTR 72 /* Device is not a stream */
|
||||
#define ETIME 73 /* Timer expired */
|
||||
#define ENOSR 74 /* Out of streams resources */
|
||||
#define ENOMSG 75 /* No message of desired type */
|
||||
#define EBADMSG 76 /* Trying to read unreadable message */
|
||||
|
||||
#define EIDRM 77 /* Identifier removed */
|
||||
|
||||
/* SystemV Record Locking */
|
||||
#define EDEADLK 78 /* Deadlock condition. */
|
||||
#define ENOLCK 79 /* No record locks available. */
|
||||
|
||||
#endif /* __BSD4_2 */
|
||||
|
||||
#if defined(_POSIX_SOURCE)
|
||||
#if defined(_MINIX)
|
||||
#define EDEADLK 35 /* resource deadlock avoided */
|
||||
#define ENAMETOOLONG 36 /* file name too long */
|
||||
#define ENOLCK 37 /* no locks available */
|
||||
#define ENOSYS 38 /* function not implemented */
|
||||
#define ENOTEMPTY 39 /* directory not empty */
|
||||
|
||||
#define ELOCKED 101 /* can't send message */
|
||||
#define EBADCALL 102 /* error on send/recieve */
|
||||
#define ELONGSTRING 103 /* string too long */
|
||||
#endif
|
||||
/* Room for other POSIX implementations */
|
||||
#endif
|
||||
|
||||
#endif /* _SYS_ERRNO_H */
|
||||
11
lang/cem/libcc.ansi/headers/sys/ioctl.h
Normal file
11
lang/cem/libcc.ansi/headers/sys/ioctl.h
Normal file
@@ -0,0 +1,11 @@
|
||||
/* $Source$
|
||||
* $State$
|
||||
* $Revision$
|
||||
*/
|
||||
|
||||
#ifndef _SYS_IOCTL_H
|
||||
#define _SYS_IOCTL_H
|
||||
|
||||
#include <unistd.h>
|
||||
|
||||
#endif
|
||||
12
lang/cem/libcc.ansi/headers/sys/time.h
Normal file
12
lang/cem/libcc.ansi/headers/sys/time.h
Normal file
@@ -0,0 +1,12 @@
|
||||
/* $Source$
|
||||
* $State$
|
||||
* $Revision$
|
||||
*/
|
||||
|
||||
#ifndef _SYS_TIME_H
|
||||
#define _SYS_TIME_H
|
||||
|
||||
#include <time.h>
|
||||
#include <unistd.h>
|
||||
|
||||
#endif
|
||||
11
lang/cem/libcc.ansi/headers/tgmath.h
Normal file
11
lang/cem/libcc.ansi/headers/tgmath.h
Normal file
@@ -0,0 +1,11 @@
|
||||
/*
|
||||
<tgmath.h> -- simple version used by "gimplify"
|
||||
|
||||
last edit: 2007-02-12 D A Gwyn
|
||||
*/
|
||||
|
||||
/* XXX -- Can't be done right without compiler support; it *may* suffice to
|
||||
use automatic coercion to type double with the <math.h> prototypes. */
|
||||
|
||||
#include <math.h>
|
||||
#include <complex.h>
|
||||
@@ -3,28 +3,15 @@
|
||||
*/
|
||||
/* $Id$ */
|
||||
|
||||
#if !defined(_TIME_H)
|
||||
#ifndef _TIME_H
|
||||
#define _TIME_H
|
||||
|
||||
#define NULL ((void *)0)
|
||||
#include <stddef.h>
|
||||
|
||||
#if defined(__BSD4_2)
|
||||
#define CLOCKS_PER_SEC 1000000 /* ticks per second */
|
||||
#else
|
||||
#define CLOCKS_PER_SEC 60
|
||||
#endif /* __BSD4_2 */
|
||||
#define CLOCKS_PER_SEC 1000000
|
||||
|
||||
#if !defined(_SIZE_T)
|
||||
#define _SIZE_T
|
||||
typedef unsigned int size_t; /* type returned by sizeof */
|
||||
#endif /* _SIZE_T */
|
||||
|
||||
#if !defined(_TIME_T)
|
||||
#define _TIME_T
|
||||
typedef unsigned long time_t; /* type returned by TOD clock */
|
||||
#endif /* _TIME_T */
|
||||
|
||||
typedef unsigned long clock_t; /* type returned by real time clock */
|
||||
typedef unsigned long time_t; /* type returned by TOD clock */
|
||||
typedef unsigned long clock_t; /* type returned by real time clock */
|
||||
|
||||
struct tm {
|
||||
int tm_sec; /* seconds after the minute - [0, 59] */
|
||||
@@ -38,27 +25,20 @@ struct tm {
|
||||
int tm_isdst; /* Daylight Saving Time flag */
|
||||
};
|
||||
|
||||
clock_t clock(void);
|
||||
double difftime(time_t _time1, time_t _time0);
|
||||
time_t mktime(struct tm *_timeptr);
|
||||
time_t time(time_t *_timeptr);
|
||||
char *asctime(const struct tm *_timeptr);
|
||||
char *ctime(const time_t *_timer);
|
||||
struct tm *gmtime(const time_t *_timer);
|
||||
struct tm *localtime(const time_t *_timer);
|
||||
size_t strftime(char *_s, size_t _maxsize,
|
||||
extern clock_t clock(void);
|
||||
extern double difftime(time_t _time1, time_t _time0);
|
||||
extern time_t mktime(struct tm *_timeptr);
|
||||
extern time_t time(time_t *_timeptr);
|
||||
extern char* asctime(const struct tm *_timeptr);
|
||||
extern char* ctime(const time_t *_timer);
|
||||
extern struct tm* gmtime(const time_t *_timer);
|
||||
extern struct tm* localtime(const time_t *_timer);
|
||||
extern size_t strftime(char *_s, size_t _maxsize,
|
||||
const char *_format,
|
||||
const struct tm *_timeptr);
|
||||
|
||||
#if defined(__USG) || defined(_POSIX_SOURCE)
|
||||
/* Extensions not in the standard */
|
||||
|
||||
void tzset(void);
|
||||
#define ctime(t) asctime(localtime(t))
|
||||
|
||||
#if defined(__USG)
|
||||
extern long timezone;
|
||||
extern int daylight;
|
||||
extern char *tzname[2];
|
||||
#endif
|
||||
#endif /* __USG || _POSIX_SOURCE */
|
||||
|
||||
#endif /* _TIME_H */
|
||||
|
||||
@@ -1,12 +0,0 @@
|
||||
/*
|
||||
* (c) copyright 1987 by the Vrije Universiteit, Amsterdam, The Netherlands.
|
||||
* See the copyright notice in the ACK home directory, in the file "Copyright".
|
||||
*/
|
||||
/* $Id$ */
|
||||
|
||||
typedef char *va_list;
|
||||
# define __va_sz(mode) (((sizeof(mode) + sizeof(int) - 1) / sizeof(int)) * sizeof(int))
|
||||
# define va_dcl int va_alist;
|
||||
# define va_start(list) (list = (char *) &va_alist)
|
||||
# define va_end(list)
|
||||
# define va_arg(list,mode) (*((mode *)((list += __va_sz(mode)) - __va_sz(mode))))
|
||||
@@ -5,10 +5,7 @@
|
||||
* Author: Hans van Eck
|
||||
*/
|
||||
/* $Id$ */
|
||||
#include <math.h>
|
||||
|
||||
double
|
||||
__huge_val(void)
|
||||
{
|
||||
return 1.0e+1000; /* This will generate a warning */
|
||||
}
|
||||
#include <math.h>
|
||||
|
||||
double __huge_val = 1.0e+1000; /* This will generate a warning */
|
||||
|
||||
@@ -3,26 +3,6 @@
|
||||
*/
|
||||
/* $Id$ */
|
||||
|
||||
/* some constants (Hart & Cheney) */
|
||||
#define M_PI 3.14159265358979323846264338327950288
|
||||
#define M_2PI 6.28318530717958647692528676655900576
|
||||
#define M_3PI_4 2.35619449019234492884698253745962716
|
||||
#define M_PI_2 1.57079632679489661923132169163975144
|
||||
#define M_3PI_8 1.17809724509617246442349126872981358
|
||||
#define M_PI_4 0.78539816339744830961566084581987572
|
||||
#define M_PI_8 0.39269908169872415480783042290993786
|
||||
#define M_1_PI 0.31830988618379067153776752674502872
|
||||
#define M_2_PI 0.63661977236758134307553505349005744
|
||||
#define M_4_PI 1.27323954473516268615107010698011488
|
||||
#define M_E 2.71828182845904523536028747135266250
|
||||
#define M_LOG2E 1.44269504088896340735992468100189213
|
||||
#define M_LOG10E 0.43429448190325182765112891891660508
|
||||
#define M_LN2 0.69314718055994530941723212145817657
|
||||
#define M_LN10 2.30258509299404568401799145468436421
|
||||
#define M_SQRT2 1.41421356237309504880168872420969808
|
||||
#define M_1_SQRT2 0.70710678118654752440084436210484904
|
||||
#define M_EULER 0.57721566490153286060651209008240243
|
||||
|
||||
/* macros for constructing polynomials */
|
||||
#define POLYNOM1(x, a) ((a)[1]*(x)+(a)[0])
|
||||
#define POLYNOM2(x, a) (POLYNOM1((x),(a)+1)*(x)+(a)[0])
|
||||
@@ -38,5 +18,18 @@
|
||||
#define POLYNOM12(x, a) (POLYNOM11((x),(a)+1)*(x)+(a)[0])
|
||||
#define POLYNOM13(x, a) (POLYNOM12((x),(a)+1)*(x)+(a)[0])
|
||||
|
||||
#define M_LN_MAX_D (M_LN2 * DBL_MAX_EXP)
|
||||
#define M_LN_MIN_D (M_LN2 * (DBL_MIN_EXP - 1))
|
||||
/* These are set up for 64-bit doubles. */
|
||||
|
||||
#ifndef M_MAX_D
|
||||
#define M_MAX_D 1.7976931348623157e+308
|
||||
#define M_MIN_D 2.2250738585072014e-308
|
||||
#define M_DEXPLEN 11
|
||||
#endif
|
||||
#define M_DMAXEXP ((1 << (M_DEXPLEN - 1)) - 1)
|
||||
#define M_DMINEXP (-M_DMAXEXP)
|
||||
#define M_LN_MAX_D (M_LN2 * M_DMAXEXP)
|
||||
#define M_LN_MIN_D (M_LN2 * (M_DMINEXP - 1))
|
||||
|
||||
#define HUGE M_MAX_D
|
||||
#define MAXDOUBLE M_MAX_D
|
||||
|
||||
|
||||
@@ -1,22 +1 @@
|
||||
closedir.c
|
||||
fdopen.c
|
||||
getdents.c
|
||||
getgrent.c
|
||||
getopt.c
|
||||
getpass.c
|
||||
getpw.c
|
||||
getw.c
|
||||
isatty.c
|
||||
opendir.c
|
||||
popen.c
|
||||
putenv.c
|
||||
environ.c
|
||||
putw.c
|
||||
readdir.c
|
||||
rewinddir.c
|
||||
seekdir.c
|
||||
sleep.c
|
||||
telldir.c
|
||||
termcap.c
|
||||
mktemp.c
|
||||
hypot.c
|
||||
|
||||
@@ -2,19 +2,9 @@
|
||||
* environ.c - define the variable environ
|
||||
*/
|
||||
/* $Id$ */
|
||||
/*
|
||||
* This file defines the variable environ and initializes it with a magic
|
||||
* value. The C run-time start-off routine tests whether the variable
|
||||
* environ is initialized with this value. If it is not, it is assumed
|
||||
* that it is defined by the user. Only two bytes are tested, since we
|
||||
* don't know the endian-ness and alignment restrictions of the machine.
|
||||
* This means that the low-order two-bytes should be equal to the
|
||||
* high-order two-bytes on machines with four-byte pointers. In fact, all
|
||||
* the bytes in the pointer are the same, just in case.
|
||||
*/
|
||||
|
||||
#if _EM_PSIZE==2
|
||||
char **environ = (char **) 0x5353;
|
||||
#else
|
||||
char **environ = (char **) 0x53535353;
|
||||
#endif
|
||||
#include <unistd.h>
|
||||
|
||||
/* Contains storage for the environ variable. */
|
||||
|
||||
char** environ;
|
||||
|
||||
@@ -3,11 +3,12 @@
|
||||
*/
|
||||
/* $Id$ */
|
||||
|
||||
#include <stdlib.h>
|
||||
#include <signal.h>
|
||||
#include <string.h>
|
||||
#include <sgtty.h>
|
||||
#include <fcntl.h>
|
||||
|
||||
#define O_RDONLY 0
|
||||
int _open(const char *path, int flags);
|
||||
int _write(int d, const char *buf, int nbytes);
|
||||
int _read(int d, char *buf, int nbytes);
|
||||
|
||||
@@ -6,13 +6,13 @@ local d = ROOTDIR.."lang/cem/libcc.ansi/"
|
||||
local crt = ackfile {
|
||||
ACKINCLUDES = {PARENT, "%ROOTDIR%h"},
|
||||
file (d.."head_ac.e"),
|
||||
install = pm.install("%BINDIR%%PLATIND%/%PLATFORM%/head_ac")
|
||||
install = pm.install("%BINDIR%%PLATIND%/%PLATFORM%/c-ansi.o")
|
||||
}
|
||||
|
||||
local libc = acklibrary {
|
||||
ACKBUILDFLAGS = {PARENT, "-ansi"},
|
||||
ACKINCLUDES = {PARENT, "%ROOTDIR%h", d.."headers"},
|
||||
outputs = {"%U%/tail_ac.a"},
|
||||
outputs = {"%U%/libc.a"},
|
||||
|
||||
-- assert
|
||||
|
||||
@@ -85,6 +85,8 @@ local libc = acklibrary {
|
||||
|
||||
-- misc
|
||||
|
||||
ackfile (d.."misc/environ.c"),
|
||||
--[[
|
||||
ackfile (d.."misc/getgrent.c"),
|
||||
ackfile (d.."misc/getopt.c"),
|
||||
ackfile (d.."misc/getpass.c"),
|
||||
@@ -110,11 +112,12 @@ local libc = acklibrary {
|
||||
ackfile (d.."misc/isatty.c"),
|
||||
ackfile (d.."misc/mktemp.c"),
|
||||
ackfile (d.."misc/hypot.c"),
|
||||
--]]
|
||||
|
||||
-- setjmp
|
||||
|
||||
ackfile (d.."setjmp/setjmp.e"),
|
||||
ackfile (d.."setjmp/sigmisc.c"),
|
||||
--ackfile (d.."setjmp/sigmisc.c"),
|
||||
|
||||
-- signal
|
||||
|
||||
@@ -124,8 +127,8 @@ local libc = acklibrary {
|
||||
|
||||
ackfile (d.."stdio/tmpfile.c"),
|
||||
ackfile (d.."stdio/tmpnam.c"),
|
||||
ackfile (d.."stdio/rename.c"),
|
||||
ackfile (d.."stdio/remove.c"),
|
||||
-- ackfile (d.."stdio/rename.c"),
|
||||
-- ackfile (d.."stdio/remove.c"),
|
||||
ackfile (d.."stdio/fopen.c"),
|
||||
ackfile (d.."stdio/freopen.c"),
|
||||
ackfile (d.."stdio/setbuf.c"),
|
||||
@@ -171,7 +174,7 @@ local libc = acklibrary {
|
||||
ackfile (d.."stdio/fclose.c"),
|
||||
ackfile (d.."stdio/flushbuf.c"),
|
||||
ackfile (d.."stdio/fflush.c"),
|
||||
ackfile (d.."stdio/isatty.c"),
|
||||
-- ackfile (d.."stdio/isatty.c"),
|
||||
ackfile (d.."stdio/data.c"),
|
||||
|
||||
-- stdlib
|
||||
@@ -195,7 +198,7 @@ local libc = acklibrary {
|
||||
ackfile (d.."stdlib/rand.c"),
|
||||
ackfile (d.."stdlib/strtod.c"),
|
||||
ackfile (d.."stdlib/strtol.c"),
|
||||
ackfile (d.."stdlib/system.c"),
|
||||
-- ackfile (d.."stdlib/system.c"),
|
||||
ackfile (d.."stdlib/wcstombs.c"),
|
||||
ackfile (d.."stdlib/wctomb.c"),
|
||||
ackfile (d.."stdlib/ext_comp.c"),
|
||||
@@ -260,32 +263,33 @@ local libc = acklibrary {
|
||||
ackfile (d.."time/misc.c"),
|
||||
|
||||
install = {
|
||||
pm.install("%BINDIR%%PLATIND%/%PLATFORM%/tail_ac")
|
||||
pm.install("%BINDIR%%PLATIND%/%PLATFORM%/libc.a")
|
||||
}
|
||||
}
|
||||
|
||||
local headers = group {
|
||||
install = {
|
||||
pm.install(d.."headers/assert.h", "%BINDIR%include/ansi/assert.h"),
|
||||
pm.install(d.."headers/ctype.h", "%BINDIR%include/ansi/ctype.h"),
|
||||
pm.install(d.."headers/dirent.h", "%BINDIR%include/ansi/dirent.h"),
|
||||
pm.install(d.."headers/errno.h", "%BINDIR%include/ansi/errno.h"),
|
||||
pm.install(d.."headers/float.h", "%BINDIR%include/ansi/float.h"),
|
||||
pm.install(d.."headers/grp.h", "%BINDIR%include/ansi/grp.h"),
|
||||
pm.install(d.."headers/limits.h", "%BINDIR%include/ansi/limits.h"),
|
||||
pm.install(d.."headers/locale.h", "%BINDIR%include/ansi/locale.h"),
|
||||
pm.install(d.."headers/math.h", "%BINDIR%include/ansi/math.h"),
|
||||
pm.install(d.."headers/mathconst.h", "%BINDIR%include/ansi/mathconst.h"),
|
||||
pm.install(d.."headers/setjmp.h", "%BINDIR%include/ansi/setjmp.h"),
|
||||
pm.install(d.."headers/signal.h", "%BINDIR%include/ansi/signal.h"),
|
||||
pm.install(d.."headers/stdarg.h", "%BINDIR%include/ansi/stdarg.h"),
|
||||
pm.install(d.."headers/stddef.h", "%BINDIR%include/ansi/stddef.h"),
|
||||
pm.install(d.."headers/stdio.h", "%BINDIR%include/ansi/stdio.h"),
|
||||
pm.install(d.."headers/stdlib.h", "%BINDIR%include/ansi/stdlib.h"),
|
||||
pm.install(d.."headers/string.h", "%BINDIR%include/ansi/string.h"),
|
||||
pm.install(d.."headers/time.h", "%BINDIR%include/ansi/time.h"),
|
||||
pm.install(d.."headers/sys/dirent.h", "%BINDIR%include/ansi/sys/dirent.h"),
|
||||
pm.install(d.."headers/sys/errno.h", "%BINDIR%include/ansi/sys/errno.h"),
|
||||
pm.install(d.."headers/sys/time.h", "%BINDIR%include/ansi/sys/time.h"),
|
||||
pm.install(d.."headers/sys/ioctl.h", "%BINDIR%include/ansi/sys/ioctl.h"),
|
||||
pm.install(d.."headers/assert.h", "%BINDIR%include/ansi/assert.h"),
|
||||
pm.install(d.."headers/ctype.h", "%BINDIR%include/ansi/ctype.h"),
|
||||
pm.install(d.."headers/errno.h", "%BINDIR%include/ansi/errno.h"),
|
||||
pm.install(d.."headers/float.h", "%BINDIR%include/ansi/float.h"),
|
||||
pm.install(d.."headers/limits.h", "%BINDIR%include/ansi/limits.h"),
|
||||
pm.install(d.."headers/math.h", "%BINDIR%include/ansi/math.h"),
|
||||
pm.install(d.."headers/setjmp.h", "%BINDIR%include/ansi/setjmp.h"),
|
||||
pm.install(d.."headers/signal.h", "%BINDIR%include/ansi/signal.h"),
|
||||
pm.install(d.."headers/stdarg.h", "%BINDIR%include/ansi/stdarg.h"),
|
||||
pm.install(d.."headers/stddef.h", "%BINDIR%include/ansi/stddef.h"),
|
||||
pm.install(d.."headers/stdint.h", "%BINDIR%include/ansi/stdint.h"),
|
||||
pm.install(d.."headers/stdio.h", "%BINDIR%include/ansi/stdio.h"),
|
||||
pm.install(d.."headers/stdlib.h", "%BINDIR%include/ansi/stdlib.h"),
|
||||
pm.install(d.."headers/string.h", "%BINDIR%include/ansi/string.h"),
|
||||
pm.install(d.."headers/time.h", "%BINDIR%include/ansi/time.h"),
|
||||
pm.install(d.."headers/iso646.h", "%BINDIR%include/ansi/iso646.h"),
|
||||
pm.install(d.."headers/stdbool.h", "%BINDIR%include/ansi/stdbool.h"),
|
||||
pm.install(d.."headers/locale.h", "%BINDIR%include/ansi/locale.h"),
|
||||
pm.install(d.."headers/tgmath.h", "%BINDIR%include/ansi/tgmath.h"),
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
@@ -1,2 +1 @@
|
||||
setjmp.e
|
||||
sigmisc.c
|
||||
|
||||
@@ -29,15 +29,12 @@ getc.c
|
||||
getchar.c
|
||||
gets.c
|
||||
icompute.c
|
||||
isatty.c
|
||||
loc_incl.h
|
||||
perror.c
|
||||
printf.c
|
||||
putc.c
|
||||
putchar.c
|
||||
puts.c
|
||||
remove.c
|
||||
rename.c
|
||||
rewind.c
|
||||
scanf.c
|
||||
setbuf.c
|
||||
|
||||
@@ -232,7 +232,7 @@ _doprnt(register const char *fmt, va_list ap, FILE *stream)
|
||||
case 'c':
|
||||
*s++ = va_arg(ap, int);
|
||||
break;
|
||||
#ifndef NOFLOAT
|
||||
#ifndef ACKCONF_NO_STDIO_FLOAT
|
||||
case 'G':
|
||||
case 'g':
|
||||
if ((flags & FL_PRECSPEC) && (precision == 0))
|
||||
@@ -249,7 +249,7 @@ _doprnt(register const char *fmt, va_list ap, FILE *stream)
|
||||
flags |= FL_SIGNEDCONV;
|
||||
s = _f_print(&ap, flags, s, c, precision);
|
||||
break;
|
||||
#endif /* NOFLOAT */
|
||||
#endif /* ACKCONF_NO_STDIO_FLOAT */
|
||||
case 'r':
|
||||
ap = va_arg(ap, va_list);
|
||||
fmt = va_arg(ap, char *);
|
||||
|
||||
@@ -88,7 +88,7 @@ o_collect(register int c, register FILE *stream, char type,
|
||||
return bufp - 1;
|
||||
}
|
||||
|
||||
#ifndef NOFLOAT
|
||||
#ifndef ACKCONF_NO_STDIO_FLOAT
|
||||
/* The function f_collect() reads a string that has the format of a
|
||||
* floating-point number. The function returns as soon as a format-error
|
||||
* is encountered, leaving the offending character in the input. This means
|
||||
@@ -158,7 +158,7 @@ f_collect(register int c, register FILE *stream, register int width)
|
||||
*bufp = '\0';
|
||||
return bufp - 1;
|
||||
}
|
||||
#endif /* NOFLOAT */
|
||||
#endif /* ACKCONF_NO_STDIO_FLOAT */
|
||||
|
||||
|
||||
/*
|
||||
@@ -180,7 +180,7 @@ _doscan(register FILE *stream, const char *format, va_list ap)
|
||||
int reverse; /* reverse the checking in [...] */
|
||||
int kind;
|
||||
register int ic; /* the input character */
|
||||
#ifndef NOFLOAT
|
||||
#ifndef ACKCONF_NO_STDIO_FLOAT
|
||||
long double ld_val;
|
||||
#endif
|
||||
|
||||
@@ -406,7 +406,7 @@ _doscan(register FILE *stream, const char *format, va_list ap)
|
||||
*str = '\0';
|
||||
}
|
||||
break;
|
||||
#ifndef NOFLOAT
|
||||
#ifndef ACKCONF_NO_STDIO_FLOAT
|
||||
case 'e':
|
||||
case 'E':
|
||||
case 'f':
|
||||
|
||||
@@ -1,6 +1,8 @@
|
||||
/* $Id$ */
|
||||
|
||||
#ifndef NOFLOAT
|
||||
#include "loc_incl.h"
|
||||
|
||||
#ifndef ACKCONF_NO_STDIO_FLOAT
|
||||
|
||||
#include "../stdlib/ext_fmt.h"
|
||||
void _dbl_ext_cvt(double value, struct EXTEND *e);
|
||||
@@ -28,4 +30,4 @@ _fcvt(long double value, int ndigit, int *decpt, int *sign)
|
||||
return cvt(value, ndigit, decpt, sign, 0);
|
||||
}
|
||||
|
||||
#endif /* NOFLOAT */
|
||||
#endif /* ACKCONF_NO_STDIO_FLOAT */
|
||||
|
||||
@@ -3,11 +3,10 @@
|
||||
*/
|
||||
/* $Id$ */
|
||||
|
||||
#include <stdio.h>
|
||||
#include <stdlib.h>
|
||||
#include "loc_incl.h"
|
||||
|
||||
int _close(int d);
|
||||
#include <stdlib.h>
|
||||
#include <stdio.h>
|
||||
#include <unistd.h>
|
||||
#include "loc_incl.h"
|
||||
|
||||
int
|
||||
fclose(FILE *fp)
|
||||
@@ -22,7 +21,7 @@ fclose(FILE *fp)
|
||||
if (i >= FOPEN_MAX)
|
||||
return EOF;
|
||||
if (fflush(fp)) retval = EOF;
|
||||
if (_close(fileno(fp))) retval = EOF;
|
||||
if (close(fileno(fp))) retval = EOF;
|
||||
if ( io_testflag(fp,_IOMYBUF) && fp->_buf )
|
||||
free((void *)fp->_buf);
|
||||
if (fp != stdin && fp != stdout && fp != stderr)
|
||||
|
||||
@@ -3,12 +3,10 @@
|
||||
*/
|
||||
/* $Id$ */
|
||||
|
||||
#include <sys/types.h>
|
||||
#include <stdio.h>
|
||||
#include "loc_incl.h"
|
||||
|
||||
int _write(int d, const char *buf, int nbytes);
|
||||
off_t _lseek(int fildes, off_t offset, int whence);
|
||||
#include <stdlib.h>
|
||||
#include <stdio.h>
|
||||
#include <unistd.h>
|
||||
#include "loc_incl.h"
|
||||
|
||||
int
|
||||
fflush(FILE *stream)
|
||||
@@ -32,7 +30,7 @@ fflush(FILE *stream)
|
||||
if (stream->_buf && !io_testflag(stream,_IONBF))
|
||||
adjust = stream->_count;
|
||||
stream->_count = 0;
|
||||
_lseek(fileno(stream), (off_t) adjust, SEEK_CUR);
|
||||
lseek(fileno(stream), (off_t) adjust, SEEK_CUR);
|
||||
if (io_testflag(stream, _IOWRITE))
|
||||
stream->_flags &= ~(_IOREADING | _IOWRITING);
|
||||
stream->_ptr = stream->_buf;
|
||||
@@ -49,12 +47,12 @@ fflush(FILE *stream)
|
||||
return 0;
|
||||
|
||||
if (io_testflag(stream, _IOAPPEND)) {
|
||||
if (_lseek(fileno(stream), 0L, SEEK_END) == -1) {
|
||||
if (lseek(fileno(stream), 0L, SEEK_END) == -1) {
|
||||
stream->_flags |= _IOERR;
|
||||
return EOF;
|
||||
}
|
||||
}
|
||||
c1 = _write(stream->_fd, (char *)stream->_buf, count);
|
||||
c1 = write(stream->_fd, (char *)stream->_buf, count);
|
||||
|
||||
stream->_count = 0;
|
||||
|
||||
|
||||
@@ -3,11 +3,10 @@
|
||||
*/
|
||||
/* $Id$ */
|
||||
|
||||
#include <stdio.h>
|
||||
#include <stdlib.h>
|
||||
#include "loc_incl.h"
|
||||
|
||||
int _read(int d, char *buf, int nbytes);
|
||||
#include <stdlib.h>
|
||||
#include <stdio.h>
|
||||
#include <unistd.h>
|
||||
#include "loc_incl.h"
|
||||
|
||||
int
|
||||
__fillbuf(register FILE *stream)
|
||||
@@ -53,7 +52,7 @@ __fillbuf(register FILE *stream)
|
||||
stream->_bufsiz = 1;
|
||||
}
|
||||
stream->_ptr = stream->_buf;
|
||||
stream->_count = _read(stream->_fd, (char *)stream->_buf, stream->_bufsiz);
|
||||
stream->_count = read(stream->_fd, (char *)stream->_buf, stream->_bufsiz);
|
||||
|
||||
if (stream->_count <= 0){
|
||||
if (stream->_count == 0) {
|
||||
|
||||
@@ -3,11 +3,12 @@
|
||||
*/
|
||||
/* $Id$ */
|
||||
|
||||
#ifndef NOFLOAT
|
||||
#include <string.h>
|
||||
#include <stdarg.h>
|
||||
#include "loc_incl.h"
|
||||
|
||||
#ifndef ACKCONF_NO_STDIO_FLOAT
|
||||
|
||||
static char *
|
||||
_pfloat(long double r, register char *s, int n, int flags)
|
||||
{
|
||||
@@ -175,4 +176,4 @@ _f_print(va_list *ap, int flags, char *s, char c, int precision)
|
||||
}
|
||||
return s;
|
||||
}
|
||||
#endif /* NOFLOAT */
|
||||
#endif /* ACKCONF_NO_STDIO_FLOAT */
|
||||
|
||||
@@ -3,15 +3,11 @@
|
||||
*/
|
||||
/* $Id$ */
|
||||
|
||||
#include <stdio.h>
|
||||
#include <stdlib.h>
|
||||
#include "loc_incl.h"
|
||||
#include <stdlib.h>
|
||||
#include <stdio.h>
|
||||
#include <unistd.h>
|
||||
#include "loc_incl.h"
|
||||
|
||||
#include <sys/types.h>
|
||||
|
||||
off_t _lseek(int fildes, off_t offset, int whence);
|
||||
int _write(int d, const char *buf, int nbytes);
|
||||
int _isatty(int d);
|
||||
extern void (*_clean)(void);
|
||||
|
||||
static int
|
||||
@@ -22,7 +18,7 @@ do_write(int d, char *buf, int nbytes)
|
||||
/* POSIX actually allows write() to return a positive value less
|
||||
than nbytes, so loop ...
|
||||
*/
|
||||
while ((c = _write(d, buf, nbytes)) > 0 && c < nbytes) {
|
||||
while ((c = write(d, buf, nbytes)) > 0 && c < nbytes) {
|
||||
nbytes -= c;
|
||||
buf += c;
|
||||
}
|
||||
@@ -41,7 +37,7 @@ __flushbuf(int c, FILE * stream)
|
||||
stream->_flags |= _IOWRITING;
|
||||
if (!io_testflag(stream, _IONBF)) {
|
||||
if (!stream->_buf) {
|
||||
if (stream == stdout && _isatty(fileno(stdout))) {
|
||||
if (stream == stdout && isatty(fileno(stdout))) {
|
||||
if (!(stream->_buf =
|
||||
(unsigned char *) malloc(BUFSIZ))) {
|
||||
stream->_flags |= _IONBF;
|
||||
@@ -71,12 +67,12 @@ __flushbuf(int c, FILE * stream)
|
||||
|
||||
stream->_count = 0;
|
||||
if (io_testflag(stream, _IOAPPEND)) {
|
||||
if (_lseek(fileno(stream), 0L, SEEK_END) == -1) {
|
||||
if (lseek(fileno(stream), 0L, SEEK_END) == -1) {
|
||||
stream->_flags |= _IOERR;
|
||||
return EOF;
|
||||
}
|
||||
}
|
||||
if (_write(fileno(stream), &c1, 1) != 1) {
|
||||
if (write(fileno(stream), &c1, 1) != 1) {
|
||||
stream->_flags |= _IOERR;
|
||||
return EOF;
|
||||
}
|
||||
@@ -91,7 +87,7 @@ __flushbuf(int c, FILE * stream)
|
||||
stream->_count = 0;
|
||||
|
||||
if (io_testflag(stream, _IOAPPEND)) {
|
||||
if (_lseek(fileno(stream), 0L, SEEK_END) == -1) {
|
||||
if (lseek(fileno(stream), 0L, SEEK_END) == -1) {
|
||||
stream->_flags |= _IOERR;
|
||||
return EOF;
|
||||
}
|
||||
@@ -110,7 +106,7 @@ __flushbuf(int c, FILE * stream)
|
||||
|
||||
if (count > 0) {
|
||||
if (io_testflag(stream, _IOAPPEND)) {
|
||||
if (_lseek(fileno(stream), 0L, SEEK_END) == -1) {
|
||||
if (lseek(fileno(stream), 0L, SEEK_END) == -1) {
|
||||
stream->_flags |= _IOERR;
|
||||
return EOF;
|
||||
}
|
||||
|
||||
@@ -3,18 +3,15 @@
|
||||
*/
|
||||
/* $Id$ */
|
||||
|
||||
#include <stdio.h>
|
||||
#include <stdlib.h>
|
||||
#include "loc_incl.h"
|
||||
#include <stdlib.h>
|
||||
#include <stdio.h>
|
||||
#include <unistd.h>
|
||||
#include <fcntl.h>
|
||||
#include <unistd.h>
|
||||
#include "loc_incl.h"
|
||||
|
||||
#define PMODE 0666
|
||||
|
||||
/* The next 3 defines are true in all UNIX systems known to me.
|
||||
*/
|
||||
#define O_RDONLY 0
|
||||
#define O_WRONLY 1
|
||||
#define O_RDWR 2
|
||||
|
||||
/* Since the O_CREAT flag is not available on all systems, we can't get it
|
||||
* from the standard library. Furthermore, even if we know that <fcntl.h>
|
||||
* contains such a flag, it's not sure whether it can be used, since we
|
||||
@@ -26,18 +23,13 @@
|
||||
* Another problem is O_APPEND, for which the same holds. When "a"
|
||||
* open-mode is used, an lseek() to the end is done before every write()
|
||||
* system-call.
|
||||
*
|
||||
* The O_CREAT, O_TRUNC and O_APPEND given here, are only for convenience.
|
||||
* They are not passed to open(), so the values don't have to match a value
|
||||
* from the real world. It is enough when they are unique.
|
||||
*
|
||||
* FIXME dtrg: I'm not sure this is relevant any more. Implementing O_CREAT
|
||||
* and O_APPEND ought to be the job of the syscall library, no? Besides, the
|
||||
* code requires valid definitions.
|
||||
*
|
||||
* Remember to fix freopen.c if changing this.
|
||||
*/
|
||||
#define O_CREAT 0x010
|
||||
#define O_TRUNC 0x020
|
||||
#define O_APPEND 0x040
|
||||
|
||||
int _open(const char *path, int flags);
|
||||
int _creat(const char *path, int mode);
|
||||
int _close(int d);
|
||||
|
||||
FILE *
|
||||
fopen(const char *name, const char *mode)
|
||||
@@ -89,11 +81,11 @@ fopen(const char *name, const char *mode)
|
||||
* the file is opened for writing and the open() failed.
|
||||
*/
|
||||
if ((rwflags & O_TRUNC)
|
||||
|| (((fd = _open(name, rwmode)) < 0)
|
||||
|| (((fd = open(name, rwmode)) < 0)
|
||||
&& (rwflags & O_CREAT))) {
|
||||
if (((fd = _creat(name, PMODE)) > 0) && flags | _IOREAD) {
|
||||
(void) _close(fd);
|
||||
fd = _open(name, rwmode);
|
||||
if (((fd = creat(name, PMODE)) > 0) && flags | _IOREAD) {
|
||||
(void) close(fd);
|
||||
fd = open(name, rwmode);
|
||||
}
|
||||
|
||||
}
|
||||
@@ -101,7 +93,7 @@ fopen(const char *name, const char *mode)
|
||||
if (fd < 0) return (FILE *)NULL;
|
||||
|
||||
if (( stream = (FILE *) malloc(sizeof(FILE))) == NULL ) {
|
||||
_close(fd);
|
||||
close(fd);
|
||||
return (FILE *)NULL;
|
||||
}
|
||||
|
||||
|
||||
@@ -3,26 +3,17 @@
|
||||
*/
|
||||
/* $Id$ */
|
||||
|
||||
#include <stdio.h>
|
||||
#include <stdlib.h>
|
||||
#include "loc_incl.h"
|
||||
#include <stdlib.h>
|
||||
#include <stdio.h>
|
||||
#include <fcntl.h>
|
||||
#include <unistd.h>
|
||||
#include "loc_incl.h"
|
||||
|
||||
#define PMODE 0666
|
||||
|
||||
/* Do not "optimize" this file to use the open with O_CREAT if the file
|
||||
* does not exist. The reason is given in fopen.c.
|
||||
*/
|
||||
#define O_RDONLY 0
|
||||
#define O_WRONLY 1
|
||||
#define O_RDWR 2
|
||||
|
||||
#define O_CREAT 0x010
|
||||
#define O_TRUNC 0x020
|
||||
#define O_APPEND 0x040
|
||||
|
||||
int _open(const char *path, int flags);
|
||||
int _creat(const char *path, int mode);
|
||||
int _close(int d);
|
||||
|
||||
FILE *
|
||||
freopen(const char *name, const char *mode, FILE *stream)
|
||||
@@ -32,7 +23,7 @@ freopen(const char *name, const char *mode, FILE *stream)
|
||||
int fd, flags = stream->_flags & (_IONBF | _IOFBF | _IOLBF | _IOMYBUF);
|
||||
|
||||
(void) fflush(stream); /* ignore errors */
|
||||
(void) _close(fileno(stream));
|
||||
(void) close(fileno(stream));
|
||||
|
||||
switch(*mode++) {
|
||||
case 'r':
|
||||
@@ -69,11 +60,11 @@ freopen(const char *name, const char *mode, FILE *stream)
|
||||
}
|
||||
|
||||
if ((rwflags & O_TRUNC)
|
||||
|| (((fd = _open(name, rwmode)) < 0)
|
||||
|| (((fd = open(name, rwmode)) < 0)
|
||||
&& (rwflags & O_CREAT))) {
|
||||
if (((fd = _creat(name, PMODE)) < 0) && flags | _IOREAD) {
|
||||
(void) _close(fd);
|
||||
fd = _open(name, rwmode);
|
||||
if (((fd = creat(name, PMODE)) < 0) && flags | _IOREAD) {
|
||||
(void) close(fd);
|
||||
fd = open(name, rwmode);
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
@@ -3,17 +3,10 @@
|
||||
*/
|
||||
/* $Id$ */
|
||||
|
||||
#include <stdio.h>
|
||||
|
||||
#if (SEEK_CUR != 1) || (SEEK_END != 2) || (SEEK_SET != 0)
|
||||
#error SEEK_* values are wrong
|
||||
#endif
|
||||
|
||||
#include "loc_incl.h"
|
||||
|
||||
#include <sys/types.h>
|
||||
|
||||
off_t _lseek(int fildes, off_t offset, int whence);
|
||||
#include <stdlib.h>
|
||||
#include <stdio.h>
|
||||
#include <unistd.h>
|
||||
#include "loc_incl.h"
|
||||
|
||||
int
|
||||
fseek(FILE *stream, long int offset, int whence)
|
||||
@@ -35,7 +28,7 @@ fseek(FILE *stream, long int offset, int whence)
|
||||
} else /* neither reading nor writing. The buffer must be empty */
|
||||
/* EMPTY */ ;
|
||||
|
||||
pos = _lseek(fileno(stream), offset - adjust, whence);
|
||||
pos = lseek(fileno(stream), offset - adjust, whence);
|
||||
if (io_testflag(stream, _IOREAD) && io_testflag(stream, _IOWRITE))
|
||||
stream->_flags &= ~(_IOREADING | _IOWRITING);
|
||||
|
||||
|
||||
@@ -3,18 +3,11 @@
|
||||
*/
|
||||
/* $Id$ */
|
||||
|
||||
#include <stdio.h>
|
||||
|
||||
#if (SEEK_CUR != 1) || (SEEK_SET != 0) || (SEEK_END != 2)
|
||||
#error SEEK_* values are wrong
|
||||
#endif
|
||||
|
||||
#include <stdlib.h>
|
||||
#include <stdio.h>
|
||||
#include <unistd.h>
|
||||
#include "loc_incl.h"
|
||||
|
||||
#include <sys/types.h>
|
||||
|
||||
off_t _lseek(int fildes, off_t offset, int whence);
|
||||
|
||||
long ftell(FILE *stream)
|
||||
{
|
||||
long result;
|
||||
@@ -28,7 +21,7 @@ long ftell(FILE *stream)
|
||||
adjust = stream->_ptr - stream->_buf;
|
||||
else adjust = 0;
|
||||
|
||||
result = _lseek(fileno(stream), 0, SEEK_CUR);
|
||||
result = lseek(fileno(stream), 0, SEEK_CUR);
|
||||
|
||||
if ( result == -1 )
|
||||
return result;
|
||||
|
||||
@@ -4,6 +4,7 @@
|
||||
/* $Id$ */
|
||||
|
||||
#include <stdio.h>
|
||||
#include <ack/config.h>
|
||||
|
||||
#define fileno(p) ((p)->_fd)
|
||||
#define io_testflag(p,x) ((p)->_flags & (x))
|
||||
@@ -18,10 +19,10 @@ void __cleanup(void);
|
||||
FILE *popen(const char *command, const char *type);
|
||||
FILE *fdopen(int fd, const char *mode);
|
||||
|
||||
#ifndef NOFLOAT
|
||||
#ifndef ACKCONF_NO_STDIO_FLOAT
|
||||
char *_ecvt(long double value, int ndigit, int *decpt, int *sign);
|
||||
char *_fcvt(long double value, int ndigit, int *decpt, int *sign);
|
||||
#endif /* NOFLOAT */
|
||||
#endif /* ACKCONF_NO_STDIO_FLOAT */
|
||||
|
||||
#define FL_LJUST 0x0001 /* left-justify field */
|
||||
#define FL_SIGN 0x0002 /* sign in signed conversions */
|
||||
|
||||
@@ -3,11 +3,11 @@
|
||||
*/
|
||||
/* $Id$ */
|
||||
|
||||
#include <stdio.h>
|
||||
|
||||
int _unlink(const char *path);
|
||||
#include <stdlib.h>
|
||||
#include <stdio.h>
|
||||
#include <unistd.h>
|
||||
|
||||
int
|
||||
remove(const char *filename) {
|
||||
return _unlink(filename);
|
||||
return unlink(filename);
|
||||
}
|
||||
|
||||
@@ -3,8 +3,9 @@
|
||||
*/
|
||||
/* $Id$ */
|
||||
|
||||
#if !defined(_POSIX_SOURCE)
|
||||
#include <stdio.h>
|
||||
#include <stdlib.h>
|
||||
#include <stdio.h>
|
||||
#include <unistd.h>
|
||||
|
||||
int _link(const char *name1, const char *name2);
|
||||
|
||||
|
||||
@@ -3,11 +3,11 @@
|
||||
*/
|
||||
/* $Id$ */
|
||||
|
||||
#include <stdio.h>
|
||||
#include <string.h>
|
||||
#include "loc_incl.h"
|
||||
|
||||
unsigned int _getpid(void);
|
||||
#include <stdlib.h>
|
||||
#include <stdio.h>
|
||||
#include <unistd.h>
|
||||
#include <string.h>
|
||||
#include "loc_incl.h"
|
||||
|
||||
FILE *
|
||||
tmpfile(void) {
|
||||
@@ -17,7 +17,7 @@ tmpfile(void) {
|
||||
|
||||
if (!name) {
|
||||
name = name_buffer + strlen(name_buffer);
|
||||
name = _i_compute(_getpid(), 10, name, 5);
|
||||
name = _i_compute(getpid(), 10, name, 5);
|
||||
*name = '\0';
|
||||
}
|
||||
|
||||
|
||||
@@ -3,11 +3,11 @@
|
||||
*/
|
||||
/* $Id$ */
|
||||
|
||||
#include <stdio.h>
|
||||
#include <string.h>
|
||||
#include "loc_incl.h"
|
||||
|
||||
unsigned int _getpid(void);
|
||||
#include <stdlib.h>
|
||||
#include <stdio.h>
|
||||
#include <string.h>
|
||||
#include <unistd.h>
|
||||
#include "loc_incl.h"
|
||||
|
||||
char *
|
||||
tmpnam(char *s) {
|
||||
@@ -17,7 +17,7 @@ tmpnam(char *s) {
|
||||
|
||||
if (!name) {
|
||||
name = name_buffer + strlen(name_buffer);
|
||||
name = _i_compute(_getpid(), 10, name, 5);
|
||||
name = _i_compute(getpid(), 10, name, 5);
|
||||
*name++ = '.';
|
||||
*name = '\0';
|
||||
}
|
||||
|
||||
@@ -8,7 +8,7 @@
|
||||
#include <errno.h>
|
||||
|
||||
double
|
||||
atof(const char *nptr)
|
||||
(atof)(const char *nptr)
|
||||
{
|
||||
double d;
|
||||
int e = errno;
|
||||
|
||||
@@ -4,16 +4,15 @@
|
||||
*/
|
||||
/* $Id$ */
|
||||
|
||||
#include <stdio.h>
|
||||
#include <stdlib.h>
|
||||
#include <stdlib.h>
|
||||
#include <stdio.h>
|
||||
#include <unistd.h>
|
||||
|
||||
#define NEXITS 32
|
||||
|
||||
void (*__functab[NEXITS])(void);
|
||||
int __funccnt = 0;
|
||||
|
||||
extern void _exit(int);
|
||||
|
||||
/* only flush output buffers when necessary */
|
||||
int (*_clean)(void) = NULL;
|
||||
|
||||
|
||||
@@ -15,6 +15,7 @@
|
||||
#include <float.h>
|
||||
#include <errno.h>
|
||||
#include <ctype.h>
|
||||
#include <ack/config.h>
|
||||
|
||||
static int b64_add(struct mantissa *e1, struct mantissa *e2);
|
||||
static b64_sft(struct mantissa *e1, int n);
|
||||
|
||||
@@ -4,14 +4,13 @@
|
||||
*/
|
||||
/* $Id$ */
|
||||
|
||||
#include <stdlib.h>
|
||||
|
||||
extern const char **_penvp;
|
||||
#include <stdlib.h>
|
||||
#include <unistd.h>
|
||||
|
||||
char *
|
||||
getenv(const char *name)
|
||||
{
|
||||
register const char **v = _penvp;
|
||||
register char **v = environ;
|
||||
register const char *p, *q;
|
||||
|
||||
if (v == NULL || name == NULL)
|
||||
|
||||
@@ -23,11 +23,12 @@
|
||||
#ifdef SYSTEM
|
||||
#include <system.h>
|
||||
#define SBRK sys_break
|
||||
extern void *SBRK(int incr);
|
||||
#else
|
||||
#define SBRK _sbrk
|
||||
#include <unistd.h>
|
||||
#define SBRK sbrk
|
||||
#define ILL_BREAK (void *)(-1) /* funny failure value */
|
||||
#endif
|
||||
extern void *SBRK(int incr);
|
||||
#ifdef STORE
|
||||
#define MAX_STORE 32
|
||||
private do_free(mallink *ml), sell_out(void);
|
||||
|
||||
@@ -10,7 +10,7 @@
|
||||
#define CHAR_SHIFT 8
|
||||
|
||||
int
|
||||
mblen(const char *s, size_t n)
|
||||
(mblen)(const char *s, size_t n)
|
||||
{
|
||||
if (s == (const char *)NULL) return 0; /* no state dependent codings */
|
||||
if (n <= 0) return 0;
|
||||
|
||||
@@ -3,6 +3,8 @@
|
||||
#include <stdlib.h>
|
||||
#include "ext_fmt.h"
|
||||
|
||||
#ifndef ACKCONF_NO_STDIO_FLOAT
|
||||
|
||||
void _str_ext_cvt(const char *s, char **ss, struct EXTEND *e);
|
||||
double _ext_dbl_cvt(struct EXTEND *e);
|
||||
|
||||
@@ -14,3 +16,5 @@ strtod(const char *p, char **pp)
|
||||
_str_ext_cvt(p, pp, &e);
|
||||
return _ext_dbl_cvt(&e);
|
||||
}
|
||||
|
||||
#endif
|
||||
|
||||
@@ -7,11 +7,6 @@
|
||||
|
||||
#if defined(__BSD4_2)
|
||||
|
||||
struct timeval {
|
||||
long tv_sec; /* seconds */
|
||||
long tv_usec; /* and microseconds */
|
||||
};
|
||||
|
||||
#define RUSAGE_SELF 0
|
||||
#define RUSAGE_CHILDREN -1
|
||||
|
||||
|
||||
@@ -6,7 +6,7 @@
|
||||
#include <time.h>
|
||||
|
||||
char *
|
||||
ctime(const time_t *timer)
|
||||
(ctime)(const time_t *timer)
|
||||
{
|
||||
return asctime(localtime(timer));
|
||||
}
|
||||
|
||||
@@ -10,17 +10,7 @@
|
||||
|
||||
#if defined(__BSD4_2)
|
||||
|
||||
struct timeval {
|
||||
long tv_sec; /* seconds */
|
||||
long tv_usec; /* and microseconds */
|
||||
};
|
||||
|
||||
struct timezone {
|
||||
int tz_minuteswest; /* minutes west of Greenwich */
|
||||
int tz_dsttime; /* type of dst correction */
|
||||
};
|
||||
|
||||
int _gettimeofday(struct timeval *tp, struct timezone *tzp);
|
||||
extern int _gettimeofday(struct timeval *tp, struct timezone *tzp);
|
||||
|
||||
#elif !defined(_POSIX_SOURCE) && !defined(__USG)
|
||||
#if !defined(_MINIX) /* MINIX has no ftime() */
|
||||
|
||||
@@ -3,34 +3,22 @@
|
||||
*/
|
||||
/* $Id$ */
|
||||
|
||||
#if defined(__BSD4_2)
|
||||
#include <time.h>
|
||||
/*
|
||||
* Structure returned by gettimeofday(2) system call,
|
||||
* and used in other calls.
|
||||
*/
|
||||
struct timeval {
|
||||
long tv_sec; /* seconds */
|
||||
long tv_usec; /* and microseconds */
|
||||
};
|
||||
#include <stdlib.h>
|
||||
#include <sys/time.h>
|
||||
#include <time.h>
|
||||
#include <ack/config.h>
|
||||
|
||||
struct timezone {
|
||||
int tz_minuteswest; /* minutes west of Greenwich */
|
||||
int tz_dsttime; /* type of dst correction */
|
||||
};
|
||||
|
||||
int _gettimeofday(struct timeval *tp, struct timezone *tzp);
|
||||
#ifndef ACKCONF_TIME_IS_A_SYSCALL
|
||||
|
||||
time_t
|
||||
time(time_t *timer)
|
||||
{
|
||||
struct timeval tv;
|
||||
struct timezone tz;
|
||||
_gettimeofday(&tv, &tz);
|
||||
gettimeofday(&tv, &tz);
|
||||
|
||||
if (timer) *timer = tv.tv_sec;
|
||||
return tv.tv_sec;
|
||||
}
|
||||
#else
|
||||
/* Assume time() is a system call */ /* ??? */
|
||||
|
||||
#endif
|
||||
|
||||
@@ -5,7 +5,7 @@ local d = ROOTDIR.."lang/cem/libcc/gen/"
|
||||
|
||||
local head = acklibrary {
|
||||
ackfile (d.."head_cc.e"),
|
||||
install = pm.install("%BINDIR%%PLATIND%/%PLATFORM%/head_cc")
|
||||
install = pm.install("%BINDIR%%PLATIND%/%PLATFORM%/c-knr.o")
|
||||
}
|
||||
|
||||
local tail = acklibrary {
|
||||
@@ -83,7 +83,7 @@ local tail = acklibrary {
|
||||
ackfile (d.."modf.e"),
|
||||
ackfile (d.."setjmp.e"),
|
||||
|
||||
install = pm.install("%BINDIR%%PLATIND%/%PLATFORM%/tail_cc.2g")
|
||||
install = pm.install("%BINDIR%%PLATIND%/%PLATFORM%/libc-knr.a")
|
||||
}
|
||||
|
||||
lang_cem_gen_runtime = group {
|
||||
|
||||
@@ -27,5 +27,5 @@ lang_cem_math_runtime = acklibrary {
|
||||
ackfile (d.."exp.c"),
|
||||
ackfile (d.."floor.c"),
|
||||
|
||||
install = pm.install("%BINDIR%%PLATIND%/%PLATFORM%/tail_m")
|
||||
install = pm.install("%BINDIR%%PLATIND%/%PLATFORM%/libm-knr.a")
|
||||
}
|
||||
|
||||
@@ -97,5 +97,5 @@ lang_cem_mon_runtime = acklibrary {
|
||||
ackfile (d.."_wait.e"),
|
||||
ackfile (d.."_write.e"),
|
||||
|
||||
install = pm.install("%BINDIR%%PLATIND%/%PLATFORM%/tail_mon")
|
||||
install = pm.install("%BINDIR%%PLATIND%/%PLATFORM%/libmon.a")
|
||||
}
|
||||
|
||||
@@ -54,5 +54,5 @@ lang_cem_stdio_runtime = acklibrary {
|
||||
ackfile (d.."timezone.c"),
|
||||
ackfile (d.."ungetc.c"),
|
||||
|
||||
install = pm.install("%BINDIR%%PLATIND%/%PLATFORM%/tail_cc.1s")
|
||||
install = pm.install("%BINDIR%%PLATIND%/%PLATFORM%/libc-stdio-knr.a")
|
||||
}
|
||||
|
||||
@@ -3,7 +3,7 @@
|
||||
|
||||
local d = ROOTDIR.."lang/cem/"
|
||||
|
||||
include (d.."cemcom/pmfile")
|
||||
-- include (d.."cemcom/pmfile")
|
||||
include (d.."cemcom.ansi/pmfile")
|
||||
include (d.."libcc/pmfile")
|
||||
-- include (d.."libcc/pmfile")
|
||||
include (d.."libcc.ansi/pmfile")
|
||||
|
||||
@@ -17,8 +17,7 @@ IMPLEMENTATION MODULE Streams;
|
||||
FROM SYSTEM IMPORT BYTE, ADR;
|
||||
FROM Epilogue IMPORT CallAtEnd;
|
||||
FROM Storage IMPORT Allocate, Available;
|
||||
FROM StripUnix IMPORT
|
||||
open, close, lseek, read, write, creat, ioctl;
|
||||
IMPORT StripUnix;
|
||||
|
||||
CONST BUFSIZ = 1024; (* tunable *)
|
||||
TYPE IOB = RECORD
|
||||
@@ -82,17 +81,17 @@ IMPLEMENTATION MODULE Streams;
|
||||
buf[HIGH(filename)+2] := BYTE(0C);
|
||||
END;
|
||||
IF (mode = reading) THEN
|
||||
fd := open(ADR(stream^.buf), 0);
|
||||
fd := StripUnix.open(ADR(stream^.buf), 0);
|
||||
ELSE
|
||||
fd := -1;
|
||||
IF (mode = appending) THEN
|
||||
fd := open(ADR(stream^.buf), 1);
|
||||
fd := StripUnix.open(ADR(stream^.buf), 1);
|
||||
IF fd >= 0 THEN
|
||||
IF (lseek(fd, 0D , 2) < 0D) THEN ; END;
|
||||
IF (StripUnix.lseek(fd, 0D , 2) < 0D) THEN ; END;
|
||||
END;
|
||||
END;
|
||||
IF fd < 0 THEN
|
||||
fd := creat(ADR(stream^.buf), 666B);
|
||||
fd := StripUnix.creat(ADR(stream^.buf), 666B);
|
||||
END;
|
||||
END;
|
||||
IF fd < 0 THEN
|
||||
@@ -153,7 +152,7 @@ IMPLEMENTATION MODULE Streams;
|
||||
IF (cnt > 0) THEN
|
||||
cnt1 := cnt;
|
||||
cnt := 0;
|
||||
IF write(fildes, ADR(buf), cnt1) < 0 THEN END;
|
||||
IF StripUnix.write(fildes, ADR(buf), cnt1) < 0 THEN END;
|
||||
END;
|
||||
END;
|
||||
END FlushStream;
|
||||
@@ -165,7 +164,7 @@ IMPLEMENTATION MODULE Streams;
|
||||
IF stream^.mode # reading THEN
|
||||
FlushStream(stream, result);
|
||||
END;
|
||||
IF close(stream^.fildes) < 0 THEN ; END;
|
||||
IF StripUnix.close(stream^.fildes) < 0 THEN ; END;
|
||||
freestruct(stream);
|
||||
ELSE
|
||||
result := nostream;
|
||||
@@ -212,7 +211,7 @@ IMPLEMENTATION MODULE Streams;
|
||||
IF stream = InputStream THEN
|
||||
FlushLineBuffers();
|
||||
END;
|
||||
maxcnt := read(fildes, ADR(buf), bufferedcnt);
|
||||
maxcnt := StripUnix.read(fildes, ADR(buf), bufferedcnt);
|
||||
cnt := 1;
|
||||
IF maxcnt <= 0 THEN
|
||||
eof := TRUE;
|
||||
@@ -335,7 +334,7 @@ IMPLEMENTATION MODULE Streams;
|
||||
RETURN;
|
||||
END;
|
||||
IF (s^.mode # reading) THEN FlushStream(s, result); END;
|
||||
position := lseek(s^.fildes, 0D, 1);
|
||||
position := StripUnix.lseek(s^.fildes, 0D, 1);
|
||||
IF position < 0D THEN
|
||||
result := illegaloperation;
|
||||
RETURN;
|
||||
@@ -360,7 +359,7 @@ IMPLEMENTATION MODULE Streams;
|
||||
s^.eof := FALSE;
|
||||
END;
|
||||
IF s^.mode = appending THEN
|
||||
currpos := lseek(s^.fildes, 0D, 1);
|
||||
currpos := StripUnix.lseek(s^.fildes, 0D, 1);
|
||||
IF currpos < 0D THEN
|
||||
result := illegaloperation;
|
||||
RETURN;
|
||||
@@ -370,7 +369,7 @@ IMPLEMENTATION MODULE Streams;
|
||||
result := illegaloperation;
|
||||
RETURN;
|
||||
END;
|
||||
currpos := lseek(s^.fildes, position, 0);
|
||||
currpos := StripUnix.lseek(s^.fildes, position, 0);
|
||||
IF currpos < 0D THEN
|
||||
result := illegaloperation;
|
||||
RETURN;
|
||||
@@ -379,21 +378,15 @@ IMPLEMENTATION MODULE Streams;
|
||||
END SetPosition;
|
||||
|
||||
PROCEDURE isatty(stream: Stream; VAR result: StreamResult): BOOLEAN;
|
||||
VAR buf: ARRAY[1..100] OF CHAR;
|
||||
BEGIN
|
||||
IF (stream = NIL) OR (stream^.kind = none) THEN
|
||||
result := nostream;
|
||||
RETURN FALSE;
|
||||
END;
|
||||
#ifdef __USG
|
||||
RETURN ioctl(stream^.fildes, INTEGER(ORD('T') * 256 + 1), ADR(buf)) >= 0;
|
||||
#else
|
||||
#ifdef __BSD4_2
|
||||
RETURN ioctl(stream^.fildes, INTEGER(ORD('t') * 256 + 8 + 6*65536 + 40000000H), ADR(buf)) >= 0;
|
||||
#else
|
||||
RETURN ioctl(stream^.fildes, INTEGER(ORD('t') * 256 + 8), ADR(buf)) >= 0;
|
||||
#endif
|
||||
#endif
|
||||
IF (StripUnix.isatty(stream^.fildes) = 0) THEN
|
||||
RETURN FALSE;
|
||||
END;
|
||||
RETURN TRUE;
|
||||
END isatty;
|
||||
|
||||
PROCEDURE InitStreams;
|
||||
|
||||
@@ -21,6 +21,7 @@ DEFINITION MODULE StripUnix;
|
||||
(* Sys5 *) PROCEDURE fcntl(fildes, request, arg: INTEGER) : INTEGER;
|
||||
PROCEDURE getpid() : INTEGER;
|
||||
PROCEDURE ioctl(fildes, request: INTEGER; arg: ADDRESS) : INTEGER;
|
||||
PROCEDURE isatty(fildes: INTEGER) : INTEGER;
|
||||
PROCEDURE lseek(fildes: INTEGER; offset: LONGINT; whence: INTEGER) : LONGINT;
|
||||
PROCEDURE open(path: ADDRESS; oflag: INTEGER) : INTEGER;
|
||||
PROCEDURE read(fildes: INTEGER;
|
||||
|
||||
@@ -79,6 +79,7 @@ DEFINITION MODULE Unix;
|
||||
PROCEDURE getgid() : INTEGER;
|
||||
PROCEDURE getegid() : INTEGER;
|
||||
PROCEDURE ioctl(fildes, request: INTEGER; arg: ADDRESS) : INTEGER;
|
||||
PROCEDURE isatty(fildes: INTEGER) : INTEGER;
|
||||
PROCEDURE stty(fildes: INTEGER; buf: ADDRESS) : INTEGER;
|
||||
PROCEDURE gtty(fildes: INTEGER; buf: ADDRESS) : INTEGER;
|
||||
PROCEDURE kill(pid, sig: INTEGER) : INTEGER;
|
||||
|
||||
@@ -13,23 +13,61 @@
|
||||
#include <em_abs.h>
|
||||
#include <m2_traps.h>
|
||||
|
||||
static const char signals_list[] = {
|
||||
#ifdef SIGHUP
|
||||
SIGHUP,
|
||||
#endif
|
||||
#ifdef SIGINT
|
||||
SIGINT,
|
||||
#endif
|
||||
#ifdef SIGQUIT
|
||||
SIGQUIT,
|
||||
#endif
|
||||
#ifdef SIGTRAP
|
||||
SIGTRAP,
|
||||
#endif
|
||||
#ifdef SIGIOT
|
||||
SIGIOT,
|
||||
#endif
|
||||
#ifdef SIGEMT
|
||||
SIGEMT,
|
||||
#endif
|
||||
#ifdef SIGFPE
|
||||
SIGFPE,
|
||||
#endif
|
||||
#ifdef SIGBUS
|
||||
SIGBUS,
|
||||
#endif
|
||||
#ifdef SIGSEGV
|
||||
SIGSEGV,
|
||||
#endif
|
||||
#ifdef SIGPIPE
|
||||
SIGPIPE,
|
||||
#endif
|
||||
#ifdef SIGALRM
|
||||
SIGALRM,
|
||||
#endif
|
||||
#ifdef SIGTERM
|
||||
SIGTERM,
|
||||
#endif
|
||||
-1
|
||||
};
|
||||
|
||||
/* map unix signals onto EM traps */
|
||||
init()
|
||||
void init(void)
|
||||
{
|
||||
sigtrp(M2_UNIXSIG, SIGHUP);
|
||||
sigtrp(M2_UNIXSIG, SIGINT);
|
||||
sigtrp(M2_UNIXSIG, SIGQUIT);
|
||||
const char* p = signals_list;
|
||||
do {
|
||||
int i = *p++;
|
||||
if (i == -1)
|
||||
break;
|
||||
sigtrp(M2_UNIXSIG, i);
|
||||
} while (1);
|
||||
|
||||
sigtrp(EILLINS, SIGILL);
|
||||
sigtrp(M2_UNIXSIG, SIGTRAP);
|
||||
sigtrp(M2_UNIXSIG, SIGIOT);
|
||||
sigtrp(M2_UNIXSIG, SIGEMT);
|
||||
sigtrp(M2_UNIXSIG, SIGFPE);
|
||||
sigtrp(M2_UNIXSIG, SIGBUS);
|
||||
sigtrp(M2_UNIXSIG, SIGSEGV);
|
||||
#ifdef SIGSYS
|
||||
sigtrp(EBADMON, SIGSYS);
|
||||
sigtrp(M2_UNIXSIG, SIGPIPE);
|
||||
sigtrp(M2_UNIXSIG, SIGALRM);
|
||||
sigtrp(M2_UNIXSIG, SIGTERM);
|
||||
#endif
|
||||
}
|
||||
#if defined(__em22) || defined(__em24) || defined(__em44)
|
||||
killbss()
|
||||
|
||||
@@ -26,7 +26,7 @@ local headers = group {
|
||||
pm.install(d.."Strings.def", "%BINDIR%include/m2/Strings.def"),
|
||||
pm.install(d.."StripUnix.def", "%BINDIR%include/m2/StripUnix.def"),
|
||||
pm.install(d.."Termcap.def", "%BINDIR%include/m2/Termcap.def"),
|
||||
pm.install(d.."Terminal.def", "%BINDIR%include/m2/Terminal.def"),
|
||||
-- pm.install(d.."Terminal.def", "%BINDIR%include/m2/Terminal.def"),
|
||||
pm.install(d.."Traps.def", "%BINDIR%include/m2/Traps.def"),
|
||||
pm.install(d.."Unix.def", "%BINDIR%include/m2/Unix.def"),
|
||||
pm.install(d.."XXTermcap.def", "%BINDIR%include/m2/XXTermcap.def"),
|
||||
@@ -36,7 +36,7 @@ local headers = group {
|
||||
local head = ackfile {
|
||||
file (d.."head_m2.e"),
|
||||
|
||||
install = pm.install("%BINDIR%%PLATIND%/%PLATFORM%/head_m2")
|
||||
install = pm.install("%BINDIR%%PLATIND%/%PLATFORM%/modula2.o")
|
||||
}
|
||||
|
||||
local tail = acklibrary {
|
||||
@@ -46,7 +46,7 @@ local tail = acklibrary {
|
||||
ackfile (d.."RealInOut.mod"),
|
||||
ackfile (d.."InOut.mod"),
|
||||
ackfile (d.."Streams.mod"),
|
||||
ackfile (d.."Terminal.mod"),
|
||||
-- ackfile (d.."Terminal.mod"),
|
||||
ackfile (d.."MathLib0.mod"),
|
||||
ackfile (d.."Mathlib.mod"),
|
||||
ackfile (d.."Processes.mod"),
|
||||
@@ -87,7 +87,7 @@ local tail = acklibrary {
|
||||
ackfile (d.."rckil.c"),
|
||||
ackfile (d.."EM.e"),
|
||||
|
||||
install = pm.install("%BINDIR%%PLATIND%/%PLATFORM%/tail_m2")
|
||||
install = pm.install("%BINDIR%%PLATIND%/%PLATFORM%/libmodula2.a")
|
||||
}
|
||||
|
||||
lang_m2_runtime = acklibrary {
|
||||
|
||||
@@ -17,5 +17,5 @@ lang_occam_lib_runtime = acklibrary {
|
||||
ackfile (d.."par_misc.e"),
|
||||
ackfile (d.."parco.c"),
|
||||
|
||||
install = pm.install("%BINDIR%%PLATIND%/%PLATFORM%/tail_ocm")
|
||||
install = pm.install("%BINDIR%%PLATIND%/%PLATFORM%/liboccam.a")
|
||||
}
|
||||
|
||||
@@ -16,9 +16,12 @@
|
||||
*
|
||||
*/
|
||||
|
||||
#include <em_abs.h>
|
||||
#include <pc_err.h>
|
||||
#include <pc_file.h>
|
||||
#include <stdlib.h>
|
||||
#include <errno.h>
|
||||
#include <unistd.h>
|
||||
#include <em_abs.h>
|
||||
#include <pc_err.h>
|
||||
#include <pc_file.h>
|
||||
|
||||
/* to make it easier to patch ... */
|
||||
extern struct file *_curfil;
|
||||
@@ -85,8 +88,6 @@ extern char **_penvp;
|
||||
|
||||
extern char *_hol0();
|
||||
extern _trp();
|
||||
extern _exit();
|
||||
extern int _write();
|
||||
|
||||
_catch(erno) unsigned erno; {
|
||||
register struct errm *ep = &errors[0];
|
||||
@@ -145,7 +146,7 @@ _catch(erno) unsigned erno; {
|
||||
p = q;
|
||||
while (*p)
|
||||
p++;
|
||||
if (_write(2,q,(int)(p-q)) < 0)
|
||||
if (write(2,q,(int)(p-q)) < 0)
|
||||
;
|
||||
}
|
||||
_exit(erno+1);
|
||||
|
||||
@@ -18,14 +18,15 @@
|
||||
|
||||
/* Author: J.W. Stevenson */
|
||||
|
||||
#include <pc_file.h>
|
||||
#include <pc_err.h>
|
||||
#include <stdlib.h>
|
||||
#include <unistd.h>
|
||||
#include <pc_file.h>
|
||||
#include <pc_err.h>
|
||||
|
||||
extern struct file *_curfil;
|
||||
extern _trp();
|
||||
extern _flush();
|
||||
extern _outcpt();
|
||||
extern int _close();
|
||||
|
||||
_xcls(f) struct file *f; {
|
||||
|
||||
@@ -61,7 +62,7 @@ _cls(f) struct file *f; {
|
||||
return;
|
||||
#endif
|
||||
_xcls(f);
|
||||
if (_close(f->ufd) != 0)
|
||||
if (close(f->ufd) != 0)
|
||||
_trp(ECLOSE);
|
||||
f->flags = 0;
|
||||
}
|
||||
|
||||
@@ -18,8 +18,10 @@
|
||||
|
||||
/* Author: J.W. Stevenson */
|
||||
|
||||
#include <pc_file.h>
|
||||
#include <pc_err.h>
|
||||
#include <stdlib.h>
|
||||
#include <errno.h>
|
||||
#include <pc_file.h>
|
||||
#include <pc_err.h>
|
||||
|
||||
extern struct file *_curfil;
|
||||
extern _trp();
|
||||
|
||||
Some files were not shown because too many files have changed in this diff Show More
Reference in New Issue
Block a user