Jack Jansen | e91a29d | 1999-12-16 16:54:55 +0000 | [diff] [blame^] | 1 | /*********************************************************** |
| 2 | Copyright 1991-1995 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 or Corporation for National Research Initiatives or |
| 13 | CNRI not be used in advertising or publicity pertaining to |
| 14 | distribution of the software without specific, written prior |
| 15 | permission. |
| 16 | |
| 17 | While CWI is the initial source for this software, a modified version |
| 18 | is made available by the Corporation for National Research Initiatives |
| 19 | (CNRI) at the Internet address ftp://ftp.python.org. |
| 20 | |
| 21 | STICHTING MATHEMATISCH CENTRUM AND CNRI DISCLAIM ALL WARRANTIES WITH |
| 22 | REGARD TO THIS SOFTWARE, INCLUDING ALL IMPLIED WARRANTIES OF |
| 23 | MERCHANTABILITY AND FITNESS, IN NO EVENT SHALL STICHTING MATHEMATISCH |
| 24 | CENTRUM OR CNRI BE LIABLE FOR ANY SPECIAL, INDIRECT OR CONSEQUENTIAL |
| 25 | DAMAGES OR ANY DAMAGES WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR |
| 26 | PROFITS, WHETHER IN AN ACTION OF CONTRACT, NEGLIGENCE OR OTHER |
| 27 | TORTIOUS ACTION, ARISING OUT OF OR IN CONNECTION WITH THE USE OR |
| 28 | PERFORMANCE OF THIS SOFTWARE. |
| 29 | |
| 30 | ******************************************************************/ |
| 31 | |
| 32 | #include "Python.h" |
| 33 | #include "macglue.h" |
| 34 | #include <Navigation.h> |
| 35 | |
| 36 | /* Exported by AEModule.c: */ |
| 37 | extern PyObject *AEDesc_New(AppleEvent *); |
| 38 | extern int AEDesc_Convert(PyObject *, AppleEvent *); |
| 39 | /* Exported by Resmodule.c */ |
| 40 | extern PyObject *ResObj_New(Handle); |
| 41 | extern int ResObj_Convert(PyObject *, Handle *); |
| 42 | |
| 43 | static PyObject *ErrorObject; |
| 44 | |
| 45 | /* ----------------------------------------------------- */ |
| 46 | static int |
| 47 | filldialogoptions(PyObject *d, |
| 48 | NavDialogOptions *opt, |
| 49 | NavEventUPP *eventProcP, |
| 50 | NavPreviewUPP *previewProcP, |
| 51 | NavObjectFilterUPP *filterProcP, |
| 52 | NavTypeListHandle *typeListP) |
| 53 | { |
| 54 | int pos = 0; |
| 55 | PyObject *key, *value; |
| 56 | char *keystr; |
| 57 | |
| 58 | memset(opt, 0, sizeof(opt)); |
| 59 | if ( eventProcP ) *eventProcP = NULL; |
| 60 | if ( previewProcP ) *previewProcP = NULL; |
| 61 | if ( filterProcP ) *filterProcP = NULL; |
| 62 | if ( typeListP ) *typeListP = NULL; |
| 63 | |
| 64 | while ( PyDict_Next(d, &pos, &key, &value) ) { |
| 65 | if ( !key || !value || !PyString_Check(key) ) { |
| 66 | PyErr_SetString(ErrorObject, "DialogOption has non-string key"); |
| 67 | return 0; |
| 68 | } |
| 69 | keystr = PyString_AsString(key); |
| 70 | if( strcmp(keystr, "version") == 0 ) { |
| 71 | if ( !PyArg_Parse(value, "h", &opt->version) ) |
| 72 | return 0; |
| 73 | } else if( strcmp(keystr, "dialogOptionFlags") == 0 ) { |
| 74 | if ( !PyArg_Parse(value, "l", &opt->dialogOptionFlags) ) |
| 75 | return 0; |
| 76 | } else if( strcmp(keystr, "location") == 0 ) { |
| 77 | if ( !PyArg_Parse(value, "O&", PyMac_GetPoint, &opt->location) ) |
| 78 | return 0; |
| 79 | } else if( strcmp(keystr, "clientName") == 0 ) { |
| 80 | if ( !PyArg_Parse(value, "O&", PyMac_GetStr255, &opt->clientName) ) |
| 81 | return 0; |
| 82 | } else if( strcmp(keystr, "windowTitle") == 0 ) { |
| 83 | if ( !PyArg_Parse(value, "O&", PyMac_GetStr255, &opt->windowTitle) ) |
| 84 | return 0; |
| 85 | } else if( strcmp(keystr, "actionButtonLabel") == 0 ) { |
| 86 | if ( !PyArg_Parse(value, "O&", PyMac_GetStr255, &opt->actionButtonLabel) ) |
| 87 | return 0; |
| 88 | } else if( strcmp(keystr, "cancelButtonLabel") == 0 ) { |
| 89 | if ( !PyArg_Parse(value, "O&", PyMac_GetStr255, &opt->cancelButtonLabel) ) |
| 90 | return 0; |
| 91 | } else if( strcmp(keystr, "savedFileName") == 0 ) { |
| 92 | if ( !PyArg_Parse(value, "O&", PyMac_GetStr255, &opt->savedFileName) ) |
| 93 | return 0; |
| 94 | } else if( strcmp(keystr, "message") == 0 ) { |
| 95 | if ( !PyArg_Parse(value, "O&", PyMac_GetStr255, &opt->message) ) |
| 96 | return 0; |
| 97 | } else if( strcmp(keystr, "preferenceKey") == 0 ) { |
| 98 | if ( !PyArg_Parse(value, "O&", PyMac_GetOSType, &opt->preferenceKey) ) |
| 99 | return 0; |
| 100 | } else if( strcmp(keystr, "popupExtension") == 0 ) { |
| 101 | if ( !PyArg_Parse(value, "O&", ResObj_Convert, &opt->popupExtension) ) |
| 102 | return 0; |
| 103 | } else if( strcmp(keystr, "eventProc") == 0 ) { |
| 104 | PyErr_SetString(ErrorObject, "No callbacks implemented yet"); |
| 105 | return 0; |
| 106 | } else if( strcmp(keystr, "previewProc") == 0 ) { |
| 107 | PyErr_SetString(ErrorObject, "No callbacks implemented yet"); |
| 108 | return 0; |
| 109 | } else if( strcmp(keystr, "filterProc") == 0 ) { |
| 110 | PyErr_SetString(ErrorObject, "No callbacks implemented yet"); |
| 111 | return 0; |
| 112 | } else if( strcmp(keystr, "typeList") == 0 ) { |
| 113 | if ( !PyArg_Parse(value, "O&", ResObj_Convert, typeListP) ) |
| 114 | return 0; |
| 115 | } else { |
| 116 | PyErr_Format(ErrorObject, "Unknown DialogOption key: %s", keystr); |
| 117 | return 0; |
| 118 | } |
| 119 | } |
| 120 | return 1; |
| 121 | } |
| 122 | |
| 123 | /* ----------------------------------------------------- */ |
| 124 | |
| 125 | /* Declarations for objects of type NavReplyRecord */ |
| 126 | |
| 127 | typedef struct { |
| 128 | PyObject_HEAD |
| 129 | NavReplyRecord itself; |
| 130 | } navrrobject; |
| 131 | |
| 132 | staticforward PyTypeObject Navrrtype; |
| 133 | |
| 134 | |
| 135 | |
| 136 | /* ---------------------------------------------------------------- */ |
| 137 | |
| 138 | static struct PyMethodDef navrr_methods[] = { |
| 139 | |
| 140 | {NULL, NULL} /* sentinel */ |
| 141 | }; |
| 142 | |
| 143 | /* ---------- */ |
| 144 | |
| 145 | |
| 146 | static navrrobject * |
| 147 | newnavrrobject(NavReplyRecord *itself) |
| 148 | { |
| 149 | navrrobject *self; |
| 150 | |
| 151 | self = PyObject_NEW(navrrobject, &Navrrtype); |
| 152 | if (self == NULL) |
| 153 | return NULL; |
| 154 | self->itself = *itself; |
| 155 | return self; |
| 156 | } |
| 157 | |
| 158 | |
| 159 | static void |
| 160 | navrr_dealloc(self) |
| 161 | navrrobject *self; |
| 162 | { |
| 163 | NavDisposeReply(&self->itself); |
| 164 | PyMem_DEL(self); |
| 165 | } |
| 166 | |
| 167 | static PyObject * |
| 168 | navrr_getattr(self, name) |
| 169 | navrrobject *self; |
| 170 | char *name; |
| 171 | { |
| 172 | if( strcmp(name, "version") == 0 ) |
| 173 | return Py_BuildValue("h", self->itself.version); |
| 174 | if( strcmp(name, "validRecord") == 0 ) |
| 175 | return Py_BuildValue("l", (long)self->itself.validRecord); |
| 176 | if( strcmp(name, "replacing") == 0 ) |
| 177 | return Py_BuildValue("l", (long)self->itself.replacing); |
| 178 | if( strcmp(name, "isStationery") == 0 ) |
| 179 | return Py_BuildValue("l", (long)self->itself.isStationery); |
| 180 | if( strcmp(name, "translationNeeded") == 0 ) |
| 181 | return Py_BuildValue("l", (long)self->itself.translationNeeded); |
| 182 | if( strcmp(name, "selection") == 0 ) |
| 183 | return AEDesc_New(&self->itself.selection); /* XXXX Is this ok? */ |
| 184 | if( strcmp(name, "fileTranslation") == 0 ) |
| 185 | return ResObj_New((Handle)self->itself.fileTranslation); |
| 186 | |
| 187 | |
| 188 | return Py_FindMethod(navrr_methods, (PyObject *)self, name); |
| 189 | } |
| 190 | |
| 191 | static int |
| 192 | navrr_setattr(self, name, v) |
| 193 | navrrobject *self; |
| 194 | char *name; |
| 195 | PyObject *v; |
| 196 | { |
| 197 | /* Set attribute 'name' to value 'v'. v==NULL means delete */ |
| 198 | |
| 199 | /* XXXX Add your own setattr code here */ |
| 200 | return -1; |
| 201 | } |
| 202 | |
| 203 | static char Navrrtype__doc__[] = |
| 204 | "" |
| 205 | ; |
| 206 | |
| 207 | static PyTypeObject Navrrtype = { |
| 208 | PyObject_HEAD_INIT(&PyType_Type) |
| 209 | 0, /*ob_size*/ |
| 210 | "NavReplyRecord", /*tp_name*/ |
| 211 | sizeof(navrrobject), /*tp_basicsize*/ |
| 212 | 0, /*tp_itemsize*/ |
| 213 | /* methods */ |
| 214 | (destructor)navrr_dealloc, /*tp_dealloc*/ |
| 215 | (printfunc)0, /*tp_print*/ |
| 216 | (getattrfunc)navrr_getattr, /*tp_getattr*/ |
| 217 | (setattrfunc)navrr_setattr, /*tp_setattr*/ |
| 218 | (cmpfunc)0, /*tp_compare*/ |
| 219 | (reprfunc)0, /*tp_repr*/ |
| 220 | 0, /*tp_as_number*/ |
| 221 | 0, /*tp_as_sequence*/ |
| 222 | 0, /*tp_as_mapping*/ |
| 223 | (hashfunc)0, /*tp_hash*/ |
| 224 | (ternaryfunc)0, /*tp_call*/ |
| 225 | (reprfunc)0, /*tp_str*/ |
| 226 | |
| 227 | /* Space for future expansion */ |
| 228 | 0L,0L,0L,0L, |
| 229 | Navrrtype__doc__ /* Documentation string */ |
| 230 | }; |
| 231 | |
| 232 | /* End of code for NavReplyRecord objects */ |
| 233 | |
| 234 | /* ----------------------------------------------------- */ |
| 235 | |
| 236 | static char nav_NavGetFile__doc__[] = |
| 237 | "" |
| 238 | ; |
| 239 | |
| 240 | static PyObject * |
| 241 | nav_NavGetFile(self, args) |
| 242 | PyObject *self; /* Not used */ |
| 243 | PyObject *args; |
| 244 | { |
| 245 | PyObject *dict; |
| 246 | AEDesc *defaultLocation = NULL; |
| 247 | NavReplyRecord reply; |
| 248 | NavDialogOptions dialogOptions; |
| 249 | NavEventUPP eventProc = NULL; |
| 250 | NavPreviewUPP previewProc = NULL; |
| 251 | NavObjectFilterUPP filterProc = NULL; |
| 252 | NavTypeListHandle typeList = NULL; |
| 253 | OSErr err; |
| 254 | |
| 255 | if (!PyArg_ParseTuple(args, "O!", &PyDict_Type, &dict)) |
| 256 | return NULL; |
| 257 | if (!filldialogoptions(dict, &dialogOptions, &eventProc, &previewProc, &filterProc, &typeList)) |
| 258 | return NULL; |
| 259 | err = NavGetFile(defaultLocation, &reply, &dialogOptions, |
| 260 | eventProc, previewProc, filterProc, typeList, (void *)dict); |
| 261 | if ( err ) { |
| 262 | PyMac_StrError(err); |
| 263 | return NULL; |
| 264 | } |
| 265 | return (PyObject *)newnavrrobject(&reply); |
| 266 | } |
| 267 | |
| 268 | static char nav_NavPutFile__doc__[] = |
| 269 | "" |
| 270 | ; |
| 271 | |
| 272 | static PyObject * |
| 273 | nav_NavPutFile(self, args) |
| 274 | PyObject *self; /* Not used */ |
| 275 | PyObject *args; |
| 276 | { |
| 277 | |
| 278 | if (!PyArg_ParseTuple(args, "")) |
| 279 | return NULL; |
| 280 | Py_INCREF(Py_None); |
| 281 | return Py_None; |
| 282 | } |
| 283 | |
| 284 | static char nav_NavAskSaveChanges__doc__[] = |
| 285 | "" |
| 286 | ; |
| 287 | |
| 288 | static PyObject * |
| 289 | nav_NavAskSaveChanges(self, args) |
| 290 | PyObject *self; /* Not used */ |
| 291 | PyObject *args; |
| 292 | { |
| 293 | |
| 294 | if (!PyArg_ParseTuple(args, "")) |
| 295 | return NULL; |
| 296 | Py_INCREF(Py_None); |
| 297 | return Py_None; |
| 298 | } |
| 299 | |
| 300 | static char nav_NavCustomAskSaveChanges__doc__[] = |
| 301 | "" |
| 302 | ; |
| 303 | |
| 304 | static PyObject * |
| 305 | nav_NavCustomAskSaveChanges(self, args) |
| 306 | PyObject *self; /* Not used */ |
| 307 | PyObject *args; |
| 308 | { |
| 309 | |
| 310 | if (!PyArg_ParseTuple(args, "")) |
| 311 | return NULL; |
| 312 | Py_INCREF(Py_None); |
| 313 | return Py_None; |
| 314 | } |
| 315 | |
| 316 | static char nav_NavAskDiscardChanges__doc__[] = |
| 317 | "" |
| 318 | ; |
| 319 | |
| 320 | static PyObject * |
| 321 | nav_NavAskDiscardChanges(self, args) |
| 322 | PyObject *self; /* Not used */ |
| 323 | PyObject *args; |
| 324 | { |
| 325 | |
| 326 | if (!PyArg_ParseTuple(args, "")) |
| 327 | return NULL; |
| 328 | Py_INCREF(Py_None); |
| 329 | return Py_None; |
| 330 | } |
| 331 | |
| 332 | static char nav_NavChooseFile__doc__[] = |
| 333 | "" |
| 334 | ; |
| 335 | |
| 336 | static PyObject * |
| 337 | nav_NavChooseFile(self, args) |
| 338 | PyObject *self; /* Not used */ |
| 339 | PyObject *args; |
| 340 | { |
| 341 | |
| 342 | if (!PyArg_ParseTuple(args, "")) |
| 343 | return NULL; |
| 344 | Py_INCREF(Py_None); |
| 345 | return Py_None; |
| 346 | } |
| 347 | |
| 348 | static char nav_NavChooseFolder__doc__[] = |
| 349 | "" |
| 350 | ; |
| 351 | |
| 352 | static PyObject * |
| 353 | nav_NavChooseFolder(self, args) |
| 354 | PyObject *self; /* Not used */ |
| 355 | PyObject *args; |
| 356 | { |
| 357 | |
| 358 | if (!PyArg_ParseTuple(args, "")) |
| 359 | return NULL; |
| 360 | Py_INCREF(Py_None); |
| 361 | return Py_None; |
| 362 | } |
| 363 | |
| 364 | static char nav_NavChooseVolume__doc__[] = |
| 365 | "" |
| 366 | ; |
| 367 | |
| 368 | static PyObject * |
| 369 | nav_NavChooseVolume(self, args) |
| 370 | PyObject *self; /* Not used */ |
| 371 | PyObject *args; |
| 372 | { |
| 373 | |
| 374 | if (!PyArg_ParseTuple(args, "")) |
| 375 | return NULL; |
| 376 | Py_INCREF(Py_None); |
| 377 | return Py_None; |
| 378 | } |
| 379 | |
| 380 | static char nav_NavChooseObject__doc__[] = |
| 381 | "" |
| 382 | ; |
| 383 | |
| 384 | static PyObject * |
| 385 | nav_NavChooseObject(self, args) |
| 386 | PyObject *self; /* Not used */ |
| 387 | PyObject *args; |
| 388 | { |
| 389 | |
| 390 | if (!PyArg_ParseTuple(args, "")) |
| 391 | return NULL; |
| 392 | Py_INCREF(Py_None); |
| 393 | return Py_None; |
| 394 | } |
| 395 | |
| 396 | static char nav_NavNewFolder__doc__[] = |
| 397 | "" |
| 398 | ; |
| 399 | |
| 400 | static PyObject * |
| 401 | nav_NavNewFolder(self, args) |
| 402 | PyObject *self; /* Not used */ |
| 403 | PyObject *args; |
| 404 | { |
| 405 | |
| 406 | if (!PyArg_ParseTuple(args, "")) |
| 407 | return NULL; |
| 408 | Py_INCREF(Py_None); |
| 409 | return Py_None; |
| 410 | } |
| 411 | |
| 412 | static char nav_NavTranslateFile__doc__[] = |
| 413 | "" |
| 414 | ; |
| 415 | |
| 416 | static PyObject * |
| 417 | nav_NavTranslateFile(self, args) |
| 418 | PyObject *self; /* Not used */ |
| 419 | PyObject *args; |
| 420 | { |
| 421 | |
| 422 | if (!PyArg_ParseTuple(args, "")) |
| 423 | return NULL; |
| 424 | Py_INCREF(Py_None); |
| 425 | return Py_None; |
| 426 | } |
| 427 | |
| 428 | static char nav_NavCompleteSave__doc__[] = |
| 429 | "" |
| 430 | ; |
| 431 | |
| 432 | static PyObject * |
| 433 | nav_NavCompleteSave(self, args) |
| 434 | PyObject *self; /* Not used */ |
| 435 | PyObject *args; |
| 436 | { |
| 437 | |
| 438 | if (!PyArg_ParseTuple(args, "")) |
| 439 | return NULL; |
| 440 | Py_INCREF(Py_None); |
| 441 | return Py_None; |
| 442 | } |
| 443 | |
| 444 | static char nav_NavCustomControl__doc__[] = |
| 445 | "" |
| 446 | ; |
| 447 | |
| 448 | static PyObject * |
| 449 | nav_NavCustomControl(self, args) |
| 450 | PyObject *self; /* Not used */ |
| 451 | PyObject *args; |
| 452 | { |
| 453 | |
| 454 | if (!PyArg_ParseTuple(args, "")) |
| 455 | return NULL; |
| 456 | Py_INCREF(Py_None); |
| 457 | return Py_None; |
| 458 | } |
| 459 | |
| 460 | static char nav_NavServicesCanRun__doc__[] = |
| 461 | "" |
| 462 | ; |
| 463 | |
| 464 | static PyObject * |
| 465 | nav_NavServicesCanRun(self, args) |
| 466 | PyObject *self; /* Not used */ |
| 467 | PyObject *args; |
| 468 | { |
| 469 | Boolean rv; |
| 470 | if (!PyArg_ParseTuple(args, "")) |
| 471 | return NULL; |
| 472 | rv = NavServicesCanRun(); |
| 473 | return Py_BuildValue("l", (long)rv); |
| 474 | } |
| 475 | |
| 476 | static char nav_NavServicesAvailable__doc__[] = |
| 477 | "" |
| 478 | ; |
| 479 | |
| 480 | static PyObject * |
| 481 | nav_NavServicesAvailable(self, args) |
| 482 | PyObject *self; /* Not used */ |
| 483 | PyObject *args; |
| 484 | { |
| 485 | Boolean rv; |
| 486 | |
| 487 | if (!PyArg_ParseTuple(args, "")) |
| 488 | return NULL; |
| 489 | rv = NavServicesAvailable(); |
| 490 | return Py_BuildValue("l", (long)rv); |
| 491 | } |
| 492 | /* XX */ |
| 493 | static char nav_NavLoad__doc__[] = |
| 494 | "" |
| 495 | ; |
| 496 | |
| 497 | static PyObject * |
| 498 | nav_NavLoad(self, args) |
| 499 | PyObject *self; /* Not used */ |
| 500 | PyObject *args; |
| 501 | { |
| 502 | |
| 503 | if (!PyArg_ParseTuple(args, "")) |
| 504 | return NULL; |
| 505 | NavLoad(); |
| 506 | Py_INCREF(Py_None); |
| 507 | return Py_None; |
| 508 | } |
| 509 | |
| 510 | static char nav_NavUnload__doc__[] = |
| 511 | "" |
| 512 | ; |
| 513 | |
| 514 | static PyObject * |
| 515 | nav_NavUnload(self, args) |
| 516 | PyObject *self; /* Not used */ |
| 517 | PyObject *args; |
| 518 | { |
| 519 | |
| 520 | if (!PyArg_ParseTuple(args, "")) |
| 521 | return NULL; |
| 522 | NavUnload(); |
| 523 | Py_INCREF(Py_None); |
| 524 | return Py_None; |
| 525 | } |
| 526 | |
| 527 | static char nav_NavLibraryVersion__doc__[] = |
| 528 | "" |
| 529 | ; |
| 530 | |
| 531 | static PyObject * |
| 532 | nav_NavLibraryVersion(self, args) |
| 533 | PyObject *self; /* Not used */ |
| 534 | PyObject *args; |
| 535 | { |
| 536 | UInt32 rv; |
| 537 | |
| 538 | if (!PyArg_ParseTuple(args, "")) |
| 539 | return NULL; |
| 540 | rv = NavLibraryVersion(); |
| 541 | return Py_BuildValue("l", (long)rv); |
| 542 | } |
| 543 | |
| 544 | #ifdef notyet |
| 545 | static char nav_NavGetDefaultDialogOptions__doc__[] = |
| 546 | "" |
| 547 | ; |
| 548 | |
| 549 | static PyObject * |
| 550 | nav_NavGetDefaultDialogOptions(self, args) |
| 551 | PyObject *self; /* Not used */ |
| 552 | PyObject *args; |
| 553 | { |
| 554 | |
| 555 | if (!PyArg_ParseTuple(args, "")) |
| 556 | return NULL; |
| 557 | Py_INCREF(Py_None); |
| 558 | return Py_None; |
| 559 | } |
| 560 | #endif |
| 561 | |
| 562 | |
| 563 | /* List of methods defined in the module */ |
| 564 | |
| 565 | static struct PyMethodDef nav_methods[] = { |
| 566 | {"NavGetFile", (PyCFunction)nav_NavGetFile, METH_VARARGS, nav_NavGetFile__doc__}, |
| 567 | {"NavPutFile", (PyCFunction)nav_NavPutFile, METH_VARARGS, nav_NavPutFile__doc__}, |
| 568 | {"NavAskSaveChanges", (PyCFunction)nav_NavAskSaveChanges, METH_VARARGS, nav_NavAskSaveChanges__doc__}, |
| 569 | {"NavCustomAskSaveChanges", (PyCFunction)nav_NavCustomAskSaveChanges, METH_VARARGS, nav_NavCustomAskSaveChanges__doc__}, |
| 570 | {"NavAskDiscardChanges", (PyCFunction)nav_NavAskDiscardChanges, METH_VARARGS, nav_NavAskDiscardChanges__doc__}, |
| 571 | {"NavChooseFile", (PyCFunction)nav_NavChooseFile, METH_VARARGS, nav_NavChooseFile__doc__}, |
| 572 | {"NavChooseFolder", (PyCFunction)nav_NavChooseFolder, METH_VARARGS, nav_NavChooseFolder__doc__}, |
| 573 | {"NavChooseVolume", (PyCFunction)nav_NavChooseVolume, METH_VARARGS, nav_NavChooseVolume__doc__}, |
| 574 | {"NavChooseObject", (PyCFunction)nav_NavChooseObject, METH_VARARGS, nav_NavChooseObject__doc__}, |
| 575 | {"NavNewFolder", (PyCFunction)nav_NavNewFolder, METH_VARARGS, nav_NavNewFolder__doc__}, |
| 576 | {"NavTranslateFile", (PyCFunction)nav_NavTranslateFile, METH_VARARGS, nav_NavTranslateFile__doc__}, |
| 577 | {"NavCompleteSave", (PyCFunction)nav_NavCompleteSave, METH_VARARGS, nav_NavCompleteSave__doc__}, |
| 578 | {"NavCustomControl", (PyCFunction)nav_NavCustomControl, METH_VARARGS, nav_NavCustomControl__doc__}, |
| 579 | {"NavServicesCanRun", (PyCFunction)nav_NavServicesCanRun, METH_VARARGS, nav_NavServicesCanRun__doc__}, |
| 580 | {"NavServicesAvailable", (PyCFunction)nav_NavServicesAvailable, METH_VARARGS, nav_NavServicesAvailable__doc__}, |
| 581 | {"NavLoad", (PyCFunction)nav_NavLoad, METH_VARARGS, nav_NavLoad__doc__}, |
| 582 | {"NavUnload", (PyCFunction)nav_NavUnload, METH_VARARGS, nav_NavUnload__doc__}, |
| 583 | {"NavLibraryVersion", (PyCFunction)nav_NavLibraryVersion, METH_VARARGS, nav_NavLibraryVersion__doc__}, |
| 584 | #ifdef notdef |
| 585 | {"NavGetDefaultDialogOptions", (PyCFunction)nav_NavGetDefaultDialogOptions, METH_VARARGS, nav_NavGetDefaultDialogOptions__doc__}, |
| 586 | #endif |
| 587 | {NULL, (PyCFunction)NULL, 0, NULL} /* sentinel */ |
| 588 | }; |
| 589 | |
| 590 | |
| 591 | /* Initialization function for the module (*must* be called initNav) */ |
| 592 | |
| 593 | static char Nav_module_documentation[] = |
| 594 | "" |
| 595 | ; |
| 596 | |
| 597 | void |
| 598 | initNav() |
| 599 | { |
| 600 | PyObject *m, *d; |
| 601 | |
| 602 | /* Create the module and add the functions */ |
| 603 | m = Py_InitModule4("Nav", nav_methods, |
| 604 | Nav_module_documentation, |
| 605 | (PyObject*)NULL,PYTHON_API_VERSION); |
| 606 | |
| 607 | /* Add some symbolic constants to the module */ |
| 608 | d = PyModule_GetDict(m); |
| 609 | ErrorObject = PyString_FromString("Nav.error"); |
| 610 | PyDict_SetItemString(d, "error", ErrorObject); |
| 611 | |
| 612 | /* XXXX Add constants here */ |
| 613 | |
| 614 | /* Check for errors */ |
| 615 | if (PyErr_Occurred()) |
| 616 | Py_FatalError("can't initialize module Nav"); |
| 617 | } |
| 618 | |