helos1/runtime/stdio.h
Edgaru089 ec808e5e2e runtime, interrupt: print to screen on errors, print CR2 on panic
CR2 is the last accessed address set on page exceptions
2021-11-11 16:18:47 +08:00

44 lines
1.0 KiB
C

#pragma once
#include "../main.h"
#include "unicode.h"
#ifdef __cplusplus
extern "C" {
#endif
// io_WriteConsole converts UTF-8 string given to Unicode(BMP only),
// then writing it to the Stdout SIMPLE_TEXT_OUTPUT_INTERFACE or the graphical console.
//
// All \n not preceeded by \r is substituted by \r\n. (WIP)
void io_WriteConsole(const char *str);
void io_WriteConsoleASCII(const char *str);
// io_Printf is a printf() replacement, printing to WriteConsole function.
int io_Printf(const char *format, ...);
// io_Error prints error information directly to the screen.
void io_Error(const char *str);
void io_ErrorASCII(const char *str);
int io_Errorf(const char *format, ...);
// Debugging printing marcos
#ifndef NDEBUG
#define DEBUG(...) \
do { \
printf(__FILE__ ":%d(%s) ", __LINE__, __func__); \
printf(__VA_ARGS__); \
} while (0)
#else
#define DEBUG(...)
#endif
#ifdef __cplusplus
}
#endif