| Commit message (Collapse) | Author | Age | Files | Lines |
... | |
|
|
|
|
|
|
|
|
|
|
|
|
|
| |
* eval.c (run_load_hooks): Install the given environment as dyn_env
temporarily, and don't restore it until after calling the hooks.
Thus the specified environment is now in effect when running the
hooks. Also, pass nil to lookup_var, in the spirit of the previous
commit. The fact that load_dyn_env had to be passed to lookup_var
previously, which is an anti-pattern, tells us that this scoping rule
was a code smell. If the *load-hooks* value comes from a given
dynamic environment, then those functions should be executed in
exactly that environment.
* txr.1: Documentation updated.
|
|
|
|
|
|
|
|
|
|
|
|
|
| |
Since lookup_var(nil, ...) skips the environment and goes for dyn_env,
there is no need to pass dyn_env explicitly; it's a bit of an
anti-pattern. The argument is intended for lexical scopes.
* eval.c (eval_exception, expand_eval, load): Pass nil to lookup_var
instead of the current dynamic environment.
* match.c (v_load): Likewise.
* parser.c (txr_parse, read_eval_ret_last): Likewise.
|
|
|
|
|
|
|
|
|
|
|
|
|
| |
* eval.c (me_push_after_load, me_pop_after_load): New static
functions.
(eval_init): Register push-after-load and pop-after-load
intrinsic macros.
* tests/019/load-hook.tl: Tests for correct expansion.
* txr.1: Documented.
* stdlib/doc-syms.tl: Updated.
|
|
|
|
|
|
|
|
|
|
|
|
| |
* eval.c (eval_init): Register delcons intrinsic.
* lib.[ch] (delcons): New function.
* tests/010/cons.tl: New file.
* txr.1: Documented.
* stdlib/doc-syms.tl: Updated.
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| |
*load-hooks* lets a .txr, .tl or .tlo file specify actions to be taken
when the loading of that file completes, whether normally or via
an exception. They are also honored by process exit.
For instance, with this, we can have a Lisp file that behaves like
a script which cleans up after itself (e.g. removing temporary files)
even if it is not run as a stand-alone program, but invoked
via (load ...). Because it's not a stand-alone program, it cannot
simply use the at-exit-call mechanism. The unwind-protect operator could
be used, but it's inconvenient because it protects a single form.
The *load-hooks* feature in effect protects all the top level forms of a
load, similarly to unwind-protect. Also, unwind-protect does not
guard against a process exit. (However, *load-hooks* does not guard
against an abnormal exit, only normal termination).
* eval.c (load_hooks_s): New symbol variable.
(run_load_hooks): New function.
(run_load_hooks_atexit): New static function.
(load): bind *load-hooks* to nil around load. Implement
the hooks processing via run_load_hooks, taking care to pass the
load-time dynamic environment that has already been undone.
(eval_init): Initialize load_hooks_s and register the *load-hooks*
variable. Register run_load_hooks_atexit with atexit, so the
current value of *load-hooks* is processed on process exit.
* eval.h (load_hooks_s, run_load_hooks): Declared.
* match.c (v_load): Similar changes as in load.
* txr.c (txr_main): Run the load hooks with run_load_hooks immediately
after processing the .txr or .tl file, before entering the listener.
* tests/019/load-hook.tl: New directory and file
* tests/load-hook.tl: New file.
* txr.1: Documented.
* stdlib/doc-syms.tl: Updated.
|
|
|
|
|
|
|
|
|
| |
* libtags.txr: use git ls-files instead of glob to
obtain list of .c files. This also means that we go into
subdirectories now, since git ls-files '*.c' lists items like
linenoise/linenoise.c and chksums/md5.c. For now, we are not
finding any new tags in these places, but in the future that
could change.
|
|
|
|
|
|
|
|
|
|
|
| |
The open-compile-streams function was calling trim-right with the
arguments in the wrong order, resulting in an output path equal
to the suffix of the input path.
Regression introduced in 8d8fee2e506806d9c117b17432ef3a5ec0d6f457.
* stdlib/compiler.tl (open-compile-streams): Swap in-path and
suff arguments in trim-right call.
|
|
|
|
|
|
|
| |
* libtags.txr: Use @(mdo) for defining variables and
structures, so this is done as libtags.txr is parsed.
The remaining top-level actions are split off in a
separate @(do ...) placed later.
|
|
|
|
| |
* libtags.txr: New file. This is a work in progress.
|
|
|
|
|
|
|
|
|
|
| |
* RELNOTES: Updated.
* configure (txr_ver): Bumped version.
* stdlib/ver.tl (lib-version): Bumped.
* txr.1: Bumped version and date.
|
|
|
|
|
| |
* tests/012/iter.tl: Several new cases to provide some
coverage in recently fixed areas. All of these break in 268.
|
|
|
|
|
|
| |
It should be sub-buf.
* txr.1: buf-sub -> sub-buf.
|
|
|
|
|
|
| |
slet is a stronger form of rlet, not weaker.
* txr.1: weaker -> stronger.
|
|
|
|
|
|
|
|
| |
They were forgotten in commit 1fb6f6691d5b6fb6b037bb14073694f651f2b9fc.
* stdlib/ffi.tl (carray-sub, sub-buf): Remove binding which
ensures the new value is evaluated only once (defset does this
already).
|
|
|
|
|
| |
* Makefile (SRCS): Fix mixture of tabs and spaces, and bad
alignment, reported by Paul A. Patience.
|
|
|
|
|
|
|
| |
* stream.c (w_fopen_mode): Only test the m.create flag as the
basis for O_CREAT, not m.append.
(do_parse_mode): In the 'a' case, set m.create = 1, since all
variants of append mode create the file.
|
|
|
|
|
|
|
|
|
|
|
|
| |
* stream.h (struct stdio_mode): New member, excl flag.
(stdio_mode_init_blank, stdio_mode_init_r, stdio_mode_init_rpb):
Add initializer for excl flag.
* stream.c (do_parse_mode): Handle 'x' in mode string.
(w_fopen_mode): Add O_EXCL flag if m.excl is set. Throw an error
if we don't HAVE_FCNTL and m.excl is set.
* txr.1: Document mode option "x".
|
|
|
|
|
|
|
|
| |
The "w+", "m+" and "a+" modes wouldn't create the file.
* stream.c (w_fopen_mode): Add O_TRUNC and O_CREAT flags if
m.create or m.append is set, rather than if m.read is unset and
m.write is set.
|
|
|
|
|
|
| |
* lib.c (seq_iter_init_with_info): The to value in a range
could be a bignum, which we should treat as a bignum range,
rather than blowing up due to calling c_num on that value.
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| |
* lib.h (struct seq_iter_ops): New operation, mark.
(seq_iter_ops_init): Default the mark operation to
seq_iter_mark_op.
(seq_iter_ops_init_nomark): New macro.
* lib.c (seq_iter_mark_op): New static function.
(si_range_cnum_ops, si_range_chr_ops, si_rev_range_cnum_ops,
si_rev_range_chr_ops, si_chr_ops): Initialize with
seq_iter_ops_init_nomark so that the iterator has no mark
operation. All other iterator types have the above new static
function as their mark op.
(seq_iter_mark): Simplified: if the iterator has a mark op,
call it.
(seq_next, iter_step): If the iterator has a mark op, that
means that the seq_get operation is likely replacing one heap
object with another, and so mut(iter) must be called to inform
the garbage collector of the assignment.
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| |
This is needed in preparation for fixing some gc
bugs in iteration in a less hacky way.
* lib.h (struct seq_iter): Members get and peek removed,
replaced by ops pointer.
(struct seq_iter_ops): New struct type.
(seq_get, seq_peek): Call get and peek through ops table.
* lib.c (seq_geti): Refer to get through ops.
(si_null_ops, si_list_ops, si_vec_ops, si_hash_ops,
si_tree_ops, si_range_cnum_ops, si_range_chr_ops,
si_range_bignum_ops, si_range_str_ops, si_rev_range_cnum_ops,
si_rev_range_chr_ops, si_rev_range_bignum_ops,
si_rev_range_str_ops, si_chr_ops, si_num_ops, si_oop_ops,
si_fast_oop_ops): New static structures.
(seq_iter_init_with_info): Point new ops member of seq_iter to
one of the new structures. Remove initializations of get and
peek.
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| |
* RELNOTES: Updated.
* configure (txr_ver): Bumped version.
* stdlib/ver.tl (lib-version): Bumped.
* txr.1: Bumped version and date.
* txr.vim, tl.vim: Regenerated.
* protsym.c: Likewise.
|
|
|
|
| |
* txr.1: fix .SS to .SS*.
|
|
|
|
|
|
|
|
| |
The "+" mode string should be equivalent to "r+", according to
the manual, but before this change it was equivalent to "r".
* stream.c (do_parse_mode): Unconditionally set m.write to 1
when "+" is present in the mode string.
|
|
|
|
|
| |
* tests/017/mmap.tl: Use the new random-buf function instead
of converting pseudo-random bignums to a buffer.
|
|
|
|
|
|
|
|
|
|
|
| |
* rand.c (random_buf): New function.
(rand-init): random-buf intrinsic registered.
* rand.h (random_buf): Declared.
* txr.1: Documented.
* stdlib/doc-syms.tl: Updated.
|
|
|
|
| |
* itypes.[ch] (c_size): New function.
|
|
|
|
|
|
|
|
|
|
|
| |
* rand.c (random): The msb_rand_mask calculation shifts by 32
when msb_rand_bits is zero, like when the modulus is
(expt 2 32). By fluke, this has been treated as a zero bit
shift on 64 bit intel, so the correct mask was calculated.
However, in a PPC64 build, it yields zero. Instead, we
calculate the required shift by negating the bit count, in
unsigned semantics, and then reducing modulo 32. This gives us
the correct value from 0 to 31, resulting in the correct mask.
|
|
|
|
|
|
|
| |
* tests/017/mmap.tl: The random buffer procedure can generate
buffers which are too small, because the random integer values
are anywhere from 0 to the modulus. This showed up up on
PPC-64 with 65536 byte pages.
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| |
Instead of byte reads/writes, we use byte order swapping.
Reads and writes that are aligned take place as a single
data transfer, which makes it possible to use these
be/le types for accessing hardware registers. This is useful
in systems where the host processor accesses the bus
in opposite endian relative to some peripheral.
Moreover, when the functions match the local endian, we just
use the native get/put functions via #define macro
redirection.
The source code size is reduced.
* ffi.c (ffi_swap_u16, ffi_swap_u32, ffi_swap_u64,
ffi_swap_i16, ffi_swap_i32, ffi_swap_i64): New static functions.
(ffi_swap_i16_put, ffi_swap_i16_get, ffi_swap_u16_put,
ffi_swap_u16_get, ffi_swap_i32_put, ffi_swap_i32_get,
ffi_swap_u32_put, ffi_swap_u32_get, ffi_swap_i64_put,
ffi_swap_i64_get, ffi_swap_u64_put, ffi_swap_u64_get): New
static functions.
(ffi_be_i16_put, ffi_be_i16_get, ffi_be_u16_put,
ffi_be_u16_get, ffi_be_i32_put, ffi_be_i32_get,
ffi_be_u32_put, ffi_be_u32_get, ffi_be_i64_put,
ffi_be_i64_get, ffi_be_u64_put, ffi_be_u64_get,
ffi_le_i16_put, ffi_le_i16_get, ffi_le_u16_put,
ffi_le_u16_get, ffi_le_i32_put, ffi_le_i32_get,
ffi_le_u32_put, ffi_le_u32_get, ffi_le_i64_put,
ffi_le_i64_get, ffi_le_u64_put, ffi_le_u64_get): Functions
deleted, replaced by same-named #define macros to redirect to
the native functions or the _swap_ functions based on the
endian.
(ffi_be_i16_rput, ffi_be_i16_rget, ffi_be_u16_rput,
ffi_be_u16_rget, ffi_be_i32_rput, ffi_be_i32_rget,
ffi_be_u32_rput, ffi_be_u32_rget, ffi_le_i16_rput,
ffi_le_i16_rget, ffi_le_u16_rput, ffi_le_u16_rget,
ffi_le_i32_rput, ffi_le_i32_rget, ffi_le_u32_rput,
ffi_le_u32_rget): Functions wrapped with #if in case these
exact width types don't exist.
(ffi_init_types): Wrap some exact-width-type type definitions
with #if in case the types don't exist.
|
|
|
|
|
|
|
| |
* tests/007/except-4.txr: This new test case does not work on
Solaris 10 because a shell script that kills itself via
kill $$ appears to be terminating successfully with an exit
status of 208, not appearing to be killed by a signal.
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| |
Solaris 10's <sys/mman.h> header doesn't declare madvise if
_POSIX_C_SOURCE > 2 is defined or _XPTG4_2, even though
__EXTENSIONS__ is defined. This is a bug in the header.
* configure (solaris_target): New variable. We set this to y
in several places where the script discovers that
-D__EXTENSIONS__ is required to get something to work, which
is a Solaris 10 telltale sign. Then just before the mmap test,
if solaris_target is true, we deposit a blurb into config.h
that declares madvise. This way, the ffi.c code, or any other
committed C code doesn't have to carry any Solaris hack.
|
|
|
|
|
|
| |
* tests/017/mmap.tl: On BSD, the map-anon test case where we
don't specify map-private or map-shared doesn't result in an
invalid argument error; a mapping is produced.
|
|
|
|
|
| |
* txr.1: Fix the neglect to specify that the daemon function's
arguments are Boolean values, rather than integers.
|
|
|
|
|
|
| |
* txr.1: Prompted by a sentence with faulty grammar, improving
the description of the table which summarizes the semantics of
the nine range operators.
|
|
|
|
|
|
|
|
|
|
| |
* ffi.c (carray_pun): Takes two new arguments to specify
displacement and size.
(ffi_init): Registration of carray-pun adjusted.
* ffi.h (carray_pun): Declaration updated.
* txr.1: Documented.
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| |
* configure: configure test for mmap depositing HAVE_MMAP into
config.h.
* ffi.c (struct carray): Subject to HAVE_MMAP, new mm_len
member which keeps track of the size of an underlying mapping
so that we can unmap it, as well as peform operations like
msync on it.
(make_carray): Initialize mm_len to 0.
(MAP_GROWSDOWN, MAP_LOCKED, MAP_NORESERVE, MAP_POPULATE,
MAP_NONBLOCK, MAP_STACK, MAP_HUGETLB, MAP_SHARED, MAP_PRIVATE,
MAP_FIXED, MAP_ANON, MAP_HUGE_SHIFT, MAP_HUGE_MASK, PROT_READ,
PROT_WRITE, PROT_EXEC, PROT_NONE, PROT_GROWSDOWN,
PROT_GROWSUP, MADV_NORMAL, MADV_RANDOM, MADV_SEQUENTIAL,
MADV_WILLNEED, MADV_DONTNEED, MADV_FREE, MADV_REMOVE,
MADV_DONTFORK, MADV_DOFORK, MADV_MERGEABLE, MADV_UNMERGEABLE,
MADV_HUGEPAGE, MADV_NOHUGEPAGE, MADV_DONTDUMP, MADV_DODUMP,
MADV_WIPEONFORK, MADV_KEEPONFORK, MADV_HWPOISON, MS_ASYNC,
MS_SYNC, MS_INVALIDATE): #define as 0 if missing.
(carray_munmap_op): New static function.
(carray_mmap_ops): New static structure.
(mmap_wrap, munmap_wrap): New functions.
(mmap_op): New static function.
(mprotect_wrap, madvise_wrap, msync_wrap): New functions.
(ffi_init): Register mmap, munmap, mprotect, madvise and msync
as well as numerous integer variables: map-growsdown,
map-locked, map-noreserve, map-populate, map-nonblock,
map-stack, map-hugetlb, map-shared, map-private, map-fixed,
map-anon, map-huge-shift, map-huge-mask, prot-read,
prot-write, prot-exec, prot-none, prot-growsdown,
prot-growsup, madv-normal, madv-random, madv-sequential,
madv-willneed, madv-dontneed, madv-free, madv-remove,
madv-dontfork, madv-dofork, madv-mergeable, madv-unmergeable,
madv-hugepage, madv-nohugepage, madv-dontdump, madv-dodump,
madv-wipeonfork, madv-keeponfork, madv-hwpoison, ms-async,
ms-sync, ms-invalidate, page-size.
* ffi.h (mmap_wrap, munmap_wrap, mprotect_wrap madvise_wrap,
msync_wrap): Declared.
* tests/017/mmap.tl: New file.
* txr.1: Documented.
* stdlib/doc-syms.tl: Updated.
|
|
|
|
| |
* txr.1: Fix cond to codn.
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| |
In this patch we allow the s in (sub s from to) and [s from..to]
to be any iterable.
* lib.c (iter_dynamic, sub_iter): New static function.
(generic_funcall): Handle all objects via the sequence case:
ref, sub and all that. Unfortunately, we lose some error
handling at the level of the sub function. But we allow any
iterable to be passed through to sub.
(sub): Handle default case through sub_iter.
* tests/012/iter.tl: New cases.
* txr.1: Documented.
|
|
|
|
|
|
|
|
| |
* lib.c (seq_iter_init_with_info): Allow the iterated object
to be an iterator, in which case a copy of the iterator is
set up.
* txr.1: Documented.
|
|
|
|
|
|
|
|
| |
* lib.c (sub_list): If from is t, then just return nil.
Do not reset it to nil in this case. After this we know from
is not nil; we don't have to check for this inside one
loop. That loop was wastefully iterating over the list in the
from == nil case only to calculate nil.
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| |
Ranges like "AAA".."ZZZ" are now possible.
* lib.c (seq_iter_get_range_str, seq_iter_peek_range_str,
seq_iter_get_rev_range_str): New static functions.
(seq_iter_init_with_info): Support string ranges via above
new functions. Range direction test is now done with less
and equal rather than lt and gt.
* tests/012/iter.tl: New file.
* txr.1: Documented.
|
|
|
|
| |
* eval.c (me_ecase): Diagnose missing test form, like me_case.
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| |
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.
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| |
* stdlib/match.tl (must-match): Renamed to just match.
It's just when-match without the "when".
(must-match-case): Renamed to match-ecase, consistent
with the case -> ecase naming scheme.
* lisplib.c (match_set_entries): Names updated here.
* tests/011/patmatch.tl: Test cases updated.
* txr.1: Names updated here.
* stdlib/doc-syms.tl: Updated.
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| |
* hash.c (struct hash): modulus and count change from cnum to
ucnum.
(hash_mark, hash_grow, copy_hash, do_weak_tables): Use ucnum
local vars.
(do_make_hash, make_similar_hash): Use c_unum to obtain modulus.
(gethash_c, gethash_e): Use & masking operation to reduce hash
value to table size.
(remhash): Move sanity check before decrement since unsigned
value can't go below zero.
(clearhash): Use ucnum and c_unum.
(hash_iter_peek): Use ucnum for chain count local.
* hash.h (struct hash_iter): chain changes from cnum to ucnum.
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| |
Even prior to discovering the recent defect in deffi, which
was caused by a missing case in caseql, combined with poor
testing, I was already thinking about adding ecase macros.
The introduction of must-match and must-match-case also shows
my motivation. That deffi bug convinced me to take action
and implement these.
* eval.c (case_error_s) New symbol variable.
(me_ecase): New static function.
(eval_init): Register new intrinsic macros ecaseq, ecaseql,
ecasequal, ecaseq*, ecaseql* and ecasequal*.
Intern case-error and initialize case_error_s.
* txr.1: Documented. Also updated Exception Hierarchy diagram
with match-error and case-error.
* stdlib/doc-syms.tl: Updated.
|
|
|
|
|
|
|
| |
* eval.c (eval_init): Numerous macros share the same implementation
function, and their registrations make wasteful repeated func_f2 calls
to hoist that function from C to Lisp more than once. Let's go through
and condense all of them.
|