From df00df5a7a5bcd9076d4423128ea014ab3535626 Mon Sep 17 00:00:00 2001 From: Mitya Selivanov Date: Sun, 11 Feb 2024 18:17:33 +0100 Subject: Update kit --- source/kit/print.h | 49 +++++++++++++++++++++++++++++++++++++++++++++++++ 1 file changed, 49 insertions(+) create mode 100644 source/kit/print.h (limited to 'source/kit/print.h') diff --git a/source/kit/print.h b/source/kit/print.h new file mode 100644 index 0000000..799a011 --- /dev/null +++ b/source/kit/print.h @@ -0,0 +1,49 @@ +#ifndef KIT_PRINT_H +#define KIT_PRINT_H + +#include "string_builder.h" + +#ifdef __cplusplus +extern "C" { +#endif + +enum { + KIT_PRINT_ALIGN_RIGHT = 1, + KIT_PRINT_UNSIGNED = (1 << 1), + KIT_PRINT_BIN = (1 << 2), + KIT_PRINT_OCT = (1 << 3), + KIT_PRINT_DEC = (1 << 4), + KIT_PRINT_HEX = (1 << 5), + KIT_PRINT_PRECISE = (1 << 6), + KIT_PRINT_UTF8 = (1 << 7), +}; + +s32 kit_print_int(kit_str_builder_t *s, i64 value, i64 width, c8 fill, + u32 flags); + +s32 kit_print_float(kit_str_builder_t *s, f64 value, i64 width, + c8 fill, u32 flags); + +s32 kit_print_esc(kit_str_builder_t *s, kit_str_t value, + c8 escape_char, kit_str_t special_symbols, + u32 flags); + +#ifdef __cplusplus +} +#endif + +#ifndef KIT_DISABLE_SHORT_NAMES +# define PRINT_ALIGN_RIGHT KIT_PRINT_ALIGN_RIGHT +# define PRINT_UNSIGNED KIT_PRINT_UNSIGNED +# define PRINT_BIN KIT_PRINT_BIN +# define PRINT_OCT KIT_PRINT_OCT +# define PRINT_DEC KIT_PRINT_DEC +# define PRINT_HEX KIT_PRINT_HEX +# define PRINT_PRECISE KIT_PRINT_PRECISE +# define PRINT_UTF8 KIT_PRINT_UTF8 +# define print_int kit_print_int +# define print_float kit_print_float +# define print_esckit_print_esc +#endif + +#endif -- cgit v1.2.3