diff Mac/Python/macglue.c @ 2394:fa8cdd3cc545 legacy-trunk

use PyMac_GetArgv (in macgetargv.c) for applet inits
author Guido van Rossum <guido@python.org>
date Sun, 19 Feb 1995 15:52:17 +0000
parents 6450d8828d2b
children 72c715c004c8
line wrap: on
line diff
--- a/Mac/Python/macglue.c	Sun Feb 19 15:51:30 1995 +0000
+++ b/Mac/Python/macglue.c	Sun Feb 19 15:52:17 1995 +0000
@@ -748,21 +748,10 @@
 }
 
 
-/* What follows is used only by applets. */
+/* ---------- */
+/* Applet support */
 
-static void
-init_mac_world()
-{
-	MaxApplZone();
-	InitGraf(&qd.thePort);
-	InitFonts();
-	InitWindows();
-	TEInit();
-	InitDialogs((long)0);
-	InitMenus();
-	InitCursor();
-}
-
+/* Run a compiled Python Python script from 'PYC ' resource __main__ */
 static int
 run_main_resource()
 {
@@ -795,14 +784,16 @@
 	return 0;
 }
 
+/* Initialization sequence for applets */
 void
 PyMac_InitApplet()
 {
-	static char *argv[] = {"__main__", NULL};
+	int argc;
+	char **argv;
 	
-	init_mac_world();
+	argc = PyMac_GetArgv(&argv);
 	Py_Initialize();
-	PySys_SetArgv((sizeof argv / sizeof argv[0]) - 1, argv);
+	PySys_SetArgv(argc, argv);
 	run_main_resource();
 	fflush(stderr);
 	fflush(stdout);