From 2eee382a62a909d5a3f2f5eda94f30fe68fd5335 Mon Sep 17 00:00:00 2001 From: "kr.angelov" Date: Fri, 20 Jan 2012 13:41:10 +0000 Subject: initial import of the C runtime --- src/runtime/c/gu/write.h | 64 ++++++++++++++++++++++++++++++++++++++++++++++++ 1 file changed, 64 insertions(+) create mode 100644 src/runtime/c/gu/write.h (limited to 'src/runtime/c/gu/write.h') diff --git a/src/runtime/c/gu/write.h b/src/runtime/c/gu/write.h new file mode 100644 index 000000000..414a7bc2c --- /dev/null +++ b/src/runtime/c/gu/write.h @@ -0,0 +1,64 @@ +#ifndef GU_WRITE_H_ +#define GU_WRITE_H_ + +#include +#include +#include +#include + +typedef struct GuWriter GuWriter; + +struct GuWriter { + GuOut out_; +}; + +size_t +gu_utf32_write(const GuUCS* buf, size_t size, GuWriter* wtr, GuExn* err); + +inline void +gu_writer_flush(GuWriter* wtr, GuExn* err) +{ + gu_out_flush(&wtr->out_, err); +} + +inline void +gu_ucs_write(GuUCS ucs, GuWriter* wtr, GuExn* err) +{ + gu_out_utf8(ucs, &wtr->out_, err); +} + +inline void +gu_putc(char c, GuWriter* wtr, GuExn* err) +{ + GuUCS ucs = gu_char_ucs(c); + gu_out_u8(&wtr->out_, (uint8_t) ucs, err); +} + +inline void +gu_puts(const char* str, GuWriter* wtr, GuExn* err) +{ + gu_str_out_utf8(str, &wtr->out_, err); +} + +inline size_t +gu_utf8_write(const uint8_t* src, size_t sz, GuWriter* wtr, GuExn* err) +{ + return gu_out_bytes(&wtr->out_, src, sz, err); +} + +void +gu_vprintf(const char* fmt, va_list args, GuWriter* wtr, GuExn* err); + +void +gu_printf(GuWriter* wtr, GuExn* err, const char* fmt, ...); + +//GuWriter +//gu_init_utf8_writer(GuOut* utf8_out); + +GuWriter* +gu_new_utf8_writer(GuOut* utf8_out, GuPool* pool); + +GuWriter* +gu_make_locale_writer(GuOut* locale_out, GuPool* pool); + +#endif // GU_WRITE_H_ -- cgit v1.2.3