00001 #ifndef __J2K__JErrorHandler_CPP__
00002 #define __J2K__JErrorHandler_CPP__
00003
00004
00005
00006
00007
00008
00009
00010
00011
00012
00013
00014
00015 #include <j2k/Fred/Error/JErrorHandler.hpp>
00016
00017 __J2K__EXTERN_C
00018
00019
00020 static void defaultErrorHandler( MC_JErrorHandlerArg )
00021 {
00022 register size_t l = (size_t)level;
00023 register size_t n = (size_t)no;
00024
00025 char* errmsgtbl = "";
00026 char* levmsg = "";
00027
00028 if ( n < __J2K__MAX_ERROR ) {
00029 errmsgtbl = (char*)JErrorMsg[ n ];
00030 }
00031
00032 if ( l < 6 ) {
00033 levmsg = (char*)JErrorLevelMsg[ l ];
00034 }
00035
00036 char buf[600];
00037 memset( buf, 0, 600 );
00038
00039 sprintf( buf,
00040 "\n\n***********************************************\n"
00041 "An error of type #%d of level %d/5 has occured\n"
00042 "at line %d of file %s,\n\n"
00043 "Here's a brief description of the error:\n"
00044 "%s \n[%s]\n%s"
00045 "\n\n***********************************************\n\n",
00046 n, l, line, file, levmsg, errmsgtbl, errmsg
00047 );
00048
00049
00050
00051 }
00052
00053 static void cheapError( int line, const char* file, const char* errmsg ) {
00054
00055 char buf[600];
00056 memset( buf, 0, 600 );
00057
00058 sprintf( buf,
00059 "\n\n***********************************************\n"
00060 "An error has occured"
00061 "at line %d of file %s,\n\n"
00062 "Here's a brief description of the error:\n"
00063 "\n%s\n"
00064 "\n\n***********************************************\n\n",
00065 line, file, errmsg
00066 );
00067 }
00068
00069 __J2K__END_C
00070
00071 JErrorHandler::~JErrorHandler()
00072 {
00073 if ( next != NULL ) {
00074 delete next;
00075 }
00076
00077 next = NULL;
00078 }
00079
00080 #endif