]> ncurses.scripts.mit.edu Git - ncurses.git/commitdiff
ncurses 5.7 - patch 20090425
authorThomas E. Dickey <dickey@invisible-island.net>
Sun, 3 May 2009 00:59:25 +0000 (00:59 +0000)
committerThomas E. Dickey <dickey@invisible-island.net>
Sun, 3 May 2009 00:59:25 +0000 (00:59 +0000)
22 files changed:
NEWS
c++/demo.cc
c++/internal.h
dist.mk
include/MKterm.h.awk.in
include/curses.h.in
include/curses.wide
include/ncurses_defs
misc/terminfo.src
ncurses/base/lib_restart.c
ncurses/curses.priv.h
ncurses/tinfo/lib_options.c
ncurses/tinfo/lib_tputs.c
ncurses/tty/lib_mvcur.c
ncurses/tty/lib_vidattr.c
ncurses/tty/tty_update.c
ncurses/widechar/lib_vid_attr.c
test/ditto.c
test/ncurses.c
test/test.priv.h
test/view.c
test/worm.c

diff --git a/NEWS b/NEWS
index b5c9782a89be6b7ca42d3bb229d5e31a85f80770..bedbaae8af340a96cb1cdb4bd0952e293f73985e 100644 (file)
--- a/NEWS
+++ b/NEWS
@@ -25,7 +25,7 @@
 -- sale, use or other dealings in this Software without prior written        --
 -- authorization.                                                            --
 -------------------------------------------------------------------------------
--- $Id: NEWS,v 1.1383 2009/04/25 21:28:43 tom Exp $
+-- $Id: NEWS,v 1.1384 2009/05/02 22:27:02 tom Exp $
 -------------------------------------------------------------------------------
 
 This is a log of changes that ncurses has gone through since Zeyd started
@@ -45,6 +45,10 @@ See the AUTHORS file for the corresponding full names.
 Changes through 1.9.9e did not credit all contributions;
 it is not possible to add this information.
 
+20090502
+       + continue integrating "sp-funcs" by Juergen Pfeifer (incomplete).
+       + add vwmterm terminfo entry (patch by Bryan Christ).
+
 20090425
        + continue integrating "sp-funcs" by Juergen Pfeifer (incomplete).
 
index ddd5f2b3e10d5ca6a86d14cc573cdcb5590c97ab..35433425f1fcc20cf383ee9c0cd1b96911b88ad4 100644 (file)
@@ -35,7 +35,7 @@
  *   Demo code for NCursesMenu and NCursesForm written by
  *   Juergen Pfeifer
  *
- * $Id: demo.cc,v 1.38 2008/08/04 17:16:57 tom Exp $
+ * $Id: demo.cc,v 1.39 2008/12/07 02:07:34 juergen Exp $
  */
 
 #include "internal.h"
 #include "cursesm.h"
 #include "cursesf.h"
 
+#ifdef __MINGW32__
+#undef KEY_EVENT
+#endif
+
+#ifndef __MINGW32__
 extern "C" unsigned int sleep(unsigned int);
+#endif
 
 #undef index // needed for NeXT
 
index 3066e72f6de52026b17740d82108bc5f51c7bfa6..64d57cd712d9ddaae5887fcdab693e253f3f473f 100644 (file)
@@ -31,7 +31,7 @@
  *   Author: Juergen Pfeifer, 1997                                          *
  ****************************************************************************/
 
-// $Id: internal.h,v 1.16 2008/10/25 21:35:44 tom Exp $
+// $Id: internal.h,v 1.17 2008/12/07 02:07:34 juergen Exp $
 
 #ifndef NCURSES_CPLUS_INTERNAL_H
 #define NCURSES_CPLUS_INTERNAL_H 1
 #define MODULE_ID(id) /*nothing*/
 #endif
 
+#ifdef __MINGW32__
+#include <nc_mingw.h>
+#undef KEY_EVENT
+#endif
+
 #ifndef _QNX_SOURCE
 #include <stdlib.h>
 #include <string.h>
diff --git a/dist.mk b/dist.mk
index 99811e412d9c04b9043c86202d67dbdf58de7238..c7d22744a4d2712637613f87267be07a4ea8ce03 100644 (file)
--- a/dist.mk
+++ b/dist.mk
@@ -25,7 +25,7 @@
 # use or other dealings in this Software without prior written               #
 # authorization.                                                             #
 ##############################################################################
-# $Id: dist.mk,v 1.696 2009/04/25 17:43:20 tom Exp $
+# $Id: dist.mk,v 1.697 2009/05/02 17:26:04 tom Exp $
 # Makefile for creating ncurses distributions.
 #
 # This only needs to be used directly as a makefile by developers, but
@@ -37,7 +37,7 @@ SHELL = /bin/sh
 # These define the major/minor/patch versions of ncurses.
 NCURSES_MAJOR = 5
 NCURSES_MINOR = 7
-NCURSES_PATCH = 20090425
+NCURSES_PATCH = 20090502
 
 # We don't append the patch to the version, since this only applies to releases
 VERSION = $(NCURSES_MAJOR).$(NCURSES_MINOR)
