]> granicus.if.org Git - imagemagick/blob - MagickCore/exception-private.h
The 8bim profile will be updated when the iptc profile is changed.
[imagemagick] / MagickCore / exception-private.h
1 /*
2   Copyright 1999-2014 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.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 "MagickCore/log.h"
22 #include "MagickCore/magick.h"
23 #include "MagickCore/string_.h"
24
25 #if defined(__cplusplus) || defined(c_plusplus)
26 extern "C" {
27 #endif
28
29 #define ThrowBinaryException(severity,tag,context) \
30 { \
31   if (image != (Image *) NULL) \
32     (void) ThrowMagickException(exception,GetMagickModule(),severity, \
33       tag == (const char *) NULL ? "unknown" : tag,"`%s'",context); \
34   return(MagickFalse); \
35 }
36 #define ThrowFatalException(severity,tag) \
37 { \
38   char \
39     *message; \
40  \
41   ExceptionInfo \
42     exception; \
43  \
44   GetExceptionInfo(&exception); \
45   message=GetExceptionMessage(errno); \
46   (void) ThrowMagickException(&exception,GetMagickModule(),severity, \
47     tag == (const char *) NULL ? "unknown" : tag,"`%s'",message); \
48   message=DestroyString(message); \
49   CatchException(&exception); \
50   (void) DestroyExceptionInfo(&exception); \
51   MagickCoreTerminus(); \
52   _exit((int) (severity-FatalErrorException)+1); \
53 }
54 #define ThrowFileException(exception,severity,tag,context) \
55 { \
56   char \
57     *message; \
58  \
59   message=GetExceptionMessage(errno); \
60   (void) ThrowMagickException(exception,GetMagickModule(),severity, \
61     tag == (const char *) NULL ? "unknown" : tag,"'%s': %s",context,message); \
62   message=DestroyString(message); \
63 }
64 #define ThrowImageException(severity,tag) \
65 { \
66   (void) ThrowMagickException(exception,GetMagickModule(),severity, \
67     tag == (const char *) NULL ? "unknown" : tag,"`%s'",image->filename); \
68   return((Image *) NULL); \
69 }
70 #define ThrowReaderException(severity,tag) \
71 { \
72   (void) ThrowMagickException(exception,GetMagickModule(),severity, \
73     tag == (const char *) NULL ? "unknown" : tag,"`%s'",image_info->filename); \
74   if ((image) != (Image *) NULL) \
75     { \
76       (void) CloseBlob(image); \
77       image=DestroyImageList(image); \
78     } \
79   return((Image *) NULL); \
80 }
81 #define ThrowWriterException(severity,tag) \
82 { \
83   (void) ThrowMagickException(exception,GetMagickModule(),severity, \
84     tag == (const char *) NULL ? "unknown" : tag,"`%s'",image->filename); \
85   if (image_info->adjoin != MagickFalse) \
86     while (image->previous != (Image *) NULL) \
87       image=image->previous; \
88   (void) CloseBlob(image); \
89   return(MagickFalse); \
90 }
91
92 #if defined(__cplusplus) || defined(c_plusplus)
93 }
94 #endif
95
96 #endif