Google
 

Trailing-Edge - PDP-10 Archives - T10_DECMAIL_MS_V11_FT1_860414 - 10,7/mail/mx/mxerr.req
There are 7 other files named mxerr.req in the archive. Click here to see a list.
%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, 'Missing key field',
            MP$SYN, 'Syntax error in line #%D of %A',
            MP$TEL, 'Extraneous text at end of line - "%A"',
            MP$UHF, 'Unsupported host format requested (Internal Error)',
            MQ$MHE, 'Message has expired',
            SP$UIE, 'Unexpected internal error',
            UF$ACF, 'Abort close failed',
            UF$FCF, 'File close failed for %A',
            UF$FRF, 'File read failed for %A',
            UF$FWF, 'File write failed for %A',
            UF$FOF, 'File open failed for %A',
            UF$CGP, 'Cannot get page',
            UF$IFA, 'Invalid file access attempted',
	    UF$IFS, 'Invalid file specification',
            UF$NSR, 'Non-sequential read attempted',
            UF$NSW, 'Non-sequential write attempted',
            UF$TLF, 'Table lookup failed',
            ER$MLE, 'Message level error occured in SERVER or SPOOLER',
            MX$NOM,                 'Insufficient memory',
            MX$NOQ, 'Insufficient quota in %A',
            MG$NSU, '%A: No such user %A',
            MG$LTL, 'SMTP: Line too long',
            MG$UEC, 'SMTP: Unexpected command',
            MG$UIC, 'SMTP: Unimplemented command',
            MG$UNC, 'SMTP: Unknown command',
            MG$ARG, 'SMTP: Bad Argument',
            MG$NNK, '%A: Node %A is not known here',
            MG$MFC, 'SMTP: Mail File corrupted - Mail lost',
            MG$IPS, 'Insufficient privilege for sending mail to SYSTEM',
            MG$GPE, '%A: %I',       !Gen. Purpose Error
            SL$NSU, 'No such user %A',
            SL$NNK, 'Node %A is not known here',
            LS$DMF, 'Duplicate message files %A, %A',
            LS$NMF, 'Message file %A does not exist',
            LS$ICP, 'Invalid continuation packet',
            LS$ISP, 'Invalid sender pid',
            LS$ISU, 'Invalid sender uid',
            LS$INN, 'MX does not service node %A',
            LS$IDS, 'Invalid destination string %A',
            NW$ERR, 'Network error at node %A - %A',
            S2$ERR, '%A',
            LS$UOQ, 'User %A was over quota',
            DN$INP, 'Invalid DECNET mail protocol',            
            LS$IHT, 'Invalid Scan_packet Header Type',
            LS$IRT, 'Invalid Scan_packet Record Type',
            UF$NQE, 'ENQ Error: %O',
            UF$CGL, 'Could not get lock',
            UF$DQE, 'DEQ Error: %O',
            UF$CFL, 'Could not free lock',
            UF$FPE, 'FILOP Error: %O',
            UF$FPF, 'FILOP failed',
            UF$FNF, 'File not found',
            UF$CNP, 'Could not parse',
            UF$LOK, 'file is locked',
            UF$LEN, 'Could not get length of %A',
            UFD$CR, 'Could not create searchlist for %A',
            LS$CCP, 'Could not create PID %A',
            MX$MZB, 'Message file %A contained zero bytes'
          ) %;

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
        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(UPLIT(%ASCIZ %CHAR($chcrt, $chlfd)));
        $$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 %;