MagickCore  7.1.1-43
Convert, Edit, Or Compose Bitmap Images
exception.h
1 /*
2  Copyright @ 1999 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. You may
6  obtain a copy of the License at
7 
8  https://imagemagick.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  MagickCore exception methods.
17 */
18 #ifndef MAGICKCORE_EXCEPTION_H
19 #define MAGICKCORE_EXCEPTION_H
20 
21 #include "MagickCore/semaphore.h"
22 
23 #if defined(__cplusplus) || defined(c_plusplus)
24 extern "C" {
25 #endif
26 
27 typedef enum
28 {
29  UndefinedException,
30  WarningException = 300,
31  ResourceLimitWarning = 300,
32  TypeWarning = 305,
33  OptionWarning = 310,
34  DelegateWarning = 315,
35  MissingDelegateWarning = 320,
36  CorruptImageWarning = 325,
37  FileOpenWarning = 330,
38  BlobWarning = 335,
39  StreamWarning = 340,
40  CacheWarning = 345,
41  CoderWarning = 350,
42  FilterWarning = 352,
43  ModuleWarning = 355,
44  DrawWarning = 360,
45  ImageWarning = 365,
46  WandWarning = 370,
47  RandomWarning = 375,
48  XServerWarning = 380,
49  MonitorWarning = 385,
50  RegistryWarning = 390,
51  ConfigureWarning = 395,
52  PolicyWarning = 399,
53  ErrorException = 400,
54  ResourceLimitError = 400,
55  TypeError = 405,
56  OptionError = 410,
57  DelegateError = 415,
58  MissingDelegateError = 420,
59  CorruptImageError = 425,
60  FileOpenError = 430,
61  BlobError = 435,
62  StreamError = 440,
63  CacheError = 445,
64  CoderError = 450,
65  FilterError = 452,
66  ModuleError = 455,
67  DrawError = 460,
68  ImageError = 465,
69  WandError = 470,
70  RandomError = 475,
71  XServerError = 480,
72  MonitorError = 485,
73  RegistryError = 490,
74  ConfigureError = 495,
75  PolicyError = 499,
76  FatalErrorException = 700,
77  ResourceLimitFatalError = 700,
78  TypeFatalError = 705,
79  OptionFatalError = 710,
80  DelegateFatalError = 715,
81  MissingDelegateFatalError = 720,
82  CorruptImageFatalError = 725,
83  FileOpenFatalError = 730,
84  BlobFatalError = 735,
85  StreamFatalError = 740,
86  CacheFatalError = 745,
87  CoderFatalError = 750,
88  FilterFatalError = 752,
89  ModuleFatalError = 755,
90  DrawFatalError = 760,
91  ImageFatalError = 765,
92  WandFatalError = 770,
93  RandomFatalError = 775,
94  XServerFatalError = 780,
95  MonitorFatalError = 785,
96  RegistryFatalError = 790,
97  ConfigureFatalError = 795,
98  PolicyFatalError = 799
99 } ExceptionType;
100 
102 {
103  ExceptionType
104  severity;
105 
106  int
107  error_number;
108 
109  char
110  *reason,
111  *description;
112 
113  void
114  *exceptions;
115 
116  MagickBooleanType
117  relinquish;
118 
120  *semaphore;
121 
122  size_t
123  signature;
124 };
125 
126 typedef void
127  (*ErrorHandler)(const ExceptionType,const char *,const char *);
128 
129 typedef void
130  (*FatalErrorHandler)(const ExceptionType,const char *,const char *)
131  magick_attribute((__noreturn__));
132 
133 typedef void
134  (*WarningHandler)(const ExceptionType,const char *,const char *);
135 
136 extern MagickExport char
137  *GetExceptionMessage(const int);
138 
139 extern MagickExport const char
140  *GetLocaleExceptionMessage(const ExceptionType,const char *);
141 
142 extern MagickExport ErrorHandler
143  SetErrorHandler(ErrorHandler);
144 
145 extern MagickExport ExceptionInfo
146  *AcquireExceptionInfo(void),
147  *CloneExceptionInfo(ExceptionInfo *),
148  *DestroyExceptionInfo(ExceptionInfo *);
149 
150 extern MagickExport FatalErrorHandler
151  SetFatalErrorHandler(FatalErrorHandler);
152 
153 extern MagickExport MagickBooleanType
154  ThrowException(ExceptionInfo *,const ExceptionType,const char *,
155  const char *),
156  ThrowMagickExceptionList(ExceptionInfo *,const char *,const char *,
157  const size_t,const ExceptionType,const char *,const char *,va_list),
158  ThrowMagickException(ExceptionInfo *,const char *,const char *,const size_t,
159  const ExceptionType,const char *,const char *,...)
160  magick_attribute((__format__ (__printf__,7,8)));
161 
162 extern MagickExport void
163  CatchException(ExceptionInfo *),
164  ClearMagickException(ExceptionInfo *),
165  InheritException(ExceptionInfo *,const ExceptionInfo *),
166  MagickError(const ExceptionType,const char *,const char *),
167  MagickFatalError(const ExceptionType,const char *,const char *)
168  magick_attribute((__noreturn__)),
169  MagickWarning(const ExceptionType,const char *,const char *);
170 
171 extern MagickExport WarningHandler
172  SetWarningHandler(WarningHandler);
173 
174 #if defined(__cplusplus) || defined(c_plusplus)
175 }
176 #endif
177 
178 #endif
SemaphoreInfo
Definition: semaphore.c:60
_ExceptionInfo
Definition: exception.h:101