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 #if defined(__cplusplus) || defined(c_plusplus)
00022 extern "C" {
00023 #endif
00024
00025 #include "magick/log.h"
00026
00027 #define ThrowBinaryException(severity,tag,context) \
00028 { \
00029 if (image != (Image *) NULL) \
00030 (void) ThrowMagickException(&image->exception,GetMagickModule(),severity, \
00031 tag == (const char *) NULL ? "unknown" : tag,"`%s'",context); \
00032 return(MagickFalse); \
00033 }
00034 #define ThrowFatalException(severity,tag) \
00035 { \
00036 ExceptionInfo \
00037 exception; \
00038 \
00039 GetExceptionInfo(&exception); \
00040 (void) ThrowMagickException(&exception,GetMagickModule(),severity, \
00041 tag == (const char *) NULL ? "unknown" : tag,"`%s'",strerror(errno)); \
00042 CatchException(&exception); \
00043 (void) DestroyExceptionInfo(&exception); \
00044 _exit(1); \
00045 }
00046 #define ThrowFileException(exception,severity,tag,context) \
00047 { \
00048 (void) ThrowMagickException(exception,GetMagickModule(),severity, \
00049 tag == (const char *) NULL ? "unknown" : tag,"`%s': %s",context, \
00050 strerror(errno)); \
00051 }
00052 #define ThrowImageException(severity,tag) \
00053 { \
00054 (void) ThrowMagickException(exception,GetMagickModule(),severity, \
00055 tag == (const char *) NULL ? "unknown" : tag,"`%s'",image->filename); \
00056 return((Image *) NULL); \
00057 }
00058 #define ThrowReaderException(severity,tag) \
00059 { \
00060 (void) ThrowMagickException(exception,GetMagickModule(),severity, \
00061 tag == (const char *) NULL ? "unknown" : tag,"`%s'",image_info->filename); \
00062 if ((image) != (Image *) NULL) \
00063 { \
00064 CloseBlob(image); \
00065 image=DestroyImageList(image); \
00066 } \
00067 return((Image *) NULL); \
00068 }
00069 #define ThrowWriterException(severity,tag) \
00070 { \
00071 (void) ThrowMagickException(&image->exception,GetMagickModule(),severity, \
00072 tag == (const char *) NULL ? "unknown" : tag,"`%s'",image->filename); \
00073 if (image_info->adjoin != MagickFalse) \
00074 while (image->previous != (Image *) NULL) \
00075 image=image->previous; \
00076 CloseBlob(image); \
00077 return(MagickFalse); \
00078 }
00079
00080 #if defined(__cplusplus) || defined(c_plusplus)
00081 }
00082 #endif
00083
00084 #endif