home *** CD-ROM | disk | FTP | other *** search
/ ProfitPress Mega CDROM2 …eeware (MSDOS)(1992)(Eng) / ProfitPress-MegaCDROM2.B6I / PROG / MISC / FPC355_2.ZIP / FPCSRC.ZIP / NEEDS.SEQ < prev    next >
Encoding:
Text File  |  1988-11-11  |  1.6 KB  |  42 lines

  1. \ NEEDS.SEQ     Conditionally load a file               by Tom Zimmer
  2.  
  3. only forth also definitions hidden also
  4.  
  5. : ?loaded       ( name --- f1 )
  6.                 save> context                   \ save CONTEXT vocabulary
  7.                 files                           \ select FILES vocabulary
  8.                 bl word ?uppercase
  9.                 dup pathset drop                \ prepend the path
  10.                 find nip ?dup 0=                \ did we find word with path
  11.                 if      here >pathend" here c!  \ if not strip path off
  12.                         here count cmove
  13.                         here count + 2 blank
  14.                         here find nip           \ and look for it without path
  15.                 then    restore> context ;
  16.  
  17.                         \ print a list of all files that have been loaded.
  18. : needs         ( | name --- )
  19.                 >in @ >r
  20.                 ?loaded 0=              \ if we dont have it
  21.                 if      r@ =: >in
  22.                         fload           \ then loadit
  23.                         false save!> warning
  24.                             loaded,     \ reset to previous file for view.
  25.                         restore> warning
  26.                 then    r>drop ;
  27.  
  28. /*              \ This can be loaded if you need it.
  29.  
  30. : unwanted      ( | name --- )
  31.                 ?loaded
  32.                 if      cr cr seqhandle count type
  33.                         ."  <-- must be loaded before --> "
  34.                         seqhandle+ count type cr abort
  35.                 then    ;
  36.  
  37. */
  38.  
  39. only forth also definitions
  40.  
  41.  
  42.