| Commit message (Collapse) | Author | Age | Files | Lines |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| |
* lib.c (compat_fixup): Call rand_compat_fixup.
* rand.c (random_state_var_s): New global symbol variable.
(rand_compat_fixup): New static function.
(rand_init): Initialize random_state_var_s by intering
the earmuffed symbol *random-state*. Initialize random_state_s
to the non-earmuffed symbol random-state.
* rand.h (random_state_var_s): Declared.
(random_state): Macro updated to look up the special
variable using random_state_var_s, rather than random_state_s.
(rand_compat_fixup): Declared.
|
|
|
|
|
|
|
|
|
|
|
| |
The issue is that eval_intrinsic doesn't clear the
last_form_evaled global around the evaluation of its forms.
If a symbol is evaluated, and it is an unbound variable, the
error is reported against some wrong form.
* eval.c (eval_intrinsic): Set the value of last_form_evaled
to nil before expanding and evaluating the form, then restore
the value.
|
|
|
|
|
| |
* txr.1: Debugger and Compatibility are moved out of the TXR
library description, into their own major sections.
|
|
|
|
|
|
|
|
|
|
| |
* parser.c (repl): If a HOME environment variable
exists, then load the .txr_history file from the user's home
directory and save it when exiting.
* sysif.c (getenv_wrap): Static function changed to extern.
* sysif.h (getenv_wrap): Declared.
|
|
|
|
|
| |
* linenoise.c (key_action): New enum constant, CTRL_Z.
(edit): Implement Ctrl-Z suspend.
|
|
|
|
|
| |
* parser.c (repl): Use format to print exception, and use ~!
to ensure indentation.
|
|
|
|
|
|
| |
* eval.c (abbrev_ctx): New static function.
(bind_args): In too many/few args case, use abbrev_ctx to only
show function only when it is a lambda.
|
|
|
|
|
| |
* lib.c (callerror): Remove accidentally committed debug
print, present from the time the function was introduced.
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| |
When the -n option was introduced, on Mar 29, 2015, the
change didn't take into account that the hacky complex_open
function takes the C stdin stream directly, and not the
std_input Lisp stream. After that change, only the std_input
is automaticaly marked for real-time input if standard input
is a tty, and not any stream later opened from stdin.
* match.c (enum fpip_close): New enum member, fpip_close_stream.
(struct fpip): New member s, for smuggling through a stream.
(complex_open): If name is "-", then plant std_input or std_output
as the s member of fpip_t, rather than planting stdin or stdout
as the f member.
(complex_open_failed): Check for nil stream also.
(complex_snarf, complex_stream): Handle stream case.
|
|
|
|
|
|
|
|
|
|
|
| |
* match.c (extract): Return match result as cons, rather than
int termination status.
* match.h (extract): Declaration updated.
* txr.c (txr_main): Handle result cons. If repl mode is selected,
pass bindings from car(result) to repl. Otherwise use match success
indication in cdr(result) to determine termination status.
|
|
|
|
|
| |
* txr.c (txr_main): i option sets a flag only, processed
later in the function.
|
|
|
|
|
|
|
|
| |
* signal.c (kill_wrap): Return boolean indication of success,
with compatibility to previous behavior.
* txr.1: Document return value of kill, and put in
compatibility note.
|
|
|
|
|
|
|
| |
* signal.c (raise_wrap): New static function
(sig_init): Register raise intrinsic.
* txr.1: Documented raise.
|
|
|
|
|
| |
* parser.c (repl): Use ** prefix on caught exception
message. Clearly indicate that the second value is args.
|
|
|
|
|
|
|
| |
* parser.c (repl): If an exception is caught, don't
store nil in the repl result variable and hash.
Rather, store a cons cell holding the exception symbol
and arguments.
|
|
|
|
|
|
|
|
|
|
|
|
| |
* lib.c (split_str, split_str_set, list_str, int_str): Use
gc_hint rather than prot1/rel1. More efficient, doesn't
use space in the prot_stack array.
* regex.c (search_regex): Likewise.
* stream.c (vformat_str, formatv, run): Likewise.
In formatv, rel1 wasn't being called in the uw_unwind
block, so this fixes a bug.
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| |
We must tear down and rebuild the Flex scanner, otherwise
it is left in a bad state causing it to abort.
* parser.c (parser_cleanup): After destroying scanner,
null out the pointer.
(parser_reset): Destroy the Flex scanner, and
instantiate a new one in its place.
(lisp_parse): Set up an unwind catch which will
reset the parser if it was aborted by an exception.
* parser.h (parser_reset): Declared.
|
|
|
|
|
|
| |
* parser.c (repl): Print a simple fixed message when a
syntax error exception is caught, just so the fact
is noted.
|
|
|
|
|
|
| |
* signal.c (sig_handler): Make sure the interrupt_count
is restored to the value on entry into the handler
if the lambda throws.
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| |
This is just amazingly broken; sig_mask recurses instead
of calling sigprocmask.
Also, we need a way to reload the signal mask cache from the
kernel, because the kernel can change the signal mask behind
our back.
* signal.c (sig_reload_cache): New static function.
(sig_handler): Call sig_reload_cache to ensure the
sig_blocked_cache accurately reflects the currently
blocked signal set.
(sig_init): Call sig_reload_cache at init time to
correctly reflect any blocked signals.
(sig_mask): Call sigprocmask instead of recursing. Moreover,
the correct op code is SIG_SETMASK, not SIG_BLOCK.
|
|
|
|
|
|
|
|
| |
* linenoise/linenoise.c (lino_print_codes): Pass l
into enable_raw_mode rather than STDIN_FILENO.
Read from l->ifd rather than STDIN_FILENO.
since this is a debugging function, I'm leaving the
printfs to stdio alone.
|
|
|
|
|
|
|
|
|
|
| |
* lib.c (chk_strdup_utf8): New function.
* lib.h (chk_strdup_utf8): Declared.
* linenoise/linenoise.c (chk_strdup_utf8): Declared.
(edit_history_next, linenoise, lino_hist_add): Use
chk_strdup_utf8 instead of strdup.
|
|
|
|
|
|
|
|
|
|
|
|
|
| |
If some program really needs this, it can be implemented in
that program.
* linenoise/linenoise.c (supported_term): Static array
removed.
(unsupported_term): Function removed.
(linenoise): Function removed.
(go_raw): Converted to linenoise function.
For handling non-tty's, opens and closes a stdio stream
over ls->ifd instead of using stdin and STDIN_FILENO.
|
|
|
|
|
|
|
|
|
|
|
| |
* eval.c (do_eval): Check for pending signals.
* parser.c (repl_intr): New static function.
(repl): Set up signal handler for SIGINT around REPL.
* signal.h (sig_deferred): declared.
(sig_check_fast): New inline function/macro.
A bit of a rearrangement here.
|
|
|
|
|
|
| |
* parser.c (repl): If linenoise returns a null pointer,
but the last error is lino_eof, print "** intr" message and
continue; do not quit.
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| |
In this commit, we introduce a persistent error
variable stored in the lino_t structure, and
functions to access it.
* linenoise/linenoise.c (struct lino_state): New
member, error.
(enable_raw_mode): Don't set errno to ENOTTY;
set linenoise error to lino_notty.
(complete_line, edit, go_raw, linenoise, lino_hist_save,
lino_hist_load): Set linenoise error before returning -1.
(lino_get_error, lino_set_error): New functions.
* linenoise/linenoise.h (enum lino_error, lino_error_t):
New enum.
(lino_get_error, lino_set_error): Declared.
|
|
|
|
|
|
|
|
|
| |
* linenoise.c (complete_line, sync_data_to_buf,
refresh_singleline, refresh_multiline, refresh_line,
edit_insert, edit_move_left, edit_move_right, edit_move_home,
edit_move_end, edit_history_next, edit_delete, edit_backspace,
edit_delete_prev_word): struct lino_state replaced
with lino_t.
|
|
|
|
|
| |
* parser.c (repl): Print "** " sequence in front
of exception.
|
|
|
|
|
|
| |
* parser.c (repl): If an exception is thrown, we
record a nil value for the line backreference
variable, and add the line to history.
|
|
|
|
|
|
|
|
|
| |
* parser.c (repl): If an expression is caught of
type syntax-error, then just suppress it. It is not
informative in this situation because the syntax
error diagnostics have appeared on the tty.
A syntax error exceptions is thrown out of the
reader so that program logic doesn't ignore errors.
|
|
|
|
|
|
|
| |
* txr.c (txr_main): Pass the name argument to lisp_parse
instead of defaulting it, so that errors against expressions
passed on the command line are referred to "cmdline-expr"
rather than the generic "string".
|
|
|
|
|
|
|
|
|
|
|
| |
* parser.l (yyerrorf): Don't print the program prefix
and parenthes, except if compatibility to 114 or older is
requested. The main motivation for this is the repl, where the
program prefix is not informative. The new format is also a
de facto standard which is compatible with other parsers.
Vim understands it directly.
* txr.1: Documented.
|
|
|
|
|
|
|
|
|
|
|
|
|
| |
* eval.c (boundp): Static function becomes extern.
* eval.h (boundp): Declared.
* parser.c (find_matching_syms): New par parameter
lets function determine whether previous character is a an
open parenthesis or brace, based on which the set
of possible completions is restricted.
(provide_completions): Calculate the par parameter
and pass to find_matching_syms.
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| |
Implement basic tab completion.
* lib.c (package_alist, package_name, package_symbols): New
functions.
* lib.h (package_alist, package_name, package_symbols):
Declared.
* parser.c (find_matching_syms, provide_completions):
New static functions.
(repl): Register provide_completions as completion callback
with linenoise.
|
|
|
|
|
| |
* linenoise/linenoise.c (complete_line): Use
TAB and ESC instead of 9 and 27.
|
|
|
|
|
|
| |
* linenoise/linenoise.c (enum key_action): New enum
constant, CTRL_V.
(edit): Implement Ctrl-V.
|
|
|
|
|
|
|
|
|
| |
* linenoise/linenoise.c (enum key_action): Unused KEY_NULL
removed. Removed uninformative comments next to
self-explanatory enum constants.
(edit): Removed uninformative comments next to cases
based on enum key_action enum constants.
Replaced 8 with CTRL_H.
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| |
The linenoise edit buffer now shows a printed representation
of underlying data. In this printed representation, multiple
characters can denote a single physical character, so that
a control code like 15 can be displayed as ^M.
In the future, this will help with a Unicode-ization of
linenoise.
The actual edit routines now operate on the data array
rather than buf, and the new function sync_data_to_buf is used
to synchronize buf with data for the sake of refreshing the
display.
* linenoise/linenoise.c (LINENOISE_MAX_DISP): New variable.
(struct lino_state): buf member becomes an array, so the
display buffer is now in the structure, and not stack
allocated in the linenoise function. New members data,
dlen and dpos for tracking the underlying data.
Also, the buflen member variable is gone. Uses of buflen
are replaced with sizeof.
(sync_data_to_buf): New static function.
(complete_line): Pass ls->data to callback, rather than
ls->buf. In the saving and restoring trick used when
displaying completions, we must copy in the completion to the
data array; we cannot swizzle a buffer pointer like before.
The restoration of the state is simplified; just copy back
the entire original. Lastly, when a completion is selected,
it must go into the data array, and not buf. Here, there
is a bugfix; it appears that refresh_line was not called;
I had to add that call. (Did that work before this change?)
(refresh_line): Call sync_data_to_buf before calling either
refresh function.
(edit_insert, edit_move_left, edit_move_right, edit_move_home,
edit_move_end, edit_history_next, edit_backspace,
edit_delete_prev_word): Operate on data array, dlen and dpos
rather than buf, len and pos.
(edit): Doesn't take buffer and length parameters any more.
No need to initialize context structure members buf, or
removed member buflen. New members dlen and dpos have to be
initialized. Inlined edit operations now work with data array,
rather than buf.
(go_raw): Buffer and buflen arguments are gone. Non-tty code
still allocates buffer on stack, but only in its local block.
(linenoise): Do not instantiate local buffer for passing
to go_raw, which doesn't take one any more.
When finished, duplicate the string in the data array.
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| |
* eval.c (eval_init): Registrations of lisp-parse and read must
account for new optional argument.
* lib.c (func_n5o): New function.
* lib.h (func_n5o): Declared.
* parser.c (lisp_parse): New argument for passing in line number.
This is punched into the parser object.
(read_eval_stream): Call to lisp_parse defaults new argument.
(repl): Pass repl line number to lisp_parse.
* parser.h (lisp_parse): Declaration updated.
* txr.c (txr_main): Call to lisp_parse defaults new argument.
|
|
|
|
|
|
|
| |
* parser.c (repl): Implement counter which enumerates
REPL lines. Implement *<num> variabls which allow the last 100
results to be referenced, as well as *n, *v, and *r variables
to have more flexible access to this value history.
|
|
|
|
|
|
|
| |
* linenoise/linenoise.c (generate_beep): Take line noise
context argument and send BEL character to output file
descriptor, rather than hardcoding to stderr.
(complete_line): Pass context to generate_beep.
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| |
* Makefile (OBJS): Only include linenoise.o if
have_termios is y.
* configure: Adding test for termios.
(have_termios): New configure and config.make variable.
(gen_config_make): Generate have_termios variable.
* parser.c (repl): New function.
* parser.h (repl): Declared.
* txr.c (help): Summarize new -i option.
(txr_main): Implement -i repl.
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| |
* linenoise/linenoise.c (completion_callback, orig_termios,
rawmode, mlmode, history_max_len, history_len, history): Global
variables removed; moved into struct lino_state.
(struct lino_state): New members next, prev. New members
completion_callback, orig_termios, rawmode, mlmode,
history_max_len, history_len, history.
(lino_list): New static variable: dummy node for circular
list of struct lino_state structures.
(lino_set_multiline): Operate on structure rather than global
variable.
(enable_raw_mode, disable_raw_mode): Operate on structure. Use
file descriptors from structures rather than inconsistent
hard-coded use of STDIN_FILENO and the argument fd, which is
gone.
(lino_clear_screen): Obtain file descriptor from structure,
rather than global.
(complete_line): Operate on structure rather than globals.
Pass context to completion callback.
(lino_set_completion_cb): Store callback in structure rather
than global. Store new context argument also.
(reresh_line): Take mode from structure rather than global.
(edit_insert, edit_move_end): Operate on struture rather
than globals.
(edit): Do not accept file descriptor arguments.
Do not update ifd and ofd members of structure; just rely on these
values to already be there, since the lino_make constructor
puts them there.
(lino_print_keycodes, go_raw): Operate on structure.
(lino_make, lino_free): New functions.
(lino_cleanup): New static function.
(linenoise, free_hist): Operate on structure.
(atexit_handler): Loop over all structures in global list,
and clean up each one.
(lino_hist_add, lino_list_set_max_len, lino_hist_save,
lino_hist_load): Operate on structure.
* linenoise/linenoise.h (lino_t): New typedef.
(lino_compl_cb_t): Function type takes new context argument.
(lino_set_completion_cb, linenoise, lino_hist_add,
lino_hist_set_max, lino_his_save, lino_hist_load,
lino_clear_screen, lino_set_multiline,
lino_print_keycodes): Declarations updated.
* linenoise/example.c (completion): Take new context argument,
and ignore it.
(main): Create linenoise context with lino_make, giving it
the input and output file descriptor, and pass it to all functions.
|
|
|
|
| |
* linenoise/example.c: New file.
|
|
|
|
|
|
| |
* linenoise/linenoise.c (edit): If 0 bytes is read from the
tty for any reason, return -1 so that the linenoise function
will return a null pointer rather than a blank line.
|
|
|
|
|
|
|
|
|
|
| |
* linenoise/linenoise.c (edit): Set freed element of history
array to null.
(free_hist): Null out all elements, and then the array
pointer.
(lino_hist_set_max_len): Calculate value of history_len
variable in obviously correct way, based on amount of history
preserved.
|
|
|
|
|
|
|
|
| |
linenoise/linenoise.c, linenoise/linenoise.h: Renaming
all camel-case identifiers to underscores. The
verbose linenoise prefix becomes lino_.
All caps enum tag gets lower cased.
Static functions with linenoise prefix lose the prefix.
|
|
|
|
|
|
| |
* linenoise/linenoise.c (enum KEY_ACTION):
Remove tabs from declaration. This is the only
place in the file which has tabs.
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| |
* linenoise/linenoise.c (mem_t): New typedef, compatible
with the one in lib.h, which we don't want to include.
(chk_malloc, chk_realloc): External declarations added.
(unsupported_term): Make element type const char *.
(linenoiseAddCompletion): Use checked allocator, add
casts, use the superior "sizeof *dest_pointer_var"
expression in size calculations rather than
"sizeof (maybe_wrong_type)".
(abAppend, linenoiseHistoryAdd, linenoiseHistorySetMaxLen): Likewise.
* linenoise/linenoise.h: Remove unnecessary include
guards; we don't use them in this project.
Remove 'extern "C"'; we don't require C linkage when
compiling everything as C++.
|
|
|
|
|
|
|
| |
* struct.c (struct_type_ops, struct_inst_ops): Use
static_forward and static_macros to handle the
forward declarations. Also, cobj_ops_init macro
now used for both instead of raw initializer.
|