From f5c15481febc99c5e9d15108e75c8d7aecd9068f Mon Sep 17 00:00:00 2001 From: Slava Pestov Date: Mon, 28 Jul 2008 22:28:13 -0500 Subject: [PATCH] Move io.styles to basis --- basis/bootstrap/stage2.factor | 2 +- basis/bootstrap/threads/threads.factor | 6 ++++++ {core => basis}/io/styles/authors.txt | 0 {core => basis}/io/styles/styles-docs.factor | 8 +++++++- {core => basis}/io/styles/styles.factor | 5 ++++- {core => basis}/io/styles/summary.txt | 0 {core => basis}/io/thread/thread.factor | 0 core/io/encodings/encodings.factor | 2 +- core/io/files/files-docs.factor | 12 ++++++------ core/io/io-docs.factor | 6 ------ core/io/io.factor | 5 +---- core/parser/parser.factor | 2 +- core/source-files/source-files.factor | 2 +- core/vocabs/loader/loader.factor | 2 +- 14 files changed, 29 insertions(+), 23 deletions(-) create mode 100644 basis/bootstrap/threads/threads.factor rename {core => basis}/io/styles/authors.txt (100%) rename {core => basis}/io/styles/styles-docs.factor (93%) rename {core => basis}/io/styles/styles.factor (84%) rename {core => basis}/io/styles/summary.txt (100%) rename {core => basis}/io/thread/thread.factor (100%) diff --git a/basis/bootstrap/stage2.factor b/basis/bootstrap/stage2.factor index 586032c2e8..08da2ae14b 100755 --- a/basis/bootstrap/stage2.factor +++ b/basis/bootstrap/stage2.factor @@ -50,7 +50,7 @@ SYMBOL: bootstrap-time default-image-name "output-image" set-global - "math compiler help io random tools ui ui.tools unicode handbook" "include" set-global + "threads math compiler help io random tools ui ui.tools unicode handbook" "include" set-global "" "exclude" set-global parse-command-line diff --git a/basis/bootstrap/threads/threads.factor b/basis/bootstrap/threads/threads.factor new file mode 100644 index 0000000000..8f4a05ef52 --- /dev/null +++ b/basis/bootstrap/threads/threads.factor @@ -0,0 +1,6 @@ +! Copyright (C) 2008 Slava Pestov. +! See http://factorcode.org/license.txt for BSD license. +IN: bootstrap.threads + +USE: io.thread +USE: threads diff --git a/core/io/styles/authors.txt b/basis/io/styles/authors.txt similarity index 100% rename from core/io/styles/authors.txt rename to basis/io/styles/authors.txt diff --git a/core/io/styles/styles-docs.factor b/basis/io/styles/styles-docs.factor similarity index 93% rename from core/io/styles/styles-docs.factor rename to basis/io/styles/styles-docs.factor index 43d93c86e7..48b72255a7 100644 --- a/core/io/styles/styles-docs.factor +++ b/basis/io/styles/styles-docs.factor @@ -24,8 +24,14 @@ ARTICLE: "table-styles" "Table styles" { $subsection table-gap } { $subsection table-border } ; +HELP: write-object +{ $values { "str" string } { "obj" "an object" } } +{ $description "Writes a string to " { $link output-stream } ", associating it with the object. If formatted output is supported, the string will become a clickable presentation of the object, otherwise this word behaves like a call to " { $link write } "." } +$io-error ; + ARTICLE: "presentations" "Presentations" -"The " { $link presented } " style can be used to emit clickable objects. The " { $link write-object } " word should be used instead of setting this directly." ; +"The " { $link presented } " style can be used to emit clickable objects. A utility word for outputting this style:" +{ $subsection write-object } ; ARTICLE: "styles" "Formatted output" "The " { $link stream-format } ", " { $link with-style } ", " { $link with-nesting } " and " { $link tabular-output } " words take a hashtable of style attributes. Output stream implementations are free to ignore style information." diff --git a/core/io/styles/styles.factor b/basis/io/styles/styles.factor similarity index 84% rename from core/io/styles/styles.factor rename to basis/io/styles/styles.factor index 4c19d87435..14827dc7a6 100644 --- a/core/io/styles/styles.factor +++ b/basis/io/styles/styles.factor @@ -1,5 +1,6 @@ -! Copyright (C) 2005, 2006 Slava Pestov. +! Copyright (C) 2005, 2008 Slava Pestov. ! See http://factorcode.org/license.txt for BSD license. +USING: hashtables io ; IN: io.styles SYMBOL: plain @@ -39,3 +40,5 @@ SYMBOL: table-border TUPLE: input string ; C: input + +: write-object ( str obj -- ) presented associate format ; diff --git a/core/io/styles/summary.txt b/basis/io/styles/summary.txt similarity index 100% rename from core/io/styles/summary.txt rename to basis/io/styles/summary.txt diff --git a/core/io/thread/thread.factor b/basis/io/thread/thread.factor similarity index 100% rename from core/io/thread/thread.factor rename to basis/io/thread/thread.factor diff --git a/core/io/encodings/encodings.factor b/core/io/encodings/encodings.factor index fc02d880f1..3df441ae03 100755 --- a/core/io/encodings/encodings.factor +++ b/core/io/encodings/encodings.factor @@ -2,7 +2,7 @@ ! See http://factorcode.org/license.txt for BSD license. USING: math kernel sequences sbufs vectors namespaces growable strings io classes continuations destructors combinators -io.styles io.streams.plain splitting byte-arrays +io.streams.plain splitting byte-arrays sequences.private accessors ; IN: io.encodings diff --git a/core/io/files/files-docs.factor b/core/io/files/files-docs.factor index cac8a4c6c5..8e32c100e0 100755 --- a/core/io/files/files-docs.factor +++ b/core/io/files/files-docs.factor @@ -1,4 +1,4 @@ -USING: help.markup help.syntax io io.styles strings +USING: help.markup help.syntax io strings io.backend io.files.private quotations ; IN: io.files @@ -170,16 +170,16 @@ HELP: +symbolic-link+ { $description "A symbolic link file. This type is currently implemented on Unix platforms only. See " { $link "symbolic-links" } " for words operating on symbolic links." } ; HELP: +character-device+ -{ $description "A Unix character device file. This type exists on unix platforms only." } ; +{ $description "A Unix character device file. This type exists on Unix platforms only." } ; HELP: +block-device+ -{ $description "A Unix block device file. This type exists on unix platforms only." } ; +{ $description "A Unix block device file. This type exists on Unix platforms only." } ; HELP: +fifo+ -{ $description "A Unix fifo file. This type exists on unix platforms only." } ; +{ $description "A Unix fifo file. This type exists on Unix platforms only." } ; HELP: +socket+ -{ $description "A Unix socket file. This type exists on unix platforms only." } ; +{ $description "A Unix socket file. This type exists on Unix platforms only." } ; HELP: +unknown+ { $description "A unknown file type." } ; @@ -327,7 +327,7 @@ HELP: resource-path { $description "Resolve a path relative to the Factor source code location." } ; HELP: pathname -{ $class-description "Class of pathname presentations. Path name presentations can be created by calling " { $link } ". Instances can be passed to " { $link write-object } " to output a clickable pathname." } ; +{ $class-description "Class of path name objects. Path name objects can be created by calling " { $link } "." } ; HELP: normalize-directory { $values { "str" "a pathname string" } { "newstr" "a new pathname string" } } diff --git a/core/io/io-docs.factor b/core/io/io-docs.factor index 782d4044ae..b639696f57 100755 --- a/core/io/io-docs.factor +++ b/core/io/io-docs.factor @@ -87,7 +87,6 @@ $nl { $subsection bl } "Formatted output:" { $subsection format } -{ $subsection write-object } { $subsection with-style } { $subsection with-nesting } "Tabular output:" @@ -356,11 +355,6 @@ HELP: bl { $description "Outputs a space character (" { $snippet "\" \"" } ") to " { $link output-stream } "." } $io-error ; -HELP: write-object -{ $values { "str" string } { "obj" "an object" } } -{ $description "Writes a string to " { $link output-stream } ", associating it with the object. If formatted output is supported, the string will become a clickable presentation of the object, otherwise this word behaves like a call to " { $link write } "." } -$io-error ; - HELP: lines { $values { "stream" "an input stream" } { "seq" "a sequence of strings" } } { $description "Reads lines of text until the stream is exhausted, collecting them in a sequence of strings." } ; diff --git a/core/io/io.factor b/core/io/io.factor index da7585e7ea..a03aaac6d8 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 -continuations destructors assocs io.styles ; +continuations destructors assocs ; IN: io GENERIC: stream-readln ( stream -- str/f ) @@ -96,9 +96,6 @@ SYMBOL: error-stream : bl ( -- ) " " write ; -: write-object ( str obj -- ) - presented associate format ; - : lines ( stream -- seq ) [ [ readln dup ] [ ] [ drop ] produce ] with-input-stream ; diff --git a/core/parser/parser.factor b/core/parser/parser.factor index 013e2c19bf..502d4c1eba 100755 --- a/core/parser/parser.factor +++ b/core/parser/parser.factor @@ -1,7 +1,7 @@ ! Copyright (C) 2005, 2008 Slava Pestov. ! See http://factorcode.org/license.txt for BSD license. USING: arrays definitions generic assocs kernel math namespaces -sequences strings vectors words quotations io.styles io +sequences strings vectors words quotations io combinators sorting splitting math.parser effects continuations io.files io.streams.string vocabs io.encodings.utf8 source-files classes hashtables compiler.errors compiler.units accessors sets diff --git a/core/source-files/source-files.factor b/core/source-files/source-files.factor index 3023c4e8d2..50c79fc2c6 100755 --- a/core/source-files/source-files.factor +++ b/core/source-files/source-files.factor @@ -1,7 +1,7 @@ ! Copyright (C) 2007, 2008 Slava Pestov. ! See http://factorcode.org/license.txt for BSD license. USING: arrays definitions generic assocs kernel math namespaces -sequences strings vectors words quotations io.styles io +sequences strings vectors words quotations io combinators sorting splitting math.parser effects continuations io.files checksums checksums.crc32 vocabs hashtables graphs compiler.units io.encodings.utf8 accessors ; diff --git a/core/vocabs/loader/loader.factor b/core/vocabs/loader/loader.factor index d51a2a88b0..26a6e8ae7a 100755 --- a/core/vocabs/loader/loader.factor +++ b/core/vocabs/loader/loader.factor @@ -1,7 +1,7 @@ ! Copyright (C) 2007, 2008 Eduardo Cavazos, Slava Pestov. ! See http://factorcode.org/license.txt for BSD license. USING: namespaces sequences io.files kernel assocs words vocabs -definitions parser continuations io io.styles hashtables sorting +definitions parser continuations io hashtables sorting source-files arrays combinators strings system math.parser compiler.errors splitting init ; IN: vocabs.loader