delorie.com/archives/browse.cgi   search  
Mail Archives: geda-user/2012/07/12/13:22:22

X-Authentication-Warning: delorie.com: mail set sender to geda-user-bounces using -f
X-Recipient: geda-user AT delorie DOT com
X-Authenticated-IP: 207.224.51.38
From: John Doty <jpd AT noqsi DOT com>
Mime-Version: 1.0 (Apple Message framework v1084)
Subject: Re: [geda-user] refdes index locations
Date: Thu, 12 Jul 2012 11:11:35 -0600
In-Reply-To: <4FFEFCFF.4060101@laserlinc.com>
To: geda-user AT delorie DOT com
References: <4FFD6CF7 DOT 60707 AT laserlinc DOT com> <20120711201719 DOT A8816819FBAB AT turkos DOT aspodata DOT se> <4FFEB545 DOT 5010000 AT laserlinc DOT com> <20120712155653 DOT 7D5EE819FBB2 AT turkos DOT aspodata DOT se> <4FFEFCFF DOT 4060101 AT laserlinc DOT com>
Message-Id: <F0B76359-7381-439F-A849-1137CBB2D7DB@noqsi.com>
X-Mailer: Apple Mail (2.1084)
Reply-To: geda-user AT delorie DOT com
Errors-To: nobody AT delorie DOT com
X-Mailing-List: geda-user AT delorie DOT com
X-Unsubscribes-To: listserv AT delorie DOT com

--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 -


  webmaster     delorie software   privacy  
  Copyright © 2019   by DJ Delorie     Updated Jul 2019