[Author Prev][Author Next][Thread Prev][Thread Next][Author Index][Thread Index]

gEDA-cvs: gaf.git: branch: master updated (1.6.1-20100214-174-gd5860bb)



The branch, master has been updated
       via  d5860bb3620502efcea4185380a6945d0c5eab41 (commit)
      from  f66597934bf8c88519396956637792533ba3a151 (commit)

Those revisions listed above that are new to this repository have
not appeared on any other notification email; so we list those
revisions in full, below.


=========
 Summary
=========

 gnetlist/scheme/gnet-osmond.scm |   96 ++++++++++++++-------------------------
 1 files changed, 35 insertions(+), 61 deletions(-)


=================
 Commit Messages
=================

commit d5860bb3620502efcea4185380a6945d0c5eab41
Author: John Doty <jpd@xxxxxxxxx>
Commit: Peter TB Brett <peter@xxxxxxxxxxxxx>

    gnetlist: Refactor 'osmond' backend for simplicity.
    
    As I said on the chat, I've refactored gnet-osmond. Only four
    functions. The longest is five lines, the deepest is only three
    parentheses deep. No recursion needed. Much simpler than the original
    "cargo cult" version.
    
    Signed-off-by: Peter TB Brett <peter@xxxxxxxxxxxxx>

:100644 100644 d0b7851... 89d59ba... M	gnetlist/scheme/gnet-osmond.scm

=========
 Changes
=========

commit d5860bb3620502efcea4185380a6945d0c5eab41
Author: John Doty <jpd@xxxxxxxxx>
Commit: Peter TB Brett <peter@xxxxxxxxxxxxx>

    gnetlist: Refactor 'osmond' backend for simplicity.
    
    As I said on the chat, I've refactored gnet-osmond. Only four
    functions. The longest is five lines, the deepest is only three
    parentheses deep. No recursion needed. Much simpler than the original
    "cargo cult" version.
    
    Signed-off-by: Peter TB Brett <peter@xxxxxxxxxxxxx>

diff --git a/gnetlist/scheme/gnet-osmond.scm b/gnetlist/scheme/gnet-osmond.scm
index d0b7851..89d59ba 100644
--- a/gnetlist/scheme/gnet-osmond.scm
+++ b/gnetlist/scheme/gnet-osmond.scm
@@ -16,68 +16,42 @@
 ;;; along with this program; if not, write to the Free Software
 ;;; Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
 
-;;
-;; Parts list 
-;;
-(define osmond:parts
-   (lambda (port ls)
-      (if (not (null? ls))
-         (let ((package (car ls)))
-            (begin
-	       (display "Part " port)
-               (display (gnetlist:get-package-attribute package "footprint") port)
-	       (display " { Name " port)
-	       (display package port )
-	       (display " }" port)
-               (newline port)
-               (osmond:parts port (cdr ls)))))))
+; Export a design to Osmond PCB
 
-;;
-;; List all connections to a net
-;;
-(define (osmond:list-connections nets)
-  (let ((k ""))
-    (for-each (lambda (in-string)
-                (set! k (string-append k in-string)))
-              (map (lambda (net)
-                     (string-append " " (car net) "-" (car (cdr net))))
-                   nets))
-   k))
+(define (osmond filename)
+	(set-current-output-port (open-output-file filename))
+	(for-each osmond:part packages)
+	(for-each osmond:signal all-unique-nets))
 
-;
-; Write out each signal
-;
-(define osmond:write-signal
-   (lambda (port signals)
-      (if (not (null? signals))
-         (let ((signal (car signals)))
-	    (begin
-	       (display "Signal " port )
-	       (write-char #\" port)
-	       (display signal port)
-	       (write-char #\" port)
-               (newline port)
-	       (display "  {" port)
-               (display (osmond:list-connections 
-	          (gnetlist:get-all-connections signal)) port)
-	       (display " }" port)
-	       (newline port)
-	       (osmond:write-signal port (cdr signals)))))))
-	              
-;;
-;; Write out all the signals
-;;	       
-(define osmond:signal
-   (lambda (port)
-      (let ((all-uniq-nets (gnetlist:get-all-unique-nets "dummy")))
-         (osmond:write-signal port all-uniq-nets))))
 
+; The first section of the file consists of a list of packages,
+; one per line. For example:
+; Part 0603 { Name R4 }
 
-(define osmond 
-   (lambda (output-filename)
-      (let ((port (open-output-file output-filename)))
-         (begin
-	    (osmond:parts port packages)
-	    (osmond:signal port)
-         )
-         (close-output-port port))))
+(define (osmond:part package)
+	(format #t
+		"Part ~A { Name ~A }\n"
+		(gnetlist:get-package-attribute package "footprint")
+		package))
+
+
+; The next section of the file consists of a list of nets.
+; Each entry takes two lines. For example:
+; Signal "unnamed_net6"
+;   { R4-1 R3-2 C3-2 }
+
+(define (osmond:signal net)
+	(format #t "Signal \"~A\"\n  {" net)
+	(for-each osmond:pin (gnetlist:get-all-connections net))
+	(format #t " }\n"))
+
+
+; gnetlist represents a connection as a two-element list of the form:
+; (refdes pinnumber)
+; Convert to " refdes-pinnumber"
+
+(define (osmond:pin connection)
+	(format #t
+		" ~A-~A"
+		(car connection)	; refdes
+		(cadr connection)))	; pin number




_______________________________________________
geda-cvs mailing list
geda-cvs@xxxxxxxxxxxxxx
http://www.seul.org/cgi-bin/mailman/listinfo/geda-cvs