|
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.
|