commit e8285d8f494e7e2139830eec517b55cb20f33de4
parent bea62e4dc9943605c2ea3f8fd427a1594b75f3ed
Author: Andres Navarro <canavarro82@gmail.com>
Date: Wed, 22 Feb 2012 20:06:00 -0300
Added ttisuser to test user pointers and a case for user pointers in the write/display code.
Diffstat:
2 files changed, 4 insertions(+), 0 deletions(-)
diff --git a/src/kobject.h b/src/kobject.h
@@ -298,6 +298,7 @@ typedef struct __attribute__ ((__packed__)) GCheader {
#define ttiseof(o) (tbasetype_(o) == K_TAG_EOF)
#define ttisboolean(o) (tbasetype_(o) == K_TAG_BOOLEAN)
#define ttischar(o) (tbasetype_(o) == K_TAG_CHAR)
+#define ttisuser(o) (tbasetype_(o) == K_TAG_USER)
#define ttisfree(o) (tbasetype_(o) == K_TAG_FREE)
/* Complex types (value in heap),
diff --git a/src/kwrite.c b/src/kwrite.c
@@ -584,6 +584,9 @@ void kwrite_scalar(klisp_State *K, TValue obj)
kw_printf(K, "#ignore");
break;
/* unreadable objects */
+ case K_TUSER:
+ kw_printf(K, "#[user pointer: %p]", pvalue(obj));
+ break;
case K_TEOF:
kw_printf(K, "#[eof]");
break;