index 9f635d65bc865bc7b315c93db60b87ac391a0c01..4e33af26a544d59d466105dc7a352246ba59f7bc 100644 (file)
@@ -34,7 +34,7 @@ BEGIN         {
                    print  "/*    and: Thomas E. Dickey                        1995-on                  */"
                    print  "/****************************************************************************/"
                    print  ""
-                   print  "/* $Id: MKterm.h.awk.in,v 1.55 2009/04/25 18:02:27 tom Exp $ */"
+                   print  "/* $Id: MKterm.h.awk.in,v 1.56 2009/05/02 19:25:57 tom Exp $ */"
                    print  ""
                    print  "/*"
                    print  "**  term.h -- Definition of struct term"
@@ -348,6 +348,8 @@ END         {
                        print  ""
                        print  "extern NCURSES_EXPORT(TERMINAL *) NCURSES_SP_NAME(set_curterm) (SCREEN*, TERMINAL *);"
                        print  "extern NCURSES_EXPORT(int)     NCURSES_SP_NAME(del_curterm) (SCREEN*, TERMINAL *);"
+                       print  ""
+                       print  "extern NCURSES_EXPORT(int)     NCURSES_SP_NAME(restartterm) (SCREEN*, NCURSES_CONST char *, int, int *);"
                        print  "#endif /* NCURSES_SP_FUNCS */"
                        print  ""
                        print  "#ifdef __cplusplus"
index 7adcb62261df2acfeea765f9a859046452b21c2f..4c886142091548e3a1fb812ee8225ba7dc350be3 100644 (file)
@@ -32,7 +32,7 @@
  *     and: Thomas E. Dickey                        1996-on                 *
  ****************************************************************************/
 
-/* $Id: curses.h.in,v 1.197 2009/04/25 21:03:34 tom Exp $ */
+/* $Id: curses.h.in,v 1.198 2009/05/02 21:59:55 tom Exp $ */
 
 #ifndef __NCURSES_H
 #define __NCURSES_H
@@ -960,6 +960,8 @@ extern NCURSES_EXPORT(char *) NCURSES_SP_NAME(termname) (SCREEN*); /* implemente
 extern NCURSES_EXPORT(int) NCURSES_SP_NAME(typeahead) (SCREEN*, int); /* implemented */
 extern NCURSES_EXPORT(int) NCURSES_SP_NAME(ungetch) (SCREEN*, int); /* implemented */
 extern NCURSES_EXPORT(void) NCURSES_SP_NAME(use_env) (SCREEN*, bool); /* implemented */
+extern NCURSES_EXPORT(int) NCURSES_SP_NAME(vidattr) (SCREEN*, chtype); /* implemented */
+extern NCURSES_EXPORT(int) NCURSES_SP_NAME(vidputs) (SCREEN*, chtype, int (*)(int)); /* implemented */
 #if @NCURSES_EXT_FUNCS@
 extern NCURSES_EXPORT(char *) NCURSES_SP_NAME(keybound) (SCREEN*, int, int);
 extern NCURSES_EXPORT(int) NCURSES_SP_NAME(assume_default_colors) (SCREEN*, int, int);
index 520875e7cebce936ff1a4d4daedc695c4eab1a9c..6ba9280ff66641c28b5607ddec0d67f793ac26a8 100644 (file)
@@ -1,4 +1,4 @@
-/* $Id: curses.wide,v 1.37 2009/04/18 21:34:06 tom Exp $ */
+/* $Id: curses.wide,v 1.38 2009/05/02 23:12:00 tom Exp $ */
 /*
  * vile:cmode:
  * This file is part of ncurses, designed to be appended after curses.h.in
@@ -171,6 +171,8 @@ extern NCURSES_EXPORT(int) wvline_set (WINDOW *, const cchar_t *, int);     /* imple
 extern NCURSES_EXPORT(attr_t) NCURSES_SP_NAME(term_attrs) (SCREEN*);           /* implemented */
 extern NCURSES_EXPORT(int) NCURSES_SP_NAME(unget_wch) (SCREEN*, const wchar_t);        /* implemented */
 extern NCURSES_EXPORT(wchar_t*) NCURSES_SP_NAME(wunctrl) (SCREEN*, cchar_t *); /* implemented */
+extern NCURSES_EXPORT(int) NCURSES_SP_NAME(vid_attr) (SCREEN*, attr_t, short, void *);
+extern NCURSES_EXPORT(int) NCURSES_SP_NAME(vid_puts) (SCREEN*, attr_t, short, void *, int (*)(int));
 #endif
 
 #ifndef NCURSES_NOMACROS
index 97a377dc52702cf52dcee8c0fdeb7c4518af4917..b07f5f1f7bd0bc52b6650a78286e1c9760f9f2da 100644 (file)
@@ -1,4 +1,4 @@
-# $Id: ncurses_defs,v 1.40 2008/09/06 15:57:41 tom Exp $
+# $Id: ncurses_defs,v 1.41 2008/11/16 00:19:59 juergen Exp $
 ##############################################################################
 # Copyright (c) 2000-2007,2008 Free Software Foundation, Inc.                #
 #                                                                            #
@@ -171,7 +171,6 @@ NCURSES_EXT_COLORS
 NCURSES_EXT_FUNCS
 NCURSES_NO_PADDING
 NCURSES_PATHSEP        ':'
-NDEBUG
 NEED_PTEM_H
 NO_LEAKS
 PURE_TERMINFO
index 96ce6e0f3953f8f48478a853b7e17b89d75060a6..cf71f91baf02ff3f884bb93c6adb17a9d70e4b05 100644 (file)
@@ -6,8 +6,8 @@
 # Report bugs and new terminal descriptions to
 #      bug-ncurses@gnu.org
 #
-#      $Revision: 1.347 $
-#      $Date: 2009/03/28 23:19:33 $
+#      $Revision: 1.348 $
+#      $Date: 2009/05/02 22:23:20 $
 #
 # The original header is preserved below for reference.  It is noted that there
 # is a "newer" version which differs in some cosmetic details (but actually
@@ -4319,6 +4319,30 @@ decansi|ANSI emulation with DEC compatibility hacks,
        smkx=\E[?1h\E=, smso=\E[7m, smul=\E[4m, u6=\E[%i%d;%dR,
        u7=\E[6n, vpa=\E[%i%p1%dd,
 
+#### VWM
+#
+# vwmterm is a terminal emulator written for the VWM console window manager
+#
+vwmterm|(vwm term),
+       am, bce, ccc, mir, msgr, npc, xenl, xon,
+       colors#8, pairs#64,
+       acsc=``aaffggjjkkllmmnnooppqqrrssttuuvvwwxxyyzz{{||}}~~,
+       bel=^G, blink=\E[5m, bold=\E[1m, civis=\E[?25l,
+       clear=\E[H\E[J, cnorm=\E[?25h, cr=^M, cub1=^H,
+       cuf=\E[%p1%dC, cuf1=\E[C, cup=\E[%i%p1%d;%p2%dH,
+       cvvis=\E[?25h, dim=\E[2m, ed=\E[J, el=\E[K, home=\E[H,
+       il1=\E[L, ind=^J, invis=\E[8m, kcub1=\E[D, kcud1=\E[B,
+       kcuf1=\E[C, kcuu1=\E[A, kdch1=\E[3~, kend=\E[4~, kf1=\E[[A,
+       kf10=\E[21~, kf11=\E[22~, kf12=\E[23~, kf2=\E[[B,
+       kf3=\E[[C, kf4=\E[[D, kf5=\E[[E, kf6=\E[17~, kf7=\E[18~,
+       kf8=\E[19~, kf9=\E[20~, khome=\E[1~, knp=\E[6~, kpp=\E[5~,
+       rev=\E[7m, rmacs=\E[10m, rmam=\E[?7l, rmcup=\E[?1049l,
+       rs1=\E[H\E[J\E[m\Ec, setab=\E[4%p1%dm,
+       setaf=\E[3%p1%dm,
+       sgr=\E[0;10%?%p1%t;7%;%?%p2%t;4%;%?%p3%t;7%;%?%p4%t;5%;%?%p6%t;1%;%?%p7%t;8%;%?%p9%t;11%;m,
+       sgr0=\E[0;10m, smacs=\E[11m, smam=\E[?7h,
+       smcup=\E[?1049h, smso=\E[3m, smul=\E[4m,
+
 #### MGR
 #
 # MGR is a Bell Labs window system lighter-weight than X.
@@ -21832,6 +21856,9 @@ v3220|LANPAR Vision II model 3220/3221/3222,
 #      * move function- and cursor-keys from emx-base to ansi.sys, and create
 #        a pfkey capability which handles F1-F48 -TD
 #
+# 2009-05-02
+#      * add vwmterm entry (Bryan Christ)
+#
 # The following sets edit modes for GNU EMACS.
 # Local Variables:
 # fill-prefix:"\t"
index da770d4e7c9266c1f27c5c3d64926707e216b7a1..55b1cc09cfa7eeaf20485825dfd434ec6e3187c6 100644 (file)
@@ -1,5 +1,5 @@
 /****************************************************************************
- * Copyright (c) 1998-2007,2008 Free Software Foundation, Inc.              *
+ * Copyright (c) 1998-2008,2009 Free Software Foundation, Inc.              *
  *                                                                          *
  * Permission is hereby granted, free of charge, to any person obtaining a  *
  * copy of this software and associated documentation files (the            *
@@ -30,6 +30,7 @@
  *  Author: Zeyd M. Ben-Halim <zmbenhal@netcom.com> 1992,1995               *
  *     and: Eric S. Raymond <esr@snark.thyrsus.com>                         *
  *     and: Thomas E. Dickey                        1996-on                 *
+ *     and: Juergen Pfeifer                         2008                    *
  ****************************************************************************/
 
 /*
 #define _POSIX_SOURCE
 #endif
 
-#include <term.h>              /* lines, columns, cur_term */
-
-MODULE_ID("$Id: lib_restart.c,v 1.10 2008/06/21 17:31:22 tom Exp $")
+MODULE_ID("$Id: lib_restart.c,v 1.11 2009/05/02 20:47:42 tom Exp $")
 
 NCURSES_EXPORT(int)
-restartterm(NCURSES_CONST char *termp, int filenum, int *errret)
+NCURSES_SP_NAME(restartterm) (NCURSES_SP_DCLx
+                             NCURSES_CONST char *termp,
+                             int filenum,
+                             int *errret)
 {
     int result;
 
-    T((T_CALLED("restartterm(%s,%d,%p)"), termp, filenum, errret));
+    T((T_CALLED("restartterm(%p,%s,%d,%p)"), SP_PARM, termp, filenum, errret));
 
     if (setupterm(termp, filenum, errret) != OK) {
        result = ERR;
-    } else if (SP != 0) {
-       int saveecho = SP->_echo;
-       int savecbreak = SP->_cbreak;
-       int saveraw = SP->_raw;
-       int savenl = SP->_nl;
+    } else if (SP_PARM != 0) {
+       int saveecho = SP_PARM->_echo;
+       int savecbreak = SP_PARM->_cbreak;
+       int saveraw = SP_PARM->_raw;
+       int savenl = SP_PARM->_nl;
 
-       if (saveecho)
-           echo();
-       else
-           noecho();
+       if (saveecho) {
+           NCURSES_SP_NAME(echo) (NCURSES_SP_ARG);
+       } else {
+           NCURSES_SP_NAME(noecho) (NCURSES_SP_ARG);
+       }
 
        if (savecbreak) {
-           cbreak();
-           noraw();
+           NCURSES_SP_NAME(cbreak) (NCURSES_SP_ARG);
+           NCURSES_SP_NAME(noraw) (NCURSES_SP_ARG);
        } else if (saveraw) {
-           nocbreak();
-           raw();
+           NCURSES_SP_NAME(nocbreak) (NCURSES_SP_ARG);
+           NCURSES_SP_NAME(raw) (NCURSES_SP_ARG);
+       } else {
+           NCURSES_SP_NAME(nocbreak) (NCURSES_SP_ARG);
+           NCURSES_SP_NAME(noraw) (NCURSES_SP_ARG);
+       }
+       if (savenl) {
+           NCURSES_SP_NAME(nl) (NCURSES_SP_ARG);
        } else {
-           nocbreak();
-           noraw();
+           NCURSES_SP_NAME(nonl) (NCURSES_SP_ARG);
        }
-       if (savenl)
-           nl();
-       else
-           nonl();
 
-       reset_prog_mode();
+       NCURSES_SP_NAME(reset_prog_mode) (NCURSES_SP_ARG);
 
 #if USE_SIZECHANGE
-       _nc_update_screensize(SP);
+       _nc_update_screensize(SP_PARM);
 #endif
 
        result = OK;
@@ -95,3 +99,11 @@ restartterm(NCURSES_CONST char *termp, int filenum, int *errret)
     }
     returnCode(result);
 }
+
+#if NCURSES_SP_FUNCS
+NCURSES_EXPORT(int)
+restartterm(NCURSES_CONST char *termp, int filenum, int *errret)
+{
+    return NCURSES_SP_NAME(restartterm) (CURRENT_SCREEN, termp, filenum, errret);
+}
+#endif
index acc94be24d0ed6e545f6b1a04063e9ec4b208ece..04f7c914cc38893ffef5774adb1725a55699eb72 100644 (file)
@@ -35,7 +35,7 @@
 
 
 /*
- * $Id: curses.priv.h,v 1.410 2009/04/25 23:38:37 tom Exp $
+ * $Id: curses.priv.h,v 1.412 2009/05/02 21:28:57 tom Exp $
  *
  *     curses.priv.h
  *
@@ -303,8 +303,14 @@ color_t;
 #define GET_WINDOW_PAIR(w)     (w)->_color
 #define SET_WINDOW_PAIR(w,p)   (w)->_color = (p)
 #define SameAttrOf(a,b)                (AttrOf(a) == AttrOf(b) && GetPair(a) == GetPair(b))
-#define VIDATTR(attr, pair)    vid_attr(attr, pair, 0)
+
+#if NCURSES_SP_FUNCS
+#define VIDATTR(sp,attr,pair)  NCURSES_SP_NAME(vid_attr)(sp, attr, pair, 0)
 #else
+#define VIDATTR(sp,attr,pair)  vid_attr(attr, pair, 0)
+#endif
+
+#else /* !(NCURSES_EXT_COLORS && USE_WIDEC_SUPPORT) */
 #define if_EXT_COLORS(stmt)    /* nothing */
 #define SetPair(value,p)       RemAttr(value, A_COLOR), \
                                SetAttr(value, AttrOf(value) | (A_COLOR & COLOR_PAIR(p)))
@@ -314,9 +320,15 @@ color_t;
 #define SET_WINDOW_PAIR(w,p)   WINDOW_ATTRS(w) &= ALL_BUT_COLOR, \
                                WINDOW_ATTRS(w) |= (A_COLOR & COLOR_PAIR(p))
 #define SameAttrOf(a,b)                (AttrOf(a) == AttrOf(b))
-#define VIDATTR(attr, pair)    vidattr(attr)
+
+#if NCURSES_SP_FUNCS
+#define VIDATTR(sp,attr,pair)  NCURSES_SP_NAME(vidattr)(sp, attr)
+#else
+#define VIDATTR(sp,attr,pair)  vidattr(attr)
 #endif
 
+#endif /* NCURSES_EXT_COLORS && USE_WIDEC_SUPPORT */
+
 #if NCURSES_NO_PADDING
 #define GetNoPadding(sp)       ((sp) ? (sp)->_no_padding : _nc_prescreen._no_padding)
 #define SetNoPadding(sp)       _nc_set_no_padding(sp)
@@ -1399,7 +1411,7 @@ extern    NCURSES_EXPORT(void) name (void); \
 
 #define ALL_BUT_COLOR ((chtype)~(A_COLOR))
 #define NONBLANK_ATTR (A_NORMAL|A_BOLD|A_DIM|A_BLINK)
-#define XMC_CHANGES(c) ((c) & SP->_xmc_suppress)
+#define XMC_CHANGES(c) ((c) & SP_PARM->_xmc_suppress)
 
 #define toggle_attr_on(S,at) {\
    if (PAIR_NUMBER(at) > 0) {\
@@ -1437,7 +1449,7 @@ extern    NCURSES_EXPORT(void) name (void); \
 #if USE_XMC_SUPPORT
 #define UpdateAttrs(sp,c)      if (!SameAttrOf(SCREEN_ATTRS(sp), c)) { \
                                attr_t chg = AttrOf(SCREEN_ATTRS(sp)); \
-                               VIDATTR(AttrOf(c), GetPair(c)); \
+                               VIDATTR(sp, AttrOf(c), GetPair(c)); \
                                if (magic_cookie_glitch > 0 \
                                 && XMC_CHANGES((chg ^ AttrOf(SCREEN_ATTRS(sp))))) { \
                                        T(("%s @%d before glitch %d,%d", \
@@ -1449,7 +1461,7 @@ extern    NCURSES_EXPORT(void) name (void); \
                        }
 #else
 #define UpdateAttrs(sp,c)      if (!SameAttrOf(SCREEN_ATTRS(sp), c)) \
-                               VIDATTR(AttrOf(c), GetPair(c));
+                                   VIDATTR(sp, AttrOf(c), GetPair(c));
 #endif
 
 /*
@@ -1578,10 +1590,10 @@ extern NCURSES_EXPORT(bool) _nc_has_mouse (SCREEN *);
 
 /* lib_setup.c */
 extern NCURSES_EXPORT(char *) _nc_get_locale(void);
-extern NCURSES_EXPORT(int) _nc_unicode_locale(void);
-extern NCURSES_EXPORT(int) _nc_locale_breaks_acs(TERMINAL *);
-extern NCURSES_EXPORT(int) _nc_setupterm(NCURSES_CONST char *, int, int *, bool);
-extern NCURSES_EXPORT(void) _nc_get_screensize(SCREEN *, int *, int *);
+extern NCURSES_EXPORT(int)    _nc_unicode_locale(void);
+extern NCURSES_EXPORT(int)    _nc_locale_breaks_acs(TERMINAL *);
+extern NCURSES_EXPORT(int)    _nc_setupterm(NCURSES_CONST char *, int, int *, bool);
+extern NCURSES_EXPORT(void)   _nc_get_screensize(SCREEN *, int *, int *);
 
 /* lib_tstp.c */
 #if USE_SIGWINCH
@@ -1646,7 +1658,7 @@ extern NCURSES_EXPORT(int) _nc_setupscreen (int, int, FILE *, bool, int);
 extern NCURSES_EXPORT(int) _nc_timed_wait (SCREEN *, int, int, int * EVENTLIST_2nd(_nc_eventlist *));
 extern NCURSES_EXPORT(void) _nc_do_color (short, short, bool, int (*)(int));
 extern NCURSES_EXPORT(void) _nc_flush (void);
-extern NCURSES_EXPORT(void) _nc_free_and_exit (int);
+extern NCURSES_EXPORT(void) _nc_free_and_exit (int) GCC_NORETURN;
 extern NCURSES_EXPORT(void) _nc_free_entry (ENTRY *, TERMTYPE *);
 extern NCURSES_EXPORT(void) _nc_freeall (void);
 extern NCURSES_EXPORT(void) _nc_hash_map (void);
@@ -1712,7 +1724,7 @@ extern NCURSES_EXPORT_VAR(int *) _nc_oldnums;
 
 #define NC_BUFFERED(flag) _nc_set_buffer(SP->_ofp, flag)
 
-#define NC_OUTPUT ((SP_PARM != 0) ? SP_PARM->_ofp : stdout)
+#define NC_OUTPUT(sp) ((sp != 0) ? sp->_ofp : stdout)
 
 /*
  * On systems with a broken linker, define 'SP' as a function to force the
@@ -1775,6 +1787,112 @@ extern NCURSES_EXPORT(int) _nc_ripoffline (int line, int (*init)(WINDOW *,int));
 #define TW_ANY     (TW_INPUT | TW_MOUSE)
 #define TW_EVENT   4
 
+#define SetSafeOutcWrapper(outc)           \
+    SCREEN* sp = CURRENT_SCREEN;            \
+    if (sp==0) {                            \
+       struct screen dummy;                \
+       sp = &dummy;                        \
+       memset(sp,0,sizeof(struct screen)); \
+       sp->_outch = _nc_outc_wrapper;      \
+    }\
+    sp->jump = outc
+
+struct DriverTCB; /* Terminal Control Block forward declaration */
+typedef void* TERM_HANDLE;
+
+typedef struct _termInfo
+{
+  bool caninit;
+
+  bool hascolor;
+  bool initcolor;
+  bool canchange;
+
+  int  tabsize;
+
+  int  maxcolors;
+  int  maxpairs;
+  int  nocolorvideo;
+
+  int  numlabels;
+  int  labelwidth;
+  int  labelheight;
+
+  const color_t* defaultPalette;
+} TerminalInfo;
+
+typedef struct term_driver {
+    bool   isTerminfo;
+    bool   (*CanHandle)(struct DriverTCB*,const char*,int*);
+    void   (*init)(struct DriverTCB*);
+    void   (*release)(struct DriverTCB*);
+    int    (*size)(struct DriverTCB*, int* Line, int *Cols);
+    int    (*sgmode)(struct DriverTCB*, bool setFlag, TTY*);
+    chtype (*conattr)(struct DriverTCB*);
+    int    (*hwcur)(struct DriverTCB*, int yold, int xold, int y, int x);
+    int    (*mode)(struct DriverTCB*, bool progFlag, bool defFlag);
+    bool   (*rescol)(struct DriverTCB*);
+    bool   (*rescolors)(struct DriverTCB*);
+    void   (*color)(struct DriverTCB*,bool fore, int color, int(*)(SCREEN*,int));
+    int    (*doBeepOrFlash)(struct DriverTCB*, bool);
+    void   (*initpair)(struct DriverTCB*,short,short,short);
+    void   (*initcolor)(struct DriverTCB*,short,short,short,short);
+    void   (*docolor)(struct DriverTCB*,short,short,bool,int(*)(SCREEN*,int));
+    void   (*initmouse)(struct DriverTCB*);
+    void   (*setfilter)(struct DriverTCB*);
+    void   (*hwlabel)(struct DriverTCB*,int,char*);
+    void   (*hwlabelOnOff)(struct DriverTCB*,bool);
+    int    (*update)(struct DriverTCB*);
+    int    (*defaultcolors)(struct DriverTCB*,int,int);
+    int    (*print)(struct DriverTCB*,char*,int);
+    int    (*getsize)(struct DriverTCB*,int*,int*);
+    int    (*setsize)(struct DriverTCB*,int,int);
+    void   (*initacs)(struct DriverTCB*,chtype*,chtype*);
+    void   (*scinit)(SCREEN *);
+    void   (*scexit)(SCREEN *);
+    int    (*twait)(struct DriverTCB*,int,int,int* EVENTLIST_2nd(_nc_eventlist*));
+    int    (*read)(struct DriverTCB*,int*);
+    int    (*nap)(struct DriverTCB*,int);
+    int    (*kpad)(struct DriverTCB*, bool);
+    int    (*kyOk)(struct DriverTCB*, int, bool);
+    bool   (*kyExist)(struct DriverTCB*, int);
+} TERM_DRIVER;
+
+
+typedef struct DriverTCB
+{
+    TERMINAL      term;   /* needs to be the first Element !!! */
+    TERM_HANDLE   inp;    /* The input handle of the Terminal */
+    TERM_HANDLE   out;    /* The output handle of the Terminal in shell mode */
+    TERM_HANDLE   hdl;    /* The output handle of the Terminal in prog  mode */
+    TERM_DRIVER*  drv;    /* The driver for that Terminal */
+    SCREEN*       csp;    /* The screen that owns that Terminal */
+    TerminalInfo  info;   /* Driver independent core capabilities of the Terminal */
+    void*         prop;   /* Driver dependent property storage to be used by the Driver */
+    long          magic;
+} TERMINAL_CONTROL_BLOCK;
+
+#define NCDRV_MAGIC(id) (0x47110000 | (id&0xffff))
+#define NCDRV_TINFO      0x01
+#define NCDRV_WINCONSOLE 0x02
+
+#define TCBOf(sp)    ((TERMINAL_CONTROL_BLOCK*)(TerminalOf(sp)))
+#define InfoOf(sp)   TCBOf(sp)->info
+#define CallDriver(sp,method)                        TCBOf(sp)->drv->method(TCBOf(sp))
+#define CallDriver_1(sp,method,arg1)                 TCBOf(sp)->drv->method(TCBOf(sp),arg1)
+#define CallDriver_2(sp,method,arg1,arg2)            TCBOf(sp)->drv->method(TCBOf(sp),arg1,arg2)
+#define CallDriver_3(sp,method,arg1,arg2,arg3)       TCBOf(sp)->drv->method(TCBOf(sp),arg1,arg2,arg3)
+#define CallDriver_4(sp,method,arg1,arg2,arg3,arg4)  TCBOf(sp)->drv->method(TCBOf(sp),arg1,arg2,arg3,arg4)
+
+extern NCURSES_EXPORT_VAR(const color_t*) _nc_cga_palette;
+extern NCURSES_EXPORT_VAR(const color_t*) _nc_hls_palette;
+
+#ifdef __MINGW32__
+#include <nc_mingw.h>
+extern NCURSES_EXPORT_VAR(TERM_DRIVER) _nc_WIN_DRIVER;
+#endif
+extern NCURSES_EXPORT_VAR(TERM_DRIVER) _nc_TINFO_DRIVER;
+
 #define IsTermInfo(sp) TRUE
 #define HasTInfoTerminal(sp) ((0!=TerminalOf(sp)) && IsTermInfo(sp))
 #define IsValidTIScreen(sp)  (HasTInfoTerminal(sp))
@@ -1788,22 +1906,26 @@ extern NCURSES_EXPORT(WINDOW *) _nc_newscr_of(SCREEN*);
 extern NCURSES_EXPORT(WINDOW *) _nc_stdscr_of(SCREEN*);
 extern NCURSES_EXPORT(int)      _nc_outc_wrapper(SCREEN*,int);
 
-extern NCURSES_EXPORT(TERMINAL*) NCURSES_SP_NAME(_nc_set_curterm)(SCREEN*,TERMINAL*);
+#if USE_REENTRANT
+extern NCURSES_EXPORT(char *)    NCURSES_SP_NAME(_nc_ttytype)(SCREEN*);
+extern NCURSES_EXPORT(int)       NCURSES_SP_NAME(_nc_TABSIZE)(SCREEN*);
+extern NCURSES_EXPORT(char *)    NCURSES_SP_NAME(longname)(SCREEN*);
+#endif
 
 #if NCURSES_EXT_FUNCS
 extern NCURSES_EXPORT(int)      NCURSES_SP_NAME(_nc_set_tabsize)(SCREEN*, int);
 #endif
 
-extern NCURSES_EXPORT(chtype)   NCURSES_SP_NAME(_nc_acs_char)(SCREEN*,int);
-
 /*
  * We put the safe versions of various calls here as they are not published
  * part of the API up to now
  */
 extern NCURSES_EXPORT(SCREEN*)  _nc_SP(void);
 
+extern NCURSES_EXPORT(TERMINAL*) NCURSES_SP_NAME(_nc_set_curterm)(SCREEN*,TERMINAL*);
+extern NCURSES_EXPORT(TERMINAL*) NCURSES_SP_NAME(cur_term)(SCREEN *sp);
 extern NCURSES_EXPORT(WINDOW *) NCURSES_SP_NAME(_nc_makenew) (SCREEN*, int, int, int, int, int);
-extern NCURSES_EXPORT(bool)     NCURSES_SP_NAME(_nc_is_term_resized)(SCREEN*,int,int);
+extern NCURSES_EXPORT(bool)     NCURSES_SP_NAME(_nc_reset_colors)(SCREEN*);
 extern NCURSES_EXPORT(char *)   NCURSES_SP_NAME(_nc_printf_string)(SCREEN*, const char *, va_list);
 extern NCURSES_EXPORT(chtype)   NCURSES_SP_NAME(_nc_acs_char)(SCREEN*,int);
 extern NCURSES_EXPORT(int)      NCURSES_SP_NAME(_nc_curs_set)(SCREEN*,int);
@@ -1815,8 +1937,6 @@ extern NCURSES_EXPORT(int)      NCURSES_SP_NAME(_nc_putp)(SCREEN*, const char *,
 extern NCURSES_EXPORT(int)      NCURSES_SP_NAME(_nc_putp_flush)(SCREEN*, const char *, const char *);
 extern NCURSES_EXPORT(int)      NCURSES_SP_NAME(_nc_resetty)(SCREEN*);
 extern NCURSES_EXPORT(int)      NCURSES_SP_NAME(_nc_resize_term)(SCREEN*,int,int);
-extern NCURSES_EXPORT(int)      NCURSES_SP_NAME(_nc_resizeterm)(SCREEN*,int,int);
-extern NCURSES_EXPORT(int)      NCURSES_SP_NAME(_nc_restartterm)(SCREEN*,NCURSES_CONST char*,int,int*);
 extern NCURSES_EXPORT(int)      NCURSES_SP_NAME(_nc_ripoffline)(SCREEN*, int, int (*)(WINDOW *,int));
 extern NCURSES_EXPORT(int)      NCURSES_SP_NAME(_nc_savetty)(SCREEN*);
 extern NCURSES_EXPORT(int)      NCURSES_SP_NAME(_nc_scr_init)(SCREEN*,const char*);
@@ -1828,12 +1948,11 @@ extern NCURSES_EXPORT(int)      NCURSES_SP_NAME(_nc_tgetent)(SCREEN*,char*,const
 extern NCURSES_EXPORT(int)      NCURSES_SP_NAME(_nc_tigetnum)(SCREEN*,NCURSES_CONST char*);
 extern NCURSES_EXPORT(int)      NCURSES_SP_NAME(_nc_tputs)(SCREEN*,const char*,int,int(*)(SCREEN*, int));
 extern NCURSES_EXPORT(int)      NCURSES_SP_NAME(_nc_vid_attr)(SCREEN *, attr_t, short, void *);
-extern NCURSES_EXPORT(int)      NCURSES_SP_NAME(_nc_vidattr)(SCREEN *, chtype);
 extern NCURSES_EXPORT(int)      NCURSES_SP_NAME(_nc_vidputs)(SCREEN*,chtype,int(*) (SCREEN*, int));
 extern NCURSES_EXPORT(void)     NCURSES_SP_NAME(_nc_do_color)(SCREEN*, short, short, bool, int (*)(SCREEN*,int));
 extern NCURSES_EXPORT(void)     NCURSES_SP_NAME(_nc_do_xmc_glitch)(SCREEN*, attr_t);
 extern NCURSES_EXPORT(void)     NCURSES_SP_NAME(_nc_flush)(SCREEN*);
-extern NCURSES_EXPORT(void)     NCURSES_SP_NAME(_nc_free_and_exit)(SCREEN*,int) GCC_NORETURN;
+extern NCURSES_EXPORT(void)     NCURSES_SP_NAME(_nc_free_and_exit)(SCREEN*, int) GCC_NORETURN;
 extern NCURSES_EXPORT(void)     NCURSES_SP_NAME(_nc_freeall)(SCREEN*);
 extern NCURSES_EXPORT(void)     NCURSES_SP_NAME(_nc_hash_map)(SCREEN*);
 extern NCURSES_EXPORT(void)     NCURSES_SP_NAME(_nc_init_acs)(SCREEN*);
index cfce6c941051665976d789a445be9acf8c5a4811..b037ddcbd5f5458a5d8dafa411b656a1c22a6310 100644 (file)
@@ -44,9 +44,8 @@
 
 #include <term.h>
 
-MODULE_ID("$Id: lib_options.c,v 1.60 2009/02/28 21:07:56 tom Exp $")
+MODULE_ID("$Id: lib_options.c,v 1.61 2009/05/02 21:19:53 tom Exp $")
 
-static int _nc_curs_set(SCREEN *, int);
 static int _nc_meta(SCREEN *, bool);
 
 NCURSES_EXPORT(int)
@@ -157,15 +156,44 @@ meta(WINDOW *win GCC_UNUSED, bool flag)
 /* curs_set() moved here to narrow the kernel interface */
 
 NCURSES_EXPORT(int)
-curs_set(int vis)
+NCURSES_SP_NAME(curs_set) (NCURSES_SP_DCLx int vis)
 {
-    int result;
+    int result = ERR;
+
+    T((T_CALLED("curs_set(%p,%d)"), SP_PARM, vis));
+    if (SP_PARM != 0 && vis >= 0 && vis <= 2) {
+       int cursor = SP_PARM->_cursor;
 
-    T((T_CALLED("curs_set(%d)"), vis));
-    result = _nc_curs_set(SP, vis);
+       if (vis == cursor) {
+           result = cursor;
+       } else {
+           switch (vis) {
+           case 2:
+               result = _nc_putp_flush("cursor_visible", cursor_visible);
+               break;
+           case 1:
+               result = _nc_putp_flush("cursor_normal", cursor_normal);
+               break;
+           case 0:
+               result = _nc_putp_flush("cursor_invisible", cursor_invisible);
+               break;
+           }
+           if (result != ERR)
+               result = (cursor == -1 ? 1 : cursor);
+           SP_PARM->_cursor = vis;
+       }
+    }
     returnCode(result);
 }
 
+#if NCURSES_SP_FUNCS
+NCURSES_EXPORT(int)
+curs_set(int vis)
+{
+    return (NCURSES_SP_NAME(curs_set) (CURRENT_SCREEN, vis));
+}
+#endif
+
 NCURSES_EXPORT(int)
 NCURSES_SP_NAME(typeahead) (NCURSES_SP_DCLx int fd)
 {
@@ -310,37 +338,6 @@ _nc_keypad(SCREEN *sp, bool flag)
     return (rc);
 }
 
-static int
-_nc_curs_set(SCREEN *sp, int vis)
-{
-    int result = ERR;
-
-    T((T_CALLED("curs_set(%d)"), vis));
-    if (sp != 0 && vis >= 0 && vis <= 2) {
-       int cursor = sp->_cursor;
-
-       if (vis == cursor) {
-           result = cursor;
-       } else {
-           switch (vis) {
-           case 2:
-               result = _nc_putp_flush("cursor_visible", cursor_visible);
-               break;
-           case 1:
-               result = _nc_putp_flush("cursor_normal", cursor_normal);
-               break;
-           case 0:
-               result = _nc_putp_flush("cursor_invisible", cursor_invisible);
-               break;
-           }
-           if (result != ERR)
-               result = (cursor == -1 ? 1 : cursor);
-           sp->_cursor = vis;
-       }
-    }
-    returnCode(result);
-}
-
 static int
 _nc_meta(SCREEN *sp, bool flag)
 {
index 0b12624ee005c75757114736846a9a04dfa9d9fa..c7061796330ba8ae4db9caa6ef5139e20f678d9a 100644 (file)
@@ -47,7 +47,7 @@
 #include <termcap.h>           /* ospeed */
 #include <tic.h>
 
-MODULE_ID("$Id: lib_tputs.c,v 1.68 2009/02/28 21:08:18 tom Exp $")
+MODULE_ID("$Id: lib_tputs.c,v 1.70 2009/05/02 20:54:22 tom Exp $")
 
 NCURSES_EXPORT_VAR(char) PC = 0;              /* used by termcap library */
 NCURSES_EXPORT_VAR(NCURSES_OSPEED) ospeed = 0;        /* used by termcap library */
@@ -104,7 +104,7 @@ delay_output(int ms)
 NCURSES_EXPORT(void)
 NCURSES_SP_NAME(_nc_flush) (NCURSES_SP_DCL0)
 {
-    (void) fflush(NC_OUTPUT);
+    (void) fflush(NC_OUTPUT(SP_PARM));
 }
 
 #if NCURSES_SP_FUNCS
@@ -127,9 +127,9 @@ NCURSES_SP_NAME(_nc_outch) (NCURSES_SP_DCLx int ch)
         * POSIX says write() is safe in a signal handler, but the
         * buffered I/O is not.
         */
-       write(fileno(NC_OUTPUT), &tmp, 1);
+       write(fileno(NC_OUTPUT(SP_PARM)), &tmp, 1);
     } else {
-       putc(ch, NC_OUTPUT);
+       putc(ch, NC_OUTPUT(SP_PARM));
     }
     return OK;
 }
index 157f7eb67e92e9023e5b0c259f55a89bea8bc2a6..2d7240700b33245f2621ff34358976ab1400e74e 100644 (file)
 #include <term.h>
 #include <ctype.h>
 
-MODULE_ID("$Id: lib_mvcur.c,v 1.117 2009/04/26 00:15:22 tom Exp $")
+MODULE_ID("$Id: lib_mvcur.c,v 1.118 2009/05/02 20:38:58 tom Exp $")
 
 #define WANT_CHAR(sp, y, x) (sp)->_newscr->_line[y].text[x]    /* desired state */
 #define BAUDRATE(sp)   cur_term->_baudrate     /* bits per second */
@@ -265,8 +265,10 @@ reset_scroll_region(NCURSES_SP_DCL0)
 /* Set the scroll-region to a known state (the default) */
 {
     if (change_scroll_region) {
-       TPUTS_TRACE("change_scroll_region");
-       putp(TPARM_2(change_scroll_region, 0, screen_lines(CURRENT_SCREEN) - 1));
+       NCURSES_SP_NAME(_nc_putp) (NCURSES_SP_ARGx
+                                  "change_scroll_region",
+                                  TPARM_2(change_scroll_region,
+                                          0, screen_lines(SP_PARM) - 1));
     }
 }
 
@@ -276,8 +278,9 @@ NCURSES_SP_NAME(_nc_mvcur_resume) (NCURSES_SP_DCL0)
 {
     /* initialize screen for cursor access */
     if (enter_ca_mode) {
-       TPUTS_TRACE("enter_ca_mode");
-       putp(enter_ca_mode);
+       NCURSES_SP_NAME(_nc_putp) (NCURSES_SP_ARGx
+                                  "enter_ca_mode",
+                                  enter_ca_mode);
     }
 
     /*
@@ -296,7 +299,7 @@ NCURSES_SP_NAME(_nc_mvcur_resume) (NCURSES_SP_DCL0)
     if (SP_PARM->_cursor != -1) {
        int cursor = SP_PARM->_cursor;
        SP_PARM->_cursor = -1;
-       curs_set(cursor);
+       NCURSES_SP_NAME(curs_set) (NCURSES_SP_ARGx cursor);
     }
 }
 
@@ -312,7 +315,7 @@ NCURSES_EXPORT(void)
 NCURSES_SP_NAME(_nc_mvcur_init) (NCURSES_SP_DCL0)
 /* initialize the cost structure */
 {
-    if (isatty(fileno(SP_PARM->_ofp)))
+    if (SP_PARM->_ofp && isatty(fileno(SP_PARM->_ofp)))
        SP_PARM->_char_padding = ((BAUDBYTE * 1000 * 10)
                                  / (BAUDRATE(SP_PARM) > 0
                                     ? BAUDRATE(SP_PARM)
@@ -410,7 +413,8 @@ NCURSES_SP_NAME(_nc_mvcur_init) (NCURSES_SP_DCL0)
 
     SP_PARM->_cup_ch_cost = NormalizedCost(
                                              TPARM_2(SP_PARM->_address_cursor,
-                                                     23, 23), 1);
+                                                     23, 23),
+                                             1);
     SP_PARM->_hpa_ch_cost = NormalizedCost(TPARM_1(column_address, 23), 1);
     SP_PARM->_cuf_ch_cost = NormalizedCost(TPARM_1(parm_right_cursor, 23), 1);
     SP_PARM->_inline_cost = min(SP_PARM->_cup_ch_cost,
@@ -458,13 +462,14 @@ NCURSES_SP_NAME(_nc_mvcur_wrap) (NCURSES_SP_DCL0)
     /* set cursor to normal mode */
     if (SP_PARM->_cursor != -1) {
        int cursor = SP_PARM->_cursor;
-       curs_set(1);
+       NCURSES_SP_NAME(curs_set) (NCURSES_SP_ARGx 1);
        SP_PARM->_cursor = cursor;
     }
 
     if (exit_ca_mode) {
-       TPUTS_TRACE("exit_ca_mode");
-       putp(exit_ca_mode);
+       NCURSES_SP_NAME(_nc_putp) (NCURSES_SP_ARGx
+                                  "exit_ca_mode",
+                                  exit_ca_mode);
     }
     /*
      * Reset terminal's tab counter.  There's a long-time bug that
@@ -474,7 +479,7 @@ NCURSES_SP_NAME(_nc_mvcur_wrap) (NCURSES_SP_DCL0)
      * escape sequences that reset things as column positions.
      * Utter a \r to reset this invisibly.
      */
-    _nc_outch('\r');
+    NCURSES_SP_NAME(_nc_outch) (NCURSES_SP_ARGx '\r');
 }
 
 #if NCURSES_SP_FUNCS
@@ -801,8 +806,9 @@ onscreen_mvcur(NCURSES_SP_DCLx int yold, int xold, int ynew, int xnew, bool ovw)
     /* tactic #1: use local movement */
     if (yold != -1 && xold != -1
        && ((newcost = relative_move(NCURSES_SP_ARGx
-                                    NullResult, yold, xold, ynew, xnew,
-                                    ovw)) != INFINITY)
+                                    NullResult,
+                                    yold, xold,
+                                    ynew, xnew, ovw)) != INFINITY)
        && newcost < usecost) {
        tactic = 1;
        usecost = newcost;
@@ -811,8 +817,9 @@ onscreen_mvcur(NCURSES_SP_DCLx int yold, int xold, int ynew, int xnew, bool ovw)
     /* tactic #2: use carriage-return + local movement */
     if (yold != -1 && carriage_return
        && ((newcost = relative_move(NCURSES_SP_ARGx
-                                    NullResult, yold, 0, ynew, xnew, ovw))
-           != INFINITY)
+                                    NullResult,
+                                    yold, 0,
+                                    ynew, xnew, ovw)) != INFINITY)
        && SP_PARM->_cr_cost + newcost < usecost) {
        tactic = 2;
        usecost = SP_PARM->_cr_cost + newcost;
@@ -821,7 +828,9 @@ onscreen_mvcur(NCURSES_SP_DCLx int yold, int xold, int ynew, int xnew, bool ovw)
     /* tactic #3: use home-cursor + local movement */
     if (cursor_home
        && ((newcost = relative_move(NCURSES_SP_ARGx
-                                    NullResult, 0, 0, ynew, xnew, ovw)) != INFINITY)
+                                    NullResult,
+                                    0, 0,
+                                    ynew, xnew, ovw)) != INFINITY)
        && SP_PARM->_home_cost + newcost < usecost) {
        tactic = 3;
        usecost = SP_PARM->_home_cost + newcost;
@@ -831,8 +840,8 @@ onscreen_mvcur(NCURSES_SP_DCLx int yold, int xold, int ynew, int xnew, bool ovw)
     if (cursor_to_ll
        && ((newcost = relative_move(NCURSES_SP_ARGx
                                     NullResult,
-                                    screen_lines(SP_PARM) - 1, 0, ynew,
-                                    xnew, ovw)) != INFINITY)
+                                    screen_lines(SP_PARM) - 1, 0,
+                                    ynew, xnew, ovw)) != INFINITY)
        && SP_PARM->_ll_cost + newcost < usecost) {
        tactic = 4;
        usecost = SP_PARM->_ll_cost + newcost;
@@ -845,12 +854,10 @@ onscreen_mvcur(NCURSES_SP_DCLx int yold, int xold, int ynew, int xnew, bool ovw)
     t5_cr_cost = (xold > 0 ? SP_PARM->_cr_cost : 0);
     if (auto_left_margin && !eat_newline_glitch
        && yold > 0 && cursor_left
-       && ((newcost = relative_move(NCURSES_SP_ARGx NullResult,
-                                    yold - 1,
-                                    screen_columns(SP_PARM) - 1,
-                                    ynew,
-                                    xnew,
-                                    ovw)) != INFINITY)
+       && ((newcost = relative_move(NCURSES_SP_ARGx
+                                    NullResult,
+                                    yold - 1, screen_columns(SP_PARM) - 1,
+                                    ynew, xnew, ovw)) != INFINITY)
        && t5_cr_cost + SP_PARM->_cub1_cost + newcost < usecost) {
        tactic = 5;
        usecost = t5_cr_cost + SP_PARM->_cub1_cost + newcost;
@@ -864,13 +871,15 @@ onscreen_mvcur(NCURSES_SP_DCLx int yold, int xold, int ynew, int xnew, bool ovw)
     switch (tactic) {
     case 1:
        (void) relative_move(NCURSES_SP_ARGx
-                            &result, yold, xold,
+                            &result,
+                            yold, xold,
                             ynew, xnew, ovw);
        break;
     case 2:
        (void) _nc_safe_strcpy(&result, carriage_return);
        (void) relative_move(NCURSES_SP_ARGx
-                            &result, yold, 0,
+                            &result,
+                            yold, 0,
                             ynew, xnew, ovw);
        break;
     case 3:
@@ -881,7 +890,8 @@ onscreen_mvcur(NCURSES_SP_DCLx int yold, int xold, int ynew, int xnew, bool ovw)
        break;
     case 4:
        (void) _nc_safe_strcpy(&result, cursor_to_ll);
-       (void) relative_move(NCURSES_SP_ARGx &result,
+       (void) relative_move(NCURSES_SP_ARGx
+                            &result,
                             screen_lines(SP_PARM) - 1, 0,
                             ynew, xnew, ovw);
        break;
@@ -889,7 +899,8 @@ onscreen_mvcur(NCURSES_SP_DCLx int yold, int xold, int ynew, int xnew, bool ovw)
        if (xold > 0)
            (void) _nc_safe_strcat(&result, carriage_return);
        (void) _nc_safe_strcat(&result, cursor_left);
-       (void) relative_move(NCURSES_SP_ARGx &result,
+       (void) relative_move(NCURSES_SP_ARGx
+                            &result,
                             yold - 1, screen_columns(SP_PARM) - 1,
                             ynew, xnew, ovw);
        break;
@@ -955,7 +966,7 @@ NCURSES_SP_NAME(mvcur) (NCURSES_SP_DCLx
            TR(TRACE_CHARPUT, ("turning off (%#lx) %s before move",
                               (unsigned long) AttrOf(oldattr),
                               _traceattr(AttrOf(oldattr))));
-           (void) VIDATTR(A_NORMAL, 0);
+           (void) VIDATTR(SP_PARM, A_NORMAL, 0);
        }
 
        if (xold >= screen_columns(SP_PARM)) {
@@ -969,18 +980,20 @@ NCURSES_SP_NAME(mvcur) (NCURSES_SP_DCLx
 
                if (l > 0) {
                    if (carriage_return) {
-                       TPUTS_TRACE("carriage_return");
-                       putp(carriage_return);
+                       NCURSES_SP_NAME(_nc_putp) (NCURSES_SP_ARGx
+                                                  "carriage_return",
+                                                  carriage_return);
                    } else
-                       _nc_outch('\r');
+                       NCURSES_SP_NAME(_nc_outch) (NCURSES_SP_ARGx '\r');
                    xold = 0;
 
                    while (l > 0) {
                        if (newline) {
-                           TPUTS_TRACE("newline");
-                           putp(newline);
+                           NCURSES_SP_NAME(_nc_putp) (NCURSES_SP_ARGx
+                                                      "newline",
+                                                      newline);
                        } else
-                           _nc_outch('\n');
+                           NCURSES_SP_NAME(_nc_outch) (NCURSES_SP_ARGx '\n');
                        l--;
                    }
                }
@@ -1009,7 +1022,7 @@ NCURSES_SP_NAME(mvcur) (NCURSES_SP_DCLx
            TR(TRACE_CHARPUT, ("turning on (%#lx) %s after move",
                               (unsigned long) AttrOf(oldattr),
                               _traceattr(AttrOf(oldattr))));
-           (void) VIDATTR(AttrOf(oldattr), GetPair(oldattr));
+           (void) VIDATTR(SP_PARM, AttrOf(oldattr), GetPair(oldattr));
        }
     }
     returnCode(code);
index 6c4f9e2f24205aba9c43611af13ea744af1e6777..83b6dbdf86115027e327537ce8e372dac5e6df18 100644 (file)
@@ -66,7 +66,7 @@
 #include <curses.priv.h>
 #include <term.h>
 
-MODULE_ID("$Id: lib_vidattr.c,v 1.51 2009/02/21 21:43:40 tom Exp $")
+MODULE_ID("$Id: lib_vidattr.c,v 1.53 2009/05/02 22:35:03 tom Exp $")
 
 #define doPut(mode) TPUTS_TRACE(#mode); tputs(mode, 1, outc)
 
@@ -91,14 +91,16 @@ MODULE_ID("$Id: lib_vidattr.c,v 1.51 2009/02/21 21:43:40 tom Exp $")
 #define PreviousAttr _nc_prescreen.previous_attr
 
 NCURSES_EXPORT(int)
-vidputs(chtype newmode, int (*outc) (int))
+NCURSES_SP_NAME(vidputs) (NCURSES_SP_DCLx
+                         chtype newmode,
+                         int (*outc) (int))
 {
     attr_t turn_on, turn_off;
     int pair;
     bool reverse = FALSE;
-    bool can_color = (SP == 0 || SP->_coloron);
+    bool can_color = (SP_PARM == 0 || SP_PARM->_coloron);
 #if NCURSES_EXT_FUNCS
-    bool fix_pair0 = (SP != 0 && SP->_coloron && !SP->_default_color);
+    bool fix_pair0 = (SP_PARM != 0 && SP_PARM->_coloron && !SP_PARM->_default_color);
 #else
 #define fix_pair0 FALSE
 #endif
@@ -107,12 +109,12 @@ vidputs(chtype newmode, int (*outc) (int))
     T((T_CALLED("vidputs(%s)"), _traceattr(newmode)));
 
     /* this allows us to go on whether or not newterm() has been called */
-    if (SP)
-       PreviousAttr = AttrOf(SCREEN_ATTRS(SP));
+    if (SP_PARM)
+       PreviousAttr = AttrOf(SCREEN_ATTRS(SP_PARM));
 
     TR(TRACE_ATTRS, ("previous attribute was %s", _traceattr(PreviousAttr)));
 
-    if ((SP != 0)
+    if ((SP_PARM != 0)
        && (magic_cookie_glitch > 0)) {
 #if USE_XMC_SUPPORT
        static const chtype table[] =
@@ -136,7 +138,7 @@ vidputs(chtype newmode, int (*outc) (int))
         * the terminfo max_attributes value.
         */
        for (n = 0; n < SIZEOF(table); ++n) {
-           if ((table[n] & SP->_ok_attributes) == 0) {
+           if ((table[n] & SP_PARM->_ok_attributes) == 0) {
                newmode &= ~table[n];
            } else if ((table[n] & newmode) != 0) {
                if (used++ >= limit) {
@@ -149,7 +151,7 @@ vidputs(chtype newmode, int (*outc) (int))
            }
        }
 #else
-       newmode &= ~(SP->_xmc_suppress);
+       newmode &= ~(SP_PARM->_xmc_suppress);
 #endif
        TR(TRACE_ATTRS, ("suppressed attribute is %s", _traceattr(newmode)));
     }
@@ -209,10 +211,10 @@ vidputs(chtype newmode, int (*outc) (int))
            if (exit_attribute_mode) {
                doPut(exit_attribute_mode);
            } else {
-               if (!SP || SP->_use_rmul) {
+               if (!SP_PARM || SP_PARM->_use_rmul) {
                    TurnOff(A_UNDERLINE, exit_underline_mode);
                }
-               if (!SP || SP->_use_rmso) {
+               if (!SP_PARM || SP_PARM->_use_rmso) {
                    TurnOff(A_STANDOUT, exit_standout_mode);
                }
            }
@@ -242,11 +244,11 @@ vidputs(chtype newmode, int (*outc) (int))
 
        TurnOff(A_ALTCHARSET, exit_alt_charset_mode);
 
-       if (!SP || SP->_use_rmul) {
+       if (!SP_PARM || SP_PARM->_use_rmul) {
            TurnOff(A_UNDERLINE, exit_underline_mode);
        }
 
-       if (!SP || SP->_use_rmso) {
+       if (!SP_PARM || SP_PARM->_use_rmso) {
            TurnOff(A_STANDOUT, exit_standout_mode);
        }
 
@@ -283,14 +285,28 @@ vidputs(chtype newmode, int (*outc) (int))
     if (reverse)
        newmode |= A_REVERSE;
 
-    if (SP)
-       SetAttr(SCREEN_ATTRS(SP), newmode);
+    if (SP_PARM)
+       SetAttr(SCREEN_ATTRS(SP_PARM), newmode);
     else
        PreviousAttr = newmode;
 
     returnCode(OK);
 }
 
+NCURSES_EXPORT(int)
+NCURSES_SP_NAME(vidattr) (NCURSES_SP_DCLx
+                         chtype newmode)
+{
+    return NCURSES_SP_NAME(vidputs) (NCURSES_SP_ARGx newmode, _nc_outch);
+}
+
+#if NCURSES_SP_FUNCS
+NCURSES_EXPORT(int)
+vidputs(chtype newmode, int (*outc) (int))
+{
+    return NCURSES_SP_NAME(vidputs) (CURRENT_SCREEN, newmode, outc);
+}
+
 NCURSES_EXPORT(int)
 vidattr(chtype newmode)
 {
@@ -298,6 +314,7 @@ vidattr(chtype newmode)
 
     returnCode(vidputs(newmode, _nc_outch));
 }
+#endif
 
 NCURSES_EXPORT(chtype)
 NCURSES_SP_NAME(termattrs) (NCURSES_SP_DCL0)
index 5ba824b7b78baa9b02179510dcedced99fad115d..cabca530843e7903a71b19daa7518b34e64ebde0 100644 (file)
@@ -78,7 +78,7 @@
 
 #include <ctype.h>
 
-MODULE_ID("$Id: tty_update.c,v 1.251 2009/04/25 23:46:09 tom Exp $")
+MODULE_ID("$Id: tty_update.c,v 1.252 2009/05/02 20:52:11 tom Exp $")
 
 /*
  * This define controls the line-breakout optimization.  Every once in a
@@ -439,7 +439,7 @@ wrap_cursor(NCURSES_SP_DCL0)
            TR(TRACE_CHARPUT, ("turning off (%#lx) %s before wrapping",
                               (unsigned long) AttrOf(SCREEN_ATTRS(SP_PARM)),
                               _traceattr(AttrOf(SCREEN_ATTRS(SP_PARM)))));
-           (void) VIDATTR(A_NORMAL, 0);
+           (void) VIDATTR(SP_PARM, A_NORMAL, 0);
        }
     } else {
        SP_PARM->_curscol--;
@@ -2002,7 +2002,7 @@ NCURSES_SP_NAME(_nc_screen_resume) (NCURSES_SP_DCL0)
 
     /* reset color pairs and definitions */
     if (SP_PARM->_coloron || SP_PARM->_color_defs)
-       _nc_reset_colors ();
+       _nc_reset_colors();
 
     /* restore user-defined colors, if any */
     if (SP_PARM->_color_defs < 0) {
@@ -2081,7 +2081,7 @@ NCURSES_SP_NAME(_nc_screen_wrap) (NCURSES_SP_DCL0)
     }
 #endif
     if (SP_PARM->_color_defs) {
-       _nc_reset_colors ();
+       _nc_reset_colors();
     }
 }
 
index 1dc679e6d9078fd191b998f8eec47a4815276f1e..0b5648b0fef782917376fa6fa1216b40b51b044f 100644 (file)
@@ -1,5 +1,5 @@
 /****************************************************************************
- * Copyright (c) 2002-2006,2007 Free Software Foundation, Inc.              *
+ * Copyright (c) 2002-2007,2009 Free Software Foundation, Inc.              *
  *                                                                          *
  * Permission is hereby granted, free of charge, to any person obtaining a  *
  * copy of this software and associated documentation files (the            *
@@ -33,7 +33,7 @@
 #include <curses.priv.h>
 #include <term.h>
 
-MODULE_ID("$Id: lib_vid_attr.c,v 1.5 2007/06/30 22:03:02 tom Exp $")
+MODULE_ID("$Id: lib_vid_attr.c,v 1.7 2009/05/02 23:30:44 tom Exp $")
 
 #define doPut(mode) TPUTS_TRACE(#mode); tputs(mode, 1, outc)
 
@@ -57,7 +57,11 @@ MODULE_ID("$Id: lib_vid_attr.c,v 1.5 2007/06/30 22:03:02 tom Exp $")
 #define set_color(mode, pair) mode &= ALL_BUT_COLOR; mode |= COLOR_PAIR(pair)
 
 NCURSES_EXPORT(int)
-vid_puts(attr_t newmode, short pair, void *opts GCC_UNUSED, int (*outc) (int))
+NCURSES_SP_NAME(vid_puts)(NCURSES_SP_DCLx
+                         attr_t newmode,
+                         short pair,
+                         void *opts GCC_UNUSED,
+                         int (*outc) (int))
 {
 #if NCURSES_EXT_COLORS
     static attr_t previous_attr = A_NORMAL;
@@ -65,9 +69,9 @@ vid_puts(attr_t newmode, short pair, void *opts GCC_UNUSED, int (*outc) (int))
 
     attr_t turn_on, turn_off;
     bool reverse = FALSE;
-    bool can_color = (SP == 0 || SP->_coloron);
+    bool can_color = (SP_PARM == 0 || SP_PARM->_coloron);
 #if NCURSES_EXT_FUNCS
-    bool fix_pair0 = (SP != 0 && SP->_coloron && !SP->_default_color);
+    bool fix_pair0 = (SP_PARM != 0 && SP_PARM->_coloron && !SP_PARM->_default_color);
 #else
 #define fix_pair0 FALSE
 #endif
@@ -76,18 +80,18 @@ vid_puts(attr_t newmode, short pair, void *opts GCC_UNUSED, int (*outc) (int))
     T((T_CALLED("vid_puts(%s,%d)"), _traceattr(newmode), pair));
 
     /* this allows us to go on whether or not newterm() has been called */
-    if (SP) {
-       previous_attr = AttrOf(SCREEN_ATTRS(SP));
-       previous_pair = GetPair(SCREEN_ATTRS(SP));
+    if (SP_PARM) {
+       previous_attr = AttrOf(SCREEN_ATTRS(SP_PARM));
+       previous_pair = GetPair(SCREEN_ATTRS(SP_PARM));
     }
 
     TR(TRACE_ATTRS, ("previous attribute was %s, %d",
                     _traceattr(previous_attr), previous_pair));
 
 #if !USE_XMC_SUPPORT
-    if ((SP != 0)
+    if ((SP_PARM != 0)
        && (magic_cookie_glitch > 0))
-       newmode &= ~(SP->_xmc_suppress);
+       newmode &= ~(SP_PARM->_xmc_suppress);
 #endif
 
     /*
@@ -144,10 +148,10 @@ vid_puts(attr_t newmode, short pair, void *opts GCC_UNUSED, int (*outc) (int))
            if (exit_attribute_mode) {
                doPut(exit_attribute_mode);
            } else {
-               if (!SP || SP->_use_rmul) {
+               if (!SP_PARM || SP_PARM->_use_rmul) {
                    TurnOff(A_UNDERLINE, exit_underline_mode);
                }
-               if (!SP || SP->_use_rmso) {
+               if (!SP_PARM || SP_PARM->_use_rmso) {
                    TurnOff(A_STANDOUT, exit_standout_mode);
                }
            }
@@ -179,11 +183,11 @@ vid_puts(attr_t newmode, short pair, void *opts GCC_UNUSED, int (*outc) (int))
 
        TurnOff(A_ALTCHARSET, exit_alt_charset_mode);
 
-       if (!SP || SP->_use_rmul) {
+       if (!SP_PARM || SP_PARM->_use_rmul) {
            TurnOff(A_UNDERLINE, exit_underline_mode);
        }
 
-       if (!SP || SP->_use_rmso) {
+       if (!SP_PARM || SP_PARM->_use_rmso) {
            TurnOff(A_STANDOUT, exit_standout_mode);
        }
 
@@ -221,9 +225,9 @@ vid_puts(attr_t newmode, short pair, void *opts GCC_UNUSED, int (*outc) (int))
     if (reverse)
        newmode |= A_REVERSE;
 
-    if (SP) {
-       SetAttr(SCREEN_ATTRS(SP), newmode);
-       SetPair(SCREEN_ATTRS(SP), pair);
+    if (SP_PARM) {
+       SetAttr(SCREEN_ATTRS(SP_PARM), newmode);
+       SetPair(SCREEN_ATTRS(SP_PARM), pair);
     } else {
        previous_attr = newmode;
        previous_pair = pair;
@@ -239,12 +243,29 @@ vid_puts(attr_t newmode, short pair, void *opts GCC_UNUSED, int (*outc) (int))
 
 #undef vid_attr
 NCURSES_EXPORT(int)
-vid_attr(attr_t newmode, short pair, void *opts)
+NCURSES_SP_NAME(vid_attr) (NCURSES_SP_DCLx
+                          attr_t newmode,
+                          short pair,
+                          void *opts)
 {
     T((T_CALLED("vid_attr(%s,%d)"), _traceattr(newmode), pair));
     returnCode(vid_puts(newmode, pair, opts, _nc_outch));
 }
 
+#if NCURSES_SP_FUNCS
+NCURSES_EXPORT(int)
+vid_puts(attr_t newmode, short pair, void *opts GCC_UNUSED, int (*outc) (int))
+{
+    return NCURSES_SP_NAME(vid_puts) (CURRENT_SCREEN, newmode, pair, opts, outc);
+}
+
+NCURSES_EXPORT(int)
+vid_attr(attr_t newmode, short pair, void *opts)
+{
+    return NCURSES_SP_NAME(vid_attr) (CURRENT_SCREEN, newmode, pair, opts);
+}
+#endif
+
 /*
  * This implementation uses the same mask values for A_xxx and WA_xxx, so
  * we can use termattrs() for part of the logic.
index b8aebac93c5678f28f94604b4354e52006bfe3c4..c658de71432d0eb7e88a8128eb5734eb2e85f4fe 100644 (file)
@@ -29,7 +29,7 @@
 /*
  * Author: Thomas E. Dickey (1998-on)
  *
- * $Id: ditto.c,v 1.32 2008/08/04 13:21:41 tom Exp $
+ * $Id: ditto.c,v 1.33 2008/11/16 00:19:59 juergen Exp $
  *
  * The program illustrates how to set up multiple screens from a single
  * program.
@@ -137,8 +137,8 @@ peek_fifo(FIFO * fifo, PEEK * peek)
 {
     int result = -1;
     if (peek->sequence < fifo->sequence) {
-       peek->sequence += 1;
        result = fifo->data[THIS_FIFO(peek->sequence)];
+       peek->sequence += 1;
     }
     return result;
 }
@@ -188,7 +188,11 @@ open_tty(char *path)
 }
 
 static void
-init_screen(SCREEN *sp GCC_UNUSED, void *arg)
+init_screen(
+#if HAVE_USE_WINDOW
+              SCREEN *sp GCC_UNUSED,
+#endif
+              void *arg)
 {
     DITTO *target = (DITTO *) arg;
     int high, wide;
@@ -237,6 +241,7 @@ open_screen(DITTO * target, char **source, int length, int which1)
     target->which1 = which1;
     target->titles = source;
     target->length = length;
+    target->fifo.head = -1;
     target->screen = newterm((char *) 0,       /* assume $TERM is the same */
                             target->output,
                             target->input);
@@ -248,7 +253,11 @@ open_screen(DITTO * target, char **source, int length, int which1)
 }
 
 static int
-close_screen(SCREEN *sp GCC_UNUSED, void *arg GCC_UNUSED)
+close_screen(
+#if HAVE_USE_WINDOW
+               SCREEN *sp GCC_UNUSED,
+#endif
+               void *arg GCC_UNUSED)
 {
     (void) sp;
     (void) arg;
@@ -259,7 +268,11 @@ close_screen(SCREEN *sp GCC_UNUSED, void *arg GCC_UNUSED)
  * Read data from the 'source' screen.
  */
 static int
-read_screen(SCREEN *sp GCC_UNUSED, void *arg)
+read_screen(
+#if HAVE_USE_WINDOW
+              SCREEN *sp GCC_UNUSED,
+#endif
+              void *arg)
 {
     DDATA *data = (DDATA *) arg;
     DITTO *ditto = &(data->ditto[data->source]);
@@ -278,7 +291,11 @@ read_screen(SCREEN *sp GCC_UNUSED, void *arg)
  * Write all of the data that's in fifos for the 'target' screen.
  */
 static int
-write_screen(SCREEN *sp GCC_UNUSED, void *arg GCC_UNUSED)
+write_screen(
+#if HAVE_USE_WINDOW
+               SCREEN *sp GCC_UNUSED,
+#endif
+               void *arg GCC_UNUSED)
 {
     DDATA *data = (DDATA *) arg;
     DITTO *ditto = &(data->ditto[data->target]);
@@ -360,7 +377,7 @@ main(int argc, char *argv[])
 
     if (argc <= 1)
        usage();
-
+    
     if ((data = typeCalloc(DITTO, (size_t) argc)) == 0)
        failed("calloc data");
 
index c1f700cac8e59d4aef25483a5a72941ea6301bc7..c99485b7b180e9e039569fed64f71dfcc67acd16 100644 (file)
@@ -40,7 +40,7 @@ AUTHOR
    Author: Eric S. Raymond <esr@snark.thyrsus.com> 1993
            Thomas E. Dickey (beginning revision 1.27 in 1996).
 
-$Id: ncurses.c,v 1.338 2009/03/28 21:40:51 tom Exp $
+$Id: ncurses.c,v 1.339 2009/04/04 22:46:11 juergen Exp $
 
 ***************************************************************************/
 
@@ -483,7 +483,11 @@ ShellOut(bool message)
        addstr("Shelling out...");
     def_prog_mode();
     endwin();
+#ifdef __MINGW32__
+    system("cmd.exe");
+#else
     system("sh");
+#endif
     if (message)
        addstr("returned from shellout.\n");
     refresh();
@@ -924,6 +928,7 @@ getch_test(void)
     wgetch_test(0, stdscr, delay);
     forget_boxes();
     finish_getch_test();
+    slk_clear();
 }
 
 #if USE_WIDEC_SUPPORT
@@ -1141,6 +1146,7 @@ get_wch_test(void)
     wget_wch_test(0, stdscr, delay);
     forget_boxes();
     finish_getch_test();
+    slk_clear();
 }
 #endif
 
index 18e163c535f42e225fef1c6705d4b389c83222e4..f62a930d2360981416b2444b68f7b67de8a30b88 100644 (file)
@@ -29,7 +29,7 @@
 /****************************************************************************
  *  Author: Thomas E. Dickey                    1996-on                     *
  ****************************************************************************/
-/* $Id: test.priv.h,v 1.80 2008/12/20 16:37:20 tom Exp $ */
+/* $Id: test.priv.h,v 1.81 2008/12/28 20:20:39 juergen Exp $ */
 
 #ifndef __TEST_PRIV_H
 #define __TEST_PRIV_H 1
@@ -467,6 +467,14 @@ extern int optind;
 #define EXIT_FAILURE 1
 #endif
 
+#ifdef __MINGW32__
+#include <nc_mingw.h>
+/* conflicts in test/firstlast.c */
+#undef large
+#undef small
+
+#endif
+
 /* Use this to quiet gcc's -Wwrite-strings warnings, but accommodate SVr4
  * curses which doesn't have const parameters declared (so far) in the places
  * that XSI shows.
@@ -563,7 +571,7 @@ typedef int (*NCURSES_SCREEN_CB)(SCREEN *, void *);
 #define USING_SCREEN(s,func,data) use_screen(s, (NCURSES_SCREEN_CB) func, data)
 #define WANT_USE_SCREEN() extern void _nc_want_use_screen(void)
 #else
-#define USING_SCREEN(s,func,data) func(s,data)
+#define USING_SCREEN(s,func,data) func(data)
 #define WANT_USE_SCREEN() extern void _nc_want_use_screen(void)
 #endif
 
index 9f2d72f64f0a46e2550963ce48efbf7563817d5f..fe3a2114ea3a3ff3de30ed781dd1090e71d4f721 100644 (file)
@@ -50,7 +50,7 @@
  * scroll operation worked, and the refresh() code only had to do a
  * partial repaint.
  *
- * $Id: view.c,v 1.69 2008/09/06 22:10:50 tom Exp $
+ * $Id: view.c,v 1.70 2008/11/16 00:19:59 juergen Exp $
  */
 
 #include <test.priv.h>
 #if HAVE_TERMIOS_H
 # include <termios.h>
 #else
+#if !defined(__MINGW32__)
 # include <sgtty.h>
 #endif
+#endif
 
 #if !defined(sun) || !HAVE_TERMIOS_H
 # if HAVE_SYS_IOCTL_H
index 2029b34f9e3cefdd00d0c3d4a03ef3b88baf103a..0bcd8d3dddc8e2c86f0cfa406a9972f57bb8dd75 100644 (file)
@@ -61,7 +61,7 @@ Options:
   traces will be dumped.  The program stops and waits for one character of
   input at the beginning and end of the interval.
 
-  $Id: worm.c,v 1.58 2008/10/04 21:54:09 tom Exp $
+  $Id: worm.c,v 1.59 2008/11/16 00:19:59 juergen Exp $
 */
 
 #include <test.priv.h>
@@ -330,7 +330,11 @@ start_worm(void *arg)
     while (!quit_worm(((struct worm *) arg) - worm)) {
        while (compare < sequence) {
            ++compare;
+#if HAVE_USE_WINDOW
            use_window(stdscr, draw_worm, arg);
+#else
+           draw_worm(stdscr, arg);
+#endif
        }
     }
     Trace(("...start_worm (done)"));
@@ -356,7 +360,13 @@ draw_all_worms(void)
     }
 #else
     for (n = 0, w = &worm[0]; n < number; n++, w++) {
-       if (USING_WINDOW2(stdscr, draw_worm, w))
+       if (
+#if HAVE_USE_WINDOW
+              USING_WINDOW2(stdscr, draw_worm, w)
+#else
+              draw_worm(stdscr, w)
+#endif
+           )
            done = TRUE;
     }
 #endif