1 // * This makes emacs happy -*-Mode: C++;-*-
2 /****************************************************************************
3 * Copyright (c) 1998 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@T-Online.de> 1997 *
32 ****************************************************************************/
34 // $Id: etip.h.in,v 1.4 1998/02/17 09:01:38 juergen Exp $
39 // These are substituted at configure/build time
40 #ifndef HAVE_BUILTIN_H
41 #define HAVE_BUILTIN_H 0
45 #define HAVE_TYPEINFO 0
49 #define HAVE_VALUES_H 0
53 # if ((__GNUG__ <= 2) && (__GNUC_MINOR__ < 8))
62 # define exception builtin_exception
66 #elif defined (__SUNPRO_CC)
83 // Forward Declarations
88 class NCursesException
94 NCursesException (const char* msg, int err)
95 : message(msg), errorno (err)
98 NCursesException (const char* msg)
99 : message(msg), errorno (E_SYSTEM_ERROR)
102 virtual const char *classname() const {
103 return "NCursesWindow";
107 class NCursesPanelException : public NCursesException
110 const NCursesPanel* p;
112 NCursesPanelException (const char *msg, int err) :
113 NCursesException (msg, err),
117 NCursesPanelException (const NCursesPanel* panel,
120 NCursesException (msg, err),
124 NCursesPanelException (int err) :
125 NCursesException ("panel library error", err),
129 NCursesPanelException (const NCursesPanel* panel,
131 NCursesException ("panel library error", err),
135 virtual const char *classname() const {
136 return "NCursesPanel";
141 class NCursesMenuException : public NCursesException
144 const NCursesMenu* m;
146 NCursesMenuException (const char *msg, int err) :
147 NCursesException (msg, err),
151 NCursesMenuException (const NCursesMenu* menu,
154 NCursesException (msg, err),
158 NCursesMenuException (int err) :
159 NCursesException ("menu library error", err),
163 NCursesMenuException (const NCursesMenu* menu,
165 NCursesException ("menu library error", err),
169 virtual const char *classname() const {
170 return "NCursesMenu";
175 class NCursesFormException : public NCursesException
178 const NCursesForm* f;
180 NCursesFormException (const char *msg, int err) :
181 NCursesException (msg, err),
185 NCursesFormException (const NCursesForm* form,
188 NCursesException (msg, err),
192 NCursesFormException (int err) :
193 NCursesException ("form library error", err),
197 NCursesFormException (const NCursesForm* form,
199 NCursesException ("form library error", err),
203 virtual const char *classname() const {
204 return "NCursesForm";
209 #if !(defined(__GNUG__)||defined(__SUNPRO_CC))
210 # include <iostream.h>
211 extern "C" void exit(int);
214 inline void THROW(const NCursesException *e) {
215 #if defined(__GNUG__)
216 # if ((__GNUG__ <= 2) && (__GNUC_MINOR__ < 8))
217 (*lib_error_handler)(e?e->classname():"",e?e->message:"");
221 #elif defined(__SUNPRO_CC)
222 genericerror(1, ((e != 0) ? (char *)(e->message) : ""));
225 cerr << e->message << endl;