home *** CD-ROM | disk | FTP | other *** search
/ Programmer 7500 / MAX_PROGRAMMERS.iso / CLIPPER / MISC / FFA.ZIP / TOPEDIT.SEQ < prev    next >
Encoding:
Text File  |  1988-01-11  |  2.4 KB  |  77 lines

  1. \ TOPEDIT.SEQ   Memory edit.                            By Tom Zimmer
  2.  
  3. ?DARK
  4. .comment:
  5.   Memory edit, allows reentering the editor without having to re-read
  6. the edit file from disk. This results in a much faster turn around time
  7. for development.  Changes made during an edit will still be saved at
  8. the end of each edit session.
  9.  
  10. comment;
  11.  
  12. only forth also editor also hidden definitions also
  13.  
  14. handle memfile
  15.  
  16. : ?readfile     ( --- )
  17.                 ?overlay 0= abort" Need Overlay already loaded by now."
  18.                 edovinit
  19.                 shndl @ memfile over c@ 1+ comp         \ if file not the same
  20.                 edready @ 0= or                         \ or editor not ready
  21.                 if      read.oldfile                    \ read the file
  22.                         shndl @ memfile $>handle        \ copy to memfile
  23.                         sinit                           \ init mem structure
  24.                         edready on                      \ say everything ready
  25.                 then    ;
  26.  
  27. : cold-edinit        ( --- )
  28.                 defers initstuff
  29.                 memfile clr-hcb
  30.                 edready off ;
  31.  
  32. ' cold-edinit is initstuff
  33.  
  34. only forth definitions also editor also hidden also
  35.  
  36. : <ed>          ( --- )         \ Redefined to work from memory.
  37.                 ?fileopen
  38.                 ovon
  39.                 ?readfile
  40.                 shndl @ hclose drop
  41.                 8 scrline !
  42.                 reedit
  43.                 shndl @ memfile $>handle
  44.                 shndl @ hopen drop      \ Reopen file
  45.                 ovoff ;
  46.  
  47. : ed            ( --- )
  48.                 byte|line on    \ Byte offset
  49.                 <ed> ;
  50.  
  51. : edit          ( n1 --- )      \ redefined to work from memory.
  52.                 1 ?enough
  53.                 byte|line off   \ Line to edit
  54.                 loadline !
  55.                 <ed> ;
  56.  
  57.  
  58. : fix           ( t1 --- )
  59.                 view
  60.                 shndl @ >hndle @ 0>
  61.                 if      ed
  62.                 then    ;
  63.  
  64. : sed           ( --- )
  65.                 edovinit
  66.                 byte|line on            \ Set to byte offset
  67.                 ovon esed ovoff ;
  68.  
  69. : listing       ( --- )
  70.                 ?fileopen
  71.                 edovinit ovon elisting ovoff ;
  72.  
  73. only forth also definitions
  74.  
  75. 300 tillkey             \ Wait up to 5 minutes for message to be read.
  76.  
  77.