Jack Jansen | 94bebc0 | 2001-08-08 13:17:31 +0000 | [diff] [blame] | 1 | /*********************************************************** |
| 2 | Copyright 1991-1997 by Stichting Mathematisch Centrum, Amsterdam, |
| 3 | The Netherlands. |
| 4 | |
| 5 | All Rights Reserved |
| 6 | |
| 7 | Permission to use, copy, modify, and distribute this software and its |
| 8 | documentation for any purpose and without fee is hereby granted, |
| 9 | provided that the above copyright notice appear in all copies and that |
| 10 | both that copyright notice and this permission notice appear in |
| 11 | supporting documentation, and that the names of Stichting Mathematisch |
| 12 | Centrum or CWI not be used in advertising or publicity pertaining to |
| 13 | distribution of the software without specific, written prior permission. |
| 14 | |
| 15 | STICHTING MATHEMATISCH CENTRUM DISCLAIMS ALL WARRANTIES WITH REGARD TO |
| 16 | THIS SOFTWARE, INCLUDING ALL IMPLIED WARRANTIES OF MERCHANTABILITY AND |
| 17 | FITNESS, IN NO EVENT SHALL STICHTING MATHEMATISCH CENTRUM BE LIABLE |
| 18 | FOR ANY SPECIAL, INDIRECT OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES |
| 19 | WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, WHETHER IN AN |
| 20 | ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT |
| 21 | OF OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE. |
| 22 | |
| 23 | ******************************************************************/ |
| 24 | |
| 25 | |
| 26 | #include "Python.h" |
Jack Jansen | 94bebc0 | 2001-08-08 13:17:31 +0000 | [diff] [blame] | 27 | #include "pymactoolbox.h" |
| 28 | |
Jack Jansen | 94bebc0 | 2001-08-08 13:17:31 +0000 | [diff] [blame] | 29 | |
Jack Jansen | 94bebc0 | 2001-08-08 13:17:31 +0000 | [diff] [blame] | 30 | /* Like strerror() but for Mac OS error numbers */ |
| 31 | char *PyMac_StrError(int err) |
| 32 | { |
| 33 | static char buf[256]; |
| 34 | Handle h; |
| 35 | char *str; |
Jack Jansen | dde800e | 2002-11-07 23:07:05 +0000 | [diff] [blame] | 36 | static int errors_loaded; |
Jack Jansen | 94bebc0 | 2001-08-08 13:17:31 +0000 | [diff] [blame] | 37 | |
| 38 | h = GetResource('Estr', err); |
Jack Jansen | dde800e | 2002-11-07 23:07:05 +0000 | [diff] [blame] | 39 | if (!h && !errors_loaded) { |
| 40 | /* |
| 41 | ** Attempt to open the resource file containing the |
| 42 | ** Estr resources. We ignore all errors. We also try |
| 43 | ** this only once. |
| 44 | */ |
Jack Jansen | dde800e | 2002-11-07 23:07:05 +0000 | [diff] [blame] | 45 | PyObject *m, *rv; |
Michael W. Hudson | 5f26dda | 2002-11-09 14:47:18 +0000 | [diff] [blame] | 46 | errors_loaded = 1; |
Jack Jansen | dde800e | 2002-11-07 23:07:05 +0000 | [diff] [blame] | 47 | |
| 48 | m = PyImport_ImportModule("macresource"); |
| 49 | if (!m) { |
| 50 | if (Py_VerboseFlag) |
| 51 | PyErr_Print(); |
| 52 | PyErr_Clear(); |
| 53 | } else { |
| 54 | rv = PyObject_CallMethod(m, "open_error_resource", ""); |
| 55 | if (!rv) { |
| 56 | if (Py_VerboseFlag) |
| 57 | PyErr_Print(); |
| 58 | PyErr_Clear(); |
| 59 | } else { |
| 60 | Py_DECREF(rv); |
| 61 | /* And try again... */ |
| 62 | h = GetResource('Estr', err); |
| 63 | } |
| 64 | } |
| 65 | } |
| 66 | /* |
| 67 | ** Whether the code above succeeded or not, we won't try |
| 68 | ** again. |
| 69 | */ |
| 70 | errors_loaded = 1; |
| 71 | |
Jack Jansen | 94bebc0 | 2001-08-08 13:17:31 +0000 | [diff] [blame] | 72 | if ( h ) { |
| 73 | HLock(h); |
| 74 | str = (char *)*h; |
| 75 | memcpy(buf, str+1, (unsigned char)str[0]); |
| 76 | buf[(unsigned char)str[0]] = '\0'; |
| 77 | HUnlock(h); |
| 78 | ReleaseResource(h); |
| 79 | } else { |
Tim Peters | 22a51ef | 2001-12-04 01:11:32 +0000 | [diff] [blame] | 80 | PyOS_snprintf(buf, sizeof(buf), "Mac OS error code %d", err); |
Jack Jansen | 94bebc0 | 2001-08-08 13:17:31 +0000 | [diff] [blame] | 81 | } |
| 82 | return buf; |
| 83 | } |
| 84 | |
| 85 | /* Exception object shared by all Mac specific modules for Mac OS errors */ |
| 86 | PyObject *PyMac_OSErrException; |
| 87 | |
| 88 | /* Initialize and return PyMac_OSErrException */ |
| 89 | PyObject * |
Jack Jansen | 697842f | 2001-09-10 22:00:39 +0000 | [diff] [blame] | 90 | PyMac_GetOSErrException(void) |
Jack Jansen | 94bebc0 | 2001-08-08 13:17:31 +0000 | [diff] [blame] | 91 | { |
| 92 | if (PyMac_OSErrException == NULL) |
Jack Jansen | 8fce2ef | 2002-10-19 22:02:21 +0000 | [diff] [blame] | 93 | PyMac_OSErrException = PyErr_NewException("MacOS.Error", NULL, NULL); |
Jack Jansen | 94bebc0 | 2001-08-08 13:17:31 +0000 | [diff] [blame] | 94 | return PyMac_OSErrException; |
| 95 | } |
| 96 | |
| 97 | /* Set a MAC-specific error from errno, and return NULL; return None if no error */ |
| 98 | PyObject * |
| 99 | PyErr_Mac(PyObject *eobj, int err) |
| 100 | { |
| 101 | char *msg; |
| 102 | PyObject *v; |
| 103 | |
| 104 | if (err == 0 && !PyErr_Occurred()) { |
| 105 | Py_INCREF(Py_None); |
| 106 | return Py_None; |
| 107 | } |
| 108 | if (err == -1 && PyErr_Occurred()) |
| 109 | return NULL; |
| 110 | msg = PyMac_StrError(err); |
| 111 | v = Py_BuildValue("(is)", err, msg); |
| 112 | PyErr_SetObject(eobj, v); |
| 113 | Py_DECREF(v); |
| 114 | return NULL; |
| 115 | } |
| 116 | |
| 117 | /* Call PyErr_Mac with PyMac_OSErrException */ |
| 118 | PyObject * |
| 119 | PyMac_Error(OSErr err) |
| 120 | { |
| 121 | return PyErr_Mac(PyMac_GetOSErrException(), err); |
| 122 | } |
| 123 | |
Jack Jansen | 697842f | 2001-09-10 22:00:39 +0000 | [diff] [blame] | 124 | |
Jack Jansen | 697842f | 2001-09-10 22:00:39 +0000 | [diff] [blame] | 125 | OSErr |
| 126 | PyMac_GetFullPathname(FSSpec *fss, char *path, int len) |
| 127 | { |
| 128 | FSRef fsr; |
| 129 | OSErr err; |
| 130 | |
| 131 | *path = '\0'; |
| 132 | err = FSpMakeFSRef(fss, &fsr); |
| 133 | if ( err == fnfErr ) { |
| 134 | /* FSSpecs can point to non-existing files, fsrefs can't. */ |
| 135 | FSSpec fss2; |
| 136 | int tocopy; |
| 137 | |
| 138 | err = FSMakeFSSpec(fss->vRefNum, fss->parID, "", &fss2); |
| 139 | if ( err ) return err; |
| 140 | err = FSpMakeFSRef(&fss2, &fsr); |
| 141 | if ( err ) return err; |
| 142 | err = (OSErr)FSRefMakePath(&fsr, path, len-1); |
| 143 | if ( err ) return err; |
| 144 | /* This part is not 100% safe: we append the filename part, but |
| 145 | ** I'm not sure that we don't run afoul of the various 8bit |
| 146 | ** encodings here. Will have to look this up at some point... |
| 147 | */ |
| 148 | strcat(path, "/"); |
| 149 | tocopy = fss->name[0]; |
| 150 | if ( strlen(path) + tocopy >= len ) |
| 151 | tocopy = len - strlen(path) - 1; |
| 152 | if ( tocopy > 0 ) |
| 153 | strncat(path, fss->name+1, tocopy); |
| 154 | } else { |
| 155 | if ( err ) return err; |
| 156 | err = (OSErr)FSRefMakePath(&fsr, path, len); |
| 157 | if ( err ) return err; |
| 158 | } |
| 159 | return 0; |
| 160 | } |
| 161 | |
Jack Jansen | 21ed16a | 2002-08-02 14:11:24 +0000 | [diff] [blame] | 162 | |
| 163 | #ifdef WITH_NEXT_FRAMEWORK |
| 164 | /* |
| 165 | ** In a bundle, find a file "resourceName" of type "resourceType". Return the |
| 166 | ** full pathname in "resourceURLCstr". |
| 167 | */ |
| 168 | static int |
| 169 | locateResourcePy(CFStringRef resourceType, CFStringRef resourceName, char *resourceURLCStr, int length) |
| 170 | { |
| 171 | CFBundleRef mainBundle = NULL; |
| 172 | CFURLRef URL, absoluteURL; |
| 173 | CFStringRef filenameString, filepathString; |
| 174 | CFIndex size, i; |
| 175 | CFArrayRef arrayRef = NULL; |
| 176 | int success = 0; |
| 177 | |
Jack Jansen | 21ed16a | 2002-08-02 14:11:24 +0000 | [diff] [blame] | 178 | CFURLPathStyle thePathStyle = kCFURLPOSIXPathStyle; |
Jack Jansen | 21ed16a | 2002-08-02 14:11:24 +0000 | [diff] [blame] | 179 | |
| 180 | /* Get a reference to our main bundle */ |
| 181 | mainBundle = CFBundleGetMainBundle(); |
| 182 | |
| 183 | /* If we are running inside a bundle, look through it. Otherwise, do nothing. */ |
| 184 | if (mainBundle) { |
| 185 | |
| 186 | /* Look for py files in the main bundle by type */ |
| 187 | arrayRef = CFBundleCopyResourceURLsOfType( mainBundle, |
| 188 | resourceType, |
| 189 | NULL ); |
| 190 | |
| 191 | /* See if there are any filename matches */ |
| 192 | size = CFArrayGetCount(arrayRef); |
| 193 | for (i = 0; i < size; i++) { |
| 194 | URL = CFArrayGetValueAtIndex(arrayRef, i); |
| 195 | filenameString = CFURLCopyLastPathComponent(URL); |
| 196 | if (CFStringCompare(filenameString, resourceName, 0) == kCFCompareEqualTo) { |
| 197 | /* We found a match, get the file's full path */ |
| 198 | absoluteURL = CFURLCopyAbsoluteURL(URL); |
| 199 | filepathString = CFURLCopyFileSystemPath(absoluteURL, thePathStyle); |
| 200 | CFRelease(absoluteURL); |
| 201 | |
| 202 | /* Copy the full path into the caller's character buffer */ |
| 203 | success = CFStringGetCString(filepathString, resourceURLCStr, length, |
| 204 | kCFStringEncodingMacRoman); |
| 205 | |
| 206 | CFRelease(filepathString); |
| 207 | } |
| 208 | CFRelease(filenameString); |
| 209 | } |
| 210 | CFRelease(arrayRef); |
| 211 | } |
| 212 | return success; |
| 213 | } |
| 214 | |
| 215 | /* |
| 216 | ** iff we are running in a .app framework then we could be |
| 217 | ** the main program for an applet. In that case, return the |
| 218 | ** script filename for the applet. |
| 219 | ** Otherwise return NULL. |
| 220 | */ |
| 221 | char * |
| 222 | PyMac_GetAppletScriptFile(void) |
| 223 | { |
| 224 | static char scriptpath[1024]; |
| 225 | |
| 226 | /* First we see whether we have __rawmain__.py and run that if it |
| 227 | ** is there. This is used for applets that want sys.argv to be |
| 228 | ** unix-like: __rawmain__ will construct it (from the initial appleevent) |
| 229 | ** and then call __main__.py. |
| 230 | */ |
| 231 | if (locateResourcePy(CFSTR("py"), CFSTR("__rawmain__.py"), scriptpath, 1024)) { |
| 232 | return scriptpath; |
| 233 | } else if (locateResourcePy(CFSTR("pyc"), CFSTR("__rawmain__.pyc"), scriptpath, 1024)) { |
| 234 | return scriptpath; |
| 235 | } else if (locateResourcePy(CFSTR("py"), CFSTR("__main__.py"), scriptpath, 1024)) { |
| 236 | return scriptpath; |
| 237 | } else if (locateResourcePy(CFSTR("pyc"), CFSTR("__main__.pyc"), scriptpath, 1024)) { |
| 238 | return scriptpath; |
| 239 | } |
| 240 | return NULL; |
| 241 | } |
| 242 | |
| 243 | #endif |
| 244 | |
| 245 | |
Jack Jansen | 94bebc0 | 2001-08-08 13:17:31 +0000 | [diff] [blame] | 246 | /* Convert a 4-char string object argument to an OSType value */ |
| 247 | int |
| 248 | PyMac_GetOSType(PyObject *v, OSType *pr) |
| 249 | { |
| 250 | if (!PyString_Check(v) || PyString_Size(v) != 4) { |
| 251 | PyErr_SetString(PyExc_TypeError, |
| 252 | "OSType arg must be string of 4 chars"); |
| 253 | return 0; |
| 254 | } |
| 255 | memcpy((char *)pr, PyString_AsString(v), 4); |
| 256 | return 1; |
| 257 | } |
| 258 | |
| 259 | /* Convert an OSType value to a 4-char string object */ |
| 260 | PyObject * |
| 261 | PyMac_BuildOSType(OSType t) |
| 262 | { |
| 263 | return PyString_FromStringAndSize((char *)&t, 4); |
| 264 | } |
| 265 | |
| 266 | /* Convert an NumVersion value to a 4-element tuple */ |
| 267 | PyObject * |
| 268 | PyMac_BuildNumVersion(NumVersion t) |
| 269 | { |
| 270 | return Py_BuildValue("(hhhh)", t.majorRev, t.minorAndBugRev, t.stage, t.nonRelRev); |
| 271 | } |
| 272 | |
| 273 | |
| 274 | /* Convert a Python string object to a Str255 */ |
| 275 | int |
| 276 | PyMac_GetStr255(PyObject *v, Str255 pbuf) |
| 277 | { |
| 278 | int len; |
| 279 | if (!PyString_Check(v) || (len = PyString_Size(v)) > 255) { |
| 280 | PyErr_SetString(PyExc_TypeError, |
| 281 | "Str255 arg must be string of at most 255 chars"); |
| 282 | return 0; |
| 283 | } |
| 284 | pbuf[0] = len; |
| 285 | memcpy((char *)(pbuf+1), PyString_AsString(v), len); |
| 286 | return 1; |
| 287 | } |
| 288 | |
| 289 | /* Convert a Str255 to a Python string object */ |
| 290 | PyObject * |
| 291 | PyMac_BuildStr255(Str255 s) |
| 292 | { |
| 293 | if ( s == NULL ) { |
| 294 | PyErr_SetString(PyExc_SystemError, "Str255 pointer is NULL"); |
| 295 | return NULL; |
| 296 | } |
| 297 | return PyString_FromStringAndSize((char *)&s[1], (int)s[0]); |
| 298 | } |
| 299 | |
| 300 | PyObject * |
| 301 | PyMac_BuildOptStr255(Str255 s) |
| 302 | { |
| 303 | if ( s == NULL ) { |
| 304 | Py_INCREF(Py_None); |
| 305 | return Py_None; |
| 306 | } |
| 307 | return PyString_FromStringAndSize((char *)&s[1], (int)s[0]); |
| 308 | } |
| 309 | |
| 310 | |
| 311 | |
| 312 | /* Convert a Python object to a Rect. |
| 313 | The object must be a (left, top, right, bottom) tuple. |
| 314 | (This differs from the order in the struct but is consistent with |
| 315 | the arguments to SetRect(), and also with STDWIN). */ |
| 316 | int |
| 317 | PyMac_GetRect(PyObject *v, Rect *r) |
| 318 | { |
| 319 | return PyArg_Parse(v, "(hhhh)", &r->left, &r->top, &r->right, &r->bottom); |
| 320 | } |
| 321 | |
| 322 | /* Convert a Rect to a Python object */ |
| 323 | PyObject * |
| 324 | PyMac_BuildRect(Rect *r) |
| 325 | { |
| 326 | return Py_BuildValue("(hhhh)", r->left, r->top, r->right, r->bottom); |
| 327 | } |
| 328 | |
| 329 | |
| 330 | /* Convert a Python object to a Point. |
| 331 | The object must be a (h, v) tuple. |
| 332 | (This differs from the order in the struct but is consistent with |
| 333 | the arguments to SetPoint(), and also with STDWIN). */ |
| 334 | int |
| 335 | PyMac_GetPoint(PyObject *v, Point *p) |
| 336 | { |
| 337 | return PyArg_Parse(v, "(hh)", &p->h, &p->v); |
| 338 | } |
| 339 | |
| 340 | /* Convert a Point to a Python object */ |
| 341 | PyObject * |
| 342 | PyMac_BuildPoint(Point p) |
| 343 | { |
| 344 | return Py_BuildValue("(hh)", p.h, p.v); |
| 345 | } |
| 346 | |
| 347 | |
| 348 | /* Convert a Python object to an EventRecord. |
| 349 | The object must be a (what, message, when, (v, h), modifiers) tuple. */ |
| 350 | int |
| 351 | PyMac_GetEventRecord(PyObject *v, EventRecord *e) |
| 352 | { |
Jack Jansen | 84c2b1b | 2003-04-17 20:44:21 +0000 | [diff] [blame] | 353 | return PyArg_Parse(v, "(Hkk(hh)H)", |
Jack Jansen | 94bebc0 | 2001-08-08 13:17:31 +0000 | [diff] [blame] | 354 | &e->what, |
| 355 | &e->message, |
| 356 | &e->when, |
| 357 | &e->where.h, |
| 358 | &e->where.v, |
| 359 | &e->modifiers); |
| 360 | } |
| 361 | |
| 362 | /* Convert a Rect to an EventRecord object */ |
| 363 | PyObject * |
| 364 | PyMac_BuildEventRecord(EventRecord *e) |
| 365 | { |
| 366 | return Py_BuildValue("(hll(hh)h)", |
| 367 | e->what, |
| 368 | e->message, |
| 369 | e->when, |
| 370 | e->where.h, |
| 371 | e->where.v, |
| 372 | e->modifiers); |
| 373 | } |
| 374 | |
| 375 | /* Convert Python object to Fixed */ |
| 376 | int |
| 377 | PyMac_GetFixed(PyObject *v, Fixed *f) |
| 378 | { |
| 379 | double d; |
| 380 | |
| 381 | if( !PyArg_Parse(v, "d", &d)) |
| 382 | return 0; |
| 383 | *f = (Fixed)(d * 0x10000); |
| 384 | return 1; |
| 385 | } |
| 386 | |
Jack Jansen | 06bd323 | 2001-08-27 14:01:05 +0000 | [diff] [blame] | 387 | /* Convert a Fixed to a Python object */ |
Jack Jansen | 94bebc0 | 2001-08-08 13:17:31 +0000 | [diff] [blame] | 388 | PyObject * |
| 389 | PyMac_BuildFixed(Fixed f) |
| 390 | { |
| 391 | double d; |
| 392 | |
| 393 | d = f; |
| 394 | d = d / 0x10000; |
| 395 | return Py_BuildValue("d", d); |
| 396 | } |
| 397 | |
| 398 | /* Convert wide to/from Python int or (hi, lo) tuple. XXXX Should use Python longs */ |
| 399 | int |
| 400 | PyMac_Getwide(PyObject *v, wide *rv) |
| 401 | { |
| 402 | if (PyInt_Check(v)) { |
| 403 | rv->hi = 0; |
| 404 | rv->lo = PyInt_AsLong(v); |
| 405 | if( rv->lo & 0x80000000 ) |
| 406 | rv->hi = -1; |
| 407 | return 1; |
| 408 | } |
Jack Jansen | 84c2b1b | 2003-04-17 20:44:21 +0000 | [diff] [blame] | 409 | return PyArg_Parse(v, "(kk)", &rv->hi, &rv->lo); |
Jack Jansen | 94bebc0 | 2001-08-08 13:17:31 +0000 | [diff] [blame] | 410 | } |
| 411 | |
| 412 | |
| 413 | PyObject * |
| 414 | PyMac_Buildwide(wide *w) |
| 415 | { |
| 416 | if ( (w->hi == 0 && (w->lo & 0x80000000) == 0) || |
| 417 | (w->hi == -1 && (w->lo & 0x80000000) ) ) |
| 418 | return PyInt_FromLong(w->lo); |
| 419 | return Py_BuildValue("(ll)", w->hi, w->lo); |
| 420 | } |
| 421 | |
| 422 | #ifdef USE_TOOLBOX_OBJECT_GLUE |
| 423 | /* |
| 424 | ** Glue together the toolbox objects. |
| 425 | ** |
| 426 | ** Because toolbox modules interdepend on each other, they use each others |
| 427 | ** object types, on MacOSX/MachO this leads to the situation that they |
| 428 | ** cannot be dynamically loaded (or they would all have to be lumped into |
| 429 | ** a single .so, but this would be bad for extensibility). |
| 430 | ** |
| 431 | ** This file defines wrappers for all the _New and _Convert functions, |
| 432 | ** which are the Py_BuildValue and PyArg_ParseTuple helpers. The wrappers |
| 433 | ** check an indirection function pointer, and if it isn't filled in yet |
| 434 | ** they import the appropriate module, whose init routine should fill in |
| 435 | ** the pointer. |
| 436 | */ |
| 437 | |
| 438 | #define GLUE_NEW(object, routinename, module) \ |
| 439 | PyObject *(*PyMacGluePtr_##routinename)(object); \ |
| 440 | \ |
| 441 | PyObject *routinename(object cobj) { \ |
| 442 | if (!PyMacGluePtr_##routinename) { \ |
| 443 | if (!PyImport_ImportModule(module)) return NULL; \ |
| 444 | if (!PyMacGluePtr_##routinename) { \ |
| 445 | PyErr_SetString(PyExc_ImportError, "Module did not provide routine: " module ": " #routinename); \ |
| 446 | return NULL; \ |
| 447 | } \ |
| 448 | } \ |
| 449 | return (*PyMacGluePtr_##routinename)(cobj); \ |
| 450 | } |
| 451 | |
| 452 | #define GLUE_CONVERT(object, routinename, module) \ |
| 453 | int (*PyMacGluePtr_##routinename)(PyObject *, object *); \ |
| 454 | \ |
| 455 | int routinename(PyObject *pyobj, object *cobj) { \ |
| 456 | if (!PyMacGluePtr_##routinename) { \ |
| 457 | if (!PyImport_ImportModule(module)) return NULL; \ |
| 458 | if (!PyMacGluePtr_##routinename) { \ |
| 459 | PyErr_SetString(PyExc_ImportError, "Module did not provide routine: " module ": " #routinename); \ |
| 460 | return NULL; \ |
| 461 | } \ |
| 462 | } \ |
| 463 | return (*PyMacGluePtr_##routinename)(pyobj, cobj); \ |
| 464 | } |
Jack Jansen | fabd00f | 2001-09-01 23:39:58 +0000 | [diff] [blame] | 465 | |
Jack Jansen | ad5e76a | 2003-03-02 23:16:50 +0000 | [diff] [blame] | 466 | GLUE_NEW(FSSpec *, PyMac_BuildFSSpec, "Carbon.File") |
| 467 | GLUE_CONVERT(FSSpec, PyMac_GetFSSpec, "Carbon.File") |
| 468 | GLUE_NEW(FSRef *, PyMac_BuildFSRef, "Carbon.File") |
| 469 | GLUE_CONVERT(FSRef, PyMac_GetFSRef, "Carbon.File") |
Jack Jansen | 94bebc0 | 2001-08-08 13:17:31 +0000 | [diff] [blame] | 470 | |
Jack Jansen | 06bd323 | 2001-08-27 14:01:05 +0000 | [diff] [blame] | 471 | GLUE_NEW(AppleEvent *, AEDesc_New, "Carbon.AE") /* XXXX Why by address? */ |
Jack Jansen | b2a5772 | 2003-01-17 23:11:17 +0000 | [diff] [blame] | 472 | GLUE_NEW(AppleEvent *, AEDesc_NewBorrowed, "Carbon.AE") |
Jack Jansen | 06bd323 | 2001-08-27 14:01:05 +0000 | [diff] [blame] | 473 | GLUE_CONVERT(AppleEvent, AEDesc_Convert, "Carbon.AE") |
Jack Jansen | 94bebc0 | 2001-08-08 13:17:31 +0000 | [diff] [blame] | 474 | |
Jack Jansen | 06bd323 | 2001-08-27 14:01:05 +0000 | [diff] [blame] | 475 | GLUE_NEW(Component, CmpObj_New, "Carbon.Cm") |
| 476 | GLUE_CONVERT(Component, CmpObj_Convert, "Carbon.Cm") |
| 477 | GLUE_NEW(ComponentInstance, CmpInstObj_New, "Carbon.Cm") |
| 478 | GLUE_CONVERT(ComponentInstance, CmpInstObj_Convert, "Carbon.Cm") |
Jack Jansen | 94bebc0 | 2001-08-08 13:17:31 +0000 | [diff] [blame] | 479 | |
Jack Jansen | 06bd323 | 2001-08-27 14:01:05 +0000 | [diff] [blame] | 480 | GLUE_NEW(ControlHandle, CtlObj_New, "Carbon.Ctl") |
| 481 | GLUE_CONVERT(ControlHandle, CtlObj_Convert, "Carbon.Ctl") |
Jack Jansen | 94bebc0 | 2001-08-08 13:17:31 +0000 | [diff] [blame] | 482 | |
Jack Jansen | 06bd323 | 2001-08-27 14:01:05 +0000 | [diff] [blame] | 483 | GLUE_NEW(DialogPtr, DlgObj_New, "Carbon.Dlg") |
| 484 | GLUE_CONVERT(DialogPtr, DlgObj_Convert, "Carbon.Dlg") |
| 485 | GLUE_NEW(DialogPtr, DlgObj_WhichDialog, "Carbon.Dlg") |
Jack Jansen | 94bebc0 | 2001-08-08 13:17:31 +0000 | [diff] [blame] | 486 | |
Jack Jansen | 06bd323 | 2001-08-27 14:01:05 +0000 | [diff] [blame] | 487 | GLUE_NEW(DragReference, DragObj_New, "Carbon.Drag") |
| 488 | GLUE_CONVERT(DragReference, DragObj_Convert, "Carbon.Drag") |
Jack Jansen | 94bebc0 | 2001-08-08 13:17:31 +0000 | [diff] [blame] | 489 | |
Jack Jansen | 06bd323 | 2001-08-27 14:01:05 +0000 | [diff] [blame] | 490 | GLUE_NEW(ListHandle, ListObj_New, "Carbon.List") |
| 491 | GLUE_CONVERT(ListHandle, ListObj_Convert, "Carbon.List") |
Jack Jansen | 94bebc0 | 2001-08-08 13:17:31 +0000 | [diff] [blame] | 492 | |
Jack Jansen | 06bd323 | 2001-08-27 14:01:05 +0000 | [diff] [blame] | 493 | GLUE_NEW(MenuHandle, MenuObj_New, "Carbon.Menu") |
| 494 | GLUE_CONVERT(MenuHandle, MenuObj_Convert, "Carbon.Menu") |
Jack Jansen | 94bebc0 | 2001-08-08 13:17:31 +0000 | [diff] [blame] | 495 | |
Jack Jansen | 06bd323 | 2001-08-27 14:01:05 +0000 | [diff] [blame] | 496 | GLUE_NEW(GrafPtr, GrafObj_New, "Carbon.Qd") |
| 497 | GLUE_CONVERT(GrafPtr, GrafObj_Convert, "Carbon.Qd") |
| 498 | GLUE_NEW(BitMapPtr, BMObj_New, "Carbon.Qd") |
| 499 | GLUE_CONVERT(BitMapPtr, BMObj_Convert, "Carbon.Qd") |
| 500 | GLUE_NEW(RGBColor *, QdRGB_New, "Carbon.Qd") /* XXXX Why? */ |
| 501 | GLUE_CONVERT(RGBColor, QdRGB_Convert, "Carbon.Qd") |
Jack Jansen | 94bebc0 | 2001-08-08 13:17:31 +0000 | [diff] [blame] | 502 | |
Jack Jansen | 06bd323 | 2001-08-27 14:01:05 +0000 | [diff] [blame] | 503 | GLUE_NEW(GWorldPtr, GWorldObj_New, "Carbon.Qdoffs") |
| 504 | GLUE_CONVERT(GWorldPtr, GWorldObj_Convert, "Carbon.Qdoffs") |
Jack Jansen | 94bebc0 | 2001-08-08 13:17:31 +0000 | [diff] [blame] | 505 | |
Jack Jansen | 06bd323 | 2001-08-27 14:01:05 +0000 | [diff] [blame] | 506 | GLUE_NEW(Track, TrackObj_New, "Carbon.Qt") |
| 507 | GLUE_CONVERT(Track, TrackObj_Convert, "Carbon.Qt") |
| 508 | GLUE_NEW(Movie, MovieObj_New, "Carbon.Qt") |
| 509 | GLUE_CONVERT(Movie, MovieObj_Convert, "Carbon.Qt") |
| 510 | GLUE_NEW(MovieController, MovieCtlObj_New, "Carbon.Qt") |
| 511 | GLUE_CONVERT(MovieController, MovieCtlObj_Convert, "Carbon.Qt") |
| 512 | GLUE_NEW(TimeBase, TimeBaseObj_New, "Carbon.Qt") |
| 513 | GLUE_CONVERT(TimeBase, TimeBaseObj_Convert, "Carbon.Qt") |
| 514 | GLUE_NEW(UserData, UserDataObj_New, "Carbon.Qt") |
| 515 | GLUE_CONVERT(UserData, UserDataObj_Convert, "Carbon.Qt") |
| 516 | GLUE_NEW(Media, MediaObj_New, "Carbon.Qt") |
| 517 | GLUE_CONVERT(Media, MediaObj_Convert, "Carbon.Qt") |
Jack Jansen | 94bebc0 | 2001-08-08 13:17:31 +0000 | [diff] [blame] | 518 | |
Jack Jansen | 06bd323 | 2001-08-27 14:01:05 +0000 | [diff] [blame] | 519 | GLUE_NEW(Handle, ResObj_New, "Carbon.Res") |
| 520 | GLUE_CONVERT(Handle, ResObj_Convert, "Carbon.Res") |
| 521 | GLUE_NEW(Handle, OptResObj_New, "Carbon.Res") |
| 522 | GLUE_CONVERT(Handle, OptResObj_Convert, "Carbon.Res") |
Jack Jansen | 94bebc0 | 2001-08-08 13:17:31 +0000 | [diff] [blame] | 523 | |
Jack Jansen | 06bd323 | 2001-08-27 14:01:05 +0000 | [diff] [blame] | 524 | GLUE_NEW(TEHandle, TEObj_New, "Carbon.TE") |
| 525 | GLUE_CONVERT(TEHandle, TEObj_Convert, "Carbon.TE") |
Jack Jansen | 94bebc0 | 2001-08-08 13:17:31 +0000 | [diff] [blame] | 526 | |
Jack Jansen | 06bd323 | 2001-08-27 14:01:05 +0000 | [diff] [blame] | 527 | GLUE_NEW(WindowPtr, WinObj_New, "Carbon.Win") |
| 528 | GLUE_CONVERT(WindowPtr, WinObj_Convert, "Carbon.Win") |
| 529 | GLUE_NEW(WindowPtr, WinObj_WhichWindow, "Carbon.Win") |
Jack Jansen | 94bebc0 | 2001-08-08 13:17:31 +0000 | [diff] [blame] | 530 | |
Jack Jansen | 4eb45e7 | 2003-05-27 21:39:58 +0000 | [diff] [blame] | 531 | GLUE_CONVERT(CFTypeRef, CFObj_Convert, "Carbon.CF") |
| 532 | GLUE_NEW(CFTypeRef, CFObj_New, "Carbon.CF") |
| 533 | |
Jack Jansen | 537a69f | 2001-11-05 14:39:22 +0000 | [diff] [blame] | 534 | GLUE_CONVERT(CFTypeRef, CFTypeRefObj_Convert, "Carbon.CF") |
| 535 | GLUE_NEW(CFTypeRef, CFTypeRefObj_New, "Carbon.CF") |
| 536 | |
| 537 | GLUE_CONVERT(CFStringRef, CFStringRefObj_Convert, "Carbon.CF") |
| 538 | GLUE_NEW(CFStringRef, CFStringRefObj_New, "Carbon.CF") |
| 539 | GLUE_CONVERT(CFMutableStringRef, CFMutableStringRefObj_Convert, "Carbon.CF") |
| 540 | GLUE_NEW(CFMutableStringRef, CFMutableStringRefObj_New, "Carbon.CF") |
| 541 | |
| 542 | GLUE_CONVERT(CFArrayRef, CFArrayRefObj_Convert, "Carbon.CF") |
| 543 | GLUE_NEW(CFArrayRef, CFArrayRefObj_New, "Carbon.CF") |
| 544 | GLUE_CONVERT(CFMutableArrayRef, CFMutableArrayRefObj_Convert, "Carbon.CF") |
| 545 | GLUE_NEW(CFMutableArrayRef, CFMutableArrayRefObj_New, "Carbon.CF") |
| 546 | |
| 547 | GLUE_CONVERT(CFDictionaryRef, CFDictionaryRefObj_Convert, "Carbon.CF") |
| 548 | GLUE_NEW(CFDictionaryRef, CFDictionaryRefObj_New, "Carbon.CF") |
| 549 | GLUE_CONVERT(CFMutableDictionaryRef, CFMutableDictionaryRefObj_Convert, "Carbon.CF") |
| 550 | GLUE_NEW(CFMutableDictionaryRef, CFMutableDictionaryRefObj_New, "Carbon.CF") |
| 551 | |
| 552 | GLUE_CONVERT(CFURLRef, CFURLRefObj_Convert, "Carbon.CF") |
| 553 | GLUE_CONVERT(CFURLRef, OptionalCFURLRefObj_Convert, "Carbon.CF") |
| 554 | GLUE_NEW(CFURLRef, CFURLRefObj_New, "Carbon.CF") |
| 555 | |
Michael W. Hudson | 5f26dda | 2002-11-09 14:47:18 +0000 | [diff] [blame] | 556 | #endif /* USE_TOOLBOX_OBJECT_GLUE */ |