From f6d73a10a980bc78969c3af93665cbe7d06c3646 Mon Sep 17 00:00:00 2001 From: Lorry Tar Creator Date: Sat, 31 Jan 2015 22:26:04 +0000 Subject: Imported from /home/lorry/working-area/delta_ncurses/ncurses-5.9-20150131.tgz. --- c++/Makefile.in | 121 +++++++++++++++++++++++++++--------------------------- c++/cursesapp.h | 21 ++++++---- c++/cursesf.cc | 12 +++++- c++/cursesf.h | 26 ++++++------ c++/cursesm.cc | 10 ++++- c++/cursesm.h | 23 ++++++----- c++/cursesmain.cc | 6 ++- c++/cursesp.h | 15 +++---- c++/cursespad.cc | 54 ++++++++++++++++-------- c++/cursesw.cc | 23 ++++++----- c++/cursesw.h | 41 ++++++++++-------- c++/cursslk.cc | 9 ++-- c++/demo.cc | 9 ++-- c++/etip.h.in | 18 ++++---- c++/internal.h | 6 ++- c++/modules | 21 +++++----- 16 files changed, 236 insertions(+), 179 deletions(-) (limited to 'c++') diff --git a/c++/Makefile.in b/c++/Makefile.in index 6fd8ffc..1e79b86 100644 --- a/c++/Makefile.in +++ b/c++/Makefile.in @@ -1,6 +1,6 @@ -# $Id: Makefile.in,v 1.93 2010/11/27 21:45:27 tom Exp $ +# $Id: Makefile.in,v 1.108 2014/11/15 00:46:17 tom Exp $ ############################################################################## -# Copyright (c) 1998-2009,2010 Free Software Foundation, Inc. # +# Copyright (c) 1998-2013,2014 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"), # @@ -44,13 +44,21 @@ o = .@OBJEXT@ MODEL = ../@DFT_OBJ_SUBDIR@ DESTDIR = @DESTDIR@ +top_srcdir = @top_srcdir@ srcdir = @srcdir@ prefix = @prefix@ exec_prefix = @exec_prefix@ +bindir = @bindir@ libdir = @libdir@ includedir = @includedir@ +includesubdir = @includesubdir@ + +INCLUDEDIR = $(DESTDIR)$(includedir)$(includesubdir) + +PACKAGE = @PACKAGE@ LIBTOOL = @LIBTOOL_CXX@ +LIBTOOL_OPTS = @LIBTOOL_OPTS@ LIBTOOL_CLEAN = @LIB_CLEAN@ LIBTOOL_COMPILE = @LIB_COMPILE@ LIBTOOL_LINK = @LIB_LINK@ @@ -65,6 +73,9 @@ INSTALL_DATA = @INSTALL_DATA@ AR = @AR@ ARFLAGS = @ARFLAGS@ +AWK = @AWK@ +LD = @LD@ +LN_S = @LN_S@ CXX_AR = @CXX_AR@ CXX_ARFLAGS = @CXX_ARFLAGS@ @@ -76,7 +87,7 @@ CXXFLAGS = @CXXFLAGS@ @EXTRA_CXXFLAGS@ CXXLIBS = @CXXLIBS@ INCDIR = ../include -CPPFLAGS = -I../c++ -I$(INCDIR) -I$(srcdir) -DHAVE_CONFIG_H @CPPFLAGS@ +CPPFLAGS = -DHAVE_CONFIG_H @CPPFLAGS@ CTAGS = @CTAGS@ ETAGS = @ETAGS@ @@ -109,35 +120,41 @@ LIBNAME_LIBTOOL = @LIB_PREFIX@$(LIBROOT)@LIB_SUFFIX@.la LIBNAME_NORMAL = @LIB_PREFIX@$(LIBROOT)@LIB_SUFFIX@.a LIBNAME = @LIB_PREFIX@$(LIBROOT)@CXX_LIB_SUFFIX@ -MY_LIBRARY = ../lib/$(LIBNAME) +LIBRARIES = @Libs_To_Make@ LINK_FLAGS = @EXTRA_LDFLAGS@ -L../lib -l$(LIBROOT)@LIB_SUFFIX@ +RPATH_LIST = @RPATH_LIST@ +MK_SHARED_LIB = @MK_SHARED_LIB@ -LINK_LIBTOOL = @EXTRA_LDFLAGS@ -L../lib $(MY_LIBRARY) +LINK_LIBTOOL = @EXTRA_LDFLAGS@ -L../lib $(LIBRARIES) LINK_NORMAL = $(LINK_FLAGS) LINK_DEBUG = $(LINK_FLAGS) LINK_PROFILE = $(LINK_FLAGS) LINK_SHARED = $(LINK_FLAGS) +# flags for test-programs TEST_LIBS = @TEST_LIBS@ TEST_ARGS = @LDFLAGS_STATIC@ @TEST_ARGS@ @LDFLAGS_SHARED@ - -LDFLAGS = $(TEST_ARGS) @LDFLAGS@ \ +TEST_LDFLAGS = $(TEST_ARGS) @LDFLAGS@ \ @LD_MODEL@ $(TEST_LIBS) @LIBS@ @LOCAL_LDFLAGS@ $(CXXLIBS) -LDFLAGS_LIBTOOL = $(LDFLAGS) $(CFLAGS_LIBTOOL) -LDFLAGS_NORMAL = $(LDFLAGS) $(CFLAGS_NORMAL) -LDFLAGS_DEBUG = $(LDFLAGS) $(CFLAGS_DEBUG) -LDFLAGS_PROFILE = $(LDFLAGS) $(CFLAGS_PROFILE) -LDFLAGS_SHARED = $(LDFLAGS) $(CFLAGS_SHARED) @LD_SHARED_OPTS@ +LDFLAGS_LIBTOOL = $(TEST_LDFLAGS) $(CFLAGS_LIBTOOL) +LDFLAGS_NORMAL = $(TEST_LDFLAGS) $(CFLAGS_NORMAL) +LDFLAGS_DEBUG = $(TEST_LDFLAGS) $(CFLAGS_DEBUG) +LDFLAGS_PROFILE = $(TEST_LDFLAGS) $(CFLAGS_PROFILE) +LDFLAGS_SHARED = $(TEST_LDFLAGS) $(CFLAGS_SHARED) @LD_SHARED_OPTS@ LDFLAGS_DEFAULT = $(LINK_@DFT_UPR_MODEL@) $(LDFLAGS_@DFT_UPR_MODEL@) +# flags for library built by this makefile +LDFLAGS = $(TEST_ARGS) @LDFLAGS@ \ + @LD_MODEL@ $(TEST_LIBS) @LIBS@ $(CXXLIBS) + AUTO_SRC = \ etip.h all \ -libs :: $(AUTO_SRC) $(MY_LIBRARY) +libs :: $(AUTO_SRC) $(LIBRARIES) @MAKE_TESTS@all :: demo$x @@ -148,61 +165,16 @@ depend : tags: $(CTAGS) *.[h] *.cc -# Build a conventional library for installing, since a shared library would -# pull in all of the ncurses libraries (panel, menu, form, ncurses) as direct -# dependencies. -LIB_OBJS = \ - $(MODEL)/cursesf$o \ - $(MODEL)/cursesm$o \ - $(MODEL)/cursesw$o \ - $(MODEL)/cursespad$o \ - $(MODEL)/cursesp$o \ - $(MODEL)/cursslk$o \ - $(MODEL)/cursesapp$o \ - $(MODEL)/cursesmain$o - -../lib/$(LIBNAME_NORMAL) : $(LIB_OBJS) - $(CXX_AR) $(CXX_ARFLAGS) $@ $? - $(RANLIB) $@ - -../lib/$(LIBNAME_LIBTOOL) : $(LIB_OBJS) - cd ../lib && $(LIBTOOL_LINK) $(CXX) $(CXXFLAGS) \ - -o $(LIBNAME) $(LIB_OBJS:$o=.lo) \ - -rpath $(INSTALL_PREFIX)$(libdir) \ - $(LIBTOOL_VERSION) $(NCURSES_MAJOR):$(NCURSES_MINOR) $(LT_UNDEF) $(SHLIB_LIST) - -OBJS_DEMO = $(MODEL)/demo$o - -$(MODEL)/demo$o : $(srcdir)/demo.cc \ - $(cursesf_h) $(cursesm_h) $(cursesapp_h) - -demo$x: $(OBJS_DEMO) \ - $(MY_LIBRARY) \ - @TEST_DEPS@ - @ECHO_LINK@ $(LINK) -o $@ $(OBJS_DEMO) $(LDFLAGS_DEFAULT) - -etip.h: $(srcdir)/etip.h.in $(srcdir)/edit_cfg.sh - cp $(srcdir)/etip.h.in $@ - sh $(srcdir)/edit_cfg.sh ../include/ncurses_cfg.h $@ - $(DESTDIR)$(libdir) : mkdir -p $@ -install \ -install.libs:: $(MY_LIBRARY) $(DESTDIR)$(libdir) - $(LIBTOOL_INSTALL) $(INSTALL_LIB) $(MY_LIBRARY) $(DESTDIR)$(libdir)/$(LIBNAME) - -uninstall \ -uninstall.libs:: - -$(LIBTOOL_UNINSTALL) rm -f $(DESTDIR)$(libdir)/$(LIBNAME) - mostlyclean :: -rm -f core tags TAGS *~ *.bak *.i *.ii *.ln *.atac trace clean :: mostlyclean -sh -c "if test -n '$x' ; then $(MAKE) clean x=''; fi" -rm -rf $(MODEL)/SunWS_cache - -$(LIBTOOL_CLEAN) rm -f demo$x $(AUTO_SRC) $(MY_LIBRARY) $(LIB_OBJS) $(OBJS_DEMO) + -$(LIBTOOL_CLEAN) rm -f demo$x $(AUTO_SRC) $(LIBRARIES) $(OBJS_DEMO) -rm -rf .libs distclean :: clean @@ -212,8 +184,16 @@ 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 + cursesw_h = $(srcdir)/cursesw.h \ - etip.h \ + $(etip_h) \ $(INCDIR)/curses.h cursesp_h = $(srcdir)/cursesp.h \ @@ -243,6 +223,27 @@ $(INCDIR)/menu.h : $(INCDIR)/panel.h : cd ../panel && $(MAKE) $@ +############################################################################### + +OBJS_DEMO = $(MODEL)/demo$o + +$(MODEL)/demo$o : $(srcdir)/demo.cc \ + $(internal_h) \ + $(cursesf_h) \ + $(cursesm_h) \ + $(cursesapp_h) + @echo 'compiling demo (obj_s)' + @$(LIBTOOL_COMPILE) $(CXX) $(CFLAGS_DEFAULT) -c $(srcdir)/demo.cc -o $@ + +demo$x: $(OBJS_DEMO) \ + $(LIBRARIES) \ + @TEST_DEPS@ + @ECHO_LD@ $(LINK) -o $@ $(OBJS_DEMO) $(LDFLAGS_DEFAULT) + +etip.h: $(srcdir)/etip.h.in $(srcdir)/edit_cfg.sh + cp $(srcdir)/etip.h.in $@ + sh $(srcdir)/edit_cfg.sh ../include/ncurses_cfg.h $@ + ############################################################################### # The remainder of this file is automatically generated during configuration ############################################################################### diff --git a/c++/cursesapp.h b/c++/cursesapp.h index 7e995d2..e3cbc04 100644 --- a/c++/cursesapp.h +++ b/c++/cursesapp.h @@ -1,6 +1,6 @@ // * This makes emacs happy -*-Mode: C++;-*- /**************************************************************************** - * Copyright (c) 1998-2003,2005 Free Software Foundation, Inc. * + * Copyright (c) 1998-2005,2011 Free Software Foundation, Inc. * * * * Permission is hereby granted, free of charge, to any person obtaining a * * copy of this software and associated documentation files (the * @@ -31,7 +31,7 @@ * Author: Juergen Pfeifer, 1997 * ****************************************************************************/ -// $Id: cursesapp.h,v 1.11 2005/05/28 21:57:44 tom Exp $ +// $Id: cursesapp.h,v 1.12 2011/09/17 22:12:10 tom Exp $ #ifndef NCURSES_CURSESAPP_H_incl #define NCURSES_CURSESAPP_H_incl @@ -80,6 +80,7 @@ protected: // This method is called to initialize the SLKs. Default is nothing. // You may rewrite this in your derived class virtual void init_labels(Soft_Label_Key_Set& S) const { + (void) S; } // Your derived class must implement this method. The return value must @@ -118,6 +119,8 @@ public: // Process the commandline arguments. The default implementation simply // ignores them. Your derived class may rewrite this. virtual void handleArgs(int argc, char* argv[]) { + (void) argc; + (void) argv; } // Does this application use colors? @@ -138,37 +141,37 @@ public: // Attributes to use for menu and forms foregrounds virtual chtype foregrounds() const { - return b_Colors ? COLOR_PAIR(1) : A_BOLD; + return b_Colors ? static_cast(COLOR_PAIR(1)) : A_BOLD; } // Attributes to use for menu and forms backgrounds virtual chtype backgrounds() const { - return b_Colors ? COLOR_PAIR(2) : A_NORMAL; + return b_Colors ? static_cast(COLOR_PAIR(2)) : A_NORMAL; } // Attributes to use for inactive (menu) elements virtual chtype inactives() const { - return b_Colors ? (COLOR_PAIR(3)|A_DIM) : A_DIM; + return b_Colors ? static_cast(COLOR_PAIR(3)|A_DIM) : A_DIM; } // Attributes to use for (form) labels and SLKs virtual chtype labels() const { - return b_Colors ? COLOR_PAIR(4) : A_NORMAL; + return b_Colors ? static_cast(COLOR_PAIR(4)) : A_NORMAL; } // Attributes to use for form backgrounds virtual chtype dialog_backgrounds() const { - return b_Colors ? COLOR_PAIR(4) : A_NORMAL; + return b_Colors ? static_cast(COLOR_PAIR(4)) : A_NORMAL; } // Attributes to use as default for (form) window backgrounds virtual chtype window_backgrounds() const { - return b_Colors ? COLOR_PAIR(5) : A_NORMAL; + return b_Colors ? static_cast(COLOR_PAIR(5)) : A_NORMAL; } // Attributes to use for the title window virtual chtype screen_titles() const { - return b_Colors ? COLOR_PAIR(6) : A_BOLD; + return b_Colors ? static_cast(COLOR_PAIR(6)) : A_BOLD; } }; diff --git a/c++/cursesf.cc b/c++/cursesf.cc index aaf1202..7956054 100644 --- a/c++/cursesf.cc +++ b/c++/cursesf.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,2011 Free Software Foundation, Inc. * * * * Permission is hereby granted, free of charge, to any person obtaining a * * copy of this software and associated documentation files (the * @@ -35,7 +35,7 @@ #include "cursesf.h" #include "cursesapp.h" -MODULE_ID("$Id: cursesf.cc,v 1.21 2005/08/13 18:09:06 tom Exp $") +MODULE_ID("$Id: cursesf.cc,v 1.22 2011/09/17 22:12:10 tom Exp $") NCursesFormField::~NCursesFormField () { @@ -234,11 +234,13 @@ NCursesForm::On_Form_Termination() void NCursesForm::On_Field_Init(NCursesFormField& field) { + (void) field; } void NCursesForm::On_Field_Termination(NCursesFormField& field) { + (void) field; } // call the form driver and do basic error checking. @@ -260,16 +262,19 @@ NCursesForm::driver (int c) void NCursesForm::On_Request_Denied(int c) const { + (void) c; ::beep(); } void NCursesForm::On_Invalid_Field(int c) const { + (void) c; ::beep(); } void NCursesForm::On_Unknown_Command(int c) const { + (void) c; ::beep(); } @@ -373,6 +378,7 @@ NCursesForm::virtualize(int c) // bool _nc_xx_fld_fcheck(FIELD *f, const void *u) { + (void) f; NCursesFormField* F = reinterpret_cast(const_cast(u)); assert(F != 0); UserDefinedFieldType* udf = reinterpret_cast(F->fieldtype()); @@ -405,6 +411,7 @@ FIELDTYPE* UserDefinedFieldType_With_Choice::generic_fieldtype_with_choice = bool _nc_xx_next_choice(FIELD *f, const void *u) { + (void) f; NCursesFormField* F = reinterpret_cast(const_cast(u)); assert(F != 0); UserDefinedFieldType_With_Choice* udf = @@ -415,6 +422,7 @@ bool _nc_xx_next_choice(FIELD *f, const void *u) bool _nc_xx_prev_choice(FIELD *f, const void *u) { + (void) f; NCursesFormField* F = reinterpret_cast(const_cast(u)); assert(F != 0); UserDefinedFieldType_With_Choice* udf = diff --git a/c++/cursesf.h b/c++/cursesf.h index 70a30c3..fe1f1aa 100644 --- a/c++/cursesf.h +++ b/c++/cursesf.h @@ -1,6 +1,6 @@ // * This makes emacs happy -*-Mode: C++;-*- /**************************************************************************** - * Copyright (c) 1998-2004,2005 Free Software Foundation, Inc. * + * Copyright (c) 1998-2012,2014 Free Software Foundation, Inc. * * * * Permission is hereby granted, free of charge, to any person obtaining a * * copy of this software and associated documentation files (the * @@ -31,7 +31,7 @@ * Author: Juergen Pfeifer, 1997 * ****************************************************************************/ -// $Id: cursesf.h,v 1.28 2005/08/13 18:08:24 tom Exp $ +// $Id: cursesf.h,v 1.32 2014/08/09 22:06:11 Adam.Jiang Exp $ #ifndef NCURSES_CURSESF_H_incl #define NCURSES_CURSESF_H_incl 1 @@ -61,7 +61,7 @@ class NCURSES_IMPEXP NCursesFieldType protected: FIELDTYPE* fieldtype; - inline void OnError(int err) const THROWS(NCursesFormException) { + inline void OnError(int err) const THROW2(NCursesException const, NCursesFormException) { if (err!=E_OK) THROW(new NCursesFormException (err)); } @@ -109,7 +109,7 @@ protected: NCursesFieldType* ftype; // Associated field type // Error handler - inline void OnError (int err) const THROWS(NCursesFormException) { + inline void OnError (int err) const THROW2(NCursesException const, NCursesFormException) { if (err != E_OK) THROW(new NCursesFormException (err)); } @@ -391,7 +391,7 @@ protected: bool with_frame, bool autoDeleteFields); - inline void OnError (int err) const THROWS(NCursesFormException) { + inline void OnError (int err) const THROW2(NCursesException const, NCursesFormException) { if (err != E_OK) THROW(new NCursesFormException (err)); } @@ -673,20 +673,21 @@ protected: const T* p_UserData = STATIC_CAST(T*)(0)) : NCursesForm(nlines,ncols,begin_y,begin_x) { if (form) - set_user (const_cast(p_UserData)); + set_user (const_cast(reinterpret_cast + (p_UserData))); } public: - NCursesUserForm (NCursesFormField Fields[], + NCursesUserForm (NCursesFormField* Fields[], const T* p_UserData = STATIC_CAST(T*)(0), bool with_frame=FALSE, bool autoDelete_Fields=FALSE) : NCursesForm (Fields, with_frame, autoDelete_Fields) { if (form) - set_user (const_cast(p_UserData)); + set_user (const_cast(reinterpret_cast(p_UserData))); }; - NCursesUserForm (NCursesFormField Fields[], + NCursesUserForm (NCursesFormField* Fields[], int nlines, int ncols, int begin_y = 0, @@ -697,19 +698,20 @@ public: : NCursesForm (Fields, nlines, ncols, begin_y, begin_x, with_frame, autoDelete_Fields) { if (form) - set_user (const_cast(p_UserData)); + set_user (const_cast(reinterpret_cast + (p_UserData))); }; virtual ~NCursesUserForm() { }; - inline T* UserData (void) const { + inline T* UserData (void) { return reinterpret_cast(get_user ()); }; inline virtual void setUserData (const T* p_UserData) { if (form) - set_user (const_cast(p_UserData)); + set_user (const_cast(reinterpret_cast(p_UserData))); } }; diff --git a/c++/cursesm.cc b/c++/cursesm.cc index c253a67..222de46 100644 --- a/c++/cursesm.cc +++ b/c++/cursesm.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,2011 Free Software Foundation, Inc. * * * * Permission is hereby granted, free of charge, to any person obtaining a * * copy of this software and associated documentation files (the * @@ -35,7 +35,7 @@ #include "cursesm.h" #include "cursesapp.h" -MODULE_ID("$Id: cursesm.cc,v 1.22 2005/04/02 20:39:05 tom Exp $") +MODULE_ID("$Id: cursesm.cc,v 1.23 2011/09/17 22:11:32 tom Exp $") NCursesMenuItem::~NCursesMenuItem() { @@ -375,33 +375,39 @@ NCursesMenu::On_Menu_Termination() void NCursesMenu::On_Item_Init(NCursesMenuItem& item) { + (void) item; } void NCursesMenu::On_Item_Termination(NCursesMenuItem& item) { + (void) item; } void NCursesMenu::On_Request_Denied(int c) const { + (void) c; ::beep(); } void NCursesMenu::On_Not_Selectable(int c) const { + (void) c; ::beep(); } void NCursesMenu::On_No_Match(int c) const { + (void) c; ::beep(); } void NCursesMenu::On_Unknown_Command(int c) const { + (void) c; ::beep(); } diff --git a/c++/cursesm.h b/c++/cursesm.h index d9c2273..f8f9665 100644 --- a/c++/cursesm.h +++ b/c++/cursesm.h @@ -1,6 +1,6 @@ // * This makes emacs happy -*-Mode: C++;-*- /**************************************************************************** - * Copyright (c) 1998-2003,2005 Free Software Foundation, Inc. * + * Copyright (c) 1998-2012,2014 Free Software Foundation, Inc. * * * * Permission is hereby granted, free of charge, to any person obtaining a * * copy of this software and associated documentation files (the * @@ -31,7 +31,7 @@ * Author: Juergen Pfeifer, 1997 * ****************************************************************************/ -// $Id: cursesm.h,v 1.25 2005/08/13 18:10:36 tom Exp $ +// $Id: cursesm.h,v 1.30 2014/08/09 22:06:18 Adam.Jiang Exp $ #ifndef NCURSES_CURSESM_H_incl #define NCURSES_CURSESM_H_incl 1 @@ -53,7 +53,7 @@ class NCURSES_IMPEXP NCursesMenuItem protected: ITEM *item; - inline void OnError (int err) const THROWS(NCursesMenuException) { + inline void OnError (int err) const THROW2(NCursesException const, NCursesMenuException) { if (err != E_OK) THROW(new NCursesMenuException (err)); } @@ -82,6 +82,7 @@ public: NCursesMenuItem(const NCursesMenuItem& rhs) : item(0) { + (void) rhs; } virtual ~NCursesMenuItem (); @@ -252,7 +253,7 @@ protected: bool with_frame, bool autoDeleteItems); - inline void OnError (int err) const THROWS(NCursesMenuException) { + inline void OnError (int err) const THROW2(NCursesException const, NCursesMenuException) { if (err != E_OK) THROW(new NCursesMenuException (this, err)); } @@ -631,20 +632,20 @@ protected: const T* p_UserData = STATIC_CAST(T*)(0)) : NCursesMenu(nlines,ncols,begin_y,begin_x) { if (menu) - set_user (const_cast(p_UserData)); + set_user (const_cast(reinterpret_cast(p_UserData))); } public: - NCursesUserMenu (NCursesMenuItem Items[], + NCursesUserMenu (NCursesMenuItem* Items[], const T* p_UserData = STATIC_CAST(T*)(0), bool with_frame=FALSE, bool autoDelete_Items=FALSE) : NCursesMenu (Items, with_frame, autoDelete_Items) { if (menu) - set_user (const_cast(p_UserData)); + set_user (const_cast(reinterpret_cast(p_UserData))); }; - NCursesUserMenu (NCursesMenuItem Items[], + NCursesUserMenu (NCursesMenuItem* Items[], int nlines, int ncols, int begin_y = 0, @@ -653,19 +654,19 @@ public: bool with_frame=FALSE) : NCursesMenu (Items, nlines, ncols, begin_y, begin_x, with_frame) { if (menu) - set_user (const_cast(p_UserData)); + set_user (const_cast(reinterpret_cast(p_UserData))); }; virtual ~NCursesUserMenu() { }; - inline T* UserData (void) const { + inline T* UserData (void) { return reinterpret_cast(get_user ()); }; inline virtual void setUserData (const T* p_UserData) { if (menu) - set_user (const_cast(p_UserData)); + set_user (const_cast(reinterpret_cast(p_UserData))); } }; diff --git a/c++/cursesmain.cc b/c++/cursesmain.cc index 1f82d4a..e870995 100644 --- a/c++/cursesmain.cc +++ b/c++/cursesmain.cc @@ -1,6 +1,6 @@ // * this is for making emacs happy: -*-Mode: C++;-*- /**************************************************************************** - * Copyright (c) 1998-2003,2007 Free Software Foundation, Inc. * + * Copyright (c) 1998-2007,2013 Free Software Foundation, Inc. * * * * Permission is hereby granted, free of charge, to any person obtaining a * * copy of this software and associated documentation files (the * @@ -35,13 +35,15 @@ #include "cursesapp.h" #if CPP_HAS_TRY_CATCH && HAVE_IOSTREAM +#pragma GCC diagnostic ignored "-Weffc++" #include +#pragma GCC diagnostic warning "-Weffc++" #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 $") +MODULE_ID("$Id: cursesmain.cc,v 1.15 2013/09/28 20:56:47 tom Exp $") #if HAVE_LOCALE_H #include diff --git a/c++/cursesp.h b/c++/cursesp.h index 9b63d6d..54b0d58 100644 --- a/c++/cursesp.h +++ b/c++/cursesp.h @@ -1,6 +1,6 @@ // * This makes emacs happy -*-Mode: C++;-*- /**************************************************************************** - * Copyright (c) 1998-2007,2008 Free Software Foundation, Inc. * + * Copyright (c) 1998-2012,2014 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.29 2008/08/16 17:20:23 tom Exp $ +// $Id: cursesp.h,v 1.31 2014/08/09 22:06:26 Adam.Jiang Exp $ #include @@ -86,7 +86,7 @@ protected: return result; } - void OnError (int err) const THROWS(NCursesPanelException) + void OnError (int err) const THROW2(NCursesException const, NCursesPanelException) { if (err==ERR) THROW(new NCursesPanelException (this, err)); @@ -236,7 +236,8 @@ public: : NCursesPanel (nlines, ncols, begin_y, begin_x) { if (p) - set_user (const_cast(p_UserData)); + set_user (const_cast(reinterpret_cast + (p_UserData))); }; // This creates an user panel of the requested size with associated // user data pointed to by p_UserData. @@ -244,14 +245,14 @@ public: NCursesUserPanel(const T* p_UserData = STATIC_CAST(T*)(0)) : NCursesPanel() { if (p) - set_user(const_cast(p_UserData)); + set_user(const_cast(reinterpret_cast(p_UserData))); }; // This creates an user panel associated with the ::stdscr and user data // pointed to by p_UserData. virtual ~NCursesUserPanel() {}; - T* UserData (void) const + T* UserData (void) { return reinterpret_cast(get_user ()); }; @@ -260,7 +261,7 @@ public: virtual void setUserData (const T* p_UserData) { if (p) - set_user (const_cast(p_UserData)); + set_user (const_cast(reinterpret_cast(p_UserData))); } // Associate the user panel with the user data pointed to by p_UserData. }; diff --git a/c++/cursespad.cc b/c++/cursespad.cc index 28c58fa..a534713 100644 --- a/c++/cursespad.cc +++ b/c++/cursespad.cc @@ -1,6 +1,6 @@ // * this is for making emacs happy: -*-Mode: C++;-*- /**************************************************************************** - * Copyright (c) 1998-2007,2008 Free Software Foundation, Inc. * + * Copyright (c) 1998-2012,2013 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,10 +33,9 @@ #include "internal.h" -#include #include -MODULE_ID("$Id: cursespad.cc,v 1.13 2008/08/04 18:59:22 tom Exp $") +MODULE_ID("$Id: cursespad.cc,v 1.17 2013/03/30 19:45:36 tom Exp $") NCursesPad::NCursesPad(int nlines, int ncols) : NCursesWindow(), @@ -220,6 +219,7 @@ void NCursesPad::setSubWindow(NCursesWindow& sub) void NCursesFramedPad::OnOperation(int pad_req) { + (void) pad_req; NCursesWindow* W = Win(); NCursesWindow* W2 = getWindow(); @@ -228,25 +228,45 @@ void NCursesFramedPad::OnOperation(int pad_req) int Height = W->height(); int i, row, col, h_len, v_len; - h_len = (Width*Width + width() - 1)/width(); - if (h_len==0) + int my_width = width(); + + if (my_width != 0) { + h_len = (Width*Width + my_width - 1) / my_width; + if (h_len==0) + h_len = 1; + if (h_len > Width) + h_len = Width; + } else { h_len = 1; - if (h_len > Width) - h_len = Width; + } + + int my_height = height(); - v_len = (Height*Height + height() - 1)/height(); - if (v_len==0) + if (my_height != 0) { + v_len = (Height*Height + my_height - 1) / my_height; + if (v_len==0) + v_len = 1; + if (v_len > Height) + v_len = Height; + } else { v_len = 1; - if (v_len > Height) - v_len = Height; + } - col = (min_col * Width + width() - 1) / width(); - if (col + h_len > Width) - col = Width - h_len; + if (my_width != 0) { + col = (min_col * Width + my_width - 1) / my_width; + if (col + h_len > Width) + col = Width - h_len; + } else { + col = 0; + } - row = (min_row * Height + height() - 1) / height(); - if (row + v_len > Height) - row = Height - v_len; + if (my_height != 0) { + row = (min_row * Height + my_height - 1) / my_height; + if (row + v_len > Height) + row = Height - v_len; + } else { + row = 0; + } W2->vline(1,Width+1,Height); W2->attron(A_REVERSE); diff --git a/c++/cursesw.cc b/c++/cursesw.cc index 47e5cf6..1643877 100644 --- a/c++/cursesw.cc +++ b/c++/cursesw.cc @@ -1,6 +1,6 @@ // * this is for making emacs happy: -*-Mode: C++;-*- /**************************************************************************** - * Copyright (c) 2007-2008,2009 Free Software Foundation, Inc. * + * Copyright (c) 2007-2012,2014 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 * @@ -42,7 +42,7 @@ #include "internal.h" #include "cursesw.h" -MODULE_ID("$Id: cursesw.cc,v 1.51 2009/03/28 21:31:37 tom Exp $") +MODULE_ID("$Id: cursesw.cc,v 1.54 2014/02/01 22:10:42 tom Exp $") #define COLORS_NEED_INITIALIZATION -1 #define COLORS_NOT_INITIALIZED 0 @@ -192,7 +192,6 @@ NCursesWindow::NCursesWindow() constructing(); w = static_cast(0); - set_keyboard(); } NCursesWindow::NCursesWindow(int nlines, int ncols, int begin_y, int begin_x) @@ -285,12 +284,14 @@ static RIPOFFINIT* prip = R_INIT; NCursesWindow::NCursesWindow(WINDOW *win, int ncols) : w(0), alloced(FALSE), par(0), subwins(0), sib(0) { + (void) ncols; initialize(); w = win; } int _nc_xx_ripoff_init(WINDOW *w, int ncols) { + (void) ncols; int res = ERR; RIPOFFINIT init = *prip++; @@ -400,16 +401,16 @@ NCursesWindow::useColors(void) } } -short +NCURSES_PAIRS_T NCursesWindow::getPair() const { - return static_cast(PAIR_NUMBER(getattrs(w))); + return static_cast(PAIR_NUMBER(getattrs(w))); } -short +NCURSES_COLOR_T NCursesWindow::getcolor(int getback) const { - short fore, back; + NCURSES_COLOR_T fore, back; if (HaveColors()) { if (::pair_content(getPair(), &fore, &back) == ERR) @@ -427,27 +428,27 @@ int NCursesWindow::NumberOfColors() return (HaveColors()) ? COLORS : 1; } -short +NCURSES_PAIRS_T NCursesWindow::getcolor() const { return (HaveColors()) ? getPair() : 0; } int -NCursesWindow::setpalette(short fore, short back, short pair) +NCursesWindow::setpalette(NCURSES_COLOR_T fore, NCURSES_COLOR_T back, NCURSES_PAIRS_T pair) { return (HaveColors()) ? ::init_pair(pair, fore, back) : OK; } int -NCursesWindow::setpalette(short fore, short back) +NCursesWindow::setpalette(NCURSES_COLOR_T fore, NCURSES_COLOR_T back) { return setpalette(fore, back, getPair()); } int -NCursesWindow::setcolor(short pair) +NCursesWindow::setcolor(NCURSES_PAIRS_T pair) { if (HaveColors()) { if ((pair < 1) || (pair > COLOR_PAIRS)) diff --git a/c++/cursesw.h b/c++/cursesw.h index b8e921a..ca07b04 100644 --- a/c++/cursesw.h +++ b/c++/cursesw.h @@ -1,7 +1,7 @@ // * This makes emacs happy -*-Mode: C++;-*- // vile:cppmode /**************************************************************************** - * Copyright (c) 1998-2007,2008 Free Software Foundation, Inc. * + * Copyright (c) 1998-2011,2014 Free Software Foundation, Inc. * * * * Permission is hereby granted, free of charge, to any person obtaining a * * copy of this software and associated documentation files (the * @@ -31,7 +31,7 @@ #ifndef NCURSES_CURSESW_H_incl #define NCURSES_CURSESW_H_incl 1 -// $Id: cursesw.h,v 1.48 2008/01/19 21:09:10 tom Exp $ +// $Id: cursesw.h,v 1.50 2014/02/01 22:17:37 tom Exp $ #include @@ -118,7 +118,7 @@ inline int UNDEF(box)(WINDOW *win, int v, int h) { return box(win, v, h); } #endif #ifdef chgat -inline int UNDEF(chgat)(int n, attr_t attr, short color, const void *opts) { +inline int UNDEF(chgat)(int n, attr_t attr, NCURSES_PAIRS_T color, const void *opts) { return chgat(n, attr, color, opts); } #undef chgat #define chgat UNDEF(chgat) @@ -151,7 +151,7 @@ inline int UNDEF(clrtoeol)() { return clrtoeol(); } #endif #ifdef color_set -inline chtype UNDEF(color_set)(short p, void* opts) { return color_set(p, opts); } +inline chtype UNDEF(color_set)(NCURSES_PAIRS_T p, void* opts) { return color_set(p, opts); } #undef color_set #define color_set UNDEF(color_set) #endif @@ -361,7 +361,7 @@ inline int UNDEF(mvaddstr)(int y, int x, const char * str) #ifdef mvchgat inline int UNDEF(mvchgat)(int y, int x, int n, - attr_t attr, short color, const void *opts) { + attr_t attr, NCURSES_PAIRS_T color, const void *opts) { return mvchgat(y, x, n, attr, color, opts); } #undef mvchgat #define mvchgat UNDEF(mvchgat) @@ -463,7 +463,7 @@ inline int UNDEF(mvwaddstr)(WINDOW *win, int y, int x, const char * str) #ifdef mvwchgat inline int UNDEF(mvwchgat)(WINDOW *win, int y, int x, int n, - attr_t attr, short color, const void *opts) { + attr_t attr, NCURSES_PAIRS_T color, const void *opts) { return mvwchgat(win, y, x, n, attr, color, opts); } #undef mvwchgat #define mvwchgat UNDEF(mvwchgat) @@ -763,10 +763,10 @@ private: void set_keyboard(); - short getcolor(int getback) const; - short getPair() const; + NCURSES_COLOR_T getcolor(int getback) const; + NCURSES_PAIRS_T getPair() const; - static int setpalette(short fore, short back, short pair); + static int setpalette(NCURSES_COLOR_T fore, NCURSES_COLOR_T back, NCURSES_PAIRS_T pair); static int colorInitialized; // This private constructor is only used during the initialization @@ -896,19 +896,19 @@ public: int maxy() const { return getmaxy(w) == ERR ? ERR : getmaxy(w)-1; } // Largest y coord in window - short getcolor() const; + NCURSES_PAIRS_T getcolor() const; // Actual color pair - short foreground() const { return getcolor(0); } + NCURSES_COLOR_T foreground() const { return getcolor(0); } // Actual foreground color - short background() const { return getcolor(1); } + NCURSES_COLOR_T background() const { return getcolor(1); } // Actual background color - int setpalette(short fore, short back); + int setpalette(NCURSES_COLOR_T fore, NCURSES_COLOR_T back); // Set color palette entry - int setcolor(short pair); + int setcolor(NCURSES_PAIRS_T pair); // Set actually used palette entry // ------------------------------------------------------------------------- @@ -1107,18 +1107,18 @@ public: chtype attrget() { return ::getattrs(w); } // Get the window attributes; - int color_set(short color_pair_number, void* opts=NULL) { + int color_set(NCURSES_PAIRS_T color_pair_number, void* opts=NULL) { return ::wcolor_set(w, color_pair_number, opts); } // Set the window color attribute; - int chgat(int n, attr_t attr, short color, const void *opts=NULL) { + int chgat(int n, attr_t attr, NCURSES_PAIRS_T color, const void *opts=NULL) { return ::wchgat(w, n, attr, color, opts); } // Change the attributes of the next n characters in the current line. If // n is negative or greater than the number of remaining characters in the // line, the attributes will be changed up to the end of the line. int chgat(int y, int x, - int n, attr_t attr, short color, const void *opts=NULL) { + int n, attr_t attr, NCURSES_PAIRS_T color, const void *opts=NULL) { return ::mvwchgat(w, y, x, n, attr, color, opts); } // Move the cursor to the requested position and then perform chgat() as // described above. @@ -1438,16 +1438,19 @@ protected: // The driver translates the keystroke c into an Pad_Request virtual void OnUnknownOperation(int pad_req) { + (void) pad_req; ::beep(); } // This is called if the driver returns an unknown op-code virtual void OnNavigationError(int pad_req) { + (void) pad_req; ::beep(); } // This is called if a navigation request couldn't be satisfied virtual void OnOperation(int pad_req) { + (void) pad_req; }; // OnOperation is called if a Pad_Operation was executed and just before // the refresh() operation is done. @@ -1542,11 +1545,15 @@ public: } void setWindow(NCursesWindow& view, int v_grid = 1, int h_grid = 1) { + (void) view; + (void) v_grid; + (void) h_grid; err_handler("Operation not allowed"); } // Disable this call; the viewport is already defined void setSubWindow(NCursesWindow& sub) { + (void) sub; err_handler("Operation not allowed"); } // Disable this call; the viewport subwindow is already defined diff --git a/c++/cursslk.cc b/c++/cursslk.cc index cfbc9da..23785df 100644 --- a/c++/cursslk.cc +++ b/c++/cursslk.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,2012 Free Software Foundation, Inc. * * * * Permission is hereby granted, free of charge, to any person obtaining a * * copy of this software and associated documentation files (the * @@ -35,14 +35,15 @@ #include "cursslk.h" #include "cursesapp.h" -MODULE_ID("$Id: cursslk.cc,v 1.15 2005/08/06 22:12:36 tom Exp $") +MODULE_ID("$Id: cursslk.cc,v 1.16 2012/02/23 10:41:56 tom Exp $") Soft_Label_Key_Set::Soft_Label_Key& Soft_Label_Key_Set::Soft_Label_Key::operator=(char *text) { delete[] label; - label = new char[1 + ::strlen(text)]; - (::strcpy)(label,text); + size_t need = 1 + ::strlen(text); + label = new char[need]; + ::_nc_STRCPY(label,text,need); return *this; } diff --git a/c++/demo.cc b/c++/demo.cc index 3543342..8bcfb14 100644 --- a/c++/demo.cc +++ b/c++/demo.cc @@ -1,6 +1,6 @@ // * This makes emacs happy -*-Mode: C++;-*- /**************************************************************************** - * Copyright (c) 1998-2007,2008 Free Software Foundation, Inc. * + * Copyright (c) 1998-2011,2012 Free Software Foundation, Inc. * * * * Permission is hereby granted, free of charge, to any person obtaining a * * copy of this software and associated documentation files (the * @@ -35,7 +35,7 @@ * Demo code for NCursesMenu and NCursesForm written by * Juergen Pfeifer * - * $Id: demo.cc,v 1.39 2008/12/07 02:07:34 juergen Exp $ + * $Id: demo.cc,v 1.41 2012/02/23 10:41:56 tom Exp $ */ #include "internal.h" @@ -220,6 +220,7 @@ private: int chk; protected: bool field_check(NCursesFormField& f) { + (void) f; return TRUE; } bool char_check(int c) { @@ -319,7 +320,7 @@ public: for(int i=1; i <= S->labels(); i++) { char buf[8]; assert(i < 100); - ::sprintf(buf, "Frm%02d", i); + ::_nc_SPRINTF(buf, _nc_SLIMIT(sizeof(buf)) "Frm%02d", i); (*S)[i] = buf; // Text (*S)[i] = Soft_Label_Key_Set::Soft_Label_Key::Left; // Justification } @@ -539,7 +540,7 @@ void TestApplication::init_labels(Soft_Label_Key_Set& S) const for(int i=1; i <= S.labels(); i++) { char buf[8]; assert(i < 100); - ::sprintf(buf, "Key%02d", i); + ::_nc_SPRINTF(buf, _nc_SLIMIT(sizeof(buf)) "Key%02d", i); S[i] = buf; // Text S[i] = Soft_Label_Key_Set::Soft_Label_Key::Left; // Justification } diff --git a/c++/etip.h.in b/c++/etip.h.in index 20642a6..9f642ee 100644 --- a/c++/etip.h.in +++ b/c++/etip.h.in @@ -1,6 +1,6 @@ // * This makes emacs happy -*-Mode: C++;-*- /**************************************************************************** - * Copyright (c) 1998-2007,2008 Free Software Foundation, Inc. * + * Copyright (c) 1998-2011,2012 Free Software Foundation, Inc. * * * * Permission is hereby granted, free of charge, to any person obtaining a * * copy of this software and associated documentation files (the * @@ -31,7 +31,7 @@ * Author: Juergen Pfeifer, 1997 * ****************************************************************************/ -// $Id: etip.h.in,v 1.37 2008/08/30 19:27:32 tom Exp $ +// $Id: etip.h.in,v 1.39 2012/12/29 21:50:44 tom Exp $ #ifndef NCURSES_ETIP_H_incl #define NCURSES_ETIP_H_incl 1 @@ -184,7 +184,7 @@ public: NCursesPanelException (const char *msg, int err) : NCursesException (msg, err), - p (NULL) + p (0) {}; NCursesPanelException (const NCursesPanel* panel, @@ -196,7 +196,7 @@ public: NCursesPanelException (int err) : NCursesException ("panel library error", err), - p (NULL) + p (0) {}; NCursesPanelException (const NCursesPanel* panel, @@ -235,7 +235,7 @@ public: NCursesMenuException (const char *msg, int err) : NCursesException (msg, err), - m (NULL) + m (0) {}; NCursesMenuException (const NCursesMenu* menu, @@ -247,7 +247,7 @@ public: NCursesMenuException (int err) : NCursesException ("menu library error", err), - m (NULL) + m (0) {}; NCursesMenuException (const NCursesMenu* menu, @@ -286,7 +286,7 @@ public: NCursesFormException (const char *msg, int err) : NCursesException (msg, err), - f (NULL) + f (0) {}; NCursesFormException (const NCursesForm* form, @@ -298,7 +298,7 @@ public: NCursesFormException (int err) : NCursesException ("form library error", err), - f (NULL) + f (0) {}; NCursesFormException (const NCursesForm* form, @@ -367,11 +367,13 @@ inline void THROW(const NCursesException *e) { #define NCURSES_CPP_TRY /* nothing */ #define NCURSES_CPP_CATCH(e) if (false) #define THROWS(s) /* nothing */ +#define THROW2(s,t) /* 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) +#define THROW2(s,t) throw(s,t) #endif } diff --git a/c++/internal.h b/c++/internal.h index 64d57cd..1f6b4a6 100644 --- a/c++/internal.h +++ b/c++/internal.h @@ -1,6 +1,6 @@ // * This makes emacs happy -*-Mode: C++;-*- /**************************************************************************** - * Copyright (c) 1998-2007,2008 Free Software Foundation, Inc. * + * Copyright (c) 1998-2008,2012 Free Software Foundation, Inc. * * * * Permission is hereby granted, free of charge, to any person obtaining a * * copy of this software and associated documentation files (the * @@ -31,7 +31,7 @@ * Author: Juergen Pfeifer, 1997 * ****************************************************************************/ -// $Id: internal.h,v 1.17 2008/12/07 02:07:34 juergen Exp $ +// $Id: internal.h,v 1.18 2012/02/23 10:41:56 tom Exp $ #ifndef NCURSES_CPLUS_INTERNAL_H #define NCURSES_CPLUS_INTERNAL_H 1 @@ -62,4 +62,6 @@ #define NULL 0 #endif +#include + #endif /* NCURSES_CPLUS_INTERNAL_H */ diff --git a/c++/modules b/c++/modules index bc4fae5..56ddad5 100644 --- a/c++/modules +++ b/c++/modules @@ -1,7 +1,7 @@ # Program modules -# $Id: modules,v 1.7 2006/12/24 00:53:08 tom Exp $ +# $Id: modules,v 1.11 2013/03/30 19:41:11 tom Exp $ ############################################################################## -# Copyright (c) 1998,2006 Free Software Foundation, Inc. # +# Copyright (c) 1998-2006,2013 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"), # @@ -32,14 +32,13 @@ # @ base -cursesf c++ $(srcdir) $(cursesf_h) $(cursesapp_h) -cursesm c++ $(srcdir) $(cursesm_h) $(cursesapp_h) -cursesp c++ $(srcdir) $(cursesp_h) -cursesw c++ $(srcdir) $(cursesw_h) -cursespad c++ $(srcdir) $(cursesw_h) -cursslk c++ $(srcdir) $(cursslk_h) $(cursesapp_h) -cursesapp c++ $(srcdir) $(cursesapp_h) -cursesmain c++ $(srcdir) $(cursesapp_h) -demo c++ $(srcdir) $(cursesf_h) $(cursesm_h) $(cursesapp_h) +cursesf c++ $(srcdir) $(internal_h) $(cursesf_h) $(cursesapp_h) +cursesm c++ $(srcdir) $(internal_h) $(cursesm_h) $(cursesapp_h) +cursesw c++ $(srcdir) $(internal_h) $(cursesw_h) +cursespad c++ $(srcdir) $(internal_h) $(cursesw_h) +cursesp c++ $(srcdir) $(internal_h) $(cursesp_h) +cursslk c++ $(srcdir) $(internal_h) $(cursesapp_h) +cursesapp c++ $(srcdir) $(internal_h) $(cursesapp_h) +cursesmain c++ $(srcdir) $(internal_h) $(cursesapp_h) $(INCDIR)/nc_alloc.h # vile:makemode -- cgit v1.2.1