Google
 

Trailing-Edge - PDP-10 Archives - bb-h138f-bm - 7-sources/mxnstr.req
There are 6 other files named mxnstr.req in the archive. Click here to see a list.
! UPD ID= 18, SNARK:<6.1.NML>STRLIB.REQ.2,  24-May-84 13:51:41 by GLINDELL
! NET:<VOBA.NML.DEVELOPMENT>STRLIB.REQ.9 18-Feb-82 12:41:09, Edit by VOBA
!
! Readability cleanup and copyright update.
!
! 14-Nov-81 22:45:18, Edit by GROSSMAN
!
! Fix CH$LEN macro so that when the string is longer than the maximum length
! the maximum length supplied by the user is substituted.
!
! NET:<DECNET20-V3P1.NMU.LIBRARY>STRLIB.REQ.3 12-Jun-81 11:59:08, Edit by JENNESS
!
! Readability cleanup and copyright update.
!
%title 'STRLIB -- String Processing Macro Library'

!                     COPYRIGHT (c) 1981, 1982 BY
!	      DIGITAL EQUIPMENT CORPORATION, MAYNARD, MASS.
!
! 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 WHICH IS NOT SUPPLIED BY DIGITAL.
!

!++
! Facility: LSG DECnet Network Management
!
! Abstract:
!
!	This file contains a set of transportable string handling
!       macros. These macros are intended to supplement the string
!       facility of XPORT, not to replace it.
!
! Environment:	BLISS-36, BLISS-32, and BLISS-16.
!
! Author(s): Steven M. Jenness, Dale C. Gunn
!
! Creation date: 23-Oct-80
!
!--
!       CH$DEFAULT (N, DEFAULT)
!
!           Install the value DEFAULT if the argument N is not given.


macro
     CH$DEFAULT (N, DEFAULT) =
	%if %null (N) %then DEFAULT %else N %fi %;


!	CH$LEN (PTR, N)
!
!           Interpret PTR as a pointer to a character position
!           sequence terminated by a null or zero value byte (possibly an
!           ASCIZ string). Interpret N as an optional integer number of
!           character sequence positions in the string designated by PTR.
!           If N is not specified a default value of 200 will be used.


macro
     CH$LEN (PTR, N) =
	(if ch$fail (ch$find_ch (ch$default (N,200), PTR, 0))
         then ch$default (N, 200)
         else ch$diff (ch$find_ch (ch$default (N,200), PTR, 0), PTR)) %;


!	CH$MIN (PTR, MAX)
!
!	    Interpret PTR as a pointer to a character position
!           sequence terminated by a null or zero value byte, i.e., an
!           ASCIZ string. Interpret MAX as a value representing the
!           maximum number of character positions to search. Return
!           the minimum of MAX or the number of non-null characters in
!           the string.


macro
     CH$MIN (PTR, MAX) =
         begin
         local P;

         if ch$fail (P = ch$find_ch (MAX, PTR, %O'0'))
         then MAX
         else ch$diff (.P, PTR)
         end %;
!	CH$SEQUENCE (N, CS)
!
!	    Interpret N and CS as for ch$allocation. Return the vector
!           structure definition required for storage of such a
!           character position sequence.


macro
     CH$SEQUENCE (N, CS) =
         vector [ch$allocation (N, CS)] %;


!	CH$ASCIC (STRING, ...)
!
!	    Return a pointer to an ASCIC character position sequence
!           formed by the characters represented by the string-params, 
!           which are interpreted as for the %string lexical function.


macro
     CH$ASCIC [ ] =
         ch$ptr (uplit (%string (%char (%charcount (%remaining)), %remaining)), 1) %;


!	CH$ASCII (STRING, ...)
!
!	    Return a pointer to an ASCII character position sequence
!           formed by the characters represented by the string-params, 
!           which are interpreted as for the %string lexical function.


macro
     CH$ASCII [ ] =
         ch$ptr (uplit (%ascii %string (%remaining))) %;


!	CH$ASCIZ (STRING, ...)
!
!	    Return a pointer to an ASCIZ character position sequence
!           formed by the characters represented by the string-params, 
!           which are interpreted as for the %string lexical function.


macro
     CH$ASCIZ [ ] =
	 ch$ptr (uplit (%asciz %string (%remaining))) %;
!	CH$MOVSTRING (ADDRESS, STRING, ...)
!
!           Interpret ADDRESS as the address of a pointer to a character
!           position sequence. Interpret STRING as for the %string
!           lexical function. Move the string formed by the characters
!           represented by the string-params to the position pointed
!           to by the pointer contained at ADDRESS. Update the pointer to
!           point to the next available byte in the character position
!           sequence.


macro
     CH$MOVSTRING (ADDRESS) [ ] =
         ADDRESS = ch$move (%charcount (%ascii %string (%remaining)),
                            CH$ASCII (%ascii %string (%remaining)),
                            .ADDRESS) %;


!	CH$MOVASCIZ (DPTR, SPTR)
!
!           Interpret DPTR as the address of the destination pointer
!           to a character position sequence. Interpret SPTR as the
!           source pointer to a character position sequence containing
!           an ASCIZ character sequence. Move the ASCIZ string pointed
!           to by SPTR (the source string) to the position pointed to
!           by DPTR (the destination string). Update DPTR to point to
!           the next available byte in the destination character position
!           sequence.


macro
     CH$MOVASCIZ (DPTR, SPTR) =
	 DPTR = ch$move (CH$LEN (SPTR), SPTR, .DPTR) %;
%title ''
%sbttl ''

!
! [End of STRLIB.REQ]