home *** CD-ROM | disk | FTP | other *** search
/ OS/2 Shareware BBS: 8 Other / 08-Other.zip / rxjis096.zip / fmttext3.erx < prev    next >
Text File  |  1997-08-07  |  3KB  |  97 lines

  1. /**/
  2. arg lm rm pm
  3. if RxFuncQuery('RxJisLoadFuncs') then do
  4.    call RxFuncAdd 'RxJisLoadFuncs', 'RXJIS', 'RxJisLoadFuncs'
  5.    call RxJisLoadFuncs
  6. end /* do */
  7. if lm = '' then lm = 1
  8. if rm = '' then rm = 64
  9. if pm = '' then pm = lm
  10. if lm >= rm then exit
  11. lw = rm - lm + 1
  12. if lw < 10 then exit
  13. if pm >= rm then exit
  14. if rm - pm < 10 then exit
  15. call RxFuncAdd 'RxJisLoadFuncs', 'RXJIS', 'RxJisLoadFuncs'
  16. call RxJisLoadFuncs
  17. 'extract /getmarktype/'
  18. if symbol('getmarktype.0') <> 'VAR' then exit
  19. if getmarktype.0 < 1 then exit
  20. if translate(getmarktype.1) <> 'LINE' then exit
  21. 'extract /getmark/'
  22. if symbol('getmark.0') <> 'VAR' then exit
  23. if getmark.0 < 2 then exit
  24. a = ''
  25. j = 1
  26. p. = ''
  27. restline = getmark.1
  28. do i = getmark.1 to getmark.2
  29.    i
  30.    'extract /getline/'
  31.    if symbol('getline.0') <> 'VAR' then exit
  32.    if getline.0 < 1 then exit
  33.    if getline.1 = '' & p.j <> '' then j = j + 1
  34.    if getline.1 = '' then iterate
  35.    p.j = RxJisAppend(p.j, strip(getline.1))
  36. end /* do */
  37. p.0 = j
  38. m. = lm
  39. n = 1
  40. do i = 1 to p.0
  41.    tokensource = p.i
  42.    do j = 1 by 1
  43.       tokensource = strip(tokensource)
  44.       if tokensource = '' then leave
  45.       if j = 1 then do
  46.          if pm <> lm then do
  47.             lw = rm - pm
  48.             m.n = pm
  49.          end /* do */
  50.          else lw = rm - lm
  51.       end /* do */
  52.       else lw = rm - lm
  53.       b = ''
  54.       do while dbwidth(b) <= lw & tokensource <> ''
  55.          t = gettoken()
  56.          u = RxJisAppend(b, t)
  57.          if dbwidth(u) > lw & b <> '' then do
  58.             tokensource = RxJisAppend(t, tokensource)
  59.             leave
  60.          end /* do */
  61.          b = u
  62.       end /* do */
  63.       b.n = b
  64.       n = n + 1
  65.    end /* do */
  66.    if i < p.0 then do
  67.       b.n = ''
  68.       n = n + 1
  69.    end /* do */
  70. end /* do */
  71. b.0 = n - 1
  72. call etkprocesseditkey 'DELETE_MARK'
  73. 'extract /last/'
  74. if symbol('last.0') <> 'VAR' then exit
  75. if last.0 < 1 then exit
  76. if last.1 = 0 then 'INSERT'
  77. do i = 1 to b.0
  78.    call etkinserttext copies(' ', m.i - 1) || b.i, i + getmark.1 - 1
  79. end /* do */
  80. if last.1 <= 10 then call etksetfilefield 'cursory', 1
  81. else call etksetfilefield 'cursory', 3
  82. call etksetfilefield 'line', getmark.1
  83. call etksetfilefield 'col', 1
  84. exit
  85.  
  86. gettoken: procedure expose tokensource
  87. i = RxJisWordIndex(tokensource, 2)
  88. if i = 0 then rem = ''
  89. else rem = substr(tokensource, i)
  90. t = RxJisWord(tokensource, 1)
  91. options 'EXMODE'
  92. w = length(t)
  93. l = substr(tokensource, w + 1, 1)
  94. if rem <> '' & l = ' ' & dbwidth(right(t, 1)) > 1 then t = t || ' '
  95. tokensource = rem
  96. return t
  97.