This is to make way for a new `-p' option which works like `princ'.
.br
.B runlisp
.RI [ options ]
+.RB [ \-d
+.IR form ]
.RB [ \-e
.IR form ]
.RB [ \-l
.IR file ]
-.RB [ \-p
-.IR form ]
.RB [ \-\- ]
.RI [ arguments
\*(..]
.BR runlisp.conf (5).
.
.TP
+.BI "\-d" "\fR, " "\-\-dump-expression=" expr
+Evaluate the expression(s)
+.I expr
+and print the resulting value(s)
+to standard output
+(as if by
+.BR prin1 ).
+If a form produces multiple values,
+they are printed on a single line,
+separated by a single space character;
+if a form produces no values at all,
+then nothing is printed \(en not even a newline character.
+This option causes
+.B runlisp
+to execute in
+.I eval
+mode.
+.
+.TP
.BI "\-e" "\fR, " "\-\-evaluate-expression=" expr
Evaluate the expression(s)
.I expr
from the configuration file(s).
.
.TP
-.BI "\-p" "\fR, " "\-\-print-expressin=" expr
-Evaluate the expression(s)
-.I expr
-and print the resulting value(s)
-to standard output
-(as if by
-.BR prin1 ).
-If a form produces multiple values,
-they are printed on a single line,
-separated by a single space character;
-if a form produces no values at all,
-then nothing is printed \(en not even a newline character.
-This option causes
-.B runlisp
-to execute in
-.I eval
-mode.
-.
-.TP
.BR "\-q" ", " "\-\-quiet"
Don't print warning messages.
This option may be repeated:
.
.PP
The
+.RB ` \-d ',
.RB ` \-e ',
-.RB ` \-l ',
and
-.RB ` \-p '
+.RB ` \-l '
options may only be given on the command-line itself,
not following a
.RB `@ RUNLISP: '
.RB ` \-\- '
if desired.
If the command line contains any of
+.RB ` \-d ',
.RB ` \-e ',
-.RB ` \-l ',
or
-.RB ` \-p ',
+.RB ` \-l ',
then
.B runlisp
treats all of its positional arguments as
is now committed to
.I script
mode, so it's too late for
+.RB ` \-d ',
.RB ` \-e ',
-.RB ` \-l ',
and
-.RB ` \-p '
+.RB ` \-l '
too.
.PP
(This feature allows scripts to provide options even if they use
fprintf(fp, "\
usage:\n\
%s [OPTIONS] [--] SCRIPT [ARGUMENTS ...]\n\
- %s [OPTIONS] [-e EXPR] [-p EXPR] [-l FILE] [--] [ARGUMENTS ...]\n\
+ %s [OPTIONS] [-e EXPR] [-d EXPR] [-l FILE] [--] [ARGUMENTS ...]\n\
OPTIONS:\n\
[-CDEnqv] [+DEn] [-L SYS,SYS,...] [-c CONF] [-o [SECT:]VAR=VAL]\n",
progname, progname);
-L, --accept-lisp=SYS,SYS,... Only use the listed Lisp systems.\n\
\n\
Evaluation mode:\n\
+ -d, --dump-expression=EXPR Print (`prin1') EXPR (repeatable).\n\
-e, --evaluate-expression=EXPR Evaluate EXPR for effect (repeatable).\n\
- -l, --load-file=FILE Load FILE (repeatable).\n\
- -p, --print-expression=EXPR Print (`prin1') EXPR (repeatable).\n",
+ -l, --load-file=FILE Load FILE (repeatable).\n",
fp);
}
{ "command-line-only", OPTF_NEGATE, 0, 'E' },
{ "accept-lisp", OPTF_ARGREQ, 0, 'L' },
{ "config-file", OPTF_ARGREQ, 0, 'c' },
+ { "dump-expression", OPTF_ARGREQ, 0, 'd' },
{ "evaluate-expression", OPTF_ARGREQ, 0, 'e' },
{ "load-file", OPTF_ARGREQ, 0, 'l' },
{ "dry-run", OPTF_NEGATE, 0, 'n' },
optarg = 0; optind = 0; optprog = (/*unconst*/ char *)progname;
for (;;) {
- i = mdwopt(argc, argv, "+hVD+E+L:c:e:l:n+o:p:qv", opts, 0, 0,
+ i = mdwopt(argc, argv, "+hVD+E+L:c:d:e:l:n+o:qv", opts, 0, 0,
OPTF_NEGATION | OPTF_NOPROGNAME);
if (i < 0) break;
switch (i) {
offsetof(struct lispsys, next_accept));
break;
case 'c': CMDL; read_config_path(optarg, 0); flags |= AF_SETCONF; break;
+ case 'd': CMDL; push_eval_op('?', optarg); break;
case 'e': CMDL; push_eval_op('!', optarg); break;
case 'l': CMDL; push_eval_op('<', optarg); break;
FLAGOPT('n', AF_DRYRUN, { CMDL; });
case 'o': CMDL; if (set_config_var(optarg)) flags |= AF_BOGUS; break;
- case 'p': CMDL; push_eval_op('?', optarg); break;
case 'q': CMDL; if (verbose) verbose--; break;
case 'v': CMDL; verbose++; break;
default: flags |= AF_BOGUS; break;
## The `:runlisp-script' keyword should /not/ be in `*features*'.
traceon
-AT_CHECK([RUNLISP_PATH -p '(find :runlisp-script *features*)'],, [NIL
+AT_CHECK([RUNLISP_PATH -d '(find :runlisp-script *features*)'],, [NIL
])
## Check a mixture of all the kinds of evaluation. We'll need a stunt script
-e '(defpackage [#:]runlisp-test (:export [#:]foo [#:]bar))
(defvar runlisp-test:foo 1)
(defvar runlisp-test:bar "stoat!")' \
- -p runlisp-test:foo \
- -p runlisp-test:bar \
+ -d runlisp-test:foo \
+ -d runlisp-test:bar \
-e '(incf runlisp-test:foo)' \
-l script.lisp \
- -p runlisp-test:foo \
+ -d runlisp-test:foo \
-- -e one two three],,
[1
"stoat!"
echo Bad Lisp = $badlisp
## Check that our selection worked.
-AT_CHECK_UNQUOTED([RUNLISP_PATH -L$lisp0 -p 'WHICH_LISP'],, ["$lisp0"NL])
-AT_CHECK_UNQUOTED([RUNLISP_PATH -L$lisp1 -p 'WHICH_LISP'],, ["$lisp1"NL])
-AT_CHECK([RUNLISP_PATH -L$badlisp -p 'WHICH_LISP'], [127],,
+AT_CHECK_UNQUOTED([RUNLISP_PATH -L$lisp0 -d 'WHICH_LISP'],, ["$lisp0"NL])
+AT_CHECK_UNQUOTED([RUNLISP_PATH -L$lisp1 -d 'WHICH_LISP'],, ["$lisp1"NL])
+AT_CHECK([RUNLISP_PATH -L$badlisp -d 'WHICH_LISP'], [127],,
[runlisp: no acceptable Lisp systems found[]NL])
## Unset all of the user preference mechanisms.
HOME=$here/HOME XDG_CONFIG_HOME=$here/config; export HOME XDG_CONFIG_HOME
## We generally take the first one listed that exists.
-AT_CHECK_UNQUOTED([RUNLISP_PATH -L$lisp0,$lisp1 -p 'WHICH_LISP'],, ["$lisp0"NL])
-AT_CHECK_UNQUOTED([RUNLISP_PATH -L$lisp1,$lisp0 -p 'WHICH_LISP'],, ["$lisp1"NL])
-AT_CHECK_UNQUOTED([RUNLISP_PATH -L$badlisp,$lisp0,$lisp1 -p 'WHICH_LISP'],,
+AT_CHECK_UNQUOTED([RUNLISP_PATH -L$lisp0,$lisp1 -d 'WHICH_LISP'],, ["$lisp0"NL])
+AT_CHECK_UNQUOTED([RUNLISP_PATH -L$lisp1,$lisp0 -d 'WHICH_LISP'],, ["$lisp1"NL])
+AT_CHECK_UNQUOTED([RUNLISP_PATH -L$badlisp,$lisp0,$lisp1 -d 'WHICH_LISP'],,
["$lisp0"NL])
## Check parsing of embedded options.