summaryrefslogtreecommitdiffhomepage
path: root/include/stc/forward.h
diff options
context:
space:
mode:
Diffstat (limited to 'include/stc/forward.h')
-rw-r--r--include/stc/forward.h25
1 files changed, 20 insertions, 5 deletions
diff --git a/include/stc/forward.h b/include/stc/forward.h
index 572a319f..5c9c4f4d 100644
--- a/include/stc/forward.h
+++ b/include/stc/forward.h
@@ -39,8 +39,21 @@
#define forward_cqueue(CX, VAL) _c_cdeq_types(CX, VAL)
#define forward_cvec(CX, VAL) _c_cvec_types(CX, VAL)
-// csview
-typedef const char csview_value;
+// csubstr : non-null terminated string view
+typedef const char csubstr_value;
+typedef struct csubstr {
+ csubstr_value* str;
+ intptr_t size;
+} csubstr;
+
+typedef union {
+ csubstr_value* ref;
+ struct { csubstr chr; csubstr_value* end; } u8;
+} csubstr_iter;
+
+
+// csview : null-terminated string view
+typedef csubstr_value csview_value;
typedef struct csview {
csview_value* str;
intptr_t size;
@@ -48,10 +61,11 @@ typedef struct csview {
typedef union {
csview_value* ref;
- struct { csview chr; csview_value* end; } u8;
+ struct { csubstr chr; } u8;
} csview_iter;
-// cstr
+
+// cstr : null-terminated string (short string optimized - sso)
typedef char cstr_value;
typedef struct { cstr_value* data; intptr_t size, cap; } cstr_buf;
typedef union cstr {
@@ -61,9 +75,10 @@ typedef union cstr {
typedef union {
cstr_value* ref;
- struct { csview chr; } u8;
+ struct { csubstr chr; } u8;
} cstr_iter;
+
#define c_true(...) __VA_ARGS__
#define c_false(...)