summaryrefslogtreecommitdiffstats
path: root/crs.c
diff options
context:
space:
mode:
authorJames LewisMoss <dres@debian.org>2000-03-12 09:04:17 -0500
committerBryan Newbold <bnewbold@robocracy.org>2017-02-20 00:05:26 -0800
commit8cfce36c6a4fc2e0a0ab6ef2db66a23cbe462693 (patch)
tree17427e4f777ca85990a449fe939fbae29770b346 /crs.c
parenta47af30d2f0e96afcd1f14b1984575c359faa3d6 (diff)
parent3278b75942bdbe706f7a0fba87729bb1e935b68b (diff)
downloadscm-8cfce36c6a4fc2e0a0ab6ef2db66a23cbe462693.tar.gz
scm-8cfce36c6a4fc2e0a0ab6ef2db66a23cbe462693.zip
Import Debian changes 5d2-3debian/5d2-3
scm (5d2-3) unstable frozen; urgency=low * Fix libncurses4-dev -> libncurses5-dev build depend (Closes: #58435) * Fix libreadline2-dev -> libreadline4-dev build depend. * Fix license location in copyright file (lintian warning) * Add tetex-bin as a build depend (needs makeinfo) (Closes: #53197) * Add -isp option to dpkg-gencontrol (lintian error) * Move scm to section interpreters. scm (5d2-2) unstable; urgency=low * Apply patch from upstream for bug in eval.c. (Picked up from comp.lang.scheme) * Add Build-Depends on slib, librx1g-dev, libncurses4-dev, libreadlineg2-dev. * Up standards version. * Correct description: this is an R5RS implementation now * Make sure no optimizations are done on m68k. (Closes: #52434) scm (5d2-1) unstable; urgency=low * New upstream. scm (5d1-2) unstable; urgency=low * Remove TAGS on clean (cut the diff back down to reasonable size). scm (5d1-1) unstable; urgency=low * New upstream. * move stuff to /usr/share. scm (5d0-3) unstable; urgency=low * Change scmlit call to ./scmlit call (missed one) (Fixes bugs #37455 and #35545) * Change man file permissions to 644 (fixes lintian warning) scm (5d0-2) unstable; urgency=low * Removed call to add_final in init_crs. lendwin doesn't do anything and scm was crashing when quit everytime in final_scm. * Changed copyright to reflect new source. scm (5d0-1) unstable; urgency=low * New upstream. * Changed (terms) to access "/usr/doc/copyright/GPL". * Changed regex to use -lrx scm (5c3-6) unstable; urgency=low * New maintainer.
Diffstat (limited to 'crs.c')
-rw-r--r--crs.c66
1 files changed, 38 insertions, 28 deletions
diff --git a/crs.c b/crs.c
index 5a4a5f1..ef1e956 100644
--- a/crs.c
+++ b/crs.c
@@ -1,18 +1,18 @@
/* Copyright (C) 1992, 1993, 1994, 1995 Free Software Foundation, Inc.
- *
+ *
* This program is free software; you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
* the Free Software Foundation; either version 2, or (at your option)
* any later version.
- *
+ *
* This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details.
- *
+ *
* You should have received a copy of the GNU General Public License
* along with this software; see the file COPYING. If not, write to
- * the Free Software Foundation, 675 Mass Ave, Cambridge, MA 02139, USA.
+ * the Free Software Foundation, 59 Temple Place, Suite 330, Boston, MA 02111, USA.
*
* As a special exception, the Free Software Foundation gives permission
* for additional uses of the text contained in its release of GUILE.
@@ -36,7 +36,7 @@
*
* If you write modifications of your own for GUILE, it is your choice
* whether to permit this exception to apply to your modifications.
- * If you do not wish that, delete this exception notice.
+ * If you do not wish that, delete this exception notice.
*/
/* "crs.c" interface to `curses' interactive terminal control library.
@@ -54,6 +54,18 @@
int wgetch P((WINDOW *));
#endif
+static int curses_initted = 0;
+
+static SCM scm_linitscr(void);
+
+
+static void do_init_maybe()
+{
+ if(!curses_initted)
+ scm_linitscr();
+ curses_initted = 1;
+}
+
/* define WIN port type */
#define WIN(obj) ((WINDOW*)CDR(obj))
#define WINP(obj) (tc16_window==TYP16(obj))
@@ -64,12 +76,6 @@ int freewindow(win)
delwin(win);
return 0;
}
-int prinwindow(exp, port, writing)
- SCM exp; SCM port; int writing;
-{
- prinport(exp, port, "window");
- return !0;
-}
int bwaddch(c, win) int c; WINDOW *win; {waddch(win, c);return c;}
int bwaddstr(str, win) char *str; WINDOW *win; {waddstr(win, str);return 0;}
sizet bwwrite(str, siz, num, win)
@@ -82,15 +88,16 @@ sizet bwwrite(str, siz, num, win)
}
int tc16_window;
static ptobfuns winptob = {
+ "window",
mark0,
freewindow,
- prinwindow,
+ 0,
equal0,
bwaddch,
bwaddstr,
bwwrite,
- wrefresh,
- wgetch,
+ wrefresh, /* warning from compiler is wrefresh(WINDOW*) not (FILE*) */
+ wgetch, /* warning from compiler is wrefresh(WINDOW*) not (FILE*) */
freewindow};
SCM mkwindow(win)
@@ -101,13 +108,13 @@ SCM mkwindow(win)
NEWCELL(z);
DEFER_INTS;
SETCHARS(z, win);
- CAR(z) = tc16_window | OPN | RDNG | WRTNG;
+ CAR(z) = scm_port_entry(tc16_window, OPN | RDNG | WRTNG);
ALLOW_INTS;
return z;
}
SCM *loc_stdscr = 0;
-SCM linitscr()
+SCM scm_linitscr()
{
WINDOW *win;
if NIMP(*loc_stdscr) {
@@ -115,10 +122,12 @@ SCM linitscr()
return *loc_stdscr;
}
win = initscr();
+ curses_initted = 1;
return *loc_stdscr = mkwindow(win);
}
SCM lendwin()
{
+ do_init_maybe();
if IMP(*loc_stdscr) return BOOL_F;
return ERR==endwin() ? BOOL_F : BOOL_T;
}
@@ -137,6 +146,7 @@ SCM lnewwin(lines, cols, args)
begin_x = CAR(CDR(args));
ASSERT(INUMP(begin_y), begin_y, ARG3, s_newwin);
ASSERT(INUMP(begin_x), begin_y, ARG4, s_newwin);
+ do_init_maybe();
win = newwin(INUM(lines), INUM(cols),
INUM(begin_y), INUM(begin_x));
return mkwindow(win);
@@ -187,7 +197,7 @@ SCM loverwrite(srcwin, dstwin)
return ERR==overwrite(WIN(srcwin), WIN(dstwin)) ? BOOL_F : BOOL_T;
}
-static char s_wmove[] = "wmove", s_wadd[] = "wadd", s_winsert[] = "winsert",
+static char s_wmove[] = "wmove", s_wadd[] = "wadd", s_winsch[] = "winsch",
s_box[] = "box";
SCM lwmove(win, y, x)
SCM win, y, x;
@@ -210,13 +220,13 @@ SCM lwadd(win, obj)
return ERR==waddstr(WIN(win), CHARS(obj)) ? BOOL_F : BOOL_T;
}
-SCM lwinsert(win, obj)
+SCM lwinsch(win, obj)
SCM win, obj;
{
- ASSERT(NIMP(win) && WINP(win), win, ARG1, s_winsert);
+ ASSERT(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_winsert);
+ ASSERT(ICHRP(obj), obj, ARG2, s_winsch);
return ERR==winsch(WIN(win), ICHR(obj)) ? BOOL_F : BOOL_T;
}
@@ -307,7 +317,7 @@ static char s_nonl[] = "nonl", s_nocbreak[] = "nocbreak",
s_noecho[] = "noecho", s_noraw[] = "noraw";
static iproc subr0s[] = {
- {"initscr", linitscr},
+ {"initscr", scm_linitscr},
{"endwin", lendwin},
{&s_nonl[2], lnl},
{s_nonl, lnonl},
@@ -361,12 +371,12 @@ static iproc subr1s[] = {
{ASSERT(NIMP(w) && WINP(w), w, ARG1, sn);\
return ERR==n(WIN(w), BOOL_F != b)?BOOL_F:BOOL_T;}
-/* SUBROPT(lclearok, clearok, s_clearok, "clearok") */
-/* SUBROPT(lidlok, idlok, s_idlok, "idlok") */
+SUBROPT(lidlok, idlok, s_idlok, "idlok")
SUBROPT(lleaveok, leaveok, s_leaveok, "leaveok")
SUBROPT(lscrollok, scrollok, s_scrollok, "scrollok")
-/* SUBROPT(lnodelay, nodelay, s_nodelay, "nodelay") */
+SUBROPT(lnodelay, nodelay, s_nodelay, "nodelay")
+/* SUBROPT(lclearok, clearok, s_clearok, "clearok") */
static char s_clearok[] = "clearok";
SCM lclearok(w, b) SCM w, b;
{
@@ -379,12 +389,12 @@ static iproc subr2s[] = {
{s_overlay, loverlay},
{s_overwrite, loverwrite},
{s_wadd, lwadd},
- {s_winsert, lwinsert},
+ {s_winsch, lwinsch},
{s_clearok, lclearok},
- /* {s_idlok, lidlok}, */
+ {s_idlok, lidlok},
{s_leaveok, lleaveok},
{s_scrollok, lscrollok},
-/* {s_nodelay, lnodelay}, */
+ {s_nodelay, lnodelay},
{0, 0}};
void init_crs()
@@ -408,5 +418,5 @@ void init_crs()
make_subr(s_mvwin, tc7_subr_3, lmvwin);
make_subr(s_box, tc7_subr_3, lbox);
add_feature("curses");
- add_final(lendwin);
+ /* add_final(lendwin); */
}