Remove unstable/port.

`port->list' does all it can do.
This commit is contained in:
Vincent St-Amour 2012-02-27 14:45:45 -05:00
parent 534886dbe4
commit 4a8f447dae
7 changed files with 2 additions and 119 deletions

View File

@ -1,7 +1,6 @@
(module run mzscheme
(require (only scheme/runtime-path define-runtime-path)
racket/port
unstable/port
mzlib/kw)
(define input-map
`(
@ -110,7 +109,7 @@
(if moments?
(apply string-append ; like sumcol, but with floats
(map (lambda (x) (string-append (number->string (exact->inexact x)) "\n"))
(read-all)))
(port->list)))
(read-bytes 10000))))])
(with-output-to-file f
(lambda ()

View File

@ -1,25 +0,0 @@
#lang racket
(require rackunit rackunit/text-ui unstable/port "helpers.rkt")
(run-tests
(test-suite "port.rkt"
(test-suite "read-all"
(test-ok (check-equal? (read-all read (open-input-string "1 2 3"))
(list 1 2 3)))
(test-ok (check-equal?
(parameterize ([current-input-port
(open-input-string "1 2 3")])
(read-all))
(list 1 2 3))))
(test-suite "read-all-syntax"
(test-ok (check-equal?
(syntax->datum
(read-all-syntax read-syntax (open-input-string "1 2 3")))
(list 1 2 3)))
(test-ok (check-equal?
(syntax->datum
(parameterize ([current-input-port
(open-input-string "1 2 3")])
(read-all-syntax)))
(list 1 2 3))))))

View File

@ -1,7 +1,7 @@
#lang racket/base
(require racket/class racket/gui/base racket/match racket/port racket/list
unstable/syntax unstable/port racket/sandbox
unstable/syntax racket/sandbox
typed-racket/optimizer/logging
(prefix-in tr: typed-racket/typed-reader))

View File

@ -1,36 +0,0 @@
#lang racket/base
(require racket/match
racket/contract/base
syntax/srcloc)
(define (port->srcloc port [source (object-name port)] [span 0])
(let*-values ([(line col pos) (port-next-location port)])
(make-srcloc source line col pos span)))
(define read-all
(case-lambda
[() (read-all read)]
[(reader)
(let loop ()
(match (reader)
[(? eof-object?) null]
[term (cons term (loop))]))]
[(reader port)
(parameterize ([current-input-port port])
(read-all reader))]))
(define read-all-syntax
(case-lambda
[() (read-all-syntax read-syntax)]
[(reader) (read-all-syntax reader (current-input-port))]
[(reader port)
(define start (port->srcloc port))
(define terms (read-all reader port))
(define end (port->srcloc port))
(datum->syntax #f terms (build-source-location-list start end))]))
(provide/contract
[read-all (->* [] [(-> any/c) input-port?] list?)]
[read-all-syntax
(->* [] [(-> (or/c syntax? eof-object?)) input-port?]
(syntax/c list?))])

View File

@ -1,53 +0,0 @@
#lang scribble/manual
@(require scribble/eval "utils.rkt" (for-label racket unstable/port))
@(define the-eval (make-base-eval))
@(the-eval '(require unstable/port))
@title{Ports}
@unstable[@author+email["Carl Eastlund" "cce@racket-lang.org"]]
@defmodule[unstable/port]
This module provides tools for port I/O.
@defproc[(read-all [reader (-> any/c) read]
[port input-port? (current-input-port)])
list?]{
This function produces a list of all the values produced by calling
@racket[(reader)] while @racket[current-input-port] is set to @racket[port], up
until it produces @racket[eof].
@defexamples[
#:eval the-eval
(read-all read (open-input-string "1 2 3"))
(parameterize ([current-input-port (open-input-string "a b c")])
(read-all))
]
}
@defproc[(read-all-syntax [reader (-> (or/c syntax? eof-object?)) read]
[port input-port? (current-input-port)])
(syntax/c list?)]{
This function produces a syntax object containing a list of all the syntax
objects produced by calling @racket[(reader)] while @racket[current-input-port]
is set to @racket[port], up until it produces @racket[eof]. The source location
of the result spans the entire portion of the port that was read.
@defexamples[
#:eval the-eval
(define port1 (open-input-string "1 2 3"))
(port-count-lines! port1)
(read-all-syntax read-syntax port1)
(define port2 (open-input-string "a b c"))
(port-count-lines! port2)
(parameterize ([current-input-port port2])
(read-all-syntax))
]
}
@(close-eval the-eval)

View File

@ -94,7 +94,6 @@ Keep documentation and tests up to date.
@include-section["markparam.scrbl"]
@include-section["match.scrbl"]
@include-section["parameter-group.scrbl"]
@include-section["port.scrbl"]
@include-section["pretty.scrbl"]
@include-section["sequence.scrbl"]
@include-section["string.scrbl"]

View File

@ -6,7 +6,6 @@
(check-docs (quote unstable/string))
(check-docs (quote unstable/sequence))
(check-docs (quote unstable/pretty))
(check-docs (quote unstable/port))
(check-docs (quote unstable/match))
(check-docs (quote unstable/markparam) #:skip #rx"^deserialize-info:")
(check-docs (quote unstable/list))