1
0
Fork 0

added support for Warninglevel

Imported-from: https://svn.code.sf.net/p/dosbox/code-0/dosbox/trunk@317
This commit is contained in:
Peter Veenstra 2002-10-16 14:07:52 +00:00
parent 602882eb78
commit 56faf852a6
5 changed files with 113 additions and 23 deletions

View file

@ -60,6 +60,104 @@ void DOSBOX_Init(void);
class Config;
extern Config * control;
extern Bitu errorlevel;
inline void LOG_MSG(char* message)
{
if(errorlevel>=0) S_Warn(message);
}
template <class type1>
inline void LOG_MSG(char* message,type1 arg1)
{
if(errorlevel>=0) S_Warn(message,arg1);
}
template <class type1,class type2>
inline void LOG_MSG(char* message,type1 arg1,type2 arg2)
{
if(errorlevel>=0) S_Warn(message,arg1,arg2);
}
template <class type1,class type2, class type3>
inline void LOG_MSG(char* message,type1 arg1,type2 arg2,type3 arg3)
{
if (errorlevel>=0)S_Warn(message,arg1,arg2,arg3);
}
#if C_LOGGING
inline void LOG_DEBUG(char * message)
{
if(errorlevel>=2) S_Warn(message);
}
template <class type>
inline void LOG_DEBUG(char * message, type type1)
{
if(errorlevel>=2) S_Warn(message,type1);
}
template <class type>
inline void LOG_WARN(char * message, type type1)
{
if(errorlevel>=1) S_Warn(message,type1);
}
inline void LOG_WARN(char* message)
{
if(errorlevel>=1) S_Warn(message);
}
inline void LOG_ERROR(char * message)
{
if(errorlevel>=0) S_Warn(message);
}
template <class type>
inline void LOG_ERROR(char * message, type type1)
{
if(errorlevel>=0) S_Warn(message,type1);
}
template <class type1, class type2>
inline void LOG_ERROR(char * message, type1 arg1,type2 arg2)
{
if(errorlevel>=0) S_Warn(message,arg1,arg2);
}
template <class type1, class type2>
inline void LOG_WARN(char * message, type1 arg1,type2 arg2)
{
if(errorlevel>=1) S_Warn(message,arg1,arg2);
}
template <class type1, class type2>
inline void LOG_DEBUG(char * message, type1 arg1,type2 arg2)
{
if(errorlevel>=2) S_Warn(message,arg1,arg2);
}
#else
#define LOG_DEBUG
#define LOG_WARN
#define LOG_ERROR
#endif
#endif

View file

@ -48,16 +48,4 @@
#define DEBUG_DMA 0 /* DMA Debugging */
#define DEBUG_DOS 0 /* DOS Debugging */
#define LOG_MSG S_Warn
#if C_LOGGING
#define LOG_DEBUG S_Warn
#define LOG_WARN S_Warn
#define LOG_ERROR S_Warn
#else
#define LOG_DEBUG
#define LOG_WARN
#define LOG_ERROR
#endif
#endif

View file

@ -40,7 +40,7 @@
/* NEEDS A CLEANUP */
char dosbox_basedir[CROSS_LEN];
Config * control;
Bitu errorlevel=1; //during startup display reason for Exits
//The whole load of startups for all the subfunctions
void MSG_Init(Section_prop *);
@ -132,7 +132,8 @@ void DOSBOX_RunMachine(void){
static void DOSBOX_RealInit(Section * sec) {
Section_prop * section=static_cast<Section_prop *>(sec);
/* Initialize some dosbox internals */
LastTicks=GetTicks();
errorlevel=section->Get_int("WARNINGS");
LastTicks=GetTicks();
DOSBOX_SetLoop(&Normal_Loop);
MSG_Init(section);
}

View file

@ -499,8 +499,8 @@ int main(int argc, char* argv[]) {
control->StartUp();
/* Shutdown everything */
} catch (char * error) {
LOG_ERROR("Exit to error %s",error);
LOG_ERROR("Exit to error: %s",error);
}
GFX_Stop();
return 0;
};
};

View file

@ -214,18 +214,21 @@ void S_Warn(char * format,...) {
GFX_ShowMsg(buf);
#endif
}
char buf[1024]; //global as else it doesn't always gets thrown right (linux/gcc2.95)
void E_Exit(char * format,...) {
char buf[1024];
// char buf[1024]; //see above
if(errorlevel>=1){
va_list msg;
strcpy(buf,"EXIT:");
va_start(msg,format);
vsprintf(buf+strlen(buf),format,msg);
vsprintf(buf,format,msg);
va_end(msg);
strcat(buf,"\n");
printf(buf);
} else {
strcpy(buf,"an unsupported feature\n");
}
throw(buf);
};
};