]> ncurses.scripts.mit.edu Git - ncurses.git/commitdiff
ncurses 5.6 - patch 20070127
authorThomas E. Dickey <dickey@invisible-island.net>
Sun, 28 Jan 2007 00:56:00 +0000 (00:56 +0000)
committerThomas E. Dickey <dickey@invisible-island.net>
Sun, 28 Jan 2007 00:56:00 +0000 (00:56 +0000)
+ improve fix for FreeBSD gnu/98975, to allow for null pointer passed
  to tgetent() (report by Rong-en Fan).
+ update tack/HISTORY and tack/README to tell how to build it after
  it is removed from the ncurses tree.
+ fix configure check for libtool's version to trim blank lines
  (report by sci-fi@hush.ai).
+ review/eliminate other original-file artifacts in cursesw.cc, making
  its license consistent with ncurses.
+ use ncurses vw_scanw() rather than reading into a fixed buffer in
  the c++ binding for scanw() methods.
+ eliminate fixed-buffer vsprintf() calls in c++ binding.

17 files changed:
NEWS
aclocal.m4
c++/README-first
c++/cursesapp.cc
c++/cursesmain.cc
c++/cursesw.cc
c++/cursesw.h
c++/demo.cc
c++/edit_cfg.sh
c++/etip.h.in
configure
dist.mk
ncurses/tinfo/lib_termcap.c
tack/HISTORY
tack/README
test/Makefile.in
test/configure.in

diff --git a/NEWS b/NEWS
index ab3a9d5ab102a620503ee2ae357d5b0924196998..fb960ab9095a527161f8ff8304b775cb36e648a3 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.1069 2007/01/20 22:37:14 tom Exp $
+-- $Id: NEWS,v 1.1073 2007/01/28 00:38:53 tom Exp $
 -------------------------------------------------------------------------------
 
 This is a log of changes that ncurses has gone through since Zeyd started
@@ -45,6 +45,19 @@ 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.
 
+20070127
+       + improve fix for FreeBSD gnu/98975, to allow for null pointer passed
+         to tgetent() (report by Rong-en Fan).
+       + update tack/HISTORY and tack/README to tell how to build it after
+         it is removed from the ncurses tree.
+       + fix configure check for libtool's version to trim blank lines
+         (report by sci-fi@hush.ai).
+       + review/eliminate other original-file artifacts in cursesw.cc, making
+         its license consistent with ncurses.
+       + use ncurses vw_scanw() rather than reading into a fixed buffer in
+         the c++ binding for scanw() methods.
+       + eliminate fixed-buffer vsprintf() calls in c++ binding.
+
 20070120
        + add _nc_leaks_tic() to separate leak-checking of tic library from
          term/ncurses libraries, and thereby eliminate a library dependency.
index 43be1cfb50c4226f7ad890ba64c957f2a2f8ea4e..343fc055be7c93db9545eeb6fe83dbe893f2b2ee 100644 (file)
@@ -28,7 +28,7 @@ dnl***************************************************************************
 dnl
 dnl Author: Thomas E. Dickey 1995-on
 dnl
-dnl $Id: aclocal.m4,v 1.413 2007/01/13 19:46:41 tom Exp $
+dnl $Id: aclocal.m4,v 1.414 2007/01/27 22:53:29 tom Exp $
 dnl Macros used in NCURSES auto-configuration script.
 dnl
 dnl These macros are maintained separately from NCURSES.  The copyright on
@@ -4641,7 +4641,7 @@ if test "$with_gpm" != no ; then
 fi
 ])
 dnl ---------------------------------------------------------------------------
-dnl CF_WITH_LIBTOOL version: 12 updated: 2006/12/30 19:00:13
+dnl CF_WITH_LIBTOOL version: 13 updated: 2007/01/27 17:52:16
 dnl ---------------
 dnl Provide a configure option to incorporate libtool.  Define several useful
 dnl symbols for the makefile rules.
