A small but powerful message manager (H49G/HP49G+)
Messages can only partly be handled at the user level in the ERROR menu. This situation improves considerably with Msgman. All built-in messages can conveniently be called to the stack, and you can find all built-in messages containing a given text fragment. Using its number instead of a message itself saves bytes in your programs and makes the message even language-sensitiv. Msgman has one page only. The first 3 commands deal with built-in messages, the last 3 with message display, preferably in the new header of the HP49+. You can flash a message in the new header, or display it in two lines in the header, similar to PROMPT but without suspending with HALT. And you can insert a small text into the header at a suitable place. All this is presently impossible at the user level on the HP49+ because of the enlarded screen. Tested in a ROM >19-6 on the HP49 and in ROM 1.22 the HP49+. Load Msgman in a port and attach as usual with a warmstart.
What is New?
Version 5.2004: SiERR (Silent Error out) replaces HDXY (a command in Headman).
Version 4.2004: Command menu reorganized
Version 3.2004: Small improvement in HDXY.
Version 2.2004: Flash not anymore too fast on the HP49+.
First version 1.2004 (made October 2003).
The six commands of the Msgman library are explained in the following table. The 2nd column describes the arguments, the 3rd column the output or the effect. More about these commands can be found in the Comments below.
Stack output or effect
GetM A zint, a real or user binary The mostly language-sensitive message associated with the input number.
Example: 1 GetM yields "Insufficient Memory" (if English is set).
ListM A zint, a real or user binary All messages living in the library with the input number.
Example: 1 LstM yields 89 interesting messages from library 1.
FindM A string (word or word fragment) Browse all messages containg the input string. Select the interesting ones with the +/- key and ENTER. This puts them as 2-lists with their numbers in stack. Cf. the example in the comments below. Flash Any, preferably a string Make string from input and flash it in the header using it entirely.
Example: "Stored in HOME" is flashed about 2_s.
HDF Any, preferably a string Make string from input and display&freeze it in the header using the entire header area. HDF is a shortcut of "Header Display Freeze". SiErr None Creates or overwrites the reserved variable STARTERR in such a way that errors don't beep anymore, independently on the BEEP flag.
With a zint, a real or a user binary argument, GetM gets the corresponding message. Normally this is possible only in a special context with DOERR. However, error out is not always wanted and most built-in messages have nothing to do with errors. Each built-in messages occurs in one or several internal libraries. There is a simple rule to compute from the message number n the library in which it occurs and its index in that library. Write n as a 4-place hexagesimal number, with leading zeros if necessary. The first two digits are the library number, the last two digits the message index in that library. For instance, the first message in library 1 has number 257 = 0101h. The "Interrupted" message has the numbers 319 = 013Fh and 2563 = 0A03h. That is, "Interrupted" is message number 3F in library 1 and at the same time message 3 in library 10 (= Ah), clearly a redundancy of the operating system. How we found this numbers will be explained in a while.
Sometimes it is useful to get all messages of a certain built-in library. The first two screen-shots show the last eight messages of libraries 0 (boot library) and 257 (MASD), obtained by running LstM on these numbers If switching to French or Spanish, all these messages will appear in the corresponding language on the HP49+. The left-hand screen contains several new messages in the HP49+ which refer to the new SD-card utility.
How to find the message numbers of "Interrupted" and how to know that this message occurs at all? Just feed the powerful command FndM with a word or fragment of this word, with "INT", say. FndM will search for all built-in messages containing the word fragment "INT", in particular the word "Interrupted". FndM ends up after a few seconds with a browser as shown in the screen-shot. Select the two ocurrences of "Interrupted" with the +/- key as in the screen. That filters them out together with their message numbers when pressing OK or ENTER. In precisely this way also the message "searching" and several others were found and explicitly used in FndM. This procedure saved a lot of bytes in Msgman, in Keyman and many other libraries. A selected message in the FndM box appears together with its number in a list on the stack. The number is a system bint but always readable. In case of multiple selection there will be several such lists on the stack. The VIEW option in the browser is useful because some built-in messages, mainly CAS messages, are too long to be displayed in one line. As can be seen from the screen, message search in FndM is case-insensitive. Attention. If you selected with +/-, the tic marks may be lost if browsing over the screen end. This is a not documented bug in the old HP48 browser used in FndM. I found no way to fix it.
Flash just flashes a message in the header for about 1 second. HDF displays and freezes a message in the header. Particular useful for the 49+ where 1 DISP 1 FREEZE does presently not work as it should. When these commands are used inside another environment, one returns without any problems. The last command SiErr is useful in particular on the 49 with its nerving error beep, e.g., during class-room tasks.
Remark. The STARTERR created by SiErr may be used also for special message display. It needs 2 objects which are displayed in a box in separate lines.
Credits. The command FindM uses an idea from FindMsg by Carsten Dominik.
Wolfgang Rautenberg - firstname.lastname@example.org - www.math.fu-berlin.de/~raut