1 ;;; gEDA - GPL Electronic Design Automation
2 ;;; gnetlist back end for Osmond PCB Design
3 ;;; Copyright (C) 2007-2010 John P. Doty
5 ;;; This program is free software; you can redistribute it and/or modify
6 ;;; it under the terms of the GNU General Public License as published by
7 ;;; the Free Software Foundation; either version 2 of the License, or
8 ;;; (at your option) any later version.
10 ;;; This program is distributed in the hope that it will be useful,
11 ;;; but WITHOUT ANY WARRANTY; without even the implied warranty of
12 ;;; MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
13 ;;; GNU General Public License for more details.
15 ;;; You should have received a copy of the GNU General Public License
16 ;;; along with this program; if not, write to the Free Software
17 ;;; Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston,
18 ;;; MA 02111-1301 USA.
20 ; Export a design to Osmond PCB
22 (define (osmond output-filename)
23 (set-current-output-port (gnetlist:output-port output-filename))
24 (for-each osmond:part packages)
25 (for-each osmond:signal all-unique-nets))
28 ; The first section of the file consists of a list of packages,
29 ; one per line. For example:
30 ; Part 0603 { Name R4 }
32 (define (osmond:part package)
34 "Part ~A { Name ~A }\n"
35 (gnetlist:get-package-attribute package "footprint")
39 ; The next section of the file consists of a list of nets.
40 ; Each entry takes two lines. For example:
41 ; Signal "unnamed_net6"
44 (define (osmond:signal net)
45 (format #t "Signal \"~A\"\n {" net)
46 (for-each osmond:pin (gnetlist:get-all-connections net))
50 ; gnetlist represents a connection as a two-element list of the form:
52 ; Convert to " refdes-pinnumber"
54 (define (osmond:pin connection)
57 (car connection) ; refdes
58 (cadr connection))) ; pin number