blob: 9f779f207442d4edd5ede88c89228d78cc059f2c [file] [log] [blame]
Guido van Rossumb0f3c821994-08-23 13:34:25 +00001/***********************************************************
Jack Jansen42218ce1997-01-31 16:15:11 +00002Copyright 1991-1997 by Stichting Mathematisch Centrum, Amsterdam,
Guido van Rossum99546991995-01-08 14:33:34 +00003The Netherlands.
Guido van Rossumb0f3c821994-08-23 13:34:25 +00004
5 All Rights Reserved
6
7Permission to use, copy, modify, and distribute this software and its
8documentation for any purpose and without fee is hereby granted,
9provided that the above copyright notice appear in all copies and that
10both that copyright notice and this permission notice appear in
11supporting documentation, and that the names of Stichting Mathematisch
12Centrum or CWI not be used in advertising or publicity pertaining to
13distribution of the software without specific, written prior permission.
14
15STICHTING MATHEMATISCH CENTRUM DISCLAIMS ALL WARRANTIES WITH REGARD TO
16THIS SOFTWARE, INCLUDING ALL IMPLIED WARRANTIES OF MERCHANTABILITY AND
17FITNESS, IN NO EVENT SHALL STICHTING MATHEMATISCH CENTRUM BE LIABLE
18FOR ANY SPECIAL, INDIRECT OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES
19WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, WHETHER IN AN
20ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT
21OF OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE.
22
23******************************************************************/
24
Jack Jansen696c9581995-08-14 12:33:20 +000025/* Python interpreter main program */
Guido van Rossumb0f3c821994-08-23 13:34:25 +000026
Jack Jansen696c9581995-08-14 12:33:20 +000027#include "Python.h"
28#include "pythonresources.h"
29#include "import.h"
30#include "marshal.h"
Jack Jansenf6865f71996-09-04 15:24:59 +000031#include "macglue.h"
Guido van Rossumb0f3c821994-08-23 13:34:25 +000032
Jack Jansen696c9581995-08-14 12:33:20 +000033#include <Memory.h>
34#include <Resources.h>
Guido van Rossumb0f3c821994-08-23 13:34:25 +000035#include <stdio.h>
Jack Jansen696c9581995-08-14 12:33:20 +000036#include <Events.h>
37#include <Windows.h>
Jack Jansen2429c721996-03-07 15:17:11 +000038#include <Fonts.h>
Jack Jansen36b983c1997-09-09 13:53:21 +000039#include <Balloons.h>
Jack Jansenc76fd391995-02-02 14:27:31 +000040#ifdef __MWERKS__
41#include <SIOUX.h>
Jack Jansen1e8557a1995-11-10 14:51:26 +000042#define USE_SIOUX
Jack Jansen8c693211997-01-07 16:19:42 +000043#if __profile__ == 1
44#include <profiler.h>
45#endif
Jack Jansenc76fd391995-02-02 14:27:31 +000046#endif
47
Jack Jansen0168f271995-10-27 13:32:30 +000048#ifdef THINK_C
49#include <console.h>
50#endif
51
Jack Jansen696c9581995-08-14 12:33:20 +000052#define STARTUP "PythonStartup"
Jack Jansenbac428d1994-12-14 13:47:30 +000053
Jack Jansen696c9581995-08-14 12:33:20 +000054extern int Py_DebugFlag; /* For parser.c, declared in pythonrun.c */
55extern int Py_VerboseFlag; /* For import.c, declared in pythonrun.c */
Jack Jansen3f7d2b41996-09-06 22:21:07 +000056short PyMac_AppRefNum; /* RefNum of application resource fork */
Jack Jansen696c9581995-08-14 12:33:20 +000057
Jack Jansen1d2f8631996-08-02 15:16:16 +000058/* For Py_GetArgcArgv(); set by main() */
Jack Jansen696c9581995-08-14 12:33:20 +000059static char **orig_argv;
60static int orig_argc;
61
Jack Jansen7d5f9e81996-09-07 17:09:31 +000062PyMac_PrefRecord options;
Jack Jansen0168f271995-10-27 13:32:30 +000063
Jack Jansen76ceece1996-08-19 11:18:24 +000064static void Py_Main Py_PROTO((int, char **)); /* Forward */
65void PyMac_Exit Py_PROTO((int)); /* Forward */
66
Jack Jansen01fbc681996-02-28 15:42:47 +000067/* Initialize the Mac toolbox world */
68
69static void
70init_mac_world()
71{
72#ifdef THINK_C
73 printf("\n");
74#else
75 MaxApplZone();
76 InitGraf(&qd.thePort);
77 InitFonts();
78 InitWindows();
79 TEInit();
80 InitDialogs((long)0);
81 InitMenus();
82 InitCursor();
83#endif
84}
85
Jack Jansen7d5f9e81996-09-07 17:09:31 +000086/*
87** PyMac_InteractiveOptions - Allow user to set options if option key is pressed
88*/
Jack Jansen01fbc681996-02-28 15:42:47 +000089static void
Jack Jansen7d5f9e81996-09-07 17:09:31 +000090PyMac_InteractiveOptions(PyMac_PrefRecord *p, int *argcp, char ***argvp)
91{
92 KeyMap rmap;
93 unsigned char *map;
94 short item, type;
95 ControlHandle handle;
96 DialogPtr dialog;
97 Rect rect;
98 int old_argc = *argcp;
99 int i;
100
101 /*
102 ** If the preferences disallows interactive options we return,
103 ** similarly of <option> isn't pressed.
104 */
105 if (p->nointopt) return;
106
107 GetKeys(rmap);
108 map = (unsigned char *)rmap;
109 if ( ( map[0x3a>>3] & (1<<(0x3a&7)) ) == 0 ) /* option key is 3a */
110 return;
111
112 dialog = GetNewDialog(OPT_DIALOG, NULL, (WindowPtr)-1);
113 if ( dialog == NULL ) {
114 printf("Option dialog not found - cannot set options\n");
115 return;
116 }
117 SetDialogDefaultItem(dialog, OPT_OK);
118 SetDialogCancelItem(dialog, OPT_CANCEL);
119
120 /* Set default values */
121#define SET_OPT_ITEM(num, var) \
122 GetDialogItem(dialog, (num), &type, (Handle *)&handle, &rect); \
Jack Jansen08c3be31997-04-08 15:27:00 +0000123 SetControlValue(handle, (short)p->var);
Jack Jansen7d5f9e81996-09-07 17:09:31 +0000124
125 SET_OPT_ITEM(OPT_INSPECT, inspect);
126 SET_OPT_ITEM(OPT_VERBOSE, verbose);
Jack Jansen36b983c1997-09-09 13:53:21 +0000127 SET_OPT_ITEM(OPT_OPTIMIZE, optimize);
Jack Jansen7d5f9e81996-09-07 17:09:31 +0000128 SET_OPT_ITEM(OPT_UNBUFFERED, unbuffered);
129 SET_OPT_ITEM(OPT_DEBUGGING, debugging);
130 SET_OPT_ITEM(OPT_KEEPNORMAL, keep_normal);
131 SET_OPT_ITEM(OPT_KEEPERROR, keep_error);
Jack Jansen36b983c1997-09-09 13:53:21 +0000132 SET_OPT_ITEM(OPT_OLDEXC, oldexc);
133 SET_OPT_ITEM(OPT_NOSITE, nosite);
Jack Jansen7d5f9e81996-09-07 17:09:31 +0000134 /* The rest are not settable interactively */
135
136#undef SET_OPT_ITEM
137
138 while (1) {
139 handle = NULL;
140 ModalDialog(NULL, &item);
141 if ( item == OPT_OK )
142 break;
143 if ( item == OPT_CANCEL ) {
Jack Jansen08c3be31997-04-08 15:27:00 +0000144 DisposeDialog(dialog);
Jack Jansen7d5f9e81996-09-07 17:09:31 +0000145 exit(0);
146 }
Jack Jansen36b983c1997-09-09 13:53:21 +0000147 if ( item == OPT_HELP ) {
148 HMSetBalloons(!HMGetBalloons());
149 }
Jack Jansen7d5f9e81996-09-07 17:09:31 +0000150 if ( item == OPT_CMDLINE ) {
151 int new_argc, newer_argc;
152 char **new_argv, **newer_argv;
153
154 new_argc = ccommand(&new_argv);
155 newer_argc = (new_argc-1) + old_argc;
156 newer_argv = malloc((newer_argc+1)*sizeof(char *));
157 if( !newer_argv )
158 Py_FatalError("Cannot malloc argv\n");
159 for(i=0; i<old_argc; i++)
160 newer_argv[i] = (*argvp)[i];
161 for(i=old_argc; i<=newer_argc; i++) /* Copy the NULL too */
162 newer_argv[i] = new_argv[i-old_argc+1];
163 *argvp = newer_argv;
164 *argcp = newer_argc;
165
166 /* XXXX Is it not safe to use free() here, apparently */
167 }
168#define OPT_ITEM(num, var) \
169 if ( item == (num) ) { \
170 p->var = !p->var; \
171 GetDialogItem(dialog, (num), &type, (Handle *)&handle, &rect); \
Jack Jansen08c3be31997-04-08 15:27:00 +0000172 SetControlValue(handle, (short)p->var); \
Jack Jansen7d5f9e81996-09-07 17:09:31 +0000173 }
174
175 OPT_ITEM(OPT_INSPECT, inspect);
176 OPT_ITEM(OPT_VERBOSE, verbose);
Jack Jansen36b983c1997-09-09 13:53:21 +0000177 OPT_ITEM(OPT_OPTIMIZE, optimize);
Jack Jansen7d5f9e81996-09-07 17:09:31 +0000178 OPT_ITEM(OPT_UNBUFFERED, unbuffered);
179 OPT_ITEM(OPT_DEBUGGING, debugging);
180 OPT_ITEM(OPT_KEEPNORMAL, keep_normal);
181 OPT_ITEM(OPT_KEEPERROR, keep_error);
Jack Jansen36b983c1997-09-09 13:53:21 +0000182 OPT_ITEM(OPT_OLDEXC, oldexc);
183 OPT_ITEM(OPT_NOSITE, nosite);
Jack Jansen7d5f9e81996-09-07 17:09:31 +0000184
185#undef OPT_ITEM
186 }
Jack Jansen08c3be31997-04-08 15:27:00 +0000187 DisposeDialog(dialog);
Jack Jansen7d5f9e81996-09-07 17:09:31 +0000188}
189
190/*
191** Initialization code, shared by interpreter and applets
192*/
193static void
Jack Jansen52ac0371997-01-15 15:49:08 +0000194init_common(int *argcp, char ***argvp, int embedded)
Jack Jansen01fbc681996-02-28 15:42:47 +0000195{
Jack Jansen3f7d2b41996-09-06 22:21:07 +0000196 /* Remember resource fork refnum, for later */
197 PyMac_AppRefNum = CurResFile();
198
Jack Jansen01fbc681996-02-28 15:42:47 +0000199 /* Initialize toolboxes */
200 init_mac_world();
201
202#ifdef USE_MAC_SHARED_LIBRARY
203 /* Add the shared library to the stack of resource files */
204 PyMac_AddLibResources();
205#endif
206
207#if defined(USE_GUSI)
208 /* Setup GUSI */
209 GUSIDefaultSetup();
Jack Jansenf6865f71996-09-04 15:24:59 +0000210 PyMac_SetGUSISpin();
Jack Jansen3f7d2b41996-09-06 22:21:07 +0000211 PyMac_SetGUSIOptions();
Jack Jansena39f1b01997-05-23 15:35:14 +0000212 atexit(PyMac_StopGUSISpin);
Jack Jansen01fbc681996-02-28 15:42:47 +0000213#endif
214
215#ifdef USE_SIOUX
216 /* Set various SIOUX flags. Some are changed later based on options */
Jack Jansencaa7c461997-06-12 10:49:13 +0000217/* SIOUXSettings.standalone = 0; /* XXXX Attempting to keep sioux from eating events */
Jack Jansen01fbc681996-02-28 15:42:47 +0000218 SIOUXSettings.asktosaveonclose = 0;
219 SIOUXSettings.showstatusline = 0;
220 SIOUXSettings.tabspaces = 4;
221#endif
222
Jack Jansen7d5f9e81996-09-07 17:09:31 +0000223 /* Get options from preference file (or from applet resource fork) */
224 options.keep_error = 1; /* default-default */
225 PyMac_PreferenceOptions(&options);
226
Jack Jansen52ac0371997-01-15 15:49:08 +0000227 if ( embedded ) {
228 static char *emb_argv[] = {"embedded-python", 0};
229
230 *argcp = 1;
231 *argvp = emb_argv;
232 } else {
233 /* Create argc/argv. Do it before we go into the options event loop. */
234 *argcp = PyMac_GetArgv(argvp, options.noargs);
235
236 /* Do interactive option setting, if allowed and <option> depressed */
237 PyMac_InteractiveOptions(&options, argcp, argvp);
238 }
Jack Jansen7d5f9e81996-09-07 17:09:31 +0000239
240 /* Copy selected options to where the machine-independent stuff wants it */
241 Py_VerboseFlag = options.verbose;
Jack Jansen7330b391997-08-08 14:56:41 +0000242/* Py_SuppressPrintingFlag = options.suppress_print; */
Jack Jansen36b983c1997-09-09 13:53:21 +0000243 Py_OptimizeFlag = options.optimize;
Jack Jansen7d5f9e81996-09-07 17:09:31 +0000244 Py_DebugFlag = options.debugging;
Jack Jansene3ae0df1997-06-03 15:28:29 +0000245 if ( options.noargs ) {
246 /* don't process events at all without the scripts permission */
247 PyMacSchedParams scp;
248
249 PyMac_GetSchedParams(&scp);
250 scp.process_events = 0;
251 /* Should we disable command-dot as well? */
252 PyMac_SetSchedParams(&scp);
253 }
Jack Jansen36b983c1997-09-09 13:53:21 +0000254 /* XXXX dispatch oldexc and nosite */
Jack Jansen7d5f9e81996-09-07 17:09:31 +0000255
256 /* Set buffering */
257 if (options.unbuffered) {
258#ifndef MPW
259 setbuf(stdout, (char *)NULL);
260 setbuf(stderr, (char *)NULL);
261#else
262 /* On MPW (3.2) unbuffered seems to hang */
263 setvbuf(stdout, (char *)NULL, _IOLBF, BUFSIZ);
264 setvbuf(stderr, (char *)NULL, _IOLBF, BUFSIZ);
265#endif
266 }
Jack Jansen8c693211997-01-07 16:19:42 +0000267#if __profile__ == 1
268 /* collectSummary or collectDetailed, timebase, #routines, max stack depth */
269 ProfilerInit(collectSummary, bestTimeBase, 2000, 150);
270#endif
Jack Jansen7330b391997-08-08 14:56:41 +0000271
272 /* Tell the rest of python about our argc/argv */
273 orig_argc = *argcp; /* For Py_GetArgcArgv() */
274 orig_argv = *argvp;
275 Py_SetProgramName((*argvp)[0]);
Jack Jansen01fbc681996-02-28 15:42:47 +0000276}
277
Jack Jansen7d5f9e81996-09-07 17:09:31 +0000278/*
279** Inspection mode after script/applet termination
280*/
281static int
282run_inspect()
283{
284 int sts = 0;
285
286 if (options.inspect && isatty((int)fileno(stdin)))
287 sts = PyRun_AnyFile(stdin, "<stdin>") != 0;
288 return sts;
289}
Jack Jansen01fbc681996-02-28 15:42:47 +0000290
Jack Jansen696c9581995-08-14 12:33:20 +0000291#ifdef USE_MAC_APPLET_SUPPORT
292/* Applet support */
293
294/* Run a compiled Python Python script from 'PYC ' resource __main__ */
295static int
296run_main_resource()
297{
298 Handle h;
299 long size;
300 PyObject *code;
301 PyObject *result;
302
303 h = GetNamedResource('PYC ', "\p__main__");
304 if (h == NULL) {
305 Alert(NOPYC_ALERT, NULL);
306 return 1;
307 }
308 size = GetResourceSizeOnDisk(h);
309 HLock(h);
310 code = PyMarshal_ReadObjectFromString(*h + 8, (int)(size - 8));
311 HUnlock(h);
312 ReleaseResource(h);
313 if (code == NULL) {
314 PyErr_Print();
315 return 1;
316 }
317 result = PyImport_ExecCodeModule("__main__", code);
318 Py_DECREF(code);
319 if (result == NULL) {
320 PyErr_Print();
321 return 1;
322 }
323 Py_DECREF(result);
324 return 0;
325}
326
327/* Initialization sequence for applets */
328void
329PyMac_InitApplet()
330{
Guido van Rossumb0f3c821994-08-23 13:34:25 +0000331 int argc;
332 char **argv;
Jack Jansen696c9581995-08-14 12:33:20 +0000333 int err;
334
Jack Jansen52ac0371997-01-15 15:49:08 +0000335 init_common(&argc, &argv, 0);
Jack Jansen7d5f9e81996-09-07 17:09:31 +0000336
Jack Jansen696c9581995-08-14 12:33:20 +0000337 Py_Initialize();
338 PySys_SetArgv(argc, argv);
Jack Jansen7d5f9e81996-09-07 17:09:31 +0000339
Jack Jansen696c9581995-08-14 12:33:20 +0000340 err = run_main_resource();
Jack Jansen7d5f9e81996-09-07 17:09:31 +0000341
342 err = (run_inspect() || err);
343
Jack Jansen696c9581995-08-14 12:33:20 +0000344 fflush(stderr);
345 fflush(stdout);
Jack Jansen0168f271995-10-27 13:32:30 +0000346 PyMac_Exit(err);
Jack Jansen696c9581995-08-14 12:33:20 +0000347 /* XXX Should we bother to Py_Exit(sts)? */
348}
349
Jack Jansen52ac0371997-01-15 15:49:08 +0000350/*
351** Hook for embedding python.
352*/
353void
354PyMac_Initialize()
355{
356 int argc;
357 char **argv;
358
359 init_common(&argc, &argv, 1);
360 Py_Initialize();
361 PySys_SetArgv(argc, argv);
362}
363
Jack Jansen696c9581995-08-14 12:33:20 +0000364#endif /* USE_MAC_APPLET_SUPPORT */
365
366/* For normal application */
367void
368PyMac_InitApplication()
369{
370 int argc;
371 char **argv;
372
Jack Jansen52ac0371997-01-15 15:49:08 +0000373 init_common(&argc, &argv, 0);
Jack Jansen7d5f9e81996-09-07 17:09:31 +0000374
Jack Jansen696c9581995-08-14 12:33:20 +0000375 if ( argc > 1 ) {
376 /* We're running a script. Attempt to change current directory */
377 char curwd[256], *endp;
378
379 strcpy(curwd, argv[1]);
380 endp = strrchr(curwd, ':');
381 if ( endp && endp > curwd ) {
382 *endp = '\0';
383
384 chdir(curwd);
Jack Jansen378815c1996-03-06 16:21:34 +0000385#ifdef USE_GUSI
386 /* Change MacOS's idea of wd too */
387 PyMac_FixGUSIcd();
388#endif
Jack Jansen696c9581995-08-14 12:33:20 +0000389 }
390 }
391 Py_Main(argc, argv);
392}
393
Jack Jansen696c9581995-08-14 12:33:20 +0000394/* Main program */
395
Jack Jansen76ceece1996-08-19 11:18:24 +0000396static void
Jack Jansen696c9581995-08-14 12:33:20 +0000397Py_Main(argc, argv)
398 int argc;
399 char **argv;
400{
Jack Jansen696c9581995-08-14 12:33:20 +0000401 int sts;
402 char *command = NULL;
403 char *filename = NULL;
404 FILE *fp = stdin;
Jack Jansen696c9581995-08-14 12:33:20 +0000405
Jack Jansen696c9581995-08-14 12:33:20 +0000406 filename = argv[1];
407
408 if (Py_VerboseFlag ||
409 command == NULL && filename == NULL && isatty((int)fileno(fp)))
410 fprintf(stderr, "Python %s\n%s\n",
Jack Jansena547dca1996-07-10 15:48:25 +0000411 Py_GetVersion(), Py_GetCopyright());
Jack Jansen696c9581995-08-14 12:33:20 +0000412
413 if (filename != NULL) {
414 if ((fp = fopen(filename, "r")) == NULL) {
415 fprintf(stderr, "%s: can't open file '%s'\n",
416 argv[0], filename);
Jack Jansen0168f271995-10-27 13:32:30 +0000417 PyMac_Exit(2);
Jack Jansen696c9581995-08-14 12:33:20 +0000418 }
419 }
420
Jack Jansen7d5f9e81996-09-07 17:09:31 +0000421 /* We initialize the menubar here, hoping SIOUX is initialized by now */
Jack Jansen3469e991996-09-06 00:30:45 +0000422 PyMac_InitMenuBar();
423
Jack Jansen696c9581995-08-14 12:33:20 +0000424 Py_Initialize();
425
426 PySys_SetArgv(argc-1, argv+1);
427
428 if (filename == NULL && isatty((int)fileno(fp))) {
429 FILE *fp = fopen(STARTUP, "r");
430 if (fp != NULL) {
431 (void) PyRun_SimpleFile(fp, STARTUP);
432 PyErr_Clear();
433 fclose(fp);
434 }
435 }
436 sts = PyRun_AnyFile(
437 fp, filename == NULL ? "<stdin>" : filename) != 0;
438 if (filename != NULL)
439 fclose(fp);
Jack Jansen7d5f9e81996-09-07 17:09:31 +0000440
441 if ( filename != NULL || command != NULL )
442 sts = (run_inspect() || sts);
Jack Jansen696c9581995-08-14 12:33:20 +0000443
444 Py_Exit(sts);
445 /*NOTREACHED*/
446}
447
Jack Jansen0168f271995-10-27 13:32:30 +0000448/*
449** Terminate application
450*/
Jack Jansen76ceece1996-08-19 11:18:24 +0000451void
Jack Jansen0168f271995-10-27 13:32:30 +0000452PyMac_Exit(status)
453 int status;
454{
455 int keep;
Jack Jansen8c693211997-01-07 16:19:42 +0000456
457#if __profile__ == 1
458 ProfilerDump("\pPython Profiler Results");
459 ProfilerTerm();
460#endif
Jack Jansen0168f271995-10-27 13:32:30 +0000461 if ( status )
Jack Jansen7d5f9e81996-09-07 17:09:31 +0000462 keep = options.keep_error;
Jack Jansen0168f271995-10-27 13:32:30 +0000463 else
Jack Jansen7d5f9e81996-09-07 17:09:31 +0000464 keep = options.keep_normal;
Jack Jansen0168f271995-10-27 13:32:30 +0000465
Jack Jansen1e8557a1995-11-10 14:51:26 +0000466#ifdef USE_SIOUX
467 if (keep) {
468 SIOUXSettings.standalone = 1;
469 SIOUXSettings.autocloseonquit = 0;
Jack Jansen415571c1996-03-25 15:46:03 +0000470 SIOUXSetTitle("\p\307terminated\310");
Jack Jansencaa7c461997-06-12 10:49:13 +0000471 PyMac_RestoreMenuBar();
Jack Jansene44545f1997-05-07 15:48:54 +0000472#ifdef USE_MSL
473 /*
474 ** Temporary workaround: autocloseonquit clearing does not
475 ** currently work for the MSL/GUSI combo.
476 */
477 while(getchar() > 0);
478#endif
Jack Jansen1e8557a1995-11-10 14:51:26 +0000479 }
Jack Jansen0168f271995-10-27 13:32:30 +0000480 else
481 SIOUXSettings.autocloseonquit = 1;
Jack Jansenf6865f71996-09-04 15:24:59 +0000482#endif /* USE_SIOUX */
Jack Jansen0168f271995-10-27 13:32:30 +0000483#ifdef THINK_C
484 console_options.pause_atexit = keep;
485#endif
486
487 exit(status);
488}
Jack Jansen696c9581995-08-14 12:33:20 +0000489
490/* Return the program name -- some code out there needs this. */
Jack Jansena39f1b01997-05-23 15:35:14 +0000491char *
492Py_GetProgramFullPath()
493{
Jack Jansen7330b391997-08-08 14:56:41 +0000494 return orig_argv[0];
Jack Jansena39f1b01997-05-23 15:35:14 +0000495}
496
Jack Jansen696c9581995-08-14 12:33:20 +0000497
498/* Make the *original* argc/argv available to other modules.
499 This is rare, but it is needed by the secureware extension. */
500
501void
Jack Jansen1d2f8631996-08-02 15:16:16 +0000502Py_GetArgcArgv(argc,argv)
Jack Jansen696c9581995-08-14 12:33:20 +0000503 int *argc;
504 char ***argv;
505{
506 *argc = orig_argc;
507 *argv = orig_argv;
Guido van Rossumb0f3c821994-08-23 13:34:25 +0000508}
Jack Jansen1d2f8631996-08-02 15:16:16 +0000509
510/* More cruft that shouldn't really be here, used in sysmodule.c */
511
512char *
513Py_GetPrefix()
514{
Jack Jansenac625691997-09-08 13:22:22 +0000515 return PyMac_GetPythonDir();
Jack Jansen1d2f8631996-08-02 15:16:16 +0000516}
517
518char *
519Py_GetExecPrefix()
520{
Jack Jansenac625691997-09-08 13:22:22 +0000521 return PyMac_GetPythonDir();
Jack Jansen1d2f8631996-08-02 15:16:16 +0000522}