summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-rw-r--r--buf.c6
-rw-r--r--buf.h1
-rw-r--r--txr.116
3 files changed, 23 insertions, 0 deletions
diff --git a/buf.c b/buf.c
index 269ccded..a5ce235f 100644
--- a/buf.c
+++ b/buf.c
@@ -96,6 +96,11 @@ val make_buf(val len, val init_val, val alloc_size)
return obj;
}
+val bufp(val object)
+{
+ return tnil(type(object) == BUF);
+}
+
val make_borrowed_buf(val len, mem_t *data)
{
val obj = make_obj();
@@ -644,6 +649,7 @@ val buf_pprint(val buf, val stream_in)
void buf_init(void)
{
reg_fun(intern(lit("make-buf"), user_package), func_n3o(make_buf, 1));
+ reg_fun(intern(lit("bufp"), user_package), func_n1(bufp));
reg_fun(intern(lit("buf-trim"), user_package), func_n1(buf_trim));
reg_fun(intern(lit("buf-set-length"), user_package), func_n3o(buf_set_length, 2));
reg_fun(intern(lit("length-buf"), user_package), func_n1(length_buf));
diff --git a/buf.h b/buf.h
index 8102fff8..f3ab4a7b 100644
--- a/buf.h
+++ b/buf.h
@@ -26,6 +26,7 @@
*/
val make_buf(val len, val init_val, val alloc_size);
+val bufp(val object);
val make_borrowed_buf(val len, mem_t *data);
val make_duplicate_buf(val len, mem_t *data);
val buf_trim(val buf);
diff --git a/txr.1 b/txr.1
index 7c1ec319..07f6d951 100644
--- a/txr.1
+++ b/txr.1
@@ -52756,6 +52756,22 @@ the buffer. If an argument is specified, its value must not
be less than
.metn len .
+.coNP Function @ bufp
+.synb
+.mets (bufp << object )
+.syne
+.desc
+The
+.code bufp
+function returns
+.code t
+if
+.meta object
+is a
+.codn buf ,
+otherwise it returns
+.codn nil .
+
.coNP Function @ length-buf
.synb
.mets (length-buf << buf )