| Commit message (Collapse) | Author | Age | Files | Lines |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| |
* LICENSE, LICENSE-CYG, METALICENSE, Makefile, alloca.h,
args.c, args.h, arith.c, arith.h, autoload.c, autoload.h,
buf.c, buf.h, cadr.c, cadr.h, chksum.c, chksum.h,
chksums/crc32.c, chksums/crc32.h, combi.c, combi.h, configure,
debug.c, debug.h, eval.c, eval.h, ffi.c, ffi.h, filter.c,
filter.h, ftw.c, ftw.h, gc.c, gc.h, glob.c, glob.h, gzio.c,
gzio.h, hash.c, hash.h, itypes.c, itypes.h, jmp.S,
lex.yy.c.shipped, lib.c, lib.h, linenoise/linenoise.c,
linenoise/linenoise.h, match.c, match.h, parser.c, parser.h,
parser.l, parser.y, protsym.c, psquare.h, rand.c, rand.h,
regex.c, regex.h, signal.c, signal.h, socket.c, socket.h,
stdlib/arith-each.tl, stdlib/asm.tl, stdlib/awk.tl,
stdlib/build.tl, stdlib/cadr.tl, stdlib/compiler.tl,
stdlib/constfun.tl, stdlib/conv.tl, stdlib/copy-file.tl,
stdlib/debugger.tl, stdlib/defset.tl, stdlib/doloop.tl,
stdlib/each-prod.tl, stdlib/error.tl, stdlib/except.tl,
stdlib/ffi.tl, stdlib/getopts.tl, stdlib/getput.tl,
stdlib/hash.tl, stdlib/ifa.tl, stdlib/keyparams.tl,
stdlib/match.tl, stdlib/op.tl, stdlib/optimize.tl,
stdlib/package.tl, stdlib/param.tl, stdlib/path-test.tl,
stdlib/pic.tl, stdlib/place.tl, stdlib/pmac.tl,
stdlib/quips.tl, stdlib/save-exe.tl, stdlib/socket.tl,
stdlib/stream-wrap.tl, stdlib/struct.tl, stdlib/tagbody.tl,
stdlib/termios.tl, stdlib/trace.tl, stdlib/txr-case.tl,
stdlib/type.tl, stdlib/vm-param.tl, stdlib/with-resources.tl,
stdlib/with-stream.tl, stdlib/yield.tl, stream.c, stream.h,
struct.c, struct.h, strudel.c, strudel.h, sysif.c, sysif.h,
syslog.c, syslog.h, termios.c, termios.h, time.c, time.h,
tree.c, tree.h, txr.1, txr.c, txr.h, unwind.c, unwind.h,
utf8.c, utf8.h, vm.c, vm.h, vmop.h, win/cleansvg.txr,
y.tab.c.shipped: Copyright year bumped to 2023.
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| |
I realized this issue while implementing Ctrl-Z for the pw
(Pipe Watch) program. Sending the SIGTSTP signal just to the
calling process is not enough. Only that process gets
suspended, which results in a weird behavior. It can be
tested like this, for instance:
txr | tee file
Ctrl-Z must be issued twice: once to sort of suspend txr, and
then again to send it to the tee program. Then the job
actually suspends and the shell prompt appears. With this fix,
the above situation requires only one Ctrl-Z, as expected.
* linenoise/linenoise.c (history_search, show_help, edit):
Don't raise(SIGTSTP), but kill(0, SIGTSTP) to send the suspend
signal to all processes in the process group.
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| |
The implicit conversions were discovered with Clang's UBSan (with
the -fsanitizer=implicit-conversion option).
* gc.c (sweep_one): Convert only the inverted REACHABLE, since
block->t.type is already of the right type.
* hash.c (eql_hash, eq_hash, hash_iter_init, us_hash_iter_init):
Explicitly convert to ucnum.
* linenoise/linenoise.c (enable_raw_mode): Explicitly convert the
inverted flag sets to tcflag_t.
* mpi/mpi.c (mp_set_uintptr): Explicitly convert to uint_ptr_t.
* regex.c (char_set_add): Explicitly convert to bitcell_t.
* struct.c (struct_inst_hash): Correct type of hash from cnum to
ucnum.
|
|
|
|
|
|
|
| |
* linenoise/linenoise.c (linenoise): In plain mode, like in
full editing mode, when EOF is detected, print a newline
so that when TXR exit to an interactive shell, the shell's
prompt starts on a new line.
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| |
If newlines are inserted into the input, they don't behave
well. The is_balanced_line callback doesn't recognize them as
line terminators for the purposes of delimiting ; comments.
Also, they make a mess in the ~/.txr_history file.
Plus, users of shells like Bash are used to Ctrl-V Ctrl-J
inserting a line break; some users have that in their muscle
memory. So let's just do that as a special case: Ctrl-V Ctrl-J
behaves like Ctrl-V Ctrl-M.
* linenoise/linenoise.c (history_search, edit): Remap a
verbatim Ctrl-J to a carriage return.
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| |
The is_balanced_line function assumes that comments are
terminated by a carriage return, whic his the multi-line
convention used by the interactive repl. The plain-mode
listener, though, only replaces newlines by carriage returns
when returning the complete multi-line input. When invoking
the is_balanced_line callback, the newlines are still there,
and so comments are not handled properly.
Reported by Paul. A. Patience.
* linenoise/linenoise.c (linenoise): In plain mode, replace
the trailing newline with a carriage return after every
physical line input, before that line is passed to the
lino->enter_callback (i.e. is_balanced_line). The code to
replace newlines with carriage returns at the end is
consequently no longer required.
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| |
*LICENSE, LICENSE-CYG, METALICENSE, Makefile, alloca.h,
args.c, args.h, arith.c, arith.h, buf.c, buf.h, cadr.c,
cadr.h, chksum.c, chksum.h, chksums/crc32.c, chksums/crc32.h,
combi.c, combi.h, configure, debug.c, debug.h, eval.c, eval.h,
ffi.c, ffi.h, filter.c, filter.h, ftw.c, ftw.h, gc.c, gc.h,
glob.c, glob.h, hash.c, hash.h, itypes.c, itypes.h, jmp.S,
lex.yy.c.shipped, lib.c, lib.h, linenoise/linenoise.c,
linenoise/linenoise.h, lisplib.c, lisplib.h, match.c, match.h,
parser.c, parser.h, parser.l, parser.y, protsym.c, psquare.h,
rand.c, rand.h, regex.c, regex.h, signal.c, signal.h,
socket.c, socket.h, stdlib/arith-each.tl, stdlib/asm.tl,
stdlib/awk.tl, stdlib/build.tl, stdlib/cadr.tl,
stdlib/compiler.tl, stdlib/constfun.tl, stdlib/conv.tl,
stdlib/copy-file.tl, stdlib/debugger.tl, stdlib/defset.tl,
stdlib/doloop.tl, stdlib/each-prod.tl, stdlib/error.tl,
stdlib/except.tl, stdlib/ffi.tl, stdlib/getopts.tl,
stdlib/getput.tl, stdlib/hash.tl, stdlib/ifa.tl,
stdlib/keyparams.tl, stdlib/match.tl, stdlib/op.tl,
stdlib/optimize.tl, stdlib/package.tl, stdlib/param.tl,
stdlib/path-test.tl, stdlib/pic.tl, stdlib/place.tl,
stdlib/pmac.tl, stdlib/quips.tl, stdlib/save-exe.tl,
stdlib/socket.tl, stdlib/stream-wrap.tl, stdlib/struct.tl,
stdlib/tagbody.tl, stdlib/termios.tl, stdlib/trace.tl,
stdlib/txr-case.tl, stdlib/type.tl, stdlib/vm-param.tl,
stdlib/with-resources.tl, stdlib/with-stream.tl,
stdlib/yield.tl, stream.c, stream.h, struct.c, struct.h,
strudel.c, strudel.h, sysif.c, sysif.h, syslog.c, syslog.h,
termios.c, termios.h, time.c, time.h, tree.c, tree.h, txr.1,
txr.c, txr.h, unwind.c, unwind.h, utf8.c, utf8.h, vm.c, vm.h,
vmop.h, win/cleansvg.txr, y.tab.c.shipped: Copyright year
bumped to 2022.
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| |
It is against TXR coding conventions to use the C cast
notation. The usage creeps into the code. To find instances of
this, we must compile using GNU g++, and add -Wold-style-cast
via EXTRA_FLAGS.
* eval.c (prof_call): Use macro instead of cast.
* ffi.c (pad_retval, ffi_varray_alloc, make_ffi_type_union,
carray_dup, carray_replace, uint_carray, int_carray,
put_carray, fill_carray): Likewise.
* itypes.c (c_i64, c_u64): Likewise.
* lib.c (cyr, chk_xalloc, spilt_str_keep, vector,
cobj_register): Likewise.
* linenoise.c (record_undo): Likewise. Also, drop one
superfluous cast: wstrdup_fn returns wchar_t *.
(flash, edit_insert, edit_insert_str): Use macro instead of cast.
* mpi/mpi.c (s_mp_ispow2d): Likewise.
* parser.c (lino_getch): Likewise.
* rand.c (make_random_state, random_buf): Likewise.
* stream.c (generic_get_line, do_parse_mode): Likewise.
* struct.c (get_duplicate_supers, call_initfun_chain,
call_postinitfun_chain): Likewise.
* sysif.c (c_time): Likewise.
* tree.c (tr_insert): Likewise.
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| |
The use of -ansi doesn't by itself diagnose instances of some
constructs we don't want in the project, like mixed
declarations and statements.
* configure (diag_flags): Add -Werror=declaration-after-statement.
This is C only, so filter it out for C++.
Also add -Werror=vla.
* HACKING: Update inaccurate statements about what dialect we
are using. TXR isn't pure C90: some GCC extensions are used.
We even use long long if the configure script detects it as
working, and some C99 library features.
* buf.c (replace_buf, buf_list): Fix by reordering.
* eval.c (op_dohash, op_load_time_lit): Fix by reordering.
* ffi.c (ffi_simple_release): Fix by reordering.
(align_sw_get): Fix empty macro to expand to dummy declaration
so a semicolon after it isn't interpreted as a statement.
On platforms with alignment, remove a semicolon from the macro
so that it requires one.
(ffi_i8_put, ffi_u8_put): Fix by reordering.
* gc.c (gc_init): Fix with extra braces.
* hash.c (hash_init): Fix by reordering.
* lib.c (list_collect_revappend, sub_iter, replace_str,
replace_vec, mapcar_listout, mappend, mapdo, window_map_list,
subst): Fix by reordering.
(gensym, find, rfind, pos, rpos, in, search_common): Fix by
renaming optional argument and using declaration instead of
assignment.
* linenoise/linenoise.c (edit_in_editor): Fix by reordering.
* parser.c (is_balanced_line): Fix by reordering.
* regex.c (nfa_count_one, print_rec): Fix by reordering.
* signal.c (sig_mask): Fix by reordering.
* stream.c (get_string): Fix by renaming optional argument and
using declaration instead of assignment.
* struct.c (lookup_static_slot_desc): Fix by turning mutated
variable into block local.
(umethod_args_fun): Fix by reordering.
(get_special_slot): Fix by new scope via braces.
* sysif.c (usleep_wrap): Fix by new scope via braces.
(setrlimit_wrap): Fix by new scope via braces.
* time.c (time_string_meth, time_parse_meth): Fix by reordering.
* tree.c (tr_do_delete_spec): Fix by new scope via braces.
* unwind.h (uw_block_beg): New macro which doesn't define
RESULTVAR but expects it to refers to an existing one.
(uw_block_begin): Replace do while (0) with enum trick
so that we have a declaration that requires a semicolon,
rather than a statement, allowing declarations to follow.
(uw_match_env_begin): Now opens a scope and features the
same enum trick as in uw_block_begin.
This fixes a declaration-follows-statement issue in
the v_output function in match.c.
(uw_match_env_end): Closes scope opened by uw_match_env_begin.
* unwind.c (revive_cont): Fix by introducing variable, and
using new uw_block_beg macro.
* vm.c (vm_execute_closure): Fix using combination of local
variable and reordering.
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| |
This patch unbundles the building of the full-featured REPL
from HAVE_TERMIOS. We make it subject to its own configuration
option CONFIG_FULL_REPL, which is 1 by default. This way, the
downstream users or package maintainers can build TXR without
the full-featured REPL even if HAVE_TERMIOS is 1, and the
other termios material is built-in.
* configure (full_repl): New variable.
(help): Include full-repl in the help text.
In the termios test, if we don't detect termios, then
negate the full_repl variable.
In the final config variable generation section, generate
the CONFIG_FULL_REPL 1 define in config.h, if full_repl
is true, ensuring it is subject to HAVE_TERMIOS, too.
* linenoise/linenoise.c: Replace HAVE_TERMIOS with
CONFIG_FULL_REPL.
* linenoise/linenoise.h: Likewise.
* parser.c: Likewise.
* txr.c: Likewise and ...
(if_termios): Macro renamed to if_full_repl.
(if_full_repl): New macro.
(opt_noninteractive): Use if_full_repl macro for
initializing.
(banner): Use if_ful_repl macro instead of if_termios.
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| |
* linenoise/linenoise.c (struct lino_state): these members are
now absent in non-termios build: atom_callback, ca_ctx,
rawmode, mlmode, clip, result, buf, plen, pos, sel, end, len,
dlen, dpos, dsel, dend, cols, oldrow, maxrows, history_index,
need_resize, need_refresh, selmode, selinclusive,
noninteractive and undo_stack.
(lino_set_multiline, lino_get_multiline,
lino_set_selinclusive, lino_get_selinculsive,
lino_set_noninteractive, lino_get_noninteractive,
lino_set_atom_cb): Functions now only defined in termios
build.
(linenoise): Adjustments for missing members in non-termios
mode.
(lino_make): We no longer need to set noninteractive to 1 in
non-termios build. The flag no longer exists.
(lino_copy, lino_cleanup): Avoid referencing nonexistent
members in non-termios build.
(lino_set_result): Another termios-only function.
* linenoise/linenoise.h (lino_set_result, lino_clear_screen,
lino_set_multiline, lino_get_multiline, lino_set_selinclusive,
lino_get_selinculsive, lino_set_noninteractive,
lino_get_noninteractive, lino_atom_cb_t, lino_set_atom_cb):
Declare only in termios build.
* parser.c (repl): Add #if HAVE_TERMIOS to avoid using
linenoise features not available in non-termios build, and to
remove any variables that thus become unused.
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| |
This commit fixes the conceptual issue that when there is no termios
support (HAVE_TERMIOS is absent/false), then there is no
listener at all, even though the listener supports plain mode
that doesn't require termios.
* Makefile (linenoise/linenoise.o): Link in unconditionally,
not subject to have_termios.
* linenoise.c: Include termios-related header only if
HAVE_TERMIOS.
(struct lino_state): Define the completion_callback and
orig_termios members only if HAVE_TERMIOS.
(wcnsprintf, atexit_handler, enable_raw_mode,
disable_raw_mode, get_cursor_position, get_columns,
lino_clear_screen, refresh_line, handle_resize, generate_beep,
delete_undo, free_undo_stack, record_undo, record_triv_undo,
remove_noop_undo, restore_undo, undo_subst_hist_idx,
undo_renumber_hist_idx, free_completions, sync_data_to_buf,
compare_completions, complete_line, lino_set_completion_cb,
lino_add_completion, next_hist_match, copy_display_params,
history_search, ab_init, ab_append, ab_free, sync_data_to_buf,
copy_display_params, refresh_singleline, col_offset_in_str,
refresh_multiline, refresh_line, move_cursor_multiline,
move_cursor, scan_match_rev, scan_rev, scan_match_fwd,
scan_fwd, find_nearest_paren, usec_delay, paren_jump, flash,
yank, yank_by_ptr, update_sel, clear_sel, yank_sel,
delete_sel, edit_insert, edit_insert_str, edit_move_left,
edit_move_right, edit_move_home, edit_move_sol, edit_move_end,
edit_move_eol, edit_move_matching_paren, edit_history_next,
edit_delete, edit_backspace, edit_delete_prev_all,
edit_delete_to_eol, edit_delete_prev_word, edit_delete_line,
tr, char, edit_in_editor, edit, sigwinch_handler): Functions
defined only if HAVE_TERMIOS.
(struct abuf, struct row_values): Struct types defined only if
HAVE_TERMIOS.
(screen_rows): Defined only if HAVE_TERMIOS.
(linenoise): Support only noninteractive read loop unless
HAVE_TERMIOS.
(lino_make): If HAVE_TERMIOS is false, then set the
noninteractive flag, so the linenoise function enters
the plain-mode loop.
(lino_cleanup, lino_hist_add): Add #ifdefs to avoid calling
nonexistent functions when HAVE_TERMIOS is false.
* linenoise/linenoise.h (struct lino_completions,
lino_compl_cb_t): Define these types only if HAVE_TERMIOS.
(lino_set_completion_cb, lino_add_completion): Declare only if
HAVE_TERMIOS.
* parser.c: Include linenoise/linenoise.h unconditionally.
(report_security_problem, load_rcfile, repl_intr,
read_eval_ret_last, get_home_path, repl_warning,
is_balanced_line, hist_save): Now define regardless of
HAVE_TERMIOS.
(repl): Define regardless of HAVE_TERMIOS, but don't set
completion or atom callback if HAVE_TERMIOS is false.
* parser.h (repl): Declare unconditionally, not subject to
HAVE_TERMIOS.
* txr.c (if_termios): New macro.
(opt_noninteractive): Initialize to 1 if HAVE_TERMIOS is false.
(help): Text about entering into listener mode is always
present now, even in a build withou HAVE_TERMIOS.
(banner): Function is always defined. If we don't
HAVE_TERMIOS, then the unused string literal that will
never be printed is replaced by nil.
(hint): Function removed.
(txr_main): Blocks conditional on HAVE_TERMIOS that either
call banner and go to the repl, or else call hint and exit,
are reduced to unconditionally calling banner and going to the
repl. All #if HAVE_TERMIOS blocks are similarly replaced with
just the HAVE_TERMIOS case.
|
|
|
|
|
|
|
| |
* linenoise/linenoise.c (linenoise): Force the printing of prompts
if the input file descriptor is a tty.
* txr.1: Documentation updated.
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| |
The :prompt-on command will enable prompting in plain mode.
* linenoise/linenoise.c (struct lino_state): New member, show_prompt.
(line_enable_noninteractive_prompt): New function.
(linenoise): In the plain mode loop, the show_prompt flag is on, show
the prompt. For continuation lines, show a condensed prompt, which
consists of the suffix of the full prompt, starting on the last
non-whitespace character.
* linenoise/linenoise.h (lino_enable_noninteractive): Declared.
* parser.c (repl): Implement :prompt-on command which enables the
above mode.
* txr.1: Documented.
|
|
|
|
|
|
|
|
|
|
|
|
|
| |
* linenoise/linenoise.c (linenoise): If we are in
noninteractive mode, then do not just read one line and return
it. If an enter_callback is defined then keep accumulating
lines while the callback indicates incomplete syntax, until
EOF occurs or the syntax appears complete. Return the lines
glued together, with \n characters replaced by \r, so the line
is correctly entered into the history, and the trailing LF
obliterated, as usual.
* txr.1: Documented new multi-line behavior of plain mode.
|
|
|
|
|
|
|
| |
* linenoise/linenoise.c (edit_in_editor): Treat empty EDITOR variable as
if it were unset (i.e., do nothing).
* txr.1: Documented.
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| |
In inclusive selection mode, when the selection is reversed
(end point is before start), and the starting character
is the end of the line or of the buffer, that character
is not included in the highlight, as if non-inclusive
selection were in effect.
This doesn't affect the semantics of the selection, only
the way it is rendered visually; the character which is
not highlighted is still included in the selection.
* linenoise/linenoise.c (sync_data_to_buf): Remove two bogus
conditions from the line which extends the visual selection
by one character: we must not avoid executing this logic if
the current character is zero (end of buffer) or CR (end of line).
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| |
* METALICENSE: 2020 copyrights bumped to 2021. Added note
about SHA-256 routines from Colin Percival.
* LICENSE, LICENSE-CYG, Makefile, alloca.h, args.c, args.h,
arith.c, arith.h, buf.c, buf.h, cadr.c, cadr.h, chksum.c,
chksum.h, chksums/crc32.c, chksums/crc32.h, combi.c, combi.h,
configure, debug.c, debug.h, eval.c, eval.h, ffi.c, ffi.h,
filter.c, filter.h, ftw.c, ftw.h, gc.c, gc.h, glob.c, glob.h,
hash.c, hash.h, itypes.c, itypes.h, jmp.S, lex.yy.c.shipped,
lib.c, lib.h, linenoise/linenoise.c, linenoise/linenoise.h,
lisplib.c, lisplib.h, match.c, match.h, parser.c, parser.h,
parser.l, parser.y, protsym.c, rand.c, rand.h, regex.c,
regex.h, share/txr/stdlib/asm.tl, share/txr/stdlib/awk.tl,
share/txr/stdlib/build.tl, share/txr/stdlib/cadr.tl,
share/txr/stdlib/compiler.tl, share/txr/stdlib/conv.tl,
share/txr/stdlib/copy-file.tl, share/txr/stdlib/debugger.tl,
share/txr/stdlib/defset.tl, share/txr/stdlib/doloop.tl,
share/txr/stdlib/each-prod.tl, share/txr/stdlib/error.tl,
share/txr/stdlib/except.tl, share/txr/stdlib/ffi.tl,
share/txr/stdlib/getopts.tl, share/txr/stdlib/getput.tl,
share/txr/stdlib/hash.tl, share/txr/stdlib/ifa.tl,
share/txr/stdlib/keyparams.tl, share/txr/stdlib/op.tl,
share/txr/stdlib/package.tl, share/txr/stdlib/param.tl,
share/txr/stdlib/path-test.tl, share/txr/stdlib/place.tl,
share/txr/stdlib/pmac.tl, share/txr/stdlib/quips.tl,
share/txr/stdlib/save-exe.tl, share/txr/stdlib/socket.tl,
share/txr/stdlib/stream-wrap.tl, share/txr/stdlib/struct.tl,
share/txr/stdlib/tagbody.tl, share/txr/stdlib/termios.tl,
share/txr/stdlib/trace.tl, share/txr/stdlib/txr-case.tl,
share/txr/stdlib/type.tl, share/txr/stdlib/vm-param.tl,
share/txr/stdlib/with-resources.tl,
share/txr/stdlib/with-stream.tl, share/txr/stdlib/yield.tl,
signal.c, signal.h, socket.c, socket.h, stream.c, stream.h,
struct.c, struct.h, strudel.c, strudel.h, sysif.c, sysif.h,
syslog.c, syslog.h, termios.c, termios.h, time.c, time.h,
tree.c, tree.h, txr.1, txr.c, txr.h, unwind.c, unwind.h,
utf8.c, utf8.h, vm.c, vm.h, vmop.h, win/cleansvg.txr,
y.tab.c.shipped: Copyright year bumped to 2021.
|
|
|
|
|
| |
* linenoise.c (scan_match_rev, scan_match_fwd): The value of
s[i] must be captured in a wchar_t, not int.
|
|
|
|
|
|
|
|
|
|
|
|
|
| |
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.
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| |
This is the seventh round of an effort to enable GCC's -Wextra
option. Warnings about switch fallthrough situations are
addressed. GCC now has a diagnostic for this that is enabled
by -Wextra in such a way that if a fallthrough comment is
present, the diagnostic is suppressed. In much of the code,
we have such a comment. It's missing in a few places, or
misplaced. There are also some real bugs.
* hash.c (hash_buf): Add fallthrough comments to intentional
fallthrough cases.
(hash_hash_op): bugfix: add break statement. The 32 and 64
bit cases are independent (at compile time).
* lib.c (cdr, nullify, list_collect, empty): Add fallthrough
comment.
(int_str): Add missing break. This has not caused a
bug though because setting the octzero flag in the zerox
case is harmless to the logic which follows.
* linenoise.c (edit): Move misplaced fallthrough.
* sysif.c (fcntl_wrap): Bugfix: add missing break, without
which errno is tampered to hold EINVAL, in spite of a
successful F_SETLK, F_SETLKW or F_GETLK operation.
* unwind.h (jmp_restore): Declare noreturn, so that GCC
does not issue a false positive warning about a fallthrough
in uw_unwind_to_exit_point.
* utf8.c (utf8_from_buf, utf8_decode): Move a fallthrough
comment outside of preprocessing, so it is properly processed
by GCC's diagnostic.
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| |
This is the sixth round of an effort to enable GCC's -Wextra
option. Warnings about uninitialized members are addressed.
I am not happy with what had to be done in linenoise.c.
We just need a dummy circular list node for the lino_list,
which we achieved with a dummy all zero struture, with
statially initialized next and prev pointers. There are way
too many members to initialize, including one that has struct
termios type containing a nonportable set of members.
On the plus size, the lino_list structure now moves into the
BSS section, reducing the executable size slightly.
* lib.c (cptr_ops): Initialize using cobj_ops_init, which has
all the initializers already, and should have been used for
this in the first place.
* linenoise/linenoise.c (lino_list): Remove initializer,
which eliminates the warning about some members not being
initialized.
(lino_init): Initialize the next and prev pointers here.
* parser.c (parser_ops): Initialize with cobj_ops_init.
* stream.h (stdio_mode_init_blank, stdio_mode_init_r,
stdio_mode_init_rpb): Add initializer corresponding to redir
array member of struct stdio_mode.
* sysif.c (cptr_dl_ops): Use cobj_ops_init.
* tree.c (tree_iter_init): Add initializer for the path
array member of struct tree_iter.
(tr_rebuild): Initialize all fields of the dummy object.
Since it's a union, we just have to deal with the any
member. There are two layouts for the obj_common fields
based on whether CONFIG_GEN_GC is enabled. This is ugly, but
occurs in one place only.
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| |
This is the fourth round of an effort to enable GCC's -Wextra
option. Instances of code that test whether an unsigned
quantity is negative are repaired. Real bugs are found.
* itypes.c (c_u32, c_uint, c_ulong): Remove useless comparison
for < 0 that was copy-pasted from the signed cases.
* linenoise/linenoise.c (show_help, edit): Do not test the
return value of the getch_fn callback for negative. It returns
wint_t, which may be unsigned. Test for the WEOF value.
This is a bug because since the original comparison is
always false, the code fails to catch the WEOF return.
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| |
This is the first round of an effort to enable GCC's -Wextra
option. All function parameters that are unused an that we
cannot eliminate are treated with a cast to void in the
function body.
* args.c (args_key_check_store): Cast unused param to void.
* combi.c (perm_list_gen_fill): Likewise.
* eval.c (op_error, op_meta_error, op_quote op_qquote_error,
op_unquote_error, op_load_time_lit, me_each, me_for,
me_quasilist, me_flet_labels, hash_min_max, me_ignerr,
me_whilet, me_iflet_whenlet, me_dotimes, me_mlet,
me_load_time, me_load_for): Likewise.
* ffi.c (ffi_void_put, ffi_fixed_dynsize, *ffi_fixed_alloc,
ffi_noop_free, ffi_void_get, ffi_simple_release, ffi_i8_put,
ffi_i8_get, ffi_u8_put, ffi_u8_get, ffi_i16_put, ffi_i16_get,
ffi_u16_put, ffi_u16_get, ffi_i32_put, ffi_i32_get,
ffi_u32_put, ffi_u32_get, ffi_i64_put, ffi_i64_get,
ffi_u64_put, ffi_u64_get, ffi_char_put, ffi_char_get,
ffi_uchar_put, ffi_uchar_get, ffi_bchar_get, ffi_short_put,
ffi_short_get, ffi_ushort_put, ffi_ushort_get, ffi_int_put,
ffi_int_get, ffi_uint_put, ffi_uint_get, ffi_long_put,
ffi_long_get, ffi_ulong_put, ffi_ulong_get, ffi_float_put,
ffi_float_get, ffi_double_put, ffi_double_get, ffi_val_put,
ffi_val_get, ffi_be_i16_put, ffi_be_i16_get, ffi_be_u16_put,
ffi_be_u16_get, ffi_le_i16_put, ffi_le_i16_get,
ffi_le_u16_put, ffi_le_u16_get, ffi_be_i32_put,
ffi_be_i32_get, ffi_be_u32_put, ffi_be_u32_get,
ffi_le_i32_put, ffi_le_i32_get, ffi_le_u32_put,
ffi_le_u32_get, ffi_be_i64_put, ffi_be_i64_get,
ffi_be_u64_put, ffi_be_u64_get, ffi_le_i64_put,
ffi_le_i64_get, ffi_le_u64_put, ffi_le_u64_get, ffi_wchar_put,
ffi_wchar_get, ffi_sbit_get, ffi_ubit_get, ffi_cptr_get,
ffi_str_in, ffi_str_put, ffi_str_get, ffi_str_d_get,
ffi_wstr_in, ffi_wstr_get, ffi_wstr_put, ffi_wstr_d_get,
ffi_bstr_in, ffi_bstr_put, ffi_bstr_get, ffi_bstr_d_get,
ffi_buf_in, ffi_buf_put, ffi_buf_get, ffi_buf_d_in,
ffi_buf_d_put, ffi_buf_d_get, ffi_closure_put, ffi_ptr_in_in,
ffi_ptr_in_d_in, ffi_ptr_in_out, ffi_ptr_out_in,
ffi_ptr_out_out, ffi_ptr_out_null_put, ffi_ptr_out_s_in,
ffi_flex_struct_in, ffi_carray_get, ffi_union_get,
make_ffi_type_builtin, make_ffi_type_array,
ffi_closure_dispatch, ffi_closure_dispatch_safe): Likewise.
* gc.c (cobj_destroy_stub_op, cobj_destroy_free_op, cobj_mark_op): Likewise.
* lib.c (seq_iter_get_nil, seq_iter_peek_nil): Likewise.
* linenoise/linenoise.c (sigwinch_handler): Likewise.
* parser.c (repl_intr, read_eval_ret_last, repl_warning,
is_balanced_line): Likewise.
* parser.y (yydebug_onoff): Likewise.
* socket.c (dgram_close): Likewise.
* stream.c (unimpl_put_string, unimpl_put_char,
unimpl_put_byte, unimpl_unget_char, unimpl_unget_byte,
unimpl_put_buf, unimpl_fill_buf, unimpl_seek, unimpl_truncate,
unimpl_set_sock_peer, null_put_string, null_put_char,
null_put_byte, null_get_line, null_get_char, null_get_byte,
null_close, null_flush, null_seek, null_set_prop,
null_get_error, null_get_error_str, null_clear_error,
null_get_fd, dir_close): Likewise.
* struct.c (struct_type_print): Likewise.
* unwind.c (me_defex): Likewise.
|
|
|
|
|
|
|
|
|
|
| |
* linenoise.c (edit): Handle Ctrl-F in extended mode so that
Ctrl-X Ctrl-F forces the line to be submitted without a
balance check.
* txr.1: Document previously undocumented balance check,
including the flashing exclamation mark. Document Ctrl-X
Ctrl-F.
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| |
* linenoise/linenoise.c (yank): New static function, made out
of yank_sel.
(yank_by_ptr): New static function.
(yank_sel): Now wrapper for yank.
(edit_delete): Call yank_sel here if selmode is on, rather
than having the caller do it. This fixes a bug: the Ctrl-D
handler was doing this, but not the Del key handler.
(edit_delete, edit_delete_prev_all, edit_delete_to_eol,
edit_delete_line): All these operations
now yank the deleted text into the clipboard.
(edit_delete_prev_word): Likewise, and bugfix here: undo was
not being recorded for the clipboard deletion, only for the
word deletion. The semantics here is that if a selection is in
effect, only the selection goes into the clipboard, not the
word.now the deleted selection goes into the clipbo
(edit): Ctrl-D handler now doesn't call yank_sel, relying on
edit_delete to do it.
* txr.1: Documentation updated.
|
|
|
|
|
|
|
|
|
| |
* linenoise/linenoise.c (lino_have_new_lines): New function.
* linenoise/linenoise.h (lino_have_new_lines): Declared.
* parser.c (hist_save): Do nothing if lino_have_new_lines
returns false.
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| |
This patch addresses the problem of history loss that
occurs when a user juggles multiple TXR sessions that
all clobber the same history file.
* linenoise/linenoise.c (struct lino_state): New member,
loaded_lines, keeping track of how many of the lines in the
history came from loading the history file. Lines between
[0] and [loaded_lines - 1] are loaded lines. New lines
occur between [loaded_lines] and [history_len - 1].
(lino_hist_add): Reset loaded_lines to zero when creating
history for the first time. Not really necessary since the
structure starts zero-filled. When a line of history is
erased, then it must be a loaded line, unless loaded_lines
is zero. Thus, then decrement loaded_lines to account for a
loss of a loaded line, but don't decrement below zero.
(lino_hist_set_max_len): Setting the max length can cause
history to be trimmed, so we must adjust loaded_lines to
account for any loaded lines that get discarded.
(lino_hist_save): Takes a new parameter which indicates
whether to just save the new history by appending it to the
given file, or to overwrite the file with the entire history.
In either case, once we save the history, we assume that all
of our lines are loaded lines and set loaded_lines to
hist_len. In the future, this last step will help implement
incremental saving mid-way through a sesssion.
(lino_hist_load): Error out if there is already a history.
With this loaded_lines logic, it really wouldn't make sense to
read history more than once. After loading, set loaded_lines
to hist_len.
* linenoise/linenoise.h (enum lino_file_mode): New enumeration
lino_append.
(lino_hist_save): Declaration updated.
* parser.c (repl): Implement new history saving protocol.
The history file is read using a temporary instance of
linenoise, which has the effect of trimming it to the required
number of lines. This is written to a temporary file, to which
the newly entered lines are appended, and which is finally
renamed to replace the history file.
(lino_mode_str): Add "a" entry corresponding to lino_append.
(lino_open): Do the fchmod in the lino_append case also.
* txr.1: Documented the new handling of the history file.
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| |
* LICENSE, LICENSE-CYG, METALICENSE, Makefile, alloca.h, args.c,
args.h, arith.c, arith.h, buf.c, buf.h, cadr.c, cadr.h,
chksum.c, chksum.h, chksums/crc32.c, chksums/crc32.h, combi.c,
combi.h, configure, debug.c, debug.h, eval.c, eval.h, ffi.c,
ffi.h, filter.c, filter.h, ftw.c, ftw.h, gc.c, gc.h, glob.c,
glob.h, hash.c, hash.h, itypes.c, itypes.h, jmp.S, lib.c,
lib.h, linenoise/linenoise.c, linenoise/linenoise.h,
lisplib.c, lisplib.h, match.c, match.h, parser.c, parser.h,
parser.l, parser.y, protsym.c, rand.c, rand.h, regex.c,
regex.h, share/txr/stdlib/asm.tl, share/txr/stdlib/awk.tl,
share/txr/stdlib/build.tl, share/txr/stdlib/cadr.tl,
share/txr/stdlib/compiler.tl, share/txr/stdlib/conv.tl,
share/txr/stdlib/debugger.tl, share/txr/stdlib/defset.tl,
share/txr/stdlib/doloop.tl, share/txr/stdlib/error.tl,
share/txr/stdlib/except.tl, share/txr/stdlib/ffi.tl,
share/txr/stdlib/getopts.tl, share/txr/stdlib/getput.tl,
share/txr/stdlib/hash.tl, share/txr/stdlib/ifa.tl,
share/txr/stdlib/keyparams.tl, share/txr/stdlib/op.tl,
share/txr/stdlib/package.tl, share/txr/stdlib/param.tl,
share/txr/stdlib/path-test.tl, share/txr/stdlib/place.tl,
share/txr/stdlib/pmac.tl, share/txr/stdlib/save-exe.tl,
share/txr/stdlib/socket.tl, share/txr/stdlib/stream-wrap.tl,
share/txr/stdlib/struct.tl, share/txr/stdlib/tagbody.tl,
share/txr/stdlib/termios.tl, share/txr/stdlib/trace.tl,
share/txr/stdlib/txr-case.tl, share/txr/stdlib/type.tl,
share/txr/stdlib/vm-param.tl,
share/txr/stdlib/with-resources.tl,
share/txr/stdlib/with-stream.tl, share/txr/stdlib/yield.tl,
signal.c, signal.h, socket.c, socket.h, stream.c, stream.h,
struct.c, struct.h, strudel.c, strudel.h, sysif.c, sysif.h,
syslog.c, syslog.h, termios.c, termios.h, tree.c, tree.h,
txr.1, txr.c, txr.h, unwind.c, unwind.h, utf8.c, utf8.h, vm.c,
vm.h, vmop.h, win/cleansvg.txr: Extended copyright notices
to 2020.
|
|
|
|
| |
* linenoise.c: due to extensive changes, asserting own copyright.
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| |
* linenoise/linenoise.h (struct lino_os): New virtual
operation, puts_file_fn: like puts_fn, but not
display-oriented: doesn't check for and ignore padding
characters, and doesn't flush after each line.
(lino_os_init): Initializer macro updated.
* linenoise/linenoise.c (edit_it_editor): Use puts_file_fn to
write to temporary file.
(lino_hist_save): Likewise, when writing out history.
* parser.c (lino_puts_file): New static function.
(linenoise_txr_binding): Add lino_puts_file to initializer
to wire in the operation.
|
|
|
|
|
|
| |
* linenoise.c (LINENOISE_MAX_LINE): Change to 4096.
* txr.1: Updated.
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| |
The optimized character insert case must handle the situation
of the cursor going off the edge of the screen when a
character is output in the last column in a manner that
is consistent with the regular insert, leaving the linenoise
structure in the same state that a full refresh would.
* linenoise/linenoise.c (refresh_multiline): In the optimized
character insert case indicated by need_refresh == 2, we
must add the check for the cursor being in the dead spot past
the edge of the screen, just like we do later in the function
for the regular refresh case. In that case we must advance the
cursor to the next line to get it out of the dead spot, and
adjust maxrows if necessary. We know we are in the dead spot
from the two rows values output by screen_rows. That function
puts out a nrow value that exceeds rows when that is the case.
|
|
|
|
|
|
|
|
|
|
| |
* linenoise/linenoise.c (move_cursor_multiline): If the npos
argument happens to be equal to the current position (the
operation is a null move), then no movement is generated. In
that case, no ab_append operation is called, and ab.b will
stay null; this null pointer then gets passed to
lino_os.puts_fn as the string to output, and that will blow
up. This situation hasn't actually been observed.
|
|
|
|
|
|
|
| |
* linenoise/linenoise.c (show_help): Rearrange contents.
^X+Tab moves from page 3 to page 2, to a spot where there
is just enough room. That gives us room to place ^X^P on
page 3.
|
|
|
|
|
|
| |
* 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.
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| |
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.
|
|
|
|
|
|
|
|
|
| |
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.
|
|
|
|
|
|
|
| |
* 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.
|
|
|
|
|
|
|
|
| |
* linenoise/linenoise.c (edit_move_left, edit_move_right,
edit_move_home, edit_move_sol, edit_move_end, edit_move_eol,
edit_move_matching_paren): Use the efficient move_cursor
instead of punching in the new position and calling
refresh_line.
|
|
|
|
|
| |
* linenoise/linenoise.c (move_cursor): Do nothing
if the requested position is current.
|
|
|
|
|
|
|
|
|
|
|
| |
* linenoise/linenoise.c (move_cursor): We must update the
oldrow variable, expected by refresh_line to be tracking the
row position of the cursor. This bug doesn't affect the
current use of move_cursor for paren_jump, because that logic
moves the cursor to the original position, which makes the
oldrow value correct, and refresh_line is never called in
between. If we want to use move_cursor in more situations,
this has to be fixed.
|
|
|
|
|
|
|
| |
* linenoise/linenoise.c (history_search): The c variable for
capturing the input character should be of type wint_t,
not int. This was caught by GNU C++, due to a signed/unsigned
warning when c was compared to WEOF.
|
|
|
|
|
|
|
|
|
|
| |
* linenoise/linenoise.c (move_cursor_multiline, move_cursor):
New functions.
(paren_jump): Use move_cursor rather than refresh_line.
In multi-line mode, this calculates the required cursor
movement and emits the escape sequences to make it happen,
without issuing a refresh, sending way less data to the
terminal.
|
|
|
|
|
|
|
|
| |
* linenoise/linenoise.c (edit_insert): This function is
missing an important optimization for multi-line mode. Let's
add it. Since multi-line mode doesn't scroll horizontally, it
is very simple: if a character is added at the end, there is
no need for refresh.
|
|
|
|
|
|
|
|
|
|
| |
* linenoise/linenoise.c (refresh_line): Clear the need_refresh
flag here.
(edit): No need to clear it here any more. This will prevent
some useless calls to refresh_line. Some edit operations set
refresh_line, but then execute something that performs
refresh_line unconditionally. If the flag is then reset, the
top of the loop doesn't have to do another wasteful refresh.
|
|
|
|
|
|
|
|
|
| |
* linenoise/linenoise.c (col_offset_in_str): Take a cols
parameter and wrap the return value into the number of
columns.
(refresh_multiline): No need to do the % cols operation on the
return value of col_offset_in_str any more; just pass cols
down into it.
|
|
|
|
|
|
|
|
| |
* linenoise/linenoise.c (get_columns): Avoid the situation
that cols is zero or negative. The cols value is involved in a
modulo calculation (position % cols), which requires cols not
to be zero. The situation hasn't been observed; this is just
defensive coding.
|