summaryrefslogtreecommitdiff
path: root/kit/print.h
diff options
context:
space:
mode:
authorMitya Selivanov <automainint@guattari.tech>2024-07-14 21:12:37 +0200
committerMitya Selivanov <automainint@guattari.tech>2024-07-14 21:12:37 +0200
commit30740ca4131d1f574718262451b4410207dc8d4e (patch)
treefc88b16a216079397ad85b9c6b1a1c1c5712a814 /kit/print.h
parent5e3c99bb1cf1d03ea006300121265571f5008fd2 (diff)
downloadsaw-30740ca4131d1f574718262451b4410207dc8d4e.zip
Reworking the build system
Diffstat (limited to 'kit/print.h')
-rw-r--r--kit/print.h47
1 files changed, 47 insertions, 0 deletions
diff --git a/kit/print.h b/kit/print.h
new file mode 100644
index 0000000..5a64a20
--- /dev/null
+++ b/kit/print.h
@@ -0,0 +1,47 @@
+#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
+
+#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