From c1d78e87ff31f545f4de9b56415cca9e251f6391 Mon Sep 17 00:00:00 2001 From: Doug Coleman Date: Mon, 9 May 2016 17:18:08 -0700 Subject: [PATCH] stream.extras: add print-flush, write-flush, etc. --- extra/stream/extras/authors.txt | 1 + extra/stream/extras/extras.factor | 18 ++++++++++++++++++ 2 files changed, 19 insertions(+) create mode 100644 extra/stream/extras/authors.txt create mode 100644 extra/stream/extras/extras.factor diff --git a/extra/stream/extras/authors.txt b/extra/stream/extras/authors.txt new file mode 100644 index 0000000000..7c1b2f2279 --- /dev/null +++ b/extra/stream/extras/authors.txt @@ -0,0 +1 @@ +Doug Coleman diff --git a/extra/stream/extras/extras.factor b/extra/stream/extras/extras.factor new file mode 100644 index 0000000000..a6f6b4a6ba --- /dev/null +++ b/extra/stream/extras/extras.factor @@ -0,0 +1,18 @@ +! Copyright (C) 2016 Doug Coleman. +! See http://factorcode.org/license.txt for BSD license. +USING: io kernel namespaces ; +IN: stream.extras + +: stream-write1-flush ( str stream -- ) + [ stream-write1 ] [ stream-flush ] bi ; inline + +: stream-write-flush ( str stream -- ) + [ stream-write ] [ stream-flush ] bi ; inline + +: stream-print-flush ( str stream -- ) + [ stream-print ] [ stream-flush ] bi ; inline + +: write1-flush ( str -- ) output-stream get stream-write1-flush ; inline +: write-flush ( str -- ) output-stream get stream-write-flush ; inline +: print-flush ( str -- ) output-stream get stream-print-flush ; inline +