// * This makes emacs happy -*-Mode: C++;-*-
/****************************************************************************
* Copyright (c) 1998-2012,2017 Free Software Foundation, Inc. *
* Permission is hereby granted, free of charge, to any person obtaining a *
* copy of this software and associated documentation files (the *
* "Software"), to deal in the Software without restriction, including *
* without limitation the rights to use, copy, modify, merge, publish, *
* distribute, distribute with modifications, sublicense, and/or sell *
* copies of the Software, and to permit persons to whom the Software is *
* furnished to do so, subject to the following conditions: *
* The above copyright notice and this permission notice shall be included *
* in all copies or substantial portions of the Software. *
* THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS *
* OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF *
* MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. *
* IN NO EVENT SHALL THE ABOVE COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, *
* DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR *
* OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR *
* THE USE OR OTHER DEALINGS IN THE SOFTWARE. *
* Except as contained in this notice, the name(s) of the above copyright *
* holders shall not be used in advertising or otherwise to promote the *
* sale, use or other dealings in this Software without prior written *
****************************************************************************/
/****************************************************************************
* Author: Juergen Pfeifer, 1997 *
****************************************************************************/
// $Id: etip.h.in,v 1.41 2017/06/24 21:57:16 tom Exp $
#ifndef NCURSES_ETIP_H_incl
#define NCURSES_ETIP_H_incl 1
// These are substituted at configure/build time
#ifndef HAVE_GXX_BUILTIN_H
#define HAVE_GXX_BUILTIN_H 0
#ifndef HAVE_GPP_BUILTIN_H
#define HAVE_GPP_BUILTIN_H 0
#ifndef ETIP_NEEDS_MATH_H
#define ETIP_NEEDS_MATH_H 0
#ifndef ETIP_NEEDS_MATH_EXCEPTION
#define ETIP_NEEDS_MATH_EXCEPTION 0
#ifndef CPP_HAS_PARAM_INIT
#define CPP_HAS_PARAM_INIT 0
#ifndef CPP_HAS_STATIC_CAST
#define CPP_HAS_STATIC_CAST 1
#ifndef IOSTREAM_NAMESPACE
#define IOSTREAM_NAMESPACE 1
# if ((__GNUG__ <= 2) && (__GNUC_MINOR__ < 8))
# if HAVE_BUILTIN_H || HAVE_GXX_BUILTIN_H || HAVE_GPP_BUILTIN_H
# if ETIP_NEEDS_MATH_EXCEPTION
# define exception math_exception
# define exception builtin_exception
# include <gpp/builtin.h>
# elif HAVE_GXX_BUILTIN_H
# include <g++/builtin.h>
#elif defined (__SUNPRO_CC)
#define NCURSES_PARAM_INIT(value) = value
#define NCURSES_PARAM_INIT(value) /*nothing*/
#define STATIC_CAST(s) static_cast<s>
#define STATIC_CAST(s) (s)
class NCURSES_IMPEXP NCursesPanel;
class NCURSES_IMPEXP NCursesMenu;
class NCURSES_IMPEXP NCursesForm;
class NCURSES_IMPEXP NCursesException
NCursesException (const char* msg, int err)
: message(msg), errorno (err)
NCursesException (const char* msg)
: message(msg), errorno (E_SYSTEM_ERROR)
NCursesException& operator=(const NCursesException& rhs)
NCursesException(const NCursesException& rhs)
: message(rhs.message), errorno(rhs.errorno)
virtual const char *classname() const {
virtual ~NCursesException()
class NCURSES_IMPEXP NCursesPanelException : public NCursesException
NCursesPanelException (const char *msg, int err) :
NCursesException (msg, err),
NCursesPanelException (const NCursesPanel* panel,
NCursesException (msg, err),
NCursesPanelException (int err) :
NCursesException ("panel library error", err),
NCursesPanelException (const NCursesPanel* panel,
NCursesException ("panel library error", err),
NCursesPanelException& operator=(const NCursesPanelException& rhs)
NCursesException::operator=(rhs);
NCursesPanelException(const NCursesPanelException& rhs)
: NCursesException(rhs), p(rhs.p)
virtual const char *classname() const {
virtual ~NCursesPanelException()
class NCURSES_IMPEXP NCursesMenuException : public NCursesException
NCursesMenuException (const char *msg, int err) :
NCursesException (msg, err),
NCursesMenuException (const NCursesMenu* menu,
NCursesException (msg, err),
NCursesMenuException (int err) :
NCursesException ("menu library error", err),
NCursesMenuException (const NCursesMenu* menu,
NCursesException ("menu library error", err),
NCursesMenuException& operator=(const NCursesMenuException& rhs)
NCursesException::operator=(rhs);
NCursesMenuException(const NCursesMenuException& rhs)
: NCursesException(rhs), m(rhs.m)
virtual const char *classname() const {
virtual ~NCursesMenuException()
class NCURSES_IMPEXP NCursesFormException : public NCursesException
NCursesFormException (const char *msg, int err) :
NCursesException (msg, err),
NCursesFormException (const NCursesForm* form,
NCursesException (msg, err),
NCursesFormException (int err) :
NCursesException ("form library error", err),
NCursesFormException (const NCursesForm* form,
NCursesException ("form library error", err),
NCursesFormException& operator=(const NCursesFormException& rhs)
NCursesException::operator=(rhs);
NCursesFormException(const NCursesFormException& rhs)
: NCursesException(rhs), f(rhs.f)
virtual const char *classname() const {
virtual ~NCursesFormException()
#if !((defined(__GNUG__) && defined(__EXCEPTIONS) && (__GNUG__ < 7)) || defined(__SUNPRO_CC))
extern "C" void exit(int);
inline void THROW(const NCursesException *e) {
#if defined(__GNUG__) && defined(__EXCEPTIONS)
# if ((__GNUG__ <= 2) && (__GNUC_MINOR__ < 8))
(*lib_error_handler)(e ? e->classname() : "", e ? e->message : "");
// g++ 7.0 warns about deprecation, but lacks the predefined symbols
std::cerr << "Found a problem - goodbye" << std::endl;
# define CPP_HAS_TRY_CATCH 1
#elif defined(__SUNPRO_CC)
# if !defined(__SUNPRO_CC_COMPAT) || (__SUNPRO_CC_COMPAT < 5)
genericerror(1, ((e != 0) ? (char *)(e->message) : ""));
# define CPP_HAS_TRY_CATCH 1
cerr << e->message << endl;
#ifndef CPP_HAS_TRY_CATCH
#define CPP_HAS_TRY_CATCH 0
#define NCURSES_CPP_TRY /* nothing */
#define NCURSES_CPP_CATCH(e) if (false)
#define THROWS(s) /* nothing */
#define THROW2(s,t) /* nothing */
#define NCURSES_CPP_TRY try
#define NCURSES_CPP_CATCH(e) catch(e)
#if defined(__cpp_noexcept_function_type) && (__cpp_noexcept_function_type >= 201510)
// C++17 deprecates the usage of throw().
#define THROWS(s) /* nothing */
#define THROW2(s,t) /* nothing */
#define THROWS(s) throw(s)
#define THROW2(s,t) throw(s,t)
#endif /* NCURSES_ETIP_H_incl */