1 // * This makes emacs happy -*-Mode: C++;-*-
2 /****************************************************************************
3 * Copyright (c) 1998,1999 Free Software Foundation, Inc. *
5 * Permission is hereby granted, free of charge, to any person obtaining a *
6 * copy of this software and associated documentation files (the *
7 * "Software"), to deal in the Software without restriction, including *
8 * without limitation the rights to use, copy, modify, merge, publish, *
9 * distribute, distribute with modifications, sublicense, and/or sell *
10 * copies of the Software, and to permit persons to whom the Software is *
11 * furnished to do so, subject to the following conditions: *
13 * The above copyright notice and this permission notice shall be included *
14 * in all copies or substantial portions of the Software. *
16 * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS *
17 * OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF *
18 * MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. *
19 * IN NO EVENT SHALL THE ABOVE COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, *
20 * DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR *
21 * OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR *
22 * THE USE OR OTHER DEALINGS IN THE SOFTWARE. *
24 * Except as contained in this notice, the name(s) of the above copyright *
25 * holders shall not be used in advertising or otherwise to promote the *
26 * sale, use or other dealings in this Software without prior written *
28 ****************************************************************************/
30 /****************************************************************************
31 * Author: Juergen Pfeifer <juergen.pfeifer@gmx.net> 1997 *
32 ****************************************************************************/
34 // $Id: etip.h.in,v 1.13 1999/09/12 02:01:59 tom Exp $
39 // These are substituted at configure/build time
40 #ifndef HAVE_BUILTIN_H
41 #define HAVE_BUILTIN_H 0
44 #ifndef HAVE_GXX_BUILTIN_H
45 #define HAVE_GXX_BUILTIN_H 0
48 #ifndef HAVE_GPP_BUILTIN_H
49 #define HAVE_GPP_BUILTIN_H 0
53 #define HAVE_TYPEINFO 0
57 #define HAVE_VALUES_H 0
60 #ifndef ETIP_NEEDS_MATH_H
61 #define ETIP_NEEDS_MATH_H 0
64 #ifndef ETIP_NEEDS_MATH_EXCEPTION
65 #define ETIP_NEEDS_MATH_EXCEPTION 0
68 #ifndef CPP_HAS_PARAM_INIT
69 #define CPP_HAS_PARAM_INIT 0
73 # if ((__GNUG__ <= 2) && (__GNUC_MINOR__ < 8))
81 # if HAVE_BUILTIN_H || HAVE_GXX_BUILTIN_H || HAVE_GPP_BUILTIN_H
82 # if ETIP_NEEDS_MATH_H
83 # if ETIP_NEEDS_MATH_EXCEPTION
85 # define exception math_exception
90 # define exception builtin_exception
91 # if HAVE_GPP_BUILTIN_H
92 # include <gpp/builtin.h>
93 # elif HAVE_GXX_BUILTIN_H
94 # include <g++/builtin.h>
100 #elif defined (__SUNPRO_CC)
101 # include <generic.h>
118 #if CPP_HAS_PARAM_INIT
119 #define NCURSES_PARAM_INIT(value) = value
121 #define NCURSES_PARAM_INIT(value) /*nothing*/
124 // Forward Declarations
129 class NCursesException
135 NCursesException (const char* msg, int err)
136 : message(msg), errorno (err)
139 NCursesException (const char* msg)
140 : message(msg), errorno (E_SYSTEM_ERROR)
143 virtual const char *classname() const {
144 return "NCursesWindow";
148 class NCursesPanelException : public NCursesException
151 const NCursesPanel* p;
153 NCursesPanelException (const char *msg, int err) :
154 NCursesException (msg, err),
158 NCursesPanelException (const NCursesPanel* panel,
161 NCursesException (msg, err),
165 NCursesPanelException (int err) :
166 NCursesException ("panel library error", err),
170 NCursesPanelException (const NCursesPanel* panel,
172 NCursesException ("panel library error", err),
176 virtual const char *classname() const {
177 return "NCursesPanel";
182 class NCursesMenuException : public NCursesException
185 const NCursesMenu* m;
187 NCursesMenuException (const char *msg, int err) :
188 NCursesException (msg, err),
192 NCursesMenuException (const NCursesMenu* menu,
195 NCursesException (msg, err),
199 NCursesMenuException (int err) :
200 NCursesException ("menu library error", err),
204 NCursesMenuException (const NCursesMenu* menu,
206 NCursesException ("menu library error", err),
210 virtual const char *classname() const {
211 return "NCursesMenu";
216 class NCursesFormException : public NCursesException
219 const NCursesForm* f;
221 NCursesFormException (const char *msg, int err) :
222 NCursesException (msg, err),
226 NCursesFormException (const NCursesForm* form,
229 NCursesException (msg, err),
233 NCursesFormException (int err) :
234 NCursesException ("form library error", err),
238 NCursesFormException (const NCursesForm* form,
240 NCursesException ("form library error", err),
244 virtual const char *classname() const {
245 return "NCursesForm";
250 #if !(defined(__GNUG__)||defined(__SUNPRO_CC))
251 # include <iostream.h>
252 extern "C" void exit(int);
255 inline void THROW(const NCursesException *e) {
256 #if defined(__GNUG__)
257 # if ((__GNUG__ <= 2) && (__GNUC_MINOR__ < 8))
258 (*lib_error_handler)(e?e->classname():"",e?e->message:"");
262 #elif defined(__SUNPRO_CC)
263 genericerror(1, ((e != 0) ? (char *)(e->message) : ""));
266 cerr << e->message << endl;