← Back to team overview

kicad-developers team mailing list archive

Re: [RFC] Symbol library file format



On 03.01.19 19:06, José Ignacio wrote:

> I
> think useful comments to the proposed format should see beyond the
> actual low level representation of the data and talk about the overall
> model being used to store it.

tl;dr: That's a separate discussion.

There are two schools of thought here, one that treats saved data as a
protocol between two black box instances, and one that treats it as a
serialization of the internal state.

Both have advantages and disadvantages. The "protocol" approach allows
changing internals more easily, and gives better compatibility between
versions as changes to the file format have to be made deliberately,
while the "serialization" approach gives us load/save basically for
free, so we need a lot less code.

The "serialization" model also requires us to generate the internal data
structures from a more constrained language like IDL, as the marshaller
needs to know when to follow pointers, and what members of an array are
actually valid.

I'm not sure there are generators that include support for spatial
indexes, though, which is pretty much a requirement for fast rendering,
so this is pretty much impossible at the moment, which places us in
"hand written load/save code" territory anyway.

We have also ignored diff/merge capability so far, which I believe is a
good thing because it cannot really be done on a textual level (schemas
are two-dimensional, PCBs are three-dimensional, so there is no normal
form with a consistent ordering of elements that will make the files

I fully expect both the internal model and the file format to change
significantly in the coming years as new features are added. The main
requirement for the file format is that it always needs to be possible
to read older files in some way, and to recognize when a file is newer
than the current parser understands.

It might be a good idea to also have an "extension" mechanism, where we
don't increase the version number when adding a new feature, but rather
mark files that actually use the new feature, so files written by newer
versions that don't use one of the newer functions can be read by older
versions. This would also be another point for "hand written" load/save.


Attachment: signature.asc
Description: OpenPGP digital signature

Follow ups