1 /***********************************************************
2 Copyright 1991-1997 by Stichting Mathematisch Centrum, Amsterdam,
7 Permission to use, copy, modify, and distribute this software and its
8 documentation for any purpose and without fee is hereby granted,
9 provided that the above copyright notice appear in all copies and that
10 both that copyright notice and this permission notice appear in
11 supporting documentation, and that the names of Stichting Mathematisch
12 Centrum or CWI not be used in advertising or publicity pertaining to
13 distribution of the software without specific, written prior permission.
15 STICHTING MATHEMATISCH CENTRUM DISCLAIMS ALL WARRANTIES WITH REGARD TO
16 THIS SOFTWARE, INCLUDING ALL IMPLIED WARRANTIES OF MERCHANTABILITY AND
17 FITNESS, IN NO EVENT SHALL STICHTING MATHEMATISCH CENTRUM BE LIABLE
18 FOR ANY SPECIAL, INDIRECT OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES
19 WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, WHETHER IN AN
20 ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT
21 OF OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE.
23 ******************************************************************/
25 /* Macintosh Python main program for both applets and interpreter */
27 #include <Resources.h>
28 #include <CodeFragments.h>
30 extern void PyMac_InitApplication(void);
31 #ifdef USE_MAC_APPLET_SUPPORT
32 extern void PyMac_InitApplet(void);
33 #endif /* USE_MAC_APPLET_SUPPORT */
35 /* From the MSL runtime: */
36 extern void __initialize(void);
39 ** Alternative initialization entry point for some very special cases.
40 ** Use this in stead of __initialize in the PEF settings to remember (and
41 ** re-open as resource file) the application. This is needed if we link against
42 ** a dynamic library that, in its own __initialize routine, opens a resource
43 ** file. This would mess up our finding of override preferences.
44 ** Only set this entrypoint in your apps if you notice sys.path or some such is
47 static int application_fss_valid
;
48 static FSSpec application_fss
;
51 __initialize_remember_app_fsspec(CFragInitBlockPtr data
)
53 /* Call the MW runtime's initialization routine */
55 if ( data
== nil
) return noErr
;
56 if ( data
->fragLocator
.where
== kDataForkCFragLocator
) {
57 application_fss
= *data
->fragLocator
.u
.onDisk
.fileSpec
;
58 application_fss_valid
= 1;
59 } else if ( data
->fragLocator
.where
== kResourceCFragLocator
) {
60 application_fss
= *data
->fragLocator
.u
.inSegs
.fileSpec
;
61 application_fss_valid
= 1;
68 if ( application_fss_valid
)
69 (void)FSpOpenResFile(&application_fss
, fsRdPerm
);
70 #ifdef USE_MAC_APPLET_SUPPORT
74 mainpyc
= Get1NamedResource('PYC ', "\p__main__");
78 PyMac_InitApplication();
81 PyMac_InitApplication();
82 #endif /* USE_MAC_APPLET_SUPPORT */