/* * error.h * * Error messages and handling * * © 1994-1998 Straylight */ /*----- Licensing note ----------------------------------------------------* * * This file is part of Straylight's Dynamic Linking System (SDLS) * * SDLS is free software; you can redistribute it and/or modify * it under the terms of the GNU General Public License as published by * the Free Software Foundation; either version 2, or (at your option) * any later version. * * SDLS is distributed in the hope that it will be useful, * but WITHOUT ANY WARRANTY; without even the implied warranty of * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the * GNU General Public License for more details. * * You should have received a copy of the GNU General Public License * along with SDLS. If not, write to the Free Software Foundation, * 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. */ #ifndef __error_h #define __error_h typedef enum { error_INFO, error_WARN, error_ERROR, error_SEVERE, error_FATAL } error_sev; /*----- A word to the wise ------------------------------------------------* * * There's some clever preprocessor jiggery-pokery going on here, which * does all the tedious matching up of error names to numbers and severities * and things. Quite neat, really. * * To actually make the array of error strings *defined*, you should * predefine the macro error__MAKETABLE. */ #ifdef error__MAKETABLE #define __entry(sev,name,msg) sev , msg "\n" , static const struct { error_sev sev; char *msg; } error__table[]={ #else #define __entry(sev,name,msg) name , enum { #endif /* --- End of preprocessor trickery --- */ __entry(error_FATAL, NOMEM, "Out of memory") __entry(error_ERROR, BADFILE, "'%s' is not a valid object file " "or library -- ignored") __entry(error_SEVERE, BADNAME, "Symbol '%s' not found in specified " "object files") __entry(error_WARN, NOSYMS, "No symbols specified -- reading " "from object files") __entry(error_ERROR, DUPSYM, "Duplicate symbol '%s' found -- " "ignoring") __entry(error_WARN, BADTAG, "Unknown option tag '%s'") __entry(error_ERROR, DUPOPT, "Option '%s' already specified -- " "duplicate ignored") __entry(error_WARN, SILLYOPT, "Unexpected option '%s' ignored") __entry(error_ERROR, SORBNOBJ, "You can't specify -o and -s or -b") __entry(error_ERROR, APPNOEXT, "You can't specify -e and -app") __entry(error_ERROR, NODEF, "No definition file specified") __entry(error_ERROR, NOSTUB, "No stublib file specified") __entry(error_ERROR, NOBIND, "No DLL header file specified") __entry(error_INFO, BADCMDLINE, "Exiting due to errors in command " "line") __entry(error_WARN, LOSTSYM, "Symbol '%s' not found in specified " "object files") __entry(error_SEVERE, NOOPENOUT, "Couldn't open file '%s' for " "writing") __entry(error_ERROR, NOOPENIN, "Couldn't open file '%s' for " "reading") __entry(error_ERROR, JUNKNOITEM, "Expected section name, found '%s'") __entry(error_ERROR, JUNKNOBRA, "Expected '{', found '%s'") __entry(error_ERROR, BADITEM, "Invalid item name '%s'") __entry(error_ERROR, JUNKNOKET, "Expected name or '}', found '%s'") __entry(error_ERROR, JUNKNOVER, "Expected version, found '%s'") __entry(error_ERROR, JUNKNONAME, "Expected DLL name, found '%s'") __entry(error_ERROR, JUNKNOCRIGHT, "Expected copyright string, found " "'%s'") __entry(error_ERROR, BADVER, "Bad version number '%s'") __entry(error_ERROR, QBFEOF, "Missing %c before , inserted") __entry(error_ERROR, QBFNL, "Missing %c before , " "inserted") __entry(error_WARN, NOVERSION, "No version number specified, " "assuming version 1.00") __entry(error_SEVERE, NONAME, "No DLL name specified") __entry(error_WARN, NOCRIGHT, "No copyright string specified") __entry(error_WARN, EASY, "Nothing to do!") /* --- Terminate entries --- */ #ifdef error__MAKETABLE }; #else __dummy }; #endif #undef __entry /* --- Functions --- */ void error_setProgName(char *name); char *error_progname(void); void error(int message,...); void error_show(void); int error_returnCode(void); #endif