| www.delorie.com/archives/browse.cgi | search |
| X-Authentication-Warning: | delorie.com: mail set sender to geda-user-bounces using -f |
| X-Recipient: | geda-user AT delorie DOT com |
| X-Google-DKIM-Signature: | v=1; a=rsa-sha256; c=relaxed/relaxed; |
| d=1e100.net; s=20130820; | |
| h=x-gm-message-state:mime-version:sender:in-reply-to:references:from | |
| :date:message-id:subject:to:content-type; | |
| bh=qv+LB/HlnSmnHnZuml5QEmfMk4nFz608vJNAkF9NcRc=; | |
| b=XosRb7tzJUTxtLbFWLi0DRiXUIUs6Xwjz/gkgBiMjlNfkX1zm6v15r9wECaEYGhhtd | |
| 2oUG5gh56b3AukqgrefAkUk1BqeY6LXydFSLKn6LiLcGWCwUSGZQN1RqkKCl9cNWpa9w | |
| H0CjHJPuXo65sgIo6vgfnglaRxBdO3bZV2PqSLPcKsDpQidE6kzrqi9w/gIiYCuTdF0l | |
| Xu5xFpmYjv5xz5Sqxd2MZfc3Fx3zypmqkP/FSiEhg/fRmvzJq4FJRORDeTO9EbE2iZsq | |
| wjQ5DPLwxq9/gWq6a2/TqH9E3PdyPgieQjSfSuw9zvU5MMz3fIfs5Yuas9Xzw37QjApt | |
| WPYg== | |
| X-Gm-Message-State: | ALoCoQktJy743a50Yr9i4iLpv1NFIocsXemoKZpvYRe0dHb10beR1uiBdR4CwnThHuQUv+98wZ+Y |
| X-Received: | by 10.152.121.42 with SMTP id lh10mr38022494lab.0.1436875075843; |
| Tue, 14 Jul 2015 04:57:55 -0700 (PDT) | |
| MIME-Version: | 1.0 |
| Sender: | mjd AT hackvana DOT com |
| X-Originating-IP: | [120.21.197.173] |
| In-Reply-To: | <alpine.DEB.2.11.1507102316100.2863@nimbus> |
| References: | <559E86A4 DOT 3040109 AT ecosensory DOT com> <DC183265-AD4B-4707-970F-1EE5D3578126 AT noqsi DOT com> |
| <201507091843 DOT t69IhGF6028321 AT envy DOT delorie DOT com> <6392CE1A-AFA0-4D62-979C-3F35786422BD AT noqsi DOT com> | |
| <201507092127 DOT t69LRHRC001744 AT envy DOT delorie DOT com> <559EFE69 DOT 1040601 AT zoot DOT drehmel DOT com> | |
| <201507092332 DOT t69NWUEN006109 AT envy DOT delorie DOT com> <alpine DOT DEB DOT 2 DOT 00 DOT 1507100501200 DOT 6924 AT igor2priv> | |
| <20150710132650 DOT GA15876 AT localhost DOT localdomain> <alpine DOT DEB DOT 2 DOT 00 DOT 1507101547500 DOT 6924 AT igor2priv> | |
| <20150710152308 DOT GA17023 AT localhost DOT localdomain> <alpine DOT DEB DOT 2 DOT 00 DOT 1507101813250 DOT 6924 AT igor2priv> | |
| <alpine DOT DEB DOT 2 DOT 11 DOT 1507102316100 DOT 2863 AT nimbus> | |
| From: | "Mitch Davis (mjd+geda-user AT hackvana DOT com) [via geda-user AT delorie DOT com]" <geda-user AT delorie DOT com> |
| Date: | Tue, 14 Jul 2015 21:57:36 +1000 |
| X-Google-Sender-Auth: | 7HJdvB-xm3Z4PKkfCsbRwfYEHBs |
| Message-ID: | <CA+KzSg+_mCiYjGNimu03WzJ43pOkxtVMNQRE7jaBpwjZVgPs+Q@mail.gmail.com> |
| Subject: | Re: [geda-user] why I parse sch: gnetlist, writing backends (Back annotation) |
| To: | geda-user AT delorie DOT com |
| 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 |
--089e011774857b8d5a051ad48c74
Content-Type: text/plain; charset=UTF-8
On Sat, Jul 11, 2015 at 7:34 AM, Roland Lutz <rlutz AT hedmen DOT org> wrote:
> On Fri, 10 Jul 2015, gedau AT igor2 DOT repo DOT hu wrote:
>
>> So next time I have something similar to solve, I will first ask you for
>> the scheme code and only if that fails I do the dirty sch-parsing awk
>> fewliner.
>>
>
> You could use Xorn. Since this uses the actual gEDA parsing code, the
> result is exactly what gEDA would see when reading the file. Taking the
> "outputting coords of line segments" task as an example, this would be:
>
> import xorn.storage
> from xorn.geda.read import read
>
> sch = read('some-schematic.sch')
>
> for ob in sch.toplevel_objects():
> data = ob.data()
> if isinstance(data, xorn.storage.Line):
> print 'X1: %d Y1: %d X2: %d Y2: %d' % (
> data.x, data.y, data.x + data.width, data.y + data.height)
>
I don't know why everyone is complaining about Scheme. I can read this
just fine, the first time I ever saw it.
M.
--089e011774857b8d5a051ad48c74
Content-Type: text/html; charset=UTF-8
Content-Transfer-Encoding: quoted-printable
<div class=3D"gmail_quote">On Sat, Jul 11, 2015 at 7:34 AM, Roland Lutz <sp=
an dir=3D"ltr"><<a href=3D"mailto:rlutz AT hedmen DOT org" target=3D"_blank">rl=
utz AT hedmen DOT org</a>></span> wrote:<br><blockquote class=3D"gmail_quote" s=
tyle=3D"margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex"><spa=
n class=3D"">On Fri, 10 Jul 2015, <a href=3D"mailto:gedau AT igor2 DOT repo DOT hu" ta=
rget=3D"_blank">gedau AT igor2 DOT repo DOT hu</a> wrote:<br>
<blockquote class=3D"gmail_quote" style=3D"margin:0 0 0 .8ex;border-left:1p=
x #ccc solid;padding-left:1ex">
So next time I have something similar to solve, I will first ask you for th=
e scheme code and only if that fails I do the dirty sch-parsing awk fewline=
r.<br>
</blockquote>
<br></span>
You could use Xorn.=C2=A0 Since this uses the actual gEDA parsing code, the=
result is exactly what gEDA would see when reading the file.=C2=A0 Taking =
the "outputting coords of line segments" task as an example, this=
would be:<br>
<br>
=C2=A0 =C2=A0 import xorn.storage<br>
=C2=A0 =C2=A0 from xorn.geda.read import read<br>
<br>
=C2=A0 =C2=A0 sch =3D read('some-schematic.sch')<br>
<br>
=C2=A0 =C2=A0 for ob in sch.toplevel_objects():<br>
=C2=A0 =C2=A0 =C2=A0 =C2=A0 data =3D ob.data()<br>
=C2=A0 =C2=A0 =C2=A0 =C2=A0 if isinstance(data, xorn.storage.Line):<br>
=C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 print 'X1: %d Y1: %d X2: %d Y=
2: %d' % (<br>
=C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 data.x, data.y, dat=
a.x + data.width, data.y + data.height)<br></blockquote><div><br>I don'=
t know why everyone is complaining about Scheme.=C2=A0 I can read this just=
fine, the first time I ever saw it.<br><br>M.<br></div></div>
--089e011774857b8d5a051ad48c74--
| webmaster | delorie software privacy |
| Copyright © 2019 by DJ Delorie | Updated Jul 2019 |