00001
00002
00003
00004
00005
00006
00007
00008
00009
00010
00011
00012
00013
00014
00015
00016
00017
00018 #ifndef MAGICKCORE_EXCEPTION_PRIVATE_H
00019 #define MAGICKCORE_EXCEPTION_PRIVATE_H
00020
00021 #include "magick/log.h"
00022 #include "magick/magick.h"
00023 #include "magick/string_.h"
00024
00025 #if defined(__cplusplus) || defined(c_plusplus)
00026 extern "C" {
00027 #endif
00028
00029 #define ThrowBinaryException(severity,tag,context) \
00030 { \
00031 (void) ThrowMagickException(exception,GetMagickModule(),severity, \
00032 tag == (const char *) NULL ? "unknown" : tag,"`%s'",context); \
00033 return(MagickFalse); \
00034 }
00035 #define ThrowBinaryImageException(severity,tag,context) \
00036 { \
00037 if (image != (Image *) NULL) \
00038 (void) ThrowMagickException(&image->exception,GetMagickModule(),severity, \
00039 tag == (const char *) NULL ? "unknown" : tag,"`%s'",context); \
00040 return(MagickFalse); \
00041 }
00042 #define ThrowFatalException(severity,tag) \
00043 { \
00044 char \
00045 *fatal_message; \
00046 \
00047 ExceptionInfo \
00048 *fatal_exception; \
00049 \
00050 fatal_exception=AcquireExceptionInfo(); \
00051 fatal_message=GetExceptionMessage(errno); \
00052 (void) ThrowMagickException(fatal_exception,GetMagickModule(),severity, \
00053 tag == (const char *) NULL ? "unknown" : tag,"`%s'",fatal_message); \
00054 fatal_message=DestroyString(fatal_message); \
00055 CatchException(fatal_exception); \
00056 (void) DestroyExceptionInfo(fatal_exception); \
00057 MagickCoreTerminus(); \
00058 _exit((int) (severity-FatalErrorException)+1); \
00059 }
00060 #define ThrowFileException(exception,severity,tag,context) \
00061 { \
00062 char \
00063 *message; \
00064 \
00065 message=GetExceptionMessage(errno); \
00066 (void) ThrowMagickException(exception,GetMagickModule(),severity, \
00067 tag == (const char *) NULL ? "unknown" : tag,"`%s': %s",context,message); \
00068 message=DestroyString(message); \
00069 }
00070 #define ThrowImageException(severity,tag) \
00071 { \
00072 (void) ThrowMagickException(exception,GetMagickModule(),severity, \
00073 tag == (const char *) NULL ? "unknown" : tag,"`%s'",image->filename); \
00074 return((Image *) NULL); \
00075 }
00076 #define ThrowReaderException(severity,tag) \
00077 { \
00078 (void) ThrowMagickException(exception,GetMagickModule(),severity, \
00079 tag == (const char *) NULL ? "unknown" : tag,"`%s'",image_info->filename); \
00080 if ((image) != (Image *) NULL) \
00081 { \
00082 (void) CloseBlob(image); \
00083 image=DestroyImageList(image); \
00084 } \
00085 return((Image *) NULL); \
00086 }
00087 #define ThrowWriterException(severity,tag) \
00088 { \
00089 (void) ThrowMagickException(&image->exception,GetMagickModule(),severity, \
00090 tag == (const char *) NULL ? "unknown" : tag,"`%s'",image->filename); \
00091 if (image_info->adjoin != MagickFalse) \
00092 while (image->previous != (Image *) NULL) \
00093 image=image->previous; \
00094 (void) CloseBlob(image); \
00095 return(MagickFalse); \
00096 }
00097
00098 extern MagickPrivate MagickBooleanType
00099 ClearExceptionInfo(ExceptionInfo *,MagickBooleanType),
00100 ExceptionComponentGenesis(void);
00101
00102 extern MagickPrivate void
00103 ExceptionComponentTerminus(void),
00104 InitializeExceptionInfo(ExceptionInfo *);
00105
00106 #if defined(__cplusplus) || defined(c_plusplus)
00107 }
00108 #endif
00109
00110 #endif