Re: [ES40-developers] Patch: graceful shutdown if syntax error in config
Status: Alpha
Brought to you by:
iamcamiel
From: Camiel V. <iam...@gm...> - 2008-02-05 10:24:39
|
Hello all, Brian's patch has been applied to the CVS repository. As is mentioned in the comments for the CConfigurator constructor: * \bug This needs to be more robust! As it is now, this code was more or less "hacked together" in a * few minutes. Also, more comments should be provided to make it more readable. The Configurator works fine as long as the config-file is valid; if it isn't, it could probably go wrong in many places. If anyone would like to have a go at building in more checks, please do so. The same goes for all issues listed in the "bugs" and "todo" pages on http://es40.sourceforge.net. Also if you know of any issues that are not on one of these lists, please let me know. Camiel. On Feb 4, 2008 8:52 PM, brian wheeler <bdw...@in...> wrote: > It looks like the configurator doesn't catch missing '}' in the > configuration file. This patch catches when theSystem doesn't get setup > correctly and exits gracefully instead of segfaulting when trying to > load the rom file. > > Brian > > =================================================================== > diff -u -r1.38 AlphaSim.cpp > --- AlphaSim.cpp 26 Jan 2008 12:21:59 -0000 1.38 > +++ AlphaSim.cpp 4 Feb 2008 19:51:47 -0000 > @@ -253,6 +253,11 @@ > fclose(f); > free(ch1); > > + if(!theSystem) { > + printf("%%SYS-F-INIT: Initialization of system has failed. > Syntax error in config?.\n",theSystem); > + exit(1); > + } > + > #if defined(IDB) > trc = new CTraceEngine(theSystem); > #endif > ==================================================================== > > > ------------------------------------------------------------------------- > This SF.net email is sponsored by: Microsoft > Defy all challenges. Microsoft(R) Visual Studio 2008. > http://clk.atdmt.com/MRT/go/vse0120000070mrt/direct/01/ > _______________________________________________ > Es40-developers mailing list > Es4...@li... > https://lists.sourceforge.net/lists/listinfo/es40-developers > |