Printf now has long (64-bit), char, and % literal support. I haven't written anything specific for shorts yet but if you cast it to an int on the way in, it'll work anyway, so whatever.
26 lines
653 B
C
26 lines
653 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;
|
|
};
|
|
|
|
extern char_writer_t* default_output;
|
|
|
|
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*, uint64_t);
|
|
int prindec(char_writer_t*, uint64_t out);
|
|
int printf(char_writer_t*, const char* fmt, ...);
|
|
|
|
#endif
|