home *** CD-ROM | disk | FTP | other *** search
/ Programmer 7500 / MAX_PROGRAMMERS.iso / PROGRAMS / UTILS / LASER / FPC35_5.ZIP / FPCSRC.ZIP / VIEW.SEQ < prev    next >
Encoding:
Text File  |  1989-05-26  |  1.7 KB  |  50 lines

  1. \ VIEW.SEQ      Viewing code for ZF.                    by Tom Zimmer
  2.  
  3. only forth also definitions hidden also
  4.  
  5. : NAME>PAD      ( A1 --- PAD )
  6.                 >r r@ ys: ?cs: pad r> yc@ 31 and 1+ cmovel  \ move name
  7.                 pad c@ 31 and pad c!                        \ clip count
  8.                 pad count + 1- dup c@ 127 and swap c!       \ mask last ch
  9.                 PAD     ;
  10.  
  11. hidden definitions
  12.  
  13. : files_set     ( --- )
  14.                 ['] files >body HERE 1000 + #THREADS 2* CMOVE ;
  15.  
  16. : 1file         ( --- false | nfa )
  17.                 HERE 1000 + #THREADS LARGEST DUP
  18.                 if      DUP L>NAME >r Y@ SWAP ! r>
  19.                 else    nip
  20.                 then    ;
  21.  
  22. 0 value maxname
  23. 0 value maxcfa
  24.  
  25. forth definitions
  26.  
  27. : >viewfile     ( cfa --- offset a1 )
  28.                 >r files_set off> maxcfa off> maxname
  29.                 begin   1file dup
  30.                 while   r@ 1+ over name> u>
  31.                         if      dup name> maxcfa u>
  32.                                 if      dup =: maxname
  33.                                         dup name> =: maxcfa
  34.                                 then
  35.                         then    drop
  36.                 repeat  drop r> >view y@
  37.                 maxname name>pad ;
  38.  
  39. : LOAD          ( n1 --- )      \ n1 is the line number to load from
  40.                 depth 1 < if 1 then     \ default to line 1
  41.                 ?fileopen
  42.                 dup>r >line             \ move to line n1
  43.                 cr ." Loading.."
  44.                 <load>
  45.                 r> =: loadline ;
  46.  
  47. ' fload alias include           \ make an alias that does the same thing as
  48.                                 \ FLOAD.
  49.  
  50.