| Commit message (Collapse) | Author | Age | Files | Lines |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| |
* 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.
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| |
Gone is the need for :vars to inform @(repeat)/@(rep) about
variable references buried in Lisp.
* eval.c (expand_with_free_refs): Change to external linkage.
* eval.h (expand_with_free_refs): Declared.
* parser.y (extract_vars): Handle sys:expr forms, which are
embedded Lisp via expand_with_free_refs to uncover their free
variables.
* txr.1: Redocumented this area.
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| |
The noreturn macro is respelled to harmonize with the
upper-case INLINE and NOINLINE.
* lib.h (noreturn): Rename to NORETURN.
* arith.c (not_number, not_integer, invalid_ops, invalid_op):
Declaration updated.
* arith.c (do_mp_error): Likewise.
* eval.c (eval_error, no_bindable_error, dotted_form_error):
Likewise.
* eval.h (eval_error): Likewise.
* lib.c (unsup_obj, callerror, wrongargs): Likewise.
* match.c (sem_error): Likewise.
* stream.c (unimpl, unimpl_put_string, unimpl_put_char,
unimpl_put_byte, unimpl_get_line, unimpl_get_char,
unimpl_get_byte, unimpl_unget_char, unimpl_unget_byte,
unimpl_put_buf, unimpl_fill_buf, unimpl_seek, unimpl_truncate,
unimpl_get_sock_family, unimpl_get_sock_type,
unimpl_get_sock_peer, unimpl_set_sock_peer): Likewise.
* struct.c (no_such_struct, no_such_slot,
no_such_static_slot): Likewise.
* unwind.h (jmp_restore, uw_throw, uw_throwf, uw_errorf,
uw_errorfv, type_mismatch): Likewise.
|
|
|
|
|
|
|
|
|
|
|
|
| |
* arith.h (minus_s): Declared.
* eval.c (reg_symacro): Changing to external linkage.
* eval.h (macro_time_s, reg_symacro): Declared.
* parser.c (repl): Bind the *-1 to *-20 symbol macros.
* txr.1: Documented.
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| |
* 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.
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| |
A crash occurs on Ubuntu 18.04, 32 bit x86, when executing the
test case tests/007/except-2.txr, whereby TXR segfaults in the
v_try function.
This is reminiscent of a January, 2016 report in the txr-users
mailing list from Morit Barsnick, who also ran into a crash in
the same test case.
Background: it appears that the compiler in Ubuntu 18.04
enables PIE (position-independent executables) by default. Thus
even simple executables that are not shared libraries
reference their own global variables through an offset table,
instead of direct addressing. To access globals, the compiler
has to emit code that retrieves their addresses from a table,
pulling them into a register, and then performing indirect
memory accesses through the register. Sometimes the emitted
code doesn't keep these addresses in a register. The address
of a global variable accessed multiple times in a block of
code may get spilled from a register into the stack, and then
later retrieved from the stack again to access that same
global.
In our extended_setjmp logic, we save the values of a few
global variables and restore them if the extended_longjmp
takes place to return to that point. The problem is that when
restoring some of the globals, the compiler is relying on
retrieving the effective addresses from the temporary spill
locations in the stack. However, those temporary locations
have since been re-used for other purposes and the access to
the globals therefore crashes or produces unpredictable
results.
Essentially, it's as if GCC did this around our code:
{
unsigned *debug_enable_addr = &debug_enable;
/* save and restore logic here uses *debug_enable_addr
* to refer to debug_enable
*/
if (extended_setjmp(...))
...
}
/* Oops, debug_enable_addr is now garbage!
* We are jumping back into the scope which will try to use
* its value to restore the debug_enable global.
*/
extended_longjmp(...);
I have experimented with a few approaches that did not work, and settled
on moving the code which saves and restores the globals into functions.
GCC will not cache the effective address calculation of a global
variable access between calls to different external functions which
access that variable.
The mitigation in this commit gets the test cases to pass even
if TXR is compiled with PIE. However, PIE should be disabled.
Not only does it cause the above problem, but it has a huge
performance impact: a more than 16% slowdown, which is quite
unacceptable.
* eval.h (dyn_env): Delare here. Some sources were depending on signal.h
providing this, which is wrong. Now signal.h doesn't declare it any
longer.
* signal.h (EJ_DBG_SAVE, EJ_DBG_REST): Macros removed.
(extended_setjmp): Greatly simplified. Extended restoring logic is now
done in extended_longjmp, and the extended save for the globals
is a function call. Just moving the restore into extended_longjmp
probably would have fixed this issue.
(extended_longjmp): Call extjmp_restore.
(extjmp_save, extjmp_restore): Declared.
* unwind.c (extjmp_save, extjmp_restore): New functions.
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| |
* eval.c (tree_lit_s, tree_construct_s): New symbol variables.
(expand_qquote_rec): Handle sys:tree-lit syntax generated by
quasi-quoted #T notaton by expanding and converting to
sys:tree-constuct call.
(eval_init): Initialize tree_lit_s and tree_construct_s.
* eval.h (tree_lit_s, tree_construct_s): Declared.
* parser.y (tree): Produce sys:tree-lit syntax when #T is
quasi-quoted, and unquotes occur inside it.
* tree.c (tree_construct_fname, tree_construct): New static
functions.
(tree_init): Register sys:tree-construct intrinsic function.
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| |
Adding binary search trees based on the new tnode cell. The
scapegoat algorithm is used, which requires no additional
storage in a cell. In the future we may go to something else,
like red-black trees, and carve out a bit in the tag field
of the cell for the red/black color.
Tree cells store only single key objects, not key/value pairs.
However, which part of the key object is compared is
determined by a custom key function stored in the tree
container. For instance, tree nodes can be cons cells, and car
can be used as the key function; the cdr then stores an
associated value.
Trees have a printed notation
#T(<props> <key>*)
where <props> is a list of up to three items:
<props> ::= ([<key-fn> [<less-fn> [<equal-fn>]]])
key-fn, less-fn and equal-fn are function names.
If they are missing or nil, they default, respectively, to
identity, less and equal.
For security, the printed notation is machine-readable only if
these options are symbols, not lambda expressions.
Furthermore, the symbols must be listed in the special
variable *tree-fun-whitelist*.
* eval.c (less_s): New symbol variable.
(eval_init): Initialize less_s.
* eval.h (less_s): Declard.
* parser.h (grammar): New #T token recognized, mapped to
HASH_T.
* parser.y (HASH_T): New terminal symbol.
(tree): New non-terminal symbol.
(i_expr, n_expr): Add tree to productions.
(fname_helper): New static function.
(yybadtoken): Map HASH_T to "#T".
* protsym.c: Tweaked accidentally; remove.
* tree.c (TREE_DEPTH_MAX): New macro.
(struct tree): New struct type.
(enum tree_iter_state): New enumeration.
(struct tree_iter): New struct type.
(tree_iter_init): New macro.
(tree_s, tree_fun_whitelist_s): New symbol variables.
(tn_size, tn_size_one_child, tn_lookup, tn_find_next,
tn_flatten, tn_build_tree, tr_rebuild,
tr_find_rebuild_scapegoat, tr_insert, tr_lookup, tr_do_delete,
tr_delete, tree_insert_node, tree_insert, tree_lookup_node,
tree_lookup, tree_delete, tree_root, tree_equal_op,
tree_print_op, tree_mark, tree_hash_op): New static functions.
(tree_ops): New static struct.
(tree): New function.
(tree_init): Initialize tree_s and tree_fun_whitelist_s symbol
variables. Register intrinsic functions tree,
tree-insert-node, tree-insert, tree-lookup-node, tree-lookup,
tree-delete, tree-root. Register special variable
*tree-fun-whitelist*.
* tree.h (tree_s, tree_fun_whitelist_s, tree): Declared.
(tree_fun_whitelist): New macro.
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| |
This patch adds special unwind frames for backtracing
expansions. With this, we can get rid of the global variable
last_form_expanded, since to get the last form expanded, we
just search for the most enclosing expand frame.
* eval.c (last_form_expanded): Global variable removed.
(error_trace): Use uw_last_form_expanded() instead of
last_form_expanded.
(expand_eval): No need to save and restore
last_form_expanded any more.
(expand_lisp_setq, expand_setqf, expand_lisp1, do_expand): Use
uw_last_form_expanded().
(expand, do_macroexpand_1): Push and pop expand frame.
This fixes a bug: do_macroexpand_1 was not recording
last_form_expanded. Evaluation of top-level forms uses
explicit macroexpansion, therefore top-level evaluation was
neglecting to set last_form_expanded.
This explains weird behavior I saw in the listener from
time to time, when errors would report against the expansion
of the wrong form.
(eval_init): Remove reference to last_form_expanded variable.
* eval.h (last_form_expanded): Declaration removed.
* share/txr/stdlib/debug.tl (expand-frame print-trace,
expand-frame loc): New methods.
(print-backtrace): Include uw-expand frames in the backtrace.
* unwind.c (expand_frame_type): New static variable.
(uw_find_frames_by_mask): Handle UW_EXPAND.
(uw_last_form_expanded, uw_push_expand): New functions.
(uw_late_init): Register expand-frame struct type.
* unwind.h (enum uw_frtype): New enum member, UW_EXPAND.
(uw_last_form_expanded, uw_push_expand): Declared.
|
|
|
|
|
|
|
|
|
|
| |
* eval.c (struct_s): Now defined here.
(eval_init): struct now interned here.
* eval.h (struct_s): Declared.
* ffi.c (struct_s): Definition removed.
(ffi_init) struct no longer interned here.
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| |
* LICENSE, LICENSE-CYG, METALICENSE, Makefile, args.c, args.h,
arith.c, arith.h, buf.c, buf.h, cadr.c, cadr.h, combi.c,
combi.h, configure, debug.c, debug.h, eval.c, eval.h, ffi.c,
ffi.h, filter.c, filter.h, ftw.h, gc.c, gc.h, glob.c, glob.h,
hash.c, hash.h, itypes.c, itypes.h, jmp.S, lib.c, lib.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/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/path-test.tl,
share/txr/stdlib/place.tl, share/txr/stdlib/pmac.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, 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 line to 2018.
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| |
* eval.c (deep_copy_env): New function.
(eval_init): Register copy-fun intrinsic.
* eval.h (deep_copy_env): Declared.
* lib.c (copy_fun): New function.
* lib.h (copy_fun): Declared.
* vm.c (vm_copy_closure): New function.
* vm.h (vm_copy_closure): Declared.
* txr.1: Documented copy-fun.
|
|
|
|
|
|
|
|
|
| |
* eval.c (apply_intrinsic): Function removed.
(to_apf): Use applyv instead of apply_intrinsic.
* eval.h (apply_intrinsic): Declaration removed.
* vm.c (vm_gapply): Use applyv instead of apply_intrinsic.
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| |
Now (pprof (apply '+ 1 2 3 4 5 '(6 7))) shows zero
bytes consed. Previously 176 (on 32 bit). This is
the same whether the expression is compiled or
interpreted.
* eval.c (applyv): Rewritten to efficiently manipulate the
args and call generic_funcall directly. The consing
funcction apply_intrinsic_frob_args is only used when
args contains a trailing list (args->list) and is only
used on that trailing list, not the entire arg list.
Also, changing the static function to external.
* eval.h (applyv): Declared.
* vm.c (vm_apply): Use applyv instead of wastefully
converting the arguments to a consed list and going through
apply_intrinsic.
|
|
|
|
|
|
|
|
|
|
|
| |
* eval.c (prof_call): New function, contents based on op_prof.
(struct prof_ctx): New struct type.
(op_prof_callback): New static function.
(op_prof): Reduced to call to prof_call, passing context
through to callback which performs the evaluation that is
timed.
* eval.h (prof_call): Declared.
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| |
This commit is the start of compiler work to make TXR Lisp
execute faster. In six days of part time work, we now have a
register-style virtual machine with 32 instructions, handling
exceptions, unwind-protect, lexical closures, and global
environment access/mutation. We have a complete assembler and
disassembler for this machine. The assembler supports labels
with forward referencing with backpatching, and features
pseudo-ops: for instance the (mov ...) pseudo-instruction
chooses one of three kinds of specific move instruction based
on the operands.
* Makelfile (OBJS): Add vm.o.
* eval.c (lookup_sym_lisp1): Static function becomes external;
the virtual machine needs to use this to support that style
of lookup.
* genvmop.txr: New file. This is the generator for the
"vmop.h" header.
* lib.c (func_vm): New function.
(generic_funcall): Handle the FVM function type via new
vm_execute_closure function. In the variadic case, we want
to avoid the argument copying which we do for the sake of C
functions that get their fixed arguments directly, and then
just the trailing arguments. Thus the code is restructured a
bit in order to switch twice on the function type.
(init): Call vm_init.
* lib.h (functype_t): New enum member FVM.
(struct func): New member in the .f union: vm_desc.
(func_vm): Declared.
* lisplib.c (set_dlt_entries_impl): New static function,
formed from set_dlt_entries.
(set_dlt_entries): Reduced to wrapper for
set_dlt_entries_impl, passing in the user package.
(set_dlt_entries_sys): New static function: like
set_dlt_entries but targetting the sys package.
(asm_instantiate, asm_set_entries): New static functions.
(lisplib_init): Auto-load the sys:assembler class.
* share/txr/stdlib/asm.tl: New file.
* vm.c, vm.h, vmop.h: New files.
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| |
* eval.c (eval_intrinsic_noerr): New function.
* eval.h (eval_intrinsic_noerr): Declared.
* parser.c (listener_greedy_eval_s): New symbol variable.
(repl): Implement greedy evaluation loop, enabled by
the *listener-greedy-eval-p* special.
(parse_init): Intern the *listener-greedy-eval-p* symbol,
storing it in the listener_greedy_eval_s variable.
Register the symbol as a special variable.
* txr.1: Documented *listener-greedy-eval-p* variable
and the greedy evaluation feature that it controls.
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| |
* LICENSE, LICENSE-CYG, METALICENSE, Makefile, args.c, args.h,
arith.c, arith.h, buf.c, buf.h, cadr.c, cadr.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, 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/awk.tl,
share/txr/stdlib/build.tl, share/txr/stdlib/cadr.tl,
share/txr/stdlib/conv.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/path-test.tl, share/txr/stdlib/place.tl,
share/txr/stdlib/pmac.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/txr-case.tl, share/txr/stdlib/type.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, txr.1, txr.c, txr.h,
unwind.c, unwind.h, utf8.c, utf8.h, win/cleansvg.txr:
Extended Copyright line to 2018.
|
|
|
|
|
|
|
|
|
|
| |
* eval.c (prod_common): New static function.
(maprodv, maprendv): New functions.
(eval_init): Registered maprod and maprend intrinsics.
* eval.h (maprodv, maprendv): Declared.
* txr.1: Documented.
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| |
Places where an integer constant was previously allowed
now allow an expression.
The way enum syntax works is now different. A temporary
lexical environment is created, and each enumeration is
bound in that environment. The value expressions are
evaluated in that environment. The decision to allow
keyword symbols to be enumeration contants is retracted.
* eval.h (special_s): Declared.
* ffi.c (ffi_eval_expr): New static function.
(make_ffi_type_enum): Enums are introduced into a temporary
environment, in which the value expressions are evaluated. By
this means, the expressions can refer can refer to previous
enums and do arbitrary computation. Also, we drop the
requirement that enums can be keyword symbols.
(ffi_type_compile): Array dimension and buf size are evaluated
as expresions. Array and buffer syntax is transformed by
substitution of the evaluated size.
* txr.1: Documented use of expressions in FFI type notation.
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| |
The --eargs mechanism won't perform a blind substring
replacement of {} with the following argument. Only
arguments which match {} exactly are replaced.
* eval.c (retf): Static function becomes extern.
* eval.h (retf): Declared.
* txr.c (txr_main): Replace the filtering logic on the
split eargs argument list to just look for items
equal to the string "{}" and replace with the following
argument.
* txr.1: Updated --eargs documentation.
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| |
The tracing module should warn when traced functions or
methods are being redefined, and stop tracing the original
methods.
* eval.c (trace_check): New function. Calls
sys:trace-redefined-check if the trace module has been
loaded, otherwise does nothing.
(op_defun, op_defmacro): Call trace_check to have a warning
issued for a redefined traced function or macro.
* eval.h (trace_check): Declared.
* lisplib.c (trace_loaded): New global variable.
(trace_instantiate): Flip trace_loaded to t.
* lisplib.h (trace_loaded): Declared.
* share/txr/stdlib/trace.tl (sys:trace-redefine-check): New
function. Checks two situations: traced function or method
is redefined (neither old nor new is traced any longer),
and traced method is overridden (base method continues to be
traced, override is not traced).
* struct.c (static_slot_ensure): Do a trace check here,
taking care of defmeth.
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| |
* eval.h (progn_s): Declarationa added.
* match.c (mdo_s): New symbol variable.
(syms_init): Initialize mdo_s.
* match.h (mdo_s): Declared.
* parser.y (check_for_include): Renamed to check_parse_time_action
and implements mdo, not only include.
(clauses_rev): Follow rename of function.
* txr.1: Documented.
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| |
Now it is possible to use a leading dot on the referencing
dot syntax. This is the is the "unbound reference dot". It
expands to the uref macro, which denotes an unbound-reference:
it produces a function which takes an object as the argument,
and curries the reference implied by the remaining arguments.
* eval.c (uref_s): New global symbol variable.
(eval_init): Intern uref symbol and init uref_s.
* eval.h (uref_s): Declared.
* lib.c (simple_qref_args_p): A qref expression is now
also not simple if it contains an embedded uref, meaning
that it cannot be rendered into the dot notation without
ambiguity.
(obj_print_impl): Support printing (uref a b c) as .a.b.c.
* lisplib.c (struct_set_entries): Add uref to the list of
autoload triggers for struct.tl.
* parser.l (DOTDOT): Consume any leading whitespace as part
of recognizing the DOTDOT token. Otherwise the new rule
for UREFDOT, which matches (mandatory) leading space
will take precedence, causing " .." to be scanned wrong.
(UREFDOT): Rule for new kind of dot token, which is
preceded by mandatory whitespace, and isn't consing
dot (which has mandatory trailing whitespace too,
matched by an earlier rule).
* parser.y (UREFDOT): New token type.
(i_dot_expr, n_dot_expr): New grammar rules.
(list): Handle a leading dot on the first element of a list as
a special case. Things are done this way because trying to
work a UREFDOT into the grammar otherwise causes intractable
conflicts.
(i_expr): The ^, ' and , punctuators are now followed by
an i_dot_expr, so that the expression can be an unbound
dot.
(n_expr): Same change as in i_expr, but using n_dot_expr.
Plus new UREFDOT n_expr production.
* share/txr/stdlib/struct.tl (uref): New macro.
* txr.1: Documented.
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| |
This issue was fixed in quasiliterals only. Because of the
implementation duplicity between output vars and quasiliteral
vars, we have to fix it in two places.
When the parser handles quasiliterals, it builds vars without
expanding the contents. The quasiliteral expander takes care
of recognzing (sys:var ...) forms and properly handles them
and their attributes, avoiding expanding the argument of
a :filter keyword.
When the parser handles an o_var that is a braced variable,
it calls expand on its contents right there, then builds the
(sys:var ...) form from the expanded contents.
Why don't we just call expand_quasi in the o_var rule to have
a single (sys:var ...) form expanded exactly how it is
done in quasiliterals.
* eval.c (expand_quasi): Change static function to external.
* eval.c (expand_quasi): Declared.
* parser.y (o_var): Construct an unexpanded (sys:var ...)
form, and then wrap it in a one-element list. This is a
de-facto quasi-items list, which can be expanded by
expand_quasi. Then we pull the car of the expansion to
get our expanded var.
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| |
* LICENSE, LICENSE-CYG, METALICENSE, Makefile, args.c, args.h,
arith.c, arith.h, cadr.c, cadr.h, combi.c, combi.h, configure,
debug.c, debug.h, eval.c, eval.h, filter.c, filter.h, ftw.c,
ftw.h, gc.c, gc.h, glob.c, glob.h, hash.c, hash.h, jmp.S,
lib.c, lib.h, lisplib.c, lisplib.h, match.c, match.h,
parser.c, parser.h, parser.l, parser.y, rand.c, rand.h,
regex.c, regex.h, signal.c, signal.h, stream.c, stream.h,
struct.c, struct.h, sysif.c, sysif.h, syslog.c, syslog.h,
termios.c, termios.h, txr.1, txr.c, txr.h, unwind.c, unwind.h,
utf8.c, utf8.h, share/txr/stdlib/awk.tl,
share/txr/stdlib/build.tl, share/txr/stdlib/cadr.tl,
share/txr/stdlib/conv.tl, share/txr/stdlib/except.tl,
share/txr/stdlib/getopts.tl, share/txr/stdlib/getput.tl,
share/txr/stdlib/hash.tl, share/txr/stdlib/ifa.tl,
share/txr/stdlib/package.tl, share/txr/stdlib/path-test.tl,
share/txr/stdlib/place.tl, share/txr/stdlib/socket.tl,
share/txr/stdlib/struct.tl, share/txr/stdlib/tagbody.tl,
share/txr/stdlib/termios.tl, share/txr/stdlib/txr-case.tl,
share/txr/stdlib/type.tl, share/txr/stdlib/with-resources.tl,
share/txr/stdlib/with-stream.tl, share/txr/stdlib/yield.tl:
Add 2017 to all copyright headers and strings.
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| |
Warnings about undefined functions and variables are now
deferred during loading, so forward references do not generate
nuisance diagnostics.
* eval.c (load_recursive_s): New symbol variable.
(eval_defr_warn): New static function.
(op_defvarl, op_defun): Purge any deferred warning about the
given function or variable not being defined.
(load): Rebind the sys:*load-recursive* special var to true
around the load. After the load, dump deferred warnings
if the prior binding of sys:*load-recursive* is false.
Discard deferred warnings in the case of termination by
a nonlocal control transfer.
(do_expand): Treat unbound vars and functions as deferrable
warnings, specially tagged for individual purging frkm
the deferred list.
(eval_init): Intern sys:*load-recursive* and initialize
load_recursive_s variable.
* eval.h (load_recursive_s): Declared.
* parse.c (repl_warning): Accept variable arguments.
Check whether we are loading and if so, defer deferrable
(repl): Adjustment for altered signature of repl_warning.
warnings.
* txr.c (txr_main): dump deferred warnings after
evaluating Lisp stream.
* unwind.c (deferred_warnings): New static variable.
(uw_throw): When a deferrable warning is caught,
suppress the usual message and add it to the
deferred_warnings list.
(uw_defer_warning, uw_dump_deferred_warnings,
uw_dump_deferred_warnings, uw_purge_deferred_warnings): New
functions.
(uw_late_init): gc-protect deferred_warnings.
* unwind.h (uw_defer_warning, uw_dump_deferred_warnings,
uw_dump_deferred_warnings, uw_purge_deferred_warnings): New
functions declared.
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| |
* eval.c (reg_mac): Static function changed to extern.
(me_defex, register_exception_subtypes): Static function
removed here; relocated into unwind.c.
(eval_init): Registrations of defex, throw, throwf, error,
register-exception-subtypes and exception-subtype-p removed.
* eval.h (reg_mac): Declared.
* unwind.c (me_defex, register_exception_subtypes): Static
function moved here.
(uw_late_init): Registrations of defex, throw, throwf, error,
register-exception-subtypes and exception-subtype-p moved
here.
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| |
* Makefile, args.c, args.h, arith.c, arith.h, cadr.c, cadr.h, combi.c,
combi.h, configure, debug.c, debug.h, eval.c, eval.h, filter.c,
filter.h, ftw.c, ftw.h, gc.c, gc.h, glob.c, glob.h, hash.c, hash.h,
jmp.S, lib.c, lib.h, lisplib.c, lisplib.h, match.c, match.h, parser.c,
parser.h, parser.l, parser.y, rand.c, rand.h, regex.c, regex.h,
share/txr/stdlib/awk.tl, share/txr/stdlib/build.tl,
share/txr/stdlib/cadr.tl, share/txr/stdlib/conv.tl,
share/txr/stdlib/except.tl, share/txr/stdlib/hash.tl,
share/txr/stdlib/ifa.tl, share/txr/stdlib/path-test.tl,
share/txr/stdlib/place.tl, share/txr/stdlib/socket.tl,
share/txr/stdlib/struct.tl, share/txr/stdlib/termios.tl,
share/txr/stdlib/txr-case.tl, share/txr/stdlib/type.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, sysif.c, sysif.h, syslog.c,
syslog.h, termios.c, termios.h, txr.1, txr.c, txr.h, unwind.c,
unwind.h, utf8.c, utf8.h: Revert to verbatim 2-Clause BSD.
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| |
* eval.c (sys_load_s): Variable removed.
(sys_load): Function removed.
(load): Body of function taken from sys_load.
There is no sloc argument; the *load-path*
variable is sampled via new load_path macro.
(me_load): Static function removed.
(eval_init): Remove initialization of sys_load_s
Remove registration of load macro and
sys:load function. Register load function.
* eval.h (load_path): New macro.
* txr.1: Change documentation of load from macro
to function.
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| |
The self-load-path symbol macro is as of now
deprecated. It simply expands to *load-path*.
*load-path* is a new special variable which is
dynamically bound to the path of a file
being loaded.
* eval.c (self_load_path_s): Global variable renamed
to load_path_s.
(sys_load): Bind *load-path* around processing of loaded file.
(me_load): Expand (load x) simply to (sys:load x *load-path*).
(set_get_symacro): Function removed.
(reg_symacro): New static function.
(eval_init): Initialize renamed load_path_s with interned
symbol having the name *load-path*. Register the *load-path*
special variable. Set up the sel-load-path symbol macro
aliasing for *load-path*.
* eval.h (self_load_path_s): Declaration renamed.
* match.c (v_load): Bind *load-path* around loading
or inclusion.
* parser.c (load_rcfile): Bind *load-path* around loading
of .txr_profile file.
* txr.c (txr_main): Bind *load-path* instead of
self-load-path symbol macro.
* txr.1: Updated documentation for @(load) directive
and load macro. Replaced documentation of self-load-path
with *load-path*.
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| |
Struct objects can now define methods car, cdr and nullify.
With these, they can participate in operations on sequences.
* eval.h (car_s, cdr_s): Declared.
* lib.c (nullify_s): New symbol variable.
(car, cdr): Implement for struct objects via, respectively,
their car and cdr methods.
(tolist): Handle objects by mapping through identity.
(nullify): Implement for objects optionally: if an object
is a struct with a nullify method, use it, otherwise go
through default case of just returning the object.
(empty): Implement for objects that have nullify method.
(obj_init): Initialize nullify_s.
* struct.c (maybe_slot): New function.
* struct.h (maybe_slot): Declared.
* txr.1: Documented car, cdr and nullify method
convention.
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| |
* eval.c (self_load_path_s): New symbol variable.
(sys_load): Save, set-up and restore self-load-path
around load.
(set_get_symacro): New function.
(eval_init): Register load function using sys_load_s instead
of redundant intern.
* eval.h (set_get_symacro): Declared.
* match.c (v_load): Save, set-up and restore self-load-path
macro.
* parser.c (load_rcfile): Likewise.
* txr.c (txr_main: Set up self-load-path when opening
file.
* txr.1: Documented self-load-path.
|
|
|
|
|
|
|
|
|
|
| |
* eval.h (call_s): Declared.
* match.c (h_call, v_call): New static function.
(dir_tables_init): Register v_call in v_directive_table
under call symbol. Likewise h_call in h_directive_table.
* txr.1: Documented.
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| |
* eval.h (if_s): Declared.
* match.c (v_if): New static function.
(dir_tables_init): Register v_if in v_directive_table under if symbol.
* parser.y (IF): Token assigned to <lineno> type.
(if_clause, elif_clauses_opt, else_clause_opt): New syntactic
representation, understood by v_if.
* txr.1: Documented if semantics more precisely, dropped
the text about it being syntactic sugar for a cases with require,
added compatibility note.
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| |
We need this now, since file system errors aren't
handled in the pattern language any more, after
the complex_open refactoring.
* eval.c (set_last_form_evaled): New function.
* eval.h (set_last_form_evaled): Declared.
* match.c (do_match_line, match_files):
Save, set up and restore last_form_evaled
via set_last_form_evaled function.
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| |
* LICENSE, METALICENSE, Makefile, args.c, args.h, arith.c,
arith.h, cadr.c, cadr.h, combi.c, combi.h, configure,
debug.c, debug.h, eval.c, eval.h, filter.c, filter.h, gc.c,
gc.h, glob.c, glob.h, hash.c, hash.h, jmp.S, lib.c, lib.h,
lisplib.c, lisplib.h, match.c, match.h, parser.c, parser.h,
parser.l, parser.y, rand.c, rand.h, regex.c, regex.h,
share/txr/stdlib/cadr.tl, share/txr/stdlib/except.tl,
share/txr/stdlib/hash.tl, share/txr/stdlib/ifa.tl,
share/txr/stdlib/path-test.tl, share/txr/stdlib/place.tl,
share/txr/stdlib/struct.tl, share/txr/stdlib/txr-case.tl,
share/txr/stdlib/type.tl, share/txr/stdlib/with-resources.tl,
share/txr/stdlib/with-stream.tl, share/txr/stdlib/yield.tl,
signal.c, signal.h, stream.c, stream.h, struct.c, struct.h,
sysif.c, sysif.h, syslog.c, syslog.h, txr.1, txr.c, txr.h,
unwind.c, unwind.h, utf8.c, utf8.h: Add 2016 copyright.
* linenoise/LICENSE, linenoise/linenoise.c,
linenoise/linenoise.h: Bump one principal author's copyright
from 2014 to 2015. The code is based on a snapshot of 2015
upstream work.
|
|
|
|
|
|
|
|
|
|
|
| |
Same issue as with Vim syntax highlighting.
* eval.c (mboundp): Externalize static function.
* eval.h (mboundp): Declared.
* parser.c (find_matching_syms): Expand fboundp check to encompass
mboundp and special_operator_p.
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| |
* eval.c (format_field): Function moved here from match.c,
along with the introduction of a new behavior: if a meta-expr
occurs among the modifiers, its constituent expression
is evaluated in its place. This allows for @{a @[expr]}
which was previously not allowed in Lisp quasiliterals,
but worked in TXR quasiliterals due to the treatment
of @ by txeval.
(subst_vars): Static function turns external, so code in
match.c can call it instead of the subst_vars in that module.
For that purpose, it needs to take a filter argument and
process filters, like the match.c subst_vars.
(op_quasi_lit): Pass nil as filter argument to subst_vars.
* eval.h (format_field, subst_vars): Declared.
* match.c (format_field): Function removed, moved to
eval.c and slightly changed.
(subst_vars): Renamed to tx_subst_vars. By default, now just a
wrapper for subst_vars. In compatibility mode, invokes the
old logic.
(do_txeval, do_output_line): Call tx_subst_vars rather than
subst_vars.
* match.h (format_field): Declaration removed.
* parser.y (expr): Grammar production removed: no longer
referenced.
(o_var): Braced variable case now parsed as n_expr, and
expanded as expr by default, since this is Lisp now. In
compatibility mode, expanded using expand_meta.
Also SYMTOK case must be subject to expansion; an output
var can now be a symbol macro.
(expand_meta): Expand a quasi-literal as Lisp, except
in compatibility mode.
* txr.1: Bit of a documentation update. Existing doc isn't
totally clear.
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| |
The context form arguments become just context objects in
various places. When a context form is actually needed, or the
context's symbolic name, they must be retrieved via functions
applied to a context.
* debug.c (debug): form argument is now a context. Use
the ctx_form function to retrieve the form.
* debug.h (debug_check): Rename form parameter to ctx.
* eval.c (ctx_form, ctx_name): New functions.
(eval_error): Leftmost parameter is a context now.
Use ctx_form API to obtain the context form from
this object, from which the source location info
can then be retrieved as before.
(abbrev_ctx): Function removed.
(bind_args, bindings_helper, fbindings_helper): Convert
ctx_form argument to
ctx, and use the API to access name or form.
(do_eval, do_eval_args, eval, eval_args_lisp1,
eval_lisp1, eval_progn, eval_prog1): ctx_form param
renamed to ctx.
(funcall_interp): Pass the original interpreted
function as the context to bind_args, not the
extracted code. When ctx_name sees this object, it
will compute the function name, which was not possible
from the code being used as the context. This
is the big reason for all these changes.
* eval.h (eval_error): Declaration updated.
(ctx_form, ctx_name): Declared.
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| |
* eval.c (env_vbind_special): Remove unused ctx_form
parameter.
(bind_args, bind_macro_params): Don't pass ctx_form to
env_vbind_special.
(apply): Remove unused ctx_form parameter.
(apply_intrinsic, applyv, mapcarv, mappendv,
lazy_mapcarv_func, mapdov, do_mapf): Don't pass nil third
argument to apply.
* eval.h (apply): Declaration updated.
* lib.c (do_juxt): Do not bind third argument of apply
to lin when currying; curry as two argument function.
(do_not): Do not pass third nil argument to apply.
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| |
* eval.c (funcall_interp): Drop the env argument.
The fun argument is now the whole function object, not the
encapsulated code to be interpreted. We pull the
environment and code out of the object locally
and interpret as before.
* eval.h (funcall_interp): Declaration updated.
* lib.c (generic_funcall, funcall, funcall1, funcall2,
* funcall3, funcall4): Calls to funcall_interp simplified,
just passing fun.
|
|
|
|
|
|
|
|
|
| |
* eval.c (interp_fun): Function renamed to funcall_interp.
* eval.h (interp_fun): Declaration updated.
* lib.c (generic_funcall, funcall, funcall1, funcall2,
funcall3, funcall4): Calls to interp_fun updated.
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| |
* eval.c (error_trace): New function. Consolidates
error reporting between unhandled exception handling
in uw_throw, and the catcher in the repl.
(op_defmacro, expand_macrolet): Propagate location info from
body to wrapping block, and to the macro binding. In the
latter function, also to the body that is wrapped by local
macros.
(do_expand, macroexpand_1): Propagate location info from macro
expander to expansion, only taking it from the form if the
macro doesn't supply it.
* eval.h (error_trace): Declared.
* parser.c (repl): Replace error reporting code with call to
error_trace.
* unwind.c (uw_throw): uw_throw: likewise.
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| |
* eval.c (origin_hash): New global variable.
(lookup_origin): New function.
(expand_macro): Enter original form into origin hash, keyed by
new form.
(eval_init): gc-protect and initialize origin_hash.
* eval.h (lookup_origin): Declared.
* parser.c (repl): Report chain of expansions from
last_form_evaled.
* unwind.c (uw_throw): Likewise.
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| |
If the equal method is defined for structs, its return
value is used in their place for hashing and comparison.
* eval.h (eq_s, eql_s, equal_s): Declared.
* hash.c (equal_hash): If a COBJ defines an equalsub
function, we call it. If it returns non-nil, we
take the object in its place and recurse.
* lib.c (equal): Refactored to support equality substitution.
(less): Support equality substitution.
* lib.h (cobj_ops): New function pointer member, equalsub.
Only struct instances define this, currently.
(cobj_ops_init): Add null entry to initializer for equalsub.
(cobj_ops_init_ex): New initialiation macro for
situations when the equalsub member must be provided.
* struct.c (struct struct_type): new member eqmslot.
(make_struct_type): Initialize emslot to zero.
(static_slot_set, static_slot_ensure): If eqmslot is -1,
indicating positive knowledge that there is no equal method
static slot, we must invalidate that with a zero: it is no
longer known whether there is or isn't such a slot.
(get_equal_method, struct_inst_equalsub): New static functions.
(struct_inst_ops): Initialize the equalsub member using
new cobj_ops_init_ex macro.
* txr.1: Document equality substitution.
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| |
When continuations are captured/restored in the middle of
variable binding constructs, a hidden problem occurs.
Binding constructs work by allocating an empty environment
and then destructively extending it. Since the environment
is not on the stack, but a referenced object, it doesn't
get deep copied into a continuation. As the continuation is
revived repeatedly, parts of the variable binding code are
repeatedly re-executed, and keep pushing fresh bindings into
the same environment object. Though the new bindings
correctly shadow the old, the old bindings are there and
potentially hang on to garbage.
The solution taken here is to introduce a new kind of frame
for handling the situation: a continuation copy handling
frame. This frame allows functions to register objects to
be copied more deeply if a continuation is captured/revived
across them.
* eval.c (copy_env): New static function.
(copy_env_handler): New static function.
(bind_args, bind_macro_params): Install continuation copy
handling frame for cloning new_env.
(struct bindings_helper_vars): New struct type.
(copy_bh_env_handler): New static function.
(bindings_helper): Install continuation copy handling frame
for de and ne variables which hold environments. The variables
are moved to a struct to facilitate access from the handler.
* eval.h (copy_env): Declared.
* unwind.c (uw_push_cont_copy): New function.
(call_copy_handler): New static function.
(revive_cont): When a continuation is being revived invoke the
copying actions in its continuation copy handling frames,
but not if it is only being temporarily revived for immediate
unwinding.
(capture_cont): After copying the continuation, invoke any
continuation copying frames in the "parent": the original
frames that were captured.
* unwind.h (enum uw_frtype): New type, UW_CONT_COPY.
(struct uw_cont_copy): New struct type.
(union uw_frame): New member cp.
(uw_push_cont_copy): Declared.
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| |
* eval.c (set_dyn_env): Static function becomes external.
* eval.h (set_dyn_env): Declared.
* match.c (eval_with_bindings, eval_progn_with_bindings):
Evaluate Lisp code in null lexical environment. Instead
install the pattern variables as dynamic, so they shadow
global variables. A compatibility check for 121 or earlier
provides the old behavior.
* txr.1: Document scoping rules, and added compatibility
notes.
|
|
|
|
|
|
| |
* eval.c (eval_error): Static function made external.
* eval.h (eval_error): Declared.
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| |
* combi.c (perm_list, perm_str, rperm_list, reperm_gen_fun,
rperm_vec, comb_vec, rcomb_list, rcomb_vec, rcomb_str):
Follow rename of list_vector to list_vec.
* eval.c (vector_list_s): Global variable renamed to
vec_list_s.
(expand_qquote): Follow vector_list_s to vec_list_s.
(eval_init): Follow renames of all identifiers. Functions
num-chr, chr-num, vector-list and list-vector are
registered under new names, while remaining registered
under old names.
* eval.h (vector_list_s): Declaration renamed.
* filter.c (url_encode): Follow chr_num to chr_int rename.
* lib.c (make_like, interpose, shuffle): Follow vector_list to vec_list rename.
(tolist, replace, replace_list): Follow list_vector to list_vec rename.
(num_chr): Renamed to int_chr.
(chr_num): Renamed to chr_int.
(vector_list): Renamed to vec_list.
(list_vector): Renamed to list_vec.
* lib.h (num_chr, chr_num, list_vector, vector_list):
* Declarations renamed.
* parser.y (vector): Follow vector_list to vec_list rename.
* txr.1: Updated documentation for num-chr, chr-num,
list-vector and vector-list with new names, and notes
about the old names being supported, but obsolescent.
|