#ifndef _MAGICKCORE_EXCEPTION_PRIVATE_H
#define _MAGICKCORE_EXCEPTION_PRIVATE_H
#include "magick/log.h"
#include "magick/magick.h"
#include "magick/string_.h"
#if defined(__cplusplus) || defined(c_plusplus)
extern "C" {
#endif
#define ThrowBinaryException(severity,tag,context) \
{ \
if (image != (Image *) NULL) \
(void) ThrowMagickException(&image->exception,GetMagickModule(),severity, \
tag == (const char *) NULL ? "unknown" : tag,"`%s'",context); \
return(MagickFalse); \
}
#define ThrowFatalException(severity,tag) \
{ \
char \
*message; \
\
ExceptionInfo \
*exception; \
\
exception=AcquireExceptionInfo(); \
message=GetExceptionMessage(errno); \
(void) ThrowMagickException(exception,GetMagickModule(),severity, \
tag == (const char *) NULL ? "unknown" : tag,"`%s'",message); \
message=DestroyString(message); \
CatchException(exception); \
(void) DestroyExceptionInfo(exception); \
MagickCoreTerminus(); \
_exit((int) (severity-FatalErrorException)+1); \
}
#define ThrowFileException(exception,severity,tag,context) \
{ \
char \
*message; \
\
message=GetExceptionMessage(errno); \
(void) ThrowMagickException(exception,GetMagickModule(),severity, \
tag == (const char *) NULL ? "unknown" : tag,"`%s': %s",context,message); \
message=DestroyString(message); \
}
#define ThrowImageException(severity,tag) \
{ \
(void) ThrowMagickException(exception,GetMagickModule(),severity, \
tag == (const char *) NULL ? "unknown" : tag,"`%s'",image->filename); \
return((Image *) NULL); \
}
#define ThrowReaderException(severity,tag) \
{ \
(void) ThrowMagickException(exception,GetMagickModule(),severity, \
tag == (const char *) NULL ? "unknown" : tag,"`%s'",image_info->filename); \
if ((image) != (Image *) NULL) \
{ \
(void) CloseBlob(image); \
image=DestroyImageList(image); \
} \
return((Image *) NULL); \
}
#define ThrowWriterException(severity,tag) \
{ \
(void) ThrowMagickException(&image->exception,GetMagickModule(),severity, \
tag == (const char *) NULL ? "unknown" : tag,"`%s'",image->filename); \
if (image_info->adjoin != MagickFalse) \
while (image->previous != (Image *) NULL) \
image=image->previous; \
(void) CloseBlob(image); \
return(MagickFalse); \
}
extern MagickPrivate MagickBooleanType
ClearExceptionInfo(ExceptionInfo *,MagickBooleanType);
extern MagickPrivate void
InitializeExceptionInfo(ExceptionInfo *);
#if defined(__cplusplus) || defined(c_plusplus)
}
#endif
#endif