Untitled_Kernel/include/io.h

79 lines
1.1 KiB
C
Raw Normal View History

/**
* @file io.h
* @brief In/Out
* @details 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>
/**
* @brief
*/
typedef struct char_writer_s char_writer_t;
/**
* @brief
*/
struct char_writer_s {
int (*putChar)(void* ctx, char out); /**< @brief */
void* ctx; /**< @brief */
};
/**
* @brief
*/
extern char_writer_t* default_output;
/**
* @brief
* @param
* @param
* @return int
*/
int putc(char_writer_t*, char);
/**
* @brief
* @param
* @param
* @return int
*/
int print(char_writer_t*, const char*);
/**
* @brief
* @param
* @param
* @return int
*/
int println(char_writer_t*, const char*);
/**
* @brief
* @param
* @param
* @return int
*/
int printhex(char_writer_t*, uint64_t);
/**
* @brief
* @param
* @param out
* @return int
*/
int prindec(char_writer_t*, uint64_t out);
/**
* @brief
* @param
* @param fmt
* @param ...
* @return int
*/
int printf(char_writer_t*, const char* fmt, ...);
#endif