← Back to team overview

kicad-developers team mailing list archive

Re: RS274X file format.


Dick Hollenbeck wrote:
> Wayne Stambaugh wrote:
>> Does any one know if the RS274X aperture definition "%ADD26MTHOLE,
>> 0.0300 X0.0100 X0.0050 X0.0*%" is valid? The Gerbview parser is choking
>> on the spaces between the optional X parameters. The fix is trivial but
>> is this best way to procedeed? At the very least Gerbview should
>> complain about an invalid gerber file.
> Yes. I share that philosophy, and in one instance where I had 
> sufficient time to spend on putting it into Kicad, I wrote the lexer and 
> parser that are in the specctra import. That code uses exceptions and 
> tells you exactly which line and exactly which character offset into the 
> reported line is the problem. So you get line number and character 
> offset, which lets you load the file into a text editor and look at it.

Unfortunately, I needed a quick fix to import these GERBER files. At
least now the parser won't choke on white space. I would have preferred
to implement a more robust solution but I don't have that kind of time
to commit. There is no way (at least that I am willing to attempt) the
current code will support exceptions cleanly.

> By using exceptions, it was possible to keep the "error reporting UI 
> code" out of the low level parser and up at a higher calling layer where 
> the catch resides.

I like this solution as well. I know in the past there were some issues
using exceptions with wxWidgets. I don't know if that is still the
case. I have avoided using them to prevent portability issue between
compilers. My only suggestion is to make parsers stream based for
flexibility rather than just file based.

> It may take another few years, but this might be nice long term 
> direction for other parts of Kicad also.

Agreed. Most of the current file parsers still use C scanf and strxxx
functions or byte by byte parsing with little or no error checking. I'm
sure a lot of this is legacy code. We'll have to keep chipping away at
it. Rome wasn't built in a day.


> Dick

<< snipped >>


Follow ups