delorie.com/archives/browse.cgi   search  
Mail Archives: geda-user/2024/05/01/15:58:53

X-Authentication-Warning: delorie.com: mail set sender to geda-user-bounces using -f
X-Recipient: geda-user AT delorie DOT com
X-Virus-Scanned: Debian amavisd-new at mail.linetec.nl
Message-ID: <d6a4d7ef-f372-46ea-be2b-f4ebda22242d@linetec.nl>
Date: Wed, 1 May 2024 21:56:44 +0200
MIME-Version: 1.0
User-Agent: Mozilla Thunderbird
Subject: Re: [geda-user] Gschem refdes autonumber over multiple pages?
To: geda-user AT delorie DOT com
References: <37de350c-1e5f-422f-b13a-c5a9a1e132ac AT linetec DOT nl>
<20240429130455 DOT F01EF81AB8C5 AT turkos DOT aspodata DOT se>
<a49f9288-9af4-4bd7-b8bb-f1f6c41fd01f AT linetec DOT nl>
<20240430103043 DOT 32de22ff AT queeg DOT menasians DOT com>
<20240430211916 DOT A6DBC81AB8C5 AT turkos DOT aspodata DOT se>
<bec8e19d-0ad0-454b-a3cf-f220e466c433 AT linetec DOT nl>
<25416a96-c328-4b7e-8fa8-091c993205bd AT linetec DOT nl> <87sez18q32 DOT fsf AT gmail DOT com>
<b4b5eab9-3fdc-45e7-b627-9b802e627b2d AT linetec DOT nl> <87o79p8jcu DOT fsf AT gmail DOT com>
From: "Richard Rasker (rasker AT linetec DOT nl) [via geda-user AT delorie DOT com]" <geda-user AT delorie DOT com>
In-Reply-To: <87o79p8jcu.fsf@gmail.com>
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

This is a multi-part message in MIME format.
--------------n0Pv2sEUpvHw80NrDlmogd0A
Content-Type: text/plain; charset=UTF-8; format=flowed
Content-Transfer-Encoding: 8bit

Hello Vladimir,

Op 01-05-2024 om 20:28 schreef Vladimir Zhbanov (vzhbanov AT gmail DOT com) 
[via geda-user AT delorie DOT com]:
> Hi Richard,
>
> "Richard Rasker (rasker AT linetec DOT nl) [viageda-user AT delorie DOT com]"<geda-user AT delorie DOT com>  writes:
>
> ...
>>> It processes components of all open pages and outputs the
>>> result as is defined at the bottom of the script.  You can load it from
>>> GUI.
>> Maybe a stupid question, but how do I do this? I use geda-gschem,
>> but the only reference to executing a script that I can find in
>> gschem is Tools -> Execute Guile Script, but I don't think that
>> this is what you mean. And if I choose this option and select your
>> script(*), nothing happens. I also have no idea what scripting
>> language this is -- I'm only familiar with bash.
>>
>> *: Yes, I did 1) already replace 'lepton' with 'geda' throughout,
>>   2) make it executable, and 3) make sure it's in $PATH.
> It is not necessary to do (2) and (3).  In lepton-schematic menu the
> item for this is File->Execute Script (or just hit 'F T').  Select the
> script in the file selection dialog and press the Run button.  That's
> all.

Ah, so I had the right menu item all :-)

>    The output will go to the terminal the program is launched from.

Yes, this works, great!Although right now it just outputs a list of 
numbers, and I haven't found out how to add something like Rfree= to the 
number for the R prefix.

