Annotation of hatari/src/debug.c, revision 1.1.1.1

1.1       root        1: /*
                      2:   Hatari
                      3: 
                      4:   Debug files
                      5: 
                      6:   For debugging we can send string to these functions which are output to the debugging files.
                      7:   Using this method it is easy to enable/disable the file output
                      8: */
                      9: 
                     10: #include "main.h"
                     11: 
                     12: #ifdef DEBUG_TO_FILE
                     13: ofstream debug,debug2,debug3;
                     14: #endif  //DEBUG_TO_FILE
                     15: 
                     16: //-----------------------------------------------------------------------
                     17: /*
                     18:   Create debug files
                     19: */
                     20: void Debug_OpenFiles(void)
                     21: {
                     22: #ifdef DEBUG_TO_FILE
                     23:   debug.open("debug.txt");
                     24:   debug2.open("debug2.txt");
                     25:   debug3.open("debug3.txt");
                     26: #endif  //DEBUG_TO_FILE
                     27: }
                     28: 
                     29: //-----------------------------------------------------------------------
                     30: /*
                     31:   Close debug files
                     32: */
                     33: void Debug_CloseFiles(void)
                     34: {
                     35: #ifdef DEBUG_TO_FILE
                     36:   debug.close();
                     37:   debug2.close();
                     38:   debug3.close();
                     39: #endif  //DEBUG_TO_FILE
                     40: }
                     41: 
                     42: #ifdef DEBUG_TO_FILE
                     43: 
                     44: //-----------------------------------------------------------------------
                     45: /*
                     46:   Output string to debug file
                     47: */
                     48: void Debug_File(char *format, ...)
                     49: {
                     50:   char szBuffer[1024];
                     51:   va_list argptr;
                     52: 
                     53:   va_start(argptr, format);
                     54:   vsprintf(szBuffer, format, argptr);
                     55:   va_end(argptr);
                     56: 
                     57:   debug << szBuffer;
                     58: }
                     59: 
                     60: //-----------------------------------------------------------------------
                     61: /*
                     62:   Output string to debug file 2 (Keyboard IKBD)
                     63: */
                     64: void Debug_IKBD(char *format, ...)
                     65: {
                     66:   char szBuffer[1024];
                     67:   va_list argptr;
                     68: 
                     69:   va_start(argptr, format);
                     70:   vsprintf(szBuffer, format, argptr);
                     71:   va_end(argptr);
                     72: 
                     73:   debug2 << szBuffer;
                     74: }
                     75: 
                     76: //-----------------------------------------------------------------------
                     77: /*
                     78:   Output string to debug file 3 (Floppy Disc Controller)
                     79: */
                     80: void Debug_FDC(char *format, ...)
                     81: {
                     82:   char szBuffer[1024];
                     83:   va_list argptr;
                     84: 
                     85:   va_start(argptr, format);
                     86:   vsprintf(szBuffer, format, argptr);
                     87:   va_end(argptr);
                     88: 
                     89:   debug3 << szBuffer;
                     90: }
                     91: 
                     92: #endif  //DEBUG_TO_FILE

unix.superglobalmegacorp.com

This archive runs on limited infrastructure. Preserving old code on modern bandwidth. Automated agents are requested to crawl responsibly.