]> granicus.if.org Git - python/commitdiff
- Added Py_GetProgramFullPath
authorJack Jansen <jack.jansen@cwi.nl>
Fri, 23 May 1997 15:35:14 +0000 (15:35 +0000)
committerJack Jansen <jack.jansen@cwi.nl>
Fri, 23 May 1997 15:35:14 +0000 (15:35 +0000)
- Added PyMac_StopGUSISpin and have it called at exit time (fixes crash
  when exiting with sockets open)
- Added PLstr... funcs needed by gusi: those provided by StdCLib are
  broken under cfm68k

Mac/Python/macglue.c
Mac/Python/macmain.c

index cc55d088e1f486d42ff131468bd309e3803f24a9..480b7419ffe405373140736834cbdea1e5df03eb 100644 (file)
@@ -215,7 +215,57 @@ PyMac_SetGUSISpin() {
        GUSISetHook(GUSI_SpinHook, (GUSIHook)PyMac_GUSISpin);
 }
 
-#endif
+/* Called at exit() time thru atexit(), to stop event processing */
+void
+PyMac_StopGUSISpin() {
+       PyMac_ConsoleIsDead = 1;
+}
+
+/*
+** Replacement routines for the PLstr... functions so we don't need
+** StdCLib. Moreover, that implementation is broken under cfm68k...
+*/
+void
+PLstrcpy(to, fr)
+       unsigned char *to, *fr;
+{
+       memcpy(to, fr, fr[0]+1);
+}
+
+int
+PLstrcmp(s1, s2)
+       unsigned char *s1, *s2;
+{
+       int res;
+       int l = s1[0] < s2[0] ? s1[0] : s2[0];
+       
+       res = memcmp(s1+1, s2+1, l);
+       if ( res != 0 )
+               return res;
+       
+       if ( s1 < s2 )
+               return -1;
+       else if ( s1 > s2 )
+               return 1;
+       else
+               return 0;
+}
+
+unsigned char *
+PLstrrchr(str, chr)
+       unsigned char *str;
+       unsigned char chr;
+{
+       unsigned char *ptr = 0;
+       unsigned char *p;
+       
+       for(p=str+1; p<str+str[0]; p++)
+               if ( *p == chr )
+                       ptr = p;
+       return ptr;
+}
+       
+#endif /* USE_GUSI */
 
 
 /* Convert C to Pascal string. Returns pointer to static buffer. */
index 9e8fbc57b8287505f3542fb07198a2bbe47837cb..811258a7ba85838f9bc87015c5d4ff70c7ac2aa7 100644 (file)
@@ -209,6 +209,7 @@ init_common(int *argcp, char ***argvp, int embedded)
        GUSIDefaultSetup();
        PyMac_SetGUSISpin();
        PyMac_SetGUSIOptions();
+       atexit(PyMac_StopGUSISpin);
 #endif
 
 #ifdef USE_SIOUX
@@ -464,13 +465,6 @@ PyMac_Exit(status)
        }
        else
                SIOUXSettings.autocloseonquit = 1;
-#ifdef USE_GUSI
-       /*
-       ** Workaround for Sioux/GUSI combo: we should not call
-       ** SiouxHandleOneEvent after the window is closed
-       */
-       PyMac_ConsoleIsDead = 1;
-#endif /* USE_GUSI */
 #endif /* USE_SIOUX */
 #ifdef THINK_C
        console_options.pause_atexit = keep;
@@ -487,6 +481,13 @@ Py_GetProgramName()
        return orig_argv[0];
 }
 
+/* The same, but used differently */
+char *
+Py_GetProgramFullPath()
+{
+       return Py_GetProgramName();
+}
+
 
 /* Make the *original* argc/argv available to other modules.
    This is rare, but it is needed by the secureware extension. */