improved parameters

This commit is contained in:
eck 1989-09-29 15:46:33 +00:00
parent 77259cd2f9
commit 26cc87efe6
16 changed files with 346 additions and 398 deletions

View file

@ -6,18 +6,12 @@
*/ */
/* $Header$ */ /* $Header$ */
void _bad_assertion(const char *expr, const char *file, int line); void __bad_assertion(const char *__expr, const char *__file, int __line);
#undef assert #undef assert
#ifdef NDEBUG #if defined(NDEBUG)
#define assert(ignore) ((void)0) #define assert(ignore) ((void)0)
#else #else
#define assert(expr) \ #define assert(expr) ((expr)? (void)0 : __bad_assertion( #expr, __FILE__, __LINE__))
{ \
if (!(expr)) { \
_bad_assertion( #expr, __FILE__, __LINE); \
abort(); \
} \
}
#endif /* NDEBUG */ #endif /* NDEBUG */

View file

@ -3,23 +3,23 @@
*/ */
/* $Header$ */ /* $Header$ */
#ifndef _CTYPE_HEADER_ #if !defined(__CTYPE_HEADER__)
#define _CTYPE_HEADER_ #define __CTYPE_HEADER__
int isalnum(int c); /* alpha numeric character */ int isalnum(int __c); /* alpha numeric character */
int isalpha(int c); /* alpha character */ int isalpha(int __c); /* alpha character */
int iscntrl(int c); /* control character */ int iscntrl(int __c); /* control character */
int isdigit(int c); /* digit character */ int isdigit(int __c); /* digit character */
int isgraph(int c); /* graphical character */ int isgraph(int __c); /* graphical character */
int islower(int c); /* lower case character */ int islower(int __c); /* lower case character */
int isprint(int c); /* printable character */ int isprint(int __c); /* printable character */
int ispunct(int c); /* punctuaction character */ int ispunct(int __c); /* punctuaction character */
int isspace(int c); /* space character */ int isspace(int __c); /* space character */
int isupper(int c); /* upper case character */ int isupper(int __c); /* upper case character */
int isxdigit(int c); /* hexdecimal digit character */ int isxdigit(int __c); /* hexdecimal digit character */
int tolower(int c); /* convert to lower case character */ int tolower(int __c); /* convert to lower case character */
int toupper(int c); /* convert to upper case character */ int toupper(int __c); /* convert to upper case character */
#define isdigit(c) ((unsigned)((c)-'0') < 10) #define isdigit(c) ((unsigned)((c)-'0') < 10)
#define islower(c) ((unsigned)((c)-'a') < 26) #define islower(c) ((unsigned)((c)-'a') < 26)
@ -27,4 +27,4 @@ int toupper(int c); /* convert to upper case character */
#define isprint(c) ((unsigned)((c)-' ') < 95) #define isprint(c) ((unsigned)((c)-' ') < 95)
#define isascii(c) ((unsigned)(c) < 128) #define isascii(c) ((unsigned)(c) < 128)
#endif /* _CTYPE_HEADER_ */ #endif /* __CTYPE_HEADER__ */

View file

@ -3,8 +3,8 @@
*/ */
/* $Header$ */ /* $Header$ */
#ifndef _ERRNO_HEADER_ #if !defined(__ERRNO_HEADER__)
#define _ERRNO_HEADER_ #define __ERRNO_HEADER__
#define EPERM 1 /* Not owner */ #define EPERM 1 /* Not owner */
#define ENOENT 2 /* No such file or directory */ #define ENOENT 2 /* No such file or directory */
@ -43,7 +43,7 @@
#define EDOM 33 /* math arg out of domain of func */ #define EDOM 33 /* math arg out of domain of func */
#define ERANGE 34 /* math result not representable */ #define ERANGE 34 /* math result not representable */
#ifdef __USG #if defined(__USG)
/* Only ENOMSG, EIDRM and EDEADLK are documented */ /* Only ENOMSG, EIDRM and EDEADLK are documented */
#define ENOMSG 35 /* No message of desired type */ #define ENOMSG 35 /* No message of desired type */
#define EIDRM 36 /* Identifier Removed */ #define EIDRM 36 /* Identifier Removed */
@ -58,7 +58,7 @@
#define EDEADLK 45 /* DeadLock */ #define EDEADLK 45 /* DeadLock */
#endif /* __USG */ #endif /* __USG */
#ifdef __BDS4_2 #if defined(__BDS4_2)
/* non-blocking and interrupt i/o */ /* non-blocking and interrupt i/o */
#define EWOULDBLOCK 35 /* Operation would block */ #define EWOULDBLOCK 35 /* Operation would block */
#define EINPROGRESS 36 /* Operation now in progress */ #define EINPROGRESS 36 /* Operation now in progress */
@ -132,4 +132,4 @@
extern int errno; /* error number */ extern int errno; /* error number */
#endif /* _ERRNO_HEADER_ */ #endif /* __ERRNO_HEADER__ */

View file

@ -3,19 +3,19 @@
*/ */
/* $Header$ */ /* $Header$ */
#ifndef _FLOAT_HEADER_ #if !defined(__FLOAT_HEADER__)
#define _FLOAT_HEADER_ #define __FLOAT_HEADER__
#ifdef vax #if defined(vax)
#define FLT_DIG 6 #define FLT_DIG 6
#define FLT_EPSILON 5.96046448e-08 #define FLT_EPSILON 5.96046448e-08
#define FLT_MANT_DIG 8 #define FLT_MANT_DIG 8
#define FLT_MAX 1.70141173e+38 #define FLT_MAX 1.70141173e+38F
#define FLT_MAX_10_EXP 38 #define FLT_MAX_10_EXP 38
#define FLT_MAX_EXP 127 #define FLT_MAX_EXP 127
#define FLT_MIN 2.93873588e-39 #define FLT_MIN 2.93873588e-39F
#define FLT_MIN_10_EXP -39 #define FLT_MIN_10_EXP (-38)
#define FLT_MIN_EXP -127 #define FLT_MIN_EXP (-127)
#define DBL_DIG 16 #define DBL_DIG 16
#define DBL_EPSILON 1.38777878078144568e-17 #define DBL_EPSILON 1.38777878078144568e-17
@ -24,36 +24,35 @@
#define DBL_MAX_10_EXP 38 #define DBL_MAX_10_EXP 38
#define DBL_MAX_EXP 127 #define DBL_MAX_EXP 127
#define DBL_MIN 2.93873587705571877e-39 #define DBL_MIN 2.93873587705571877e-39
#define DBL_MIN_10_EXP 39 #define DBL_MIN_10_EXP (-38)
#define DBL_MIN_EXP -127 #define DBL_MIN_EXP (-127)
#define LDBL_DIG 16 #define LDBL_DIG 16
#define LDBL_EPSILON 1.38777878078144568e-17 #define LDBL_EPSILON 1.38777878078144568e-17
#define LDBL_MANT_DIG 8 #define LDBL_MANT_DIG 8
#define LDBL_MAX 1.70141183460469229e+38 #define LDBL_MAX 1.70141183460469229e+38L
#define LDBL_MAX_10_EXP 38 #define LDBL_MAX_10_EXP 38
#define LDBL_MAX_EXP 127 #define LDBL_MAX_EXP 127
#define LDBL_MIN 2.93873587705571877e-39 #define LDBL_MIN 2.93873587705571877e-39L
#define LDBL_MIN_10_EXP 39 #define LDBL_MIN_10_EXP (-38)
#define LDBL_MIN_EXP -127 #define LDBL_MIN_EXP (-127)
#define FLT_ROUNDS 1 #define FLT_ROUNDS 1
#define FLT_RADIX 2 #define FLT_RADIX 2
#else #elif defined(pdp)
#ifdef pdp
/* The values are not certain, because there are no pdp's here anymore. The /* The values are not certain, because there are no pdp's here anymore. The
* values given here are the same as for the vax. * values given here are the same as for the vax.
*/ */
#define FLT_DIG 6 #define FLT_DIG 6
#define FLT_EPSILON 5.96046448e-08 #define FLT_EPSILON 5.96046448e-08
#define FLT_MANT_DIG 8 #define FLT_MANT_DIG 8
#define FLT_MAX 1.70141173e+38 #define FLT_MAX 1.70141173e+38F
#define FLT_MAX_10_EXP 38 #define FLT_MAX_10_EXP 38
#define FLT_MAX_EXP 127 #define FLT_MAX_EXP 127
#define FLT_MIN 2.93873588e-39 #define FLT_MIN 2.93873588e-39F
#define FLT_MIN_10_EXP -39 #define FLT_MIN_10_EXP (-38)
#define FLT_MIN_EXP -127 #define FLT_MIN_EXP (-127)
#define DBL_DIG 16 #define DBL_DIG 16
#define DBL_EPSILON 1.38777878078144568e-17 #define DBL_EPSILON 1.38777878078144568e-17
@ -62,57 +61,56 @@
#define DBL_MAX_10_EXP 38 #define DBL_MAX_10_EXP 38
#define DBL_MAX_EXP 127 #define DBL_MAX_EXP 127
#define DBL_MIN 2.93873587705571877e-39 #define DBL_MIN 2.93873587705571877e-39
#define DBL_MIN_10_EXP 39 #define DBL_MIN_10_EXP (-38)
#define DBL_MIN_EXP -127 #define DBL_MIN_EXP (-127)
#define LDBL_DIG 16 #define LDBL_DIG 16
#define LDBL_EPSILON 1.38777878078144568e-17 #define LDBL_EPSILON 1.38777878078144568e-17
#define LDBL_MANT_DIG 8 #define LDBL_MANT_DIG 8
#define LDBL_MAX 1.70141183460469229e+38 #define LDBL_MAX 1.70141183460469229e+38L
#define LDBL_MAX_10_EXP 38 #define LDBL_MAX_10_EXP 38
#define LDBL_MAX_EXP 127 #define LDBL_MAX_EXP 127
#define LDBL_MIN 2.93873587705571877e-39 #define LDBL_MIN 2.93873587705571877e-39L
#define LDBL_MIN_10_EXP 39 #define LDBL_MIN_10_EXP (-38)
#define LDBL_MIN_EXP -127 #define LDBL_MIN_EXP (-127)
#define FLT_ROUNDS 1 #define FLT_ROUNDS 1
#define FLT_RADIX 2 #define FLT_RADIX 2
#else /* floating point emulation */ #else /* IEEE format */
#define FLT_DIG 6 #define FLT_DIG 6
#define FLT_EPSILON 5.96046448e-08 #define FLT_EPSILON 1.19209290e-07
#define FLT_MANT_DIG 8 #define FLT_MANT_DIG 24
#define FLT_MAX 1.70141173e+38 #define FLT_MAX 3.40282347e+38F
#define FLT_MAX_10_EXP 38 #define FLT_MAX_10_EXP 38
#define FLT_MAX_EXP 127 #define FLT_MAX_EXP 128
#define FLT_MIN 2.93873588e-39 #define FLT_MIN 1.17549435e-38F
#define FLT_MIN_10_EXP -39 #define FLT_MIN_10_EXP (-37)
#define FLT_MIN_EXP -127 #define FLT_MIN_EXP (-125)
#define DBL_DIG 15 #define DBL_DIG 15
#define DBL_EPSILON 1.1102230246251565e-16 #define DBL_EPSILON 2.2204460492503131e-16
#define DBL_MANT_DIG 11 #define DBL_MANT_DIG 53
#define DBL_MAX 8.9884656743115823e+307 #define DBL_MAX 1.7976931348623157e+308
#define DBL_MAX_10_EXP 307 #define DBL_MAX_10_EXP 308
#define DBL_MAX_EXP 1023 #define DBL_MAX_EXP 1024
#define DBL_MIN 5.5626846462680062e-309 #define DBL_MIN 2.2250738585072014e-308
#define DBL_MIN_10_EXP -309 #define DBL_MIN_10_EXP (-307)
#define DBL_MIN_EXP -1023 #define DBL_MIN_EXP (-1021)
#define LDBL_DIG 15 #define LDBL_DIG 15
#define LDBL_EPSILON 1.1102230246251565e-16 #define LDBL_EPSILON 2.2204460492503131e-16
#define LDBL_MANT_DIG 11 #define LDBL_MANT_DIG 53
#define LDBL_MAX 8.9884656743115823e+307 #define LDBL_MAX 1.7976931348623157e+308L
#define LDBL_MAX_10_EXP 307 #define LDBL_MAX_10_EXP 308
#define LDBL_MAX_EXP 1023 #define LDBL_MAX_EXP 1024
#define LDBL_MIN 5.5626846462680062e-309 #define LDBL_MIN 2.2250738585072014e-308L
#define LDBL_MIN_10_EXP -309 #define LDBL_MIN_10_EXP (-307)
#define LDBL_MIN_EXP -1023 #define LDBL_MIN_EXP (-1021)
#define FLT_ROUNDS 1 #define FLT_ROUNDS 1
#define FLT_RADIX 2 #define FLT_RADIX 2
#endif /* pdp */ #endif /* vax, pdp or ieee */
#endif /* vax */
#endif /* _FLOAT_HEADER_ */ #endif /* __FLOAT_HEADER__ */

View file

@ -3,49 +3,35 @@
*/ */
/* $Header$ */ /* $Header$ */
#ifndef _LIMITS_HEADER_ #if !defined(__LIMITS_HEADER__)
#define _LIMITS_HEADER_ #define __LIMITS_HEADER__
/*
** Define _SIGNED_CHARS_ for machines with signed characters.
** Define _WORD_32_ for machines with 32 bits integers.
**
** These defines should probably be set by the compiler when the
** -vi option is used.
*/
#define _SIGNED_CHARS_
#define _WORD_32_
#define CHAR_BIT 8 #define CHAR_BIT 8
#define SCHAR_MIN (-127) #define SCHAR_MIN (-128)
#define SCHAR_MAX (+127) #define SCHAR_MAX (+127)
#define UCHAR_MAX 255 #define UCHAR_MAX 255
#define MB_LEN_MAX 1 #define MB_LEN_MAX 1
#define SHRT_MIN (-32767) #define SHRT_MIN (-32767 - 1)
#define SHRT_MAX (+32767) #define SHRT_MAX (+32767)
#define USHRT_MAX 65535 #define USHRT_MAX 65535U
#define LONG_MIN (-2147483647L) #define LONG_MIN (-2147483647L - 1L)
#define LONG_MAX (+2147483647L) #define LONG_MAX (+2147483647L)
#define ULONG_MAX 4294967295L #define ULONG_MAX 4294967295U
#ifdef _SIGNED_CHARS_ /* Assume signed characters (yegh) */
#define CHAR_MAX SCHAR_MAX #define CHAR_MAX SCHAR_MAX
#define CHAR_MIN SCHAR_MIN #define CHAR_MIN SCHAR_MIN
#else /* defined(_UNSIGNED_CHARS_) */
#define CHAR_MAX UCHAR_MAX
#define CHAR_MIN 0
#endif /* _SIGNED_CHARS */
#ifdef _WORD_32_ #if _EM_WSIZE == 4
#define INT_MIN LONG_MIN #define INT_MIN LONG_MIN
#define INT_MAX LONG_MAX #define INT_MAX LONG_MAX
#define UINT_MAX ULONG_MAX #define UINT_MAX ULONG_MAX
#else /*defined(_WORD_16_)*/ #else /* _EM_WSIZE == 2 */
#define INT_MIN SHRT_MIN #define INT_MIN SHRT_MIN
#define INT_MAX SHRT_MAX #define INT_MAX SHRT_MAX
#define UINT_MAX USHRT_MAX #define UINT_MAX USHRT_MAX
#endif /* WORD_32_ */ #endif
#endif /* _LIMITS_HEADER_ */ #endif /* __LIMITS_HEADER__ */

View file

@ -3,8 +3,8 @@
*/ */
/* $Header$ */ /* $Header$ */
#ifndef _LOCALE_HEADER_ #if !defined(__LOCALE_HEADER__)
#define _LOCALE_HEADER_ #define __LOCALE_HEADER__
struct lconv { struct lconv {
char *decimal_point; /* "." */ char *decimal_point; /* "." */
@ -26,7 +26,7 @@ struct lconv {
char n_sign_posn; /* CHAR_MAX */ char n_sign_posn; /* CHAR_MAX */
}; };
#ifndef NULL #if defined(NULL)
#define NULL 0 #define NULL 0
#endif /* NULL */ #endif /* NULL */
@ -38,7 +38,7 @@ struct lconv {
#define LC_TIME 6 #define LC_TIME 6
char *setlocale(int category, const char *locale); char *setlocale(int __category, const char *__locale);
struct lconv *localeconv(void); struct lconv *localeconv(void);
#endif /* _LOCALE_HEADER_ */ #endif /* __LOCALE_HEADER__ */

View file

@ -3,39 +3,38 @@
*/ */
/* $Header$ */ /* $Header$ */
#ifndef _MATH_HEADER_ #if !defined(__MATH_HEADER__)
#define _MATH_HEADER_ #define __MATH_HEADER__
#include <float.h> #define HUGE_VAL 9.9e+999 /* though it will generate a warning */
#define HUGE_VAL DBL_MAX
double acos(double x); double acos(double __x);
double asin(double x); double asin(double __x);
double atan(double x); double atan(double __x);
double atan2(double y, double x); double atan2(double __y, double __x);
double cos(double x); double cos(double __x);
double sin(double x); double sin(double __x);
double tan(double x); double tan(double __x);
double cosh(double x); double cosh(double __x);
double sinh(double x); double sinh(double __x);
double tanh(double x); double tanh(double __x);
double exp(double x); double exp(double __x);
double log(double x); double log(double __x);
double log10(double x); double log10(double __x);
double sqrt(double x); double sqrt(double __x);
double ceil(double x); double ceil(double __x);
double fabs(double x); double fabs(double __x);
double floor(double x); double floor(double __x);
double pow(double x, double y); double pow(double __x, double __y);
double frexp(double x, int *exp); double frexp(double __x, int *__exp);
double ldexp(double x, int exp); double ldexp(double __x, int __exp);
double modf(double x, double *iptr); double modf(double __x, double *__iptr);
double fmod(double x, double y); double fmod(double __x, double __y);
#endif /* _MATH_HEADER_ */ #endif /* __MATH_HEADER__ */

View file

@ -3,8 +3,8 @@
*/ */
/* $Header$ */ /* $Header$ */
#ifndef _MATHCONST_HEADER_ #if !defined(__MATHCONST_HEADER__)
#define _MATHCONST_HEADER_ #define __MATHCONST_HEADER__
/* some constants (Hart & Cheney) */ /* some constants (Hart & Cheney) */
#define M_PI 3.14159265358979323846264338327950288 #define M_PI 3.14159265358979323846264338327950288
@ -26,4 +26,4 @@
#define M_1_SQRT2 0.70710678118654752440084436210484904 #define M_1_SQRT2 0.70710678118654752440084436210484904
#define M_EULER 0.57721566490153286060651209008240243 #define M_EULER 0.57721566490153286060651209008240243
#endif /* _MATHCONST_HEADER_ */ #endif /* __MATHCONST_HEADER__ */

View file

@ -6,12 +6,12 @@
*/ */
/* $Header$ */ /* $Header$ */
#ifndef _SETJMP_HEADER_ #if !defined(__SETJMP_HEADER__)
#define _SETJMP_HEADER_ #define __SETJMP_HEADER__
typedef char jmp_buf[256]; typedef char jmp_buf[256];
int setjmp(jmp_buf env); int setjmp(jmp_buf __env);
void longjmp(jmp_buf env, int val); void longjmp(jmp_buf __env, int __val);
#endif /* _SETJMP_HEADER_ */ #endif /* __SETJMP_HEADER__ */

View file

@ -5,19 +5,20 @@
* See the copyright notice in the ACK home directory, in the file "Copyright". * See the copyright notice in the ACK home directory, in the file "Copyright".
*/ */
/* $Header$ */ /* $Header$ */
#ifndef _SIGNAL_HEADER_
#define _SIGNAL_HEADER_ #if !defined(__SIGNAL_HEADER__)
#define __SIGNAL_HEADER__
typedef int sig_atomic_t; typedef int sig_atomic_t;
#define SIG_ERR (void (*)())-1 #define SIG_ERR ((void (*)(int))-1)
#if defined(em22) || defined(em24) || defined(em44) #if defined(em22) || defined(em24) || defined(em44)
#define SIG_DFL ((void (*)())-2) #define SIG_DFL ((void (*)(int))-2)
#define SIG_IGN ((void (*)())-3) #define SIG_IGN ((void (*)(int))-3)
#else #else
#define SIG_DFL ((void (*)())0) #define SIG_DFL ((void (*)(int))0)
#define SIG_IGN ((void (*)())1) #define SIG_IGN ((void (*)(int))1)
#endif /* SIG_ERR */ #endif /* no interpretation */
#define SIGHUP 1 /* hangup */ #define SIGHUP 1 /* hangup */
#define SIGINT 2 /* interrupt */ #define SIGINT 2 /* interrupt */
@ -35,7 +36,7 @@ typedef int sig_atomic_t;
#define SIGPIPE 13 /* write on a pipe with no one to read it */ #define SIGPIPE 13 /* write on a pipe with no one to read it */
#define SIGALRM 14 /* alarm clock */ #define SIGALRM 14 /* alarm clock */
#define SIGTERM 15 /* software termination signal from kill */ #define SIGTERM 15 /* software termination signal from kill */
#ifdef __USG #if defined(__USG)
#define SIGUSR1 16 /* user defined signal 1 */ #define SIGUSR1 16 /* user defined signal 1 */
#define SIGUSR2 17 /* user defined signal 2 */ #define SIGUSR2 17 /* user defined signal 2 */
#define SIGCLD 18 /* death of a child */ #define SIGCLD 18 /* death of a child */
@ -65,52 +66,7 @@ typedef int sig_atomic_t;
#define _NSIG 16 #define _NSIG 16
#endif /* __USG or __BSD4_2 */ #endif /* __USG or __BSD4_2 */
#ifdef __BSD4_2 void (*signal(int __sig, void (*__func)(int)))(int);
struct sigvec { int raise(int __sig);
int (*sv_handler)(); /* handler */
int sv_mask; /* mask to apply */
int sv_flags;
};
#define SV_ONSTACK 0x0001 /* take signal on signal stack */
#define SV_INTERRUPT 0x0002 /* do not restart system on signal return */
#define SV_RESETHAND 0x0004 /* reset signal handler to SIG_DFL when signal taken */
#define sv_onstack sv_flags /* compat. */
struct sigstack { #endif /* __SIGNAL_HEADER__ */
char *ss_sp; /* signal stack pointer */
int ss_onstack; /* current status */
};
struct sigcontext {
int sc_onstack; /* sigstack state to restore */
int sc_mask; /* signal mask to restore */
int sc_sp; /* sp to restore */
#ifdef vax
int sc_fp; /* fp to restore */
int sc_ap; /* ap to restore */
#endif /* vax */
int sc_pc; /* pc to retore */
int sc_ps; /* psl to restore */
};
#define BADSIG SIG_ERR /* compat. */
#define sigmask(m) (1 << ((m)-1))
/*
* These are only defined for shutting up the compiler.
*/
#ifdef __STDC__
int sigvec(int sig, struct sigvec *vec, struct sigvec *ovec);
int sigstack(struct sigstack *ss, struct sigstack *oss);
int sigblock(int mask);
int sigsetmask(int mask);
int sigpause(int sigmask);
#endif /* __STDC__ */
#endif /* __BSD4_2 */
#ifdef __STDC__
void (*signal(int sig, void (*func)(int)))(int);
int raise(int sig);
#endif /* __STDC__ */
#endif /* _SIGNAL_HEADER_ */

View file

@ -6,13 +6,15 @@
*/ */
/* $Header$ */ /* $Header$ */
#ifndef _STDARG_HEADER_ #if !defined(__STDARG_HEADER__)
#define _STDARG_HEADER_ #define __STDARG_HEADER__
typedef char *va_list; typedef void *va_list;
#define va_start(ap, parmN) (ap = (char *)&parmN) #define _vasz(x) ((sizeof(x)+sizeof(int)-1) & ~(sizeof(int) -1))
#define va_arg(ap, type) ((type *)(ap += sizeof(type)))[0]
#define va_end(ap)
#endif /* _STDARG_HEADER_ */ #define va_start(ap, parmN) (ap = (va_list)&parmN + _vasz(parmN))
#define va_arg(ap, type) (*((type *)((ap += _vasz(type)) - _vasz(type))))
#define va_end(ap)
#endif /* __STDARG_HEADER__ */

View file

@ -6,30 +6,28 @@
*/ */
/* $Header$ */ /* $Header$ */
#ifndef _STDDEF_HEADER_ #if !defined(__STDDEF_HEADER__)
#define _STDDEF_HEADER_ #define __STDDEF_HEADER__
#ifndef NULL #if !defined(NULL)
#define NULL 0 #define NULL 0
#endif /* NULL */ #endif /* NULL */
/* ??? cast to char pointer necessary? */ #define offsetof(type, ident) (((size_t) &(((type *)0)->ident))
#define offsetof(type, ident) \
(size_t) &(((type *)0)->ident)
#ifndef _TYPE_PTRDIFF_ #if !defined(__TYPE_PTRDIFF__)
#define _TYPE_PTRDIFF_ #define __TYPE_PTRDIFF__
typedef int ptrdiff_t; /* result of substracting two pointers */ typedef int ptrdiff_t; /* result of substracting two pointers */
#endif /* _TYPE_PTRDIFF_ */ #endif /* __TYPE_PTRDIFF__ */
#ifndef _TYPE_SIZE_ #if !defined(__TYPE_SIZE__)
#define _TYPE_SIZE_ #define __TYPE_SIZE__
typedef unsigned int size_t; /* type returned by sizeof */ typedef unsigned int size_t; /* type returned by sizeof */
#endif /* _TYPE_SIZE_ */ #endif /* __TYPE_SIZE__ */
#ifndef _TYPE_WCHAR_ #if !defined(__TYPE_WCHAR__)
#define _TYPE_WCHAR_ #define __TYPE_WCHAR__
typedef char wchar_t; /* type expanded character set */ typedef char wchar_t; /* type expanded character set */
#endif /* _TYPE_WCHAR_ */ #endif /* __TYPE_WCHAR__ */
#endif /* _STDEF_HEADER_ */ #endif /* __STDDEF_HEADER__ */

View file

@ -6,120 +6,135 @@
*/ */
/* $Header$ */ /* $Header$ */
#ifndef _STDIO_HEADER_ #if !defined(__STDIO_HEADER__)
#define _STDIO_HEADER_ #define __STDIO_HEADER__
#include <stdarg.h>
#define _NFILES 20
/* /*
* Focus point of all stdio activity. * Focus point of all stdio activity.
*/ */
typedef struct _iobuf { typedef struct __iobuf {
int _fd;
int _count; int _count;
int _fd;
int _flags; int _flags;
int _bufsiz;
char *_tname; char *_tname;
unsigned char *_buf; unsigned char *_buf;
unsigned char *_ptr; unsigned char *_ptr;
} FILE; } FILE;
#define _IOFBF 0000 #define _IOFBF 0x000
#define _IOREAD 0001 #define _IOREAD 0x001
#define _IOWRITE 0002 #define _IOWRITE 0x002
#define _IONBF 0004 #define _IONBF 0x004
#define _IOMYBUF 0010 #define _IOMYBUF 0x008
#define _IOEOF 0020 #define _IOEOF 0x010
#define _IOERR 0040 #define _IOERR 0x020
#define _IOLBF 0100 #define _IOLBF 0x040
#define _IOREADING 0x080
#define _IOWRITING 0x100
/* The following definitions are also in <unistd.h>. They should not
* conflict.
*/
#define SEEK_SET 0 #define SEEK_SET 0
#define SEEK_CUR 1 #define SEEK_CUR 1
#define SEEK_END 2 #define SEEK_END 2
#define stdin (&_stdin) #define stdin (&__stdin)
#define stdout (&_stdout) #define stdout (&__stdout)
#define stderr (&_stderr) #define stderr (&__stderr)
#define BUFSIZ 1024 #define BUFSIZ 1024
#ifndef NULL #if !defined(NULL)
#define NULL 0 #define NULL 0
#endif /* NULL */ #endif /* NULL */
#ifndef EOF #if !defined(EOF)
#define EOF (-1) #define EOF (-1)
#endif /* EOF */ #endif /* EOF */
#define FOPEN_MAX (_NFILES - 3) #define FOPEN_MAX 20
#ifdef __BSD4_2
#if defined(__BSD4_2)
#define FILENAME_MAX 255 #define FILENAME_MAX 255
#else #else
#define FILENAME_MAX 14 #define FILENAME_MAX 14
#endif /* __BSD4_2 */ #endif /* __BSD4_2 */
#define TMP_MAX 1000 #define TMP_MAX 999
#define L_tmpnam (sizeof("/usr/tmp/") + 15) #define L_tmpnam (sizeof("/tmp/") + 15)
#ifndef _TYPE_FPOS_ #if !defined(__TYPE_FPOS__)
#define _TYPE_FPOS_ #define __TYPE_FPOS__
typedef long int fpos_t; typedef long int fpos_t;
#endif /* _TYPE_FPOS */ #endif /* __TYPE_FPOS__ */
#ifndef _TYPE_SIZE_ #if !defined(__TYPE_SIZE__)
#define _TYPE_SIZE_ #define __TYPE_SIZE__
typedef unsigned int size_t; typedef unsigned int size_t;
#endif /* _TYPE_SIZE_ */ #endif /* __TYPE_SIZE__ */
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(char *__s, const char *__format, ...);
int vfprintf(FILE *__stream, const char *__format, void *__arg);
int vprintf(const char *__format, void *__arg);
int vsprintf(char *__s, const char *__format, void *__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);
#define getchar() getc(stdin) #define getchar() getc(stdin)
#define putchar(c) putc(c,stdout) #define putchar(c) putc(c,stdout)
#define getc(p) (--(p)->_count >= 0 ? (int) (*(p)->_ptr++) : \ #define getc(p) (--(p)->_count >= 0 ? (int) (*(p)->_ptr++) : \
_fillbuf(p)) __fillbuf(p))
#define putc(c, p) (--(p)->_count >= 0 ? \ #define putc(c, p) (--(p)->_count >= 0 ? \
(int) (*(p)->_ptr++ = (c)) : \ (int) (*(p)->_ptr++ = (c)) : \
_flushbuf((c),(p))) __flushbuf((c),(p)))
#define feof(p) (((p)->_flags & _IOEOF) != 0) #define feof(p) (((p)->_flags & _IOEOF) != 0)
#define ferror(p) (((p)->_flags & _IOERR) != 0) #define ferror(p) (((p)->_flags & _IOERR) != 0)
#define fileno(p) ((p)->_fd)
#if defined(_POSIX_SOURCE)
int fileno(FILE *__stream);
#define fileno(stream) ((stream)->_fd)
#endif /* _POSIX_SOURCE */
FILE *_iotable[_NFILES]; #endif /* __STDIO_HEADER__ */
FILE _stdin, _stdout, _stderr;
#ifdef __STDC__
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(char *s, const char *format, ...);
int vfprintf(FILE *stream, const char *format, va_list arg);
int vprintf(const char *format, va_list arg);
int vsprintf(char *s, const char *format, va_list 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);
char *gets(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, const fpos_t *pos);
long ftell(FILE *stream);
void rewind(FILE *stream);
void clearerr(FILE *stream);
int perror(const char *s);
#endif /* __STDC__ */
#endif /* _STDIO_HEADER_ */

