| Commit message (Collapse) | Author | Age | Files | Lines |
... | |
|
|
|
|
|
|
|
| |
* ffi.c (elemtype_s): New symbol variable.
(ffi_type_compile): Handle elemtype.
(ffi_init): Initialize elemtype_s.
* txr.1: Document elemtype.
|
|
|
|
|
|
|
|
| |
* ffi.c (ffi_elemsize, ffi_elemtype): Fix error messages to
include enum among possible argument types.
* txr.1: Extend documentation for ffi-elemsize and ffi-elemtype
to include base integer type of enumerations.
|
|
|
|
|
|
| |
* ffi.c (ffi_type_compile): New case handling qref_s symbol.
* txr.1: Documented.
|
|
|
|
|
|
|
|
|
|
| |
* RELNOTES: Updated.
* configure, txr.1: Bumped version and date.
* share/txr/stdlib/ver.tl: Likewise.
* txr.vim, tl.vim: Regenerated.
|
|
|
|
|
|
| |
* txr.1: Ensure all instances of vice versa are spellled
consistently without a dash and italicized. Italicize every
et cetera and one a priori.
|
|
|
|
| |
* txr.1: All instances of the hedge phrase "of course" are removed.
|
|
|
|
|
|
|
| |
* txr.1: A smattering of wording improvements motivated by a
search for the fluff adjective "very". Most instances of
"very" are deleted, and in some cases the surrounding wording
is improved.
|
|
|
|
|
| |
* txr.1: Description of @(merge) is improved by eliminating
fluff wording.
|
|
|
|
|
|
|
|
|
| |
* txr.1: In the --args example, don't use txr-path, but
txr-exe-path. Also, path-cat instead of plain string
catenation. The example for save-exe was additionally doing
something wrong: taking the dir-name of txr-path, which would
calculate the parent of the executable directory. This example
is harmonized with the --args one.
|
|
|
|
|
| |
* txr.1: the term "raw directory path" has not been
introduced; it is a typo for "raw directory prefix".
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| |
This commit adds support for working with foreign structures
which use the C99 "flexible array member", or possibly the
old "C struct hack". Some improvements are made in the FFI
code the area of incomplete types and bitfields.
* ffi.c (struct txr_ffi_type): New flag members incomplete
and bitfield.
(ffi_varray_dynsize): Check incomplete type flag rather than
for zero size.
(ffi_flex_dynsize, ffi_flex_alloc, ffi_flex_struct_in): New static functions.
(ffi_struct_in): Call ffi_flex_struct_in when doing by-value
semantics on a flexible structure, just before converting last
member. This checks for the length method, calls it, and
adjusts the last member object as documented.
(ffi_struct_get): Likewise.
(bitfield_syntax_p): Static function removed; there is a
flag for this now in the type, so no need to parse its
syntax.
(make_ffi_type_pointer): Test bitfield flag rather than
using bitfield_syntax_p.
(make_ffi_type_struct): Take new argument indicating that the
struct is flexible. Wire in appropriate virtual functions
based on this flag, and set the type's incomplete flag
accordingly. Check bitfield flag rather than using
bitfield_syntax_p for detecting bitfield members.
Calculate the size of flexible struct differently: it is
the offset of the last member.
(make_ffi_type_union): Test bitfield flag rather than
using bitfield_syntax_p.
(ffi_struct_compile): Renamed to ffi_membs_compile.
(ffi_membs_compile): New pointer parameter for returning an
indication whether the member list specifies a flexible
struct. Test the incomplete flag of a member type rather than
size being zero.
(ffi_type_compile): Follow rename of ffi_struct_compile to
ffi_membs_compile. Pass down the flag obtained from
ffi_membs_compile into make_ffi_type_struct so that a flexible
struct type is created when necessary. Disallow arrays of
bitfields. Set bitfield flag on bitfield types.
(ffi_init_types): Set incomplete flag on void type.
(ffi_make_call_desc): Test for incomplete and bitfield types
using new flags.
(ffi_typedef, ffi_size, ffi_alignof): Test for bitfield type
using new bitfield flag.
(carray_elem_check): New static function.
(carray_buf, carray_pun, carray_unum, carray_num): Use new
carray_elem_check to check for bad array element type. This
uses the incomplete flag rather than checking for zero size,
and also disallows bitfields.
* lib.h (length_s): Declared.
* txr.1: Flexible structs documented in new section. Also
section on incomplete types. Description of sizeof operator
gives more detaild about incomplete types including flexible
structs.
|
|
|
|
| |
* txr.1: Add missing documentation for ffi-out.
|
|
|
|
| |
* txr.1: ffi-in is a decoding not an encoding action.
|
|
|
|
| |
* txr.1: Document the offset argument of the ffi-in operation.
|
|
|
|
|
|
|
|
|
|
|
| |
* lib.c (do_relate_hash, do_relate_hash_dfl): New static
functions.
(relate): If the number of keys and values is the same, and
there are more than ten, then use hashing.
If the default value is specified, and it is nil, then a hash
table can be returned directly, instead of a function.
* txr.1: Note added that relate may return a hash.
|
|
|
|
|
|
|
|
|
| |
* hash.c (hash_zip): New function.
(hash_init): hash-zip intrinsic registered.
* hash.h (hash_zip): Declared.
* txr.1: Documented.
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| |
If sizeof is given an extra argument (an expression which
evaluates to an object), it can calculate the dynamic size of
the FFI type in relation to representing that object.
* ffi.c (dyn_size): New static function.
(ffi_init): Register sys:dyn-size intrinsic.
* share/txr/stdlib/ffi.tl (sizeof): Support additional
argument, avoiding run-time compilation of the type expression
with the help of load-time.
* txr.1: Update documentation for sizeof macro.
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| |
The motivating bug here is that
(ffi-put #(1 2 3 5) (ffi (array int)))
perpetrates a buffer overrun. The size of (array int) is zero,
and so a zero-length buffer is allocated. But then an array of
five ints is stored. This is made to work correctly:
allocating a buffer large enough.
A new virtual function is introduced into the txr_ffi_type
structure to calculate a type's dynamic size, from a prototype
Lisp object.
* ffi.c (struct txr_ffi_type): New function pointer member,
dynsize.
(ffi_fixed_dynsize, ffi_varray_dynsize): New static functions.
(make_ffi_type_builtin, make_ffi_type_pointer,
make_ffi_type_struct, make_ffi_type_union,
make_ffi_type_array): Initialize new dynsize member of type
structure with pointer to ffi_fixed_dynsize.
(ffi_type_compile): Initialize the dynsize pointer of variable
array types to ffi_varray_dynsize.
(ffi_put_into, ffi_put, ffi_in, ffi_out): Use dynsize to
calculate the real size required to store or extract the given
object.
* txr.1: Update doc for ffi-put, ffi-put-into and ffi-in.
Looks like we are missing ffi-out; it is not documented!
|
|
|
|
|
|
|
|
|
|
| |
* RELNOTES: Updated.
* configure, txr.1: Bumped version and date.
* share/txr/stdlib/ver.tl: Likewise.
* txr.vim, tl.vim: Regenerated.
|
|
|
|
|
|
| |
* txr.1: Switch op example to ap and move under description
of ap, which needs an example anyway. Add new examples for op.
Reported by user vapnik spaknik.
|
|
|
|
|
|
|
|
|
|
|
|
|
| |
* buf.c (replace_buf): In the same-type case, use memmove
rather than memcpy in case the objects overlap, so we
don't invoke C undefined behavior.
* lib.c (replace_str, replace_vec): Likewise.
* txr.1: Specify that if the replacement sequence overlaps
with the target range of the destination sequence, or
with any portion that has to be relocated if range
changes size, then the behavior is unspecified.
|
|
|
|
|
| |
* txr.1: The index-list argument of replace can be a sequence
of any kind, not just a list or vector.
|
|
|
|
|
|
|
|
|
|
| |
* buf.c (buf_move_bytes): New static function.
(buf_put_buf): New function.
(buf_init): Register buf-put-buf intrinsic.
* buf.h (buf_put_buf): Declared.
* txr.1: Documented.
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| |
* chksum.c (sha256_stream_impl): New static function, formed
out of bulk of sha256_stream. Takes a pointer to a buffer
where the digest is stored.
(sha256_ensure_buf): New static function.
(sha256_stream): Take buf argument; use sha256_ensure_buf to
allocate a buffer if necessary, and to obtain the low-level
buffer pointer. Implementation moved into sha256_stream_impl.
(sha256_buf, sha256_str): Take pointer to digest buffer; don't
allocate a buf object, don't return anything.
(sha256): Take buf argument; use sha256_ensure_buf to
allocate a buffer if necessary, and to obtain the low-level
buffer pointer, which is passed to sha256_buf and sha256_str.
(chksum_init): Update registrations of intrinsics with new
optional parameters.
* chksum.h (sha256_stream, sha256): Declarations updated.
* txr.1: Updated.
|
|
|
|
|
|
|
| |
* stream.c (stream_init): Register make-byte-input-stream
intrinsic.
* txr.1: Documented.
|
|
|
|
|
| |
* txr.1: Two examples have a comment claiming an
incorrect return value. Reported by user vapnik spaknik.
|
|
|
|
|
|
|
|
|
|
| |
* RELNOTES: Updated.
* configure, txr.1: Bumped version and date.
* share/txr/stdlib/ver.tl: Likewise.
* txr.vim, tl.vim: Regenerated.
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| |
Users of defset no longer have to ensure that in the store
form, the symbol which gives the new value to be stored is
inserted only once.
* share/txr/stdlib/defset.tl (defset-expander): Transform the
store form by inserting a temporary variable using alet.
(sub-list, sub-vec, sub-str): These place forms no longer
require a local gensym.
* txr.1: Updated doc.
* tests/012/defset.tl: The expected output for the inc case
now incorporates a gensym that comes from the compiled
defset macro. Since we can't control that by means of the
gensym counter, we resort to extracting it from the expansion
itself, then check the test case against a template which
incorporates that gensym. We check that the extracted item
really is a gensym: it's a symbol with no home package whose
name starts with "g".
|
|
|
|
|
|
|
|
|
|
|
|
|
| |
* lib.c (seq_begin): Do not null out si->inf.obj; it's needed
for accessing hashes and vector-like objects. This bug means
that seq-begin iteration has only worked correctly for lists.
The original motivation was not to have spurious retention of
the head of a lazy list, which is hereby reintroduced. But
iterators can be rewound. Let's just document this away and
leave it as a to-do item.
* txr.1: Document the limitation of seq-begin w.r.t.
lazy lists.
|
|
|
|
|
| |
* txr.1: The pos argument of put-buff and fill-buf is a
position within the buffer (not the stream).
|
|
|
|
|
| |
* txr.1: Update the list of syntactic places to list all the
new places that have been added, plus a few additional edits.
|
|
|
|
|
|
|
| |
* lib.c (in): A simple check and fallthrough lets this
function process hash tables more generally in this function.
* txr.1: Documented.
|
|
|
|
|
|
| |
* txr.1: Clarify that nullify also just returns its argument
if it is not a sequence at all. Clarify that nullify works
on objects via the nullify method only.
|
|
|
|
|
|
|
| |
* lib.c (seqp): Use seq_info to classify the object
as a sequence.
* txr.1: Update description of seqp.
|
|
|
|
|
|
|
|
|
|
|
|
| |
* Makefile (OBJS): Add chksums/crc32.o.
* chksum.c (crc32_stream, crc32): New functions.
(chksum_init): Register crc32-stream and crc32 intrinsic
functions.
* chksums/crc32.c, chksums/crc32.h: New files.
* txr.1: Documented.
|
|
|
|
|
|
|
|
|
|
| |
* chksum.c, chksum.h, chksums/sha256.c, chksums/sha256.h: New files.
* lib.c (init): Call chksum_init.
* txr.1: Documented.
* LICENSE: Add SHA-256 copyright notice.
|
|
|
|
|
|
|
|
| |
* txr.1: Buffers are now documented after strings and vectors.
Buffer streams are in the I/O section. Note: the diff between
this and the previous commit needs to be generated with
git diff --minimal. Otherwise it looks like over 30,000 lines
of changes.
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| |
* filter.c (base64_encode): Handle an object of either string
or buffer type by using make_byte_input_stream.
(base64_decode_buf): New function.
(filter_init): Register base64-decode-buf intrinsic.
* filter.h (base64_decode_buf): Declared.
* stream.c (make_byte_input_stream): New function.
* stream.h (make_byte_input_stream): Declared.
* txr.1: Updated.
|
|
|
|
|
| |
* txr.1: Two issues fixed while proof-reading: missing "a"
article and a missing plural.
|
|
|
|
|
| |
* txr.1: In two places, fix an awkward "; that is, has ..."
and "; that is, is ..." grammatical curiosity.
|
|
|
|
| |
* txr.1: "following three expressions" should be "two".
|
|
|
|
|
|
|
|
|
|
|
|
| |
* RELNOTES: Updated.
* configure, txr.1: Bumped version and date.
* share/txr/stdlib/ver.tl: Likewise.
* txr.vim, tl.vim: Regenerated.
* protsym.c: Likewise.
|
|
|
|
|
|
|
|
|
|
|
| |
* arith.c (bitset_s): New symbol variable.
(bitset): New function.
(arith_init): bitset_s initialized, bitset intrinsic
registered.
* lib.h (bitset): Declared.
* txr.1: Documented bitset function and method.
|
|
|
|
|
|
|
|
|
|
|
| |
* lisplib.c (defset_instantiate): Add sub-list, sub-vec and
sub-str symbols as autoload triggers for defset.tl.
* share/txr/stdlib/defset.tl (sub-list, sub-vec, sub-str): New
syntactic places defined with defset.
* txr.1: sub-list, sub-vec and sub-str documented as
accessors.
|
|
|
|
|
|
|
|
|
|
| |
* lisplib.c (ffi_set_entries): Register autoload for sub-buf
symbol.
* share/txr/stdlib/ffi.tl (sub-buf): Syntactic place
defined via defset.
* txr.1: Updated sub-buf documentation.
|
|
|
|
|
|
| |
* txr.1: Documentatation for sub accessor fails to specify
that the seq variable is updated with the value returned by
replace.
|
|
|
|
|
|
|
|
|
|
|
|
|
| |
* share/txr/stdlib/ffi.tl (carray-sub): We use defset to
define a carray-sub place that updates via carray-replace,
rather than using a place macro to defer to the
generic sub accessor. This results in a more efficient
implementation. This new accessor doesn't require the carray
argument to be a place; unlike sub, it doesn't have to capture
the return value of carray-replace and store it back into
the carray variable.
* txr.1: Updated doc.
|
|
|
|
|
|
| |
* txr.1: Add mentions of the forgotten define-accessor macro
in text that lists ways of defiing places. Cross-reference
short form of defset and define-accessor.
|
|
|
|
| |
* txr.1: Fix ftw function being mistakenly called nftw.
|
|
|
|
|
|
| |
* txr.1: Numerous library functions whose Description
paragraph begins with "This function" are now introduced by
their name.
|