www.delorie.com/archives/browse.cgi   search  
Mail Archives: geda-user/2015/02/16/05:36:45

X-Authentication-Warning: delorie.com: mail set sender to geda-user-bounces using -f
X-Recipient: geda-user AT delorie DOT com
DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed;
d=gmail.com; s=20120113;
h=date:from:to:subject:message-id:mail-followup-to:references
:mime-version:content-type:content-disposition
:content-transfer-encoding:in-reply-to:user-agent;
bh=fB4piqC29IEKzcq8SDVjbF66QlaxaCnVmgt1uhU3FOQ=;
b=Sd9DXIqu3IWKbgveqm7L8YyprI0RhgzZMOs1soSBEXcsIThN9FpCY1SCTvHsG3Htnf
7AwnswkENzBXHjMbmzyi6IkQN1nNgsVr3B52MCEw5ko7c7YvPeFh0gTKRWsjO7AWJaVL
b5+UIYv6sdjwQTm8doB6Hopau8dfBSg5uUFEKVeqYUHXv7ix/TZUPS3oGybnZZVIz1F6
yb3ylBpJt3IR7231nlbfTD08/SEso4ZoWQCZtHO+MbxNbnO314BFTxt7o/uzNkwmc1lH
CbNFRWGz/amU1RkGm1iDs2ICqOf6L9kuU9K0HAVGQozFhZT9zgqXTSfQrI+2xZgE6BxF
9KKg==
X-Received: by 10.112.172.131 with SMTP id bc3mr21279712lbc.79.1424082887913;
Mon, 16 Feb 2015 02:34:47 -0800 (PST)
Date: Mon, 16 Feb 2015 13:34:45 +0300
From: Vladimir Zhbanov <vzhbanov AT gmail DOT com>
To: geda-user AT delorie DOT com
Subject: Re: [geda-user] work on gEDA
Message-ID: <20150216103445.GA28499@localhost.localdomain>
Mail-Followup-To: geda-user AT delorie DOT com
References: <20150215021721 DOT 28d94fde AT jive>
<20150215092144 DOT EF6D381A5EB8 AT turkos DOT aspodata DOT se>
<alpine DOT DEB DOT 2 DOT 00 DOT 1502151046540 DOT 7324 AT igor2priv>
<alpine DOT DEB DOT 2 DOT 11 DOT 1502151524530 DOT 26783 AT nimbus>
<4CDE0B7D-C211-44CE-990C-758BE560656B AT noqsi DOT com>
<1424040627 DOT 18156 DOT 2 DOT camel AT cam DOT ac DOT uk>
<74CC75B2-6E07-4292-8ACE-655F64EB3744 AT noqsi DOT com>
MIME-Version: 1.0
In-Reply-To: <74CC75B2-6E07-4292-8ACE-655F64EB3744@noqsi.com>
User-Agent: Mutt/1.5.23 (2014-03-12)
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

--lrZ03NoBR/3+SXJZ
Content-Type: text/plain; charset=utf-8
Content-Disposition: inline
Content-Transfer-Encoding: 8bit

On Sun, Feb 15, 2015 at 07:40:51PM -1000, John Doty wrote:
...
> It’s more readable to me than the Scheme original, and I wrote the Scheme original. I think this is the future…

Would one of the attached versions of your backend be more
readable than your original :) ?

The key point here for me is using of clear names, so some
syntactic sugar makes things look more clear.

Though the more important thing I sort of see in Roland's code is
creating of two full internal netlists, that is net-based and
instance-based ones, before doing the work the backend wants to
do, which can be afterwards filtered by means of Scheme to pick
out the stuff you need to get the work done. I suspect some
refactoring to make gnetlist work in such a way would simplify
many backends (and probably solve some gnetlist inefficiencies).

(BTW, I don't like Python and don't want Scheme to be replaced
with it entirely in gEDA/gaf. However I agree that the osmond
backend code written by Roland is nice.)

Cheers,
  Vladimir

--lrZ03NoBR/3+SXJZ
Content-Type: text/plain; charset=utf-8
Content-Disposition: attachment; filename="gnet-osmond-1.scm"

; Export a design to Osmond PCB

; Some syntactic sugar
(define (package-footprint package)
  (gnetlist:get-package-attribute package "footprint"))
(define (package-refdes package) package)
(define (connection-refdes connection) (car connection))
(define (connection-pin-number connection) (cadr connection))
(define (net-connections net-name) (gnetlist:get-all-connections net-name))

(define (output-part p)
  (format #t "Part ~A { Name ~A }\n" (package-footprint p) (package-refdes p)))

(define (output-refdes-pinnumber c)
  (format #t " ~A-~A" (connection-refdes c) (connection-pin-number c)))

(define (output-signal net-name)
  (format #t "Signal \"~A\"\n  {" net-name)
  (for-each output-refdes-pinnumber (net-connections net-name))
  (format #t " }\n"))

; Main procedure
(define (osmond output-filename)
  (set-current-output-port (gnetlist:output-port output-filename))
  (for-each output-part packages)
  (for-each output-signal all-unique-nets))

--lrZ03NoBR/3+SXJZ
Content-Type: text/plain; charset=utf-8
Content-Disposition: attachment; filename="gnet-osmond-2.scm"

; Export a design to Osmond PCB

; Some syntactic sugar
(define (package-footprint package)
  (gnetlist:get-package-attribute package "footprint"))
(define (package-refdes package) package)
(define (connection-refdes connection) (car connection))
(define (connection-pin-number connection) (cadr connection))
(define (net-connections net-name) (gnetlist:get-all-connections net-name))

; Main procedure
(define (osmond output-filename)
  (set-current-output-port (gnetlist:output-port output-filename))
  (for-each
    (lambda (p)
      (format #t "Part ~A { Name ~A }\n" (package-footprint p) (package-refdes p)))
    packages)
  (for-each
    (lambda (net-name)
      (format #t "Signal \"~A\"\n  {" net-name)
      (for-each
        (lambda (c)
          (format #t " ~A-~A" (connection-refdes c) (connection-pin-number c)))
        (net-connections net-name))
      (format #t " }\n"))
    all-unique-nets))

--lrZ03NoBR/3+SXJZ--

- Raw text -


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