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 * Contact: http://www.familiepfeifer.de/Contact.aspx?Lang=en *
33 ****************************************************************************/
35 // $Id: etip.h.in,v 1.24 2002/10/12 22:33:07 Dimitar.Zhekov Exp $
37 #ifndef NCURSES_ETIP_H_incl
38 #define NCURSES_ETIP_H_incl 1
40 // These are substituted at configure/build time
41 #ifndef HAVE_BUILTIN_H
42 #define HAVE_BUILTIN_H 0
45 #ifndef HAVE_GXX_BUILTIN_H
46 #define HAVE_GXX_BUILTIN_H 0
49 #ifndef HAVE_GPP_BUILTIN_H
50 #define HAVE_GPP_BUILTIN_H 0
53 #ifndef HAVE_STRSTREAM_H
54 #define HAVE_STRSTREAM_H 0
58 #define HAVE_TYPEINFO 0
62 #define HAVE_VALUES_H 0
65 #ifndef ETIP_NEEDS_MATH_H
66 #define ETIP_NEEDS_MATH_H 0
69 #ifndef ETIP_NEEDS_MATH_EXCEPTION
70 #define ETIP_NEEDS_MATH_EXCEPTION 0
73 #ifndef CPP_HAS_PARAM_INIT
74 #define CPP_HAS_PARAM_INIT 0
77 #ifndef USE_STRSTREAM_VSCAN
78 #define USE_STRSTREAM_VSCAN 0
81 #ifndef USE_STRSTREAM_VSCAN_CAST
82 #define USE_STRSTREAM_VSCAN_CAST 0
86 # if ((__GNUG__ <= 2) && (__GNUC_MINOR__ < 8))
94 # if HAVE_BUILTIN_H || HAVE_GXX_BUILTIN_H || HAVE_GPP_BUILTIN_H
95 # if ETIP_NEEDS_MATH_H
96 # if ETIP_NEEDS_MATH_EXCEPTION
98 # define exception math_exception
103 # define exception builtin_exception
104 # if HAVE_GPP_BUILTIN_H
105 # include <gpp/builtin.h>
106 # elif HAVE_GXX_BUILTIN_H
107 # include <g++/builtin.h>
109 # include <builtin.h>
113 #elif defined (__SUNPRO_CC)
114 # include <generic.h>
120 #include <ncurses_dll.h>
133 #if CPP_HAS_PARAM_INIT
134 #define NCURSES_PARAM_INIT(value) = value
136 #define NCURSES_PARAM_INIT(value) /*nothing*/
139 // Forward Declarations
140 class NCURSES_IMPEXP NCursesPanel;
141 class NCURSES_IMPEXP NCursesMenu;
142 class NCURSES_IMPEXP NCursesForm;
144 class NCURSES_IMPEXP NCursesException
150 NCursesException (const char* msg, int err)
151 : message(msg), errorno (err)
154 NCursesException (const char* msg)
155 : message(msg), errorno (E_SYSTEM_ERROR)
158 virtual const char *classname() const {
159 return "NCursesWindow";
163 class NCURSES_IMPEXP NCursesPanelException : public NCursesException
166 const NCursesPanel* p;
168 NCursesPanelException (const char *msg, int err) :
169 NCursesException (msg, err),
173 NCursesPanelException (const NCursesPanel* panel,
176 NCursesException (msg, err),
180 NCursesPanelException (int err) :
181 NCursesException ("panel library error", err),
185 NCursesPanelException (const NCursesPanel* panel,
187 NCursesException ("panel library error", err),
191 virtual const char *classname() const {
192 return "NCursesPanel";
197 class NCURSES_IMPEXP NCursesMenuException : public NCursesException
200 const NCursesMenu* m;
202 NCursesMenuException (const char *msg, int err) :
203 NCursesException (msg, err),
207 NCursesMenuException (const NCursesMenu* menu,
210 NCursesException (msg, err),
214 NCursesMenuException (int err) :
215 NCursesException ("menu library error", err),
219 NCursesMenuException (const NCursesMenu* menu,
221 NCursesException ("menu library error", err),
225 virtual const char *classname() const {
226 return "NCursesMenu";
231 class NCURSES_IMPEXP NCursesFormException : public NCursesException
234 const NCursesForm* f;
236 NCursesFormException (const char *msg, int err) :
237 NCursesException (msg, err),
241 NCursesFormException (const NCursesForm* form,
244 NCursesException (msg, err),
248 NCursesFormException (int err) :
249 NCursesException ("form library error", err),
253 NCursesFormException (const NCursesForm* form,
255 NCursesException ("form library error", err),
259 virtual const char *classname() const {
260 return "NCursesForm";
265 #if !((defined(__GNUG__) && defined(__EXCEPTIONS)) || defined(__SUNPRO_CC))
266 # include <iostream.h>
267 extern "C" void exit(int);
270 inline void THROW(const NCursesException *e) {
271 #if defined(__GNUG__) && defined(__EXCEPTIONS)
272 # if ((__GNUG__ <= 2) && (__GNUC_MINOR__ < 8))
273 (*lib_error_handler)(e?e->classname():"",e?e->message:"");
277 #elif defined(__SUNPRO_CC)
278 # if !defined(__SUNPRO_CC_COMPAT) || (__SUNPRO_CC_COMPAT < 5)
279 genericerror(1, ((e != 0) ? (char *)(e->message) : ""));
285 cerr << e->message << endl;
292 #endif // NCURSES_ETIP_H_incl