exception-private.h

Go to the documentation of this file.
00001 /*
00002   Copyright 1999-2010 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 "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
Generated by  doxygen 1.6.2-20100208