;C************************************************************************ ;C* ;C* COPYRIGHT (c) 1981,1983,1984,1987,1988 ;C* Westinghouse Electric Corporation ;C* ;C* THIS SOFTWARE IS FURNISHED WITHOUT LICENSE AND MAY BE USED AND ;C* COPIED ONLY WITH THE INCLUSION OF THE ABOVE COPYRIGHT NOTICE. ;C* ;C* THE INFORMATION IN THIS SOFTWARE IS SUBJECT TO CHANGE WITHOUT NOTICE ;C* AND SHOULD NOT BE CONSTRUED AS A COMMITMENT BY WESTINGHOUSE. ;C* ;C* WESTINGHOUSE ASSUMES NO RESPONSIBILITY FOR THE USE OR RELIABILITY ;C* OF THIS SOFTWARE. ;C* ;C**************************************************************************** .title LENGTH ; ; LENGTH scans a character string and returns a pointer to the ; last non-blank, non-null, non-Tab character. ; ; Calling Sequence: ; ; len.wlc.v = length (string.rt.dx) ; ; len = last non-blank pointer, 0 if all blanks ; string = string to search ; ; Written by Art Moorshead ; STRING = 4 BLANK = 32 .psect $code, nowrt, exe, long, pic, shr .entry length, ^m<> movq @STRING (ap), r0 ; get string descriptor movzwl r0, r0 ; string length addl2 r0, r1 ; address of end of string brb 20$ 10$: cmpb -(r1), #BLANK ; Greater than Blank? bgtru 30$ ; Yes, exit 20$: sobgeq r0, 10$ ; No, try next character 30$: incl r0 ; Correct the offset ret .end