Mail Archives: geda-user/2012/07/12/13:22:22
--Apple-Mail-174-881159053
Content-Transfer-Encoding: quoted-printable
Content-Type: text/plain;
charset=us-ascii
On Jul 12, 2012, at 10:36 AM, Joshua Lansford wrote:
> Oh. I don't think this script needs the information in the symbols. =
The location of the symbols is in the .sch file. =20
The location of the corner is in the .sch file. The location of the =
symbol's center and boundaries is nowhere, derived dynamically from the =
symbol file.
> For my scripts that do need to read though the symbols, I have a =
separate text file with all the symbol dirs listed in it. It's =
redundant but it works.
Here's a gnetlist back end that extracts that info from your gafrc =
files. Hmm, I should put this on gedasymbols...
--Apple-Mail-174-881159053
Content-Disposition: attachment;
filename=gnet-flatten-gafrc.scm
Content-Type: application/octet-stream;
name="gnet-flatten-gafrc.scm"
Content-Transfer-Encoding: 7bit
;;; gEDA - GPL Electronic Design Automation
;;; gnetlist back end to create a flat TSV representation
;;; of the configuration defined by the various gafrc scripts.
;;; Copyright (C) 2009 John P. Doty
;;;
;;; This program is free software; you can redistribute it and/or modify
;;; it under the terms of the GNU General Public License as published by
;;; the Free Software Foundation; either version 2 of the License, or
;;; (at your option) any later version.
;;;
;;; This program is distributed in the hope that it will be useful,
;;; but WITHOUT ANY WARRANTY; without even the implied warranty of
;;; MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
;;; GNU General Public License for more details.
;;;
;;; You should have received a copy of the GNU General Public License
;;; along with this program; if not, write to the Free Software
;;; Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
(define flatten-gafrc (lambda (output-filename)
(set-current-output-port (open-output-file output-filename))
(display header)
(load (build-path geda-rc-path "system-gafrc"))
(load-if-present (build-path (getenv "HOME") ".gEDA/gafrc"))
(load-if-present "gafrc")
(put-variables)
))
;; load a file if it exists
(define load-if-present (lambda (f)
(if (file-exists? f) (load f))
))
;; Explanatory header
(define header
"# Project parameter file created by the flatten-gafrc gnetlist back end
# Don't edit this file: edit gafrc or ~/.gEDA/gafrc and then regenerate
# this file with a command like:
# gnetlist -g flatten-gafrc -o gafrc.tsv /dev/null
#
# Format of each line is:
# parameter value ...
# with tabs separating fields.
#
# See system-gafrc for an explanation of the parameters.
#
# Lines starting with # are comments: code reading this file should
# ignore them, and it should also ignore blank lines.
")
;; Variables. These may get set multiple times by the rc files,
;; but only the last (most local) setting counts. Defaults for these
;; should be defined in system-gafrc.
(define v-attribute-promotion "undefined")
(define v-keep-invisible "undefined")
(define v-promote-invisible "undefined")
(define v-always-promote-attributes "undefined")
;; Variable setting procedures override the definitions in libgeda
;; so we can capture the settings here when we read the rc files.
(define attribute-promotion (lambda (x) (set! v-attribute-promotion x)))
(define keep-invisible (lambda (x) (set! v-keep-invisible x)))
(define promote-invisible (lambda (x) (set! v-promote-invisible x)))
(define always-promote-attributes (lambda (x)
(set! v-always-promote-attributes x)))
;; Put variables to output
(define put-variables (lambda ()
(put-tsv "attribute-promotion" v-attribute-promotion)
(put-tsv "keep-invisible" v-keep-invisible)
(put-tsv "promote-invisible" v-promote-invisible)
(put-tsv "always-promote-attributes" v-always-promote-attributes)
))
;; Procedures to capture the various library paths and put them
;; in the output.
(define component-library-search (lambda (x)
(put-tsv "component-library-search" x)))
(define source-library (lambda (x) (put-tsv "source-library" x)))
(define source-library-search (lambda (x)
(put-tsv "source-library-search" x)))
;; This one's a little trickier, as it's used with a variable
;; number of arguments, rather than a list. Leave the () around
;; the parameter out, and it works automagically, because put-tsv
;; accepts a list.
(define component-library (lambda x (put-tsv "component-library" x)))
;; Put a TSV line to output
(define put-tsv (lambda (parameter value)
(display parameter)
(if (list? value)
(for-each tabout value) ;; then put list members
(tabout value) ;; else put the single value
)
(newline)
))
;; put a TSV field to output
(define tabout (lambda (x)
(display "\t")
(display x)
))
--Apple-Mail-174-881159053
Content-Transfer-Encoding: 7bit
Content-Type: text/plain;
charset=us-ascii
John Doty Noqsi Aerospace, Ltd.
http://www.noqsi.com/
jpd AT noqsi DOT com
--Apple-Mail-174-881159053--
- Raw text -