summaryrefslogtreecommitdiffstats
path: root/repl.c
diff options
context:
space:
mode:
authorBryan Newbold <bnewbold@robocracy.org>2017-02-20 00:05:31 -0800
committerBryan Newbold <bnewbold@robocracy.org>2017-02-20 00:05:31 -0800
commitae2b295c7deaf2d7c18ad1ed9b6050970e56bae7 (patch)
treeeee15e02ae016333546d3841712be591b2bcb06f /repl.c
parent302e3218b7d487539ec305bf23881a6ee7d5be99 (diff)
downloadscm-ae2b295c7deaf2d7c18ad1ed9b6050970e56bae7.tar.gz
scm-ae2b295c7deaf2d7c18ad1ed9b6050970e56bae7.zip
Import Upstream version 5e2upstream/5e2
Diffstat (limited to 'repl.c')
-rw-r--r--repl.c80
1 files changed, 40 insertions, 40 deletions
diff --git a/repl.c b/repl.c
index a3204dc..a8856ae 100644
--- a/repl.c
+++ b/repl.c
@@ -44,12 +44,12 @@
#include "scm.h"
#include "setjump.h"
-void igc P((char *what, STACKITEM *stackbase));
+void igc P((const char *what, STACKITEM *stackbase));
void unexec P((char *new_name, char *a_name, unsigned data_start,
unsigned bss_start, unsigned entry_address));
void scm_fill_freelist P((void));
-#ifdef __CYGWIN32__
+#ifdef __CYGWIN__
# include <sys/types.h>
#endif
@@ -155,7 +155,7 @@ static char s_freshline[] = "freshline";
static char s_eofin[] = "end of file in ";
static char s_unknown_sharp[] = "unknown # object";
-static SCM lread1 P((SCM port, int flgs, char *what));
+static SCM lread1 P((SCM port, int flgs, const char *what));
static SCM lreadr P((SCM tok_buf, SCM port, int flgs));
static SCM lreadpr P((SCM tok_buf, SCM port, int flgs));
static SCM lreadparen P((SCM tok_buf, SCM port, int flgs, char *name));
@@ -203,12 +203,12 @@ void iprlist(hdr, exp, tlr, port, writing)
exp = GCCDR(exp); /* CDR(exp); */
for(;NIMP(exp);exp = GCCDR(exp) /* CDR(exp)*/) {
if (!scm_cell_p(~1L & exp)) break;
- if NECONSP(exp) break;
+ if (NECONSP(exp)) break;
lputc(' ', port);
/* CHECK_INTS; */
iprin1(CAR(exp), port, writing);
}
- if NNULLP(exp) {
+ if (NNULLP(exp)) {
lputs(" . ", port);
iprin1(exp, port, writing);
}
@@ -227,7 +227,7 @@ taloop:
intprint(INUM(exp), 10, port);
break;
case 4:
- if ICHRP(exp) {
+ if (ICHRP(exp)) {
i = ICHR(exp);
if (writing) lputs("#\\", port);
if (!writing) lputc((int)i, port);
@@ -247,7 +247,7 @@ taloop:
}
else if (IFLAGP(exp) && (ISYMNUM(exp)<(sizeof isymnames/sizeof(char *))))
lputs(ISYMCHARS(exp), port);
- else if ILOCP(exp) {
+ else if (ILOCP(exp)) {
lputs("#@", port);
intprint((long)IFRAME(exp), -10, port);
lputc(ICDRP(exp)?'-':'+', port);
@@ -470,7 +470,7 @@ static int input_waiting(f)
SCM char_readyp(port)
SCM port;
{
- if UNBNDP(port) port = cur_inp;
+ if (UNBNDP(port)) port = cur_inp;
ASRTER(NIMP(port) && OPINPORTP(port), port, ARG1, s_char_readyp);
if (CRDYP(port) || !(BUF0 & SCM_PORTFLAGS(port))) return BOOL_T;
return input_waiting(STREAM(port)) ? BOOL_T : BOOL_F;
@@ -500,7 +500,7 @@ SCM wait_for_input(args)
ASRTER(!NULLP(args), INUM0, WNA, s_wfi);
how_long = CAR(args);
args = CDR(args);
- if NULLP(args) port1 = cur_inp;
+ if (NULLP(args)) port1 = cur_inp;
else {
port1 = CAR(args);
args = CDR(args);
@@ -595,7 +595,7 @@ static SCM *loc_broken_pipe = 0;
/* returning non-zero means try again. */
int scm_io_error(port, what)
SCM port;
- char *what;
+ const char *what;
{
#ifdef HAVE_PIPE
# ifdef EPIPE
@@ -636,7 +636,7 @@ static char s_flush[] = "force-output";
SCM lflush(port) /* user accessible as force-output */
SCM port;
{
- if UNBNDP(port) port = cur_outp;
+ if (UNBNDP(port)) port = cur_outp;
else ASRTER(NIMP(port) && OPOUTPORTP(port), port, ARG1, s_flush);
{
sizet i = PTOBNUM(port);
@@ -650,7 +650,7 @@ SCM lflush(port) /* user accessible as force-output */
SCM lwrite(obj, port)
SCM obj, port;
{
- if UNBNDP(port) port = cur_outp;
+ if (UNBNDP(port)) port = cur_outp;
else ASRTER(NIMP(port) && OPOUTPORTP(port), port, ARG2, s_write);
iprin1(obj, port, 1);
return UNSPECIFIED;
@@ -658,7 +658,7 @@ SCM lwrite(obj, port)
SCM display(obj, port)
SCM obj, port;
{
- if UNBNDP(port) port = cur_outp;
+ if (UNBNDP(port)) port = cur_outp;
else ASRTER(NIMP(port) && OPOUTPORTP(port), port, ARG2, s_display);
iprin1(obj, port, 0);
return UNSPECIFIED;
@@ -666,7 +666,7 @@ SCM display(obj, port)
SCM newline(port)
SCM port;
{
- if UNBNDP(port) port = cur_outp;
+ if (UNBNDP(port)) port = cur_outp;
else ASRTER(NIMP(port) && OPOUTPORTP(port), port, ARG1, s_newline);
lputc('\n', port);
if (port==cur_outp) lfflush(port);
@@ -675,7 +675,7 @@ SCM newline(port)
SCM write_char(chr, port)
SCM chr, port;
{
- if UNBNDP(port) port = cur_outp;
+ if (UNBNDP(port)) port = cur_outp;
else ASRTER(NIMP(port) && OPOUTPORTP(port), port, ARG2, s_write_char);
ASRTER(ICHRP(chr), chr, ARG1, s_write_char);
lputc((int)ICHR(chr), port);
@@ -684,7 +684,7 @@ SCM write_char(chr, port)
SCM scm_freshline(port)
SCM port;
{
- if UNBNDP(port) port = cur_outp;
+ if (UNBNDP(port)) port = cur_outp;
else ASRTER(NIMP(port) && OPOUTPORTP(port), port, ARG1, s_freshline);
if (INUM0==scm_port_col(port)) return UNSPECIFIED;
lputc('\n', port);
@@ -713,7 +713,7 @@ void lputc(c, port)
}
}
void lputs(s, port)
- char *s;
+ const char *s;
SCM port;
{
sizet i = PTOBNUM(port);
@@ -817,7 +817,7 @@ SCM scm_read_char(port)
SCM port;
{
int c;
- if UNBNDP(port) port = cur_inp;
+ if (UNBNDP(port)) port = cur_inp;
ASRTER(NIMP(port) && OPINPORTP(port), port, ARG1, s_read_char);
c = lgetc(port);
if (EOF==c) return EOF_VAL;
@@ -827,7 +827,7 @@ SCM peek_char(port)
SCM port;
{
int c;
- if UNBNDP(port) port = cur_inp;
+ if (UNBNDP(port)) port = cur_inp;
else ASRTER(NIMP(port) && OPINPORTP(port), port, ARG1, s_peek_char);
c = lgetc(port);
if (EOF==c) return EOF_VAL;
@@ -888,11 +888,11 @@ SCM scm_read_numbered(port)
static SCM lread1(port, flgs, what)
SCM port;
int flgs;
- char *what;
+ const char *what;
{
int c;
SCM tok_buf;
- if UNBNDP(port) port = cur_inp;
+ if (UNBNDP(port)) port = cur_inp;
ASRTER(NIMP(port) && OPINPORTP(port), port, ARG1, what);
do {
c = flush_ws(port);
@@ -972,7 +972,7 @@ static SCM lreadpr(tok_buf, port, flgs)
if (loc_charsharp && NIMP(*loc_charsharp)) {
resizuve(tok_buf, MAKINUM(j));
p = apply(*loc_charsharp, tok_buf, listofnull);
- if ICHRP(p) return p;
+ if (ICHRP(p)) return p;
}
wta(UNDEFINED, "unknown # object: #\\", CHARS(tok_buf));
case '|':
@@ -1040,7 +1040,7 @@ static SCM lreadpr(tok_buf, port, flgs)
num:
j = read_token(c, tok_buf, port);
p = istring2number(CHARS(tok_buf), (long)j, 10L);
- if NFALSEP(p) return p;
+ if (NFALSEP(p)) return p;
if (c=='#') {
if ((j==2) && (lgetc(port)=='(')) {
lungetc('(', port);
@@ -1297,7 +1297,7 @@ int handle_it(i)
ALLOW_INTS;
/* discarding was necessary here because intern() may do NEWCELL */
proc = CDR(intern(name, (sizet)strlen(name)));
- if NIMP(proc) { /* Save environment stack, in case it moves
+ if (NIMP(proc)) { /* Save environment stack, in case it moves
when applying proc. Do an ecache gc to
protect contents of stack. */
SCM estk, *estk_ptr, env, env_tmp;
@@ -1357,7 +1357,7 @@ SCM scm_top_level(initpath, toplvl_fun)
char *name = errmsgs[i-WNA].s_response;
if (name) {
SCM proc = CDR(intern(name, (sizet)strlen(name)));
- if NIMP(proc) apply(proc, EOL, EOL);
+ if (NIMP(proc)) apply(proc, EOL, EOL);
}}
i = errmsgs[i-WNA].parent_err;
if (i) goto drloop;
@@ -1388,7 +1388,7 @@ SCM scm_top_level(initpath, toplvl_fun)
{
SCM boot_tail = scm_evstr("boot-tail");
/* initialization tail-call */
- if NIMP(boot_tail)
+ if (NIMP(boot_tail))
apply(boot_tail, (dumped ? makfrom0str(initpath) : BOOL_F), listofnull);
}
case -2: /* abrt */
@@ -1420,7 +1420,7 @@ SCM scm_top_level(initpath, toplvl_fun)
ints_disabled = 0;
dowinds(EOL);
ret = toplvl_fun(); /* typically repl() */
- if INUMP(ret) exitval = ret;
+ if (INUMP(ret)) exitval = ret;
err_pos = (char *)EXIT;
i = EXIT;
goto drloop; /* encountered EOF on stdin */
@@ -1536,7 +1536,7 @@ void growth_mon(obj, size, units, grewp)
}
void gc_start(what)
- char *what;
+ const char *what;
{
if (verbose > 4) {
lputs(";GC(", sys_errp);
@@ -1686,7 +1686,7 @@ SCM prolixity(arg)
{
int old = verbose;
if (!UNBNDP(arg)) {
- if FALSEP(arg) scm_verbose = 1;
+ if (FALSEP(arg)) scm_verbose = 1;
else scm_verbose = INUM(arg);
}
return MAKINUM(old);
@@ -1701,7 +1701,7 @@ SCM repl()
if (OPINPORTP(cur_inp) && OPOUTPORTP(cur_outp)) {
repl_report();
while(1) {
- if OPOUTPORTP(cur_inp) { /* This case for curses window */
+ if (OPOUTPORTP(cur_inp)) { /* This case for curses window */
lfflush(cur_outp);
if (verbose) lputs(PROMPT, cur_inp);
lfflush(cur_inp);
@@ -1728,7 +1728,7 @@ SCM repl()
#endif
#ifdef __MSDOS__
if ('\n' != CGETUN(cur_inp))
- if OPOUTPORTP(cur_inp) /* This case for curses window */
+ if (OPOUTPORTP(cur_inp)) /* This case for curses window */
{lfflush(cur_outp); newline(cur_inp);}
else newline(cur_outp);
#endif
@@ -1761,7 +1761,7 @@ SCM quit(n)
SCM n;
{
if (UNBNDP(n) || BOOL_T==n) n = MAKINUM(EXIT_SUCCESS);
- if INUMP(n) exitval = n;
+ if (INUMP(n)) exitval = n;
else exitval = MAKINUM(EXIT_FAILURE);
if (errjmp_bad) exit(INUM(exitval));
longjump(CONT(rootcont)->jmpbuf, COOKIE(-1));
@@ -1852,7 +1852,7 @@ SCM tryload(filename, reader)
SCM form, port;
SCM env = EOL;
port = open_file(filename, makfromstr("r?", (sizet)2*sizeof(char)));
- if FALSEP(port) return port;
+ if (FALSEP(port)) return port;
*loc_loadpath = filename;
loadports = cons(port, loadports);
#ifdef SCM_ENV_FILENAME
@@ -1918,7 +1918,7 @@ void scm_line_msg(file, linum, port)
lputs(": ", port);
}
void scm_err_line(what, file, linum, port)
- char *what;
+ const char *what;
SCM file, linum, port;
{
lputs(what, port);
@@ -1983,7 +1983,7 @@ SCM lerrno(arg)
{
int old = errno;
if (!UNBNDP(arg)) {
- if FALSEP(arg) errno = 0;
+ if (FALSEP(arg)) errno = 0;
else errno = INUM(arg);
}
return MAKINUM(old);
@@ -2055,8 +2055,8 @@ static void def_err_response()
if (codep) scm_princode(obj, EOL, sys_safep, writing);
else iprin1(obj, sys_safep, writing);
}
- if UNBNDP(err_exp) goto getout;
- if NIMP(err_exp) {
+ if (UNBNDP(err_exp)) goto getout;
+ if (NIMP(err_exp)) {
if (reset_safeport(sys_safep, 55, cur_errp))
if (0==setjmp(SAFEP_JMPBUF(sys_safep))) {
lputs("\n; in expression: ", cur_errp);
@@ -2093,7 +2093,7 @@ static void def_err_response()
}
void everr(exp, env, arg, pos, s_subr, codep)
SCM exp, env, arg;
- char *pos, *s_subr;
+ const char *pos, *s_subr;
int codep;
{
err_exp = exp;
@@ -2110,7 +2110,7 @@ void everr(exp, env, arg, pos, s_subr, codep)
}
void wta(arg, pos, s_subr)
SCM arg;
- char *pos, *s_subr;
+ const char *pos, *s_subr;
{
#ifndef RECKLESS
everr(scm_trace, scm_trace_env, arg, pos, s_subr, 0);
@@ -2120,7 +2120,7 @@ void wta(arg, pos, s_subr)
}
void scm_experr(arg, pos, s_subr)
SCM arg;
- char *pos, *s_subr;
+ const char *pos, *s_subr;
{
#ifndef RECKLESS
everr(scm_trace, scm_trace_env, arg, pos, s_subr, !0);