home *** CD-ROM | disk | FTP | other *** search
/ ARM Club 1 / ARM_CLUB_CD.iso / contents / apps / languages / progs / forth1 / !FORTH / FORTH / INIT
Encoding:
Text File  |  1991-03-30  |  1.2 KB  |  85 lines

  1. ( Loading .. Forth Line Editor - Davidsoft 1991 ) type cr
  2.  
  3. : ^ 94 token ;
  4.   ^ is a comment marker ^
  5.  
  6. 0 variable maxpos
  7.   ^ maxpos holds furthest position of a char in a line ^
  8.  
  9. : showbuffer
  10.   128 0 do
  11.     buffer i + c@
  12.     dup 0=
  13.     if
  14.       drop { [0]} type leave
  15.     else
  16.       vdu
  17.     then
  18.  loop
  19. ;
  20.  
  21. : clrbuffer 127 0 do 32 buffer i + ! loop ;
  22.   ^ reset the buffer ^
  23.  
  24. : isctrl 2dup 126 > swap 32 < or ;
  25.   ^ push 1 to stack if is a ctrl char ^
  26.  
  27. : mvf
  28.     dup lbp @ buffer + c!
  29.     lbp @ 127 <
  30.     if
  31.       1 lbp +!
  32.       lbp @ maxpos @ >=
  33.       if
  34.         lbp @ maxpos !
  35.       then
  36.       vdu
  37.     else
  38.       vdu 8 vdu
  39.     then
  40.   ;
  41.  
  42. : mvb
  43.   lbp @ 0>
  44.   if
  45.     127 vdu
  46.     32 lbp @ buffer + c!
  47.     -1 maxpos +!
  48.     -1 lbp +!
  49.   then
  50. ;
  51.  
  52. : inline
  53.   cr
  54.   clrbuffer
  55.   maxpos 0set
  56.   lbp 0set
  57.   begin
  58.     get
  59.       dup isctrl
  60.       if
  61.         dup 127 =
  62.         if
  63.           mvb drop
  64.         else
  65.           dup 27 =
  66.           if
  67.             quit
  68.           else
  69.             drop
  70.           then
  71.         then
  72.       else
  73.         mvf
  74.       then
  75.     13 <>
  76.   if while
  77.   lbp @ buffer + c0set
  78.   lbp 0set
  79.   space
  80. ;
  81.  
  82. ^ &8364 editv ! ^ ^ fix the inline reference - until FORTH inline works..^
  83.  
  84. ' inline editv ! 
  85.