Google
 

Trailing-Edge - PDP-10 Archives - BB-P363B-SM_1985 - mcb/nml/strlib.req
There are 3 other files named strlib.req in the archive. Click here to see a list.
! 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) 1980, 1981, 1982
!                    DIGITAL EQUIPMENT CORPORATION
!                        Maynard, Massachusetts
!
!     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]