From 24176ec52bf426f4ecae47ecd7691ac375196bbf Mon Sep 17 00:00:00 2001 From: Alexander Batalov Date: Sun, 19 Jun 2022 13:13:34 +0300 Subject: [PATCH] Cleanup debug.h See #42 --- src/debug.cc | 28 ++++++++++++++++++---------- src/debug.h | 13 ------------- 2 files changed, 18 insertions(+), 23 deletions(-) diff --git a/src/debug.cc b/src/debug.cc index 959e023..c643df7 100644 --- a/src/debug.cc +++ b/src/debug.cc @@ -5,6 +5,7 @@ #include "window_manager_private.h" #include +#include #include #include @@ -13,17 +14,24 @@ #include #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 -FILE* _fd = NULL; +static FILE* _fd = NULL; // 0x51DEFC -int _curx = 0; +static int _curx = 0; // 0x51DF00 -int _cury = 0; +static int _cury = 0; // 0x51DF04 -DebugPrintProc* gDebugPrintProc = NULL; +static DebugPrintProc* gDebugPrintProc = NULL; // 0x4C6CD0 void _GNW_debug_init() @@ -154,7 +162,7 @@ int debugPrint(const char* format, ...) } // 0x4C6F94 -int _debug_puts(char* string) +static int _debug_puts(char* string) { if (gDebugPrintProc != NULL) { return gDebugPrintProc(string); @@ -164,13 +172,13 @@ int _debug_puts(char* string) } // 0x4C6FAC -void _debug_clear() +static void _debug_clear() { // TODO: Something with segments. } // 0x4C7004 -int _debug_mono(char* string) +static int _debug_mono(char* string) { if (gDebugPrintProc == _debug_mono) { while (*string != '\0') { @@ -182,7 +190,7 @@ int _debug_mono(char* string) } // 0x4C7028 -int _debug_log(char* string) +static int _debug_log(char* string) { if (gDebugPrintProc == _debug_log) { if (_fd == NULL) { @@ -202,7 +210,7 @@ int _debug_log(char* string) } // 0x4C7068 -int _debug_screen(char* string) +static int _debug_screen(char* string) { if (gDebugPrintProc == _debug_screen) { printf(string); @@ -212,7 +220,7 @@ int _debug_screen(char* string) } // 0x4C709C -void _debug_putc(char ch) +static void _debug_putc(char ch) { // TODO: Something with segments. } diff --git a/src/debug.h b/src/debug.h index bc32c54..a95207d 100644 --- a/src/debug.h +++ b/src/debug.h @@ -1,15 +1,8 @@ #ifndef DEBUG_H #define DEBUG_H -#include - typedef int(DebugPrintProc)(char* string); -extern FILE* _fd; -extern int _curx; -extern int _cury; -extern DebugPrintProc* gDebugPrintProc; - void _GNW_debug_init(); void _debug_register_mono(); 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_func(DebugPrintProc* proc); 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); #endif /* DEBUG_H */