mirror of
				https://github.com/python/cpython.git
				synced 2025-10-31 13:41:24 +00:00 
			
		
		
		
	- Allow setting of argc/argv in <option>-start dialog
- Set "ok" to be default button
This commit is contained in:
		
							parent
							
								
									4032c2c1ce
								
							
						
					
					
						commit
						e355c4568f
					
				
					 3 changed files with 54 additions and 30 deletions
				
			
		|  | @ -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 | ||||
|  |  | |||
|  | @ -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,13 +313,13 @@ 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 | ||||
| 		setbuf(stdout, (char *)NULL); | ||||
|  | @ -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; | ||||
|  |  | |||
|  | @ -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@8JGfKPFQ8JDA3JDA-r!*!%$!"D!'B!fJ'+!)"993!!!"8!DJ"B!0N"B!!"!3! | |||
| !!3%!!3#3"3%"!*!%3J!$!*!&@J#r!'i!q`3#6dX!N!9D!!S!EJ"%"!C$B@jMC@` | ||||
| !N!8+!!S!-!$lL!#3"MB!$3"+!2J3!*!%&3##!'3!kJ&N!!%"!!%!N!8"!J#3"&3 | ||||
| !"!#3"8d!6J"H!'3)!*!'63$!!'%!qJ3$@@9cqJ#3"8d!I`"K!,N%!Nj[!*!&63! | ||||
| +!'%!4J3'3f&ZBf9X!*!&#J!+!%B!qSJ!N!39!#J!+!%)!8B!!3%!!3#3"S-!N!6 | ||||
| +!'%!4J3'3f&ZBf9X!*!&#J!+!%B!qSJ!N!39!#J!+!%T!88!!3%!!3#3"S-!N!6 | ||||
| -!!S!N!@8!3d!TJ&G"!42F'9Z!*!&V`%0!-%"A33'3f&ZBf9X!*!%"*F!2J6R!&! | ||||
| %!*!')`$U!$F"AB!!N!C#!3d!9!&G"!9&DQ9MG!#3"P`"$3"Z!9d%"d4PFfYdEh! | ||||
| !N!C"!!i!`J$U!*!()` Jack Jansen
						Jack Jansen