exception.h

Go to the documentation of this file.
00001 /*
00002   Copyright 1999-2008 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.wizards-toolkit.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   Wizard's Toolkit Exception Methods.
00017 */
00018 #ifndef _WIZARDS_TOOLKIT_EXCEPTION_H
00019 #define _WIZARDS_TOOLKIT_EXCEPTION_H
00020 
00021 #if defined(__cplusplus) || defined(c_plusplus)
00022 extern "C" {
00023 #endif
00024 
00025 #include "wizard/semaphore.h"
00026 
00027 typedef enum
00028 {
00029   RandomDomain = 0,
00030   HashDomain = 1,
00031   EntropyDomain = 2,
00032   RepairDomain = 3,
00033   MACDomain = 4,
00034   CipherDomain = 5,
00035   KeymapDomain = 6,
00036   AuthenticateDomain = 7,
00037   KeyringDomain = 8,
00038   ParseDomain = 9,
00039   UserDomain = 10,
00040   CacheDomain = 11,
00041   LogDomain = 12,
00042   StringDomain = 13,
00043   ResourceDomain = 14,
00044   MiscellaneousDomain = 15
00045 } DomainType;
00046 
00047 typedef enum
00048 {
00049   MemoryError = 0,
00050   EnumerateError = 1,
00051   AuthenticateUserError = 2,
00052   KeyError = 3,
00053   HashIOError = 4,
00054   TimeError = 5,
00055   TamperError = 6,
00056   AssertError = 7
00057 } ErrorType;
00058 
00059 typedef enum
00060 {
00061   UndefinedException,
00062   WarningException = 300,
00063   OptionWarning = 305,
00064   RandomWarning = 310,
00065   HashWarning = 315,
00066   MACWarning = 320,
00067   EntropyWarning = 325,
00068   ConfigureWarning = 330,
00069   CipherWarning = 335,
00070   KeymapWarning = 340,
00071   AuthenticateWarning = 345,
00072   KeyringWarning = 350,
00073   ParseWarning = 355,
00074   UserWarning = 360,
00075   SplayTreeWarning = 365,
00076   HashmapWarning = 370,
00077   LogWarning = 375,
00078   StringWarning = 380,
00079   FileWarning = 385,
00080   BlobWarning = 390,
00081   ResourceWarning = 395,
00082   ErrorException = 400,
00083   OptionError = 405,
00084   RandomError = 410,
00085   HashError = 415,
00086   MACError = 420,
00087   EntropyError = 425,
00088   ConfigureError = 430,
00089   CipherError = 435,
00090   KeymapError = 440,
00091   AuthenticateError = 445,
00092   KeyringError = 450,
00093   ParseError = 455,
00094   UserError = 460,
00095   SplayTreeError = 465,
00096   HashmapError = 470,
00097   LogError = 475,
00098   StringError = 480,
00099   FileError = 485,
00100   BlobError = 490,
00101   ResourceError = 495,
00102   FatalErrorException = 700,
00103   OptionFatalError = 705,
00104   RandomFatalError = 710,
00105   HashFatalError = 715,
00106   MACFatalError = 720,
00107   EntropyFatalError = 725,
00108   ConfigureFatalError = 730,
00109   CipherFatalError = 735,
00110   KeymapFatalError = 740,
00111   AuthenticateFatalError = 745,
00112   KeyringFatalError = 750,
00113   ParseFatalError = 755,
00114   UserFatalError = 760,
00115   SplayTreeFatalError = 765,
00116   HashmapFatalError = 770,
00117   LogFatalError = 775,
00118   StringFatalError = 780,
00119   FileFatalError = 785,
00120   BlobFatalError = 790,
00121   ResourceFatalError = 795
00122 } ExceptionType;
00123 
00124 typedef struct _ExceptionInfo
00125   ExceptionInfo;
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 /*
00137   Exception declarations.
00138 */
00139 extern WizardExport char
00140   *GetExceptionMessage(const int);
00141 
00142 extern WizardExport const char
00143   *GetLocaleExceptionMessage(const ExceptionType,const char *),
00144   *GetLocaleMessage(const char *);
00145 
00146 extern WizardExport ErrorHandler
00147   SetErrorHandler(ErrorHandler);
00148 
00149 extern WizardExport ExceptionInfo
00150   *AcquireExceptionInfo(void),
00151   *DestroyExceptionInfo(ExceptionInfo *);
00152 
00153 extern WizardExport ExceptionType
00154   GetExceptionSeverity(const ExceptionInfo *);
00155 
00156 extern WizardExport FatalErrorHandler
00157   SetFatalErrorHandler(FatalErrorHandler);
00158 
00159 extern WizardExport WizardBooleanType
00160   ListLocaleInfo(FILE *,ExceptionInfo *),
00161   ThrowException(ExceptionInfo *,const ExceptionType,const char *,
00162     const char *),
00163   ThrowWizardException(ExceptionInfo *,const char *,const char *,
00164     const unsigned long,const ExceptionType,const char *,...)
00165     wizard_attribute((format (printf,6,7)));
00166 
00167 extern WizardExport void
00168   CatchException(ExceptionInfo *),
00169   ClearWizardException(ExceptionInfo *),
00170   DestroyLocaleInfo(void),
00171   GetExceptionInfo(ExceptionInfo *),
00172   InheritException(ExceptionInfo *,const ExceptionInfo *),
00173   WizardError(const ExceptionType,const char *,const char *),
00174   WizardFatalError(const ExceptionType,const char *,const char *),
00175   WizardWarning(const ExceptionType,const char *,const char *);
00176 
00177 extern WizardExport WarningHandler
00178   SetWarningHandler(WarningHandler);
00179 
00180 #if defined(__cplusplus) || defined(c_plusplus)
00181 }
00182 #endif
00183 
00184 #endif

Generated on Sat Jan 26 14:50:32 2008 for WizardsToolkit by  doxygen 1.5.4