Mercurial > cpython-lru_cache-weakref
annotate Python/mactoolboxglue.c @ 46567:ffeecbebf3ca
Block 2.6-only doc change.
| author | Georg Brandl <georg@python.org> |
|---|---|
| date | Sat, 26 Apr 2008 18:28:08 +0000 |
| parents | b91ca87e6f32 |
| children |
| rev | line source |
|---|---|
|
19064
e57a4614469e
Split macglue.c into two: a new mactoolboxglue.c (in ./Python)
Jack Jansen <jack.jansen@cwi.nl>
parents:
diff
changeset
|
1 /*********************************************************** |
|
e57a4614469e
Split macglue.c into two: a new mactoolboxglue.c (in ./Python)
Jack Jansen <jack.jansen@cwi.nl>
parents:
diff
changeset
|
2 Copyright 1991-1997 by Stichting Mathematisch Centrum, Amsterdam, |
|
e57a4614469e
Split macglue.c into two: a new mactoolboxglue.c (in ./Python)
Jack Jansen <jack.jansen@cwi.nl>
parents:
diff
changeset
|
3 The Netherlands. |
|
e57a4614469e
Split macglue.c into two: a new mactoolboxglue.c (in ./Python)
Jack Jansen <jack.jansen@cwi.nl>
parents:
diff
changeset
|
4 |
|
e57a4614469e
Split macglue.c into two: a new mactoolboxglue.c (in ./Python)
Jack Jansen <jack.jansen@cwi.nl>
parents:
diff
changeset
|
5 All Rights Reserved |
|
e57a4614469e
Split macglue.c into two: a new mactoolboxglue.c (in ./Python)
Jack Jansen <jack.jansen@cwi.nl>
parents:
diff
changeset
|
6 |
|
e57a4614469e
Split macglue.c into two: a new mactoolboxglue.c (in ./Python)
Jack Jansen <jack.jansen@cwi.nl>
parents:
diff
changeset
|
7 Permission to use, copy, modify, and distribute this software and its |
|
e57a4614469e
Split macglue.c into two: a new mactoolboxglue.c (in ./Python)
Jack Jansen <jack.jansen@cwi.nl>
parents:
diff
changeset
|
8 documentation for any purpose and without fee is hereby granted, |
|
e57a4614469e
Split macglue.c into two: a new mactoolboxglue.c (in ./Python)
Jack Jansen <jack.jansen@cwi.nl>
parents:
diff
changeset
|
9 provided that the above copyright notice appear in all copies and that |
|
e57a4614469e
Split macglue.c into two: a new mactoolboxglue.c (in ./Python)
Jack Jansen <jack.jansen@cwi.nl>
parents:
diff
changeset
|
10 both that copyright notice and this permission notice appear in |
|
e57a4614469e
Split macglue.c into two: a new mactoolboxglue.c (in ./Python)
Jack Jansen <jack.jansen@cwi.nl>
parents:
diff
changeset
|
11 supporting documentation, and that the names of Stichting Mathematisch |
|
e57a4614469e
Split macglue.c into two: a new mactoolboxglue.c (in ./Python)
Jack Jansen <jack.jansen@cwi.nl>
parents:
diff
changeset
|
12 Centrum or CWI not be used in advertising or publicity pertaining to |
|
e57a4614469e
Split macglue.c into two: a new mactoolboxglue.c (in ./Python)
Jack Jansen <jack.jansen@cwi.nl>
parents:
diff
changeset
|
13 distribution of the software without specific, written prior permission. |
|
e57a4614469e
Split macglue.c into two: a new mactoolboxglue.c (in ./Python)
Jack Jansen <jack.jansen@cwi.nl>
parents:
diff
changeset
|
14 |
|
e57a4614469e
Split macglue.c into two: a new mactoolboxglue.c (in ./Python)
Jack Jansen <jack.jansen@cwi.nl>
parents:
diff
changeset
|
15 STICHTING MATHEMATISCH CENTRUM DISCLAIMS ALL WARRANTIES WITH REGARD TO |
|
e57a4614469e
Split macglue.c into two: a new mactoolboxglue.c (in ./Python)
Jack Jansen <jack.jansen@cwi.nl>
parents:
diff
changeset
|
16 THIS SOFTWARE, INCLUDING ALL IMPLIED WARRANTIES OF MERCHANTABILITY AND |
|
e57a4614469e
Split macglue.c into two: a new mactoolboxglue.c (in ./Python)
Jack Jansen <jack.jansen@cwi.nl>
parents:
diff
changeset
|
17 FITNESS, IN NO EVENT SHALL STICHTING MATHEMATISCH CENTRUM BE LIABLE |
|
e57a4614469e
Split macglue.c into two: a new mactoolboxglue.c (in ./Python)
Jack Jansen <jack.jansen@cwi.nl>
parents:
diff
changeset
|
18 FOR ANY SPECIAL, INDIRECT OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES |
|
e57a4614469e
Split macglue.c into two: a new mactoolboxglue.c (in ./Python)
Jack Jansen <jack.jansen@cwi.nl>
parents:
diff
changeset
|
19 WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, WHETHER IN AN |
|
e57a4614469e
Split macglue.c into two: a new mactoolboxglue.c (in ./Python)
Jack Jansen <jack.jansen@cwi.nl>
parents:
diff
changeset
|
20 ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT |
|
e57a4614469e
Split macglue.c into two: a new mactoolboxglue.c (in ./Python)
Jack Jansen <jack.jansen@cwi.nl>
parents:
diff
changeset
|
21 OF OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE. |
|
e57a4614469e
Split macglue.c into two: a new mactoolboxglue.c (in ./Python)
Jack Jansen <jack.jansen@cwi.nl>
parents:
diff
changeset
|
22 |
|
e57a4614469e
Split macglue.c into two: a new mactoolboxglue.c (in ./Python)
Jack Jansen <jack.jansen@cwi.nl>
parents:
diff
changeset
|
23 ******************************************************************/ |
|
e57a4614469e
Split macglue.c into two: a new mactoolboxglue.c (in ./Python)
Jack Jansen <jack.jansen@cwi.nl>
parents:
diff
changeset
|
24 |
|
e57a4614469e
Split macglue.c into two: a new mactoolboxglue.c (in ./Python)
Jack Jansen <jack.jansen@cwi.nl>
parents:
diff
changeset
|
25 |
|
e57a4614469e
Split macglue.c into two: a new mactoolboxglue.c (in ./Python)
Jack Jansen <jack.jansen@cwi.nl>
parents:
diff
changeset
|
26 #include "Python.h" |
|
e57a4614469e
Split macglue.c into two: a new mactoolboxglue.c (in ./Python)
Jack Jansen <jack.jansen@cwi.nl>
parents:
diff
changeset
|
27 #include "pymactoolbox.h" |
|
37879
f731859e9b3b
Merge p3yk branch with the trunk up to revision 45595. This breaks a fair
Thomas Wouters <thomas@python.org>
parents:
36501
diff
changeset
|
28 #include <arpa/inet.h> /* for ntohl, htonl */ |
|
19064
e57a4614469e
Split macglue.c into two: a new mactoolboxglue.c (in ./Python)
Jack Jansen <jack.jansen@cwi.nl>
parents:
diff
changeset
|
29 |
|
e57a4614469e
Split macglue.c into two: a new mactoolboxglue.c (in ./Python)
Jack Jansen <jack.jansen@cwi.nl>
parents:
diff
changeset
|
30 |
|
e57a4614469e
Split macglue.c into two: a new mactoolboxglue.c (in ./Python)
Jack Jansen <jack.jansen@cwi.nl>
parents:
diff
changeset
|
31 /* Like strerror() but for Mac OS error numbers */ |
|
33908
7ed899b61182
SF patch #1035255: Remove CoreServices / CoreFoundation dependencies in core
Raymond Hettinger <python@rcn.com>
parents:
32689
diff
changeset
|
32 char * |
|
7ed899b61182
SF patch #1035255: Remove CoreServices / CoreFoundation dependencies in core
Raymond Hettinger <python@rcn.com>
parents:
32689
diff
changeset
|
33 PyMac_StrError(int err) |
|
19064
e57a4614469e
Split macglue.c into two: a new mactoolboxglue.c (in ./Python)
Jack Jansen <jack.jansen@cwi.nl>
parents:
diff
changeset
|
34 { |
|
e57a4614469e
Split macglue.c into two: a new mactoolboxglue.c (in ./Python)
Jack Jansen <jack.jansen@cwi.nl>
parents:
diff
changeset
|
35 static char buf[256]; |
|
33908
7ed899b61182
SF patch #1035255: Remove CoreServices / CoreFoundation dependencies in core
Raymond Hettinger <python@rcn.com>
parents:
32689
diff
changeset
|
36 PyObject *m; |
|
7ed899b61182
SF patch #1035255: Remove CoreServices / CoreFoundation dependencies in core
Raymond Hettinger <python@rcn.com>
parents:
32689
diff
changeset
|
37 PyObject *rv; |
|
7ed899b61182
SF patch #1035255: Remove CoreServices / CoreFoundation dependencies in core
Raymond Hettinger <python@rcn.com>
parents:
32689
diff
changeset
|
38 |
|
44441
b91ca87e6f32
Merged revisions 59666-59679 via svnmerge from
Christian Heimes <christian@cheimes.de>
parents:
44099
diff
changeset
|
39 m = PyImport_ImportModuleNoBlock("MacOS"); |
|
33908
7ed899b61182
SF patch #1035255: Remove CoreServices / CoreFoundation dependencies in core
Raymond Hettinger <python@rcn.com>
parents:
32689
diff
changeset
|
40 if (!m) { |
|
7ed899b61182
SF patch #1035255: Remove CoreServices / CoreFoundation dependencies in core
Raymond Hettinger <python@rcn.com>
parents:
32689
diff
changeset
|
41 if (Py_VerboseFlag) |
|
7ed899b61182
SF patch #1035255: Remove CoreServices / CoreFoundation dependencies in core
Raymond Hettinger <python@rcn.com>
parents:
32689
diff
changeset
|
42 PyErr_Print(); |
|
7ed899b61182
SF patch #1035255: Remove CoreServices / CoreFoundation dependencies in core
Raymond Hettinger <python@rcn.com>
parents:
32689
diff
changeset
|
43 PyErr_Clear(); |
|
7ed899b61182
SF patch #1035255: Remove CoreServices / CoreFoundation dependencies in core
Raymond Hettinger <python@rcn.com>
parents:
32689
diff
changeset
|
44 rv = NULL; |
|
7ed899b61182
SF patch #1035255: Remove CoreServices / CoreFoundation dependencies in core
Raymond Hettinger <python@rcn.com>
parents:
32689
diff
changeset
|
45 } |
|
7ed899b61182
SF patch #1035255: Remove CoreServices / CoreFoundation dependencies in core
Raymond Hettinger <python@rcn.com>
parents:
32689
diff
changeset
|
46 else { |
|
7ed899b61182
SF patch #1035255: Remove CoreServices / CoreFoundation dependencies in core
Raymond Hettinger <python@rcn.com>
parents:
32689
diff
changeset
|
47 rv = PyObject_CallMethod(m, "GetErrorString", "i", err); |
|
7ed899b61182
SF patch #1035255: Remove CoreServices / CoreFoundation dependencies in core
Raymond Hettinger <python@rcn.com>
parents:
32689
diff
changeset
|
48 if (!rv) |
|
26100
756319a137b8
Got rid of the python.rsrc resource file. The error message strings and
Jack Jansen <jack.jansen@cwi.nl>
parents:
25868
diff
changeset
|
49 PyErr_Clear(); |
|
33908
7ed899b61182
SF patch #1035255: Remove CoreServices / CoreFoundation dependencies in core
Raymond Hettinger <python@rcn.com>
parents:
32689
diff
changeset
|
50 } |
|
7ed899b61182
SF patch #1035255: Remove CoreServices / CoreFoundation dependencies in core
Raymond Hettinger <python@rcn.com>
parents:
32689
diff
changeset
|
51 if (!rv) { |
|
7ed899b61182
SF patch #1035255: Remove CoreServices / CoreFoundation dependencies in core
Raymond Hettinger <python@rcn.com>
parents:
32689
diff
changeset
|
52 buf[0] = '\0'; |
|
7ed899b61182
SF patch #1035255: Remove CoreServices / CoreFoundation dependencies in core
Raymond Hettinger <python@rcn.com>
parents:
32689
diff
changeset
|
53 } |
|
7ed899b61182
SF patch #1035255: Remove CoreServices / CoreFoundation dependencies in core
Raymond Hettinger <python@rcn.com>
parents:
32689
diff
changeset
|
54 else { |
|
7ed899b61182
SF patch #1035255: Remove CoreServices / CoreFoundation dependencies in core
Raymond Hettinger <python@rcn.com>
parents:
32689
diff
changeset
|
55 char *input = PyString_AsString(rv); |
|
7ed899b61182
SF patch #1035255: Remove CoreServices / CoreFoundation dependencies in core
Raymond Hettinger <python@rcn.com>
parents:
32689
diff
changeset
|
56 if (!input) { |
|
7ed899b61182
SF patch #1035255: Remove CoreServices / CoreFoundation dependencies in core
Raymond Hettinger <python@rcn.com>
parents:
32689
diff
changeset
|
57 PyErr_Clear(); |
|
7ed899b61182
SF patch #1035255: Remove CoreServices / CoreFoundation dependencies in core
Raymond Hettinger <python@rcn.com>
parents:
32689
diff
changeset
|
58 buf[0] = '\0'; |
|
26100
756319a137b8
Got rid of the python.rsrc resource file. The error message strings and
Jack Jansen <jack.jansen@cwi.nl>
parents:
25868
diff
changeset
|
59 } else { |
|
33908
7ed899b61182
SF patch #1035255: Remove CoreServices / CoreFoundation dependencies in core
Raymond Hettinger <python@rcn.com>
parents:
32689
diff
changeset
|
60 strncpy(buf, input, sizeof(buf) - 1); |
|
7ed899b61182
SF patch #1035255: Remove CoreServices / CoreFoundation dependencies in core
Raymond Hettinger <python@rcn.com>
parents:
32689
diff
changeset
|
61 buf[sizeof(buf) - 1] = '\0'; |
|
26100
756319a137b8
Got rid of the python.rsrc resource file. The error message strings and
Jack Jansen <jack.jansen@cwi.nl>
parents:
25868
diff
changeset
|
62 } |
|
39442
654c380cf8b9
Merged revisions 46753-51188 via svnmerge from
Thomas Wouters <thomas@python.org>
parents:
37879
diff
changeset
|
63 Py_DECREF(rv); |
|
26100
756319a137b8
Got rid of the python.rsrc resource file. The error message strings and
Jack Jansen <jack.jansen@cwi.nl>
parents:
25868
diff
changeset
|
64 } |
|
39442
654c380cf8b9
Merged revisions 46753-51188 via svnmerge from
Thomas Wouters <thomas@python.org>
parents:
37879
diff
changeset
|
65 Py_XDECREF(m); |
|
19064
e57a4614469e
Split macglue.c into two: a new mactoolboxglue.c (in ./Python)
Jack Jansen <jack.jansen@cwi.nl>
parents:
diff
changeset
|
66 return buf; |
|
e57a4614469e
Split macglue.c into two: a new mactoolboxglue.c (in ./Python)
Jack Jansen <jack.jansen@cwi.nl>
parents:
diff
changeset
|
67 } |
|
e57a4614469e
Split macglue.c into two: a new mactoolboxglue.c (in ./Python)
Jack Jansen <jack.jansen@cwi.nl>
parents:
diff
changeset
|
68 |
|
e57a4614469e
Split macglue.c into two: a new mactoolboxglue.c (in ./Python)
Jack Jansen <jack.jansen@cwi.nl>
parents:
diff
changeset
|
69 /* Exception object shared by all Mac specific modules for Mac OS errors */ |
|
e57a4614469e
Split macglue.c into two: a new mactoolboxglue.c (in ./Python)
Jack Jansen <jack.jansen@cwi.nl>
parents:
diff
changeset
|
70 PyObject *PyMac_OSErrException; |
|
e57a4614469e
Split macglue.c into two: a new mactoolboxglue.c (in ./Python)
Jack Jansen <jack.jansen@cwi.nl>
parents:
diff
changeset
|
71 |
|
e57a4614469e
Split macglue.c into two: a new mactoolboxglue.c (in ./Python)
Jack Jansen <jack.jansen@cwi.nl>
parents:
diff
changeset
|
72 /* Initialize and return PyMac_OSErrException */ |
|
e57a4614469e
Split macglue.c into two: a new mactoolboxglue.c (in ./Python)
Jack Jansen <jack.jansen@cwi.nl>
parents:
diff
changeset
|
73 PyObject * |
|
19841
d8dd75e3b304
Replaced PyMac_FullPath by PyMac_FullPathname, which has an extra 'length'
Jack Jansen <jack.jansen@cwi.nl>
parents:
19645
diff
changeset
|
74 PyMac_GetOSErrException(void) |
|
19064
e57a4614469e
Split macglue.c into two: a new mactoolboxglue.c (in ./Python)
Jack Jansen <jack.jansen@cwi.nl>
parents:
diff
changeset
|
75 { |
|
e57a4614469e
Split macglue.c into two: a new mactoolboxglue.c (in ./Python)
Jack Jansen <jack.jansen@cwi.nl>
parents:
diff
changeset
|
76 if (PyMac_OSErrException == NULL) |
|
25868
2b158267b00e
Made MacOS.Error a class style exception (at last!).
Jack Jansen <jack.jansen@cwi.nl>
parents:
24480
diff
changeset
|
77 PyMac_OSErrException = PyErr_NewException("MacOS.Error", NULL, NULL); |
|
19064
e57a4614469e
Split macglue.c into two: a new mactoolboxglue.c (in ./Python)
Jack Jansen <jack.jansen@cwi.nl>
parents:
diff
changeset
|
78 return PyMac_OSErrException; |
|
e57a4614469e
Split macglue.c into two: a new mactoolboxglue.c (in ./Python)
Jack Jansen <jack.jansen@cwi.nl>
parents:
diff
changeset
|
79 } |
|
e57a4614469e
Split macglue.c into two: a new mactoolboxglue.c (in ./Python)
Jack Jansen <jack.jansen@cwi.nl>
parents:
diff
changeset
|
80 |
|
e57a4614469e
Split macglue.c into two: a new mactoolboxglue.c (in ./Python)
Jack Jansen <jack.jansen@cwi.nl>
parents:
diff
changeset
|
81 /* Set a MAC-specific error from errno, and return NULL; return None if no error */ |
|
e57a4614469e
Split macglue.c into two: a new mactoolboxglue.c (in ./Python)
Jack Jansen <jack.jansen@cwi.nl>
parents:
diff
changeset
|
82 PyObject * |
|
e57a4614469e
Split macglue.c into two: a new mactoolboxglue.c (in ./Python)
Jack Jansen <jack.jansen@cwi.nl>
parents:
diff
changeset
|
83 PyErr_Mac(PyObject *eobj, int err) |
|
e57a4614469e
Split macglue.c into two: a new mactoolboxglue.c (in ./Python)
Jack Jansen <jack.jansen@cwi.nl>
parents:
diff
changeset
|
84 { |
|
e57a4614469e
Split macglue.c into two: a new mactoolboxglue.c (in ./Python)
Jack Jansen <jack.jansen@cwi.nl>
parents:
diff
changeset
|
85 char *msg; |
|
e57a4614469e
Split macglue.c into two: a new mactoolboxglue.c (in ./Python)
Jack Jansen <jack.jansen@cwi.nl>
parents:
diff
changeset
|
86 PyObject *v; |
|
e57a4614469e
Split macglue.c into two: a new mactoolboxglue.c (in ./Python)
Jack Jansen <jack.jansen@cwi.nl>
parents:
diff
changeset
|
87 |
|
e57a4614469e
Split macglue.c into two: a new mactoolboxglue.c (in ./Python)
Jack Jansen <jack.jansen@cwi.nl>
parents:
diff
changeset
|
88 if (err == 0 && !PyErr_Occurred()) { |
|
e57a4614469e
Split macglue.c into two: a new mactoolboxglue.c (in ./Python)
Jack Jansen <jack.jansen@cwi.nl>
parents:
diff
changeset
|
89 Py_INCREF(Py_None); |
|
e57a4614469e
Split macglue.c into two: a new mactoolboxglue.c (in ./Python)
Jack Jansen <jack.jansen@cwi.nl>
parents:
diff
changeset
|
90 return Py_None; |
|
e57a4614469e
Split macglue.c into two: a new mactoolboxglue.c (in ./Python)
Jack Jansen <jack.jansen@cwi.nl>
parents:
diff
changeset
|
91 } |
|
e57a4614469e
Split macglue.c into two: a new mactoolboxglue.c (in ./Python)
Jack Jansen <jack.jansen@cwi.nl>
parents:
diff
changeset
|
92 if (err == -1 && PyErr_Occurred()) |
|
e57a4614469e
Split macglue.c into two: a new mactoolboxglue.c (in ./Python)
Jack Jansen <jack.jansen@cwi.nl>
parents:
diff
changeset
|
93 return NULL; |
|
e57a4614469e
Split macglue.c into two: a new mactoolboxglue.c (in ./Python)
Jack Jansen <jack.jansen@cwi.nl>
parents:
diff
changeset
|
94 msg = PyMac_StrError(err); |
|
e57a4614469e
Split macglue.c into two: a new mactoolboxglue.c (in ./Python)
Jack Jansen <jack.jansen@cwi.nl>
parents:
diff
changeset
|
95 v = Py_BuildValue("(is)", err, msg); |
|
e57a4614469e
Split macglue.c into two: a new mactoolboxglue.c (in ./Python)
Jack Jansen <jack.jansen@cwi.nl>
parents:
diff
changeset
|
96 PyErr_SetObject(eobj, v); |
|
e57a4614469e
Split macglue.c into two: a new mactoolboxglue.c (in ./Python)
Jack Jansen <jack.jansen@cwi.nl>
parents:
diff
changeset
|
97 Py_DECREF(v); |
|
e57a4614469e
Split macglue.c into two: a new mactoolboxglue.c (in ./Python)
Jack Jansen <jack.jansen@cwi.nl>
parents:
diff
changeset
|
98 return NULL; |
|
e57a4614469e
Split macglue.c into two: a new mactoolboxglue.c (in ./Python)
Jack Jansen <jack.jansen@cwi.nl>
parents:
diff
changeset
|
99 } |
|
e57a4614469e
Split macglue.c into two: a new mactoolboxglue.c (in ./Python)
Jack Jansen <jack.jansen@cwi.nl>
parents:
diff
changeset
|
100 |
|
e57a4614469e
Split macglue.c into two: a new mactoolboxglue.c (in ./Python)
Jack Jansen <jack.jansen@cwi.nl>
parents:
diff
changeset
|
101 /* Call PyErr_Mac with PyMac_OSErrException */ |
|
e57a4614469e
Split macglue.c into two: a new mactoolboxglue.c (in ./Python)
Jack Jansen <jack.jansen@cwi.nl>
parents:
diff
changeset
|
102 PyObject * |
|
e57a4614469e
Split macglue.c into two: a new mactoolboxglue.c (in ./Python)
Jack Jansen <jack.jansen@cwi.nl>
parents:
diff
changeset
|
103 PyMac_Error(OSErr err) |
|
e57a4614469e
Split macglue.c into two: a new mactoolboxglue.c (in ./Python)
Jack Jansen <jack.jansen@cwi.nl>
parents:
diff
changeset
|
104 { |
|
e57a4614469e
Split macglue.c into two: a new mactoolboxglue.c (in ./Python)
Jack Jansen <jack.jansen@cwi.nl>
parents:
diff
changeset
|
105 return PyErr_Mac(PyMac_GetOSErrException(), err); |
|
e57a4614469e
Split macglue.c into two: a new mactoolboxglue.c (in ./Python)
Jack Jansen <jack.jansen@cwi.nl>
parents:
diff
changeset
|
106 } |
|
e57a4614469e
Split macglue.c into two: a new mactoolboxglue.c (in ./Python)
Jack Jansen <jack.jansen@cwi.nl>
parents:
diff
changeset
|
107 |
|
19841
d8dd75e3b304
Replaced PyMac_FullPath by PyMac_FullPathname, which has an extra 'length'
Jack Jansen <jack.jansen@cwi.nl>
parents:
19645
diff
changeset
|
108 |
|
d8dd75e3b304
Replaced PyMac_FullPath by PyMac_FullPathname, which has an extra 'length'
Jack Jansen <jack.jansen@cwi.nl>
parents:
19645
diff
changeset
|
109 OSErr |
|
d8dd75e3b304
Replaced PyMac_FullPath by PyMac_FullPathname, which has an extra 'length'
Jack Jansen <jack.jansen@cwi.nl>
parents:
19645
diff
changeset
|
110 PyMac_GetFullPathname(FSSpec *fss, char *path, int len) |
|
d8dd75e3b304
Replaced PyMac_FullPath by PyMac_FullPathname, which has an extra 'length'
Jack Jansen <jack.jansen@cwi.nl>
parents:
19645
diff
changeset
|
111 { |
|
33908
7ed899b61182
SF patch #1035255: Remove CoreServices / CoreFoundation dependencies in core
Raymond Hettinger <python@rcn.com>
parents:
32689
diff
changeset
|
112 PyObject *fs, *exc; |
|
7ed899b61182
SF patch #1035255: Remove CoreServices / CoreFoundation dependencies in core
Raymond Hettinger <python@rcn.com>
parents:
32689
diff
changeset
|
113 PyObject *rv = NULL; |
|
7ed899b61182
SF patch #1035255: Remove CoreServices / CoreFoundation dependencies in core
Raymond Hettinger <python@rcn.com>
parents:
32689
diff
changeset
|
114 char *input; |
|
7ed899b61182
SF patch #1035255: Remove CoreServices / CoreFoundation dependencies in core
Raymond Hettinger <python@rcn.com>
parents:
32689
diff
changeset
|
115 OSErr err = noErr; |
|
7ed899b61182
SF patch #1035255: Remove CoreServices / CoreFoundation dependencies in core
Raymond Hettinger <python@rcn.com>
parents:
32689
diff
changeset
|
116 |
|
19841
d8dd75e3b304
Replaced PyMac_FullPath by PyMac_FullPathname, which has an extra 'length'
Jack Jansen <jack.jansen@cwi.nl>
parents:
19645
diff
changeset
|
117 *path = '\0'; |
|
33908
7ed899b61182
SF patch #1035255: Remove CoreServices / CoreFoundation dependencies in core
Raymond Hettinger <python@rcn.com>
parents:
32689
diff
changeset
|
118 |
|
7ed899b61182
SF patch #1035255: Remove CoreServices / CoreFoundation dependencies in core
Raymond Hettinger <python@rcn.com>
parents:
32689
diff
changeset
|
119 fs = PyMac_BuildFSSpec(fss); |
|
7ed899b61182
SF patch #1035255: Remove CoreServices / CoreFoundation dependencies in core
Raymond Hettinger <python@rcn.com>
parents:
32689
diff
changeset
|
120 if (!fs) |
|
7ed899b61182
SF patch #1035255: Remove CoreServices / CoreFoundation dependencies in core
Raymond Hettinger <python@rcn.com>
parents:
32689
diff
changeset
|
121 goto error; |
|
19841
d8dd75e3b304
Replaced PyMac_FullPath by PyMac_FullPathname, which has an extra 'length'
Jack Jansen <jack.jansen@cwi.nl>
parents:
19645
diff
changeset
|
122 |
|
33908
7ed899b61182
SF patch #1035255: Remove CoreServices / CoreFoundation dependencies in core
Raymond Hettinger <python@rcn.com>
parents:
32689
diff
changeset
|
123 rv = PyObject_CallMethod(fs, "as_pathname", ""); |
|
7ed899b61182
SF patch #1035255: Remove CoreServices / CoreFoundation dependencies in core
Raymond Hettinger <python@rcn.com>
parents:
32689
diff
changeset
|
124 if (!rv) |
|
7ed899b61182
SF patch #1035255: Remove CoreServices / CoreFoundation dependencies in core
Raymond Hettinger <python@rcn.com>
parents:
32689
diff
changeset
|
125 goto error; |
|
24480
03d85d197052
Added one call to Py_Main(), for OSX framework builds only, that will get the
Jack Jansen <jack.jansen@cwi.nl>
parents:
21178
diff
changeset
|
126 |
|
33908
7ed899b61182
SF patch #1035255: Remove CoreServices / CoreFoundation dependencies in core
Raymond Hettinger <python@rcn.com>
parents:
32689
diff
changeset
|
127 input = PyString_AsString(rv); |
|
7ed899b61182
SF patch #1035255: Remove CoreServices / CoreFoundation dependencies in core
Raymond Hettinger <python@rcn.com>
parents:
32689
diff
changeset
|
128 if (!input) |
|
7ed899b61182
SF patch #1035255: Remove CoreServices / CoreFoundation dependencies in core
Raymond Hettinger <python@rcn.com>
parents:
32689
diff
changeset
|
129 goto error; |
|
24480
03d85d197052
Added one call to Py_Main(), for OSX framework builds only, that will get the
Jack Jansen <jack.jansen@cwi.nl>
parents:
21178
diff
changeset
|
130 |
|
33908
7ed899b61182
SF patch #1035255: Remove CoreServices / CoreFoundation dependencies in core
Raymond Hettinger <python@rcn.com>
parents:
32689
diff
changeset
|
131 strncpy(path, input, len - 1); |
|
7ed899b61182
SF patch #1035255: Remove CoreServices / CoreFoundation dependencies in core
Raymond Hettinger <python@rcn.com>
parents:
32689
diff
changeset
|
132 path[len - 1] = '\0'; |
|
24480
03d85d197052
Added one call to Py_Main(), for OSX framework builds only, that will get the
Jack Jansen <jack.jansen@cwi.nl>
parents:
21178
diff
changeset
|
133 |
|
33908
7ed899b61182
SF patch #1035255: Remove CoreServices / CoreFoundation dependencies in core
Raymond Hettinger <python@rcn.com>
parents:
32689
diff
changeset
|
134 Py_XDECREF(rv); |
|
7ed899b61182
SF patch #1035255: Remove CoreServices / CoreFoundation dependencies in core
Raymond Hettinger <python@rcn.com>
parents:
32689
diff
changeset
|
135 Py_XDECREF(fs); |
|
7ed899b61182
SF patch #1035255: Remove CoreServices / CoreFoundation dependencies in core
Raymond Hettinger <python@rcn.com>
parents:
32689
diff
changeset
|
136 return err; |
|
24480
03d85d197052
Added one call to Py_Main(), for OSX framework builds only, that will get the
Jack Jansen <jack.jansen@cwi.nl>
parents:
21178
diff
changeset
|
137 |
|
33908
7ed899b61182
SF patch #1035255: Remove CoreServices / CoreFoundation dependencies in core
Raymond Hettinger <python@rcn.com>
parents:
32689
diff
changeset
|
138 error: |
|
7ed899b61182
SF patch #1035255: Remove CoreServices / CoreFoundation dependencies in core
Raymond Hettinger <python@rcn.com>
parents:
32689
diff
changeset
|
139 exc = PyErr_Occurred(); |
|
7ed899b61182
SF patch #1035255: Remove CoreServices / CoreFoundation dependencies in core
Raymond Hettinger <python@rcn.com>
parents:
32689
diff
changeset
|
140 if (exc && PyErr_GivenExceptionMatches(exc, |
|
7ed899b61182
SF patch #1035255: Remove CoreServices / CoreFoundation dependencies in core
Raymond Hettinger <python@rcn.com>
parents:
32689
diff
changeset
|
141 PyMac_GetOSErrException())) { |
|
7ed899b61182
SF patch #1035255: Remove CoreServices / CoreFoundation dependencies in core
Raymond Hettinger <python@rcn.com>
parents:
32689
diff
changeset
|
142 PyObject *args = PyObject_GetAttrString(exc, "args"); |
|
7ed899b61182
SF patch #1035255: Remove CoreServices / CoreFoundation dependencies in core
Raymond Hettinger <python@rcn.com>
parents:
32689
diff
changeset
|
143 if (args) { |
|
7ed899b61182
SF patch #1035255: Remove CoreServices / CoreFoundation dependencies in core
Raymond Hettinger <python@rcn.com>
parents:
32689
diff
changeset
|
144 char *ignore; |
|
7ed899b61182
SF patch #1035255: Remove CoreServices / CoreFoundation dependencies in core
Raymond Hettinger <python@rcn.com>
parents:
32689
diff
changeset
|
145 PyArg_ParseTuple(args, "is", &err, &ignore); |
|
7ed899b61182
SF patch #1035255: Remove CoreServices / CoreFoundation dependencies in core
Raymond Hettinger <python@rcn.com>
parents:
32689
diff
changeset
|
146 Py_XDECREF(args); |
|
7ed899b61182
SF patch #1035255: Remove CoreServices / CoreFoundation dependencies in core
Raymond Hettinger <python@rcn.com>
parents:
32689
diff
changeset
|
147 } |
|
24480
03d85d197052
Added one call to Py_Main(), for OSX framework builds only, that will get the
Jack Jansen <jack.jansen@cwi.nl>
parents:
21178
diff
changeset
|
148 } |
|
33908
7ed899b61182
SF patch #1035255: Remove CoreServices / CoreFoundation dependencies in core
Raymond Hettinger <python@rcn.com>
parents:
32689
diff
changeset
|
149 if (err == noErr) |
|
7ed899b61182
SF patch #1035255: Remove CoreServices / CoreFoundation dependencies in core
Raymond Hettinger <python@rcn.com>
parents:
32689
diff
changeset
|
150 err = -1; |
|
7ed899b61182
SF patch #1035255: Remove CoreServices / CoreFoundation dependencies in core
Raymond Hettinger <python@rcn.com>
parents:
32689
diff
changeset
|
151 PyErr_Clear(); |
|
7ed899b61182
SF patch #1035255: Remove CoreServices / CoreFoundation dependencies in core
Raymond Hettinger <python@rcn.com>
parents:
32689
diff
changeset
|
152 Py_XDECREF(rv); |
|
7ed899b61182
SF patch #1035255: Remove CoreServices / CoreFoundation dependencies in core
Raymond Hettinger <python@rcn.com>
parents:
32689
diff
changeset
|
153 Py_XDECREF(fs); |
|
7ed899b61182
SF patch #1035255: Remove CoreServices / CoreFoundation dependencies in core
Raymond Hettinger <python@rcn.com>
parents:
32689
diff
changeset
|
154 return err; |
|
24480
03d85d197052
Added one call to Py_Main(), for OSX framework builds only, that will get the
Jack Jansen <jack.jansen@cwi.nl>
parents:
21178
diff
changeset
|
155 } |
|
03d85d197052
Added one call to Py_Main(), for OSX framework builds only, that will get the
Jack Jansen <jack.jansen@cwi.nl>
parents:
21178
diff
changeset
|
156 |
|
19064
e57a4614469e
Split macglue.c into two: a new mactoolboxglue.c (in ./Python)
Jack Jansen <jack.jansen@cwi.nl>
parents:
diff
changeset
|
157 /* Convert a 4-char string object argument to an OSType value */ |
|
e57a4614469e
Split macglue.c into two: a new mactoolboxglue.c (in ./Python)
Jack Jansen <jack.jansen@cwi.nl>
parents:
diff
changeset
|
158 int |
|
e57a4614469e
Split macglue.c into two: a new mactoolboxglue.c (in ./Python)
Jack Jansen <jack.jansen@cwi.nl>
parents:
diff
changeset
|
159 PyMac_GetOSType(PyObject *v, OSType *pr) |
|
e57a4614469e
Split macglue.c into two: a new mactoolboxglue.c (in ./Python)
Jack Jansen <jack.jansen@cwi.nl>
parents:
diff
changeset
|
160 { |
|
37879
f731859e9b3b
Merge p3yk branch with the trunk up to revision 45595. This breaks a fair
Thomas Wouters <thomas@python.org>
parents:
36501
diff
changeset
|
161 uint32_t tmp; |
|
42163
bff9ebabfc15
Changes to ctypes and Mac toolbox glue that fix test_threading and test_platform.
Guido van Rossum <guido@python.org>
parents:
39442
diff
changeset
|
162 const char *str; |
|
bff9ebabfc15
Changes to ctypes and Mac toolbox glue that fix test_threading and test_platform.
Guido van Rossum <guido@python.org>
parents:
39442
diff
changeset
|
163 int len; |
|
bff9ebabfc15
Changes to ctypes and Mac toolbox glue that fix test_threading and test_platform.
Guido van Rossum <guido@python.org>
parents:
39442
diff
changeset
|
164 if (PyUnicode_Check(v)) { |
|
bff9ebabfc15
Changes to ctypes and Mac toolbox glue that fix test_threading and test_platform.
Guido van Rossum <guido@python.org>
parents:
39442
diff
changeset
|
165 v = _PyUnicode_AsDefaultEncodedString(v, NULL); |
|
bff9ebabfc15
Changes to ctypes and Mac toolbox glue that fix test_threading and test_platform.
Guido van Rossum <guido@python.org>
parents:
39442
diff
changeset
|
166 if (v == NULL) |
|
bff9ebabfc15
Changes to ctypes and Mac toolbox glue that fix test_threading and test_platform.
Guido van Rossum <guido@python.org>
parents:
39442
diff
changeset
|
167 return 0; |
|
bff9ebabfc15
Changes to ctypes and Mac toolbox glue that fix test_threading and test_platform.
Guido van Rossum <guido@python.org>
parents:
39442
diff
changeset
|
168 } |
|
bff9ebabfc15
Changes to ctypes and Mac toolbox glue that fix test_threading and test_platform.
Guido van Rossum <guido@python.org>
parents:
39442
diff
changeset
|
169 if (PyString_Check(v)) { |
|
bff9ebabfc15
Changes to ctypes and Mac toolbox glue that fix test_threading and test_platform.
Guido van Rossum <guido@python.org>
parents:
39442
diff
changeset
|
170 str = PyString_AS_STRING(v); |
|
bff9ebabfc15
Changes to ctypes and Mac toolbox glue that fix test_threading and test_platform.
Guido van Rossum <guido@python.org>
parents:
39442
diff
changeset
|
171 len = PyString_GET_SIZE(v); |
|
bff9ebabfc15
Changes to ctypes and Mac toolbox glue that fix test_threading and test_platform.
Guido van Rossum <guido@python.org>
parents:
39442
diff
changeset
|
172 } |
|
bff9ebabfc15
Changes to ctypes and Mac toolbox glue that fix test_threading and test_platform.
Guido van Rossum <guido@python.org>
parents:
39442
diff
changeset
|
173 else if (PyBytes_Check(v)) { |
|
bff9ebabfc15
Changes to ctypes and Mac toolbox glue that fix test_threading and test_platform.
Guido van Rossum <guido@python.org>
parents:
39442
diff
changeset
|
174 str = PyBytes_AS_STRING(v); |
|
bff9ebabfc15
Changes to ctypes and Mac toolbox glue that fix test_threading and test_platform.
Guido van Rossum <guido@python.org>
parents:
39442
diff
changeset
|
175 len = PyBytes_GET_SIZE(v); |
|
bff9ebabfc15
Changes to ctypes and Mac toolbox glue that fix test_threading and test_platform.
Guido van Rossum <guido@python.org>
parents:
39442
diff
changeset
|
176 } |
|
bff9ebabfc15
Changes to ctypes and Mac toolbox glue that fix test_threading and test_platform.
Guido van Rossum <guido@python.org>
parents:
39442
diff
changeset
|
177 else { |
|
19064
e57a4614469e
Split macglue.c into two: a new mactoolboxglue.c (in ./Python)
Jack Jansen <jack.jansen@cwi.nl>
parents:
diff
changeset
|
178 PyErr_SetString(PyExc_TypeError, |
|
42163
bff9ebabfc15
Changes to ctypes and Mac toolbox glue that fix test_threading and test_platform.
Guido van Rossum <guido@python.org>
parents:
39442
diff
changeset
|
179 "OSType arg must be string (of 4 chars)"); |
|
19064
e57a4614469e
Split macglue.c into two: a new mactoolboxglue.c (in ./Python)
Jack Jansen <jack.jansen@cwi.nl>
parents:
diff
changeset
|
180 return 0; |
|
e57a4614469e
Split macglue.c into two: a new mactoolboxglue.c (in ./Python)
Jack Jansen <jack.jansen@cwi.nl>
parents:
diff
changeset
|
181 } |
|
42163
bff9ebabfc15
Changes to ctypes and Mac toolbox glue that fix test_threading and test_platform.
Guido van Rossum <guido@python.org>
parents:
39442
diff
changeset
|
182 if (len != 4) { |
|
bff9ebabfc15
Changes to ctypes and Mac toolbox glue that fix test_threading and test_platform.
Guido van Rossum <guido@python.org>
parents:
39442
diff
changeset
|
183 PyErr_SetString(PyExc_TypeError, |
|
bff9ebabfc15
Changes to ctypes and Mac toolbox glue that fix test_threading and test_platform.
Guido van Rossum <guido@python.org>
parents:
39442
diff
changeset
|
184 "OSType arg must be (string of) 4 chars"); |
|
bff9ebabfc15
Changes to ctypes and Mac toolbox glue that fix test_threading and test_platform.
Guido van Rossum <guido@python.org>
parents:
39442
diff
changeset
|
185 return 0; |
|
bff9ebabfc15
Changes to ctypes and Mac toolbox glue that fix test_threading and test_platform.
Guido van Rossum <guido@python.org>
parents:
39442
diff
changeset
|
186 } |
|
bff9ebabfc15
Changes to ctypes and Mac toolbox glue that fix test_threading and test_platform.
Guido van Rossum <guido@python.org>
parents:
39442
diff
changeset
|
187 memcpy((char *)&tmp, str, 4); |
|
37879
f731859e9b3b
Merge p3yk branch with the trunk up to revision 45595. This breaks a fair
Thomas Wouters <thomas@python.org>
parents:
36501
diff
changeset
|
188 *pr = (OSType)ntohl(tmp); |
|
19064
e57a4614469e
Split macglue.c into two: a new mactoolboxglue.c (in ./Python)
Jack Jansen <jack.jansen@cwi.nl>
parents:
diff
changeset
|
189 return 1; |
|
e57a4614469e
Split macglue.c into two: a new mactoolboxglue.c (in ./Python)
Jack Jansen <jack.jansen@cwi.nl>
parents:
diff
changeset
|
190 } |
|
e57a4614469e
Split macglue.c into two: a new mactoolboxglue.c (in ./Python)
Jack Jansen <jack.jansen@cwi.nl>
parents:
diff
changeset
|
191 |
|
e57a4614469e
Split macglue.c into two: a new mactoolboxglue.c (in ./Python)
Jack Jansen <jack.jansen@cwi.nl>
parents:
diff
changeset
|
192 /* Convert an OSType value to a 4-char string object */ |
|
e57a4614469e
Split macglue.c into two: a new mactoolboxglue.c (in ./Python)
Jack Jansen <jack.jansen@cwi.nl>
parents:
diff
changeset
|
193 PyObject * |
|
e57a4614469e
Split macglue.c into two: a new mactoolboxglue.c (in ./Python)
Jack Jansen <jack.jansen@cwi.nl>
parents:
diff
changeset
|
194 PyMac_BuildOSType(OSType t) |
|
e57a4614469e
Split macglue.c into two: a new mactoolboxglue.c (in ./Python)
Jack Jansen <jack.jansen@cwi.nl>
parents:
diff
changeset
|
195 { |
|
37879
f731859e9b3b
Merge p3yk branch with the trunk up to revision 45595. This breaks a fair
Thomas Wouters <thomas@python.org>
parents:
36501
diff
changeset
|
196 uint32_t tmp = htonl((uint32_t)t); |
|
43777
0d462d789b18
Merging the py3k-pep3137 branch back into the py3k branch.
Guido van Rossum <guido@python.org>
parents:
42376
diff
changeset
|
197 return PyString_FromStringAndSize((char *)&tmp, 4); |
|
19064
e57a4614469e
Split macglue.c into two: a new mactoolboxglue.c (in ./Python)
Jack Jansen <jack.jansen@cwi.nl>
parents:
diff
changeset
|
198 } |
|
e57a4614469e
Split macglue.c into two: a new mactoolboxglue.c (in ./Python)
Jack Jansen <jack.jansen@cwi.nl>
parents:
diff
changeset
|
199 |
|
e57a4614469e
Split macglue.c into two: a new mactoolboxglue.c (in ./Python)
Jack Jansen <jack.jansen@cwi.nl>
parents:
diff
changeset
|
200 /* Convert an NumVersion value to a 4-element tuple */ |
|
e57a4614469e
Split macglue.c into two: a new mactoolboxglue.c (in ./Python)
Jack Jansen <jack.jansen@cwi.nl>
parents:
diff
changeset
|
201 PyObject * |
|
e57a4614469e
Split macglue.c into two: a new mactoolboxglue.c (in ./Python)
Jack Jansen <jack.jansen@cwi.nl>
parents:
diff
changeset
|
202 PyMac_BuildNumVersion(NumVersion t) |
|
e57a4614469e
Split macglue.c into two: a new mactoolboxglue.c (in ./Python)
Jack Jansen <jack.jansen@cwi.nl>
parents:
diff
changeset
|
203 { |
|
e57a4614469e
Split macglue.c into two: a new mactoolboxglue.c (in ./Python)
Jack Jansen <jack.jansen@cwi.nl>
parents:
diff
changeset
|
204 return Py_BuildValue("(hhhh)", t.majorRev, t.minorAndBugRev, t.stage, t.nonRelRev); |
|
e57a4614469e
Split macglue.c into two: a new mactoolboxglue.c (in ./Python)
Jack Jansen <jack.jansen@cwi.nl>
parents:
diff
changeset
|
205 } |
|
e57a4614469e
Split macglue.c into two: a new mactoolboxglue.c (in ./Python)
Jack Jansen <jack.jansen@cwi.nl>
parents:
diff
changeset
|
206 |
|
e57a4614469e
Split macglue.c into two: a new mactoolboxglue.c (in ./Python)
Jack Jansen <jack.jansen@cwi.nl>
parents:
diff
changeset
|
207 |
|
e57a4614469e
Split macglue.c into two: a new mactoolboxglue.c (in ./Python)
Jack Jansen <jack.jansen@cwi.nl>
parents:
diff
changeset
|
208 /* Convert a Python string object to a Str255 */ |
|
e57a4614469e
Split macglue.c into two: a new mactoolboxglue.c (in ./Python)
Jack Jansen <jack.jansen@cwi.nl>
parents:
diff
changeset
|
209 int |
|
e57a4614469e
Split macglue.c into two: a new mactoolboxglue.c (in ./Python)
Jack Jansen <jack.jansen@cwi.nl>
parents:
diff
changeset
|
210 PyMac_GetStr255(PyObject *v, Str255 pbuf) |
|
e57a4614469e
Split macglue.c into two: a new mactoolboxglue.c (in ./Python)
Jack Jansen <jack.jansen@cwi.nl>
parents:
diff
changeset
|
211 { |
|
42170
acd1f642706f
Make test_urllib.py pass. Mostly str/bytes issues.
Guido van Rossum <guido@python.org>
parents:
42163
diff
changeset
|
212 char *ptr; |
|
acd1f642706f
Make test_urllib.py pass. Mostly str/bytes issues.
Guido van Rossum <guido@python.org>
parents:
42163
diff
changeset
|
213 Py_ssize_t len = 1000; |
|
acd1f642706f
Make test_urllib.py pass. Mostly str/bytes issues.
Guido van Rossum <guido@python.org>
parents:
42163
diff
changeset
|
214 |
|
acd1f642706f
Make test_urllib.py pass. Mostly str/bytes issues.
Guido van Rossum <guido@python.org>
parents:
42163
diff
changeset
|
215 if (PyUnicode_Check(v)) { |
|
acd1f642706f
Make test_urllib.py pass. Mostly str/bytes issues.
Guido van Rossum <guido@python.org>
parents:
42163
diff
changeset
|
216 v = _PyUnicode_AsDefaultEncodedString(v, NULL); |
|
acd1f642706f
Make test_urllib.py pass. Mostly str/bytes issues.
Guido van Rossum <guido@python.org>
parents:
42163
diff
changeset
|
217 if (v == NULL) |
|
42376
278c52134140
SF patch# 1761465 by Jeffrey Yasskin.
Guido van Rossum <guido@python.org>
parents:
42170
diff
changeset
|
218 return 0; |
|
42170
acd1f642706f
Make test_urllib.py pass. Mostly str/bytes issues.
Guido van Rossum <guido@python.org>
parents:
42163
diff
changeset
|
219 } |
|
acd1f642706f
Make test_urllib.py pass. Mostly str/bytes issues.
Guido van Rossum <guido@python.org>
parents:
42163
diff
changeset
|
220 if (PyString_Check(v)) { |
|
acd1f642706f
Make test_urllib.py pass. Mostly str/bytes issues.
Guido van Rossum <guido@python.org>
parents:
42163
diff
changeset
|
221 ptr = PyString_AS_STRING(v); |
|
acd1f642706f
Make test_urllib.py pass. Mostly str/bytes issues.
Guido van Rossum <guido@python.org>
parents:
42163
diff
changeset
|
222 len = PyString_GET_SIZE(v); |
|
acd1f642706f
Make test_urllib.py pass. Mostly str/bytes issues.
Guido van Rossum <guido@python.org>
parents:
42163
diff
changeset
|
223 } |
|
acd1f642706f
Make test_urllib.py pass. Mostly str/bytes issues.
Guido van Rossum <guido@python.org>
parents:
42163
diff
changeset
|
224 else if (PyBytes_Check(v)) { |
|
acd1f642706f
Make test_urllib.py pass. Mostly str/bytes issues.
Guido van Rossum <guido@python.org>
parents:
42163
diff
changeset
|
225 ptr = PyBytes_AS_STRING(v); |
|
acd1f642706f
Make test_urllib.py pass. Mostly str/bytes issues.
Guido van Rossum <guido@python.org>
parents:
42163
diff
changeset
|
226 len = PyBytes_GET_SIZE(v); |
|
acd1f642706f
Make test_urllib.py pass. Mostly str/bytes issues.
Guido van Rossum <guido@python.org>
parents:
42163
diff
changeset
|
227 } |
|
acd1f642706f
Make test_urllib.py pass. Mostly str/bytes issues.
Guido van Rossum <guido@python.org>
parents:
42163
diff
changeset
|
228 if (len > 255) { |
|
19064
e57a4614469e
Split macglue.c into two: a new mactoolboxglue.c (in ./Python)
Jack Jansen <jack.jansen@cwi.nl>
parents:
diff
changeset
|
229 PyErr_SetString(PyExc_TypeError, |
|
42170
acd1f642706f
Make test_urllib.py pass. Mostly str/bytes issues.
Guido van Rossum <guido@python.org>
parents:
42163
diff
changeset
|
230 "Str255 arg must be string/bytes of at most 255 chars"); |
|
19064
e57a4614469e
Split macglue.c into two: a new mactoolboxglue.c (in ./Python)
Jack Jansen <jack.jansen@cwi.nl>
parents:
diff
changeset
|
231 return 0; |
|
e57a4614469e
Split macglue.c into two: a new mactoolboxglue.c (in ./Python)
Jack Jansen <jack.jansen@cwi.nl>
parents:
diff
changeset
|
232 } |
|
e57a4614469e
Split macglue.c into two: a new mactoolboxglue.c (in ./Python)
Jack Jansen <jack.jansen@cwi.nl>
parents:
diff
changeset
|
233 pbuf[0] = len; |
|
42170
acd1f642706f
Make test_urllib.py pass. Mostly str/bytes issues.
Guido van Rossum <guido@python.org>
parents:
42163
diff
changeset
|
234 memcpy((char *)(pbuf+1), ptr, len); |
|
19064
e57a4614469e
Split macglue.c into two: a new mactoolboxglue.c (in ./Python)
Jack Jansen <jack.jansen@cwi.nl>
parents:
diff
changeset
|
235 return 1; |
|
e57a4614469e
Split macglue.c into two: a new mactoolboxglue.c (in ./Python)
Jack Jansen <jack.jansen@cwi.nl>
parents:
diff
changeset
|
236 } |
|
e57a4614469e
Split macglue.c into two: a new mactoolboxglue.c (in ./Python)
Jack Jansen <jack.jansen@cwi.nl>
parents:
diff
changeset
|
237 |
|
e57a4614469e
Split macglue.c into two: a new mactoolboxglue.c (in ./Python)
Jack Jansen <jack.jansen@cwi.nl>
parents:
diff
changeset
|
238 /* Convert a Str255 to a Python string object */ |
|
e57a4614469e
Split macglue.c into two: a new mactoolboxglue.c (in ./Python)
Jack Jansen <jack.jansen@cwi.nl>
parents:
diff
changeset
|
239 PyObject * |
|
e57a4614469e
Split macglue.c into two: a new mactoolboxglue.c (in ./Python)
Jack Jansen <jack.jansen@cwi.nl>
parents:
diff
changeset
|
240 PyMac_BuildStr255(Str255 s) |
|
e57a4614469e
Split macglue.c into two: a new mactoolboxglue.c (in ./Python)
Jack Jansen <jack.jansen@cwi.nl>
parents:
diff
changeset
|
241 { |
|
e57a4614469e
Split macglue.c into two: a new mactoolboxglue.c (in ./Python)
Jack Jansen <jack.jansen@cwi.nl>
parents:
diff
changeset
|
242 if ( s == NULL ) { |
|
e57a4614469e
Split macglue.c into two: a new mactoolboxglue.c (in ./Python)
Jack Jansen <jack.jansen@cwi.nl>
parents:
diff
changeset
|
243 PyErr_SetString(PyExc_SystemError, "Str255 pointer is NULL"); |
|
e57a4614469e
Split macglue.c into two: a new mactoolboxglue.c (in ./Python)
Jack Jansen <jack.jansen@cwi.nl>
parents:
diff
changeset
|
244 return NULL; |
|
e57a4614469e
Split macglue.c into two: a new mactoolboxglue.c (in ./Python)
Jack Jansen <jack.jansen@cwi.nl>
parents:
diff
changeset
|
245 } |
|
e57a4614469e
Split macglue.c into two: a new mactoolboxglue.c (in ./Python)
Jack Jansen <jack.jansen@cwi.nl>
parents:
diff
changeset
|
246 return PyString_FromStringAndSize((char *)&s[1], (int)s[0]); |
|
e57a4614469e
Split macglue.c into two: a new mactoolboxglue.c (in ./Python)
Jack Jansen <jack.jansen@cwi.nl>
parents:
diff
changeset
|
247 } |
|
e57a4614469e
Split macglue.c into two: a new mactoolboxglue.c (in ./Python)
Jack Jansen <jack.jansen@cwi.nl>
parents:
diff
changeset
|
248 |
|
e57a4614469e
Split macglue.c into two: a new mactoolboxglue.c (in ./Python)
Jack Jansen <jack.jansen@cwi.nl>
parents:
diff
changeset
|
249 PyObject * |
|
e57a4614469e
Split macglue.c into two: a new mactoolboxglue.c (in ./Python)
Jack Jansen <jack.jansen@cwi.nl>
parents:
diff
changeset
|
250 PyMac_BuildOptStr255(Str255 s) |
|
e57a4614469e
Split macglue.c into two: a new mactoolboxglue.c (in ./Python)
Jack Jansen <jack.jansen@cwi.nl>
parents:
diff
changeset
|
251 { |
|
e57a4614469e
Split macglue.c into two: a new mactoolboxglue.c (in ./Python)
Jack Jansen <jack.jansen@cwi.nl>
parents:
diff
changeset
|
252 if ( s == NULL ) { |
|
e57a4614469e
Split macglue.c into two: a new mactoolboxglue.c (in ./Python)
Jack Jansen <jack.jansen@cwi.nl>
parents:
diff
changeset
|
253 Py_INCREF(Py_None); |
|
e57a4614469e
Split macglue.c into two: a new mactoolboxglue.c (in ./Python)
Jack Jansen <jack.jansen@cwi.nl>
parents:
diff
changeset
|
254 return Py_None; |
|
e57a4614469e
Split macglue.c into two: a new mactoolboxglue.c (in ./Python)
Jack Jansen <jack.jansen@cwi.nl>
parents:
diff
changeset
|
255 } |
|
e57a4614469e
Split macglue.c into two: a new mactoolboxglue.c (in ./Python)
Jack Jansen <jack.jansen@cwi.nl>
parents:
diff
changeset
|
256 return PyString_FromStringAndSize((char *)&s[1], (int)s[0]); |
|
e57a4614469e
Split macglue.c into two: a new mactoolboxglue.c (in ./Python)
Jack Jansen <jack.jansen@cwi.nl>
parents:
diff
changeset
|
257 } |
|
e57a4614469e
Split macglue.c into two: a new mactoolboxglue.c (in ./Python)
Jack Jansen <jack.jansen@cwi.nl>
parents:
diff
changeset
|
258 |
|
e57a4614469e
Split macglue.c into two: a new mactoolboxglue.c (in ./Python)
Jack Jansen <jack.jansen@cwi.nl>
parents:
diff
changeset
|
259 |
|
e57a4614469e
Split macglue.c into two: a new mactoolboxglue.c (in ./Python)
Jack Jansen <jack.jansen@cwi.nl>
parents:
diff
changeset
|
260 |
|
e57a4614469e
Split macglue.c into two: a new mactoolboxglue.c (in ./Python)
Jack Jansen <jack.jansen@cwi.nl>
parents:
diff
changeset
|
261 /* Convert a Python object to a Rect. |
|
e57a4614469e
Split macglue.c into two: a new mactoolboxglue.c (in ./Python)
Jack Jansen <jack.jansen@cwi.nl>
parents:
diff
changeset
|
262 The object must be a (left, top, right, bottom) tuple. |
|
e57a4614469e
Split macglue.c into two: a new mactoolboxglue.c (in ./Python)
Jack Jansen <jack.jansen@cwi.nl>
parents:
diff
changeset
|
263 (This differs from the order in the struct but is consistent with |
|
e57a4614469e
Split macglue.c into two: a new mactoolboxglue.c (in ./Python)
Jack Jansen <jack.jansen@cwi.nl>
parents:
diff
changeset
|
264 the arguments to SetRect(), and also with STDWIN). */ |
|
e57a4614469e
Split macglue.c into two: a new mactoolboxglue.c (in ./Python)
Jack Jansen <jack.jansen@cwi.nl>
parents:
diff
changeset
|
265 int |
|
e57a4614469e
Split macglue.c into two: a new mactoolboxglue.c (in ./Python)
Jack Jansen <jack.jansen@cwi.nl>
parents:
diff
changeset
|
266 PyMac_GetRect(PyObject *v, Rect *r) |
|
e57a4614469e
Split macglue.c into two: a new mactoolboxglue.c (in ./Python)
Jack Jansen <jack.jansen@cwi.nl>
parents:
diff
changeset
|
267 { |
|
e57a4614469e
Split macglue.c into two: a new mactoolboxglue.c (in ./Python)
Jack Jansen <jack.jansen@cwi.nl>
parents:
diff
changeset
|
268 return PyArg_Parse(v, "(hhhh)", &r->left, &r->top, &r->right, &r->bottom); |
|
e57a4614469e
Split macglue.c into two: a new mactoolboxglue.c (in ./Python)
Jack Jansen <jack.jansen@cwi.nl>
parents:
diff
changeset
|
269 } |
|
e57a4614469e
Split macglue.c into two: a new mactoolboxglue.c (in ./Python)
Jack Jansen <jack.jansen@cwi.nl>
parents:
diff
changeset
|
270 |
|
e57a4614469e
Split macglue.c into two: a new mactoolboxglue.c (in ./Python)
Jack Jansen <jack.jansen@cwi.nl>
parents:
diff
changeset
|
271 /* Convert a Rect to a Python object */ |
|
e57a4614469e
Split macglue.c into two: a new mactoolboxglue.c (in ./Python)
Jack Jansen <jack.jansen@cwi.nl>
parents:
diff
changeset
|
272 PyObject * |
|
e57a4614469e
Split macglue.c into two: a new mactoolboxglue.c (in ./Python)
Jack Jansen <jack.jansen@cwi.nl>
parents:
diff
changeset
|
273 PyMac_BuildRect(Rect *r) |
|
e57a4614469e
Split macglue.c into two: a new mactoolboxglue.c (in ./Python)
Jack Jansen <jack.jansen@cwi.nl>
parents:
diff
changeset
|
274 { |
|
e57a4614469e
Split macglue.c into two: a new mactoolboxglue.c (in ./Python)
Jack Jansen <jack.jansen@cwi.nl>
parents:
diff
changeset
|
275 return Py_BuildValue("(hhhh)", r->left, r->top, r->right, r->bottom); |
|
e57a4614469e
Split macglue.c into two: a new mactoolboxglue.c (in ./Python)
Jack Jansen <jack.jansen@cwi.nl>
parents:
diff
changeset
|
276 } |
|
e57a4614469e
Split macglue.c into two: a new mactoolboxglue.c (in ./Python)
Jack Jansen <jack.jansen@cwi.nl>
parents:
diff
changeset
|
277 |
|
e57a4614469e
Split macglue.c into two: a new mactoolboxglue.c (in ./Python)
Jack Jansen <jack.jansen@cwi.nl>
parents:
diff
changeset
|
278 |
|
e57a4614469e
Split macglue.c into two: a new mactoolboxglue.c (in ./Python)
Jack Jansen <jack.jansen@cwi.nl>
parents:
diff
changeset
|
279 /* Convert a Python object to a Point. |
|
e57a4614469e
Split macglue.c into two: a new mactoolboxglue.c (in ./Python)
Jack Jansen <jack.jansen@cwi.nl>
parents:
diff
changeset
|
280 The object must be a (h, v) tuple. |
|
e57a4614469e
Split macglue.c into two: a new mactoolboxglue.c (in ./Python)
Jack Jansen <jack.jansen@cwi.nl>
parents:
diff
changeset
|
281 (This differs from the order in the struct but is consistent with |
|
e57a4614469e
Split macglue.c into two: a new mactoolboxglue.c (in ./Python)
Jack Jansen <jack.jansen@cwi.nl>
parents:
diff
changeset
|
282 the arguments to SetPoint(), and also with STDWIN). */ |
|
e57a4614469e
Split macglue.c into two: a new mactoolboxglue.c (in ./Python)
Jack Jansen <jack.jansen@cwi.nl>
parents:
diff
changeset
|
283 int |
|
e57a4614469e
Split macglue.c into two: a new mactoolboxglue.c (in ./Python)
Jack Jansen <jack.jansen@cwi.nl>
parents:
diff
changeset
|
284 PyMac_GetPoint(PyObject *v, Point *p) |
|
e57a4614469e
Split macglue.c into two: a new mactoolboxglue.c (in ./Python)
Jack Jansen <jack.jansen@cwi.nl>
parents:
diff
changeset
|
285 { |
|
e57a4614469e
Split macglue.c into two: a new mactoolboxglue.c (in ./Python)
Jack Jansen <jack.jansen@cwi.nl>
parents:
diff
changeset
|
286 return PyArg_Parse(v, "(hh)", &p->h, &p->v); |
|
e57a4614469e
Split macglue.c into two: a new mactoolboxglue.c (in ./Python)
Jack Jansen <jack.jansen@cwi.nl>
parents:
diff
changeset
|
287 } |
|
e57a4614469e
Split macglue.c into two: a new mactoolboxglue.c (in ./Python)
Jack Jansen <jack.jansen@cwi.nl>
parents:
diff
changeset
|
288 |
|
e57a4614469e
Split macglue.c into two: a new mactoolboxglue.c (in ./Python)
Jack Jansen <jack.jansen@cwi.nl>
parents:
diff
changeset
|
289 /* Convert a Point to a Python object */ |
|
e57a4614469e
Split macglue.c into two: a new mactoolboxglue.c (in ./Python)
Jack Jansen <jack.jansen@cwi.nl>
parents:
diff
changeset
|
290 PyObject * |
|
e57a4614469e
Split macglue.c into two: a new mactoolboxglue.c (in ./Python)
Jack Jansen <jack.jansen@cwi.nl>
parents:
diff
changeset
|
291 PyMac_BuildPoint(Point p) |
|
e57a4614469e
Split macglue.c into two: a new mactoolboxglue.c (in ./Python)
Jack Jansen <jack.jansen@cwi.nl>
parents:
diff
changeset
|
292 { |
|
e57a4614469e
Split macglue.c into two: a new mactoolboxglue.c (in ./Python)
Jack Jansen <jack.jansen@cwi.nl>
parents:
diff
changeset
|
293 return Py_BuildValue("(hh)", p.h, p.v); |
|
e57a4614469e
Split macglue.c into two: a new mactoolboxglue.c (in ./Python)
Jack Jansen <jack.jansen@cwi.nl>
parents:
diff
changeset
|
294 } |
|
e57a4614469e
Split macglue.c into two: a new mactoolboxglue.c (in ./Python)
Jack Jansen <jack.jansen@cwi.nl>
parents:
diff
changeset
|
295 |
|
e57a4614469e
Split macglue.c into two: a new mactoolboxglue.c (in ./Python)
Jack Jansen <jack.jansen@cwi.nl>
parents:
diff
changeset
|
296 |
|
e57a4614469e
Split macglue.c into two: a new mactoolboxglue.c (in ./Python)
Jack Jansen <jack.jansen@cwi.nl>
parents:
diff
changeset
|
297 /* Convert a Python object to an EventRecord. |
|
e57a4614469e
Split macglue.c into two: a new mactoolboxglue.c (in ./Python)
Jack Jansen <jack.jansen@cwi.nl>
parents:
diff
changeset
|
298 The object must be a (what, message, when, (v, h), modifiers) tuple. */ |
|
e57a4614469e
Split macglue.c into two: a new mactoolboxglue.c (in ./Python)
Jack Jansen <jack.jansen@cwi.nl>
parents:
diff
changeset
|
299 int |
|
e57a4614469e
Split macglue.c into two: a new mactoolboxglue.c (in ./Python)
Jack Jansen <jack.jansen@cwi.nl>
parents:
diff
changeset
|
300 PyMac_GetEventRecord(PyObject *v, EventRecord *e) |
|
e57a4614469e
Split macglue.c into two: a new mactoolboxglue.c (in ./Python)
Jack Jansen <jack.jansen@cwi.nl>
parents:
diff
changeset
|
301 { |
|
28655
16f47bd431c4
Oops, 'k' is the new format code for un unchecked 32 bit quantity,
Jack Jansen <jack.jansen@cwi.nl>
parents:
28654
diff
changeset
|
302 return PyArg_Parse(v, "(Hkk(hh)H)", |
|
19064
e57a4614469e
Split macglue.c into two: a new mactoolboxglue.c (in ./Python)
Jack Jansen <jack.jansen@cwi.nl>
parents:
diff
changeset
|
303 &e->what, |
|
e57a4614469e
Split macglue.c into two: a new mactoolboxglue.c (in ./Python)
Jack Jansen <jack.jansen@cwi.nl>
parents:
diff
changeset
|
304 &e->message, |
|
e57a4614469e
Split macglue.c into two: a new mactoolboxglue.c (in ./Python)
Jack Jansen <jack.jansen@cwi.nl>
parents:
diff
changeset
|
305 &e->when, |
|
e57a4614469e
Split macglue.c into two: a new mactoolboxglue.c (in ./Python)
Jack Jansen <jack.jansen@cwi.nl>
parents:
diff
changeset
|
306 &e->where.h, |
|
e57a4614469e
Split macglue.c into two: a new mactoolboxglue.c (in ./Python)
Jack Jansen <jack.jansen@cwi.nl>
parents:
diff
changeset
|
307 &e->where.v, |
|
e57a4614469e
Split macglue.c into two: a new mactoolboxglue.c (in ./Python)
Jack Jansen <jack.jansen@cwi.nl>
parents:
diff
changeset
|
308 &e->modifiers); |
|
e57a4614469e
Split macglue.c into two: a new mactoolboxglue.c (in ./Python)
Jack Jansen <jack.jansen@cwi.nl>
parents:
diff
changeset
|
309 } |
|
e57a4614469e
Split macglue.c into two: a new mactoolboxglue.c (in ./Python)
Jack Jansen <jack.jansen@cwi.nl>
parents:
diff
changeset
|
310 |
|
e57a4614469e
Split macglue.c into two: a new mactoolboxglue.c (in ./Python)
Jack Jansen <jack.jansen@cwi.nl>
parents:
diff
changeset
|
311 /* Convert a Rect to an EventRecord object */ |
|
e57a4614469e
Split macglue.c into two: a new mactoolboxglue.c (in ./Python)
Jack Jansen <jack.jansen@cwi.nl>
parents:
diff
changeset
|
312 PyObject * |
|
e57a4614469e
Split macglue.c into two: a new mactoolboxglue.c (in ./Python)
Jack Jansen <jack.jansen@cwi.nl>
parents:
diff
changeset
|
313 PyMac_BuildEventRecord(EventRecord *e) |
|
e57a4614469e
Split macglue.c into two: a new mactoolboxglue.c (in ./Python)
Jack Jansen <jack.jansen@cwi.nl>
parents:
diff
changeset
|
314 { |
|
e57a4614469e
Split macglue.c into two: a new mactoolboxglue.c (in ./Python)
Jack Jansen <jack.jansen@cwi.nl>
parents:
diff
changeset
|
315 return Py_BuildValue("(hll(hh)h)", |
|
e57a4614469e
Split macglue.c into two: a new mactoolboxglue.c (in ./Python)
Jack Jansen <jack.jansen@cwi.nl>
parents:
diff
changeset
|
316 e->what, |
|
e57a4614469e
Split macglue.c into two: a new mactoolboxglue.c (in ./Python)
Jack Jansen <jack.jansen@cwi.nl>
parents:
diff
changeset
|
317 e->message, |
|
e57a4614469e
Split macglue.c into two: a new mactoolboxglue.c (in ./Python)
Jack Jansen <jack.jansen@cwi.nl>
parents:
diff
changeset
|
318 e->when, |
|
e57a4614469e
Split macglue.c into two: a new mactoolboxglue.c (in ./Python)
Jack Jansen <jack.jansen@cwi.nl>
parents:
diff
changeset
|
319 e->where.h, |
|
e57a4614469e
Split macglue.c into two: a new mactoolboxglue.c (in ./Python)
Jack Jansen <jack.jansen@cwi.nl>
parents:
diff
changeset
|
320 e->where.v, |
|
e57a4614469e
Split macglue.c into two: a new mactoolboxglue.c (in ./Python)
Jack Jansen <jack.jansen@cwi.nl>
parents:
diff
changeset
|
321 e->modifiers); |
|
e57a4614469e
Split macglue.c into two: a new mactoolboxglue.c (in ./Python)
Jack Jansen <jack.jansen@cwi.nl>
parents:
diff
changeset
|
322 } |
|
e57a4614469e
Split macglue.c into two: a new mactoolboxglue.c (in ./Python)
Jack Jansen <jack.jansen@cwi.nl>
parents:
diff
changeset
|
323 |
|
e57a4614469e
Split macglue.c into two: a new mactoolboxglue.c (in ./Python)
Jack Jansen <jack.jansen@cwi.nl>
parents:
diff
changeset
|
324 /* Convert Python object to Fixed */ |
|
e57a4614469e
Split macglue.c into two: a new mactoolboxglue.c (in ./Python)
Jack Jansen <jack.jansen@cwi.nl>
parents:
diff
changeset
|
325 int |
|
e57a4614469e
Split macglue.c into two: a new mactoolboxglue.c (in ./Python)
Jack Jansen <jack.jansen@cwi.nl>
parents:
diff
changeset
|
326 PyMac_GetFixed(PyObject *v, Fixed *f) |
|
e57a4614469e
Split macglue.c into two: a new mactoolboxglue.c (in ./Python)
Jack Jansen <jack.jansen@cwi.nl>
parents:
diff
changeset
|
327 { |
|
e57a4614469e
Split macglue.c into two: a new mactoolboxglue.c (in ./Python)
Jack Jansen <jack.jansen@cwi.nl>
parents:
diff
changeset
|
328 double d; |
|
e57a4614469e
Split macglue.c into two: a new mactoolboxglue.c (in ./Python)
Jack Jansen <jack.jansen@cwi.nl>
parents:
diff
changeset
|
329 |
|
e57a4614469e
Split macglue.c into two: a new mactoolboxglue.c (in ./Python)
Jack Jansen <jack.jansen@cwi.nl>
parents:
diff
changeset
|
330 if( !PyArg_Parse(v, "d", &d)) |
|
e57a4614469e
Split macglue.c into two: a new mactoolboxglue.c (in ./Python)
Jack Jansen <jack.jansen@cwi.nl>
parents:
diff
changeset
|
331 return 0; |
|
e57a4614469e
Split macglue.c into two: a new mactoolboxglue.c (in ./Python)
Jack Jansen <jack.jansen@cwi.nl>
parents:
diff
changeset
|
332 *f = (Fixed)(d * 0x10000); |
|
e57a4614469e
Split macglue.c into two: a new mactoolboxglue.c (in ./Python)
Jack Jansen <jack.jansen@cwi.nl>
parents:
diff
changeset
|
333 return 1; |
|
e57a4614469e
Split macglue.c into two: a new mactoolboxglue.c (in ./Python)
Jack Jansen <jack.jansen@cwi.nl>
parents:
diff
changeset
|
334 } |
|
e57a4614469e
Split macglue.c into two: a new mactoolboxglue.c (in ./Python)
Jack Jansen <jack.jansen@cwi.nl>
parents:
diff
changeset
|
335 |
|
19496
617555579611
Refer to the toolbox modules by their official name (Carbon.AE), not the internal name (_AE). This can slow things down (once) but it's the only way I can get things to work on OSX, OS9 dynamically loaded and OS9 frozen.
Jack Jansen <jack.jansen@cwi.nl>
parents:
19442
diff
changeset
|
336 /* Convert a Fixed to a Python object */ |
|
19064
e57a4614469e
Split macglue.c into two: a new mactoolboxglue.c (in ./Python)
Jack Jansen <jack.jansen@cwi.nl>
parents:
diff
changeset
|
337 PyObject * |
|
e57a4614469e
Split macglue.c into two: a new mactoolboxglue.c (in ./Python)
Jack Jansen <jack.jansen@cwi.nl>
parents:
diff
changeset
|
338 PyMac_BuildFixed(Fixed f) |
|
e57a4614469e
Split macglue.c into two: a new mactoolboxglue.c (in ./Python)
Jack Jansen <jack.jansen@cwi.nl>
parents:
diff
changeset
|
339 { |
|
e57a4614469e
Split macglue.c into two: a new mactoolboxglue.c (in ./Python)
Jack Jansen <jack.jansen@cwi.nl>
parents:
diff
changeset
|
340 double d; |
|
e57a4614469e
Split macglue.c into two: a new mactoolboxglue.c (in ./Python)
Jack Jansen <jack.jansen@cwi.nl>
parents:
diff
changeset
|
341 |
|
e57a4614469e
Split macglue.c into two: a new mactoolboxglue.c (in ./Python)
Jack Jansen <jack.jansen@cwi.nl>
parents:
diff
changeset
|
342 d = f; |
|
e57a4614469e
Split macglue.c into two: a new mactoolboxglue.c (in ./Python)
Jack Jansen <jack.jansen@cwi.nl>
parents:
diff
changeset
|
343 d = d / 0x10000; |
|
e57a4614469e
Split macglue.c into two: a new mactoolboxglue.c (in ./Python)
Jack Jansen <jack.jansen@cwi.nl>
parents:
diff
changeset
|
344 return Py_BuildValue("d", d); |
|
e57a4614469e
Split macglue.c into two: a new mactoolboxglue.c (in ./Python)
Jack Jansen <jack.jansen@cwi.nl>
parents:
diff
changeset
|
345 } |
|
e57a4614469e
Split macglue.c into two: a new mactoolboxglue.c (in ./Python)
Jack Jansen <jack.jansen@cwi.nl>
parents:
diff
changeset
|
346 |
|
e57a4614469e
Split macglue.c into two: a new mactoolboxglue.c (in ./Python)
Jack Jansen <jack.jansen@cwi.nl>
parents:
diff
changeset
|
347 /* Convert wide to/from Python int or (hi, lo) tuple. XXXX Should use Python longs */ |
|
e57a4614469e
Split macglue.c into two: a new mactoolboxglue.c (in ./Python)
Jack Jansen <jack.jansen@cwi.nl>
parents:
diff
changeset
|
348 int |
|
e57a4614469e
Split macglue.c into two: a new mactoolboxglue.c (in ./Python)
Jack Jansen <jack.jansen@cwi.nl>
parents:
diff
changeset
|
349 PyMac_Getwide(PyObject *v, wide *rv) |
|
e57a4614469e
Split macglue.c into two: a new mactoolboxglue.c (in ./Python)
Jack Jansen <jack.jansen@cwi.nl>
parents:
diff
changeset
|
350 { |
|
44099
f324631462a2
Cleanup: Replaced most PyInt_ aliases with PyLong_ and disabled the aliases in intobject.h
Christian Heimes <christian@cheimes.de>
parents:
43777
diff
changeset
|
351 if (PyLong_Check(v)) { |
|
19064
e57a4614469e
Split macglue.c into two: a new mactoolboxglue.c (in ./Python)
Jack Jansen <jack.jansen@cwi.nl>
parents:
diff
changeset
|
352 rv->hi = 0; |
|
44099
f324631462a2
Cleanup: Replaced most PyInt_ aliases with PyLong_ and disabled the aliases in intobject.h
Christian Heimes <christian@cheimes.de>
parents:
43777
diff
changeset
|
353 rv->lo = PyLong_AsLong(v); |
|
19064
e57a4614469e
Split macglue.c into two: a new mactoolboxglue.c (in ./Python)
Jack Jansen <jack.jansen@cwi.nl>
parents:
diff
changeset
|
354 if( rv->lo & 0x80000000 ) |
|
e57a4614469e
Split macglue.c into two: a new mactoolboxglue.c (in ./Python)
Jack Jansen <jack.jansen@cwi.nl>
parents:
diff
changeset
|
355 rv->hi = -1; |
|
e57a4614469e
Split macglue.c into two: a new mactoolboxglue.c (in ./Python)
Jack Jansen <jack.jansen@cwi.nl>
parents:
diff
changeset
|
356 return 1; |
|
e57a4614469e
Split macglue.c into two: a new mactoolboxglue.c (in ./Python)
Jack Jansen <jack.jansen@cwi.nl>
parents:
diff
changeset
|
357 } |
|
28655
16f47bd431c4
Oops, 'k' is the new format code for un unchecked 32 bit quantity,
Jack Jansen <jack.jansen@cwi.nl>
parents:
28654
diff
changeset
|
358 return PyArg_Parse(v, "(kk)", &rv->hi, &rv->lo); |
|
19064
e57a4614469e
Split macglue.c into two: a new mactoolboxglue.c (in ./Python)
Jack Jansen <jack.jansen@cwi.nl>
parents:
diff
changeset
|
359 } |
|
e57a4614469e
Split macglue.c into two: a new mactoolboxglue.c (in ./Python)
Jack Jansen <jack.jansen@cwi.nl>
parents:
diff
changeset
|
360 |
|
e57a4614469e
Split macglue.c into two: a new mactoolboxglue.c (in ./Python)
Jack Jansen <jack.jansen@cwi.nl>
parents:
diff
changeset
|
361 |
|
e57a4614469e
Split macglue.c into two: a new mactoolboxglue.c (in ./Python)
Jack Jansen <jack.jansen@cwi.nl>
parents:
diff
changeset
|
362 PyObject * |
|
e57a4614469e
Split macglue.c into two: a new mactoolboxglue.c (in ./Python)
Jack Jansen <jack.jansen@cwi.nl>
parents:
diff
changeset
|
363 PyMac_Buildwide(wide *w) |
|
e57a4614469e
Split macglue.c into two: a new mactoolboxglue.c (in ./Python)
Jack Jansen <jack.jansen@cwi.nl>
parents:
diff
changeset
|
364 { |
|
e57a4614469e
Split macglue.c into two: a new mactoolboxglue.c (in ./Python)
Jack Jansen <jack.jansen@cwi.nl>
parents:
diff
changeset
|
365 if ( (w->hi == 0 && (w->lo & 0x80000000) == 0) || |
|
e57a4614469e
Split macglue.c into two: a new mactoolboxglue.c (in ./Python)
Jack Jansen <jack.jansen@cwi.nl>
parents:
diff
changeset
|
366 (w->hi == -1 && (w->lo & 0x80000000) ) ) |
|
44099
f324631462a2
Cleanup: Replaced most PyInt_ aliases with PyLong_ and disabled the aliases in intobject.h
Christian Heimes <christian@cheimes.de>
parents:
43777
diff
changeset
|
367 return PyLong_FromLong(w->lo); |
|
19064
e57a4614469e
Split macglue.c into two: a new mactoolboxglue.c (in ./Python)
Jack Jansen <jack.jansen@cwi.nl>
parents:
diff
changeset
|
368 return Py_BuildValue("(ll)", w->hi, w->lo); |
|
e57a4614469e
Split macglue.c into two: a new mactoolboxglue.c (in ./Python)
Jack Jansen <jack.jansen@cwi.nl>
parents:
diff
changeset
|
369 } |
|
e57a4614469e
Split macglue.c into two: a new mactoolboxglue.c (in ./Python)
Jack Jansen <jack.jansen@cwi.nl>
parents:
diff
changeset
|
370 |
|
e57a4614469e
Split macglue.c into two: a new mactoolboxglue.c (in ./Python)
Jack Jansen <jack.jansen@cwi.nl>
parents:
diff
changeset
|
371 #ifdef USE_TOOLBOX_OBJECT_GLUE |
|
e57a4614469e
Split macglue.c into two: a new mactoolboxglue.c (in ./Python)
Jack Jansen <jack.jansen@cwi.nl>
parents:
diff
changeset
|
372 /* |
|
e57a4614469e
Split macglue.c into two: a new mactoolboxglue.c (in ./Python)
Jack Jansen <jack.jansen@cwi.nl>
parents:
diff
changeset
|
373 ** Glue together the toolbox objects. |
|
e57a4614469e
Split macglue.c into two: a new mactoolboxglue.c (in ./Python)
Jack Jansen <jack.jansen@cwi.nl>
parents:
diff
changeset
|
374 ** |
|
e57a4614469e
Split macglue.c into two: a new mactoolboxglue.c (in ./Python)
Jack Jansen <jack.jansen@cwi.nl>
parents:
diff
changeset
|
375 ** Because toolbox modules interdepend on each other, they use each others |
|
e57a4614469e
Split macglue.c into two: a new mactoolboxglue.c (in ./Python)
Jack Jansen <jack.jansen@cwi.nl>
parents:
diff
changeset
|
376 ** object types, on MacOSX/MachO this leads to the situation that they |
|
e57a4614469e
Split macglue.c into two: a new mactoolboxglue.c (in ./Python)
Jack Jansen <jack.jansen@cwi.nl>
parents:
diff
changeset
|
377 ** cannot be dynamically loaded (or they would all have to be lumped into |
|
e57a4614469e
Split macglue.c into two: a new mactoolboxglue.c (in ./Python)
Jack Jansen <jack.jansen@cwi.nl>
parents:
diff
changeset
|
378 ** a single .so, but this would be bad for extensibility). |
|
e57a4614469e
Split macglue.c into two: a new mactoolboxglue.c (in ./Python)
Jack Jansen <jack.jansen@cwi.nl>
parents:
diff
changeset
|
379 ** |
|
e57a4614469e
Split macglue.c into two: a new mactoolboxglue.c (in ./Python)
Jack Jansen <jack.jansen@cwi.nl>
parents:
diff
changeset
|
380 ** This file defines wrappers for all the _New and _Convert functions, |
|
e57a4614469e
Split macglue.c into two: a new mactoolboxglue.c (in ./Python)
Jack Jansen <jack.jansen@cwi.nl>
parents:
diff
changeset
|
381 ** which are the Py_BuildValue and PyArg_ParseTuple helpers. The wrappers |
|
e57a4614469e
Split macglue.c into two: a new mactoolboxglue.c (in ./Python)
Jack Jansen <jack.jansen@cwi.nl>
parents:
diff
changeset
|
382 ** check an indirection function pointer, and if it isn't filled in yet |
|
e57a4614469e
Split macglue.c into two: a new mactoolboxglue.c (in ./Python)
Jack Jansen <jack.jansen@cwi.nl>
parents:
diff
changeset
|
383 ** they import the appropriate module, whose init routine should fill in |
|
e57a4614469e
Split macglue.c into two: a new mactoolboxglue.c (in ./Python)
Jack Jansen <jack.jansen@cwi.nl>
parents:
diff
changeset
|
384 ** the pointer. |
|
e57a4614469e
Split macglue.c into two: a new mactoolboxglue.c (in ./Python)
Jack Jansen <jack.jansen@cwi.nl>
parents:
diff
changeset
|
385 */ |
|
e57a4614469e
Split macglue.c into two: a new mactoolboxglue.c (in ./Python)
Jack Jansen <jack.jansen@cwi.nl>
parents:
diff
changeset
|
386 |
|
e57a4614469e
Split macglue.c into two: a new mactoolboxglue.c (in ./Python)
Jack Jansen <jack.jansen@cwi.nl>
parents:
diff
changeset
|
387 #define GLUE_NEW(object, routinename, module) \ |
|
e57a4614469e
Split macglue.c into two: a new mactoolboxglue.c (in ./Python)
Jack Jansen <jack.jansen@cwi.nl>
parents:
diff
changeset
|
388 PyObject *(*PyMacGluePtr_##routinename)(object); \ |
|
e57a4614469e
Split macglue.c into two: a new mactoolboxglue.c (in ./Python)
Jack Jansen <jack.jansen@cwi.nl>
parents:
diff
changeset
|
389 \ |
|
e57a4614469e
Split macglue.c into two: a new mactoolboxglue.c (in ./Python)
Jack Jansen <jack.jansen@cwi.nl>
parents:
diff
changeset
|
390 PyObject *routinename(object cobj) { \ |
|
e57a4614469e
Split macglue.c into two: a new mactoolboxglue.c (in ./Python)
Jack Jansen <jack.jansen@cwi.nl>
parents:
diff
changeset
|
391 if (!PyMacGluePtr_##routinename) { \ |
|
e57a4614469e
Split macglue.c into two: a new mactoolboxglue.c (in ./Python)
Jack Jansen <jack.jansen@cwi.nl>
parents:
diff
changeset
|
392 if (!PyImport_ImportModule(module)) return NULL; \ |
|
e57a4614469e
Split macglue.c into two: a new mactoolboxglue.c (in ./Python)
Jack Jansen <jack.jansen@cwi.nl>
parents:
diff
changeset
|
393 if (!PyMacGluePtr_##routinename) { \ |
|
e57a4614469e
Split macglue.c into two: a new mactoolboxglue.c (in ./Python)
Jack Jansen <jack.jansen@cwi.nl>
parents:
diff
changeset
|
394 PyErr_SetString(PyExc_ImportError, "Module did not provide routine: " module ": " #routinename); \ |
|
e57a4614469e
Split macglue.c into two: a new mactoolboxglue.c (in ./Python)
Jack Jansen <jack.jansen@cwi.nl>
parents:
diff
changeset
|
395 return NULL; \ |
|
e57a4614469e
Split macglue.c into two: a new mactoolboxglue.c (in ./Python)
Jack Jansen <jack.jansen@cwi.nl>
parents:
diff
changeset
|
396 } \ |
|
e57a4614469e
Split macglue.c into two: a new mactoolboxglue.c (in ./Python)
Jack Jansen <jack.jansen@cwi.nl>
parents:
diff
changeset
|
397 } \ |
|
e57a4614469e
Split macglue.c into two: a new mactoolboxglue.c (in ./Python)
Jack Jansen <jack.jansen@cwi.nl>
parents:
diff
changeset
|
398 return (*PyMacGluePtr_##routinename)(cobj); \ |
|
e57a4614469e
Split macglue.c into two: a new mactoolboxglue.c (in ./Python)
Jack Jansen <jack.jansen@cwi.nl>
parents:
diff
changeset
|
399 } |
|
e57a4614469e
Split macglue.c into two: a new mactoolboxglue.c (in ./Python)
Jack Jansen <jack.jansen@cwi.nl>
parents:
diff
changeset
|
400 |
|
e57a4614469e
Split macglue.c into two: a new mactoolboxglue.c (in ./Python)
Jack Jansen <jack.jansen@cwi.nl>
parents:
diff
changeset
|
401 #define GLUE_CONVERT(object, routinename, module) \ |
|
e57a4614469e
Split macglue.c into two: a new mactoolboxglue.c (in ./Python)
Jack Jansen <jack.jansen@cwi.nl>
parents:
diff
changeset
|
402 int (*PyMacGluePtr_##routinename)(PyObject *, object *); \ |
|
e57a4614469e
Split macglue.c into two: a new mactoolboxglue.c (in ./Python)
Jack Jansen <jack.jansen@cwi.nl>
parents:
diff
changeset
|
403 \ |
|
e57a4614469e
Split macglue.c into two: a new mactoolboxglue.c (in ./Python)
Jack Jansen <jack.jansen@cwi.nl>
parents:
diff
changeset
|
404 int routinename(PyObject *pyobj, object *cobj) { \ |
|
e57a4614469e
Split macglue.c into two: a new mactoolboxglue.c (in ./Python)
Jack Jansen <jack.jansen@cwi.nl>
parents:
diff
changeset
|
405 if (!PyMacGluePtr_##routinename) { \ |
|
36501
7fdc639bc5b4
Merge ssize_t branch.
Martin v. Löwis <martin@v.loewis.de>
parents:
33908
diff
changeset
|
406 if (!PyImport_ImportModule(module)) return 0; \ |
|
19064
e57a4614469e
Split macglue.c into two: a new mactoolboxglue.c (in ./Python)
Jack Jansen <jack.jansen@cwi.nl>
parents:
diff
changeset
|
407 if (!PyMacGluePtr_##routinename) { \ |
|
e57a4614469e
Split macglue.c into two: a new mactoolboxglue.c (in ./Python)
Jack Jansen <jack.jansen@cwi.nl>
parents:
diff
changeset
|
408 PyErr_SetString(PyExc_ImportError, "Module did not provide routine: " module ": " #routinename); \ |
|
36501
7fdc639bc5b4
Merge ssize_t branch.
Martin v. Löwis <martin@v.loewis.de>
parents:
33908
diff
changeset
|
409 return 0; \ |
|
19064
e57a4614469e
Split macglue.c into two: a new mactoolboxglue.c (in ./Python)
Jack Jansen <jack.jansen@cwi.nl>
parents:
diff
changeset
|
410 } \ |
|
e57a4614469e
Split macglue.c into two: a new mactoolboxglue.c (in ./Python)
Jack Jansen <jack.jansen@cwi.nl>
parents:
diff
changeset
|
411 } \ |
|
e57a4614469e
Split macglue.c into two: a new mactoolboxglue.c (in ./Python)
Jack Jansen <jack.jansen@cwi.nl>
parents:
diff
changeset
|
412 return (*PyMacGluePtr_##routinename)(pyobj, cobj); \ |
|
e57a4614469e
Split macglue.c into two: a new mactoolboxglue.c (in ./Python)
Jack Jansen <jack.jansen@cwi.nl>
parents:
diff
changeset
|
413 } |
|
19645
d55b75ac2fb4
Added glue routine for PyMac_BuildFSSpec, PyMac_GetFSRef and PyMac_BuildFSRef.
Jack Jansen <jack.jansen@cwi.nl>
parents:
19496
diff
changeset
|
414 |
|
28138
eb15de6a4a4c
Use Carbon.File for FSSpec and FSRef conversion, not macfs.
Jack Jansen <jack.jansen@cwi.nl>
parents:
27286
diff
changeset
|
415 GLUE_NEW(FSSpec *, PyMac_BuildFSSpec, "Carbon.File") |
|
eb15de6a4a4c
Use Carbon.File for FSSpec and FSRef conversion, not macfs.
Jack Jansen <jack.jansen@cwi.nl>
parents:
27286
diff
changeset
|
416 GLUE_CONVERT(FSSpec, PyMac_GetFSSpec, "Carbon.File") |
|
eb15de6a4a4c
Use Carbon.File for FSSpec and FSRef conversion, not macfs.
Jack Jansen <jack.jansen@cwi.nl>
parents:
27286
diff
changeset
|
417 GLUE_NEW(FSRef *, PyMac_BuildFSRef, "Carbon.File") |
|
eb15de6a4a4c
Use Carbon.File for FSSpec and FSRef conversion, not macfs.
Jack Jansen <jack.jansen@cwi.nl>
parents:
27286
diff
changeset
|
418 GLUE_CONVERT(FSRef, PyMac_GetFSRef, "Carbon.File") |
|
19064
e57a4614469e
Split macglue.c into two: a new mactoolboxglue.c (in ./Python)
Jack Jansen <jack.jansen@cwi.nl>
parents:
diff
changeset
|
419 |
|
19496
617555579611
Refer to the toolbox modules by their official name (Carbon.AE), not the internal name (_AE). This can slow things down (once) but it's the only way I can get things to work on OSX, OS9 dynamically loaded and OS9 frozen.
Jack Jansen <jack.jansen@cwi.nl>
parents:
19442
diff
changeset
|
420 GLUE_NEW(AppleEvent *, AEDesc_New, "Carbon.AE") /* XXXX Why by address? */ |
|
27286
04e5610c5efe
It turns out that some calls return AEDesc records that are "borrowed",
Jack Jansen <jack.jansen@cwi.nl>
parents:
26764
diff
changeset
|
421 GLUE_NEW(AppleEvent *, AEDesc_NewBorrowed, "Carbon.AE") |
|
19496
617555579611
Refer to the toolbox modules by their official name (Carbon.AE), not the internal name (_AE). This can slow things down (once) but it's the only way I can get things to work on OSX, OS9 dynamically loaded and OS9 frozen.
Jack Jansen <jack.jansen@cwi.nl>
parents:
19442
diff
changeset
|
422 GLUE_CONVERT(AppleEvent, AEDesc_Convert, "Carbon.AE") |
|
19064
e57a4614469e
Split macglue.c into two: a new mactoolboxglue.c (in ./Python)
Jack Jansen <jack.jansen@cwi.nl>
parents:
diff
changeset
|
423 |
|
19496
617555579611
Refer to the toolbox modules by their official name (Carbon.AE), not the internal name (_AE). This can slow things down (once) but it's the only way I can get things to work on OSX, OS9 dynamically loaded and OS9 frozen.
Jack Jansen <jack.jansen@cwi.nl>
parents:
19442
diff
changeset
|
424 GLUE_NEW(Component, CmpObj_New, "Carbon.Cm") |
|
617555579611
Refer to the toolbox modules by their official name (Carbon.AE), not the internal name (_AE). This can slow things down (once) but it's the only way I can get things to work on OSX, OS9 dynamically loaded and OS9 frozen.
Jack Jansen <jack.jansen@cwi.nl>
parents:
19442
diff
changeset
|
425 GLUE_CONVERT(Component, CmpObj_Convert, "Carbon.Cm") |
|
617555579611
Refer to the toolbox modules by their official name (Carbon.AE), not the internal name (_AE). This can slow things down (once) but it's the only way I can get things to work on OSX, OS9 dynamically loaded and OS9 frozen.
Jack Jansen <jack.jansen@cwi.nl>
parents:
19442
diff
changeset
|
426 GLUE_NEW(ComponentInstance, CmpInstObj_New, "Carbon.Cm") |
|
617555579611
Refer to the toolbox modules by their official name (Carbon.AE), not the internal name (_AE). This can slow things down (once) but it's the only way I can get things to work on OSX, OS9 dynamically loaded and OS9 frozen.
Jack Jansen <jack.jansen@cwi.nl>
parents:
19442
diff
changeset
|
427 GLUE_CONVERT(ComponentInstance, CmpInstObj_Convert, "Carbon.Cm") |
|
19064
e57a4614469e
Split macglue.c into two: a new mactoolboxglue.c (in ./Python)
Jack Jansen <jack.jansen@cwi.nl>
parents:
diff
changeset
|
428 |
|
19496
617555579611
Refer to the toolbox modules by their official name (Carbon.AE), not the internal name (_AE). This can slow things down (once) but it's the only way I can get things to work on OSX, OS9 dynamically loaded and OS9 frozen.
Jack Jansen <jack.jansen@cwi.nl>
parents:
19442
diff
changeset
|
429 GLUE_NEW(ControlHandle, CtlObj_New, "Carbon.Ctl") |
|
617555579611
Refer to the toolbox modules by their official name (Carbon.AE), not the internal name (_AE). This can slow things down (once) but it's the only way I can get things to work on OSX, OS9 dynamically loaded and OS9 frozen.
Jack Jansen <jack.jansen@cwi.nl>
parents:
19442
diff
changeset
|
430 GLUE_CONVERT(ControlHandle, CtlObj_Convert, "Carbon.Ctl") |
|
19064
e57a4614469e
Split macglue.c into two: a new mactoolboxglue.c (in ./Python)
Jack Jansen <jack.jansen@cwi.nl>
parents:
diff
changeset
|
431 |
|
19496
617555579611
Refer to the toolbox modules by their official name (Carbon.AE), not the internal name (_AE). This can slow things down (once) but it's the only way I can get things to work on OSX, OS9 dynamically loaded and OS9 frozen.
Jack Jansen <jack.jansen@cwi.nl>
parents:
19442
diff
changeset
|
432 GLUE_NEW(DialogPtr, DlgObj_New, "Carbon.Dlg") |
|
617555579611
Refer to the toolbox modules by their official name (Carbon.AE), not the internal name (_AE). This can slow things down (once) but it's the only way I can get things to work on OSX, OS9 dynamically loaded and OS9 frozen.
Jack Jansen <jack.jansen@cwi.nl>
parents:
19442
diff
changeset
|
433 GLUE_CONVERT(DialogPtr, DlgObj_Convert, "Carbon.Dlg") |
|
617555579611
Refer to the toolbox modules by their official name (Carbon.AE), not the internal name (_AE). This can slow things down (once) but it's the only way I can get things to work on OSX, OS9 dynamically loaded and OS9 frozen.
Jack Jansen <jack.jansen@cwi.nl>
parents:
19442
diff
changeset
|
434 GLUE_NEW(DialogPtr, DlgObj_WhichDialog, "Carbon.Dlg") |
|
19064
e57a4614469e
Split macglue.c into two: a new mactoolboxglue.c (in ./Python)
Jack Jansen <jack.jansen@cwi.nl>
parents:
diff
changeset
|
435 |
|
19496
617555579611
Refer to the toolbox modules by their official name (Carbon.AE), not the internal name (_AE). This can slow things down (once) but it's the only way I can get things to work on OSX, OS9 dynamically loaded and OS9 frozen.
Jack Jansen <jack.jansen@cwi.nl>
parents:
19442
diff
changeset
|
436 GLUE_NEW(DragReference, DragObj_New, "Carbon.Drag") |
|
617555579611
Refer to the toolbox modules by their official name (Carbon.AE), not the internal name (_AE). This can slow things down (once) but it's the only way I can get things to work on OSX, OS9 dynamically loaded and OS9 frozen.
Jack Jansen <jack.jansen@cwi.nl>
parents:
19442
diff
changeset
|
437 GLUE_CONVERT(DragReference, DragObj_Convert, "Carbon.Drag") |
|
19064
e57a4614469e
Split macglue.c into two: a new mactoolboxglue.c (in ./Python)
Jack Jansen <jack.jansen@cwi.nl>
parents:
diff
changeset
|
438 |
|
19496
617555579611
Refer to the toolbox modules by their official name (Carbon.AE), not the internal name (_AE). This can slow things down (once) but it's the only way I can get things to work on OSX, OS9 dynamically loaded and OS9 frozen.
Jack Jansen <jack.jansen@cwi.nl>
parents:
19442
diff
changeset
|
439 GLUE_NEW(ListHandle, ListObj_New, "Carbon.List") |
|
617555579611
Refer to the toolbox modules by their official name (Carbon.AE), not the internal name (_AE). This can slow things down (once) but it's the only way I can get things to work on OSX, OS9 dynamically loaded and OS9 frozen.
Jack Jansen <jack.jansen@cwi.nl>
parents:
19442
diff
changeset
|
440 GLUE_CONVERT(ListHandle, ListObj_Convert, "Carbon.List") |
|
19064
e57a4614469e
Split macglue.c into two: a new mactoolboxglue.c (in ./Python)
Jack Jansen <jack.jansen@cwi.nl>
parents:
diff
changeset
|
441 |
|
19496
617555579611
Refer to the toolbox modules by their official name (Carbon.AE), not the internal name (_AE). This can slow things down (once) but it's the only way I can get things to work on OSX, OS9 dynamically loaded and OS9 frozen.
Jack Jansen <jack.jansen@cwi.nl>
parents:
19442
diff
changeset
|
442 GLUE_NEW(MenuHandle, MenuObj_New, "Carbon.Menu") |
|
617555579611
Refer to the toolbox modules by their official name (Carbon.AE), not the internal name (_AE). This can slow things down (once) but it's the only way I can get things to work on OSX, OS9 dynamically loaded and OS9 frozen.
Jack Jansen <jack.jansen@cwi.nl>
parents:
19442
diff
changeset
|
443 GLUE_CONVERT(MenuHandle, MenuObj_Convert, "Carbon.Menu") |
|
19064
e57a4614469e
Split macglue.c into two: a new mactoolboxglue.c (in ./Python)
Jack Jansen <jack.jansen@cwi.nl>
parents:
diff
changeset
|
444 |
|
19496
617555579611
Refer to the toolbox modules by their official name (Carbon.AE), not the internal name (_AE). This can slow things down (once) but it's the only way I can get things to work on OSX, OS9 dynamically loaded and OS9 frozen.
Jack Jansen <jack.jansen@cwi.nl>
parents:
19442
diff
changeset
|
445 GLUE_NEW(GrafPtr, GrafObj_New, "Carbon.Qd") |
|
617555579611
Refer to the toolbox modules by their official name (Carbon.AE), not the internal name (_AE). This can slow things down (once) but it's the only way I can get things to work on OSX, OS9 dynamically loaded and OS9 frozen.
Jack Jansen <jack.jansen@cwi.nl>
parents:
19442
diff
changeset
|
446 GLUE_CONVERT(GrafPtr, GrafObj_Convert, "Carbon.Qd") |
|
617555579611
Refer to the toolbox modules by their official name (Carbon.AE), not the internal name (_AE). This can slow things down (once) but it's the only way I can get things to work on OSX, OS9 dynamically loaded and OS9 frozen.
Jack Jansen <jack.jansen@cwi.nl>
parents:
19442
diff
changeset
|
447 GLUE_NEW(BitMapPtr, BMObj_New, "Carbon.Qd") |
|
617555579611
Refer to the toolbox modules by their official name (Carbon.AE), not the internal name (_AE). This can slow things down (once) but it's the only way I can get things to work on OSX, OS9 dynamically loaded and OS9 frozen.
Jack Jansen <jack.jansen@cwi.nl>
parents:
19442
diff
changeset
|
448 GLUE_CONVERT(BitMapPtr, BMObj_Convert, "Carbon.Qd") |
|
617555579611
Refer to the toolbox modules by their official name (Carbon.AE), not the internal name (_AE). This can slow things down (once) but it's the only way I can get things to work on OSX, OS9 dynamically loaded and OS9 frozen.
Jack Jansen <jack.jansen@cwi.nl>
parents:
19442
diff
changeset
|
449 GLUE_NEW(RGBColor *, QdRGB_New, "Carbon.Qd") /* XXXX Why? */ |
|
617555579611
Refer to the toolbox modules by their official name (Carbon.AE), not the internal name (_AE). This can slow things down (once) but it's the only way I can get things to work on OSX, OS9 dynamically loaded and OS9 frozen.
Jack Jansen <jack.jansen@cwi.nl>
parents:
19442
diff
changeset
|
450 GLUE_CONVERT(RGBColor, QdRGB_Convert, "Carbon.Qd") |
|
19064
e57a4614469e
Split macglue.c into two: a new mactoolboxglue.c (in ./Python)
Jack Jansen <jack.jansen@cwi.nl>
parents:
diff
changeset
|
451 |
|
19496
617555579611
Refer to the toolbox modules by their official name (Carbon.AE), not the internal name (_AE). This can slow things down (once) but it's the only way I can get things to work on OSX, OS9 dynamically loaded and OS9 frozen.
Jack Jansen <jack.jansen@cwi.nl>
parents:
19442
diff
changeset
|
452 GLUE_NEW(GWorldPtr, GWorldObj_New, "Carbon.Qdoffs") |
|
617555579611
Refer to the toolbox modules by their official name (Carbon.AE), not the internal name (_AE). This can slow things down (once) but it's the only way I can get things to work on OSX, OS9 dynamically loaded and OS9 frozen.
Jack Jansen <jack.jansen@cwi.nl>
parents:
19442
diff
changeset
|
453 GLUE_CONVERT(GWorldPtr, GWorldObj_Convert, "Carbon.Qdoffs") |
|
19064
e57a4614469e
Split macglue.c into two: a new mactoolboxglue.c (in ./Python)
Jack Jansen <jack.jansen@cwi.nl>
parents:
diff
changeset
|
454 |
|
19496
617555579611
Refer to the toolbox modules by their official name (Carbon.AE), not the internal name (_AE). This can slow things down (once) but it's the only way I can get things to work on OSX, OS9 dynamically loaded and OS9 frozen.
Jack Jansen <jack.jansen@cwi.nl>
parents:
19442
diff
changeset
|
455 GLUE_NEW(Track, TrackObj_New, "Carbon.Qt") |
|
617555579611
Refer to the toolbox modules by their official name (Carbon.AE), not the internal name (_AE). This can slow things down (once) but it's the only way I can get things to work on OSX, OS9 dynamically loaded and OS9 frozen.
Jack Jansen <jack.jansen@cwi.nl>
parents:
19442
diff
changeset
|
456 GLUE_CONVERT(Track, TrackObj_Convert, "Carbon.Qt") |
|
617555579611
Refer to the toolbox modules by their official name (Carbon.AE), not the internal name (_AE). This can slow things down (once) but it's the only way I can get things to work on OSX, OS9 dynamically loaded and OS9 frozen.
Jack Jansen <jack.jansen@cwi.nl>
parents:
19442
diff
changeset
|
457 GLUE_NEW(Movie, MovieObj_New, "Carbon.Qt") |
|
617555579611
Refer to the toolbox modules by their official name (Carbon.AE), not the internal name (_AE). This can slow things down (once) but it's the only way I can get things to work on OSX, OS9 dynamically loaded and OS9 frozen.
Jack Jansen <jack.jansen@cwi.nl>
parents:
19442
diff
changeset
|
458 GLUE_CONVERT(Movie, MovieObj_Convert, "Carbon.Qt") |
|
617555579611
Refer to the toolbox modules by their official name (Carbon.AE), not the internal name (_AE). This can slow things down (once) but it's the only way I can get things to work on OSX, OS9 dynamically loaded and OS9 frozen.
Jack Jansen <jack.jansen@cwi.nl>
parents:
19442
diff
changeset
|
459 GLUE_NEW(MovieController, MovieCtlObj_New, "Carbon.Qt") |
|
617555579611
Refer to the toolbox modules by their official name (Carbon.AE), not the internal name (_AE). This can slow things down (once) but it's the only way I can get things to work on OSX, OS9 dynamically loaded and OS9 frozen.
Jack Jansen <jack.jansen@cwi.nl>
parents:
19442
diff
changeset
|
460 GLUE_CONVERT(MovieController, MovieCtlObj_Convert, "Carbon.Qt") |
|
617555579611
Refer to the toolbox modules by their official name (Carbon.AE), not the internal name (_AE). This can slow things down (once) but it's the only way I can get things to work on OSX, OS9 dynamically loaded and OS9 frozen.
Jack Jansen <jack.jansen@cwi.nl>
parents:
19442
diff
changeset
|
461 GLUE_NEW(TimeBase, TimeBaseObj_New, "Carbon.Qt") |
|
617555579611
Refer to the toolbox modules by their official name (Carbon.AE), not the internal name (_AE). This can slow things down (once) but it's the only way I can get things to work on OSX, OS9 dynamically loaded and OS9 frozen.
Jack Jansen <jack.jansen@cwi.nl>
parents:
19442
diff
changeset
|
462 GLUE_CONVERT(TimeBase, TimeBaseObj_Convert, "Carbon.Qt") |
|
617555579611
Refer to the toolbox modules by their official name (Carbon.AE), not the internal name (_AE). This can slow things down (once) but it's the only way I can get things to work on OSX, OS9 dynamically loaded and OS9 frozen.
Jack Jansen <jack.jansen@cwi.nl>
parents:
19442
diff
changeset
|
463 GLUE_NEW(UserData, UserDataObj_New, "Carbon.Qt") |
|
617555579611
Refer to the toolbox modules by their official name (Carbon.AE), not the internal name (_AE). This can slow things down (once) but it's the only way I can get things to work on OSX, OS9 dynamically loaded and OS9 frozen.
Jack Jansen <jack.jansen@cwi.nl>
parents:
19442
diff
changeset
|
464 GLUE_CONVERT(UserData, UserDataObj_Convert, "Carbon.Qt") |
|
617555579611
Refer to the toolbox modules by their official name (Carbon.AE), not the internal name (_AE). This can slow things down (once) but it's the only way I can get things to work on OSX, OS9 dynamically loaded and OS9 frozen.
Jack Jansen <jack.jansen@cwi.nl>
parents:
19442
diff
changeset
|
465 GLUE_NEW(Media, MediaObj_New, "Carbon.Qt") |
|
617555579611
Refer to the toolbox modules by their official name (Carbon.AE), not the internal name (_AE). This can slow things down (once) but it's the only way I can get things to work on OSX, OS9 dynamically loaded and OS9 frozen.
Jack Jansen <jack.jansen@cwi.nl>
parents:
19442
diff
changeset
|
466 GLUE_CONVERT(Media, MediaObj_Convert, "Carbon.Qt") |
|
19064
e57a4614469e
Split macglue.c into two: a new mactoolboxglue.c (in ./Python)
Jack Jansen <jack.jansen@cwi.nl>
parents:
diff
changeset
|
467 |
|
19496
617555579611
Refer to the toolbox modules by their official name (Carbon.AE), not the internal name (_AE). This can slow things down (once) but it's the only way I can get things to work on OSX, OS9 dynamically loaded and OS9 frozen.
Jack Jansen <jack.jansen@cwi.nl>
parents:
19442
diff
changeset
|
468 GLUE_NEW(Handle, ResObj_New, "Carbon.Res") |
|
617555579611
Refer to the toolbox modules by their official name (Carbon.AE), not the internal name (_AE). This can slow things down (once) but it's the only way I can get things to work on OSX, OS9 dynamically loaded and OS9 frozen.
Jack Jansen <jack.jansen@cwi.nl>
parents:
19442
diff
changeset
|
469 GLUE_CONVERT(Handle, ResObj_Convert, "Carbon.Res") |
|
617555579611
Refer to the toolbox modules by their official name (Carbon.AE), not the internal name (_AE). This can slow things down (once) but it's the only way I can get things to work on OSX, OS9 dynamically loaded and OS9 frozen.
Jack Jansen <jack.jansen@cwi.nl>
parents:
19442
diff
changeset
|
470 GLUE_NEW(Handle, OptResObj_New, "Carbon.Res") |
|
617555579611
Refer to the toolbox modules by their official name (Carbon.AE), not the internal name (_AE). This can slow things down (once) but it's the only way I can get things to work on OSX, OS9 dynamically loaded and OS9 frozen.
Jack Jansen <jack.jansen@cwi.nl>
parents:
19442
diff
changeset
|
471 GLUE_CONVERT(Handle, OptResObj_Convert, "Carbon.Res") |
|
19064
e57a4614469e
Split macglue.c into two: a new mactoolboxglue.c (in ./Python)
Jack Jansen <jack.jansen@cwi.nl>
parents:
diff
changeset
|
472 |
|
19496
617555579611
Refer to the toolbox modules by their official name (Carbon.AE), not the internal name (_AE). This can slow things down (once) but it's the only way I can get things to work on OSX, OS9 dynamically loaded and OS9 frozen.
Jack Jansen <jack.jansen@cwi.nl>
parents:
19442
diff
changeset
|
473 GLUE_NEW(TEHandle, TEObj_New, "Carbon.TE") |
|
617555579611
Refer to the toolbox modules by their official name (Carbon.AE), not the internal name (_AE). This can slow things down (once) but it's the only way I can get things to work on OSX, OS9 dynamically loaded and OS9 frozen.
Jack Jansen <jack.jansen@cwi.nl>
parents:
19442
diff
changeset
|
474 GLUE_CONVERT(TEHandle, TEObj_Convert, "Carbon.TE") |
|
19064
e57a4614469e
Split macglue.c into two: a new mactoolboxglue.c (in ./Python)
Jack Jansen <jack.jansen@cwi.nl>
parents:
diff
changeset
|
475 |
|
19496
617555579611
Refer to the toolbox modules by their official name (Carbon.AE), not the internal name (_AE). This can slow things down (once) but it's the only way I can get things to work on OSX, OS9 dynamically loaded and OS9 frozen.
Jack Jansen <jack.jansen@cwi.nl>
parents:
19442
diff
changeset
|
476 GLUE_NEW(WindowPtr, WinObj_New, "Carbon.Win") |
|
617555579611
Refer to the toolbox modules by their official name (Carbon.AE), not the internal name (_AE). This can slow things down (once) but it's the only way I can get things to work on OSX, OS9 dynamically loaded and OS9 frozen.
Jack Jansen <jack.jansen@cwi.nl>
parents:
19442
diff
changeset
|
477 GLUE_CONVERT(WindowPtr, WinObj_Convert, "Carbon.Win") |
|
617555579611
Refer to the toolbox modules by their official name (Carbon.AE), not the internal name (_AE). This can slow things down (once) but it's the only way I can get things to work on OSX, OS9 dynamically loaded and OS9 frozen.
Jack Jansen <jack.jansen@cwi.nl>
parents:
19442
diff
changeset
|
478 GLUE_NEW(WindowPtr, WinObj_WhichWindow, "Carbon.Win") |
|
19064
e57a4614469e
Split macglue.c into two: a new mactoolboxglue.c (in ./Python)
Jack Jansen <jack.jansen@cwi.nl>
parents:
diff
changeset
|
479 |
|
29279
b372b903d10e
Added functions CFObj_New and CFObj_Convert, general functions to convert
Jack Jansen <jack.jansen@cwi.nl>
parents:
28655
diff
changeset
|
480 GLUE_CONVERT(CFTypeRef, CFObj_Convert, "Carbon.CF") |
|
b372b903d10e
Added functions CFObj_New and CFObj_Convert, general functions to convert
Jack Jansen <jack.jansen@cwi.nl>
parents:
28655
diff
changeset
|
481 GLUE_NEW(CFTypeRef, CFObj_New, "Carbon.CF") |
|
b372b903d10e
Added functions CFObj_New and CFObj_Convert, general functions to convert
Jack Jansen <jack.jansen@cwi.nl>
parents:
28655
diff
changeset
|
482 |
|
20877
d54e294484b2
Make the CoreFoundation object _New and _Convert routines available to other modules. Idea by Donovan Preston, implementaion by me.
Jack Jansen <jack.jansen@cwi.nl>
parents:
20789
diff
changeset
|
483 GLUE_CONVERT(CFTypeRef, CFTypeRefObj_Convert, "Carbon.CF") |
|
d54e294484b2
Make the CoreFoundation object _New and _Convert routines available to other modules. Idea by Donovan Preston, implementaion by me.
Jack Jansen <jack.jansen@cwi.nl>
parents:
20789
diff
changeset
|
484 GLUE_NEW(CFTypeRef, CFTypeRefObj_New, "Carbon.CF") |
|
d54e294484b2
Make the CoreFoundation object _New and _Convert routines available to other modules. Idea by Donovan Preston, implementaion by me.
Jack Jansen <jack.jansen@cwi.nl>
parents:
20789
diff
changeset
|
485 |
|
d54e294484b2
Make the CoreFoundation object _New and _Convert routines available to other modules. Idea by Donovan Preston, implementaion by me.
Jack Jansen <jack.jansen@cwi.nl>
parents:
20789
diff
changeset
|
486 GLUE_CONVERT(CFStringRef, CFStringRefObj_Convert, "Carbon.CF") |
|
d54e294484b2
Make the CoreFoundation object _New and _Convert routines available to other modules. Idea by Donovan Preston, implementaion by me.
Jack Jansen <jack.jansen@cwi.nl>
parents:
20789
diff
changeset
|
487 GLUE_NEW(CFStringRef, CFStringRefObj_New, "Carbon.CF") |
|
d54e294484b2
Make the CoreFoundation object _New and _Convert routines available to other modules. Idea by Donovan Preston, implementaion by me.
Jack Jansen <jack.jansen@cwi.nl>
parents:
20789
diff
changeset
|
488 GLUE_CONVERT(CFMutableStringRef, CFMutableStringRefObj_Convert, "Carbon.CF") |
|
d54e294484b2
Make the CoreFoundation object _New and _Convert routines available to other modules. Idea by Donovan Preston, implementaion by me.
Jack Jansen <jack.jansen@cwi.nl>
parents:
20789
diff
changeset
|
489 GLUE_NEW(CFMutableStringRef, CFMutableStringRefObj_New, "Carbon.CF") |
|
d54e294484b2
Make the CoreFoundation object _New and _Convert routines available to other modules. Idea by Donovan Preston, implementaion by me.
Jack Jansen <jack.jansen@cwi.nl>
parents:
20789
diff
changeset
|
490 |
|
d54e294484b2
Make the CoreFoundation object _New and _Convert routines available to other modules. Idea by Donovan Preston, implementaion by me.
Jack Jansen <jack.jansen@cwi.nl>
parents:
20789
diff
changeset
|
491 GLUE_CONVERT(CFArrayRef, CFArrayRefObj_Convert, "Carbon.CF") |
|
d54e294484b2
Make the CoreFoundation object _New and _Convert routines available to other modules. Idea by Donovan Preston, implementaion by me.
Jack Jansen <jack.jansen@cwi.nl>
parents:
20789
diff
changeset
|
492 GLUE_NEW(CFArrayRef, CFArrayRefObj_New, "Carbon.CF") |
|
d54e294484b2
Make the CoreFoundation object _New and _Convert routines available to other modules. Idea by Donovan Preston, implementaion by me.
Jack Jansen <jack.jansen@cwi.nl>
parents:
20789
diff
changeset
|
493 GLUE_CONVERT(CFMutableArrayRef, CFMutableArrayRefObj_Convert, "Carbon.CF") |
|
d54e294484b2
Make the CoreFoundation object _New and _Convert routines available to other modules. Idea by Donovan Preston, implementaion by me.
Jack Jansen <jack.jansen@cwi.nl>
parents:
20789
diff
changeset
|
494 GLUE_NEW(CFMutableArrayRef, CFMutableArrayRefObj_New, "Carbon.CF") |
|
d54e294484b2
Make the CoreFoundation object _New and _Convert routines available to other modules. Idea by Donovan Preston, implementaion by me.
Jack Jansen <jack.jansen@cwi.nl>
parents:
20789
diff
changeset
|
495 |
|
d54e294484b2
Make the CoreFoundation object _New and _Convert routines available to other modules. Idea by Donovan Preston, implementaion by me.
Jack Jansen <jack.jansen@cwi.nl>
parents:
20789
diff
changeset
|
496 GLUE_CONVERT(CFDictionaryRef, CFDictionaryRefObj_Convert, "Carbon.CF") |
|
d54e294484b2
Make the CoreFoundation object _New and _Convert routines available to other modules. Idea by Donovan Preston, implementaion by me.
Jack Jansen <jack.jansen@cwi.nl>
parents:
20789
diff
changeset
|
497 GLUE_NEW(CFDictionaryRef, CFDictionaryRefObj_New, "Carbon.CF") |
|
d54e294484b2
Make the CoreFoundation object _New and _Convert routines available to other modules. Idea by Donovan Preston, implementaion by me.
Jack Jansen <jack.jansen@cwi.nl>
parents:
20789
diff
changeset
|
498 GLUE_CONVERT(CFMutableDictionaryRef, CFMutableDictionaryRefObj_Convert, "Carbon.CF") |
|
d54e294484b2
Make the CoreFoundation object _New and _Convert routines available to other modules. Idea by Donovan Preston, implementaion by me.
Jack Jansen <jack.jansen@cwi.nl>
parents:
20789
diff
changeset
|
499 GLUE_NEW(CFMutableDictionaryRef, CFMutableDictionaryRefObj_New, "Carbon.CF") |
|
d54e294484b2
Make the CoreFoundation object _New and _Convert routines available to other modules. Idea by Donovan Preston, implementaion by me.
Jack Jansen <jack.jansen@cwi.nl>
parents:
20789
diff
changeset
|
500 |
|
d54e294484b2
Make the CoreFoundation object _New and _Convert routines available to other modules. Idea by Donovan Preston, implementaion by me.
Jack Jansen <jack.jansen@cwi.nl>
parents:
20789
diff
changeset
|
501 GLUE_CONVERT(CFURLRef, CFURLRefObj_Convert, "Carbon.CF") |
|
d54e294484b2
Make the CoreFoundation object _New and _Convert routines available to other modules. Idea by Donovan Preston, implementaion by me.
Jack Jansen <jack.jansen@cwi.nl>
parents:
20789
diff
changeset
|
502 GLUE_CONVERT(CFURLRef, OptionalCFURLRefObj_Convert, "Carbon.CF") |
|
d54e294484b2
Make the CoreFoundation object _New and _Convert routines available to other modules. Idea by Donovan Preston, implementaion by me.
Jack Jansen <jack.jansen@cwi.nl>
parents:
20789
diff
changeset
|
503 GLUE_NEW(CFURLRef, CFURLRefObj_New, "Carbon.CF") |
|
d54e294484b2
Make the CoreFoundation object _New and _Convert routines available to other modules. Idea by Donovan Preston, implementaion by me.
Jack Jansen <jack.jansen@cwi.nl>
parents:
20789
diff
changeset
|
504 |
| 26134 | 505 #endif /* USE_TOOLBOX_OBJECT_GLUE */ |
