|
MagickCore
6.7.5
|
00001 /* 00002 Copyright 1999-2012 ImageMagick Studio LLC, a non-profit organization 00003 dedicated to making software imaging solutions freely available. 00004 00005 You may not use this file except in compliance with the License. 00006 obtain a copy of the License at 00007 00008 http://www.imagemagick.org/script/license.php 00009 00010 Unless required by applicable law or agreed to in writing, software 00011 distributed under the License is distributed on an "AS IS" BASIS, 00012 WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 00013 See the License for the specific language governing permissions and 00014 limitations under the License. 00015 00016 MagickCore exception private methods. 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 "MagickCore/log.h" 00026 #include "MagickCore/string_.h" 00027 00028 #define ThrowBinaryException(severity,tag,context) \ 00029 { \ 00030 if (image != (Image *) NULL) \ 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 *message; \ 00039 \ 00040 ExceptionInfo \ 00041 exception; \ 00042 \ 00043 GetExceptionInfo(&exception); \ 00044 message=GetExceptionMessage(errno); \ 00045 (void) ThrowMagickException(&exception,GetMagickModule(),severity, \ 00046 tag == (const char *) NULL ? "unknown" : tag,"`%s'",message); \ 00047 message=DestroyString(message); \ 00048 CatchException(&exception); \ 00049 (void) DestroyExceptionInfo(&exception); \ 00050 _exit(1); \ 00051 } 00052 #define ThrowFileException(exception,severity,tag,context) \ 00053 { \ 00054 char \ 00055 *message; \ 00056 \ 00057 message=GetExceptionMessage(errno); \ 00058 (void) ThrowMagickException(exception,GetMagickModule(),severity, \ 00059 tag == (const char *) NULL ? "unknown" : tag,"`%s': %s",context,message); \ 00060 message=DestroyString(message); \ 00061 } 00062 #define ThrowImageException(severity,tag) \ 00063 { \ 00064 (void) ThrowMagickException(exception,GetMagickModule(),severity, \ 00065 tag == (const char *) NULL ? "unknown" : tag,"`%s'",image->filename); \ 00066 return((Image *) NULL); \ 00067 } 00068 #define ThrowReaderException(severity,tag) \ 00069 { \ 00070 (void) ThrowMagickException(exception,GetMagickModule(),severity, \ 00071 tag == (const char *) NULL ? "unknown" : tag,"`%s'",image_info->filename); \ 00072 if ((image) != (Image *) NULL) \ 00073 { \ 00074 (void) CloseBlob(image); \ 00075 image=DestroyImageList(image); \ 00076 } \ 00077 return((Image *) NULL); \ 00078 } 00079 #define ThrowWriterException(severity,tag) \ 00080 { \ 00081 (void) ThrowMagickException(exception,GetMagickModule(),severity, \ 00082 tag == (const char *) NULL ? "unknown" : tag,"`%s'",image->filename); \ 00083 if (image_info->adjoin != MagickFalse) \ 00084 while (image->previous != (Image *) NULL) \ 00085 image=image->previous; \ 00086 (void) CloseBlob(image); \ 00087 return(MagickFalse); \ 00088 } 00089 00090 #if defined(__cplusplus) || defined(c_plusplus) 00091 } 00092 #endif 00093 00094 #endif