|
1 /************************************************************************** |
|
2 * |
|
3 * _error.h - Definitions for error messages |
|
4 * |
|
5 * This is an internal header file used to implement the C++ Standard |
|
6 * Library. It should never be #included directly by a program. |
|
7 * |
|
8 * $Id: _error.h 225375 2005-07-26 19:04:10Z sebor $ |
|
9 * |
|
10 *************************************************************************** |
|
11 * |
|
12 * Copyright (c) 1994-2005 Quovadx, Inc., acting through its Rogue Wave |
|
13 * Software division. Licensed under the Apache License, Version 2.0 (the |
|
14 * "License"); you may not use this file except in compliance with the |
|
15 * License. You may obtain a copy of the License at |
|
16 * http://www.apache.org/licenses/LICENSE-2.0. Unless required by |
|
17 * applicable law or agreed to in writing, software distributed under |
|
18 * the License is distributed on an "AS IS" BASIS, WITHOUT WARRANTIES OR |
|
19 * CONDITIONS OF ANY KIND, either express or implied. See the License |
|
20 * for the specific language governing permissions and limitations under |
|
21 * the License. |
|
22 * |
|
23 **************************************************************************/ |
|
24 |
|
25 #ifndef _RWSTD_ERROR_H_INCLUDED |
|
26 #define _RWSTD_ERROR_H_INCLUDED |
|
27 |
|
28 #ifndef _RWSTD_NO_INCLUDES |
|
29 |
|
30 // prevent inclusion if compiling a .rc file with MSVC |
|
31 # include <rw/_defs.h> |
|
32 |
|
33 _RWSTD_NAMESPACE (__rw) { |
|
34 |
|
35 // throws an exception identified by first argument, optional arguments |
|
36 // (if any) used to format the exception object's what() string |
|
37 #ifndef __SYMBIAN32__ |
|
38 void _RWSTD_EXPORT __rw_throw (int, ...); |
|
39 #else |
|
40 void __rw_throw (int, ...){} |
|
41 #endif |
|
42 |
|
43 // throws an exception identified by first argument with the second |
|
44 // argument containing the exception object's what() string, which |
|
45 // if non-0, is dynamically allocated and must be delete[]'d |
|
46 // may be assigned to a user-defined handler (e.g., to prevent |
|
47 // the library from throwing exceptions or to implement logging) |
|
48 extern void _RWSTD_EXPORT (*__rw_throw_proc)(int, char*); |
|
49 |
|
50 } // namespace __rw |
|
51 |
|
52 #endif |
|
53 |
|
54 #ifndef _RWSTD_ERROR_CATALOG |
|
55 // name of catalog optionally followed by a colon and a set number |
|
56 // catalog looked up according to rules of catopen(3) |
|
57 // may be customized at lib build time (pathname okay) |
|
58 # define _RWSTD_ERROR_CATALOG "rwstderr:1" |
|
59 #endif // _RWSTD_ERROR_CATALOG |
|
60 |
|
61 #ifndef _RWSTD_ERROR_ENVVAR |
|
62 // environment variable name - overrides _RWSTD_ERROR_CATALOG |
|
63 // may be customized at lib build time |
|
64 # define _RWSTD_ERROR_ENVVAR "RWSTDERR" |
|
65 #endif // _RWSTD_ERROR_ENVVAR |
|
66 |
|
67 #ifndef _RWSTD_ERROR_FIRST |
|
68 // id of first message - 1, may be customized at lib build time |
|
69 # define _RWSTD_ERROR_FIRST 0 |
|
70 #endif // _RWSTD_ERROR_FIRST |
|
71 |
|
72 |
|
73 // these must be macros to accomodate MSVC's resource compiler, with values |
|
74 // expected to be consecutive starting with _RWSTD_ERROR_FIRST + 1 |
|
75 |
|
76 // # define _RWSTD_ERROR_EXCEPTION (_RWSTD_ERROR_FIRST + 1) |
|
77 // # define _RWSTD_ERROR_BAD_EXCEPTION (_RWSTD_ERROR_FIRST + 2) |
|
78 // # define _RWSTD_ERROR_BAD_ALLOC (_RWSTD_ERROR_FIRST + 3) |
|
79 # define _RWSTD_ERROR_BAD_CAST (_RWSTD_ERROR_FIRST + 4) |
|
80 # define _RWSTD_ERROR_LOGIC_ERROR (_RWSTD_ERROR_FIRST + 5) |
|
81 # define _RWSTD_ERROR_DOMAIN_ERROR (_RWSTD_ERROR_FIRST + 6) |
|
82 # define _RWSTD_ERROR_INVALID_ARGUMENT (_RWSTD_ERROR_FIRST + 7) |
|
83 # define _RWSTD_ERROR_LENGTH_ERROR (_RWSTD_ERROR_FIRST + 8) |
|
84 # define _RWSTD_ERROR_OUT_OF_RANGE (_RWSTD_ERROR_FIRST + 9) |
|
85 # define _RWSTD_ERROR_RUNTIME_ERROR (_RWSTD_ERROR_FIRST + 10) |
|
86 # define _RWSTD_ERROR_RANGE_ERROR (_RWSTD_ERROR_FIRST + 11) |
|
87 # define _RWSTD_ERROR_OVERFLOW_ERROR (_RWSTD_ERROR_FIRST + 12) |
|
88 # define _RWSTD_ERROR_UNDERFLOW_ERROR (_RWSTD_ERROR_FIRST + 13) |
|
89 |
|
90 # define _RWSTD_ERROR_FAILBIT_SET (_RWSTD_ERROR_FIRST + 14) |
|
91 # define _RWSTD_ERROR_BADBIT_SET (_RWSTD_ERROR_FIRST + 15) |
|
92 # define _RWSTD_ERROR_EOFBIT_SET (_RWSTD_ERROR_FIRST + 16) |
|
93 # define _RWSTD_ERROR_IOSTATE_BIT_SET (_RWSTD_ERROR_FIRST + 17) |
|
94 |
|
95 # define _RWSTD_ERROR_FACET_NOT_FOUND (_RWSTD_ERROR_FIRST + 18) |
|
96 # define _RWSTD_ERROR_LOCALE_BAD_NAME (_RWSTD_ERROR_FIRST + 19) |
|
97 # define _RWSTD_ERROR_LOCALE_ERROR_NAME (_RWSTD_ERROR_FIRST + 20) |
|
98 # define _RWSTD_ERROR_CODECVT (_RWSTD_ERROR_FIRST + 21) |
|
99 |
|
100 # define _RWSTD_ERROR_BAD_POINTER (_RWSTD_ERROR_FIRST + 22) |
|
101 # define _RWSTD_ERROR_TRANSFORM (_RWSTD_ERROR_FIRST + 23) |
|
102 # define _RWSTD_ERROR_LOCALE_BAD_CAT (_RWSTD_ERROR_FIRST + 24) |
|
103 |
|
104 # define _RWSTD_ERROR_STRINGS \ |
|
105 "%s: %s: unspecified error", \ |
|
106 "%s: %s: exception", \ |
|
107 "%s: %s: unexpected exception", \ |
|
108 "%s: %s: bad_alloc: out of memory", \ |
|
109 "%s: %s: bad cast", \ |
|
110 "%s: %s: logic error", \ |
|
111 "%s: %s: domain error", \ |
|
112 "%s: %s: invalid argument", \ |
|
113 "%s: %s: length error: size %u out of range [0, %u)", \ |
|
114 "%s: %s: argument value %u out of range [0, %u)", \ |
|
115 "%s: %s: runtime error", \ |
|
116 "%s: %s: range error: invalid range [%d, %d)", \ |
|
117 "%s: %s: overflow error", \ |
|
118 "%s: %s: underflow error", \ |
|
119 /* the following take a single arg because */ \ |
|
120 /* they are generated in a .cpp file */ \ |
|
121 "%s: stream object has set ios::failbit", \ |
|
122 "%s: stream object has set ios::badbit", \ |
|
123 "%s: stream object has set ios::eofbit", \ |
|
124 "%s: stream object has set %s", \ |
|
125 "%s: %s: facet %u not found in locale (\"%s\")", \ |
|
126 "%s: %s: bad locale name: \"%s\"", \ |
|
127 "%s: %s: failed to construct locale name", \ |
|
128 "%s: %s: conversion failed", \ |
|
129 "%s: %s: invalid pointer %p", \ |
|
130 "%s: %s: transformation failed", \ |
|
131 "%s: %s: bad category value: %#x" |
|
132 |
|
133 #define _RWSTD_ERROR_EXCEPTION "exception" |
|
134 #define _RWSTD_ERROR_BAD_EXCEPTION "unexpected exception" |
|
135 #define _RWSTD_ERROR_BAD_ALLOC "bad_alloc: out of memory" |
|
136 |
|
137 |
|
138 #endif // _RWSTD_ERROR_H_INCLUDED |