Mercurial > cpython-lru_cache-weakref
annotate Python/mactoolboxglue.c @ 25135:0f0016632be4 legacy-trunk
_formatparam(), set_param(): RFC 2231 encoding support by Oleg
Broytmann in SF patch #600096. Specifically, the former function now
encodes the triplets, while the latter adds optional charset and
language arguments.
| author | Barry Warsaw <barry@python.org> |
|---|---|
| date | Fri, 06 Sep 2002 03:55:04 +0000 |
| parents | 03d85d197052 |
| children | 2b158267b00e |
| 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" |
|
e57a4614469e
Split macglue.c into two: a new mactoolboxglue.c (in ./Python)
Jack Jansen <jack.jansen@cwi.nl>
parents:
diff
changeset
|
28 |
|
e57a4614469e
Split macglue.c into two: a new mactoolboxglue.c (in ./Python)
Jack Jansen <jack.jansen@cwi.nl>
parents:
diff
changeset
|
29 #ifdef WITHOUT_FRAMEWORKS |
|
19068
d00802c74ba4
Got rid of unused includes.
Jack Jansen <jack.jansen@cwi.nl>
parents:
19064
diff
changeset
|
30 #include <Script.h> |
|
d00802c74ba4
Got rid of unused includes.
Jack Jansen <jack.jansen@cwi.nl>
parents:
19064
diff
changeset
|
31 #include <Resources.h> |
|
19064
e57a4614469e
Split macglue.c into two: a new mactoolboxglue.c (in ./Python)
Jack Jansen <jack.jansen@cwi.nl>
parents:
diff
changeset
|
32 #endif |
|
e57a4614469e
Split macglue.c into two: a new mactoolboxglue.c (in ./Python)
Jack Jansen <jack.jansen@cwi.nl>
parents:
diff
changeset
|
33 |
|
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 ** Find out what the current script is. |
|
e57a4614469e
Split macglue.c into two: a new mactoolboxglue.c (in ./Python)
Jack Jansen <jack.jansen@cwi.nl>
parents:
diff
changeset
|
36 ** Donated by Fredrik Lund. |
|
e57a4614469e
Split macglue.c into two: a new mactoolboxglue.c (in ./Python)
Jack Jansen <jack.jansen@cwi.nl>
parents:
diff
changeset
|
37 */ |
|
e57a4614469e
Split macglue.c into two: a new mactoolboxglue.c (in ./Python)
Jack Jansen <jack.jansen@cwi.nl>
parents:
diff
changeset
|
38 char *PyMac_getscript() |
|
e57a4614469e
Split macglue.c into two: a new mactoolboxglue.c (in ./Python)
Jack Jansen <jack.jansen@cwi.nl>
parents:
diff
changeset
|
39 { |
|
20789
961b24f8e1d8
Link the core with CoreServices, not with Carbon, and don't use any Carbon
Jack Jansen <jack.jansen@cwi.nl>
parents:
19841
diff
changeset
|
40 #if TARGET_API_MAC_OSX |
|
961b24f8e1d8
Link the core with CoreServices, not with Carbon, and don't use any Carbon
Jack Jansen <jack.jansen@cwi.nl>
parents:
19841
diff
changeset
|
41 /* We cannot use GetSysFont because it requires the window manager |
|
961b24f8e1d8
Link the core with CoreServices, not with Carbon, and don't use any Carbon
Jack Jansen <jack.jansen@cwi.nl>
parents:
19841
diff
changeset
|
42 ** There are other APIs to query the default 8 bit encoding, but |
|
961b24f8e1d8
Link the core with CoreServices, not with Carbon, and don't use any Carbon
Jack Jansen <jack.jansen@cwi.nl>
parents:
19841
diff
changeset
|
43 ** I don't know about them (yet). |
|
961b24f8e1d8
Link the core with CoreServices, not with Carbon, and don't use any Carbon
Jack Jansen <jack.jansen@cwi.nl>
parents:
19841
diff
changeset
|
44 */ |
|
961b24f8e1d8
Link the core with CoreServices, not with Carbon, and don't use any Carbon
Jack Jansen <jack.jansen@cwi.nl>
parents:
19841
diff
changeset
|
45 return "ascii"; |
|
961b24f8e1d8
Link the core with CoreServices, not with Carbon, and don't use any Carbon
Jack Jansen <jack.jansen@cwi.nl>
parents:
19841
diff
changeset
|
46 #else |
|
19064
e57a4614469e
Split macglue.c into two: a new mactoolboxglue.c (in ./Python)
Jack Jansen <jack.jansen@cwi.nl>
parents:
diff
changeset
|
47 int font, script, lang; |
|
e57a4614469e
Split macglue.c into two: a new mactoolboxglue.c (in ./Python)
Jack Jansen <jack.jansen@cwi.nl>
parents:
diff
changeset
|
48 font = 0; |
|
e57a4614469e
Split macglue.c into two: a new mactoolboxglue.c (in ./Python)
Jack Jansen <jack.jansen@cwi.nl>
parents:
diff
changeset
|
49 font = GetSysFont(); |
|
e57a4614469e
Split macglue.c into two: a new mactoolboxglue.c (in ./Python)
Jack Jansen <jack.jansen@cwi.nl>
parents:
diff
changeset
|
50 script = FontToScript(font); |
|
e57a4614469e
Split macglue.c into two: a new mactoolboxglue.c (in ./Python)
Jack Jansen <jack.jansen@cwi.nl>
parents:
diff
changeset
|
51 switch (script) { |
|
e57a4614469e
Split macglue.c into two: a new mactoolboxglue.c (in ./Python)
Jack Jansen <jack.jansen@cwi.nl>
parents:
diff
changeset
|
52 case smRoman: |
|
e57a4614469e
Split macglue.c into two: a new mactoolboxglue.c (in ./Python)
Jack Jansen <jack.jansen@cwi.nl>
parents:
diff
changeset
|
53 lang = GetScriptVariable(script, smScriptLang); |
|
e57a4614469e
Split macglue.c into two: a new mactoolboxglue.c (in ./Python)
Jack Jansen <jack.jansen@cwi.nl>
parents:
diff
changeset
|
54 if (lang == langIcelandic) |
|
e57a4614469e
Split macglue.c into two: a new mactoolboxglue.c (in ./Python)
Jack Jansen <jack.jansen@cwi.nl>
parents:
diff
changeset
|
55 return "mac-iceland"; |
|
e57a4614469e
Split macglue.c into two: a new mactoolboxglue.c (in ./Python)
Jack Jansen <jack.jansen@cwi.nl>
parents:
diff
changeset
|
56 else if (lang == langTurkish) |
|
e57a4614469e
Split macglue.c into two: a new mactoolboxglue.c (in ./Python)
Jack Jansen <jack.jansen@cwi.nl>
parents:
diff
changeset
|
57 return "mac-turkish"; |
|
e57a4614469e
Split macglue.c into two: a new mactoolboxglue.c (in ./Python)
Jack Jansen <jack.jansen@cwi.nl>
parents:
diff
changeset
|
58 else if (lang == langGreek) |
|
e57a4614469e
Split macglue.c into two: a new mactoolboxglue.c (in ./Python)
Jack Jansen <jack.jansen@cwi.nl>
parents:
diff
changeset
|
59 return "mac-greek"; |
|
e57a4614469e
Split macglue.c into two: a new mactoolboxglue.c (in ./Python)
Jack Jansen <jack.jansen@cwi.nl>
parents:
diff
changeset
|
60 else |
|
e57a4614469e
Split macglue.c into two: a new mactoolboxglue.c (in ./Python)
Jack Jansen <jack.jansen@cwi.nl>
parents:
diff
changeset
|
61 return "mac-roman"; |
|
e57a4614469e
Split macglue.c into two: a new mactoolboxglue.c (in ./Python)
Jack Jansen <jack.jansen@cwi.nl>
parents:
diff
changeset
|
62 break; |
|
e57a4614469e
Split macglue.c into two: a new mactoolboxglue.c (in ./Python)
Jack Jansen <jack.jansen@cwi.nl>
parents:
diff
changeset
|
63 #if 0 |
|
e57a4614469e
Split macglue.c into two: a new mactoolboxglue.c (in ./Python)
Jack Jansen <jack.jansen@cwi.nl>
parents:
diff
changeset
|
64 /* We don't have a codec for this, so don't return it */ |
|
e57a4614469e
Split macglue.c into two: a new mactoolboxglue.c (in ./Python)
Jack Jansen <jack.jansen@cwi.nl>
parents:
diff
changeset
|
65 case smJapanese: |
|
e57a4614469e
Split macglue.c into two: a new mactoolboxglue.c (in ./Python)
Jack Jansen <jack.jansen@cwi.nl>
parents:
diff
changeset
|
66 return "mac-japan"; |
|
e57a4614469e
Split macglue.c into two: a new mactoolboxglue.c (in ./Python)
Jack Jansen <jack.jansen@cwi.nl>
parents:
diff
changeset
|
67 #endif |
|
e57a4614469e
Split macglue.c into two: a new mactoolboxglue.c (in ./Python)
Jack Jansen <jack.jansen@cwi.nl>
parents:
diff
changeset
|
68 case smGreek: |
|
e57a4614469e
Split macglue.c into two: a new mactoolboxglue.c (in ./Python)
Jack Jansen <jack.jansen@cwi.nl>
parents:
diff
changeset
|
69 return "mac-greek"; |
|
e57a4614469e
Split macglue.c into two: a new mactoolboxglue.c (in ./Python)
Jack Jansen <jack.jansen@cwi.nl>
parents:
diff
changeset
|
70 case smCyrillic: |
|
e57a4614469e
Split macglue.c into two: a new mactoolboxglue.c (in ./Python)
Jack Jansen <jack.jansen@cwi.nl>
parents:
diff
changeset
|
71 return "mac-cyrillic"; |
|
e57a4614469e
Split macglue.c into two: a new mactoolboxglue.c (in ./Python)
Jack Jansen <jack.jansen@cwi.nl>
parents:
diff
changeset
|
72 default: |
|
e57a4614469e
Split macglue.c into two: a new mactoolboxglue.c (in ./Python)
Jack Jansen <jack.jansen@cwi.nl>
parents:
diff
changeset
|
73 return "ascii"; /* better than nothing */ |
|
e57a4614469e
Split macglue.c into two: a new mactoolboxglue.c (in ./Python)
Jack Jansen <jack.jansen@cwi.nl>
parents:
diff
changeset
|
74 } |
|
20789
961b24f8e1d8
Link the core with CoreServices, not with Carbon, and don't use any Carbon
Jack Jansen <jack.jansen@cwi.nl>
parents:
19841
diff
changeset
|
75 #endif /* TARGET_API_MAC_OSX */ |
|
19064
e57a4614469e
Split macglue.c into two: a new mactoolboxglue.c (in ./Python)
Jack Jansen <jack.jansen@cwi.nl>
parents:
diff
changeset
|
76 } |
|
e57a4614469e
Split macglue.c into two: a new mactoolboxglue.c (in ./Python)
Jack Jansen <jack.jansen@cwi.nl>
parents:
diff
changeset
|
77 |
|
e57a4614469e
Split macglue.c into two: a new mactoolboxglue.c (in ./Python)
Jack Jansen <jack.jansen@cwi.nl>
parents:
diff
changeset
|
78 /* Like strerror() but for Mac OS error numbers */ |
|
e57a4614469e
Split macglue.c into two: a new mactoolboxglue.c (in ./Python)
Jack Jansen <jack.jansen@cwi.nl>
parents:
diff
changeset
|
79 char *PyMac_StrError(int err) |
|
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 static char buf[256]; |
|
e57a4614469e
Split macglue.c into two: a new mactoolboxglue.c (in ./Python)
Jack Jansen <jack.jansen@cwi.nl>
parents:
diff
changeset
|
82 Handle h; |
|
e57a4614469e
Split macglue.c into two: a new mactoolboxglue.c (in ./Python)
Jack Jansen <jack.jansen@cwi.nl>
parents:
diff
changeset
|
83 char *str; |
|
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 h = GetResource('Estr', err); |
|
e57a4614469e
Split macglue.c into two: a new mactoolboxglue.c (in ./Python)
Jack Jansen <jack.jansen@cwi.nl>
parents:
diff
changeset
|
86 if ( h ) { |
|
e57a4614469e
Split macglue.c into two: a new mactoolboxglue.c (in ./Python)
Jack Jansen <jack.jansen@cwi.nl>
parents:
diff
changeset
|
87 HLock(h); |
|
e57a4614469e
Split macglue.c into two: a new mactoolboxglue.c (in ./Python)
Jack Jansen <jack.jansen@cwi.nl>
parents:
diff
changeset
|
88 str = (char *)*h; |
|
e57a4614469e
Split macglue.c into two: a new mactoolboxglue.c (in ./Python)
Jack Jansen <jack.jansen@cwi.nl>
parents:
diff
changeset
|
89 memcpy(buf, str+1, (unsigned char)str[0]); |
|
e57a4614469e
Split macglue.c into two: a new mactoolboxglue.c (in ./Python)
Jack Jansen <jack.jansen@cwi.nl>
parents:
diff
changeset
|
90 buf[(unsigned char)str[0]] = '\0'; |
|
e57a4614469e
Split macglue.c into two: a new mactoolboxglue.c (in ./Python)
Jack Jansen <jack.jansen@cwi.nl>
parents:
diff
changeset
|
91 HUnlock(h); |
|
e57a4614469e
Split macglue.c into two: a new mactoolboxglue.c (in ./Python)
Jack Jansen <jack.jansen@cwi.nl>
parents:
diff
changeset
|
92 ReleaseResource(h); |
|
e57a4614469e
Split macglue.c into two: a new mactoolboxglue.c (in ./Python)
Jack Jansen <jack.jansen@cwi.nl>
parents:
diff
changeset
|
93 } else { |
|
21178
bc51de643b5e
More sprintf -> PyOS_snprintf.
Tim Peters <tim.peters@gmail.com>
parents:
20877
diff
changeset
|
94 PyOS_snprintf(buf, sizeof(buf), "Mac OS error code %d", err); |
|
19064
e57a4614469e
Split macglue.c into two: a new mactoolboxglue.c (in ./Python)
Jack Jansen <jack.jansen@cwi.nl>
parents:
diff
changeset
|
95 } |
|
e57a4614469e
Split macglue.c into two: a new mactoolboxglue.c (in ./Python)
Jack Jansen <jack.jansen@cwi.nl>
parents:
diff
changeset
|
96 return buf; |
|
e57a4614469e
Split macglue.c into two: a new mactoolboxglue.c (in ./Python)
Jack Jansen <jack.jansen@cwi.nl>
parents:
diff
changeset
|
97 } |
|
e57a4614469e
Split macglue.c into two: a new mactoolboxglue.c (in ./Python)
Jack Jansen <jack.jansen@cwi.nl>
parents:
diff
changeset
|
98 |
|
e57a4614469e
Split macglue.c into two: a new mactoolboxglue.c (in ./Python)
Jack Jansen <jack.jansen@cwi.nl>
parents:
diff
changeset
|
99 /* 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
|
100 PyObject *PyMac_OSErrException; |
|
e57a4614469e
Split macglue.c into two: a new mactoolboxglue.c (in ./Python)
Jack Jansen <jack.jansen@cwi.nl>
parents:
diff
changeset
|
101 |
|
e57a4614469e
Split macglue.c into two: a new mactoolboxglue.c (in ./Python)
Jack Jansen <jack.jansen@cwi.nl>
parents:
diff
changeset
|
102 /* 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
|
103 PyObject * |
|
19841
d8dd75e3b304
Replaced PyMac_FullPath by PyMac_FullPathname, which has an extra 'length'
Jack Jansen <jack.jansen@cwi.nl>
parents:
19645
diff
changeset
|
104 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
|
105 { |
|
e57a4614469e
Split macglue.c into two: a new mactoolboxglue.c (in ./Python)
Jack Jansen <jack.jansen@cwi.nl>
parents:
diff
changeset
|
106 if (PyMac_OSErrException == NULL) |
|
e57a4614469e
Split macglue.c into two: a new mactoolboxglue.c (in ./Python)
Jack Jansen <jack.jansen@cwi.nl>
parents:
diff
changeset
|
107 PyMac_OSErrException = PyString_FromString("MacOS.Error"); |
|
e57a4614469e
Split macglue.c into two: a new mactoolboxglue.c (in ./Python)
Jack Jansen <jack.jansen@cwi.nl>
parents:
diff
changeset
|
108 return PyMac_OSErrException; |
|
e57a4614469e
Split macglue.c into two: a new mactoolboxglue.c (in ./Python)
Jack Jansen <jack.jansen@cwi.nl>
parents:
diff
changeset
|
109 } |
|
e57a4614469e
Split macglue.c into two: a new mactoolboxglue.c (in ./Python)
Jack Jansen <jack.jansen@cwi.nl>
parents:
diff
changeset
|
110 |
|
e57a4614469e
Split macglue.c into two: a new mactoolboxglue.c (in ./Python)
Jack Jansen <jack.jansen@cwi.nl>
parents:
diff
changeset
|
111 /* 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
|
112 PyObject * |
|
e57a4614469e
Split macglue.c into two: a new mactoolboxglue.c (in ./Python)
Jack Jansen <jack.jansen@cwi.nl>
parents:
diff
changeset
|
113 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
|
114 { |
|
e57a4614469e
Split macglue.c into two: a new mactoolboxglue.c (in ./Python)
Jack Jansen <jack.jansen@cwi.nl>
parents:
diff
changeset
|
115 char *msg; |
|
e57a4614469e
Split macglue.c into two: a new mactoolboxglue.c (in ./Python)
Jack Jansen <jack.jansen@cwi.nl>
parents:
diff
changeset
|
116 PyObject *v; |
|
e57a4614469e
Split macglue.c into two: a new mactoolboxglue.c (in ./Python)
Jack Jansen <jack.jansen@cwi.nl>
parents:
diff
changeset
|
117 |
|
e57a4614469e
Split macglue.c into two: a new mactoolboxglue.c (in ./Python)
Jack Jansen <jack.jansen@cwi.nl>
parents:
diff
changeset
|
118 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
|
119 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
|
120 return Py_None; |
|
e57a4614469e
Split macglue.c into two: a new mactoolboxglue.c (in ./Python)
Jack Jansen <jack.jansen@cwi.nl>
parents:
diff
changeset
|
121 } |
|
e57a4614469e
Split macglue.c into two: a new mactoolboxglue.c (in ./Python)
Jack Jansen <jack.jansen@cwi.nl>
parents:
diff
changeset
|
122 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
|
123 return NULL; |
|
e57a4614469e
Split macglue.c into two: a new mactoolboxglue.c (in ./Python)
Jack Jansen <jack.jansen@cwi.nl>
parents:
diff
changeset
|
124 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
|
125 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
|
126 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
|
127 Py_DECREF(v); |
|
e57a4614469e
Split macglue.c into two: a new mactoolboxglue.c (in ./Python)
Jack Jansen <jack.jansen@cwi.nl>
parents:
diff
changeset
|
128 return NULL; |
|
e57a4614469e
Split macglue.c into two: a new mactoolboxglue.c (in ./Python)
Jack Jansen <jack.jansen@cwi.nl>
parents:
diff
changeset
|
129 } |
|
e57a4614469e
Split macglue.c into two: a new mactoolboxglue.c (in ./Python)
Jack Jansen <jack.jansen@cwi.nl>
parents:
diff
changeset
|
130 |
|
e57a4614469e
Split macglue.c into two: a new mactoolboxglue.c (in ./Python)
Jack Jansen <jack.jansen@cwi.nl>
parents:
diff
changeset
|
131 /* 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
|
132 PyObject * |
|
e57a4614469e
Split macglue.c into two: a new mactoolboxglue.c (in ./Python)
Jack Jansen <jack.jansen@cwi.nl>
parents:
diff
changeset
|
133 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
|
134 { |
|
e57a4614469e
Split macglue.c into two: a new mactoolboxglue.c (in ./Python)
Jack Jansen <jack.jansen@cwi.nl>
parents:
diff
changeset
|
135 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
|
136 } |
|
e57a4614469e
Split macglue.c into two: a new mactoolboxglue.c (in ./Python)
Jack Jansen <jack.jansen@cwi.nl>
parents:
diff
changeset
|
137 |
|
19841
d8dd75e3b304
Replaced PyMac_FullPath by PyMac_FullPathname, which has an extra 'length'
Jack Jansen <jack.jansen@cwi.nl>
parents:
19645
diff
changeset
|
138 |
|
d8dd75e3b304
Replaced PyMac_FullPath by PyMac_FullPathname, which has an extra 'length'
Jack Jansen <jack.jansen@cwi.nl>
parents:
19645
diff
changeset
|
139 #if TARGET_API_MAC_OSX |
|
d8dd75e3b304
Replaced PyMac_FullPath by PyMac_FullPathname, which has an extra 'length'
Jack Jansen <jack.jansen@cwi.nl>
parents:
19645
diff
changeset
|
140 OSErr |
|
d8dd75e3b304
Replaced PyMac_FullPath by PyMac_FullPathname, which has an extra 'length'
Jack Jansen <jack.jansen@cwi.nl>
parents:
19645
diff
changeset
|
141 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
|
142 { |
|
d8dd75e3b304
Replaced PyMac_FullPath by PyMac_FullPathname, which has an extra 'length'
Jack Jansen <jack.jansen@cwi.nl>
parents:
19645
diff
changeset
|
143 FSRef fsr; |
|
d8dd75e3b304
Replaced PyMac_FullPath by PyMac_FullPathname, which has an extra 'length'
Jack Jansen <jack.jansen@cwi.nl>
parents:
19645
diff
changeset
|
144 OSErr err; |
|
d8dd75e3b304
Replaced PyMac_FullPath by PyMac_FullPathname, which has an extra 'length'
Jack Jansen <jack.jansen@cwi.nl>
parents:
19645
diff
changeset
|
145 |
|
d8dd75e3b304
Replaced PyMac_FullPath by PyMac_FullPathname, which has an extra 'length'
Jack Jansen <jack.jansen@cwi.nl>
parents:
19645
diff
changeset
|
146 *path = '\0'; |
|
d8dd75e3b304
Replaced PyMac_FullPath by PyMac_FullPathname, which has an extra 'length'
Jack Jansen <jack.jansen@cwi.nl>
parents:
19645
diff
changeset
|
147 err = FSpMakeFSRef(fss, &fsr); |
|
d8dd75e3b304
Replaced PyMac_FullPath by PyMac_FullPathname, which has an extra 'length'
Jack Jansen <jack.jansen@cwi.nl>
parents:
19645
diff
changeset
|
148 if ( err == fnfErr ) { |
|
d8dd75e3b304
Replaced PyMac_FullPath by PyMac_FullPathname, which has an extra 'length'
Jack Jansen <jack.jansen@cwi.nl>
parents:
19645
diff
changeset
|
149 /* FSSpecs can point to non-existing files, fsrefs can't. */ |
|
d8dd75e3b304
Replaced PyMac_FullPath by PyMac_FullPathname, which has an extra 'length'
Jack Jansen <jack.jansen@cwi.nl>
parents:
19645
diff
changeset
|
150 FSSpec fss2; |
|
d8dd75e3b304
Replaced PyMac_FullPath by PyMac_FullPathname, which has an extra 'length'
Jack Jansen <jack.jansen@cwi.nl>
parents:
19645
diff
changeset
|
151 int tocopy; |
|
d8dd75e3b304
Replaced PyMac_FullPath by PyMac_FullPathname, which has an extra 'length'
Jack Jansen <jack.jansen@cwi.nl>
parents:
19645
diff
changeset
|
152 |
|
d8dd75e3b304
Replaced PyMac_FullPath by PyMac_FullPathname, which has an extra 'length'
Jack Jansen <jack.jansen@cwi.nl>
parents:
19645
diff
changeset
|
153 err = FSMakeFSSpec(fss->vRefNum, fss->parID, "", &fss2); |
|
d8dd75e3b304
Replaced PyMac_FullPath by PyMac_FullPathname, which has an extra 'length'
Jack Jansen <jack.jansen@cwi.nl>
parents:
19645
diff
changeset
|
154 if ( err ) return err; |
|
d8dd75e3b304
Replaced PyMac_FullPath by PyMac_FullPathname, which has an extra 'length'
Jack Jansen <jack.jansen@cwi.nl>
parents:
19645
diff
changeset
|
155 err = FSpMakeFSRef(&fss2, &fsr); |
|
d8dd75e3b304
Replaced PyMac_FullPath by PyMac_FullPathname, which has an extra 'length'
Jack Jansen <jack.jansen@cwi.nl>
parents:
19645
diff
changeset
|
156 if ( err ) return err; |
|
d8dd75e3b304
Replaced PyMac_FullPath by PyMac_FullPathname, which has an extra 'length'
Jack Jansen <jack.jansen@cwi.nl>
parents:
19645
diff
changeset
|
157 err = (OSErr)FSRefMakePath(&fsr, path, len-1); |
|
d8dd75e3b304
Replaced PyMac_FullPath by PyMac_FullPathname, which has an extra 'length'
Jack Jansen <jack.jansen@cwi.nl>
parents:
19645
diff
changeset
|
158 if ( err ) return err; |
|
d8dd75e3b304
Replaced PyMac_FullPath by PyMac_FullPathname, which has an extra 'length'
Jack Jansen <jack.jansen@cwi.nl>
parents:
19645
diff
changeset
|
159 /* This part is not 100% safe: we append the filename part, but |
|
d8dd75e3b304
Replaced PyMac_FullPath by PyMac_FullPathname, which has an extra 'length'
Jack Jansen <jack.jansen@cwi.nl>
parents:
19645
diff
changeset
|
160 ** I'm not sure that we don't run afoul of the various 8bit |
|
d8dd75e3b304
Replaced PyMac_FullPath by PyMac_FullPathname, which has an extra 'length'
Jack Jansen <jack.jansen@cwi.nl>
parents:
19645
diff
changeset
|
161 ** encodings here. Will have to look this up at some point... |
|
d8dd75e3b304
Replaced PyMac_FullPath by PyMac_FullPathname, which has an extra 'length'
Jack Jansen <jack.jansen@cwi.nl>
parents:
19645
diff
changeset
|
162 */ |
|
d8dd75e3b304
Replaced PyMac_FullPath by PyMac_FullPathname, which has an extra 'length'
Jack Jansen <jack.jansen@cwi.nl>
parents:
19645
diff
changeset
|
163 strcat(path, "/"); |
|
d8dd75e3b304
Replaced PyMac_FullPath by PyMac_FullPathname, which has an extra 'length'
Jack Jansen <jack.jansen@cwi.nl>
parents:
19645
diff
changeset
|
164 tocopy = fss->name[0]; |
|
d8dd75e3b304
Replaced PyMac_FullPath by PyMac_FullPathname, which has an extra 'length'
Jack Jansen <jack.jansen@cwi.nl>
parents:
19645
diff
changeset
|
165 if ( strlen(path) + tocopy >= len ) |
|
d8dd75e3b304
Replaced PyMac_FullPath by PyMac_FullPathname, which has an extra 'length'
Jack Jansen <jack.jansen@cwi.nl>
parents:
19645
diff
changeset
|
166 tocopy = len - strlen(path) - 1; |
|
d8dd75e3b304
Replaced PyMac_FullPath by PyMac_FullPathname, which has an extra 'length'
Jack Jansen <jack.jansen@cwi.nl>
parents:
19645
diff
changeset
|
167 if ( tocopy > 0 ) |
|
d8dd75e3b304
Replaced PyMac_FullPath by PyMac_FullPathname, which has an extra 'length'
Jack Jansen <jack.jansen@cwi.nl>
parents:
19645
diff
changeset
|
168 strncat(path, fss->name+1, tocopy); |
|
d8dd75e3b304
Replaced PyMac_FullPath by PyMac_FullPathname, which has an extra 'length'
Jack Jansen <jack.jansen@cwi.nl>
parents:
19645
diff
changeset
|
169 } else { |
|
d8dd75e3b304
Replaced PyMac_FullPath by PyMac_FullPathname, which has an extra 'length'
Jack Jansen <jack.jansen@cwi.nl>
parents:
19645
diff
changeset
|
170 if ( err ) return err; |
|
d8dd75e3b304
Replaced PyMac_FullPath by PyMac_FullPathname, which has an extra 'length'
Jack Jansen <jack.jansen@cwi.nl>
parents:
19645
diff
changeset
|
171 err = (OSErr)FSRefMakePath(&fsr, path, len); |
|
d8dd75e3b304
Replaced PyMac_FullPath by PyMac_FullPathname, which has an extra 'length'
Jack Jansen <jack.jansen@cwi.nl>
parents:
19645
diff
changeset
|
172 if ( err ) return err; |
|
d8dd75e3b304
Replaced PyMac_FullPath by PyMac_FullPathname, which has an extra 'length'
Jack Jansen <jack.jansen@cwi.nl>
parents:
19645
diff
changeset
|
173 } |
|
d8dd75e3b304
Replaced PyMac_FullPath by PyMac_FullPathname, which has an extra 'length'
Jack Jansen <jack.jansen@cwi.nl>
parents:
19645
diff
changeset
|
174 return 0; |
|
d8dd75e3b304
Replaced PyMac_FullPath by PyMac_FullPathname, which has an extra 'length'
Jack Jansen <jack.jansen@cwi.nl>
parents:
19645
diff
changeset
|
175 } |
|
d8dd75e3b304
Replaced PyMac_FullPath by PyMac_FullPathname, which has an extra 'length'
Jack Jansen <jack.jansen@cwi.nl>
parents:
19645
diff
changeset
|
176 |
|
d8dd75e3b304
Replaced PyMac_FullPath by PyMac_FullPathname, which has an extra 'length'
Jack Jansen <jack.jansen@cwi.nl>
parents:
19645
diff
changeset
|
177 #endif /* TARGET_API_MAC_OSX */ |
|
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
|
178 |
|
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
|
179 #ifdef WITH_NEXT_FRAMEWORK |
|
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
|
180 /* |
|
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
|
181 ** In a bundle, find a file "resourceName" of type "resourceType". Return the |
|
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
|
182 ** full pathname in "resourceURLCstr". |
|
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
|
183 */ |
|
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
|
184 static int |
|
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
|
185 locateResourcePy(CFStringRef resourceType, CFStringRef resourceName, char *resourceURLCStr, int length) |
|
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
|
186 { |
|
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
|
187 CFBundleRef mainBundle = NULL; |
|
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
|
188 CFURLRef URL, absoluteURL; |
|
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
|
189 CFStringRef filenameString, filepathString; |
|
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
|
190 CFIndex size, i; |
|
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
|
191 CFArrayRef arrayRef = NULL; |
|
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
|
192 int success = 0; |
|
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
|
193 |
|
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
|
194 #if TARGET_API_MAC_OSX |
|
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
|
195 CFURLPathStyle thePathStyle = kCFURLPOSIXPathStyle; |
|
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
|
196 #else |
|
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
|
197 CFURLPathStyle thePathStyle = kCFURLHFSPathStyle; |
|
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
|
198 #endif |
|
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
|
199 |
|
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
|
200 /* Get a reference to our main bundle */ |
|
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
|
201 mainBundle = CFBundleGetMainBundle(); |
|
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
|
202 |
|
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
|
203 /* If we are running inside a bundle, look through it. Otherwise, do nothing. */ |
|
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
|
204 if (mainBundle) { |
|
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
|
205 |
|
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
|
206 /* Look for py files in the main bundle by type */ |
|
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
|
207 arrayRef = CFBundleCopyResourceURLsOfType( mainBundle, |
|
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
|
208 resourceType, |
|
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
|
209 NULL ); |
|
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
|
210 |
|
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
|
211 /* See if there are any filename matches */ |
|
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
|
212 size = CFArrayGetCount(arrayRef); |
|
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
|
213 for (i = 0; i < size; i++) { |
|
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
|
214 URL = CFArrayGetValueAtIndex(arrayRef, i); |
|
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
|
215 filenameString = CFURLCopyLastPathComponent(URL); |
|
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
|
216 if (CFStringCompare(filenameString, resourceName, 0) == kCFCompareEqualTo) { |
|
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
|
217 /* We found a match, get the file's full path */ |
|
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
|
218 absoluteURL = CFURLCopyAbsoluteURL(URL); |
|
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
|
219 filepathString = CFURLCopyFileSystemPath(absoluteURL, thePathStyle); |
|
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
|
220 CFRelease(absoluteURL); |
|
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
|
221 |
|
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
|
222 /* Copy the full path into the caller's character buffer */ |
|
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
|
223 success = CFStringGetCString(filepathString, resourceURLCStr, length, |
|
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
|
224 kCFStringEncodingMacRoman); |
|
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
|
225 |
|
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
|
226 CFRelease(filepathString); |
|
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
|
227 } |
|
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
|
228 CFRelease(filenameString); |
|
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
|
229 } |
|
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
|
230 CFRelease(arrayRef); |
|
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
|
231 } |
|
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
|
232 return success; |
|
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
|
233 } |
|
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
|
234 |
|
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
|
235 /* |
|
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
|
236 ** iff we are running in a .app framework then we could be |
|
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
|
237 ** the main program for an applet. In that case, return the |
|
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
|
238 ** script filename for the applet. |
|
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
|
239 ** Otherwise return NULL. |
|
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
|
240 */ |
|
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
|
241 char * |
|
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
|
242 PyMac_GetAppletScriptFile(void) |
|
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
|
243 { |
|
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
|
244 static char scriptpath[1024]; |
|
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
|
245 |
|
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
|
246 /* First we see whether we have __rawmain__.py and run that if it |
|
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
|
247 ** is there. This is used for applets that want sys.argv to be |
|
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
|
248 ** unix-like: __rawmain__ will construct it (from the initial appleevent) |
|
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
|
249 ** and then call __main__.py. |
|
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
|
250 */ |
|
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
|
251 if (locateResourcePy(CFSTR("py"), CFSTR("__rawmain__.py"), scriptpath, 1024)) { |
|
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
|
252 return scriptpath; |
|
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
|
253 } else if (locateResourcePy(CFSTR("pyc"), CFSTR("__rawmain__.pyc"), scriptpath, 1024)) { |
|
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
|
254 return scriptpath; |
|
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
|
255 } else if (locateResourcePy(CFSTR("py"), CFSTR("__main__.py"), scriptpath, 1024)) { |
|
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
|
256 return scriptpath; |
|
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
|
257 } else if (locateResourcePy(CFSTR("pyc"), CFSTR("__main__.pyc"), scriptpath, 1024)) { |
|
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
|
258 return scriptpath; |
|
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
|
259 } |
|
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
|
260 return NULL; |
|
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
|
261 } |
|
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
|
262 |
|
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
|
263 #endif |
|
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
|
264 |
|
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
|
265 |
|
19064
e57a4614469e
Split macglue.c into two: a new mactoolboxglue.c (in ./Python)
Jack Jansen <jack.jansen@cwi.nl>
parents:
diff
changeset
|
266 /* 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
|
267 int |
|
e57a4614469e
Split macglue.c into two: a new mactoolboxglue.c (in ./Python)
Jack Jansen <jack.jansen@cwi.nl>
parents:
diff
changeset
|
268 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
|
269 { |
|
e57a4614469e
Split macglue.c into two: a new mactoolboxglue.c (in ./Python)
Jack Jansen <jack.jansen@cwi.nl>
parents:
diff
changeset
|
270 if (!PyString_Check(v) || PyString_Size(v) != 4) { |
|
e57a4614469e
Split macglue.c into two: a new mactoolboxglue.c (in ./Python)
Jack Jansen <jack.jansen@cwi.nl>
parents:
diff
changeset
|
271 PyErr_SetString(PyExc_TypeError, |
|
e57a4614469e
Split macglue.c into two: a new mactoolboxglue.c (in ./Python)
Jack Jansen <jack.jansen@cwi.nl>
parents:
diff
changeset
|
272 "OSType arg must be string of 4 chars"); |
|
e57a4614469e
Split macglue.c into two: a new mactoolboxglue.c (in ./Python)
Jack Jansen <jack.jansen@cwi.nl>
parents:
diff
changeset
|
273 return 0; |
|
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 memcpy((char *)pr, PyString_AsString(v), 4); |
|
e57a4614469e
Split macglue.c into two: a new mactoolboxglue.c (in ./Python)
Jack Jansen <jack.jansen@cwi.nl>
parents:
diff
changeset
|
276 return 1; |
|
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 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
|
280 PyObject * |
|
e57a4614469e
Split macglue.c into two: a new mactoolboxglue.c (in ./Python)
Jack Jansen <jack.jansen@cwi.nl>
parents:
diff
changeset
|
281 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
|
282 { |
|
e57a4614469e
Split macglue.c into two: a new mactoolboxglue.c (in ./Python)
Jack Jansen <jack.jansen@cwi.nl>
parents:
diff
changeset
|
283 return PyString_FromStringAndSize((char *)&t, 4); |
|
e57a4614469e
Split macglue.c into two: a new mactoolboxglue.c (in ./Python)
Jack Jansen <jack.jansen@cwi.nl>
parents:
diff
changeset
|
284 } |
|
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 /* 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
|
287 PyObject * |
|
e57a4614469e
Split macglue.c into two: a new mactoolboxglue.c (in ./Python)
Jack Jansen <jack.jansen@cwi.nl>
parents:
diff
changeset
|
288 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
|
289 { |
|
e57a4614469e
Split macglue.c into two: a new mactoolboxglue.c (in ./Python)
Jack Jansen <jack.jansen@cwi.nl>
parents:
diff
changeset
|
290 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
|
291 } |
|
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 |
|
e57a4614469e
Split macglue.c into two: a new mactoolboxglue.c (in ./Python)
Jack Jansen <jack.jansen@cwi.nl>
parents:
diff
changeset
|
294 /* 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
|
295 int |
|
e57a4614469e
Split macglue.c into two: a new mactoolboxglue.c (in ./Python)
Jack Jansen <jack.jansen@cwi.nl>
parents:
diff
changeset
|
296 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
|
297 { |
|
e57a4614469e
Split macglue.c into two: a new mactoolboxglue.c (in ./Python)
Jack Jansen <jack.jansen@cwi.nl>
parents:
diff
changeset
|
298 int len; |
|
e57a4614469e
Split macglue.c into two: a new mactoolboxglue.c (in ./Python)
Jack Jansen <jack.jansen@cwi.nl>
parents:
diff
changeset
|
299 if (!PyString_Check(v) || (len = PyString_Size(v)) > 255) { |
|
e57a4614469e
Split macglue.c into two: a new mactoolboxglue.c (in ./Python)
Jack Jansen <jack.jansen@cwi.nl>
parents:
diff
changeset
|
300 PyErr_SetString(PyExc_TypeError, |
|
e57a4614469e
Split macglue.c into two: a new mactoolboxglue.c (in ./Python)
Jack Jansen <jack.jansen@cwi.nl>
parents:
diff
changeset
|
301 "Str255 arg must be string of at most 255 chars"); |
|
e57a4614469e
Split macglue.c into two: a new mactoolboxglue.c (in ./Python)
Jack Jansen <jack.jansen@cwi.nl>
parents:
diff
changeset
|
302 return 0; |
|
e57a4614469e
Split macglue.c into two: a new mactoolboxglue.c (in ./Python)
Jack Jansen <jack.jansen@cwi.nl>
parents:
diff
changeset
|
303 } |
|
e57a4614469e
Split macglue.c into two: a new mactoolboxglue.c (in ./Python)
Jack Jansen <jack.jansen@cwi.nl>
parents:
diff
changeset
|
304 pbuf[0] = len; |
|
e57a4614469e
Split macglue.c into two: a new mactoolboxglue.c (in ./Python)
Jack Jansen <jack.jansen@cwi.nl>
parents:
diff
changeset
|
305 memcpy((char *)(pbuf+1), PyString_AsString(v), len); |
|
e57a4614469e
Split macglue.c into two: a new mactoolboxglue.c (in ./Python)
Jack Jansen <jack.jansen@cwi.nl>
parents:
diff
changeset
|
306 return 1; |
|
e57a4614469e
Split macglue.c into two: a new mactoolboxglue.c (in ./Python)
Jack Jansen <jack.jansen@cwi.nl>
parents:
diff
changeset
|
307 } |
|
e57a4614469e
Split macglue.c into two: a new mactoolboxglue.c (in ./Python)
Jack Jansen <jack.jansen@cwi.nl>
parents:
diff
changeset
|
308 |
|
e57a4614469e
Split macglue.c into two: a new mactoolboxglue.c (in ./Python)
Jack Jansen <jack.jansen@cwi.nl>
parents:
diff
changeset
|
309 /* 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
|
310 PyObject * |
|
e57a4614469e
Split macglue.c into two: a new mactoolboxglue.c (in ./Python)
Jack Jansen <jack.jansen@cwi.nl>
parents:
diff
changeset
|
311 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
|
312 { |
|
e57a4614469e
Split macglue.c into two: a new mactoolboxglue.c (in ./Python)
Jack Jansen <jack.jansen@cwi.nl>
parents:
diff
changeset
|
313 if ( s == NULL ) { |
|
e57a4614469e
Split macglue.c into two: a new mactoolboxglue.c (in ./Python)
Jack Jansen <jack.jansen@cwi.nl>
parents:
diff
changeset
|
314 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
|
315 return NULL; |
|
e57a4614469e
Split macglue.c into two: a new mactoolboxglue.c (in ./Python)
Jack Jansen <jack.jansen@cwi.nl>
parents:
diff
changeset
|
316 } |
|
e57a4614469e
Split macglue.c into two: a new mactoolboxglue.c (in ./Python)
Jack Jansen <jack.jansen@cwi.nl>
parents:
diff
changeset
|
317 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
|
318 } |
|
e57a4614469e
Split macglue.c into two: a new mactoolboxglue.c (in ./Python)
Jack Jansen <jack.jansen@cwi.nl>
parents:
diff
changeset
|
319 |
|
e57a4614469e
Split macglue.c into two: a new mactoolboxglue.c (in ./Python)
Jack Jansen <jack.jansen@cwi.nl>
parents:
diff
changeset
|
320 PyObject * |
|
e57a4614469e
Split macglue.c into two: a new mactoolboxglue.c (in ./Python)
Jack Jansen <jack.jansen@cwi.nl>
parents:
diff
changeset
|
321 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
|
322 { |
|
e57a4614469e
Split macglue.c into two: a new mactoolboxglue.c (in ./Python)
Jack Jansen <jack.jansen@cwi.nl>
parents:
diff
changeset
|
323 if ( s == NULL ) { |
|
e57a4614469e
Split macglue.c into two: a new mactoolboxglue.c (in ./Python)
Jack Jansen <jack.jansen@cwi.nl>
parents:
diff
changeset
|
324 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
|
325 return Py_None; |
|
e57a4614469e
Split macglue.c into two: a new mactoolboxglue.c (in ./Python)
Jack Jansen <jack.jansen@cwi.nl>
parents:
diff
changeset
|
326 } |
|
e57a4614469e
Split macglue.c into two: a new mactoolboxglue.c (in ./Python)
Jack Jansen <jack.jansen@cwi.nl>
parents:
diff
changeset
|
327 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
|
328 } |
|
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 |
|
e57a4614469e
Split macglue.c into two: a new mactoolboxglue.c (in ./Python)
Jack Jansen <jack.jansen@cwi.nl>
parents:
diff
changeset
|
331 |
|
e57a4614469e
Split macglue.c into two: a new mactoolboxglue.c (in ./Python)
Jack Jansen <jack.jansen@cwi.nl>
parents:
diff
changeset
|
332 /* 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
|
333 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
|
334 (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
|
335 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
|
336 int |
|
e57a4614469e
Split macglue.c into two: a new mactoolboxglue.c (in ./Python)
Jack Jansen <jack.jansen@cwi.nl>
parents:
diff
changeset
|
337 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
|
338 { |
|
e57a4614469e
Split macglue.c into two: a new mactoolboxglue.c (in ./Python)
Jack Jansen <jack.jansen@cwi.nl>
parents:
diff
changeset
|
339 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
|
340 } |
|
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 /* 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
|
343 PyObject * |
|
e57a4614469e
Split macglue.c into two: a new mactoolboxglue.c (in ./Python)
Jack Jansen <jack.jansen@cwi.nl>
parents:
diff
changeset
|
344 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
|
345 { |
|
e57a4614469e
Split macglue.c into two: a new mactoolboxglue.c (in ./Python)
Jack Jansen <jack.jansen@cwi.nl>
parents:
diff
changeset
|
346 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
|
347 } |
|
e57a4614469e
Split macglue.c into two: a new mactoolboxglue.c (in ./Python)
Jack Jansen <jack.jansen@cwi.nl>
parents:
diff
changeset
|
348 |
|
e57a4614469e
Split macglue.c into two: a new mactoolboxglue.c (in ./Python)
Jack Jansen <jack.jansen@cwi.nl>
parents:
diff
changeset
|
349 |
|
e57a4614469e
Split macglue.c into two: a new mactoolboxglue.c (in ./Python)
Jack Jansen <jack.jansen@cwi.nl>
parents:
diff
changeset
|
350 /* 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
|
351 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
|
352 (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
|
353 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
|
354 int |
|
e57a4614469e
Split macglue.c into two: a new mactoolboxglue.c (in ./Python)
Jack Jansen <jack.jansen@cwi.nl>
parents:
diff
changeset
|
355 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
|
356 { |
|
e57a4614469e
Split macglue.c into two: a new mactoolboxglue.c (in ./Python)
Jack Jansen <jack.jansen@cwi.nl>
parents:
diff
changeset
|
357 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
|
358 } |
|
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 /* 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
|
361 PyObject * |
|
e57a4614469e
Split macglue.c into two: a new mactoolboxglue.c (in ./Python)
Jack Jansen <jack.jansen@cwi.nl>
parents:
diff
changeset
|
362 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
|
363 { |
|
e57a4614469e
Split macglue.c into two: a new mactoolboxglue.c (in ./Python)
Jack Jansen <jack.jansen@cwi.nl>
parents:
diff
changeset
|
364 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
|
365 } |
|
e57a4614469e
Split macglue.c into two: a new mactoolboxglue.c (in ./Python)
Jack Jansen <jack.jansen@cwi.nl>
parents:
diff
changeset
|
366 |
|
e57a4614469e
Split macglue.c into two: a new mactoolboxglue.c (in ./Python)
Jack Jansen <jack.jansen@cwi.nl>
parents:
diff
changeset
|
367 |
|
e57a4614469e
Split macglue.c into two: a new mactoolboxglue.c (in ./Python)
Jack Jansen <jack.jansen@cwi.nl>
parents:
diff
changeset
|
368 /* 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
|
369 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
|
370 int |
|
e57a4614469e
Split macglue.c into two: a new mactoolboxglue.c (in ./Python)
Jack Jansen <jack.jansen@cwi.nl>
parents:
diff
changeset
|
371 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
|
372 { |
|
e57a4614469e
Split macglue.c into two: a new mactoolboxglue.c (in ./Python)
Jack Jansen <jack.jansen@cwi.nl>
parents:
diff
changeset
|
373 return PyArg_Parse(v, "(Hll(hh)H)", |
|
e57a4614469e
Split macglue.c into two: a new mactoolboxglue.c (in ./Python)
Jack Jansen <jack.jansen@cwi.nl>
parents:
diff
changeset
|
374 &e->what, |
|
e57a4614469e
Split macglue.c into two: a new mactoolboxglue.c (in ./Python)
Jack Jansen <jack.jansen@cwi.nl>
parents:
diff
changeset
|
375 &e->message, |
|
e57a4614469e
Split macglue.c into two: a new mactoolboxglue.c (in ./Python)
Jack Jansen <jack.jansen@cwi.nl>
parents:
diff
changeset
|
376 &e->when, |
|
e57a4614469e
Split macglue.c into two: a new mactoolboxglue.c (in ./Python)
Jack Jansen <jack.jansen@cwi.nl>
parents:
diff
changeset
|
377 &e->where.h, |
|
e57a4614469e
Split macglue.c into two: a new mactoolboxglue.c (in ./Python)
Jack Jansen <jack.jansen@cwi.nl>
parents:
diff
changeset
|
378 &e->where.v, |
|
e57a4614469e
Split macglue.c into two: a new mactoolboxglue.c (in ./Python)
Jack Jansen <jack.jansen@cwi.nl>
parents:
diff
changeset
|
379 &e->modifiers); |
|
e57a4614469e
Split macglue.c into two: a new mactoolboxglue.c (in ./Python)
Jack Jansen <jack.jansen@cwi.nl>
parents:
diff
changeset
|
380 } |
|
e57a4614469e
Split macglue.c into two: a new mactoolboxglue.c (in ./Python)
Jack Jansen <jack.jansen@cwi.nl>
parents:
diff
changeset
|
381 |
|
e57a4614469e
Split macglue.c into two: a new mactoolboxglue.c (in ./Python)
Jack Jansen <jack.jansen@cwi.nl>
parents:
diff
changeset
|
382 /* 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
|
383 PyObject * |
|
e57a4614469e
Split macglue.c into two: a new mactoolboxglue.c (in ./Python)
Jack Jansen <jack.jansen@cwi.nl>
parents:
diff
changeset
|
384 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
|
385 { |
|
e57a4614469e
Split macglue.c into two: a new mactoolboxglue.c (in ./Python)
Jack Jansen <jack.jansen@cwi.nl>
parents:
diff
changeset
|
386 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
|
387 e->what, |
|
e57a4614469e
Split macglue.c into two: a new mactoolboxglue.c (in ./Python)
Jack Jansen <jack.jansen@cwi.nl>
parents:
diff
changeset
|
388 e->message, |
|
e57a4614469e
Split macglue.c into two: a new mactoolboxglue.c (in ./Python)
Jack Jansen <jack.jansen@cwi.nl>
parents:
diff
changeset
|
389 e->when, |
|
e57a4614469e
Split macglue.c into two: a new mactoolboxglue.c (in ./Python)
Jack Jansen <jack.jansen@cwi.nl>
parents:
diff
changeset
|
390 e->where.h, |
|
e57a4614469e
Split macglue.c into two: a new mactoolboxglue.c (in ./Python)
Jack Jansen <jack.jansen@cwi.nl>
parents:
diff
changeset
|
391 e->where.v, |
|
e57a4614469e
Split macglue.c into two: a new mactoolboxglue.c (in ./Python)
Jack Jansen <jack.jansen@cwi.nl>
parents:
diff
changeset
|
392 e->modifiers); |
|
e57a4614469e
Split macglue.c into two: a new mactoolboxglue.c (in ./Python)
Jack Jansen <jack.jansen@cwi.nl>
parents:
diff
changeset
|
393 } |
|
e57a4614469e
Split macglue.c into two: a new mactoolboxglue.c (in ./Python)
Jack Jansen <jack.jansen@cwi.nl>
parents:
diff
changeset
|
394 |
|
e57a4614469e
Split macglue.c into two: a new mactoolboxglue.c (in ./Python)
Jack Jansen <jack.jansen@cwi.nl>
parents:
diff
changeset
|
395 /* 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
|
396 int |
|
e57a4614469e
Split macglue.c into two: a new mactoolboxglue.c (in ./Python)
Jack Jansen <jack.jansen@cwi.nl>
parents:
diff
changeset
|
397 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
|
398 { |
|
e57a4614469e
Split macglue.c into two: a new mactoolboxglue.c (in ./Python)
Jack Jansen <jack.jansen@cwi.nl>
parents:
diff
changeset
|
399 double d; |
|
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 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
|
402 return 0; |
|
e57a4614469e
Split macglue.c into two: a new mactoolboxglue.c (in ./Python)
Jack Jansen <jack.jansen@cwi.nl>
parents:
diff
changeset
|
403 *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
|
404 return 1; |
|
e57a4614469e
Split macglue.c into two: a new mactoolboxglue.c (in ./Python)
Jack Jansen <jack.jansen@cwi.nl>
parents:
diff
changeset
|
405 } |
|
e57a4614469e
Split macglue.c into two: a new mactoolboxglue.c (in ./Python)
Jack Jansen <jack.jansen@cwi.nl>
parents:
diff
changeset
|
406 |
|
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
|
407 /* 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
|
408 PyObject * |
|
e57a4614469e
Split macglue.c into two: a new mactoolboxglue.c (in ./Python)
Jack Jansen <jack.jansen@cwi.nl>
parents:
diff
changeset
|
409 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
|
410 { |
|
e57a4614469e
Split macglue.c into two: a new mactoolboxglue.c (in ./Python)
Jack Jansen <jack.jansen@cwi.nl>
parents:
diff
changeset
|
411 double d; |
|
e57a4614469e
Split macglue.c into two: a new mactoolboxglue.c (in ./Python)
Jack Jansen <jack.jansen@cwi.nl>
parents:
diff
changeset
|
412 |
|
e57a4614469e
Split macglue.c into two: a new mactoolboxglue.c (in ./Python)
Jack Jansen <jack.jansen@cwi.nl>
parents:
diff
changeset
|
413 d = f; |
|
e57a4614469e
Split macglue.c into two: a new mactoolboxglue.c (in ./Python)
Jack Jansen <jack.jansen@cwi.nl>
parents:
diff
changeset
|
414 d = d / 0x10000; |
|
e57a4614469e
Split macglue.c into two: a new mactoolboxglue.c (in ./Python)
Jack Jansen <jack.jansen@cwi.nl>
parents:
diff
changeset
|
415 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
|
416 } |
|
e57a4614469e
Split macglue.c into two: a new mactoolboxglue.c (in ./Python)
Jack Jansen <jack.jansen@cwi.nl>
parents:
diff
changeset
|
417 |
|
e57a4614469e
Split macglue.c into two: a new mactoolboxglue.c (in ./Python)
Jack Jansen <jack.jansen@cwi.nl>
parents:
diff
changeset
|
418 /* 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
|
419 int |
|
e57a4614469e
Split macglue.c into two: a new mactoolboxglue.c (in ./Python)
Jack Jansen <jack.jansen@cwi.nl>
parents:
diff
changeset
|
420 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
|
421 { |
|
e57a4614469e
Split macglue.c into two: a new mactoolboxglue.c (in ./Python)
Jack Jansen <jack.jansen@cwi.nl>
parents:
diff
changeset
|
422 if (PyInt_Check(v)) { |
|
e57a4614469e
Split macglue.c into two: a new mactoolboxglue.c (in ./Python)
Jack Jansen <jack.jansen@cwi.nl>
parents:
diff
changeset
|
423 rv->hi = 0; |
|
e57a4614469e
Split macglue.c into two: a new mactoolboxglue.c (in ./Python)
Jack Jansen <jack.jansen@cwi.nl>
parents:
diff
changeset
|
424 rv->lo = PyInt_AsLong(v); |
|
e57a4614469e
Split macglue.c into two: a new mactoolboxglue.c (in ./Python)
Jack Jansen <jack.jansen@cwi.nl>
parents:
diff
changeset
|
425 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
|
426 rv->hi = -1; |
|
e57a4614469e
Split macglue.c into two: a new mactoolboxglue.c (in ./Python)
Jack Jansen <jack.jansen@cwi.nl>
parents:
diff
changeset
|
427 return 1; |
|
e57a4614469e
Split macglue.c into two: a new mactoolboxglue.c (in ./Python)
Jack Jansen <jack.jansen@cwi.nl>
parents:
diff
changeset
|
428 } |
|
e57a4614469e
Split macglue.c into two: a new mactoolboxglue.c (in ./Python)
Jack Jansen <jack.jansen@cwi.nl>
parents:
diff
changeset
|
429 return PyArg_Parse(v, "(ll)", &rv->hi, &rv->lo); |
|
e57a4614469e
Split macglue.c into two: a new mactoolboxglue.c (in ./Python)
Jack Jansen <jack.jansen@cwi.nl>
parents:
diff
changeset
|
430 } |
|
e57a4614469e
Split macglue.c into two: a new mactoolboxglue.c (in ./Python)
Jack Jansen <jack.jansen@cwi.nl>
parents:
diff
changeset
|
431 |
|
e57a4614469e
Split macglue.c into two: a new mactoolboxglue.c (in ./Python)
Jack Jansen <jack.jansen@cwi.nl>
parents:
diff
changeset
|
432 |
|
e57a4614469e
Split macglue.c into two: a new mactoolboxglue.c (in ./Python)
Jack Jansen <jack.jansen@cwi.nl>
parents:
diff
changeset
|
433 PyObject * |
|
e57a4614469e
Split macglue.c into two: a new mactoolboxglue.c (in ./Python)
Jack Jansen <jack.jansen@cwi.nl>
parents:
diff
changeset
|
434 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
|
435 { |
|
e57a4614469e
Split macglue.c into two: a new mactoolboxglue.c (in ./Python)
Jack Jansen <jack.jansen@cwi.nl>
parents:
diff
changeset
|
436 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
|
437 (w->hi == -1 && (w->lo & 0x80000000) ) ) |
|
e57a4614469e
Split macglue.c into two: a new mactoolboxglue.c (in ./Python)
Jack Jansen <jack.jansen@cwi.nl>
parents:
diff
changeset
|
438 return PyInt_FromLong(w->lo); |
|
e57a4614469e
Split macglue.c into two: a new mactoolboxglue.c (in ./Python)
Jack Jansen <jack.jansen@cwi.nl>
parents:
diff
changeset
|
439 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
|
440 } |
|
e57a4614469e
Split macglue.c into two: a new mactoolboxglue.c (in ./Python)
Jack Jansen <jack.jansen@cwi.nl>
parents:
diff
changeset
|
441 |
|
e57a4614469e
Split macglue.c into two: a new mactoolboxglue.c (in ./Python)
Jack Jansen <jack.jansen@cwi.nl>
parents:
diff
changeset
|
442 #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
|
443 /* |
|
e57a4614469e
Split macglue.c into two: a new mactoolboxglue.c (in ./Python)
Jack Jansen <jack.jansen@cwi.nl>
parents:
diff
changeset
|
444 ** 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
|
445 ** |
|
e57a4614469e
Split macglue.c into two: a new mactoolboxglue.c (in ./Python)
Jack Jansen <jack.jansen@cwi.nl>
parents:
diff
changeset
|
446 ** 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
|
447 ** 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
|
448 ** 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
|
449 ** 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
|
450 ** |
|
e57a4614469e
Split macglue.c into two: a new mactoolboxglue.c (in ./Python)
Jack Jansen <jack.jansen@cwi.nl>
parents:
diff
changeset
|
451 ** 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
|
452 ** 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
|
453 ** 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
|
454 ** 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
|
455 ** the pointer. |
|
e57a4614469e
Split macglue.c into two: a new mactoolboxglue.c (in ./Python)
Jack Jansen <jack.jansen@cwi.nl>
parents:
diff
changeset
|
456 */ |
|
e57a4614469e
Split macglue.c into two: a new mactoolboxglue.c (in ./Python)
Jack Jansen <jack.jansen@cwi.nl>
parents:
diff
changeset
|
457 |
|
e57a4614469e
Split macglue.c into two: a new mactoolboxglue.c (in ./Python)
Jack Jansen <jack.jansen@cwi.nl>
parents:
diff
changeset
|
458 #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
|
459 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
|
460 \ |
|
e57a4614469e
Split macglue.c into two: a new mactoolboxglue.c (in ./Python)
Jack Jansen <jack.jansen@cwi.nl>
parents:
diff
changeset
|
461 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
|
462 if (!PyMacGluePtr_##routinename) { \ |
|
e57a4614469e
Split macglue.c into two: a new mactoolboxglue.c (in ./Python)
Jack Jansen <jack.jansen@cwi.nl>
parents:
diff
changeset
|
463 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
|
464 if (!PyMacGluePtr_##routinename) { \ |
|
e57a4614469e
Split macglue.c into two: a new mactoolboxglue.c (in ./Python)
Jack Jansen <jack.jansen@cwi.nl>
parents:
diff
changeset
|
465 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
|
466 return NULL; \ |
|
e57a4614469e
Split macglue.c into two: a new mactoolboxglue.c (in ./Python)
Jack Jansen <jack.jansen@cwi.nl>
parents:
diff
changeset
|
467 } \ |
|
e57a4614469e
Split macglue.c into two: a new mactoolboxglue.c (in ./Python)
Jack Jansen <jack.jansen@cwi.nl>
parents:
diff
changeset
|
468 } \ |
|
e57a4614469e
Split macglue.c into two: a new mactoolboxglue.c (in ./Python)
Jack Jansen <jack.jansen@cwi.nl>
parents:
diff
changeset
|
469 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
|
470 } |
|
e57a4614469e
Split macglue.c into two: a new mactoolboxglue.c (in ./Python)
Jack Jansen <jack.jansen@cwi.nl>
parents:
diff
changeset
|
471 |
|
e57a4614469e
Split macglue.c into two: a new mactoolboxglue.c (in ./Python)
Jack Jansen <jack.jansen@cwi.nl>
parents:
diff
changeset
|
472 #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
|
473 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
|
474 \ |
|
e57a4614469e
Split macglue.c into two: a new mactoolboxglue.c (in ./Python)
Jack Jansen <jack.jansen@cwi.nl>
parents:
diff
changeset
|
475 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
|
476 if (!PyMacGluePtr_##routinename) { \ |
|
e57a4614469e
Split macglue.c into two: a new mactoolboxglue.c (in ./Python)
Jack Jansen <jack.jansen@cwi.nl>
parents:
diff
changeset
|
477 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
|
478 if (!PyMacGluePtr_##routinename) { \ |
|
e57a4614469e
Split macglue.c into two: a new mactoolboxglue.c (in ./Python)
Jack Jansen <jack.jansen@cwi.nl>
parents:
diff
changeset
|
479 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
|
480 return NULL; \ |
|
e57a4614469e
Split macglue.c into two: a new mactoolboxglue.c (in ./Python)
Jack Jansen <jack.jansen@cwi.nl>
parents:
diff
changeset
|
481 } \ |
|
e57a4614469e
Split macglue.c into two: a new mactoolboxglue.c (in ./Python)
Jack Jansen <jack.jansen@cwi.nl>
parents:
diff
changeset
|
482 } \ |
|
e57a4614469e
Split macglue.c into two: a new mactoolboxglue.c (in ./Python)
Jack Jansen <jack.jansen@cwi.nl>
parents:
diff
changeset
|
483 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
|
484 } |
|
19645
d55b75ac2fb4
Added glue routine for PyMac_BuildFSSpec, PyMac_GetFSRef and PyMac_BuildFSRef.
Jack Jansen <jack.jansen@cwi.nl>
parents:
19496
diff
changeset
|
485 |
|
d55b75ac2fb4
Added glue routine for PyMac_BuildFSSpec, PyMac_GetFSRef and PyMac_BuildFSRef.
Jack Jansen <jack.jansen@cwi.nl>
parents:
19496
diff
changeset
|
486 GLUE_NEW(FSSpec *, PyMac_BuildFSSpec, "macfs") |
|
19064
e57a4614469e
Split macglue.c into two: a new mactoolboxglue.c (in ./Python)
Jack Jansen <jack.jansen@cwi.nl>
parents:
diff
changeset
|
487 GLUE_CONVERT(FSSpec, PyMac_GetFSSpec, "macfs") |
|
19645
d55b75ac2fb4
Added glue routine for PyMac_BuildFSSpec, PyMac_GetFSRef and PyMac_BuildFSRef.
Jack Jansen <jack.jansen@cwi.nl>
parents:
19496
diff
changeset
|
488 GLUE_NEW(FSRef *, PyMac_BuildFSRef, "macfs") |
|
d55b75ac2fb4
Added glue routine for PyMac_BuildFSSpec, PyMac_GetFSRef and PyMac_BuildFSRef.
Jack Jansen <jack.jansen@cwi.nl>
parents:
19496
diff
changeset
|
489 GLUE_CONVERT(FSRef, PyMac_GetFSRef, "macfs") |
|
19064
e57a4614469e
Split macglue.c into two: a new mactoolboxglue.c (in ./Python)
Jack Jansen <jack.jansen@cwi.nl>
parents:
diff
changeset
|
490 |
|
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
|
491 GLUE_NEW(AppleEvent *, AEDesc_New, "Carbon.AE") /* XXXX Why by address? */ |
|
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
|
492 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
|
493 |
|
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
|
494 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
|
495 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
|
496 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
|
497 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
|
498 |
|
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
|
499 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
|
500 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
|
501 |
|
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
|
502 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
|
503 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
|
504 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
|
505 |
|
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
|
506 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
|
507 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
|
508 |
|
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
|
509 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
|
510 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
|
511 |
|
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
|
512 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
|
513 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
|
514 |
|
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
|
515 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
|
516 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
|
517 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
|
518 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
|
519 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
|
520 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
|
521 |
|
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
|
522 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
|
523 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
|
524 |
|
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
|
525 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
|
526 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
|
527 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
|
528 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
|
529 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
|
530 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
|
531 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
|
532 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
|
533 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
|
534 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
|
535 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
|
536 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
|
537 |
|
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
|
538 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
|
539 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
|
540 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
|
541 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
|
542 |
|
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
|
543 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
|
544 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
|
545 |
|
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
|
546 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
|
547 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
|
548 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
|
549 |
|
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
|
550 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
|
551 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
|
552 |
|
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
|
553 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
|
554 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
|
555 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
|
556 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
|
557 |
|
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
|
558 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
|
559 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
|
560 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
|
561 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
|
562 |
|
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
|
563 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
|
564 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
|
565 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
|
566 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
|
567 |
|
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
|
568 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
|
569 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
|
570 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
|
571 |
|
19064
e57a4614469e
Split macglue.c into two: a new mactoolboxglue.c (in ./Python)
Jack Jansen <jack.jansen@cwi.nl>
parents:
diff
changeset
|
572 #endif /* USE_TOOLBOX_OBJECT_GLUE */ |
