summaryrefslogtreecommitdiffstats
path: root/lib.c
diff options
context:
space:
mode:
authorKaz Kylheku <kaz@kylheku.com>2019-08-21 17:32:13 -0700
committerKaz Kylheku <kaz@kylheku.com>2019-08-21 17:32:13 -0700
commit0dd1d1a586fcfcf11e0b1c926c8be9c4c8d525be (patch)
tree1e674edaf8401bc52745c930edfe3c114e1073a7 /lib.c
parentbc06c87a10f9d9ddc4209ec0a49ab48bf37dc706 (diff)
downloadtxr-0dd1d1a586fcfcf11e0b1c926c8be9c4c8d525be.tar.gz
txr-0dd1d1a586fcfcf11e0b1c926c8be9c4c8d525be.tar.bz2
txr-0dd1d1a586fcfcf11e0b1c926c8be9c4c8d525be.zip
New function: cptr-buf.
* eval.c (eval_init): Register cptr-buf intrinsic. * lib.c (cptr_buf): New function. * lib.h (cptr_buf): Declared. * txr.1: Documented.
Diffstat (limited to 'lib.c')
-rw-r--r--lib.c7
1 files changed, 7 insertions, 0 deletions
diff --git a/lib.c b/lib.c
index d07a03ca..374b038a 100644
--- a/lib.c
+++ b/lib.c
@@ -7832,6 +7832,13 @@ val cptr_obj(val obj, val type_sym_in)
return cptr_typed(coerce(mem_t *, obj), type_sym, 0);
}
+val cptr_buf(val buf, val type_sym_in)
+{
+ val type_sym = default_null_arg(type_sym_in);
+ mem_t *ptr = buf_get(buf, lit("cptr-buf"));
+ return cptr_typed(ptr, type_sym, 0);
+}
+
val cptr_zap(val cptr)
{
(void) cptr_handle(cptr, nil, lit("cptr-zap"));