Stripped down the library to something approaching the ANSI C minimum and replaced most of the header files, to provide a reasonably consistent base to work up from.

This commit is contained in:
dtrg 2007-04-24 19:42:24 +00:00
parent 740940c9fc
commit bfeb736c35
32 changed files with 590 additions and 792 deletions

View file

@ -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

View file

@ -1,2 +0,0 @@
clean:
rm -f OLIST

View file

@ -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

View file

@ -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)

View file

@ -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 */

View file

@ -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

View file

@ -0,0 +1,11 @@
/*
* fcntl.h - file I/O primitives
*/
/* $Id$ */
#ifndef _FCNTL_H
#define _FCNTL_H
#include <unistd.h>
#endif

View file

@ -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

View file

@ -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 */

View 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

View file

@ -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

View file

@ -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 */

View file

@ -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 */

View file

@ -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 */

View file

@ -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 */

View file

@ -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

View 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

View file

@ -6,29 +6,25 @@
*/
/* $Id$ */
#if !defined(_STDDEF_H)
#ifndef _STDDEF_H
#define _STDDEF_H
#define NULL ((void *)0)
#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 */
typedef int intptr_t; /* an integer big enough to store a pointer */
#elif _EM_PSIZE == _EM_LSIZE
typedef long ptrdiff_t; /* result of substracting two pointers */
typedef long intptr_t; /* an integer big enough to store a pointer */
#else
#error garbage pointer size
#error unsupported pointer size
#endif /* _EM_PSIZE */
#if !defined(_SIZE_T)
#define _SIZE_T
typedef unsigned int size_t; /* type returned by sizeof */
#endif /* _SIZE_T */
typedef unsigned int size_t; /* type returned by sizeof */
typedef char wchar_t; /* type of a wide character */
typedef long off_t; /* type of a position offset */
#if !defined(_WCHAR_T)
#define _WCHAR_T
typedef char wchar_t; /* type expanded character set */
#endif /* _WCHAR_T */
#endif /* _STDDEF_H */
#endif

View file

