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

  1. \ EDITSTUF.SEQ  Stuff needed by the editor              by Tom Zimmer
  2.  
  3. only forth also definitions
  4. vocabulary editor
  5. only forth also hidden definitions also
  6.  
  7.   variable tsegb        \ text segment beginning
  8.   variable lseg         \ linelist save segment
  9.   variable dseg         \ delete lines segment
  10.   variable toff
  11.   variable tend
  12.  
  13.   variable warncnt      \ warning count, if not enough memory for delete seg
  14.                         \ then tell user so, but only the first time.
  15.  
  16.   variable byte|line    \ flag to tell if we are going to a line in file
  17.                         \ or a byte offset in file.
  18.  
  19.   variable edready      \ ready to edit, we have a file, and can enter
  20.                         \ editor on it, with no problem.
  21.  
  22. : seginit       ( --- )
  23.                 defers initstuff
  24.                 tsegb off
  25.                 lseg off
  26.                 dseg off ;
  27.  
  28. ' seginit is initstuff
  29.  
  30.  132 constant mxlln
  31. 4000 constant maxlines
  32.  100 constant maxdline
  33.    0 constant screenchar        \ A pseudo variable
  34.  
  35. : memabort      ( n1 --- )
  36.                 8 = abort" Could not allocate memory for Editor" ;
  37.  
  38. : tbuf.init     ( --- )         \ Allocate the edit buffers.
  39.                 toff off tend off
  40.                 tsegb @ 0=
  41.         if      65536. 16 um/mod nip alloc
  42.                 memabort nip tsegb !            \ edit buffer  64k
  43.         then    lseg @ 0=
  44.         if      maxlines 2* 16 / 1+ alloc
  45.                 memabort nip lseg  !            \ Line pointer table
  46.         then    dseg @ 0= warncnt @ 0= and
  47.         if      maxdline mxlln * 16 / 1+ alloc 8 =
  48.                 if      dseg off cr >rev
  49.                     ."  Memory Limited, LINE UNDELETE will NOT be available! "
  50.                         >norm beep 1 seconds beep 1 seconds warncnt incr
  51.                 else    nip dseg  !             \ delete buffer
  52.                 then
  53.         then    ;
  54.  
  55. : edovinit      ( --- )
  56. \               defers initstuff      \ Add this to initialization list?
  57.                 tbuf.init ;                       \ Allocate the editor
  58.                                                     \ space needed.
  59.  
  60. \ ' edovinit is initstuff
  61.  
  62. only forth also definitions
  63.  
  64.  
  65.