From f66f8ad7119207b99f00ea2ea389550ee65db5b3 Mon Sep 17 00:00:00 2001 From: Bruce Hill Date: Fri, 29 Nov 2024 18:09:12 -0500 Subject: Add serialization and deserialization --- stdlib/types.h | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-) (limited to 'stdlib/types.h') 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 #include +#include #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; -- cgit v1.2.3