# 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'",strerror(errno)); \
    00042   CatchException(&exception); \
    00043   (void) DestroyExceptionInfo(&exception); \
    00044   _exit(1); \
    00045 }
    00046 #define ThrowFileException(exception,severity,tag,context) \
    00047 { \
    00048   (void) ThrowMagickException(exception,GetMagickModule(),severity, \
    00049     tag == (const char *) NULL ? "unknown" : tag,"`%s': %s",context, \
    00050     strerror(errno)); \
    00051 }
    00052 #define ThrowImageException(severity,tag) \
    00053 { \
    00054   (void) ThrowMagickException(exception,GetMagickModule(),severity, \
    00055     tag == (const char *) NULL ? "unknown" : tag,"`%s'",image->filename); \
    00056   return((Image *) NULL); \
    00057 }
    00058 #define ThrowReaderException(severity,tag) \
    00059 { \
    00060   (void) ThrowMagickException(exception,GetMagickModule(),severity, \
    00061     tag == (const char *) NULL ? "unknown" : tag,"`%s'",image_info->filename); \
    00062   if ((image) != (Image *) NULL) \
    00063     { \
    00064       CloseBlob(image); \
    00065       image=DestroyImageList(image); \
    00066     } \
    00067   return((Image *) NULL); \
    00068 }
    00069 #define ThrowWriterException(severity,tag) \
    00070 { \
    00071   (void) ThrowMagickException(&image->exception,GetMagickModule(),severity, \
    00072     tag == (const char *) NULL ? "unknown" : tag,"`%s'",image->filename); \
    00073   if (image_info->adjoin != MagickFalse) \
    00074     while (image->previous != (Image *) NULL) \
    00075       image=image->previous; \
    00076   CloseBlob(image); \
    00077   return(MagickFalse); \
    00078 }
    00079
    00080 #if defined(__cplusplus) || defined(c_plusplus)
    00081 }
    00082 #endif
    00083
    00084 #endif