compilable on systems without SIGSEGV
authorClaus Gittinger <cg@exept.de>
Mon, 24 Nov 2014 14:56:09 +0100
changeset 6617 2af71b6a7e46
parent 6614 160cf8d7ea05
child 6618 9d377a77a1a1
compilable on systems without SIGSEGV
GLXWorkstation.st
--- a/GLXWorkstation.st	Mon Nov 24 04:49:39 2014 +0000
+++ b/GLXWorkstation.st	Mon Nov 24 14:56:09 2014 +0100
@@ -20,6 +20,8 @@
 
 !GLXWorkstation primitiveDefinitions!
 %{
+#include "stxOSDefs.h"
+
 /*
  * on SGI, this class is compiled with -DGLX, while
  * for simulation (using vogl), this is compiled with -DVGL
@@ -77,7 +79,27 @@
 # include "vms_Xnames.h"
 #endif
 
-#include <stdio.h>
+#ifdef __arm__
+// # define _POSIX_C_SOURCE
+#endif
+
+#ifndef _STDIO_H_INCLUDED_
+# include <stdio.h>
+# define _STDIO_H_INCLUDED_
+#endif
+
+#ifdef __arm__
+# ifndef _SYS_TYPES_H_INCLUDED_
+#  include <sys/types.h>
+#  define _SYS_TYPES_H_INCLUDED_
+# endif
+# ifndef _SYS_SIGNAL_H_INCLUDED_
+#  include <sys/signal.h>
+#  define _SYS_SIGNAL_H_INCLUDED_
+# endif
+
+#endif
+
 #ifdef __osx__
 # include <sys/signal.h>
 # define DYNAMICALLY_LOADABLE
@@ -457,7 +479,9 @@
 # ifndef VGL
 #  include        <gl/glws.h>
 # endif
-# include        <signal.h>
+# ifndef _SIGNAL_H_INCLUDED_
+#  include        <signal.h>
+# endif
 # include        <setjmp.h>
 # include        "stcIntern.h"
 
@@ -543,9 +567,9 @@
     int scr, i, nret;
     Window win;
 #ifdef HAS_SIGACTION
-    struct sigaction oldSig, newSig;
-#else
-    void *oldSig;
+    struct sigaction oldSigSegv, newSigSegv;
+#else
+    void *oldSigSegv;
 #endif
 
 #if !defined(OPENGL)
@@ -554,11 +578,14 @@
 
     if (stx_setjmp(errorReturn)) {
 	console_fprintf(stderr, "hard error in GL - return\n");
-#ifdef HAS_SIGACTION
-	sigaction(SIGSEGV, &oldSig, 0);
-#else
-	signal(SIGSEGV, oldSig);
-#endif
+#ifdef SIGSEGV
+# ifdef HAS_SIGACTION
+	sigaction(SIGSEGV, &oldSigSegv, 0);
+# else
+	signal(SIGSEGV, oldSigSegv);
+# endif
+#endif
+
 #if !defined(OPENGL)
 	__catchExit(0);
 #endif
@@ -605,19 +632,25 @@
      * views are created ... just to make certain, we catch those
      * in GL too.
      */
-#  ifdef HAS_SIGACTION
-    sigaction(SIGSEGV, (struct sigaction *)0, &oldSig);
-    newSig = oldSig;
-    newSig.sa_handler = glAbort;
-    sigaction(SIGSEGV, &newSig, (struct sigaction *)0);
-#  else
-    oldSig = signal(SIGSEGV, glAbort);
+#  ifdef SIGSEGV
+#   ifdef HAS_SIGACTION
+    sigaction(SIGSEGV, (struct sigaction *)0, &oldSigSegv);
+    newSigSegv = oldSigSegv;
+    newSigSegv.sa_handler = glAbort;
+    sigaction(SIGSEGV, &newSigSegv, (struct sigaction *)0);
+#   else
+    oldSigSegv = signal(SIGSEGV, glAbort);
+#   endif
 #  endif
+
     i = GLXlink(dpy, win);
-#  ifdef HAS_SIGACTION
-    sigaction(SIGSEGV, &oldSig, (struct sigaction *)0);
-#  else
-    signal(SIGSEGV, oldSig);
+
+#  ifdef SIGSEGV
+#   ifdef HAS_SIGACTION
+    sigaction(SIGSEGV, &oldSigSegv, (struct sigaction *)0);
+#   else
+    signal(SIGSEGV, oldSigSegv);
+#   endif
 #  endif
 
     if (i < 0) {
@@ -719,19 +752,25 @@
      * on iris, seg-violations occur in the GL, if too many
      * views are created ...
      */
-#  ifdef HAS_SIGACTION
-    sigaction(SIGSEGV, (struct sigaction *)0, &oldSig);
-    newSig = oldSig;
-    newSig.sa_handler = glAbort;
-    sigaction(SIGSEGV, &newSig, (struct sigaction *)0);
-#  else
-    oldSig = signal(SIGSEGV, glAbort);
+#  ifdef SIGSEGV
+#   ifdef HAS_SIGACTION
+    sigaction(SIGSEGV, (struct sigaction *)0, &oldSigSegv);
+    newSigSegv = oldSigSegv;
+    newSigSegv.sa_handler = glAbort;
+    sigaction(SIGSEGV, &newSigSegv, (struct sigaction *)0);
+#   else
+    oldSigSegv = signal(SIGSEGV, glAbort);
+#   endif
 #  endif
+
     i = GLXlink(dpy, retconfig);
-#  ifdef HAS_SIGACTION
-    sigaction(SIGSEGV, &oldSig, (struct sigaction *)0);
-#  else
-    signal(SIGSEGV, oldSig);
+
+#  ifdef SIGSEGV
+#   ifdef HAS_SIGACTION
+    sigaction(SIGSEGV, &oldSigSegv, (struct sigaction *)0);
+#   else
+    signal(SIGSEGV, oldSigSegv);
+#   endif
 #  endif
 
     if (i < 0) {
@@ -8786,9 +8825,9 @@
 !GLXWorkstation class methodsFor:'documentation'!
 
 version
-    ^ '$Header: /cvs/stx/stx/libview/GLXWorkstation.st,v 1.87 2014-02-08 21:42:13 cg Exp $'
+    ^ '$Header: /cvs/stx/stx/libview/GLXWorkstation.st,v 1.88 2014-11-24 13:56:09 cg Exp $'
 !
 
 version_CVS
-    ^ '$Header: /cvs/stx/stx/libview/GLXWorkstation.st,v 1.87 2014-02-08 21:42:13 cg Exp $'
+    ^ '$Header: /cvs/stx/stx/libview/GLXWorkstation.st,v 1.88 2014-11-24 13:56:09 cg Exp $'
 ! !