1 ;;; gEDA - GPL Electronic Design Automation
2 ;;; gnetlist - gEDA Netlist
3 ;;; Copyright (C) 1998-2010 Ales Hvezda
4 ;;; Copyright (C) 1998-2010 gEDA Contributors (see ChangeLog for details)
6 ;;; This program is free software; you can redistribute it and/or modify
7 ;;; it under the terms of the GNU General Public License as published by
8 ;;; the Free Software Foundation; either version 2 of the License, or
9 ;;; (at your option) any later version.
11 ;;; This program is distributed in the hope that it will be useful,
12 ;;; but WITHOUT ANY WARRANTY; without even the implied warranty of
13 ;;; MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
14 ;;; GNU General Public License for more details.
16 ;;; You should have received a copy of the GNU General Public License
17 ;;; along with this program; if not, write to the Free Software
18 ;;; Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
20 ;; RACAL-REDAC / Cadstar netlist format by Wojciech Kazubski 2003
23 ;; Display the individual net connections
25 (define redac:display-connections
27 (if (not (null? nets))
28 (let ((item (string-append (car (car nets)) " " (car (cdr (car nets))))))
30 (if (not (null? (cdr nets)))
35 (redac:display-connections (cdr nets) port (- k 1)))
37 (display (string-append "\r\n" item " ") port)
38 (redac:display-connections (cdr nets) port (+ k 6))))))))))
41 (define redac:write-net
42 (lambda (port netnames)
43 (if (not (null? netnames))
44 (let ((netname (car netnames)))
45 (display ".REM " port)
46 (display netname port)
48 (redac:display-connections
49 (gnetlist:get-all-connections netname) port 7)
51 (redac:write-net port (cdr netnames))
56 (let ((port (if (string=? "-" filename)
58 (open-output-file filename))))
59 (display ".PCB\r\n" port)
60 (display ".REM CREATED BY gEDA GNETLIST\r\n" port)
61 (display ".CON\r\n" port)
62 (display ".COD 2\r\n\r\n" port)
63 (redac:write-net port (gnetlist:get-all-unique-nets "dummy"))
64 (display ".EOD\r\n" port)
65 (close-output-port port))))