- Allow setting of argc/argv in <option>-start dialog

- Set "ok" to be default button
This commit is contained in:
Jack Jansen 1996-03-12 13:29:04 +00:00
parent 4032c2c1ce
commit e355c4568f
3 changed files with 54 additions and 30 deletions

View File

@ -43,6 +43,7 @@
#define OPT_DEBUGGING 7
#define OPT_KEEPNORMAL 8
#define OPT_KEEPERROR 9
#define OPT_CMDLINE 10
/* Dialog for 'No preferences directory' */
#define NOPREFDIR_ID 133

View File

@ -208,7 +208,7 @@ PyMac_InitApplication()
void
PyMac_InteractiveOptions(int *inspect, int *verbose, int *suppress_print,
int *unbuffered, int *debugging, int *keep_normal,
int *keep_error)
int *keep_error, int *argcp, char ***argvp)
{
KeyMap rmap;
unsigned char *map;
@ -216,6 +216,8 @@ PyMac_InteractiveOptions(int *inspect, int *verbose, int *suppress_print,
ControlHandle handle;
DialogPtr dialog;
Rect rect;
int old_argc = *argcp;
int i;
/* Default-defaults: */
*keep_error = 1;
@ -233,6 +235,8 @@ PyMac_InteractiveOptions(int *inspect, int *verbose, int *suppress_print,
printf("Option dialog not found - cannot set options\n");
return;
}
SetDialogDefaultItem(dialog, OPT_OK);
SetDialogCancelItem(dialog, OPT_CANCEL);
/* Set default values */
#define SET_OPT_ITEM(num, var) \
@ -258,6 +262,24 @@ PyMac_InteractiveOptions(int *inspect, int *verbose, int *suppress_print,
DisposDialog(dialog);
exit(0);
}
if ( item == OPT_CMDLINE ) {
int new_argc, newer_argc;
char **new_argv, **newer_argv;
new_argc = ccommand(&new_argv);
newer_argc = (new_argc-1) + old_argc;
newer_argv = malloc((newer_argc+1)*sizeof(char *));
if( !newer_argv )
Py_FatalError("Cannot malloc argv\n");
for(i=0; i<old_argc; i++)
newer_argv[i] = (*argvp)[i];
for(i=old_argc; i<=newer_argc; i++) /* Copy the NULL too */
newer_argv[i] = new_argv[i-old_argc+1];
*argvp = newer_argv;
*argcp = newer_argc;
/* XXXX Is it not safe to use free() here, apparently */
}
#define OPT_ITEM(num, var) \
if ( item == (num) ) { \
*(var) = !*(var); \
@ -291,12 +313,12 @@ Py_Main(argc, argv)
int inspect = 0;
int unbuffered = 0;
PyMac_InteractiveOptions(&inspect, &Py_VerboseFlag, &Py_SuppressPrintingFlag,
&unbuffered, &Py_DebugFlag, &keep_normal, &keep_error, &argc, &argv);
orig_argc = argc; /* For getargcargv() */
orig_argv = argv;
argv0 = argv[0]; /* For getprogramname() */
PyMac_InteractiveOptions(&inspect, &Py_VerboseFlag, &Py_SuppressPrintingFlag,
&unbuffered, &Py_DebugFlag, &keep_normal, &keep_error);
if (unbuffered) {
#ifndef MPW
@ -366,7 +388,7 @@ PyMac_Exit(status)
if (keep) {
SIOUXSettings.standalone = 1;
SIOUXSettings.autocloseonquit = 0;
SIOUXSetTitle("\p«terminated»");
SIOUXSetTitle("\p´terminatedª");
}
else
SIOUXSettings.autocloseonquit = 1;

View File

@ -1,8 +1,8 @@
(This file must be converted with BinHex 4.0)
:$'4TB@a[Ch-ZFR0bB`"bFh*M8P0&4!%!N!F,5YMQ!*!%!3!!!!MI!!!(h`!!!QX
:$'4TB@a[Ch-ZFR0bB`"bFh*M8P0&4!%!N!F,GLmj!*!%!3!!!!N,!!!)#`!!!QX
f&#"8)'J!&#"3I4'`D"%!1J&R*K)[$%kk!J`-1J"DH3aND@&XEfGc,R*cFQ0c!J!
!!(*cFQ058d9%!3!!0!#!!!"bFh*M8P0&4!%!!$3!J!#3%Uc1(f3!N!B,5[m4`+K
#!(*cFQ058d9%!3!!0!#!!J"bFh*M8P0&4!%!!$3!J!#3%Uc1(f3!N!B,G[m4`+K
T!4e!%Irc%h!!%#lrmlh5%@B386Dq9@X"!8*%[D'q9@X"!6"4-J&R(N39$!!!('8
5F!!3,N-9$!!!(f)'F!&J!!%"!LaD9#dZ4,d"!"Xm!@B`*e8q'NU!)&-#+!#r!#i
L!1d*!J%!3)-Sfc36UGF[$%kk!3P+CfX"!+CA3cS!!!"d!!%!N!9,!&F!A`#4"!*
@ -17,7 +17,7 @@ JE@8JGfKPFQ8JDA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