| Commit message (Collapse) | Author | Age | Files | Lines |
|
|
|
|
|
|
|
|
|
|
|
| |
* linenoise/linenoise.c (struct lino_state): New members
atom_callback and ca_ctx.
(lino_set_atom_cb): New function.
(edit): Ctrl-X Ctrl-A invokes atom callback, and inserts
returned string.
* linenoise/linenoise.h (lino_atom_cb_t): New function pointer
typedef.
(lino_set_atom_cb): Declared.
|
|
|
|
|
|
|
|
|
|
| |
* eval.c (eval_init): Register flatcar intrinsic.
* lib.c (flatcar): New function.
* lib.h (flatcar): Declared.
* txr.1: Documented.
|
|
|
|
|
|
|
|
| |
* linenoise/linenoise.c (edit): Ctrl-X Ctrl-W,
or Ctrl-X w, with an optional number in between,
cause a word from the previous line to be inserted.
* txr.1: Documented.
|
|
|
|
|
| |
* parser.c (repl): Configure the .tl suffix
in the linenoise object.
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| |
This is so that when a command line is edited in an external
editor, editors can choose appropriate syntax highlighting
mode based on the suffix.
* linenoise/linenoise.c (struct lino_state): New member,
suffix.
(edit_in_editor): If we have the mkstemps function, then
use it to create a suffixed name.
(lino_set_tempfile_suffix): New function.
* linenoise/linenoise.h (lino_set_tempfile_suffix): Declared.
|
|
|
|
|
|
| |
* configure: Add check for mkstemps.
(HAVE_MKSTEMPS): New preprocessor symbol,
conditionally deposited into config/config.h
|
|
|
|
| |
* txr.1: Description wrongly refers to getpwuid.
|
|
|
|
|
|
|
|
|
|
| |
* parser.c (load_rcfile): Use path-exists-p for the existence
check. Since that doesn't throw, it's outside of the
catch section. Use path-private-to-me-p to impose a security
check on the profile file. If an error exception is caught,
show the details.
* txr.1: Added notes about security check.
|
|
|
|
|
|
|
|
|
| |
* lisplib.c (path_test_set_entries: "path-private-to-me-p"
addred to name array.
* share/txr/stdlib/path-test.tl (path-private-to-me-p): New
function.
* txr.1: Documented path-private-to-me.
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| |
* configure (have_grgid): New variable.
New tests added for getgrent and the rest.
(HAVE_GRGID, HAVE_GRGID_R): New preprocessor symbols
conditionally deposited into config/config.h.
* sysif.c (group_s, mem_s): New global symbol variables.
(setgrent_wrap, endgrent_wrap, fill_group, make_grstruct,
get_grent_wrap, getgrgid_wrap, getgrnam_wrap): New static
functions.
(sysif_init): New global symbol variables initialized.
New group struct type instantiated.
Intrinsic functions setgrent, endgrent, getgrent,
getgrgid and getgrnam registered.
* txr.1: Documented group structure and functions.
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| |
Now that we have a multi-line mode, it no longer works that we
use the command line number as the parse line number, so that
an error from something that was parsed in command 42 comes
out as "line:42". This commit changes to the format
"expr-42:3": line 3 of expression 42. The expression number is
fixed in the parse name, and the line number is derived from
the line divisions in the entry itself.
* parser.c (repl): Dynamically compute the parse name,
such that it contains the command number. Then when parsing,
just leave the parse to begin at line 1.
|
|
|
|
| |
* parser.c (load_rcfile): Trailing whitespace after declaration.
|
|
|
|
|
|
|
|
| |
* linenoise/linenoise.c (edit): Support a verbatim
entry mode with limited commands, in which most
characters self-insert, including Enter.
* txr.1: Documented.
|
|
|
|
|
|
|
|
|
|
| |
* RELNOTES: Updated.
* configure, txr.1: Bumped version and date.
* share/txr/stdlib/ver.tl: Likewise.
* txr.vim, tl.vim: Regenerated.
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| |
* linenoise/linenoise.c (lino_get_multiline): New function.
* linenoise/linenoise.h (lino_get_multiline): Declared.
* parser.c (listener_hist_len, listener_multi_line_p_s): New
symbol global variables.
(repl): Set linenoise history length and multi-line mode from
the *listener-hist-len* and *listener-multi-line-p* variables
on each call. Set the *listener-multi-line* variable from
the lino_t object's current state after each linenoise call.
(parse_init): Initialize new global variables and register
them as special variables.
* txr.1: Update sentence which says that history is fixed
at 100 lines. Document listener configuration variables.
|
|
|
|
| |
* txr.1: New section about line length limit and other restrictions.
|
|
|
|
|
| |
* txr.1: Clear Screen, Suspend, and History Persistence
are not editing commands. They get their own sections.
|
|
|
|
|
|
|
|
| |
* linenoise/linenoise.c (tr, edit_in_editor): New
static functions.
(edit): edit_in_editor hooked in under Ctrl-X Ctrl-E.
* txr.1: Documented.
|
|
|
|
|
|
| |
* linenoise/linenoise.c (edit): Handle the Ctrl-X
key by setting a temporary flag. This sets the framework for
commands prefixed by Ctrl-X.
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| |
This is needed for multi-line mode with CR line breaks.
It also makes TXR tolerant when code is ported among
systems with different line endings.
* parser.l (NL): New lex named pattern, matching three
possible line terminators: CR, NL or CR-NL.
(grammar): In places where \n was previously matched,
use {NL}. In a few places where \n is in a character
class, add \r. In one place (comment matching), the
the pattern . which implicitly doesn't match newlines
had to be replaced with [^\r\n].
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| |
The oldpos variable for tracing the previous cursor position
as an absolute offset into the display data is not appropriate
any more under enhanced multi-line mode. The reason is that
edit operations can completely replace the buffer (e.g.
history recall). When the buffer is replaced, because there
can be arbitrary line breaks in the data, the oldpos
variable's saved position has no meaning relative to the new
buffer contents. But the only use of oldpos is to calculate
the previous *row* of the cursor position! So, we can replace
oldpos with a variable that just remembers the row directly.
As a bonus, we can get rid of the calculation which tries to
recover the oldrow from oldpos.
* linenoise/linenoise.c (struct lino_state): Removed member
oldpos. Added member oldrow.
(struct row_values): Array reduced to two elements.
(screen_rows): Doesn't take oldpos argument any more.
Current cursor position returned in out.rows[1].
(refresh_multiline): Some variables renamed. rpos2 becomes
nrow (new row position). old_rows is oldmaxrows to avoid
confusion with l->oldrow. The rpos variable (old row
position) is gone: its uses are replaced with l->oldrow.
Near the end of the function, we save the new cursor row
position (nrow) in l->oldrow, in the same spot where
we previously saved the current position in l->oldpos.
(edit): Initialize l->oldrow to 0. Remove initialization
of l->oldpos.
|
|
|
|
|
|
|
| |
* linenoise/linenoise.c (lndebug): Macro removed.
The variables have changed; it won't work any more.
We have GDB.
(refresh_multiline): lndebug calls removed.
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| |
The linenoise multi-line mode is just a glorified line
wrapper, and not actualy a multi-line editor, like in GNU
Readline and others. This commit fixes it. The edit buffer can
now contain line breaks, separated by carriage return
characters. (In single-line mode, these characters continue
to be displayed as ^M). The row and column calculations in the
multi-line refresh follow this data representation.
* linenoise/linenoise.c (sync_data_to_buf): This function
now takes an extra argument telling it whether multi-line mode
is in effect for the rendering. In multi-line mode, the prompt
is now added to the display data, so that multi-line refresh
is simplified by not having to account for the prompt length
in various calculations. Also, in multi-line mode, carriage
returns are rendered to display as CR-LF pairs, since they
denote embedded line breaks.
(complete_line): Pass mlmode to sync_data_to_buf.
(struct row_values): New struct, for returning multiple
row values out of a function.
(screen_rows, col_offset_in_str): New static functions.
(refresh_multiline): Modified to use screen_rows and
col_offset_in_str for its calculations, and not to deal with
the prompt at all, since the prompt is rolled into the display
data.
(refresh_line, edit_insert): Pass mlmode to sync_data_to_buf.
* txr.1: Documented multi-line mode.
|
|
|
|
|
|
|
|
|
| |
* linenoise/linenoise.c (lino_hist_load): Don't look for
and overwrite carriage returns with the null character; only
do that for newlines. We already handle embedded carriage
returns just fine by displaying them as ^M.
There is a plan to use these characters for breaking up lines
in an enhanced multi-line mode.
|
|
|
|
|
|
|
| |
* linenoise/linenoise.c (sync_data_to_buffer): Add
missing null terminator to l->buf. This hasn't
caused a problem because no code relies on it
being a C string. That may be about to change.
|
|
|
|
|
| |
* linenoise/linenoise.c (edit): Handle CTL('J')
by toggling mlmode and refreshing the line.
|
|
|
|
|
| |
* linenoise/linenoise.c (edit): Delete if the data
length is nonzero, not the display length.
|
|
|
|
|
|
|
|
|
|
|
| |
* linenoise/linenoise.c (LINENOISE_PAREN_DELAY): New
preprocessor symbol.
(scan_match_rev, scan_rev, usec_delay, paren_jump):
New static functions.
(edit): Handle closing parenthesis, bracket and brace
by inserting and calling paren_jump.
* txr.1: Documented.
|
|
|
|
|
| |
* txr.1: Fix inappropriately copy and pasted ungrammatical
text "permutations is of zero length".
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| |
The issue is that sigset_t is 1024 bits wide on Linux, but
there aren't actually that many signals. Valgrind knows this
and so when sigprocmask returns the old signal set, Valgrind
only marks a portion of it as initialized, and not the
entire 1024 bits. When this sigset_t is later passed into
sig_set again, we do a memcmp on all 1024 bits and Valgrind
complains about a use of uninitialized data. Test case:
run valgrind ./txr -i and execute a (throw 'foo) expr.
* signal.c (sig_mask): If we are compiling with Valgrind
support, mark the old signal set defined just before passing
it to sigprocmask, so it has no uninitialized bits.
|
|
|
|
|
|
|
|
|
|
|
|
|
| |
Instances of extended_jmp_buf structure are defined in
automatic storage. The members are manipulated after setjmp
and accessed after returning via longjmp. Therefore, they
should be volatile-qualified.
* signal.h (EJ_DBG_MEMB): Add volatile to dbg_depth.
(extended_jmp_buf): Add volatile on all members in
both versions of the structure.
(extended_setjmp): Cast away volatile when
passing sigset_t to sig_mask.
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| |
When a NFA regex goes through more than 4.29 billion state
transitions, the state coloring "visited" marker wraps around.
There could still exist states with old values at or near
zero, which destroys the correctness of the closure
calculations.
* regex.c (nfa_handle_wraparound): New static function.
The wraparound situation is handled by detecting when
the next marker value is UINT_MAX. When this happens,
we visit all states, marking them to UINT_MAX.
Then we visit them again, marking them to zero, and
set the next marker value to 1.
(nfa_free): Added comment about why we don't have a
wraparound check, in case it isn't obvious.
(nfa_run): Check for wraparound before eveyr nfa_closure call.
(regex_machine_reset): Check for wraparound before nfa_closure
call. Fix: store the counter back in the start state's visited
field.
(regex_machine_init): Initialize the n.visited field of the
regex machine structure to zero. Not strictly necessary, since
it's initialized moments later in regex_machine_reset, but
good form.
(regex_machine_feed): Check for wraparound before nfa_closure
call.
|
|
|
|
|
| |
* regex.c (nfa_free): Use alloca for array of all states.
(nfa_run): Use alloca for move, closure and stack arrays.
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| |
* regex.c (struct regex): New member, nstates.
(NFA_SET_SIZE): Preprocessor symbol removed.
(struct nfa_machine): New member, nstates.
(nfa_all_states): Function removed.
(nfa_map_states): New static function.
(nfa_count_one, nfa_count_states, nfa_collect_one): New static
functions.
(nfa_free): Takes nstates argument. Calculate array of all
states using nfa_map_states over nfa_collect_one rather than
nfa_all_states. The array is tightly allocated. Also the
spanning tree traversal needs just one root, nfa.start.
It's not clear why nfa_all_states used nfa.start and
nfa.accept as roots.
(nfa_closure): Takes nstates parameter; array bounds checking
performed tightly against nstates rather than NFA_SET_SIZE.
(nfa_move): Check against NFA_SET_SIZE removed.
(nfa_run): Take nstates argument. Allocate arrays tightly. Pass nstates
to nfa_closure.
(regex_destroy): Pass regex->nstates to nfa_free.
(regex_compile): Initialize regex->nstates.
(regex_run): Pass regex->nstates to nfa_run.
(regex_machine_reset): Pass nstates to nfa_closure.
(regex_machine_init): Initialize n.nstates member of regex
machine. Allocate arrays tightly.
(regex_machine_feed): Pass nstates to nfa_closure.
|
|
|
|
|
|
| |
* regex.c (nfa_free): The visited marker must be incremented,
otherwise nfa_all_states will only collect start and
accept.
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| |
* linenoise/linenoise.c (struct lino_state): New member,
need_resize.
(lino_list_busy): New static variable.
(handle_resize): New function.
(complete_line, history_search, edit): Check for the tty read
being interrupted, and in that case call handle_resize to put
the resize into effect, and continue the loop to fetch another
character.
(sigwich_handler): New function.
(linenoise): If we have SIGWINCH, install a handler for it
temporarily.
(link_into_list, unlink_from_list): Set global busy flag
around list manipulations. The signal handler stays away if
these are set. This means that if the user performs some
action that requires a lino_t to be constructed (e.g. types
Ctrl-R to search), while resizing the window at almost exactly
the same time, we will lose the resize signal. Oh well!
|
|
|
|
|
|
|
|
|
|
|
|
| |
* parser.c (load_rcfile): New function.
(repl): Compute profile file name and try to load it before
entering loop.
* sysif.c (statp): Linkage becomes external.
* sysif.h (statp): Declaration updated.
* txr.1: Documented.
|
|
|
|
|
|
|
| |
* parser.c (find_matching_syms): Don't add an entry
into the history if it is a full match for the
completion prefix, because in the UI in then looks
as if nothing happened when Tab as pressed.
|
|
|
|
|
|
|
|
|
| |
* linenoise/linenoise.c (history_search): Editing keys
should leave search mode and be processed in command mode.
Also, let's have Ctrl-L and Ctrl-Z work, but stay in search
mode.
* txr.1: Documented.
|
|
|
|
|
|
| |
* linenoise/linenoise.c (history_search):
Don't step through identical lines, which
looks as if Ctrl-R is being ignored.
|
|
|
|
|
|
|
|
|
| |
* linenoise/linenoise.c (compare_completions): Restructure
with help of new lino_copy function to collect completions
just for the prefix of the line up to the cursor position,
and recombine those with the suffix.
* txr.1: Doc updated.
|
|
|
|
|
|
|
|
|
|
| |
* linenoise/linenoise.c (complete_line): ESC must not be
treated specially when leaving completion mode; it must
accept the completed line. The original code did this wrong
in my opinion and I propagated the error.
* txr.1: Remove all mention of special ESC treatment
in completion mode.
|
|
|
|
|
|
|
| |
* linenoise/linenoise.c (edit): Don't let characters
less than 32 be inserted.
* txr.1: Documented that control characters are rejected.
|
|
|
|
|
|
|
|
|
|
|
| |
* linenoise/linenoise.c (next_hist_match, history_search): New
static function.
(edit): New Ctrl-R case added to early switch that also
handles Tab completion, and calls history_search.
(lino_free): Adding null check, so we can safely call
lino_free(0). history_search relies on this.
* txr.1: Documented search.
|
|
|
|
|
|
|
|
|
|
| |
* parser.c (repl): If we continue the loop due to detecting a
blank line, we must free that line, since we are outside of
the unwind block (and continue would violate that block if we
were). If a line contains nothing but a comment, then enter
that line into the history.
* txr.1: Documented treatment of commented lines.
|
|
|
|
|
|
|
|
| |
* parser.c (read_eval_ret_last): New function.
(repl): Use read_eval_ret_last for :read command.
* txr.1: Document :read in new section on direct
read from the terminal.
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| |
This makes a difference if we read from a TTY.
Without this fix, two Ctrl-D's have to be issued
before the code registers EOF and returns.
The trick is that we know, after calling the
parser, whether it hit EOF, because we have
the recent token. If its value is zero, that's
the EOF token. We can bail out of the loop
instead of calling the parser again which will
require another EOF (because prime_parser
will not push an EOF token!)
* parser.h (parser_eof): Declared.
* parser.c (read_eval_stream): After lisp_parse
and eval, check for EOF with the parser_eof
function, and bail if so.
(parser_eof): New function.
|
|
|
|
|
|
|
|
| |
* parser.c (repl): Subtle difference. Test form's syntax for
equality to :quit, not its value. The REPL should not
terminate if a form happens to calculate :quit as a value.
* txr.1: Updated.
|
|
|
|
| |
* txr.1: document Home, End and Delete support.
|
|
|
|
|
|
|
|
|
|
| |
* linenoise/linenoise.c (complete_line): If Ctrl-C is
pressed in completion mode, we cancel completion and return
0 so the command loop reads a new character.
* txr.1: Documented Ctrl-C in completion mode, and removed
the falsehood that ESC is a cancel command, adding instead
an explanation about the ESC handling is really for.
|