00001 #ifndef _TOKE_ERRHANDLER_H 00002 #define _TOKE_ERRHANDLER_H 00003 00004 /* 00005 * OpenBIOS - free your system! 00006 * ( FCode tokenizer ) 00007 * 00008 * This program is part of a free implementation of the IEEE 1275-1994 00009 * Standard for Boot (Initialization Configuration) Firmware. 00010 * 00011 * Copyright (C) 2001-2005 Stefan Reinauer, <stepan@openbios.org> 00012 * 00013 * This program is free software; you can redistribute it and/or modify 00014 * it under the terms of the GNU General Public License as published by 00015 * the Free Software Foundation; version 2 of the License. 00016 * 00017 * This program is distributed in the hope that it will be useful, 00018 * but WITHOUT ANY WARRANTY; without even the implied warranty of 00019 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 00020 * GNU General Public License for more details. 00021 * 00022 * You should have received a copy of the GNU General Public License 00023 * along with this program; if not, write to the Free Software 00024 * Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA, 02110-1301 USA 00025 * 00026 */ 00027 00028 /* ************************************************************************** 00029 * 00030 * Function Prototypes for Tokenizer Error-Handler 00031 * 00032 * Defines symbols for the various classes of errors 00033 * for the Error-Handler and for all its users 00034 * 00035 * 00036 * (C) Copyright 2005 IBM Corporation. All Rights Reserved. 00037 * Module Author: David L. Paktor dlpaktor@us.ibm.com 00038 * 00039 **************************************************************************** */ 00040 00041 #include "types.h" 00042 00043 #define FATAL 0x80000000 00044 #define TKERROR 0x04000000 00045 #define WARNING 0x00200000 00046 #define INFO 0x00010000 00047 #define MESSAGE 0x00000800 00048 #define P_MESSAGE 0x00000040 00049 #define FORCE_MSG 0x00000001 00050 00051 void init_error_handler( void); 00052 void tokenization_error( int err_type, char* msg, ... ); 00053 void started_at( char * saved_ifile, unsigned int saved_lineno); 00054 void print_started_at( char * saved_ifile, unsigned int saved_lineno); 00055 void just_started_at( char * saved_ifile, unsigned int saved_lineno); 00056 void where_started( char * saved_ifile, unsigned int saved_lineno); 00057 void just_where_started( char * saved_ifile, unsigned int saved_lineno); 00058 void in_last_colon( void ); 00059 _PTR safe_malloc( size_t size, char *phrase); 00060 bool error_summary( void ); /* Return TRUE if OK to produce output. */ 00061 00062 00063 /* ************************************************************************** 00064 * 00065 * Macros: 00066 * ERRMSG_DESTINATION During development, I used this to switch 00067 * error message destination between STDOUT and STDERR, until I 00068 * settled on which is preferable. Recently, I have proven to 00069 * my satisfaction that STDERR is preferable: error-messages 00070 * produced by a sub-shell will be correctly synchronized with 00071 * the error-messages we produce. When I tested using STDOUT 00072 * for error-messages, that error-case looked garbled. 00073 * FFLUSH_STDOUT fflush( stdout) if error message destination 00074 * is STDERR, No-op if it's STDOUT. A few of these, judiciously 00075 * placed, kept our own regular and error messages nicely in sync. 00076 * 00077 **************************************************************************** */ 00078 00079 #define ERRMSG_DESTINATION stderr 00080 #define FFLUSH_STDOUT fflush( stdout); 00081 00082 /* We're no longer switching the above. 00083 * The below is left here to show what had been done formerly. 00084 */ 00085 #if -1 /* Switchable error-message destination */ 00086 #else /* Switchable error-message destination */ 00087 #define ERRMSG_DESTINATION stdout 00088 #define FFLUSH_STDOUT /* Don't need to do anything here */ 00089 #endif /* Switchable error-message destination */ 00090 00091 /* Some systems don't seem to have strupr */ 00092 #ifdef SYS_IS_GNU_Linux 00093 #define NEEDS_STRUPR 00094 #endif /* SYS_IS_GNU_Linux */ 00095 #ifdef SYS_IS_AIX 00096 #define NEEDS_STRUPR 00097 #endif /* SYS_IS_AIX */ 00098 /* ??? Should this instead be tuned to Proc'r is PPC ??? Why? */ 00099 00100 #ifdef NEEDS_STRUPR 00101 00102 /* ************************************************************************** 00103 * 00104 * A necessary hack for systems that don't seem 00105 * to have strupr and strlwr 00106 * Let's avoid a naming conflict, just in case... 00107 * 00108 **************************************************************************** */ 00109 00110 extern char *strupper( char *strung); 00111 #define strupr strupper 00112 00113 extern char *strlower( char *strung); 00114 #define strlwr strlower 00115 00116 00117 #endif /* NEEDS_STRUPR */ 00118 00119 #endif /* _TOKE_ERRHANDLER_H */