Initial revision
authoreck <none@none>
Tue, 16 May 1989 13:13:53 +0000 (13:13 +0000)
committereck <none@none>
Tue, 16 May 1989 13:13:53 +0000 (13:13 +0000)
39 files changed:
lang/cem/libcc.ansi/headers/assert.h [new file with mode: 0644]
lang/cem/libcc.ansi/headers/ctype.h [new file with mode: 0644]
lang/cem/libcc.ansi/headers/errno.h [new file with mode: 0644]
lang/cem/libcc.ansi/headers/float.h [new file with mode: 0644]
lang/cem/libcc.ansi/headers/limits.h [new file with mode: 0644]
lang/cem/libcc.ansi/headers/locale.h [new file with mode: 0644]
lang/cem/libcc.ansi/headers/math.h [new file with mode: 0644]
lang/cem/libcc.ansi/headers/mathconst.h [new file with mode: 0644]
lang/cem/libcc.ansi/headers/setjmp.h [new file with mode: 0644]
lang/cem/libcc.ansi/headers/signal.h [new file with mode: 0644]
lang/cem/libcc.ansi/headers/stdarg.h [new file with mode: 0644]
lang/cem/libcc.ansi/headers/stddef.h [new file with mode: 0644]
lang/cem/libcc.ansi/headers/stdio.h [new file with mode: 0644]
lang/cem/libcc.ansi/headers/stdlib.h [new file with mode: 0644]
lang/cem/libcc.ansi/headers/string.h [new file with mode: 0644]
lang/cem/libcc.ansi/headers/time.h [new file with mode: 0644]
lang/cem/libcc.ansi/stdlib/abort.c [new file with mode: 0644]
lang/cem/libcc.ansi/stdlib/abs.c [new file with mode: 0644]
lang/cem/libcc.ansi/stdlib/atof.c [new file with mode: 0644]
lang/cem/libcc.ansi/stdlib/atoi.c [new file with mode: 0644]
lang/cem/libcc.ansi/stdlib/atol.c [new file with mode: 0644]
lang/cem/libcc.ansi/stdlib/bsearch.c [new file with mode: 0644]
lang/cem/libcc.ansi/stdlib/calloc.c [new file with mode: 0644]
lang/cem/libcc.ansi/stdlib/div.c [new file with mode: 0644]
lang/cem/libcc.ansi/stdlib/exit.c [new file with mode: 0644]
lang/cem/libcc.ansi/stdlib/getenv.c [new file with mode: 0644]
lang/cem/libcc.ansi/stdlib/labs.c [new file with mode: 0644]
lang/cem/libcc.ansi/stdlib/ldiv.c [new file with mode: 0644]
lang/cem/libcc.ansi/stdlib/malloc.c [new file with mode: 0644]
lang/cem/libcc.ansi/stdlib/mblen.c [new file with mode: 0644]
lang/cem/libcc.ansi/stdlib/mbstowcs.c [new file with mode: 0644]
lang/cem/libcc.ansi/stdlib/mbtowc.c [new file with mode: 0644]
lang/cem/libcc.ansi/stdlib/qsort.c [new file with mode: 0644]
lang/cem/libcc.ansi/stdlib/rand.c [new file with mode: 0644]
lang/cem/libcc.ansi/stdlib/strtod.c [new file with mode: 0644]
lang/cem/libcc.ansi/stdlib/strtol.c [new file with mode: 0644]
lang/cem/libcc.ansi/stdlib/system.c [new file with mode: 0644]
lang/cem/libcc.ansi/stdlib/wcstombs.c [new file with mode: 0644]
lang/cem/libcc.ansi/stdlib/wctomb.c [new file with mode: 0644]

