Port to Elk 3.99 and modern C
This commit is contained in:
parent
0d0d0afbfd
commit
861bc7c177
|
@ -273,9 +273,9 @@
|
||||||
(loop (read-line))))))
|
(loop (read-line))))))
|
||||||
(cond
|
(cond
|
||||||
((string=? delim "##")
|
((string=? delim "##")
|
||||||
(with-output-to-stream '[##]
|
(with-output-to-stream 'hash-hash
|
||||||
(copy-exec ".##\n" "inline Scheme execution"))
|
(copy-exec ".##\n" "inline Scheme execution"))
|
||||||
(let ((p (open-input-string (stream->string '[##]))))
|
(let ((p (open-input-string (stream->string 'hash-hash))))
|
||||||
(copy-apply (lambda () (read p)) \##-eval)))
|
(copy-apply (lambda () (read p)) \##-eval)))
|
||||||
((string=? delim ">>")
|
((string=? delim ">>")
|
||||||
(copy-exec ".>>\n" "transparent output"))
|
(copy-exec ".>>\n" "transparent output"))
|
||||||
|
|
|
@ -37,10 +37,7 @@ void fatal_error(char *fmt, ...) {
|
||||||
exit(1);
|
exit(1);
|
||||||
}
|
}
|
||||||
|
|
||||||
static char *strerr(void) {
|
static const char *strerr(void) {
|
||||||
extern int sys_nerr;
|
|
||||||
extern char *sys_errlist[];
|
|
||||||
|
|
||||||
return errno > 0 && errno < sys_nerr ?
|
return errno > 0 && errno < sys_nerr ?
|
||||||
sys_errlist[errno] : "unknown error";
|
sys_errlist[errno] : "unknown error";
|
||||||
}
|
}
|
||||||
|
|
|
@ -12,9 +12,5 @@ void read_error(char *) NORETURN;
|
||||||
void write_error(char *) NORETURN;
|
void write_error(char *) NORETURN;
|
||||||
void open_error(char *) NORETURN;
|
void open_error(char *) NORETURN;
|
||||||
|
|
||||||
/* Redefined to add NORETURN
|
|
||||||
*/
|
|
||||||
extern Primitive_Error() NORETURN;
|
|
||||||
|
|
||||||
char *printable_string(char *, int);
|
char *printable_string(char *, int);
|
||||||
char *printable_char(char);
|
char *printable_char(char);
|
||||||
|
|
|
@ -170,7 +170,7 @@ err: *p = 0;
|
||||||
assert(0);
|
assert(0);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
if (!finite(acc)) {
|
if (!isfinite(acc)) {
|
||||||
warn("expression evaluates to infinity"); goto err;
|
warn("expression evaluates to infinity"); goto err;
|
||||||
}
|
}
|
||||||
return acc;
|
return acc;
|
||||||
|
|
|
@ -154,7 +154,8 @@ int main(int ac, char **av) {
|
||||||
directory = DEFAULT_DIR;
|
directory = DEFAULT_DIR;
|
||||||
if ((format = getenv(DEFAULT_FORMAT_ENV)) == 0)
|
if ((format = getenv(DEFAULT_FORMAT_ENV)) == 0)
|
||||||
format = DEFAULT_FORMAT;
|
format = DEFAULT_FORMAT;
|
||||||
eav = safe_malloc((ac+1+2) * sizeof(char *)); /* ac + -p xxx + 0-ptr */
|
/* av[0] "-g", "-p", "xxx", av[1...] NULL */
|
||||||
|
eav = safe_malloc((ac+3+1) * sizeof(char *));
|
||||||
eav[0] = av[0];
|
eav[0] = av[0];
|
||||||
opterr = 0;
|
opterr = 0;
|
||||||
while ((c = getopt(ac, av, "h:gm:f:tC")) != EOF) {
|
while ((c = getopt(ac, av, "h:gm:f:tC")) != EOF) {
|
||||||
|
@ -180,6 +181,7 @@ int main(int ac, char **av) {
|
||||||
return 1;
|
return 1;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
eav[eac++] = "-g"; /* We need symbols to be case-sensitive. */
|
||||||
/* Set the Elk load-path to $(directory)/elk, so that a minimal,
|
/* Set the Elk load-path to $(directory)/elk, so that a minimal,
|
||||||
* self-contained Elk runtime environment can be shipped with
|
* self-contained Elk runtime environment can be shipped with
|
||||||
* binary distributions. Sites with a full Elk can symlink
|
* binary distributions. Sites with a full Elk can symlink
|
||||||
|
|
11
src/unroff.h
11
src/unroff.h
|
@ -26,18 +26,9 @@ extern long strtol(const char *s, char **endp, int base);
|
||||||
extern double strtod(const char *s, char **endp);
|
extern double strtod(const char *s, char **endp);
|
||||||
extern int pclose(FILE *);
|
extern int pclose(FILE *);
|
||||||
extern int system(const char *);
|
extern int system(const char *);
|
||||||
#ifndef tolower
|
|
||||||
extern int tolower(int);
|
|
||||||
#endif
|
|
||||||
|
|
||||||
/* Prototypes for IEEE FP functions that may be missing:
|
|
||||||
*/
|
|
||||||
#ifndef finite
|
|
||||||
extern int finite(double);
|
|
||||||
#endif
|
|
||||||
|
|
||||||
|
|
||||||
#include "scheme.h"
|
#include <elk/scheme.h>
|
||||||
|
|
||||||
/* Prototypes that were missing from "scheme.h" in some Elk releases:
|
/* Prototypes that were missing from "scheme.h" in some Elk releases:
|
||||||
*/
|
*/
|
||||||
|
|
Loading…
Reference in New Issue