# exception.h

Go to the documentation of this file.

    00001 /*
    00002   Copyright 1999-2009 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 methods.
    00017 */
    00018 #ifndef _MAGICKCORE_EXCEPTION_H
    00019 #define _MAGICKCORE_EXCEPTION_H
    00020
    00021 #if defined(__cplusplus) || defined(c_plusplus)
    00022 extern "C" {
    00023 #endif
    00024
    00025 #include <stdarg.h>
    00026 #include "magick/semaphore.h"
    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   ModuleWarning = 355,
    00044   DrawWarning = 360,
    00045   ImageWarning = 365,
    00046   WandWarning = 370,
    00047   XServerWarning = 380,
    00048   MonitorWarning = 385,
    00049   RegistryWarning = 390,
    00050   ConfigureWarning = 395,
    00051   ErrorException = 400,
    00052   ResourceLimitError = 400,
    00053   TypeError = 405,
    00054   OptionError = 410,
    00055   DelegateError = 415,
    00056   MissingDelegateError = 420,
    00057   CorruptImageError = 425,
    00058   FileOpenError = 430,
    00059   BlobError = 435,
    00060   StreamError = 440,
    00061   CacheError = 445,
    00062   CoderError = 450,
    00063   ModuleError = 455,
    00064   DrawError = 460,
    00065   ImageError = 465,
    00066   WandError = 470,
    00067   XServerError = 480,
    00068   MonitorError = 485,
    00069   RegistryError = 490,
    00070   ConfigureError = 495,
    00071   FatalErrorException = 700,
    00072   ResourceLimitFatalError = 700,
    00073   TypeFatalError = 705,
    00074   OptionFatalError = 710,
    00075   DelegateFatalError = 715,
    00076   MissingDelegateFatalError = 720,
    00077   CorruptImageFatalError = 725,
    00078   FileOpenFatalError = 730,
    00079   BlobFatalError = 735,
    00080   StreamFatalError = 740,
    00081   CacheFatalError = 745,
    00082   CoderFatalError = 750,
    00083   ModuleFatalError = 755,
    00084   DrawFatalError = 760,
    00085   ImageFatalError = 765,
    00086   WandFatalError = 770,
    00087   XServerFatalError = 780,
    00088   MonitorFatalError = 785,
    00089   RegistryFatalError = 790,
    00090   ConfigureFatalError = 795
    00091 } ExceptionType;
    00092
    00093 struct _ExceptionInfo
    00094 {
    00095   ExceptionType
    00096     severity;
    00097
    00098   int
    00099     error_number;
    00100
    00101   char
    00102     *reason,
    00103     *description;
    00104
    00105   void
    00106     *exceptions;
    00107
    00108   MagickBooleanType
    00109     relinquish;
    00110
    00111   SemaphoreInfo
    00112     *semaphore;
    00113
    00114   unsigned long
    00115     signature;
    00116 };
    00117
    00118 typedef void
    00119   (*ErrorHandler)(const ExceptionType,const char *,const char *);
    00120
    00121 typedef void
    00122   (*FatalErrorHandler)(const ExceptionType,const char *,const char *);
    00123
    00124 typedef void
    00125   (*WarningHandler)(const ExceptionType,const char *,const char *);
    00126
    00127 extern MagickExport char
    00128   *GetExceptionMessage(const int);
    00129
    00130 extern MagickExport const char
    00131   *GetLocaleExceptionMessage(const ExceptionType,const char *);
    00132
    00133 extern MagickExport ErrorHandler
    00134   SetErrorHandler(ErrorHandler);
    00135
    00136 extern MagickExport ExceptionInfo
    00137   *AcquireExceptionInfo(void),
    00138   *DestroyExceptionInfo(ExceptionInfo *);
    00139
    00140 extern MagickExport FatalErrorHandler
    00141   SetFatalErrorHandler(FatalErrorHandler);
    00142
    00143 extern MagickExport MagickBooleanType
    00144   ThrowException(ExceptionInfo *,const ExceptionType,const char *,
    00145     const char *),
    00146   ThrowMagickException(ExceptionInfo *,const char *,const char *,
    00147     const unsigned long,const ExceptionType,const char *,const char *,...)
    00148     magick_attribute((format (printf,7,8))),
    00149   ThrowMagickExceptionList(ExceptionInfo *,const char *,const char *,
    00150     const unsigned long,const ExceptionType,const char *,const char *,va_list)
    00151     magick_attribute((format (printf,7,0)));
    00152
    00153 extern MagickExport void
    00154   CatchException(ExceptionInfo *),
    00155   ClearMagickException(ExceptionInfo *),
    00156   GetExceptionInfo(ExceptionInfo *),
    00157   InheritException(ExceptionInfo *,const ExceptionInfo *),
    00158   MagickError(const ExceptionType,const char *,const char *),
    00159   MagickFatalError(const ExceptionType,const char *,const char *),
    00160   MagickWarning(const ExceptionType,const char *,const char *);
    00161
    00162 extern MagickExport WarningHandler
    00163   SetWarningHandler(WarningHandler);
    00164
    00165 #if defined(__cplusplus) || defined(c_plusplus)
    00166 }
    00167 #endif
    00168
    00169 #endif