root/WizardsToolkit/trunk/wizard/exception.h

Revision 1, 4.5 KB (checked in by cristy, 3 months ago)


Line 
1/*
2  Copyright 1999-2009 ImageMagick Studio LLC, a non-profit organization
3  dedicated to making software imaging solutions freely available.
4
5  You may not use this file except in compliance with the License.
6  obtain a copy of the License at
7
8    http://www.wizards-toolkit.org/script/license.php
9
10  Unless required by applicable law or agreed to in writing, software
11  distributed under the License is distributed on an "AS IS" BASIS,
12  WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
13  See the License for the specific language governing permissions and
14  limitations under the License.
15
16  Wizard's Toolkit Exception Methods.
17*/
18#ifndef _WIZARDSTOOLKIT_EXCEPTION_H
19#define _WIZARDSTOOLKIT_EXCEPTION_H
20
21#if defined(__cplusplus) || defined(c_plusplus)
22extern "C" {
23#endif
24
25#include "wizard/semaphore.h"
26
27typedef enum
28{
29  RandomDomain = 0,
30  HashDomain = 1,
31  EntropyDomain = 2,
32  RepairDomain = 3,
33  MACDomain = 4,
34  CipherDomain = 5,
35  KeymapDomain = 6,
36  AuthenticateDomain = 7,
37  KeyringDomain = 8,
38  ParseDomain = 9,
39  UserDomain = 10,
40  CacheDomain = 11,
41  LogDomain = 12,
42  StringDomain = 13,
43  ResourceDomain = 14,
44  MiscellaneousDomain = 15
45} DomainType;
46
47typedef enum
48{
49  MemoryError = 0,
50  EnumerateError = 1,
51  AuthenticateUserError = 2,
52  KeyError = 3,
53  HashIOError = 4,
54  TimeError = 5,
55  TamperError = 6,
56  AssertError = 7
57} ErrorType;
58
59typedef enum
60{
61  UndefinedException,
62  WarningException = 300,
63  OptionWarning = 305,
64  RandomWarning = 310,
65  HashWarning = 315,
66  MACWarning = 320,
67  EntropyWarning = 325,
68  ConfigureWarning = 330,
69  CipherWarning = 335,
70  KeymapWarning = 340,
71  AuthenticateWarning = 345,
72  KeyringWarning = 350,
73  ParseWarning = 355,
74  UserWarning = 360,
75  SplayTreeWarning = 365,
76  HashmapWarning = 370,
77  LogWarning = 375,
78  StringWarning = 380,
79  FileWarning = 385,
80  BlobWarning = 390,
81  ResourceWarning = 395,
82  ErrorException = 400,
83  OptionError = 405,
84  RandomError = 410,
85  HashError = 415,
86  MACError = 420,
87  EntropyError = 425,
88  ConfigureError = 430,
89  CipherError = 435,
90  KeymapError = 440,
91  AuthenticateError = 445,
92  KeyringError = 450,
93  ParseError = 455,
94  UserError = 460,
95  SplayTreeError = 465,
96  HashmapError = 470,
97  LogError = 475,
98  StringError = 480,
99  FileError = 485,
100  BlobError = 490,
101  ResourceError = 495,
102  FatalErrorException = 700,
103  OptionFatalError = 705,
104  RandomFatalError = 710,
105  HashFatalError = 715,
106  MACFatalError = 720,
107  EntropyFatalError = 725,
108  ConfigureFatalError = 730,
109  CipherFatalError = 735,
110  KeymapFatalError = 740,
111  AuthenticateFatalError = 745,
112  KeyringFatalError = 750,
113  ParseFatalError = 755,
114  UserFatalError = 760,
115  SplayTreeFatalError = 765,
116  HashmapFatalError = 770,
117  LogFatalError = 775,
118  StringFatalError = 780,
119  FileFatalError = 785,
120  BlobFatalError = 790,
121  ResourceFatalError = 795
122} ExceptionType;
123
124typedef struct _ExceptionInfo
125  ExceptionInfo;
126
127typedef void
128  (*ErrorHandler)(const ExceptionType,const char *,const char *);
129
130typedef void
131  (*FatalErrorHandler)(const ExceptionType,const char *,const char *);
132
133typedef void
134  (*WarningHandler)(const ExceptionType,const char *,const char *);
135
136/*
137  Exception declarations.
138*/
139extern WizardExport char
140  *GetExceptionMessage(const int);
141
142extern WizardExport const char
143  *GetLocaleExceptionMessage(const ExceptionType,const char *),
144  *GetLocaleMessage(const char *);
145
146extern WizardExport ErrorHandler
147  SetErrorHandler(ErrorHandler);
148
149extern WizardExport ExceptionInfo
150  *AcquireExceptionInfo(void),
151  *DestroyExceptionInfo(ExceptionInfo *);
152
153extern WizardExport ExceptionType
154  GetExceptionSeverity(const ExceptionInfo *);
155
156extern WizardExport FatalErrorHandler
157  SetFatalErrorHandler(FatalErrorHandler);
158
159extern WizardExport WizardBooleanType
160  ListLocaleInfo(FILE *,ExceptionInfo *),
161  ThrowException(ExceptionInfo *,const ExceptionType,const char *,
162    const char *),
163  ThrowWizardException(ExceptionInfo *,const char *,const char *,
164    const unsigned long,const ExceptionType,const char *,...)
165    wizard_attribute((format (printf,6,7)));
166
167extern WizardExport void
168  CatchException(ExceptionInfo *),
169  ClearWizardException(ExceptionInfo *),
170  DestroyLocaleInfo(void),
171  GetExceptionInfo(ExceptionInfo *),
172  InheritException(ExceptionInfo *,const ExceptionInfo *),
173  WizardError(const ExceptionType,const char *,const char *),
174  WizardFatalError(const ExceptionType,const char *,const char *),
175  WizardWarning(const ExceptionType,const char *,const char *);
176
177extern WizardExport WarningHandler
178  SetWarningHandler(WarningHandler);
179
180#if defined(__cplusplus) || defined(c_plusplus)
181}
182#endif
183
184#endif
Note: See TracBrowser for help on using the browser.