Trailing-Edge
-
PDP-10 Archives
-
decuslib10-08
-
43,50512/ertext.b36
There are no other files named ertext.b36 in the archive.
MODULE ERTEXT=
!Contains routine to return text from error messages
BEGIN
!
! Table of Contents
!
FORWARD ROUTINE
ERTEXT; !Return pointer to error message text
!
! Conditional Compilation
!
COMPILETIME FTCRASH_UEC=0; !No crash on undefined error code
!
! Library & Require files
!
LIBRARY 'TBL';
!
! Version
!
THIS_IS[ERTE] VERSION[1] EDIT[5] DATE[26,MAR,79]
!
! Revision History
!
![5] DAP status codes we don't have text for should not be
! referred to as 'Undefined'
!
! Global data
!
!Strings to return addresses of if code is not defined
GLOBAL BIND
ERRUEC=UPLIT(%ASCIZ'Undefined error code '),
RMTUEC=UPLIT(%ASCIZ'DAP Status code ');
!
! Routines
!
GLOBAL ROUTINE ERTEXT(NUM)=
!Return text of error message
!Arguments
!NUM: error code
!Returns address of error text
BEGIN
!First declare the group names GLOBAL
UNDECLARE %QUOTE ERGROUP, %QUOTE ER;
!Macro To generate UPLIT with number and error text
!Arguments
!SYM: Symbolic name to be given to this error code (globally)
!NUM: Numeric value of error code
!TEXT: Text of error message
MACRO ER(SYM,NUM,TEXT)=SYM,UPLIT(%ASCIZ TEXT), %;
FIELD ERRTAB_FIELDS=
SET
ERRTAB_CODE=[0,0,36,0],
ERRTAB_TEXT=[1,0,36,0]
TES;
GLOBAL BIND ERRTAB=PLIT(
ALL_ERRS
0,UPLIT(%ASCIZ 'No error code given')
):BLOCKVECTOR[99,2] FIELD(ERRTAB_FIELDS);
BEGIN
UNDECLARE %QUOTE ER;
MACRO ER(NUM)=INTERN(NUM); %;
ALL_ERRS;
END;
INCR I FROM 0 TO (.(ERRTAB-1)/2) DO
BEGIN
IF .NUM EQL .ERRTAB[.I,ERRTAB_CODE] THEN
RETURN .ERRTAB[.I,ERRTAB_TEXT];
END;
SELECTONE .NUM OF SET
[RMTERR TO RMTERR+%O'177777']:
RMTUEC;
[OTHERWISE]:
BEGIN
!Somebody gave us an error code we never heard of!!!
LOCAL STR:VECTOR[CH$ALLOCATION(40)];
LOCAL PTR;
EXTERNAL ROUTINE WRNUM,%NAME('.CRASH');
%IF FTCRASH_UEC
%THEN
PTR=CH$PTR(STR);
WRNUM(.NUM,8,.PTR); !Convert to ASCII
TYPE('%??Undefined Error code: ');
TSTR(STR); !Error code number
%NAME('.CRASH')(); !This should never happen
%FI
ERRUEC !Return this if we get back here
END;
TES
END;
END ELUDOM