Mercurial > cpython-lru_cache-weakref
annotate Mac/Modules/gestaltmodule.c @ 80661:94de77bd0b4b 2.7
Issue #16194: document imp.load_dynamic problems
when read several extension modules from the same binary object file.
| author | Andrew Svetlov <andrew.svetlov@gmail.com> |
|---|---|
| date | Thu, 29 Nov 2012 19:51:28 +0200 |
| parents | fd25030223b0 |
| children |
| rev | line source |
|---|---|
|
2392
9dc875ad050c
added copyright header
Guido van Rossum <guido@python.org>
parents:
1892
diff
changeset
|
1 /*********************************************************** |
|
5079
d6b292a33cfe
Added/updated copyright notices
Jack Jansen <jack.jansen@cwi.nl>
parents:
5071
diff
changeset
|
2 Copyright 1991-1997 by Stichting Mathematisch Centrum, Amsterdam, |
|
2392
9dc875ad050c
added copyright header
Guido van Rossum <guido@python.org>
parents:
1892
diff
changeset
|
3 The Netherlands. |
|
9dc875ad050c
added copyright header
Guido van Rossum <guido@python.org>
parents:
1892
diff
changeset
|
4 |
|
9dc875ad050c
added copyright header
Guido van Rossum <guido@python.org>
parents:
1892
diff
changeset
|
5 All Rights Reserved |
|
9dc875ad050c
added copyright header
Guido van Rossum <guido@python.org>
parents:
1892
diff
changeset
|
6 |
|
61463
fd25030223b0
Untabify C files. Will watch buildbots.
Antoine Pitrou <solipsis@pitrou.net>
parents:
47163
diff
changeset
|
7 Permission to use, copy, modify, and distribute this software and its |
|
fd25030223b0
Untabify C files. Will watch buildbots.
Antoine Pitrou <solipsis@pitrou.net>
parents:
47163
diff
changeset
|
8 documentation for any purpose and without fee is hereby granted, |
|
2392
9dc875ad050c
added copyright header
Guido van Rossum <guido@python.org>
parents:
1892
diff
changeset
|
9 provided that the above copyright notice appear in all copies and that |
|
61463
fd25030223b0
Untabify C files. Will watch buildbots.
Antoine Pitrou <solipsis@pitrou.net>
parents:
47163
diff
changeset
|
10 both that copyright notice and this permission notice appear in |
|
2392
9dc875ad050c
added copyright header
Guido van Rossum <guido@python.org>
parents:
1892
diff
changeset
|
11 supporting documentation, and that the names of Stichting Mathematisch |
|
9dc875ad050c
added copyright header
Guido van Rossum <guido@python.org>
parents:
1892
diff
changeset
|
12 Centrum or CWI not be used in advertising or publicity pertaining to |
|
9dc875ad050c
added copyright header
Guido van Rossum <guido@python.org>
parents:
1892
diff
changeset
|
13 distribution of the software without specific, written prior permission. |
|
9dc875ad050c
added copyright header
Guido van Rossum <guido@python.org>
parents:
1892
diff
changeset
|
14 |
|
9dc875ad050c
added copyright header
Guido van Rossum <guido@python.org>
parents:
1892
diff
changeset
|
15 STICHTING MATHEMATISCH CENTRUM DISCLAIMS ALL WARRANTIES WITH REGARD TO |
|
9dc875ad050c
added copyright header
Guido van Rossum <guido@python.org>
parents:
1892
diff
changeset
|
16 THIS SOFTWARE, INCLUDING ALL IMPLIED WARRANTIES OF MERCHANTABILITY AND |
|
9dc875ad050c
added copyright header
Guido van Rossum <guido@python.org>
parents:
1892
diff
changeset
|
17 FITNESS, IN NO EVENT SHALL STICHTING MATHEMATISCH CENTRUM BE LIABLE |
|
9dc875ad050c
added copyright header
Guido van Rossum <guido@python.org>
parents:
1892
diff
changeset
|
18 FOR ANY SPECIAL, INDIRECT OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES |
|
9dc875ad050c
added copyright header
Guido van Rossum <guido@python.org>
parents:
1892
diff
changeset
|
19 WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, WHETHER IN AN |
|
9dc875ad050c
added copyright header
Guido van Rossum <guido@python.org>
parents:
1892
diff
changeset
|
20 ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT |
|
9dc875ad050c
added copyright header
Guido van Rossum <guido@python.org>
parents:
1892
diff
changeset
|
21 OF OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE. |
|
9dc875ad050c
added copyright header
Guido van Rossum <guido@python.org>
parents:
1892
diff
changeset
|
22 |
|
9dc875ad050c
added copyright header
Guido van Rossum <guido@python.org>
parents:
1892
diff
changeset
|
23 ******************************************************************/ |
|
9dc875ad050c
added copyright header
Guido van Rossum <guido@python.org>
parents:
1892
diff
changeset
|
24 |
|
1892
eec0dc5aba60
gestaltmodule.c: interface to Gestalt Manager.
Guido van Rossum <guido@python.org>
parents:
diff
changeset
|
25 /* Macintosh Gestalt interface */ |
|
eec0dc5aba60
gestaltmodule.c: interface to Gestalt Manager.
Guido van Rossum <guido@python.org>
parents:
diff
changeset
|
26 |
| 5071 | 27 #include "Python.h" |
|
30982
e543b3f0d906
Got rid of macglue.h, replacing it by pymactoolbox.h where relevant.
Jack Jansen <jack.jansen@cwi.nl>
parents:
30970
diff
changeset
|
28 #include "pymactoolbox.h" |
|
1892
eec0dc5aba60
gestaltmodule.c: interface to Gestalt Manager.
Guido van Rossum <guido@python.org>
parents:
diff
changeset
|
29 |
|
17814
2211c8995a5f
Got the first MacPython module working under MacOSX/MachO (gestalt). Main changes
Jack Jansen <jack.jansen@cwi.nl>
parents:
11220
diff
changeset
|
30 #include <Carbon/Carbon.h> |
|
1892
eec0dc5aba60
gestaltmodule.c: interface to Gestalt Manager.
Guido van Rossum <guido@python.org>
parents:
diff
changeset
|
31 |
| 5071 | 32 static PyObject * |
|
19711
bd252b1832a2
Added prototypes to shut gcc -Wstrict-prototypes up.
Jack Jansen <jack.jansen@cwi.nl>
parents:
17814
diff
changeset
|
33 gestalt_gestalt(PyObject *self, PyObject *args) |
|
1892
eec0dc5aba60
gestaltmodule.c: interface to Gestalt Manager.
Guido van Rossum <guido@python.org>
parents:
diff
changeset
|
34 { |
|
61463
fd25030223b0
Untabify C files. Will watch buildbots.
Antoine Pitrou <solipsis@pitrou.net>
parents:
47163
diff
changeset
|
35 OSErr iErr; |
|
fd25030223b0
Untabify C files. Will watch buildbots.
Antoine Pitrou <solipsis@pitrou.net>
parents:
47163
diff
changeset
|
36 OSType selector; |
|
fd25030223b0
Untabify C files. Will watch buildbots.
Antoine Pitrou <solipsis@pitrou.net>
parents:
47163
diff
changeset
|
37 SInt32 response; |
|
fd25030223b0
Untabify C files. Will watch buildbots.
Antoine Pitrou <solipsis@pitrou.net>
parents:
47163
diff
changeset
|
38 if (!PyArg_ParseTuple(args, "O&", PyMac_GetOSType, &selector)) |
|
fd25030223b0
Untabify C files. Will watch buildbots.
Antoine Pitrou <solipsis@pitrou.net>
parents:
47163
diff
changeset
|
39 return NULL; |
|
fd25030223b0
Untabify C files. Will watch buildbots.
Antoine Pitrou <solipsis@pitrou.net>
parents:
47163
diff
changeset
|
40 iErr = Gestalt ( selector, &response ); |
|
fd25030223b0
Untabify C files. Will watch buildbots.
Antoine Pitrou <solipsis@pitrou.net>
parents:
47163
diff
changeset
|
41 if (iErr != 0) |
|
fd25030223b0
Untabify C files. Will watch buildbots.
Antoine Pitrou <solipsis@pitrou.net>
parents:
47163
diff
changeset
|
42 return PyMac_Error(iErr); |
|
fd25030223b0
Untabify C files. Will watch buildbots.
Antoine Pitrou <solipsis@pitrou.net>
parents:
47163
diff
changeset
|
43 return PyInt_FromLong(response); |
|
1892
eec0dc5aba60
gestaltmodule.c: interface to Gestalt Manager.
Guido van Rossum <guido@python.org>
parents:
diff
changeset
|
44 } |
|
eec0dc5aba60
gestaltmodule.c: interface to Gestalt Manager.
Guido van Rossum <guido@python.org>
parents:
diff
changeset
|
45 |
| 5071 | 46 static struct PyMethodDef gestalt_methods[] = { |
|
61463
fd25030223b0
Untabify C files. Will watch buildbots.
Antoine Pitrou <solipsis@pitrou.net>
parents:
47163
diff
changeset
|
47 {"gestalt", gestalt_gestalt, METH_VARARGS}, |
|
fd25030223b0
Untabify C files. Will watch buildbots.
Antoine Pitrou <solipsis@pitrou.net>
parents:
47163
diff
changeset
|
48 {NULL, NULL} /* Sentinel */ |
|
1892
eec0dc5aba60
gestaltmodule.c: interface to Gestalt Manager.
Guido van Rossum <guido@python.org>
parents:
diff
changeset
|
49 }; |
|
eec0dc5aba60
gestaltmodule.c: interface to Gestalt Manager.
Guido van Rossum <guido@python.org>
parents:
diff
changeset
|
50 |
|
eec0dc5aba60
gestaltmodule.c: interface to Gestalt Manager.
Guido van Rossum <guido@python.org>
parents:
diff
changeset
|
51 void |
|
19711
bd252b1832a2
Added prototypes to shut gcc -Wstrict-prototypes up.
Jack Jansen <jack.jansen@cwi.nl>
parents:
17814
diff
changeset
|
52 initgestalt(void) |
|
1892
eec0dc5aba60
gestaltmodule.c: interface to Gestalt Manager.
Guido van Rossum <guido@python.org>
parents:
diff
changeset
|
53 { |
|
61463
fd25030223b0
Untabify C files. Will watch buildbots.
Antoine Pitrou <solipsis@pitrou.net>
parents:
47163
diff
changeset
|
54 Py_InitModule("gestalt", gestalt_methods); |
|
1892
eec0dc5aba60
gestaltmodule.c: interface to Gestalt Manager.
Guido van Rossum <guido@python.org>
parents:
diff
changeset
|
55 } |
