| 1 | |
|---|
| 2 | |
|---|
| 3 | |
|---|
| 4 | |
|---|
| 5 | |
|---|
| 6 | |
|---|
| 7 | |
|---|
| 8 | |
|---|
| 9 | |
|---|
| 10 | |
|---|
| 11 | |
|---|
| 12 | |
|---|
| 13 | |
|---|
| 14 | |
|---|
| 15 | |
|---|
| 16 | |
|---|
| 17 | |
|---|
| 18 | #ifndef _MAGICKCORE_EXCEPTION_PRIVATE_H |
|---|
| 19 | #define _MAGICKCORE_EXCEPTION_PRIVATE_H |
|---|
| 20 | |
|---|
| 21 | #if defined(__cplusplus) || defined(c_plusplus) |
|---|
| 22 | extern "C" { |
|---|
| 23 | #endif |
|---|
| 24 | |
|---|
| 25 | #include "magick/log.h" |
|---|
| 26 | |
|---|
| 27 | #define ThrowBinaryException(severity,tag,context) \ |
|---|
| 28 | { \ |
|---|
| 29 | if (image != (Image *) NULL) \ |
|---|
| 30 | (void) ThrowMagickException(&image->exception,GetMagickModule(),severity, \ |
|---|
| 31 | tag == (const char *) NULL ? "unknown" : tag,"`%s'",context); \ |
|---|
| 32 | return(MagickFalse); \ |
|---|
| 33 | } |
|---|
| 34 | #define ThrowFatalException(severity,tag) \ |
|---|
| 35 | { \ |
|---|
| 36 | ExceptionInfo \ |
|---|
| 37 | exception; \ |
|---|
| 38 | \ |
|---|
| 39 | GetExceptionInfo(&exception); \ |
|---|
| 40 | (void) ThrowMagickException(&exception,GetMagickModule(),severity, \ |
|---|
| 41 | tag == (const char *) NULL ? "unknown" : tag,"`%s'",strerror(errno)); \ |
|---|
| 42 | CatchException(&exception); \ |
|---|
| 43 | (void) DestroyExceptionInfo(&exception); \ |
|---|
| 44 | _exit(1); \ |
|---|
| 45 | } |
|---|
| 46 | #define ThrowFileException(exception,severity,tag,context) \ |
|---|
| 47 | { \ |
|---|
| 48 | (void) ThrowMagickException(exception,GetMagickModule(),severity, \ |
|---|
| 49 | tag == (const char *) NULL ? "unknown" : tag,"`%s': %s",context, \ |
|---|
| 50 | strerror(errno)); \ |
|---|
| 51 | } |
|---|
| 52 | #define ThrowImageException(severity,tag) \ |
|---|
| 53 | { \ |
|---|
| 54 | (void) ThrowMagickException(exception,GetMagickModule(),severity, \ |
|---|
| 55 | tag == (const char *) NULL ? "unknown" : tag,"`%s'",image->filename); \ |
|---|
| 56 | return((Image *) NULL); \ |
|---|
| 57 | } |
|---|
| 58 | #define ThrowReaderException(severity,tag) \ |
|---|
| 59 | { \ |
|---|
| 60 | (void) ThrowMagickException(exception,GetMagickModule(),severity, \ |
|---|
| 61 | tag == (const char *) NULL ? "unknown" : tag,"`%s'",image_info->filename); \ |
|---|
| 62 | if ((image) != (Image *) NULL) \ |
|---|
| 63 | { \ |
|---|
| 64 | CloseBlob(image); \ |
|---|
| 65 | image=DestroyImageList(image); \ |
|---|
| 66 | } \ |
|---|
| 67 | return((Image *) NULL); \ |
|---|
| 68 | } |
|---|
| 69 | #define ThrowWriterException(severity,tag) \ |
|---|
| 70 | { \ |
|---|
| 71 | (void) ThrowMagickException(&image->exception,GetMagickModule(),severity, \ |
|---|
| 72 | tag == (const char *) NULL ? "unknown" : tag,"`%s'",image->filename); \ |
|---|
| 73 | if (image_info->adjoin != MagickFalse) \ |
|---|
| 74 | while (image->previous != (Image *) NULL) \ |
|---|
| 75 | image=image->previous; \ |
|---|
| 76 | CloseBlob(image); \ |
|---|
| 77 | return(MagickFalse); \ |
|---|
| 78 | } |
|---|
| 79 | |
|---|
| 80 | #if defined(__cplusplus) || defined(c_plusplus) |
|---|
| 81 | } |
|---|
| 82 | #endif |
|---|
| 83 | |
|---|
| 84 | #endif |
|---|