Added PyMac_Initialize() routine, to be used by embedding programs (in
stead of standard Py_Initialize(), which it calls).
This commit is contained in:
parent
5cd752028c
commit
52ac037249
|
@ -102,3 +102,4 @@ PyObject *PyMac_BuildEventRecord(EventRecord *); /* Convert EventRecord to PyObj
|
|||
int PyMac_GetFixed(PyObject *, Fixed *); /* argument parser for Fixed */
|
||||
PyObject *PyMac_BuildFixed(Fixed); /* Convert Fixed to PyObject */
|
||||
void PyMac_InitApplet(void); /* Initialize and run an Applet */
|
||||
void PyMac_Initialize(void); /* Initialize function for embedding Python */
|
||||
|
|
|
@ -192,7 +192,7 @@ PyMac_InteractiveOptions(PyMac_PrefRecord *p, int *argcp, char ***argvp)
|
|||
** Initialization code, shared by interpreter and applets
|
||||
*/
|
||||
static void
|
||||
init_common(int *argcp, char ***argvp)
|
||||
init_common(int *argcp, char ***argvp, int embedded)
|
||||
{
|
||||
/* Remember resource fork refnum, for later */
|
||||
PyMac_AppRefNum = CurResFile();
|
||||
|
@ -223,11 +223,18 @@ init_common(int *argcp, char ***argvp)
|
|||
options.keep_error = 1; /* default-default */
|
||||
PyMac_PreferenceOptions(&options);
|
||||
|
||||
if ( embedded ) {
|
||||
static char *emb_argv[] = {"embedded-python", 0};
|
||||
|
||||
*argcp = 1;
|
||||
*argvp = emb_argv;
|
||||
} else {
|
||||
/* Create argc/argv. Do it before we go into the options event loop. */
|
||||
*argcp = PyMac_GetArgv(argvp, options.noargs);
|
||||
|
||||
/* Do interactive option setting, if allowed and <option> depressed */
|
||||
PyMac_InteractiveOptions(&options, argcp, argvp);
|
||||
}
|
||||
|
||||
/* Copy selected options to where the machine-independent stuff wants it */
|
||||
Py_VerboseFlag = options.verbose;
|
||||
|
@ -310,7 +317,7 @@ PyMac_InitApplet()
|
|||
char **argv;
|
||||
int err;
|
||||
|
||||
init_common(&argc, &argv);
|
||||
init_common(&argc, &argv, 0);
|
||||
|
||||
Py_Initialize();
|
||||
PySys_SetArgv(argc, argv);
|
||||
|
@ -325,6 +332,20 @@ PyMac_InitApplet()
|
|||
/* XXX Should we bother to Py_Exit(sts)? */
|
||||
}
|
||||
|
||||
/*
|
||||
** Hook for embedding python.
|
||||
*/
|
||||
void
|
||||
PyMac_Initialize()
|
||||
{
|
||||
int argc;
|
||||
char **argv;
|
||||
|
||||
init_common(&argc, &argv, 1);
|
||||
Py_Initialize();
|
||||
PySys_SetArgv(argc, argv);
|
||||
}
|
||||
|
||||
#endif /* USE_MAC_APPLET_SUPPORT */
|
||||
|
||||
/* For normal application */
|
||||
|
@ -334,7 +355,7 @@ PyMac_InitApplication()
|
|||
int argc;
|
||||
char **argv;
|
||||
|
||||
init_common(&argc, &argv);
|
||||
init_common(&argc, &argv, 0);
|
||||
|
||||
if ( argc > 1 ) {
|
||||
/* We're running a script. Attempt to change current directory */
|
||||
|
|
|
@ -1,4 +1,5 @@
|
|||
inittab
|
||||
PyMac_Initialize
|
||||
PyExc_ZeroDivisionError
|
||||
PyExc_ValueError
|
||||
PyExc_TypeError
|
||||
|
|
File diff suppressed because it is too large
Load Diff
|
@ -12,15 +12,15 @@ IFfKKFQ9NAf0[EQCTCbjS!*!*VT2S`3'!9%9B9+k6k-%!"!!#!*!%$9"jG'K[EN0
|
|||
Z8fTb!B"08%a'VP0UFJ!!!6!!"!"3!!!!!J!"!*!)!J#3"4"YB@0KF("XD@0KG'P
|
||||
[ELjM!*!B!3#3"`1ZNqM"!!%!4J")!qF!!3!#!*!)!J%!N!313A"`8R9ZG'PYC5j
|
||||
-D@)!N"S&!*!(4J")!qF!!3!#!*!)!J%!N!308(PdD'pZ3fpbC9"33`#3'`3!N!G
|
||||
'!%J$j`!"!!-!N!J#!3#3"!YLG@jNE'8ZFR0bB`#3(3)!N!S$9@i`!!!"(J!!!3j
|
||||
34Qac!*!%!e@`M!!!!L`!!!%`8%acG!#3#a`!!!!#8&0PCrrr!*!*(J!!!3"38f9
|
||||
R!!%!!$!e!!!"!!!!*"m!!#-I!!!#XJ#3"9S!!HXF!!-!N"3,8(PdD'pZ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