aboutsummaryrefslogtreecommitdiff
path: root/c++
diff options
context:
space:
mode:
Diffstat (limited to 'c++')
-rw-r--r--c++/Makefile.in42
-rw-r--r--c++/NEWS16
-rw-r--r--c++/README-first6
-rw-r--r--c++/cursesapp.h6
-rw-r--r--c++/cursesf.cc10
-rw-r--r--c++/cursesf.h33
-rw-r--r--c++/cursesm.cc10
-rw-r--r--c++/cursesm.h12
-rw-r--r--c++/cursesp.h13
-rw-r--r--c++/cursesw.h18
-rw-r--r--c++/cursslk.cc10
-rw-r--r--c++/cursslk.h7
-rw-r--r--c++/demo.cc12
-rwxr-xr-xc++/edit_cfg.sh20
-rw-r--r--c++/etip.h.in33
15 files changed, 150 insertions, 98 deletions
diff --git a/c++/Makefile.in b/c++/Makefile.in
index c1c0db703cf8..99f21da480fa 100644
--- a/c++/Makefile.in
+++ b/c++/Makefile.in
@@ -1,4 +1,4 @@
-# $Id: Makefile.in,v 1.128 2021/01/23 20:42:08 tom Exp $
+# $Id: Makefile.in,v 1.133 2021/07/03 18:53:57 tom Exp $
##############################################################################
# Copyright 2018-2020,2021 Thomas E. Dickey #
# Copyright 1998-2015,2016 Free Software Foundation, Inc. #
@@ -68,7 +68,7 @@ LIBTOOL_UNINSTALL = @LIB_UNINSTALL@
LIBTOOL_VERSION = @LIBTOOL_VERSION@
LT_UNDEF = @LT_UNDEF@
-INSTALL = @INSTALL@
+INSTALL = @INSTALL@
INSTALL_LIB = $(INSTALL) @INSTALL_LIB@
INSTALL_DATA = @INSTALL_DATA@
INSTALL_OPT_P = @INSTALL_OPT_P@
@@ -128,6 +128,10 @@ LIBNAME = @LIB_PREFIX@$(LIBROOT)@CXX_LIB_SUFFIX@
LIBRARIES = @Libs_To_Make@
+LINT = @LINT@
+LINT_OPTS = @LINT_OPTS@
+LINT_LIBS = -lncurses @LIBS@
+
LINK_FLAGS = @EXTRA_LDFLAGS@ -L../lib -l$(LIBROOT)@USE_LIB_SUFFIX@
RPATH_LIST = @RPATH_LIST@
MK_SHARED_LIB = @MK_SHARED_LIB@
@@ -140,7 +144,7 @@ LINK_SHARED = $(LINK_FLAGS)
# flags for test-programs
TEST_LIBS = @TEST_LIBS@
-TEST_ARGS = @LDFLAGS_STATIC@ @TEST_ARGS@ @LDFLAGS_SHARED@
+TEST_ARGS = @LDFLAGS_STATIC@ @TEST_ARGS@ @LDFLAGS_SHARED@
TEST_LDFLAGS = $(TEST_ARGS) @LDFLAGS@ \
@LD_MODEL@ $(TEST_LIBS) @LIBS@ @LOCAL_LDFLAGS@ $(CXXLIBS)
@@ -159,15 +163,31 @@ LDFLAGS = $(TEST_ARGS) @LDFLAGS@ \
AUTO_SRC = \
etip.h
+################################################################################
+
+@MAKE_PHONY@.PHONY : all
+@MAKE_PHONY@.PHONY : check
+@MAKE_PHONY@.PHONY : clean
+@MAKE_PHONY@.PHONY : depend
+@MAKE_PHONY@.PHONY : distclean
+@MAKE_PHONY@.PHONY : install
+@MAKE_PHONY@.PHONY : install.libs
+@MAKE_PHONY@.PHONY : libs
+@MAKE_PHONY@.PHONY : mostlyclean
+@MAKE_PHONY@.PHONY : realclean
+@MAKE_PHONY@.PHONY : sources
+@MAKE_PHONY@.PHONY : uninstall
+@MAKE_PHONY@.PHONY : uninstall.libs
+
all \
libs :: $(AUTO_SRC) $(LIBRARIES)
@MAKE_TESTS@all :: demo$x
-sources : $(AUTO_SRC)
-
depend :
+sources : $(AUTO_SRC)
+
tags:
$(CTAGS) *.[h] *.cc
@@ -255,6 +275,18 @@ etip.h: $(srcdir)/etip.h.in $(srcdir)/edit_cfg.sh
cp $(srcdir)/etip.h.in $@
$(SHELL) $(srcdir)/edit_cfg.sh ../include/ncurses_cfg.h $@
+# Verify that each header-file can be compiled without including another.
+check ::
+ @$(SHELL) -c "for header in *.h;\
+ do \
+ [ \$${header} = etip.h ] && continue; \
+ echo \"** testing \$${header}\" ; \
+ echo \"#include <\$${header}>\" >headers.cc; \
+ echo \"int main(int argc, char **argv) { (void) argc; (void) argv; return 0; }\" >>headers.cc; \
+ $(CXX) -c $(CXXFLAGS) $(CPPFLAGS) headers.cc; \
+ done"
+ -@rm -f headers.*
+
###############################################################################
# The remainder of this file is automatically generated during configuration
###############################################################################
diff --git a/c++/NEWS b/c++/NEWS
index 69948934dc1a..998e5ff3c0bf 100644
--- a/c++/NEWS
+++ b/c++/NEWS
@@ -1,5 +1,5 @@
-------------------------------------------------------------------------------
--- Copyright 2020 Thomas E. Dickey --
+-- Copyright 2020,2021 Thomas E. Dickey --
-- Copyright 1998-1999,2006 Free Software Foundation, Inc. --
-- --
-- Permission is hereby granted, free of charge, to any person obtaining a --
@@ -26,7 +26,7 @@
-- sale, use or other dealings in this Software without prior written --
-- authorization. --
-------------------------------------------------------------------------------
--- $Id: NEWS,v 1.5 2020/02/02 23:34:34 tom Exp $
+-- $Id: NEWS,v 1.6 2021/06/17 21:20:30 tom Exp $
-------------------------------------------------------------------------------
This is a log of changes that the ncurses C++ binding has gone
through starting with the integration of menu and forms integration
@@ -37,19 +37,19 @@ into the binding.
to view the pad.
970908 + Improve NCursesWindow class: added additional methods to
- cover more ncurses functionality. Make refresh() and
+ cover more ncurses functionality. Make refresh() and
noutrefresh() virtual members to allow different implementation
in the NCursesPanel class.
+ CAUTION: changed order of parameters in vline() and hline() of
NCursesWindow class.
+ Make refresh() in NCursesPanel non-static, it is now a
- reimplementation of refresh() in the base class. Added
+ reimplementation of refresh() in the base class. Added
noutrefresh() to NCursesPanel.
+ Added NCursesForm and related classes to support libform
functionality.
+ Moved most of configuration related stuff from cursesw.h to
etip.h
- + Added NCursesApplication class to support easy configuration
+ + Added NCursesApplication class to support easy configuration
of menu and forms related attributes as well as ripped of
title lines and Soft-Label-Keys for an application.
+ Support of Auto-Cleanup for a menus fieldlist.
@@ -63,10 +63,10 @@ into the binding.
+ Added the NCursesMenu class to support libmenu functionality.
+ The inheritace relation between NCursesWindow and NCursesColorWindow
was kind of brain damage. Monochrome is a special case of colored, so
- the relation should be just the opposite. This would allow all
- derived classes like NCursesPanel, NCursesMenu or NCursesForm to
+ the relation should be just the opposite. This would allow all
+ derived classes like NCursesPanel, NCursesMenu or NCursesForm to
have colors.
- To resolve that design flaw I put the color functionality into the
+ To resolve that design flaw I put the color functionality into the
NCursesWindow class and it can be switched on by the static member
useColors(). NCursesColorWindow is still there for compatibility
reasons.
diff --git a/c++/README-first b/c++/README-first
index 374328f36ab8..313c1f8e710d 100644
--- a/c++/README-first
+++ b/c++/README-first
@@ -1,5 +1,5 @@
-------------------------------------------------------------------------------
--- Copyright 2020 Thomas E. Dickey --
+-- Copyright 2020,2021 Thomas E. Dickey --
-- Copyright 1998-2006,2007 Free Software Foundation, Inc. --
-- --
-- Permission is hereby granted, free of charge, to any person obtaining a --
@@ -26,7 +26,7 @@
-- sale, use or other dealings in this Software without prior written --
-- authorization. --
-------------------------------------------------------------------------------
--- $Id: README-first,v 1.10 2020/02/02 23:34:34 tom Exp $
+-- $Id: README-first,v 1.11 2021/06/17 21:20:30 tom Exp $
-------------------------------------------------------------------------------
C++ interface to ncurses routines
-----------------------------------------------------------------------
@@ -45,7 +45,7 @@ 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.
-The next enhancement is color support. It was originally provided by a
+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
base class so that any derived class may use color support also.
diff --git a/c++/cursesapp.h b/c++/cursesapp.h
index 9d7b8a3958c2..1296f374e984 100644
--- a/c++/cursesapp.h
+++ b/c++/cursesapp.h
@@ -1,6 +1,6 @@
// * This makes emacs happy -*-Mode: C++;-*-
/****************************************************************************
- * Copyright 2019,2020 Thomas E. Dickey *
+ * Copyright 2019-2020,2021 Thomas E. Dickey *
* Copyright 1998-2005,2011 Free Software Foundation, Inc. *
* *
* Permission is hereby granted, free of charge, to any person obtaining a *
@@ -32,7 +32,7 @@
* Author: Juergen Pfeifer, 1997 *
****************************************************************************/
-// $Id: cursesapp.h,v 1.17 2020/08/29 16:22:03 juergen Exp $
+// $Id: cursesapp.h,v 1.18 2021/06/17 21:26:02 tom Exp $
#ifndef NCURSES_CURSESAPP_H_incl
#define NCURSES_CURSESAPP_H_incl
@@ -187,5 +187,5 @@ public:
}
};
-
+
#endif /* NCURSES_CURSESAPP_H_incl */
diff --git a/c++/cursesf.cc b/c++/cursesf.cc
index fcf0080f9db5..5d316489ea00 100644
--- a/c++/cursesf.cc
+++ b/c++/cursesf.cc
@@ -1,6 +1,6 @@
// * this is for making emacs happy: -*-Mode: C++;-*-
/****************************************************************************
- * Copyright 2019,2020 Thomas E. Dickey *
+ * Copyright 2019-2020,2021 Thomas E. Dickey *
* Copyright 1998-2005,2011 Free Software Foundation, Inc. *
* *
* Permission is hereby granted, free of charge, to any person obtaining a *
@@ -36,7 +36,7 @@
#include "cursesf.h"
#include "cursesapp.h"
-MODULE_ID("$Id: cursesf.cc,v 1.25 2020/07/18 19:57:11 anonymous.maarten Exp $")
+MODULE_ID("$Id: cursesf.cc,v 1.26 2021/04/17 18:11:08 tom Exp $")
NCursesFormField::~NCursesFormField () THROWS(NCursesException)
{
@@ -285,15 +285,15 @@ NCursesFormField*
NCursesForm::operator()(void)
{
int drvCmnd;
- int err;
int c;
post();
show();
refresh();
- while (((drvCmnd = virtualize((c=getKey()))) != CMD_QUIT)) {
- switch((err=driver(drvCmnd))) {
+ while (((drvCmnd = virtualize((c = getKey()))) != CMD_QUIT)) {
+ int err;
+ switch((err = driver(drvCmnd))) {
case E_REQUEST_DENIED:
On_Request_Denied(c);
break;
diff --git a/c++/cursesf.h b/c++/cursesf.h
index c7000948e16e..e29e7adbf6f0 100644
--- a/c++/cursesf.h
+++ b/c++/cursesf.h
@@ -1,6 +1,7 @@
// * This makes emacs happy -*-Mode: C++;-*-
+// vile:cppmode
/****************************************************************************
- * Copyright 2019,2020 Thomas E. Dickey *
+ * Copyright 2019-2021,2022 Thomas E. Dickey *
* Copyright 1998-2012,2014 Free Software Foundation, Inc. *
* *
* Permission is hereby granted, free of charge, to any person obtaining a *
@@ -32,7 +33,7 @@
* Author: Juergen Pfeifer, 1997 *
****************************************************************************/
-// $Id: cursesf.h,v 1.37 2020/07/18 19:57:11 anonymous.maarten Exp $
+// $Id: cursesf.h,v 1.39 2022/08/20 20:52:15 tom Exp $
#ifndef NCURSES_CURSESF_H_incl
#define NCURSES_CURSESF_H_incl 1
@@ -500,21 +501,21 @@ public:
}
// Decorations
- inline void frame(const char *title=NULL, const char* btitle=NULL) {
+ inline void frame(const char *title=NULL, const char* btitle=NULL) NCURSES_OVERRIDE {
if (b_framed)
NCursesPanel::frame(title,btitle);
else
OnError(E_SYSTEM_ERROR);
}
- inline void boldframe(const char *title=NULL, const char* btitle=NULL) {
+ inline void boldframe(const char *title=NULL, const char* btitle=NULL) NCURSES_OVERRIDE {
if (b_framed)
NCursesPanel::boldframe(title,btitle);
else
OnError(E_SYSTEM_ERROR);
}
- inline void label(const char *topLabel, const char *bottomLabel) {
+ inline void label(const char *topLabel, const char *bottomLabel) NCURSES_OVERRIDE {
if (b_framed)
NCursesPanel::label(topLabel,bottomLabel);
else
@@ -726,12 +727,12 @@ class NCURSES_CXX_IMPEXP Alpha_Field : public NCursesFieldType
private:
int min_field_width;
- void set(NCursesFormField& f) {
+ void set(NCursesFormField& f) NCURSES_OVERRIDE {
OnError(::set_field_type(f.get_field(),fieldtype,min_field_width));
}
public:
- Alpha_Field(int width)
+ explicit Alpha_Field(int width)
: NCursesFieldType(TYPE_ALPHA),
min_field_width(width) {
}
@@ -742,12 +743,12 @@ class NCURSES_CXX_IMPEXP Alphanumeric_Field : public NCursesFieldType
private:
int min_field_width;
- void set(NCursesFormField& f) {
+ void set(NCursesFormField& f) NCURSES_OVERRIDE {
OnError(::set_field_type(f.get_field(),fieldtype,min_field_width));
}
public:
- Alphanumeric_Field(int width)
+ explicit Alphanumeric_Field(int width)
: NCursesFieldType(TYPE_ALNUM),
min_field_width(width) {
}
@@ -759,7 +760,7 @@ private:
int precision;
long lower_limit, upper_limit;
- void set(NCursesFormField& f) {
+ void set(NCursesFormField& f) NCURSES_OVERRIDE {
OnError(::set_field_type(f.get_field(),fieldtype,
precision,lower_limit,upper_limit));
}
@@ -777,7 +778,7 @@ private:
int precision;
double lower_limit, upper_limit;
- void set(NCursesFormField& f) {
+ void set(NCursesFormField& f) NCURSES_OVERRIDE {
OnError(::set_field_type(f.get_field(),fieldtype,
precision,lower_limit,upper_limit));
}
@@ -794,7 +795,7 @@ class NCURSES_CXX_IMPEXP Regular_Expression_Field : public NCursesFieldType
private:
char* regex;
- void set(NCursesFormField& f) {
+ void set(NCursesFormField& f) NCURSES_OVERRIDE {
OnError(::set_field_type(f.get_field(),fieldtype,regex));
}
@@ -805,7 +806,7 @@ private:
}
public:
- Regular_Expression_Field(const char *expr)
+ explicit Regular_Expression_Field(const char *expr)
: NCursesFieldType(TYPE_REGEXP),
regex(NULL)
{
@@ -841,7 +842,7 @@ private:
int case_sensitive;
int non_unique_matches;
- void set(NCursesFormField& f) {
+ void set(NCursesFormField& f) NCURSES_OVERRIDE {
OnError(::set_field_type(f.get_field(),fieldtype,
list,case_sensitive,non_unique_matches));
}
@@ -876,7 +877,7 @@ public:
class NCURSES_CXX_IMPEXP IPV4_Address_Field : public NCursesFieldType
{
private:
- void set(NCursesFormField& f) {
+ void set(NCursesFormField& f) NCURSES_OVERRIDE {
OnError(::set_field_type(f.get_field(),fieldtype));
}
@@ -911,7 +912,7 @@ protected:
friend bool _nc_xx_fld_ccheck(int c, const void *);
friend void* _nc_xx_fld_makearg(va_list*);
- void set(NCursesFormField& f) {
+ void set(NCursesFormField& f) NCURSES_OVERRIDE {
OnError(::set_field_type(f.get_field(),fieldtype,&f));
}
diff --git a/c++/cursesm.cc b/c++/cursesm.cc
index 2215a16891c6..64f36358cd99 100644
--- a/c++/cursesm.cc
+++ b/c++/cursesm.cc
@@ -1,6 +1,6 @@
// * this is for making emacs happy: -*-Mode: C++;-*-
/****************************************************************************
- * Copyright 2019,2020 Thomas E. Dickey *
+ * Copyright 2019-2020,2021 Thomas E. Dickey *
* Copyright 1998-2011,2017 Free Software Foundation, Inc. *
* *
* Permission is hereby granted, free of charge, to any person obtaining a *
@@ -36,7 +36,7 @@
#include "cursesm.h"
#include "cursesapp.h"
-MODULE_ID("$Id: cursesm.cc,v 1.26 2020/02/02 23:34:34 tom Exp $")
+MODULE_ID("$Id: cursesm.cc,v 1.27 2021/04/17 18:11:08 tom Exp $")
NCursesMenuItem::~NCursesMenuItem() THROWS(NCursesException)
{
@@ -301,7 +301,6 @@ NCursesMenuItem*
NCursesMenu::operator()(void)
{
int drvCmnd;
- int err;
int c;
bool b_action = FALSE;
@@ -309,9 +308,10 @@ NCursesMenu::operator()(void)
show();
refresh();
- while (!b_action && ((drvCmnd = virtualize((c=getKey()))) != CMD_QUIT)) {
+ while (!b_action && ((drvCmnd = virtualize((c = getKey()))) != CMD_QUIT)) {
+ int err;
- switch((err=driver(drvCmnd))) {
+ switch((err = driver(drvCmnd))) {
case E_REQUEST_DENIED:
On_Request_Denied(c);
break;
diff --git a/c++/cursesm.h b/c++/cursesm.h
index 383c7e12507e..9651195fd9d2 100644
--- a/c++/cursesm.h
+++ b/c++/cursesm.h
@@ -1,6 +1,6 @@
// * This makes emacs happy -*-Mode: C++;-*-
/****************************************************************************
- * Copyright 2019,2020 Thomas E. Dickey *
+ * Copyright 2019-2020,2022 Thomas E. Dickey *
* Copyright 1998-2012,2014 Free Software Foundation, Inc. *
* *
* Permission is hereby granted, free of charge, to any person obtaining a *
@@ -32,7 +32,7 @@
* Author: Juergen Pfeifer, 1997 *
****************************************************************************/
-// $Id: cursesm.h,v 1.34 2020/05/24 01:40:20 anonymous.maarten Exp $
+// $Id: cursesm.h,v 1.35 2022/08/20 20:52:15 tom Exp $
#ifndef NCURSES_CURSESM_H_incl
#define NCURSES_CURSESM_H_incl 1
@@ -182,7 +182,7 @@ public:
virtual ~NCursesMenuCallbackItem() THROWS(NCursesException);
- bool action();
+ bool action() NCURSES_OVERRIDE;
};
// This are the built-in hook functions in this C++ binding. In C++ we use
@@ -512,21 +512,21 @@ public:
}
// Decorations
- inline void frame(const char *title=NULL, const char* btitle=NULL) {
+ inline void frame(const char *title=NULL, const char* btitle=NULL) NCURSES_OVERRIDE {
if (b_framed)
NCursesPanel::frame(title,btitle);
else
OnError(E_SYSTEM_ERROR);
}
- inline void boldframe(const char *title=NULL, const char* btitle=NULL) {
+ inline void boldframe(const char *title=NULL, const char* btitle=NULL) NCURSES_OVERRIDE {
if (b_framed)
NCursesPanel::boldframe(title,btitle);
else
OnError(E_SYSTEM_ERROR);
}
- inline void label(const char *topLabel, const char *bottomLabel) {
+ inline void label(const char *topLabel, const char *bottomLabel) NCURSES_OVERRIDE {
if (b_framed)
NCursesPanel::label(topLabel,bottomLabel);
else
diff --git a/c++/cursesp.h b/c++/cursesp.h
index eb9111b7aedd..f0bd5c9cdfff 100644
--- a/c++/cursesp.h
+++ b/c++/cursesp.h
@@ -1,6 +1,7 @@
// * This makes emacs happy -*-Mode: C++;-*-
+// vile:cppmode
/****************************************************************************
- * Copyright 2019,2020 Thomas E. Dickey *
+ * Copyright 2019-2021,2022 Thomas E. Dickey *
* Copyright 1998-2012,2014 Free Software Foundation, Inc. *
* *
* Permission is hereby granted, free of charge, to any person obtaining a *
@@ -35,7 +36,7 @@
#ifndef NCURSES_CURSESP_H_incl
#define NCURSES_CURSESP_H_incl 1
-// $Id: cursesp.h,v 1.34 2020/05/24 01:40:20 anonymous.maarten Exp $
+// $Id: cursesp.h,v 1.36 2022/08/20 20:52:15 tom Exp $
#include <cursesw.h>
@@ -161,7 +162,7 @@ public:
// N.B.: The panel associated with ::stdscr is always on the bottom. So
// actually bottom() makes the panel the first above ::stdscr.
- virtual int mvwin(int y, int x)
+ virtual int mvwin(int y, int x) NCURSES_OVERRIDE
{
OnError(::move_panel(p, y, x));
return OK;
@@ -194,11 +195,11 @@ public:
// Those two are rewrites of the corresponding virtual members of
// NCursesWindow
- virtual int refresh();
+ virtual int refresh() NCURSES_OVERRIDE;
// Propagate all panel changes to the virtual screen and update the
// physical screen.
- virtual int noutrefresh();
+ virtual int noutrefresh() NCURSES_OVERRIDE;
// Propagate all panel changes to the virtual screen.
static void redraw();
@@ -243,7 +244,7 @@ public:
// This creates an user panel of the requested size with associated
// user data pointed to by p_UserData.
- NCursesUserPanel(const T* p_UserData = STATIC_CAST(T*)(0)) : NCursesPanel()
+ explicit NCursesUserPanel(const T* p_UserData = STATIC_CAST(T*)(0)) : NCursesPanel()
{
if (p)
set_user(const_cast<void *>(reinterpret_cast<const void*>(p_UserData)));
diff --git a/c++/cursesw.h b/c++/cursesw.h
index 602b7a965091..eef5a631c995 100644
--- a/c++/cursesw.h
+++ b/c++/cursesw.h
@@ -1,7 +1,7 @@
// * This makes emacs happy -*-Mode: C++;-*-
// vile:cppmode
/****************************************************************************
- * Copyright 2019,2020 Thomas E. Dickey *
+ * Copyright 2019-2021,2022 Thomas E. Dickey *
* Copyright 1998-2014,2017 Free Software Foundation, Inc. *
* *
* Permission is hereby granted, free of charge, to any person obtaining a *
@@ -32,7 +32,7 @@
#ifndef NCURSES_CURSESW_H_incl
#define NCURSES_CURSESW_H_incl 1
-// $Id: cursesw.h,v 1.57 2020/07/04 20:38:43 tom Exp $
+// $Id: cursesw.h,v 1.59 2022/08/20 20:52:15 tom Exp $
extern "C" {
# include <curses.h>
@@ -816,7 +816,7 @@ protected:
NCursesWindow();
public:
- NCursesWindow(WINDOW* window); // useful only for stdscr
+ explicit NCursesWindow(WINDOW* window); // useful only for stdscr
NCursesWindow(int nlines, // number of lines
int ncols, // number of columns
@@ -1385,7 +1385,7 @@ public:
class NCURSES_CXX_IMPEXP NCursesColorWindow : public NCursesWindow
{
public:
- NCursesColorWindow(WINDOW* &window) // useful only for stdscr
+ explicit NCursesColorWindow(WINDOW* &window) // useful only for stdscr
: NCursesWindow(window) {
useColors(); }
@@ -1503,7 +1503,7 @@ public:
// Put the attributed character onto the pad and immediately do a
// prefresh().
- int refresh();
+ int refresh() NCURSES_OVERRIDE;
// If a viewport is defined the pad is displayed in this window, otherwise
// this is a noop.
@@ -1517,7 +1517,7 @@ public:
// on the screen. <b>refresh</b> copies a rectangle of this size beginning
// with top left corner pminrow,pmincol onto the screen and calls doupdate().
- int noutrefresh();
+ int noutrefresh() NCURSES_OVERRIDE;
// If a viewport is defined the pad is displayed in this window, otherwise
// this is a noop.
@@ -1547,7 +1547,7 @@ public:
class NCURSES_CXX_IMPEXP NCursesFramedPad : public NCursesPad
{
protected:
- virtual void OnOperation(int pad_req);
+ virtual void OnOperation(int pad_req) NCURSES_OVERRIDE;
public:
NCursesFramedPad(NCursesWindow& win, int nlines, int ncols,
@@ -1562,7 +1562,7 @@ public:
delete getSubWindow();
}
- void setWindow(NCursesWindow& view, int v_grid = 1, int h_grid = 1) {
+ void setWindow(NCursesWindow& view, int v_grid = 1, int h_grid = 1) NCURSES_OVERRIDE {
(void) view;
(void) v_grid;
(void) h_grid;
@@ -1570,7 +1570,7 @@ public:
}
// Disable this call; the viewport is already defined
- void setSubWindow(NCursesWindow& sub) {
+ void setSubWindow(NCursesWindow& sub) NCURSES_OVERRIDE {
(void) sub;
err_handler("Operation not allowed");
}
diff --git a/c++/cursslk.cc b/c++/cursslk.cc
index 9922163cd360..7b898cefff7d 100644
--- a/c++/cursslk.cc
+++ b/c++/cursslk.cc
@@ -1,6 +1,6 @@
// * this is for making emacs happy: -*-Mode: C++;-*-
/****************************************************************************
- * Copyright 2019,2020 Thomas E. Dickey *
+ * Copyright 2019-2022,2023 Thomas E. Dickey *
* Copyright 1998-2005,2012 Free Software Foundation, Inc. *
* *
* Permission is hereby granted, free of charge, to any person obtaining a *
@@ -36,7 +36,7 @@
#include "cursslk.h"
#include "cursesapp.h"
-MODULE_ID("$Id: cursslk.cc,v 1.19 2020/07/18 19:57:11 anonymous.maarten Exp $")
+MODULE_ID("$Id: cursslk.cc,v 1.21 2023/02/25 23:36:06 tom Exp $")
Soft_Label_Key_Set::Soft_Label_Key&
Soft_Label_Key_Set::Soft_Label_Key::operator=(char *text)
@@ -56,7 +56,11 @@ Soft_Label_Key_Set::Label_Layout
void Soft_Label_Key_Set::init()
{
- slk_array = new Soft_Label_Key[num_labels];
+ if (num_labels > 12)
+ num_labels = 12;
+ if (num_labels < 0)
+ num_labels = 0;
+ slk_array = new Soft_Label_Key[num_labels + 1];
for(int i=0; i < num_labels; i++) {
slk_array[i].num = i+1;
}
diff --git a/c++/cursslk.h b/c++/cursslk.h
index 4a34400916d3..66564fe3a479 100644
--- a/c++/cursslk.h
+++ b/c++/cursslk.h
@@ -1,6 +1,7 @@
// * this is for making emacs happy: -*-Mode: C++;-*-
+// vile:cppmode
/****************************************************************************
- * Copyright 2019,2020 Thomas E. Dickey *
+ * Copyright 2019-2020,2021 Thomas E. Dickey *
* Copyright 1998-2003,2005 Free Software Foundation, Inc. *
* *
* Permission is hereby granted, free of charge, to any person obtaining a *
@@ -32,7 +33,7 @@
* Author: Juergen Pfeifer, 1997 *
****************************************************************************/
-// $Id: cursslk.h,v 1.18 2020/07/18 19:57:11 anonymous.maarten Exp $
+// $Id: cursslk.h,v 1.19 2021/04/17 18:11:08 tom Exp $
#ifndef NCURSES_CURSSLK_H_incl
#define NCURSES_CURSSLK_H_incl
@@ -140,7 +141,7 @@ public:
// You must create a Soft_Label_Key_Set before you create any object of
// the NCursesWindow, NCursesPanel or derived classes. (Actually before
// ::initscr() is called).
- Soft_Label_Key_Set(Label_Layout fmt);
+ explicit Soft_Label_Key_Set(Label_Layout fmt);
// This constructor assumes, that you already constructed a Key Set
// with a layout by the constructor above. This layout will be reused.
diff --git a/c++/demo.cc b/c++/demo.cc
index 6996097b0f97..7d300ff38b4e 100644
--- a/c++/demo.cc
+++ b/c++/demo.cc
@@ -1,6 +1,6 @@
// * This makes emacs happy -*-Mode: C++;-*-
/****************************************************************************
- * Copyright 2018-2019,2020 Thomas E. Dickey *
+ * Copyright 2018-2021,2023 Thomas E. Dickey *
* Copyright 1998-2012,2017 Free Software Foundation, Inc. *
* *
* Permission is hereby granted, free of charge, to any person obtaining a *
@@ -36,7 +36,7 @@
* Demo code for NCursesMenu and NCursesForm written by
* Juergen Pfeifer
*
- * $Id: demo.cc,v 1.49 2020/09/13 00:47:00 tom Exp $
+ * $Id: demo.cc,v 1.52 2023/08/26 19:14:14 tom Exp $
*/
#include "internal.h"
@@ -46,6 +46,7 @@
#if (defined(_WIN32) || defined(_WIN64))
#undef KEY_EVENT
+#undef sleep
#define sleep(n) Sleep(n)
#else
extern "C" unsigned int sleep(unsigned int);
@@ -104,7 +105,7 @@ class SillyDemo
}
// A refresh to any valid panel updates all panels and refreshes
- // the screen. Using mystd is just convenient - We know it's always
+ // the screen. Using mystd is just convenient - We know it is always
// valid until the end of the program.
mystd->refresh();
@@ -168,7 +169,7 @@ public:
//
// -------------------------------------------------------------------------
//
-template<class T> class MyAction : public NCursesUserItem<T>
+template<class T> class NCURSES_CXX_IMPEXP MyAction : public NCursesUserItem<UserData>
{
public:
MyAction (const char* p_name,
@@ -185,9 +186,6 @@ public:
}
};
-template class MyAction<UserData>;
-template class NCURSES_CXX_IMPEXP NCursesUserItem<UserData>;
-
class QuitItem : public NCursesMenuItem
{
public:
diff --git a/c++/edit_cfg.sh b/c++/edit_cfg.sh
index 92ab0b1fbdc5..928f7fdfb7dd 100755
--- a/c++/edit_cfg.sh
+++ b/c++/edit_cfg.sh
@@ -1,7 +1,7 @@
#!/bin/sh
-# $Id: edit_cfg.sh,v 1.18 2020/02/02 23:34:34 tom Exp $
+# $Id: edit_cfg.sh,v 1.19 2022/07/16 18:00:59 tom Exp $
##############################################################################
-# Copyright 2020 Thomas E. Dickey #
+# Copyright 2020,2022 Thomas E. Dickey #
# Copyright 1998-2007,2008 Free Software Foundation, Inc. #
# #
# Permission is hereby granted, free of charge, to any person obtaining a #
@@ -51,22 +51,22 @@ for name in \
HAVE_VALUES_H \
IOSTREAM_NAMESPACE
do
- rm -f $2.bak
- mv $2 $2.bak
- if ( grep "[ ]$name[ ]1" $1 2>&1 >/dev/null)
+ rm -f "$2".bak
+ mv "$2" "$2".bak
+ if ( grep "[ ]${name}[ ]1" "$1" >/dev/null 2>&1)
then
value=1
- sed -e 's/define '$name'.*$/define '$name' 1/' $2.bak >$2
+ sed -e 's/define '"$name"'.*$/define '"$name"' 1/' "$2".bak >"$2"
else
value=0
- sed -e 's/define '$name'.*$/define '$name' 0/' $2.bak >$2
+ sed -e 's/define '"$name"'.*$/define '"$name"' 0/' "$2".bak >"$2"
fi
- if (cmp -s $2 $2.bak)
+ if (cmp -s "$2" "$2".bak)
then
echo '... '$name $value
- mv $2.bak $2
+ mv "$2".bak "$2"
else
echo '... '$name $value
- rm -f $2.bak
+ rm -f "$2".bak
fi
done
diff --git a/c++/etip.h.in b/c++/etip.h.in
index 6dc41042e61d..70842ef6b4c6 100644
--- a/c++/etip.h.in
+++ b/c++/etip.h.in
@@ -1,6 +1,6 @@
// * This makes emacs happy -*-Mode: C++;-*-
/****************************************************************************
- * Copyright 2018,2020 Thomas E. Dickey *
+ * Copyright 2018-2021,2022 Thomas E. Dickey *
* Copyright 1998-2012,2017 Free Software Foundation, Inc. *
* *
* Permission is hereby granted, free of charge, to any person obtaining a *
@@ -32,7 +32,7 @@
* Author: Juergen Pfeifer, 1997 *
****************************************************************************/
-// $Id: etip.h.in,v 1.45 2020/05/24 01:40:20 anonymous.maarten Exp $
+// $Id: etip.h.in,v 1.50 2022/08/20 20:50:00 tom Exp $
#ifndef NCURSES_ETIP_H_incl
#define NCURSES_ETIP_H_incl 1
@@ -70,6 +70,10 @@
#define ETIP_NEEDS_MATH_EXCEPTION 0
#endif
+#ifndef CPP_HAS_OVERRIDE
+#define CPP_HAS_OVERRIDE 0
+#endif
+
#ifndef CPP_HAS_PARAM_INIT
#define CPP_HAS_PARAM_INIT 0
#endif
@@ -127,6 +131,12 @@ extern "C" {
}
// Language features
+#if CPP_HAS_OVERRIDE
+#define NCURSES_OVERRIDE override
+#else
+#define NCURSES_OVERRIDE /*nothing*/
+#endif
+
#if CPP_HAS_PARAM_INIT
#define NCURSES_PARAM_INIT(value) = value
#else
@@ -139,6 +149,10 @@ extern "C" {
#define STATIC_CAST(s) (s)
#endif
+#ifndef NCURSES_CXX_IMPEXP
+#define NCURSES_CXX_IMPEXP /* nothing */
+#endif
+
// Forward Declarations
class NCURSES_CXX_IMPEXP NCursesPanel;
class NCURSES_CXX_IMPEXP NCursesMenu;
@@ -154,12 +168,13 @@ public:
: message(msg), errorno (err)
{};
- NCursesException (const char* msg)
+ explicit NCursesException (const char* msg)
: message(msg), errorno (E_SYSTEM_ERROR)
{};
NCursesException& operator=(const NCursesException& rhs)
{
+ message = rhs.message;
errorno = rhs.errorno;
return *this;
}
@@ -195,7 +210,7 @@ public:
p (panel)
{};
- NCursesPanelException (int err) :
+ explicit NCursesPanelException (int err) :
NCursesException ("panel library error", err),
p (0)
{};
@@ -220,7 +235,7 @@ public:
{
}
- virtual const char *classname() const {
+ virtual const char *classname() const NCURSES_OVERRIDE {
return "NCursesPanel";
}
@@ -246,7 +261,7 @@ public:
m (menu)
{};
- NCursesMenuException (int err) :
+ explicit NCursesMenuException (int err) :
NCursesException ("menu library error", err),
m (0)
{};
@@ -271,7 +286,7 @@ public:
{
}
- virtual const char *classname() const {
+ virtual const char *classname() const NCURSES_OVERRIDE {
return "NCursesMenu";
}
@@ -297,7 +312,7 @@ public:
f (form)
{};
- NCursesFormException (int err) :
+ explicit NCursesFormException (int err) :
NCursesException ("form library error", err),
f (0)
{};
@@ -322,7 +337,7 @@ public:
{
}
- virtual const char *classname() const {
+ virtual const char *classname() const NCURSES_OVERRIDE {
return "NCursesForm";
}