From: Thomas E. Dickey Date: Sun, 8 Apr 2007 01:10:28 +0000 (+0000) Subject: ncurses 5.6 - patch 20070407 X-Git-Tag: v5.7~73 X-Git-Url: http://ncurses.scripts.mit.edu/?p=ncurses.git;a=commitdiff_plain;h=2639531af0c3ca25b48e7bcb9c790fa566cc5892;hp=5a9c046f10f72b47ad32801a8e54fe3d05aa8051 ncurses 5.6 - patch 20070407 --- diff --git a/Ada95/gen/Makefile.in b/Ada95/gen/Makefile.in index 8ffdbac1..82c7284a 100644 --- a/Ada95/gen/Makefile.in +++ b/Ada95/gen/Makefile.in @@ -28,7 +28,7 @@ # # Author: Juergen Pfeifer, 1996 # -# $Id: Makefile.in,v 1.54 2007/03/31 21:53:14 tom Exp $ +# $Id: Makefile.in,v 1.56 2007/04/07 21:45:46 tom Exp $ # .SUFFIXES: @@ -42,10 +42,13 @@ DESTDIR = @DESTDIR@ srcdir = @srcdir@ prefix = @prefix@ exec_prefix = @exec_prefix@ +bindir = @bindir@ + ADA_INCLUDE = $(DESTDIR)@ADA_INCLUDE@ ADA_OBJECTS = $(DESTDIR)@ADA_OBJECTS@ INSTALL = @INSTALL@ +INSTALL_PROG = @INSTALL_PROGRAM@ INSTALL_DATA = @INSTALL_DATA@ AWK = @AWK@ @@ -78,6 +81,8 @@ RANLIB = @RANLIB@ M4 = m4 M4FLAGS = +ADACURSES_CONFIG = adacurses-config + GENERATE = ./gen$x '@DFT_ARG_SUFFIX@' DEL_ADAMODE = sed -e '/^\-\-\ \ \-\*\-\ ada\ \-\*\-.*/d' @@ -162,7 +167,7 @@ sources: $(ADA_INCLUDE) \ $(ADA_OBJECTS) : - $(top_srcdir)/mkinstalldirs $@ + sh $(top_srcdir)/mkdirs.sh $@ install \ install.libs :: $(ADA_INCLUDE) @@ -180,6 +185,10 @@ install.libs :: $(ADA_OBJECTS) @$(top_srcdir)/tar-copy.sh '$(ALIB)[-.]*.ali' $(ADA_SRCDIR) $(ADA_OBJECTS) @-chmod u+x $(ADA_SRCDIR)/*.ali +install \ +install.libs :: $(DESTDIR)$(bindir) adacurses-config + $(INSTALL_PROG) adacurses-config $(DESTDIR)$(bindir)/$(ADACURSES_CONFIG) + uninstall \ uninstall.libs :: @echo removing package $(ALIB) from $(ADA_INCLUDE) @@ -190,6 +199,10 @@ uninstall.libs :: @echo removing package $(ALIB) from $(ADA_OBJECTS) -@cd $(ADA_OBJECTS) && rm -f $(ALIB)[-.]* +uninstall \ +uninstall.libs :: + -rm -f $(DESTDIR)$(bindir)/$(ADACURSES_CONFIG) + gen$x: gen.o @ECHO_LINK@ $(LINK) $(CFLAGS_NORMAL) gen.o $(LD_FLAGS) -o $@ @@ -369,8 +382,8 @@ install.progs :: tags: ctags *.[ch] -TAGS: - etags *.[ch] +@MAKE_UPPER_TAGS@TAGS: +@MAKE_UPPER_TAGS@ etags *.[ch] mostlyclean :: -rm -f a.out core gen$x *.o @@ -384,7 +397,8 @@ clean :: mostlyclean -rm -f $(GEN_TARGETS) instab.tmp *.ad[bs] *.html *.ali *.tmp distclean :: clean - rm -f Makefile + -rm -f adacurses-config + -rm -f Makefile realclean :: distclean diff --git a/Ada95/gen/adacurses-config.in b/Ada95/gen/adacurses-config.in new file mode 100644 index 00000000..c88d85be --- /dev/null +++ b/Ada95/gen/adacurses-config.in @@ -0,0 +1,35 @@ +#! /bin/sh +# $Id: adacurses-config.in,v 1.2 2007/04/07 21:06:50 tom Exp $ +# +# This script will return the option to add to `gnatmake' for using +# AdaCurses. +# + +prefix="@prefix@" +exec_prefix="@exec_prefix@" +libdir="@libdir@" + +VERSION="@NCURSES_MAJOR@.@NCURSES_MINOR@.@NCURSES_PATCH@" + +CFLAGS="-I$libdir/adacurses -L$libdir/adacurses" +LIBS="-L$prefix/lib -lAdaCurses" + +case "x$1" in + x--version) + echo AdaCurses $VERSION + ;; + x--cflags) + echo $CFLAGS + ;; + x--libs) + echo $LIBS + ;; + x) + # if no parameter is given, give what gnatmake needs + echo $CFLAGS -largs $LIBS + ;; + *) + echo 'Usage: adacurses-config [--version | --cflags | --libs]' >&2 + exit 1 + ;; +esac diff --git a/Ada95/gen/gen.c b/Ada95/gen/gen.c index 97aea3a3..86cfd0e1 100644 --- a/Ada95/gen/gen.c +++ b/Ada95/gen/gen.c @@ -32,7 +32,7 @@ /* Version Control - $Id: gen.c,v 1.46 2007/03/31 23:39:15 tom Exp $ + $Id: gen.c,v 1.47 2007/04/07 22:29:23 tom Exp $ --------------------------------------------------------------------------*/ /* This program generates various record structures and constants from the @@ -776,7 +776,8 @@ gen_acs(void) printf(" type C_ACS_Map is array (Character'Val (0) .. Character'Val (127))\n"); printf(" of Attributed_Character;\n"); #if USE_REENTRANT - printf(" function ACS_Map return C_ACS_Map;\n"); + printf(" type C_ACS_Ptr is access C_ACS_Map;\n"); + printf(" function ACS_Map return C_ACS_Ptr;\n"); printf(" pragma Import (C, ACS_Map, \"_nc_acs_map\");\n"); #else printf(" ACS_Map : C_ACS_Map;\n"); diff --git a/MANIFEST b/MANIFEST index 35b23375..8743c63f 100644 --- a/MANIFEST +++ b/MANIFEST @@ -4,6 +4,7 @@ ./Ada95/README ./Ada95/TODO ./Ada95/gen/Makefile.in +./Ada95/gen/adacurses-config.in ./Ada95/gen/gen.c ./Ada95/gen/html.m4 ./Ada95/gen/normal.m4 @@ -553,8 +554,10 @@ ./man/curs_instr.3x ./man/curs_inwstr.3x ./man/curs_kernel.3x +./man/curs_legacy.3x ./man/curs_mouse.3x ./man/curs_move.3x +./man/curs_opaque.3x ./man/curs_outopts.3x ./man/curs_overlay.3x ./man/curs_pad.3x diff --git a/NEWS b/NEWS index ae34c501..0085579a 100644 --- a/NEWS +++ b/NEWS @@ -25,7 +25,7 @@ -- sale, use or other dealings in this Software without prior written -- -- authorization. -- ------------------------------------------------------------------------------- --- $Id: NEWS,v 1.1109 2007/04/01 00:30:22 tom Exp $ +-- $Id: NEWS,v 1.1115 2007/04/07 23:08:57 tom Exp $ ------------------------------------------------------------------------------- This is a log of changes that ncurses has gone through since Zeyd started @@ -45,6 +45,44 @@ 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. +20060407 + + add man/curs_legacy.3x, man/curs_opaque.3x + + fix acs_map binding for Ada95 when --enable-reentrant is used. + + add adacurses-config to the Ada95 install, based on version from + FreeBSD port, in turn by Juergen Pfeifer in 2000 (prompted by + comment on comp.lang.ada newsgroup). + + fix includes in c++ binding to build with Intel compiler + (cf: 20061209). + + update install rule in Ada95 to use mkdirs.sh + > other fixes prompted by inspection for Coverity report: + + modify ifdef's for c++ binding to use try/catch/throw statements + + add a null-pointer check in tack/ansi.c request_cfss() + + fix a memory leak in ncurses/base/wresize.c + + corrected check for valid memu/meml capabilities in + progs/dump_entry.c when handling V_HPUX case. + > fixes based on Coverity report: + + remove dead code in test/bs.c + + remove dead code in test/demo_defkey.c + + remove an unused assignment in progs/infocmp.c + + fix a limit check in tack/ansi.c tools_charset() + + fix tack/ansi.c tools_status() to perform the VT320/VT420 + tests in request_cfss(). The function had exited too soon. + + fix a memory leak in tic.c's make_namelist() + + fix a couple of places in tack/output.c which did not check for EOF. + + fix a loop-condition in test/bs.c + + add index checks in lib_color.c for color palettes + + add index checks in progs/dump_entry.c for version_filter() handling + of V_BSD case. + + fix a possible null-pointer dereference in copywin() + + fix a possible null-pointer dereference in waddchnstr() + + add a null-pointer check in _nc_expand_try() + + add a null-pointer check in tic.c's make_namelist() + + add a null-pointer check in _nc_expand_try() + + add null-pointer checks in test/cardfile.c + + fix a double-free in ncurses/tinfo/trim_sgr0.c + + fix a double-free in ncurses/base/wresize.c + + add try/catch block to c++/cursesmain.cc + 20070331 + modify Ada95 binding to build with --enable-reentrant by wrapping global variables (bug: acs_map does not yet work). diff --git a/c++/cursesmain.cc b/c++/cursesmain.cc index 7382600b..1f82d4ad 100644 --- a/c++/cursesmain.cc +++ b/c++/cursesmain.cc @@ -34,7 +34,14 @@ #include "internal.h" #include "cursesapp.h" -MODULE_ID("$Id: cursesmain.cc,v 1.13 2007/01/27 20:29:27 tom Exp $") +#if CPP_HAS_TRY_CATCH && HAVE_IOSTREAM +#include +#else +#undef CPP_HAS_TRY_CATCH +#define CPP_HAS_TRY_CATCH 0 +#endif + +MODULE_ID("$Id: cursesmain.cc,v 1.14 2007/04/07 17:10:11 tom Exp $") #if HAVE_LOCALE_H #include @@ -62,8 +69,20 @@ int main(int argc, char* argv[]) A->handleArgs(argc,argv); ::endwin(); +#if CPP_HAS_TRY_CATCH + try { + res = (*A)(); + ::endwin(); + } + catch(const NCursesException &e) { + ::endwin(); + std::cerr << e.message << std::endl; + res = e.errorno; + } +#else res = (*A)(); ::endwin(); +#endif #if NO_LEAKS delete A; _nc_free_and_exit(res); diff --git a/c++/cursesp.h b/c++/cursesp.h index adb54455..3d8828cb 100644 --- a/c++/cursesp.h +++ b/c++/cursesp.h @@ -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 * @@ -34,7 +34,7 @@ #ifndef NCURSES_CURSESP_H_incl #define NCURSES_CURSESP_H_incl 1 -// $Id: cursesp.h,v 1.26 2005/08/13 18:09:21 tom Exp $ +// $Id: cursesp.h,v 1.27 2007/04/07 17:12:54 tom Exp $ #include @@ -83,7 +83,7 @@ protected: return uptr->m_user; } - void OnError (int err) const THROWS((NCursesPanelException)) + void OnError (int err) const THROWS(NCursesPanelException) { if (err==ERR) THROW(new NCursesPanelException (this, err)); diff --git a/c++/cursespad.cc b/c++/cursespad.cc index d875a815..3685c5e5 100644 --- a/c++/cursespad.cc +++ b/c++/cursespad.cc @@ -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 * @@ -33,12 +33,10 @@ #include "internal.h" -#include +#include +#include -#include "etip.h" -#include "cursesw.h" - -MODULE_ID("$Id: cursespad.cc,v 1.11 2005/07/23 20:51:23 tom Exp $") +MODULE_ID("$Id: cursespad.cc,v 1.12 2007/04/07 18:43:54 tom Exp $") NCursesPad::NCursesPad(int nlines, int ncols) : NCursesWindow(), diff --git a/c++/cursesw.h b/c++/cursesw.h index c275e6b6..7e24c835 100644 --- a/c++/cursesw.h +++ b/c++/cursesw.h @@ -30,10 +30,7 @@ #ifndef NCURSES_CURSESW_H_incl #define NCURSES_CURSESW_H_incl 1 -// $Id: cursesw.h,v 1.43 2007/03/24 18:33:50 tom Exp $ - -#include -#include +// $Id: cursesw.h,v 1.44 2007/04/07 18:42:04 tom Exp $ #include diff --git a/c++/demo.cc b/c++/demo.cc index 1a436b5e..8fa19ad2 100644 --- a/c++/demo.cc +++ b/c++/demo.cc @@ -35,7 +35,7 @@ * Demo code for NCursesMenu and NCursesForm written by * Juergen Pfeifer * - * $Id: demo.cc,v 1.35 2007/01/27 20:28:51 tom Exp $ + * $Id: demo.cc,v 1.36 2007/04/07 20:24:49 tom Exp $ */ #include "internal.h" @@ -55,30 +55,30 @@ class SillyDemo public: void run(int sleeptime) { - NCursesPanel *std = new NCursesPanel(); + NCursesPanel *mystd = new NCursesPanel(); // Make a few small demo panels - NCursesPanel *u = new NCursesPanel(8,20,12,4); - NCursesPanel *v = new NCursesPanel(8,20,10,6); - NCursesPanel *w = new NCursesPanel(8,20,8,8); - NCursesPanel *x = new NCursesPanel(8,20,6,10); - NCursesPanel *y = new NCursesPanel(8,20,4,12); - NCursesPanel *z = new NCursesPanel(8,30,2,14); + NCursesPanel *u = new NCursesPanel(8, 20, 12, 4); + NCursesPanel *v = new NCursesPanel(8, 20, 10, 6); + NCursesPanel *w = new NCursesPanel(8, 20, 8, 8); + NCursesPanel *x = new NCursesPanel(8, 20, 6, 10); + NCursesPanel *y = new NCursesPanel(8, 20, 4, 12); + NCursesPanel *z = new NCursesPanel(8, 30, 2, 14); // Draw something on the main screen, so we can see what happens // when panels get moved or deleted. - std->box(); - std->move(std->height()/2,1); - std->hline(std->width()-2); - std->move(1,std->width()/2); - std->vline(std->height()-2); - std->addch(0,std->width()/2,ACS_TTEE); - std->addch(std->height()-1,std->width()/2,ACS_BTEE); - std->addch(std->height()/2,0,ACS_LTEE); - std->addch(std->height()/2,std->width()-1,ACS_RTEE); - std->addch(std->height()/2,std->width()/2,ACS_PLUS); + mystd->box(); + mystd->move(mystd->height()/2, 1); + mystd->hline(mystd->width()-2); + mystd->move(1, mystd->width()/2); + mystd->vline(mystd->height()-2); + mystd->addch(0, mystd->width()/2, ACS_TTEE); + mystd->addch(mystd->height()-1, mystd->width()/2, ACS_BTEE); + mystd->addch(mystd->height()/2, 0, ACS_LTEE); + mystd->addch(mystd->height()/2, mystd->width()-1, ACS_RTEE); + mystd->addch(mystd->height()/2, mystd->width()/2, ACS_PLUS); // Draw frames with titles around panels so that we can see where // the panels are located. @@ -98,56 +98,56 @@ class SillyDemo } // A refresh to any valid panel updates all panels and refreshes - // the screen. Using std is just convenient - We know it's always + // the screen. Using mystd is just convenient - We know it's always // valid until the end of the program. - std->refresh(); + mystd->refresh(); sleep(sleeptime); // Show what happens when panels are deleted and moved. sleep(sleeptime); delete u; - std->refresh(); + mystd->refresh(); sleep(sleeptime); delete z; - std->refresh(); + mystd->refresh(); sleep(sleeptime); delete v; - std->refresh(); + mystd->refresh(); // show how it looks when a panel moves sleep(sleeptime); - y->mvwin(5,30); - std->refresh(); + y->mvwin(5, 30); + mystd->refresh(); sleep(sleeptime); delete y; - std->refresh(); + mystd->refresh(); // show how it looks when you raise a panel sleep(sleeptime); w->top(); - std->refresh(); + mystd->refresh(); sleep(sleeptime); delete w; - std->refresh(); + mystd->refresh(); sleep(sleeptime); delete x; - std->clear(); - std->refresh(); + mystd->clear(); + mystd->refresh(); // Don't forget to clean up the main screen. Since this is the // last thing using NCursesWindow, this has the effect of // shutting down ncurses and restoring the terminal state. sleep(sleeptime); - delete std; + delete mystd; } }; @@ -247,21 +247,21 @@ public: F = new NCursesFormField*[10]; mft = new MyFieldType('X'); - ift = new Integer_Field(0,1,10); + ift = new Integer_Field(0, 1, 10); eft = new Enumeration_Field(weekdays); - F[0] = new Label("Demo Entry Form",0,16); - F[1] = new Label("Weekday Enum",2,1); - F[2] = new Label("Number(1-10)",2,21); - F[3] = new Label("Only 'X'",2,35); - F[4] = new Label("Multiline Field (Dynamic and Scrollable)",5,1); - F[5] = new NCursesFormField(1,18,3,1); - F[6] = new NCursesFormField(1,12,3,21); - F[7] = new NCursesFormField(1,12,3,35); - F[8] = new NCursesFormField(4,46,6,1,2); + F[0] = new Label("Demo Entry Form", 0, 16); + F[1] = new Label("Weekday Enum", 2, 1); + F[2] = new Label("Number(1-10)", 2, 21); + F[3] = new Label("Only 'X'", 2, 35); + F[4] = new Label("Multiline Field (Dynamic and Scrollable)", 5, 1); + F[5] = new NCursesFormField(1, 18, 3, 1); + F[6] = new NCursesFormField(1, 12, 3, 21); + F[7] = new NCursesFormField(1, 12, 3, 35); + F[8] = new NCursesFormField(4, 46, 6, 1, 2); F[9] = new NCursesFormField(); - InitForm(F,TRUE,TRUE); + InitForm(F, TRUE, TRUE); boldframe(); F[5]->set_fieldtype(*eft); @@ -312,7 +312,7 @@ public: Soft_Label_Key_Set* S = new Soft_Label_Key_Set; for(int i=1; i <= S->labels(); i++) { char buf[8]; - ::sprintf(buf,"Frm%02d",i); + ::sprintf(buf, "Frm%02d", i); (*S)[i] = buf; // Text (*S)[i] = Soft_Label_Key_Set::Soft_Label_Key::Left; // Justification } @@ -336,9 +336,9 @@ public: const int PADSIZE = 200; unsigned gridcount = 0; - NCursesPanel std; - NCursesPanel P(std.lines()-2,std.cols()-2,1,1); - NCursesFramedPad FP(P,PADSIZE,PADSIZE); + NCursesPanel mystd; + NCursesPanel P(mystd.lines()-2, mystd.cols()-2, 1, 1); + NCursesFramedPad FP(P, PADSIZE, PADSIZE); for (int i=0; i < PADSIZE; i++) { for (int j=0; j < PADSIZE; j++) { @@ -357,7 +357,7 @@ public: } } - P.label("Pad Demo",NULL); + P.label("Pad Demo", NULL); FP(); P.clear(); return FALSE; @@ -385,9 +385,9 @@ public: } bool action() { - NCursesPanel *std = new NCursesPanel(); + NCursesPanel *mystd = new NCursesPanel(); - NCursesPanel *w = new NCursesPanel(std->lines() - 2, std->cols() - 2, 1, 1); + NCursesPanel *w = new NCursesPanel(mystd->lines() - 2, mystd->cols() - 2, 1, 1); w->box(); w->refresh(); @@ -411,7 +411,7 @@ public: delete s; delete w; - delete std; + delete mystd; ::noecho(); return FALSE; } @@ -444,10 +444,10 @@ public: I[6] = new QuitItem(); I[7] = new NCursesMenuItem(); // Terminating empty item - InitMenu(I,TRUE,TRUE); + InitMenu(I, TRUE, TRUE); - P = new NCursesPanel(1,n_items,LINES-1,1); - boldframe("Demo","Silly"); + P = new NCursesPanel(1, n_items, LINES-1, 1); + boldframe("Demo", "Silly"); P->show(); } @@ -474,7 +474,7 @@ public: virtual void On_Menu_Init() { NCursesWindow W(::stdscr); - P->move(0,0); + P->move(0, 0); P->clrtoeol(); for(int i=1; i<=count(); i++) P->addch('0' + i); @@ -484,25 +484,25 @@ public: virtual void On_Menu_Termination() { - P->move(0,0); + P->move(0, 0); P->clrtoeol(); refresh(); } virtual void On_Item_Init(NCursesMenuItem& item) { - P->move(0,item.index()); + P->move(0, item.index()); P->attron(A_REVERSE); - P->printw("%1d",1+item.index()); + P->printw("%1d", 1+item.index()); P->attroff(A_REVERSE); refresh(); } virtual void On_Item_Termination(NCursesMenuItem& item) { - P->move(0,item.index()); + P->move(0, item.index()); P->attroff(A_REVERSE); - P->printw("%1d",1+item.index()); + P->printw("%1d", 1+item.index()); refresh(); } }; @@ -530,7 +530,7 @@ void TestApplication::init_labels(Soft_Label_Key_Set& S) const { for(int i=1; i <= S.labels(); i++) { char buf[8]; - ::sprintf(buf,"Key%02d",i); + ::sprintf(buf, "Key%02d", i); S[i] = buf; // Text S[i] = Soft_Label_Key_Set::Soft_Label_Key::Left; // Justification } @@ -542,7 +542,7 @@ void TestApplication::title() const int len = ::strlen(titleText); titleWindow->bkgd(screen_titles()); - titleWindow->addstr(0,(titleWindow->cols() - len)/2, titleText); + titleWindow->addstr(0, (titleWindow->cols() - len)/2, titleText); titleWindow->noutrefresh(); } diff --git a/c++/edit_cfg.sh b/c++/edit_cfg.sh index f478d6ec..9b2f2890 100755 --- a/c++/edit_cfg.sh +++ b/c++/edit_cfg.sh @@ -1,5 +1,5 @@ #!/bin/sh -# $Id: edit_cfg.sh,v 1.15 2007/01/27 18:51:04 tom Exp $ +# $Id: edit_cfg.sh,v 1.16 2007/04/07 19:08:49 tom Exp $ ############################################################################## # Copyright (c) 1998-2005,2007 Free Software Foundation, Inc. # # # @@ -45,6 +45,7 @@ for name in \ HAVE_BUILTIN_H \ HAVE_GPP_BUILTIN_H \ HAVE_GXX_BUILTIN_H \ + HAVE_IOSTREAM \ HAVE_TYPEINFO \ HAVE_VALUES_H do diff --git a/c++/etip.h.in b/c++/etip.h.in index 8576d2e1..8d5d05e0 100644 --- a/c++/etip.h.in +++ b/c++/etip.h.in @@ -31,7 +31,7 @@ * Author: Juergen Pfeifer, 1997 * ****************************************************************************/ -// $Id: etip.h.in,v 1.34 2007/01/27 18:49:00 tom Exp $ +// $Id: etip.h.in,v 1.36 2007/04/07 18:56:32 tom Exp $ #ifndef NCURSES_ETIP_H_incl #define NCURSES_ETIP_H_incl 1 @@ -49,6 +49,10 @@ #define HAVE_GPP_BUILTIN_H 0 #endif +#ifndef HAVE_IOSTREAM +#define HAVE_IOSTREAM 0 +#endif + #ifndef HAVE_TYPEINFO #define HAVE_TYPEINFO 0 #endif @@ -323,30 +327,46 @@ public: }; #if !((defined(__GNUG__) && defined(__EXCEPTIONS)) || defined(__SUNPRO_CC)) -# include +# if HAVE_IOSTREAM +# include +using std::cerr; +using std::endl; +# else +# include +# endif extern "C" void exit(int); #endif inline void THROW(const NCursesException *e) { #if defined(__GNUG__) && defined(__EXCEPTIONS) # if ((__GNUG__ <= 2) && (__GNUC_MINOR__ < 8)) - (*lib_error_handler)(e?e->classname():"",e?e->message:""); + (*lib_error_handler)(e ? e->classname() : "", e ? e->message : ""); #else - throw *e; +#define CPP_HAS_TRY_CATCH 1 #endif #elif defined(__SUNPRO_CC) # if !defined(__SUNPRO_CC_COMPAT) || (__SUNPRO_CC_COMPAT < 5) genericerror(1, ((e != 0) ? (char *)(e->message) : "")); #else - throw *e; +#define CPP_HAS_TRY_CATCH 1 #endif #else if (e) cerr << e->message << endl; exit(0); #endif -} -#define THROWS(s) +#ifndef CPP_HAS_TRY_CATCH +#define CPP_HAS_TRY_CATCH 0 +#define NCURSES_CPP_TRY /* nothing */ +#define NCURSES_CPP_CATCH(e) if (false) +#define THROWS(s) /* nothing */ +#elif CPP_HAS_TRY_CATCH + throw *e; +#define NCURSES_CPP_TRY try +#define NCURSES_CPP_CATCH(e) catch(e) +#define THROWS(s) throw(s) +#endif +} #endif /* NCURSES_ETIP_H_incl */ diff --git a/c++/internal.h b/c++/internal.h index a14680cc..16495bcd 100644 --- a/c++/internal.h +++ b/c++/internal.h @@ -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,11 +31,13 @@ * Author: Juergen Pfeifer, 1997 * ****************************************************************************/ -// $Id: internal.h,v 1.13 2006/09/30 21:59:57 tom Exp $ +// $Id: internal.h,v 1.14 2007/04/07 18:44:17 tom Exp $ #ifndef NCURSES_CPLUS_INTERNAL_H #define NCURSES_CPLUS_INTERNAL_H 1 +#include + #include #if USE_RCS_IDS diff --git a/configure b/configure index b2eb941c..5e7895e4 100755 --- a/configure +++ b/configure @@ -1,5 +1,5 @@ #! /bin/sh -# From configure.in Revision: 1.410 . +# From configure.in Revision: 1.412 . # Guess values for system-dependent variables and create Makefiles. # Generated by Autoconf 2.52.20061216. # @@ -13973,7 +13973,7 @@ ac_link='$CXX -o conftest$ac_exeext $CXXFLAGS $CPPFLAGS $LDFLAGS conftest.$ac_ex ac_compiler_gnu=$ac_cv_cxx_compiler_gnu ac_main_return=return -for ac_header in typeinfo +for ac_header in iostream typeinfo do as_ac_Header=`echo "ac_cv_header_$ac_header" | $as_tr_sh` echo "$as_me:13979: checking for $ac_header" >&5 @@ -15285,6 +15285,10 @@ if test -n "$ADA_SUBDIRS"; then fi +if test "$cf_with_ada" != "no" && test "$cf_cv_prog_gnat_correct" != "no"; then + SUB_MAKEFILES="$SUB_MAKEFILES Ada95/gen/adacurses-config" +fi + DIRS_TO_MAKE="lib" for cf_item in $cf_list_models do @@ -15496,7 +15500,7 @@ DEFS=-DHAVE_CONFIG_H : ${CONFIG_STATUS=./config.status} ac_clean_files_save=$ac_clean_files ac_clean_files="$ac_clean_files $CONFIG_STATUS" -{ echo "$as_me:15499: creating $CONFIG_STATUS" >&5 +{ echo "$as_me:15503: creating $CONFIG_STATUS" >&5 echo "$as_me: creating $CONFIG_STATUS" >&6;} cat >$CONFIG_STATUS <<_ACEOF #! $SHELL @@ -15672,7 +15676,7 @@ cat >>$CONFIG_STATUS <<\EOF echo "$ac_cs_version"; exit 0 ;; --he | --h) # Conflict between --help and --header - { { echo "$as_me:15675: error: ambiguous option: $1 + { { echo "$as_me:15679: error: ambiguous option: $1 Try \`$0 --help' for more information." >&5 echo "$as_me: error: ambiguous option: $1 Try \`$0 --help' for more information." >&2;} @@ -15691,7 +15695,7 @@ Try \`$0 --help' for more information." >&2;} ac_need_defaults=false;; # This is an error. - -*) { { echo "$as_me:15694: error: unrecognized option: $1 + -*) { { echo "$as_me:15698: error: unrecognized option: $1 Try \`$0 --help' for more information." >&5 echo "$as_me: error: unrecognized option: $1 Try \`$0 --help' for more information." >&2;} @@ -15787,7 +15791,7 @@ do "Makefile" ) CONFIG_FILES="$CONFIG_FILES Makefile" ;; "default" ) CONFIG_COMMANDS="$CONFIG_COMMANDS default" ;; "include/ncurses_cfg.h" ) CONFIG_HEADERS="$CONFIG_HEADERS include/ncurses_cfg.h:include/ncurses_cfg.hin" ;; - *) { { echo "$as_me:15790: error: invalid argument: $ac_config_target" >&5 + *) { { echo "$as_me:15794: error: invalid argument: $ac_config_target" >&5 echo "$as_me: error: invalid argument: $ac_config_target" >&2;} { (exit 1); exit 1; }; };; esac @@ -16164,7 +16168,7 @@ done; } esac if test x"$ac_file" != x-; then - { echo "$as_me:16167: creating $ac_file" >&5 + { echo "$as_me:16171: creating $ac_file" >&5 echo "$as_me: creating $ac_file" >&6;} rm -f "$ac_file" fi @@ -16182,7 +16186,7 @@ echo "$as_me: creating $ac_file" >&6;} -) echo $tmp/stdin ;; [\\/$]*) # Absolute (can't be DOS-style, as IFS=:) - test -f "$f" || { { echo "$as_me:16185: error: cannot find input file: $f" >&5 + test -f "$f" || { { echo "$as_me:16189: error: cannot find input file: $f" >&5 echo "$as_me: error: cannot find input file: $f" >&2;} { (exit 1); exit 1; }; } echo $f;; @@ -16195,7 +16199,7 @@ echo "$as_me: error: cannot find input file: $f" >&2;} echo $srcdir/$f else # /dev/null tree - { { echo "$as_me:16198: error: cannot find input file: $f" >&5 + { { echo "$as_me:16202: error: cannot find input file: $f" >&5 echo "$as_me: error: cannot find input file: $f" >&2;} { (exit 1); exit 1; }; } fi;; @@ -16261,7 +16265,7 @@ for ac_file in : $CONFIG_HEADERS; do test "x$ac_file" = x: && continue * ) ac_file_in=$ac_file.in ;; esac - test x"$ac_file" != x- && { echo "$as_me:16264: creating $ac_file" >&5 + test x"$ac_file" != x- && { echo "$as_me:16268: creating $ac_file" >&5 echo "$as_me: creating $ac_file" >&6;} # First look for the input files in the build tree, otherwise in the @@ -16272,7 +16276,7 @@ echo "$as_me: creating $ac_file" >&6;} -) echo $tmp/stdin ;; [\\/$]*) # Absolute (can't be DOS-style, as IFS=:) - test -f "$f" || { { echo "$as_me:16275: error: cannot find input file: $f" >&5 + test -f "$f" || { { echo "$as_me:16279: error: cannot find input file: $f" >&5 echo "$as_me: error: cannot find input file: $f" >&2;} { (exit 1); exit 1; }; } echo $f;; @@ -16285,7 +16289,7 @@ echo "$as_me: error: cannot find input file: $f" >&2;} echo $srcdir/$f else # /dev/null tree - { { echo "$as_me:16288: error: cannot find input file: $f" >&5 + { { echo "$as_me:16292: error: cannot find input file: $f" >&5 echo "$as_me: error: cannot find input file: $f" >&2;} { (exit 1); exit 1; }; } fi;; @@ -16343,7 +16347,7 @@ cat >>$CONFIG_STATUS <<\EOF rm -f $tmp/in if test x"$ac_file" != x-; then if cmp -s $ac_file $tmp/config.h 2>/dev/null; then - { echo "$as_me:16346: $ac_file is unchanged" >&5 + { echo "$as_me:16350: $ac_file is unchanged" >&5 echo "$as_me: $ac_file is unchanged" >&6;} else ac_dir=`$as_expr X"$ac_file" : 'X\(.*[^/]\)//*[^/][^/]*/*$' \| \ diff --git a/configure.in b/configure.in index dc138c6e..6cc9591d 100644 --- a/configure.in +++ b/configure.in @@ -28,14 +28,14 @@ dnl*************************************************************************** dnl dnl Author: Thomas E. Dickey 1995-on dnl -dnl $Id: configure.in,v 1.410 2007/03/24 23:12:57 tom Exp $ +dnl $Id: configure.in,v 1.412 2007/04/07 21:15:23 tom Exp $ dnl Process this file with autoconf to produce a configure script. dnl dnl See http://invisible-island.net/autoconf/ for additional information. dnl dnl --------------------------------------------------------------------------- AC_PREREQ(2.13.20020210) -AC_REVISION($Revision: 1.410 $) +AC_REVISION($Revision: 1.412 $) AC_INIT(ncurses/base/lib_initscr.c) AC_CONFIG_HEADER(include/ncurses_cfg.h:include/ncurses_cfg.hin) @@ -1253,7 +1253,7 @@ if test -n "$CXX" ; then ;; esac - AC_CHECK_HEADERS(typeinfo) + AC_CHECK_HEADERS(iostream typeinfo) CF_BOOL_DECL CF_BOOL_SIZE @@ -1616,6 +1616,11 @@ AC_DEFINE(HAVE_SLK_COLOR) ### with the appropriate compile-rules. CF_SRC_MODULES($modules_to_build) + +if test "$cf_with_ada" != "no" && test "$cf_cv_prog_gnat_correct" != "no"; then + SUB_MAKEFILES="$SUB_MAKEFILES Ada95/gen/adacurses-config" +fi + CF_DIRS_TO_MAKE AC_DEFINE_UNQUOTED(NCURSES_PATHSEP,'$PATHSEP') diff --git a/dist.mk b/dist.mk index d51360d9..5c5f3b5f 100644 --- 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.587 2007/04/01 00:32:37 tom Exp $ +# $Id: dist.mk,v 1.588 2007/04/07 17:04: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 = 6 -NCURSES_PATCH = 20070331 +NCURSES_PATCH = 20070407 # We don't append the patch to the version, since this only applies to releases VERSION = $(NCURSES_MAJOR).$(NCURSES_MINOR) diff --git a/include/ncurses_defs b/include/ncurses_defs index f6828877..eddcbf2c 100644 --- a/include/ncurses_defs +++ b/include/ncurses_defs @@ -1,4 +1,4 @@ -# $Id: ncurses_defs,v 1.32 2007/03/10 15:40:16 tom Exp $ +# $Id: ncurses_defs,v 1.33 2007/04/07 17:07:27 tom Exp $ ############################################################################## # Copyright (c) 2000-2006,2007 Free Software Foundation, Inc. # # # @@ -67,6 +67,7 @@ HAVE_GPM_H HAVE_GPP_BUILTIN_H HAVE_GXX_BUILTIN_H HAVE_HAS_KEY +HAVE_IOSTREAM HAVE_ISASCII HAVE_ISSETUGID HAVE_LANGINFO_CODESET diff --git a/man/curs_getyx.3x b/man/curs_getyx.3x index d83cce74..701b15d4 100644 --- a/man/curs_getyx.3x +++ b/man/curs_getyx.3x @@ -26,7 +26,7 @@ .\" authorization. * .\"*************************************************************************** .\" -.\" $Id: curs_getyx.3x,v 1.14 2007/03/17 20:22:45 tom Exp $ +.\" $Id: curs_getyx.3x,v 1.15 2007/04/07 23:21:34 tom Exp $ .TH curs_getyx 3X "" .SH NAME \fBgetyx\fR, @@ -80,7 +80,8 @@ This implementation also provides \fBgetpary\fR for compatibility with older versions of curses. .SH SEE ALSO -\fBcurses\fR(3X) +\fBcurses\fR(3X), +\fBcurs_legacy\fR(3X) .\"# .\"# The following sets edit modes for GNU EMACS .\"# Local Variables: diff --git a/man/curs_legacy.3x b/man/curs_legacy.3x new file mode 100644 index 00000000..251ae496 --- /dev/null +++ b/man/curs_legacy.3x @@ -0,0 +1,93 @@ +.\"*************************************************************************** +.\" 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. * +.\"*************************************************************************** +.\" +.\" $Id: curs_legacy.3x,v 1.1 2007/04/07 23:54:29 tom Exp $ +.TH curs_legacy 3X "" +.SH NAME +\fBgetbegx\fR, +\fBgetbegy\fR, +\fBgetcurx\fR, +\fBgetcury\fR, +\fBgetmaxx\fR, +\fBgetmaxy\fR, +\fBgetparx\fR, +\fBgetpary\fR - get \fBcurses\fR cursor and window coordinates +.SH SYNOPSIS +\fB#include \fR +.sp +\fBint getbegx(WINDOW *win);\fR +.br +\fBint getbegy(WINDOW *win);\fR +.br +\fBint getcurx(WINDOW *win);\fR +.br +\fBint getcury(WINDOW *win);\fR +.br +\fBint getmaxx(WINDOW *win);\fR +.br +\fBint getmaxy(WINDOW *win);\fR +.br +\fBint getparx(WINDOW *win);\fR +.br +\fBint getpary(WINDOW *win);\fR +.br +.SH DESCRIPTION +The \fBgetbegy\fR and \fBgetbegx\fR functions return the same +data as \fBgetbegyx\fR. +.PP +The \fBgetcury\fR and \fBgetcurx\fR functions return the same +data as \fBgetyx\fR. +.PP +The \fBgetmaxy\fR and \fBgetmaxx\fR functions return the same +data as \fBgetmaxyx\fR. +.PP +The \fBgetpary\fR and \fBgetparx\fR functions return the same +data as \fBgetparyx\fR. +.SH RETURN VALUE +These functions return an integer, +or ERR if the window parameter is null. +.SH NOTES +All of these interfaces are provided as macros and functions. +The macros are suppressed (and only the functions provided) +when \fBNCURSES_OPAQUE\fR is defined. +The standard forms such as \fBgetyx\fP must be implemented as macros, +and (in this implementation) are defined in terms of the functions +described here, +to avoid reliance on internal details of the WINDOW structure. +.SH PORTABILITY +These functions were supported on Version 7, BSD or System V implementations. +.SH SEE ALSO +\fBcurses\fR(3X), +\fBcurs_getyx\fR(3X), +\fBcurs_opaque\fR(3X) +.\"# +.\"# The following sets edit modes for GNU EMACS +.\"# Local Variables: +.\"# mode:nroff +.\"# fill-column:79 +.\"# End: diff --git a/man/curs_opaque.3x b/man/curs_opaque.3x new file mode 100644 index 00000000..1f04fbf2 --- /dev/null +++ b/man/curs_opaque.3x @@ -0,0 +1,123 @@ +.\"*************************************************************************** +.\" 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. * +.\"*************************************************************************** +.\" +.\" $Id: curs_opaque.3x,v 1.1 2007/04/07 23:19:40 tom Exp $ +.TH curs_opaque 3X "" +.na +.hy 0 +.SH NAME +\fBis_cleared\fR, +\fBis_idlok\fR, +\fBis_idcok\fR, +\fBis_immedok\fR, +\fBis_keypad\fR, +\fBis_leaveok\fR, +\fBis_nodelay\fR, +\fBis_timeout\fR, +\fBis_scrollok\fR, +\fBis_syncok\fR - \fBcurses\fR output options +.ad +.hy +.SH SYNOPSIS +\fB#include \fR +.sp +\fBbool is_cleared (WINDOW *win);\fR +.br +\fBbool is_idcok (WINDOW *win);\fR +.br +\fBbool is_idlok (WINDOW *win);\fR +.br +\fBbool is_immedok (WINDOW *win);\fR +.br +\fBbool is_keypad (WINDOW *win);\fR +.br +\fBbool is_leaveok (WINDOW *win);\fR +.br +\fBbool is_nodelay (WINDOW *win);\fR +.br +\fBbool is_notimeout (WINDOW *win);\fR +.br +\fBbool is_scrollok (WINDOW *win);\fR +.br +\fBbool is_syncok (WINDOW *win);\fR +.br +.SH DESCRIPTION +This implementation provides functions which return properties +set in the WINDOW structure, allowing it to be ``opaque'' if +the symbol \fBNCURSES_OPAQUE\fR is defined: +.TP 5 +\fBis_cleared\fR +returns the value set in \fBclearok\fR +.TP 5 +\fBis_idcok\fR +returns the value set in \fBidcok\fR +.TP 5 +\fBis_idlok\fR +returns the value set in \fBidlok\fR +.TP 5 +\fBis_immedok\fR +returns the value set in \fBimmedok\fR +.TP 5 +\fBis_keypad\fR +returns the value set in \fBkeypad\fR +.TP 5 +\fBis_leaveok\fR +returns the value set in \fBleaveok\fR +.TP 5 +\fBis_nodelay\fR +returns the value set in \fBnodelay\fR +.TP 5 +\fBis_notimeout\fR +returns the value set in \fBnotimeout\fR +.TP 5 +\fBis_scrollok\fR +returns the value set in \fBscrollok\fR +.TP 5 +\fBis_syncok\fR +returns the value set in \fBsyncok\fR +.RE +.SH RETURN VALUE +These functions all return TRUE or FALSE. +.SH NOTES +Both a macro and a function are provided for each name. +.SH PORTABILITY +These routines are specific to ncurses. +They were not supported on Version 7, BSD or System V implementations. +It is recommended that any code depending on ncurses extensions +be conditioned using NCURSES_VERSION. +.SH SEE ALSO +\fBcurses\fR(3X), +\fBcurs_inopts\fR(3X), +\fBcurs_outopts\fR(3X), +\fBcurs_window\fR(3X) +.\"# +.\"# The following sets edit modes for GNU EMACS +.\"# Local Variables: +.\"# mode:nroff +.\"# fill-column:79 +.\"# End: diff --git a/man/man_db.renames b/man/man_db.renames index d2c60248..a84ae809 100644 --- a/man/man_db.renames +++ b/man/man_db.renames @@ -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 "Software"), # @@ -25,7 +25,7 @@ # use or other dealings in this Software without prior written # # authorization. # ############################################################################## -# $Id: man_db.renames,v 0.38 2006/12/24 16:07:46 tom Exp $ +# $Id: man_db.renames,v 0.39 2007/04/07 23:06:31 tom Exp $ # Manual-page renamings for the man_db program # # Files: @@ -67,8 +67,10 @@ curs_insstr.3x insstr.3ncurses curs_instr.3x instr.3ncurses curs_inwstr.3x inwstr.3ncurses curs_kernel.3x kernel.3ncurses +curs_legacy.3x legacy.3ncurses curs_mouse.3x mouse.3ncurses curs_move.3x move.3ncurses +curs_opaque.3x opaque.3ncurses curs_outopts.3x outopts.3ncurses curs_overlay.3x overlay.3ncurses curs_pad.3x pad.3ncurses diff --git a/man/ncurses.3x b/man/ncurses.3x index c3e017a8..ebcaa40b 100644 --- a/man/ncurses.3x +++ b/man/ncurses.3x @@ -27,7 +27,7 @@ .\" authorization. * .\"*************************************************************************** .\" -.\" $Id: ncurses.3x,v 1.84 2007/03/17 20:30:11 tom Exp $ +.\" $Id: ncurses.3x,v 1.86 2007/04/07 23:08:08 tom Exp $ .hy 0 .TH ncurses 3X "" .ds n 5 @@ -276,23 +276,23 @@ flushinp/\fBcurs_util\fR(3X) get_wch/\fBcurs_get_wch\fR(3X) get_wstr/\fBcurs_get_wstr\fR(3X) getattrs/\fBcurs_attr\fR(3X) -getbegx/\fBcurs_getyx\fR(3X) -getbegy/\fBcurs_getyx\fR(3X) +getbegx/\fBcurs_legacy\fR(3X)* +getbegy/\fBcurs_legacy\fR(3X)* getbegyx/\fBcurs_getyx\fR(3X) getbkgd/\fBcurs_bkgd\fR(3X) getbkgrnd/\fBcurs_bkgrnd\fR(3X) getcchar/\fBcurs_getcchar\fR(3X) getch/\fBcurs_getch\fR(3X) -getcurx/\fBcurs_getyx\fR(3X) -getcury/\fBcurs_getyx\fR(3X) -getmaxx/\fBcurs_getyx\fR(3X) -getmaxy/\fBcurs_getyx\fR(3X) +getcurx/\fBcurs_legacy\fR(3X)* +getcury/\fBcurs_legacy\fR(3X)* +getmaxx/\fBcurs_legacy\fR(3X)* +getmaxy/\fBcurs_legacy\fR(3X)* getmaxyx/\fBcurs_getyx\fR(3X) getmouse/\fBcurs_mouse\fR(3X)* getn_wstr/\fBcurs_get_wstr\fR(3X) getnstr/\fBcurs_getstr\fR(3X) -getparx/\fBcurs_getyx\fR(3X) -getpary/\fBcurs_getyx\fR(3X) +getparx/\fBcurs_legacy\fR(3X)* +getpary/\fBcurs_legacy\fR(3X)* getparyx/\fBcurs_getyx\fR(3X) getstr/\fBcurs_getstr\fR(3X) getsyx/\fBcurs_kernel\fR(3X) @@ -330,7 +330,18 @@ insstr/\fBcurs_insstr\fR(3X) instr/\fBcurs_instr\fR(3X) intrflush/\fBcurs_inopts\fR(3X) inwstr/\fBcurs_inwstr\fR(3X) +is_cleared/\fBcurs_opaque\fR(3X)* +is_idcok/\fBcurs_opaque\fR(3X)* +is_idlok/\fBcurs_opaque\fR(3X)* +is_immedok/\fBcurs_opaque\fR(3X)* +is_keypad/\fBcurs_opaque\fR(3X)* +is_leaveok/\fBcurs_opaque\fR(3X)* is_linetouched/\fBcurs_touch\fR(3X) +is_nodelay/\fBcurs_opaque\fR(3X)* +is_notimeout/\fBcurs_opaque\fR(3X)* +is_scrollok/\fBcurs_opaque\fR(3X)* +is_syncok/\fBcurs_opaque\fR(3X)* +is_term_resized/\fBresizeterm\fR(3X)* is_wintouched/\fBcurs_touch\fR(3X) isendwin/\fBcurs_initscr\fR(3X) key_defined/\fBkey_defined\fR(3X)* @@ -440,6 +451,7 @@ nl/\fBcurs_outopts\fR(3X) nocbreak/\fBcurs_inopts\fR(3X) nodelay/\fBcurs_inopts\fR(3X) noecho/\fBcurs_inopts\fR(3X) +nofilter/\fBcurs_util\fR(3X)* nonl/\fBcurs_outopts\fR(3X) noqiflush/\fBcurs_inopts\fR(3X) noraw/\fBcurs_inopts\fR(3X) @@ -528,6 +540,7 @@ untouchwin/\fBcurs_touch\fR(3X) use_default_colors/\fBdefault_colors\fR(3X)* use_env/\fBcurs_util\fR(3X) use_extended_names/\fBcurs_extend\fR(3X)* +use_legacy_coding/\fBlegacy_coding\fR(3X)* vid_attr/\fBcurs_terminfo\fR(3X) vid_puts/\fBcurs_terminfo\fR(3X) vidattr/\fBcurs_terminfo\fR(3X) @@ -994,22 +1007,30 @@ A small number of local differences (that is, individual differences between the XSI Curses and \fBncurses\fR calls) are described in \fBPORTABILITY\fR sections of the library man pages. .PP +This implementation also contains several extensions: +.RS 5 +.PP The routine \fBhas_key\fR is not part of XPG4, nor is it present in SVr4. See the \fBcurs_getch\fR(3X) manual page for details. .PP -The routine \fBslk_attr\fR is not part of XPG4, nor is it present in SVr4. See -the \fBcurs_slk\fR(3X) manual page for details. +The routine \fBslk_attr\fR is not part of XPG4, nor is it present in SVr4. +See the \fBcurs_slk\fR(3X) manual page for details. .PP The routines \fBgetmouse\fR, \fBmousemask\fR, \fBungetmouse\fR, \fBmouseinterval\fR, and \fBwenclose\fR relating to mouse interfacing are not -part of XPG4, nor are they present in SVr4. See the \fBcurs_mouse\fR(3X) -manual page for details. +part of XPG4, nor are they present in SVr4. +See the \fBcurs_mouse\fR(3X) manual page for details. .PP -The routine \fBmcprint\fR was not present in any previous curses -implementation. See the \fBcurs_print\fR(3X) manual page for details. +The routine \fBmcprint\fR was not present in any previous curses implementation. +See the \fBcurs_print\fR(3X) manual page for details. .PP -The routine \fBwresize\fR is not part of XPG4, nor is it present in SVr4. See -the \fBwresize\fR(3X) manual page for details. +The routine \fBwresize\fR is not part of XPG4, nor is it present in SVr4. +See the \fBwresize\fR(3X) manual page for details. +.PP +The WINDOW structure's internal details can be hidden from application +programs. +See \fBcurs_opaque\fR(3X) for the discussion of \fBis_scrollok\fR, etc. +.RE .PP In historic curses versions, delays embedded in the capabilities \fBcr\fR, \fBind\fR, \fBcub1\fR, \fBff\fR and \fBtab\fR activated corresponding delay diff --git a/ncurses/base/lib_addstr.c b/ncurses/base/lib_addstr.c index b7a0b40e..7428f520 100644 --- a/ncurses/base/lib_addstr.c +++ b/ncurses/base/lib_addstr.c @@ -1,5 +1,5 @@ /**************************************************************************** - * Copyright (c) 1998-2004,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 * @@ -44,7 +44,7 @@ #include -MODULE_ID("$Id: lib_addstr.c,v 1.46 2006/05/27 19:22:19 tom Exp $") +MODULE_ID("$Id: lib_addstr.c,v 1.47 2007/04/07 17:13:21 tom Exp $") NCURSES_EXPORT(int) waddnstr(WINDOW *win, const char *astr, int n) @@ -80,8 +80,7 @@ waddnstr(WINDOW *win, const char *astr, int n) NCURSES_EXPORT(int) waddchnstr(WINDOW *win, const chtype *astr, int n) { - NCURSES_SIZE_T y = win->_cury; - NCURSES_SIZE_T x = win->_curx; + NCURSES_SIZE_T y, x; int code = OK; int i; struct ldat *line; @@ -91,6 +90,8 @@ waddchnstr(WINDOW *win, const chtype *astr, int n) if (!win) returnCode(ERR); + y = win->_cury; + x = win->_curx; if (n < 0) { const chtype *str; n = 0; diff --git a/ncurses/base/lib_color.c b/ncurses/base/lib_color.c index ba2563c5..9cae4954 100644 --- a/ncurses/base/lib_color.c +++ b/ncurses/base/lib_color.c @@ -42,7 +42,7 @@ #include #include -MODULE_ID("$Id: lib_color.c,v 1.84 2007/03/10 19:20:15 tom Exp $") +MODULE_ID("$Id: lib_color.c,v 1.85 2007/04/07 17:07:28 tom Exp $") /* * These should be screen structure members. They need to be globals for @@ -69,7 +69,10 @@ NCURSES_EXPORT_VAR(int) COLORS = 0; #define TYPE_CALLOC(type,elts) typeCalloc(type, (unsigned)(elts)) +#define MAX_PALETTE 8 + #define OkColorHi(n) (((n) < COLORS) && ((n) < max_colors)) +#define InPalette(n) ((n) >= 0 && (n) < MAX_PALETTE) /* * Given a RGB range of 0..1000, we'll normally set the individual values @@ -175,10 +178,10 @@ init_color_table(void) tp = (hue_lightness_saturation) ? hls_palette : cga_palette; for (n = 0; n < COLORS; n++) { - if (n < 8) { + if (InPalette(n)) { SP->_color_table[n] = tp[n]; } else { - SP->_color_table[n] = tp[n % 8]; + SP->_color_table[n] = tp[n % MAX_PALETTE]; if (hue_lightness_saturation) { SP->_color_table[n].green = 100; } else { @@ -382,7 +385,7 @@ init_pair(short pair, short f, short b) if (GET_SCREEN_PAIR(SP) == pair) SET_SCREEN_PAIR(SP, (chtype) (~0)); /* force attribute update */ - if (initialize_pair) { + if (initialize_pair && InPalette(f) && InPalette(b)) { const color_t *tp = hue_lightness_saturation ? hls_palette : cga_palette; TR(TRACE_ATTRS, diff --git a/ncurses/base/lib_overlay.c b/ncurses/base/lib_overlay.c index 9ecc4582..22bd2f80 100644 --- a/ncurses/base/lib_overlay.c +++ b/ncurses/base/lib_overlay.c @@ -1,5 +1,5 @@ /**************************************************************************** - * Copyright (c) 1998-2002,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 * @@ -40,7 +40,7 @@ #include -MODULE_ID("$Id: lib_overlay.c,v 1.22 2006/10/14 20:43:31 tom Exp $") +MODULE_ID("$Id: lib_overlay.c,v 1.23 2007/04/07 17:13:52 tom Exp $") static int overlap(const WINDOW *const s, WINDOW *const d, int const flag) @@ -139,8 +139,8 @@ copywin(const WINDOW *src, WINDOW *dst, { int sx, sy, dx, dy; bool touched; - attr_t bk = AttrOf(dst->_nc_bkgd); - attr_t mask = ~(attr_t) ((bk & A_COLOR) ? A_COLOR : 0); + attr_t bk; + attr_t mask; T((T_CALLED("copywin(%p, %p, %d, %d, %d, %d, %d, %d, %d)"), src, dst, sminrow, smincol, dminrow, dmincol, dmaxrow, dmaxcol, over)); @@ -148,6 +148,9 @@ copywin(const WINDOW *src, WINDOW *dst, if (!src || !dst) returnCode(ERR); + bk = AttrOf(dst->_nc_bkgd); + mask = ~(attr_t) ((bk & A_COLOR) ? A_COLOR : 0); + /* make sure rectangle exists in source */ if ((sminrow + dmaxrow - dminrow) > (src->_maxy + 1) || (smincol + dmaxcol - dmincol) > (src->_maxx + 1)) { diff --git a/ncurses/base/tries.c b/ncurses/base/tries.c index a346decc..c00ef20b 100644 --- a/ncurses/base/tries.c +++ b/ncurses/base/tries.c @@ -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 * @@ -39,7 +39,7 @@ #include -MODULE_ID("$Id: tries.c,v 1.23 2006/12/30 16:26:54 tom Exp $") +MODULE_ID("$Id: tries.c,v 1.24 2007/04/07 17:14:27 tom Exp $") /* * Expand a keycode into the string that it corresponds to, returning null if @@ -68,7 +68,7 @@ _nc_expand_try(TRIES * tree, unsigned code, int *count, size_t len) } } if (result != 0) { - if ((result[len] = ptr->ch) == 0) + if (ptr != 0 && (result[len] = ptr->ch) == 0) *((unsigned char *) (result + len)) = 128; #ifdef TRACE if (len == 0 && _nc_tracing != 0) diff --git a/ncurses/base/wresize.c b/ncurses/base/wresize.c index ca6336dc..604f7f9a 100644 --- a/ncurses/base/wresize.c +++ b/ncurses/base/wresize.c @@ -1,5 +1,5 @@ /**************************************************************************** - * Copyright (c) 1998-2002,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 * @@ -32,13 +32,13 @@ #include -MODULE_ID("$Id: wresize.c,v 1.24 2006/10/14 20:43:31 tom Exp $") +MODULE_ID("$Id: wresize.c,v 1.25 2007/04/07 17:13:42 tom Exp $") static int cleanup_lines(struct ldat *data, int length) { while (--length >= 0) - free(data->text); + free(data[length].text); free(data); return ERR; } diff --git a/ncurses/tinfo/trim_sgr0.c b/ncurses/tinfo/trim_sgr0.c index 3ce18e07..80c8f77f 100644 --- a/ncurses/tinfo/trim_sgr0.c +++ b/ncurses/tinfo/trim_sgr0.c @@ -1,5 +1,5 @@ /**************************************************************************** - * Copyright (c) 2005 Free Software Foundation, Inc. * + * Copyright (c) 2005-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 * @@ -37,7 +37,7 @@ #include #include -MODULE_ID("$Id: trim_sgr0.c,v 1.7 2006/12/02 19:37:57 tom Exp $") +MODULE_ID("$Id: trim_sgr0.c,v 1.8 2007/04/07 17:14:11 tom Exp $") #undef CUR #define CUR tp-> @@ -247,9 +247,7 @@ _nc_trim_sgr0(TERMTYPE *tp) if (!rewrite_sgr(on, enter_alt_charset_mode) || !rewrite_sgr(off, exit_alt_charset_mode) || !rewrite_sgr(end, exit_alt_charset_mode)) { - FreeIfNeeded(on); FreeIfNeeded(off); - FreeIfNeeded(end); } else if (similar_sgr(off, end) && !similar_sgr(off, on)) { TR(TRACE_DATABASE, ("adjusting sgr(9:off) : %s", _nc_visbuf(off))); @@ -315,8 +313,8 @@ _nc_trim_sgr0(TERMTYPE *tp) */ free(off); } - free(end); - free(on); + FreeIfNeeded(end); + FreeIfNeeded(on); } else { /* * Possibly some applications are confused if sgr0 contains rmacs, diff --git a/ncurses/trace/visbuf.c b/ncurses/trace/visbuf.c index fd06af93..706dea0e 100644 --- a/ncurses/trace/visbuf.c +++ b/ncurses/trace/visbuf.c @@ -42,11 +42,13 @@ #include #include -MODULE_ID("$Id: visbuf.c,v 1.22 2007/03/11 00:03:11 tom Exp $") +MODULE_ID("$Id: visbuf.c,v 1.23 2007/04/07 19:25:28 tom Exp $") +#ifdef TRACE static const char d_quote[] = {D_QUOTE, 0}; static const char l_brace[] = {L_BRACE, 0}; static const char r_brace[] = {R_BRACE, 0}; +#endif static char * _nc_vischar(char *tp, unsigned c) diff --git a/progs/dump_entry.c b/progs/dump_entry.c index 0a3cb380..2ae53806 100644 --- a/progs/dump_entry.c +++ b/progs/dump_entry.c @@ -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 * @@ -39,7 +39,7 @@ #include "termsort.c" /* this C file is generated */ #include /* so is this */ -MODULE_ID("$Id: dump_entry.c,v 1.79 2006/09/30 20:18:15 tom Exp $") +MODULE_ID("$Id: dump_entry.c,v 1.80 2007/04/07 17:13:36 tom Exp $") #define INDENT 8 #define DISCARD(string) string = ABSENT_STRING @@ -352,14 +352,17 @@ version_filter(PredType type, PredIdx idx) } break; +#define is_termcap(type) (idx < (int) sizeof(type##_from_termcap) && \ + type##_from_termcap[idx]) + case V_BSD: /* BSD */ switch (type) { case BOOLEAN: - return bool_from_termcap[idx]; + return is_termcap(bool); case NUMBER: - return num_from_termcap[idx]; + return is_termcap(num); case STRING: - return str_from_termcap[idx]; + return is_termcap(str); } break; } @@ -788,11 +791,11 @@ fmt_entry(TERMTYPE *tterm, * Much more work should be done on this to support dumping termcaps. */ if (tversion == V_HPUX) { - if (memory_lock) { + if (VALID_STRING(memory_lock)) { (void) sprintf(buffer, "meml=%s", memory_lock); WRAP_CONCAT; } - if (memory_unlock) { + if (VALID_STRING(memory_unlock)) { (void) sprintf(buffer, "memu=%s", memory_unlock); WRAP_CONCAT; } diff --git a/progs/infocmp.c b/progs/infocmp.c index dbaf2377..e0ef1d2a 100644 --- a/progs/infocmp.c +++ b/progs/infocmp.c @@ -41,7 +41,7 @@ #include -MODULE_ID("$Id: infocmp.c,v 1.87 2007/02/03 19:10:27 tom Exp $") +MODULE_ID("$Id: infocmp.c,v 1.88 2007/04/07 17:07:30 tom Exp $") #define L_CURL "{" #define R_CURL "}" @@ -1083,7 +1083,6 @@ dump_initializers(TERMTYPE *term) } *tp++ = '"'; *tp = '\0'; - size += (strlen(term->Strings[n]) + 1); (void) printf("static char %-20s[] = %s;\n", string_variable(ExtStrname(term, n, strnames)), buf); } diff --git a/progs/tic.c b/progs/tic.c index 1b03f380..ae6559ce 100644 --- a/progs/tic.c +++ b/progs/tic.c @@ -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 * @@ -44,7 +44,7 @@ #include #include -MODULE_ID("$Id: tic.c,v 1.131 2006/12/02 22:13:17 tom Exp $") +MODULE_ID("$Id: tic.c,v 1.132 2007/04/07 17:14:27 tom Exp $") const char *_nc_progname = "tic"; @@ -353,11 +353,24 @@ open_input(const char *filename) return fp; } +#if NO_LEAKS +static void +free_namelist(char **src) +{ + if (src != 0) { + int n; + for (n = 0; src[n] != 0; ++n) + free(src[n]); + free(src); + } +} +#endif + /* Parse the "-e" option-value into a list of names */ -static const char ** +static char ** make_namelist(char *src) { - const char **dst = 0; + char **dst = 0; char *s, *base; unsigned pass, n, nn; @@ -374,11 +387,13 @@ make_namelist(char *src) if ((s = stripped(buffer)) != 0) { if (dst != 0) dst[nn] = s; + else + free(s); nn++; } } if (pass == 1) { - dst = typeCalloc(const char *, nn + 1); + dst = typeCalloc(char *, nn + 1); rewind(fp); } } @@ -401,10 +416,10 @@ make_namelist(char *src) break; } if (pass == 1) - dst = typeCalloc(const char *, nn + 1); + dst = typeCalloc(char *, nn + 1); } } - if (showsummary) { + if (showsummary && (dst != 0)) { fprintf(log_fp, "Entries that will be compiled:\n"); for (n = 0; dst[n] != 0; n++) fprintf(log_fp, "%u:%s\n", n + 1, dst[n]); @@ -413,7 +428,7 @@ make_namelist(char *src) } static bool -matches(const char **needle, const char *haystack) +matches(char **needle, const char *haystack) /* does entry in needle list match |-separated field in haystack? */ { bool code = FALSE; @@ -468,7 +483,7 @@ main(int argc, char *argv[]) bool limited = TRUE; char *tversion = (char *) NULL; const char *source_file = "terminfo"; - const char **namelst = 0; + char **namelst = 0; char *outdir = (char *) NULL; bool check_only = FALSE; bool suppress_untranslatable = FALSE; @@ -784,6 +799,9 @@ main(int argc, char *argv[]) else fprintf(log_fp, "No entries written\n"); } +#if NO_LEAKS + free_namelist(namelst); +#endif cleanup(); ExitProgram(EXIT_SUCCESS); } diff --git a/test/bs.c b/test/bs.c index ce74f566..4330f902 100644 --- a/test/bs.c +++ b/test/bs.c @@ -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 * @@ -34,7 +34,7 @@ * v2.0 featuring strict ANSI/POSIX conformance, November 1993. * v2.1 with ncurses mouse support, September 1995 * - * $Id: bs.c,v 1.44 2006/05/20 15:38:52 tom Exp $ + * $Id: bs.c,v 1.45 2007/04/07 17:13:11 tom Exp $ */ #include @@ -459,7 +459,7 @@ initgame(void) do { c = getch(); } while - (!strchr("hjklrR", c) || c == FF); + (!(strchr("hjklrR", c) || c == FF)); if (c == FF) { (void) clearok(stdscr, TRUE); diff --git a/test/cardfile.c b/test/cardfile.c index 2985b2ed..04816949 100644 --- a/test/cardfile.c +++ b/test/cardfile.c @@ -29,7 +29,7 @@ /* * Author: Thomas E. Dickey * - * $Id: cardfile.c,v 1.29 2007/03/10 19:16:45 tom Exp $ + * $Id: cardfile.c,v 1.30 2007/04/07 17:07:34 tom Exp $ * * File format: text beginning in column 1 is a title; other text is content. */ @@ -136,13 +136,15 @@ add_content(CARD * card, const char *content) if ((offset = strlen(card->content)) != 0) { total += 1 + offset; card->content = (char *) realloc(card->content, total + 1); - strcpy(card->content + offset++, " "); + if (card->content) + strcpy(card->content + offset++, " "); } else { if (card->content != 0) free(card->content); card->content = (char *) malloc(total + 1); } - strcpy(card->content + offset, content); + if (card->content) + strcpy(card->content + offset, content); } } diff --git a/test/demo_defkey.c b/test/demo_defkey.c index 7f70f8ac..00c1cf30 100644 --- a/test/demo_defkey.c +++ b/test/demo_defkey.c @@ -1,5 +1,5 @@ /**************************************************************************** - * Copyright (c) 2002-2005,2006 Free Software Foundation, Inc. * + * Copyright (c) 2002-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 * @@ -26,7 +26,7 @@ * authorization. * ****************************************************************************/ /* - * $Id: demo_defkey.c,v 1.16 2006/04/01 19:08:03 tom Exp $ + * $Id: demo_defkey.c,v 1.17 2007/04/07 17:13:03 tom Exp $ * * Demonstrate the define_key() function. * Thomas Dickey - 2002/11/23 @@ -143,13 +143,12 @@ really_define_key(WINDOW *win, const char *new_string, int code) code_name); } log_last_line(win); + if (vis_string != 0) { free(vis_string); vis_string = 0; } - if (vis_string != 0) - free(vis_string); vis_string = visible(new_string); if ((rc = key_defined(new_string)) > 0) { wprintw(win, "%s was bound to %s\n", vis_string, keyname(rc));