diff options
Diffstat (limited to 'src/stdlib')
| -rw-r--r-- | src/stdlib/datatypes.h | 14 | ||||
| -rw-r--r-- | src/stdlib/structs.c | 11 | ||||
| -rw-r--r-- | src/stdlib/structs.h | 2 | ||||
| -rw-r--r-- | src/stdlib/tables.c | 12 | ||||
| -rw-r--r-- | src/stdlib/tables.h | 2 |
5 files changed, 21 insertions, 20 deletions
diff --git a/src/stdlib/datatypes.h b/src/stdlib/datatypes.h index d51db8ab..fbd2ce73 100644 --- a/src/stdlib/datatypes.h +++ b/src/stdlib/datatypes.h @@ -69,18 +69,18 @@ typedef struct table_s { struct table_s *fallback; } Table_t; -typedef struct Empty$$struct { -} Empty$$type; +typedef struct Present$$struct { +} Present$$type; -#define EMPTY_STRUCT ((Empty$$type){}) +#define PRESENT_STRUCT ((Present$$type){}) typedef struct { bool has_value; - Empty$$type value; -} $OptionalEmpty$$type; + Present$$type value; +} $OptionalPresent$$type; -#define NONE_EMPTY_STRUCT (($OptionalEmpty$$type){.has_value = false}) -#define OPTIONAL_EMPTY_STRUCT (($OptionalEmpty$$type){.has_value = true}) +#define NONE_PRESENT_STRUCT (($OptionalPresent$$type){.has_value = false}) +#define OPTIONAL_PRESENT_STRUCT (($OptionalPresent$$type){.has_value = true}) typedef struct { void *fn, *userdata; diff --git a/src/stdlib/structs.c b/src/stdlib/structs.c index 89b5581b..da8f1461 100644 --- a/src/stdlib/structs.c +++ b/src/stdlib/structs.c @@ -215,14 +215,3 @@ void Struct$deserialize(FILE *in, void *outval, List_t *pointers, const TypeInfo } } } - -public -const TypeInfo_t Empty$$info = {.size = 0, - .align = 0, - .tag = StructInfo, - .metamethods = Struct$metamethods, - .StructInfo.name = "Empty", - .StructInfo.num_fields = 0}; - -public -const Empty$$type EMPTY = {}; diff --git a/src/stdlib/structs.h b/src/stdlib/structs.h index 83904377..a582e9fb 100644 --- a/src/stdlib/structs.h +++ b/src/stdlib/structs.h @@ -15,8 +15,6 @@ PUREFUNC bool PackedData$equal(const void *x, const void *y, const TypeInfo_t *t PUREFUNC Text_t Struct$as_text(const void *obj, bool colorize, const TypeInfo_t *type); void Struct$serialize(const void *obj, FILE *out, Table_t *pointers, const TypeInfo_t *type); void Struct$deserialize(FILE *in, void *outval, List_t *pointers, const TypeInfo_t *type); -extern const TypeInfo_t Empty$$info; -extern const Empty$$type EMPTY; #define Struct$metamethods \ { \ diff --git a/src/stdlib/tables.c b/src/stdlib/tables.c index 6e774c53..a801957f 100644 --- a/src/stdlib/tables.c +++ b/src/stdlib/tables.c @@ -18,6 +18,7 @@ #include "metamethods.h" #include "pointers.h" #include "siphash.h" +#include "structs.h" #include "tables.h" #include "text.h" #include "types.h" @@ -757,3 +758,14 @@ void Table$deserialize(FILE *in, void *outval, List_t *pointers, const TypeInfo_ *(Table_t *)outval = t; } + +public +const TypeInfo_t Present$$info = {.size = 0, + .align = 0, + .tag = StructInfo, + .metamethods = Struct$metamethods, + .StructInfo.name = "Present", + .StructInfo.num_fields = 0}; + +public +const Present$$type PRESENT = {}; diff --git a/src/stdlib/tables.h b/src/stdlib/tables.h index cc2b3b91..cf1c3625 100644 --- a/src/stdlib/tables.h +++ b/src/stdlib/tables.h @@ -130,6 +130,8 @@ void Table$deserialize(FILE *in, void *outval, List_t *pointers, const TypeInfo_ #define Table$length(t) ((t).entries.length) +extern const TypeInfo_t Present$$info; +extern const Present$$type PRESENT; extern const TypeInfo_t CStrToVoidStarTable; #define Table$metamethods \ |