> If you want to see its output, say, in the log window (e.g. in case you
> don't use any terminal for launching the GUI), you'll have to replace
> the "(display ...)" commands with something like
>    (log! 'message "Counter for R is ~A\n" (lookup-counter-by-prefix "R"))

Hm, that doesn't seem to work yet. Here's what happens in gschem's 
Status Dock:

Executing guile script [/home/richard/scripts/refdes-counter.scm]

Tracing:
            6 (apply-smob/1 #<catch-closure 564014dc1220>)
            5 (apply-smob/1 #<catch-closure 56401672f6a0>)
In ice-9/eval.scm:
    202:27  4 (_ #f)
    223:20  3 (proc #<directory (guile-user) 564014e55140>)
In unknown file:
            2 (%resolve-variable (7 . log!) #<directory (guile-user) …>)
In ice-9/boot-9.scm:
    751:25  1 (dispatch-exception 0 unbound-variable (#f "Unbound …" …))
In unknown file:
            0 (apply-smob/1 #<catch-closure 56401672f660> # #f "Unbo…" …)

ERROR: In procedure apply-smob/1:
Unbound variable: log!

So from the Guile Reference I assume that I need to define log!, is that 
correct?

However,

(define (log!)
(log! 'message "R = ~A\n" (lookup-counter-by-prefix "R")))

doesn't throw errors any more, but it doesn't do anything either, except 
show the message 'executing guile script ...'.

So I guess I'll need to take a closer look at Guile here.

But this is already very close to what I had in mind, thanks!

Richard

--------------n0Pv2sEUpvHw80NrDlmogd0A
Content-Type: text/html; charset=UTF-8
Content-Transfer-Encoding: 8bit

<!DOCTYPE html>
<html>
  <head>
    <meta http-equiv="Content-Type" content="text/html; charset=UTF-8">
  </head>
  <body>
    <p>Hello Vladimir,<br>
    </p>
    <div class="moz-cite-prefix">Op 01-05-2024 om 20:28 schreef Vladimir
      Zhbanov (<a class="moz-txt-link-abbreviated" href="mailto:vzhbanov AT gmail DOT com">vzhbanov AT gmail DOT com</a>) [via <a class="moz-txt-link-abbreviated" href="mailto:geda-user AT delorie DOT com">geda-user AT delorie DOT com</a>]:<br>
    </div>
    <blockquote type="cite" cite="mid:87o79p8jcu DOT fsf AT gmail DOT com">
      <pre class="moz-quote-pre" wrap="">
Hi Richard,

"Richard Rasker (<a class="moz-txt-link-abbreviated" href="mailto:rasker AT linetec DOT nl">rasker AT linetec DOT nl</a>) [via <a class="moz-txt-link-abbreviated" href="mailto:geda-user AT delorie DOT com">geda-user AT delorie DOT com</a>]" <a class="moz-txt-link-rfc2396E" href="mailto:geda-user AT delorie DOT com">&lt;geda-user AT delorie DOT com&gt;</a> writes:

...
</pre>
      <blockquote type="cite">
        <blockquote type="cite">
          <pre class="moz-quote-pre" wrap="">It processes components of all open pages and outputs the
result as is defined at the bottom of the script.  You can load it from
GUI.
</pre>
        </blockquote>
        <pre class="moz-quote-pre" wrap="">
Maybe a stupid question, but how do I do this? I use geda-gschem,
but the only reference to executing a script that I can find in
gschem is Tools -&gt; Execute Guile Script, but I don't think that
this is what you mean. And if I choose this option and select your
script(*), nothing happens. I also have no idea what scripting
language this is -- I'm only familiar with bash.

*: Yes, I did 1) already replace 'lepton' with 'geda' throughout,
 2) make it executable, and 3) make sure it's in $PATH.
</pre>
      </blockquote>
      <pre class="moz-quote-pre" wrap="">
It is not necessary to do (2) and (3).  In lepton-schematic menu the
item for this is File-&gt;Execute Script (or just hit 'F T').  Select the
script in the file selection dialog and press the Run button.  That's
all.</pre>
    </blockquote>
    <p>Ah, so I had the right menu item all :-)</p>
    <blockquote type="cite" cite="mid:87o79p8jcu DOT fsf AT gmail DOT com">
      <pre class="moz-quote-pre" wrap="">  The output will go to the terminal the program is launched from.</pre>
    </blockquote>
    <p>Yes, this works, great!<span style="white-space: pre-wrap"> Although right now it just outputs a list of numbers, and I haven't found out how to add something like Rfree= to the number for the R prefix.
</span></p>
    <blockquote type="cite" cite="mid:87o79p8jcu DOT fsf AT gmail DOT com">
      <pre class="moz-quote-pre" wrap="">If you want to see its output, say, in the log window (e.g. in case you
don't use any terminal for launching the GUI), you'll have to replace
the "(display ...)" commands with something like
  (log! 'message "Counter for R is ~A\n" (lookup-counter-by-prefix "R"))</pre>
    </blockquote>
    <p>Hm, that doesn't seem to work yet. Here's what happens in
      gschem's Status Dock:</p>
    <p>Executing guile script [/home/richard/scripts/refdes-counter.scm]<br>
      <br>
      <font face="monospace">Tracing:</font><br>
      <font face="monospace">           6 (apply-smob/1
        #&lt;catch-closure 564014dc1220&gt;)</font><br>
      <font face="monospace">           5 (apply-smob/1
        #&lt;catch-closure 56401672f6a0&gt;)</font><br>
      <font face="monospace">In ice-9/eval.scm:</font><br>
      <font face="monospace">   202:27  4 (_ #f)</font><br>
      <font face="monospace">   223:20  3 (proc #&lt;directory
        (guile-user) 564014e55140&gt;)</font><br>
      <font face="monospace">In unknown file:</font><br>
      <font face="monospace">           2 (%resolve-variable (7 . log!)
        #&lt;directory (guile-user) …&gt;)</font><br>
      <font face="monospace">In ice-9/boot-9.scm:</font><br>
      <font face="monospace">   751:25  1 (dispatch-exception 0
        unbound-variable (#f "Unbound …" …))</font><br>
      <font face="monospace">In unknown file:</font><br>
      <font face="monospace">           0 (apply-smob/1
        #&lt;catch-closure 56401672f660&gt; # #f "Unbo…" …)</font><br>
      <br>
      <font face="monospace">ERROR: In procedure apply-smob/1:</font><br>
      <font face="monospace">Unbound variable: log!</font></p>
    <p>So from the Guile Reference I assume that I need to define log!,
      is that correct?</p>
    <p>However,</p>
    <p><font face="monospace">(define (log!)<br>
        (log! 'message "R = ~A\n" (lookup-counter-by-prefix "R")))</font></p>
    <p>doesn't throw errors any more, but it doesn't do anything either,
      except show the message 'executing guile script ...'.</p>
    <p>So I guess I'll need to take a closer look at Guile here.</p>
    <p>But this is already very close to what I had in mind, thanks!</p>
    <p>Richard<br>
    </p>
  </body>
</html>

--------------n0Pv2sEUpvHw80NrDlmogd0A--

- Raw text -


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