#pragma once #include ///@defgroup libk libk ///@{ ///@defgroup stdio stdio ///@{ #ifdef __cplusplus /** * An object type used for streams */ struct kIoDevice { /** Function that prints a character to the stream */ virtual void putc(char) = 0; /** Function that prints a string to the stream */ virtual int puts(const char *, int) = 0; /** Flush write buffers */ virtual void flush() = 0; }; typedef kIoDevice FILE; #else typedef void FILE; #endif /** A FILE value corresponding to stdin, the keyboard buffer */ extern FILE *stdin; /** A FILE value corresponding to stdout, the display */ extern FILE *stdout; /** A FILE value corresponding to stderr, the uart */ extern FILE *stderr; #ifdef __cplusplus extern "C" { #endif /** * Write the formatted string to stdout * Supports ``%s`` (string), ``%d`` (decimal), ``%u`` (unsigned), ``%x`` (hexadecimal) * @return number of bytes written */ int printf(const char *restrict format, ...); /** * Write the formatted string to stream; see printf */ int fprintf(FILE *restrict stream, const char *restrict format, ...); /** * Write the formatted string to stream; see printf */ int vfprintf(FILE *restrict stream, const char *restrict format, va_list ap); #ifdef __cplusplus } #endif ///@} ///@}