Google
 

Trailing-Edge - PDP-10 Archives - bb-kl11l-bm_tops20_v7_0_tsu03_2_of_3 - t20src/mxnstr.r36
There are 13 other files named mxnstr.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 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 400 will be used.


macro
     CH$LEN (PTR, N) =
        BEGIN
        LOCAL
            p;

	IF CH$FAIL(p = CH$FIND_CH (ch$default (N,400), PTR, 0))
        THEN 
            ch$default (N, 400)
        ELSE
            CH$DIFF (.p, PTR)
        END %;


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