www.delorie.com/archives/browse.cgi   search  
Mail Archives: geda-user/2015/02/08/06:48:02

X-Authentication-Warning: delorie.com: mail set sender to geda-user-bounces using -f
X-Recipient: geda-user AT delorie DOT com
From: Christian Riggenbach <criggenbach AT magahugu DOT ch>
To: geda-user AT delorie DOT com
Subject: Re: [geda-user] Using Lua to safely read configuration and layout files (program attached)
Date: Sun, 08 Feb 2015 12:47:39 +0100
Message-ID: <3709636.NVszrDDjOR@jasum>
User-Agent: KMail/4.14.4 (Linux/3.18.4-1-ARCH; KDE/4.14.4; x86_64; ; )
In-Reply-To: <20150208003842.63db8a55@jive>
References: <CAOFvGD7pJTo8A=MXVbuuXO=++0vGukUyqVfckVtnCi99ziqWJQ AT mail DOT gmail DOT com> <32380475 DOT xlWdxyhFd9 AT jasum> <20150208003842 DOT 63db8a55 AT jive>
MIME-Version: 1.0
Reply-To: geda-user AT delorie DOT com
Errors-To: nobody AT delorie DOT com
X-Mailing-List: geda-user AT delorie DOT com
X-Unsubscribes-To: listserv AT delorie DOT com

On Sunday 08 February 2015 00.38:42 you wrote:
> I wouldn't use ANY scripts in the PCB or sch file. That would make life
> very hard.

I think the approach of Jason White to prohibit the execution of scripts in 
the loading stage is great. No loops, ifs or other constructs, just tables 
with function-"pointers".

> I'd use <whatever scripting language> to parse the data in a
> file. This is the task to be done, just don't overcomplicate the solution. I
> would be happy if it was Lua, but we could roll our own language and
> parser.

I wouldn't write another custom parser. I would harness the power of an 
existing parser and define a couple of functions like schematics.line(), 
schematics.pin() etc. to define the data. Then some middlelayer to generate the 
netlist. Now you have all the data with a simple interface. With a object 
oriented aproach, you could also define a object for the attributes like the 
coordinates, refdes etc. with proper recursion (define in the symbol, overwrite 
in the instance) for free. Embedding the symbols would be a mater of defining 
them in the header, so you could have selfcontained schematics with a 
"schematic-globaly" editable instance.

Also serialising the data in lua is relatively easy, there are different 
preexisting modules out there. To write another with custom logic like 
alphabetic sorting with the refdes, or top left to bottom right for free lines 
and nets should be possible.

If you use an versioning system for the schematics today, you get a mess of 
chopped "gibberish" now, as the normal line based patches are not human 
readable.

> If there is something we can do, it doesn't mean we must do it.

Yeah, absolutely. I'm just brainstorming ;)

I'm no fanboy of lua, but with an standartised, scriptable data format, adding 
a custom netlister or other small housekeeping jobs like autonumbering, 
autoslotting should be straightforward. My dream would be a console in gschem 
(or standalone) for executing our own scriptlets directly on the life data.

-- 
mit freundlichem Gruss

Christian Riggenbach

- Raw text -


  webmaster     delorie software   privacy  
  Copyright © 2019   by DJ Delorie     Updated Jul 2019