summaryrefslogtreecommitdiff
path: root/prb_string.h
diff options
context:
space:
mode:
Diffstat (limited to 'prb_string.h')
-rw-r--r--prb_string.h53
1 files changed, 35 insertions, 18 deletions
diff --git a/prb_string.h b/prb_string.h
index 49c7d24..7df8246 100644
--- a/prb_string.h
+++ b/prb_string.h
@@ -1,23 +1,40 @@
#ifndef PRB_STRING_H
#define PRB_STRING_H
-#define str8lit(s) str8((U8 *)(s), sizeof(s)-1)
-#define str8expand(s) (int)((s).length), ((s).ptr)
-
-Str8 str8(U8 *ptr, U64 length);
-Str8 str8range(U8 *start, U8 *end);
-Str8 str8fromcstr(char *cstr);
-char *str8tocstr(Arena *arena, Str8 s);
-Str8 str8chopend(Str8 s, U64 count);
-Str8 str8chopstart(Str8 s, U64 count);
-void str8print(Str8 s);
-
-Str8List *str8list(Arena *arena);
-void str8listpush(Arena *arena, Str8List *list, Str8 str, B32 to_front);
-void str8listprint(Str8List *list);
-
-Str8 str8pushfv(Arena *arena, char *fmt, va_list args);
-Str8 str8pushf(Arena *arena, char *fmt, ...);
-void str8listpushf(Arena *arena, Str8List *list, B32 to_front, char *fmt, ...);
+/* NOTE(pryazha): I don't know wheter it's a good idea
+ * to keep regular and fixed-length strings together, but
+ * seems reasonable at the time.
+ */
+
+/* NOTE(pryazha): Null-terminated strings */
+
+void sys_vprintf(const char *fmt, va_list args);
+void sys_printf(const char *fmt, ...);
+
+/* NOTE(pryazha): Fixed-length strings */
+
+#define FLSLIT(s) fls((U8 *)(s), sizeof(s)-1)
+#define FLSEXP(s) (int)((s).len), ((s).p)
+
+FLS fls(U8 *p, U64 len);
+
+FLS flsfromcstr(const char *cstr);
+char *flstocstr(Arena *a, FLS s);
+
+FLS flsrange(U8 *start, U8 *end);
+FLS flschopend(FLS s, U64 cnt);
+FLS flschopstart(FLS s, U64 cnt);
+
+FLS flspushfv(Arena *a, const char *fmt, va_list args);
+FLS flspushf(Arena *a, const char *fmt, ...);
+
+void flsprint(FLS s);
+
+FLSList *flslist(Arena *a);
+
+void flslistpush(Arena *a, FLSList *l, FLS s, B32 front);
+void flslistpushf(Arena *a, FLSList *l, B32 front, const char *fmt, ...);
+
+void flslistprint(FLSList *l);
#endif /* PRB_STRING_H */