home *** CD-ROM | disk | FTP | other *** search
/ Programmer 7500 / MAX_PROGRAMMERS.iso / PROGRAMS / UTILS / LASER / FPC35_5.ZIP / FPCSRC.ZIP / BROWSEPR.SEQ < prev    next >
Encoding:
Text File  |  1989-07-08  |  3.5 KB  |  109 lines

  1. \ TOBROWSE.SEQ          direct printed text to the browser
  2.  
  3. comment:
  4.  
  5.   This file allows re-direction of printed output to a file called
  6. BROWSE.PRN, which is then subsequently passed to the borwser for your
  7. perusal. You can say for example:
  8.  
  9.                 >B WORDS DUP <enter>
  10.  
  11. Which will send a list of all words containing DUP to a file. The browser
  12. is then started on the file so you can examine them. Or,
  13.  
  14.                 >B REF HOPEN <enter>
  15.  
  16. Browse a list of all places where HOPEN is used. Or,
  17.  
  18.                 >B FLOOK HDELETE SRC\*.SEQ <enter>
  19.  
  20. Browse a list of all the places in all files in the SRC directory where
  21. HDELETE is used.
  22.  
  23. comment;
  24.  
  25. \       ******** LOAD FILE ONLY IF WE HAVE THE EDITOR ********
  26.  
  27. defined editor nip 0=
  28. #if
  29.         cr .( Can't load BROWSEPR.SEQ, no editor available)
  30.         \s                              \ Discard the rest of the file
  31. #then
  32.  
  33.  
  34. only forth also editor also hidden definitions also
  35.  
  36. @> errfix value oldfix
  37.         0 value #prlines
  38.  
  39. : outfix        ( --- )
  40.                 ['] qtypeL  is typeL
  41.                 ['] (emit)  is emit
  42.                 ['] (print) is pemit
  43.                 oldfix is errfix ;    \ remove from errfix
  44.  
  45. comment:
  46.   ┌────────────────────────────────────────────────────────────────────┐
  47.   │ In the following definition, QTYPE is used "on purpose", to assure │
  48.   │ the typing actually goes to the screen, and not to the redirected  │
  49.   │ TYPE which is going to a printer file.                             │
  50.   └────────────────────────────────────────────────────────────────────┘
  51. comment;
  52.  
  53. : ?.prlines      ( --- )
  54.                 #prlines 127 and 0=
  55.                 if      false      save!> printing
  56.                         ibm-at?        2>r
  57.                         #out @ #line @ 2>r
  58.                                 base @  >r decimal
  59.                         52 9 at #prlines u16/ (.) >attrib1
  60.                         5 over - spcs swap 0MAX
  61.                                 ?CS: -ROT qtypeL
  62.                                 ?CS: -ROT qtypeL
  63.                         spcs 2  ?CS: -ROT qtypeL >norm
  64.                               r> base !
  65.                              2r> #line ! #out !
  66.                              2r> ibm-at
  67.                         restore> printing
  68.                 then    incr> #prlines ;
  69.  
  70. : prtypeL       ( SEG a1 n1 --- )
  71.                 PRNTYPEL ?.prlines ;
  72.  
  73. : premit        ( c1 --- )
  74.                 (print) ?.prlines ;
  75.  
  76. forth definitions
  77.  
  78. : >browser      ( | <command_line> --- )  \ browse results of command line
  79.                 " BROWSE.PRN" ">$ dup>r
  80.                 $pfile abort" Failed to create BROWSE.PRN"
  81.                 savescr savecursor
  82.                 20 8 60 10 box&fill
  83.                 ."  \1 Building BROWSE.PRN file...   "
  84.                 restcursor
  85.                 off> #prlines
  86.                 @> errfix =: oldfix
  87.                 ['] pemit  save!> emit
  88.                 ['] prtypeL save!> typeL
  89.                 ['] outfix is errfix
  90.                 ['] premit save!> pemit
  91.                 printing on cr interpret cr cr printing off
  92.                 restscr pclose
  93.                 restore> pemit
  94.                 restore> typeL
  95.                 restore> emit
  96.                 oldfix =: errfix
  97.                 r> $file abort" Couldn't re-open BROWSE.PRN"
  98.                 on> newbrowse
  99.                 on> ?browse
  100.                 off> seding
  101.                 off> newfl
  102.                 off> edready
  103.                 <ed> ;
  104.  
  105. ' >browser alias >b
  106.  
  107. only forth also definitions
  108.  
  109.