MagickCore  6.9.10
Convert, Edit, Or Compose Bitmap Images
exception-private.h
Go to the documentation of this file.
1 /*
2  Copyright 1999-2019 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  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 private methods.
17 */
18 #ifndef MAGICKCORE_EXCEPTION_PRIVATE_H
19 #define MAGICKCORE_EXCEPTION_PRIVATE_H
20 
21 #include "magick/log.h"
22 #include "magick/magick.h"
23 #include "magick/string_.h"
24 
25 #if defined(__cplusplus) || defined(c_plusplus)
26 extern "C" {
27 #endif
28 
29 #define ThrowBinaryException(severity,tag,context) \
30 { \
31  (void) ThrowMagickException(exception,GetMagickModule(),severity, \
32  tag == (const char *) NULL ? "unknown" : tag,"`%s'",context); \
33  return(MagickFalse); \
34 }
35 #define ThrowBinaryImageException(severity,tag,context) \
36 { \
37  if (image != (Image *) NULL) \
38  (void) ThrowMagickException(&image->exception,GetMagickModule(),severity, \
39  tag == (const char *) NULL ? "unknown" : tag,"`%s'",context); \
40  return(MagickFalse); \
41 }
42 #define ThrowFatalException(severity,tag) \
43 { \
44  char \
45  *fatal_message; \
46  \
47  ExceptionInfo \
48  *fatal_exception; \
49  \
50  fatal_exception=AcquireExceptionInfo(); \
51  fatal_message=GetExceptionMessage(errno); \
52  (void) ThrowMagickException(fatal_exception,GetMagickModule(),severity, \
53  tag == (const char *) NULL ? "unknown" : tag,"`%s'",fatal_message); \
54  fatal_message=DestroyString(fatal_message); \
55  CatchException(fatal_exception); \
56  (void) DestroyExceptionInfo(fatal_exception); \
57  MagickCoreTerminus(); \
58  _exit((int) (severity-FatalErrorException)+1); \
59 }
60 #define ThrowFileException(exception,severity,tag,context) \
61 { \
62  char \
63  *message; \
64  \
65  message=GetExceptionMessage(errno); \
66  (void) ThrowMagickException(exception,GetMagickModule(),severity, \
67  tag == (const char *) NULL ? "unknown" : tag,"`%s': %s",context,message); \
68  message=DestroyString(message); \
69 }
70 #define ThrowImageException(severity,tag) \
71 { \
72  (void) ThrowMagickException(exception,GetMagickModule(),severity, \
73  tag == (const char *) NULL ? "unknown" : tag,"`%s'",image->filename); \
74  return((Image *) NULL); \
75 }
76 #define ThrowPolicyException(tag,status) \
77 { \
78  errno=EPERM; \
79  (void) ThrowMagickException(exception,GetMagickModule(),PolicyError, \
80  "NotAuthorized","`%s'",tag); \
81  return(status); \
82 }
83 #define ThrowReaderException(severity,tag) \
84 { \
85  (void) ThrowMagickException(exception,GetMagickModule(),severity, \
86  tag == (const char *) NULL ? "unknown" : tag,"`%s'",image_info->filename); \
87  if ((image) != (Image *) NULL) \
88  { \
89  (void) CloseBlob(image); \
90  image=DestroyImageList(image); \
91  } \
92  return((Image *) NULL); \
93 }
94 #define ThrowWriterException(severity,tag) \
95 { \
96  (void) ThrowMagickException(&image->exception,GetMagickModule(),severity, \
97  tag == (const char *) NULL ? "unknown" : tag,"`%s'",image->filename); \
98  if (image_info->adjoin != MagickFalse) \
99  while (image->previous != (Image *) NULL) \
100  image=image->previous; \
101  (void) CloseBlob(image); \
102  return(MagickFalse); \
103 }
104 
107 
108 extern MagickPrivate void
110 
111 #if defined(__cplusplus) || defined(c_plusplus)
112 }
113 #endif
114 
115 #endif
Definition: exception.h:102
MagickPrivate void InitializeExceptionInfo(ExceptionInfo *)
Definition: exception.c:681
MagickBooleanType
Definition: magick-type.h:191
#define MagickPrivate
Definition: method-attribute.h:81
MagickPrivate MagickBooleanType ClearExceptionInfo(ExceptionInfo *, MagickBooleanType)
Definition: exception.c:414