Path: utzoo!utgpu!news-server.csri.toronto.edu!rpi!zaphod.mps.ohio-state.edu!usc!jarthur!sburke From: sburke@jarthur.Claremont.EDU (Scott Burke) Newsgroups: comp.sys.handhelds Subject: Re: HP48:Errorhandling help,strange feature and a little problem Keywords: HP48 Error Message-ID: <11807@jarthur.Claremont.EDU> Date: 19 Apr 91 06:18:20 GMT References: <1548@tau.sm.luth.se> Distribution: comp Organization: Harvey Mudd College, Claremont, CA 91711 Lines: 55 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