home *** CD-ROM | disk | FTP | other *** search
/ OS/2 Shareware BBS: 5 Edit / 05-Edit.zip / epmsmp.zip / EPAIRS.E < prev    next >
Text File  |  1995-01-09  |  2KB  |  52 lines

  1. ; This can be used to edit all pairs of files in a CMPTREE output, or 
  2. ; you can line-mark the desired subset and just those will be loaded. 
  3. ; It's intended for use with EPMCOMP (or E3COMP), and so only loads   
  4. ; pairs of files - any unpaired files will be skipped.                
  5.                                                                       
  6. -- EPAIRS.E, by Larry Margolis - MARGOLI at YKTVMV                    
  7.  
  8. defc epairs
  9.    getfileid treefileid
  10.    if .filename <> '.tree' then
  11.       sayerror "This is not a tree file.  You must be in a tree buffer to invoke EPairs."
  12.       return
  13.    endif
  14.    firstline = 1; lastline = .last   -- Could be 3 to (.last-1), but allow for user editing file.
  15.    if leftstr(marktype(), 1)='L' then
  16.       getmark l1, l2, c1, c2, markfid
  17.       if markfid = treefileid then
  18.          firstline = l1; lastline = l2
  19.       endif
  20.    endif
  21.    display -1
  22.    prevfilename = ''
  23.    prevfilenamex = ''
  24.    loaded = 0
  25.    for linenum = lastline to firstline by -1
  26.       getline content, linenum, treefileid
  27.       filenamex = substr(content, 52)
  28.       if pos(substr(filenamex,2,1), ":\.") then
  29.          if substr(content, 46, 1) = 'D' then
  30.             iterate
  31.          endif
  32.          lp = lastpos('\', filenamex)
  33.          filename = substr(filenamex, lp+1)
  34.          if filename = prevfilename then
  35.             'e' filenamex prevfilenamex
  36.             activatefile treefileid
  37.             loaded = 1
  38.          endif
  39.          prevfilename = filename
  40.          prevfilenamex = filenamex
  41.       endif
  42.    endfor
  43.    display 1
  44.    if loaded then nextfile; endif
  45.  
  46. defmain
  47.    "epairs" arg(1)
  48.  
  49. compile if EVERSION >= 6
  50.    EA_comment 'This defines the EPAIRS command, to edit pairs of files from CmpTree output; it can be linked in or executed directly.'
  51. compile endif
  52.