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 "MagickCore/log.h"
00022 #include "MagickCore/magick.h"
00023 #include "MagickCore/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 ThrowFatalException(severity,tag) \
00036 { \
00037 char \
00038 *fatal_message; \
00039 \
00040 ExceptionInfo \
00041 *fatal_exception; \
00042 \
00043 fatal_exception=AcquireExceptionInfo(); \
00044 fatal_message=GetExceptionMessage(errno); \
00045 (void) ThrowMagickException(fatal_exception,GetMagickModule(),severity, \
00046 tag == (const char *) NULL ? "unknown" : tag,"`%s'",fatal_message); \
00047 fatal_message=DestroyString(fatal_message); \
00048 CatchException(fatal_exception); \
00049 (void) DestroyExceptionInfo(fatal_exception); \
00050 MagickCoreTerminus(); \
00051 _exit((int) (severity-FatalErrorException)+1); \
00052 }
00053 #define ThrowFileException(exception,severity,tag,context) \
00054 { \
00055 char \
00056 *file_message; \
00057 \
00058 file_message=GetExceptionMessage(errno); \
00059 (void) ThrowMagickException(exception,GetMagickModule(),severity, \
00060 tag == (const char *) NULL ? "unknown" : tag,"'%s': %s",context, \
00061 file_message); \
00062 file_message=DestroyString(file_message); \
00063 }
00064 #define ThrowImageException(severity,tag) \
00065 { \
00066 (void) ThrowMagickException(exception,GetMagickModule(),severity, \
00067 tag == (const char *) NULL ? "unknown" : tag,"`%s'",image->filename); \
00068 return((Image *) NULL); \
00069 }
00070 #define ThrowReaderException(severity,tag) \
00071 { \
00072 (void) ThrowMagickException(exception,GetMagickModule(),severity, \
00073 tag == (const char *) NULL ? "unknown" : tag,"`%s'",image_info->filename); \
00074 if ((image) != (Image *) NULL) \
00075 { \
00076 (void) CloseBlob(image); \
00077 image=DestroyImageList(image); \
00078 } \
00079 return((Image *) NULL); \
00080 }
00081 #define ThrowWriterException(severity,tag) \
00082 { \
00083 (void) ThrowMagickException(exception,GetMagickModule(),severity, \
00084 tag == (const char *) NULL ? "unknown" : tag,"`%s'",image->filename); \
00085 if (image_info->adjoin != MagickFalse) \
00086 while (image->previous != (Image *) NULL) \
00087 image=image->previous; \
00088 (void) CloseBlob(image); \
00089 return(MagickFalse); \
00090 }
00091
00092 extern MagickPrivate void
00093 ExceptionComponentTerminus(void),
00094 InitializeExceptionInfo(ExceptionInfo *);
00095
00096 extern MagickPrivate MagickBooleanType
00097 ExceptionComponentGenesis(void);
00098
00099 #if defined(__cplusplus) || defined(c_plusplus)
00100 }
00101 #endif
00102
00103 #endif