summaryrefslogtreecommitdiff
path: root/c++
diff options
context:
space:
mode:
Diffstat (limited to 'c++')
-rw-r--r--c++/Makefile.in103
-rw-r--r--c++/NEWS16
-rw-r--r--c++/README-first6
-rw-r--r--c++/cursesapp.cc11
-rw-r--r--c++/cursesapp.h25
-rw-r--r--c++/cursesf.cc21
-rw-r--r--c++/cursesf.h48
-rw-r--r--c++/cursesm.cc10
-rw-r--r--c++/cursesm.h12
-rw-r--r--c++/cursesmain.cc4
-rw-r--r--c++/cursesp.h9
-rw-r--r--c++/cursesw.h27
-rw-r--r--c++/cursslk.cc6
-rw-r--r--c++/cursslk.h25
-rw-r--r--c++/demo.cc26
-rw-r--r--c++/etip.h.in32
-rw-r--r--c++/internal.h8
17 files changed, 244 insertions, 145 deletions
diff --git a/c++/Makefile.in b/c++/Makefile.in
index 9b22b6a..99f21da 100644
--- a/c++/Makefile.in
+++ b/c++/Makefile.in
@@ -1,6 +1,6 @@
-# $Id: Makefile.in,v 1.119 2020/02/02 23:34:34 tom Exp $
+# $Id: Makefile.in,v 1.133 2021/07/03 18:53:57 tom Exp $
##############################################################################
-# Copyright 2018,2020 Thomas E. Dickey #
+# Copyright 2018-2020,2021 Thomas E. Dickey #
# Copyright 1998-2015,2016 Free Software Foundation, Inc. #
# #
# Permission is hereby granted, free of charge, to any person obtaining a #
@@ -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@
@@ -89,7 +89,7 @@ CXXFLAGS = @CXXFLAGS@ @EXTRA_CXXFLAGS@
CXXLIBS = @CXXLIBS@
INCDIR = ../include
-CPPFLAGS = -DHAVE_CONFIG_H -I../c++ @CPPFLAGS@
+CPPFLAGS = -DHAVE_CONFIG_H -DBUILDING_NCURSES_CXX -I../c++ @CPPFLAGS@
CTAGS = @CTAGS@
ETAGS = @ETAGS@
@@ -98,9 +98,9 @@ CC = ${CXX}
CCFLAGS = $(CPPFLAGS) $(CXXFLAGS)
CFLAGS_LIBTOOL = $(CCFLAGS)
-CFLAGS_NORMAL = $(CCFLAGS)
-CFLAGS_DEBUG = $(CCFLAGS) @CXX_G_OPT@ -DTRACE
-CFLAGS_PROFILE = $(CCFLAGS) -pg
+CFLAGS_NORMAL = $(CCFLAGS) -DNCURSES_STATIC
+CFLAGS_DEBUG = $(CCFLAGS) -DNCURSES_STATIC @CXX_G_OPT@ -DTRACE
+CFLAGS_PROFILE = $(CCFLAGS) -DNCURSES_STATIC -pg
CFLAGS_SHARED = $(CCFLAGS) @CC_SHARED_OPTS@
CFLAGS_DEFAULT = $(CFLAGS_@DFT_UPR_MODEL@)
@@ -114,7 +114,11 @@ LOCAL_LIBDIR = @top_builddir@/lib
LINK = @LINK_PROGS@ $(LIBTOOL_LINK) @CXXLDFLAGS@
SHLIB_DIRS = -L../lib
-SHLIB_LIST = $(SHLIB_DIRS) -lform@USE_LIB_SUFFIX@ -lmenu@USE_LIB_SUFFIX@ -lpanel@USE_LIB_SUFFIX@ -lncurses@USE_LIB_SUFFIX@ @SHLIB_LIST@
+SHLIB_LIST = $(SHLIB_DIRS) \
+ -l@FORM_NAME@@USE_LIB_SUFFIX@ \
+ -l@MENU_NAME@@USE_LIB_SUFFIX@ \
+ -l@PANEL_NAME@@USE_LIB_SUFFIX@ \
+ -lncurses@USE_LIB_SUFFIX@ @SHLIB_LIST@
LIBROOT = ncurses++
@@ -124,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@
@@ -136,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)
@@ -155,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
@@ -186,29 +210,34 @@ realclean :: distclean
###############################################################################
-internal_h = $(srcdir)/internal.h \
- $(INCDIR)/ncurses_cfg.h \
- $(INCDIR)/nc_mingw.h \
- $(INCDIR)/nc_string.h
-
-etip_h = etip.h \
- $(INCDIR)/ncurses_dll.h
+HEADER_DEPS = @INTERNALS_HDR@ \
+ etip.h \
+ ../include/curses.h \
+ ../include/eti.h \
+ ../include/form.h \
+ ../include/menu.h \
+ ../include/ncurses_cfg.h \
+ ../include/ncurses_def.h \
+ ../include/ncurses_dll.h \
+ ../include/panel.h \
+ ../include/unctrl.h \
+ $(INCDIR)/nc_string.h \
+ $(srcdir)/cursesp.h \
+ $(srcdir)/cursesw.h \
+ $(srcdir)/cursslk.h \
+ $(srcdir)/internal.h
cursesw_h = $(srcdir)/cursesw.h \
- $(etip_h) \
- $(INCDIR)/curses.h
+ $(HEADER_DEPS)
cursesp_h = $(srcdir)/cursesp.h \
- $(cursesw_h) \
- $(INCDIR)/panel.h
+ $(cursesw_h)
cursesf_h = $(srcdir)/cursesf.h \
- $(cursesp_h) \
- $(INCDIR)/form.h
+ $(cursesp_h)
cursesm_h = $(srcdir)/cursesm.h \
- $(cursesp_h) \
- $(INCDIR)/menu.h
+ $(cursesp_h)
cursslk_h = $(srcdir)/cursslk.h \
$(cursesw_h)
@@ -217,25 +246,25 @@ cursesapp_h = $(srcdir)/cursesapp.h \
$(cursslk_h)
$(INCDIR)/form.h :
- cd ../form && $(MAKE) $@
+ ( cd ../form && $(MAKE) $@ )
$(INCDIR)/menu.h :
- cd ../menu && $(MAKE) $@
+ ( cd ../menu && $(MAKE) $@ )
$(INCDIR)/panel.h :
- cd ../panel && $(MAKE) $@
+ ( cd ../panel && $(MAKE) $@ )
###############################################################################
OBJS_DEMO = $(MODEL)/demo$o
$(MODEL)/demo$o : $(srcdir)/demo.cc \
- $(internal_h) \
+ $(HEADER_DEPS) \
$(cursesf_h) \
$(cursesm_h) \
$(cursesapp_h)
@echo 'compiling demo (obj_s)'
- @$(LIBTOOL_COMPILE) $(CXX) $(CFLAGS_DEFAULT) -c $(srcdir)/demo.cc -o $@
+ @( cd $(MODEL) && $(LIBTOOL_COMPILE) $(CXX) $(CFLAGS_DEFAULT) -c $(top_srcdir)/c++/demo.cc -o $@ )
demo$x: $(OBJS_DEMO) \
$(LIBRARIES) \
@@ -246,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 6994893..998e5ff 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 374328f..313c1f8 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.cc b/c++/cursesapp.cc
index 522c570..81f6098 100644
--- a/c++/cursesapp.cc
+++ b/c++/cursesapp.cc
@@ -36,7 +36,7 @@
#include "internal.h"
#include "cursesapp.h"
-MODULE_ID("$Id: cursesapp.cc,v 1.17 2020/02/02 23:34:34 tom Exp $")
+MODULE_ID("$Id: cursesapp.cc,v 1.18 2020/07/18 19:57:11 anonymous.maarten Exp $")
void
NCursesApplication::init(bool bColors)
@@ -69,6 +69,11 @@ NCursesApplication* NCursesApplication::theApp = 0;
NCursesWindow* NCursesApplication::titleWindow = 0;
NCursesApplication::SLK_Link* NCursesApplication::slk_stack = 0;
+
+NCursesWindow *&NCursesApplication::getTitleWindow() {
+ return titleWindow;
+}
+
NCursesApplication::~NCursesApplication() THROWS(NCursesException)
{
Soft_Label_Key_Set* S;
@@ -87,6 +92,10 @@ NCursesApplication::~NCursesApplication() THROWS(NCursesException)
::endwin();
}
+NCursesApplication* NCursesApplication::getApplication() {
+ return theApp;
+}
+
int NCursesApplication::rinit(NCursesWindow& w)
{
titleWindow = &w;
diff --git a/c++/cursesapp.h b/c++/cursesapp.h
index a09a3b6..1296f37 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,14 +32,25 @@
* Author: Juergen Pfeifer, 1997 *
****************************************************************************/
-// $Id: cursesapp.h,v 1.14 2020/02/02 23:34:34 tom 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
#include <cursslk.h>
-class NCURSES_IMPEXP NCursesApplication {
+#if (defined(_WIN32) || defined(_WIN64))
+# define NCURSES_CXX_MAIN_NAME cursespp_main
+# define NCURSES_CXX_MAIN \
+ int main(int argc, char *argv[]) { \
+ return NCURSES_CXX_MAIN_NAME(argc, argv); \
+ }
+#else
+# define NCURSES_CXX_MAIN_NAME main
+#endif
+NCURSES_CXX_IMPEXP int NCURSES_CXX_MAIN_NAME(int argc, char *argv[]);
+
+class NCURSES_CXX_IMPEXP NCursesApplication {
public:
typedef struct _slk_link { // This structure is used to maintain
struct _slk_link* prev; // a stack of SLKs
@@ -106,13 +117,13 @@ protected:
{
}
+ static NCursesWindow *&getTitleWindow();
+
public:
virtual ~NCursesApplication() THROWS(NCursesException);
// Get a pointer to the current application object
- static NCursesApplication* getApplication() {
- return theApp;
- }
+ static NCursesApplication* getApplication();
// This method runs the application and returns its exit value
int operator()(void);
@@ -176,5 +187,5 @@ public:
}
};
-
+
#endif /* NCURSES_CURSESAPP_H_incl */
diff --git a/c++/cursesf.cc b/c++/cursesf.cc
index fea592a..5d31648 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.24 2020/02/02 23:34:34 tom 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;
@@ -406,10 +406,19 @@ FIELDTYPE* UserDefinedFieldType::generic_fieldtype =
::new_fieldtype(_nc_xx_fld_fcheck,
_nc_xx_fld_ccheck);
+
+UserDefinedFieldType::UserDefinedFieldType() : NCursesFieldType(generic_fieldtype) {
+}
+
FIELDTYPE* UserDefinedFieldType_With_Choice::generic_fieldtype_with_choice =
::new_fieldtype(_nc_xx_fld_fcheck,
_nc_xx_fld_ccheck);
+
+UserDefinedFieldType_With_Choice::UserDefinedFieldType_With_Choice() {
+ fieldtype = generic_fieldtype_with_choice;
+}
+
bool _nc_xx_next_choice(FIELD *f, const void *u)
{
(void) f;
@@ -461,3 +470,5 @@ public:
};
UDF_Init* UDF_Init::I = new UDF_Init();
+
+
diff --git a/c++/cursesf.h b/c++/cursesf.h
index 17d4c70..ea1aaf0 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-2020,2021 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.35 2020/02/02 23:34:34 tom Exp $
+// $Id: cursesf.h,v 1.38 2021/04/17 18:11:08 tom Exp $
#ifndef NCURSES_CURSESF_H_incl
#define NCURSES_CURSESF_H_incl 1
@@ -51,11 +52,11 @@ extern "C" {
// The abstract base class for builtin and user defined Fieldtypes.
// -------------------------------------------------------------------------
//
-class NCURSES_IMPEXP NCursesFormField; // forward declaration
+class NCURSES_CXX_IMPEXP NCursesFormField; // forward declaration
// Class to represent builtin field types as well as C++ written new
// fieldtypes (see classes UserDefineFieldType...
-class NCURSES_IMPEXP NCursesFieldType
+class NCURSES_CXX_IMPEXP NCursesFieldType
{
friend class NCursesFormField;
@@ -101,7 +102,7 @@ public:
// The class representing a forms field, wrapping the lowlevel FIELD struct
// -------------------------------------------------------------------------
//
-class NCURSES_IMPEXP NCursesFormField
+class NCURSES_CXX_IMPEXP NCursesFormField
{
friend class NCursesForm;
@@ -338,7 +339,7 @@ extern "C" {
// The class representing a form, wrapping the lowlevel FORM struct
// -------------------------------------------------------------------------
//
-class NCURSES_IMPEXP NCursesForm : public NCursesPanel
+class NCURSES_CXX_IMPEXP NCursesForm : public NCursesPanel
{
protected:
FORM* form; // the lowlevel structure
@@ -629,7 +630,7 @@ public:
// data belongs to some class T. Use T as template argument
// to create a UserField.
// -------------------------------------------------------------------------
-template<class T> class NCURSES_IMPEXP NCursesUserField : public NCursesFormField
+template<class T> class NCURSES_CXX_IMPEXP NCursesUserField : public NCursesFormField
{
public:
NCursesUserField (int rows,
@@ -662,7 +663,7 @@ public:
// The same mechanism is used to attach user data to a form
// -------------------------------------------------------------------------
//
-template<class T> class NCURSES_IMPEXP NCursesUserForm : public NCursesForm
+template<class T> class NCURSES_CXX_IMPEXP NCursesUserForm : public NCursesForm
{
protected:
// 'Internal' constructor, builds an object without association to a
@@ -721,7 +722,7 @@ public:
// Builtin Fieldtypes
// -------------------------------------------------------------------------
//
-class NCURSES_IMPEXP Alpha_Field : public NCursesFieldType
+class NCURSES_CXX_IMPEXP Alpha_Field : public NCursesFieldType
{
private:
int min_field_width;
@@ -731,13 +732,13 @@ private:
}
public:
- Alpha_Field(int width)
+ explicit Alpha_Field(int width)
: NCursesFieldType(TYPE_ALPHA),
min_field_width(width) {
}
};
-class NCURSES_IMPEXP Alphanumeric_Field : public NCursesFieldType
+class NCURSES_CXX_IMPEXP Alphanumeric_Field : public NCursesFieldType
{
private:
int min_field_width;
@@ -747,13 +748,13 @@ private:
}
public:
- Alphanumeric_Field(int width)
+ explicit Alphanumeric_Field(int width)
: NCursesFieldType(TYPE_ALNUM),
min_field_width(width) {
}
};
-class NCURSES_IMPEXP Integer_Field : public NCursesFieldType
+class NCURSES_CXX_IMPEXP Integer_Field : public NCursesFieldType
{
private:
int precision;
@@ -771,7 +772,7 @@ public:
}
};
-class NCURSES_IMPEXP Numeric_Field : public NCursesFieldType
+class NCURSES_CXX_IMPEXP Numeric_Field : public NCursesFieldType
{
private:
int precision;
@@ -789,7 +790,7 @@ public:
}
};
-class NCURSES_IMPEXP Regular_Expression_Field : public NCursesFieldType
+class NCURSES_CXX_IMPEXP Regular_Expression_Field : public NCursesFieldType
{
private:
char* 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)
{
@@ -834,7 +835,7 @@ public:
}
};
-class NCURSES_IMPEXP Enumeration_Field : public NCursesFieldType
+class NCURSES_CXX_IMPEXP Enumeration_Field : public NCursesFieldType
{
private:
const char** list;
@@ -873,7 +874,7 @@ public:
}
};
-class NCURSES_IMPEXP IPV4_Address_Field : public NCursesFieldType
+class NCURSES_CXX_IMPEXP IPV4_Address_Field : public NCursesFieldType
{
private:
void set(NCursesFormField& f) {
@@ -896,7 +897,7 @@ extern "C" {
// Abstract base class for User-Defined Fieldtypes
// -------------------------------------------------------------------------
//
-class NCURSES_IMPEXP UserDefinedFieldType : public NCursesFieldType
+class NCURSES_CXX_IMPEXP UserDefinedFieldType : public NCursesFieldType
{
friend class UDF_Init; // Internal helper to set up statics
private:
@@ -925,8 +926,7 @@ protected:
virtual bool char_check (int c) = 0;
public:
- UserDefinedFieldType() : NCursesFieldType(generic_fieldtype) {
- }
+ UserDefinedFieldType();
};
extern "C" {
@@ -939,7 +939,7 @@ extern "C" {
// Abstract base class for User-Defined Fieldtypes with Choice functions
// -------------------------------------------------------------------------
//
-class NCURSES_IMPEXP UserDefinedFieldType_With_Choice : public UserDefinedFieldType
+class NCURSES_CXX_IMPEXP UserDefinedFieldType_With_Choice : public UserDefinedFieldType
{
friend class UDF_Init; // Internal helper to set up statics
private:
@@ -962,9 +962,7 @@ protected:
virtual bool previous(NCursesFormField& f) = 0;
public:
- UserDefinedFieldType_With_Choice() {
- fieldtype = generic_fieldtype_with_choice;
- }
+ UserDefinedFieldType_With_Choice();
};
#endif /* NCURSES_CURSESF_H_incl */
diff --git a/c++/cursesm.cc b/c++/cursesm.cc
index 2215a16..64f3635 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 413da76..383c7e1 100644
--- a/c++/cursesm.h
+++ b/c++/cursesm.h
@@ -32,7 +32,7 @@
* Author: Juergen Pfeifer, 1997 *
****************************************************************************/
-// $Id: cursesm.h,v 1.33 2020/02/02 23:34:34 tom Exp $
+// $Id: cursesm.h,v 1.34 2020/05/24 01:40:20 anonymous.maarten Exp $
#ifndef NCURSES_CURSESM_H_incl
#define NCURSES_CURSESM_H_incl 1
@@ -47,7 +47,7 @@ extern "C" {
// This wraps the ITEM type of <menu.h>
// -------------------------------------------------------------------------
//
-class NCURSES_IMPEXP NCursesMenuItem
+class NCURSES_CXX_IMPEXP NCursesMenuItem
{
friend class NCursesMenu;
@@ -153,7 +153,7 @@ typedef bool ITEMCALLBACK(NCursesMenuItem&);
// If you don't like to create a child class for individual items to
// overload action(), you may use this class and provide a callback
// function pointer for items.
-class NCURSES_IMPEXP NCursesMenuCallbackItem : public NCursesMenuItem
+class NCURSES_CXX_IMPEXP NCursesMenuCallbackItem : public NCursesMenuItem
{
private:
ITEMCALLBACK* p_fct;
@@ -200,7 +200,7 @@ extern "C" {
// This wraps the MENU type of <menu.h>
// -------------------------------------------------------------------------
//
-class NCURSES_IMPEXP NCursesMenu : public NCursesPanel
+class NCURSES_CXX_IMPEXP NCursesMenu : public NCursesPanel
{
protected:
MENU *menu;
@@ -596,7 +596,7 @@ public:
// to create a UserItem.
// -------------------------------------------------------------------------
//
-template<class T> class NCURSES_IMPEXP NCursesUserItem : public NCursesMenuItem
+template<class T> class NCURSES_CXX_IMPEXP NCursesUserItem : public NCursesMenuItem
{
public:
NCursesUserItem (const char* p_name,
@@ -623,7 +623,7 @@ public:
// The same mechanism is used to attach user data to a menu
// -------------------------------------------------------------------------
//
-template<class T> class NCURSES_IMPEXP NCursesUserMenu : public NCursesMenu
+template<class T> class NCURSES_CXX_IMPEXP NCursesUserMenu : public NCursesMenu
{
protected:
NCursesUserMenu( int nlines,
diff --git a/c++/cursesmain.cc b/c++/cursesmain.cc
index b4f1293..cc41b50 100644
--- a/c++/cursesmain.cc
+++ b/c++/cursesmain.cc
@@ -44,7 +44,7 @@
#define CPP_HAS_TRY_CATCH 0
#endif
-MODULE_ID("$Id: cursesmain.cc,v 1.17 2020/02/02 23:34:34 tom Exp $")
+MODULE_ID("$Id: cursesmain.cc,v 1.20 2020/07/18 19:57:11 anonymous.maarten Exp $")
#if HAVE_LOCALE_H
#include <locale.h>
@@ -60,7 +60,7 @@ MODULE_ID("$Id: cursesmain.cc,v 1.17 2020/02/02 23:34:34 tom Exp $")
* You only have to instantiate a static NCursesApplication object in your
* main application source file and link this module with your application.
*/
-int main(int argc, char* argv[])
+int NCURSES_CXX_MAIN_NAME(int argc, char* argv[])
{
setlocale(LC_ALL, "");
diff --git a/c++/cursesp.h b/c++/cursesp.h
index d1eea96..1eb90e9 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-2020,2021 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.33 2020/02/02 23:34:34 tom Exp $
+// $Id: cursesp.h,v 1.35 2021/04/17 18:11:08 tom Exp $
#include <cursesw.h>
@@ -43,7 +44,7 @@ extern "C" {
# include <panel.h>
}
-class NCURSES_IMPEXP NCursesPanel
+class NCURSES_CXX_IMPEXP NCursesPanel
: public NCursesWindow
{
protected:
@@ -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 10a2da7..001f6db 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-2020,2021 Thomas E. Dickey *
* Copyright 1998-2014,2017 Free Software Foundation, Inc. *
* *
* Permission is hereby granted, free of charge, to any person obtaining a *
@@ -32,12 +32,23 @@
#ifndef NCURSES_CURSESW_H_incl
#define NCURSES_CURSESW_H_incl 1
-// $Id: cursesw.h,v 1.56 2020/02/02 23:34:34 tom Exp $
+// $Id: cursesw.h,v 1.58 2021/04/17 18:11:08 tom Exp $
extern "C" {
# include <curses.h>
}
+#if defined(BUILDING_NCURSES_CXX)
+# define NCURSES_CXX_IMPEXP NCURSES_EXPORT_GENERAL_EXPORT
+#else
+# define NCURSES_CXX_IMPEXP NCURSES_EXPORT_GENERAL_IMPORT
+#endif
+
+#define NCURSES_CXX_WRAPPED_VAR(type,name) extern NCURSES_CXX_IMPEXP type NCURSES_PUBLIC_VAR(name)(void)
+
+#define NCURSES_CXX_EXPORT(type) NCURSES_CXX_IMPEXP type NCURSES_API
+#define NCURSES_CXX_EXPORT_VAR(type) NCURSES_CXX_IMPEXP type
+
#include <etip.h>
/* SCO 3.2v4 curses.h includes term.h, which defines lines as a macro.
@@ -757,7 +768,7 @@ extern "C" int _nc_ripoffline(int, int (*init)(WINDOW*, int));
extern "C" int _nc_xx_ripoff_init(WINDOW *, int);
extern "C" int _nc_has_mouse(void);
-class NCURSES_IMPEXP NCursesWindow
+class NCURSES_CXX_IMPEXP NCursesWindow
{
friend class NCursesMenu;
friend class NCursesForm;
@@ -805,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
@@ -1371,10 +1382,10 @@ public:
// -------------------------------------------------------------------------
// We leave this here for compatibility reasons.
// -------------------------------------------------------------------------
-class NCURSES_IMPEXP NCursesColorWindow : public NCursesWindow
+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(); }
@@ -1417,7 +1428,7 @@ public:
// Pad Support. We allow an association of a pad with a "real" window
// through which the pad may be viewed.
// -------------------------------------------------------------------------
-class NCURSES_IMPEXP NCursesPad : public NCursesWindow
+class NCURSES_CXX_IMPEXP NCursesPad : public NCursesWindow
{
private:
NCursesWindow* viewWin; // the "viewport" window
@@ -1533,7 +1544,7 @@ public:
// A FramedPad is constructed always with a viewport window. This viewport
// will be framed (by a box() command) and the interior of the box is the
// viewport subwindow. On the frame we display scrollbar sliders.
-class NCURSES_IMPEXP NCursesFramedPad : public NCursesPad
+class NCURSES_CXX_IMPEXP NCursesFramedPad : public NCursesPad
{
protected:
virtual void OnOperation(int pad_req);
diff --git a/c++/cursslk.cc b/c++/cursslk.cc
index 78a426e..9922163 100644
--- a/c++/cursslk.cc
+++ b/c++/cursslk.cc
@@ -36,7 +36,7 @@
#include "cursslk.h"
#include "cursesapp.h"
-MODULE_ID("$Id: cursslk.cc,v 1.18 2020/02/02 23:34:34 tom Exp $")
+MODULE_ID("$Id: cursslk.cc,v 1.19 2020/07/18 19:57:11 anonymous.maarten Exp $")
Soft_Label_Key_Set::Soft_Label_Key&
Soft_Label_Key_Set::Soft_Label_Key::operator=(char *text)
@@ -102,6 +102,10 @@ Soft_Label_Key_Set::Soft_Label_Key& Soft_Label_Key_Set::operator[](int i) {
return slk_array[i-1];
}
+int Soft_Label_Key_Set::labels() const {
+ return num_labels;
+}
+
void Soft_Label_Key_Set::activate_label(int i, bool bf) {
if (!b_attrInit) {
NCursesApplication* A = NCursesApplication::getApplication();
diff --git a/c++/cursslk.h b/c++/cursslk.h
index 5a7b78c..66564fe 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,17 +33,17 @@
* Author: Juergen Pfeifer, 1997 *
****************************************************************************/
-// $Id: cursslk.h,v 1.15 2020/02/02 23:34:34 tom 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
#include <cursesw.h>
-class NCURSES_IMPEXP Soft_Label_Key_Set {
+class NCURSES_CXX_IMPEXP Soft_Label_Key_Set {
public:
// This inner class represents the attributes of a Soft Label Key (SLK)
- class NCURSES_IMPEXP Soft_Label_Key {
+ class NCURSES_CXX_IMPEXP Soft_Label_Key {
friend class Soft_Label_Key_Set;
public:
typedef enum { Left=0, Center=1, Right=2 } Justification;
@@ -101,10 +102,10 @@ public:
} Label_Layout;
private:
- static long NCURSES_IMPEXP count; // Number of Key Sets
- static Label_Layout NCURSES_IMPEXP format; // Layout of the Key Sets
- static int NCURSES_IMPEXP num_labels; // Number Of Labels in Key Sets
- bool NCURSES_IMPEXP b_attrInit; // Are attributes initialized
+ static long count; // Number of Key Sets
+ static Label_Layout format; // Layout of the Key Sets
+ static int num_labels; // Number Of Labels in Key Sets
+ bool b_attrInit; // Are attributes initialized
Soft_Label_Key *slk_array; // The array of SLK's
@@ -140,11 +141,11 @@ 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.
- NCURSES_IMPEXP Soft_Label_Key_Set();
+ Soft_Label_Key_Set();
Soft_Label_Key_Set& operator=(const Soft_Label_Key_Set& rhs)
{
@@ -165,10 +166,10 @@ public:
virtual ~Soft_Label_Key_Set() THROWS(NCursesException);
// Get Label# i. Label counting starts with 1!
- NCURSES_IMPEXP Soft_Label_Key& operator[](int i);
+ Soft_Label_Key& operator[](int i);
// Retrieve number of Labels
- inline int labels() const { return num_labels; }
+ int labels() const;
// Refresh the SLK portion of the screen
inline void refresh() {
diff --git a/c++/demo.cc b/c++/demo.cc
index 2b5451a..195e98a 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-2020,2021 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.45 2020/02/02 23:34:34 tom Exp $
+ * $Id: demo.cc,v 1.50 2021/09/04 10:52:55 tom Exp $
*/
#include "internal.h"
@@ -44,11 +44,10 @@
#include "cursesm.h"
#include "cursesf.h"
-#ifdef _WIN32
+#if (defined(_WIN32) || defined(_WIN64))
#undef KEY_EVENT
-#endif
-
-#ifndef _WIN32
+#define sleep(n) Sleep(n)
+#else
extern "C" unsigned int sleep(unsigned int);
#endif
@@ -105,7 +104,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();
@@ -187,7 +186,7 @@ public:
};
template class MyAction<UserData>;
-template class NCURSES_IMPEXP NCursesUserItem<UserData>;
+template class NCURSES_CXX_IMPEXP NCursesUserItem<UserData>;
class QuitItem : public NCursesMenuItem
{
@@ -552,9 +551,9 @@ void TestApplication::title()
const char * const titleText = "Simple C++ Binding Demo";
const int len = ::strlen(titleText);
- titleWindow->bkgd(screen_titles());
- titleWindow->addstr(0, (titleWindow->cols() - len)/2, titleText);
- titleWindow->noutrefresh();
+ getTitleWindow()->bkgd(screen_titles());
+ getTitleWindow()->addstr(0, (getTitleWindow()->cols() - len)/2, titleText);
+ getTitleWindow()->noutrefresh();
}
@@ -569,3 +568,8 @@ int TestApplication::run()
// -------------------------------------------------------------------------
//
static TestApplication *Demo = new TestApplication();
+
+#if (defined(_WIN32) || defined(_WIN64))
+// This is actually only needed when ncurses is a dll
+NCURSES_CXX_MAIN
+#endif
diff --git a/c++/etip.h.in b/c++/etip.h.in
index 9334f9d..9dbb0e7 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-2020,2021 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.43 2020/02/02 23:34:34 tom Exp $
+// $Id: etip.h.in,v 1.48 2021/06/17 21:11:08 tom Exp $
#ifndef NCURSES_ETIP_H_incl
#define NCURSES_ETIP_H_incl 1
@@ -139,12 +139,16 @@ extern "C" {
#define STATIC_CAST(s) (s)
#endif
+#ifndef NCURSES_CXX_IMPEXP
+#define NCURSES_CXX_IMPEXP /* nothing */
+#endif
+
// Forward Declarations
-class NCURSES_IMPEXP NCursesPanel;
-class NCURSES_IMPEXP NCursesMenu;
-class NCURSES_IMPEXP NCursesForm;
+class NCURSES_CXX_IMPEXP NCursesPanel;
+class NCURSES_CXX_IMPEXP NCursesMenu;
+class NCURSES_CXX_IMPEXP NCursesForm;
-class NCURSES_IMPEXP NCursesException
+class NCURSES_CXX_IMPEXP NCursesException
{
public:
const char *message;
@@ -154,12 +158,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;
}
@@ -178,7 +183,7 @@ public:
}
};
-class NCURSES_IMPEXP NCursesPanelException : public NCursesException
+class NCURSES_CXX_IMPEXP NCursesPanelException : public NCursesException
{
public:
const NCursesPanel* p;
@@ -195,7 +200,7 @@ public:
p (panel)
{};
- NCursesPanelException (int err) :
+ explicit NCursesPanelException (int err) :
NCursesException ("panel library error", err),
p (0)
{};
@@ -229,7 +234,7 @@ public:
}
};
-class NCURSES_IMPEXP NCursesMenuException : public NCursesException
+class NCURSES_CXX_IMPEXP NCursesMenuException : public NCursesException
{
public:
const NCursesMenu* m;
@@ -246,7 +251,7 @@ public:
m (menu)
{};
- NCursesMenuException (int err) :
+ explicit NCursesMenuException (int err) :
NCursesException ("menu library error", err),
m (0)
{};
@@ -280,7 +285,7 @@ public:
}
};
-class NCURSES_IMPEXP NCursesFormException : public NCursesException
+class NCURSES_CXX_IMPEXP NCursesFormException : public NCursesException
{
public:
const NCursesForm* f;
@@ -297,7 +302,7 @@ public:
f (form)
{};
- NCursesFormException (int err) :
+ explicit NCursesFormException (int err) :
NCursesException ("form library error", err),
f (0)
{};
@@ -341,7 +346,6 @@ using std::endl;
# else
# include <iostream.h>
# endif
- extern "C" void exit(int);
#endif
inline void THROW(const NCursesException *e) {
diff --git a/c++/internal.h b/c++/internal.h
index 5cd2020..f67aaec 100644
--- a/c++/internal.h
+++ b/c++/internal.h
@@ -32,7 +32,7 @@
* Author: Juergen Pfeifer, 1997 *
****************************************************************************/
-// $Id: internal.h,v 1.20 2020/02/02 23:34:34 tom Exp $
+// $Id: internal.h,v 1.22 2020/08/29 23:06:41 tom Exp $
#ifndef NCURSES_CPLUS_INTERNAL_H
#define NCURSES_CPLUS_INTERNAL_H 1
@@ -45,8 +45,12 @@
#define MODULE_ID(id) /*nothing */
#endif
-#ifdef _WIN32
+#if (defined(_WIN32) || defined(_WIN64))
+#if defined(EXP_WIN32_DRIVER)
+#include <nc_win32.h>
+#else
#include <nc_mingw.h>
+#endif
#undef KEY_EVENT
#endif