annotate Mac/Modules/launch/_Launchmodule.c @ 80661:94de77bd0b4b 2.7

Issue #16194: document imp.load_dynamic problems when read several extension modules from the same binary object file.
author Andrew Svetlov <andrew.svetlov@gmail.com>
date Thu, 29 Nov 2012 19:51:28 +0200
parents fd25030223b0
children
Ignore whitespace changes - Everywhere: Within whitespace: At end of lines:
rev   line source
31075
5b515cc90b5a An interface to the LaunchServices API.
Jack Jansen <jack.jansen@cwi.nl>
parents:
diff changeset
1
5b515cc90b5a An interface to the LaunchServices API.
Jack Jansen <jack.jansen@cwi.nl>
parents:
diff changeset
2 /* ========================= Module _Launch ========================= */
5b515cc90b5a An interface to the LaunchServices API.
Jack Jansen <jack.jansen@cwi.nl>
parents:
diff changeset
3
5b515cc90b5a An interface to the LaunchServices API.
Jack Jansen <jack.jansen@cwi.nl>
parents:
diff changeset
4 #include "Python.h"
5b515cc90b5a An interface to the LaunchServices API.
Jack Jansen <jack.jansen@cwi.nl>
parents:
diff changeset
5
5b515cc90b5a An interface to the LaunchServices API.
Jack Jansen <jack.jansen@cwi.nl>
parents:
diff changeset
6
5b515cc90b5a An interface to the LaunchServices API.
Jack Jansen <jack.jansen@cwi.nl>
parents:
diff changeset
7
5b515cc90b5a An interface to the LaunchServices API.
Jack Jansen <jack.jansen@cwi.nl>
parents:
diff changeset
8 #include "pymactoolbox.h"
5b515cc90b5a An interface to the LaunchServices API.
Jack Jansen <jack.jansen@cwi.nl>
parents:
diff changeset
9
5b515cc90b5a An interface to the LaunchServices API.
Jack Jansen <jack.jansen@cwi.nl>
parents:
diff changeset
10 /* Macro to test whether a weak-loaded CFM function exists */
5b515cc90b5a An interface to the LaunchServices API.
Jack Jansen <jack.jansen@cwi.nl>
parents:
diff changeset
11 #define PyMac_PRECHECK(rtn) do { if ( &rtn == NULL ) {\
61463
fd25030223b0 Untabify C files. Will watch buildbots.
Antoine Pitrou <solipsis@pitrou.net>
parents: 47473
diff changeset
12 PyErr_SetString(PyExc_NotImplementedError, \
fd25030223b0 Untabify C files. Will watch buildbots.
Antoine Pitrou <solipsis@pitrou.net>
parents: 47473
diff changeset
13 "Not available in this shared library/OS version"); \
fd25030223b0 Untabify C files. Will watch buildbots.
Antoine Pitrou <solipsis@pitrou.net>
parents: 47473
diff changeset
14 return NULL; \
31075
5b515cc90b5a An interface to the LaunchServices API.
Jack Jansen <jack.jansen@cwi.nl>
parents:
diff changeset
15 }} while(0)
5b515cc90b5a An interface to the LaunchServices API.
Jack Jansen <jack.jansen@cwi.nl>
parents:
diff changeset
16
5b515cc90b5a An interface to the LaunchServices API.
Jack Jansen <jack.jansen@cwi.nl>
parents:
diff changeset
17
31160
2a0782cc151f Made this module compatible with Python2.3, and added a temporary setup
Jack Jansen <jack.jansen@cwi.nl>
parents: 31091
diff changeset
18 #if PY_VERSION_HEX < 0x02040000
2a0782cc151f Made this module compatible with Python2.3, and added a temporary setup
Jack Jansen <jack.jansen@cwi.nl>
parents: 31091
diff changeset
19 PyObject *PyMac_GetOSErrException(void);
2a0782cc151f Made this module compatible with Python2.3, and added a temporary setup
Jack Jansen <jack.jansen@cwi.nl>
parents: 31091
diff changeset
20 #endif
2a0782cc151f Made this module compatible with Python2.3, and added a temporary setup
Jack Jansen <jack.jansen@cwi.nl>
parents: 31091
diff changeset
21
31075
5b515cc90b5a An interface to the LaunchServices API.
Jack Jansen <jack.jansen@cwi.nl>
parents:
diff changeset
22 #include <ApplicationServices/ApplicationServices.h>
5b515cc90b5a An interface to the LaunchServices API.
Jack Jansen <jack.jansen@cwi.nl>
parents:
diff changeset
23
5b515cc90b5a An interface to the LaunchServices API.
Jack Jansen <jack.jansen@cwi.nl>
parents:
diff changeset
24 /*
5b515cc90b5a An interface to the LaunchServices API.
Jack Jansen <jack.jansen@cwi.nl>
parents:
diff changeset
25 ** Optional CFStringRef. None will pass NULL
5b515cc90b5a An interface to the LaunchServices API.
Jack Jansen <jack.jansen@cwi.nl>
parents:
diff changeset
26 */
5b515cc90b5a An interface to the LaunchServices API.
Jack Jansen <jack.jansen@cwi.nl>
parents:
diff changeset
27 static int
5b515cc90b5a An interface to the LaunchServices API.
Jack Jansen <jack.jansen@cwi.nl>
parents:
diff changeset
28 OptCFStringRefObj_Convert(PyObject *v, CFStringRef *spec)
5b515cc90b5a An interface to the LaunchServices API.
Jack Jansen <jack.jansen@cwi.nl>
parents:
diff changeset
29 {
61463
fd25030223b0 Untabify C files. Will watch buildbots.
Antoine Pitrou <solipsis@pitrou.net>
parents: 47473
diff changeset
30 if (v == Py_None) {
fd25030223b0 Untabify C files. Will watch buildbots.
Antoine Pitrou <solipsis@pitrou.net>
parents: 47473
diff changeset
31 *spec = NULL;
fd25030223b0 Untabify C files. Will watch buildbots.
Antoine Pitrou <solipsis@pitrou.net>
parents: 47473
diff changeset
32 return 1;
fd25030223b0 Untabify C files. Will watch buildbots.
Antoine Pitrou <solipsis@pitrou.net>
parents: 47473
diff changeset
33 }
fd25030223b0 Untabify C files. Will watch buildbots.
Antoine Pitrou <solipsis@pitrou.net>
parents: 47473
diff changeset
34 return CFStringRefObj_Convert(v, spec);
31075
5b515cc90b5a An interface to the LaunchServices API.
Jack Jansen <jack.jansen@cwi.nl>
parents:
diff changeset
35 }
5b515cc90b5a An interface to the LaunchServices API.
Jack Jansen <jack.jansen@cwi.nl>
parents:
diff changeset
36
5b515cc90b5a An interface to the LaunchServices API.
Jack Jansen <jack.jansen@cwi.nl>
parents:
diff changeset
37 PyObject *
5b515cc90b5a An interface to the LaunchServices API.
Jack Jansen <jack.jansen@cwi.nl>
parents:
diff changeset
38 OptCFStringRefObj_New(CFStringRef it)
5b515cc90b5a An interface to the LaunchServices API.
Jack Jansen <jack.jansen@cwi.nl>
parents:
diff changeset
39 {
61463
fd25030223b0 Untabify C files. Will watch buildbots.
Antoine Pitrou <solipsis@pitrou.net>
parents: 47473
diff changeset
40 if (it == NULL) {
fd25030223b0 Untabify C files. Will watch buildbots.
Antoine Pitrou <solipsis@pitrou.net>
parents: 47473
diff changeset
41 Py_INCREF(Py_None);
fd25030223b0 Untabify C files. Will watch buildbots.
Antoine Pitrou <solipsis@pitrou.net>
parents: 47473
diff changeset
42 return Py_None;
fd25030223b0 Untabify C files. Will watch buildbots.
Antoine Pitrou <solipsis@pitrou.net>
parents: 47473
diff changeset
43 }
fd25030223b0 Untabify C files. Will watch buildbots.
Antoine Pitrou <solipsis@pitrou.net>
parents: 47473
diff changeset
44 return CFStringRefObj_New(it);
31075
5b515cc90b5a An interface to the LaunchServices API.
Jack Jansen <jack.jansen@cwi.nl>
parents:
diff changeset
45 }
5b515cc90b5a An interface to the LaunchServices API.
Jack Jansen <jack.jansen@cwi.nl>
parents:
diff changeset
46
5b515cc90b5a An interface to the LaunchServices API.
Jack Jansen <jack.jansen@cwi.nl>
parents:
diff changeset
47 /*
5b515cc90b5a An interface to the LaunchServices API.
Jack Jansen <jack.jansen@cwi.nl>
parents:
diff changeset
48 ** Convert LSItemInfoRecord to Python.
5b515cc90b5a An interface to the LaunchServices API.
Jack Jansen <jack.jansen@cwi.nl>
parents:
diff changeset
49 */
5b515cc90b5a An interface to the LaunchServices API.
Jack Jansen <jack.jansen@cwi.nl>
parents:
diff changeset
50 PyObject *
5b515cc90b5a An interface to the LaunchServices API.
Jack Jansen <jack.jansen@cwi.nl>
parents:
diff changeset
51 LSItemInfoRecord_New(LSItemInfoRecord *it)
5b515cc90b5a An interface to the LaunchServices API.
Jack Jansen <jack.jansen@cwi.nl>
parents:
diff changeset
52 {
47473
c34e34057714 MacOS X: Enable 4-way universal builds
Ronald Oussoren <ronaldoussoren@mac.com>
parents: 35200
diff changeset
53 #ifndef __LP64__
61463
fd25030223b0 Untabify C files. Will watch buildbots.
Antoine Pitrou <solipsis@pitrou.net>
parents: 47473
diff changeset
54 return Py_BuildValue("{s:is:O&s:O&s:O&s:O&s:i}",
fd25030223b0 Untabify C files. Will watch buildbots.
Antoine Pitrou <solipsis@pitrou.net>
parents: 47473
diff changeset
55 "flags", it->flags,
fd25030223b0 Untabify C files. Will watch buildbots.
Antoine Pitrou <solipsis@pitrou.net>
parents: 47473
diff changeset
56 "filetype", PyMac_BuildOSType, it->filetype,
fd25030223b0 Untabify C files. Will watch buildbots.
Antoine Pitrou <solipsis@pitrou.net>
parents: 47473
diff changeset
57 "creator", PyMac_BuildOSType, it->creator,
fd25030223b0 Untabify C files. Will watch buildbots.
Antoine Pitrou <solipsis@pitrou.net>
parents: 47473
diff changeset
58 "extension", OptCFStringRefObj_New, it->extension,
fd25030223b0 Untabify C files. Will watch buildbots.
Antoine Pitrou <solipsis@pitrou.net>
parents: 47473
diff changeset
59 "iconFileName", OptCFStringRefObj_New, it->iconFileName,
fd25030223b0 Untabify C files. Will watch buildbots.
Antoine Pitrou <solipsis@pitrou.net>
parents: 47473
diff changeset
60 "kindID", it->kindID);
47473
c34e34057714 MacOS X: Enable 4-way universal builds
Ronald Oussoren <ronaldoussoren@mac.com>
parents: 35200
diff changeset
61 #else
61463
fd25030223b0 Untabify C files. Will watch buildbots.
Antoine Pitrou <solipsis@pitrou.net>
parents: 47473
diff changeset
62 return Py_BuildValue("{s:is:O&s:O&s:O&}",
fd25030223b0 Untabify C files. Will watch buildbots.
Antoine Pitrou <solipsis@pitrou.net>
parents: 47473
diff changeset
63 "flags", it->flags,
fd25030223b0 Untabify C files. Will watch buildbots.
Antoine Pitrou <solipsis@pitrou.net>
parents: 47473
diff changeset
64 "filetype", PyMac_BuildOSType, it->filetype,
fd25030223b0 Untabify C files. Will watch buildbots.
Antoine Pitrou <solipsis@pitrou.net>
parents: 47473
diff changeset
65 "creator", PyMac_BuildOSType, it->creator,
fd25030223b0 Untabify C files. Will watch buildbots.
Antoine Pitrou <solipsis@pitrou.net>
parents: 47473
diff changeset
66 "extension", OptCFStringRefObj_New, it->extension);
47473
c34e34057714 MacOS X: Enable 4-way universal builds
Ronald Oussoren <ronaldoussoren@mac.com>
parents: 35200
diff changeset
67 #endif
31075
5b515cc90b5a An interface to the LaunchServices API.
Jack Jansen <jack.jansen@cwi.nl>
parents:
diff changeset
68 }
5b515cc90b5a An interface to the LaunchServices API.
Jack Jansen <jack.jansen@cwi.nl>
parents:
diff changeset
69
5b515cc90b5a An interface to the LaunchServices API.
Jack Jansen <jack.jansen@cwi.nl>
parents:
diff changeset
70 static PyObject *Launch_Error;
5b515cc90b5a An interface to the LaunchServices API.
Jack Jansen <jack.jansen@cwi.nl>
parents:
diff changeset
71
5b515cc90b5a An interface to the LaunchServices API.
Jack Jansen <jack.jansen@cwi.nl>
parents:
diff changeset
72 static PyObject *Launch_LSCopyItemInfoForRef(PyObject *_self, PyObject *_args)
5b515cc90b5a An interface to the LaunchServices API.
Jack Jansen <jack.jansen@cwi.nl>
parents:
diff changeset
73 {
61463
fd25030223b0 Untabify C files. Will watch buildbots.
Antoine Pitrou <solipsis@pitrou.net>
parents: 47473
diff changeset
74 PyObject *_res = NULL;
fd25030223b0 Untabify C files. Will watch buildbots.
Antoine Pitrou <solipsis@pitrou.net>
parents: 47473
diff changeset
75 OSStatus _err;
fd25030223b0 Untabify C files. Will watch buildbots.
Antoine Pitrou <solipsis@pitrou.net>
parents: 47473
diff changeset
76 FSRef inItemRef;
fd25030223b0 Untabify C files. Will watch buildbots.
Antoine Pitrou <solipsis@pitrou.net>
parents: 47473
diff changeset
77 LSRequestedInfo inWhichInfo;
fd25030223b0 Untabify C files. Will watch buildbots.
Antoine Pitrou <solipsis@pitrou.net>
parents: 47473
diff changeset
78 LSItemInfoRecord outItemInfo;
fd25030223b0 Untabify C files. Will watch buildbots.
Antoine Pitrou <solipsis@pitrou.net>
parents: 47473
diff changeset
79 if (!PyArg_ParseTuple(_args, "O&l",
fd25030223b0 Untabify C files. Will watch buildbots.
Antoine Pitrou <solipsis@pitrou.net>
parents: 47473
diff changeset
80 PyMac_GetFSRef, &inItemRef,
fd25030223b0 Untabify C files. Will watch buildbots.
Antoine Pitrou <solipsis@pitrou.net>
parents: 47473
diff changeset
81 &inWhichInfo))
fd25030223b0 Untabify C files. Will watch buildbots.
Antoine Pitrou <solipsis@pitrou.net>
parents: 47473
diff changeset
82 return NULL;
fd25030223b0 Untabify C files. Will watch buildbots.
Antoine Pitrou <solipsis@pitrou.net>
parents: 47473
diff changeset
83 _err = LSCopyItemInfoForRef(&inItemRef,
fd25030223b0 Untabify C files. Will watch buildbots.
Antoine Pitrou <solipsis@pitrou.net>
parents: 47473
diff changeset
84 inWhichInfo,
fd25030223b0 Untabify C files. Will watch buildbots.
Antoine Pitrou <solipsis@pitrou.net>
parents: 47473
diff changeset
85 &outItemInfo);
fd25030223b0 Untabify C files. Will watch buildbots.
Antoine Pitrou <solipsis@pitrou.net>
parents: 47473
diff changeset
86 if (_err != noErr) return PyMac_Error(_err);
fd25030223b0 Untabify C files. Will watch buildbots.
Antoine Pitrou <solipsis@pitrou.net>
parents: 47473
diff changeset
87 _res = Py_BuildValue("O&",
fd25030223b0 Untabify C files. Will watch buildbots.
Antoine Pitrou <solipsis@pitrou.net>
parents: 47473
diff changeset
88 LSItemInfoRecord_New, &outItemInfo);
fd25030223b0 Untabify C files. Will watch buildbots.
Antoine Pitrou <solipsis@pitrou.net>
parents: 47473
diff changeset
89 return _res;
31075
5b515cc90b5a An interface to the LaunchServices API.
Jack Jansen <jack.jansen@cwi.nl>
parents:
diff changeset
90 }
5b515cc90b5a An interface to the LaunchServices API.
Jack Jansen <jack.jansen@cwi.nl>
parents:
diff changeset
91
5b515cc90b5a An interface to the LaunchServices API.
Jack Jansen <jack.jansen@cwi.nl>
parents:
diff changeset
92 static PyObject *Launch_LSCopyItemInfoForURL(PyObject *_self, PyObject *_args)
5b515cc90b5a An interface to the LaunchServices API.
Jack Jansen <jack.jansen@cwi.nl>
parents:
diff changeset
93 {
61463
fd25030223b0 Untabify C files. Will watch buildbots.
Antoine Pitrou <solipsis@pitrou.net>
parents: 47473
diff changeset
94 PyObject *_res = NULL;
fd25030223b0 Untabify C files. Will watch buildbots.
Antoine Pitrou <solipsis@pitrou.net>
parents: 47473
diff changeset
95 OSStatus _err;
fd25030223b0 Untabify C files. Will watch buildbots.
Antoine Pitrou <solipsis@pitrou.net>
parents: 47473
diff changeset
96 CFURLRef inURL;
fd25030223b0 Untabify C files. Will watch buildbots.
Antoine Pitrou <solipsis@pitrou.net>
parents: 47473
diff changeset
97 LSRequestedInfo inWhichInfo;
fd25030223b0 Untabify C files. Will watch buildbots.
Antoine Pitrou <solipsis@pitrou.net>
parents: 47473
diff changeset
98 LSItemInfoRecord outItemInfo;
fd25030223b0 Untabify C files. Will watch buildbots.
Antoine Pitrou <solipsis@pitrou.net>
parents: 47473
diff changeset
99 if (!PyArg_ParseTuple(_args, "O&l",
fd25030223b0 Untabify C files. Will watch buildbots.
Antoine Pitrou <solipsis@pitrou.net>
parents: 47473
diff changeset
100 CFURLRefObj_Convert, &inURL,
fd25030223b0 Untabify C files. Will watch buildbots.
Antoine Pitrou <solipsis@pitrou.net>
parents: 47473
diff changeset
101 &inWhichInfo))
fd25030223b0 Untabify C files. Will watch buildbots.
Antoine Pitrou <solipsis@pitrou.net>
parents: 47473
diff changeset
102 return NULL;
fd25030223b0 Untabify C files. Will watch buildbots.
Antoine Pitrou <solipsis@pitrou.net>
parents: 47473
diff changeset
103 _err = LSCopyItemInfoForURL(inURL,
fd25030223b0 Untabify C files. Will watch buildbots.
Antoine Pitrou <solipsis@pitrou.net>
parents: 47473
diff changeset
104 inWhichInfo,
fd25030223b0 Untabify C files. Will watch buildbots.
Antoine Pitrou <solipsis@pitrou.net>
parents: 47473
diff changeset
105 &outItemInfo);
fd25030223b0 Untabify C files. Will watch buildbots.
Antoine Pitrou <solipsis@pitrou.net>
parents: 47473
diff changeset
106 if (_err != noErr) return PyMac_Error(_err);
fd25030223b0 Untabify C files. Will watch buildbots.
Antoine Pitrou <solipsis@pitrou.net>
parents: 47473
diff changeset
107 _res = Py_BuildValue("O&",
fd25030223b0 Untabify C files. Will watch buildbots.
Antoine Pitrou <solipsis@pitrou.net>
parents: 47473
diff changeset
108 LSItemInfoRecord_New, &outItemInfo);
fd25030223b0 Untabify C files. Will watch buildbots.
Antoine Pitrou <solipsis@pitrou.net>
parents: 47473
diff changeset
109 return _res;
31075
5b515cc90b5a An interface to the LaunchServices API.
Jack Jansen <jack.jansen@cwi.nl>
parents:
diff changeset
110 }
5b515cc90b5a An interface to the LaunchServices API.
Jack Jansen <jack.jansen@cwi.nl>
parents:
diff changeset
111
31091
3861eb467c29 Ported to Universal Headers 3.4.2. Qd and Qt remain to be done.
Jack Jansen <jack.jansen@cwi.nl>
parents: 31086
diff changeset
112 static PyObject *Launch_LSGetExtensionInfo(PyObject *_self, PyObject *_args)
3861eb467c29 Ported to Universal Headers 3.4.2. Qd and Qt remain to be done.
Jack Jansen <jack.jansen@cwi.nl>
parents: 31086
diff changeset
113 {
61463
fd25030223b0 Untabify C files. Will watch buildbots.
Antoine Pitrou <solipsis@pitrou.net>
parents: 47473
diff changeset
114 PyObject *_res = NULL;
fd25030223b0 Untabify C files. Will watch buildbots.
Antoine Pitrou <solipsis@pitrou.net>
parents: 47473
diff changeset
115 OSStatus _err;
fd25030223b0 Untabify C files. Will watch buildbots.
Antoine Pitrou <solipsis@pitrou.net>
parents: 47473
diff changeset
116 UniChar *inNameLen__in__;
fd25030223b0 Untabify C files. Will watch buildbots.
Antoine Pitrou <solipsis@pitrou.net>
parents: 47473
diff changeset
117 UniCharCount inNameLen__len__;
fd25030223b0 Untabify C files. Will watch buildbots.
Antoine Pitrou <solipsis@pitrou.net>
parents: 47473
diff changeset
118 int inNameLen__in_len__;
fd25030223b0 Untabify C files. Will watch buildbots.
Antoine Pitrou <solipsis@pitrou.net>
parents: 47473
diff changeset
119 UniCharCount outExtStartIndex;
fd25030223b0 Untabify C files. Will watch buildbots.
Antoine Pitrou <solipsis@pitrou.net>
parents: 47473
diff changeset
120 if (!PyArg_ParseTuple(_args, "u#",
fd25030223b0 Untabify C files. Will watch buildbots.
Antoine Pitrou <solipsis@pitrou.net>
parents: 47473
diff changeset
121 &inNameLen__in__, &inNameLen__in_len__))
fd25030223b0 Untabify C files. Will watch buildbots.
Antoine Pitrou <solipsis@pitrou.net>
parents: 47473
diff changeset
122 return NULL;
fd25030223b0 Untabify C files. Will watch buildbots.
Antoine Pitrou <solipsis@pitrou.net>
parents: 47473
diff changeset
123 inNameLen__len__ = inNameLen__in_len__;
fd25030223b0 Untabify C files. Will watch buildbots.
Antoine Pitrou <solipsis@pitrou.net>
parents: 47473
diff changeset
124 _err = LSGetExtensionInfo(inNameLen__len__, inNameLen__in__,
fd25030223b0 Untabify C files. Will watch buildbots.
Antoine Pitrou <solipsis@pitrou.net>
parents: 47473
diff changeset
125 &outExtStartIndex);
fd25030223b0 Untabify C files. Will watch buildbots.
Antoine Pitrou <solipsis@pitrou.net>
parents: 47473
diff changeset
126 if (_err != noErr) return PyMac_Error(_err);
fd25030223b0 Untabify C files. Will watch buildbots.
Antoine Pitrou <solipsis@pitrou.net>
parents: 47473
diff changeset
127 _res = Py_BuildValue("l",
fd25030223b0 Untabify C files. Will watch buildbots.
Antoine Pitrou <solipsis@pitrou.net>
parents: 47473
diff changeset
128 outExtStartIndex);
fd25030223b0 Untabify C files. Will watch buildbots.
Antoine Pitrou <solipsis@pitrou.net>
parents: 47473
diff changeset
129 return _res;
31091
3861eb467c29 Ported to Universal Headers 3.4.2. Qd and Qt remain to be done.
Jack Jansen <jack.jansen@cwi.nl>
parents: 31086
diff changeset
130 }
3861eb467c29 Ported to Universal Headers 3.4.2. Qd and Qt remain to be done.
Jack Jansen <jack.jansen@cwi.nl>
parents: 31086
diff changeset
131
3861eb467c29 Ported to Universal Headers 3.4.2. Qd and Qt remain to be done.
Jack Jansen <jack.jansen@cwi.nl>
parents: 31086
diff changeset
132 static PyObject *Launch_LSCopyDisplayNameForRef(PyObject *_self, PyObject *_args)
3861eb467c29 Ported to Universal Headers 3.4.2. Qd and Qt remain to be done.
Jack Jansen <jack.jansen@cwi.nl>
parents: 31086
diff changeset
133 {
61463
fd25030223b0 Untabify C files. Will watch buildbots.
Antoine Pitrou <solipsis@pitrou.net>
parents: 47473
diff changeset
134 PyObject *_res = NULL;
fd25030223b0 Untabify C files. Will watch buildbots.
Antoine Pitrou <solipsis@pitrou.net>
parents: 47473
diff changeset
135 OSStatus _err;
fd25030223b0 Untabify C files. Will watch buildbots.
Antoine Pitrou <solipsis@pitrou.net>
parents: 47473
diff changeset
136 FSRef inRef;
fd25030223b0 Untabify C files. Will watch buildbots.
Antoine Pitrou <solipsis@pitrou.net>
parents: 47473
diff changeset
137 CFStringRef outDisplayName;
fd25030223b0 Untabify C files. Will watch buildbots.
Antoine Pitrou <solipsis@pitrou.net>
parents: 47473
diff changeset
138 if (!PyArg_ParseTuple(_args, "O&",
fd25030223b0 Untabify C files. Will watch buildbots.
Antoine Pitrou <solipsis@pitrou.net>
parents: 47473
diff changeset
139 PyMac_GetFSRef, &inRef))
fd25030223b0 Untabify C files. Will watch buildbots.
Antoine Pitrou <solipsis@pitrou.net>
parents: 47473
diff changeset
140 return NULL;
fd25030223b0 Untabify C files. Will watch buildbots.
Antoine Pitrou <solipsis@pitrou.net>
parents: 47473
diff changeset
141 _err = LSCopyDisplayNameForRef(&inRef,
fd25030223b0 Untabify C files. Will watch buildbots.
Antoine Pitrou <solipsis@pitrou.net>
parents: 47473
diff changeset
142 &outDisplayName);
fd25030223b0 Untabify C files. Will watch buildbots.
Antoine Pitrou <solipsis@pitrou.net>
parents: 47473
diff changeset
143 if (_err != noErr) return PyMac_Error(_err);
fd25030223b0 Untabify C files. Will watch buildbots.
Antoine Pitrou <solipsis@pitrou.net>
parents: 47473
diff changeset
144 _res = Py_BuildValue("O&",
fd25030223b0 Untabify C files. Will watch buildbots.
Antoine Pitrou <solipsis@pitrou.net>
parents: 47473
diff changeset
145 CFStringRefObj_New, outDisplayName);
fd25030223b0 Untabify C files. Will watch buildbots.
Antoine Pitrou <solipsis@pitrou.net>
parents: 47473
diff changeset
146 return _res;
31091
3861eb467c29 Ported to Universal Headers 3.4.2. Qd and Qt remain to be done.
Jack Jansen <jack.jansen@cwi.nl>
parents: 31086
diff changeset
147 }
3861eb467c29 Ported to Universal Headers 3.4.2. Qd and Qt remain to be done.
Jack Jansen <jack.jansen@cwi.nl>
parents: 31086
diff changeset
148
3861eb467c29 Ported to Universal Headers 3.4.2. Qd and Qt remain to be done.
Jack Jansen <jack.jansen@cwi.nl>
parents: 31086
diff changeset
149 static PyObject *Launch_LSCopyDisplayNameForURL(PyObject *_self, PyObject *_args)
3861eb467c29 Ported to Universal Headers 3.4.2. Qd and Qt remain to be done.
Jack Jansen <jack.jansen@cwi.nl>
parents: 31086
diff changeset
150 {
61463
fd25030223b0 Untabify C files. Will watch buildbots.
Antoine Pitrou <solipsis@pitrou.net>
parents: 47473
diff changeset
151 PyObject *_res = NULL;
fd25030223b0 Untabify C files. Will watch buildbots.
Antoine Pitrou <solipsis@pitrou.net>
parents: 47473
diff changeset
152 OSStatus _err;
fd25030223b0 Untabify C files. Will watch buildbots.
Antoine Pitrou <solipsis@pitrou.net>
parents: 47473
diff changeset
153 CFURLRef inURL;
fd25030223b0 Untabify C files. Will watch buildbots.
Antoine Pitrou <solipsis@pitrou.net>
parents: 47473
diff changeset
154 CFStringRef outDisplayName;
fd25030223b0 Untabify C files. Will watch buildbots.
Antoine Pitrou <solipsis@pitrou.net>
parents: 47473
diff changeset
155 if (!PyArg_ParseTuple(_args, "O&",
fd25030223b0 Untabify C files. Will watch buildbots.
Antoine Pitrou <solipsis@pitrou.net>
parents: 47473
diff changeset
156 CFURLRefObj_Convert, &inURL))
fd25030223b0 Untabify C files. Will watch buildbots.
Antoine Pitrou <solipsis@pitrou.net>
parents: 47473
diff changeset
157 return NULL;
fd25030223b0 Untabify C files. Will watch buildbots.
Antoine Pitrou <solipsis@pitrou.net>
parents: 47473
diff changeset
158 _err = LSCopyDisplayNameForURL(inURL,
fd25030223b0 Untabify C files. Will watch buildbots.
Antoine Pitrou <solipsis@pitrou.net>
parents: 47473
diff changeset
159 &outDisplayName);
fd25030223b0 Untabify C files. Will watch buildbots.
Antoine Pitrou <solipsis@pitrou.net>
parents: 47473
diff changeset
160 if (_err != noErr) return PyMac_Error(_err);
fd25030223b0 Untabify C files. Will watch buildbots.
Antoine Pitrou <solipsis@pitrou.net>
parents: 47473
diff changeset
161 _res = Py_BuildValue("O&",
fd25030223b0 Untabify C files. Will watch buildbots.
Antoine Pitrou <solipsis@pitrou.net>
parents: 47473
diff changeset
162 CFStringRefObj_New, outDisplayName);
fd25030223b0 Untabify C files. Will watch buildbots.
Antoine Pitrou <solipsis@pitrou.net>
parents: 47473
diff changeset
163 return _res;
31091
3861eb467c29 Ported to Universal Headers 3.4.2. Qd and Qt remain to be done.
Jack Jansen <jack.jansen@cwi.nl>
parents: 31086
diff changeset
164 }
3861eb467c29 Ported to Universal Headers 3.4.2. Qd and Qt remain to be done.
Jack Jansen <jack.jansen@cwi.nl>
parents: 31086
diff changeset
165
3861eb467c29 Ported to Universal Headers 3.4.2. Qd and Qt remain to be done.
Jack Jansen <jack.jansen@cwi.nl>
parents: 31086
diff changeset
166 static PyObject *Launch_LSSetExtensionHiddenForRef(PyObject *_self, PyObject *_args)
3861eb467c29 Ported to Universal Headers 3.4.2. Qd and Qt remain to be done.
Jack Jansen <jack.jansen@cwi.nl>
parents: 31086
diff changeset
167 {
61463
fd25030223b0 Untabify C files. Will watch buildbots.
Antoine Pitrou <solipsis@pitrou.net>
parents: 47473
diff changeset
168 PyObject *_res = NULL;
fd25030223b0 Untabify C files. Will watch buildbots.
Antoine Pitrou <solipsis@pitrou.net>
parents: 47473
diff changeset
169 OSStatus _err;
fd25030223b0 Untabify C files. Will watch buildbots.
Antoine Pitrou <solipsis@pitrou.net>
parents: 47473
diff changeset
170 FSRef inRef;
fd25030223b0 Untabify C files. Will watch buildbots.
Antoine Pitrou <solipsis@pitrou.net>
parents: 47473
diff changeset
171 Boolean inHide;
fd25030223b0 Untabify C files. Will watch buildbots.
Antoine Pitrou <solipsis@pitrou.net>
parents: 47473
diff changeset
172 if (!PyArg_ParseTuple(_args, "O&b",
fd25030223b0 Untabify C files. Will watch buildbots.
Antoine Pitrou <solipsis@pitrou.net>
parents: 47473
diff changeset
173 PyMac_GetFSRef, &inRef,
fd25030223b0 Untabify C files. Will watch buildbots.
Antoine Pitrou <solipsis@pitrou.net>
parents: 47473
diff changeset
174 &inHide))
fd25030223b0 Untabify C files. Will watch buildbots.
Antoine Pitrou <solipsis@pitrou.net>
parents: 47473
diff changeset
175 return NULL;
fd25030223b0 Untabify C files. Will watch buildbots.
Antoine Pitrou <solipsis@pitrou.net>
parents: 47473
diff changeset
176 _err = LSSetExtensionHiddenForRef(&inRef,
fd25030223b0 Untabify C files. Will watch buildbots.
Antoine Pitrou <solipsis@pitrou.net>
parents: 47473
diff changeset
177 inHide);
fd25030223b0 Untabify C files. Will watch buildbots.
Antoine Pitrou <solipsis@pitrou.net>
parents: 47473
diff changeset
178 if (_err != noErr) return PyMac_Error(_err);
fd25030223b0 Untabify C files. Will watch buildbots.
Antoine Pitrou <solipsis@pitrou.net>
parents: 47473
diff changeset
179 Py_INCREF(Py_None);
fd25030223b0 Untabify C files. Will watch buildbots.
Antoine Pitrou <solipsis@pitrou.net>
parents: 47473
diff changeset
180 _res = Py_None;
fd25030223b0 Untabify C files. Will watch buildbots.
Antoine Pitrou <solipsis@pitrou.net>
parents: 47473
diff changeset
181 return _res;
31091
3861eb467c29 Ported to Universal Headers 3.4.2. Qd and Qt remain to be done.
Jack Jansen <jack.jansen@cwi.nl>
parents: 31086
diff changeset
182 }
3861eb467c29 Ported to Universal Headers 3.4.2. Qd and Qt remain to be done.
Jack Jansen <jack.jansen@cwi.nl>
parents: 31086
diff changeset
183
3861eb467c29 Ported to Universal Headers 3.4.2. Qd and Qt remain to be done.
Jack Jansen <jack.jansen@cwi.nl>
parents: 31086
diff changeset
184 static PyObject *Launch_LSSetExtensionHiddenForURL(PyObject *_self, PyObject *_args)
3861eb467c29 Ported to Universal Headers 3.4.2. Qd and Qt remain to be done.
Jack Jansen <jack.jansen@cwi.nl>
parents: 31086
diff changeset
185 {
61463
fd25030223b0 Untabify C files. Will watch buildbots.
Antoine Pitrou <solipsis@pitrou.net>
parents: 47473
diff changeset
186 PyObject *_res = NULL;
fd25030223b0 Untabify C files. Will watch buildbots.
Antoine Pitrou <solipsis@pitrou.net>
parents: 47473
diff changeset
187 OSStatus _err;
fd25030223b0 Untabify C files. Will watch buildbots.
Antoine Pitrou <solipsis@pitrou.net>
parents: 47473
diff changeset
188 CFURLRef inURL;
fd25030223b0 Untabify C files. Will watch buildbots.
Antoine Pitrou <solipsis@pitrou.net>
parents: 47473
diff changeset
189 Boolean inHide;
fd25030223b0 Untabify C files. Will watch buildbots.
Antoine Pitrou <solipsis@pitrou.net>
parents: 47473
diff changeset
190 if (!PyArg_ParseTuple(_args, "O&b",
fd25030223b0 Untabify C files. Will watch buildbots.
Antoine Pitrou <solipsis@pitrou.net>
parents: 47473
diff changeset
191 CFURLRefObj_Convert, &inURL,
fd25030223b0 Untabify C files. Will watch buildbots.
Antoine Pitrou <solipsis@pitrou.net>
parents: 47473
diff changeset
192 &inHide))
fd25030223b0 Untabify C files. Will watch buildbots.
Antoine Pitrou <solipsis@pitrou.net>
parents: 47473
diff changeset
193 return NULL;
fd25030223b0 Untabify C files. Will watch buildbots.
Antoine Pitrou <solipsis@pitrou.net>
parents: 47473
diff changeset
194 _err = LSSetExtensionHiddenForURL(inURL,
fd25030223b0 Untabify C files. Will watch buildbots.
Antoine Pitrou <solipsis@pitrou.net>
parents: 47473
diff changeset
195 inHide);
fd25030223b0 Untabify C files. Will watch buildbots.
Antoine Pitrou <solipsis@pitrou.net>
parents: 47473
diff changeset
196 if (_err != noErr) return PyMac_Error(_err);
fd25030223b0 Untabify C files. Will watch buildbots.
Antoine Pitrou <solipsis@pitrou.net>
parents: 47473
diff changeset
197 Py_INCREF(Py_None);
fd25030223b0 Untabify C files. Will watch buildbots.
Antoine Pitrou <solipsis@pitrou.net>
parents: 47473
diff changeset
198 _res = Py_None;
fd25030223b0 Untabify C files. Will watch buildbots.
Antoine Pitrou <solipsis@pitrou.net>
parents: 47473
diff changeset
199 return _res;
31091
3861eb467c29 Ported to Universal Headers 3.4.2. Qd and Qt remain to be done.
Jack Jansen <jack.jansen@cwi.nl>
parents: 31086
diff changeset
200 }
3861eb467c29 Ported to Universal Headers 3.4.2. Qd and Qt remain to be done.
Jack Jansen <jack.jansen@cwi.nl>
parents: 31086
diff changeset
201
31075
5b515cc90b5a An interface to the LaunchServices API.
Jack Jansen <jack.jansen@cwi.nl>
parents:
diff changeset
202 static PyObject *Launch_LSCopyKindStringForRef(PyObject *_self, PyObject *_args)
5b515cc90b5a An interface to the LaunchServices API.
Jack Jansen <jack.jansen@cwi.nl>
parents:
diff changeset
203 {
61463
fd25030223b0 Untabify C files. Will watch buildbots.
Antoine Pitrou <solipsis@pitrou.net>
parents: 47473
diff changeset
204 PyObject *_res = NULL;
fd25030223b0 Untabify C files. Will watch buildbots.
Antoine Pitrou <solipsis@pitrou.net>
parents: 47473
diff changeset
205 OSStatus _err;
fd25030223b0 Untabify C files. Will watch buildbots.
Antoine Pitrou <solipsis@pitrou.net>
parents: 47473
diff changeset
206 FSRef inFSRef;
fd25030223b0 Untabify C files. Will watch buildbots.
Antoine Pitrou <solipsis@pitrou.net>
parents: 47473
diff changeset
207 CFStringRef outKindString;
fd25030223b0 Untabify C files. Will watch buildbots.
Antoine Pitrou <solipsis@pitrou.net>
parents: 47473
diff changeset
208 if (!PyArg_ParseTuple(_args, "O&",
fd25030223b0 Untabify C files. Will watch buildbots.
Antoine Pitrou <solipsis@pitrou.net>
parents: 47473
diff changeset
209 PyMac_GetFSRef, &inFSRef))
fd25030223b0 Untabify C files. Will watch buildbots.
Antoine Pitrou <solipsis@pitrou.net>
parents: 47473
diff changeset
210 return NULL;
fd25030223b0 Untabify C files. Will watch buildbots.
Antoine Pitrou <solipsis@pitrou.net>
parents: 47473
diff changeset
211 _err = LSCopyKindStringForRef(&inFSRef,
fd25030223b0 Untabify C files. Will watch buildbots.
Antoine Pitrou <solipsis@pitrou.net>
parents: 47473
diff changeset
212 &outKindString);
fd25030223b0 Untabify C files. Will watch buildbots.
Antoine Pitrou <solipsis@pitrou.net>
parents: 47473
diff changeset
213 if (_err != noErr) return PyMac_Error(_err);
fd25030223b0 Untabify C files. Will watch buildbots.
Antoine Pitrou <solipsis@pitrou.net>
parents: 47473
diff changeset
214 _res = Py_BuildValue("O&",
fd25030223b0 Untabify C files. Will watch buildbots.
Antoine Pitrou <solipsis@pitrou.net>
parents: 47473
diff changeset
215 CFStringRefObj_New, outKindString);
fd25030223b0 Untabify C files. Will watch buildbots.
Antoine Pitrou <solipsis@pitrou.net>
parents: 47473
diff changeset
216 return _res;
31075
5b515cc90b5a An interface to the LaunchServices API.
Jack Jansen <jack.jansen@cwi.nl>
parents:
diff changeset
217 }
5b515cc90b5a An interface to the LaunchServices API.
Jack Jansen <jack.jansen@cwi.nl>
parents:
diff changeset
218
5b515cc90b5a An interface to the LaunchServices API.
Jack Jansen <jack.jansen@cwi.nl>
parents:
diff changeset
219 static PyObject *Launch_LSCopyKindStringForURL(PyObject *_self, PyObject *_args)
5b515cc90b5a An interface to the LaunchServices API.
Jack Jansen <jack.jansen@cwi.nl>
parents:
diff changeset
220 {
61463
fd25030223b0 Untabify C files. Will watch buildbots.
Antoine Pitrou <solipsis@pitrou.net>
parents: 47473
diff changeset
221 PyObject *_res = NULL;
fd25030223b0 Untabify C files. Will watch buildbots.
Antoine Pitrou <solipsis@pitrou.net>
parents: 47473
diff changeset
222 OSStatus _err;
fd25030223b0 Untabify C files. Will watch buildbots.
Antoine Pitrou <solipsis@pitrou.net>
parents: 47473
diff changeset
223 CFURLRef inURL;
fd25030223b0 Untabify C files. Will watch buildbots.
Antoine Pitrou <solipsis@pitrou.net>
parents: 47473
diff changeset
224 CFStringRef outKindString;
fd25030223b0 Untabify C files. Will watch buildbots.
Antoine Pitrou <solipsis@pitrou.net>
parents: 47473
diff changeset
225 if (!PyArg_ParseTuple(_args, "O&",
fd25030223b0 Untabify C files. Will watch buildbots.
Antoine Pitrou <solipsis@pitrou.net>
parents: 47473
diff changeset
226 CFURLRefObj_Convert, &inURL))
fd25030223b0 Untabify C files. Will watch buildbots.
Antoine Pitrou <solipsis@pitrou.net>
parents: 47473
diff changeset
227 return NULL;
fd25030223b0 Untabify C files. Will watch buildbots.
Antoine Pitrou <solipsis@pitrou.net>
parents: 47473
diff changeset
228 _err = LSCopyKindStringForURL(inURL,
fd25030223b0 Untabify C files. Will watch buildbots.
Antoine Pitrou <solipsis@pitrou.net>
parents: 47473
diff changeset
229 &outKindString);
fd25030223b0 Untabify C files. Will watch buildbots.
Antoine Pitrou <solipsis@pitrou.net>
parents: 47473
diff changeset
230 if (_err != noErr) return PyMac_Error(_err);
fd25030223b0 Untabify C files. Will watch buildbots.
Antoine Pitrou <solipsis@pitrou.net>
parents: 47473
diff changeset
231 _res = Py_BuildValue("O&",
fd25030223b0 Untabify C files. Will watch buildbots.
Antoine Pitrou <solipsis@pitrou.net>
parents: 47473
diff changeset
232 CFStringRefObj_New, outKindString);
fd25030223b0 Untabify C files. Will watch buildbots.
Antoine Pitrou <solipsis@pitrou.net>
parents: 47473
diff changeset
233 return _res;
31075
5b515cc90b5a An interface to the LaunchServices API.
Jack Jansen <jack.jansen@cwi.nl>
parents:
diff changeset
234 }
5b515cc90b5a An interface to the LaunchServices API.
Jack Jansen <jack.jansen@cwi.nl>
parents:
diff changeset
235
5b515cc90b5a An interface to the LaunchServices API.
Jack Jansen <jack.jansen@cwi.nl>
parents:
diff changeset
236 static PyObject *Launch_LSGetApplicationForItem(PyObject *_self, PyObject *_args)
5b515cc90b5a An interface to the LaunchServices API.
Jack Jansen <jack.jansen@cwi.nl>
parents:
diff changeset
237 {
61463
fd25030223b0 Untabify C files. Will watch buildbots.
Antoine Pitrou <solipsis@pitrou.net>
parents: 47473
diff changeset
238 PyObject *_res = NULL;
fd25030223b0 Untabify C files. Will watch buildbots.
Antoine Pitrou <solipsis@pitrou.net>
parents: 47473
diff changeset
239 OSStatus _err;
fd25030223b0 Untabify C files. Will watch buildbots.
Antoine Pitrou <solipsis@pitrou.net>
parents: 47473
diff changeset
240 FSRef inItemRef;
fd25030223b0 Untabify C files. Will watch buildbots.
Antoine Pitrou <solipsis@pitrou.net>
parents: 47473
diff changeset
241 LSRolesMask inRoleMask;
fd25030223b0 Untabify C files. Will watch buildbots.
Antoine Pitrou <solipsis@pitrou.net>
parents: 47473
diff changeset
242 FSRef outAppRef;
fd25030223b0 Untabify C files. Will watch buildbots.
Antoine Pitrou <solipsis@pitrou.net>
parents: 47473
diff changeset
243 CFURLRef outAppURL;
fd25030223b0 Untabify C files. Will watch buildbots.
Antoine Pitrou <solipsis@pitrou.net>
parents: 47473
diff changeset
244 if (!PyArg_ParseTuple(_args, "O&l",
fd25030223b0 Untabify C files. Will watch buildbots.
Antoine Pitrou <solipsis@pitrou.net>
parents: 47473
diff changeset
245 PyMac_GetFSRef, &inItemRef,
fd25030223b0 Untabify C files. Will watch buildbots.
Antoine Pitrou <solipsis@pitrou.net>
parents: 47473
diff changeset
246 &inRoleMask))
fd25030223b0 Untabify C files. Will watch buildbots.
Antoine Pitrou <solipsis@pitrou.net>
parents: 47473
diff changeset
247 return NULL;
fd25030223b0 Untabify C files. Will watch buildbots.
Antoine Pitrou <solipsis@pitrou.net>
parents: 47473
diff changeset
248 _err = LSGetApplicationForItem(&inItemRef,
fd25030223b0 Untabify C files. Will watch buildbots.
Antoine Pitrou <solipsis@pitrou.net>
parents: 47473
diff changeset
249 inRoleMask,
fd25030223b0 Untabify C files. Will watch buildbots.
Antoine Pitrou <solipsis@pitrou.net>
parents: 47473
diff changeset
250 &outAppRef,
fd25030223b0 Untabify C files. Will watch buildbots.
Antoine Pitrou <solipsis@pitrou.net>
parents: 47473
diff changeset
251 &outAppURL);
fd25030223b0 Untabify C files. Will watch buildbots.
Antoine Pitrou <solipsis@pitrou.net>
parents: 47473
diff changeset
252 if (_err != noErr) return PyMac_Error(_err);
fd25030223b0 Untabify C files. Will watch buildbots.
Antoine Pitrou <solipsis@pitrou.net>
parents: 47473
diff changeset
253 _res = Py_BuildValue("O&O&",
fd25030223b0 Untabify C files. Will watch buildbots.
Antoine Pitrou <solipsis@pitrou.net>
parents: 47473
diff changeset
254 PyMac_BuildFSRef, &outAppRef,
fd25030223b0 Untabify C files. Will watch buildbots.
Antoine Pitrou <solipsis@pitrou.net>
parents: 47473
diff changeset
255 CFURLRefObj_New, outAppURL);
fd25030223b0 Untabify C files. Will watch buildbots.
Antoine Pitrou <solipsis@pitrou.net>
parents: 47473
diff changeset
256 return _res;
31075
5b515cc90b5a An interface to the LaunchServices API.
Jack Jansen <jack.jansen@cwi.nl>
parents:
diff changeset
257 }
5b515cc90b5a An interface to the LaunchServices API.
Jack Jansen <jack.jansen@cwi.nl>
parents:
diff changeset
258
5b515cc90b5a An interface to the LaunchServices API.
Jack Jansen <jack.jansen@cwi.nl>
parents:
diff changeset
259 static PyObject *Launch_LSGetApplicationForInfo(PyObject *_self, PyObject *_args)
5b515cc90b5a An interface to the LaunchServices API.
Jack Jansen <jack.jansen@cwi.nl>
parents:
diff changeset
260 {
61463
fd25030223b0 Untabify C files. Will watch buildbots.
Antoine Pitrou <solipsis@pitrou.net>
parents: 47473
diff changeset
261 PyObject *_res = NULL;
fd25030223b0 Untabify C files. Will watch buildbots.
Antoine Pitrou <solipsis@pitrou.net>
parents: 47473
diff changeset
262 OSStatus _err;
fd25030223b0 Untabify C files. Will watch buildbots.
Antoine Pitrou <solipsis@pitrou.net>
parents: 47473
diff changeset
263 OSType inType;
fd25030223b0 Untabify C files. Will watch buildbots.
Antoine Pitrou <solipsis@pitrou.net>
parents: 47473
diff changeset
264 OSType inCreator;
fd25030223b0 Untabify C files. Will watch buildbots.
Antoine Pitrou <solipsis@pitrou.net>
parents: 47473
diff changeset
265 CFStringRef inExtension;
fd25030223b0 Untabify C files. Will watch buildbots.
Antoine Pitrou <solipsis@pitrou.net>
parents: 47473
diff changeset
266 LSRolesMask inRoleMask;
fd25030223b0 Untabify C files. Will watch buildbots.
Antoine Pitrou <solipsis@pitrou.net>
parents: 47473
diff changeset
267 FSRef outAppRef;
fd25030223b0 Untabify C files. Will watch buildbots.
Antoine Pitrou <solipsis@pitrou.net>
parents: 47473
diff changeset
268 CFURLRef outAppURL;
fd25030223b0 Untabify C files. Will watch buildbots.
Antoine Pitrou <solipsis@pitrou.net>
parents: 47473
diff changeset
269 if (!PyArg_ParseTuple(_args, "O&O&O&l",
fd25030223b0 Untabify C files. Will watch buildbots.
Antoine Pitrou <solipsis@pitrou.net>
parents: 47473
diff changeset
270 PyMac_GetOSType, &inType,
fd25030223b0 Untabify C files. Will watch buildbots.
Antoine Pitrou <solipsis@pitrou.net>
parents: 47473
diff changeset
271 PyMac_GetOSType, &inCreator,
fd25030223b0 Untabify C files. Will watch buildbots.
Antoine Pitrou <solipsis@pitrou.net>
parents: 47473
diff changeset
272 OptCFStringRefObj_Convert, &inExtension,
fd25030223b0 Untabify C files. Will watch buildbots.
Antoine Pitrou <solipsis@pitrou.net>
parents: 47473
diff changeset
273 &inRoleMask))
fd25030223b0 Untabify C files. Will watch buildbots.
Antoine Pitrou <solipsis@pitrou.net>
parents: 47473
diff changeset
274 return NULL;
fd25030223b0 Untabify C files. Will watch buildbots.
Antoine Pitrou <solipsis@pitrou.net>
parents: 47473
diff changeset
275 _err = LSGetApplicationForInfo(inType,
fd25030223b0 Untabify C files. Will watch buildbots.
Antoine Pitrou <solipsis@pitrou.net>
parents: 47473
diff changeset
276 inCreator,
fd25030223b0 Untabify C files. Will watch buildbots.
Antoine Pitrou <solipsis@pitrou.net>
parents: 47473
diff changeset
277 inExtension,
fd25030223b0 Untabify C files. Will watch buildbots.
Antoine Pitrou <solipsis@pitrou.net>
parents: 47473
diff changeset
278 inRoleMask,
fd25030223b0 Untabify C files. Will watch buildbots.
Antoine Pitrou <solipsis@pitrou.net>
parents: 47473
diff changeset
279 &outAppRef,
fd25030223b0 Untabify C files. Will watch buildbots.
Antoine Pitrou <solipsis@pitrou.net>
parents: 47473
diff changeset
280 &outAppURL);
fd25030223b0 Untabify C files. Will watch buildbots.
Antoine Pitrou <solipsis@pitrou.net>
parents: 47473
diff changeset
281 if (_err != noErr) return PyMac_Error(_err);
fd25030223b0 Untabify C files. Will watch buildbots.
Antoine Pitrou <solipsis@pitrou.net>
parents: 47473
diff changeset
282 _res = Py_BuildValue("O&O&",
fd25030223b0 Untabify C files. Will watch buildbots.
Antoine Pitrou <solipsis@pitrou.net>
parents: 47473
diff changeset
283 PyMac_BuildFSRef, &outAppRef,
fd25030223b0 Untabify C files. Will watch buildbots.
Antoine Pitrou <solipsis@pitrou.net>
parents: 47473
diff changeset
284 CFURLRefObj_New, outAppURL);
fd25030223b0 Untabify C files. Will watch buildbots.
Antoine Pitrou <solipsis@pitrou.net>
parents: 47473
diff changeset
285 return _res;
31075
5b515cc90b5a An interface to the LaunchServices API.
Jack Jansen <jack.jansen@cwi.nl>
parents:
diff changeset
286 }
5b515cc90b5a An interface to the LaunchServices API.
Jack Jansen <jack.jansen@cwi.nl>
parents:
diff changeset
287
5b515cc90b5a An interface to the LaunchServices API.
Jack Jansen <jack.jansen@cwi.nl>
parents:
diff changeset
288 static PyObject *Launch_LSGetApplicationForURL(PyObject *_self, PyObject *_args)
5b515cc90b5a An interface to the LaunchServices API.
Jack Jansen <jack.jansen@cwi.nl>
parents:
diff changeset
289 {
61463
fd25030223b0 Untabify C files. Will watch buildbots.
Antoine Pitrou <solipsis@pitrou.net>
parents: 47473
diff changeset
290 PyObject *_res = NULL;
fd25030223b0 Untabify C files. Will watch buildbots.
Antoine Pitrou <solipsis@pitrou.net>
parents: 47473
diff changeset
291 OSStatus _err;
fd25030223b0 Untabify C files. Will watch buildbots.
Antoine Pitrou <solipsis@pitrou.net>
parents: 47473
diff changeset
292 CFURLRef inURL;
fd25030223b0 Untabify C files. Will watch buildbots.
Antoine Pitrou <solipsis@pitrou.net>
parents: 47473
diff changeset
293 LSRolesMask inRoleMask;
fd25030223b0 Untabify C files. Will watch buildbots.
Antoine Pitrou <solipsis@pitrou.net>
parents: 47473
diff changeset
294 FSRef outAppRef;
fd25030223b0 Untabify C files. Will watch buildbots.
Antoine Pitrou <solipsis@pitrou.net>
parents: 47473
diff changeset
295 CFURLRef outAppURL;
fd25030223b0 Untabify C files. Will watch buildbots.
Antoine Pitrou <solipsis@pitrou.net>
parents: 47473
diff changeset
296 if (!PyArg_ParseTuple(_args, "O&l",
fd25030223b0 Untabify C files. Will watch buildbots.
Antoine Pitrou <solipsis@pitrou.net>
parents: 47473
diff changeset
297 CFURLRefObj_Convert, &inURL,
fd25030223b0 Untabify C files. Will watch buildbots.
Antoine Pitrou <solipsis@pitrou.net>
parents: 47473
diff changeset
298 &inRoleMask))
fd25030223b0 Untabify C files. Will watch buildbots.
Antoine Pitrou <solipsis@pitrou.net>
parents: 47473
diff changeset
299 return NULL;
fd25030223b0 Untabify C files. Will watch buildbots.
Antoine Pitrou <solipsis@pitrou.net>
parents: 47473
diff changeset
300 _err = LSGetApplicationForURL(inURL,
fd25030223b0 Untabify C files. Will watch buildbots.
Antoine Pitrou <solipsis@pitrou.net>
parents: 47473
diff changeset
301 inRoleMask,
fd25030223b0 Untabify C files. Will watch buildbots.
Antoine Pitrou <solipsis@pitrou.net>
parents: 47473
diff changeset
302 &outAppRef,
fd25030223b0 Untabify C files. Will watch buildbots.
Antoine Pitrou <solipsis@pitrou.net>
parents: 47473
diff changeset
303 &outAppURL);
fd25030223b0 Untabify C files. Will watch buildbots.
Antoine Pitrou <solipsis@pitrou.net>
parents: 47473
diff changeset
304 if (_err != noErr) return PyMac_Error(_err);
fd25030223b0 Untabify C files. Will watch buildbots.
Antoine Pitrou <solipsis@pitrou.net>
parents: 47473
diff changeset
305 _res = Py_BuildValue("O&O&",
fd25030223b0 Untabify C files. Will watch buildbots.
Antoine Pitrou <solipsis@pitrou.net>
parents: 47473
diff changeset
306 PyMac_BuildFSRef, &outAppRef,
fd25030223b0 Untabify C files. Will watch buildbots.
Antoine Pitrou <solipsis@pitrou.net>
parents: 47473
diff changeset
307 CFURLRefObj_New, outAppURL);
fd25030223b0 Untabify C files. Will watch buildbots.
Antoine Pitrou <solipsis@pitrou.net>
parents: 47473
diff changeset
308 return _res;
31075
5b515cc90b5a An interface to the LaunchServices API.
Jack Jansen <jack.jansen@cwi.nl>
parents:
diff changeset
309 }
5b515cc90b5a An interface to the LaunchServices API.
Jack Jansen <jack.jansen@cwi.nl>
parents:
diff changeset
310
5b515cc90b5a An interface to the LaunchServices API.
Jack Jansen <jack.jansen@cwi.nl>
parents:
diff changeset
311 static PyObject *Launch_LSFindApplicationForInfo(PyObject *_self, PyObject *_args)
5b515cc90b5a An interface to the LaunchServices API.
Jack Jansen <jack.jansen@cwi.nl>
parents:
diff changeset
312 {
61463
fd25030223b0 Untabify C files. Will watch buildbots.
Antoine Pitrou <solipsis@pitrou.net>
parents: 47473
diff changeset
313 PyObject *_res = NULL;
fd25030223b0 Untabify C files. Will watch buildbots.
Antoine Pitrou <solipsis@pitrou.net>
parents: 47473
diff changeset
314 OSStatus _err;
fd25030223b0 Untabify C files. Will watch buildbots.
Antoine Pitrou <solipsis@pitrou.net>
parents: 47473
diff changeset
315 OSType inCreator;
fd25030223b0 Untabify C files. Will watch buildbots.
Antoine Pitrou <solipsis@pitrou.net>
parents: 47473
diff changeset
316 CFStringRef inBundleID;
fd25030223b0 Untabify C files. Will watch buildbots.
Antoine Pitrou <solipsis@pitrou.net>
parents: 47473
diff changeset
317 CFStringRef inName;
fd25030223b0 Untabify C files. Will watch buildbots.
Antoine Pitrou <solipsis@pitrou.net>
parents: 47473
diff changeset
318 FSRef outAppRef;
fd25030223b0 Untabify C files. Will watch buildbots.
Antoine Pitrou <solipsis@pitrou.net>
parents: 47473
diff changeset
319 CFURLRef outAppURL;
fd25030223b0 Untabify C files. Will watch buildbots.
Antoine Pitrou <solipsis@pitrou.net>
parents: 47473
diff changeset
320 if (!PyArg_ParseTuple(_args, "O&O&O&",
fd25030223b0 Untabify C files. Will watch buildbots.
Antoine Pitrou <solipsis@pitrou.net>
parents: 47473
diff changeset
321 PyMac_GetOSType, &inCreator,
fd25030223b0 Untabify C files. Will watch buildbots.
Antoine Pitrou <solipsis@pitrou.net>
parents: 47473
diff changeset
322 OptCFStringRefObj_Convert, &inBundleID,
fd25030223b0 Untabify C files. Will watch buildbots.
Antoine Pitrou <solipsis@pitrou.net>
parents: 47473
diff changeset
323 OptCFStringRefObj_Convert, &inName))
fd25030223b0 Untabify C files. Will watch buildbots.
Antoine Pitrou <solipsis@pitrou.net>
parents: 47473
diff changeset
324 return NULL;
fd25030223b0 Untabify C files. Will watch buildbots.
Antoine Pitrou <solipsis@pitrou.net>
parents: 47473
diff changeset
325 _err = LSFindApplicationForInfo(inCreator,
fd25030223b0 Untabify C files. Will watch buildbots.
Antoine Pitrou <solipsis@pitrou.net>
parents: 47473
diff changeset
326 inBundleID,
fd25030223b0 Untabify C files. Will watch buildbots.
Antoine Pitrou <solipsis@pitrou.net>
parents: 47473
diff changeset
327 inName,
fd25030223b0 Untabify C files. Will watch buildbots.
Antoine Pitrou <solipsis@pitrou.net>
parents: 47473
diff changeset
328 &outAppRef,
fd25030223b0 Untabify C files. Will watch buildbots.
Antoine Pitrou <solipsis@pitrou.net>
parents: 47473
diff changeset
329 &outAppURL);
fd25030223b0 Untabify C files. Will watch buildbots.
Antoine Pitrou <solipsis@pitrou.net>
parents: 47473
diff changeset
330 if (_err != noErr) return PyMac_Error(_err);
fd25030223b0 Untabify C files. Will watch buildbots.
Antoine Pitrou <solipsis@pitrou.net>
parents: 47473
diff changeset
331 _res = Py_BuildValue("O&O&",
fd25030223b0 Untabify C files. Will watch buildbots.
Antoine Pitrou <solipsis@pitrou.net>
parents: 47473
diff changeset
332 PyMac_BuildFSRef, &outAppRef,
fd25030223b0 Untabify C files. Will watch buildbots.
Antoine Pitrou <solipsis@pitrou.net>
parents: 47473
diff changeset
333 CFURLRefObj_New, outAppURL);
fd25030223b0 Untabify C files. Will watch buildbots.
Antoine Pitrou <solipsis@pitrou.net>
parents: 47473
diff changeset
334 return _res;
31075
5b515cc90b5a An interface to the LaunchServices API.
Jack Jansen <jack.jansen@cwi.nl>
parents:
diff changeset
335 }
5b515cc90b5a An interface to the LaunchServices API.
Jack Jansen <jack.jansen@cwi.nl>
parents:
diff changeset
336
5b515cc90b5a An interface to the LaunchServices API.
Jack Jansen <jack.jansen@cwi.nl>
parents:
diff changeset
337 static PyObject *Launch_LSCanRefAcceptItem(PyObject *_self, PyObject *_args)
5b515cc90b5a An interface to the LaunchServices API.
Jack Jansen <jack.jansen@cwi.nl>
parents:
diff changeset
338 {
61463
fd25030223b0 Untabify C files. Will watch buildbots.
Antoine Pitrou <solipsis@pitrou.net>
parents: 47473
diff changeset
339 PyObject *_res = NULL;
fd25030223b0 Untabify C files. Will watch buildbots.
Antoine Pitrou <solipsis@pitrou.net>
parents: 47473
diff changeset
340 OSStatus _err;
fd25030223b0 Untabify C files. Will watch buildbots.
Antoine Pitrou <solipsis@pitrou.net>
parents: 47473
diff changeset
341 FSRef inItemFSRef;
fd25030223b0 Untabify C files. Will watch buildbots.
Antoine Pitrou <solipsis@pitrou.net>
parents: 47473
diff changeset
342 FSRef inTargetRef;
fd25030223b0 Untabify C files. Will watch buildbots.
Antoine Pitrou <solipsis@pitrou.net>
parents: 47473
diff changeset
343 LSRolesMask inRoleMask;
fd25030223b0 Untabify C files. Will watch buildbots.
Antoine Pitrou <solipsis@pitrou.net>
parents: 47473
diff changeset
344 LSAcceptanceFlags inFlags;
fd25030223b0 Untabify C files. Will watch buildbots.
Antoine Pitrou <solipsis@pitrou.net>
parents: 47473
diff changeset
345 Boolean outAcceptsItem;
fd25030223b0 Untabify C files. Will watch buildbots.
Antoine Pitrou <solipsis@pitrou.net>
parents: 47473
diff changeset
346 if (!PyArg_ParseTuple(_args, "O&O&ll",
fd25030223b0 Untabify C files. Will watch buildbots.
Antoine Pitrou <solipsis@pitrou.net>
parents: 47473
diff changeset
347 PyMac_GetFSRef, &inItemFSRef,
fd25030223b0 Untabify C files. Will watch buildbots.
Antoine Pitrou <solipsis@pitrou.net>
parents: 47473
diff changeset
348 PyMac_GetFSRef, &inTargetRef,
fd25030223b0 Untabify C files. Will watch buildbots.
Antoine Pitrou <solipsis@pitrou.net>
parents: 47473
diff changeset
349 &inRoleMask,
fd25030223b0 Untabify C files. Will watch buildbots.
Antoine Pitrou <solipsis@pitrou.net>
parents: 47473
diff changeset
350 &inFlags))
fd25030223b0 Untabify C files. Will watch buildbots.
Antoine Pitrou <solipsis@pitrou.net>
parents: 47473
diff changeset
351 return NULL;
fd25030223b0 Untabify C files. Will watch buildbots.
Antoine Pitrou <solipsis@pitrou.net>
parents: 47473
diff changeset
352 _err = LSCanRefAcceptItem(&inItemFSRef,
fd25030223b0 Untabify C files. Will watch buildbots.
Antoine Pitrou <solipsis@pitrou.net>
parents: 47473
diff changeset
353 &inTargetRef,
fd25030223b0 Untabify C files. Will watch buildbots.
Antoine Pitrou <solipsis@pitrou.net>
parents: 47473
diff changeset
354 inRoleMask,
fd25030223b0 Untabify C files. Will watch buildbots.
Antoine Pitrou <solipsis@pitrou.net>
parents: 47473
diff changeset
355 inFlags,
fd25030223b0 Untabify C files. Will watch buildbots.
Antoine Pitrou <solipsis@pitrou.net>
parents: 47473
diff changeset
356 &outAcceptsItem);
fd25030223b0 Untabify C files. Will watch buildbots.
Antoine Pitrou <solipsis@pitrou.net>
parents: 47473
diff changeset
357 if (_err != noErr) return PyMac_Error(_err);
fd25030223b0 Untabify C files. Will watch buildbots.
Antoine Pitrou <solipsis@pitrou.net>
parents: 47473
diff changeset
358 _res = Py_BuildValue("b",
fd25030223b0 Untabify C files. Will watch buildbots.
Antoine Pitrou <solipsis@pitrou.net>
parents: 47473
diff changeset
359 outAcceptsItem);
fd25030223b0 Untabify C files. Will watch buildbots.
Antoine Pitrou <solipsis@pitrou.net>
parents: 47473
diff changeset
360 return _res;
31075
5b515cc90b5a An interface to the LaunchServices API.
Jack Jansen <jack.jansen@cwi.nl>
parents:
diff changeset
361 }
5b515cc90b5a An interface to the LaunchServices API.
Jack Jansen <jack.jansen@cwi.nl>
parents:
diff changeset
362
5b515cc90b5a An interface to the LaunchServices API.
Jack Jansen <jack.jansen@cwi.nl>
parents:
diff changeset
363 static PyObject *Launch_LSCanURLAcceptURL(PyObject *_self, PyObject *_args)
5b515cc90b5a An interface to the LaunchServices API.
Jack Jansen <jack.jansen@cwi.nl>
parents:
diff changeset
364 {
61463
fd25030223b0 Untabify C files. Will watch buildbots.
Antoine Pitrou <solipsis@pitrou.net>
parents: 47473
diff changeset
365 PyObject *_res = NULL;
fd25030223b0 Untabify C files. Will watch buildbots.
Antoine Pitrou <solipsis@pitrou.net>
parents: 47473
diff changeset
366 OSStatus _err;
fd25030223b0 Untabify C files. Will watch buildbots.
Antoine Pitrou <solipsis@pitrou.net>
parents: 47473
diff changeset
367 CFURLRef inItemURL;
fd25030223b0 Untabify C files. Will watch buildbots.
Antoine Pitrou <solipsis@pitrou.net>
parents: 47473
diff changeset
368 CFURLRef inTargetURL;
fd25030223b0 Untabify C files. Will watch buildbots.
Antoine Pitrou <solipsis@pitrou.net>
parents: 47473
diff changeset
369 LSRolesMask inRoleMask;
fd25030223b0 Untabify C files. Will watch buildbots.
Antoine Pitrou <solipsis@pitrou.net>
parents: 47473
diff changeset
370 LSAcceptanceFlags inFlags;
fd25030223b0 Untabify C files. Will watch buildbots.
Antoine Pitrou <solipsis@pitrou.net>
parents: 47473
diff changeset
371 Boolean outAcceptsItem;
fd25030223b0 Untabify C files. Will watch buildbots.
Antoine Pitrou <solipsis@pitrou.net>
parents: 47473
diff changeset
372 if (!PyArg_ParseTuple(_args, "O&O&ll",
fd25030223b0 Untabify C files. Will watch buildbots.
Antoine Pitrou <solipsis@pitrou.net>
parents: 47473
diff changeset
373 CFURLRefObj_Convert, &inItemURL,
fd25030223b0 Untabify C files. Will watch buildbots.
Antoine Pitrou <solipsis@pitrou.net>
parents: 47473
diff changeset
374 CFURLRefObj_Convert, &inTargetURL,
fd25030223b0 Untabify C files. Will watch buildbots.
Antoine Pitrou <solipsis@pitrou.net>
parents: 47473
diff changeset
375 &inRoleMask,
fd25030223b0 Untabify C files. Will watch buildbots.
Antoine Pitrou <solipsis@pitrou.net>
parents: 47473
diff changeset
376 &inFlags))
fd25030223b0 Untabify C files. Will watch buildbots.
Antoine Pitrou <solipsis@pitrou.net>
parents: 47473
diff changeset
377 return NULL;
fd25030223b0 Untabify C files. Will watch buildbots.
Antoine Pitrou <solipsis@pitrou.net>
parents: 47473
diff changeset
378 _err = LSCanURLAcceptURL(inItemURL,
fd25030223b0 Untabify C files. Will watch buildbots.
Antoine Pitrou <solipsis@pitrou.net>
parents: 47473
diff changeset
379 inTargetURL,
fd25030223b0 Untabify C files. Will watch buildbots.
Antoine Pitrou <solipsis@pitrou.net>
parents: 47473
diff changeset
380 inRoleMask,
fd25030223b0 Untabify C files. Will watch buildbots.
Antoine Pitrou <solipsis@pitrou.net>
parents: 47473
diff changeset
381 inFlags,
fd25030223b0 Untabify C files. Will watch buildbots.
Antoine Pitrou <solipsis@pitrou.net>
parents: 47473
diff changeset
382 &outAcceptsItem);
fd25030223b0 Untabify C files. Will watch buildbots.
Antoine Pitrou <solipsis@pitrou.net>
parents: 47473
diff changeset
383 if (_err != noErr) return PyMac_Error(_err);
fd25030223b0 Untabify C files. Will watch buildbots.
Antoine Pitrou <solipsis@pitrou.net>
parents: 47473
diff changeset
384 _res = Py_BuildValue("b",
fd25030223b0 Untabify C files. Will watch buildbots.
Antoine Pitrou <solipsis@pitrou.net>
parents: 47473
diff changeset
385 outAcceptsItem);
fd25030223b0 Untabify C files. Will watch buildbots.
Antoine Pitrou <solipsis@pitrou.net>
parents: 47473
diff changeset
386 return _res;
31075
5b515cc90b5a An interface to the LaunchServices API.
Jack Jansen <jack.jansen@cwi.nl>
parents:
diff changeset
387 }
5b515cc90b5a An interface to the LaunchServices API.
Jack Jansen <jack.jansen@cwi.nl>
parents:
diff changeset
388
5b515cc90b5a An interface to the LaunchServices API.
Jack Jansen <jack.jansen@cwi.nl>
parents:
diff changeset
389 static PyObject *Launch_LSOpenFSRef(PyObject *_self, PyObject *_args)
5b515cc90b5a An interface to the LaunchServices API.
Jack Jansen <jack.jansen@cwi.nl>
parents:
diff changeset
390 {
61463
fd25030223b0 Untabify C files. Will watch buildbots.
Antoine Pitrou <solipsis@pitrou.net>
parents: 47473
diff changeset
391 PyObject *_res = NULL;
fd25030223b0 Untabify C files. Will watch buildbots.
Antoine Pitrou <solipsis@pitrou.net>
parents: 47473
diff changeset
392 OSStatus _err;
fd25030223b0 Untabify C files. Will watch buildbots.
Antoine Pitrou <solipsis@pitrou.net>
parents: 47473
diff changeset
393 FSRef inRef;
fd25030223b0 Untabify C files. Will watch buildbots.
Antoine Pitrou <solipsis@pitrou.net>
parents: 47473
diff changeset
394 FSRef outLaunchedRef;
fd25030223b0 Untabify C files. Will watch buildbots.
Antoine Pitrou <solipsis@pitrou.net>
parents: 47473
diff changeset
395 if (!PyArg_ParseTuple(_args, "O&",
fd25030223b0 Untabify C files. Will watch buildbots.
Antoine Pitrou <solipsis@pitrou.net>
parents: 47473
diff changeset
396 PyMac_GetFSRef, &inRef))
fd25030223b0 Untabify C files. Will watch buildbots.
Antoine Pitrou <solipsis@pitrou.net>
parents: 47473
diff changeset
397 return NULL;
fd25030223b0 Untabify C files. Will watch buildbots.
Antoine Pitrou <solipsis@pitrou.net>
parents: 47473
diff changeset
398 _err = LSOpenFSRef(&inRef,
fd25030223b0 Untabify C files. Will watch buildbots.
Antoine Pitrou <solipsis@pitrou.net>
parents: 47473
diff changeset
399 &outLaunchedRef);
fd25030223b0 Untabify C files. Will watch buildbots.
Antoine Pitrou <solipsis@pitrou.net>
parents: 47473
diff changeset
400 if (_err != noErr) return PyMac_Error(_err);
fd25030223b0 Untabify C files. Will watch buildbots.
Antoine Pitrou <solipsis@pitrou.net>
parents: 47473
diff changeset
401 _res = Py_BuildValue("O&",
fd25030223b0 Untabify C files. Will watch buildbots.
Antoine Pitrou <solipsis@pitrou.net>
parents: 47473
diff changeset
402 PyMac_BuildFSRef, &outLaunchedRef);
fd25030223b0 Untabify C files. Will watch buildbots.
Antoine Pitrou <solipsis@pitrou.net>
parents: 47473
diff changeset
403 return _res;
31075
5b515cc90b5a An interface to the LaunchServices API.
Jack Jansen <jack.jansen@cwi.nl>
parents:
diff changeset
404 }
5b515cc90b5a An interface to the LaunchServices API.
Jack Jansen <jack.jansen@cwi.nl>
parents:
diff changeset
405
5b515cc90b5a An interface to the LaunchServices API.
Jack Jansen <jack.jansen@cwi.nl>
parents:
diff changeset
406 static PyObject *Launch_LSOpenCFURLRef(PyObject *_self, PyObject *_args)
5b515cc90b5a An interface to the LaunchServices API.
Jack Jansen <jack.jansen@cwi.nl>
parents:
diff changeset
407 {
61463
fd25030223b0 Untabify C files. Will watch buildbots.
Antoine Pitrou <solipsis@pitrou.net>
parents: 47473
diff changeset
408 PyObject *_res = NULL;
fd25030223b0 Untabify C files. Will watch buildbots.
Antoine Pitrou <solipsis@pitrou.net>
parents: 47473
diff changeset
409 OSStatus _err;
fd25030223b0 Untabify C files. Will watch buildbots.
Antoine Pitrou <solipsis@pitrou.net>
parents: 47473
diff changeset
410 CFURLRef inURL;
fd25030223b0 Untabify C files. Will watch buildbots.
Antoine Pitrou <solipsis@pitrou.net>
parents: 47473
diff changeset
411 CFURLRef outLaunchedURL;
fd25030223b0 Untabify C files. Will watch buildbots.
Antoine Pitrou <solipsis@pitrou.net>
parents: 47473
diff changeset
412 if (!PyArg_ParseTuple(_args, "O&",
fd25030223b0 Untabify C files. Will watch buildbots.
Antoine Pitrou <solipsis@pitrou.net>
parents: 47473
diff changeset
413 CFURLRefObj_Convert, &inURL))
fd25030223b0 Untabify C files. Will watch buildbots.
Antoine Pitrou <solipsis@pitrou.net>
parents: 47473
diff changeset
414 return NULL;
fd25030223b0 Untabify C files. Will watch buildbots.
Antoine Pitrou <solipsis@pitrou.net>
parents: 47473
diff changeset
415 _err = LSOpenCFURLRef(inURL,
fd25030223b0 Untabify C files. Will watch buildbots.
Antoine Pitrou <solipsis@pitrou.net>
parents: 47473
diff changeset
416 &outLaunchedURL);
fd25030223b0 Untabify C files. Will watch buildbots.
Antoine Pitrou <solipsis@pitrou.net>
parents: 47473
diff changeset
417 if (_err != noErr) return PyMac_Error(_err);
fd25030223b0 Untabify C files. Will watch buildbots.
Antoine Pitrou <solipsis@pitrou.net>
parents: 47473
diff changeset
418 _res = Py_BuildValue("O&",
fd25030223b0 Untabify C files. Will watch buildbots.
Antoine Pitrou <solipsis@pitrou.net>
parents: 47473
diff changeset
419 CFURLRefObj_New, outLaunchedURL);
fd25030223b0 Untabify C files. Will watch buildbots.
Antoine Pitrou <solipsis@pitrou.net>
parents: 47473
diff changeset
420 return _res;
31075
5b515cc90b5a An interface to the LaunchServices API.
Jack Jansen <jack.jansen@cwi.nl>
parents:
diff changeset
421 }
5b515cc90b5a An interface to the LaunchServices API.
Jack Jansen <jack.jansen@cwi.nl>
parents:
diff changeset
422
5b515cc90b5a An interface to the LaunchServices API.
Jack Jansen <jack.jansen@cwi.nl>
parents:
diff changeset
423 static PyMethodDef Launch_methods[] = {
61463
fd25030223b0 Untabify C files. Will watch buildbots.
Antoine Pitrou <solipsis@pitrou.net>
parents: 47473
diff changeset
424 {"LSCopyItemInfoForRef", (PyCFunction)Launch_LSCopyItemInfoForRef, 1,
fd25030223b0 Untabify C files. Will watch buildbots.
Antoine Pitrou <solipsis@pitrou.net>
parents: 47473
diff changeset
425 PyDoc_STR("(FSRef inItemRef, LSRequestedInfo inWhichInfo) -> (LSItemInfoRecord outItemInfo)")},
fd25030223b0 Untabify C files. Will watch buildbots.
Antoine Pitrou <solipsis@pitrou.net>
parents: 47473
diff changeset
426 {"LSCopyItemInfoForURL", (PyCFunction)Launch_LSCopyItemInfoForURL, 1,
fd25030223b0 Untabify C files. Will watch buildbots.
Antoine Pitrou <solipsis@pitrou.net>
parents: 47473
diff changeset
427 PyDoc_STR("(CFURLRef inURL, LSRequestedInfo inWhichInfo) -> (LSItemInfoRecord outItemInfo)")},
fd25030223b0 Untabify C files. Will watch buildbots.
Antoine Pitrou <solipsis@pitrou.net>
parents: 47473
diff changeset
428 {"LSGetExtensionInfo", (PyCFunction)Launch_LSGetExtensionInfo, 1,
fd25030223b0 Untabify C files. Will watch buildbots.
Antoine Pitrou <solipsis@pitrou.net>
parents: 47473
diff changeset
429 PyDoc_STR("(Buffer inNameLen) -> (UniCharCount outExtStartIndex)")},
fd25030223b0 Untabify C files. Will watch buildbots.
Antoine Pitrou <solipsis@pitrou.net>
parents: 47473
diff changeset
430 {"LSCopyDisplayNameForRef", (PyCFunction)Launch_LSCopyDisplayNameForRef, 1,
fd25030223b0 Untabify C files. Will watch buildbots.
Antoine Pitrou <solipsis@pitrou.net>
parents: 47473
diff changeset
431 PyDoc_STR("(FSRef inRef) -> (CFStringRef outDisplayName)")},
fd25030223b0 Untabify C files. Will watch buildbots.
Antoine Pitrou <solipsis@pitrou.net>
parents: 47473
diff changeset
432 {"LSCopyDisplayNameForURL", (PyCFunction)Launch_LSCopyDisplayNameForURL, 1,
fd25030223b0 Untabify C files. Will watch buildbots.
Antoine Pitrou <solipsis@pitrou.net>
parents: 47473
diff changeset
433 PyDoc_STR("(CFURLRef inURL) -> (CFStringRef outDisplayName)")},
fd25030223b0 Untabify C files. Will watch buildbots.
Antoine Pitrou <solipsis@pitrou.net>
parents: 47473
diff changeset
434 {"LSSetExtensionHiddenForRef", (PyCFunction)Launch_LSSetExtensionHiddenForRef, 1,
fd25030223b0 Untabify C files. Will watch buildbots.
Antoine Pitrou <solipsis@pitrou.net>
parents: 47473
diff changeset
435 PyDoc_STR("(FSRef inRef, Boolean inHide) -> None")},
fd25030223b0 Untabify C files. Will watch buildbots.
Antoine Pitrou <solipsis@pitrou.net>
parents: 47473
diff changeset
436 {"LSSetExtensionHiddenForURL", (PyCFunction)Launch_LSSetExtensionHiddenForURL, 1,
fd25030223b0 Untabify C files. Will watch buildbots.
Antoine Pitrou <solipsis@pitrou.net>
parents: 47473
diff changeset
437 PyDoc_STR("(CFURLRef inURL, Boolean inHide) -> None")},
fd25030223b0 Untabify C files. Will watch buildbots.
Antoine Pitrou <solipsis@pitrou.net>
parents: 47473
diff changeset
438 {"LSCopyKindStringForRef", (PyCFunction)Launch_LSCopyKindStringForRef, 1,
fd25030223b0 Untabify C files. Will watch buildbots.
Antoine Pitrou <solipsis@pitrou.net>
parents: 47473
diff changeset
439 PyDoc_STR("(FSRef inFSRef) -> (CFStringRef outKindString)")},
fd25030223b0 Untabify C files. Will watch buildbots.
Antoine Pitrou <solipsis@pitrou.net>
parents: 47473
diff changeset
440 {"LSCopyKindStringForURL", (PyCFunction)Launch_LSCopyKindStringForURL, 1,
fd25030223b0 Untabify C files. Will watch buildbots.
Antoine Pitrou <solipsis@pitrou.net>
parents: 47473
diff changeset
441 PyDoc_STR("(CFURLRef inURL) -> (CFStringRef outKindString)")},
fd25030223b0 Untabify C files. Will watch buildbots.
Antoine Pitrou <solipsis@pitrou.net>
parents: 47473
diff changeset
442 {"LSGetApplicationForItem", (PyCFunction)Launch_LSGetApplicationForItem, 1,
fd25030223b0 Untabify C files. Will watch buildbots.
Antoine Pitrou <solipsis@pitrou.net>
parents: 47473
diff changeset
443 PyDoc_STR("(FSRef inItemRef, LSRolesMask inRoleMask) -> (FSRef outAppRef, CFURLRef outAppURL)")},
fd25030223b0 Untabify C files. Will watch buildbots.
Antoine Pitrou <solipsis@pitrou.net>
parents: 47473
diff changeset
444 {"LSGetApplicationForInfo", (PyCFunction)Launch_LSGetApplicationForInfo, 1,
fd25030223b0 Untabify C files. Will watch buildbots.
Antoine Pitrou <solipsis@pitrou.net>
parents: 47473
diff changeset
445 PyDoc_STR("(OSType inType, OSType inCreator, CFStringRef inExtension, LSRolesMask inRoleMask) -> (FSRef outAppRef, CFURLRef outAppURL)")},
fd25030223b0 Untabify C files. Will watch buildbots.
Antoine Pitrou <solipsis@pitrou.net>
parents: 47473
diff changeset
446 {"LSGetApplicationForURL", (PyCFunction)Launch_LSGetApplicationForURL, 1,
fd25030223b0 Untabify C files. Will watch buildbots.
Antoine Pitrou <solipsis@pitrou.net>
parents: 47473
diff changeset
447 PyDoc_STR("(CFURLRef inURL, LSRolesMask inRoleMask) -> (FSRef outAppRef, CFURLRef outAppURL)")},
fd25030223b0 Untabify C files. Will watch buildbots.
Antoine Pitrou <solipsis@pitrou.net>
parents: 47473
diff changeset
448 {"LSFindApplicationForInfo", (PyCFunction)Launch_LSFindApplicationForInfo, 1,
fd25030223b0 Untabify C files. Will watch buildbots.
Antoine Pitrou <solipsis@pitrou.net>
parents: 47473
diff changeset
449 PyDoc_STR("(OSType inCreator, CFStringRef inBundleID, CFStringRef inName) -> (FSRef outAppRef, CFURLRef outAppURL)")},
fd25030223b0 Untabify C files. Will watch buildbots.
Antoine Pitrou <solipsis@pitrou.net>
parents: 47473
diff changeset
450 {"LSCanRefAcceptItem", (PyCFunction)Launch_LSCanRefAcceptItem, 1,
fd25030223b0 Untabify C files. Will watch buildbots.
Antoine Pitrou <solipsis@pitrou.net>
parents: 47473
diff changeset
451 PyDoc_STR("(FSRef inItemFSRef, FSRef inTargetRef, LSRolesMask inRoleMask, LSAcceptanceFlags inFlags) -> (Boolean outAcceptsItem)")},
fd25030223b0 Untabify C files. Will watch buildbots.
Antoine Pitrou <solipsis@pitrou.net>
parents: 47473
diff changeset
452 {"LSCanURLAcceptURL", (PyCFunction)Launch_LSCanURLAcceptURL, 1,
fd25030223b0 Untabify C files. Will watch buildbots.
Antoine Pitrou <solipsis@pitrou.net>
parents: 47473
diff changeset
453 PyDoc_STR("(CFURLRef inItemURL, CFURLRef inTargetURL, LSRolesMask inRoleMask, LSAcceptanceFlags inFlags) -> (Boolean outAcceptsItem)")},
fd25030223b0 Untabify C files. Will watch buildbots.
Antoine Pitrou <solipsis@pitrou.net>
parents: 47473
diff changeset
454 {"LSOpenFSRef", (PyCFunction)Launch_LSOpenFSRef, 1,
fd25030223b0 Untabify C files. Will watch buildbots.
Antoine Pitrou <solipsis@pitrou.net>
parents: 47473
diff changeset
455 PyDoc_STR("(FSRef inRef) -> (FSRef outLaunchedRef)")},
fd25030223b0 Untabify C files. Will watch buildbots.
Antoine Pitrou <solipsis@pitrou.net>
parents: 47473
diff changeset
456 {"LSOpenCFURLRef", (PyCFunction)Launch_LSOpenCFURLRef, 1,
fd25030223b0 Untabify C files. Will watch buildbots.
Antoine Pitrou <solipsis@pitrou.net>
parents: 47473
diff changeset
457 PyDoc_STR("(CFURLRef inURL) -> (CFURLRef outLaunchedURL)")},
fd25030223b0 Untabify C files. Will watch buildbots.
Antoine Pitrou <solipsis@pitrou.net>
parents: 47473
diff changeset
458 {NULL, NULL, 0}
31075
5b515cc90b5a An interface to the LaunchServices API.
Jack Jansen <jack.jansen@cwi.nl>
parents:
diff changeset
459 };
5b515cc90b5a An interface to the LaunchServices API.
Jack Jansen <jack.jansen@cwi.nl>
parents:
diff changeset
460
5b515cc90b5a An interface to the LaunchServices API.
Jack Jansen <jack.jansen@cwi.nl>
parents:
diff changeset
461
5b515cc90b5a An interface to the LaunchServices API.
Jack Jansen <jack.jansen@cwi.nl>
parents:
diff changeset
462
5b515cc90b5a An interface to the LaunchServices API.
Jack Jansen <jack.jansen@cwi.nl>
parents:
diff changeset
463
5b515cc90b5a An interface to the LaunchServices API.
Jack Jansen <jack.jansen@cwi.nl>
parents:
diff changeset
464 void init_Launch(void)
5b515cc90b5a An interface to the LaunchServices API.
Jack Jansen <jack.jansen@cwi.nl>
parents:
diff changeset
465 {
61463
fd25030223b0 Untabify C files. Will watch buildbots.
Antoine Pitrou <solipsis@pitrou.net>
parents: 47473
diff changeset
466 PyObject *m;
fd25030223b0 Untabify C files. Will watch buildbots.
Antoine Pitrou <solipsis@pitrou.net>
parents: 47473
diff changeset
467 PyObject *d;
31075
5b515cc90b5a An interface to the LaunchServices API.
Jack Jansen <jack.jansen@cwi.nl>
parents:
diff changeset
468
5b515cc90b5a An interface to the LaunchServices API.
Jack Jansen <jack.jansen@cwi.nl>
parents:
diff changeset
469
5b515cc90b5a An interface to the LaunchServices API.
Jack Jansen <jack.jansen@cwi.nl>
parents:
diff changeset
470
5b515cc90b5a An interface to the LaunchServices API.
Jack Jansen <jack.jansen@cwi.nl>
parents:
diff changeset
471
61463
fd25030223b0 Untabify C files. Will watch buildbots.
Antoine Pitrou <solipsis@pitrou.net>
parents: 47473
diff changeset
472 m = Py_InitModule("_Launch", Launch_methods);
fd25030223b0 Untabify C files. Will watch buildbots.
Antoine Pitrou <solipsis@pitrou.net>
parents: 47473
diff changeset
473 d = PyModule_GetDict(m);
fd25030223b0 Untabify C files. Will watch buildbots.
Antoine Pitrou <solipsis@pitrou.net>
parents: 47473
diff changeset
474 Launch_Error = PyMac_GetOSErrException();
fd25030223b0 Untabify C files. Will watch buildbots.
Antoine Pitrou <solipsis@pitrou.net>
parents: 47473
diff changeset
475 if (Launch_Error == NULL ||
fd25030223b0 Untabify C files. Will watch buildbots.
Antoine Pitrou <solipsis@pitrou.net>
parents: 47473
diff changeset
476 PyDict_SetItemString(d, "Error", Launch_Error) != 0)
fd25030223b0 Untabify C files. Will watch buildbots.
Antoine Pitrou <solipsis@pitrou.net>
parents: 47473
diff changeset
477 return;
31075
5b515cc90b5a An interface to the LaunchServices API.
Jack Jansen <jack.jansen@cwi.nl>
parents:
diff changeset
478 }
5b515cc90b5a An interface to the LaunchServices API.
Jack Jansen <jack.jansen@cwi.nl>
parents:
diff changeset
479
5b515cc90b5a An interface to the LaunchServices API.
Jack Jansen <jack.jansen@cwi.nl>
parents:
diff changeset
480 /* ======================= End module _Launch ======================= */
5b515cc90b5a An interface to the LaunchServices API.
Jack Jansen <jack.jansen@cwi.nl>
parents:
diff changeset
481