tomo/builtins/memory.c

34 lines
729 B
C
Raw Normal View History

2024-02-04 18:13:50 -08:00
#include <gc.h>
#include <gc/cord.h>
#include <stdalign.h>
#include <stdbool.h>
#include <stdint.h>
#include <stdlib.h>
#include <ctype.h>
#include <sys/param.h>
#include <err.h>
#include "types.h"
#include "../util.h"
#include "../SipHash/halfsiphash.h"
extern const void *SSS_HASH_VECTOR;
public CORD Memory__cord(const void *p, bool colorize, const TypeInfo *type) {
(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_type = {
.size=0,
.align=0,
.tag=CustomInfo,
.CustomInfo={.cord=(void*)Memory__cord},
};
// vim: ts=4 sw=0 et cino=L2,l1,(0,W4,m1,\:0