Update of /cvsroot/arcem/arcem In directory vz-cvs-4.sog:/tmp/cvs-serv13637
Modified Files: armemu.c dagstandalone.c hostfs.c hostfs.h 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: armemu.c =================================================================== RCS file: /cvsroot/arcem/arcem/armemu.c,v retrieving revision 1.18 retrieving revision 1.19 diff -u -d -r1.18 -r1.19 --- armemu.c 21 Jul 2012 01:01:11 -0000 1.18 +++ armemu.c 21 Oct 2012 16:59:31 -0000 1.19 @@ -22,6 +22,7 @@ #include <time.h> #include "prof.h" #include "arch/archio.h" +#include "ControlPane.h" ARMul_State statestr; @@ -68,7 +69,7 @@ fprintf(stderr,"LoadInstr: %08x maps to entry %08x res %08x (mode %08x pc %08x)\n",addr,entry,res,MEMC.FastMapMode,state->Reg[15]); fprintf(stderr,"-> data %08x pfunc %08x instr %08x func %08x using ofs %08x\n",data,pfunc,instr,temp,MEMC.FastMapInstrFuncOfs); fprintf(stderr,"But should be %08x!\n",ARMul_Emulate_DecodeInstr(instr)); - exit(5); + ControlPane_Error(5,"AMul_LoadInstr failure\n"); } #endif p->func = temp; @@ -1185,8 +1186,7 @@ } if(!loops) { - fprintf(stderr,"Runaway loop in EventQ. Head event func %08x time %08x (local_time %08x)\n",state->EventQ[0].Func,state->EventQ[0].Time,loops); - exit(1); + ControlPane_Error(1,"Runaway loop in EventQ. Head event func %08x time %08x (local_time %08x)\n",state->EventQ[0].Func,state->EventQ[0].Time,loops); } #endif Index: hostfs.h =================================================================== RCS file: /cvsroot/arcem/arcem/hostfs.h,v retrieving revision 1.5 retrieving revision 1.6 diff -u -d -r1.5 -r1.6 --- hostfs.h 30 Jul 2012 21:26:24 -0000 1.5 +++ hostfs.h 21 Oct 2012 16:59:31 -0000 1.6 @@ -16,6 +16,7 @@ #define rpclog(...) fprintf(stderr,__VA_ARGS__) #define error(...) fprintf(stderr,__VA_ARGS__) +#define hostfs_error(code,...) ControlPane_Error(code,__VA_ARGS__) #define HOSTFS_ARCEM /* Build ArcEm version, not RPCEmu */ Index: hostfs.c =================================================================== RCS file: /cvsroot/arcem/arcem/hostfs.c,v retrieving revision 1.21 retrieving revision 1.22 diff -u -d -r1.21 -r1.22 --- hostfs.c 30 Jul 2012 21:26:24 -0000 1.21 +++ hostfs.c 21 Oct 2012 16:59:31 -0000 1.22 @@ -87,6 +87,7 @@ #include "arch/armarc.h" #include "arch/ArcemConfig.h" #include "arch/filecalls.h" +#include "ControlPane.h" #define HOSTFS_ROOT hArcemConfig.sHostFSDirectory @@ -228,8 +229,7 @@ { switch(errno) { case ENOMEM: /* Out of memory */ - fprintf(stderr, "HostFS out of memory in %s: \'%s\'\n",function,strerror(errno)); - exit(EXIT_FAILURE); + hostfs_error(EXIT_FAILURE,"HostFS out of memory in %s: \'%s\'\n",function,strerror(errno)); break; case ENOENT: /* Object not found */ @@ -279,9 +279,8 @@ if (buffer_size_needed > buffer_size) { buffer = realloc(buffer, buffer_size_needed); if (!buffer) { - fprintf(stderr, "HostFS could not increase buffer size to %lu bytes\n", + hostfs_error(EXIT_FAILURE,"HostFS could not increase buffer size to %lu bytes\n", (unsigned long) buffer_size_needed); - exit(EXIT_FAILURE); } buffer_size = buffer_size_needed; } @@ -1751,8 +1750,7 @@ cache_names = malloc(cache_names_capacity); } if ((!cache_entries) || (!cache_names)) { - fprintf(stderr, "hostfs_cache_dir(): Out of memory\n"); - exit(1); + hostfs_error(1,"hostfs_cache_dir(): Out of memory\n"); } /* Read each of the directory entries one at a time. @@ -1790,8 +1788,7 @@ cache_names_capacity *= 2; cache_names = realloc(cache_names, cache_names_capacity); if (!cache_names) { - fprintf(stderr, "hostfs_cache_dir(): Out of memory\n"); - exit(1); + hostfs_error(1,"hostfs_cache_dir(): Out of memory\n"); } } @@ -1808,8 +1805,7 @@ cache_entries_capacity *= 2; cache_entries = realloc(cache_entries, cache_entries_capacity * sizeof(cache_directory_entry)); if (!cache_entries) { - fprintf(stderr, "hostfs_cache_dir(): Out of memory\n"); - exit(1); + hostfs_error(1,"hostfs_cache_dir(): Out of memory\n"); } } } @@ -1850,8 +1846,7 @@ cache_names_capacity *= 2; cache_names = realloc(cache_names, cache_names_capacity); if (!cache_names) { - fprintf(stderr, "hostfs_cache_dir(): Out of memory\n"); - exit(1); + hostfs_error(1,"hostfs_cache_dir(): Out of memory\n"); } } @@ -1868,8 +1863,7 @@ cache_entries_capacity *= 2; cache_entries = realloc(cache_entries, cache_entries_capacity * sizeof(cache_directory_entry)); if (!cache_entries) { - fprintf(stderr, "hostfs_cache_dir(): Out of memory\n"); - exit(1); + hostfs_error(1,"hostfs_cache_dir(): Out of memory\n"); } } } Index: dagstandalone.c =================================================================== RCS file: /cvsroot/arcem/arcem/dagstandalone.c,v retrieving revision 1.12 retrieving revision 1.13 diff -u -d -r1.12 -r1.13 --- dagstandalone.c 12 May 2012 17:34:51 -0000 1.12 +++ dagstandalone.c 21 Oct 2012 16:59:31 -0000 1.13 @@ -31,6 +31,7 @@ #include "armdefs.h" #include "ArcemConfig.h" +#include "ControlPane.h" /**************************************************************/ /* Signal handler that terminates excecution in the ARMulator */ @@ -55,9 +56,8 @@ #endif static void InitFail(int exitcode, char const *which) { - fprintf(stderr, "%s interface failed to initialise. Exiting\n", + ControlPane_Error(exitcode,"%s interface failed to initialise. Exiting\n", which); - exit(exitcode); } /** ------------------------------------------------------------------------------ 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