summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-rw-r--r--lib.c18
1 files changed, 18 insertions, 0 deletions
diff --git a/lib.c b/lib.c
index 5cd5be4f..597c7edc 100644
--- a/lib.c
+++ b/lib.c
@@ -539,6 +539,10 @@ val car(val cons)
if (zerop(length_str(cons)))
return nil;
return chr_str(cons, zero);
+ case BUF:
+ if (zerop(length_buf(cons)))
+ return nil;
+ return buf_get_uchar(cons, zero);
case COBJ:
if (obj_struct_p(cons)) {
{
@@ -581,6 +585,10 @@ val cdr(val cons)
if (le(length(cons), one))
return nil;
return sub(cons, one, t);
+ case BUF:
+ if (le(length_buf(cons), one))
+ return nil;
+ return sub_buf(cons, one, nil);
case COBJ:
if (obj_struct_p(cons)) {
{
@@ -613,6 +621,9 @@ val rplaca(val cons, val new_car)
case LSTR:
refset(cons, zero, new_car);
return cons;
+ case BUF:
+ buf_put_uchar(cons, zero, new_car);
+ return cons;
default:
if (structp(cons)) {
{
@@ -648,6 +659,7 @@ val rplacd(val cons, val new_cdr)
case VEC:
case STR:
case LSTR:
+ case BUF:
replace(cons, new_cdr, one, t);
return cons;
default:
@@ -978,6 +990,12 @@ val make_like(val list, val thatobj)
if (is_chr(car(list)))
return cat_str(list, nil);
break;
+ case BUF:
+ if (!list)
+ return make_buf(zero, zero, zero);
+ if (integerp(car(list)))
+ return buf_list(list);
+ break;
case COBJ:
if (obj_struct_p(thatobj)) {
val from_list_meth = get_special_slot(thatobj, from_list_m);