summaryrefslogtreecommitdiffstats
path: root/crs.c
diff options
context:
space:
mode:
authorBryan Newbold <bnewbold@robocracy.org>2017-02-20 00:05:27 -0800
committerBryan Newbold <bnewbold@robocracy.org>2017-02-20 00:05:27 -0800
commitc7d035ae1a729232579a0fe41ed5affa131d3623 (patch)
treefb387f7c2a8e01cf603d4c75fbbaa68f711df986 /crs.c
parentdeda2c0fd8689349fea2a900199a76ff7ecb319e (diff)
downloadscm-c7d035ae1a729232579a0fe41ed5affa131d3623.tar.gz
scm-c7d035ae1a729232579a0fe41ed5affa131d3623.zip
Import Upstream version 5d9upstream/5d9
Diffstat (limited to 'crs.c')
-rw-r--r--crs.c78
1 files changed, 41 insertions, 37 deletions
diff --git a/crs.c b/crs.c
index 665b0bd..0b4fe5f 100644
--- a/crs.c
+++ b/crs.c
@@ -47,7 +47,11 @@
#ifdef __FreeBSD__
# include <ncurses.h>
#else
-# include <curses.h>
+# ifdef __NetBSD__
+# include <ncurses.h>
+# else
+# include <curses.h>
+# endif
#endif
#ifdef MWC
@@ -128,13 +132,13 @@ SCM lnewwin(lines, cols, args)
{
SCM begin_y, begin_x;
WINDOW *win;
- ASSERT(INUMP(lines), lines, ARG1, s_newwin);
- ASSERT(INUMP(cols), cols, ARG2, s_newwin);
- ASSERT(2==ilength(args), args, WNA, s_newwin);
+ ASRTER(INUMP(lines), lines, ARG1, s_newwin);
+ ASRTER(INUMP(cols), cols, ARG2, s_newwin);
+ ASRTER(2==ilength(args), args, WNA, s_newwin);
begin_y = CAR(args);
begin_x = CAR(CDR(args));
- ASSERT(INUMP(begin_y), begin_y, ARG3, s_newwin);
- ASSERT(INUMP(begin_x), begin_y, ARG4, s_newwin);
+ ASRTER(INUMP(begin_y), begin_y, ARG3, s_newwin);
+ ASRTER(INUMP(begin_x), begin_y, ARG4, s_newwin);
win = newwin(INUM(lines), INUM(cols),
INUM(begin_y), INUM(begin_x));
return mkwindow(win);
@@ -143,9 +147,9 @@ SCM lnewwin(lines, cols, args)
SCM lmvwin(win, y, x)
SCM win, y, x;
{
- ASSERT(NIMP(win) && WINP(win), win, ARG1, s_mvwin);
- ASSERT(INUMP(x), x, ARG2, s_mvwin);
- ASSERT(INUMP(y), y, ARG3, s_mvwin);
+ ASRTER(NIMP(win) && WINP(win), win, ARG1, s_mvwin);
+ ASRTER(INUMP(x), x, ARG2, s_mvwin);
+ ASRTER(INUMP(y), y, ARG3, s_mvwin);
return ERR==mvwin(WIN(win), INUM(y), INUM(x)) ? BOOL_F : BOOL_T;
}
@@ -154,16 +158,16 @@ SCM lsubwin(win, lines, args)
{
SCM cols, begin_y, begin_x;
WINDOW *nwin;
- ASSERT(NIMP(win) && WINP(win), win, ARG1, s_subwin);
- ASSERT(INUMP(lines), lines, ARG2, s_subwin);
- ASSERT(3==ilength(args), args, WNA, s_subwin);
+ ASRTER(NIMP(win) && WINP(win), win, ARG1, s_subwin);
+ ASRTER(INUMP(lines), lines, ARG2, s_subwin);
+ ASRTER(3==ilength(args), args, WNA, s_subwin);
cols = CAR(args);
args = CDR(args);
begin_y = CAR(args);
begin_x = CAR(CDR(args));
- ASSERT(INUMP(cols), cols, ARG3, s_subwin);
- ASSERT(INUMP(begin_y), begin_y, ARG3, s_subwin);
- ASSERT(INUMP(begin_x), begin_y, ARG4, s_subwin);
+ ASRTER(INUMP(cols), cols, ARG3, s_subwin);
+ ASRTER(INUMP(begin_y), begin_y, ARG3, s_subwin);
+ ASRTER(INUMP(begin_x), begin_y, ARG4, s_subwin);
nwin = subwin(WIN(win), INUM(lines), INUM(cols),
INUM(begin_y), INUM(begin_x));
return mkwindow(nwin);
@@ -172,16 +176,16 @@ SCM lsubwin(win, lines, args)
SCM loverlay(srcwin, dstwin)
SCM srcwin, dstwin;
{
- ASSERT(NIMP(srcwin) && WINP(srcwin), srcwin, ARG1, s_overlay);
- ASSERT(NIMP(dstwin) && WINP(dstwin), dstwin, ARG2, s_overlay);
+ ASRTER(NIMP(srcwin) && WINP(srcwin), srcwin, ARG1, s_overlay);
+ ASRTER(NIMP(dstwin) && WINP(dstwin), dstwin, ARG2, s_overlay);
return ERR==overlay(WIN(srcwin), WIN(dstwin)) ? BOOL_F : BOOL_T;
}
SCM loverwrite(srcwin, dstwin)
SCM srcwin, dstwin;
{
- ASSERT(NIMP(srcwin) && WINP(srcwin), srcwin, ARG1, s_overwrite);
- ASSERT(NIMP(dstwin) && WINP(dstwin), dstwin, ARG2, s_overwrite);
+ ASRTER(NIMP(srcwin) && WINP(srcwin), srcwin, ARG1, s_overwrite);
+ ASRTER(NIMP(dstwin) && WINP(dstwin), dstwin, ARG2, s_overwrite);
return ERR==overwrite(WIN(srcwin), WIN(dstwin)) ? BOOL_F : BOOL_T;
}
@@ -190,31 +194,31 @@ static char s_wmove[] = "wmove", s_wadd[] = "wadd", s_winsch[] = "winsch",
SCM lwmove(win, y, x)
SCM win, y, x;
{
- ASSERT(NIMP(win) && WINP(win), win, ARG1, s_wmove);
- ASSERT(INUMP(x), x, ARG2, s_wmove);
- ASSERT(INUMP(y), y, ARG3, s_wmove);
+ ASRTER(NIMP(win) && WINP(win), win, ARG1, s_wmove);
+ ASRTER(INUMP(x), x, ARG2, s_wmove);
+ ASRTER(INUMP(y), y, ARG3, s_wmove);
return ERR==wmove(WIN(win), INUM(y), INUM(x)) ? BOOL_F : BOOL_T;
}
SCM lwadd(win, obj)
SCM win, obj;
{
- ASSERT(NIMP(win) && WINP(win), win, ARG1, s_wadd);
+ ASRTER(NIMP(win) && WINP(win), win, ARG1, s_wadd);
if ICHRP(obj)
return ERR==waddch(WIN(win), ICHR(obj)) ? BOOL_F : BOOL_T;
if INUMP(obj)
return ERR==waddch(WIN(win), INUM(obj)) ? BOOL_F : BOOL_T;
- ASSERT(NIMP(obj) && STRINGP(obj), obj, ARG2, s_wadd);
+ ASRTER(NIMP(obj) && STRINGP(obj), obj, ARG2, s_wadd);
return ERR==waddstr(WIN(win), CHARS(obj)) ? BOOL_F : BOOL_T;
}
SCM lwinsch(win, obj)
SCM win, obj;
{
- ASSERT(NIMP(win) && WINP(win), win, ARG1, s_winsch);
+ ASRTER(NIMP(win) && WINP(win), win, ARG1, s_winsch);
if INUMP(obj)
return ERR==winsch(WIN(win), INUM(obj)) ? BOOL_F : BOOL_T;
- ASSERT(ICHRP(obj), obj, ARG2, s_winsch);
+ ASRTER(ICHRP(obj), obj, ARG2, s_winsch);
return ERR==winsch(WIN(win), ICHR(obj)) ? BOOL_F : BOOL_T;
}
@@ -222,15 +226,15 @@ SCM lbox(win, vertch, horch)
SCM win, vertch, horch;
{
int v, h;
- ASSERT(NIMP(win) && WINP(win), win, ARG1, s_box);
+ ASRTER(NIMP(win) && WINP(win), win, ARG1, s_box);
if INUMP(vertch) v = INUM(vertch);
else {
- ASSERT(ICHRP(vertch), vertch, ARG2, s_box);
+ ASRTER(ICHRP(vertch), vertch, ARG2, s_box);
v = ICHR(vertch);
}
if INUMP(horch) h = INUM(horch);
else {
- ASSERT(ICHRP(horch), horch, ARG3, s_box);
+ ASRTER(ICHRP(horch), horch, ARG3, s_box);
h = ICHR(horch);
}
return ERR==box(WIN(win), v, h) ? BOOL_F : BOOL_T;
@@ -241,7 +245,7 @@ SCM lgetyx(win)
SCM win;
{
int y, x;
- ASSERT(NIMP(win) && WINP(win), win, ARG1, s_getyx);
+ ASRTER(NIMP(win) && WINP(win), win, ARG1, s_getyx);
getyx(WIN(win), y, x);
return cons2(MAKINUM(y), MAKINUM(x), EOL);
}
@@ -249,14 +253,14 @@ SCM lgetyx(win)
SCM lwinch(win)
SCM win;
{
- ASSERT(NIMP(win) && WINP(win), win, ARG1, s_winch);
+ ASRTER(NIMP(win) && WINP(win), win, ARG1, s_winch);
return MAKICHR(winch(WIN(win)));
}
SCM lunctrl(c)
SCM c;
{
- ASSERT(ICHRP(c), c, ARG1, s_unctrl);
+ ASRTER(ICHRP(c), c, ARG1, s_unctrl);
{
char *str = unctrl(ICHR(c));
return makfrom0str(str);
@@ -268,7 +272,7 @@ SCM owidth(arg)
SCM arg;
{
if UNBNDP(arg) arg = cur_outp;
- ASSERT(NIMP(arg) && OPOUTPORTP(arg), arg, ARG1, s_owidth);
+ ASRTER(NIMP(arg) && OPOUTPORTP(arg), arg, ARG1, s_owidth);
if NIMP(*loc_stdscr)
if WINP(arg) return MAKINUM(WIN(arg)->_maxx+1);
else return MAKINUM(COLS);
@@ -278,7 +282,7 @@ SCM oheight(arg)
SCM arg;
{
if UNBNDP(arg) arg = cur_outp;
- ASSERT(NIMP(arg) && OPOUTPORTP(arg), arg, ARG1, s_owidth);
+ ASRTER(NIMP(arg) && OPOUTPORTP(arg), arg, ARG1, s_owidth);
if NIMP(*loc_stdscr)
if WINP(arg) return MAKINUM(WIN(arg)->_maxy+1);
else return MAKINUM(LINES);
@@ -322,7 +326,7 @@ static iproc subr0s[] = {
#define SUBRW(ln, n, s_n, sn) static char s_n[]=sn;\
SCM ln(w)SCM w;\
- {ASSERT(NIMP(w) && WINP(w), w, ARG1, sn);\
+ {ASRTER(NIMP(w) && WINP(w), w, ARG1, sn);\
return ERR==n(WIN(w))?BOOL_F:BOOL_T;}
SUBRW(lwerase, werase, s_werase, "werase")
@@ -356,7 +360,7 @@ static iproc subr1s[] = {
#define SUBROPT(ln, n, s_n, sn) static char s_n[]=sn;\
SCM ln(w, b)SCM w, b;\
- {ASSERT(NIMP(w) && WINP(w), w, ARG1, sn);\
+ {ASRTER(NIMP(w) && WINP(w), w, ARG1, sn);\
return ERR==n(WIN(w), BOOL_F != b)?BOOL_F:BOOL_T;}
SUBROPT(lidlok, idlok, s_idlok, "idlok")
@@ -369,7 +373,7 @@ static char s_clearok[] = "clearok";
SCM lclearok(w, b) SCM w, b;
{
if (BOOL_T==w) return ERR==clearok(curscr, BOOL_F != b)?BOOL_F:BOOL_T;
- ASSERT(NIMP(w) && WINP(w), w, ARG1, s_clearok);
+ ASRTER(NIMP(w) && WINP(w), w, ARG1, s_clearok);
return ERR==clearok(WIN(w), BOOL_F != b)?BOOL_F:BOOL_T;
}