1 // * This makes emacs happy -*-Mode: C++;-*-
2 /****************************************************************************
3 * Copyright (c) 1998,1999,2000,2001 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, 1997 *
32 ****************************************************************************/
34 // $Id: etip.h.in,v 1.25 2003/10/25 15:05:58 tom Exp $
36 #ifndef NCURSES_ETIP_H_incl
37 #define NCURSES_ETIP_H_incl 1
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
52 #ifndef HAVE_STRSTREAM_H
53 #define HAVE_STRSTREAM_H 0
57 #define HAVE_TYPEINFO 0
61 #define HAVE_VALUES_H 0
64 #ifndef ETIP_NEEDS_MATH_H
65 #define ETIP_NEEDS_MATH_H 0
68 #ifndef ETIP_NEEDS_MATH_EXCEPTION
69 #define ETIP_NEEDS_MATH_EXCEPTION 0
72 #ifndef CPP_HAS_PARAM_INIT
73 #define CPP_HAS_PARAM_INIT 0
76 #ifndef USE_STRSTREAM_VSCAN
77 #define USE_STRSTREAM_VSCAN 0
80 #ifndef USE_STRSTREAM_VSCAN_CAST
81 #define USE_STRSTREAM_VSCAN_CAST 0
85 # if ((__GNUG__ <= 2) && (__GNUC_MINOR__ < 8))
93 # if HAVE_BUILTIN_H || HAVE_GXX_BUILTIN_H || HAVE_GPP_BUILTIN_H
94 # if ETIP_NEEDS_MATH_H
95 # if ETIP_NEEDS_MATH_EXCEPTION
97 # define exception math_exception
102 # define exception builtin_exception
103 # if HAVE_GPP_BUILTIN_H
104 # include <gpp/builtin.h>
105 # elif HAVE_GXX_BUILTIN_H
106 # include <g++/builtin.h>
108 # include <builtin.h>
112 #elif defined (__SUNPRO_CC)
113 # include <generic.h>
119 #include <ncurses_dll.h>
132 #if CPP_HAS_PARAM_INIT
133 #define NCURSES_PARAM_INIT(value) = value
135 #define NCURSES_PARAM_INIT(value) /*nothing*/
138 // Forward Declarations
139 class NCURSES_IMPEXP NCursesPanel;
140 class NCURSES_IMPEXP NCursesMenu;
141 class NCURSES_IMPEXP NCursesForm;
143 class NCURSES_IMPEXP NCursesException
149 NCursesException (const char* msg, int err)
150 : message(msg), errorno (err)
153 NCursesException (const char* msg)
154 : message(msg), errorno (E_SYSTEM_ERROR)
157 virtual const char *classname() const {
158 return "NCursesWindow";
162 class NCURSES_IMPEXP NCursesPanelException : public NCursesException
165 const NCursesPanel* p;
167 NCursesPanelException (const char *msg, int err) :
168 NCursesException (msg, err),
172 NCursesPanelException (const NCursesPanel* panel,
175 NCursesException (msg, err),
179 NCursesPanelException (int err) :
180 NCursesException ("panel library error", err),
184 NCursesPanelException (const NCursesPanel* panel,
186 NCursesException ("panel library error", err),
190 virtual const char *classname() const {
191 return "NCursesPanel";
196 class NCURSES_IMPEXP NCursesMenuException : public NCursesException
199 const NCursesMenu* m;
201 NCursesMenuException (const char *msg, int err) :
202 NCursesException (msg, err),
206 NCursesMenuException (const NCursesMenu* menu,
209 NCursesException (msg, err),
213 NCursesMenuException (int err) :
214 NCursesException ("menu library error", err),
218 NCursesMenuException (const NCursesMenu* menu,
220 NCursesException ("menu library error", err),
224 virtual const char *classname() const {
225 return "NCursesMenu";
230 class NCURSES_IMPEXP NCursesFormException : public NCursesException
233 const NCursesForm* f;
235 NCursesFormException (const char *msg, int err) :
236 NCursesException (msg, err),
240 NCursesFormException (const NCursesForm* form,
243 NCursesException (msg, err),
247 NCursesFormException (int err) :
248 NCursesException ("form library error", err),
252 NCursesFormException (const NCursesForm* form,
254 NCursesException ("form library error", err),
258 virtual const char *classname() const {
259 return "NCursesForm";
264 #if !((defined(__GNUG__) && defined(__EXCEPTIONS)) || defined(__SUNPRO_CC))
265 # include <iostream.h>
266 extern "C" void exit(int);
269 inline void THROW(const NCursesException *e) {
270 #if defined(__GNUG__) && defined(__EXCEPTIONS)
271 # if ((__GNUG__ <= 2) && (__GNUC_MINOR__ < 8))
272 (*lib_error_handler)(e?e->classname():"",e?e->message:"");
276 #elif defined(__SUNPRO_CC)
277 # if !defined(__SUNPRO_CC_COMPAT) || (__SUNPRO_CC_COMPAT < 5)
278 genericerror(1, ((e != 0) ? (char *)(e->message) : ""));
284 cerr << e->message << endl;
291 #endif // NCURSES_ETIP_H_incl