Changeset 8808 in project


Ignore:
Timestamp:
02/24/08 18:18:56 (12 years ago)
Author:
azul
Message:

Applying my fix here as well.

File:
1 edited

Legend:

Unmodified
Added
Removed
  • release/3/stream-wiki/trunk/extensions/enscript.scm

    r2954 r8808  
    4747      (stream-drop-while-all pred (stream-cdr str)))))
    4848
     49(define (stream-break-all pred str)
     50  (values (stream-take-while-all (complement pred) str)
     51          (stream-drop-while-all (complement pred) str)))
     52
    4953; In Gentoo, enscript 1.6.3 advertises the -w option:
    5054;
     
    7478          (close-output-port out)
    7579          (let ((in-str (port->stream in)))
    76             (stream-append
    77               (if (stream-null? in-str)
    78                 (html-stream (pre text))
    79                 (stream-take-while-all
    80                   (complement (lambda (x) (stream-prefix= x (list #\< #\H #\R #\>))))
    81                   (stream-drop-while-all
    82                     (complement (lambda (x) (stream-prefix= x (list #\< #\P #\R #\E #\>))))
    83                     in-str)))
    84               (stream-delay
    85                 (begin (process-wait pid)
    86                        stream-null)))))
     80            (if (stream-null? in-str)
     81              (html-stream (pre text))
     82              (receive (code tail)
     83                       (stream-break-all
     84                         (lambda (x) (stream-prefix= x (list #\< #\H #\R #\>)))
     85                         (stream-drop-while-all
     86                           (complement (lambda (x) (stream-prefix= x (list #\< #\P #\R #\E #\>))))
     87                           in-str))
     88                ; This is important: forces the waitpid on the pid!
     89                (stream-length tail)
     90                code))))
    8791        stream-null))))
    8892
Note: See TracChangeset for help on using the changeset viewer.