| Commit message (Collapse) | Author | Age | Files | Lines |
... | |
|
|
|
|
| |
* 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 was broken on April 21, 2019 in commit
2e36e0feae8d1dd75c8410b365d7dc33b30ce66b (April 21, 2019)
which changed parse_once in such a way that the name
being passed down was no longer stored in the parser.
The ensure_parser function being relied upon doesn't take on
the responsibility of propagating the name from the stream
to the parser, so the parser ends up with a nil name.
Let's just smooth this over by having ensure_parser take
a name parameter. If ensure_parser creates a new parser, it
puts in the name. If the name is nil, then it is
taken from the stream.
* eval.c (load): Pass name to ensure_parser.
* match.c (v_load): Likewise.
* parser.c (parser): Take name parameter, and plant into newly
constructed parser.
(ensure_parser): Take name parameter. When creating a parser,
give it that name, or if name is specified as nil, then
give it the name taken from the stream.
(parser_set_lineno): Pass nil name to ensure_parser.
(lisp_parse_impl, read_file_common): Pass name to
ensure_parser.
* parser.h (parser, ensure_parser): Declarations updated.
* parser.y (parse_once): Pass name to ensure_parser.
* txr.c (txr_main): Pass spec_file_str to ensure_parser.
|
|
|
|
|
|
|
|
|
|
| |
The get operation must use the flexible array's in virtual
function, because incomplete arrays have a no-op get function.
* ffi.c (ffi_flex_struct_in): return the value of the slot.
(ffi_struct_get): When processing the terminating slot of a
flexible struct, we invoke its in-semantics, using the updated
slot value as the object.
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| |
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!
|
|
|
|
|
|
|
| |
* lib.c (chk_calloc): Use unsigned arithmetic to figure out
the total, which is only used for incrementing the
malloc_bytes counter. The unsigned arithmetic is performed in
the same type as that counter.
|
|
|
|
|
|
|
|
|
|
| |
* RELNOTES: Updated.
* configure, txr.1: Bumped version and date.
* share/txr/stdlib/ver.tl: Likewise.
* txr.vim, tl.vim: Regenerated.
|
|
|
|
| |
* crc32.c, crc32.h: Repair accidentally joined lines.
|
|
|
|
|
|
|
| |
* share/txr/stdlib/compiler.tl (usr:compile-file): If a
top-level form is compiled that is an atom, don't emit the
translation, since it has no effect (beyond interning the
symbol).
|
|
|
|
|
|
|
|
|
| |
* share/txr/stdlib/compiler.tl (usr:compile-file): do not
silently ignore forms that (after macroexpansion) are atoms;
treat them like any other forms. This is mostly useless, but
if unbound variables are used as top-level forms, it is
diagnosed, and keeps the file compilation behavior closer to
interpreted semantics.
|
|
|
|
|
|
| |
* 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.
|
|
|
|
|
|
|
|
| |
* ffi.c (carray_replace): Use original fn < vn loop guard,
like in the original code that was replaced by the generic
sequence iteration loop. For instance, when we replace
a range like 1..1, fn == tn, and so the loop doesn't copy
anything.
|
|
|
|
| |
* buf.c, buf.h (buf_fill): Removed.
|
|
|
|
|
|
|
|
|
|
| |
* 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 (crc32_stream): use iobuf_get to obtain the I/O
buffer, and iobuf_put to recycle it.
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| |
* 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.
|
|
|
|
|
|
|
|
|
|
|
|
|
| |
* chksum.c (sha256_stream): Use iobuf_get and iobuf_put.
* gc.c (gc): Do not mark the list of recycled buffers; just
consider them to be garbage and clear the list, like we do
with recycled conses via rcyc_empty.
* stream.c (iobuf_free_list): New static variable.
(iobuf_get, iobuf_put, iobuf_list_empty): New functions.
* stream.h (iobuf_get, iobuf_put, iobuf_list_empty): Declared.
|
|
|
|
|
|
|
| |
* stream.c (stream_init): Register make-byte-input-stream
intrinsic.
* txr.1: Documented.
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| |
* tests/001/query-5.txr: New file.
* tests/001/query-5.expected: New file.
* Makefile (tst/tests/001/query-5.ok): Pass -B to txr for this
new test.
* tests/017/glob-carray.expected: Updated, because the glob
test globs over the contents of tests/001 directory.
* tests/017/glob-zarray.expected: Likewise.
|
|
|
|
|
| |
* txr.1: Two examples have a comment claiming an
incorrect return value. Reported by user vapnik spaknik.
|
|
|
|
|
|
|
|
|
|
| |
* match.c (h_var): When processing variable bound over a regex
or text match, if that datum came from a modifier which was
a variable, we must process the substituted modifier, not the
original variable symbol. This is a regression that was
introduced on November 16, 2011, in commit
b86a599bbfcd591f64f31ddfc9ab1a659d39a7c0: "Variable matches can
span over function calls.". Reported by user vapnik spaknik.
|
|
|
|
|
|
|
|
|
| |
* parser.y (elem, define_clause): The match_reg_params
function is supposed to walk the pattern function parameters,
not the argument of the define directive (of which the second
one is those arguments). This bug causes spurious unbound
variable warnings when function bodies refer to their second
or subsequent arguments. Issue 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.
|
|
|
|
| |
* lib.c (empty): Handle BUF in switch.
|
|
|
|
|
|
|
|
| |
* chksums/sha256.c (SHA256_update): Change in parameter to
const unsigned char *, avoiding the need for a local
variable in that type.
* chksums/sha256.h (SHA256_update): Declaration updated.
|
|
|
|
|
|
|
| |
* share/txr/stdlib/except.tl (catch**): Obtain macro
environment and pass to constantp.
* share/txr/stdlib/place.tl (last, butlast): Likewise.
|
|
|
|
|
|
|
|
|
|
|
|
| |
When the keyword parameter list contains a mixture of constant
and non-constant default value expressions, the order of the
extracted keys is scrambled, so values go to the wrong
variables.
* share/txr/stdlib/keyparams.tl (sys:build-key-list): Renamed
to build-key-list-expr and rewritten to preserve the key
order.
(:key): Follow rename of build-key-list.
|
|
|
|
|
|
| |
* share/txr/stdlib/keyparams.tl (sys:build-key-list): Take
macro environment parameter, and pass to constantp.
(:key): Pass macro environment to sys:build-key-list.
|
|
|
|
|
|
| |
* share/txr/stdlib/defset.tl (defset-expander): Move
with-gensyms to outermost scope so we can include nvsym in it,
avoiding the explicit (nvnsm (gensym)) binding.
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| |
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".
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| |
A change in the nullify function to support hash tables has
broken various functions which classify an object using
seq_info, obtainig a SEQ_HASHLIKE kind, and then work with
si.obj using hash functions. But si.obj has been nullified.
An example of a broken function is find-max.
Basically, this can be attributed to a careless use of nullify
in seq_info. The purpose of nullify is to support code which
treats any sequence as if it were a list. But seq_info doesn't
do that; it classifies sequences and treats them according to
their kind. Under seq_info, the only non-list objects that get
treated as lists are list-like structures. For these it makes
sense to call nullify, in case they have a nullify method.
* lib.c (seq_info): Don't unconditionally call nullify on all
COBJ objects. Only call nullify on struct objects. If that
returns nil, then treat the object as SEQ_NIL; and if it
returns an object different from the original, then recurse.
|
|
|
|
|
|
|
|
|
|
|
|
|
| |
* 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.
|
|
|
|
|
| |
* lib.c (in): Keep the existing specialized cases, but use
seq_info in the fallback.
|
|
|
|
|
| |
* lib.c (take, take_while, take_until, drop_while,
drop_until): Move repeated function name into self variable.
|
|
|
|
|
|
| |
* lib.c (drop_while, drop_until): Use seq_info, so these
functions work with all sequences. Thus now for instance
[drop-while zerop #b'0000f00d'] yields #b'f00d'.
|
|
|
|
| |
* lib.c (empty): Add carray sub case to COBJ case.
|
|
|
|
|
| |
* lib.c (nullify): Add carray and hash subcases into
the COBJ case.
|