[Top][All Lists]

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: libapl question

From: Chris Moller
Subject: Re: libapl question
Date: Fri, 1 Jan 2021 09:19:32 -0500
User-agent: Mozilla/5.0 (X11; Linux x86_64; rv:78.0) Gecko/20100101 Thunderbird/78.6.0

Many thanks for the quick fix.

As to the
issue, I'm using libapl in a limited context as an embedded _expression_ evaluator and not as a full-fledged APL environment, so maybe the issue won't bite me.  I expect I'll find out later today.

Thanks again,

On 1/1/21 7:24 AM, Dr. Jürgen Sauermann wrote:
Hi Chris,

fixed in SVN 1400.

However, please note the following:

In GNU APL, you may, in principle, execute commands with ⍎ which is a non-standard
APL extension. I have tested your case with both
⍎')LOAD wsname' and with  ⍎')COPY wsname'
instead of libapl. The first test failed while the second case succeeded.

The reason why the first case failed was because ⍎ of commands is only
allowed for commands that do not modify the )SI stack (otherwise
hell would brake loose). Now, )LOAD modifies the )SI stack while )COPY
does not. Since not allowing )LOAD would be somewhat weird, it
is not entirely rejected, but does an automatic )SIC before it is being executed.
This )SIC is necessary (since after it a )LOAD does no longer modify the )SI stack)
but invisible to the user. As a consequence, the result of an assignment like
Q←⍎')LOAD wsname' gets lost because an error occurs before the assignment takes place
and right after the error the )SI stack is cleared (which hides the error from the user).

I suppose that libapl behaves somewhat differently because it performs the command
directly instead of using ⍎, but the problem remains the same. The assignment of the
)LOAD command output is done in the old workspace which is )CLEARed before
the )LOAD proceeds and may therefore be lost. The commands which do an automatic
)SIC are: )LOAD, )QLOAD, )CLEAR (aka. )RESET) and )SIC.

Best Regards,

On 12/31/20 8:59 PM, Chris Moller wrote:
Being some combination of sadistic and masochistic, I'm trying to use the libapl library using the libapl.h API

libapl.h says
/// Pass `command` to the command processor and return its output.
extern const char * apl_command(const char * command_utf8);

but when I do
const char *rc = apl_command (")load workspace");
it dumps
SAVED 2020-12-30 17:18:13 (GMT-4)
to stdout and rc is empty.

Am I doing something wrong, or am I trying to do something APL was never intended to do?  I'd like to be able to capture everything libapl says and not have it go to stdout/stderr.


reply via email to

[Prev in Thread] Current Thread [Next in Thread]