diff options
| author | Bruce Hill <bruce@bruce-hill.com> | 2024-11-29 18:09:12 -0500 |
|---|---|---|
| committer | Bruce Hill <bruce@bruce-hill.com> | 2024-11-29 18:09:12 -0500 |
| commit | f66f8ad7119207b99f00ea2ea389550ee65db5b3 (patch) | |
| tree | 5b5a7c887b311e3de2f2cb293b1228598c5b9eb1 /stdlib/types.h | |
| parent | 4b5e4cd1f21582f5e5fa682ab4e4bff252963468 (diff) | |
Add serialization and deserialization
Diffstat (limited to 'stdlib/types.h')
| -rw-r--r-- | stdlib/types.h | 6 |
1 files changed, 5 insertions, 1 deletions
diff --git a/stdlib/types.h b/stdlib/types.h index 652a2e70..faaa531c 100644 --- a/stdlib/types.h +++ b/stdlib/types.h @@ -4,6 +4,7 @@ #include <stdbool.h> #include <stdint.h> +#include <stdio.h> #include "datatypes.h" @@ -15,6 +16,8 @@ typedef struct { bool (*equal)(const void*, const void*, const TypeInfo_t*); Text_t (*as_text)(const void*, bool, const TypeInfo_t*); bool (*is_none)(const void*, const TypeInfo_t*); + void (*serialize)(const void*, FILE*, Table_t*, const TypeInfo_t*); + void (*deserialize)(FILE*, void*, Array_t*, const TypeInfo_t*); } metamethods_t; typedef struct { @@ -68,7 +71,8 @@ struct TypeInfo_s { }; #define Type$info(typestr) &((TypeInfo_t){.size=sizeof(TypeInfo_t), .align=__alignof__(TypeInfo_t), \ - .tag=TypeInfoInfo, .TypeInfoInfo.type_str=typestr}) + .tag=TypeInfoInfo, .TypeInfoInfo.type_str=typestr, \ + .metamethods={.serialize=cannot_serialize, .deserialize=cannot_deserialize}}) extern const TypeInfo_t Void$info; extern const TypeInfo_t Abort$info; |
