X-Authentication-Warning: delorie.com: mail set sender to geda-user-bounces using -f X-Recipient: geda-user AT delorie DOT com X-TCPREMOTEIP: 207.224.51.38 X-Authenticated-UID: jpd AT noqsi DOT com Content-Type: text/plain; charset=windows-1252 Mime-Version: 1.0 (Mac OS X Mail 7.3 \(1878.6\)) Subject: Re: [geda-user] Using Lua to safely read configuration and layout files (program attached) From: John Doty In-Reply-To: <3252013.jziFbvHuEb@jasum> Date: Sun, 8 Feb 2015 11:21:21 -0700 Message-Id: <130419BB-B323-48C5-907B-40C543EECBD6@noqsi.com> References: <66DD3BF9-092C-4EFF-B12D-6214141C152D AT icloud DOT com> <52E0C8E3-2FD3-4D79-A01D-962E7EFA6D4F AT noqsi DOT com> <3252013 DOT jziFbvHuEb AT jasum> To: geda-user AT delorie DOT com X-Mailer: Apple Mail (2.1878.6) Content-Transfer-Encoding: 8bit X-MIME-Autoconverted: from quoted-printable to 8bit by delorie.com id t18ILPLk023924 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 Precedence: bulk On Feb 8, 2015, at 10:55 AM, Christian Riggenbach wrote: > On Sunday 08 February 2015 10.09:06 you wrote: >> In Lua’s representation. Not as a Scheme data structure. You have exactly >> the same problem the C implementation has: you must expose the data through >> a Scheme API. You’re not really solving any problems, just torquing the >> design to fit your Lua prejudice. > > The workflow would look like this: > > 1. start the lua core and load custom modules like eg. filesystem or hex- > parser, some global defaults and the custom functions for geda (like > netlisting, data objects for lines, pins etc) > 2. load and parse all config+macro files: system, user then local (like todays > gafrc and friends) > 3. load and parse the schematic > > Now you have all the data inclusive the middle layer in the lua core, A step backward from the files unless you’re writing in Lua. Any application can read a file, but FFI’s are messy. > so you > don't have an internal representation per application anymore (or just for > specialised tasks like graphical representation or sorting algorithms). The > core is ready to exchange the data back with gschem/gnetlist/etc. Except that every application needs an internal representation that’s different from Lua’s if it’s not in Lua. > > 4. seriealise it back to the schematic file to save the data. > > gnetlist would then just be a simple wrapper around lua to do point 1-3, load > a custom script (or an interactive prompt) and point 4. But gnetlist already does 1-3. That’s not the hard part, so you haven’t helped. All you’ve done is break a lot of existing code. > In all whole suite, > you would have the exact same API to access the data, either with C code or > directly in lua. Python? AWK? Perl? Scheme? Matlab? C and Lua are not the universe. But any of these can read a line-oriented file, especially one that’s essentially pre-parsed. John Doty Noqsi Aerospace, Ltd. http://www.noqsi.com/ jpd AT noqsi DOT com