@ -0,0 +1,120 @@
/*
<stdint.h> -- simple version used by "gimplify"
last edit: 2007-03-02 D A Gwyn
*/
/* Although we try to unify integer types, some actual machine characteristics
are visible, and these definitions need to work within their limits. We do
assume that the GCC target has an "int" at least 32 bits wide, which works
for all our development platforms. We use "long long" for the widest types
because presumably the programmer really needed something special there. */
#define int8_t signed char
#define uint8_t unsigned char
#define int16_t short
#define uint16_t unsigned short
#define int32_t int
#define uint32_t unsigned
#define int64_t long long
#define uint64_t unsigned long long
#define int_least8_t int
#define uint_least8_t int
#define int_least16_t int
#define uint_least16_t unsigned
#define int_least32_t int
#define uint_least32_t unsigned
#define int_least64_t long long
#define uint_least64_t unsigned long long
#define intptr_t int
#define uintptr_t unsigned int
#define intmax_t long long
#define uintmax_t unsigned long long
#define int_fast8_t int
#define uint_fast8_t unsigned int
#define int_fast16_t int
#define uint_fast16_t unsigned int
#define int_fast32_t int
#define uint_fast32_t unsigned int
#define int_fast64_t long long int
#define uint_fast64_t unsigned long long
#define INT8_MAX 127
#define INT8_MIN (-128)
#define UINT8_MAX 255
#define INT16_MAX 32767
#define INT16_MIN (-32768)
#define UINT16_MAX 65535
#define INT32_MAX 2147483647
#define INT32_MIN (-2147483648)
#define UINT32_MAX 4294967295
#define INT64_MAX 2147483647LL
#define INT64_MIN (-2147483648LL)
#define UINT64_MAX 4294967295ULL
#define INT_LEAST8_MAX 2147483647
#define INT_LEAST8_MIN (-2147483647)
#define UINT_LEAST8_MAX 4294967295
#define INT_LEAST16_MAX 2147483647
#define INT_LEAST16_MIN (-2147483647)
#define UINT_LEAST16_MAX 4294967295
#define INT_LEAST32_MAX 2147483647
#define INT_LEAST32_MIN (-2147483647)
#define UINT_LEAST32_MAX 4294967295
#define INT_LEAST64_MAX 2147483647LL
#define INT_LEAST64_MIN (-2147483647LL)
#define UINT_LEAST64_MAX 4294967295ULL
#define INT_FAST8_MAX 2147483647
#define INT_FAST8_MIN (-2147483647)
#define UINT_FAST8_MAX 4294967295
#define INT_FAST16_MAX 2147483647
#define INT_FAST16_MIN (-2147483647)
#define UINT_FAST16_MAX 4294967295
#define INT_FAST32_MAX 2147483647
#define INT_FAST32_MIN (-2147483647)
#define UINT_FAST32_MAX 4294967295
#define INT_FAST64_MAX 2147483647LL
#define INT_FAST64_MIN (-2147483647LL)
#define UINT_FAST64_MAX 4294967295ULL
#define INTPTR_MAX 2147483647
#define INTPTR_MIN (-2147483647)
#define UINTPTR_MAX 4294967295
#define INTMAX_MAX 2147483647LL
#define INTMAX_MIN (-2147483647LL)
#define UINTMAX_MAX 4294967295ULL
#define PTRDIFF_MAX 2147483647
#define PTRDIFF_MIN (-2147483647)
#define SIG_ATOMIC_MAX 4294967295
#define SIG_ATOMIC_MIN 0
#define SIZE_MAX 4294967295
/* The trick used to get the right type is due to Clive Feather: */
#define INT8_C(c) (INT_LEAST8_MAX - INT_LEAST8_MAX + (c))
#define UINT8_C(c) (UINT_LEAST8_MAX - UINT_LEAST8_MAX + (c))
#define INT16_C(c) (INT_LEAST16_MAX - INT_LEAST16_MAX + (c))
#define UINT16_C(c) (UINT_LEAST16_MAX - UINT_LEAST16_MAX + (c))
#define INT32_C(c) (INT_LEAST32_MAX - INT_LEAST32_MAX + (c))
#define UINT32_C(c) (UINT_LEAST32_MAX - UINT_LEAST32_MAX + (c))
#define INT64_C(c) (INT_LEAST64_MAX - INT_LEAST64_MAX + (c))
#define UINT64_C(c) (UINT_LEAST64_MAX - UINT_LEAST64_MAX + (c))
#define INTMAX_C(c) (INTMAX_MAX - INTMAX_MAX + (c))
#define UINTMAX_C(c) (UINTMAX_MAX - UINTMAX_MAX + (c))

View file

@ -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 */

View file

@ -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

View file

@ -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

View file

@ -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 */

View file

@ -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 */

View file

@ -0,0 +1,11 @@
/* $Source$
* $State$
* $Revision$
*/
#ifndef _SYS_IOCTL_H
#define _SYS_IOCTL_H
#include <unistd.h>
#endif

View file

@ -0,0 +1,12 @@
/* $Source$
* $State$
* $Revision$
*/
#ifndef _SYS_TIME_H
#define _SYS_TIME_H
#include <time.h>
#include <unistd.h>
#endif

View 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>

View file

@ -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 */

View file

@ -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))))

View file

@ -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 */

View file

@ -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

View file

@ -12,7 +12,7 @@ local crt = ackfile {
local libc = acklibrary {
ACKBUILDFLAGS = {PARENT, "-ansi"},
ACKINCLUDES = {PARENT, "%ROOTDIR%h", d.."headers"},
outputs = {"%U%/libc-ansi.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,22 +263,24 @@ local libc = acklibrary {
ackfile (d.."time/misc.c"),
install = {
pm.install("%BINDIR%%PLATIND%/%PLATFORM%/libc-ansi.a")
pm.install("%BINDIR%%PLATIND%/%PLATFORM%/libc.a")
}
}
local headers = group {
install = {
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/dirent.h", "%BINDIR%include/ansi/dirent.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/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/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/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"),
@ -284,8 +289,6 @@ local headers = group {
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"),
}
}