Google
 

Trailing-Edge - PDP-10 Archives - tops20-v7-ft-dist1-clock - 7-sources/mxerr.req
There are 7 other files named mxerr.req in the archive. Click here to see a list.
! Edit= 314 to MXERR.REQ on 17-May-88 by WADDINGTON, for SPR #21402
!Make MX work without DECnet for both TOPS-10 and TOPS-20.
%title 'MXERR - Error message handler macros'
!++
! Facility: DECMAIL/MS - Message EXchange
!
! Abstract:
!          This set of macros is used to manipulate error strings used
!      by MX.
!
! Environment: Bliss 36,
!
! Author: Richard B. Waddington, Creation Date: October 8, 1984
!
!--
MACRO error$data =
        (
            MP$MKF, 'MP$MKF-Missing key field',
            MP$SYN, 'MP$SYN-Syntax error in line #%D of %A',
            MP$TEL, 'MP$TEL-Extraneous text at end of line - "%A"',
            MP$UHF, 'MP$UHF-Unsupported host format requested (Internal Error)',
            MQ$MHE, 'MQ$MHE-Message has expired',
            SP$UIE, 'SP$UIE-Unexpected internal error',
            UF$ACF, 'UF$ACF-Abort close failed',
            UF$FCF, 'UF$FCF-File close failed for %A',
            UF$FRF, 'UF$FRF-File read failed for %A',
            UF$FWF, 'UF$FWF-File write failed for %A',
            UF$FOF, 'UF$FOF-File open failed for %A',
            UF$CGP, 'UF$CGP-Cannot get page',
            UF$IFA, 'UF$IFA-Invalid file access attempted',
	    UF$IFS, 'UF$IFS-Invalid file specification',
            UF$NSR, 'UF$NSR-Non-sequential read attempted',
            UF$NSW, 'UF$NSW-Non-sequential write attempted',
            UF$TLF, 'UF$TLF-Table lookup failed',
            ER$MLE, 'ER$MLE-Message level error occured in SERVER or SPOOLER',
            MX$NOM,                 'MX$NOM-Insufficient memory',
            MX$NOQ, 'MX$NOQ-Insufficient quota in %A',
            MG$NSU, 'MG$NSU-%A: No such user %A',
            MG$LTL, 'MG$LTL-SMTP: Line too long',
            MG$UEC, 'MG$UEC-SMTP: Unexpected command',
            MG$UIC, 'MG$UIC-SMTP: Unimplemented command',
            MG$UNC, 'MG$UNC-SMTP: Unknown command',
            MG$ARG, 'MG$ARG-SMTP: Bad Argument',
            MG$NNK, 'MG$NNK-%A: Node %A is not known here',
            MG$MFC, 'MG$MFC-SMTP: Mail File corrupted - Mail lost',
            MG$IPS, 'MG$IPS-Insufficient privilege for sending mail to SYSTEM',
            MG$GPE, 'MG$GPE-%A: %I',       !Gen. Purpose Error
            SL$NSU, 'SL$NSU-No such user %A',
            SL$NNK, 'SL$NNK-Node %A is not known here',
            LS$DMF, 'LS$DMF-Duplicate message files %A, %A',
            LS$NMF, 'LS$NMF-Message file %A does not exist',
            LS$ICP, 'LS$ICP-Invalid continuation packet',
            LS$ISP, 'LS$ISP-Invalid sender pid',
            LS$ISU, 'LS$ISU-Invalid sender uid',
            LS$INN, 'LS$INN-MX does not service node %A',
            LS$IDS, 'LS$IDS-Invalid destination string %A',
            NW$ERR, 'NW$ERR-Network error at node %A - %A',
            S2$ERR, 'S2$ERR-%A',
            LS$UOQ, 'LS$UOQ-User %A was over quota',
            DN$INP, 'DN$INP-Invalid DECNET mail protocol',            
            LS$IHT, 'LS$IHT-Invalid Scan_packet Header Type',
            LS$IRT, 'LS$IRT-Invalid Scan_packet Record Type',
            UF$NQE, 'UF$NQE-ENQ Error: %O',
            UF$CGL, 'UF$CGL-Could not get lock',
            UF$DQE, 'UF$DQE-DEQ Error: %O',
            UF$CFL, 'UF$CFL-Could not free lock',
            UF$FPE, 'UF$FPE-FILOP Error: %O',
            UF$FPF, 'UF$FPF-FILOP failed',
            UF$FNF, 'UF$FNF-File not found',
            UF$CNP, 'UF$CNP-Could not parse',
            UF$LOK, 'UF$LOK-file is locked',
            UF$LEN, 'UF$LEN-Could not get length of %A',
            UFD$CR, 'UFD$CR-Could not create searchlist for %A',
            LS$CCP, 'LS$CCP-Could not create PID %A',
            MX$MZB, 'MX$MZB-Message file %A contained zero bytes',
            MX$CTP, 'MX$CTP-Could not translate POBOX:',
            MP$PLD, 'MP$PLD-Path loop detected at node %A'
          ) %;

MACRO
    $GLITERAL =				! Initialize for constant creation
	%ASSIGN( $xpo$distinct, 0 )     !NOTE GLOBAL LITERAL cannot occur
	GLOBAL LITERAL %;               !in LIBRARY file.