@@ -4732,7 +4732,7 @@ ifdef([AC_PROG_LIBTOOL],[
        # Save the version in a cache variable - this is not entirely a good
        # thing, but the version string from libtool is very ugly, and for
        # bug reports it might be useful to have the original string.
-       cf_cv_libtool_version=`$LIBTOOL --version 2>&1 | sed -e '/^$/d' -e '2,$d' -e 's/([[^)]]*)//g' -e 's/^[[^1-9]]*//' -e 's/[[^0-9.]].*//'`
+       cf_cv_libtool_version=`$LIBTOOL --version 2>&1 | sed -e '/^$/d' |sed -e '2,$d' -e 's/([[^)]]*)//g' -e 's/^[[^1-9]]*//' -e 's/[[^0-9.]].*//'`
        AC_MSG_RESULT($cf_cv_libtool_version)
        if test -z "$cf_cv_libtool_version" ; then
                AC_MSG_ERROR(This is not libtool)
index 99c96d2b31188dd81e15748d42ecb5cd6417906b..42487f52db41d988bdac6a4b623d5181a6dae859 100644 (file)
@@ -1,5 +1,5 @@
 -------------------------------------------------------------------------------
--- Copyright (c) 1998-2003,2006 Free Software Foundation, Inc.               --
+-- Copyright (c) 1998-2006,2007 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             --
 -- sale, use or other dealings in this Software without prior written        --
 -- authorization.                                                            --
 -------------------------------------------------------------------------------
--- $Id: README-first,v 1.8 2006/04/22 22:19:37 tom Exp $
+-- $Id: README-first,v 1.9 2007/01/27 18:27:09 tom Exp $
 -------------------------------------------------------------------------------
                   C++ interface to ncurses routines
 -----------------------------------------------------------------------
 
 This directory contains the source code for several C++ classes which
-ease the use of writing ncurses-based programs.  The code is derived
-from the libg++ CursesWindow class but enhanced for ncurses.
+ease the use of writing ncurses-based programs.  The code was originally
+derived from the libg++ CursesWindow class, but rewritten for ncurses.
 
 The classes simplify the use of window specific functions by
 encapsulating them in the window object.  Function overloading is
-used in order to narrow the interface.  E.g. you don't have the
+used in order to narrow the interface.  For example, you do not have the
 distinction between `printw' and `mvprintw' anymore.
 
 A second benefit is the removal of all #defines which are included in
 the curses.h file.  This is a steady cause of trouble because many
 common identifiers are used.  Instead now all #defines are inline
-functions which also allows strict type checking of arguments.
+functions, which also allows strict type checking of arguments.
 
 The next enhancement is color support. It was originally provided by a 
-derived class. This caused some trouble if you think about Panels or
-Menus and Forms with colors. We decided to put color support into the
+derived class.  This caused some trouble if you think about Panels or
+Menus and Forms with colors.  We decided to put color support into the
 base class so that any derived class may use color support also.
 The implementation chosen here is directed to unrestricted use
-of mixes of color and monochrome windows. The original NCursesColorWindow
+of mixes of color and monochrome windows.  The original NCursesColorWindow
 class is maintained for compatibility reasons.
 
 The last point to mention is the support of other packages that are
-distributed with the ncurses package: the panels library, the menu library
-and the form library. This support is provided by the NCursesPanel class, 
+distributed with the ncurses package:  the panels library, the menu library
+and the form library.  This support is provided by the NCursesPanel class,
 which is also derived from the NCursesWindow class and the NCursesMenu
-and NCursesForm classes which are derived from NCursesPanel. This allows 
+and NCursesForm classes which are derived from NCursesPanel.  This allows
 building interfaces with windows.
 
 Please see the example program for a quick introduction.
@@ -68,14 +68,6 @@ to find out how to use the classes, read the code and the example program.
 Suggestions for enhancements and contributions of code (and docs) are
 welcome.  Please let us know which functionality you miss.
 
-       ATTENTION LINUX USERS:  There is currently some discussion of
-       replacing the BSD curses in the Linux libc with ncurses.  If
-       this is done we could perhaps include these classes in the Linux
-       libg++ replacing the original CursesWindow class (and renaming it
-       to CursesWindow).  This could be done because NCursesWindow can
-       be made easily to a superset of the CursesWindow class.
-
-
 Original author:
      Eric Newton         <newton@rocky.oswego.edu> for FSF's libg++
 
@@ -83,5 +75,6 @@ Authors of first ncurses based release (NCursesWindow, NCursesPanel):
      Ulrich Drepper      <drepper@ira.uka.de>
  and Anatoly Ivasyuk     <anatoly@nick.csh.rit.edu>
 
-Author of this release:
+Authors of this release:
      Juergen Pfeifer
+     Thomas E. Dickey
index 6871a69a39773d7af0ebd5dd799a8a2131a6ce00..c85e4f74555d8da85979f25c389b803603af06a6 100644 (file)
@@ -1,6 +1,6 @@
 // * this is for making emacs happy: -*-Mode: C++;-*-
 /****************************************************************************
- * Copyright (c) 1998-2003,2005 Free Software Foundation, Inc.              *
+ * Copyright (c) 1998-2005,2007 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            *
@@ -34,7 +34,7 @@
 #include "internal.h"
 #include "cursesapp.h"
 
-MODULE_ID("$Id: cursesapp.cc,v 1.13 2005/04/03 12:25:23 tom Exp $")
+MODULE_ID("$Id: cursesapp.cc,v 1.14 2007/01/27 20:16:42 tom Exp $")
 
 void
 NCursesApplication::init(bool bColors)
@@ -72,11 +72,16 @@ NCursesApplication::~NCursesApplication()
   Soft_Label_Key_Set* S;
 
   delete titleWindow;
+  titleWindow = 0;
+
   while( (S=top()) ) {
     pop();
     delete S;
   }
+
   delete Root_Window;
+  Root_Window = 0;
+
   ::endwin();
 }
 
index d10035b5f06e69c1242bc89e7197e82840eec68e..7382600b986bd7db982d77d5c90b793d89bb71da 100644 (file)
@@ -1,6 +1,6 @@
 // * this is for making emacs happy: -*-Mode: C++;-*-
 /****************************************************************************
- * Copyright (c) 1998-2002,2003 Free Software Foundation, Inc.              *
+ * Copyright (c) 1998-2003,2007 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            *
@@ -34,7 +34,7 @@
 #include "internal.h"
 #include "cursesapp.h"
 
-MODULE_ID("$Id: cursesmain.cc,v 1.11 2003/10/25 14:53:13 tom Exp $")
+MODULE_ID("$Id: cursesmain.cc,v 1.13 2007/01/27 20:29:27 tom Exp $")
 
 #if HAVE_LOCALE_H
 #include <locale.h>
@@ -42,6 +42,10 @@ MODULE_ID("$Id: cursesmain.cc,v 1.11 2003/10/25 14:53:13 tom Exp $")
 #define setlocale(name,string) /* nothing */
 #endif
 
+#if NO_LEAKS
+#include <nc_alloc.h>
+#endif
+
 /* This is the default implementation of main() for a NCursesApplication.
  * You only have to instantiate a static NCursesApplication object in your
  * main application source file and link this module with your application.
@@ -60,6 +64,11 @@ int main(int argc, char* argv[])
     ::endwin();
     res = (*A)();
     ::endwin();
+#if NO_LEAKS
+    delete A;
+    _nc_free_and_exit(res);
+#else
     return(res);
+#endif
   }
 }
index 106202a5379d6c24d855c9bd6abf5f51c71c04d2..acf9ce94b0ae47a3bc3c7ac37d1499b2eeaab06f 100644 (file)
@@ -1,79 +1,70 @@
 // * this is for making emacs happy: -*-Mode: C++;-*-
+/****************************************************************************
+ * Copyright (c) 2007 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            *
+ * "Software"), to deal in the Software without restriction, including      *
+ * without limitation the rights to use, copy, modify, merge, publish,      *
+ * distribute, distribute with modifications, sublicense, and/or sell       *
+ * copies of the Software, and to permit persons to whom the Software is    *
+ * furnished to do so, subject to the following conditions:                 *
+ *                                                                          *
+ * The above copyright notice and this permission notice shall be included  *
+ * in all copies or substantial portions of the Software.                   *
+ *                                                                          *
+ * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS  *
+ * OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF               *
+ * MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT.   *
+ * IN NO EVENT SHALL THE ABOVE COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM,   *
+ * DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR    *
+ * OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR    *
+ * THE USE OR OTHER DEALINGS IN THE SOFTWARE.                               *
+ *                                                                          *
+ * Except as contained in this notice, the name(s) of the above copyright   *
+ * holders shall not be used in advertising or otherwise to promote the     *
+ * sale, use or other dealings in this Software without prior written       *
+ * authorization.                                                           *
+ ****************************************************************************/
 
 /*
-  Copyright (C) 1989 Free Software Foundation
-  written by Eric Newton (newton@rocky.oswego.edu)
-
-  This file is part of the GNU C++ Library.  This library is free
-  software; you can redistribute it and/or modify it under the terms of
-  the GNU Library General Public License as published by the Free
-  Software Foundation; either version 2 of the License, or (at your
-  option) any later version.  This library 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 Library General Public License for more details.
-  You should have received a copy of the GNU Library General Public
-  License along with this library; if not, write to the Free Software
-  Foundation, 675 Mass Ave, Cambridge, MA 02139, USA.
-
-  modified by Ulrich Drepper  (drepper@karlsruhe.gmd.de)
-          and Anatoly Ivasyuk (anatoly@nick.csh.rit.edu)
-
-  modified by Juergen Pfeifer
-  and Thomas Dickey (noting that more than 70% of this file has been changed)
-*/
+ * Authors:
+ *     Thomas E. Dickey
+ *     Juergen Pfeifer
+ *
+ * The NCursesWindow class was originally based on a file written by
+ * Eric Newton, later modified by Ulrich Drepper and Anatoly Ivasyuk.
+ * However, aside from the compatible interface definition, no trace
+ * of the original code remains in this version: it consists only of
+ * changes introduced since 1995.
+ */
 
 #include "internal.h"
 #include "cursesw.h"
 
-MODULE_ID("$Id: cursesw.cc,v 1.32 2005/08/13 18:12:17 tom Exp $")
+MODULE_ID("$Id: cursesw.cc,v 1.46 2007/01/27 22:31:12 tom Exp $")
 
 #define COLORS_NEED_INITIALIZATION  -1
 #define COLORS_NOT_INITIALIZED       0
 #define COLORS_MONOCHROME            1
 #define COLORS_ARE_REALLY_THERE      2
 
+#define HaveColors() (colorInitialized == COLORS_ARE_REALLY_THERE)
+
 // declare static variables for the class
 long NCursesWindow::count = 0L;
 bool NCursesWindow::b_initialized = FALSE;
 
-/*
- * The ncurses library has a fallback for vsscanf(), which may work...
- */
-#if !(USE_STRSTREAM_VSCAN || USE_STRSTREAM_VSCAN_CAST)
-#  undef  USE_STDIO_VSCAN
-#  define USE_STDIO_VSCAN 1
-#endif
-
-#if defined(__GNUG__)
-#  ifndef _IO_va_list
-#    define _IO_va_list char *
-#  endif
-#endif
-
 int
 NCursesWindow::scanw(const char* fmt, ...)
 {
     int result = ERR;
-    char buf[BUFSIZ];
 
-    if (::wgetnstr(w, buf, sizeof(buf)) != ERR) {
-       va_list args;
-       va_start(args, fmt);
-#if USE_STDIO_VSCAN
-       if (::vsscanf(buf, fmt, args) != -1)
-           result = OK;
-#elif USE_STRSTREAM_VSCAN      /* powerpc, os390 */
-       strstreambuf ss(buf, sizeof(buf));
-       if (ss.vscan(fmt, args) != -1)
-           result = OK;
-#elif USE_STRSTREAM_VSCAN_CAST /* pre-gcc 3.0 */
-       strstreambuf ss(buf, sizeof(buf));
-       if (ss.vscan(fmt, (_IO_va_list)args) != -1)
-           result = OK;
-#endif
-       va_end(args);
-    }
+    va_list args;
+    va_start(args, fmt);
+    result = ::vw_scanw (w, const_cast<NCURSES_CONST char *>(fmt), args);
+    va_end(args);
+
     return result;
 }
 
@@ -82,26 +73,12 @@ int
 NCursesWindow::scanw(int y, int x, const char* fmt, ...)
 {
     int result = ERR;
-    char buf[BUFSIZ];
 
     if (::wmove(w, y, x) != ERR) {
-       if (::wgetnstr(w, buf, sizeof(buf)) != ERR) {
-           va_list args;
-           va_start(args, fmt);
-#if USE_STDIO_VSCAN
-           if (::vsscanf(buf, fmt, args) != -1)
-               result = OK;
-#elif USE_STRSTREAM_VSCAN      /* powerpc, os390 */
-           strstreambuf ss(buf, sizeof(buf));
-           if (ss.vscan(fmt, args) != -1)
-               result = OK;
-#elif USE_STRSTREAM_VSCAN_CAST /* pre-gcc 3.0 */
-           strstreambuf ss(buf, sizeof(buf));
-           if (ss.vscan(fmt, (_IO_va_list)args) != -1)
-               result = OK;
-#endif
-           va_end(args);
-       }
+       va_list args;
+       va_start(args, fmt);
+       result = ::vw_scanw (w, const_cast<NCURSES_CONST char *>(fmt), args);
+       va_end(args);
     }
     return result;
 }
@@ -112,10 +89,9 @@ NCursesWindow::printw(const char * fmt, ...)
 {
     va_list args;
     va_start(args, fmt);
-    char buf[BUFSIZ];
-    ::vsprintf(buf, fmt, args);
+    int result = ::vw_printw(w, fmt, args);
     va_end(args);
-    return waddstr(w, buf);
+    return result;
 }
 
 
@@ -126,9 +102,7 @@ NCursesWindow::printw(int y, int x, const char * fmt, ...)
     va_start(args, fmt);
     int result = ::wmove(w, y, x);
     if (result == OK) {
-       char buf[BUFSIZ];
-       ::vsprintf(buf, fmt, args);
-       result = waddstr(w, buf);
+       result = ::vw_printw(w, fmt, args);
     }
     va_end(args);
     return result;
@@ -136,11 +110,10 @@ NCursesWindow::printw(int y, int x, const char * fmt, ...)
 
 
 void
-NCursesWindow::init(void)
+NCursesWindow::set_keyboard(void)
 {
-    leaveok(0);
-    keypad(1);
-    meta(1);
+    keypad(TRUE);
+    meta(TRUE);
 }
 
 void
@@ -152,73 +125,68 @@ NCursesWindow::err_handler(const char *msg) const THROWS(NCursesException)
 void
 NCursesWindow::initialize()
 {
-  if (!b_initialized) {
-    ::initscr();
-    b_initialized = TRUE;
-    if (colorInitialized==COLORS_NEED_INITIALIZATION) {
-      colorInitialized=COLORS_NOT_INITIALIZED;
-      useColors();
+    if (!b_initialized) {
+       ::initscr();
+       b_initialized = TRUE;
+       if (colorInitialized == COLORS_NEED_INITIALIZATION) {
+           colorInitialized = COLORS_NOT_INITIALIZED;
+           useColors();
+       }
+       ::noecho();
+       ::cbreak();
     }
-    ::noecho();
-    ::cbreak();
-  }
+}
+
+void
+NCursesWindow::constructing()
+{
+    initialize();
+    ++count;
 }
 
 NCursesWindow::NCursesWindow()
-  : w(0), alloced(0), par(0), subwins(0), sib(0)
+  : w(0), alloced(FALSE), par(0), subwins(0), sib(0)
 {
-  initialize();
+    constructing();
 
-  w = static_cast<WINDOW *>(0);
-  init();
-  alloced = FALSE;
-  subwins = par = sib = 0;
-  count++;
+    w = static_cast<WINDOW *>(0);
+    set_keyboard();
 }
 
 NCursesWindow::NCursesWindow(int nlines, int ncols, int begin_y, int begin_x)
-  : w(0), alloced(0), par(0), subwins(0), sib(0)
+  : w(0), alloced(TRUE), par(0), subwins(0), sib(0)
 {
-    initialize();
+    constructing();
 
     w = ::newwin(nlines, ncols, begin_y, begin_x);
     if (w == 0) {
        err_handler("Cannot construct window");
     }
-    init();
-
-    alloced = TRUE;
-    subwins = par = sib = 0;
-    count++;
+    set_keyboard();
 }
 
 NCursesWindow::NCursesWindow(WINDOW* &window)
-  : w(0), alloced(0), par(0), subwins(0), sib(0)
+  : w(0), alloced(FALSE), par(0), subwins(0), sib(0)
 {
-    initialize();
+    constructing();
 
     w = window;
-    init();
-    alloced = FALSE;
-    subwins = par = sib = 0;
-    count++;
+    set_keyboard();
 }
 
-NCursesWindow::NCursesWindow(NCursesWindow& win, int l, int c,
+NCursesWindow::NCursesWindow(NCursesWindow& win, int ny, int nx,
                             int begin_y, int begin_x, char absrel)
-  : w(0), alloced(0), par(0), subwins(0), sib(0)
+  : w(0), alloced(TRUE), par(0), subwins(0), sib(0)
 {
-    initialize();
-    if (absrel == 'a') { // absolute origin
+    constructing();
+    if (absrel == 'a') {       // absolute origin
        begin_y -= win.begy();
        begin_x -= win.begx();
     }
 
-    // Even though we treat subwindows as a tree, the standard curses
-    // library needs the `subwin' call to link to the parent in
-    // order to correctly perform refreshes, etc.
-    // Friendly enough, this also works for pads.
-    w = ::derwin(win.w, l, c, begin_y, begin_x);
+    // Link this window into its parent's list of subwindows.
+    // We use derwin(), since this also works for pads.
+    w = ::derwin(win.w, ny, nx, begin_y, begin_x);
     if (w == 0) {
        err_handler("Cannot construct subwindow");
     }
@@ -226,45 +194,40 @@ NCursesWindow::NCursesWindow(NCursesWindow& win, int l, int c,
     par = &win;
     sib = win.subwins;
     win.subwins = this;
-    subwins = 0;
-    alloced = TRUE;
-    count++;
 }
 
 NCursesWindow::NCursesWindow(NCursesWindow& win,
                                bool do_box NCURSES_PARAM_INIT(TRUE))
-  : w(0), alloced(0), par(0), subwins(0), sib(0)
+  : w(0), alloced(TRUE), par(0), subwins(0), sib(0)
 {
-  initialize();
-  int myHeight = win.height();
-  int myWidth  = win.width();
-  w = :: derwin(win.w, myHeight - 2, myWidth - 2, 1, 1);
-  if (w == 0) {
-    err_handler("Cannot construct subwindow");
-  }
-
-  par = &win;
-  sib = win.subwins;
-  win.subwins = this;
-  subwins = 0;
-  alloced = TRUE;
-  count++;
-
-  if (do_box) {
-    win.box();
-    win.touchwin();
-  }
+    constructing();
+    int myHeight = win.height();
+    int myWidth  = win.width();
+    w = :: derwin(win.w, myHeight - 2, myWidth - 2, 1, 1);
+    if (w == 0) {
+       err_handler("Cannot construct subwindow");
+    }
+
+    par = &win;
+    sib = win.subwins;
+    win.subwins = this;
+    subwins = 0;
+
+    if (do_box) {
+       win.box();
+       win.touchwin();
+    }
 }
 
 NCursesWindow NCursesWindow::Clone()
 {
-  WINDOW *d = ::dupwin(w);
-  NCursesWindow W(d);
-  W.subwins = subwins;
-  W.sib = sib;
-  W.par = par;
-  W.alloced = alloced;
-  return W;
+    WINDOW *d = ::dupwin(w);
+    NCursesWindow W(d);
+    W.subwins = subwins;
+    W.sib = sib;
+    W.par = par;
+    W.alloced = alloced;
+    return W;
 }
 
 typedef int (*RIPOFFINIT)(NCursesWindow&);
@@ -273,62 +236,64 @@ static int r_init_idx   = 0;
 static RIPOFFINIT* prip = R_INIT;
 
 NCursesWindow::NCursesWindow(WINDOW *win, int ncols)
-  : w(0), alloced(0), par(0), subwins(0), sib(0)
+  : w(0), alloced(FALSE), par(0), subwins(0), sib(0)
 {
-  initialize();
-  w = win;
-  assert((w->_maxx+1)==ncols);
-  alloced = FALSE;
-  subwins = par = sib = 0;
+    initialize();
+    w = win;
+    assert((w->_maxx +1 ) == ncols);
 }
 
 int _nc_xx_ripoff_init(WINDOW *w, int ncols)
 {
-  int res = ERR;
-
-  RIPOFFINIT init = *prip++;
-  if (init) {
-    NCursesWindow* W = new NCursesWindow(w,ncols);
-    res = init(*W);
-  }
-  return res;
+    int res = ERR;
+
+    RIPOFFINIT init = *prip++;
+    if (init) {
+       NCursesWindow* W = new NCursesWindow(w,ncols);
+       res = init(*W);
+    }
+    return res;
 }
 
 int NCursesWindow::ripoffline(int ripoff_lines,
                              int (*init)(NCursesWindow& win))
 {
-  int code = ::_nc_ripoffline(ripoff_lines,_nc_xx_ripoff_init);
-  if (code==OK && init && ripoff_lines) {
-    R_INIT[r_init_idx++] = init;
-  }
-  return code;
+    int code = ::_nc_ripoffline(ripoff_lines,_nc_xx_ripoff_init);
+    if (code == OK && init && ripoff_lines) {
+       R_INIT[r_init_idx++] = init;
+    }
+    return code;
 }
 
 bool
 NCursesWindow::isDescendant(NCursesWindow& win)
 {
-  for (NCursesWindow* p = subwins; p != NULL; p = p->sib) {
-    if (p==&win)
-      return TRUE;
-    else {
-      if (p->isDescendant(win))
-       return TRUE;
+    bool result = FALSE;
+
+    for (NCursesWindow* p = subwins; p != NULL; p = p->sib) {
+       if (p == &win || p->isDescendant(win)) {
+           result = TRUE;
+           break;
+       }
     }
-  }
-  return FALSE;
+    return result;
 }
 
 void
 NCursesWindow::kill_subwindows()
 {
-    for (NCursesWindow* p = subwins; p != 0; p = p->sib) {
+    NCursesWindow* p = subwins;
+
+    subwins = 0;
+    while (p != 0) {
+       NCursesWindow* q = p->sib;
        p->kill_subwindows();
        if (p->alloced) {
            if (p->w != 0)
                ::delwin(p->w);
-           p->alloced = FALSE;
        }
-       p->w = 0; // cause a run-time error if anyone attempts to use...
+       delete p;
+       p = q;
     }
 }
 
@@ -337,22 +302,21 @@ NCursesWindow::~NCursesWindow()
 {
     kill_subwindows();
 
-    if (par != 0) {  // Snip us from the parent's list of subwindows.
-       NCursesWindow * win = par->subwins;
-       NCursesWindow * trail = 0;
-       for (;;) {
-           if (win == 0)
-               break;
-           else if (win == this) {
-               if (trail != 0)
-                   trail->sib = win->sib;
-               else
-                   par->subwins = win->sib;
+    if (par != 0) {
+       // Remove this window from the parent's list of subwindows.
+       NCursesWindow * next = par->subwins;
+       NCursesWindow * prev = 0;
+       while (next != 0) {
+           if (next == this) {
+               if (prev != 0) {
+                   prev->sib = next->sib;
+               } else {
+                   par->subwins = next->sib;
+               }
                break;
-           } else {
-               trail = win;
-               win = win->sib;
            }
+           prev = next;
+           next = next->sib;
        }
     }
 
@@ -360,13 +324,12 @@ NCursesWindow::~NCursesWindow()
        ::delwin(w);
 
     if (alloced) {
-      --count;
-      if (count == 0) {
-       ::endwin();
-      }
-      else if (count < 0) { // cannot happen!
-       err_handler("Too many windows destroyed");
-      }
+       --count;
+       if (count == 0) {
+           ::endwin();
+       } else if (count < 0) { // cannot happen!
+           err_handler("Too many windows destroyed");
+       }
     }
 }
 
@@ -379,16 +342,16 @@ void
 NCursesWindow::useColors(void)
 {
     if (colorInitialized == COLORS_NOT_INITIALIZED) {
-      if (b_initialized) {
-       if (::has_colors()) {
-         ::start_color();
-         colorInitialized = COLORS_ARE_REALLY_THERE;
+       if (b_initialized) {
+           if (::has_colors()) {
+               ::start_color();
+               colorInitialized = COLORS_ARE_REALLY_THERE;
+           } else {
+               colorInitialized = COLORS_MONOCHROME;
+           }
+       } else {
+           colorInitialized = COLORS_NEED_INITIALIZATION;
        }
-       else
-         colorInitialized = COLORS_MONOCHROME;
-      }
-      else
-       colorInitialized = COLORS_NEED_INITIALIZATION;
     }
 }
 
@@ -397,71 +360,58 @@ NCursesWindow::getcolor(int getback) const
 {
     short fore, back;
 
-    if (colorInitialized==COLORS_ARE_REALLY_THERE) {
-      if (::pair_content(static_cast<short>(PAIR_NUMBER(w->_attrs)), &fore, &back))
-       err_handler("Can't get color pair");
-    }
-    else {
-      // Monochrome means white on black
-      back = COLOR_BLACK;
-      fore = COLOR_WHITE;
+    if (HaveColors()) {
+       if (::pair_content(static_cast<short>(PAIR_NUMBER(w->_attrs)), &fore, &back) == ERR)
+           err_handler("Can't get color pair");
+    } else {
+       // Monochrome means white on black
+       back = COLOR_BLACK;
+       fore = COLOR_WHITE;
     }
     return getback ? back : fore;
 }
 
 int NCursesWindow::NumberOfColors()
 {
-  if (colorInitialized==COLORS_ARE_REALLY_THERE)
-    return COLORS;
-  else
-    return 1; // monochrome (actually there are two ;-)
+    return (HaveColors()) ? COLORS : 1;
 }
 
 short
 NCursesWindow::getcolor() const
 {
-  if (colorInitialized==COLORS_ARE_REALLY_THERE)
-    return PAIR_NUMBER(w->_attrs);
-  else
-    return 0; // we only have pair zero
+    return (HaveColors()) ? PAIR_NUMBER(w->_attrs) : 0;
 }
 
 int
 NCursesWindow::setpalette(short fore, short back, short pair)
 {
-  if (colorInitialized==COLORS_ARE_REALLY_THERE)
-    return ::init_pair(pair, fore, back);
-  else
-    return OK;
+    return (HaveColors()) ? ::init_pair(pair, fore, back) : OK;
 }
 
 int
 NCursesWindow::setpalette(short fore, short back)
 {
-  if (colorInitialized==COLORS_ARE_REALLY_THERE)
     return setpalette(fore, back, static_cast<short>(PAIR_NUMBER(w->_attrs)));
-  else
-    return OK;
 }
 
 
 int
 NCursesWindow::setcolor(short pair)
 {
-  if (colorInitialized==COLORS_ARE_REALLY_THERE) {
-    if ((pair < 1) || (pair > COLOR_PAIRS))
-      err_handler("Can't set color pair");
-
-    attroff(A_COLOR);
-    attrset(COLOR_PAIR(pair));
-  }
-  return OK;
+    if (HaveColors()) {
+       if ((pair < 1) || (pair > COLOR_PAIRS))
+           err_handler("Can't set color pair");
+
+       attroff(A_COLOR);
+       attrset(COLOR_PAIR(pair));
+    }
+    return OK;
 }
 
 #if HAVE_HAS_KEY
 bool NCursesWindow::has_mouse() const
 {
-  return ((::has_key(KEY_MOUSE) || ::_nc_has_mouse())
-         ? TRUE : FALSE);
+    return ((::has_key(KEY_MOUSE) || ::_nc_has_mouse())
+            ? TRUE : FALSE);
 }
 #endif
index 13f87a6800d455791764fbcea0ea5d76357ca176..e391fa22eca19941a29455adf99c00addbb7ed5a 100644 (file)
@@ -1,6 +1,6 @@
 // * This makes emacs happy -*-Mode: C++;-*-
 /****************************************************************************
- * Copyright (c) 1998-2004,2005 Free Software Foundation, Inc.              *
+ * Copyright (c) 1998-2005,2007 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            *
 #ifndef NCURSES_CURSESW_H_incl
 #define NCURSES_CURSESW_H_incl 1
 
-// $Id: cursesw.h,v 1.38 2005/07/23 20:51:39 tom Exp $
+// $Id: cursesw.h,v 1.41 2007/01/27 22:29:36 tom Exp $
 
 #include <stdarg.h>
 #include <stdio.h>
 
 #include <etip.h>
 
-#if HAVE_STRSTREAM_H && (USE_STRSTREAM_VSCAN||USE_STRSTREAM_VSCAN_CAST)
-#include <strstream.h>
-#endif
-
 extern "C" {
 #  include   <curses.h>
 }
@@ -705,9 +701,10 @@ class NCURSES_IMPEXP NCursesWindow
 private:
   static bool    b_initialized;
   static void    initialize();
+  void           constructing();
   friend int     _nc_xx_ripoff_init(WINDOW *, int);
 
-  void           init();
+  void           set_keyboard();
 
   short          getcolor(int getback) const;
 
index 63bac25d90855cf7402891b943ddc583b203bf10..1a436b5e2197354053d7385b8751d475013f4593 100644 (file)
@@ -1,6 +1,6 @@
 // * This makes emacs happy -*-Mode: C++;-*-
 /****************************************************************************
- * Copyright (c) 1998-2005,2006 Free Software Foundation, Inc.              *
+ * Copyright (c) 1998-2006,2007 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            *
@@ -35,7 +35,7 @@
  *   Demo code for NCursesMenu and NCursesForm written by
  *   Juergen Pfeifer
  *
- * $Id: demo.cc,v 1.34 2006/04/22 22:38:57 tom Exp $
+ * $Id: demo.cc,v 1.35 2007/01/27 20:28:51 tom Exp $
  */
 
 #include "internal.h"
@@ -557,4 +557,4 @@ int TestApplication::run()
 //
 // -------------------------------------------------------------------------
 //
-static TestApplication Demo;
+static TestApplication *Demo = new TestApplication();
index b56321f130cd362d00e9257a1a580f3e7b2a3b2a..f478d6ec79ba18e734ee1f446b095cbab96aabc9 100755 (executable)
@@ -1,7 +1,7 @@
 #!/bin/sh
-# $Id: edit_cfg.sh,v 1.14 2005/04/30 21:00:22 tom Exp $
+# $Id: edit_cfg.sh,v 1.15 2007/01/27 18:51:04 tom Exp $
 ##############################################################################
-# Copyright (c) 1998-2003,2005 Free Software Foundation, Inc.                #
+# Copyright (c) 1998-2005,2007 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 "Software"), #
@@ -28,7 +28,7 @@
 # authorization.                                                             #
 ##############################################################################
 #
-# Author: Thomas E. Dickey 1997
+# Author: Thomas E. Dickey 1997-on
 #
 # Edit the default value of the etip.h file based on the autoconf-generated
 # values:
@@ -45,11 +45,8 @@ for name in \
        HAVE_BUILTIN_H \
        HAVE_GPP_BUILTIN_H \
        HAVE_GXX_BUILTIN_H \
-       HAVE_STRSTREAM_H \
        HAVE_TYPEINFO \
-       HAVE_VALUES_H \
-       USE_STRSTREAM_VSCAN \
-       USE_STRSTREAM_VSCAN_CAST
+       HAVE_VALUES_H
 do
        rm -f $2.bak
        mv $2 $2.bak
index 482f8eb4b8519bfe09e890768aa06060ec265bd9..8576d2e1910120de8bf25034683d8f67c0abe22b 100644 (file)
@@ -1,6 +1,6 @@
 // * This makes emacs happy -*-Mode: C++;-*-
 /****************************************************************************
- * Copyright (c) 1998-2003,2005 Free Software Foundation, Inc.              *
+ * Copyright (c) 1998-2005,2007 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            *
@@ -31,7 +31,7 @@
  *   Author: Juergen Pfeifer, 1997                                          *
  ****************************************************************************/
 
-// $Id: etip.h.in,v 1.32 2005/08/06 19:55:57 tom Exp $
+// $Id: etip.h.in,v 1.34 2007/01/27 18:49:00 tom Exp $
 
 #ifndef NCURSES_ETIP_H_incl
 #define NCURSES_ETIP_H_incl 1
 #define HAVE_GPP_BUILTIN_H 0
 #endif
 
-#ifndef HAVE_STRSTREAM_H
-#define HAVE_STRSTREAM_H 0
-#endif
-
 #ifndef HAVE_TYPEINFO
 #define HAVE_TYPEINFO 0
 #endif
 #define CPP_HAS_STATIC_CAST 0  // workaround for g++ 2.95.3
 #endif
 
-#ifndef USE_STRSTREAM_VSCAN
-#define USE_STRSTREAM_VSCAN 0
-#endif
-
-#ifndef USE_STRSTREAM_VSCAN_CAST
-#define USE_STRSTREAM_VSCAN_CAST 0
-#endif
-
 #ifdef __GNUG__
 #  if ((__GNUG__ <= 2) && (__GNUC_MINOR__ < 8))
 #    if HAVE_TYPEINFO
index 496f814ec487bbe521fe9ee93f031f91818029fe..f4a8aef953d416fd9c52a9759877db46244a1f36 100755 (executable)
--- a/configure
+++ b/configure
@@ -4137,7 +4137,7 @@ echo $ECHO_N "checking version of libtool... $ECHO_C" >&6
        # Save the version in a cache variable - this is not entirely a good
        # thing, but the version string from libtool is very ugly, and for
        # bug reports it might be useful to have the original string.
-       cf_cv_libtool_version=`$LIBTOOL --version 2>&1 | sed -e '/^$/d' -e '2,$d' -e 's/([^)]*)//g' -e 's/^[^1-9]*//' -e 's/[^0-9.].*//'`
+       cf_cv_libtool_version=`$LIBTOOL --version 2>&1 | sed -e '/^$/d' |sed -e '2,$d' -e 's/([^)]*)//g' -e 's/^[^1-9]*//' -e 's/[^0-9.].*//'`
        echo "$as_me:4141: result: $cf_cv_libtool_version" >&5
 echo "${ECHO_T}$cf_cv_libtool_version" >&6
        if test -z "$cf_cv_libtool_version" ; then
diff --git a/dist.mk b/dist.mk
index 064dc1f93ae92502eec913b66a7af3d1b4d8cf19..e5b5bc767814ff9a88d588e8485fce21c9ed6613 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.573 2007/01/20 19:55:40 tom Exp $
+# $Id: dist.mk,v 1.574 2007/01/27 15:54:59 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 = 6
-NCURSES_PATCH = 20070120
+NCURSES_PATCH = 20070127
 
 # We don't append the patch to the version, since this only applies to releases
 VERSION = $(NCURSES_MAJOR).$(NCURSES_MINOR)
index 33e15c55c179e569a6580446baef555aad4185f4..111fecd0689d0d5e0f168407251413d864a08f16 100644 (file)
@@ -1,5 +1,5 @@
 /****************************************************************************
- * Copyright (c) 1998-2005,2006 Free Software Foundation, Inc.              *
+ * Copyright (c) 1998-2006,2007 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            *
 
 #include <term_entry.h>
 
-MODULE_ID("$Id: lib_termcap.c,v 1.58 2006/09/02 19:39:46 Miroslav.Lichvar Exp $")
+MODULE_ID("$Id: lib_termcap.c,v 1.59 2007/01/28 00:33:11 tom Exp $")
 
 NCURSES_EXPORT_VAR(char *) UP = 0;
 NCURSES_EXPORT_VAR(char *) BC = 0;
 
 typedef struct {
     long sequence;
+    bool last_used;
     char *fix_sgr0;            /* this holds the filtered sgr0 string */
     char *last_bufp;           /* help with fix_sgr0 leak */
     TERMINAL *last_term;
@@ -64,6 +65,7 @@ static int in_cache = 0;
 #define FIX_SGR0 cache[in_cache].fix_sgr0
 #define LAST_TRM cache[in_cache].last_term
 #define LAST_BUF cache[in_cache].last_bufp
+#define LAST_USE cache[in_cache].last_used
 #define LAST_SEQ cache[in_cache].sequence
 
 /***************************************************************************
@@ -100,9 +102,15 @@ tgetent(char *bufp, const char *name)
      * caller, but if tgetent() is called with the same buffer, that is
      * good enough, since the previous data would be invalidated by the
      * current call.
+     *
+     * bufp may be a null pointer, e.g., GNU termcap.  That allocates data,
+     * which is good until the next tgetent() call.  The conventional termcap
+     * is inconvenient because of the fixed buffer size, but because it uses
+     * caller-supplied buffers, can have multiple terminal descriptions in
+     * use at a given time.
      */
     for (n = 0; n < MAX_CACHE; ++n) {
-       bool same_result = (bufp != 0 && cache[n].last_bufp == bufp);
+       bool same_result = (cache[n].last_used && cache[n].last_bufp == bufp);
        if (same_result) {
            in_cache = n;
            if (FIX_SGR0 != 0) {
@@ -164,6 +172,7 @@ tgetent(char *bufp, const char *name)
            }
        }
        LAST_BUF = bufp;
+       LAST_USE = TRUE;
 
        (void) baudrate();      /* sets ospeed as a side-effect */
 
index 56497fb54264e5d3a2922fc8755450da2464a652..9d26753bd76567472a318b4f06bbfbe9dedfa566 100644 (file)
@@ -1,6 +1,7 @@
 
 Current history:
 
+2007/01/27     1.03    Update README to tell how to build tack after removal.
 2006/11/25             Fixes for ncurses tparm() prototype.
 2006/06/24     1.02    Modify to support ncurses extended string capabilities.
 2003/10/18     1.01    Fix some logic in pad.c, improve bce test.
index 71147042d922bfc9ac0d31bccd12983114e9e756..c19bcc8ed77dd9d75dcc5f06cbc466f06edba91b 100644 (file)
@@ -1,14 +1,20 @@
--- $Id: README,v 1.2 2000/03/12 02:39:12 Daniel.Weaver Exp $
+-- $Id: README,v 1.3 2007/01/27 23:14:19 tom Exp $
 
 The 'tack' program is a diagnostic that is designed to create and
 verify the correctness of terminfo's.  This program can be used to
 create new terminal descriptions that are not included in the standard
-release.  Although 'tack' is distributed with ncurses, it is not an
+release.  Although 'tack' has been distributed with ncurses, it is not an
 integral part of ncurses.  It may be removed from the release without
 limiting the usefulness of ncurses on those terminals described in the
 terminfo data base.  The best way to remove 'tack' from the build is
 to delete or rename the 'tack' directory before running the configure
 script.
 
-Unlike most of ncurses the 'tack' program is covered under the GNU
+Starting with ncurses 5.6 patch 20070113, this program can be built
+outside the ncurses source-tree, provided that ncurses is configured
+using the "--with-ticlib" option.  That makes available the private
+interfaces used by tack, and eliminates the need to distribute tack
+as an optional part of ncurses.
+
+Unlike the rest of ncurses, the 'tack' program is covered under the GNU
 Public License.
index 22a0ac159834bde1218665925048168f56a40c81..cdd5ca25b974066ddf12e4739c8b350c71ccabf1 100644 (file)
@@ -1,6 +1,6 @@
-# $Id: Makefile.in,v 1.94 2007/01/13 22:31:09 tom Exp $
+# $Id: Makefile.in,v 1.95 2007/01/27 22:56:17 tom Exp $
 ##############################################################################
-# Copyright (c) 1998-2005,2006 Free Software Foundation, Inc.                #
+# Copyright (c) 1998-2006,2007 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 "Software"), #
@@ -96,8 +96,7 @@ LIBS_CURSES   = `echo "@TEST_ARGS@ @LIBS@" | sed -e 's/-lform.*-lpanel[^ ]*//'` $(
 LDFLAGS_CURSES = $(LDFLAGS_@DFT_UPR_MODEL@) $(LIBS_CURSES)
 
 # use these for linking with the tinfo library if we have it, or curses library if not
-# FIXME: TICS_LEAKS fixes linkage for --disable-leaks
-LIBS_TINFO     = @TICS_LEAKS@ @TINFO_ARGS@ @LIBS@ $(MATH_LIB)
+LIBS_TINFO     = @TINFO_ARGS@ @LIBS@ $(MATH_LIB)
 LDFLAGS_TINFO  = $(LDFLAGS_@DFT_UPR_MODEL@) $(LIBS_TINFO)
 
 LINT           = @LINT@
index 433448804eb411e3c4ca7dffffb8529d6942d91d..b98d890b285b540aa71dad432c4413d658eee7e4 100644 (file)
@@ -1,5 +1,5 @@
 dnl***************************************************************************
-dnl Copyright (c) 1998-2004,2005 Free Software Foundation, Inc.              *
+dnl Copyright (c) 1998-2006,2007 Free Software Foundation, Inc.              *
 dnl                                                                          *
 dnl Permission is hereby granted, free of charge, to any person obtaining a  *
 dnl copy of this software and associated documentation files (the            *
@@ -28,7 +28,7 @@ dnl***************************************************************************
 dnl
 dnl Author: Thomas E. Dickey 1996, etc.
 dnl
-dnl $Id: configure.in,v 1.60 2007/01/13 22:59:00 tom Exp $
+dnl $Id: configure.in,v 1.61 2007/01/27 22:56:49 tom Exp $
 dnl This is a simple configuration-script for the ncurses test programs that
 dnl allows the test-directory to be separately configured against a reference
 dnl system (i.e., sysvr4 curses)
@@ -74,7 +74,6 @@ LOCAL_LDFLAGS=""                      AC_SUBST(LOCAL_LDFLAGS)
 MATH_LIB="-lm"                         AC_SUBST(MATH_LIB)
 TEST_ARGS=""                           AC_SUBST(TEST_ARGS)
 TEST_DEPS=""                           AC_SUBST(TEST_DEPS)
-TICS_LEAKS=""                          AC_SUBST(TICS_LEAKS)
 TINFO_ARGS='$(LIBS_CURSES)'            AC_SUBST(TINFO_ARGS)
 cf_cv_abi_version=""                   AC_SUBST(cf_cv_abi_version)
 cf_cv_rel_version=""                   AC_SUBST(cf_cv_rel_version)