bug-apl
[Top][All Lists]
Advanced

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

Re: libapl apl_exec results displayed as ?


From: Dr . Jürgen Sauermann
Subject: Re: libapl apl_exec results displayed as ?
Date: Mon, 25 Jul 2022 11:53:11 +0200
User-agent: Mozilla/5.0 (X11; Linux x86_64; rv:78.0) Gecko/20100101 Thunderbird/78.13.0

Hi again,

just realized that there is a nice "info libapl" written by Dr. Dirk Laurie
(the author of libapl) which explains the callback in section 2.4.

Best Regards,
Jürgen


On 7/25/22 11:28 AM, Dr. Jürgen Sauermann wrote:
Hi enztec,

not entirely sure since I haven't written libapl myself. However, looking
at the code it seems to me as if apl_exec returns an APL error code (most
likely as per Error.def) if it fails.

To capture the APL result I suppose you have to print in the _expression_ or
install a result_callback (just guessing), see API description in libapl.h

BTW the libapl API is C while GNU APL is C++.

Best Regards,
Jürgen


On 7/24/22 11:49 PM, enztec@gmx.com wrote:
Hi

i can see you code is c++

I am working with libapl with fpc (freepascal) and i can capture stdout and stderr fine in fpc coding
but the only stdout i get from ap_exec is the 0

i have apl_exec as a function and tried with either of the following definitions

function apl_exec(p : pchar) : longint; cdecl; // gives good results displayed but stdout captures only 0

function apl_exec(p : pchar) : ansistring; cdecl; // gives nothing to screen with apl_exec nor any stdout





On Sun, 24 Jul 2022 17:16:10 -0400

Chris Moller <moller@mollerware.com> wrote:

apl_exec() can output to both stdout and stderr.

I use:


std::stringstream outbuffer;
      std::streambuf *coutbuf = std::cout.rdbuf();
      std::cout.rdbuf(outbuffer.rdbuf());
      std::stringstream errbuffer;
      std::streambuf *cerrbuf = std::cerr.rdbuf();
      std::cerr.rdbuf(errbuffer.rdbuf());
      execerr = apl_exec (cmd.toStdString ().c_str ());
      std::cout.rdbuf(coutbuf);
      std::cerr.rdbuf(cerrbuf);
      outString = QString (outbuffer.str ().c_str ());
      errString = QString (errbuffer.str ().c_str ());

On 7/24/22 16:12, enztec@gmx.com wrote:
hello

What does libapl output?- the apl_exec function returns 0 to stdout but what is the actual display?

for example  apl_exec('⍳20')  what/where is the 1 to 20 displayed so it can be captured?

thanks




reply via email to

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