← Back to team overview

kicad-developers team mailing list archive

Re: Request in s-expression format: general user data or comment

 

On Jun 23, 2013 5:16 AM, "Dick Hollenbeck" <dick@xxxxxxxxxxx> wrote:
>
>
> On Jun 23, 2013 4:45 AM, "Thiadmer Riemersma" <
thiadmer.riemersma@xxxxxxxxx> wrote:
> >
> > Hello everyone,
> >
> > I have a request for the s-expression format for footprints: a field
for data that is not used by pcbnew or the module editor, but that is
preserved (by the module editor). Something like (fp_userdata "general text
string").
> >
> > In the alternative, I would like to request to be able to put comments
in an s-expression. Those comments need not be preserved (by the module
editor).
>
> Any line whose first character is a # is a comment now.  Should be no
limit to th numbrr of such lines.  So your alternative is being fulfilled
already, courtesy of yours truly.
>
> >
> > Rationale:
> >
> > I am developing a "footprint wizard", based on templates. But a wizard
won't be of much use if you cannot modify the footprints later. So, this
wizard reads back footprints and allows you to adjust them. However,
detecting which template was used (and with what settings) may not be
deterministically feasible, given the number of options.
> >
> > So, the best option is to store that information in the generated
footprint. Even if the user changes the footprint in the module editor, the
wizard would still be able to get the correct template.
> >
> > In the alternative (store the information in a comment), the user would
be able to adjust the footprint with the wizard, as long as no changes have
been made to it in the module editor. This is good enough for me.
> >
> > Question:
> >
> > I do not appear to be able to select an s-expression library in pcbnew.
Is this correct? Or do I need to build KiCad with a special option?
>
> Look at how the test program is built down in /tools.  I wrote a document
model parsing function that gives you a boost propert tree as a document.
>
> A second path is to try and lind to libcommon, but this will flop due to
unredolved ecternals if you stray too far from richio and dsnlexer.
>
> A final and third option is to link with _pcbnew.so which basically all
of pcbnew in DSO form.

Look at KICAD_PLUGIN::Footprint*() functions.  I would accept a patch which
preserves a multiline comment block thru a Load / Save () cycle if that
muliline comment is first in kicad_mod file.  Telling DSNLEXER to announce
comments is already there, just have to turn it on after construction, then
concatonate initial single line comments for subsequent Save (). Do not
change DSNLEXER.

This form of DSNLEXER usage is not document model.

Currently this is only built is SCRIPTING is bulit, but I will be changing
this in the next handful of weeks so it always gets built.
>
> Are you using wx as your ui?
>
> Dick
>
> >
> > Regards,
> > Thiadmer Riemersma
> >
> > _______________________________________________
> > Mailing list: https://launchpad.net/~kicad-developers
> > Post to     : kicad-developers@xxxxxxxxxxxxxxxxxxx
> > Unsubscribe : https://launchpad.net/~kicad-developers
> > More help   : https://help.launchpad.net/ListHelp
> >

References