[Author Prev][Author Next][Thread Prev][Thread Next][Author Index][Thread Index]

Re: gEDA-user: Parsing and writing schematics with Perl



On Mon, 2008-04-21 at 00:05 +0200, fricker wrote:
> Hi all,
> 
> Is there a Perl interface to gschem I could use to:
> - parse a given set of schematic (or symbol) pages and get a data  
> structure of the full (flat) design
> - write back schematic (or symbol) pages given the same and modified  
> data structure (and do a backup first)
> 
> I already have something working that uses Parse::RecDescent (see  
> http://search.cpan.org/~dconway/Parse-RecDescent-v1.95.1/, I wrote  
> the grammar specification as an exercise based on http:// 
> geda.seul.org/wiki/geda:file_format_spec), but I know it might be  
> just Yet Another Gschem Parser... and was wondering if there was some  
> *simple user-level* API to libgeda I should be using instead (and how?).

No, libgeda isn't ready to define any external and gauranteed API, it
changes every release.

Also, due to some technical problems with Guile (the scripting language
it uses internally), we can't (in general) write language bindings for
it, even if we could make any API guarantee.

I started writing YANGP for Python, but realised it was going to be
tricky. My end approach was to write a C utility program which can work
with libgeda, then communicate with that program.

gschem's file format is quite simple and easy to parse, it may have been
quicker to implement the parser, but that's not really the kind of
coding I enjoy.

> Below is an example of such data structure output using Data::Dumper
> 
> Thanks,
> _jP
> 
> data = [
>           {

...

[snip example]

This kindof feels like a DOM tree in HTML / XML. If its a convenient
format for you to process, it looks quite neat.

What sort of processing are you needing to automate in this way?

Best regards,


-- 
Peter Clifton

Electrical Engineering Division,
Engineering Department,
University of Cambridge,
9, JJ Thomson Avenue,
Cambridge
CB3 0FA

Tel: +44 (0)7729 980173 - (No signal in the lab!)



_______________________________________________
geda-user mailing list
geda-user@xxxxxxxxxxxxxx
http://www.seul.org/cgi-bin/mailman/listinfo/geda-user