MACRO 
    $ERROR_TABLE =
        UNDECLARE mxerrs;
        UNDECLARE $ebuf;
        UNDECLARE ext_lines(%remove(error$data));

        $gliteral
        lit_lines(%REMOVE(error$data));
        
        GLOBAL mxerrs: VECTOR [max_error]
        INITIAL
            (0,
             STR_LINES(%remove(error$data)) );

        GLOBAL $ebuf: VECTOR[CH$ALLOCATION(256)] %;

macro EXT_LINES (CODE,TEXT)[] =
         CODE
         %if not %null(%remaining) %then ,EXT_LINES(%remaining) 
         %else ;
         %if %declared(max_error) %then 
         UNDECLARE max_error;
         %fi

         LITERAL
            max_error = %count + 2 %fi %;

macro LIT_LINES (CODE,TEXT)[] =
         CODE = $distinct
         %if not %null(%remaining)
         %then
              ,LIT_LINES(%remaining)
         %fi %;

macro STR_LINES (CODE,TEXT)[] =
         ch$ptr(uplit(%string(%asciz TEXT)))
         %if not %null(%remaining)
         %then
              ,STR_LINES(%remaining) %fi %;

EXTERNAL ext_lines(%remove(error$data));
EXTERNAL mxerrs: vector[max_error];
EXTERNAL $ebuf:  vector[CH$ALLOCATION(256)];

MACRO $$cnt(_A_) =
    %LENGTH %;

MACRO $$oplen(_arg) =
    %IF %CTCE(_arg) %THEN
        %IF (_arg NEQ 0) AND (_arg NEQ $error_code)
        %THEN 1
        %ELSE 0 %FI
    %ELSE 1 %FI %;

MACRO $$assign_args(_n, _arg)[] =
    %IF NOT %NULL(_arg) %THEN
    _argblck[_n] = _arg;
    $$assign_args(_n+1, %REMAINING) %FI %;

KEYWORDMACRO
    $error(severity, code, facility,
           id=0,
           message_data=,
           optional_message=0,
           optional_data=) =

        BEGIN
        %IF facility EQL $message
        %THEN
            %IF %CTCE(id)
            %THEN
                %ERROR('Missing Message ID in $ERROR call') %FI %FI

        STACKLOCAL
            _argblck: VECTOR[5 + $$cnt(%remove(message_data)) +
                                 $$cnt(%remove(optional_data)) +
                                 $$oplen(optional_message)]

                        INITIAL(4 + $$cnt(%remove(message_data)) +
                                    $$cnt(%remove(optional_data)) +
                                    $$oplen(optional_message),

                                sts$value(SEV=severity,COD=code,FAC=facility),

                                0,
                                0,
                                5 + $$cnt(%remove(message_data)) +
                                    $$oplen(optional_message)
                                );

        _argblck[2] = id;
        _argblck[3] = optional_message;

        $$assign_args(5, %REMOVE(message_data))

        %IF $$oplen(optional_message) %THEN
            _argblck[5+$$cnt(%REMOVE(message_data))] = optional_message; %FI

        $$assign_args(5+$$cnt(%REMOVE(message_data))+$$oplen(optional_message),
                        %REMOVE(optional_data))

        mx$error_processor(_argblck);
        $false
        END %;

KEYWORDMACRO
    $signal_error(severity, code, facility,
                  id=0,
                  message_data=,
                  optional_message=0,
                  optional_data=) =
        SIGNAL(
            sts$value(SEV=severity, COD=code, FAC=facility),
            id,
            optional_message,
            5 + $$cnt(%REMOVE(message_data))
            %IF NOT %NULL(message_data) %THEN ,%REMOVE(message_data) %FI
            %IF $$oplen(optional_message) %THEN ,optional_message %FI
            %IF NOT %NULL(optional_data) %THEN ,%REMOVE(optional_data) %FI
                    ) %;

    MACRO
        $e_display(b) =
        %IF %SWITCHES(TOPS20) %THEN
            BEGIN
            DECLARE_JSYS(psout);
            $$psout(b);
            END
        %ELSE
            task_info(CH$PTR(b))
        %FI %;

%if $TOPS20 %then
macro
     $LAST_ERROR =
           (declare_jsys(geter);
           local error;

           $$geter($fhslf;error);
           .error<0,18>
            ) %;
%fi
!
! Severity codes:
!
LITERAL
    $warning = 0,
    $success = 1,
    $err     = 2,
    $info    = 3,
    $severe  = 4;

!
! Facility codes:
!
$LITERAL
    $protocol = $DISTINCT,
    $message  = $DISTINCT,
    $internal = $DISTINCT;

LITERAL
    min_facility = $protocol,
    max_facility = $internal;
!
! Other symbols
!
LITERAL
    $error_code = -1;

MACRO
    abort_mx =
        %IF %SWITCHES(TOPS20) %THEN

        BEGIN
        DECLARE_JSYS(psout,haltf);

        $$psout(crlf_pointer);                          ![314]New MONSYM change
        $$psout(UPLIT(%ASCIZ %STRING('?MX crashed')));
        $$haltf();
        END

        %ELSE
!           %WARN('ABORT_MX not implemented for this OS')
	BEGIN
	BUILTIN UUO;

	UUO(0,EXIT(1));
	END
        %FI %;