*
This commit is contained in:
parent
6a9a0cd4e4
commit
d359c68c32
16 changed files with 2026 additions and 89 deletions
11
src/print.c
11
src/print.c
|
|
@ -2,6 +2,7 @@
|
|||
#include <stdio.h>
|
||||
|
||||
#include "object.h"
|
||||
#include "string.h"
|
||||
#include "print.h"
|
||||
|
||||
V print(O o) {
|
||||
|
|
@ -10,10 +11,16 @@ V print(O o) {
|
|||
} else if (IMM(o)) {
|
||||
printf("%" PRIdPTR, ORD(o));
|
||||
} else {
|
||||
switch (type(o)) {
|
||||
case TYPE_QUOT:
|
||||
Hd *hdr = UNBOX(o);
|
||||
switch (hdr->type) {
|
||||
case OBJ_QUOT:
|
||||
printf("<quotation>");
|
||||
break;
|
||||
case OBJ_STR: {
|
||||
Str *s = string_unwrap(o);
|
||||
printf("\"%.*s\"", (int)s->len, s->data);
|
||||
break;
|
||||
}
|
||||
default:
|
||||
printf("<obj type=%ld ptr=%p>", type(o), (void *)o);
|
||||
}
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue