From af2fa50318fdfacee97396cc0410fb1645c7f2de Mon Sep 17 00:00:00 2001 From: Vincent St-Amour Date: Thu, 17 Jun 2010 12:13:50 -0400 Subject: [PATCH] Added type signatures for some byte-string functions. original commit: ecb614849c30cc437b2cb7004321bc9e88fba8fa --- collects/typed-scheme/private/base-env.rkt | 24 +++++++++++++++++++--- 1 file changed, 21 insertions(+), 3 deletions(-) diff --git a/collects/typed-scheme/private/base-env.rkt b/collects/typed-scheme/private/base-env.rkt index a8a22634..140ec67a 100644 --- a/collects/typed-scheme/private/base-env.rkt +++ b/collects/typed-scheme/private/base-env.rkt @@ -559,14 +559,35 @@ ((-HT a b) -Integer . -> . b))] [bytes (->* (list) -Integer -Bytes)] +[bytes? (make-pred-ty -Bytes)] [make-bytes (cl-> [(-Integer -Integer) -Bytes] [(-Integer) -Bytes])] +[bytes->immutable-bytes (-> -Bytes -Bytes)] +[byte? (make-pred-ty -Nat)] [bytes-ref (-> -Bytes -Integer -Nat)] [bytes-set! (-> -Bytes -Integer -Integer -Void)] [bytes-append (->* (list) -Bytes -Bytes)] [subbytes (cl-> [(-Bytes -Integer) -Bytes] [(-Bytes -Integer -Integer) -Bytes])] [bytes-length (-> -Bytes -Nat)] +[bytes-copy (-> -Bytes -Bytes)] +[bytes-copy! (-Bytes -Integer -Bytes [-Integer -Integer] . ->opt . -Void)] +[bytes-fill! (-> -Bytes -Integer -Void)] [unsafe-bytes-length (-> -Bytes -Nat)] +[bytes->list (-> -Bytes (-lst -Nat))] +[list->bytes (-> (-lst -Integer) -Bytes)] +[bytes* (list -Bytes) -Bytes B)] +[bytes>? (->* (list -Bytes) -Bytes B)] +[bytes=? (->* (list -Bytes) -Bytes B)] +[bytes->string/utf-8 (-Bytes [(Un (-val #f) -Char) -Integer -Integer] . ->opt . -String)] +[bytes->string/locale (-Bytes [(Un (-val #f) -Char) -Integer -Integer] . ->opt . -String)] +[bytes->string/latin-1 (-Bytes [(Un (-val #f) -Char) -Integer -Integer] . ->opt . -String)] +[string->bytes/utf-8 (-String [(Un (-val #f) -Integer) -Integer -Integer] . ->opt . -Bytes)] +[string->bytes/locale (-String [(Un (-val #f) -Integer) -Integer -Integer] . ->opt . -Bytes)] +[string->bytes/latin-1 (-String [(Un (-val #f) -Integer) -Integer -Integer] . ->opt . -Bytes)] +[string-utf-8-length (-String [-Integer -Integer] . ->opt . -Nat)] +[bytes-utf-8-length (-Bytes [(Un (-val #f) -Char) -Integer -Integer] . ->opt . -Nat)] +[bytes-utf-8-ref (-Bytes [-Integer (Un (-val #f) -Char) -Integer -Integer] . ->opt . -Char)] +[bytes-utf-8-index (-Bytes [-Integer (Un (-val #f) -Char) -Integer -Integer] . ->opt . -Nat)] [read-bytes-line (->opt [-Input-Port Sym] (Un -Bytes (-val eof)))] [open-input-file (->key -Pathlike #:mode (Un (-val 'binary) (-val 'text)) #f -Input-Port)] @@ -578,11 +599,8 @@ [file-stream-buffer-mode (cl-> [(-Port) (Un (-val 'none) (-val 'line) (-val 'block) (-val #f))] [(-Port (Un (-val 'none) (-val 'line) (-val 'block))) -Void])] [file-position (-> -Port -Nat)] -[bytes->string/utf-8 (-> -Bytes -String)] -[string->bytes/utf-8 (-> -String -Bytes)] [force (-poly (a) (-> (-Promise a) a))] -[bytes* (list -Bytes) -Bytes B)] [regexp-replace* (cl->* (-Pattern -String -String . -> . -String) (-Pattern (Un -Bytes -String) (Un -Bytes -String) . -> . -Bytes))]