|
|
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;
1.1.1.2 ! root 14: #endif /*DEBUG_TO_FILE*/
1.1 root 15:
1.1.1.2 ! root 16:
! 17: /*-----------------------------------------------------------------------*/
1.1 root 18: /*
19: Create debug files
20: */
21: void Debug_OpenFiles(void)
22: {
23: #ifdef DEBUG_TO_FILE
24: debug.open("debug.txt");
25: debug2.open("debug2.txt");
26: debug3.open("debug3.txt");
1.1.1.2 ! root 27: #endif /*DEBUG_TO_FILE*/
1.1 root 28: }
29:
1.1.1.2 ! root 30:
! 31: /*-----------------------------------------------------------------------*/
1.1 root 32: /*
33: Close debug files
34: */
35: void Debug_CloseFiles(void)
36: {
37: #ifdef DEBUG_TO_FILE
38: debug.close();
39: debug2.close();
40: debug3.close();
1.1.1.2 ! root 41: #endif /*DEBUG_TO_FILE*/
1.1 root 42: }
43:
44: #ifdef DEBUG_TO_FILE
45:
1.1.1.2 ! root 46:
! 47: /*-----------------------------------------------------------------------*/
1.1 root 48: /*
49: Output string to debug file
50: */
51: void Debug_File(char *format, ...)
52: {
53: char szBuffer[1024];
54: va_list argptr;
55:
56: va_start(argptr, format);
57: vsprintf(szBuffer, format, argptr);
58: va_end(argptr);
59:
60: debug << szBuffer;
61: }
62:
1.1.1.2 ! root 63:
! 64: /*-----------------------------------------------------------------------*/
1.1 root 65: /*
66: Output string to debug file 2 (Keyboard IKBD)
67: */
68: void Debug_IKBD(char *format, ...)
69: {
70: char szBuffer[1024];
71: va_list argptr;
72:
73: va_start(argptr, format);
74: vsprintf(szBuffer, format, argptr);
75: va_end(argptr);
76:
77: debug2 << szBuffer;
78: }
79:
1.1.1.2 ! root 80:
! 81: /*-----------------------------------------------------------------------*/
1.1 root 82: /*
83: Output string to debug file 3 (Floppy Disc Controller)
84: */
85: void Debug_FDC(char *format, ...)
86: {
87: char szBuffer[1024];
88: va_list argptr;
89:
90: va_start(argptr, format);
91: vsprintf(szBuffer, format, argptr);
92: va_end(argptr);
93:
94: debug3 << szBuffer;
95: }
96:
1.1.1.2 ! root 97: #endif /*DEBUG_TO_FILE*/
This archive runs on limited infrastructure. Preserving old code on modern bandwidth. Automated agents are requested to crawl responsibly.