For DOS Protected Mode version of sensor core software
You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
 
 
 
 

139 lines
2.6 KiB

#include "dosdebug.h"
//extern unsigned _heaplen = 54321U;
#ifdef DEBUG_OUT_FILE
static FILE * DEBUG_FD = NULL;
#endif
void debug( char *msg, ... ){
//*
int i = 0;
struct time t;
va_list valist;
char Format[256];
char Buffer[256];
sprintf( Format, "\n%%02d:%%02d:%%02d.%%02d %%s" );
gettime( &t );
sprintf( Buffer, Format, t.ti_hour, t.ti_min, t.ti_sec, t.ti_hund, msg );
va_start( valist, msg );
vsprintf( Format, Buffer, valist );
va_end( valist );
for( i = strlen( Format ); i < 70; i++ ) Format[i]='.';
Format[i] = (char) 0;
#ifdef DEBUG_OUT_FILE
DEBUG_FD = fopen( DEBUG_OUT_FILE ,"a+");
if( DEBUG_FD ){
fprintf( DEBUG_FD, Format );
fclose( DEBUG_FD );
DEBUG_FD = NULL;
};
#else
printf( Format );
#endif
//*/
/*
#ifdef DEBUG_OUT_FILE
DEBUG_FD = fopen( DEBUG_OUT_FILE ,"a+");
if( DEBUG_FD ){
fprintf( DEBUG_FD, "%s\n", msg );
fclose( DEBUG_FD );
DEBUG_FD = NULL;
};
#else
printf( "%s\n", msg );
#endif
*/
};
void debugProcBegin( char *msg, ... ){
//*
int i = 0;
struct time t;
va_list valist;
char Format[256];
char Buffer[256];
sprintf( Format, "\n%%02d:%%02d:%%02d.%%02d %%s" );
int la = strlen( Format );
gettime( &t );
sprintf( Buffer, Format, t.ti_hour, t.ti_min, t.ti_sec, t.ti_hund, msg );
va_start( valist, msg );
vsprintf( Format, Buffer, valist );
va_end( valist );
for( i = strlen( Format ); i < 70; i++ ) Format[i]='.';
Format[i] = (char) 0;
#ifdef DEBUG_OUT_FILE
DEBUG_FD = fopen( DEBUG_OUT_FILE ,"a+");
if( DEBUG_FD ){
fprintf( DEBUG_FD, Format );
fclose( DEBUG_FD );
DEBUG_FD = NULL;
};
#else
printf( Format );
#endif
//*/
/*
#ifdef DEBUG_OUT_FILE
DEBUG_FD = fopen( DEBUG_OUT_FILE ,"a+");
if( DEBUG_FD ){
fprintf( DEBUG_FD, "%s\n", msg );
fclose( DEBUG_FD );
DEBUG_FD = NULL;
};
#else
printf( "%s\n", msg );
#endif
*/
};
void debugProcEnd( unsigned char z){
//*
if( z ) {
#ifdef DEBUG_OUT_FILE
DEBUG_FD = fopen( DEBUG_OUT_FILE ,"a+");
if( DEBUG_FD ){
fprintf( DEBUG_FD, "[OK]" );
fclose( DEBUG_FD );
DEBUG_FD = NULL;
};
#else
printf( "[OK]" );
#endif
} else {
#ifdef DEBUG_OUT_FILE
DEBUG_FD = fopen( DEBUG_OUT_FILE ,"a+");
if( DEBUG_FD ){
fprintf( DEBUG_FD, "[ERROR]" );
fclose( DEBUG_FD );
DEBUG_FD = NULL;
};
#else
printf( "[ERROR]" );
#endif
};
//*/
/*
if( z ){
#ifdef DEBUG_OUT_FILE
DEBUG_FD = fopen( DEBUG_OUT_FILE ,"a+");
if( DEBUG_FD ){
fprintf( DEBUG_FD, "[OK]\n" );
fclose( DEBUG_FD );
DEBUG_FD = NULL;
};
#else
printf( "[OK]\n" );
#endif
} else {
#ifdef DEBUG_OUT_FILE
DEBUG_FD = fopen( DEBUG_OUT_FILE ,"a+");
if( DEBUG_FD ){
fprintf( DEBUG_FD, "[ERROR]\n");
fclose( DEBUG_FD );
DEBUG_FD = NULL;
};
#else
printf( "[ERROR]\n" );
#endif
};
*/
};