add new command-line arguments: -p, -P, -Q

svn: r5557
This commit is contained in:
Matthew Flatt 2007-02-06 05:14:34 +00:00
parent 6325a359f0
commit 2007843ba4
11 changed files with 205 additions and 148 deletions

View File

@ -379,7 +379,7 @@
("Set the maximum inlining size" "size")] ("Set the maximum inlining size" "size")]
[("--prim") [("--prim")
,(lambda (f) (compiler:option:assume-primitives #t)) ,(lambda (f) (compiler:option:assume-primitives #t))
("Assume primitive bindings at top-level")] ("Assume primitive bindings at top level")]
[("--stupid") [("--stupid")
,(lambda (f) (compiler:option:stupid #t)) ,(lambda (f) (compiler:option:stupid #t))
("Compile despite obvious non-syntactic errors")] ("Compile despite obvious non-syntactic errors")]

View File

@ -181,7 +181,7 @@
[(program arguments table finish finish-help help) [(program arguments table finish finish-help help)
(parse-command-line program arguments table finish finish-help help (parse-command-line program arguments table finish finish-help help
(lambda (flag) (lambda (flag)
(raise-user-error (string->symbol program) "unknown flag: ~s" flag)))] (raise-user-error (string->symbol program) "unknown switch: ~s" flag)))]
[(program arguments0 table finish finish-help help unknown-flag) [(program arguments0 table finish finish-help help unknown-flag)
(define arguments (if (vector? arguments0) (vector->list arguments0) arguments0)) (define arguments (if (vector? arguments0) (vector->list arguments0) arguments0))
(unless (string? program) (unless (string? program)
@ -310,9 +310,9 @@
(list #f (list "--help" "-h") (list #f (list "--help" "-h")
(lambda (f) (lambda (f)
(let* ([sp (open-output-string)]) (let* ([sp (open-output-string)])
(fprintf sp "~a [ <flag> ... ]" program) (fprintf sp "~a [ <option> ... ]" program)
(print-args sp finish-help finish) (print-args sp finish-help finish)
(fprintf sp "~n where <flag> is one of~n") (fprintf sp "~n where <option> is one of~n")
(for-each (for-each
(lambda (set) (lambda (set)
(if (eq? (car set) 'help-labels) (if (eq? (car set) 'help-labels)
@ -358,12 +358,12 @@
(cdr set)))) (cdr set))))
table) ; the original table table) ; the original table
(fprintf sp " --help, -h : Show this help~n") (fprintf sp " --help, -h : Show this help~n")
(fprintf sp " -- : Do not treat any remaining argument as a flag (at this level)~n") (fprintf sp " -- : Do not treat any remaining argument as a switch (at this level)~n")
(when (or (assq 'multi table) (assq 'final table)) (when (or (assq 'multi table) (assq 'final table))
(fprintf sp " * Asterisks indicate flags allowed multiple times.~n")) (fprintf sp " * Asterisks indicate options allowed multiple times.~n"))
(when (assq 'once-any table) (when (assq 'once-any table)
(fprintf sp " /|\\ Brackets indicate mutually exclusive flags.~n")) (fprintf sp " /|\\ Brackets indicate mutually exclusive options.~n"))
(fprintf sp " Multiple single-letter flags can be combined after one `-'; for~n") (fprintf sp " Multiple single-letter switches can be combined after one `-'; for~n")
(fprintf sp " example: `-h-' is the same as `-h --'~n") (fprintf sp " example: `-h-' is the same as `-h --'~n")
(help (get-output-string sp)))) (help (get-output-string sp))))
(list "Help"))) (list "Help")))
@ -427,7 +427,7 @@
remaining)]) remaining)])
(if (< remaining needed) (if (< remaining needed)
(raise-user-error (string->symbol (format "~a" program)) (raise-user-error (string->symbol (format "~a" program))
"the ~s flag needs ~a argument~a, but ~a~a provided" "the ~s option needs ~a argument~a, but ~a~a provided"
flag needed (if (> needed 1) "s" "") flag needed (if (> needed 1) "s" "")
(if (zero? remaining) "" "only ") (if (zero? remaining) "" "only ")
remaining) remaining)
@ -458,8 +458,8 @@
(raise-user-error (raise-user-error
(string->symbol (format "~a" program)) (string->symbol (format "~a" program))
(let ([s (if (= 1 (length flags)) (let ([s (if (= 1 (length flags))
(format "the ~a flag can only be specified once" (car flags)) (format "the ~a option can only be specified once" (car flags))
(format "only one instance of one flag from ~a is allowed" flags))]) (format "only one instance of one option from ~a is allowed" flags))])
(if orig-multi (if orig-multi
(format "~a; note that ~s is shorthand for ~s, in contrast to ~s" (format "~a; note that ~s is shorthand for ~s, in contrast to ~s"
s s

View File

@ -1,3 +1,6 @@
Version 369.8
Added -p, -P, and -Q command-line options
Version 369.7 Version 369.7
Added string->path-element and path-element->string Added string->path-element and path-element->string

View File

@ -1,5 +1,5 @@
.\" dummy line .\" dummy line
.TH DRSCHEME 1 "May 2007" .TH DRSCHEME 1 "May 2006"
.UC 4 .UC 4
.SH NAME .SH NAME
drscheme \- The PLT Scheme programming environment drscheme \- The PLT Scheme programming environment

View File

@ -1,5 +1,5 @@
.\" dummy line .\" dummy line
.TH HELP-DESK 1 "May 2007" .TH HELP-DESK 1 "May 2006"
.UC 4 .UC 4
.SH NAME .SH NAME
help-desk \- The PLT Scheme documentation center help-desk \- The PLT Scheme documentation center

View File

@ -1,5 +1,5 @@
\" dummy line \" dummy line
.TH MRED 1 "May 2007" .TH MRED 1 "January 2007"
.UC 4 .UC 4
.SH NAME .SH NAME
mred \- The PLT Graphical Scheme implementation mred \- The PLT Graphical Scheme implementation
@ -138,6 +138,26 @@ Same as
.I coll\|\c .I coll\|\c
"))'. "))'.
.TP .TP
.BI \-p \ file \ user \ package
Same as
.BR -e \ '(require\ (planet\ "\|\c
.I file\|\c
\|" "\|\c
.I user\|\c
\|" "\|\c
.I package\|\c
"))'.
.TP
.BI \-P \ name \ user
Same as
.BR -e \ '(require\ (planet\ "\|\c
.I name\|\c
\|.ss" "\|\c
.I user\|\c
\|" "\|\c
.I name\|\c
\|.plt"))'.
.TP
.B \-r\fR,\fP \-\^\-script .B \-r\fR,\fP \-\^\-script
Script mode: use as last flag for scripts. Script mode: use as last flag for scripts.
Same as Same as
@ -218,6 +238,10 @@ Skips defining `argv' and `program'.
.SH LANGUAGE SETTING OPTIONS .SH LANGUAGE SETTING OPTIONS
.TP .TP
.B \-Q\fR,\fP \-\^\-prim
Assume primitive bindings at top level by initializing the environment with
`(require mzscheme)'.
.TP
.B \-g\fR,\fP \-\^\-case-sens .B \-g\fR,\fP \-\^\-case-sens
Identifiers and symbols are initially case-sensitive (the default). Identifiers and symbols are initially case-sensitive (the default).
.TP .TP
@ -248,11 +272,8 @@ Like -v, also suppresses (yield 'wait).
.TP .TP
.B \-h\fR,\fP \-\^\-help .B \-h\fR,\fP \-\^\-help
Shows help for command-line arguments. Shows help for command-line arguments.
.TP
.BI \-R file\fR,\ \fP \-\^\-restore \ file
Restores an image; must be the only switch. (Special versions only)
.SH OPTION CONVENTIONS .SH COMMAND-LINE CONVENTIONS
Multiple single-letter switches can be collapsed, with arguments placed Multiple single-letter switches can be collapsed, with arguments placed
after the collapsed switches; the first collapsed switch cannot be after the collapsed switches; the first collapsed switch cannot be
@ -267,17 +288,11 @@ is the same as
.B -m -e .B -m -e
.IR expr . .IR expr .
.PP .PP
Extra arguments following the last switch are put into the Scheme global Extra arguments following the last option are put into the Scheme global
variable `argv' as a vector of strings. The name used to start variable `argv' as a vector of strings. The name used to start
.I MrEd .I MrEd
is put into the global variable `program' as a string. is put into the global variable `program' as a string.
.PP .PP
Extra arguments after a
.B --restore
file are returned as a vector of
strings to the continuation of the `write-image-to-file' call that created
the image.
.PP
Expressions/files are evaluated/loaded in order as provided, including Expressions/files are evaluated/loaded in order as provided, including
calls to calls to
.B main .B main
@ -293,7 +308,7 @@ expressions/files are evaluated/loaded, unless the
.B -x .B -x
or or
.B --no-lib-path .B --no-lib-path
switch is used. option is used.
.SH EXECUTABLE NAME .SH EXECUTABLE NAME
If the executable name has the form scheme-\|\c If the executable name has the form scheme-\|\c
@ -315,13 +330,13 @@ expressions/files are evaluated/loaded, unless the
.B -q .B -q
or or
.B --no-init-file .B --no-init-file
switch is used. option is used.
.PP .PP
Unless the Unless the
.B -U .B -U
or or
.B --no-user-path .B --no-user-path
switch is provided, the library collections search option is provided, the library collections search
path is read from the PLTCOLLECTS environment variable path is read from the PLTCOLLECTS environment variable
(as a colon-separated list of paths). Where the empty path (as a colon-separated list of paths). Where the empty path
appears in PLTCOLLECTS, it is replaced with the default appears in PLTCOLLECTS, it is replaced with the default

View File

@ -1,5 +1,5 @@
.\" dummy line .\" dummy line
.TH MZSCHEME 1 "May 2007" .TH MZSCHEME 1 "January 2007"
.UC 4 .UC 4
.SH NAME .SH NAME
mzscheme \- The PLT Scheme implementation mzscheme \- The PLT Scheme implementation
@ -100,6 +100,26 @@ Same as
.I coll\|\c .I coll\|\c
"))'. "))'.
.TP .TP
.BI \-p \ file \ user \ package
Same as
.BR -e \ '(require\ (planet\ "\|\c
.I file\|\c
\|" "\|\c
.I user\|\c
\|" "\|\c
.I package\|\c
"))'.
.TP
.BI \-P \ name \ user
Same as
.BR -e \ '(require\ (planet\ "\|\c
.I name\|\c
\|.ss" "\|\c
.I user\|\c
\|" "\|\c
.I name\|\c
\|.plt"))'.
.TP
.B \-r\fR,\fP \-\^\-script .B \-r\fR,\fP \-\^\-script
Script mode: use as last flag for scripts. Script mode: use as last flag for scripts.
Same as Same as
@ -170,6 +190,10 @@ Skips defining `argv' and `program'.
.SH LANGUAGE SETTING OPTIONS .SH LANGUAGE SETTING OPTIONS
.TP .TP
.B \-Q\fR,\fP \-\^\-prim
Assume primitive bindings at top level by initializing the environment with
`(require mzscheme)'.
.TP
.B \-g\fR,\fP \-\^\-case-sens .B \-g\fR,\fP \-\^\-case-sens
Identifiers and symbols are initially case-sensitive (the default). Identifiers and symbols are initially case-sensitive (the default).
.TP .TP
@ -197,14 +221,11 @@ Suppresses the read-eval-print loop.
.TP .TP
.B \-h\fR,\fP \-\^\-help .B \-h\fR,\fP \-\^\-help
Shows help for command-line arguments. Shows help for command-line arguments.
.TP
.BI \-R file\fR,\ \fP \-\^\-restore \ file
Restores an image; must be the only switch. (Special versions only)
.SH OPTION CONVENTIONS .SH COMMAND-LINE CONVENTIONS
Multiple single-letter switches can be collapsed, with arguments placed Multiple single-letter switches can be collapsed, with arguments placed
after the collapsed switches; the first collapsed switch cannot be after the collapsed swicthes; the first collapsed switch cannot be
.BR -- . .BR -- .
E.g.: E.g.:
.B -vfme .B -vfme
@ -216,17 +237,11 @@ is the same as
.B -m -e .B -m -e
.IR expr . .IR expr .
.PP .PP
Extra arguments following the last switch are put into the Scheme global Extra arguments following the last option are put into the Scheme global
variable `argv' as a vector of strings. The name used to start variable `argv' as a vector of strings. The name used to start
.I MzScheme .I MzScheme
is put into the global variable `program' as a string. is put into the global variable `program' as a string.
.PP .PP
Extra arguments after a
.B --restore
file are returned as a vector of
strings to the continuation of the `write-image-to-file' call that created
the image.
.PP
Expressions/files are evaluated/loaded in order as provided, including Expressions/files are evaluated/loaded in order as provided, including
calls to calls to
.B main .B main
@ -242,7 +257,7 @@ expressions/files are evaluated/loaded, unless the
.B -x .B -x
or or
.B --no-lib-path .B --no-lib-path
switch is used. option is used.
.SH EXECUTABLE NAME .SH EXECUTABLE NAME
If the executable name has the form scheme-\|\c If the executable name has the form scheme-\|\c
@ -264,13 +279,13 @@ expressions/files are evaluated/loaded, unless the
.B -q .B -q
or or
.B --no-init-file .B --no-init-file
switch is used. option is used.
.PP .PP
Unless the Unless the
.B -U .B -U
or or
.B --no-user-path .B --no-user-path
switch is provided, the library collections search option is provided, the library collections search
path is read from the PLTCOLLECTS environment variable path is read from the PLTCOLLECTS environment variable
(as a colon-separated list of paths). Where the empty path (as a colon-separated list of paths). Where the empty path
appears in PLTCOLLECTS, it is replaced with the default appears in PLTCOLLECTS, it is replaced with the default

View File

@ -63,15 +63,6 @@ extern "C" { typedef int (*ACTUAL_MAIN_PTR)(int argc, char **argv); }
char *check_for_another = "yes, please check for another"; char *check_for_another = "yes, please check for another";
#endif #endif
#if defined(_IBMR2)
static void dangerdanger(int)
{
char *s = "mred: Danger - paging space low\n";
write(2, s, strlen(s));
scheme_collect_garbage();
}
#endif
static void yield_indefinitely() static void yield_indefinitely()
{ {
#ifdef MZ_PRECISE_GC #ifdef MZ_PRECISE_GC
@ -173,23 +164,6 @@ static void interrupt(int)
#endif #endif
#endif #endif
#if defined(_IBMR2)
static int danger_signal_received;
static void dangerdanger_gui(int)
{
if (danger_signal_received) {
fprintf(stderr, "mred: Danger - paging space STILL low - exiting\n");
exit(-1);
} else {
fprintf(stderr, "mred: Danger - paging space low\n");
scheme_collect_garbage();
danger_signal_received = 1;
}
signal(SIGDANGER, dangerdanger_gui);
}
#endif
static FinishArgs *xfa; static FinishArgs *xfa;
static void do_graph_repl(Scheme_Env *env) static void do_graph_repl(Scheme_Env *env)
@ -288,9 +262,6 @@ int main(int argc, char *argv[])
scheme_set_stack_base(stack_start, 1); scheme_set_stack_base(stack_start, 1);
#endif #endif
#if defined(_IBMR2)
signal(SIGDANGER, dangerdanger_gui);
#endif
#ifdef wx_x #ifdef wx_x
# if INTERRUPT_CHECK_ON # if INTERRUPT_CHECK_ON
signal(SIGINT, interrupt); signal(SIGINT, interrupt);

View File

@ -3,7 +3,7 @@
/* This command-line parser is used by both MzScheme and MrEd. */ /* This command-line parser is used by both MzScheme and MrEd. */
/***************************************************************/ /***************************************************************/
#define SDESC "Set! works on undefined identifiers.\n" #define SDESC "Set! works on undefined identifiers"
char *cmdline_exe_hack = "[Replace me for EXE hack ]"; char *cmdline_exe_hack = "[Replace me for EXE hack ]";
@ -232,6 +232,32 @@ static char *make_require_coll(const char *coll)
return make_require_lib(s, coll); return make_require_lib(s, coll);
} }
static char *make_require_planet(const char *file, const char *file_sfx,
const char *user,
const char *pkg, char *pkg_sfx)
{
char *s;
pkg = protect_quote_backslash(pkg);
user = protect_quote_backslash(user);
s = (char *)malloc(strlen(file)
+ strlen(file_sfx)
+ strlen(user)
+ strlen(pkg)
+ strlen(pkg_sfx) + 46);
strcpy(s, "(require (planet \"");
strcat(s, file);
strcat(s, file_sfx);
strcat(s, "\" (\"");
strcat(s, user);
strcat(s, "\" \"");
strcat(s, pkg);
strcat(s, pkg_sfx);
strcat(s, "\")))");
return s;
}
static char *make_embedded_load(const char *start, const char *end) static char *make_embedded_load(const char *start, const char *end)
{ {
char *s; char *s;
@ -260,6 +286,7 @@ static char *make_embedded_load(const char *start, const char *end)
#define mzcmd_MAIN 2 #define mzcmd_MAIN 2
typedef struct { typedef struct {
int start_with_req;
#ifndef DONT_PARSE_COMMAND_LINE #ifndef DONT_PARSE_COMMAND_LINE
char **evals_and_loads; char **evals_and_loads;
int *eval_kind, num_enl; int *eval_kind, num_enl;
@ -288,6 +315,10 @@ static int finish_cmd_line_run(FinishArgs *fa, Repl_Proc repl)
{ {
volatile int exit_val = 0; volatile int exit_val = 0;
if (fa->start_with_req) {
scheme_eval_string("(require mzscheme)", fa->global_env);
}
#ifndef DONT_LOAD_INIT_FILE #ifndef DONT_LOAD_INIT_FILE
if (!fa->no_init_file) { if (!fa->no_init_file) {
char *filename; char *filename;
@ -459,10 +490,6 @@ static void init_mred(Scheme_Env *global_env)
int osk_not_console = 0; int osk_not_console = 0;
#endif #endif
#if defined(_IBMR2)
static void dangerdanger(int);
#endif
#ifndef MZ_XFORM #ifndef MZ_XFORM
# ifndef GC_CAN_IGNORE # ifndef GC_CAN_IGNORE
# define GC_CAN_IGNORE /**/ # define GC_CAN_IGNORE /**/
@ -484,6 +511,7 @@ static int run_from_cmd_line(int argc, char *_argv[],
int no_more_switches = 0; int no_more_switches = 0;
int mute_banner = 0; int mute_banner = 0;
int no_argv = 0; int no_argv = 0;
int start_with_req = 0;
#endif #endif
#if !defined(DONT_RUN_REP) || !defined(DONT_PARSE_COMMAND_LINE) #if !defined(DONT_RUN_REP) || !defined(DONT_PARSE_COMMAND_LINE)
int no_rep = 0; int no_rep = 0;
@ -747,6 +775,8 @@ static int run_from_cmd_line(int argc, char *_argv[],
argv[0] = "-X"; argv[0] = "-X";
else if (!strcmp("--search", argv[0])) else if (!strcmp("--search", argv[0]))
argv[0] = "-S"; argv[0] = "-S";
else if (!strcmp("--prim", argv[0]))
argv[0] = "-Q";
# ifndef MZSCHEME_CMD_LINE # ifndef MZSCHEME_CMD_LINE
else if (!strcmp("--nogui", argv[0])) else if (!strcmp("--nogui", argv[0]))
argv[0] = "-Z"; argv[0] = "-Z";
@ -761,10 +791,6 @@ static int run_from_cmd_line(int argc, char *_argv[],
else if (!strcmp("--yield", argv[0])) else if (!strcmp("--yield", argv[0]))
argv[0] = "-V"; argv[0] = "-V";
# endif # endif
#if defined(_IBMR2)
else if (!strcmp("--persistent", argv[0]))
argv[0] = "-p";
#endif
else if (!strcmp("--restore", argv[0])) { else if (!strcmp("--restore", argv[0])) {
PRINTF("--restore or -R<file> must be the first (and only) switch\n"); PRINTF("--restore or -R<file> must be the first (and only) switch\n");
goto show_need_help; goto show_need_help;
@ -945,6 +971,45 @@ static int run_from_cmd_line(int argc, char *_argv[],
evals_and_loads[num_enl] = se; evals_and_loads[num_enl] = se;
eval_kind[num_enl++] = mzcmd_EVAL; eval_kind[num_enl++] = mzcmd_EVAL;
break; break;
case 'p':
if (argc < 4) {
PRINTF("%s: missing %s after %s switch\n",
prog,
((argc > 2)
? "package"
: ((argc > 1)
? "user and package"
: "file, user, and package")),
real_switch);
goto show_need_help;
}
argv++;
--argc;
se = make_require_planet(argv[0], "", argv[1], argv[2], "");
evals_and_loads[num_enl] = se;
argv += 2;
argc -= 2;
eval_kind[num_enl++] = mzcmd_EVAL;
break;
case 'P':
if (argc < 3) {
PRINTF("%s: missing %s after %s switch\n",
prog,
(argc < 2) ? "package/file base name and user" : "package",
real_switch);
goto show_need_help;
}
argv++;
--argc;
se = make_require_planet(argv[0], ".ss", argv[1], argv[0], ".plt");
evals_and_loads[num_enl] = se;
argv++;
--argc;
eval_kind[num_enl++] = mzcmd_EVAL;
break;
case 'Q':
start_with_req = 1;
break;
case 'w': case 'w':
se = make_require_lib("awk.ss", "mzlib"); se = make_require_lib("awk.ss", "mzlib");
evals_and_loads[num_enl] = se; evals_and_loads[num_enl] = se;
@ -1018,11 +1083,6 @@ static int run_from_cmd_line(int argc, char *_argv[],
no_front = 1; no_front = 1;
break; break;
#endif #endif
#if defined(_IBMR2)
case 'p':
signal(SIGDANGER, dangerdanger);
break;
#endif
#ifdef USE_OSKIT_CONSOLE #ifdef USE_OSKIT_CONSOLE
case 'S': case 'S':
osk_not_console = 1; osk_not_console = 1;
@ -1052,7 +1112,7 @@ static int run_from_cmd_line(int argc, char *_argv[],
PRINTF(BANNER); PRINTF(BANNER);
#ifdef MZSCHEME_CMD_LINE #ifdef MZSCHEME_CMD_LINE
if (scheme_get_allow_set_undefined()) if (scheme_get_allow_set_undefined())
PRINTF(SDESC); PRINTF(SDESC ".\n");
# ifdef DOS_FILE_SYSTEM # ifdef DOS_FILE_SYSTEM
# if !defined(FILES_HAVE_FDS) # if !defined(FILES_HAVE_FDS)
# if !defined(WINDOWS_FILE_HANDLES) # if !defined(WINDOWS_FILE_HANDLES)
@ -1139,6 +1199,7 @@ static int run_from_cmd_line(int argc, char *_argv[],
#endif #endif
fa = (FinishArgs *)scheme_malloc(sizeof(FinishArgs)); fa = (FinishArgs *)scheme_malloc(sizeof(FinishArgs));
fa->start_with_req = start_with_req;
#ifndef DONT_PARSE_COMMAND_LINE #ifndef DONT_PARSE_COMMAND_LINE
fa->evals_and_loads = evals_and_loads; fa->evals_and_loads = evals_and_loads;
fa->eval_kind = eval_kind; fa->eval_kind = eval_kind;
@ -1168,93 +1229,94 @@ static int run_from_cmd_line(int argc, char *_argv[],
#ifndef DONT_PARSE_COMMAND_LINE #ifndef DONT_PARSE_COMMAND_LINE
show_help: show_help:
prog =("%s" prog =("%s"
PROGRAM_LC " [<option> ...] <argument> ...\n"
# ifndef MZSCHEME_CMD_LINE # ifndef MZSCHEME_CMD_LINE
# ifdef wx_x # ifdef wx_x
" X switches (must precede all other flags):\n" " X options (must precede all other options):\n"
" -display <display>, -geometry <geometry>, -fn <font>, -font <font>,\n" " -display <display>, -geometry <geometry>, -fn <font>, -font <font>,\n"
" -bg <color>, -background <color>, -fg <color>, -foreground <color>,\n" " -bg <color>, -background <color>, -fg <color>, -foreground <color>,\n"
" -iconic, -name <name>, -rv, -reverse, +rv, -selectionTimeout <timeout>,\n" " -iconic, -name <name>, -rv, -reverse, +rv, -selectionTimeout <timeout>,\n"
" -synchronous, -title <title>, -xnllanguage <language>, -xrm <file>\n" " -synchronous, -title <title>, -xnllanguage <language>, -xrm <file>\n"
# endif # endif
# endif # endif
" Startup file and expression switches:\n" " Startup file and expression options:\n"
" -e <expr>, --eval <expr> : Evaluates <expr> after " PROGRAM " starts.\n" " -e <expr>, --eval <expr> : Evaluates <expr> after " PROGRAM " starts\n"
" -f <file>, --load <file> : Loads <file> after " PROGRAM " starts.\n" " -f <file>, --load <file> : Loads <file> after " PROGRAM " starts\n"
" -d <file>, --load-cd <file> : Load/cds <file> after " PROGRAM " starts.\n" " -d <file>, --load-cd <file> : Load/cds <file> after " PROGRAM " starts\n"
" -t <file>, --require <file> : Requires <file> after " PROGRAM " starts.\n" " -t <file>, --require <file> : Requires <file> after " PROGRAM " starts\n"
" -F, --Load : Loads all remaining arguments after " PROGRAM " starts.\n" " -F, --Load : Loads all remaining arguments after " PROGRAM " starts\n"
" -D, --Load-cd : Load/cds all remaining arguments after " PROGRAM " starts.\n" " -D, --Load-cd : Load/cds all remaining arguments after " PROGRAM " starts\n"
" -T, --Require : Requires all remaining arguments after " PROGRAM " starts.\n" " -T, --Require : Requires all remaining arguments after " PROGRAM " starts\n"
" -l <file>, --mzlib <file> : Same as -e '(require (lib \"<file>\"))'.\n" " -l <file>, --mzlib <file> : Same as -e '(require (lib \"<file>\"))'\n"
" -L <file> <coll> : Same as -e '(require (lib \"<file>\" \"<coll>\"))'.\n" " -L <file> <coll> : Same as -e '(require (lib \"<file>\" \"<coll>\"))'\n"
" -M <coll> : Same as -e '(require (lib \"<coll>.ss\" \"<coll>\"))'.\n" " -M <coll> : Same as -e '(require (lib \"<coll>.ss\" \"<coll>\"))'\n"
" -r, --script : Script mode: use as last switch for scripts. Same as -fmv-.\n" " -p <fl> <u> <pkg> : Same as -e '(require (planet \"<fl>\" (\"<u>\" \"<pkg>\"))'\n"
" -i, --script-cd : Like -r, but also sets the directory. Same as -dmv-.\n" " -P <nm> <u> : Same as -e '(require (planet \"<nm>.ss\" (\"<u>\" \"<nm>.plt\"))'\n"
" -u, --require-script : Like -r, but requires a module. Same as -tmv-.\n" " -r, --script : Script mode: use as last option for scripts; same as -fmv-\n"
" -i, --script-cd : Like -r, but also sets the directory; same as -dmv-\n"
" -u, --require-script : Like -r, but requires a module; same as -tmv-\n"
# ifndef MZSCHEME_CMD_LINE # ifndef MZSCHEME_CMD_LINE
" -Z, --nogui : Skip \"class.ss\" & \"mred.ss\" require, load handler set.\n" " -Z, --nogui : Skip \"class.ss\" & \"mred.ss\" require, load handler set\n"
# endif # endif
# ifdef CMDLINE_STDIO_FLAG # ifdef CMDLINE_STDIO_FLAG
" -z, --stdio : Show version, use read-eval-print-loop (not graphical-...).\n" " -z, --stdio : Show version, use read-eval-print-loop (not graphical-...)\n"
" -K, --back : Don't bring application to the foreground (Mac OS X).\n" " -K, --back : Don't bring application to the foreground (Mac OS X)\n"
# endif # endif
" -w, --awk : Same as -l awk.ss.\n" " -w, --awk : Same as -l awk.ss\n"
" -k <n> <m> : Load executable-embedded code from file offset <n> to <m>.\n" " -k <n> <m> : Load executable-embedded code from file offset <n> to <m>\n"
" -C, --main : Like -r, then call `main' w/argument list; car is file name.\n" " -C, --main : Like -r, then call `main' w/argument list; car is file name\n"
" Initialization switches:\n" " Initialization options:\n"
" -X <dir>, --collects <dir> : Main collects at <dir> relative to " PROGRAM ".\n" " -X <dir>, --collects <dir> : Main collects at <dir> relative to " PROGRAM "\n"
" -S <dir>, --search <dir> : More collects at <dir> relative to " PROGRAM ".\n" " -S <dir>, --search <dir> : More collects at <dir> relative to " PROGRAM "\n"
" -U, --no-user-path : Ignores user-specific collects, etc.\n" " -U, --no-user-path : Ignores user-specific collects, etc.\n"
" -x, --no-lib-path : Skips trying to set current-library-collection-paths.\n" " -x, --no-lib-path : Skips trying to set current-library-collection-paths\n"
" -q, --no-init-file : Skips trying to load " INIT_FILENAME ".\n" " -q, --no-init-file : Skips trying to load " INIT_FILENAME "\n"
" -N <file>, --name <file> : Sets `program' to <file>.\n" " -N <file>, --name <file> : Sets `program' to <file>\n"
" -A : Skips defining `argv' and `program'.\n" " -A : Skips defining `argv' and `program'\n"
# ifdef MZ_USE_JIT # ifdef MZ_USE_JIT
" -j, --no-jit : Disables just-in-time compiler.\n" " -j, --no-jit : Disables just-in-time compiler\n"
# else # else
" -j, --no-jit : No effect, since the just-in-time compiler is unavailable.\n" " -j, --no-jit : No effect, since the just-in-time compiler is unavailable\n"
# endif
" Language setting switches:\n"
" -g, --case-sens : Identifiers/symbols are initially case-sensitive.\n"
" -G, --case-insens : Identifiers/symbols are initially case-insensitive.\n"
" -s, --set-undef : " SDESC
" Miscellaneous switches:\n"
" -- : No argument following this switch is used as a switch.\n"
# if defined(_IBMR2)
" -p, --persistent : Catches SIGDANGER (low page space) signal.\n"
# endif # endif
" Language setting options:\n"
" -Q, --prim : Assume primitive bindings at top level\n"
" -g, --case-sens : Identifiers/symbols are initially case-sensitive\n"
" -G, --case-insens : Identifiers/symbols are initially case-insensitive\n"
" -s, --set-undef : " SDESC "\n"
" Miscellaneous options:\n"
" -- : No argument following this switch is used as a switch\n"
" -m, --mute-banner : Suppresses " " -m, --mute-banner : Suppresses "
# ifdef MZSCHEME_CMD_LINE # ifdef MZSCHEME_CMD_LINE
"the startup banner" "the startup banner"
# else # else
"-v/--version/-z/--stdio" "-v/--version/-z/--stdio"
# endif # endif
" text.\n" " text\n"
" -v, --version : Suppresses the read-eval-print loop" " -v, --version : Suppresses the read-eval-print loop"
# ifdef MZSCHEME_CMD_LINE # ifdef MZSCHEME_CMD_LINE
".\n" "\n"
# else # else
", prints version.\n" ", prints version\n"
# endif # endif
# ifdef VERSION_YIELD_FLAG # ifdef VERSION_YIELD_FLAG
" -V, --no-yield : Like -v, also suppresses (yield 'wait).\n" " -V, --no-yield : Like -v, also suppresses (yield 'wait)\n"
# endif # endif
" -b, --binary : Read stdin and write stdout/stderr in binary mode.\n" " -b, --binary : Read stdin and write stdout/stderr in binary mode\n"
" -h, --help : Shows this information and exits, ignoring other switches.\n" " -h, --help : Shows this information and exits, ignoring other options\n"
"Multiple single-letter switches can be collapsed, with arguments placed\n" "Multiple single-letter switches can be collapsed, with arguments placed\n"
" after the collapsed switches; the first collapsed switch cannot be --.\n" " after the collapsed switches; the first collapsed switch cannot be --.\n"
" E.g.: `-vfme file expr' is the same as `-v -f file -m -e expr'.\n" " E.g.: `-vfme file expr' is the same as `-v -f file -m -e expr'\n"
"Extra arguments following the last switch are put into the Scheme global\n" "Extra arguments following the last option are put into the Scheme global\n"
" variable `argv' as a vector of strings. The name used to start " PROGRAM "\n" " variable `argv' as a vector of strings. The name used to start " PROGRAM "\n"
" is put into the global variable `program' as a string.\n" " is put into the global variable `program' as a string.\n"
"Expressions/files/--main/etc. are evaluated/loaded in order as provided.\n" "Expressions/files/--main/etc. are evaluated/loaded in order as provided.\n"
" An error during evaluation/loading causes later ones to be skipped.\n" " An error during evaluation/loading causes later ones to be skipped.\n"
"The current-library-collection-paths is automatically set before any\n" "The current-library-collection-paths is automatically set before any\n"
" expressions/files are evaluated/loaded, unless the -x or --no-lib-path\n" " expressions/files are evaluated/loaded, unless the -x or --no-lib-path\n"
" switch is used.\n" " option is used.\n"
"The file " INIT_FILENAME "The file " INIT_FILENAME
" is loaded before any provided expressions/files\n" " is loaded before any provided expressions/files\n"
" are evaluated/loaded, unless the -q or --no-init-file switch is used.\n" " are evaluated/loaded, unless the -q or --no-init-file option is used.\n"
# ifdef MACINTOSH_EVENTS # ifdef MACINTOSH_EVENTS
"\n" "\n"
"Macintosh Startup files are alphabetized and put after the -F switch\n" "Macintosh Startup files are alphabetized and put after the -F switch\n"

View File

@ -183,15 +183,6 @@ static void user_break_hit(int ignore)
#endif #endif
#if defined(_IBMR2)
static void dangerdanger(int ignored)
{
char *s = "mzscheme: Danger - paging space low\n";
write(2, s, strlen(s));
scheme_collect_garbage();
}
#endif
/*========================================================================*/ /*========================================================================*/
/* main */ /* main */
/*========================================================================*/ /*========================================================================*/

View File

@ -3860,12 +3860,12 @@ int scheme_block_until(Scheme_Ready_Fun _f, Scheme_Needs_Wakeup_Fun fdf,
/* We make an sinfo to be polite, but we also assume /* We make an sinfo to be polite, but we also assume
that f will not generate any redirections! */ that f will not generate any redirections! */
init_schedule_info(&sinfo, 0, sleep_end); init_schedule_info(&sinfo, NULL, sleep_end);
while (!(result = f((Scheme_Object *)data, &sinfo))) { while (!(result = f((Scheme_Object *)data, &sinfo))) {
sleep_end = sinfo.sleep_end; sleep_end = sinfo.sleep_end;
if (sinfo.spin) { if (sinfo.spin) {
init_schedule_info(&sinfo, 0, 0.0); init_schedule_info(&sinfo, NULL, 0.0);
scheme_thread_block(0.0); scheme_thread_block(0.0);
scheme_current_thread->ran_some = 1; scheme_current_thread->ran_some = 1;
} else { } else {