d89-mlt@sm.luth.se (Morgan Lindqvist) (04/19/91)
Hello World! I have a BIG and a tiny problem, hope you out there can help me solving them. The BIG problem: --------------- When one in a program or a library does a #201h DOERR the HP says: Error: Too Few Arguments How do I do if I want it to say: HDrcl Error: Too Few Arguments HDrcl is the program there the DOERR reside. e.i How do I tell the errorhandler that it is the command HDrcl is the active one. If you key in a program like this with a library attached, you will get a very strange error message if you detach and purge the library and then run the program. \<< 12 'Test' STO Library_command \>> The HP will say: STO Error: Undefined XLIB Name 4: 3: 2: 12 1: 'Test' Yes, your eyes are telling you the right thing. The arguments to STO are still on the stack AND there is a new variable called Test containing 12 on the directory. I understand why it says 'Undefined XLIB Name', but I was very surprised that the errorhandler still thinks that STO is the present command and there fore restores the stack as it looked before the STO command. NOTE: I have a HP48-A, can someone whit a version D or E verify this behavior. Now to something more easy The tiny problem: ---------------- Where can I get the IFERR library I am eagerly waiting for YOUR answer (E-Mail OR c.s.h (h=handhels or h=hp48)) Morgan Lindqvist d89-mlt@sm.luth.se
sburke@jarthur.Claremont.EDU (Scott Burke) (04/19/91)
Let me generalize this problem a little bit, and further ask for a solution: I write a user-defined function in user-RPL, like this one: PLUS \<< \-> a b \<< a b + \>> \>> If there are too few arguments, then I get an error message like: \-> Error: Too Few Arguments Now on to a more complicated example: DIVIDE \<< \-> a b \<< IFERR a b / THEN -55 FC? { a b } IFT @ restore LastArgs if -55 clear, to @ mimic the HP-48SX behavior "DIVIDE Error:\010" @ \010 is a newline ERRM + DOERR @ repeat the error, but with "DIVIDE..." END \>> \>> This routine (and the obvious extensions to it, which involve type-checking the two variables 'a' and 'b') will mimic the built-in '/' operator, except for one situation: Too Few Arguments. Since I want a user-defined function, I _must_ immediately do the "\-> a b" command to get the arguments, without first checking that at least two things are on the stack. If I could check that two things were on the stack, I could provide the desired error: DIVIDE Error: Too Few Arguments As it is, I must make do with the "\-> Error:\010Too Few Arguments" version. It's a minor quibble, but I am curious as to how to trigger or control the built-in error handler. I'm not looking for machine-language solutions, but perhaps a simple SYSEVAL or two that I can plop into a user-language routine. Any ideas? Scott sburke@jarthur.claremont.edu