summaryrefslogtreecommitdiff
path: root/source/kit/print.h
diff options
context:
space:
mode:
authorMitya Selivanov <automainint@guattari.tech>2024-02-11 18:17:33 +0100
committerMitya Selivanov <automainint@guattari.tech>2024-02-11 18:17:33 +0100
commitdf00df5a7a5bcd9076d4423128ea014ab3535626 (patch)
tree337e62f8ca39b19b250b155a3fbeb495384e356b /source/kit/print.h
parent80da54bb97c279aa60fb77a9bbad9baa0f2e4477 (diff)
downloadsaw-df00df5a7a5bcd9076d4423128ea014ab3535626.zip
Update kit
Diffstat (limited to 'source/kit/print.h')
-rw-r--r--source/kit/print.h49
1 files changed, 49 insertions, 0 deletions
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