Google
 

Trailing-Edge - PDP-10 Archives - bb-kl11k-bm_tops20_v7_0_tsu02_2_of_2 - t20src/mxnrsp.r36
There are 13 other files named mxnrsp.r36 in the archive. Click here to see a list.
!	COPYRIGHT (c) DIGITAL EQUIPMENT CORPORATION 1985, 1989.
!	ALL RIGHTS RESERVED.
!
!	THIS SOFTWARE IS FURNISHED UNDER A  LICENSE AND MAY BE USED AND  COPIED
!	ONLY IN  ACCORDANCE  WITH  THE  TERMS OF  SUCH  LICENSE  AND  WITH  THE
!	INCLUSION OF THE ABOVE  COPYRIGHT NOTICE.  THIS  SOFTWARE OR ANY  OTHER
!	COPIES THEREOF MAY NOT BE PROVIDED  OR OTHERWISE MADE AVAILABLE TO  ANY
!	OTHER PERSON.  NO  TITLE TO  AND OWNERSHIP  OF THE  SOFTWARE IS  HEREBY
!	TRANSFERRED.
!
!	THE INFORMATION IN THIS  SOFTWARE IS SUBJECT  TO CHANGE WITHOUT  NOTICE
!	AND SHOULD  NOT  BE CONSTRUED  AS  A COMMITMENT  BY  DIGITAL  EQUIPMENT
!	CORPORATION.
!
!	DIGITAL ASSUMES NO  RESPONSIBILITY FOR  THE USE OR  RELIABILITY OF  ITS
!	SOFTWARE ON EQUIPMENT THAT IS NOT SUPPLIED BY DIGITAL.

!++
! Facility: LSG DECnet Network Management
!
! Abstract:
!
!        This set of macros is used to manipulate error strings used
!        in NICE processing.  The error string format is the same as
!        that used in a NICE response message.
!
! Environment: Bliss-36, Bliss-32 and Bliss-16.
!
! Author: Steven M. Jenness, Creation date: 18-Mar-81
!
!--
! macro: $CLEAR_RESPONSE
!
!		This macro clears the response string.
!
!    e.x. $CLEAR_RESPONSE (RESPONSE_POINTER);


macro
     $CLEAR_RESPONSE (PTR) =
         begin
         local STRPTR;

         STRPTR = PTR;
         PUTB (0, STRPTR);              ! Clear response code
%if $MCB
%then
         ch$wchar (-1, .STRPTR);        ! Clear error detail
         ch$wchar_a (ch$rchar_a (STRPTR), STRPTR);
%else
         PUTB (-1, STRPTR);             ! Clear error detail
         PUTB (-1, STRPTR);
%fi
         PUTB (0, STRPTR);              ! Clear text length
         PUTB (0, STRPTR);
         end %;


! macro: $RESPONSE
!
!		This macro puts the appropriate values
!		into the fields in a error response string.
!
!	$RESPONSE (PTR, CODE, DET [,TXT] {,PRM ...});
!
!	PTR	Byte pointer to error string buffer
!	CODE	Nice return code
!	DET	Nice error detail
!	TXT	Error text string
!	PRM	Parameters to fill in text string
!
!    e.x.    $RESPONSE (.BUFPTR, NICE$_FOE, 1, "No such device");


macro
     $RESPONSE (PTR, CODE, DET, TXT) =
         begin
         local STRPTR;

         STRPTR = PTR;
         PUTB (CODE, STRPTR);

         %if not %NULL (DET)
         %then %if %ctce (DET)
               %then
                    PUTB ((DET and %o'377'), STRPTR);
                    PUTB ((DET^-8 and %o'377'), STRPTR);
               %else
                    begin
                    local DETAIL;

                    DETAIL = DET;
                    PUTW (DETAIL, STRPTR);
                    end;
               %fi
         %else
%if $MCB
%then
               ch$wchar (-1, .STRPTR);
               ch$wchar_a (ch$rchar_a (STRPTR), STRPTR);
%else
               PUTB (-1, STRPTR);
               PUTB (-1, STRPTR);
%fi
         %fi

         %if not %null (TXT)
         %then %if not $MCB
               %then
                    begin
                    local TXTPTR, CNT;
                    external routine NMU$TEXT;

                    TXTPTR = .STRPTR;
                    PUTB (0, STRPTR);
                    CNT = $NMU$TEXT (STRPTR, 72, %string (TXT, '%N')
                                     %if %length gtr 4
                                     %then , %remaining %fi);
                    PUTB (.CNT, TXTPTR);
                    end;
              %fi
	%else PUTB (0, STRPTR);
	%fi

	ch$diff (.STRPTR, PTR)
	end %;


! macro: $RESPONSE_X
!
!		This macro puts the appropriate values
!		into the fields in a error response string.
!
!	$RESPONSE_X (PTR, CODE, DET [,TXT,ERR] {,PRM ...});
!
!	PTR	Byte pointer to error string buffer
!	CODE	NICE return code
!	DET	NICE error detail
!	TXT	Error text string
!       ERR     Error text number for MCB environment
!	PRM	Parameters to fill in text string
!
!    e.x.    $RESPONSE_X (.BUFPTR, NICE$_FOE, 1, "No such device", 101);


