diff options
Diffstat (limited to 'src/stdlib')
| -rw-r--r-- | src/stdlib/datatypes.h | 3 | ||||
| -rw-r--r-- | src/stdlib/structs.c | 12 | ||||
| -rw-r--r-- | src/stdlib/structs.h | 2 | ||||
| -rw-r--r-- | src/stdlib/types.h | 1 |
4 files changed, 17 insertions, 1 deletions
diff --git a/src/stdlib/datatypes.h b/src/stdlib/datatypes.h index fc665401..0ac97019 100644 --- a/src/stdlib/datatypes.h +++ b/src/stdlib/datatypes.h @@ -69,6 +69,9 @@ typedef struct table_s { struct table_s *fallback; } Table_t; +typedef struct Empty$$struct { +} Empty$$type; + typedef struct { void *fn, *userdata; } Closure_t; diff --git a/src/stdlib/structs.c b/src/stdlib/structs.c index 885b903c..89b5581b 100644 --- a/src/stdlib/structs.c +++ b/src/stdlib/structs.c @@ -6,6 +6,7 @@ #include "bools.h" #include "metamethods.h" #include "siphash.h" +#include "structs.h" #include "text.h" #include "util.h" @@ -214,3 +215,14 @@ 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 a582e9fb..83904377 100644 --- a/src/stdlib/structs.h +++ b/src/stdlib/structs.h @@ -15,6 +15,8 @@ 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/types.h b/src/stdlib/types.h index bd2474fa..5cd622e7 100644 --- a/src/stdlib/types.h +++ b/src/stdlib/types.h @@ -91,7 +91,6 @@ struct TypeInfo_s { extern const TypeInfo_t Void$info; extern const TypeInfo_t Abort$info; -#define Void_t void Text_t Type$as_text(const void *typeinfo, bool colorize, const TypeInfo_t *type); |