diff --git a/lang/cem/libcc.ansi/headers/assert.h b/lang/cem/libcc.ansi/headers/assert.h
new file mode 100644 (file)
index 0000000..8603ea4
--- /dev/null
@@ -0,0 +1,23 @@
+/*
+ * assert.h - diagnostics
+ *
+ * (c) copyright 1987 by the Vrije Universiteit, Amsterdam, The Netherlands.
+ * See the copyright notice in the ACK home directory, in the file "Copyright".
+ */
+/* $Header$ */
+
+void _bad_assertion(const char *expr, const char *file, int line);
+
+#undef assert
+
+#ifdef NDEBUG
+#define        assert(ignore)  ((void)0)
+#else
+#define assert(expr)                                                   \
+       {                                                               \
+               if (!(expr)) {                                          \
+                       _bad_assertion( #expr, __FILE__, __LINE);       \
+                       abort();                                        \
+               }                                                       \
+       }
+#endif /* NDEBUG */
diff --git a/lang/cem/libcc.ansi/headers/ctype.h b/lang/cem/libcc.ansi/headers/ctype.h
new file mode 100644 (file)
index 0000000..ebe828f
--- /dev/null
@@ -0,0 +1,30 @@
+/*
+ * ctype.h - character handling
+ */
+/* $Header$ */
+
+#ifndef        _CTYPE_HEADER_
+#define        _CTYPE_HEADER_
+
+int    isalnum(int c);         /* alpha numeric character */
+int    isalpha(int c);         /* alpha character */
+int    iscntrl(int c);         /* control character */
+int    isdigit(int c);         /* digit character */
+int    isgraph(int c);         /* graphical character */
+int    islower(int c);         /* lower case character */
+int    isprint(int c);         /* printable character */
+int    ispunct(int c);         /* punctuaction character */
+int    isspace(int c);         /* space character */
+int    isupper(int c);         /* upper case character */
+int    isxdigit(int c);        /* hexdecimal digit character */
+
+int    tolower(int c);         /* convert to lower case character */
+int    toupper(int c);         /* convert to upper case character */
+
+#define        isdigit(c)      ((unsigned)((c)-'0') < 10)
+#define        islower(c)      ((unsigned)((c)-'a') < 26)
+#define        isupper(c)      ((unsigned)((c)-'A') < 26)
+#define        isprint(c)      ((unsigned)((c)-' ') < 95)
+#define        isascii(c)      ((unsigned)(c) < 128)
+
+#endif /* _CTYPE_HEADER_ */
diff --git a/lang/cem/libcc.ansi/headers/errno.h b/lang/cem/libcc.ansi/headers/errno.h
new file mode 100644 (file)
index 0000000..ef0f344
--- /dev/null
@@ -0,0 +1,135 @@
+/*
+ * errno.h - errors
+ */
+/* $Header$ */
+
+#ifndef        _ERRNO_HEADER_
+#define        _ERRNO_HEADER_
+
+#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 */
+
+/* The standard requires the next two definitions */
+#define        EDOM            33      /* math arg out of domain of func */
+#define        ERANGE          34      /* math result not representable */
+
+#ifdef __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 */
+
+#ifdef __BDS4_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 */
+
+extern int errno;      /* error number */
+
+#endif /* _ERRNO_HEADER_ */
diff --git a/lang/cem/libcc.ansi/headers/float.h b/lang/cem/libcc.ansi/headers/float.h
new file mode 100644 (file)
index 0000000..69a3097
--- /dev/null
@@ -0,0 +1,118 @@
+/*
+ * float.h - implementation limits
+ */
+/* $Header$ */
+
+#ifndef        _FLOAT_HEADER_
+#define        _FLOAT_HEADER_
+
+#ifdef vax
+#define        FLT_DIG                 6
+#define        FLT_EPSILON             5.96046448e-08
+#define        FLT_MANT_DIG            8
+#define        FLT_MAX                 1.70141173e+38
+#define        FLT_MAX_10_EXP          38
+#define        FLT_MAX_EXP             127
+#define        FLT_MIN                 2.93873588e-39
+#define        FLT_MIN_10_EXP          -39
+#define        FLT_MIN_EXP             -127
+
+#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          39
+#define        DBL_MIN_EXP             -127
+
+#define        LDBL_DIG                16
+#define        LDBL_EPSILON            1.38777878078144568e-17
+#define        LDBL_MANT_DIG           8
+#define        LDBL_MAX                1.70141183460469229e+38
+#define        LDBL_MAX_10_EXP         38
+#define        LDBL_MAX_EXP            127
+#define        LDBL_MIN                2.93873587705571877e-39
+#define        LDBL_MIN_10_EXP         39
+#define        LDBL_MIN_EXP            -127
+
+#define        FLT_ROUNDS              1
+#define        FLT_RADIX               2
+
+#else
+#ifdef pdp
+/* The values are not certain, because there are no pdp's here anymore. The
+ * values given here are the same as for the vax. 
+ */
+#define        FLT_DIG                 6
+#define        FLT_EPSILON             5.96046448e-08
+#define        FLT_MANT_DIG            8
+#define        FLT_MAX                 1.70141173e+38
+#define        FLT_MAX_10_EXP          38
+#define        FLT_MAX_EXP             127
+#define        FLT_MIN                 2.93873588e-39
+#define        FLT_MIN_10_EXP          -39
+#define        FLT_MIN_EXP             -127
+
+#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          39
+#define        DBL_MIN_EXP             -127
+
+#define        LDBL_DIG                16
+#define        LDBL_EPSILON            1.38777878078144568e-17
+#define        LDBL_MANT_DIG           8
+#define        LDBL_MAX                1.70141183460469229e+38
+#define        LDBL_MAX_10_EXP         38
+#define        LDBL_MAX_EXP            127
+#define        LDBL_MIN                2.93873587705571877e-39
+#define        LDBL_MIN_10_EXP         39
+#define        LDBL_MIN_EXP            -127
+
+#define        FLT_ROUNDS              1
+#define        FLT_RADIX               2
+
+#else          /* floating point emulation */
+#define        FLT_DIG                 6
+#define        FLT_EPSILON             5.96046448e-08
+#define        FLT_MANT_DIG            8
+#define        FLT_MAX                 1.70141173e+38
+#define        FLT_MAX_10_EXP          38
+#define        FLT_MAX_EXP             127
+#define        FLT_MIN                 2.93873588e-39
+#define        FLT_MIN_10_EXP          -39
+#define        FLT_MIN_EXP             -127
+
+#define        DBL_DIG                 15
+#define        DBL_EPSILON             1.1102230246251565e-16
+#define        DBL_MANT_DIG            11
+#define        DBL_MAX                 8.9884656743115823e+307
+#define        DBL_MAX_10_EXP          307
+#define        DBL_MAX_EXP             1023
+#define        DBL_MIN                 5.5626846462680062e-309
+#define        DBL_MIN_10_EXP          -309
+#define        DBL_MIN_EXP             -1023
+
+#define        LDBL_DIG                15
+#define        LDBL_EPSILON            1.1102230246251565e-16
+#define        LDBL_MANT_DIG           11
+#define        LDBL_MAX                8.9884656743115823e+307
+#define        LDBL_MAX_10_EXP         307
+#define        LDBL_MAX_EXP            1023
+#define        LDBL_MIN                5.5626846462680062e-309
+#define        LDBL_MIN_10_EXP         -309
+#define        LDBL_MIN_EXP            -1023
+
+#define        FLT_ROUNDS              1
+#define        FLT_RADIX               2
+
+#endif /* pdp */
+#endif /* vax */
+
+#endif /* _FLOAT_HEADER_ */
diff --git a/lang/cem/libcc.ansi/headers/limits.h b/lang/cem/libcc.ansi/headers/limits.h
new file mode 100644 (file)
index 0000000..8d848f0
--- /dev/null
@@ -0,0 +1,51 @@
+/*
+ * limits.h - implementation limits
+ */
+/* $Header$ */
+
+#ifndef        _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        SCHAR_MIN               (-127)
+#define        SCHAR_MAX               (+127)
+#define        UCHAR_MAX               255
+#define        MB_LEN_MAX              1
+
+#define        SHRT_MIN                (-32767)
+#define        SHRT_MAX                (+32767)
+#define        USHRT_MAX               65535
+
+#define        LONG_MIN                (-2147483647L)
+#define        LONG_MAX                (+2147483647L)
+#define        ULONG_MAX               4294967295L
+
+#ifdef _SIGNED_CHARS_
+#define        CHAR_MAX                SCHAR_MAX
+#define        CHAR_MIN                SCHAR_MIN
+#else  /* defined(_UNSIGNED_CHARS_) */
+#define        CHAR_MAX                UCHAR_MAX
+#define        CHAR_MIN                0
+#endif /* _SIGNED_CHARS */
+
+#ifdef _WORD_32_
+#define        INT_MIN                 LONG_MIN
+#define        INT_MAX                 LONG_MAX
+#define        UINT_MAX                ULONG_MAX
+#else  /*defined(_WORD_16_)*/
+#define        INT_MIN                 SHRT_MIN
+#define        INT_MAX                 SHRT_MAX
+#define        UINT_MAX                USHRT_MAX
+#endif /* WORD_32_ */
+
+#endif /* _LIMITS_HEADER_ */
diff --git a/lang/cem/libcc.ansi/headers/locale.h b/lang/cem/libcc.ansi/headers/locale.h
new file mode 100644 (file)
index 0000000..eb572cd
--- /dev/null
@@ -0,0 +1,44 @@
+/*
+ * locale.h - localization
+ */
+/* $Header$ */
+
+#ifndef        _LOCALE_HEADER_
+#define        _LOCALE_HEADER_
+
+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    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 */
+};
+
+#ifndef        NULL
+#define        NULL            0
+#endif /* NULL */
+
+#define        LC_ALL          1
+#define        LC_COLLATE      2
+#define        LC_CTYPE        3
+#define        LC_MONETARY     4
+#define        LC_NUMERIC      5
+#define        LC_TIME         6
+
+
+char           *setlocale(int category, const char *locale);
+struct lconv   *localeconv(void);
+
+#endif /* _LOCALE_HEADER_ */
diff --git a/lang/cem/libcc.ansi/headers/math.h b/lang/cem/libcc.ansi/headers/math.h
new file mode 100644 (file)
index 0000000..91bf6da
--- /dev/null
@@ -0,0 +1,41 @@
+/*
+ * math.h - mathematics
+ */
+/* $Header$ */
+
+#ifndef        _MATH_HEADER_
+#define        _MATH_HEADER_
+
+#include       <float.h>
+#define        HUGE_VAL        DBL_MAX
+
+double acos(double x);
+double asin(double x);
+double atan(double x);
+double atan2(double y, double x);
+
+double cos(double x);
+double sin(double x);
+double tan(double x);
+
+double cosh(double x);
+double sinh(double x);
+double tanh(double x);
+
+double exp(double x);
+double log(double x);
+double log10(double x);
+
+double sqrt(double x);
+double ceil(double x);
+double fabs(double x);
+double floor(double x);
+
+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);
+
+#endif /* _MATH_HEADER_ */
diff --git a/lang/cem/libcc.ansi/headers/mathconst.h b/lang/cem/libcc.ansi/headers/mathconst.h
new file mode 100644 (file)
index 0000000..ba88717
--- /dev/null
@@ -0,0 +1,29 @@
+/*
+ * mathconst.h - mathematic constants
+ */
+/* $Header$ */
+
+#ifndef        _MATHCONST_HEADER_
+#define        _MATHCONST_HEADER_
+
+/* 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_HEADER_ */
diff --git a/lang/cem/libcc.ansi/headers/setjmp.h b/lang/cem/libcc.ansi/headers/setjmp.h
new file mode 100644 (file)
index 0000000..273de89
--- /dev/null
@@ -0,0 +1,17 @@
+/*
+ * setjmp.h - restore calling environment
+ *
+ * (c) copyright 1987 by the Vrije Universiteit, Amsterdam, The Netherlands.
+ * See the copyright notice in the ACK home directory, in the file "Copyright".
+ */
+/* $Header$ */
+
+#ifndef        _SETJMP_HEADER_
+#define        _SETJMP_HEADER_
+
+typedef char jmp_buf[256];
+
+int    setjmp(jmp_buf env);
+void   longjmp(jmp_buf env, int val);
+
+#endif /* _SETJMP_HEADER_ */
diff --git a/lang/cem/libcc.ansi/headers/signal.h b/lang/cem/libcc.ansi/headers/signal.h
new file mode 100644 (file)
index 0000000..a22e3e3
--- /dev/null
@@ -0,0 +1,116 @@
+/*
+ * signal.h - signal handling
+ *
+ * (c) copyright 1987 by the Vrije Universiteit, Amsterdam, The Netherlands.
+ * See the copyright notice in the ACK home directory, in the file "Copyright".
+ */
+/* $Header$ */
+#ifndef        _SIGNAL_HEADER_
+#define        _SIGNAL_HEADER_
+
+typedef        int             sig_atomic_t;
+
+#define        SIG_ERR         (void (*)())-1
+#if    defined(em22) || defined(em24) || defined(em44)
+#define        SIG_DFL         ((void (*)())-2)
+#define        SIG_IGN         ((void (*)())-3)
+#else
+#define        SIG_DFL         ((void (*)())0)
+#define        SIG_IGN         ((void (*)())1)
+#endif /* SIG_ERR */
+
+#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 */
+#ifdef __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
+#else
+#define        _NSIG   16
+#endif /* __USG or __BSD4_2 */
+
+#ifdef __BSD4_2
+struct sigvec {
+       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 {
+       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_ */
diff --git a/lang/cem/libcc.ansi/headers/stdarg.h b/lang/cem/libcc.ansi/headers/stdarg.h
new file mode 100644 (file)
index 0000000..0ac873c
--- /dev/null
@@ -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".
+ */
+/* $Header$ */
+
+#ifndef        _STDARG_HEADER_
+#define        _STDARG_HEADER_
+
+typedef        char    *va_list;
+
+#define        va_start(ap, parmN)     (ap = (char *)&parmN)
+#define        va_arg(ap, type)        ((type *)(ap += sizeof(type)))[0]
+#define        va_end(ap)
+
+#endif /* _STDARG_HEADER_ */
diff --git a/lang/cem/libcc.ansi/headers/stddef.h b/lang/cem/libcc.ansi/headers/stddef.h
new file mode 100644 (file)
index 0000000..06e6236
--- /dev/null
@@ -0,0 +1,35 @@
+/*
+ * stddef.h - common definitions
+ *
+ * (c) copyright 1987 by the Vrije Universiteit, Amsterdam, The Netherlands.
+ * See the copyright notice in the ACK home directory, in the file "Copyright".
+ */
+/* $Header$ */
+
+#ifndef        _STDDEF_HEADER_
+#define        _STDDEF_HEADER_
+
+#ifndef        NULL
+#define        NULL            0
+#endif /* NULL */
+
+/* ??? cast to char pointer necessary? */
+#define        offsetof(type, ident) \
+       (size_t) &(((type *)0)->ident)
+
+#ifndef        _TYPE_PTRDIFF_
+#define        _TYPE_PTRDIFF_
+typedef int    ptrdiff_t;      /* result of substracting two pointers */
+#endif /* _TYPE_PTRDIFF_ */
+
+#ifndef        _TYPE_SIZE_
+#define        _TYPE_SIZE_
+typedef unsigned int   size_t;         /* type returned by sizeof */
+#endif /* _TYPE_SIZE_ */
+
+#ifndef        _TYPE_WCHAR_
+#define        _TYPE_WCHAR_
+typedef char   wchar_t;                /* type expanded character set */
+#endif /* _TYPE_WCHAR_ */
+
+#endif /* _STDEF_HEADER_ */
diff --git a/lang/cem/libcc.ansi/headers/stdio.h b/lang/cem/libcc.ansi/headers/stdio.h
new file mode 100644 (file)
index 0000000..7c4da6b
--- /dev/null
@@ -0,0 +1,125 @@
+/*
+ * stdio.h - input/output definitions
+ *
+ * (c) copyright 1987 by the Vrije Universiteit, Amsterdam, The Netherlands.
+ * See the copyright notice in the ACK home directory, in the file "Copyright".
+ */
+/* $Header$ */
+
+#ifndef        _STDIO_HEADER_
+#define        _STDIO_HEADER_
+
+#include       <stdarg.h>
+
+#define        _NFILES         20
+
+/*
+ * Focus point of all stdio activity.
+ */
+typedef struct _iobuf {
+       int             _fd;
+       int             _count;
+       int             _flags;
+       char            *_tname;
+       unsigned char   *_buf;
+       unsigned char   *_ptr;
+} FILE;
+
+#define        _IOFBF          0000
+#define        _IOREAD         0001
+#define        _IOWRITE        0002
+#define        _IONBF          0004
+#define        _IOMYBUF        0010
+#define        _IOEOF          0020
+#define        _IOERR          0040
+#define        _IOLBF          0100
+
+#define        SEEK_SET        0
+#define        SEEK_CUR        1
+#define        SEEK_END        2
+
+#define        stdin           (&_stdin)
+#define        stdout          (&_stdout)
+#define        stderr          (&_stderr)
+
+#define        BUFSIZ          1024
+#ifndef        NULL
+#define        NULL            0
+#endif /* NULL */
+#ifndef        EOF
+#define        EOF             (-1)
+#endif /* EOF */
+
+#define        FOPEN_MAX       (_NFILES - 3)
+#ifdef __BSD4_2
+#define        FILENAME_MAX    255
+#else
+#define        FILENAME_MAX    14
+#endif /* __BSD4_2 */
+#define        TMP_MAX         1000
+#define        L_tmpnam        (sizeof("/usr/tmp/") + 15)
+
+#ifndef        _TYPE_FPOS_
+#define        _TYPE_FPOS_
+typedef long int       fpos_t;
+#endif /* _TYPE_FPOS */
+
+#ifndef        _TYPE_SIZE_
+#define        _TYPE_SIZE_
+typedef unsigned int   size_t;
+#endif /* _TYPE_SIZE_ */
+
+#define        getchar()       getc(stdin)
+#define        putchar(c)      putc(c,stdout)
+#define        getc(p)         (--(p)->_count >= 0 ? (int) (*(p)->_ptr++) : \
+                               _fillbuf(p))
+#define        putc(c, p)      (--(p)->_count >= 0 ? \
+                        (int) (*(p)->_ptr++ = (c)) : \
+                        _flushbuf((c),(p)))
+
+#define        feof(p)         (((p)->_flags & _IOEOF) != 0)
+#define        ferror(p)       (((p)->_flags & _IOERR) != 0)
+#define        fileno(p)       ((p)->_fd)
+
+
+FILE   *_iotable[_NFILES];
+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_ */
diff --git a/lang/cem/libcc.ansi/headers/stdlib.h b/lang/cem/libcc.ansi/headers/stdlib.h
new file mode 100644 (file)
index 0000000..d385046
--- /dev/null
@@ -0,0 +1,68 @@
+/*
+ * stdlib.h - standard library
+ *
+ * (c) copyright 1987 by the Vrije Universiteit, Amsterdam, The Netherlands.
+ * See the copyright notice in the ACK home directory, in the file "Copyright".
+ */
+/* $Header$ */
+
+#ifndef        _STDLIB_HEADER_
+#define        _STDLIB_HEADER_
+
+#ifndef        NULL
+#define        NULL            0
+#endif /* NULL */
+
+#define        EXIT_FAILURE    1
+#define        EXIT_SUCCESS    0
+#define        RAND_MAX        32767
+#define        MB_CUR_MAX      1
+
+typedef struct { int quot, rem; } div_t;
+typedef struct { long quot, rem; } ldiv_t;
+
+#ifndef        _TYPE_SIZE_
+#define        _TYPE_SIZE_
+typedef unsigned int   size_t;
+#endif /* _TYPE_SIZE_ */
+
+#ifndef        _TYPE_WCHAR_
+#define        _TYPE_WCHAR_
+typedef int    wchar_t;
+#endif /* _TYPE_WCHAR_ */
+
+#ifdef __STDC__
+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,
+                       size_t nmemb, size_t size,
+                       int (*compar)(const void *, const void *));
+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(const 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);
+#endif /* __STDC__ */
+
+#endif /* _STDLIB_HEADER_ */
diff --git a/lang/cem/libcc.ansi/headers/string.h b/lang/cem/libcc.ansi/headers/string.h
new file mode 100644 (file)
index 0000000..8c5348f
--- /dev/null
@@ -0,0 +1,46 @@
+/*
+ * string.h - string handling
+ *
+ * (c) copyright 1987 by the Vrije Universiteit, Amsterdam, The Netherlands.
+ * See the copyright notice in the ACK home directory, in the file "Copyright".
+ */
+/* $Header$ */
+
+#ifndef        _STRING_HEADER_
+#define        _STRING_HEADER_
+
+#ifndef        NULL
+#define        NULL            0
+#endif /* NULL */
+
+#ifndef        _TYPE_SIZE_
+#define        _TYPE_SIZE_
+typedef unsigned int   size_t;         /* type returned by sizeof */
+#endif /* _TYPE_SIZE_ */
+
+#ifdef __STDC__
+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 /* __STDC__ */
+
+#endif /* _STRING_HEADER_ */
diff --git a/lang/cem/libcc.ansi/headers/time.h b/lang/cem/libcc.ansi/headers/time.h
new file mode 100644 (file)
index 0000000..54f24df
--- /dev/null
@@ -0,0 +1,51 @@
+/*
+ * time.h - date and time
+ */
+/* $Header$ */
+
+#ifndef        _TIME_HEADER_
+#define        _TIME_HEADER_
+
+#ifndef        NULL
+#define        NULL            0
+#endif /* NULL */
+
+#ifdef __BSD4_2
+#define        CLK_TCK         60              /* ticks per second */
+#else
+#define        CLK_TCK         1
+#endif /* __BSD4_2 */
+
+#ifndef        _TYPE_SIZE_
+#define        _TYPE_SIZE_
+typedef unsigned int   size_t;         /* type returned by sizeof */
+#endif /* _TYPE_SIZE_ */
+
+typedef        signed  long    time_t;         /* type returned by TOD clock */
+typedef        signed  long    clock_t;        /* type returned by real time clock */
+
+struct tm {
+       int     tm_sec;                 /* seconds after the minute - [0, 59] */
+       int     tm_min;                 /* minutes after the hour - [0, 59] */
+       int     tm_hour;                /* hours since midnight - [0, 28] */
+       int     tm_mday;                /* day of the month - [1, 31] */
+       int     tm_mon;                 /* months since January - [0, 11] */
+       int     tm_year;                /* years since 1900 */
+       int     tm_wday;                /* days since Sunday - [0, 6] */
+       int     tm_yday;                /* days since January 1 - [0, 365] */
+       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,
+                       const char *format,
+                       const struct tm *timeptr);
+
+#endif /* _TIME_HEADER_ */
diff --git a/lang/cem/libcc.ansi/stdlib/abort.c b/lang/cem/libcc.ansi/stdlib/abort.c
new file mode 100644 (file)
index 0000000..d2fc9d3
--- /dev/null
@@ -0,0 +1,15 @@
+/*
+ * (c) copyright 1987 by the Vrije Universiteit, Amsterdam, The Netherlands.
+ * See the copyright notice in the ACK home directory, in the file "Copyright".
+ */
+/* $Header$ */
+
+#include       <signal.h>
+#include       <stdlib.h>
+
+void
+abort(void)
+{
+       raise(SIGABRT);
+}
+
diff --git a/lang/cem/libcc.ansi/stdlib/abs.c b/lang/cem/libcc.ansi/stdlib/abs.c
new file mode 100644 (file)
index 0000000..63b893c
--- /dev/null
@@ -0,0 +1,13 @@
+/*
+ * (c) copyright 1987 by the Vrije Universiteit, Amsterdam, The Netherlands.
+ * See the copyright notice in the ACK home directory, in the file "Copyright".
+ */
+/* $Header$ */
+
+#include       <stdlib.h>
+
+int
+abs(register int i)
+{
+       return i >= 0 ? i : -i;
+}
diff --git a/lang/cem/libcc.ansi/stdlib/atof.c b/lang/cem/libcc.ansi/stdlib/atof.c
new file mode 100644 (file)
index 0000000..20d6c51
--- /dev/null
@@ -0,0 +1,15 @@
+/*
+ * (c) copyright 1987 by the Vrije Universiteit, Amsterdam, The Netherlands.
+ * See the copyright notice in the ACK home directory, in the file "Copyright".
+ */
+/* $Header$ */
+
+#ifndef        NOFLOAT
+#include       <stdlib.h>
+
+double
+atof(const char *nptr)
+{
+       return strtod(nptr, (char **) NULL);
+}
+#endif /* NOFLOAT */
diff --git a/lang/cem/libcc.ansi/stdlib/atoi.c b/lang/cem/libcc.ansi/stdlib/atoi.c
new file mode 100644 (file)
index 0000000..020a458
--- /dev/null
@@ -0,0 +1,13 @@
+/*
+ * (c) copyright 1987 by the Vrije Universiteit, Amsterdam, The Netherlands.
+ * See the copyright notice in the ACK home directory, in the file "Copyright".
+ */
+/* $Header$ */
+
+#include       <stdlib.h>
+
+int
+atoi(const char *nptr)
+{
+       return (int)strtol(nptr, (char **)NULL, 10);
+}
diff --git a/lang/cem/libcc.ansi/stdlib/atol.c b/lang/cem/libcc.ansi/stdlib/atol.c
new file mode 100644 (file)
index 0000000..e178007
--- /dev/null
@@ -0,0 +1,13 @@
+/*
+ * (c) copyright 1987 by the Vrije Universiteit, Amsterdam, The Netherlands.
+ * See the copyright notice in the ACK home directory, in the file "Copyright".
+ */
+/* $Header$ */
+
+#include       <stdlib.h>
+
+long
+atol(const char *nptr)
+{
+       return strtol(nptr, (char **)NULL, 10);
+}
diff --git a/lang/cem/libcc.ansi/stdlib/bsearch.c b/lang/cem/libcc.ansi/stdlib/bsearch.c
new file mode 100644 (file)
index 0000000..aeebf3d
--- /dev/null
@@ -0,0 +1,28 @@
+/*
+ * (c) copyright 1987 by the Vrije Universiteit, Amsterdam, The Netherlands.
+ * See the copyright notice in the ACK home directory, in the file "Copyright".
+ */
+/* $Header$ */
+
+#include       <stdlib.h>
+
+void *
+bsearch(register const void *key, register const void *base,
+       register size_t nmemb, register size_t size,
+       int (*compar)(const void *, const void *))
+{
+       register void *mid_point;
+       register int  cmp;
+
+       while (nmemb > 0) {
+               mid_point = base + size * (nmemb >> 1);
+               if ((cmp = (*compar)(key, mid_point)) == 0)
+                       return(mid_point);
+               if (cmp >= 0) {
+                       base  = mid_point + size;
+                       nmemb = (nmemb - 1) >> 1;
+               } else
+                       nmemb >>= 1;
+       }
+       return((void *)NULL);
+}
diff --git a/lang/cem/libcc.ansi/stdlib/calloc.c b/lang/cem/libcc.ansi/stdlib/calloc.c
new file mode 100644 (file)
index 0000000..90c664c
--- /dev/null
@@ -0,0 +1,24 @@
+/*
+ * (c) copyright 1987 by the Vrije Universiteit, Amsterdam, The Netherlands.
+ * See the copyright notice in the ACK home directory, in the file "Copyright".
+ */
+/* $Header$ */
+
+#include       <stdlib.h>
+
+#define ALIGN(sz)      (((sz)+(sizeof(long)-1)/sizeof(long))*sizeof(long))
+
+void *
+calloc(size_t nelem, size_t elsize)
+{
+       register void *p;
+       register long *q;
+       unsigned int size = ALIGN(nelem * elsize);
+
+       if ((p = malloc(size)) == (void *)NULL)
+               return (void *)NULL;
+       /* "The space is intialized to all bits zero" */
+       q = (long *) (p + size);
+       while ((void *) q > p) *--q = 0;
+       return p;
+}
diff --git a/lang/cem/libcc.ansi/stdlib/div.c b/lang/cem/libcc.ansi/stdlib/div.c
new file mode 100644 (file)
index 0000000..bf27906
--- /dev/null
@@ -0,0 +1,17 @@
+/*
+ * (c) copyright 1987 by the Vrije Universiteit, Amsterdam, The Netherlands.
+ * See the copyright notice in the ACK home directory, in the file "Copyright".
+ */
+/* $Header$ */
+
+#include       <stdlib.h>
+
+div_t
+div(register int numer, register int denom)
+{
+       div_t r;
+
+       r.quot = numer / denom;
+       r.rem = numer % denom;
+       return r;
+}
diff --git a/lang/cem/libcc.ansi/stdlib/exit.c b/lang/cem/libcc.ansi/stdlib/exit.c
new file mode 100644 (file)
index 0000000..8a664a8
--- /dev/null
@@ -0,0 +1,42 @@
+/*
+ * (c) copyright 1987 by the Vrije Universiteit, Amsterdam, The Netherlands.
+ * See the copyright notice in the ACK home directory, in the file "Copyright".
+ */
+/* $Header$ */
+
+#include       <stdlib.h>
+
+#define        NEXITS  32
+
+static void (*functab[NEXITS])(void);
+static int funccnt = 0;
+
+extern void _cleanup(void);
+extern void _exit(int);
+
+static void
+_calls(void)
+{
+       register int i = funccnt;
+       
+       /* "Called in reversed order of their registration" */
+       while (--i >= 0)
+               (*functab[i])();
+}
+
+void
+exit(int status)
+{
+       _calls();
+       _cleanup() ;
+       _exit(status) ;
+}
+
+int
+atexit(void (*func)(void))
+{
+       if (funccnt >= NEXITS)
+               return 1;
+       functab[funccnt++] = func;
+       return 0;
+}
diff --git a/lang/cem/libcc.ansi/stdlib/getenv.c b/lang/cem/libcc.ansi/stdlib/getenv.c
new file mode 100644 (file)
index 0000000..0534312
--- /dev/null
@@ -0,0 +1,28 @@
+/*
+ * (c) copyright 1987 by the Vrije Universiteit, Amsterdam, The Netherlands.
+ * See the copyright notice in the ACK home directory, in the file "Copyright".
+ */
+/* $Header$ */
+
+#include       <stdlib.h>
+
+extern char **environ;
+
+char *
+getenv(const char *name)
+{
+       register char **v = environ;
+       register char *p, *q;
+
+       if (v == (char **)NULL || name == (char *)NULL)
+               return (char *)NULL;
+       while ((p = *v++) != (char *)NULL) {
+               q = name;
+               while (*q && (*q++ == *p++))
+                       /* EMPTY */ ;
+               if (*q || (*p != '='))
+                       continue;
+               return(p+1);
+       }
+       return((char *)NULL);
+}
diff --git a/lang/cem/libcc.ansi/stdlib/labs.c b/lang/cem/libcc.ansi/stdlib/labs.c
new file mode 100644 (file)
index 0000000..ca593ea
--- /dev/null
@@ -0,0 +1,13 @@
+/*
+ * (c) copyright 1987 by the Vrije Universiteit, Amsterdam, The Netherlands.
+ * See the copyright notice in the ACK home directory, in the file "Copyright".
+ */
+/* $Header$ */
+
+#include       <stdlib.h>
+
+long
+labs(register long l)
+{
+       return l >= 0 ? l : -l;
+}
diff --git a/lang/cem/libcc.ansi/stdlib/ldiv.c b/lang/cem/libcc.ansi/stdlib/ldiv.c
new file mode 100644 (file)
index 0000000..7757464
--- /dev/null
@@ -0,0 +1,17 @@
+/*
+ * (c) copyright 1987 by the Vrije Universiteit, Amsterdam, The Netherlands.
+ * See the copyright notice in the ACK home directory, in the file "Copyright".
+ */
+/* $Header$ */
+
+#include       <stdlib.h>
+
+ldiv_t
+ldiv(register long numer, register long denom)
+{
+       ldiv_t r;
+
+       r.quot = numer / denom;
+       r.rem = numer % denom;
+       return r;
+}
diff --git a/lang/cem/libcc.ansi/stdlib/malloc.c b/lang/cem/libcc.ansi/stdlib/malloc.c
new file mode 100644 (file)
index 0000000..0015f51
--- /dev/null
@@ -0,0 +1,127 @@
+/*
+ * (c) copyright 1987 by the Vrije Universiteit, Amsterdam, The Netherlands.
+ * See the copyright notice in the ACK home directory, in the file "Copyright".
+ */
+/* $Header$ */
+
+#include       <stdlib.h>
+
+#define        CLICK_SIZE      4096
+
+#if    EM_WSIZE == EM_PSIZE
+typedef unsigned int vir_bytes;
+#else
+typedef long vir_bytes;
+#endif
+
+
+#define ALIGN(x, a)    (((x) + (a - 1)) & ~(a - 1))
+#define BUSY           1
+#define NEXT(p)                (* (void **) (p))
+
+#ifdef pdp
+#define BUGFIX 64      /* cannot set break in top 64 bytes */
+#else
+#define BUGFIX 0
+#endif
+
+extern void bcopy(void *, void *, size_t);
+extern void *sbrk(unsigned int);
+extern void *brk(unsigned int);
+static void *bottom, *top;
+
+static int
+grow(size_t len)
+{
+       register void *p;
+       register int click = CLICK_SIZE;
+
+       p = sbrk(0);
+       len += (void *) ALIGN((vir_bytes) p, sizeof(void *)) - p;
+       while (click >= 4) {
+               size_t len1 = ALIGN((vir_bytes)p+len+sizeof(char *),click)-(vir_bytes)p;
+               void *p1 = p;
+
+               if (p + len1 + BUGFIX < p || (p1 = sbrk(len1)) == (void *) -1) {
+                       click >>= 1;
+                       continue;
+               }
+               p = p1;
+               if (top + sizeof(void *) != p) {
+                       /* someone else has done an sbrk */
+                       NEXT(top) = (void *) ((vir_bytes) p | BUSY);
+               } else {
+                       for (p = bottom; NEXT(p) != NULL; p = (void *) (* (vir_bytes *) p & ~BUSY))
+                               ;
+               }
+               top = p + len1 - sizeof(void *);
+               NEXT(p) = top;
+               NEXT(top) = NULL;
+               return 1;
+       }
+       return 0;
+}
+
+void *
+malloc(size_t size)
+{
+       register void *p, *next, *new;
+       register size_t len = ALIGN(size, sizeof(void *)) + sizeof(void *);
+
+       if ((p = bottom) == NULL) {
+               p = sbrk(sizeof(void *));
+               sbrk((void *) ALIGN((vir_bytes) p, sizeof(void *)) - p);
+               p = (void *) ALIGN((vir_bytes) p, sizeof(void *));
+               top = bottom = p;
+               NEXT(p) = NULL;
+       }
+       while ((next = NEXT(p)) != NULL)
+               if ((vir_bytes) next & BUSY)            /* already in use */
+                       p = (void *) ((vir_bytes) next & ~BUSY);
+               else {
+                       while ((new = NEXT(next)) != NULL
+                               && !((vir_bytes) new & BUSY))
+                           next = new;
+                       if (next - p >= len) {                  /* fits */
+                               if ((new = p + len) < next)     /* too big */
+                                       NEXT(new) = next;
+                               NEXT(p) = (void *) ((vir_bytes) new | BUSY);
+                               return(p + sizeof(void *));
+                       }
+                       p = next;
+               }
+       return grow(len) ? malloc(size) : (void *)NULL;
+}
+
+void *
+realloc(void *old, size_t size)
+{
+       register void *p = old - sizeof(void *), *next, *new;
+       register size_t len = ALIGN(size, sizeof(void *)) + sizeof(void *), n;
+
+       next = (void *) (* (vir_bytes *) p & ~BUSY);
+       n = next - old;                                 /* old size */
+       while ((new = NEXT(next)) != NULL && !((vir_bytes) new & BUSY))
+               next = new;
+       if (next - p >= len) {                          /* does it still fit */
+               if ((new = p + len) < next) {           /* even too big */
+                       NEXT(new) = next;
+                       NEXT(p) = (void *) ((vir_bytes) new | BUSY);
+               }
+               else
+                       NEXT(p) = (void *) ((vir_bytes) next | BUSY);
+               return(old);
+       }
+       if ((new = malloc(size)) == NULL)               /* it didn't fit */
+               return((void *)NULL);
+       bcopy(old, new, n);                             /* n < size */
+       * (vir_bytes *) p &= ~BUSY;
+       return(new);
+}
+
+void
+free(void *p)
+{
+       if (p != (void *)NULL)
+               *(vir_bytes *) (p - sizeof(void *)) &= ~BUSY;
+}
diff --git a/lang/cem/libcc.ansi/stdlib/mblen.c b/lang/cem/libcc.ansi/stdlib/mblen.c
new file mode 100644 (file)
index 0000000..38a901c
--- /dev/null
@@ -0,0 +1,20 @@
+/*
+ * (c) copyright 1987 by the Vrije Universiteit, Amsterdam, The Netherlands.
+ * See the copyright notice in the ACK home directory, in the file "Copyright".
+ */
+/* $Header$ */
+
+#include       <stdlib.h>
+#include       <limits.h>
+
+int
+mblen(const char *s, size_t n)
+{
+       if (s == (char *)NULL)
+               return 0;
+       if (*s == '\0')
+               return 0;
+       if (n < 1 || n > MB_CUR_MAX)
+               return -1;
+       return MB_LEN_MAX;
+}
diff --git a/lang/cem/libcc.ansi/stdlib/mbstowcs.c b/lang/cem/libcc.ansi/stdlib/mbstowcs.c
new file mode 100644 (file)
index 0000000..0d2c575
--- /dev/null
@@ -0,0 +1,24 @@
+/*
+ * (c) copyright 1987 by the Vrije Universiteit, Amsterdam, The Netherlands.
+ * See the copyright notice in the ACK home directory, in the file "Copyright".
+ */
+/* $Header$ */
+
+#include       <stdlib.h>
+#include       <locale.h>
+#include       <limits.h>
+
+size_t
+mbstowcs(register wchar_t *pwcs, register const char *s, size_t n)
+{
+       register int i = 0;
+
+       while (i < n) {
+               i++;
+               *pwcs++ = *s++;
+               if (*s == '\0')
+                       return i;
+       }
+       return n;
+}
+
diff --git a/lang/cem/libcc.ansi/stdlib/mbtowc.c b/lang/cem/libcc.ansi/stdlib/mbtowc.c
new file mode 100644 (file)
index 0000000..6e4a015
--- /dev/null
@@ -0,0 +1,22 @@
+/*
+ * (c) copyright 1987 by the Vrije Universiteit, Amsterdam, The Netherlands.
+ * See the copyright notice in the ACK home directory, in the file "Copyright".
+ */
+/* $Header$ */
+
+#include       <stdlib.h>
+#include       <limits.h>
+
+int
+mbtowc(register wchar_t *pwc, register const char *s, size_t n)
+{
+       if (s == (char *)NULL)
+               return 0;
+       if (*s == '\0')
+               return 0;
+       if (n < 1 || n > MB_CUR_MAX)
+               return -1;
+       if (pwc != (wchar_t *)NULL)
+               *pwc = *s;
+       return MB_CUR_MAX;
+}
diff --git a/lang/cem/libcc.ansi/stdlib/qsort.c b/lang/cem/libcc.ansi/stdlib/qsort.c
new file mode 100644 (file)
index 0000000..2804ae1
--- /dev/null
@@ -0,0 +1,137 @@
+/*
+ * (c) copyright 1987 by the Vrije Universiteit, Amsterdam, The Netherlands.
+ * See the copyright notice in the ACK home directory, in the file "Copyright".
+ */
+/* $Header$ */
+
+#include       <stdlib.h>
+
+static void qsort1(void *, void *, size_t);
+static int (*qcompar)(const void *, const void *);
+static void qexchange(void *, void *, size_t);
+static void q3exchange(void *, void *, void *, size_t);
+
+void
+qsort(void *base, size_t nel, size_t width,
+      int (*compar)(const void *, const void *))
+{
+       qcompar = compar;
+       qsort1(base, base + (nel - 1) * width, width);
+}
+
+static void
+qsort1(void *a1, void *a2, register size_t width)
+{
+       register const void *left, *right;
+       register const void *lefteq, *righteq;
+       int cmp;
+
+       for (;;) {
+               if (a2 <= a1) return;
+               left = a1;
+               right = a2;
+               lefteq = righteq = a1 + width * (((a2-a1)+width)/(2*width));
+               /*
+                  Pick an element in the middle of the array.
+                  We will collect the equals around it.
+                  "lefteq" and "righteq" indicate the left and right
+                  bounds of the equals respectively.
+                  Smaller elements end up left of it, larger elements end
+                  up right of it.
+               */
+again:
+               while (left < lefteq && (cmp = (*qcompar)(left, lefteq)) <= 0) {
+                       if (cmp < 0) {
+                               /* leave it where it is */
+                               left += width;
+                       }
+                       else {
+                               /* equal, so exchange with the element to
+                                  the left of the "equal"-interval.
+                               */
+                               lefteq -= width;
+                               qexchange(left, lefteq, width);
+                       }
+               }
+               while (right > righteq) {
+                       if ((cmp = (*qcompar)(right, righteq)) < 0) {
+                               /* smaller, should go to left part
+                               */
+                               if (left < lefteq) {
+                                       /* yes, we had a larger one at the
+                                          left, so we can just exchange
+                                       */
+                                       qexchange(left, right, width);
+                                       left += width;
+                                       right -= width;
+                                       goto again;
+                               }
+                               /* no more room at the left part, so we
+                                  move the "equal-interval" one place to the
+                                  right, and the smaller element to the
+                                  left of it.
+                                  This is best expressed as a three-way
+                                  exchange.
+                               */
+                               righteq += width;
+                               q3exchange(left, righteq, right, width);
+                               lefteq += width;
+                               left = lefteq;
+                       }
+                       else if (cmp == 0) {
+                               /* equal, so exchange with the element to
+                                  the right of the "equal-interval"
+                               */
+                               righteq += width;
+                               qexchange(right, righteq, width);
+                       }
+                       else    /* just leave it */ right -= width;
+               }
+               if (left < lefteq) {
+                       /* larger element to the left, but no more room,
+                          so move the "equal-interval" one place to the
+                          left, and the larger element to the right
+                          of it.
+                       */
+                       lefteq -= width;
+                       q3exchange(right, lefteq, left, width);
+                       righteq -= width;
+                       right = righteq;
+                       goto again;
+               }
+               /* now sort the "smaller" part */
+               qsort1(a1, lefteq - width, width);
+               /* and now the larger, saving a subroutine call
+                  because of the for(;;)
+               */
+               a1 = righteq + width;
+       }
+       /*NOTREACHED*/
+}
+
+static void
+qexchange(register void *p, register void *q,
+         register size_t n)
+{
+       register int c;
+
+       while (n-- > 0) {
+               c = *p;
+               *p++ = *q;
+               *q++ = c;
+       }
+}
+
+static void
+q3exchange(register void *p, register void *q, register void *r,
+          register size_t n)
+{
+       register int c;
+
+       while (n-- > 0) {
+               c = *p;
+               *p++ = *r;
+               *r++ = *q;
+               *q++ = c;
+       }
+}
diff --git a/lang/cem/libcc.ansi/stdlib/rand.c b/lang/cem/libcc.ansi/stdlib/rand.c
new file mode 100644 (file)
index 0000000..b510b1e
--- /dev/null
@@ -0,0 +1,20 @@
+/*
+ * (c) copyright 1987 by the Vrije Universiteit, Amsterdam, The Netherlands.
+ * See the copyright notice in the ACK home directory, in the file "Copyright".
+ */
+/* $Header$ */
+
+#include       <stdlib.h>
+
+static unsigned long int next = 1;
+
+int rand(void)
+{
+       next = next * 1103515245 + 12345;
+       return((unsigned int)(next/(2 * (RAND_MAX +1)) % (RAND_MAX+1));
+}
+
+void srand(unsigned int seed)
+{
+       next = seed;
+}
diff --git a/lang/cem/libcc.ansi/stdlib/strtod.c b/lang/cem/libcc.ansi/stdlib/strtod.c
new file mode 100644 (file)
index 0000000..9a3b0c3
--- /dev/null
@@ -0,0 +1,103 @@
+/*
+ * (c) copyright 1987 by the Vrije Universiteit, Amsterdam, The Netherlands.
+ * See the copyright notice in the ACK home directory, in the file "Copyright".
+ */
+/* $Header$ */
+
+#ifndef        NOFLOAT
+#include       <ctype.h>
+#include       <limits.h>
+#include       <math.h>
+#include       <stdlib.h>
+
+#define        MAX     (LONG_MAX/10)
+
+double
+strtod(register const char *p, register char **pp)
+{
+       register int c;
+       int exp = 0, sign = 1, expsign = 0;
+       double fl;
+       long lowl = 0, highl = 0, pos = 1;
+       int dotseen = 0;
+       int digit_seen = 0;
+
+       if (pp) *pp = p;
+       while (isspace(*p)) p++;
+       c = *p;
+
+       switch (c) {
+       case '-':
+               sign = -1;
+               /* fallthrough */
+       case '+': 
+               p++;
+       }
+
+       while (isdigit(c = *p++) || (c == '.' && ! dotseen++)) {
+               if (c == '.') continue;
+               digit_seen = 1;
+               if (highl < MAX) {
+                       highl = (highl << 3) + (highl << 1) + (c - '0');
+               }
+               else if (pos < MAX) {
+                       pos = (pos << 3) + (pos << 1);
+                       lowl = (lowl << 3) + (lowl << 1) + (c - '0');
+               }
+               else exp++;
+               if (dotseen) exp--;
+       }
+       if (! digit_seen) return 0.0;
+       fl = highl;
+       if (pos > 1) {
+               fl = pos * fl + lowl;
+       }
+
+       if (pp) *pp = p-1;
+
+       if (c == 'E' || c == 'e') {
+               int exp1 = 0;
+               int sign = 1;
+
+               switch (*p) {
+               case '-':
+                       sign = -1;
+                       /* fallthrough */
+               case '+':
+                       p++;
+               }
+               if (isdigit(c = *p)) {
+                       do {
+                               exp1 = 10 * exp1 + c - '0';
+                       } while (isdigit(c = *++p));
+                       if (pp) *pp = p;
+               }
+               exp += sign * exp1;
+       }
+
+       if (fl == 0.0) return 0.0;
+
+       if (exp < 0) {
+               expsign = 1;
+               exp = -exp;
+       }
+
+       if (exp != 0) {
+                int oldexp = exp;
+                double exp5 = 5.0;
+                double correction = 1.0;
+                while (exp) {
+                        if (exp % 2) correction *= exp5;
+                        exp /= 2;
+                        if (exp != 0) exp5 *= exp5;
+                }
+                if (expsign) fl = fl / correction;
+                else    fl = fl * correction;
+                fl = ldexp(fl, expsign ? -oldexp : oldexp);
+       }
+
+       return sign * fl;
+}
+#endif
diff --git a/lang/cem/libcc.ansi/stdlib/strtol.c b/lang/cem/libcc.ansi/stdlib/strtol.c
new file mode 100644 (file)
index 0000000..e7766f3
--- /dev/null
@@ -0,0 +1,53 @@
+/*
+ * (c) copyright 1987 by the Vrije Universiteit, Amsterdam, The Netherlands.
+ * See the copyright notice in the ACK home directory, in the file "Copyright".
+ */
+/* $Header$ */
+
+#include       <stdlib.h>
+#include       <ctype.h>
+
+long int
+strtol(register const char *p, char **pp, int base)
+{
+       register long val, v;
+       register int c;
+       int sign = 1;
+
+       if (pp) *pp = p;
+       while (isspace(*p)) p++;
+       c = *p;
+
+       switch (c) {
+       case '-':
+               sign = -1;
+               /* fallthrough */
+       case '+':
+               p++;
+       }
+
+       /* this is bizare */
+       if (base==16 && *p=='0' && (*(p+1)=='x' || *(p+1)=='X'))
+               p += 2;
+
+       while (isdigit(c = *p++) || isalpha(c)) {
+               if (isalpha(c))
+                       v = 10 + (isupper(c) ? c - 'A' : c - 'a');
+               else
+                       v = c - '0';
+               if (v >= base) {
+                       p--;
+                       break;
+               }
+               val = (val * base) + v;
+       }
+       if (pp) *pp = p-1;
+       return sign * val;
+}
+
+
+unsigned long int
+strtoul(register const char *p, char **pp, int base)
+{
+       return (unsigned long)strtol(p, pp, base);
+}
diff --git a/lang/cem/libcc.ansi/stdlib/system.c b/lang/cem/libcc.ansi/stdlib/system.c
new file mode 100644 (file)
index 0000000..afe38aa
--- /dev/null
@@ -0,0 +1,47 @@
+/*
+ * (c) copyright 1987 by the Vrije Universiteit, Amsterdam, The Netherlands.
+ * See the copyright notice in the ACK home directory, in the file "Copyright".
+ */
+/* $Header$ */
+
+#include       <stdlib.h>
+#include       <signal.h>
+
+extern int fork(void);
+extern int wait(int *);
+extern void _exit(int);
+extern void execl(char *, ...);
+extern void close(int);
+
+#define        FAIL    127
+
+int
+system(const char *str)
+{
+       int pid, exitstatus, waitval;
+       int i;
+
+       if ((pid = fork()) < 0) return str ? -1 : 0;
+
+       if (pid == 0) {
+               for (i = 3; i <= 20; i++)
+                       close(i);
+               if (!str) str = "cd .";         /* just testing for a shell */
+               execl("/bin/sh", "sh", "-c", str, (char *) NULL);
+               /* get here if execl fails ... */
+               _exit(FAIL);    /* see manual page */
+       }
+       while ((waitval = wait(&exitstatus)) != pid) {
+               if (waitval == -1) break;
+       }
+       if (waitval == -1) {
+               /* no child ??? or maybe interrupted ??? */
+               exitstatus = -1;
+       }
+       if (!str) {
+               if (exitstatus == FAIL << 8)            /* execl() failed */
+                       exitstatus = 0;
+               else exitstatus = 1;                    /* /bin/sh exists */
+       }
+       return exitstatus;
+}
diff --git a/lang/cem/libcc.ansi/stdlib/wcstombs.c b/lang/cem/libcc.ansi/stdlib/wcstombs.c
new file mode 100644 (file)
index 0000000..8e2e8e7
--- /dev/null
@@ -0,0 +1,23 @@
+/*
+ * (c) copyright 1987 by the Vrije Universiteit, Amsterdam, The Netherlands.
+ * See the copyright notice in the ACK home directory, in the file "Copyright".
+ */
+/* $Header$ */
+
+#include       <stdlib.h>
+#include       <locale.h>
+#include       <limits.h>
+
+size_t
+wcstombs(register char *s, register const wchar_t *pwcs, size_t n)
+{
+       register int i = 0;
+
+       while (i < n) {
+               i++;
+               *s++ = *pwcs++;
+               if (*s == '\0')
+                       return i;
+       }
+       return n;
+}
diff --git a/lang/cem/libcc.ansi/stdlib/wctomb.c b/lang/cem/libcc.ansi/stdlib/wctomb.c
new file mode 100644 (file)
index 0000000..bc8defc
--- /dev/null
@@ -0,0 +1,19 @@
+/*
+ * (c) copyright 1987 by the Vrije Universiteit, Amsterdam, The Netherlands.
+ * See the copyright notice in the ACK home directory, in the file "Copyright".
+ */
+/* $Header$ */
+
+#include       <stdlib.h>
+#include       <limits.h>
+
+int
+wctomb(char *s, wchar_t wchar)
+{
+       if (s != (char *)NULL) {
+               *s = wchar;
+               return MB_LEN_MAX;
+       } else
+               return 0;
+}
+