View file

@ -6,10 +6,10 @@
*/ */
/* $Header$ */ /* $Header$ */
#ifndef _STDLIB_HEADER_ #if !defined(__STDLIB_HEADER__)
#define _STDLIB_HEADER_ #define __STDLIB_HEADER__
#ifndef NULL #if !defined(NULL)
#define NULL 0 #define NULL 0
#endif /* NULL */ #endif /* NULL */
@ -21,48 +21,46 @@
typedef struct { int quot, rem; } div_t; typedef struct { int quot, rem; } div_t;
typedef struct { long quot, rem; } ldiv_t; typedef struct { long quot, rem; } ldiv_t;
#ifndef _TYPE_SIZE_ #if !defined(__TYPE_SIZE__)
#define _TYPE_SIZE_ #define __TYPE_SIZE__
typedef unsigned int size_t; typedef unsigned int size_t;
#endif /* _TYPE_SIZE_ */ #endif /* __TYPE_SIZE__ */
#ifndef _TYPE_WCHAR_ #if !defined(__TYPE_WCHAR__)
#define _TYPE_WCHAR_ #define __TYPE_WCHAR__
typedef int wchar_t; typedef char wchar_t;
#endif /* _TYPE_WCHAR_ */ #endif /* __TYPE_WCHAR__ */
#ifdef __STDC__ double atof(const char *__nptr);
double atof(const char *nptr); int atoi(const char *__nptr);
int atoi(const char *nptr); long atol(const char *__nptr);
long atol(const char *nptr); double strtod(const char *__nptr, char **__endptr);
double strtod(const char *nptr, char **endptr); long strtol(const char *__nptr, char **__endptr, int __base);
long strtol(const char *nptr, char **endptr, int base); unsigned long int strtoul(const char *__nptr, char **__endptr, int __base);
unsigned long int strtoul(const char *nptr, char **endptr, int base);
int rand(void); int rand(void);
void srand(unsigned int seed); void srand(unsigned int __seed);
void *calloc(size_t nmemb, size_t size); void *calloc(size_t __nmemb, size_t __size);
void free(void *ptr); void free(void *__ptr);
void *malloc(size_t size); void *malloc(size_t __size);
void *realloc(void *ptr, size_t size); void *realloc(void *__ptr, size_t __size);
void abort(void); void abort(void);
int atexit(void (*func)(void)); int atexit(void (*__func)(void));
void exit(int status); void exit(int __status);
char *getenv(const char *name); char *getenv(const char *__name);
int system(const char *string); int system(const char *__string);
void *bsearch(const void *key, const void *base, void *bsearch(const void *__key, const void *__base,
size_t nmemb, size_t size, size_t __nmemb, size_t __size,
int (*compar)(const void *, const void *)); int (*__compar)(const void *, const void *));
void qsort(void *base, size_t nmemb, size_t size, void qsort(void *__base, size_t __nmemb, size_t __size,
int (*compar)(const void *, const void *)); int (*__compar)(const void *, const void *));
int abs(int j); int abs(int __j);
div_t div(int numer, int denom); div_t div(int __numer, int __denom);
long labs(long j); long labs(long __j);
ldiv_t ldiv(long numer, long denom); ldiv_t ldiv(long __numer, long __denom);
int mblen(const char *s, size_t n); int mblen(const char *__s, size_t __n);
int mbtowc(wchar_t *pwc, const char *s, size_t n); int mbtowc(wchar_t *__pwc, const char *__s, size_t __n);
int wctomb(const char *s, wchar_t wchar); int wctomb(char *__s, wchar_t __wchar);
size_t mbstowcs(wchar_t *pwcs, const char *s, size_t n); size_t mbstowcs(wchar_t *__pwcs, const char *__s, size_t __n);
size_t wcstombs(char *s, const wchar_t *pwcs, size_t n); size_t wcstombs(char *__s, const wchar_t *__pwcs, size_t __n);
#endif /* __STDC__ */
#endif /* _STDLIB_HEADER_ */ #endif /* __STDLIB_HEADER__ */

