Cleanup debug.h

See #42
This commit is contained in:
Alexander Batalov 2022-06-19 13:13:34 +03:00
parent 48510bc3ad
commit 24176ec52b
2 changed files with 18 additions and 23 deletions

View File

@ -5,6 +5,7 @@
#include "window_manager_private.h" #include "window_manager_private.h"
#include <stdarg.h> #include <stdarg.h>
#include <stdio.h>
#include <stdlib.h> #include <stdlib.h>
#include <string.h> #include <string.h>
@ -13,17 +14,24 @@
#include <windows.h> #include <windows.h>
#endif #endif
static int _debug_puts(char* string);
static void _debug_clear();
static int _debug_mono(char* string);
static int _debug_log(char* string);
static int _debug_screen(char* string);
static void _debug_putc(char ch);
// 0x51DEF8 // 0x51DEF8
FILE* _fd = NULL; static FILE* _fd = NULL;
// 0x51DEFC // 0x51DEFC
int _curx = 0; static int _curx = 0;
// 0x51DF00 // 0x51DF00
int _cury = 0; static int _cury = 0;
// 0x51DF04 // 0x51DF04
DebugPrintProc* gDebugPrintProc = NULL; static DebugPrintProc* gDebugPrintProc = NULL;
// 0x4C6CD0 // 0x4C6CD0
void _GNW_debug_init() void _GNW_debug_init()
@ -154,7 +162,7 @@ int debugPrint(const char* format, ...)
} }
// 0x4C6F94 // 0x4C6F94
int _debug_puts(char* string) static int _debug_puts(char* string)
{ {
if (gDebugPrintProc != NULL) { if (gDebugPrintProc != NULL) {
return gDebugPrintProc(string); return gDebugPrintProc(string);
@ -164,13 +172,13 @@ int _debug_puts(char* string)
} }
// 0x4C6FAC // 0x4C6FAC
void _debug_clear() static void _debug_clear()
{ {
// TODO: Something with segments. // TODO: Something with segments.
} }
// 0x4C7004 // 0x4C7004
int _debug_mono(char* string) static int _debug_mono(char* string)
{ {
if (gDebugPrintProc == _debug_mono) { if (gDebugPrintProc == _debug_mono) {
while (*string != '\0') { while (*string != '\0') {
@ -182,7 +190,7 @@ int _debug_mono(char* string)
} }
// 0x4C7028 // 0x4C7028
int _debug_log(char* string) static int _debug_log(char* string)
{ {
if (gDebugPrintProc == _debug_log) { if (gDebugPrintProc == _debug_log) {
if (_fd == NULL) { if (_fd == NULL) {
@ -202,7 +210,7 @@ int _debug_log(char* string)
} }
// 0x4C7068 // 0x4C7068
int _debug_screen(char* string) static int _debug_screen(char* string)
{ {
if (gDebugPrintProc == _debug_screen) { if (gDebugPrintProc == _debug_screen) {
printf(string); printf(string);
@ -212,7 +220,7 @@ int _debug_screen(char* string)
} }
// 0x4C709C // 0x4C709C
void _debug_putc(char ch) static void _debug_putc(char ch)
{ {
// TODO: Something with segments. // TODO: Something with segments.
} }

View File

@ -1,15 +1,8 @@
#ifndef DEBUG_H #ifndef DEBUG_H
#define DEBUG_H #define DEBUG_H
#include <stdio.h>
typedef int(DebugPrintProc)(char* string); typedef int(DebugPrintProc)(char* string);
extern FILE* _fd;
extern int _curx;
extern int _cury;
extern DebugPrintProc* gDebugPrintProc;
void _GNW_debug_init(); void _GNW_debug_init();
void _debug_register_mono(); void _debug_register_mono();
void _debug_register_log(const char* fileName, const char* mode); void _debug_register_log(const char* fileName, const char* mode);
@ -17,12 +10,6 @@ void _debug_register_screen();
void _debug_register_env(); void _debug_register_env();
void _debug_register_func(DebugPrintProc* proc); void _debug_register_func(DebugPrintProc* proc);
int debugPrint(const char* format, ...); int debugPrint(const char* format, ...);
int _debug_puts(char* string);
void _debug_clear();
int _debug_mono(char* string);
int _debug_log(char* string);
int _debug_screen(char* string);
void _debug_putc(char ch);
void _debug_exit(void); void _debug_exit(void);
#endif /* DEBUG_H */ #endif /* DEBUG_H */