From: dhandly@hpcuhe.cup.hp.com (Dennis Handly)
Newsgroups: comp.sys.hp
Subject: Re: Bad escape codes on 9000/720?
Date: 7 Jan 93 04:00:05 GMT
Organization: Hewlett-Packard Cal Language Lab

>From: rjohns@brtph46.BNR.CA (Richard Johns P205)
>Ok, some more investigation and I find that there's a Pascal include file,
>/usr/include/pasesc.ph, that maps these "huge numbers" to reasonable numbers.
>For example, escape code 39321792 maps to error PasErr_600, which means I can 
>look up error 600 in /usr/lib/paserrs.  SO, NOW:

>1.  What's with these funny escape codes?  What good are they?

They uniquely indicate that these are Pascal runtime errors vs. some other
runtime library.  And on MPE/iX they indicate which part of the OS the
error occurs, i.e. which Subsystem.

>2.  What's the recommended way of translating the constant PasErr_600 (which is
>    39321792) to 600 so I can look it up in the error message file?  Do I have 
>    to write a giant case statement?

You mean you didn't try to do a linear curve fit?  :-)

You just do:  x div hex('10000');  Provided that x mod hex('10000') = 192.

>3.  Is there anything useful I can do with the error message catalog,
>    /usr/lib/nls/$LANG/pc_msgs.cat?

The file /usr/lib/paserrs is an ascii version of that file.  It states that:
$  categories:
$    600-799   (4)   run-time errors

Which means that message set 4 contains the errors.

>4.  Why isn't any of this explained in the 700 series HP Pascal Reference or 
>    HP Pascal Programmer's guide?  One would think it'd be mentioned with the 
>    escape code stuff, at least.  Or under "Error Messages", or something.

This is documented in the Pascal Programmer's Guide in Chapter 11 under
ESCAPECODE Function and again under XLIBTRAP intrinsic.  The later
show the use of one of these escapecode/errorcodes.

(Both at least mention the name of the file and what it contains.)

The detailed mapping of the fields is documented in the MPE/iX intrinsic
manual and in the Trap Handling Programmer's Guide, 32650-90026 chapter 5.
(This manual is mentioned in the Pascal PG, though it's addressed for
the MPE/iX audience.)

At one time I was going to change the pasesc.ph file to be more obvious:

 pascal_subsystem = 192;
 PasErr_600       = 600 * hex('10000') + pascal_subsystem;
 PasErr_HeapExhausted = paserr_600;

Would that be documentation enough?????

--------------
>// shankar@sgi.com (Shankar Unni) /  1:52 pm  Jan  5, 1993 /
>> 2.  What's the recommended way of translating the constant PasErr_600?
>The exact encoding is an artifact of the system error encoding in the
>MPE/iX operating system, where the *lower* half (16 bits) is a
>"subsystem number", and the *upper* half is the error number.  Seems
>a**-backward, and I never got a good explanation from anyone why it
>was done that way.

Because the upper half is a signed number and this allows you to look
at the 32 bit value and quickly determine if there is no error, 0,
an error (negative) or a warning (positive).
NOTE: Pascal's errors are positive only.  Only MPE/iX uses the sign
notation.

This all has to do with MPE/iX's fancy Error management subsystem.

>> 3.  Is there anything useful I can do with the error message catalog,
>>     /usr/lib/nls/$LANG/pc_msgs.cat?

>If I remember right, the /usr/lib/nls/$LANG/pc_msgs.cat catalog has
>the text for the errors in pasesc.ph. If you know how to read a
>message catalog, you can retrieve the text for these messages from
>there.  I *think* the message set number (for catread/catgetmsg et. al.)
>is "5".

No, 4.