From ace3419a8a60db5be97a5973813d586ee6740aaa Mon Sep 17 00:00:00 2001 From: Doug Coleman Date: Fri, 4 Jan 2008 18:56:04 -0600 Subject: [PATCH] Remove circular dependency in io add file-lines --- core/io/files/files.factor | 7 ++++++- core/io/io.factor | 5 +---- 2 files changed, 7 insertions(+), 5 deletions(-) diff --git a/core/io/files/files.factor b/core/io/files/files.factor index 3a01cc7d82..350ea1dfa6 100755 --- a/core/io/files/files.factor +++ b/core/io/files/files.factor @@ -3,7 +3,7 @@ IN: io.files USING: io.backend io.files.private io hashtables kernel math memory namespaces sequences strings assocs arrays definitions -system combinators splitting ; +system combinators splitting sbufs ; HOOK: io-backend ( path -- stream ) @@ -157,3 +157,8 @@ HOOK: binary-roots io-backend ( -- seq ) PRIVATE> : walk-dir ( path -- seq ) [ (walk-dir) ] { } make ; + +: file-lines ( path -- seq ) lines ; + +: file-contents ( path -- str ) + dup swap file-length [ stream-copy ] keep >string ; diff --git a/core/io/io.factor b/core/io/io.factor index 9c5cf782e7..0336ffda78 100755 --- a/core/io/io.factor +++ b/core/io/io.factor @@ -1,7 +1,7 @@ ! Copyright (C) 2003, 2007 Slava Pestov. ! See http://factorcode.org/license.txt for BSD license. USING: hashtables generic kernel math namespaces sequences strings - continuations assocs io.files io.styles sbufs ; + continuations assocs io.styles sbufs ; IN: io GENERIC: stream-close ( stream -- ) @@ -90,6 +90,3 @@ SYMBOL: stdio : contents ( stream -- str ) 2048 [ stream-copy ] keep >string ; - -: file-contents ( path -- str ) - dup swap file-length [ stream-copy ] keep >string ;