tomo/builtins/memory.c

32 lines
691 B
C
Raw Normal View History

2024-02-04 18:13:50 -08:00
#include <gc.h>
#include <gc/cord.h>
#include <stdbool.h>
#include <stdint.h>
#include <stdlib.h>
#include <ctype.h>
#include <sys/param.h>
#include <err.h>
#include "../util.h"
#include "../SipHash/halfsiphash.h"
2024-02-17 16:35:35 -08:00
#include "memory.h"
#include "types.h"
2024-02-04 18:13:50 -08:00
2024-02-17 14:44:17 -08:00
public CORD Memory__as_str(const void *p, bool colorize, const TypeInfo *type) {
2024-02-04 18:13:50 -08:00
(void)type;
2024-02-17 14:29:56 -08:00
if (!p) return "Memory";
2024-02-04 18:13:50 -08:00
CORD cord;
2024-02-17 14:29:56 -08:00
CORD_sprintf(&cord, colorize ? "\x1b[0;34;1mMemory<%p>\x1b[m" : "Memory<%p>", *(const void**)p);
2024-02-04 18:13:50 -08:00
return cord;
}
public TypeInfo Memory = {
2024-02-04 18:13:50 -08:00
.size=0,
.align=0,
.tag=CustomInfo,
2024-02-17 14:44:17 -08:00
.CustomInfo={.as_str=(void*)Memory__as_str},
2024-02-04 18:13:50 -08:00
};
// vim: ts=4 sw=0 et cino=L2,l1,(0,W4,m1,\:0