[ES40-developers] Patch: Configurator syntax checking
Status: Alpha
Brought to you by:
iamcamiel
From: brian w. <bdw...@in...> - 2008-02-23 20:31:43
|
This is basically the Configurator.cpp that I sent the other day, except in patch form. Here's how it works: On the first pass (parent==0) the file is stripped down to the essentials and the c-comments, strings, and braces are checked to verify they are closed correctly. My configuration file is turned into this string: gui=sdl{keyboard.use_mapping=false;keyboard.map="keys.map";} sys0=tsunami{rom.srm="../rom/cl67srmrom.exe";rom.decompressed="../rom/decompressed.rom"; rom.flash="../rom/flash.rom";rom.dpr="../rom/dpr.rom";memory.bits=30; cpu0=ev68cb{icache=false;}pci0.7=ali{mouse.enabled=true;lpt.outfile="lpt.out"; vga_console=true;}pci0.15=ali_ide{disk0.0=file{file="../img/scratch.dsk"; read_only=false;cdrom=false;}disk1.0=file{file="../img/alphacd-3.1.1.iso"; read_only=true;cdrom=true;}}pci0.19=ali_usb{}pci0.2=cirrus{ rom="../rom/vgabios-0.6a.debug.bin";}pci0.3=sym53c810{}serial0=serial{port=21264; action="xterm -e telnet localhost 21264";}} When all of the whitespace and comments are removed, the configuration parser becomes much simpler: state transitions are direct (instead of having to go through a 'done' phase, and no syntax checking is required since the first pass already took care of it. Brian |