| Commit message (Collapse) | Author | Age | Files | Lines |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| |
* match.c (v_var_compat, v_var): New static functions.
(match_files): No longer recognize v_var specially; it is now
handled via vertical table.
(dir_tables_init): Register a vertical sys:var directive also
via v_var function.
(match_compat_fixup): New function.
* txr.c (compat): Call match_compat_fixup.
* tests/010/span-var.txr: New file.
* txr.1: Documented.
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| |
With :mass-delegate, it is possible to generate delegation
methods in bulk. All of the methods of a struct type can be
mirrored by delegates in another struct type just by writing
a single :mass-delegate clause.
* stdlib/struct.tlk (:mass-delegate): New struct clause macro.
* tests/012/oop.tl: New tests.
* txr.1: Documented.
* stdlib/doc-syms.tl: Updated.
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| |
This bug affects optional parameters which either
have no default expression, or one that is nil.
For instance x in (lambda (: (x nil))) or (lambda (: x)).
When such a parameter is given the : symbol as an argument, it
is not being bound, as if it weren't there.
((lambda (: x) x) :) -> ;; error: unbound variable x
This issue is not a regression; it was introduced in the
commit which introduced the colon convention to optionals, as
well as init expressions and presence-indicating variables,
commit 68c084269581f32f0a7b859446ae2efb6c6a26c0 made in
February 2014.
This might be the first instance of an interpreter bug being
found that is not present in the compiler.
* eval.c (bind_args): The idea here was that when the argument
to an optional the colon keyword symbol, and the optional's
initform is nil, we can skip the overhead of calling eval to
get that initform's value. Unfortunately, the skip was
extended over the code which binds the parameter. Only
the eval can be skipped!
* tests/012/lambda.tl: New test cases to cover this.
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| |
* lisplib.c (struct_set_entries): Trigger autoload on new
symbols define-struct-clause and *struct-clause-expander*.
* stdlib/struct.tl (*struct-clause-expander*): New variable.
(defstruct): expand-slot local function now returns list of
expanded slots, not a single slot; every case in the tree-case
is converted to return a list. The syntax of a slot clause is
first expanded through *struct-clause-expander hash; if that
works then the resulting list is further scanned for
expansions.
(define-struct-clause): New macro.
(:delegate): New struct clause defined with
define-struct-clause. Provides single-slot delegation.
* tests/012/oop.tl: Tests for :delegate.
* txr.1: Documented define-struct-clause and :delegate.
* stdlib/doc-syms.tl: Updated.
|
|
|
|
|
|
|
|
|
|
|
|
| |
* eval.c (eval_init): Register pairlis intrinsic.
* lib.c, lib.h (pairlis): New function.
* tests/012/seq.tl: New test cases.
* txr.1: Documented.
* stdlib/doc-syms.tl: Updated.
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| |
* eval.c (eval_init): Register new intrinsics.
* lib.c, lib.h (subq, subql, subqual, subst): New functions.
* tests/012/seq.tl: New test cases.
* stdlib/optimize.tl (subst): Function removed. The new subst
drop-in replaces this one.
* txr.1: Documented.
* stdlib/doc-syms.tl: Updated.
|
|
|
|
|
|
|
|
| |
* lib.c (less_tab_init): Add missing initialization for VEC,
with a priority above CONS: all vectors are greater than
conses. The BUF priority is bumped to 7.
* test/012/less.tl: New file.
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| |
* tree.c (tree_min_node, tree_min, tree_del_min_node,
tree_del_min): New functions.
(tree_init): tree-min-node, tree-min, tree-del-min-node,
tree-del-min: New intrinsics registered.
* tree.h (tree_min_node, tree_min, tree_del_min_node,
tree_del_min): Declared.
* txr.1: Documented.
* tests/010/tree.tl: New tests.
* stdlib/doc-syms.tl: Updated.
|
|
|
|
|
|
|
|
|
|
|
|
|
| |
When duplicate keys are inserted in the default way with
replacement, the tree size must not be incremented.
* tree.c (tr_insert): Increment the tr->size and maintain
tr->max_size here. In the case of replacing an existing node,
do not touch the count.
* tests/010/tree.tl: Add test cases covering duplicate
insertion and tree-count.
(tree_insert_node): Remove unconditional size increment.
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| |
* tree.c (tr_insert): New argument for allowing duplicate.
If it is true, suppresses the case of replacing a node,
causing the logic to fall through to traversing right, so the
duplicate key effectively looks like it is greater than the
existing duplicates, and gets inserted as the rightmost
duplicate.
(tr_do_delete_specific, tr_delete_specific): New static functions.
(tree_insert_node): New parameter, passed to tr_insert.
(tree_insert): New parameter, passed to tree_insert_node.
(tree_delete_specific_node): New function.
(tree): New parameter to allow duplicate keys in the elements
sequence.
(tree_construct): Pass t to tree to allow duplicate elements.
(tree_init): Update registrations of tree, tree-insert and
tree-insert-node. Register tree-delete-specific-node function.
* tree.h (tree, tree_insert_node, tree_insert): Declarations
updated.
(tree_delete_specific_node): Declared.
* lib.c (seq): Pass t argument to tree_insert, allowing
duplicates.
* parser.c (circ_backpatch): Likewise.
* parser.y (tree): Pass t to new argument of tree, so
duplicates are preserved in the element list of the #T
literal.
* y.tab.c.shipped: Updated.
* tests/010/tree.tl: Test cases for duplicate keys.
* txr.1: Documented.
* stdlib/doc-syms.tl: Updated.
|
|
|
|
|
|
|
|
|
|
|
|
|
| |
* tree.c (tree_count): New function.
(tree_init): tree-count intrinsic registered.
* tree.h (tree_count): Declared.
* lib.c (length): Support search tree argument via tree_count.
* tests/010/tree.tl: Test cases for tree-count, indirectly via len.
* txr.1: Documented.
|
|
|
|
|
|
|
|
|
|
|
| |
I discovered this off chance by searching for occurrences
of (let ,(zip ...) ...) or (let (,*(zip ...)) ...) in the
code base, noticing an incorrect one.
* stdlib/place.tl (sys:register-simple-accessor): Remove
spurious list around ,(zip temps args).
* tests/012/defset.tl: Test cases for define-accessor added.
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| |
* txr.1: Adding the missing requirement that each-match
and the other macros in that family must have an implicit
anonymous block around the body forms. This is a requirements
bug, effectively: the programmer expects these operators to be
consistent with the each operator, as part of the same family.
* match.tl (each-match-expander): Implement the requirement.
Since we are using mapping functions, we must use temporary
variables: the evaluation of the expressions which produce the
sequence argument values to the mapping functions must be
outside of the anonymous block. The block must surround only
the function call.
* tests/011/patmatch.tl: Add small test case covering this.
|
|
|
|
|
|
|
|
|
|
|
|
| |
* eval.c (me_case): Reduce (key) to key only if key is
an atom. Otherwise we reduce ((a b c)), which
is a single list-valued key to (a b c), which looks like
three keys. This was introduced on Oct 25, 2017 in
commit b72c9309c8d8f1af320dce616a69412510531b48,
making it a regression.
* tests/012/case.tl: New file. The last test
case fails without this bugfix. The others pass either way.
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| |
* eval.c (eval_init): nrot, rot intrinsics registered.
* lib.c (nrot, rot): New functions.
* lib.h (nrot, rot): Declared.
* tests/012/seq.tl: New test cases.
* txr.1: Documented.
* stdlib/doc-syms.tl: Updated.
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| |
* eval.c (eval_init): Register tuples* intrinsic.
* lib.c (tuples_star_func): New static function.
(tuples_star): New function.
* lib.h (tuples_star): Declared.
* tests/012/seq.tl: New test cases.
* txr.1: Documented.
* stdlib/doc-syms.tl: Updated.
|
|
|
|
| |
* tests/012/seq.tl: Numerous test cases for tuples.
|
|
|
|
|
|
|
| |
* lib.c (tuples): Check that n argument giving tuple size is a
is a positive integer.
* tests/012/seql.tl: Test case added.
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| |
* hash.c (randbox, hash_c_str, hash_buf): Separate
implementation for 64 bit pointers, using 64 bit random
values, and producing a 64 bit hash, taking in a 64 bit seed.
(gen_hash_seed): Use time_sec_nsec to get nanoseconds.
On 64 bit, put together the seed differently to generate
a wider value.
* tests/009/json.txr: Change from hash tables to lists,
so the order of the output doesn't change between 64 and 32
bits, due to the different string hashing.
* tests/009/json.expected: Updated.
* txr.1: Documented that seeds are up to 64 bits, but
with possibly only the lower 32 bits being used.
|
|
|
|
|
|
| |
* tests/011/patmatch.tl: Add failing test cases.
* txr.1: Document desired requirements.
|
|
|
|
| |
* tests/012/syntax.tl: New tests, some of which fail.
|
|
|
|
|
|
| |
Add three tests; the first and third fail.
* tests/019/load-time.tl: New file.
|
|
|
|
|
|
|
|
|
| |
* stdlib/copy-file.tl (path-simplify): If the incoming path's
first component is "", it is absolute; in that case swallow
any components that go above.
* tests/018/path-equal.tl: Uncomment two previously failing
tests.
|
|
|
|
|
|
|
|
|
|
| |
* pic.tl (add-neg-parens): New system function.
(expand-neg-parens): New macro.
(expand-pic): New numeric pattern with parentheses.
Also suport escaping of parentheses.
(pic): Recognize parenthesized numeric pattern here also.
* tests/018/format.tl: New tests.
|
|
|
|
| |
* tests/018/format.tl: New test cases.
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| |
* pic.tl (expand-pic-num): If the overflowing field specifies
a decimal point other than in the rightmost position, then
stick one into the fill pattern. The motivation for this is
that it harmonizes with the digit separators. The new digit
separator insertion logic will treat the # characters like
digits, and requires the embedded decimal in order to work
properly. Allowing digit separation to work in the fill
pattern will make for better looking output in column
displays. That's the same reason why we insert digit
separators among leading zeros.
* tests/018/format.tl: Overflow test cases updated in
light of this requirement change.
* txr.1: Documented.
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| |
This is a basic read/print consistency problem. When a symbol
is printed that is anywhere in the fallback list of the
current package, we are dumping it unqualified, even if
it is hidden by a same-named symbol in the current package
itself or such a symbol occurring earlier in the fallback
list.
* lib.c (symbol_needs_prefix): When the to-be-printed symbol
is found in the fallback list, re-scan the current package
for a symbol having the same name, as well as the preceding
nodes in the fallback list. If such a symbol is found, then
the to-be printed symbol must be package-qualified.
* tests/012/syms.expected: New file.
* tests/012/syms.tl: Likewise.
* tests/012/compile.tl: Pull syms into compile job.
* txr.1: Clarify text about this. The existing text's
only reasonable interpretation supports the behavior which
this patch ensures (which is needed on grounds of read/print
consistency) but the text lacks precision.
|
|
|
|
|
|
|
|
|
|
| |
* lisplib.c (copy_file_set_entries): Add path-equal to autoload symbols.
* stdlib/copy-file.tl (path-equal): New function.
* tests/018/path-equal.tl: New file.
* txr.1: Documented.
|
|
|
|
|
|
|
|
|
|
|
|
|
| |
Reported by Paul A. Patience.
* ffi.c (make_ffi_type_enum): Do not use the cnum native type
for doing the member value calculations. Work with Lisp
numbers, and verify their range by passing them into the put
function of the underlying integer type. Duplicated code is
merged, too.
* tests/017/ffi-misc.tl: New tests. Two 64 bit ones fail
due to conversion bugs.
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| |
On systems with true Unix heritage, like Solaris,
MacOS/Darwin, and undoubtedly various BSDs, getsockopt is
returning a bitmask value for some options , rather than 1.
For instance if we enable SO_REUSEADDR, and then read back the
value of the option, we get 4 and not 1. This is because the
value of the SO_REUSEADDR symbol itself is 4; it is a mask.
The kernel code is evidently just masking out the desired
option out of the option mask, and returning the mask value
without reducing it to 0 or 1.
* tests/014/socket-misc.tl: Test the result of sock-opt for
nonzero using nzerop rather than testing specifically for 1.
|
|
|
|
|
|
|
| |
* stream.c (run): replace_env takes only one argument.
* tests/018/process.tl: *child-env* tests are reporting some extra
environment variables on Windows; let's just disable them.
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| |
* stdlib/awk.tl (sys:awk-compile-time): Slot field-names renamed to
field-name-conv.
(sys:awk-expander): Parse the new syntax which allows (sym fn)
pairs with optional fn, creating a list of normalized items
in the field-name-conv slot of the compile-time structure.
(sys:awk-symac-let): Adjust the code to the pair representation in
field-name-conv.
(sys:awk-field-name-code): New function for generating the
field conversion code.
(awk): Now that we have two optional pieces of code to wrap around
p-actions form, we factor that out of the awk-lambda, to a series
of conditional assignments. Here we handle the generation of the
field conversionns.
* conv.tl (sys:conv-expand-sym): New macro, used in
sys:awk-field-name-code and sys:conv-let.
(sys:conv-let): Simplify with sys:conv-expand-sym. Drop optional
argument from i; it connects with no documented feature, and is
not usable from fconv.
* tests/015/awk-fields.tl: New tests.
* txr.1: Updated, including cruft in fconv documentation.
Change-Id: Ie42819f58af039fdbcdb1ae365c89dc1add55c93
|
|
|
|
|
|
|
|
|
|
|
|
|
| |
* stdlib/awk.tl (sys:awk-compile-time): New slot, field-names.
(sys:awk-expander): Validate and store field-names into compile-time
structure.
(sys:awk-symac-let): New macro.
(awk): Wrap sys:awk-symac-let around code to generate field
name macros.
* tests/015/awk-fields.tl: New file.
* txr.1: Documented.
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| |
* tests/common.tl (sstest): New macro. Like stest, but the right hand
side is an object which the macro turns to a string, rather than
expecting a string.
* tests/016/arith.tl: Use the sstest macro for the main quantile
test to compare the result and expected value as character strings
rather than objects. Specify the expected values using no more
than 14 decimal digits of precision, and over the scope of the test
case, restrict floating-point printing to 14 digits. Thus, we
effectively have quick and dirty epsilon comparison to 14 digits
that recurses over the list, without having to write that as a function.
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| |
This specifies the environment to be used for executing
programs.
* stream.c (open_subprocess, run): Check *child-env* variable and if
other than t, then install the environment before execvp.
In the spawn-based version of run, we save and restore the
environment around the spawn call, if *child-env* is in
effect.
* sysif.c (child_env_s): New symbol variable.
(exec_wrap): If *child-env* is other than t, then save the
environment in a list, and install the specified environment
before calling execvp. If that function returns, restore the
environbment.
* sysif.h (child_env_s): Declared.
(child_env): New macro.
* tests/018/process.tl: New tests.
* txr.1: Documented.
* stdlib/doc-syms.tl: Updated.
|
|
|
|
|
| |
* arith.tl: Somehow I committed some wrong expected numbers in
a quantile test, yet didn't catch the test failure.
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| |
The new function:
- just returns the name if it contains path name components.
- returns nil if the name is "." or "..".
- tests for existence only, not permission to execute.
* lisplib.c (path_test_set_entries): Do not auto-load path-test
module on the path-search symbol, since it is no longer implemented
there.
* stdlib/path-test.tl (path-search): Function removed.
* stream.c (path_var_sep_char): New global variable.
(path_search): New function.
(detect_path_separators): Also set path_var_sep_char to semicolon
on Cygnal.
(stream-init): Register path-search intrinsic here now.
* stream.h (path_var_sep_char, path_search): Declared.
* tests/018/path-test.tl: New tests.
* txr.1: Documentation revised for path-search.
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| |
* lisplib.c (arith_each_instantiate, arith_each_set_entries): New
functions.
(each_prod_set_entries): Add sum-each-prod, sum-each-prod*,
mul-each-prod and mul-each-prod* as autoload triggers for
each-prod.tl, where those macros are now defined.
(lisplib_init): Register autoloading of arith-each.tl via the
two new functions.
* stdlib/arith-each.tl: New file.
* stdlib/each-prod.tl (sys:expand-each-prod*): Handle sum-each-prod* and
mul-each-prod* in the same way, by mapping to their parallel binding
counterparts.
(sys:expand-arith-each-prod): New function.
(sym-each-prod, mul-each-prod, sum-each-prod*, mul-each-prod*): New
macros.
* tests/016/arith.tl: New tests.
* txr.1: Documented.
* stdlib/doc-syms.tl: Updated.
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| |
* Makefile (psquare.o): New object file.
* arith.c (psq_ops): New static structure.
(quant_fun): New static function.
(quantile): New function.
(arith_init): Register quantile intrinsic.
* arith.h (quantile): Declared.
* psquare.c, psquare.h: New files.
* tests/016/arith.tl: New tests.
* txr.1: Documented.
* stdlib/doc-syms.tl: Updated.
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| |
The new sock-opt and sock-set-opt functions are wrappers around
getsockopt and setsockopt, respectively.
All POSIX socket options are registered. Platform-specific
options may be added in the future.
* ffi.c (sock_opt, sock_set_opt): New functions.
(ffi_init): Register sock-opt, sock-set-opt, sol-socket,
ipproto-ip, ipproto-ipv6, ipproto-tcp, ipproto-udp,
so-acceptconn, so-broadcast, so-debug, so-dontroute, so-error,
so-keepalive, so-linger, so-oobinline, so-rcvbuf, so-rcvlowat,
so-rcvtimeo, so-reuseaddr, so-sndbuf, so-sndlowat, so-sndtimeo,
so-type, ipv6-join-group, ipv6-leave-group, ipv6-multicast-hops,
ipv6-multicast-if, ipv6-multicast-loop, ipv6-unicast-hops,
ipv6-v6only, tcp-nodelay.
* lisplib.c (sock_set_entries): Add sock-opt and sock-set-opt.
* stdlib/socket.tl (sock-opt): Define as syntactic place.
* tests/014/socket-misc.tl: New cases, for sock-opt.
(set-and-get): New macro.
* txr.1: Documented. Also, mention that sock-bind enables
so-reuseaddr.
* stdlib/doc-syms.tl: Updated.
|
|
|
|
|
| |
* tests/014/socket-misc.tl: Test that we can perform a place
update operation on a (sock-peer s) place.
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| |
Paul A. Patience reports a regression in
3d5d525eb525cfad8f643917c31e3d9fedce2874, whereby the code
marked with #if SOCK_NONBLOCK || SOCK_CLOEXEC is being
excluded by the preprocoessor, and so those flags are not
being cleared from the socket type that we retain.
This is because these preprocessor symbols are not necessarily
integer constants. They may expand to C enum identifiers,
in which case, in preprocessor expressions they appear to take
on the value zero.
* socket.c (open_socket, socketpair_wrap): Use the if
statement to test for SOCK_NONBLOCK or SOCK_CLOEXEC being
nonzero, rather than a preprocessor #if. This should still be
optimized away as unreachable code if they are zero.
* tests/014/socket-misc.tl: New file.
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| |
Basic idea: when we throw an exception that pertains to a
system error which has an errno code, we can stick the errno
into the memory area of the character string, into the wchar_t
that immediately follows the null terminator. We can do this
because strings track their actual allocation size.
A pair of setter/getter functions to set and retrieve this
value are provided, and all functions in the code which can
set such a code are updated to do so, simply by calling the
newly added uw_ethrowf that drop-in replaces for uw_throwf.
* lib.[ch] (string_set_code, string_get_code): New functions.
* unwind.[ch] (uw_ethrowf): New function.
* eval.c (eval_init): Register string-set-code and
string-get-code intrinsics.
* ftw.c (ftw_wrap): Switch to uw_ethrowf.
* parser.c (open_txr_file): Likewise.
* socket.c (dgram_overflow): Store the ENOBUFS error in errno,
and use uw_ethrowf instead uw_throwf.
(dgram_get_byte_callback, dgram_flush, sock_bind, to_connect,
open_sockfd, sock_connect, sock_listen, sock_accept,
sock_shutdown, sock_timeout, socketpair_wrap): Switch to
uw_ethrowf.
* stream.c (dev_null_get_fd, stdio_maybe_read_error,
stdio_maybe_error, stdio_close, pipe_close, open_directory,
open_file, open_fileno, open_tail, fds_subst,
open_subprocess, open_command, remove_path, rename_path,
tmpfile_wrap, mkdtemp_wrap, mkstemp_wrap): Switch to uw_ethrowf.
* sysif.c (mkdir_wrap, ensure_dir, chdir_wrap, getcwd_wrap,
rmdir_wrap, mknod_wrap, mkfifo_wrap, chmod_wrap, do_chown,
symlink_wrap, link_wrap, readlink_wrap, close_wrap, val
exec_wrap, stat_impl, do_utimes, pipe_wrap, poll_wrap,
getgroups_wrap, setuid_wrap, seteuid_wrap, setgid_wrap,
setegid_wrap, setgroups_wrap, getresuid_wrap, setresuid_wrap,
setresgid_wrap, crypt_wrap, uname_wrap, opendir_wrap,
getrlimit_wrap, setrlimit_wrap): Likewise.
* termios.c (tcgetattr_wrap, tcsetattr_wrap, tcsendbreak_wrap,
tcdrain_wrap, tcflush_wrap, tcflow_wrap): Likewise.
* tests/018/errno.tl: New file.
* txr.1: Documented.
* stdlib/doc-syms.tl: Updated.
|
|
|
|
|
|
|
|
|
|
|
|
|
| |
* 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.
|
|
|
|
|
| |
* tests/012/iter.tl: Several new cases to provide some
coverage in recently fixed areas. All of these break in 268.
|
|
|
|
|
| |
* tests/017/mmap.tl: Use the new random-buf function instead
of converting pseudo-random bignums to a buffer.
|
|
|
|
|
|
|
| |
* 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.
|
|
|
|
|
|
|
| |
* 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.
|