resource manager: add optional resource id.
[dragonfly.git] / contrib / ncurses-5.4 / c++ / etip.h.in
blob2ddc292adda09dab5a812f031fc4a7dd0867ebcc
1 // * This makes emacs happy -*-Mode: C++;-*-
2 /****************************************************************************
3 * Copyright (c) 1998,1999,2000,2001 Free Software Foundation, Inc. *
4 * *
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: *
12 * *
13 * The above copyright notice and this permission notice shall be included *
14 * in all copies or substantial portions of the Software. *
15 * *
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. *
23 * *
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 *
27 * authorization. *
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
42 #endif
44 #ifndef HAVE_GXX_BUILTIN_H
45 #define HAVE_GXX_BUILTIN_H 0
46 #endif
48 #ifndef HAVE_GPP_BUILTIN_H
49 #define HAVE_GPP_BUILTIN_H 0
50 #endif
52 #ifndef HAVE_STRSTREAM_H
53 #define HAVE_STRSTREAM_H 0
54 #endif
56 #ifndef HAVE_TYPEINFO
57 #define HAVE_TYPEINFO 0
58 #endif
60 #ifndef HAVE_VALUES_H
61 #define HAVE_VALUES_H 0
62 #endif
64 #ifndef ETIP_NEEDS_MATH_H
65 #define ETIP_NEEDS_MATH_H 0
66 #endif
68 #ifndef ETIP_NEEDS_MATH_EXCEPTION
69 #define ETIP_NEEDS_MATH_EXCEPTION 0
70 #endif
72 #ifndef CPP_HAS_PARAM_INIT
73 #define CPP_HAS_PARAM_INIT 0
74 #endif
76 #ifndef USE_STRSTREAM_VSCAN
77 #define USE_STRSTREAM_VSCAN 0
78 #endif
80 #ifndef USE_STRSTREAM_VSCAN_CAST
81 #define USE_STRSTREAM_VSCAN_CAST 0
82 #endif
84 #ifdef __GNUG__
85 # if ((__GNUG__ <= 2) && (__GNUC_MINOR__ < 8))
86 # if HAVE_TYPEINFO
87 # include <typeinfo>
88 # endif
89 # endif
90 #endif
92 #if defined(__GNUG__)
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
96 # undef exception
97 # define exception math_exception
98 # endif
99 # include <math.h>
100 # endif
101 # undef 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>
107 # else
108 # include <builtin.h>
109 # endif
110 # undef exception
111 # endif
112 #elif defined (__SUNPRO_CC)
113 # include <generic.h>
114 # include <string.h>
115 #else
116 # include <string.h>
117 #endif
119 #include <ncurses_dll.h>
121 extern "C" {
122 #if HAVE_VALUES_H
123 # include <values.h>
124 #endif
126 #include <assert.h>
127 #include <eti.h>
128 #include <errno.h>
131 // Language features
132 #if CPP_HAS_PARAM_INIT
133 #define NCURSES_PARAM_INIT(value) = value
134 #else
135 #define NCURSES_PARAM_INIT(value) /*nothing*/
136 #endif
138 // Forward Declarations
139 class NCURSES_IMPEXP NCursesPanel;
140 class NCURSES_IMPEXP NCursesMenu;
141 class NCURSES_IMPEXP NCursesForm;
143 class NCURSES_IMPEXP NCursesException
145 public:
146 const char *message;
147 int errorno;
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
164 public:
165 const NCursesPanel* p;
167 NCursesPanelException (const char *msg, int err) :
168 NCursesException (msg, err),
169 p ((NCursesPanel*)0)
172 NCursesPanelException (const NCursesPanel* panel,
173 const char *msg,
174 int err) :
175 NCursesException (msg, err),
176 p (panel)
179 NCursesPanelException (int err) :
180 NCursesException ("panel library error", err),
181 p ((NCursesPanel*)0)
184 NCursesPanelException (const NCursesPanel* panel,
185 int err) :
186 NCursesException ("panel library error", err),
187 p (panel)
190 virtual const char *classname() const {
191 return "NCursesPanel";
196 class NCURSES_IMPEXP NCursesMenuException : public NCursesException
198 public:
199 const NCursesMenu* m;
201 NCursesMenuException (const char *msg, int err) :
202 NCursesException (msg, err),
203 m ((NCursesMenu *)0)
206 NCursesMenuException (const NCursesMenu* menu,
207 const char *msg,
208 int err) :
209 NCursesException (msg, err),
210 m (menu)
213 NCursesMenuException (int err) :
214 NCursesException ("menu library error", err),
215 m ((NCursesMenu *)0)
218 NCursesMenuException (const NCursesMenu* menu,
219 int err) :
220 NCursesException ("menu library error", err),
221 m (menu)
224 virtual const char *classname() const {
225 return "NCursesMenu";
230 class NCURSES_IMPEXP NCursesFormException : public NCursesException
232 public:
233 const NCursesForm* f;
235 NCursesFormException (const char *msg, int err) :
236 NCursesException (msg, err),
237 f ((NCursesForm*)0)
240 NCursesFormException (const NCursesForm* form,
241 const char *msg,
242 int err) :
243 NCursesException (msg, err),
244 f (form)
247 NCursesFormException (int err) :
248 NCursesException ("form library error", err),
249 f ((NCursesForm*)0)
252 NCursesFormException (const NCursesForm* form,
253 int err) :
254 NCursesException ("form library error", err),
255 f (form)
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);
267 #endif
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:"");
273 #else
274 throw *e;
275 #endif
276 #elif defined(__SUNPRO_CC)
277 # if !defined(__SUNPRO_CC_COMPAT) || (__SUNPRO_CC_COMPAT < 5)
278 genericerror(1, ((e != 0) ? (char *)(e->message) : ""));
279 #else
280 throw *e;
281 #endif
282 #else
283 if (e)
284 cerr << e->message << endl;
285 exit(0);
286 #endif
289 #define THROWS(s)
291 #endif // NCURSES_ETIP_H_incl