home
***
CD-ROM
|
disk
|
FTP
|
other
***
search
/
OS/2 Shareware BBS: 5 Edit
/
05-Edit.zip
/
epmsmp.zip
/
WORDPROC.E
< prev
next >
Wrap
Text File
|
1996-02-09
|
2KB
|
70 lines
; This routine converts a file into a format suitable for input into a
; word processor. It is assumed that the current file contains a number
; of paragraphs separated by blank lines. Each paragraph is reflowed,
; and the line terminators are for each line but the last one in each
; paragraph gets changed so that the lines will be "glued" together
; when the file is saved, making each paragraph into one long line.
; Larry Margolis
compile if EVERSION < '6.03'
*** Error: This routine is only supported in EPM 6.03 or above.
compile endif
compile if not defined(E_DLL) -- Being separately compiled?
include 'stdconst.e'
defmain
'wordproc'
compile endif -- not defined(E_DLL)
#define MAXLNSIZE_UNTERMINATED 1
defc wordproc
getfileid fid
call psave_mark(savemark)
call psave_pos(savepos)
oldmargins = .margins
oldmodify = .modify
oldautosave = .autosave
.autosave = 0 -- Don't want to go crazy autosaving...
.margins = '2 72 1' -- This should make it look nice...
stopit = 0
top
do forever
getline line
do while line='' -- Skip over blank lines
if .line=.last then stopit=1; leave; endif
down
getline line
enddo
if stopit then leave; endif
startline = .line -- Startline is first line of paragraph
unmark; mark_line
call pfind_blank_line()
if .line<>startline then
up
else
bottom
endif
mark_line
reflow
getmark firstline, lastline -- New first and last lines of marked region.
do i = firstline to lastline-1
call setterm(fid, i, MAXLNSIZE_UNTERMINATED)
enddo
if lastline=.last then leave; endif
lastline+1
enddo
.margins = oldmargins
.modify = oldmodify + 1
.autosave = oldautosave
call prestore_mark(savemark)
call prestore_pos(savepos)
defproc setterm(fid, line, termtype)
return dynalink32(E_DLL,
'EtkChangeLineTerminator', -- Not exported until 1995/03/06
gethwndc(EPMINFO_EDITCLIENT) || atol(fid) || atol(line) || atol(termtype))