exception.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 methods.
00017 */
00018 #ifndef MAGICKCORE_EXCEPTION_H
00019 #define MAGICKCORE_EXCEPTION_H
00020 
00021 #include <stdarg.h>
00022 #include "magick/semaphore.h"
00023 
00024 #if defined(__cplusplus) || defined(c_plusplus)
00025 extern "C" {
00026 #endif
00027 
00028 typedef enum
00029 {
00030   UndefinedException,
00031   WarningException = 300,
00032   ResourceLimitWarning = 300,
00033   TypeWarning = 305,
00034   OptionWarning = 310,
00035   DelegateWarning = 315,
00036   MissingDelegateWarning = 320,
00037   CorruptImageWarning = 325,
00038   FileOpenWarning = 330,
00039   BlobWarning = 335,
00040   StreamWarning = 340,
00041   CacheWarning = 345,
00042   CoderWarning = 350,
00043   FilterWarning = 352,
00044   ModuleWarning = 355,
00045   DrawWarning = 360,
00046   ImageWarning = 365,
00047   WandWarning = 370,
00048   RandomWarning = 375,
00049   XServerWarning = 380,
00050   MonitorWarning = 385,
00051   RegistryWarning = 390,
00052   ConfigureWarning = 395,
00053   PolicyWarning = 399,
00054   ErrorException = 400,
00055   ResourceLimitError = 400,
00056   TypeError = 405,
00057   OptionError = 410,
00058   DelegateError = 415,
00059   MissingDelegateError = 420,
00060   CorruptImageError = 425,
00061   FileOpenError = 430,
00062   BlobError = 435,
00063   StreamError = 440,
00064   CacheError = 445,
00065   CoderError = 450,
00066   FilterError = 452,
00067   ModuleError = 455,
00068   DrawError = 460,
00069   ImageError = 465,
00070   WandError = 470,
00071   RandomError = 475,
00072   XServerError = 480,
00073   MonitorError = 485,
00074   RegistryError = 490,
00075   ConfigureError = 495,
00076   PolicyError = 499,
00077   FatalErrorException = 700,
00078   ResourceLimitFatalError = 700,
00079   TypeFatalError = 705,
00080   OptionFatalError = 710,
00081   DelegateFatalError = 715,
00082   MissingDelegateFatalError = 720,
00083   CorruptImageFatalError = 725,
00084   FileOpenFatalError = 730,
00085   BlobFatalError = 735,
00086   StreamFatalError = 740,
00087   CacheFatalError = 745,
00088   CoderFatalError = 750,
00089   FilterFatalError = 752,
00090   ModuleFatalError = 755,
00091   DrawFatalError = 760,
00092   ImageFatalError = 765,
00093   WandFatalError = 770,
00094   RandomFatalError = 775,
00095   XServerFatalError = 780,
00096   MonitorFatalError = 785,
00097   RegistryFatalError = 790,
00098   ConfigureFatalError = 795,
00099   PolicyFatalError = 799
00100 } ExceptionType;
00101 
00102 struct _ExceptionInfo
00103 {
00104   ExceptionType
00105     severity;
00106 
00107   int
00108     error_number;
00109 
00110   char
00111     *reason,
00112     *description;
00113 
00114   void
00115     *exceptions;
00116 
00117   MagickBooleanType
00118     relinquish;
00119 
00120   SemaphoreInfo
00121     *semaphore;
00122 
00123   size_t
00124     signature;
00125 };
00126 
00127 typedef void
00128   (*ErrorHandler)(const ExceptionType,const char *,const char *);
00129 
00130 typedef void
00131   (*FatalErrorHandler)(const ExceptionType,const char *,const char *);
00132 
00133 typedef void
00134   (*WarningHandler)(const ExceptionType,const char *,const char *);
00135 
00136 extern MagickExport char
00137   *GetExceptionMessage(const int);
00138 
00139 extern MagickExport const char
00140   *GetLocaleExceptionMessage(const ExceptionType,const char *);
00141 
00142 extern MagickExport ErrorHandler
00143   SetErrorHandler(ErrorHandler);
00144 
00145 extern MagickExport ExceptionInfo
00146   *AcquireExceptionInfo(void),
00147   *CloneExceptionInfo(ExceptionInfo *),
00148   *DestroyExceptionInfo(ExceptionInfo *);
00149 
00150 extern MagickExport FatalErrorHandler
00151   SetFatalErrorHandler(FatalErrorHandler);
00152 
00153 extern MagickExport MagickBooleanType
00154   ThrowException(ExceptionInfo *,const ExceptionType,const char *,
00155     const char *),
00156   ThrowMagickException(ExceptionInfo *,const char *,const char *,const size_t,
00157     const ExceptionType,const char *,const char *,...)
00158     magick_attribute((__format__ (__printf__,7,8))),
00159   ThrowMagickExceptionList(ExceptionInfo *,const char *,const char *,
00160     const size_t,const ExceptionType,const char *,const char *,va_list)
00161     magick_attribute((__format__ (__printf__,7,0)));
00162 
00163 extern MagickExport void
00164   CatchException(ExceptionInfo *),
00165   ClearMagickException(ExceptionInfo *),
00166   InheritException(ExceptionInfo *,const ExceptionInfo *),
00167   MagickError(const ExceptionType,const char *,const char *),
00168   MagickFatalError(const ExceptionType,const char *,const char *),
00169   MagickWarning(const ExceptionType,const char *,const char *);
00170 
00171 extern MagickExport WarningHandler
00172   SetWarningHandler(WarningHandler);
00173 
00174 #if defined(__cplusplus) || defined(c_plusplus)
00175 }
00176 #endif
00177 
00178 #endif

Generated on 27 Apr 2020 for MagickCore by  doxygen 1.6.1