Renamed the language libraries and runtimes to have more
conventional names.
This commit is contained in:
58
lang/cem/libcc/gen/getopt.c
Normal file
58
lang/cem/libcc/gen/getopt.c
Normal file
@@ -0,0 +1,58 @@
|
||||
/* $Header$ */
|
||||
#include <stdio.h>
|
||||
#define ERR(s, c) if(opterr){\
|
||||
fputs(argv[0], stderr);\
|
||||
fputs(s, stderr);\
|
||||
fputc(c, stderr);\
|
||||
fputc('\n', stderr);}
|
||||
|
||||
int opterr = 1;
|
||||
int optind = 1;
|
||||
int optopt;
|
||||
char *optarg;
|
||||
char *index();
|
||||
|
||||
int
|
||||
getopt (argc, argv, opts)
|
||||
char **argv, *opts;
|
||||
{
|
||||
static int sp = 1;
|
||||
register c;
|
||||
register char *cp;
|
||||
|
||||
if (sp == 1)
|
||||
if (optind >= argc ||
|
||||
argv[optind][0] != '-' || argv[optind][1] == '\0')
|
||||
return EOF;
|
||||
else if (strcmp(argv[optind], "--") == NULL) {
|
||||
optind++;
|
||||
return EOF;
|
||||
}
|
||||
optopt = c = argv[optind][sp];
|
||||
if (c == ':' || (cp=index(opts, c)) == NULL) {
|
||||
ERR (": illegal option -- ", c);
|
||||
if (argv[optind][++sp] == '\0') {
|
||||
optind++;
|
||||
sp = 1;
|
||||
}
|
||||
return '?';
|
||||
}
|
||||
if (*++cp == ':') {
|
||||
if (argv[optind][sp+1] != '\0')
|
||||
optarg = &argv[optind++][sp+1];
|
||||
else if (++optind >= argc) {
|
||||
ERR (": option requires an argument -- ", c);
|
||||
sp = 1;
|
||||
return '?';
|
||||
} else
|
||||
optarg = argv[optind++];
|
||||
sp = 1;
|
||||
} else {
|
||||
if (argv[optind][++sp] == '\0') {
|
||||
sp = 1;
|
||||
optind++;
|
||||
}
|
||||
optarg = NULL;
|
||||
}
|
||||
return c;
|
||||
}
|
||||
@@ -5,7 +5,7 @@ local d = ROOTDIR.."lang/cem/libcc/gen/"
|
||||
|
||||
local head = acklibrary {
|
||||
ackfile (d.."head_cc.e"),
|
||||
install = pm.install("%BINDIR%%PLATIND%/%PLATFORM%/head_cc")
|
||||
install = pm.install("%BINDIR%%PLATIND%/%PLATFORM%/c-knr.o")
|
||||
}
|
||||
|
||||
local tail = acklibrary {
|
||||
@@ -83,7 +83,7 @@ local tail = acklibrary {
|
||||
ackfile (d.."modf.e"),
|
||||
ackfile (d.."setjmp.e"),
|
||||
|
||||
install = pm.install("%BINDIR%%PLATIND%/%PLATFORM%/tail_cc.2g")
|
||||
install = pm.install("%BINDIR%%PLATIND%/%PLATFORM%/libc-knr.a")
|
||||
}
|
||||
|
||||
lang_cem_gen_runtime = group {
|
||||
|
||||
38
lang/cem/libcc/math/cosh.c
Normal file
38
lang/cem/libcc/math/cosh.c
Normal file
@@ -0,0 +1,38 @@
|
||||
/*
|
||||
* (c) copyright 1988 by the Vrije Universiteit, Amsterdam, The Netherlands.
|
||||
* See the copyright notice in the ACK home directory, in the file "Copyright".
|
||||
*
|
||||
* Author: Ceriel J.H. Jacobs
|
||||
*/
|
||||
|
||||
/* $Header$ */
|
||||
|
||||
#include <math.h>
|
||||
#include <errno.h>
|
||||
|
||||
extern int errno;
|
||||
|
||||
double
|
||||
cosh(x)
|
||||
double x;
|
||||
{
|
||||
extern double exp();
|
||||
|
||||
if (x < 0) {
|
||||
x = -x;
|
||||
}
|
||||
if (x > M_LN_MAX_D) {
|
||||
/* exp(x) would overflow */
|
||||
if (x >= M_LN_MAX_D + M_LN2) {
|
||||
/* not representable */
|
||||
x = HUGE;
|
||||
errno = ERANGE;
|
||||
}
|
||||
else x = exp (x - M_LN2);
|
||||
}
|
||||
else {
|
||||
double expx = exp(x);
|
||||
x = 0.5 * (expx + 1.0/expx);
|
||||
}
|
||||
return x;
|
||||
}
|
||||
@@ -27,5 +27,5 @@ lang_cem_math_runtime = acklibrary {
|
||||
ackfile (d.."exp.c"),
|
||||
ackfile (d.."floor.c"),
|
||||
|
||||
install = pm.install("%BINDIR%%PLATIND%/%PLATFORM%/tail_m")
|
||||
install = pm.install("%BINDIR%%PLATIND%/%PLATFORM%/libm-knr.a")
|
||||
}
|
||||
|
||||
@@ -97,5 +97,5 @@ lang_cem_mon_runtime = acklibrary {
|
||||
ackfile (d.."_wait.e"),
|
||||
ackfile (d.."_write.e"),
|
||||
|
||||
install = pm.install("%BINDIR%%PLATIND%/%PLATFORM%/tail_mon")
|
||||
install = pm.install("%BINDIR%%PLATIND%/%PLATFORM%/libmon.a")
|
||||
}
|
||||
|
||||
@@ -54,5 +54,5 @@ lang_cem_stdio_runtime = acklibrary {
|
||||
ackfile (d.."timezone.c"),
|
||||
ackfile (d.."ungetc.c"),
|
||||
|
||||
install = pm.install("%BINDIR%%PLATIND%/%PLATFORM%/tail_cc.1s")
|
||||
install = pm.install("%BINDIR%%PLATIND%/%PLATFORM%/libc-stdio-knr.a")
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user