code / tomo

Lines41.3K C23.7K Markdown9.7K YAML5.0K Tomo2.3K
7 others 763
Python231 Shell230 make212 INI47 Text21 SVG16 Lua6
(34 lines)
1 // Type info and methods for "Memory" opaque type
3 #include <err.h>
4 #include <gc.h>
5 #include <stdbool.h>
6 #include <stdint.h>
7 #include <sys/param.h>
9 #include "memory.h"
10 #include "metamethods.h"
11 #include "print.h"
12 #include "text.h"
13 #include "types.h"
14 #include "util.h"
16 public
17 Text_t Memory$as_text(const void *p, bool colorize, const TypeInfo_t *info) {
18 (void)info;
19 if (!p) return Text("Memory");
20 Text_t text = Text$from_str(String("Memory<", (void *)p, ">"));
21 return colorize ? Text$concat(Text("\x1b[0;34;1m"), text, Text("\x1b[m")) : text;
24 public
25 const TypeInfo_t Memory$info = {
26 .size = 0,
27 .align = 0,
28 .metamethods =
30 .as_text = Memory$as_text,
31 .serialize = cannot_serialize,
32 .deserialize = cannot_deserialize,
33 },
34 };