From a16062bf91a763b62dfcdaca0efa617ad583b8f2 Mon Sep 17 00:00:00 2001 From: indianpojken Date: Mon, 9 Oct 2017 17:44:45 +0200 Subject: [PATCH 1/2] Adds uintX variants to read/peek procs --- lib/pure/streams.nim | 32 ++++++++++++++++++++++++++++++++ 1 file changed, 32 insertions(+) diff --git a/lib/pure/streams.nim b/lib/pure/streams.nim index 69f6739903..d54f4b963d 100644 --- a/lib/pure/streams.nim +++ b/lib/pure/streams.nim @@ -232,6 +232,38 @@ proc peekFloat32*(s: Stream): float32 = ## peeks a float32 from the stream `s`. Raises `EIO` if an error occurred. peek(s, result) +proc readUint8*(s: Stream): uint8 = + ## reads an uint8 from the stream `s`. Raises `EIO` if an error occurred. + read(s, result) + +proc peekUint8*(s: Stream): uint8 = + ## peeks an uint8 from the stream `s`. Raises `EIO` if an error occurred. + peek(s, result) + +proc readUint16*(s: Stream): uint16 = + ## reads an uint16 from the stream `s`. Raises `EIO` if an error occurred. + read(s, result) + +proc peekUint16*(s: Stream): uint16 = + ## peeks an uint16 from the stream `s`. Raises `EIO` if an error occurred. + peek(s, result) + +proc readUint32*(s: Stream): uint32 = + ## reads an uint32 from the stream `s`. Raises `EIO` if an error occurred. + read(s, result) + +proc peekUint32*(s: Stream): uint32 = + ## peeks an uint32 from the stream `s`. Raises `EIO` if an error occurred. + peek(s, result) + +proc readUint64*(s: Stream): uint64 = + ## reads an uint64 from the stream `s`. Raises `EIO` if an error occurred. + read(s, result) + +proc peekUint64*(s: Stream): uint64 = + ## peeks an uint64 from the stream `s`. Raises `EIO` if an error occurred. + peek(s, result) + proc readFloat64*(s: Stream): float64 = ## reads a float64 from the stream `s`. Raises `EIO` if an error occurred. read(s, result) From 12d7503f76bfa54946efa2754c30c026ea253eb4 Mon Sep 17 00:00:00 2001 From: indianpojken Date: Mon, 16 Oct 2017 00:52:07 +0200 Subject: [PATCH 2/2] Update streams.nim --- lib/pure/streams.nim | 16 ++++++++-------- 1 file changed, 8 insertions(+), 8 deletions(-) diff --git a/lib/pure/streams.nim b/lib/pure/streams.nim index d54f4b963d..354e07da30 100644 --- a/lib/pure/streams.nim +++ b/lib/pure/streams.nim @@ -224,14 +224,6 @@ proc peekInt64*(s: Stream): int64 = ## peeks an int64 from the stream `s`. Raises `EIO` if an error occurred. peek(s, result) -proc readFloat32*(s: Stream): float32 = - ## reads a float32 from the stream `s`. Raises `EIO` if an error occurred. - read(s, result) - -proc peekFloat32*(s: Stream): float32 = - ## peeks a float32 from the stream `s`. Raises `EIO` if an error occurred. - peek(s, result) - proc readUint8*(s: Stream): uint8 = ## reads an uint8 from the stream `s`. Raises `EIO` if an error occurred. read(s, result) @@ -264,6 +256,14 @@ proc peekUint64*(s: Stream): uint64 = ## peeks an uint64 from the stream `s`. Raises `EIO` if an error occurred. peek(s, result) +proc readFloat32*(s: Stream): float32 = + ## reads a float32 from the stream `s`. Raises `EIO` if an error occurred. + read(s, result) + +proc peekFloat32*(s: Stream): float32 = + ## peeks a float32 from the stream `s`. Raises `EIO` if an error occurred. + peek(s, result) + proc readFloat64*(s: Stream): float64 = ## reads a float64 from the stream `s`. Raises `EIO` if an error occurred. read(s, result)