Mercurial > cpython-lru_cache-weakref
annotate Mac/Python/macshlglue.c @ 3720:b341def4eef8 legacy-trunk
Ignore latex intermediate products.
| author | Guido van Rossum <guido@python.org> |
|---|---|
| date | Wed, 26 Jun 1996 19:30:01 +0000 |
| parents | 24bee3783b35 |
| children | 938918ff3537 |
| rev | line source |
|---|---|
|
2316
ed821a99ba39
Glue for the python shared library: an init routine that remembers
Jack Jansen <jack.jansen@cwi.nl>
parents:
diff
changeset
|
1 /* |
| 2410 | 2 ** Mac shared lib glue. |
|
2316
ed821a99ba39
Glue for the python shared library: an init routine that remembers
Jack Jansen <jack.jansen@cwi.nl>
parents:
diff
changeset
|
3 */ |
|
ed821a99ba39
Glue for the python shared library: an init routine that remembers
Jack Jansen <jack.jansen@cwi.nl>
parents:
diff
changeset
|
4 |
|
ed821a99ba39
Glue for the python shared library: an init routine that remembers
Jack Jansen <jack.jansen@cwi.nl>
parents:
diff
changeset
|
5 #include <Quickdraw.h> |
|
ed821a99ba39
Glue for the python shared library: an init routine that remembers
Jack Jansen <jack.jansen@cwi.nl>
parents:
diff
changeset
|
6 #include <SegLoad.h> |
|
ed821a99ba39
Glue for the python shared library: an init routine that remembers
Jack Jansen <jack.jansen@cwi.nl>
parents:
diff
changeset
|
7 #include <FragLoad.h> |
|
ed821a99ba39
Glue for the python shared library: an init routine that remembers
Jack Jansen <jack.jansen@cwi.nl>
parents:
diff
changeset
|
8 #include <Files.h> |
|
ed821a99ba39
Glue for the python shared library: an init routine that remembers
Jack Jansen <jack.jansen@cwi.nl>
parents:
diff
changeset
|
9 #include <Resources.h> |
|
ed821a99ba39
Glue for the python shared library: an init routine that remembers
Jack Jansen <jack.jansen@cwi.nl>
parents:
diff
changeset
|
10 |
| 2410 | 11 #ifdef __MWERKS__ |
|
3401
1df8f5a8b216
Ported to CW8 (added PRE_CW8 ifdef for CW7, for the time being)
Jack Jansen <jack.jansen@cwi.nl>
parents:
3255
diff
changeset
|
12 #ifdef PRE_CW8 |
| 2410 | 13 /* |
| 14 ** This part is copied from MW Startup.c, which is | |
| 15 ** Copyright © 1993 metrowerks inc. All Rights Reserved. | |
| 16 */ | |
| 17 #include <setjmp.h> | |
|
2316
ed821a99ba39
Glue for the python shared library: an init routine that remembers
Jack Jansen <jack.jansen@cwi.nl>
parents:
diff
changeset
|
18 #include <stdio.h> |
|
ed821a99ba39
Glue for the python shared library: an init routine that remembers
Jack Jansen <jack.jansen@cwi.nl>
parents:
diff
changeset
|
19 |
|
3255
33310cb6a5d7
Changed for the 1.3.2 compiler (CW7.5)
Jack Jansen <jack.jansen@cwi.nl>
parents:
3189
diff
changeset
|
20 /* void *__local_destructor_chain; /* chain of local objects that need destruction */ |
|
2316
ed821a99ba39
Glue for the python shared library: an init routine that remembers
Jack Jansen <jack.jansen@cwi.nl>
parents:
diff
changeset
|
21 |
|
ed821a99ba39
Glue for the python shared library: an init routine that remembers
Jack Jansen <jack.jansen@cwi.nl>
parents:
diff
changeset
|
22 /* public data */ |
|
ed821a99ba39
Glue for the python shared library: an init routine that remembers
Jack Jansen <jack.jansen@cwi.nl>
parents:
diff
changeset
|
23 |
|
ed821a99ba39
Glue for the python shared library: an init routine that remembers
Jack Jansen <jack.jansen@cwi.nl>
parents:
diff
changeset
|
24 QDGlobals qd; /* define the Quickdraw globals here! */ |
|
ed821a99ba39
Glue for the python shared library: an init routine that remembers
Jack Jansen <jack.jansen@cwi.nl>
parents:
diff
changeset
|
25 jmp_buf __program_exit; /* exit() does a longjmp() to here */ |
|
ed821a99ba39
Glue for the python shared library: an init routine that remembers
Jack Jansen <jack.jansen@cwi.nl>
parents:
diff
changeset
|
26 void (*__atexit_hook)(void); /* atexit() sets this up if it is ever called */ |
|
ed821a99ba39
Glue for the python shared library: an init routine that remembers
Jack Jansen <jack.jansen@cwi.nl>
parents:
diff
changeset
|
27 void (*___atexit_hook)(void); /* _atexit() sets this up if it is ever called */ |
|
ed821a99ba39
Glue for the python shared library: an init routine that remembers
Jack Jansen <jack.jansen@cwi.nl>
parents:
diff
changeset
|
28 int __aborting; /* abort() sets this and longjmps to __program_exit */ |
| 2410 | 29 #endif |
|
3401
1df8f5a8b216
Ported to CW8 (added PRE_CW8 ifdef for CW7, for the time being)
Jack Jansen <jack.jansen@cwi.nl>
parents:
3255
diff
changeset
|
30 #endif |
|
2316
ed821a99ba39
Glue for the python shared library: an init routine that remembers
Jack Jansen <jack.jansen@cwi.nl>
parents:
diff
changeset
|
31 |
| 2410 | 32 /* |
| 33 ** Variables passed from shared lib initialization to PyMac_AddLibResources. | |
| 34 */ | |
| 35 static int library_fss_valid; | |
| 36 static FSSpec library_fss; | |
| 37 | |
|
2316
ed821a99ba39
Glue for the python shared library: an init routine that remembers
Jack Jansen <jack.jansen@cwi.nl>
parents:
diff
changeset
|
38 /* |
|
ed821a99ba39
Glue for the python shared library: an init routine that remembers
Jack Jansen <jack.jansen@cwi.nl>
parents:
diff
changeset
|
39 ** Routine called upon fragment load. We attempt to save the FSSpec from which we're |
|
ed821a99ba39
Glue for the python shared library: an init routine that remembers
Jack Jansen <jack.jansen@cwi.nl>
parents:
diff
changeset
|
40 ** loaded. We always return noErr (we just continue without the resources). |
|
ed821a99ba39
Glue for the python shared library: an init routine that remembers
Jack Jansen <jack.jansen@cwi.nl>
parents:
diff
changeset
|
41 */ |
| 2410 | 42 OSErr pascal |
|
3255
33310cb6a5d7
Changed for the 1.3.2 compiler (CW7.5)
Jack Jansen <jack.jansen@cwi.nl>
parents:
3189
diff
changeset
|
43 PythonCore_init(InitBlockPtr data) |
|
2316
ed821a99ba39
Glue for the python shared library: an init routine that remembers
Jack Jansen <jack.jansen@cwi.nl>
parents:
diff
changeset
|
44 { |
|
3424
24bee3783b35
Added __sinit() call, so C++ initializations in shared library work
Jack Jansen <jack.jansen@cwi.nl>
parents:
3401
diff
changeset
|
45 /* Initialize C++ static data (if needed) */ |
|
24bee3783b35
Added __sinit() call, so C++ initializations in shared library work
Jack Jansen <jack.jansen@cwi.nl>
parents:
3401
diff
changeset
|
46 __sinit(); |
|
24bee3783b35
Added __sinit() call, so C++ initializations in shared library work
Jack Jansen <jack.jansen@cwi.nl>
parents:
3401
diff
changeset
|
47 |
| 2410 | 48 if ( data == nil ) return noErr; |
|
2316
ed821a99ba39
Glue for the python shared library: an init routine that remembers
Jack Jansen <jack.jansen@cwi.nl>
parents:
diff
changeset
|
49 if ( data->fragLocator.where == kOnDiskFlat ) { |
|
ed821a99ba39
Glue for the python shared library: an init routine that remembers
Jack Jansen <jack.jansen@cwi.nl>
parents:
diff
changeset
|
50 library_fss = *data->fragLocator.u.onDisk.fileSpec; |
|
ed821a99ba39
Glue for the python shared library: an init routine that remembers
Jack Jansen <jack.jansen@cwi.nl>
parents:
diff
changeset
|
51 library_fss_valid = 1; |
|
ed821a99ba39
Glue for the python shared library: an init routine that remembers
Jack Jansen <jack.jansen@cwi.nl>
parents:
diff
changeset
|
52 } else if ( data->fragLocator.where == kOnDiskSegmented ) { |
|
ed821a99ba39
Glue for the python shared library: an init routine that remembers
Jack Jansen <jack.jansen@cwi.nl>
parents:
diff
changeset
|
53 library_fss = *data->fragLocator.u.inSegs.fileSpec; |
|
ed821a99ba39
Glue for the python shared library: an init routine that remembers
Jack Jansen <jack.jansen@cwi.nl>
parents:
diff
changeset
|
54 library_fss_valid = 1; |
|
ed821a99ba39
Glue for the python shared library: an init routine that remembers
Jack Jansen <jack.jansen@cwi.nl>
parents:
diff
changeset
|
55 } |
|
ed821a99ba39
Glue for the python shared library: an init routine that remembers
Jack Jansen <jack.jansen@cwi.nl>
parents:
diff
changeset
|
56 return noErr; |
|
ed821a99ba39
Glue for the python shared library: an init routine that remembers
Jack Jansen <jack.jansen@cwi.nl>
parents:
diff
changeset
|
57 } |
|
ed821a99ba39
Glue for the python shared library: an init routine that remembers
Jack Jansen <jack.jansen@cwi.nl>
parents:
diff
changeset
|
58 |
|
ed821a99ba39
Glue for the python shared library: an init routine that remembers
Jack Jansen <jack.jansen@cwi.nl>
parents:
diff
changeset
|
59 /* |
|
ed821a99ba39
Glue for the python shared library: an init routine that remembers
Jack Jansen <jack.jansen@cwi.nl>
parents:
diff
changeset
|
60 ** Insert the library resources into the search path. Put them after |
|
ed821a99ba39
Glue for the python shared library: an init routine that remembers
Jack Jansen <jack.jansen@cwi.nl>
parents:
diff
changeset
|
61 ** the resources from the application (which we assume is the current |
|
ed821a99ba39
Glue for the python shared library: an init routine that remembers
Jack Jansen <jack.jansen@cwi.nl>
parents:
diff
changeset
|
62 ** resource file). Again, we ignore errors. |
|
ed821a99ba39
Glue for the python shared library: an init routine that remembers
Jack Jansen <jack.jansen@cwi.nl>
parents:
diff
changeset
|
63 */ |
|
ed821a99ba39
Glue for the python shared library: an init routine that remembers
Jack Jansen <jack.jansen@cwi.nl>
parents:
diff
changeset
|
64 void |
|
ed821a99ba39
Glue for the python shared library: an init routine that remembers
Jack Jansen <jack.jansen@cwi.nl>
parents:
diff
changeset
|
65 PyMac_AddLibResources() |
|
ed821a99ba39
Glue for the python shared library: an init routine that remembers
Jack Jansen <jack.jansen@cwi.nl>
parents:
diff
changeset
|
66 { |
|
ed821a99ba39
Glue for the python shared library: an init routine that remembers
Jack Jansen <jack.jansen@cwi.nl>
parents:
diff
changeset
|
67 if ( !library_fss_valid ) |
|
ed821a99ba39
Glue for the python shared library: an init routine that remembers
Jack Jansen <jack.jansen@cwi.nl>
parents:
diff
changeset
|
68 return; |
| 3189 | 69 (void)FSpOpenResFile(&library_fss, fsRdPerm); |
|
2316
ed821a99ba39
Glue for the python shared library: an init routine that remembers
Jack Jansen <jack.jansen@cwi.nl>
parents:
diff
changeset
|
70 } |
| 2410 | 71 |
