From 4a5eb967b8b50bfc301d83d5d3234501db8f0a17 Mon Sep 17 00:00:00 2001 From: Jack Jansen Date: Fri, 22 Sep 2000 21:50:11 +0000 Subject: [PATCH] Keepconsole is now a 4-way option: never/errorexit/unseen output/always. Default is "unseen output". Upped the Popt version number. --- Mac/Include/macbuildno.h | 2 +- Mac/Include/pythonresources.h | 27 +++++++-------- Mac/Lib/pythonprefs.py | 6 ++-- Mac/Python/macmain.c | 55 ++++++++++++++++++++++++------- Mac/Resources/dialogs.rsrc | Bin 17829 -> 17903 bytes Mac/Resources/pythonpath.r | 11 ++++--- Mac/scripts/EditPythonPrefs.py | 42 ++++++++++++++++------- Mac/scripts/EditPythonPrefs.rsrc | Bin 8994 -> 9068 bytes 8 files changed, 97 insertions(+), 46 deletions(-) diff --git a/Mac/Include/macbuildno.h b/Mac/Include/macbuildno.h index 7cced7773f1..f1bf41a5a6f 100644 --- a/Mac/Include/macbuildno.h +++ b/Mac/Include/macbuildno.h @@ -1 +1 @@ -#define BUILD 55 +#define BUILD 66 diff --git a/Mac/Include/pythonresources.h b/Mac/Include/pythonresources.h index 178260826c2..0b74328d020 100644 --- a/Mac/Include/pythonresources.h +++ b/Mac/Include/pythonresources.h @@ -68,9 +68,11 @@ OF OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE. #define OPT_OPTIMIZE 5 #define OPT_UNBUFFERED 6 #define OPT_DEBUGGING 7 -#define OPT_KEEPNORMAL 8 -#define OPT_KEEPERROR 9 -#define OPT_CMDLINE 10 +#define OPT_KEEPALWAYS 8 +#define OPT_KEEPOUTPUT 9 +#define OPT_KEEPERROR 10 +#define OPT_KEEPNEVER 11 +#define OPT_CMDLINE 12 #define OPT_TABWARN 13 #define OPT_NOSITE 14 #define OPT_HELP 15 @@ -134,17 +136,12 @@ OF OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE. /* The Python options resource and offset of its members */ #define PYTHONOPTIONS_ID 228 #define PYTHONOPTIONSOVERRIDE_ID 229 -#if 0 -#define POPT_INSPECT 0 -#define POPT_VERBOSE 1 -#define POPT_OPTIMIZE 2 -#define POPT_UNBUFFERED 3 -#define POPT_DEBUGGING 4 -#define POPT_KEEPNORM 5 -#define POPT_KEEPERR 6 -#endif -#define POPT_VERSION_CURRENT 5 /* Current version number */ +#define POPT_VERSION_CURRENT 6 /* Current version number */ +#define POPT_KEEPCONSOLE_NEVER 0 +#define POPT_KEEPCONSOLE_OUTPUT 1 +#define POPT_KEEPCONSOLE_ERROR 2 +#define POPT_KEEPCONSOLE_ALWAYS 3 #ifndef rez typedef struct PyMac_PrefRecord { @@ -154,8 +151,8 @@ typedef struct PyMac_PrefRecord { unsigned char optimize; unsigned char unbuffered; unsigned char debugging; - unsigned char keep_normal; - unsigned char keep_error; + unsigned char unused; + unsigned char keep_console; unsigned char nointopt; unsigned char noargs; unsigned char tabwarn; diff --git a/Mac/Lib/pythonprefs.py b/Mac/Lib/pythonprefs.py index 916ec9f2b37..81d095f3f67 100644 --- a/Mac/Lib/pythonprefs.py +++ b/Mac/Lib/pythonprefs.py @@ -16,7 +16,7 @@ OVERRIDE_POPT_ID = 229 OVERRIDE_GUSI_ID = 10241 # version -CUR_VERSION=5 +CUR_VERSION=6 preffilename = PstringLoader(AnyResLoader('STR ', resname=PREFNAME_NAME)).load() pref_fss = preferencefile(preffilename, 'Pyth', 'pref') @@ -88,7 +88,7 @@ class PythonOptions: dict['creator'], dict['type'], dict['delayconsole'] = self.gusi.load() flags = self.popt.load() dict['version'], dict['inspect'], dict['verbose'], dict['optimize'], \ - dict['unbuffered'], dict['debugging'], dict['keepopen'], dict['keeperror'], \ + dict['unbuffered'], dict['debugging'], dummy, dict['keep_console'], \ dict['nointopt'], dict['noargs'], dict['tabwarn'], \ dict['nosite'], dict['nonavservice'] = flags return dict @@ -99,7 +99,7 @@ class PythonOptions: self.dir.save(diralias) self.gusi.save((dict['creator'], dict['type'], dict['delayconsole'])) flags = dict['version'], dict['inspect'], dict['verbose'], dict['optimize'], \ - dict['unbuffered'], dict['debugging'], dict['keepopen'], dict['keeperror'], \ + dict['unbuffered'], dict['debugging'], 0, dict['keep_console'], \ dict['nointopt'], dict['noargs'], dict['tabwarn'], \ dict['nosite'], dict['nonavservice'] self.popt.save(flags) diff --git a/Mac/Python/macmain.c b/Mac/Python/macmain.c index c46fd2f62e0..3531f4c2bac 100644 --- a/Mac/Python/macmain.c +++ b/Mac/Python/macmain.c @@ -53,6 +53,9 @@ extern int ccommand(char ***); #ifdef USE_MAC_SHARED_LIBRARY extern PyMac_AddLibResources(void); #endif +#ifdef USE_GUSI +#include "GUSISIOUX.h" +#endif #define STARTUP "PythonStartup" @@ -151,8 +154,15 @@ PyMac_InteractiveOptions(PyMac_PrefRecord *p, int *argcp, char ***argvp) SET_OPT_ITEM(OPT_OPTIMIZE, optimize); SET_OPT_ITEM(OPT_UNBUFFERED, unbuffered); SET_OPT_ITEM(OPT_DEBUGGING, debugging); - SET_OPT_ITEM(OPT_KEEPNORMAL, keep_normal); - SET_OPT_ITEM(OPT_KEEPERROR, keep_error); + GetDialogItem(dialog, OPT_KEEPALWAYS, &type, (Handle *)&handle, &rect); + SetControlValue(handle, (short)(p->keep_console == POPT_KEEPCONSOLE_ALWAYS)); + GetDialogItem(dialog, OPT_KEEPOUTPUT, &type, (Handle *)&handle, &rect); + SetControlValue(handle, (short)(p->keep_console == POPT_KEEPCONSOLE_OUTPUT)); + GetDialogItem(dialog, OPT_KEEPERROR, &type, (Handle *)&handle, &rect); + SetControlValue(handle, (short)(p->keep_console == POPT_KEEPCONSOLE_ERROR)); + GetDialogItem(dialog, OPT_KEEPNEVER, &type, (Handle *)&handle, &rect); + SetControlValue(handle, (short)(p->keep_console == POPT_KEEPCONSOLE_NEVER)); +/* SET_OPT_ITEM(OPT_KEEPCONSOLE, keep_console); */ SET_OPT_ITEM(OPT_TABWARN, tabwarn); SET_OPT_ITEM(OPT_NOSITE, nosite); SET_OPT_ITEM(OPT_NONAVSERV, nonavservice); @@ -204,8 +214,18 @@ PyMac_InteractiveOptions(PyMac_PrefRecord *p, int *argcp, char ***argvp) OPT_ITEM(OPT_OPTIMIZE, optimize); OPT_ITEM(OPT_UNBUFFERED, unbuffered); OPT_ITEM(OPT_DEBUGGING, debugging); - OPT_ITEM(OPT_KEEPNORMAL, keep_normal); - OPT_ITEM(OPT_KEEPERROR, keep_error); + if ( item == OPT_KEEPALWAYS ) p->keep_console = POPT_KEEPCONSOLE_ALWAYS; + if ( item == OPT_KEEPOUTPUT ) p->keep_console = POPT_KEEPCONSOLE_OUTPUT; + if ( item == OPT_KEEPERROR ) p->keep_console = POPT_KEEPCONSOLE_ERROR; + if ( item == OPT_KEEPNEVER ) p->keep_console = POPT_KEEPCONSOLE_NEVER; + GetDialogItem(dialog, OPT_KEEPALWAYS, &type, (Handle *)&handle, &rect); + SetControlValue(handle, (short)(p->keep_console == POPT_KEEPCONSOLE_ALWAYS)); + GetDialogItem(dialog, OPT_KEEPOUTPUT, &type, (Handle *)&handle, &rect); + SetControlValue(handle, (short)(p->keep_console == POPT_KEEPCONSOLE_OUTPUT)); + GetDialogItem(dialog, OPT_KEEPERROR, &type, (Handle *)&handle, &rect); + SetControlValue(handle, (short)(p->keep_console == POPT_KEEPCONSOLE_ERROR)); + GetDialogItem(dialog, OPT_KEEPNEVER, &type, (Handle *)&handle, &rect); + SetControlValue(handle, (short)(p->keep_console == POPT_KEEPCONSOLE_NEVER)); OPT_ITEM(OPT_TABWARN, tabwarn); OPT_ITEM(OPT_NOSITE, nosite); OPT_ITEM(OPT_NONAVSERV, nonavservice); @@ -252,7 +272,7 @@ init_common(int *argcp, char ***argvp, int embedded) #endif /* Get options from preference file (or from applet resource fork) */ - options.keep_error = 1; /* default-default */ + options.keep_console = POPT_KEEPCONSOLE_OUTPUT; /* default-default */ PyMac_PreferenceOptions(&options); if ( embedded ) { @@ -281,7 +301,7 @@ init_common(int *argcp, char ***argvp, int embedded) } /* Copy selected options to where the machine-independent stuff wants it */ - Py_VerboseFlag = options.verbose *2; + Py_VerboseFlag = options.verbose; /* Py_SuppressPrintingFlag = options.suppress_print; */ Py_OptimizeFlag = options.optimize; Py_DebugFlag = options.debugging; @@ -525,18 +545,31 @@ void PyMac_Exit(status) int status; { - int keep; + int keep = 0; #if __profile__ == 1 ProfilerDump("\pPython Profiler Results"); ProfilerTerm(); #endif - if ( status ) - keep = options.keep_error; - else - keep = options.keep_normal; #ifdef USE_SIOUX + switch (options.keep_console) { + case POPT_KEEPCONSOLE_NEVER: + keep = 0; + break; + case POPT_KEEPCONSOLE_OUTPUT: + if (gusisioux_state == GUSISIOUX_STATE_LASTWRITE || + gusisioux_state == GUSISIOUX_STATE_UNKNOWN ) + keep = 1; + else + keep = 0; + break; + case POPT_KEEPCONSOLE_ERROR: + keep = (status != 0); + break; + default: + keep = 1; + } if (keep) { SIOUXSettings.standalone = 1; SIOUXSettings.autocloseonquit = 0; diff --git a/Mac/Resources/dialogs.rsrc b/Mac/Resources/dialogs.rsrc index 907b9d012bb9564af372fdfbccc7999a29b00c07..4a84dd63cd501c59185e7c3f9c0705b90ca2f9a8 100644 GIT binary patch delta 604 zcmZ|LO=uHA6bJA(ue+OVw0;)0v``ks5302lll`D+niT0lN~B0oAqX)n5((L`yYb^7 z7^qMzw$^v@Dk@S>8u3_i>!~32;7KXD1U%?P!9$?VOaq?W!_060@4cO2UoEqr%k1ei zd$N{3qjmvO-FMYovbo|eDG2kl;HIfHen`Opj!-N4`)V5u_yrA3%U13d?}s3sHZ1b2 zs}1CBZE&l;PY)xA~mQseBW9hSOkoDt70PBrBtAk$v+)27U z^GOso0i2~?f!{5)L%EE7T`?hXO{7dkgZsO*hNnzO>e4ZExKB#!c!|3q-H!$Cx6+8K zCRiouK77Ibh`wcN{Mg-H0Q<2hKu37$HQmh4Vd4X=XK!HQA;o9s3wv$O%YSXojxf{2 zNMb`;7f$A-`=qy}QP{Gj0V}+Rzw=p!4|qP(d_SureZIIobnr@445E6?^lMSsuZFS9 Gd;4FA@s0@q delta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