| Commit message (Collapse) | Author | Age | Files | Lines |
|
|
|
|
|
|
|
|
|
|
|
|
|
| |
* lisplib.c (save_exe_instantiate, save_exe_set_entries): New
static functions.
(lisplib_init): Register auto-load of save-exe module, keyed
to save-exe symbol.
* share/txr/stdlib/save-exe.tl: New file.
* txr.1: Removing txr-embedded-arg.txr documentation and
documenting save-exe in its place.
* txr-embedded-arg.txr: File removed.
|
|
|
|
|
|
|
|
|
|
|
|
|
| |
* regex.c (scan_until_common): New static function, made from
read_until_match.
(read_until_match): Now just wrapper for scan_until_common.
(scan_until_match, count_until_match): New functions.
(regex_init): Registered new intrinsics scan-until-match and
count-until-match.
* regex.h (read_until_match, scan_until_match): Declared.
* txr.1: Documented.
|
|
|
|
|
|
|
|
|
| |
* stream.c (fill_buf_adjust): New function.
(stream_init): Register fill-buf-adjust intrinsic.
* stream.h (fill_buf_adjust): Declared.
* txr.1: Documented.
|
|
|
|
|
|
|
|
|
| |
* buf.c (buf_alloc_size): New function.
(buf_init): buf-alloc-size intrinsic registered.
* buf.h (buf_alloc_size): Declared.
* txr.1: Documented.
|
|
|
|
| |
* buf.c (length_buf): Replace incorrect name.
|
|
|
|
|
|
|
|
|
| |
* txr.c (sysroot_init): prog_dir is missing a trailing
slash, and this breaks the fallback case when we're running a
renamed txr executable in the build directory. The presence of
the trailing slash had also been documented for the txr-path
variable, which is now obsolescent and undocumented.
That is hereby fixed.
|
|
|
|
|
|
|
|
|
| |
* txr.c (sysroot_init): Make prog_path available via the
txr-exe-path variable. The txr-path variable becomes
obsolescent.
* txr.1: Documented txr-exe-path; removed documentation
for txr-path.
|
|
|
|
|
|
| |
* linenoise.c (edit_in_editor): If we can't read the file,
then preserve the file, and replace the command line buffer
with an error message in which the name of that file appears.
|
|
|
|
|
|
|
|
|
| |
When an external file is edited, and is longer than the
listener's buffer allows, the buffer overflows, trashing the
other fields in the linenoise structure, and memory beyond.
* parser.c (lino_gets): Decrement nchar in the loop.
Also, eliminate useless return case.
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| |
This relates to the optimized insert at the end of the line.
The following bug manifests itself. When the cursor is not at
the bottom of the screen (e.g. fresh terminal after a clear
screen), if blank lines are added to the buffer and then
backspace is hit, the cursor strangely jumps down by multiple
lines prior to the refresh.
In a Windows CMD.EXE window, this shows up even at the bottom
of the screen, because the CMD.EXE console responds to a
downward movement (ESC[<n>B) beyond the bottom row by
scrolling the screen, rather than clipping the movement.
* linenoise/linenoise.c (refresh_multiline): When doing the
elided refresh (l->need_refresh == 2), we must update not only
l->maxrows but also l->oldrow. Otherwise when we do
the real update, it will think that the cursor is on the first
line, and try to move down to the last line.
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| |
* struct.c (uptopow2_0, uptopow2_1, uptopow2_2, uptopow2_3,
uptopow2_4, uptopow2_5, uptopow2): New macros.
(struct struct_id_recycle): Declaration removed.
(struct_id_counter, struct_id_stack): Static variables
removed.
(get_struct_id, recycle_struct_id): Static functions removed.
(struct_type_finalize): No need to recycle struct ID;
don't call removed recycle_struct_id function.
(make_struct_type): Don't call removed get_struct_id to
allocate ID. Rather, cast the struct_type handle pointer to
unsigned integer, and divide by the next smallest power of
two.
|
|
|
|
|
|
|
|
| |
* struct.c (struct struct_inst): When the dirty flag was
added, the id field was not decreased by one bit to make
space, so the desired packing is not being achieved any
more. Let's just use TAG_SHIFT to reserve the maximum bits
that will still let us fit a fixnum into id.
|
|
|
|
|
|
|
|
|
|
|
|
|
| |
* struct.c (nelem): New macro.
(struct struct_id_recycle): New struct type.
(struct_id_counter): Initialize to 1 instead of zero.
(get_struct_id, recycle_struct_id): New static functions.
(struct_type_finalize): From each slot symbol, remove the
struct type's ID from it slot cache, and finally recycle the
struct type ID.
(make_struct_type): Use get_struct_id to obtain an ID for the
new struct type, rather than directly incrementing the global
counter.
|
|
|
|
|
|
|
|
|
|
| |
* RELNOTES: Updated.
* configure, txr.1: Bumped version and date.
* share/txr/stdlib/ver.tl: Likewise.
* txr.vim, tl.vim: Regenerated.
|
|
|
|
|
|
|
|
|
| |
When Enter is input in multi-line mode, a ^M appears instead
of advancing to the next line. When the display is refreshed,
the ^M's are properly treated as line breaks.
* linenoise.c (edit_insert): Let's restructure the conditional
ladder here into a switch and handle ENTER by issuing CR-LF.
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| |
The associative lists that make up the chains of a hash table
are guaranteed to be made of conses. We can use unsafe
versions of car, cdr, rplaca and rplacd to speed up hash
operations.
* eval.c (op_dohash): Use unsafe operations on hash cell.
* filter.c (trie_compress, regex_from_trie): Likewise.
* hash.c (hash_equal_op, hash_print_op, hash_mark, hash_grow,
hash_assoc, hash_assql, copy_hash_chain, gethash, inhash,
gethash_n, sethash, remhash, hash_next, maphash,
do_weak_tables, group_by, group_reduce, hash_keys_lazy,
hash_keys, hash_values_lazy, hash_values, hash_pairs_lazy,
hash_pairs, hash_alist_lazy, hash_uni, hash_diff,
hash_symdiff, hash_isec, hash_subset, hash_update,
hash_update_1, hash_revget): Likewise.
* lib.c (us_rplaca, us_rplacd): New functions.
(package_local_symbols, package_foreign_symbols, where,
populate_obj_hash, obj_hash_merge): Use unsafe operations on
hash cell
* lib.h (us_rplaca, us_rplacd): Declared.
* parser.c (circ_backpatch, get_visible_syms): Use unsafe
operations on hash cell.
* struct.c (method_name, get_slot_syms): Likewise.
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| |
* eval.c (env_fbind, env_vbind, reg_symacro): Use gethash_l
instead of gethash_c to eliminate repeated cdr operations
on the same cell.
* hash.c (sethash): Since new_p is never used, eliminated it
and use nulloc.
(group_reduce): Use gethash_l instead of gethash_c.
* lib.c (obj_init): Replace rplacd(gethash_c(...)) pattern
whose return value is not used with with sethash. We lose some
diagnosability here since sethash doesn't take a "self"
argument.
(obj_print_impl, obj_hash_merge): Use gethash_l instead of
gethash_c.
* parser.y (ensure_parser, parser_circ_def, get_visible_syms,
rlset): Use gethash_l instead of gethash_c.
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| |
Uses of gethash_f can be replaced with gethash_e, which
returns the hash cell directly rather than through a loc
argument. Code that needs the value can call cdr itself.
* hash.c (inhash, hash_isec, hash_update_1): Replace gethash_f
with gethash_e.
(gethash_f): Function removed.
* hash.h (gethash_f): Declaration removed.
* lib.c (use_sym, unuse_sym, find_symbol, unintern,
intern_fallback, in, sel, populate_obj_hash): Replace
gethash_f with gethash_e.
|
|
|
|
|
|
|
|
|
|
|
|
| |
* eval.c (eval_init): Register symdiff intrinsic.
* lib.c (symdiff): New function.
* lib.h (us_car_p, us_cdr_p): New inline functions.
(symdiff): Declared.
* txr.1: Documented, also fixing issues not related to
symdiff doc.
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| |
Also, these functions now support hashes.
* eval.c (eval_init): Register only the deprecated set-diff to
the set_diff function. The diff intrinsic is now going to the
new function named diff.
* lib.c (diff): New function.
(isec, uni): Rewritten to use seq_iter_t.
* lib.h (diff): Declared.
* txr.1: Documentation updated.
|
|
|
|
|
| |
* lib.c (num): Use num_fast instead of an expression that is
identical to the body of that inline function.
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| |
This has been needed for a while. While we have seq_info for
classifying sequences to nicely dispatch code into various
cases, those cases duplicate code. The code base could benefit
from generic traversal.
* lib.c (seq_iter_get_nil, seq_iter_get_list,
seq_iter_get_vec, set_iter_get_hash): New static functions.
(seq_iter_rewind, seq_iter_init): New functions.
* lib.h (struct seq_iter, seq_iter_t): New struct type and its
typedef name.
(seq_iter_init, seq_iter_rewind): Declared.
(seq_get): New inline function.
|
|
|
|
|
|
|
|
|
| |
* hash.c (hash_from_alist_v): New function.
(hash_init): Register hash-from-alist intrinsic.
* hash.h (hash_from_alist_v): Declared.
* txr.1: Documented.
|
|
|
|
|
|
|
|
|
| |
* hash.c (hash_symdiff): New function.
(hash_init): hash-symdiff intrinsic registered.
* hash.h (hash_symdiff): Declared.
* txr.1: Documented.
|
|
|
|
|
|
|
|
| |
* hash.c (hash_uni): The join function must only be called for
the values of keys that exist in both hashes. The broken logic
here unconditionally calls the join function for all keys in
the left hash (using nil as the right join value when the key
doesn't exist in the right hash).
|
|
|
|
|
|
| |
* txr.1: In Notes under load-time, the function is once
referred to as load-value; also the phrase load-time value is
used that can just be load-time.
|
|
|
|
|
|
|
|
|
|
| |
* RELNOTES: Updated.
* configure, txr.1: Bumped version and date.
* share/txr/stdlib/ver.tl: Likewise.
* txr.vim, tl.vim: Regenerated.
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| |
After the defvar bugfix in the previous commit, the only
differences between .tlo and .tlo2 files are the names of
a few gensyms here and there. In other words, they are
identical code; therefore, there is no point in compiling
them.
* Makefile (STDLIB_TLOS2): Variable removed.
(%.tlo2): Implicit rule removed.
(stage1 stage2): Phony targets removed.
(all): Directly depends on $(STDLIB_TLOS) without stage1
intermediary.
(clean-tlo): Don't remove $(STDLIB_TLOS2).
|
|
|
|
|
|
|
|
|
|
|
| |
The defvar/defparm macro expander marks symbols special only
at macro-expansion time, without actually generating code in
the macro expansion to do this. This means that the compiled
versions of defvar and defparm forms will code will neglect to
create a dynamically scoped variable!
* eval.c (me_def_variable): Add code to the output to mark the
symbol special, for defvar or defparm.
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| |
What happens if a FFI closure intercepts an exception, returns
to the foreign code, but that caller does not return to Lisp
where the exception will continue? Suppose the caller invokes
another closure. In that situation, the lingering value of
the s_exit_point variable causes problems for FFI calls.
An example of this is callbacks from an event dispatching
framework such as a GUI. When these callback closures return,
control returns to the event loop, which itself doesn't
immediately return to Lisp code. Rather, it processes more
events and invokes more callbacks.
* ffi.c (ffi_closure_dispatch_safe): One thing we can do
is clear s_exit_point whenever we dispatch a closure.
|
|
|
|
|
|
|
| |
* ffi.c (ffi_closure_dispatch_safe): When initially clearing
a return value that has release semantics, use the padded
size, not the nominal size. Let's get calculate this once and
put it in a local.
|
|
|
|
| |
* ffi.c (pad_retval): If the size is zero, don't pad it.
|
|
|
|
|
|
| |
* ffi.c (ffi_make_closure): Fix wrong argument defaulting on
safe_p_in parameter, which leaves it always true, preventing
unsafely dispatched closures from being created.
|
|
|
|
| |
* txr.1: Run-on period on identifier; extra words.
|
|
|
|
|
| |
* lisplib.c (ffi_set_entries): Add missinig autoload entry for
deffi-cb-unsafe.
|
|
|
|
|
|
|
| |
* ffi.c (make_zstruct): Don't convert zeros to a Lisp type and
don't try to set the slot, if the slot name is nil. That's a
padding slot which doesn't exist in the Lisp type; the slotset
will blow up on it.
|
|
|
|
| |
* ffi.c (make_zstruct): space around assignment operator.
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| |
A null byte in regex and string literals is being processed as
a #\nul instead of correctly turning into #\pnul. Bad UTF-8 is
not being rejected.
* parser.l (REGCHAR, LITCHAR): Use utf8_from_buffer to
properly convert yytext using its true length, rather than
utf8_from which assumes a null-terminated string. Thus
null bytes (including the case of a yytext being single NUL)
are handled properly. Check that the result is exactly one
character (null-terminated buffer, two characters wide).
* utf8.c (utf8_from): Unused function removed.
* utf8.h (utf8_from): Declaration removed.
|
|
|
|
|
|
|
| |
* linenoise.c (edit_insert): In the optimized insertion case
at the end of the buffer in multi-line mode, we must render
control characters in the same manner as in the slow refresh
case: namely, with the caret notatiion: ^@, ^A, ...
|
|
|
|
|
|
|
| |
* linenoise/linenoise.c (sync_data_to_buf): The null character
appears from the stream as 0xDC00. We must test for that and
render it as ^@, counting a a width of two, rather than
sending it to the terminal, counting as width of 1.
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| |
The following problem happens: when charaters are inserted
past the end of the line such that it wraps, hitting backspace
or any cursor movement causes a spurious scroll.
This was caused on Nov 1 2018 by bf85503b (linenoise: avoid
refresh for new text in multi-line mode).
The reason is that the maxrows variable isn't updated when
we trivially add a character without repainting.
* linenoise/linenoise.c (lino state): Document special value
for need_refresh: when it is 2, the refresh doesn't perform a
any output, but recalculates maxrows.
(refreh_multiline): If need_refresh is 2, bail after
updating maxrows.
(edit_insert): When trivially adding a character at the
end and just outputting it, if in multi-line mode, set
need_refresh to 2.
|
|
|
|
|
|
|
|
|
|
|
|
|
| |
* eval.c (eval_init): Adjust registrations of sum and prod to
be binary functions with an optional argument.
* lib.c (nary_op_keyfun, sumv, prodv): New static functions.
(sum, prod): Implement optional keyfun argument via sumv and
prodv helpers.
* lib.h (sum, prod): Declarations updated.
* txr.1: Documentation updated.
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| |
This addresses the following issue. Suppose the query
is something like this:
@abc
@(nonexistent)
and there is one line of data. In this case, there is no error
about a nonexistent function. The function lookup fails in
vertical mode, so horizontal mode fallback takes place. But
that just concludes that there is no data, and reports a
failed match. But the programmer might have intended to invoke
some function or directive that doesn't need to match
anything, but rather has an important effect.
In this patch we fix that. As part of the change, we disallow
functions from shadowing horizontal directives.
* match.c (match_files): Do not look up sys:var and sys:text
through the directive table, but check for these. If the
directive is not found in the vertical table, check the
horizontal table; if found there, don't try it as a function
but go to horizontal processing. Then if the function lookup
fails, we diagnose a failed lookup; don't fall through to
horizontal processing.
|
|
|
|
|
|
| |
* match.c (match_files): Change pointless two-step
initialization of a variable by assignment into straight
initialization.
|
|
|
|
|
|
|
|
|
|
|
|
|
| |
* lisplib.c (compiler_set_entries): Register
dump-compiled-objects for auto-loading.
* share/txr/stdlib/compiler.tl (usr:dmp-to-tlo): New
function.
(compile-file): Code to be shared with dump-compiled-objects
moved into dump-to-tlo function.
(usr:dump-compiled-objects): New function.
* txr.1: Documented.
|
|
|
|
| |
* txr.1: New section on Treatment of literals.
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| |
Let's squash duplicate strings and bignum integers in the
virtual machine data tables. We can safely do it for these
objects. For lists and vectors, things are tricky because
these aggregates can contain circularity; so we leave those
alone for now.
Text processing code can generate a lot of duplicate strings.
For instance `@a @b @c` generates three copies of the " " literal.
* share/txr/stdlib/compiler.tl (*dedup*): New special
variable. This is our de-dupe table, but it is globally
nil, so that we don't retain cruft between compile jobs.
(dedup): New function.
(get-dreg): Map the incoming object through dedup.
(dreg-key): New function. This converts a literal object to key for
the dreg hash. Objects that can be de-duped represent themselves.
Objects that cannot be de-duped are keyed by a gensym.
(compiler get-dreg): Use dreg-key to reduce the incoming object to a
key, and work with that, with the effect that strings, characters and
numbers in the data table get de-duped: multiple occurrences of a
character, string or number in the code get the same dreg.
(usr:compile-toplevel, usr:with-compilation-unit): Establish a
dedup hash for the dynamically enclosed compile job. If one is
already established by the surroundign dynamic environment,
then use that one, otherwise create a new hash.
|
|
|
|
|
|
|
|
|
|
|
| |
* eval.c (me_case): Replace a code generation pattern of the
(if (and x y) z) with the equivalent (and x y z). The
motivation behind this is that it effectively coaxes a
jump-threading optimization out of our simplistic compiler.
The failure cases out of a single *and* all jump past the
entire code block, whereas with the cascaded if + and we get
a double test of the same failed value threading through two
branches.
|
|
|
|
|
|
|
|
| |
* RELNOTES: Updated.
* configure, txr.1: Bumped version and date.
* share/txr/stdlib/ver.tl: Likewise.
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| |
We would like @(next (open-directory "nonexistent") :nothrow)
to act as a failed match, rather than for the exception to
propagate (and likely terminate TXR). The problem is that
only file sources are treated with :nothrow.
* match.c (tleval_nothrow, tleval_144_nothrow): New static
functions.
(v_next_impl): Use tleval_nothrow for all Lisp evaluation. If
nothrow is requested and Lisp evaluation returns the colon
symbol (which tleval_nothrow produces in the case of an
exception), then treat the situation as a failed match.
|