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