exception-private.h

Go to the documentation of this file.
00001 /*
00002   Copyright 1999-2020 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.  You may
00006   obtain a copy of the License at
00007   
00008     https://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 #include "magick/log.h"
00022 #include "magick/magick.h"
00023 #include "magick/string_.h"
00024 
00025 #if defined(__cplusplus) || defined(c_plusplus)
00026 extern "C" {
00027 #endif
00028 
00029 #define ThrowBinaryException(severity,tag,context) \
00030 { \
00031   (void) ThrowMagickException(exception,GetMagickModule(),severity, \
00032     tag == (const char *) NULL ? "unknown" : tag,"`%s'",context); \
00033   return(MagickFalse); \
00034 }
00035 #define ThrowBinaryImageException(severity,tag,context) \
00036 { \
00037   if (image != (Image *) NULL) \
00038     (void) ThrowMagickException(&image->exception,GetMagickModule(),severity, \
00039        tag == (const char *) NULL ? "unknown" : tag,"`%s'",context); \
00040   return(MagickFalse); \
00041 }
00042 #define ThrowFatalException(severity,tag) \
00043 { \
00044   char \
00045     *fatal_message; \
00046  \
00047   ExceptionInfo \
00048     *fatal_exception; \
00049  \
00050   fatal_exception=AcquireExceptionInfo(); \
00051   fatal_message=GetExceptionMessage(errno); \
00052   (void) ThrowMagickException(fatal_exception,GetMagickModule(),severity, \
00053     tag == (const char *) NULL ? "unknown" : tag,"`%s'",fatal_message); \
00054   fatal_message=DestroyString(fatal_message); \
00055   CatchException(fatal_exception); \
00056   (void) DestroyExceptionInfo(fatal_exception); \
00057   MagickCoreTerminus(); \
00058   _exit((int) (severity-FatalErrorException)+1); \
00059 }
00060 #define ThrowFileException(exception,severity,tag,context) \
00061 { \
00062   char \
00063     *message; \
00064  \
00065   message=GetExceptionMessage(errno); \
00066   (void) ThrowMagickException(exception,GetMagickModule(),severity, \
00067     tag == (const char *) NULL ? "unknown" : tag,"`%s': %s",context,message); \
00068   message=DestroyString(message); \
00069 }
00070 #define ThrowImageException(severity,tag) \
00071 { \
00072   (void) ThrowMagickException(exception,GetMagickModule(),severity, \
00073     tag == (const char *) NULL ? "unknown" : tag,"`%s'",image->filename); \
00074   return((Image *) NULL); \
00075 }
00076 #define ThrowReaderException(severity,tag) \
00077 { \
00078   (void) ThrowMagickException(exception,GetMagickModule(),severity, \
00079     tag == (const char *) NULL ? "unknown" : tag,"`%s'",image_info->filename); \
00080   if ((image) != (Image *) NULL) \
00081     { \
00082       (void) CloseBlob(image); \
00083       image=DestroyImageList(image); \
00084     } \
00085   return((Image *) NULL); \
00086 }
00087 #define ThrowWriterException(severity,tag) \
00088 { \
00089   (void) ThrowMagickException(&image->exception,GetMagickModule(),severity, \
00090     tag == (const char *) NULL ? "unknown" : tag,"`%s'",image->filename); \
00091   if (image_info->adjoin != MagickFalse) \
00092     while (image->previous != (Image *) NULL) \
00093       image=image->previous; \
00094   (void) CloseBlob(image); \
00095   return(MagickFalse); \
00096 }
00097 
00098 extern MagickPrivate MagickBooleanType
00099   ClearExceptionInfo(ExceptionInfo *,MagickBooleanType),
00100   ExceptionComponentGenesis(void);
00101 
00102 extern MagickPrivate void
00103   ExceptionComponentTerminus(void),
00104   InitializeExceptionInfo(ExceptionInfo *);
00105 
00106 #if defined(__cplusplus) || defined(c_plusplus)
00107 }
00108 #endif
00109 
00110 #endif

Generated on 20 Apr 2020 for MagickCore by  doxygen 1.6.1