|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| |
When TXR executes a top-level program, such that it will
exit when the last form in that program terminates,
it simulates a load. There is a block named load visible,
and the program can evaluate a (return-from load <expr>).
The value of that <expr> is thrown away, and the
termination status is always unsuccessful.
In this patch, (return-from load <expr>) is made to work
such that the value of <expr> will determine the exit
status, according to the same interpretation that
(exit <expr>) would give to the value.
* sysif.[ch] (exit_wrap): Static function becomes external.
* txr.c (txr_main): In the cases where we execute a file
and return from main, we now call exit_wrap instead.
The termination status is not simply based on whether
the file was successfully read, but takes into account the
load block.
* tests/019/load-ret/{script.tl,bad.tl}: New files.
* tests/019/load-ret/load-ret.tl: New tests.
* txr.1: Documented.
|
|
We can give additional arguments to load, which
become arguments of the script, which it can
retrieve via the *load-args* special variable.
* eval.c (load_args_s): New symbol variable.
(loadv): New function, taking over the
implementation of load. This takes variadic
arguments. Loadv binds the *load-args* variable
from the list of variadic arguments.
(load): Reduced to wrapper around loadv.
(rt_load_for): Each clause in load for can
now have arguments after the target name. If
that file needs to be loaded, then the arguments
are passed.
(me_load_for): The macro expander for the load-for
macro needs to allow for the load-arg expressions
and generate code which passes them to sys:rt-load-for.
They all get evaluated.
(eval-init): Initialize load_args_s and register the
*load-args* variable. Update registration of intrinsic
function load to use loadv.
* tests/019/load-ret.tl,
* tests/019/load-ret/module.tl,
* tests/019/load-ret/module2.tl:
New files.
* txr.1: Documented.
|