Google
 

Trailing-Edge - PDP-10 Archives - T10_DECMAIL_MS_V11_FT1_860414 - 10,7/mail/mx/nmrsp.req
There are 3 other files named nmrsp.req in the archive. Click here to see a list.
! NET:<PECKHAM.DEVELOPMENT>NMRSP.REQ.2 24-May-82 17:55:52, Edit by PECKHAM
!
!    Set proper default for ERROR DETAIL to -1.
!    Optimize string access for MCB.
!
! NET:<VOBA.NML.DEVELOPMENT>NMRSP.REQ.7 18-Feb-82 15:49:32, Edit by VOBA
!
!    Clean up code and update copyright date.
!
! NET:<DECNET20-V3P1.BASELEVEL-2.SOURCES>NMRSP.REQ.5 16-Oct-81 16:04:12, Edit by PECKHAM
!
!    Optimize various macros for MCB.
!
! NET:<DECNET20-V3P1.NML>NMRSP.REQ.2  8-Aug-81 11:56:02, Edit by GUNN
!
!    Change $RESPONSE macro to provide for error numbers in MCB.
!
! NET:<DECNET20-V3P1.NMU>NMRSP.REQ.3 24-Jun-81 08:53:13, Edit by JENNESS
!
!    Readability improvements.  Copyright page insertion.
!
! NET:<DECNET20-V3P1.BASELEVEL-2.SOURCES>NMRSP.REQ.2 12-Jun-81 15:26:07, Edit by GUNN
!
!    Made calls to NMU$TEXT be under $MCB conditional.
!
%title 'NMRSP -- NICE Response Generation Macros'

!                     COPYRIGHT (C) 1981, 1982 BY
!     DIGITAL EQUIPMENT CORPORATION, MAYNARD, MASSACHUSETTS  01754
!
! THIS SOFTWARE IS FURNISHED  UNDER A LICENSE FOR USE ONLY ON A SINGLE
! COMPUTER  SYSTEM AND  MAY BE  COPIED ONLY 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
! EXCEPT FOR USE ON SUCH SYSTEM AND TO ONE WHO AGREES TO THESE LICENSE
! TERMS.  TITLE TO AND  OWNERSHIP OF THE  SOFTWARE  SHALL AT ALL TIMES
! REMAIN IN DEC.
!
! THE INFORMATION IN THIS SOFTWARE IS SUBJECT TO CHANGE WITHOUT NOTICE
! AND SHOULD  NOT BE CONSTRUED  AS A COMMITMENT  BY DIGITAL  EQUIPMENT
! CORPORATION.
!
! DEC ASSUMES  NO  RESPONSIBILITY  FOR  THE USE OR  RELIABILITY OF ITS
! SOFTWARE ON EQUIPMENT WHICH IS NOT SUPPLIED BY DEC.
!

!++
! 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]