exception-private.h
Go to the documentation of this file.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'", \
00042 GetExceptionMessage(errno)); \
00043 CatchException(&exception); \
00044 (void) DestroyExceptionInfo(&exception); \
00045 _exit(1); \
00046 }
00047 #define ThrowFileException(exception,severity,tag,context) \
00048 { \
00049 (void) ThrowMagickException(exception,GetMagickModule(),severity, \
00050 tag == (const char *) NULL ? "unknown" : tag,"`%s': %s",context, \
00051 GetExceptionMessage(errno)); \
00052 }
00053 #define ThrowImageException(severity,tag) \
00054 { \
00055 (void) ThrowMagickException(exception,GetMagickModule(),severity, \
00056 tag == (const char *) NULL ? "unknown" : tag,"`%s'",image->filename); \
00057 return((Image *) NULL); \
00058 }
00059 #define ThrowReaderException(severity,tag) \
00060 { \
00061 (void) ThrowMagickException(exception,GetMagickModule(),severity, \
00062 tag == (const char *) NULL ? "unknown" : tag,"`%s'",image_info->filename); \
00063 if ((image) != (Image *) NULL) \
00064 { \
00065 (void) CloseBlob(image); \
00066 image=DestroyImageList(image); \
00067 } \
00068 return((Image *) NULL); \
00069 }
00070 #define ThrowWriterException(severity,tag) \
00071 { \
00072 (void) ThrowMagickException(&image->exception,GetMagickModule(),severity, \
00073 tag == (const char *) NULL ? "unknown" : tag,"`%s'",image->filename); \
00074 if (image_info->adjoin != MagickFalse) \
00075 while (image->previous != (Image *) NULL) \
00076 image=image->previous; \
00077 (void) CloseBlob(image); \
00078 return(MagickFalse); \
00079 }
00080
00081 #if defined(__cplusplus) || defined(c_plusplus)
00082 }
00083 #endif
00084
00085 #endif