diff options
-rw-r--r-- | lisplib.c | 2 | ||||
-rw-r--r-- | share/txr/stdlib/ffi.tl | 3 | ||||
-rw-r--r-- | txr.1 | 9 |
3 files changed, 12 insertions, 2 deletions
@@ -526,7 +526,7 @@ static val ffi_set_entries(val dlt, val fun) lit("with-dyn-lib"), lit("deffi"), lit("deffi-type"), lit("deffi-cb"), lit("deffi-var"), lit("typedef"), lit("sizeof"), lit("alignof"), lit("offsetof"), lit("arraysize"), lit("elemsize"), lit("elemtype"), - lit("ffi"), lit("carray-ref"), + lit("ffi"), lit("carray-ref"), lit("carray-sub"), nil }; set_dlt_entries(dlt, name, fun); diff --git a/share/txr/stdlib/ffi.tl b/share/txr/stdlib/ffi.tl index da29c1e5..a041692f 100644 --- a/share/txr/stdlib/ffi.tl +++ b/share/txr/stdlib/ffi.tl @@ -133,3 +133,6 @@ ^(ffi-type-compile ',type)) (define-accessor carray-ref carray-refset) + +(define-place-macro carray-sub (carray : (from 0) (to t)) + ^(sub ,carray ,from ,to)) @@ -56928,9 +56928,10 @@ then the expected string conversion semantics applies. Both of these functions return .metn carray . -.coNP Function @ carray-sub +.coNP Accessor @ carray-sub .synb .mets (carray-sub < carray >> [ from <> [ to ]]) +.mets (set (carray-sub < carray >> [ from <> [ to ]]) << new-val ) .syne .desc The @@ -56965,6 +56966,12 @@ can be severed by invoking on the returned object, after which the two no longer share storage, and modifications in the original are not reflected in the subrange. +If +.code carray-sub +is used as a syntactic place, behaves exactly like the +.code sub +accessor, via a place macro substitution to that form. + .coNP Function @ carray-replace .synb .mets (carray-replace < carray < item-sequence >> [ from <> [ to ]]) |