X-Authentication-Warning: delorie.com: mail set sender to geda-user-bounces using -f X-Recipient: geda-user AT delorie DOT com DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=gamma; h=mime-version:in-reply-to:references:date:message-id:subject:from:to :content-type; bh=92GRc3JB0R9+6LGWZ+NupAN8iNOwODES025h4wuChxs=; b=juwbDVc6PZIydXyEiYdwcaxjzkDIN2uX7/2cXEFsNmcSZx90iKV5bP4sHDiA7RFU3c 2uq2AQYTt1IoPNIbiC0O9unYcDiLSyggPQQ/UBMu1DZDOqAsTVFf4h3M7ZXfku8ORs8m FkF9xyVpDif7EaFEHsNygbihYgKGP0g3xRANg= MIME-Version: 1.0 In-Reply-To: <20111130211002.32B5081F6275@turkos.aspodata.se> References: <20111130211002 DOT 32B5081F6275 AT turkos DOT aspodata DOT se> Date: Thu, 1 Dec 2011 16:02:56 +0100 Message-ID: Subject: Re: [geda-user] Dynamic loading personal components (with subfolder) into the search component tree of gschem From: Luigi Salvatore Palese To: geda-user AT delorie DOT com Content-Type: multipart/mixed; boundary=0016364183adc4a35104b3092595 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 Precedence: bulk --0016364183adc4a35104b3092595 Content-Type: multipart/alternative; boundary=0016364183adc4a34904b3092593 --0016364183adc4a34904b3092593 Content-Type: text/plain; charset=ISO-8859-1 Content-Transfer-Encoding: quoted-printable Hi Karl, your script looks good but you have to manage the growing of the gafrc file= . Following your way, i'm making the scheme in attachment. Now the needed lines to start the guile script from gafrc are only as follow: ; (define geda-rchome-path (build-path (getenv "HOME") ".gEDA")) (load (build-path geda-rchome-path "local-symbols-library.scm")) ; ; (component-library-add-tree "personal" "/usr/local/share/symbols") ; ; At this point the folder name will be used as description in the tree: +Generic\ capacitors/ cap-1.sym +AVX\ Capacitors/ idc.sym I notice an interesting feature if the subfolders are named like: Generic\ capacitors/ Generic\ capacitors - AVX/ Generic\ capacitors - AVX - IDC/ The items will be displayed sequentially in the tree. Regards, Luigi On Wed, Nov 30, 2011 at 10:10 PM, Karl Hammar wrote: > Luigi: > ... > > The procedure in attachment is composed by a bash script and a guile > > script. > ... > > /////// > Attachment "build-local-symbols-list": > > SYMPATH=3D"/usr/local/share/symbols" > SYMSUB=3D"personal/" > cd $SYMPATH ; echo > local-symbols-list ; > IFS=3D$'\n' > > You could do (in case you don't have a .desc in every directory): > > for file in `find dir -name .desc -type f`; do > d=3D`dirname $file` > desc=3D`cat $file` > ... > > > for d in `find ./$SYMSUB -type d` ; do > desc=3D"`cat $d/.desc`" > echo "$d" >> local-symbols-list > echo "$desc" >> local-symbols-list > done > > echo "Coping local-symbols-list to ~/.gEDA folder..." > cp local-symbols-list ~/.gEDA/ > > /////// > Attachment "README": > > cd my-symbols-path ; mkdir personal ; > mv * personal > cp build-local-symbols-list my-symbols-path > > # for each path in personal: > echo "One Line Description" > .desc > > ------------------------------------------------------------------ > Examples path: > capacitors/ > .desc <--onelinecontent-- "Generic capacitors" > cap-1.sym > avx/ > .desc <--onelinecontent- "AVX Capacitors" > idc.sym > > > become --> > > geda symbols tree+ > >capacitors Generic capacitors > cap-1.sym > >avx AVX Capacitors > idc.sym > > Why do you have a .desc file when you could as easily use the > directory name as the description. E.g. why don't you instead use: > > Examples path: > Generic\ capacitors/ > cap-1.sym > AVX\ Capacitors/ > idc.sym > > Why use a file (.desc) when you can store it directly in the directory > structure, and if you instead use the directory name as description, > you can use the attached script. > > /////// > > Overall it seems you build a file "local-symbols-list" with the > shell script "build-local-symbols-list", then you process that list > with the scheme script "local-symbols-library.scm". > > Wouldn't it be great if you didn't have to run the shell script, if > the scheme script took care about that part? So you could use: > > (component-library-add-tree "cvs" "${HOME}/Net/cvs/ > cvs.gedasymbols.org/www/user") > > or > > (component-library-add-tree "personal" "/usr/local/share/symbols") > > in your .gEDA/gafrc file, and it swalloped the whole tree. > > If you write such a script, I'll be happy to test it. > > Regards, > /Karl Hammar > > ----------------------------------------------------------------------- > Asp=F6 Data > Lilla Asp=F6 148 > S-742 94 =D6sthammar > Sweden > +46 173 140 57 > > --0016364183adc4a34904b3092593 Content-Type: text/html; charset=ISO-8859-1 Content-Transfer-Encoding: quoted-printable Hi Karl,
your script looks good but you have to manage the growing of th= e gafrc file.
Following your way, i'm making the scheme in attachmen= t.
Now the needed lines to start the guile script from gafrc are only as= follow:
;
(define geda-rchome-path (build-path (getenv "HOME") ".= gEDA"))
(load (build-path geda-rchome-path "local-symbols-libr= ary.scm"))
;
;
(component-library-add-tree "personal&quo= t; "/usr/local/share/symbols")
;
;

At this point the folder name will be used as description in = the tree:

+Generic\ capacitors/
=A0=A0=A0=A0=A0=A0=A0=A0 cap-1.sy= m
=A0+AVX\ Capacitors/
=A0=A0=A0=A0=A0=A0=A0=A0=A0=A0=A0=A0=A0=A0=A0= =A0 idc.sym

I notice an interesting feature if the subfolders are na= med like:
Generic\ capacitors/
=A0=A0=A0 Generic\ capacitors - AVX/
=A0=A0=A0= =A0=A0=A0=A0 Generic\ capacitors - AVX - IDC/

The items will be disp= layed sequentially in the tree.


Regards,
Luigi



On Wed, Nov 30, 2011 at 10:10 PM, Karl Hammar <karl AT aspodata DOT se> wrote:
Luigi:
...
> The procedure in attachment is composed by a bash sc= ript and a guile
> script.
...

///////
Attachment "build-local-symbols-list":

=A0SYMPATH=3D"/usr/local/share/symbols"
=A0SYMSUB=3D"personal/"
=A0cd $SYMPATH ; echo > local-symbols-list ;
=A0IFS=3D$'\n'

You could do (in case you don't have a .desc in every directory):

for file in `find dir -name .desc -type f`; do
=A0 d=3D`dirname $file`
=A0 desc=3D`cat $file`
...


=A0for d in `find ./$SYMSUB -type d` ; do
=A0 =A0 =A0 =A0 =A0desc=3D"`cat $d/.desc`"
=A0 =A0 =A0 =A0 =A0echo "$d" >> local-symbols-list
=A0 =A0 =A0 =A0 =A0echo "$desc" >> local-symbols-list
=A0done

=A0echo "Coping local-symbols-list to ~/.gEDA folder..."
=A0cp local-symbols-list =A0~/.gEDA/

///////
Attachment "README":

=A0cd my-symbols-path ; mkdir personal ;
=A0mv * personal
=A0cp build-local-symbols-list my-symbols-path

=A0# for each path in personal:
=A0echo "One Line Description" > .desc

=A0------------------------------------------------------------------
=A0Examples path:
=A0capacitors/
=A0 =A0 =A0 =A0 =A0.desc <--onelinecontent-- "Generic capacitors&q= uot;
=A0 =A0 =A0 =A0 =A0cap-1.sym
=A0 =A0 =A0 =A0 =A0avx/
=A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0.desc <--onelinecontent- "AVX C= apacitors"
=A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0idc.sym


=A0become -->

=A0geda symbols tree+
=A0 =A0 =A0 =A0 =A0>capacitors Generic capacitors
=A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0cap-1.sym
=A0 =A0 =A0 =A0 =A0>avx AVX Capacitors
=A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0idc.sym

Why do you have a .desc file when you could as easily use the
directory name as the description. E.g. why don't you instead use:

=A0Examples path:
=A0Generic\ capacitors/
=A0 =A0 =A0 =A0 =A0cap-1.sym
=A0 =A0 =A0 =A0 =A0AVX\ Capacitors/
=A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0idc.sym

Why use a file (.desc) when you can store it directly in the directory
structure, and if you instead use the directory name as description,
you can use the attached script.

///////

Overall it seems you build a file "local-symbols-list" with the shell script "build-local-symbols-list", then you process that li= st
with the scheme script "local-symbols-library.scm".

Wouldn't it be great if you didn't have to run the shell script, if=
the scheme script took care about that part? So you could use:

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

=A0or

(component-library-add-tree "personal" "/usr/local/share/sym= bols")

in your .gEDA/gafrc file, and it swalloped the whole tree.

If you write such a script, I'll be happy to test it.

Regards,
/Karl Hammar

-----------------------------------------------------------------------
Asp=F6 Data
Lilla Asp=F6 148
S-742 94 =D6sthammar
Sweden
+46 173 140 57=


--0016364183adc4a34904b3092593-- --0016364183adc4a35104b3092595 Content-Type: text/x-scheme; charset=US-ASCII; name="local-symbols-library.scm" Content-Disposition: attachment; filename="local-symbols-library.scm" Content-Transfer-Encoding: base64 X-Attachment-Id: f_gvnw7x9z1 OyAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAg IC0qLVNjaGVtZS0qLQo7ICAgIFRoaXMgcHJvZ3JhbSBpcyBmcmVlIHNvZnR3YXJlOiB5b3UgY2Fu IHJlZGlzdHJpYnV0ZSBpdCBhbmQvb3IgbW9kaWZ5CjsgICAgaXQgdW5kZXIgdGhlIHRlcm1zIG9m IHRoZSBHTlUgR2VuZXJhbCBQdWJsaWMgTGljZW5zZSBhcyBwdWJsaXNoZWQgYnkKOyAgICB0aGUg RnJlZSBTb2Z0d2FyZSBGb3VuZGF0aW9uLCBlaXRoZXIgdmVyc2lvbiAzIG9mIHRoZSBMaWNlbnNl LCBvcgo7ICAgIChhdCB5b3VyIG9wdGlvbikgYW55IGxhdGVyIHZlcnNpb24uCjsKOyAgICBUaGlz IHByb2dyYW0gaXMgZGlzdHJpYnV0ZWQgaW4gdGhlIGhvcGUgdGhhdCBpdCB3aWxsIGJlIHVzZWZ1 bCwKOyAgICBidXQgV0lUSE9VVCBBTlkgV0FSUkFOVFk7IHdpdGhvdXQgZXZlbiB0aGUgaW1wbGll ZCB3YXJyYW50eSBvZgo7ICAgIE1FUkNIQU5UQUJJTElUWSBvciBGSVRORVNTIEZPUiBBIFBBUlRJ Q1VMQVIgUFVSUE9TRS4gIFNlZSB0aGUKOyAgICBHTlUgR2VuZXJhbCBQdWJsaWMgTGljZW5zZSBm b3IgbW9yZSBkZXRhaWxzLgo7CjsgICAgWW91IHNob3VsZCBoYXZlIHJlY2VpdmVkIGEgY29weSBv ZiB0aGUgR05VIEdlbmVyYWwgUHVibGljIExpY2Vuc2UKOyAgICBhbG9uZyB3aXRoIHRoaXMgcHJv Z3JhbS4gIElmIG5vdCwgc2VlIDxodHRwOi8vd3d3LmdudS5vcmcvbGljZW5zZXMvPi4KOwo7IENv cHlyaWdodCAoQykgMjAxMSAgTC5TLlAuIDx1bHRyYWJpdEBnbWFpbC5jb20+CjsKKHVzZS1tb2R1 bGVzIChpY2UtOSBmdHcpKQo7OzsKOzs7IEFkZCB0aGUgZGVmYXVsdCBjb21wb25lbnQgbGlicmFy aWVzCjs7OwooZGVmaW5lIGdlZGEtcmNob21lLXBhdGggKGJ1aWxkLXBhdGggKGdldGVudiAiSE9N RSIpICIuZ0VEQSIpKQooZGVmaW5lIGxvY2FsLXBhdGggKGJ1aWxkLXBhdGggIi91c3IvbG9jYWwv c2hhcmUiKSkKKGRlZmluZSBsb2NhbC1zeW0tcGF0aCAoYnVpbGQtcGF0aCBsb2NhbC1wYXRoICJz eW1ib2xzIikpCjsoZGVmaW5lIGxvY2FsLWZvb3RwcmludC1wYXRoIChidWlsZC1wYXRoIGxvY2Fs LXBhdGggImZvb3RwcmludHMiKSkKKGRlZmluZSBmb2xkZXJsaXN0ICcoKSkKKGRlZmluZSBidWls ZC1zeW1ib2xzLWxpc3QKICAgICAgICAobGFtYmRhICAoZmlsZW5hbWUgc3RhdGluZm8gZmxhZ3Mp CiAgICAgICAgICAgICAgICAoaWYgKGVxPyAoc3RyaW5nLT5zeW1ib2wgImRpcmVjdG9yeSIpIGZs YWdzKQogICAgICAgICAgICAgICAgICAgICAgICAoYmVnaW4gIAogICAgICAgICAgICAgICAgICAg ICAgICAoc2V0ISBmb2xkZXJsaXN0ICAKICAgICAgICAgICAgICAgICAgICAgICAgKGFwcGVuZCBm b2xkZXJsaXN0CiAgICAgICAgICAgICAgICAgICAgICAgIChsaXN0IChsaXN0IGZpbGVuYW1lIChj YXIgKHJldmVyc2UgKHN0cmluZy1zcGxpdCBmaWxlbmFtZSAjXC8pKSkpKSkpCiAgICAgICAgICAg ICAgICAgICAgICAgICkpCiAgICAgICAgICAgICAgICAoZXE/ICN0ICN0KSkKKQooZGVmaW5lIGNv bXBvbmVudC1saWJyYXJ5LWFkZC10cmVlCgkobGFtYmRhIChzdWJmb2xkZXIgbWFpbmZvbGRlcikK CQk7IEJ1aWxkaW5nIHRoZSBsaXN0IG9mIGZvbGRlcnMKICAgICAgICAJKGZ0dyAoYnVpbGQtcGF0 aCBtYWluZm9sZGVyIHN1YmZvbGRlcikgYnVpbGQtc3ltYm9scy1saXN0KQoJKGZvci1lYWNoCgkJ KGxhbWJkYSAoZGlyKQoJCQkoY29tcG9uZW50LWxpYnJhcnkgKGJ1aWxkLXBhdGggKGNhciBkaXIp KSAoY2FkciBkaXIpKSkKCSBmb2xkZXJsaXN0KQoJKQopCgo= --0016364183adc4a35104b3092595--