|
From: David T. <dv...@da...> - 2005-06-03 17:15:40
|
Hi Bruno,
> David Tolpin wrote in c.l.l:
>> This does not save from hacking, unfortunately; CLISP always calls
>> fresh-line on standard output, and never sets argv_verbose to zero if
>> used as a script interpreter. I've just had to fix spvw.d to make it
>> work (that is, to regard -q set twice despite of scripts etc., and to
>> not print newline on stdout on exit if argv_verbose is 0).
>
> - About argv_verbose: Did you try using
> #!/usr/bin/env clisp -q
> or similar in your script, to reduce the verbosity? See the section
> "Quickstarting delivery with CLISP" in the impnotes.html.
Yes, I even set it twice, -q -q, and then patched spvw.d, see below, to
not fresh-line if argv_verbose. It along did not help because spvw.d
2922 # Perform the main actions as specified by the command-line
arguments.
2923 local inline void main_actions (struct argv_actions *p) {
2924 /* print greeting: */
2925 if (!nullpSv(quiet)) /* SYS::*QUIET* /= NIL ? */
2926 { p->argv_verbose = 1; } /* prevents the greeting */
2927 if (p->argv_execute_file != NULL) /* batch-mode ? */
2928 { p->argv_verbose = 1; } /* prevents the greeting */
opposite to what the documentation says, argv_verbose does not become
0, because it is reset to 1.
Changed it to if(p->argv_verbose) p->argv_verbose = 1;
to make it work.
(Actually, I was changing the last stable version, clisp-2.33.2, but it
is almost the same with the current CVS branch).
> - About the newline: Can you let us reproduce the problem? When I do
> $ LC_ALL=C clisp -q foo3.lisp
> where foo3.lisp contains just a nop form, no output is sent to stdout
> at all.
Yes, because it is freshline, not newline. From spvw.d
3370 /* when running as a script, i.e. "clisp lisp-file",
3371 *standard-input* is /dev/fd/0
3372 *standard-output* is /dev/fd/1
3373 *error-output* is /dev/fd/2
3374 and *terminal-io* is an #<IO TERMINAL-STREAM>,
3375 so they all need to be terminated individually */
3376 funcall(L(fresh_line),0); # (FRESH-LINE [*standard-output*])
3377 pushSTACK(var_stream(S(error_output),strmflags_wr_ch_B));
3378 funcall(L(fresh_line),1); /* (FRESH-LINE *error-output*)
*/
3379 pushSTACK(Symbol_value(S(terminal_io)));
3380 funcall(L(fresh_line),1); /* (FRESH-LINE *terminal-io*) */
3381 if (argv2.argv_verbose >= 2) {
3382 pushSTACK(CLSTEXT("Bye.")); funcall(L(write_line),1);
3383 }
Line 3376 always sends fresh-line to stdout.
David
|