Here is an improvement patch to bom2 which gives a "qty" count with the
number of parts condensed onto each line.

Peter B, as discussed, I suspect this output routine is rather more
stack heavy than is really necessary. Perhaps (bom2:printbom ...) needs
to be split into more than one routine. It currently recurses both for
each component to print on a line, AND for each line of output. I
suspect it could be broken down into a routine for printing all the
refdes which belong on this line, and another for iterating over the
lines to print.

Best wishes,

-- 
Peter Clifton

Electrical Engineering Division,
Engineering Department,
University of Cambridge,
9, JJ Thomson Avenue,
Cambridge
CB3 0FA

Tel: +44 (0)7729 980173 - (No signal in the lab!)
--- gedasrc/git/gnetlist/scheme/gnet-bom2.scm	2008-01-13 14:31:05.000000000 +0000
+++ gnet-bom2.scm	2008-07-17 22:12:40.000000000 +0100
@@ -38,25 +38,29 @@
 		      (current-output-port)
 		      (open-output-file output-filename)))
 	  (attriblist (bom2:parseconfig (open-input-file "attribs"))))
-      (bom2:printlist (cons 'refdes attriblist) port #\:)
+      (bom2:printlist (append (cons 'refdes attriblist) (list "qty")) port #\:)
       (newline port)
-      (bom2:printbom port (bom2:components packages attriblist))
+      (bom2:printbom port (bom2:components packages attriblist) 0)
       (close-output-port port))))
 
 (define bom2:printbom
-  (lambda (port bomlist)
+  (lambda (port bomlist count)
     (if (not (null? bomlist))
       (if (not (null? (caar bomlist)))
         (begin
           (display (caaar bomlist) port)
           (if (not (null? (cdaar bomlist)))
             (write-char #\, port))
-          (bom2:printbom port (cons (cons (cdaar bomlist)(cdar bomlist))(cdr bomlist))))
+          (bom2:printbom port (cons (cons (cdaar bomlist)(cdar bomlist))(cdr bomlist)) (+ count 1))
+        )
         (begin
           (display #\: port)
           (bom2:printlist (cdar bomlist) port #\:)
+          (display #\: port)
+          (display count port)
           (newline port)
-          (bom2:printbom port (cdr bomlist)))))))
+          (bom2:printbom port (cdr bomlist) 0)
+        )))))
 
 (define bom2:printlist
   (lambda (ls port delimiter)

_______________________________________________
geda-dev mailing list
[email protected]
http://www.seul.org/cgi-bin/mailman/listinfo/geda-dev

Reply via email to