00001 
00002 
00003 
00004 
00005 
00006 
00007 
00008 
00009 
00010 
00011 
00012 
00013 
00014 
00015 
00016 
00017 
00018 
00019 
00020 
00021 
00022 
00023 
00029 #include "debug.h"
00030 #include "utrac.h"
00031 #include "ut_error.h"
00032 
00033 
00037 const char * UT_EOL_NAME[] = { "CR", "LF", "CRLF", "LFCR", "Mix","BSN", "Nul", "None" };
00038 
00039 typedef struct UtErrorMessage {
00040         UtCode code;
00041         const char * message;
00042 } UtErrorMessage;
00043 
00044 
00045 const char * ut_error_message (UtCode code) {
00046         
00047         UtErrorMessage array[] = {
00048                 { UT_INTERRUPTED_BY_USER, "Processing interrupted by user" },
00049                 
00050                 
00051                 { UT_NOT_FOUND_ERROR, "Element not found" },
00052 
00053                 { UT_MALLOC_ERROR, "Memory allocation refused"},
00054                 { UT_OPEN_FILE_ERROR, "Unable to open file"},
00055                 { UT_CLOSE_FILE_ERROR, "Unable to close file"},
00056                 { UT_FSTAT_FILE_ERROR, "Call to fstat refused"},
00057                 { UT_READ_FILE_ERROR, "Error during reading"},
00058                 { UT_READ_FILE_ERROR2, "Error during reading"},
00059                 { UT_FILE_TOO_BIG_ERROR, "File too big"},
00060 
00061                 { UT_ALREADY_INITIALISED_ERROR, "Utrac already initialised"},
00062                 { UT_SYNTAX_ERROR, "Syntax error"},
00063                 { UT_STRING_MISSING_ERROR, "Missing string"},
00064                 { UT_LANG_SYS_ALREADY_DEFINED_ERROR, "Language/system already defined"},
00065                 { UT_LANG_SYS_CODE_MISSING_ERROR, "Missing language/system code "},
00066                 { UT_PARTIAL_LANG_SYS_CODE_ERROR, "Incomplete language/system entry"},
00067                 { UT_LANG_SYS_NAME_MISSING_ERROR, "Missing language/system name"},
00068                 { UT_LANG_SYS_UNDEFINED_ERROR, "Undefined language/system"},
00069                 { UT_LANG_SYS_COEF_MISSING_ERROR, "Missing language/system coefficient"},
00070                 { UT_LANG_SYS_INCORRECT_COEF_ERROR, "Incorrect language/system coefficient"},
00071                 { UT_LANG_SYS_COEF_TOO_BIG_ERROR, "Language/system coefficient too big"},
00072                 { UT_LANG_SYS_DEF_AFTER_CHARSET_ERROR, "Language/system defined after charsets"},
00073                 { UT_INCORRECT_CHARMAP_ENTRY_ERROR, "Incorrect charmap entry"},
00074                 { UT_UNDEFINED_CATEGORY_ERROR, "Undefined character category"},
00075                 { UT_CHAR_TOO_BIG_ERROR, "Character too big"},
00076                 { UT_UNICODE_CHAR_TOO_BIG_ERROR, "Unicode character too big"},
00077                 { UT_CHARSET_FILE_ERROR, "Error in charsets file"},
00078                 { UT_CHARMAP_ENTRY_ILLEGAL_ERROR, "Illegal charmap entry in this charset"},
00079         
00080                 { UT_BAD_PARAMETER_ERROR, "Bad parameter"},
00081                 
00082                 
00083                 
00084                 { UT_EMPTY_DATA_ERROR, "No data"},
00085                 { UT_BINARY_DATA_ERROR, "Binary data"},
00086                 
00087                 
00088                 { UT_UNSET, NULL }
00089         };
00090         
00091         int i=0;
00092         while (array[i].code != UT_UNSET) {
00093                 if (array[i].code == code) return array[i].message;
00094                 i++;
00095         }
00096                         
00097         return NULL;
00098 }