home *** CD-ROM | disk | FTP | other *** search
- \ EDITSTUF.SEQ Stuff needed by the editor by Tom Zimmer
-
- only forth also definitions
- vocabulary editor
- only forth also hidden definitions also
-
- variable tsegb \ text segment beginning
- variable lseg \ linelist save segment
- variable dseg \ delete lines segment
- variable toff
- variable tend
-
- variable warncnt \ warning count, if not enough memory for delete seg
- \ then tell user so, but only the first time.
-
- variable byte|line \ flag to tell if we are going to a line in file
- \ or a byte offset in file.
-
- variable edready \ ready to edit, we have a file, and can enter
- \ editor on it, with no problem.
-
- : seginit ( --- )
- defers initstuff
- tsegb off
- lseg off
- dseg off ;
-
- ' seginit is initstuff
-
- 132 constant mxlln
- 4000 constant maxlines
- 100 constant maxdline
- 0 constant screenchar \ A pseudo variable
-
- : memabort ( n1 --- )
- 8 = abort" Could not allocate memory for Editor" ;
-
- : tbuf.init ( --- ) \ Allocate the edit buffers.
- toff off tend off
- tsegb @ 0=
- if 65536. 16 um/mod nip alloc
- memabort nip tsegb ! \ edit buffer 64k
- then lseg @ 0=
- if maxlines 2* 16 / 1+ alloc
- memabort nip lseg ! \ Line pointer table
- then dseg @ 0= warncnt @ 0= and
- if maxdline mxlln * 16 / 1+ alloc 8 =
- if dseg off cr >rev
- ." Memory Limited, LINE UNDELETE will NOT be available! "
- >norm beep 1 seconds beep 1 seconds warncnt incr
- else nip dseg ! \ delete buffer
- then
- then ;
-
- : edovinit ( --- )
- \ defers initstuff \ Add this to initialization list?
- tbuf.init ; \ Allocate the editor
- \ space needed.
-
- \ ' edovinit is initstuff
-
- only forth also definitions
-
-