summaryrefslogtreecommitdiffhomepage
path: root/include
diff options
context:
space:
mode:
authorTyge Løvset <[email protected]>2023-02-10 13:28:47 +0100
committerTyge Løvset <[email protected]>2023-02-10 13:28:47 +0100
commit9f8fc0e6b9bb56ea5cf9fbb27e25326f5cb96891 (patch)
tree33387b7c11a80d9727927c79c33687db249409cf /include
parentfaf7ddf7a6d36b08b57a2bcd67d2d12815453d1d (diff)
downloadSTC-modified-9f8fc0e6b9bb56ea5cf9fbb27e25326f5cb96891.tar.gz
STC-modified-9f8fc0e6b9bb56ea5cf9fbb27e25326f5cb96891.zip
Added struct name to typedef to allow container pointer predecarations.
Diffstat (limited to 'include')
-rw-r--r--include/stc/forward.h34
1 files changed, 21 insertions, 13 deletions
diff --git a/include/stc/forward.h b/include/stc/forward.h
index d08b71b4..64d4370a 100644
--- a/include/stc/forward.h
+++ b/include/stc/forward.h
@@ -42,7 +42,11 @@
// csview
typedef const char csview_value;
-typedef struct { csview_value* str; intptr_t size; } csview;
+typedef struct csview {
+ csview_value* str;
+ intptr_t size;
+} csview;
+
typedef union {
csview_value* ref;
struct { csview chr; csview_value* end; } u8;
@@ -51,10 +55,11 @@ typedef union {
// cstr
typedef char cstr_value;
typedef struct { cstr_value* data; intptr_t size, cap; } cstr_buf;
-typedef union {
+typedef union cstr {
struct { cstr_value data[sizeof(cstr_buf) - 1]; unsigned char size; } sml;
struct { cstr_value* data; size_t size, ncap; } lon;
} cstr;
+
typedef union {
cstr_value* ref;
struct { csview chr; } u8;
@@ -65,22 +70,25 @@ typedef union {
#define _c_carc_types(SELF, VAL) \
typedef VAL SELF##_value; \
-\
- typedef struct { \
+ typedef struct SELF { \
SELF##_value* get; \
catomic_long* use_count; \
} SELF
#define _c_cbox_types(SELF, VAL) \
typedef VAL SELF##_value; \
- typedef struct { \
+ typedef struct SELF { \
SELF##_value* get; \
} SELF
#define _c_cdeq_types(SELF, VAL) \
typedef VAL SELF##_value; \
typedef struct { SELF##_value *ref, *end; } SELF##_iter; \
- typedef struct { SELF##_value *_base, *data; intptr_t _len, _cap; } SELF
+\
+ typedef struct SELF { \
+ SELF##_value *_base, *data; \
+ intptr_t _len, _cap; \
+ } SELF
#define _c_clist_types(SELF, VAL) \
typedef VAL SELF##_value; \
@@ -91,7 +99,7 @@ typedef union {
SELF##_node *const *_last, *prev; \
} SELF##_iter; \
\
- typedef struct { \
+ typedef struct SELF { \
SELF##_node *last; \
} SELF
@@ -114,7 +122,7 @@ typedef union {
uint8_t* _hx; \
} SELF##_iter; \
\
- typedef struct { \
+ typedef struct SELF { \
SELF##_value* table; \
uint8_t* _hashx; \
SELF##_sizet size, bucket_count; \
@@ -142,7 +150,7 @@ typedef union {
SELF##_sizet _tn, _st[36]; \
} SELF##_iter; \
\
- typedef struct { \
+ typedef struct SELF { \
SELF##_node *nodes; \
SELF##_sizet root, disp, head, size, cap; \
} SELF
@@ -150,20 +158,20 @@ typedef union {
#define _c_cstack_fixed(SELF, VAL, CAP) \
typedef VAL SELF##_value; \
typedef struct { SELF##_value *ref, *end; } SELF##_iter; \
- typedef struct { SELF##_value data[CAP]; intptr_t _len; } SELF
+ typedef struct SELF { SELF##_value data[CAP]; intptr_t _len; } SELF
#define _c_cstack_types(SELF, VAL) \
typedef VAL SELF##_value; \
typedef struct { SELF##_value *ref, *end; } SELF##_iter; \
- typedef struct { SELF##_value* data; intptr_t _len, _cap; } SELF
+ typedef struct SELF { SELF##_value* data; intptr_t _len, _cap; } SELF
#define _c_cvec_types(SELF, VAL) \
typedef VAL SELF##_value; \
typedef struct { SELF##_value *ref, *end; } SELF##_iter; \
- typedef struct { SELF##_value *data; intptr_t _len, _cap; } SELF
+ typedef struct SELF { SELF##_value *data; intptr_t _len, _cap; } SELF
#define _c_cpque_types(SELF, VAL) \
typedef VAL SELF##_value; \
- typedef struct { SELF##_value* data; intptr_t _len, _cap; } SELF
+ typedef struct SELF { SELF##_value* data; intptr_t _len, _cap; } SELF
#endif // STC_FORWARD_H_INCLUDED