kicad-developers team mailing list archive
-
kicad-developers team
-
Mailing list archive
-
Message #39699
Re: Patch: Legacy symbol read/write extraction; SCH_PLUGIN registry mechanism
(Previously: "Can IO_MGR from pcbnew be used?")
I've taken a brief look at the IO_MGR code from pcbnew with an eye
toward merging its functionality with the SCH_IO_PLUGIN_REGISTRY I
submitted in my patch. Obviously the idea is the same, but the
implementation details are rather different; in particular, my
registry's use of dynamically-assigned ID numbers in place of a static
enum. I think some discussion is in order to decide on which ideas
should make it into a unified plugin registry (something I'm definitely
in favor of and would be happy to contribute to the project). Some
talking points:
1. What's the right thing to use as a public unique key? I like
strings because they can be done in a decentralized fashion and a plugin
writer needn't touch anything but his or her own code, but of course the
down side is there must be some means of preventing collisions, e.g. two
different plugins can't register themselves both as "EAGLE". Get many
plugins and it starts to become troublesome to find out what keys are
already in use, which is an argument in favor of some form of central
authority. This could simply be a header with a set of #defined string
literals.
2. What to do if multiple plugins might want to work on files with the
same extension? Maybe we take the approach of invoking plugins in a
sequence until one reports success? That might not be too painful if
files are easily differentiable without reading too far into them.
3. Where does this unified code live? common? I think I'm correct in
guessing we don't want to introduce link dependencies between the major
targets (e.g. between eeschema.kiface and pcbnew.kiface)
I'm sure there are other things to figure out; those are just a few I
can think of.
As an aside, I'm going to separate my initial submission into two
separate patches (which I probably should've done from the start) so
that the extracted legacy read/write can be merged (upon approval,
obviously) without waiting for us to settle on the details for the
unified plugin registry.
Cheers,
-Brian
Follow ups
References