| Commit message (Collapse) | Author | Age | Files | Lines |
... | |
|
|
|
|
|
|
|
| |
* txr.1: Fix missing backslash on font changing directive in
the troff-oriented implementation of the <> operator.
This makes no difference to the output. The HTML output is
absolutely identical according to diff. Visual inspections of
the groff-generated PDF also reveal no difference.
|
|
|
|
|
| |
* txr.1: Fix "Buffers" and "The buf type" being at equal
section levels. Adjust the cptr type section to harmonize.
|
|
|
|
|
|
|
|
|
|
| |
* RELNOTES: Updated.
* configure, txr.1: Bumped version and date.
* share/txr/stdlib/ver.tl: Likewise.
* txr.vim, tl.vim: Regenerated.
|
|
|
|
|
|
| |
* txr.1: Fix instances in which the sequence argument of a
sequence manipulating function is called a list or object.
Also fix some unnecessary abbreviation of sequence to seq.
|
|
|
|
|
|
|
| |
* txr.1: Relocate description of nullify from bottom of
Sequence Manipulation to near the top, after the description
of empty. This is very similar to the recent relocation of
nullify in lib.c and lib.h.
|
|
|
|
|
|
|
| |
* txr.1: Move description of make-like from near the bottom of
the Sequence Manipulation section to close to the top, just
under the seqp description. Also, ref-sequence parameter is
renamed to object.
|
|
|
|
|
| |
* txr.1: Move description of copy function out of Sequence
Manipulation and into Object Equivalence.
|
|
|
|
|
|
| |
* txr.1: Move the descriptions of apply and iapply out of
Sequence Manipulation and into Functions, following the
description of the call function.
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| |
The (each ()) form should infinitely loop, and the compiled
version does. The interpreter crashes, when that is a
top-level form. The reason is that the underlying sys:each-op
operator uses an empty list of variable names as an indication
to use the bindings from the parent lexical environment.
And in that particular case, the let is also empty. The
whole thing looks like:
(let () (sys:each-op each nil))
If this is a top-level expression, then op_let receives a null
environment pointer. Since it has no bindings to add, it
doesn't extend the environment chain and passes a null
environment pointer down to op_each, which that tries to use,
because it's told to reach into it for bindings.
Let's use the t symbol for that instead, so then the above
would look like:
;; the t and only the t means "access parent env"
(let () (sys:each-op each t))
And then, let's also fix it so that t is never used in this
case when there are no vars:
;; no t, and so don't access parent env.
(let () (sys:each-op each nil))
* eval.c (op_each): Get the bindings from the parent
environment if vars is t, rather than when it's null.
(me_each): When the symbols are not being inserted into the
sys:each-op form, then insert t to indicate that, rather than
nil. If the source form specifies an empty list of bindings,
then insert nil, not t.
* share/txr/stdlib/compiler.tl (expand-each): Get the list of
variable names from the parent lexical environment when vars
is t, rather than when it's null.
|
|
|
|
|
|
|
| |
This fixes cases like (isec 0..10 5..15).
* lib.c (seq_iter_rewind): Handle the rewinding of
non-sequence iterators (ranges, characters, numbers).
|
|
|
|
|
| |
* txr.1: Nullify documentation updated and clarified, with
examples.
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| |
Issues: (nullify 1..1) doesn't return nil as it
should, and (empty 1) fails.
* lib.c (seq_info): Since we would like nullify to use
seq_info, seq_info cannot call nullify. Transplant the probing
of the nullify method out of nullify and into here.
(nullify): Obtain a seq_info_t on the object. If it's not a
sequence and is not range, then just return the object.
Otherwise obtain a seq_iter_t sequence and peek whether it has
a next item.
(empty): Similarly, obtain an iterator and peek.
Definition of empty is relocated to be next to nullify.
* lib.h: Relocate declaration of empty, also.
|
|
|
|
|
|
|
|
|
|
|
|
| |
The recent refactoring of the mapping functions to use
stack-allocated iterators has a bug. args_decl occurs inside a
loop. But args_decl uses alloca, which doesn't dispose of the
memory when the block scope terminates.
* eval.c (map_common, prod_common): Move the declaration of
args_fun outside of the loop, so that it is allocated just
once. The loop just stuffs fresh sets of values into the
arguments.
|
|
|
|
|
|
|
|
|
| |
* lib.c (transpose): Don't simply copy the input, but convert
it to a list with tolist. The transposev function relies on
mapcarv, and that function now doesn't simply pull out the
trailing object from the args. It processes the args as args,
and a non-list causes problems there, such as args_count
reporting the wrong value.
|
|
|
|
|
|
|
|
| |
* doc: Add paragraphs uder Sequence Manipulation discussing
support for sequences, iterables and hashes. Establish naming
cnovention for arguments: iterables are called iterable or
iter. Update descriptions of functions that work with
iterables.
|
|
|
|
|
|
| |
* txr.1: The init-forms in (each ...) must be suitable for
iter-init and that is now documented. A (range 1 10)
in the example is replaced with 1..11.
|
|
|
|
|
| |
* txr.1: New section added under TXR LISP to introduce the
new iteration concept.
|
|
|
|
|
| |
* txr.1: Add more detail about list handling, and cover
numbers and ranges.
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| |
* lib.h (seq_iter_t): Add some union members to ui and ul for
use with ranges. The purpose of this is to have separate
naming for the iteration variables for ranges.
* lib.c (seq_iter_get_range_cnum, seq_iter_peek_range_cnum,
seq_iter_get_range_chr, seq_iter_peek_range_chr,
seq_iter_get_range_bignum, seq_iter_peek_range_bignum): Use
new union member names for clarity.
(seq_iter_get_rev_range_cnum, seq_iter_peek_rev_range_cnum,
seq_iter_get_rev_range_chr, seq_iter_peek_rev_range_chr,
seq_iter_get_rev_range_bignum,
seq_iter_peek_rev_range_bignum): New static functions.
(seq_iter_with_init_info): Drop obj argument since the si
argument has the object. Add handling for empty and reversed
ranges. Also convert unbounded ranges like N..t and N..: to
just N, recursively. Use new union member names.
(seq_iter_init, seq_iter_init_with_rewind, iter_begin,
iter_reset): Follow elimination of argument in
seq_iter_init_with_info.
|
|
|
|
|
|
|
|
|
|
|
|
| |
* lib.c (seq_iter_init_with_info): Take new Boolean argument
indicating whether the iterator needs to support the rewind
operation. If this is false, and the object is a list, then we
clobber the object, in order to eliminate the GC root.
(seq_iter_init, iter_begin, iter_reset): Pass 0 for the new
Boolean parameter.
(seq_iter_init_with_rewind): New function.
(diff, isec): Use seq_iter_init_with_rewind to request an
iterator with rewind support for the second sequence.
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| |
* eval.c (map_common): Do not extract the arguments as a list.
Do not produce a list of iterator objects. Instead, allocate
an array of seq_iter_t objects on the stack using alloca, and
use these for walking the input lists in parallel. Do not cons
a list of the tuples coming from the lists, but rather store
the tuples into a struct args, also on the stack, and invoke
the function with that. Now, the only heap memory we allocate
is the resulting list being accumulated. In the case of mapdo,
no heap allocation takes place. However, if some of the inputs
are hashes, then hash iterators get allocated in seq_iter_init.
(mapcarv, mappendv, mapdov): Pass self argument to map_common,
needed for seq_iter_init.
|
|
|
|
|
|
| |
* eval.c (map_common): New static function.
(mapcarv, mappendv, mapdov): Now one-line wrappers
for map_common.
|
|
|
|
|
|
|
|
|
|
|
| |
The one list case of maprod reduces to mappend rather than
mapcar, so that [maprod identity '(1 2 3)] fails instead
of producing (1 2 3).
* eval.c (prod_common): Take pointer to mapping function to
use in one-list case, and use it.
(maprodv): Pass mapcarv to prod_common.
(maprendv): Pass mappendv to prod_common.
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| |
* eval.c (get_iter_f): Renamed to iter_from_binding_f.
(iter_begin_f, iter_more_f, iter_item_f, iter_step_f): New
global variables.
(op_each): Follow rename of get_iter_f.
(mapcarv, mappendv, lazy_mapcar_func, lazy_mapcar,
lazy_mapcarv_func, lazy_mapcarv, mapdov, prod_common):
Convert from car/cdr/null-test iteration to iter-begin.
(eval_init): gc-protect and initialize new variables.
* lib.c (mapcar_listout, mappend, mapdo): Convert to seq_iter
iteration. List argument renamed to seq.
(mapcar): List argument renamed to seq.
* lib.h: Declarations updated with renamed arguments.
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| |
I think with the iter-begin API, we have the the "Maxwell's
Equations of Iteration". This not only works well for conses,
but it extends to numbers and ranges.
* lib.h (seq_iter_t): New union member ul, containing a new
member lim. existing len member moved into ul union.
* lib.c (seq_iter_get_vec, seq_iter_peek_vec): Adjust access
of len, now wrapped in union.
(seq_iter_get_range_cnum, seq_iter_peek_range_cnum,
seq_iter_get_range_chr, seq_iter_peek_range_chr,
seq_iter_get_range_bignum, seq_iter_peek_range_bignum,
seq_iter_get_chr, seq_iter_peek_chr, seq_iter_get_num,
seq_iter_peek_num): New static functions.
(seq_iter_init_with_info): Support RNG object, further
classifying the iteration based on the type of the from
element. Support numbers and characters as iterable.
(iter_begin, iter_more, iter_item, iter_step, iter_reset):
Support numbers directly as unencapsulated iterators.
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| |
With this change we can do (each ((x vec)) ...) with
reasonable efficiency, because we are no longer marching
through the vector with cdr, copying the suffix.
* eval.c (get_iter_f): New global variable.
(op_each): Obtain iterators for all the objects with
iter_begin, instead of treating them as lists. Probe the
iterators for termination with iter_more, get the items with
iter_item instead of car and step with iter_step instead of
cdr.
(eval_init): gc-protect the get_iter_f function and initialize
it.
* share/txr/stdlib/compiler.tl (expand-each): Replace the
car/cdr and null testing with iter-init, iter-more, iter-item
and iter-step.
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| |
iter-begin provides a paradigm for iteration that is more
compatible with lists. If the sequence is a list, then the
list itself is returned as the iterator, and the other
functions are basicaly wrappers for car/cdr and null testing.
Yet the API is defined in such a way that other objects can be
iterated with good efficiency, at the cost of allocating a new
iterator object (which can be re-used).
* eval.c (eval_init): Register iter-begin, iter-more,
iter-item, iter-step and iter-reset.
* lib.c (seq_iter_init_with_info): New static function.
(seq_iter_init): Now a thin wrapper for
seq_iter_init_with_info.
(iter_begin, iter_more, iter_item, iter_step, iter_reset): New
functions.
* lib.h (iter_begin, iter_more, iter_item, iter_step,
iter_reset): New functions.
* txr.1: Documented.
|
|
|
|
|
|
|
|
| |
* RELNOTES: Updated.
* configure, txr.1: Bumped version and date.
* share/txr/stdlib/ver.tl: Likewise.
|
|
|
|
|
|
|
|
|
|
| |
The compiler's expander for dohash, and for the each family of
operators neglects to add the (block nil ...) around the forms
that are expected to be in a block.
* share/txr/stdlib/compiler.tl (expand-dohash, expand-each):
Generate the (block nil ...) around the sys:for construct
which doesn't produce one.
|
|
|
|
|
| |
* vm.c (vm_no_block_err): Fix passing extra name argument to
format that is not used in the format string.
|
|
|
|
| |
* txr.1: Fix extra whitespace around env parameter.
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| |
* configure: provide LONGLONG_TYPE and INTPTR_TYPE macros in
config.h that expand to a string literal capturing the
original tokens of the type that was probed.
* stream.c (struct fmt): Removed size member, replaced with
type string. We can match format strings to the textual type,
which will work even if we cannot compile that type. So that
is to say, for instance the "%I64d" entry in the table is
associated with "int64", whereas an expression like sizeof
(int64) won't compile where that type doesn't exist.
(fmt_tab): Replace sizes with type names. Also fix an issue:
%llx was replicated in three rows of the table.
(detect_format_string): Determine the textual type of cnum. It
is a typedef for intptr_t, and the new INPTR_TYPE macro gives
the tokens that were used to typedef intptr_t. If
INTPTR_TYPE happens to be "longlong_t", we use LONGLONG_TYPE
in its place. Then using the determined type, we can search
the table for an appropriate entry: one which matches the type
and whose conversion specifier works. Also, we now test all
four conversion specifiers rather than assuming that if the
decimal one is okay, the others work. Plus, if a working
format string is not found, we now abort.
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| |
* gencadr.txr (cadr_register): Use scat2 to glue two strings.
* cadr.c: Regenerated.
* lib.c (scat2, scat3): New functions.
* lib.h (scat2, scat3): Declared.
* liblib.c (place_instantiate, ver_instantiate,
ifa_instantiate, txr_case_instantiate,
with_resources_instantiate, path_test_instantiate,
struct_instantiate, with_stream_instantiate, hash_instantiate,
except_instantiate, type_instantiate, yield_instantiate,
sock_instantiate, termios_instantiate, awk_instantiate,
build_instantiate, trace_instantiate, getopts_instantiate,
package_instantiate, getput_instantiate, tagbody_instantiate,
pmac_instantiate, error_instantiate, keyparams_instantiate,
ffi_instantiate, doloop_instantiate, stream_wrap_instantiate,
asm_instantiate, compiler_instantiate, debugger_instantiate,
op_instantiate, save_exe_instantiate, defset_instantiate,
copy_file_instantiate): Use scat2 to glue two strings instead
of format.
* parser.c (find_matching_syms, hist_save, repl): Replace
trivial uses of format with scat2 or scat3.
* sysif.c (ensure_dir): Likewise.
* txr.c (get_self_path, substitute_basename, sysroot,
sysroot_init, parse_once_noerr, read_compiled_file_noerr,
read_eval_stream_noerr): Likewise.
* unwind.c (uw_unwind_to_exit_point): Likewise.
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| |
Quasistrings compile to code that requires on the sys:fmt-join
function to glue strings together. Rewriting that function to
avoid converting its arguments from struct args * to a list.
* eval.c (fmt_join): Static function removed.
* lib.c (cat_str_measure, cat_str_append): more_p parameter
changed to int type, which better matches the C style Boolean
values it takes.
(fmt_join): New external function.
* lib.h: Declared.
* args.h (args_more_nozap, args_get_nozap): New inline
functions allowing multiple iterations over arguments without
making a copy.
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| |
The alternative stack is shared by SIGSEGV and SIGBUS.
Therefore, we cannot tear it down when disabling either
signal; the other may be using it.
* signal.c (stack_refcount): New static variable.
(setup_alt_stack, teardown_alt_stack): Functions removed.
(addref_alt_stack, release_alt_stack): New functions to manage
stack with reference counting.
(set_sig_handler): Rearrange the code to only call addref_alt_stack
when transitioning from no-handler to handler for SIGSEGV and
SIGBUS and to only call release_alt_stack when transitioning
from handler to no-handler for these signals.
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| |
* lib.c (seq_getpos, seq_setpos): New functions.
* lib.h (seq_getpos, seq_setpos): Declared.
(search_list, rsearch_list): Static functions removed.
(search_common): New static function.
(search, contains, rsearch): These functions are now trivial
wrappers around search_common. A requirement problem is fixed
in rsearch: when the key is empty, the length of sequence is
returned rather than zero, because zero is obviously not the
right most place where an empty key matches.
* txr.1: Documentation updated.
|
|
|
|
|
| |
* lib.c (update): Function converted to seq_info
classification instead of switching on type.
|
|
|
|
|
|
|
|
|
|
|
| |
The rsearch function is completely broken, returning incorrect
values.
* lib.c (search_list, rsearch_list): Update the position in
the increment part of the loop. This fix only affects
research, but the code is copy-and-paste, so it's good to keep
them the same, and the position of the pos update is a code
smell regardless.
|
|
|
|
|
| |
* lib.c (search_list, rsearch_list): When the key has a bad
type, don't report the seq object in its place.
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| |
The vscat function is white-box copy of cat_str, with just the
iteration over the inputs done differently, and without the
support for separators that are characters instead of strings
(which was added to cat_str after vscat was forked.
In this patch, the common logic underlying both functions is
factored out into a small ad-hoc "struct cat_str" object which
maintains the state and provides the operations to measure the
pieces of the string, allocate the space, copy the pieces
together and produce the resulting object.
The motivation here isn't just to reduce duplication. I would
like a more efficient function for catenating strings which
takes a "struct args *", not requiring a list to be consed up.
* lib.c (struct cat_str): New struct type.
(cat_str_init, cat_str_measure, cat_str_alloc, cat_str_append,
cat_str_get): New static functions.
(cat_str, vscat): Considerably shorten by using the above
functions.
|
|
|
|
|
|
|
|
|
|
|
|
|
| |
Fossies administrator Jens alerted me to some typos.
* txr.1: Fix two instances of alphanumeric being hyphenated,
and one case of invocable being rendered as invokable.
* linenoise/linenoise.c (struct lino_state): Misspelled
"buffer" in a comment. One other comment typos in this file is
from the original code, so it stays: who needs yet another
merge conflict? Not touching the original typo in example.c,
either.
|
|
|
|
|
|
|
|
|
|
| |
* RELNOTES: Updated.
* configure, txr.1: Bumped version and date.
* share/txr/stdlib/ver.tl: Likewise.
* txr.vim, tl.vim: Regenerated.
|
|
|
|
|
|
|
|
|
|
|
|
| |
* eval.c (rt_assert_fail, me_assert): New static functions.
(eval_init): assert macro and sys:rt-assert-fail function
registered.
* lib.c (func_n4ov): New function.
* lib.h (func_n4ov): Declared.
* txr.1: Documented.
|
|
|
|
|
|
|
|
|
|
|
|
| |
* eval.c (eval_init): If opt_compat is 237 or less, make sort
and shuffle destructive.
* share/txr/stdlib/getopts.tl (opthelp): Revert previous
change, restoring use of copy-list and use nsort instead of
sort, so the function is not affected by the 237 compatibility
being turned on.
* txr.1: Add compatibility notes.
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| |
I'm fixing a historic mistake copied from ANSI Lisp,
which trips up language newcomers and sometimes even
experienced users.
The function innocently named sort will now return newly
allocated structure. The function previously called sort will
be available as nsort (non-consing/allocating sort).
The shuffle function also becomes pure, and is accompanied by
nshuffle.
* eval (me_op): Continue to use destructive sort in this
legacy code that is only triggered in very old compat mode.
(eval_init): Registered nsort and nshuffle.
* lib.c (nsort, nshuffle): New functions introduced, closely
based on sort and shuffle.
(sort, shuffle): Rewritten to avoid destructive behavior: work
by copying the input and calling destructive counterparts.
(sort_group): Continue to use destructive sort, which is safe;
the structure is locally allocated. The sort_group function
has pure semantics.
(grade): Likewise.
* lib.h (nsort, nshuffle): Declared.
* share/txr/stdlib/getopts.tl (opthelp): Replace an instance
of the (sort (copy-list ...)) pattern with just (sort ...).
* tags.tl (toplevel): Continue to use destructive sort to sort
tags before writing the tag file; the lifetime of the tags
list ends when the file is written.
* tests/010/seq.txr: Switch some sort calls to nsort to keep
test case working.
* txr.1: Documented.
|
|
|
|
|
|
|
|
| |
* lib.c (sort, shuffle): Switch to seq_info. For consistency
with sort, shuffle now handles hashes in the same peculiar
way.
* txr.1: Document hash behavior for sort and shuffle.
|
|
|
|
|
|
|
| |
* sysif.c (isatty_wrap): New function.
(sysif_init): Register isatty intrinsic.
* txr.1: Documented.
|
|
|
|
|
| |
* txr.1: Remove manually added angle brackets on <form>.
Fix inappropriate use of << and >>.
|
|
|
|
|
| |
* configure: move the section of the script which
produces ./reconfigure after the help processing.
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| |
I've noticed that the January 9, 2020 commit "gc: obtain stack top using
alloca" triggers spurious retention when compiling with HAVE_VALGRIND.
The finalization test case tests/012/fini.tl breaks because the expected
finalizers are not called. Changing the (sys:gc) call to two calls to
(sys:gc 1) makes it pass.
The culprit seems to be the inlining of the complex function sweep
into gc. It has local variables for which spaces has to be reserved,
which are not used until after mark() is called; likely the values
in those spaces are picked up by the stack scan.
Let's make sure that functions called out of gc() are not inlined.
* gc.c (mark, sweep, prepare_finals, call_finals): Mark NOTINLINE.
|