A small but powerful message manager (HP 49g+)
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 nearly 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 49g+. 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 impossible at the user level on the 49g+ ROM < 2.0. Tested in a ROM 1.24 on the 49G and in ROM 2.0 on 49g+. Load Msgman in a port and attach as usual with a warmstart.
What is New?
Version 1.2005: Adapted to ROM 2.0
Version 5.2004: SiERR (Silent Error out) replaces HDXY.
Version 4.2004: Command menu reorganized
Version 3.2004: Small improvement in HDXY.
Version 2.2004: Flash not anymore too fast on the 49g+.
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 at least one internal library. There is a simple rule to compute from the message number n the (first) 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, 257 GetM yields "No Room to Save Stack", the first message in library 1, since 257 = 0101h. The message "Interrupted" has number 319 = 013Fh. That is, "Interrupted" is message number 3F in library 1, but also message 3 in library 10 (= Ah). This is clearly a redundancy of the operating system. How we found this message numbers will be explained below.
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 49g+. The left-hand screen contains several new messages in the 49g+ 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 "Interrupted", 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 which contains all messages containing the fragment "INT". 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 always readable system bint. 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 (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 48G-series browser used in FndM.
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 49g+ 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 49g+ with its nerving error beep, e.g., during class-room tasks.
Remark 1. 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.
Remark 2. On the 49G, with older ROM (e.g. 1.19-6), only the first two commands: GetM and ListM are working properly.
Remark 3. The Library numbers can change with changing ROM-Versions. The screen shots have been made with the 49g+ ROM 1.22.
Credits. The command FindM uses an idea from FindMsg by Carsten Dominik.
Wolfgang Rautenberg - firstname.lastname@example.org - www.math.fu-berlin.de/~raut