Untitled_Kernel/include/io.h
lordtet d6465ade55 Reworked I/O methodology
Instead of passing function pointers, we're passing structs with context
now. The idea is the same, I/O functions require some struct with a
function pointer and some generic memory that only the output device
cares about. I/O just calls it.

VGA has been reworked to accomodate this change, as well as default
outputs being created for low-overhead use (such as interrupt handlers).
2025-07-03 01:36:47 -04:00

24 lines
614 B
C

/* io.h
* In/Out
*
* Common library for handling user i/o. Aims to be mechanic agnostic, and instead
* focus on implementing generic functions to format and manipulate data.
*/
#ifndef IO_H
#define IO_H
#include <stdint.h>
typedef struct char_writer_s char_writer_t;
struct char_writer_s {
int (*putChar)(void* ctx, char out);
void* ctx;
};
int putc(char_writer_t*, char);
int print(char_writer_t*, const char*);
int println(char_writer_t*, const char*);
int printhex(char_writer_t*, uint32_t);
int prindec(char_writer_t*, uint32_t out);
int printf(char_writer_t*, const char* fmt, ...);
#endif