Update of /cvsroot/arcem/arcem/X
In directory vz-cvs-4.sog:/tmp/cvs-serv13637/X

Modified Files:
        ControlPane.c DispKbd.c pseudo.c true.c 
Log Message:
* Add ControlPane_Error() function to allow errors to be reported in a 
platform-specific way.
* Replace numerous fprintf(stderr,"Foo"); exit(1); calls with calls to 
ControlPane_Error()
RISC OS specific changes:
* Add support for running in 32bpp modes (e.g. for Raspberry Pi)
* Allow tweak menu keys to be configured
* Fix stdout redirection preventing tweak menu from being visible!



Index: ControlPane.c
===================================================================
RCS file: /cvsroot/arcem/arcem/X/ControlPane.c,v
retrieving revision 1.18
retrieving revision 1.19
diff -u -d -r1.18 -r1.19
--- ControlPane.c       12 May 2012 17:34:51 -0000      1.18
+++ ControlPane.c       21 Oct 2012 16:59:31 -0000      1.19
@@ -16,6 +16,8 @@
 #include "arch/keyboard.h"
 
 #include <string.h>
+#include <stdarg.h>
+#include <stdio.h>
 
 #define CTRLPANEWIDTH 640
 #define CTRLPANEHEIGHT 100
@@ -205,8 +207,7 @@
   tmpptr = strdup("Arc emulator - Control panel");
 
   if (XStringListToTextProperty(&tmpptr, 1, &name) == 0) {
-    fprintf(stderr, "Could not allocate window name\n");
-    exit(1);
+    ControlPane_Error(1,"Could not allocate window name\n");
   }
 
   XSetWMName(PD.disp, PD.ControlPane, &name);
@@ -219,8 +220,7 @@
   PD.ButtonFont = XLoadQueryFont(PD.disp, "fixed");
 
   if (PD.ButtonFont == NULL) {
-    fprintf(stderr, "Couldn't get font for buttons\n");
-    exit(1);
+    ControlPane_Error(1,"Couldn't get font for buttons\n");
   }
 
   XSetFont(PD.disp, PD.ControlPaneGC, PD.ButtonFont->fid);
@@ -241,5 +241,17 @@
 } /* ControlPane_Init */
 
 
+/*----------------------------------------------------------------------------*/
+
+void ControlPane_Error(int code,const char *fmt,...)
+{
+  va_list args;
+  va_start(args,fmt);
+  /* Log it */
+  vfprintf(stderr,fmt,args);
+  /* Quit */
+  exit(code);
+}
+
 
 

Index: pseudo.c
===================================================================
RCS file: /cvsroot/arcem/arcem/X/pseudo.c,v
retrieving revision 1.3
retrieving revision 1.4
diff -u -d -r1.3 -r1.4
--- pseudo.c    12 May 2012 17:34:51 -0000      1.3
+++ pseudo.c    21 Oct 2012 16:59:31 -0000      1.4
@@ -28,6 +28,7 @@
 #include "../armemu.h"
 #include "arch/displaydev.h"
 #include "platform.h"
+#include "ControlPane.h"
 
 typedef char SDD_HostColour;
 #define SDD_Name(x) pseudo_##x
@@ -76,9 +77,8 @@
 static void SDD_Name(Host_ChangeMode)(ARMul_State *state,int width,int 
height,int hz)
 {
   if (width > MaxVideoWidth || height > MaxVideoHeight) {
-      fprintf(stderr, "Resize_Window: new size (%d, %d) exceeds maximum (%d, 
%d)\n",
+      ControlPane_Error(EXIT_FAILURE,"Resize_Window: new size (%d, %d) exceeds 
maximum (%d, %d)\n",
           width, height, MaxVideoWidth, MaxVideoHeight);
-          exit(EXIT_FAILURE);
   }
 
   HD.XScale = 1;

Index: DispKbd.c
===================================================================
RCS file: /cvsroot/arcem/arcem/X/DispKbd.c,v
retrieving revision 1.81
retrieving revision 1.82
diff -u -d -r1.81 -r1.82
--- DispKbd.c   20 Jul 2012 20:18:57 -0000      1.81
+++ DispKbd.c   21 Oct 2012 16:59:31 -0000      1.82
@@ -392,8 +392,7 @@
             PD.blue_prec);
     } else {
         puts("nothing suitable");
-      fprintf(stderr,"DisplayKbd_Init: Failed to find a matching visual - I'm 
looking for either 8 bit Pseudo colour, or 32,24,16,  or 15 bit TrueColour - 
sorry\n");
-      exit(EXIT_FAILURE);
+      ControlPane_Error(EXIT_FAILURE,"DisplayKbd_Init: Failed to find a 
matching visual - I'm looking for either 8 bit Pseudo colour, or 32,24,16,  or 
15 bit TrueColour - sorry\n");
     }
   }
 
@@ -918,9 +917,8 @@
     } else if (e.xany.window == PD.CursorPane) {
       CursorPane_Event(state, &e);
     } else {
-      fprintf(stderr, "event on unknown window: %#lx %d\n",
+      ControlPane_Error(EXIT_FAILURE,"event on unknown window: %#lx %d\n",
               e.xany.window, e.type);
-      exit(EXIT_FAILURE);
     }
   }
   return 0;
@@ -977,9 +975,8 @@
     void *p;
 
     if ((p = malloc(n)) == NULL) {
-        fprintf(stderr, "arcem: malloc of %zu bytes for %s failed.\n",
+        ControlPane_Error(1,"arcem: malloc of %zu bytes for %s failed.\n",
             n, use);
-        exit(1);
     }
 
     return p;
@@ -1001,6 +998,5 @@
         return;
     }
 
-    fprintf(stderr, "arcem: insisting on %s.\n", diag);
-    exit(1);
+    ControlPane_Error(1,"arcem: insisting on %s.\n", diag);
 }

Index: true.c
===================================================================
RCS file: /cvsroot/arcem/arcem/X/true.c,v
retrieving revision 1.3
retrieving revision 1.4
diff -u -d -r1.3 -r1.4
--- true.c      12 May 2012 17:34:51 -0000      1.3
+++ true.c      21 Oct 2012 16:59:31 -0000      1.4
@@ -26,6 +26,7 @@
 #include "../armemu.h"
 #include "arch/displaydev.h"
 #include "platform.h"
+#include "ControlPane.h"
 
 typedef unsigned int SDD_HostColour;
 #define SDD_Name(x) true_##x
@@ -87,9 +88,8 @@
 static void SDD_Name(Host_ChangeMode)(ARMul_State *state,int width,int 
height,int hz)
 {
   if (width > MaxVideoWidth || height > MaxVideoHeight) {
-      fprintf(stderr, "Resize_Window: new size (%d, %d) exceeds maximum (%d, 
%d)\n",
+      ControlPane_Error(EXIT_FAILURE,"Resize_Window: new size (%d, %d) exceeds 
maximum (%d, %d)\n",
           width, height, MaxVideoWidth, MaxVideoHeight);
-          exit(EXIT_FAILURE);
   }
 
   HD.XScale = 1;


------------------------------------------------------------------------------
Everyone hates slow websites. So do we.
Make your web apps faster with AppDynamics
Download AppDynamics Lite for free today:
http://p.sf.net/sfu/appdyn_sfd2d_oct
-- 
arcem-cvs mailing list
arcem-cvs@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/arcem-cvs

Reply via email to