macro
     $RESPONSE_X (PTR, CODE, DET, TXT, ERR) =
         begin
         local STRPTR;

         STRPTR = PTR;

         PUTB (CODE, STRPTR);

         %if not %NULL (DET)
         %then %if %ctce (DET)
               %then
                    PUTB ((DET and %o'377'), STRPTR);
                    PUTB ((DET^-8 and %o'377'), STRPTR);
               %else
                    begin
                    local DETAIL;

                    DETAIL = DET;
                    PUTW (DETAIL, STRPTR);
                    end;
               %fi
         %else
%if $MCB
%then
               ch$wchar (-1, .STRPTR);
               ch$wchar_a (ch$rchar_a (STRPTR), STRPTR);
%else
               PUTB (-1, STRPTR);
               PUTB (-1, STRPTR);
%fi
         %fi

         %if not %null (TXT)
         %then %if not $MCB
               %then
                    begin
                    local TXTPTR, CNT;
                    external routine NMU$TEXT;

                    TXTPTR = .STRPTR;
                    PUTB (0, STRPTR);
                    CNT = $NMU$TEXT (STRPTR, 72, %string (TXT, '%N')
                                     %if %length gtr 4
                                     %then , %remaining %fi);
                    PUTB (.CNT, TXTPTR);
                    end;
               %else
                    begin
                    linkage CBDSG = JSR (register=0,register=1,register=2;
                                         register=0) : nopreserve (1,2);
                    external routine $CBDSG : CBDSG novalue;

                    PUTB (5, STRPTR);   ! 5 digit ASCII signed decimal number
                    $CBDSG (.STRPTR,
                            %if not %null (ERR)
                            %then ERR %else 99999 %fi,
                            1;
                            STRPTR);
                    end;
               %fi
        %else PUTB (0, STRPTR);
	%fi

	ch$diff (.STRPTR, PTR)
	end %;


! macro: $RESPONSE_CODE
!
!		This macro puts the reponse code into the
!		specified response string.
!
!    e.x.    $RESPONSE_CODE (RESPONSE_POINTER, NICE$_UFO);

macro
     $RESPONSE_CODE (PTR, CODE) =
         begin
         ch$wchar (CODE, PTR);
         end %;


! macro: $RESPONSE_DETAIL
!
!		This macro puts the error detail into the
!		specified response string.
!
!    e.x.    $RESPONSE_DETAIL (RESPONSE_POINTER, 11);


macro
     $RESPONSE_DETAIL (PTR, DET) =
         begin
         local STRPTR;

         STRPTR = ch$plus (PTR, 1);

         %if %ctce (DET)
         %then
              PUTB ((DET and %o'377'), STRPTR);
              PUTB ((DET^-8 and %o'377'), STRPTR);
         %else
              begin
              local DETAIL;

              DETAIL = DET;
              PUTW (DETAIL, STRPTR);
              end;
         %fi
         end %;


! macro: $RESPONSE_TEXT
!
!		This macro puts the error text into
!		the specified response string.  The
!		format of the arguments is the same as
!		as that taken by $NMU$TEXT.
!
!    e.x.    $RESPONSE_TEXT (RESPONSE_POINTER, 'Bad error:', .WHY);


macro
     $RESPONSE_TEXT (PTR, TXT) =
         %if $MCB
         %then
              begin
              local STRPTR, TXTPTR;

              TXTPTR = ch$plus (PTR, 3);
              STRPTR = ch$plus (.TXTPTR, 1);
              PUTB ($NMU$TEXT (STRPTR, 72, %string (TXT, '%N')
                               %if %length gtr 2
                               %then , %remaining %fi),
                    TXTPTR);
              end
         %fi %;


! macro: $RESPONSE_LENGTH
!
!		This macro returns the length (in bytes) of
!		the response string.  It assumes that an response
!		code, error detail and counted text string
!		exist.
!
!    e.x.    LENGTH = $RESPONSE_LENGTH (RESPONSE_POINTER);


macro
     $RESPONSE_LENGTH (PTR) =
         begin
         local STRPTR;

         STRPTR = ch$plus (PTR, 3);
         4 + GETB (STRPTR)
         end %;


! macro: $GET_CODE
!
!		This macro fetches the response code field in the
!		specified error string.
!
!    e.x.    CODE = $GET_CODE (RESPONSE_POINTER);


macro
     $GET_CODE (PTR) =
         begin
         ch$rchar (PTR)
         end %;


! macro: $GET_DETAIL
!
!		This macro gets the error detail from the
!		specified response string.
!
!    e.x.    DETAIL = $GET_DETAIL (RESPONSE_POINTER);


macro
     $GET_DETAIL (PTR) =
         GETW_NA (ch$plus (PTR, 1)) %;


! macro: $GET_TEXT
!
!		This macro gets a pointer to the text field
!		in specified the response string.
!
!    e.x.    TEXT_PTR = $GET_TEXT (RESPONSE_POINTER);
!	     TEXT_LENGTH = GETB (TEXT_PTR);


macro
     $GET_TEXT (PTR) =
         ch$plus (PTR, 3)) %;
%title ''
%sbttl ''

!
! [End of NMRSP.REQ]