From 6939b2ca5f6576b6456b349bbae04d31c6c626ae Mon Sep 17 00:00:00 2001 From: Doug Coleman Date: Sat, 16 Sep 2017 16:46:47 -0500 Subject: [PATCH] io.errors: Add words to print to error-stream as easily as to output-stream. --- basis/io/errors/authors.txt | 1 + basis/io/errors/errors.factor | 11 +++++++++++ core/io/io.factor | 2 ++ 3 files changed, 14 insertions(+) create mode 100644 basis/io/errors/authors.txt create mode 100644 basis/io/errors/errors.factor diff --git a/basis/io/errors/authors.txt b/basis/io/errors/authors.txt new file mode 100644 index 0000000000..7c1b2f2279 --- /dev/null +++ b/basis/io/errors/authors.txt @@ -0,0 +1 @@ +Doug Coleman diff --git a/basis/io/errors/errors.factor b/basis/io/errors/errors.factor new file mode 100644 index 0000000000..64255a4575 --- /dev/null +++ b/basis/io/errors/errors.factor @@ -0,0 +1,11 @@ +! Copyright (C) 2017 Doug Coleman. +! See http://factorcode.org/license.txt for BSD license. +USING: io namespaces ; +IN: io.errors + +: ebl ( -- ) error-stream get stream-bl ; +: enl ( -- ) error-stream get stream-nl ; inline +: ewrite ( str -- ) error-stream get stream-write ; inline +: ewrite1 ( elt -- ) error-stream get stream-write1 ; inline +: eprint ( str -- ) error-stream get stream-print ; inline +: eflush ( -- ) error-stream get stream-flush ; inline diff --git a/core/io/io.factor b/core/io/io.factor index 4ab6296161..fc1d3e61f3 100644 --- a/core/io/io.factor +++ b/core/io/io.factor @@ -43,8 +43,10 @@ SYMBOL: error-stream : read-until ( seps -- seq sep/f ) input-stream get stream-read-until ; inline : tell-input ( -- n ) input-stream get stream-tell ; inline : tell-output ( -- n ) output-stream get stream-tell ; inline +: tell-error ( -- n ) error-stream get stream-tell ; inline : seek-input ( n seek-type -- ) input-stream get stream-seek ; inline : seek-output ( n seek-type -- ) output-stream get stream-seek ; inline +: seek-error ( n seek-type -- ) error-stream get stream-seek ; inline : write1 ( elt -- ) output-stream get stream-write1 ; inline : write ( seq -- ) output-stream get stream-write ; inline