www.delorie.com/archives/browse.cgi   search  
Mail Archives: geda-user/2011/12/03/09:48:50

X-Authentication-Warning: delorie.com: mail set sender to geda-user-bounces using -f
X-Recipient: geda-user AT delorie DOT com
X-Mailer: exmh version 2.7.2 01/07/2005 (debian 1:2.7.2-18) with nmh-1.3
X-Exmh-Isig-CompType: repl
X-Exmh-Isig-Folder: inbox
To: geda-user AT delorie DOT com
Subject: Re: [geda-user] Dynamic loading personal components (with subfolder) into the search component tree of gschem
In-reply-to: <CAAVSQ3tkg3es-uBn+yFroysi5xAOtNqW5hTs2yAWQfo47rUaVQ@mail.gmail.com>
References: <CAAVSQ3vnFZkWdWn=LCbf+WSM0vOx9pwW+OaeTs47EdO8nfmC_w AT mail DOT gmail DOT com> <20111130211002 DOT 32B5081F6275 AT turkos DOT aspodata DOT se> <CAAVSQ3tkg3es-uBn+yFroysi5xAOtNqW5hTs2yAWQfo47rUaVQ AT mail DOT gmail DOT com>
Comments: In-reply-to Luigi Salvatore Palese <ultrabit AT gmail DOT com>
message dated "Thu, 01 Dec 2011 16:02:56 +0100."
Mime-Version: 1.0
Message-Id: <20111203144826.7AB9581D541B@turkos.aspodata.se>
Date: Sat, 3 Dec 2011 15:48:26 +0100 (CET)
From: karl AT aspodata DOT se (Karl Hammar)
X-Virus-Scanned: ClamAV using ClamSMTP
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

Luigi Salvatorre:
...
[in the gafrc file]
> (component-library-add-tree "personal" "/usr/local/share/symbols")

Since I don't have anything in /usr/local/share/symbols, I tried with:

 (component-library-add-tree "cvs" "$HOME/Net/cvs/cvs.gedasymbols.org/www/user")

But that didn't do any change in the library browser.

  (use-modules (ice-9 ftw))

Strange name that "ice-9", doesn't seem to mean anything [1].
ftw seems to be wery useful, thanks for the tip.

  ;;;
  ;;; Add the default component libraries
  ;;;
  (define geda-rchome-path (build-path (getenv "HOME") ".gEDA"))
  (define local-path (build-path "/usr/local/share"))
  (define local-sym-path (build-path local-path "symbols"))

The above defines variables which aren't used below, I'll remove theese
lines.

  ;(define local-footprint-path (build-path local-path "footprints"))
  (define folderlist '())
  (define build-symbols-list
	  (lambda  (filename statinfo flags)
		  (if (eq? (string->symbol "directory") flags)
			  (begin  
			  (set! folderlist  
			  (append folderlist
			  (list (list filename (car (reverse (string-split filename #\/)))))))
			  ))
		  (eq? #t #t))
  )

The above collects all directories, even thoose without any sym files,
maybe we should first find all sym files, extract its directory,
and only put that list in folderlist.

  (define component-library-add-tree
	  (lambda (subfolder mainfolder)
		  ; Building the list of folders
		  (ftw (build-path mainfolder subfolder) build-symbols-list)

Why have argments (subfolder mainfolder) when the only thing you do
with them is to combine them (once), wouldn't it be easier to let the
caller give us the full path?
Also, why not let the caller give us a prefix for the line shown in
the library browser?

	  (for-each
		  (lambda (dir)
			  (component-library (build-path (car dir)) (cadr dir)))
	   folderlist)
	  )
  )

It seems I have to learn scheme..., I'll see what I can come up with.

Regards,
/Karl Hammar

[1] http://www.gnu.org/software/guile/manual/html_node/Status.html#Status

-----------------------------------------------------------------------
Aspö Data
Lilla Aspö 148
S-742 94 Östhammar
Sweden
+46 173 140 57




- Raw text -


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