Mail Archives: geda-user/2024/05/01/15:58:53
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"><geda-user AT delorie DOT com></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 -> 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->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
#<catch-closure 564014dc1220>)</font><br>
<font face="monospace"> 5 (apply-smob/1
#<catch-closure 56401672f6a0>)</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 #<directory
(guile-user) 564014e55140>)</font><br>
<font face="monospace">In unknown file:</font><br>
<font face="monospace"> 2 (%resolve-variable (7 . log!)
#<directory (guile-user) …>)</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
#<catch-closure 56401672f660> # #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 -