1 ;;; gEDA - GPL Electronic Design Automation
2 ;;; gnetlist - gEDA Netlist
3 ;;; Copyright (C) 1998-2010 Ales Hvezda
4 ;;; Copyright (C) 1998-2020 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., 51 Franklin Street, Fifth Floor, Boston,
19 ;;; MA 02111-1301 USA.
21 (use-modules (ice-9 optargs))
23 ;; --------------------------------------------------------------------------
25 ;; protelII netlist format specific functions go here
28 ;; [ -- element for list of components
32 ;; FOOTPRINT attrbute.
35 ;; If VALUE attribute exists, output VALUE attribute.
36 ;; Otherwise, output DEVICE attrbute.
37 ;; (This covers the case of ICs, which usually carry their part no (e.g. uA741) in the DEVICE attribute.)
90 ;; ... other components ...
92 ;; ( -- element for list of nets
94 ;; PART-PIN# VALUE-PINNAME PINTYPE -- use PASSIVE for PINTYPE
95 ;; ...more connections...
100 ;; { -- element for net option list
116 ;; ...more net options...
120 ;; We redefine the newline function, because this file format requires
121 ;; Windows-style "\r\n" line endings rather than Unix-style "\n"
123 (define* (newline #:optional)
124 (display "\r\n" (or (current-output-port))))
129 (define (protelII:write-top-header)
130 (display "PROTEL NETLIST 2.0")
134 ;; Top level component writing
136 (define protelII:components
139 (let ((package (car ls)))
143 (display "DESIGNATOR")
147 (display "FOOTPRINT")
149 (display (gnetlist:get-package-attribute package "footprint"))
153 (let ((value (get-value package))) ;; This change by SDB on 10.12.2003.
154 (if (string-ci=? value "unknown")
155 (display (get-device package))
160 (display "DESCRIPTION")
162 (display (get-device package))
164 (display "Part Field 1")
168 (display "Part Field 2")
172 (display "Part Field 3")
176 (display "Part Field 4")
180 (display "Part Field 5")
184 (display "Part Field 6")
188 (display "Part Field 7")
192 (display "Part Field 8")
196 (display "Part Field 9")
200 (display "Part Field 10")
204 (display "Part Field 11")
208 (display "Part Field 12")
212 (display "Part Field 13")
216 (display "Part Field 14")
220 (display "Part Field 15")
224 (display "Part Field 16")
228 (display "LIBRARYFIELD1")
232 (display "LIBRARYFIELD2")
236 (display "LIBRARYFIELD3")
240 (display "LIBRARYFIELD4")
244 (display "LIBRARYFIELD5")
248 (display "LIBRARYFIELD6")
252 (display "LIBRARYFIELD7")
256 (display "LIBRARYFIELD8")
262 (protelII:components (cdr ls)))))))
265 ;; Display the individual net connections
267 (define protelII:display-connections
269 (if (not (null? nets))
271 (let ((package (car (car nets))))
274 (display (car (cdr (car nets))))
276 (display (get-device package))
278 (display (car (cdr (car nets))))
279 (display " PASSIVE"))
280 (if (not (null? (cdr nets)))
283 (protelII:display-connections (cdr nets))))))
288 (define protelII:display-name-nets
291 (protelII:display-connections nets)
296 ;; Write netname : uref pin, uref pin, ...
298 (define protelII:write-net
300 (if (not (null? netnames))
301 (let ((netname (car netnames)))
307 (protelII:display-name-nets (gnetlist:get-all-connections netname))
310 (protelII:write-net (cdr netnames)))))))
313 ;; Write the net part of the gEDA format
315 (define protelII:nets
317 (let ((all-uniq-nets (gnetlist:get-all-unique-nets "dummy")))
318 (protelII:write-net all-uniq-nets))))
320 ;;; Highest level function
321 ;;; Write my special testing netlist format
323 (define (protelII output-filename)
324 (set-current-output-port (gnetlist:output-port output-filename))
326 (protelII:write-top-header)
327 (protelII:components packages)
329 (close-output-port (current-output-port)))
332 ;; gEDA's native test netlist format specific functions ends
334 ;; --------------------------------------------------------------------------