www.delorie.com/archives/browse.cgi   search  
Mail Archives: geda-user/2015/02/08/10:32:28

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
Mime-Version: 1.0 (Mac OS X Mail 7.3 \(1878.6\))
Subject: Re: [geda-user] FOSDEM
From: John Doty <jpd AT noqsi DOT com>
In-Reply-To: <5583C086-E36C-4E79-BB7A-CCCCCDEE5686@icloud.com>
Date: Sun, 8 Feb 2015 08:30:33 -0700
Message-Id: <DA23C6BD-501B-47B2-8AAF-C713581021E9@noqsi.com>
References: <1420499386 DOT 3521 DOT 3 DOT camel AT cam DOT ac DOT uk> <20150202152654 DOT GA13336 AT cuci DOT nl> <54CFD589 DOT 9040702 AT xs4all DOT nl> <CAHBYzfRkn-nJb4JfrDYyaD0WwPrpZvAgi0QdHCusgz185iNoHA AT mail DOT gmail DOT com> <CAGde_xN-iNZUvHh-E47kx1EyoPRt1018wWiDwHhYQ9+od+cJwA AT mail DOT gmail DOT com> <20150203112631 DOT 3507a0c1 AT Parasomnia DOT thuis DOT lan> <20150204054256 DOT Horde DOT Pm1JV8RJbICk9SHvIGwZ7A3 AT webmail DOT in-berlin DOT de> <CAOP4iL2stWVCy3WK0=SNu2zAbs8t6B0uyAgFuOnzG8v_MrYNfw AT mail DOT gmail DOT com> <CAGde_xN5gs5r_on=HP2RN7cy6E=2EL9eK3cp+sd9BfBaWNLVew AT mail DOT gmail DOT com> <20150204193720 DOT Horde DOT 42xUN-NzhCJRWZne-M5eCQ1 AT webmail DOT in-berlin DOT de> <90236728-E79D-47C7-BFB1-34140DB85ACB AT sbcglobal DOT net> <CAOFvGD4M48Ap=UQzL_T3yzas2rJrNFfxXRUOkOe8gA8J3bQCHg AT mail DOT gmail DOT com> <201502042333 DOT t14NX28o024789 AT envy DOT delorie DOT com> <7C1A5871-3056-482C-BC58-173D90D80F77 AT icloud DOT com> <CAOFvGD7vdircWqDYWKrKPY49gpYo4ZGsw20q9yE+4+gno3ZkhA AT mail DOT gmail DOT com> <F66800B5-AAC3-459C-B6BC-B2F1E4AC98CC AT noqsi DOT com> <EF4852DC-EDAF-4BDA-878B-1E76E7E737D1 AT icloud DOT com> <13D9CC45-143D-42C2-B3A5-43D8CDD9!
8E35 AT icloud DOT com> <38B551E5-A593-4B72-9156-823A8B4B31F1 AT noqsi DOT com> <5583C086-E36C-4E79-BB7A-CCCCCDEE5686 AT icloud DOT com>
To: geda-user AT delorie DOT com
X-Mailer: Apple Mail (2.1878.6)
X-MIME-Autoconverted: from quoted-printable to 8bit by delorie.com id t18FUjhh006309
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 Feb 8, 2015, at 4:22 AM, Chris Smith <space DOT dandy AT icloud DOT com> wrote:

> 
>> On 7 Feb 2015, at 21:19, John Doty <jpd AT noqsi DOT com> wrote:
>>> On Feb 7, 2015, at 1:44 PM, Chris Smith <space DOT dandy AT icloud DOT com> wrote:
>>> 
>>> It's just a text file and AWK and sed are text processors.
>> 
>> Except that they are line oriented. Things like AWK and cut are field oriented at the next level. What are your record and field punctuation? How would you do the following in your system?
>> 
>> awk '/^C /{print $7}' Interface.*.sch | sort | uniq
> 
> This is what a simple schematic might look like as a valid Lua construct. I've deliberately formatted it to look as close to the gEDA format as possible:
> schematic = { {
> 'v', 20110115, 2 },{
> 'C', 40000, 40000, 0, 0, 0, 'title-B.sym' },{
> 'C', 46000, 48700, 1, 0, 0, 'vcc-1.sym' },{
> 'C', 46100, 46000, 1, 0, 0, 'gnd-1.sym' },{
> 'C', 46300, 47600, 1, 90, 0, 'resistor-2.sym',
> {
> 'T', 45950, 48000, 5, 10, 0, 0, 90, 0, 1,
> device='RESISTOR' },{
> 'T', 46000, 48300, 5, 10, 1, 1, 180, 0, 1,
> refdes='R1' },{
> 'T', 45700, 47800, 5, 10, 1, 1, 0, 0, 1,
> value='10k' }
> }, {
> 'C', 46300, 46500, 1, 90, 0, 'resistor-2.sym',
> {
> 'T', 45950, 46900, 5, 10, 0, 0, 90, 0, 1,
> device='RESISTOR' },{
> 'T', 46000, 47200, 5, 10, 1, 1, 180, 0, 1,
> refdes='R2' },{
> 'T', 45700, 46700, 5, 10, 1, 1, 0, 0, 1,
> value='20k' }
> }, {
> 'N', 46200, 48500, 46200, 48700, 4 },{
> 'N', 46200, 47600, 46200, 47400, 4 },{
> 'N', 46200, 46500, 46200, 46300, 4 }
> }
> Chris
> 

Shudder. Here anybody who’s processing this in a textutilish way needs to write a whole bunch of extra stuff to remove all of the unneeded punctuation. “5” is a perfectly good number, but “5,” isn’t. 

This also demonstrates the sort of misconception that can creep in with this approach. “device=‘resistor’” is wrong: to the parser, text is text. Whether the “=“ is to be interpreted depends on what you are doing. In text sometimes there’s no “=“, sometimes more than one. Often, “=" punctuates an attribute, but sometimes it’s just part of a note to the reader. Not the parser’s call.

The file format should be language-neutral. We have that now. If it ain’t broke, don’t fix it. If Lua is as good as you claim, you could have written a parser for the existing format in the time we’ve wasted here. What problem does changing the file format solve?

John Doty              Noqsi Aerospace, Ltd.
http://www.noqsi.com/
jpd AT noqsi DOT com



- Raw text -


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