.MCALL .MODULE .MODULE TRIM,VERSION=03,COMMENT=,IDENT=NO,LIB=YES ; Copyright (c) 1998 by Mentec, Inc., Nashua, NH. ; All rights reserved ; ; 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 Mentec, Inc. ; ; The information in this document is subject to change without ; notice and should not be construed as a commitment by Digital ; Equipment Corporation, or Mentec, Inc. ; ; Digital and Mentec assume no responsibility for the use or ; reliability of its software on equipment which is not supplied ; by Digital or Mentec, and listed in the Software Product ; Description. .SBTTL TRIM - FORTRAN CALLABLE SUBROUTINE ; ; CALL TRIM(A) ; ; THIS ROUTINE SHORTENS THE STRING IN A BY REMOVING ALL TRAILING ; BLANKS. TRAILING BLANKS ARE BLANKS WHICH HAVE NO NON-BLANK ; CHARACTERS TO THEIR RIGHT. IF STRING A CONTAINS ALL BLANK ; CHARACTERS, IT IS MADE TO BE A NULL STRING. IF STRING A HAS NO ; TRAILING BLANKS, IT IS UNCHANGED BY THIS ROUTINE. THIS ROUTINE ; IS USEFUL FOR INPUT USING A-TYPE FORMAT ITEMS. ; ; MAS .PSECT SYS$I .GLOBL $SYSLB TRIM:: TST (R5)+ ;SKIP # OF ARGS MOV (R5)+,R1 ;GET STRING POINTER MOV R1,R2 ;COPY POINTER MOVB -(R2),R3 ;SAVE BYTE BEFORE STRING CLRB @R2 ;SET A CONVENIENT STOPPER 10$: TSTB (R1)+ ;FIND END OF STRING BNE 10$ DEC R1 ;BACK UP OVER NULL 20$: CMPB -(R1),#40 ;SKIP ALL TRAILING BLANKS BEQ 20$ CLRB 1(R1) ;NEW END OF STRING MOVB R3,@R2 ;RESTORE CHAR BEFORE STRING (STOPPER) RETURN .END