How to simulate system error msgs on 48?
06-26-2014, 05:24 PM (This post was last modified: 06-26-2014 05:38 PM by HP67.)
Post: #1
 HP67 Senior Member Posts: 605 Joined: Dec 2013
How to simulate system error msgs on 48?
I'm backporting some RPL system functions from the 48GX to the SX for some code I wrote. I'm implementing them on the SX in User RPL for now.

I have not figured out a way to simulate system error messages. I know how to display the text across the top two display lines and make it look just like the real thing with DOERR. I also know I can set the error message number with DOERR. What I have not figured out is how to do both, short of a really hideous kludge.

Anybody got any ideas on this? I figure it must have come up before.

It ain't OVER 'till it's 2 PICK
06-27-2014, 02:28 AM
Post: #2
 DavidM Senior Member Posts: 754 Joined: Dec 2013
RE: How to simulate system error msgs on 48?
(06-26-2014 05:24 PM)HP67 Wrote:  I know how to display the text across the top two display lines and make it look just like the real thing with DOERR. I also know I can set the error message number with DOERR. What I have not figured out is how to do both, short of a really hideous kludge.

Can you explain a bit more about what you're trying to do? It appears from the documentation for DOERR (and some verification testing) that it sets both the error number and the appropriate message when provided with a valid error number.

Here's a sample that shows both the number and message being set when only the error number is supplied:
Code:
\<<   ERR0            @ Clear out any previous errors   ERRN ERRM       @ Recall current error number and message   IFERR           @ Trap the following error so that program doesn't stop     #203h DOERR   @ Trigger error #203h - Bad Argument Value   THEN   END   ERRN ERRM       @ Recall current error number and message   OVER DOERR      @ Force the error to display \>>

Are you trying to generate errors that aren't predefined, but want to use something other than #70000h for the number? It's not clear based on your description. If that's the case, you would probably need to use SYSEVALs to store the number/message and trigger the error since it doesn't appear that there are any standard UserRPL commands for those purposes.
06-27-2014, 08:00 AM
Post: #3
 HP67 Senior Member Posts: 605 Joined: Dec 2013
RE: How to simulate system error msgs on 48?
Hi and thanks for looking into this. Sorry for not giving an example or a better explanation earlier.

Errors from the system words appear with the name of the command as part of the error text, for example

Code:
1 HEAD

produces

Code:
HEAD Error: Bad argument type

But

Code:
# 202h DOERR

produces
Code:
Error: Bad argument type

I don't know how to get the command name to appear before the "Error:" literal.

I want to be able to implement all the same effects as a system error message. I want the command name to appear in the error message, and I believe I'll have to use DOERR so ERRN and ERRM are set so the replacement words I'm working on back-porting all produce identical results as the GX words they're meant to replace.

It ain't OVER 'till it's 2 PICK
06-27-2014, 02:38 PM
Post: #4
 DavidM Senior Member Posts: 754 Joined: Dec 2013
RE: How to simulate system error msgs on 48?
(06-27-2014 08:00 AM)HP67 Wrote:  I want to be able to implement all the same effects as a system error message. I want the command name to appear in the error message, and I believe I'll have to use DOERR so ERRN and ERRM are set so the replacement words I'm working on back-porting all produce identical results as the GX words they're meant to replace.

Thanks for the additional explanation. Now I understand what you're trying to do.

Is keeping the error number intact really that important? If not, a structure like the following in your replacement code is reasonably compact:
Code:
\<<   IFERR     @ some code     @ some code     0 INV                 @ to force an error   THEN     "MyCmd Error: " 10 CHR + ERRM + DOERR   END \>>

I'm not aware of any UserRPL way to keep the error number intact that still acts exactly like a system error. The following is close, but not exact. It's also much messier:
Code:
\<<   IFERR     0 INV                 @ to force an error   THEN     "MyCmd Error:" 1 DISP     ERRM 2 DISP     1400 0.08 BEEP     1 FREEZE     0 WAIT DROP KILL   END \>>

Note that pressing ON/ATTN to clear the screen in that case will actually interrupt the program instead of allowing it to continue, which will leave an additional zero on the stack. Perhaps someone else knows of a better solution -- this is all I can think of at the moment.
06-27-2014, 02:45 PM
Post: #5
 HP67 Senior Member Posts: 605 Joined: Dec 2013
RE: How to simulate system error msgs on 48?
(06-27-2014 02:38 PM)DavidM Wrote:  Is keeping the error number intact really that important?

Yes, I am trying to replace some functions as seamlessly as reasonably possible and for that to work so other code could use them presumably the new ones have to be black box replacements for the old ones.

Thanks for the info and help. I may have to look at writing a message wrapper in Sys RPL, if it's possible to set the command name that way.

It ain't OVER 'till it's 2 PICK
 « Next Oldest | Next Newest »

User(s) browsing this thread: 1 Guest(s)