home *** CD-ROM | disk | FTP | other *** search
-
- ; MSPTROP.ASM
- ; MS 4.0
- ; Copyright (c) 1985, 87 by Borland International, Inc.
- ;
- ; Primitive routines for Editor Toolbox
-
-
- DATA SEGMENT BYTE PUBLIC
-
- DATA ENDS
-
- CODE SEGMENT BYTE PUBLIC
-
- ASSUME CS:CODE,DS:DATA
-
- PUBLIC EdGetEol
-
- ;****************************************************** EdGetEol
-
- ;function EdGetEol(var Buf; C : Word) : Word;
-
- ;Find last non-blank character in Buf and return offset
- ;Buf is a string of text
- ;C must initially point past end of text
- ;Returns 0 if buffer is all blank
-
- GECol EQU WORD PTR [BP+6]
- GeBuf EQU DWORD PTR [BP+8]
-
- EdGetEol PROC FAR
-
- PUSH BP ;Save BP
- MOV BP,SP ;Set up stack frame
-
- MOV CX,GECol ;CX = C
- LES DI,GEBuf ;ES:DI points to start of Buf
- ADD DI,CX ;ES:DI points beyond end of Buf
- MOV AL,' ' ;AL = space
- STD ;Go backward
- REPE SCASB ;Scan for non-space
- JE GEDone ;Done if CX = 0 and still blank
- INC CX ;CX => previous char looked at
- GEDone:
- CLD ;Reset direction flag
- MOV AX,CX ;EdGetEol = CX
-
- MOV SP,BP ;Restore SP
- POP BP ;Restore BP
- RET 6 ;Remove parameters and return
-
- EdGetEol ENDP
-
- CODE ENDS
-
- END