mirror of
https://github.com/python/cpython.git
synced 2025-07-23 11:15:24 +00:00
Store default startup options in preference file or
app.
This commit is contained in:
parent
532e3c2bf6
commit
a4b7e14df8
3 changed files with 66 additions and 4 deletions
|
@ -263,3 +263,37 @@ out:
|
|||
}
|
||||
#endif /* !USE_BUILTIN_PATH */
|
||||
|
||||
void
|
||||
PyMac_PreferenceOptions(int *inspect, int *verbose, int *suppress_print,
|
||||
int *unbuffered, int *debugging, int *keep_normal,
|
||||
int *keep_error)
|
||||
{
|
||||
short oldrh, prefrh;
|
||||
Handle handle;
|
||||
int size;
|
||||
char *p;
|
||||
|
||||
|
||||
oldrh = CurResFile();
|
||||
prefrh = PyMac_OpenPrefFile();
|
||||
handle = GetResource('Popt', PYTHONOPTIONS_ID);
|
||||
if ( handle == NULL ) {
|
||||
return;
|
||||
}
|
||||
HLock(handle);
|
||||
size = GetHandleSize(handle);
|
||||
p = (char *)*handle;
|
||||
|
||||
if ( size > POPT_INSPECT ) *inspect = p[POPT_INSPECT];
|
||||
if ( size > POPT_VERBOSE ) *verbose = p[POPT_VERBOSE];
|
||||
if ( size > POPT_SUPPRESS ) *suppress_print = p[POPT_SUPPRESS];
|
||||
if ( size > POPT_UNBUFFERED ) *unbuffered = p[POPT_UNBUFFERED];
|
||||
if ( size > POPT_DEBUGGING ) *debugging = p[POPT_DEBUGGING];
|
||||
if ( size > POPT_KEEPNORM ) *keep_normal = p[POPT_KEEPNORM];
|
||||
if ( size > POPT_KEEPERR ) *keep_error = p[POPT_KEEPERR];
|
||||
|
||||
HUnlock(handle);
|
||||
|
||||
CloseResFile(prefrh);
|
||||
UseResFile(oldrh);
|
||||
}
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue