code / tomo

Lines41.3K C23.7K Markdown9.7K YAML5.0K Tomo2.3K
7 others 763
Python231 Shell230 make212 INI47 Text21 SVG16 Lua6
(20 lines)
1 // Metamethods are methods that all types share:
3 #pragma once
5 #include <stdint.h>
7 #include "datatypes.h"
8 #include "types.h"
9 #include "util.h"
11 PUREFUNC uint64_t generic_hash(const void *obj, const TypeInfo_t *type);
12 PUREFUNC int32_t generic_compare(const void *x, const void *y, const TypeInfo_t *type);
13 PUREFUNC bool generic_equal(const void *x, const void *y, const TypeInfo_t *type);
14 Text_t generic_as_text(const void *obj, bool colorize, const TypeInfo_t *type);
15 void _serialize(const void *obj, FILE *out, Table_t *pointers, const TypeInfo_t *type);
16 List_t generic_serialize(const void *x, const TypeInfo_t *type);
17 void _deserialize(FILE *input, void *outval, List_t *pointers, const TypeInfo_t *type);
18 void generic_deserialize(List_t bytes, void *outval, const TypeInfo_t *type);
19 void cannot_serialize(const void *, FILE *, Table_t *, const TypeInfo_t *type);
20 void cannot_deserialize(FILE *, void *, List_t *, const TypeInfo_t *type);