From: Dave Hayden on
On Feb 5, 5:03 pm, "hughseri...(a)googlemail.com"
<hughseri...(a)googlemail.com> wrote:
> Hi,
>
> I've been having a look at this library. it's really handy for
> interfacing Saturn objects to C and back. do you know how i might
> raise C errors as saturn errors. for example, divide by zero, or some
> other math error.
>

Thanks for using it Hugh. I had a bad feeling that it was just going
to gather dust. :)

An alternative to Tim's excellent suggestion is to have your program
return 1 and a string (on levels 1 and 2) if there is an error, or 0
and whatever else it might return on levels 1-N on success. Then call
it in a user RPL wrapper: IF myProg THEN DOERR END. That way if the C
code returns 0 then you get an error beep and a text box with the
string. Otherwise the IF/THEN pops the "0" and you're left with the
"real" return values.

> i might have a go at the matrix & list bits next.

There's a bug in the LISTencodeN() and it's cousins like
SYMBencodeN(). I can send you the repaired source file or a patched
library if you like.

Dave

>
> thanks,
> -- hugh.

From: TW on
> An alternative to Tim's excellent suggestion is to have your program
> return 1 and a string (on levels 1 and 2) if there is an error, or 0
> and whatever else it might return on levels 1-N on success.

That works, but the benefit of using the built in system is that your
library can have error messages in a message table and they will be
displayed correctly by all of the correct error handling systems. I
generally return a sysRPL true or false, and then run the error system
if it is false.

TW