aboutsummaryrefslogtreecommitdiff
path: root/src/stdlib
diff options
context:
space:
mode:
authorBruce Hill <bruce@bruce-hill.com>2025-11-23 13:28:48 -0500
committerBruce Hill <bruce@bruce-hill.com>2025-11-23 13:28:48 -0500
commit0fa9a52090eb5d9ce88220c0134a8d2af6eb8d94 (patch)
tree87a3181238da384a94077f401b0ba49eb8eb1e7e /src/stdlib
parent1c77d596b28ee45e0234cfa7c5f5679492f2178e (diff)
Accessing enum fields now gives an optional value instead of a boolean
Diffstat (limited to 'src/stdlib')
-rw-r--r--src/stdlib/datatypes.h5
1 files changed, 5 insertions, 0 deletions
diff --git a/src/stdlib/datatypes.h b/src/stdlib/datatypes.h
index caabdacd..d51db8ab 100644
--- a/src/stdlib/datatypes.h
+++ b/src/stdlib/datatypes.h
@@ -72,11 +72,16 @@ typedef struct table_s {
typedef struct Empty$$struct {
} Empty$$type;
+#define EMPTY_STRUCT ((Empty$$type){})
+
typedef struct {
bool has_value;
Empty$$type value;
} $OptionalEmpty$$type;
+#define NONE_EMPTY_STRUCT (($OptionalEmpty$$type){.has_value = false})
+#define OPTIONAL_EMPTY_STRUCT (($OptionalEmpty$$type){.has_value = true})
+
typedef struct {
void *fn, *userdata;
} Closure_t;