home
***
CD-ROM
|
disk
|
FTP
|
other
***
search
/
OS/2 Shareware BBS: 8 Other
/
08-Other.zip
/
rxjis096.zip
/
fmttext3.erx
< prev
next >
Wrap
Text File
|
1997-08-07
|
3KB
|
97 lines
/**/
arg lm rm pm
if RxFuncQuery('RxJisLoadFuncs') then do
call RxFuncAdd 'RxJisLoadFuncs', 'RXJIS', 'RxJisLoadFuncs'
call RxJisLoadFuncs
end /* do */
if lm = '' then lm = 1
if rm = '' then rm = 64
if pm = '' then pm = lm
if lm >= rm then exit
lw = rm - lm + 1
if lw < 10 then exit
if pm >= rm then exit
if rm - pm < 10 then exit
call RxFuncAdd 'RxJisLoadFuncs', 'RXJIS', 'RxJisLoadFuncs'
call RxJisLoadFuncs
'extract /getmarktype/'
if symbol('getmarktype.0') <> 'VAR' then exit
if getmarktype.0 < 1 then exit
if translate(getmarktype.1) <> 'LINE' then exit
'extract /getmark/'
if symbol('getmark.0') <> 'VAR' then exit
if getmark.0 < 2 then exit
a = ''
j = 1
p. = ''
restline = getmark.1
do i = getmark.1 to getmark.2
i
'extract /getline/'
if symbol('getline.0') <> 'VAR' then exit
if getline.0 < 1 then exit
if getline.1 = '' & p.j <> '' then j = j + 1
if getline.1 = '' then iterate
p.j = RxJisAppend(p.j, strip(getline.1))
end /* do */
p.0 = j
m. = lm
n = 1
do i = 1 to p.0
tokensource = p.i
do j = 1 by 1
tokensource = strip(tokensource)
if tokensource = '' then leave
if j = 1 then do
if pm <> lm then do
lw = rm - pm
m.n = pm
end /* do */
else lw = rm - lm
end /* do */
else lw = rm - lm
b = ''
do while dbwidth(b) <= lw & tokensource <> ''
t = gettoken()
u = RxJisAppend(b, t)
if dbwidth(u) > lw & b <> '' then do
tokensource = RxJisAppend(t, tokensource)
leave
end /* do */
b = u
end /* do */
b.n = b
n = n + 1
end /* do */
if i < p.0 then do
b.n = ''
n = n + 1
end /* do */
end /* do */
b.0 = n - 1
call etkprocesseditkey 'DELETE_MARK'
'extract /last/'
if symbol('last.0') <> 'VAR' then exit
if last.0 < 1 then exit
if last.1 = 0 then 'INSERT'
do i = 1 to b.0
call etkinserttext copies(' ', m.i - 1) || b.i, i + getmark.1 - 1
end /* do */
if last.1 <= 10 then call etksetfilefield 'cursory', 1
else call etksetfilefield 'cursory', 3
call etksetfilefield 'line', getmark.1
call etksetfilefield 'col', 1
exit
gettoken: procedure expose tokensource
i = RxJisWordIndex(tokensource, 2)
if i = 0 then rem = ''
else rem = substr(tokensource, i)
t = RxJisWord(tokensource, 1)
options 'EXMODE'
w = length(t)
l = substr(tokensource, w + 1, 1)
if rem <> '' & l = ' ' & dbwidth(right(t, 1)) > 1 then t = t || ' '
tokensource = rem
return t