View file

@ -6,41 +6,39 @@
*/ */
/* $Header$ */ /* $Header$ */
#ifndef _STRING_HEADER_ #if !defined(__STRING_HEADER__)
#define _STRING_HEADER_ #define __STRING_HEADER__
#ifndef NULL #if !defined(NULL)
#define NULL 0 #define NULL 0
#endif /* NULL */ #endif /* NULL */
#ifndef _TYPE_SIZE_ #if !defined(__TYPE_SIZE__)
#define _TYPE_SIZE_ #define __TYPE_SIZE__
typedef unsigned int size_t; /* type returned by sizeof */ typedef unsigned int size_t; /* type returned by sizeof */
#endif /* _TYPE_SIZE_ */ #endif /* __TYPE_SIZE__ */
#ifdef __STDC__ void *memcpy(void *__s1, const void *__s2, size_t __n);
void *memcpy(void *s1, const void *s2, size_t n); void *memmove(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 *strcpy(char *s1, const char *s2); char *strncpy(char *__s1, const char *__s2, size_t __n);
char *strncpy(char *s1, const char *s2, size_t n); char *strcat(char *__s1, const char *__s2);
char *strcat(char *s1, const char *s2); char *strncat(char *__s1, const char *__s2, size_t __n);
char *strncat(char *s1, const char *s2, size_t n); int memcmp(const void *__s1, const void *__s2, size_t __n);
int memcmp(const void *s1, const void *s2, size_t n); int strcmp(const char *__s1, const char *__s2);
int strcmp(const char *s1, const char *s2); int strcoll(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);
int strncmp(const char *s1, const char *s2, size_t n); size_t strxfrm(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);
void *memchr(const void *s, int c, size_t n); char *strchr(const char *__s, int __c);
char *strchr(const char *s, int c); size_t strcspn(const char *__s1, const char *__s2);
size_t strcspn(const char *s1, const char *s2); char *strpbrk(const char *__s1, const char *__s2);
char *strpbrk(const char *s1, const char *s2); char *strrchr(const char *__s, int __c);
char *strrchr(const char *s, int c); size_t strspn(const char *__s1, const char *__s2);
size_t strspn(const char *s1, const char *s2); char *strstr(const char *__s1, const char *__s2);
char *strstr(const char *s1, const char *s2); char *strtok(char *__s1, const char *__s2);
char *strtok(char *s1, const char *s2); void *memset(void *__s, int __c, size_t __n);
void *memset(void *s, int c, size_t n); char *strerror(int __errnum);
char *strerror(int errnum); size_t strlen(const char *__s);
size_t strlen(const char *s);
#endif /* __STDC__ */
#endif /* _STRING_HEADER_ */ #endif /* __STRING_HEADER__ */

View file

@ -3,26 +3,26 @@
*/ */
/* $Header$ */ /* $Header$ */
#ifndef _TIME_HEADER_ #if !defined(__TIME_HEADER__)
#define _TIME_HEADER_ #define __TIME_HEADER__
#ifndef NULL #if !defined(NULL)
#define NULL 0 #define NULL 0
#endif /* NULL */ #endif /* NULL */
#ifdef __BSD4_2 #if defined(__BSD4_2)
#define CLK_TCK 60 /* ticks per second */ #define CLOCKS_PER_SEC 1000000 /* ticks per second */
#else #else
#define CLK_TCK 1 #define CLOCKS_PER_SEC 60
#endif /* __BSD4_2 */ #endif /* __BSD4_2 */
#ifndef _TYPE_SIZE_ #if !defined(__TYPE_SIZE__)
#define _TYPE_SIZE_ #define __TYPE_SIZE__
typedef unsigned int size_t; /* type returned by sizeof */ typedef unsigned int size_t; /* type returned by sizeof */
#endif /* _TYPE_SIZE_ */ #endif /* __TYPE_SIZE__ */
typedef signed long time_t; /* type returned by TOD clock */ typedef unsigned long time_t; /* type returned by TOD clock */
typedef signed long clock_t; /* type returned by real time clock */ typedef unsigned long clock_t; /* type returned by real time clock */
struct tm { struct tm {
int tm_sec; /* seconds after the minute - [0, 59] */ int tm_sec; /* seconds after the minute - [0, 59] */
@ -37,15 +37,19 @@ struct tm {
}; };
clock_t clock(void); clock_t clock(void);
double difftime(time_t time1, time_t time0); double difftime(time_t __time1, time_t __time0);
time_t mktime(struct tm *timeptr); time_t mktime(struct tm *__timeptr);
time_t time(time_t *timeptr); time_t time(time_t *__timeptr);
char *asctime(const struct tm *timeptr); char *asctime(const struct tm *__timeptr);
char *ctime(const time_t *timer); char *ctime(const time_t *__timer);
struct tm *gmtime(const time_t *timer); struct tm *gmtime(const time_t *__timer);
struct tm *localtime(const time_t *timer); struct tm *localtime(const time_t *__timer);
size_t strftime(char *s, size_t maxsize, size_t strftime(char *__s, size_t __maxsize,
const char *format, const char *__format,
const struct tm *timeptr); const struct tm *__timeptr);
#endif /* _TIME_HEADER_ */ #if defined(__USG) || defined(_POSIX_SOURCE)
void tzset(void);
#endif /* __USG || _POSIX_SOURCE */
#endif /* __TIME_HEADER__ */