summaryrefslogtreecommitdiffstats
Commit message (Collapse)AuthorAgeFilesLines
...
* Remove useless mark_makefresh hack.Kaz Kylheku2015-09-091-12/+1
| | | | | | | | | This contraption doesn't actually do anything. * gc.c (mark_makefresh): Static variable removed. (mark_obj): Remove logic conditional no mark_makefresh. (prepare_finals): Remove setting of mark_makefresh. (call_finals): Remove clearing of mark_makefresh.
* Finalization fix: incorrect for generational gc.Kaz Kylheku2015-09-091-17/+19
| | | | | | | | | | | | | | | | | | | | | | | | | | Another bug found in the finalization hooks. The reachability test being applied is not correct for generational GC, relying only on the REACHABLE flag. This bug means that we call finalization hooks on mature objects, while they remain reachable. It must use the gc_is_reachable logic, just like weak hash table processing does, because under an incremental garbage collection pass, all gen 1 objects are considered reachable (though they don't have the REACHABLE flag set). * gc.c (struct fin_reg): Remving obj_type member, replacing with reachable flag. (is_reachable): New static function based on gc_is_reachable, minus the is_ptr test. (GC code which knows it is dealing with a pointer doesn't need the test). (prepare_finals): In the first pass, instead of memorizing the prior object type, simply calculate the reachable flag, correctly taking into account generational GC. (call_finals): Rely on the new reachable flag rather than the REACHABLE flag in the saved obj_type. (gc_is_reachable): Becomes a public wrapper for is_reachable which adds the pointer test. (gc_finalize): Initialize the reachable member of fin_reg. Remove initialization for obj_type.
* Bugfix: multiple evaluation problem in slot place.Kaz Kylheku2015-09-091-4/+5
| | | | | | * share/txr/stdlib/place.tl (defplace slot): The slot argument must be evaluated only once, a gensym is established for it, just like for the object form.
* Formatting under new macro.Kaz Kylheku2015-09-091-0/+1
| | | | * txr.1: Missing .desc added.
* Fix fun, symbol-function and symbol-value places.Kaz Kylheku2015-09-091-5/+5
| | | | | | | * share/txr/stdlib/place.tl (defplace fun, defplace symbol-function, defplace symbol-value): Fix incorrect splicing substitution of body into the output.
* More informative printed rep for functions.Kaz Kylheku2015-09-092-2/+19
| | | | | | | | | * lib.c (obj_print_impl): Print whether a function is interpreted or intrinsic, and include argument information. * tests/012/struct.tl: Test case relying on function printed rep updated.
* Reveal struct winsize on Solaris.Kaz Kylheku2015-09-093-4/+39
| | | | | | | | | | | | | | | | | | | | | | | | | On Solaris 10, we need __EXTENSIONS__ defined to make struct winsize appear out of <termios.h>. This commit adds detection for what preprocessor symbol needs to be defined for struct winsize to appear, if it appears at all. Then this symbol is defined on the compiler command line when compiling linenoise. * Makefile (CFLAGS): Add -D$(termios_define) for linenoise.o target. * configure (have_winsize, termios_define): New variables. Detect whether struct winsize is available, and what preprocessor symbol, if any, is required to reveal the feature. * linenoise/linenoise.c: Need to include TXR's "config.h" for HAVE_WINSIZE. (get_columns): Reorganized so that use of struct winsize is guarded by HAVE_WINSIZE and fallback code is used if either obtaining the size fails or the feature is completely unavailable.
* alloca needs to be declared.Kaz Kylheku2015-09-091-0/+1
| | | | * parser.c: #include ALLOCA_H.
* Wrap call to repl with #if HAVE_TERMIOS.Kaz Kylheku2015-09-091-0/+2
| | | | | * txr.c (txr_main): The repl funtion is not declared unless HAVE_TERMIOS is present and nonzero.
* linenoise: remove input-viewing debug function.Kaz Kylheku2015-09-093-32/+0
| | | | | | | | | | | | This is unused code which just addds to the executable size. Also it passes a char to isprint, which is undefined behavior if that char happens to be negative. * linenoise/example.c (main): Remove --keycodes option and reference to lino_print_keycodes function. * linenoise/linenoise.c, linenoise/linenoise.h (lino_print_keycodes): Function removed.
* Missing termination and else clause in configure.Kaz Kylheku2015-09-091-0/+4
| | | | | | * configure: If we don't have alloca, we must not only print "no", but bail, because we depend on it now. If termios is not found, print no.
* linenoise: don't touch OPOST termios output flag.Kaz Kylheku2015-09-081-2/+1
| | | | | | * linenoise/linenoise.c (enable_raw_mode): Do not clear the OPOST output flag. It is implementation-defined, and if it is set, it is probably set for a good reason.
* linenoise: stray printf on stdout.Kaz Kylheku2015-09-081-2/+5
| | | | | * linenoise/linenoise.c (linenoise): Replace printf("\n") with one-character write on ls->ofd.
* linenoise: don't flush tty input when changing mode.Kaz Kylheku2015-09-081-2/+2
| | | | | | | * linenoise/linenoise.c (enable_raw_mode, disable_raw_mode): Use TCSANOW instead of TCSAFLUSH to change tty settings without flushing input. TCSAFLUSH could discard type-ahead-buffered keystrokes.
* Refinement in linenoise eof/intr handling.Kaz Kylheku2015-09-081-3/+10
| | | | | | | | * parser.c (repl): Rather than breaking out of the loop when linenoise indicates lino_eof, break out of the loop for any error not equal to lino_intr. If the termination was due to other than lino_eof, print an error message.
* linenoise: stdin fd closed bug in !isatty case.Kaz Kylheku2015-09-081-1/+4
| | | | | | * linenoise/linenoise.c (linenoise): Of course, we must up ls->ifd and fdopen the dup, because fdopen closes the descriptor.
* Documented interactive listener.Kaz Kylheku2015-09-081-0/+343
|
* linenoise: eliminate silly CTRL_<letter> constants.Kaz Kylheku2015-09-081-32/+18
| | | | | | | * linenoise/linenoise.c (CTL): New macro. (enum key_action): Removed CTRL_ members. (edit): Replace CTRL_A with CTL('A') and similarly for all others.
* Bugfix: underrun on empty line tab completion.Kaz Kylheku2015-09-081-1/+4
| | | | | | | * parser.c (provide_completions): If strlen(data) is zero, the calculation of ptr places it at data - 1. Instead, let us calculate a zero value for ptr and then bail based on this.
* linenoise: Ctrl-U deletes only to the left.Kaz Kylheku2015-09-081-4/+11
| | | | | | | | | | | Ctrl-U does not traditionally delete the entire line in line editors or text editors. Rather, it is a "super backspace" to the beginning of the line. * linenoise/linenoise.c (edit_delete_prev_all): New static function. (edit): Replace CTRL_U action with call to edit_delete_prev_all.
* linenoise: expand tabs to spaces instead of ^I.Kaz Kylheku2015-09-081-4/+10
| | | | | | | | | | * linenoise/linenoise.c (LINENOISE_MAX_LINE): Reduced to 1024. (LINENOISE_MAX_DISP): Now 8 times LINENOISE_MAX_LINE because the worst case is that the line contains only tabs, which expand to eight spaces. (sync_data_to_buf): Use character constants instead of hard coded values. Check for tab, and expand to spaces up to the next modulo 8 tab position.
* linenoise: delete word recognizes tabs as space.Kaz Kylheku2015-09-081-2/+3
| | | | | | * linenoise/linenoise.c (SPACE): New preprocessor symbol. (edit_delete_prev_word): Use strchr to check for spaces and tabs.
* linenoise: remove history and TODO list from comment.Kaz Kylheku2015-09-081-64/+0
|
* Allow runaway lazy list computation to be interrupted.Kaz Kylheku2015-09-081-0/+4
| | | | | | * lib.c (car, cdr, car_l, cdr_l): Check for signal before calling forcing function of a lazy cons.
* New functions, subtypep and typep.Kaz Kylheku2015-09-085-1/+203
| | | | | | | | | | | | | | | | * eval.c (eval_init): Register subtypep and typep. * eval.h (list_s): Existing variable declared. * lib.c (atom_s, integer_s, number_s, sequence_s, string_s): new symbol variables. (subtypep, typep): New functions. (obj_init): Initialize new symbol variables. * lib.c (atom_s, integer_s, number_s, sequence_s, string_s): Declared. * txr.1: Documented type hierarchy and the new functions.
* Random states of type random-state, not *random-state*.Kaz Kylheku2015-09-084-5/+26
| | | | | | | | | | | | | | | * 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.
* Don't report unbound var errors against wrong form.Kaz Kylheku2015-09-081-2/+5
| | | | | | | | | | | 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.
* Debugger and compatibility now major sections.Kaz Kylheku2015-09-071-5/+7
| | | | | * txr.1: Debugger and Compatibility are moved out of the TXR library description, into their own major sections.
* Load and save repl history.Kaz Kylheku2015-09-073-1/+16
| | | | | | | | | | * 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: Ctrl-Z suspend.Kaz Kylheku2015-09-071-0/+8
| | | | | * linenoise.c (key_action): New enum constant, CTRL_Z. (edit): Implement Ctrl-Z suspend.
* Print exceptions with proper indenting.Kaz Kylheku2015-09-071-9/+7
| | | | | * parser.c (repl): Use format to print exception, and use ~! to ensure indentation.
* Don't show whole function definition in args mismatch.Kaz Kylheku2015-09-071-4/+11
| | | | | | * 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.
* Remove stray debug print (TXR 113).Kaz Kylheku2015-09-071-1/+1
| | | | | * lib.c (callerror): Remove accidentally committed debug print, present from the time the function was introduced.
* TXR 105 regression: real-time stream not used on tty.Kaz Kylheku2015-09-071-6/+11
| | | | | | | | | | | | | | | | | 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.
* Go into repl after processing txr file also.Kaz Kylheku2015-09-073-8/+16
| | | | | | | | | | | * 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.
* Enter repl after processing options and loading file.Kaz Kylheku2015-09-071-3/+15
| | | | | * txr.c (txr_main): i option sets a flag only, processed later in the function.
* kill function returns boolean rather than integer.Kaz Kylheku2015-09-072-2/+16
| | | | | | | | * 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.
* Adding raise function.Kaz Kylheku2015-09-072-0/+24
| | | | | | | * signal.c (raise_wrap): New static function (sig_init): Register raise intrinsic. * txr.1: Documented raise.
* Better message for caught exceptions.Kaz Kylheku2015-09-071-1/+1
| | | | | * parser.c (repl): Use ** prefix on caught exception message. Clearly indicate that the second value is args.
* Store exception in repl variable.Kaz Kylheku2015-09-071-2/+3
| | | | | | | * 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.
* Don't use prot1 for temporary gc protection.Kaz Kylheku2015-09-073-31/+13
| | | | | | | | | | | | * 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.
* Reset flex scanner if exception thrown during read.Kaz Kylheku2015-09-062-1/+23
| | | | | | | | | | | | | | 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.
* Repl will print something for syntax error exceptions.Kaz Kylheku2015-09-061-1/+1
| | | | | | * parser.c (repl): Print a simple fixed message when a syntax error exception is caught, just so the fact is noted.
* Manage intr count in the face of exceptions.Kaz Kylheku2015-09-061-2/+8
| | | | | | * signal.c (sig_handler): Make sure the interrupt_count is restored to the value on entry into the handler if the lambda throws.
* Bugfix: sig_mask not calling into the OS.Kaz Kylheku2015-09-061-1/+10
| | | | | | | | | | | | | | | | | | 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: STDIN_FILENO used as pointer.Kaz Kylheku2015-09-061-2/+2
| | | | | | | | * 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.
* linenoise: use checked allocator for strdup.Kaz Kylheku2015-09-063-4/+14
| | | | | | | | | | * 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.
* linenoise: remove bogus suport for crap terminals.Kaz Kylheku2015-09-061-55/+30
| | | | | | | | | | | | | 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.
* Allow evaluation from repl to be interrupted.Kaz Kylheku2015-09-063-1/+18
| | | | | | | | | | | * 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.
* Distinguish interrupt indication from linenoise.Kaz Kylheku2015-09-061-2/+6
| | | | | | * parser.c (repl): If linenoise returns a null pointer, but the last error is lino_eof, print "** intr" message and continue; do not quit.