Mercurial > cpython-lru_cache-weakref
comparison Mac/Python/macmain.c @ 12593:eaee924efb19 legacy-trunk
Removed string-exception preference, added tabcheck and NavService preference, upped version number.
| author | Jack Jansen <jack.jansen@cwi.nl> |
|---|---|
| date | Fri, 05 May 2000 23:11:14 +0000 |
| parents | 51c0c3b6d919 |
| children | c2a0f2a81fa8 |
comparison
equal
deleted
inserted
replaced
| 12592:76b3399b364c | 12593:eaee924efb19 |
|---|---|
| 147 SET_OPT_ITEM(OPT_OPTIMIZE, optimize); | 147 SET_OPT_ITEM(OPT_OPTIMIZE, optimize); |
| 148 SET_OPT_ITEM(OPT_UNBUFFERED, unbuffered); | 148 SET_OPT_ITEM(OPT_UNBUFFERED, unbuffered); |
| 149 SET_OPT_ITEM(OPT_DEBUGGING, debugging); | 149 SET_OPT_ITEM(OPT_DEBUGGING, debugging); |
| 150 SET_OPT_ITEM(OPT_KEEPNORMAL, keep_normal); | 150 SET_OPT_ITEM(OPT_KEEPNORMAL, keep_normal); |
| 151 SET_OPT_ITEM(OPT_KEEPERROR, keep_error); | 151 SET_OPT_ITEM(OPT_KEEPERROR, keep_error); |
| 152 SET_OPT_ITEM(OPT_OLDEXC, oldexc); | 152 SET_OPT_ITEM(OPT_TABWARN, tabwarn); |
| 153 SET_OPT_ITEM(OPT_NOSITE, nosite); | 153 SET_OPT_ITEM(OPT_NOSITE, nosite); |
| 154 SET_OPT_ITEM(OPT_NONAVSERV, nonavservice); | |
| 154 /* The rest are not settable interactively */ | 155 /* The rest are not settable interactively */ |
| 155 | 156 |
| 156 #undef SET_OPT_ITEM | 157 #undef SET_OPT_ITEM |
| 157 | 158 |
| 158 while (1) { | 159 while (1) { |
| 197 OPT_ITEM(OPT_OPTIMIZE, optimize); | 198 OPT_ITEM(OPT_OPTIMIZE, optimize); |
| 198 OPT_ITEM(OPT_UNBUFFERED, unbuffered); | 199 OPT_ITEM(OPT_UNBUFFERED, unbuffered); |
| 199 OPT_ITEM(OPT_DEBUGGING, debugging); | 200 OPT_ITEM(OPT_DEBUGGING, debugging); |
| 200 OPT_ITEM(OPT_KEEPNORMAL, keep_normal); | 201 OPT_ITEM(OPT_KEEPNORMAL, keep_normal); |
| 201 OPT_ITEM(OPT_KEEPERROR, keep_error); | 202 OPT_ITEM(OPT_KEEPERROR, keep_error); |
| 202 OPT_ITEM(OPT_OLDEXC, oldexc); | 203 OPT_ITEM(OPT_TABWARN, tabwarn); |
| 203 OPT_ITEM(OPT_NOSITE, nosite); | 204 OPT_ITEM(OPT_NOSITE, nosite); |
| 205 OPT_ITEM(OPT_NONAVSERV, nonavservice); | |
| 204 | 206 |
| 205 #undef OPT_ITEM | 207 #undef OPT_ITEM |
| 206 } | 208 } |
| 207 DisposeDialog(dialog); | 209 DisposeDialog(dialog); |
| 208 } | 210 } |
| 264 Py_VerboseFlag = options.verbose; | 266 Py_VerboseFlag = options.verbose; |
| 265 /* Py_SuppressPrintingFlag = options.suppress_print; */ | 267 /* Py_SuppressPrintingFlag = options.suppress_print; */ |
| 266 Py_OptimizeFlag = options.optimize; | 268 Py_OptimizeFlag = options.optimize; |
| 267 Py_DebugFlag = options.debugging; | 269 Py_DebugFlag = options.debugging; |
| 268 Py_NoSiteFlag = options.nosite; | 270 Py_NoSiteFlag = options.nosite; |
| 269 Py_UseClassExceptionsFlag = !(options.oldexc); | 271 Py_TabcheckFlag = options.tabwarn; |
| 270 if ( options.noargs ) { | 272 if ( options.noargs ) { |
| 271 /* don't process events at all without the scripts permission */ | 273 /* don't process events at all without the scripts permission */ |
| 272 PyMacSchedParams scp; | 274 PyMacSchedParams scp; |
| 273 | 275 |
| 274 PyMac_GetSchedParams(&scp); | 276 PyMac_GetSchedParams(&scp); |
| 311 if (options.inspect && isatty((int)fileno(stdin))) | 313 if (options.inspect && isatty((int)fileno(stdin))) |
| 312 sts = PyRun_AnyFile(stdin, "<stdin>") != 0; | 314 sts = PyRun_AnyFile(stdin, "<stdin>") != 0; |
| 313 return sts; | 315 return sts; |
| 314 } | 316 } |
| 315 | 317 |
| 318 /* | |
| 319 ** Import the macfsn module, which will override the Standard File | |
| 320 ** calls in the macfs builtin module by Navigation Services versions, | |
| 321 ** if available on this machine. | |
| 322 */ | |
| 323 static void | |
| 324 PyMac_InstallNavServicesForSF() | |
| 325 { | |
| 326 if ( !options.nonavservice ) { | |
| 327 PyObject *m = PyImport_ImportModule("macfsn"); | |
| 328 | |
| 329 if ( m == NULL ) { | |
| 330 PySys_WriteStderr("'import macfsn' failed; "); | |
| 331 if (Py_VerboseFlag) { | |
| 332 PySys_WriteStderr("traceback:\n"); | |
| 333 PyErr_Print(); | |
| 334 } | |
| 335 else { | |
| 336 PySys_WriteStderr("use -v for traceback\n"); | |
| 337 } | |
| 338 } | |
| 339 } | |
| 340 } | |
| 341 | |
| 316 #ifdef USE_MAC_APPLET_SUPPORT | 342 #ifdef USE_MAC_APPLET_SUPPORT |
| 317 /* Applet support */ | 343 /* Applet support */ |
| 318 | 344 |
| 319 /* Run a compiled Python Python script from 'PYC ' resource __main__ */ | 345 /* Run a compiled Python Python script from 'PYC ' resource __main__ */ |
| 320 static int | 346 static int |
| 358 int err; | 384 int err; |
| 359 | 385 |
| 360 init_common(&argc, &argv, 0); | 386 init_common(&argc, &argv, 0); |
| 361 | 387 |
| 362 Py_Initialize(); | 388 Py_Initialize(); |
| 389 PyMac_InstallNavServicesForSF(); | |
| 363 PySys_SetArgv(argc, argv); | 390 PySys_SetArgv(argc, argv); |
| 364 | 391 |
| 365 err = run_main_resource(); | 392 err = run_main_resource(); |
| 366 | 393 |
| 367 err = (run_inspect() || err); | 394 err = (run_inspect() || err); |
| 381 int argc; | 408 int argc; |
| 382 char **argv; | 409 char **argv; |
| 383 | 410 |
| 384 init_common(&argc, &argv, 1); | 411 init_common(&argc, &argv, 1); |
| 385 Py_Initialize(); | 412 Py_Initialize(); |
| 413 PyMac_InstallNavServicesForSF(); | |
| 386 PySys_SetArgv(argc, argv); | 414 PySys_SetArgv(argc, argv); |
| 387 } | 415 } |
| 388 | 416 |
| 389 #endif /* USE_MAC_APPLET_SUPPORT */ | 417 #endif /* USE_MAC_APPLET_SUPPORT */ |
| 390 | 418 |
| 446 /* We initialize the menubar here, hoping SIOUX is initialized by now */ | 474 /* We initialize the menubar here, hoping SIOUX is initialized by now */ |
| 447 PyMac_InitMenuBar(); | 475 PyMac_InitMenuBar(); |
| 448 | 476 |
| 449 Py_Initialize(); | 477 Py_Initialize(); |
| 450 | 478 |
| 479 PyMac_InstallNavServicesForSF(); | |
| 480 | |
| 451 PySys_SetArgv(argc-1, argv+1); | 481 PySys_SetArgv(argc-1, argv+1); |
| 452 | 482 |
| 453 if (filename == NULL && isatty((int)fileno(fp))) { | 483 if (filename == NULL && isatty((int)fileno(fp))) { |
| 454 FILE *fp = fopen(STARTUP, "r"); | 484 FILE *fp = fopen(STARTUP, "r"); |
| 455 if (fp != NULL) { | 485 if (fp != NULL) { |
