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

gEDA-cvs: CVS update: gnet-spice-sdb.scm



  User: sdb     
  Date: 05/12/27 09:13:29

  Modified:    .        gnet-spice-sdb.scm
  Log:
  Fix sorting bug in sort-spice-IO-pins.  Bug noticed by John Doty:
  
  IO pins were sorted as strings by refdes, not as numbers.  
  
  
  
  
  Revision  Changes    Path
  1.16      +34 -2     eda/geda/devel/gnetlist/scheme/gnet-spice-sdb.scm
  
  (In the diff below, changes in quantity of whitespace are not shown.)
  
  Index: gnet-spice-sdb.scm
  ===================================================================
  RCS file: /home/cvspsrv/cvsroot/eda/geda/devel/gnetlist/scheme/gnet-spice-sdb.scm,v
  retrieving revision 1.15
  retrieving revision 1.16
  diff -u -b -r1.15 -r1.16
  --- gnet-spice-sdb.scm	11 Sep 2005 16:12:35 -0000	1.15
  +++ gnet-spice-sdb.scm	27 Dec 2005 14:13:29 -0000	1.16
  @@ -1,4 +1,4 @@
  -;;; $Id: gnet-spice-sdb.scm,v 1.15 2005/09/11 16:12:35 sdb Exp $
  +;;; $Id: gnet-spice-sdb.scm,v 1.16 2005/12/27 14:13:29 sdb Exp $
   ;;;
   ;;; gEDA - GNU Electronic Design Automation
   ;;; gnetlist - GNU Netlist
  @@ -78,6 +78,9 @@
   ;;  9.11.2005 -- Incorporated patch from Paul Bunyk to enable netlisting of
   ;;               Josephson junctions and "K" mutual inductances.  Also enabled 
   ;;               netlisting of "COIL" devices as inductors.
  +;;  12.27.2005 -- Fix bug discovered by John Doty: spice-IO pins with refdes greater
  +;;                than P9 were sorted incorrectly (as strings).  Now they are sorted
  +;;                as numbers.
   ;;**********************************************************************************
   ;;
   ;;  Organization of gnet-spice-sdb.scm file:
  @@ -254,14 +257,43 @@
   ;;----------------------------------------------------------------
   ;;  This takes the list of io-pin-packages and sorts it in order of 
   ;;  refdes.
  +;;  Repaired on 12.27.2005 to correctly sort pin numbers > 9.
   ;;----------------------------------------------------------------
   (define spice-sdb:sort-spice-IO-pins 
     (lambda (package-list)
  -    (sort package-list string<?)
  +    ;;  Yes, this isn't good Scheme form.  Tough!  Writing this out
  +    ;;  in a functional programming form would be totally confusing!
  +    ;;  Note that this fcn requires that 
  +    ;;  each spice-IO pin have the same, single character prefix (i.e. 'P')
  +    (let* ((char-prefixes              (map car (map string->list package-list)))  ;; Pull off first char (prefix)
  +	   (prefixes                   (map string char-prefixes))                 ;; Make list of strings from prefixes
  +	   (split-numbers-list         (map cdr (map string->list package-list)))  ;; Pull off refdes numbers as list elements
  +	   (string-numbers-list        (map list->string split-numbers-list))      ;; Recombine split up (multidigit) number strings
  +	   (numbers-list               (map string->number string-numbers-list))   ;; Convert strings to numbers for sorting
  +	   (sorted-numbers-list        (sort numbers-list <))                      ;; Sort refdes numbers as numbers
  +	   (sorted-string-numbers-list (map number->string sorted-numbers-list)) ) ;; Create sorted list of refdes strings.
  +
  +      ;; (debug-spew "Packages found = \n")
  +      ;; (debug-spew package-list)
  +      ;; (debug-spew "\nPrefixes found = \n")
  +      ;; (debug-spew prefixes)
  +      ;; (debug-spew "\nNumbers found -- split-numbers-list\n")
  +      ;; (debug-spew split-numbers-list)
  +      ;; (debug-spew "\nNumbers found -- numbers-list\n")
  +      ;; (debug-spew numbers-list)
  +      ;; (debug-spew "\nSorted-numbers-list\n")
  +      ;; (debug-spew sorted-numbers-list)
  +      ;; (debug-spew "\nSorted-string-numbers-list\n")
  +      ;; (debug-spew sorted-string-numbers-list)
  +
  +      (map-in-order string-append  prefixes sorted-string-numbers-list)  ;; Laminate prefixes back onto refdes numbers & return.
  +
  +    )
     )
   )
   
   
  +
   ;;----------------------------------------------------------------
   ;;  Given a list of spice-IO packages (refdeses), this function returns the list
   ;;  of nets attached to the IOs.