Mailing list archives : pcb-rnd

Date:Fri, 23 Dec 2016 04:14:27 +0100 (CET)
Subject:Re: [pcb-rnd] bug report : footprints from pcb-mainline
in-reply-to:327 from miloh <>
Thanks Evan, this was a real bug, fixed in r5875. (1.1.4 is not affected I 
On Thu, 22 Dec 2016, miloh wrote:
> I bisected to take a look at when this change occurred, it looks like
> it happened in pcb-rnd -r5657, which leads me to a workaround which
> may(probably will) have bad effects:
> If I add a line with the string "# release: pcb" on its own line in
> the footprint files(anywhere), pcb-rnd opens it from the commandline
> or the File menu pick "Load layout data to paste-buffer".
> However, since these are footprints and not complete layouts and
> intended to become part of a bigger valid 'pcb' filetype, perhaps that
> suggests why the parse validation was implemented.
Thank you, your bisecting saved me a lot of time! Actually you did most 
of the fix, I just had to copy two lines and type in "Element".
The fix was to teach io_pcb to recognize footprint files so it is willing 
to parse them again.
We need to open various file types with a dynamic number of plugins. 
Originally we just tried to open any file with all IO plugins but that 
resulted in a lot of error messages when lihata or kicad tried to parse 
.pcb or vice versa.
The fix is that each IO plugin gets a chance to look at the file _before_ 
really parsing it and report if the file looks like one it could parse. 
This is called a "test parse": we just read through the file, no real 
parser involved, and look for familiar patterns. Then say "yay" or "nay" 
and the loader will call the real parser only on the "yay-sayers".
For a .pcb file the test parse looks for the # release info or PCB[ or 
PCB(, ignoring all comments. Anything familiar needs to happen in the 
first 16 non-comment-non-empty lines and then we say we could try it, else 
we say no (so we don't need to read through a 4 gigabyte movie the user 
accidentally tried to open).
Unfortunately footprint is yet another special case with the original 
format. It obviously doesn't have a PCB[] becase it's not a board, but for 
some reason it doesn't have # release either. So we just didn't find 
anything familiar and said it's not ours.
The fix is that we also accept if the file has a line starting with 
Element[ or Element( in the first 16 significant lines (leading whitepsace 
is stripped).

Reply subtree:
329 Re: [pcb-rnd] bug report : footprints from pcb-mainline from