]> gitweb.factorcode.org Git - factor.git/commitdiff
handbook updates, HTML-format changelog
authorSlava Pestov <slava@factorcode.org>
Fri, 22 Jul 2005 01:43:37 +0000 (01:43 +0000)
committerSlava Pestov <slava@factorcode.org>
Fri, 22 Jul 2005 01:43:37 +0000 (01:43 +0000)
24 files changed:
CHANGES.html [new file with mode: 0644]
CHANGES.txt [deleted file]
doc/handbook.tex
library/collections/sequences-epilogue.factor
library/collections/sequences.factor
library/httpd/html.factor
library/httpd/http-client.factor
library/httpd/http-common.factor
library/httpd/httpd.factor
library/io/c-streams.factor
library/io/directories.factor
library/io/duplex-stream.factor
library/io/lines.factor
library/io/stdio.factor
library/io/stream.factor
library/io/string-streams.factor
library/syntax/prettyprint.factor
library/syntax/see.factor
library/test/httpd/html.factor
library/test/io/io.factor
library/tools/jedit.factor
library/tools/listener.factor
library/ui/panes.factor
library/unix/io.factor

diff --git a/CHANGES.html b/CHANGES.html
new file mode 100644 (file)
index 0000000..c4d79e7
--- /dev/null
@@ -0,0 +1,113 @@
+<html>
+<head><title>Factor change log</title></head>
+<body>
+
+<h1>Factor 0.76:</h1>
+<!-- :noWordSep=+-*\=><;.?/'()%,_|: -->
+
+<ul>
+<li>
+Major improvements to the GUI:
+<ul>
+<li>Now uses 3-dimensional co-ordinates throughout</li>
+<li>The listener supports styled text output and presentations</li>
+<li>Gradient paint, bevel border paint</li>
+<li>Wheel mouse scrolling</li>
+<li>Slide-show tutorial with live code examples</li>
+<li>Performance improvements, code cleanups, bug fixes</li>
+</ul>
+</li>
+<li>
+Sequences:
+<ul>
+<li>The following formely list-specific words are now generic:
+    
+    <pre>all? ( seq quot -- ? | quot: elt -- ? )
+all-with? ( obj seq quot -- ? | quot: elt -- ? )
+subset ( seq quot -- seq | quot: elt -- ? )
+subset-with ( obj seq quot -- seq | quot: obj elt -- ? )
+fiber? ( seq quot -- ? | quot: elt elt -- ? )
+prune ( seq -- seq )</pre>
+
+<li> The <code>contains?</code> word for testing membership in a sequence has been
+  renamed to <code>member? ( elt seq -- ? )</code>.
+
+<li> The list-specific <code>some?</code> and <code>some-with?</code> combinators are gone. Their replacements are generic:
+  
+  <pre>contains? ( seq quot -- ? | quot: elt -- ? )
+contains-with? ( obj seq quot -- ? | quot: obj elt -- ? )
+find ( seq quot -- i elt | quot: elt -- ? )
+find* ( i seq quot -- i elt | quot: elt -- ? )
+find-with ( obj seq quot -- i elt | quot: elt -- ? )
+find-with* ( obj i seq quot -- i elt | quot: elt -- ? )</pre>
+
+  See the developer's handbook for details.
+
+<li> The <code>nreverse ( seq -- )</code> word has been removed.
+
+<li> <code>reverse-slice ( seq -- seq )</code> outputs a new sequence that shares
+  structure with the given sequence, but presents elements in reverse
+  order.
+
+<li> The <code>string-compare</code> primitive has been replaced with the lexi word
+  which now operates on any pair of sequences of numbers. The
+  string> word has been replaced with <code>>lexi></code>.
+
+<li> The <code>,</code> word no longer accepts a string as input inside a <code>make-string</code>. In 0.75, the following
+  two lines were equivalent:
+  
+  <pre>[ "Hello" , " world" , ] make-string
+[ "Hello" % " world" % ] make-string</pre>
+  
+<li> Now, the former raises a type error. Use <code>,</code> with characters, and <code>%</code> with
+  strings inside make-string.
+</ul>
+
+<li>Streams:
+
+<ul>
+<li>The following words have been renamed:
+  
+    <pre>stream-auto-flush ==> stream-finish ( stream -- )
+stream-write-attr ==> stream-format ( string style stream -- )
+write-attr ==> format ( string style -- )</pre>
+
+<li>The following words no longer accept character arguments:
+  
+    <pre>stream-format ( string style stream -- )
+format ( string style -- )
+stream-write ( string stream -- )
+write ( string -- )
+stream-print ( string -- )
+print ( string -- )</pre>
+
+<li>Use the new words to write characters:
+  
+    <pre>stream-write1 ( char stream -- )
+write1 ( char -- )</pre>
+
+  Note that <code>stream-write1</code> is generic and your stream must implement it.
+
+<li><code>with-string</code> word renamed to <code>string-out ( quot -- string )</code>
+
+<li>New <code>string-in ( string quot -- )</code> word, calls <code>quot</code> with <code>stdio</code> bound to
+  a stream that reads from the given string.
+</ul>
+
+<li>Many improvements to the matrices library.
+
+<li>Improved inspector. Call it with <code>inspect ( obj -- )</code>.
+
+<li>The number of generations used for garbage collection can now be set
+  with the +G command line switch. You must specify at least 2
+  generations.
+
+<li>Only 2 generations are used by default now, since there seems to be no
+  performance benefit to having 3 after running some brief benchmarks.
+
+<li>Fixed bug where images saved from the jEdit plugin would fail to
+  start.
+
+<li>md5 hashing algorithm in <code>contrib/crypto/</code> (Doug Coleman).
+
+</ul>
diff --git a/CHANGES.txt b/CHANGES.txt
deleted file mode 100644 (file)
index 67f9932..0000000
+++ /dev/null
@@ -1,191 +0,0 @@
-Factor 0.76:
-------------
-
-- Major improvements to the GUI:
-
-  - The listener supports styled text output and presentations
-  - Gradient paint, bevel border paint
-  - Wheel mouse scrolling
-  - Slide-show tutorial with live code examples
-  - Performance improvements, code cleanups, bug fixes
-
-- The following formely list-specific words are now generic:
-    
-    all? all-with? subset subset-with fiber? prune
-
-- The contains? word for testing membership in a sequence has been
-  renamed to member?.
-
-- The some? and some-with? combinators are gone. Their replacements
-  are contains?, contains-with?, find, find*, find-with, and find-with*.
-  See the documentation for details.
-
-- The nreverse word has been removed.
-
-- The , word no longer accepts a string as input. Formely, the following
-  two lines were equivalent:
-  
-  [ "Hello" , " world" , ] make-string
-  [ "Hello" % " world" % ] make-string
-  
-  Now, the former raises a type error.
-
-- The string-compare primitive has been replaced with the lexi word
-  which now operates on any pair of sequences of numbers. The
-  string> word has been replaced with lexi>.
-
-- The stream-write, stream-write-attr, write and write-attr generic   
-  words no longer accept a character as an argument. Use the new
-  stream-write1 and write1 generic words to write single characters.
-
-- reverse-slice ( seq -- seq ) outputs a new sequence that shares
-  structure with the given sequence, but presents elements in reverse
-  order.
-
-- Many improvements to the matrices library.
-
-- with-string word renamed to string-out ( quot -- string )
-
-- new string-in ( string quot -- ) word, calls quot with stdio bound to
-  a stream that reads from the given string.
-
-- Improved inspector. Call it with inspect ( obj -- ).
-
-- The number of generations used for garbage collection can now be set
-  with the +G command line switch. You must specify at least 2
-  generations.
-
-- Only 2 generations are used by default now, since there seems to be no
-  performance benefit to having 3 after running some brief benchmarks.
-
-- Fixed bug where images saved from the jEdit plugin would fail to
-  start.
-
-- md5 hashing algorithm in contrib/crypto/ (Doug Coleman).
-
-Factor 0.75:
-------------
-
-+ Runtime and core library
-
-- Fix for a fatal bug where Factor was not functional on Mac OS X 10.4.
-
-- Client sockets were not functional on Linux.
-
-- New generational garbage collector. There are two command line
-  switches for controlling it:
-
-   +Yn   Size of 2 youngest generations, megabytes
-   +An   Size of tenured and semi-spaces, megabytes
-
-- Generic words can now dispatch on stack elements other than the top
-  one; define your generic like this to dispatch on the second element:
-
-   G: foo [ over ] [ type ] ;
-
-  Or this for the third:
-
-   G: foo [ pick ] [ type ] ;
-
-  Note that GENERIC: foo is the same as
-
-   G: foo [ dup ] [ type ] ;
-
-- Sequence API refactoring, as described in
-  http://www.jroller.com/page/slava/20050518.
-
-- The SO_OOBINLINE socket flag is now set. In 0.74, sending out-of-band
-  data could fill up the buffer and cause a denial-of-service attack.
-
-- You can now set timeouts for I/O operations with the set-timeout
-  generic word. The HTTP server sets a timeout of 60 seconds for client
-  requests.
-
-- Improved the words for doing binary I/O; see library/io/binary.factor
-  and the section in the handbook on binary I/O.
-
-+ Compiler
-
-- The compiler now does constant folding for certain words with literal
-  operands. The compiler's peephole optimizer has been improved.
-
-- The alien interface now supports "float" and "double" types, and
-  arrays of C types.
-
-- New short-hand syntax for defining words that alien-invoke
-  (Alex Chapman).
-  
-  LIBRARY: gl
-  FUNCTION: void glTranslatef ( GLfloat x, GLfloat y, GLfloat z ) ;
-
-  should be the same as doing:
-
-  : glTranslatef ( x y z -- )
-      "void" "gl" "glTranslatef"
-      [ "GLfloat" "GLfloat" "GLfloat" ] alien-invoke ;
-  \ glTranslatef compile
-
-+ Framework
-
-- OpenGL binding in contrib/gl/ (Alex Chapman).
-
-- PostgreSQL binding in contrib/postgresql/ (Doug Coleman).
-
-- HTTP server now supports virtual hosting.
-
-- The Factor plugin now supports connecting to Factor instances on
-  arbitrary host and port names. This allows interactive development on
-  one machine while testing on another. A new command was added to
-  evaluate the word definition at the caret in the listener.
-
-Factor 0.74:
-------------
-
-C library interface ported to Linux/PPC and Mac OS X.
-
-Developer's handbook rewritten to be more up to date and complete.
-
-Added the sequences vocabulary that unifies code for working with lists,
-vectors, strings, and string buffers. There are many changes, and most
-of the old type-specific words such as vector-nth and string-map are
-gone.
-
-Added the matrices vocabulary for working with mathematical vectors and
-matrices.
-
-Added two words for modular arithmetic in the math vocabulary: mod-inv
-and ^mod.
-
-Added HTTP client API supporting GET and POST requests in the
-http-client vocabulary.
-
-Removed some inspection words: vocabs. words. usages. Now, just put a
-space before the . and write vocabs . words . usages .
-
-Redefining words that are used by compiled words automatically
-decompiles the compiled words. This fixes the problem of new definitions
-not taking effect. In a future release, there will be automatic
-recompilation, rather than decompilation.
-
-As a result of the previous change, there is now a cross-referencing
-database, and the usages word lists indirect dependencies and is much
-faster. The usage word behaves like the old usages, and lists direct
-dependencies only.
-
-The dump word in the dump vocabulary prints the memory bytes comprising
-an object. The dump* word prints the bytes at an arbitrary address.
-
-New words in words vocabulary for inspecting classes and methods:
-classes implements.
-
-The Unix I/O code was rewritten in Factor using the C library interface.
-Many new features will be added in future releases, such as socket
-timeouts and Unicode character encodings.
-
-Lazy lists and parser combinators library in contrib/parser-combinators/
-(Chris Double).
-
-Quotations containing \ foo are prettyprinted in that form.
-
-The watch word now causes annotated words to dump the stack, in addition
-to printing a log message.
index 3d37f293d2efcfe2f81cd2d24af74180df22e797..64b5330dbd0f369d716fc01c4caf38faeaf16a23 100644 (file)
@@ -3872,7 +3872,7 @@ String buffers support the stream output protocol. See \ref{stdio}.
 \glossary{name=input stream,
 description={a stream that implements the \texttt{stream-readln} and \texttt{stream-read} generic words and can be used for character input}}
 \glossary{name=output stream,
-description={a stream that implements the \texttt{stream-write-attr}, \texttt{stream-flush} and \texttt{stream-auto-flush} generic words and can be used for character output}}
+description={a stream that implements the \texttt{stream-write-attr}, \texttt{stream-flush} and \texttt{stream-finish} generic words and can be used for character output}}
 
 There are various subsets of the stream protocol that a class can implement so that its instances may be used as streams. The following generic word is mandatory.
 
@@ -3926,11 +3926,11 @@ Ensures all pending output operations are been complete. With many output stream
 
 \wordtable{
 \vocabulary{io}
-\genericword{stream-auto-flush}{stream-auto-flush ( s -- )}
+\genericword{stream-finish}{stream-finish ( s -- )}
 }
-Ensures the user sees prior output. It is not as strong as \texttt{stream-flush}. The contract is as follows: if the stream is connected to an interactive end-point such as a terminal, \texttt{stream-auto-flush} should execute \texttt{stream-flush}. If the stream is a file or network stream used for ``batch'' operations, this word should have an empty definition.
+Ensures the user sees prior output. It is not as strong as \texttt{stream-flush}. The contract is as follows: if the stream is connected to an interactive end-point such as a terminal, \texttt{stream-finish} should execute \texttt{stream-flush}. If the stream is a file or network stream used for ``batch'' operations, this word should have an empty definition.
 
-The \texttt{stream-print} word executes \texttt{stream-auto-flush} after each line of output.
+The \texttt{stream-print} word executes \texttt{stream-finish} after each line of output.
 
 With some streams, the above operations may suspend the current thread and execute other threads until input data is available (\ref{threads}).
 
@@ -3951,7 +3951,7 @@ Outputs a string to the stream, without any specific style information. Implemen
 \vocabulary{io}
 \ordinaryword{stream-print}{stream-print ( string stream -- )}
 }
-Outputs a string to the stream, followed by a newline, then executes \texttt{stream-auto-flush} to force the line to be displayed on interactive streams.
+Outputs a string to the stream, followed by a newline, then executes \texttt{stream-finish} to force the line to be displayed on interactive streams.
 
 \section{The default stream}\label{stdio}
 \glossary{name=default stream,
index 843f6fea03a5cee4dfcfba28399c4315cd2ede23..774b0d6edcd2b2746c8879aa462e1665ddbca843 100644 (file)
@@ -83,7 +83,7 @@ M: object find ( seq quot -- i elt )
     #! ForAll(P in X) <==> !Exists(!P in X)
     swap [ swap call not ] contains-with? not ; inline
 
-: all-with? ( obj list pred -- ? )
+: all-with? ( obj seq quot -- ? | quot: elt -- ? )
     swap [ with rot ] all? 2nip ; inline
 
 : subset ( seq quot -- seq | quot: elt -- ? )
@@ -99,7 +99,7 @@ M: object find ( seq quot -- i elt )
         ] each drop
     ] keep like ; inline
 
-: subset-with ( obj list quot -- list )
+: subset-with ( obj seq quot -- seq | quot: obj elt -- ? )
     swap [ with rot ] subset 2nip ; inline
 
 : fiber? ( seq quot -- ? | quot: elt elt -- ? )
index 7d64e8159602d8b9f5bf8d56caccb96a46bfa0fa..eae919d0ea7ae3b2e2687e2e65e1b737660fbe8d 100644 (file)
@@ -7,7 +7,7 @@ USING: errors generic kernel math math-internals strings vectors ;
 
 ! Sequences support the following protocol. Concrete examples
 ! are strings, string buffers, vectors, and arrays. Arrays are
-! low level and not bounds-checked; they are in the
+! low level and no | quot: elt -- ? t bounds-checked; they are in the
 ! kernel-internals vocabulary, so don't use them unless you have
 ! a good reason.
 
@@ -41,16 +41,16 @@ G: each ( seq quot -- | quot: elt -- )
 G: 2map ( seq seq quot -- seq | quot: elt elt -- elt )
     [ over ] [ type ] ; inline
 
-G: find ( seq quot -- i elt )
+G: find ( seq quot -- i elt | quot: elt -- ? )
     [ over ] [ type ] ; inline
 
-: find-with ( obj seq quot -- i elt )
+: find-with ( obj seq quot -- i elt | quot: elt -- ? )
     swap [ with rot ] find 2swap 2drop ; inline
 
-G: find* ( i seq quot -- i elt )
+G: find* ( i seq quot -- i elt | quot: elt -- ? )
     [ over ] [ type ] ; inline
 
-: find-with* ( obj i seq quot -- i elt )
+: find-with* ( obj i seq quot -- i elt | quot: elt -- ? )
     -rot [ with rot ] find* 2swap 2drop ; inline
 
 : first 0 swap nth ; inline
index 92fa603dea396dae8198f339321465e8458b35dd..e51923ba86da4ab8220a0f8ac20216a9d8d3a106 100644 (file)
@@ -106,7 +106,7 @@ M: html-stream stream-write1 ( char stream -- )
         dup html-entities assoc [ write ] [ write1 ] ?ifte
     ] with-wrapper ;
 
-M: html-stream stream-write-attr ( str style stream -- )
+M: html-stream stream-format ( str style stream -- )
     [
         [
             [
index 98003c4fc0337c9d1a192ea2c144cf13fe4b8b76..8265010e9a7a6716c88dc5f7c7d145b34749f6e3 100644 (file)
@@ -21,7 +21,7 @@ io strings unparser ;
 : read-response ( -- code header )
     #! After sending a GET oR POST we read a response line and
     #! header.
-    flush read-line parse-response read-header ;
+    flush readln parse-response read-header ;
 
 : http-request ( host resource method -- )
     write CHAR: \s write write " HTTP/1.0" write crlf
index 163d36f0224ad930995b5a655fb2838725856919..bc95e66df295e22ac0921b6bef1cca5bfc245336 100644 (file)
@@ -7,7 +7,7 @@ io strings unparser ;
     ": " split1 dup [ cons swons ] [ 2drop ] ifte ;
 
 : (read-header) ( alist -- alist )
-    read-line dup
+    readln dup
     empty? [ drop ] [ header-line (read-header) ] ifte ;
 
 : read-header ( -- alist )
index 4646f76a2f43843efa66dc30c5dd9173610507ea..1a9ceb1c869ff073cae59aaf8948fa160addddf0 100644 (file)
@@ -52,7 +52,7 @@ sequences ;
 : httpd-client ( socket -- )
     dup log-client [
         60000 stdio get set-timeout
-        read-line [ parse-request ] when*
+        readln [ parse-request ] when*
     ] with-stream ;
 
 : httpd-connection ( socket -- )
index 367de4084ad80541ee103cbe4dba3ba28f687cb3..6aebdb785d5fc3c2437d9f9f474b811adbd58761 100644 (file)
@@ -15,7 +15,7 @@ TUPLE: c-stream in out flush? ;
 M: c-stream stream-write1 ( char stream -- )
     >r ch>string r> c-stream-out fwrite ;
 
-M: c-stream stream-write-attr ( str style stream -- )
+M: c-stream stream-format ( str style stream -- )
     nip c-stream-out fwrite ;
 
 M: c-stream stream-read1 ( stream -- char/f )
index 8fa633c284b910093fffee19e1eb39ace7f171d2..39464664bf57a90478868fe0603f4a1506190e46 100644 (file)
@@ -11,7 +11,7 @@ sequences strings unparser ;
 : file-icon. directory? dir-icon file-icon ? write-icon ;
 
 : file-link. ( dir name -- )
-    tuck path+ "file" swons unit write-attr ;
+    tuck path+ "file" swons unit format ;
 
 : file. ( dir name -- )
     #! If "doc-root" set, create links relative to it.
index 6b60e377d60c8cd3d30cbb6f8072aadcec809bc6..bbab18db7896425daf32532f1856904ebcfdb751 100644 (file)
@@ -23,8 +23,8 @@ M: duplex-stream stream-read
 M: duplex-stream stream-write1
     duplex-stream-out stream-write1 ;
 
-M: duplex-stream stream-write-attr
-    duplex-stream-out stream-write-attr ;
+M: duplex-stream stream-format
+    duplex-stream-out stream-format ;
 
 M: duplex-stream stream-close
     #! The output stream is closed first, in case both streams
index 6e24c1ca1f3ec6304472560ecf5d91d0b5caa8cd..7774004bbc8ff22d231cfaf3d5ad81250a84922b 100644 (file)
@@ -9,16 +9,16 @@ C: line-reader ( stream -- line ) [ set-delegate ] keep ;
 
 : cr> dup line-reader-cr f rot set-line-reader-cr ;
 
-: (read-line) ( ? line -- ? )
+: (readln) ( ? line -- ? )
     #! The flag is set after the first character is read.
     dup delegate stream-read1 dup [
         >r >r drop t r> r> dup CHAR: \r = [
             drop t swap set-line-reader-cr
         ] [
             dup CHAR: \n = [
-                drop dup cr> [ (read-line) ] [ drop ] ifte
+                drop dup cr> [ (readln) ] [ drop ] ifte
             ] [
-                , (read-line)
+                , (readln)
             ] ifte
         ] ifte
     ] [
@@ -26,7 +26,7 @@ C: line-reader ( stream -- line ) [ set-delegate ] keep ;
     ] ifte ;
 
 M: line-reader stream-readln ( line -- string )
-    [ f swap (read-line) ] make-string
+    [ f swap (readln) ] make-string
     dup empty? [ f ? ] [ nip ] ifte ;
 
 M: line-reader stream-read ( count line -- string )
index 8e88beecf8012935f6239c01e0a59db6ab34b839..e43238a45e7aaac48fe84cb781dd3906748ad8db 100644 (file)
@@ -3,26 +3,27 @@
 IN: io
 USING: errors generic kernel lists namespaces strings styles ;
 
-: flush      ( -- )              stdio get stream-flush ;
-: read-line  ( -- string )       stdio get stream-readln ;
-: read1      ( -- char/f )       stdio get stream-read1 ;
-: read       ( count -- string ) stdio get stream-read ;
-: write      ( string -- )       stdio get stream-write ;
-: write1     ( char -- )         stdio get stream-write1 ;
-: write-attr ( string style -- ) stdio get stream-write-attr ;
-: print      ( string -- )       stdio get stream-print ;
-: terpri     ( -- )              stdio get stream-terpri ;
-: crlf       ( -- )              "\r\n" write ;
-: bl         ( -- )              " " write ;
-: close      ( -- )              stdio get stream-close ;
+: flush  ( -- )              stdio get stream-flush ;
+: readln ( -- string/f )       stdio get stream-readln ;
+: read1  ( -- char/f )       stdio get stream-read1 ;
+: read   ( count -- string ) stdio get stream-read ;
+: write  ( string -- )       stdio get stream-write ;
+: write1 ( char -- )         stdio get stream-write1 ;
+: format ( string style -- ) stdio get stream-format ;
+: print  ( string -- )       stdio get stream-print ;
+: terpri ( -- )              stdio get stream-terpri ;
+: close  ( -- )              stdio get stream-close ;
+
+: crlf   ( -- )              "\r\n" write ;
+: bl     ( -- )              " " write ;
 
 : write-icon ( resource -- )
     #! Write an icon. Eg, /library/icons/File.png
-    icon swons unit "" swap write-attr ;
+    icon swons unit "" swap format ;
 
 : with-stream ( stream quot -- )
-    #! Close the stream no matter what happends.
-    [ swap stdio set  [ close rethrow ] catch ] with-scope ;
+    #! Close the stream no matter what happens.
+    [ swap stdio set [ close rethrow ] catch ] with-scope ;
 
 : with-stream* ( stream quot -- )
     #! Close the stream if there is an error.
index 7fe4437bee09463570640401b8222c88ae721b8e..0852b87db4373381457753a8c8e973f7546210c3 100644 (file)
@@ -7,33 +7,28 @@ strings ;
 SYMBOL: stdio
 
 ! Stream protocol.
-GENERIC: stream-flush      ( stream -- )
-GENERIC: stream-finish     ( stream -- )
-GENERIC: stream-readln     ( stream -- string )
-GENERIC: stream-read1      ( stream -- char/f )
-GENERIC: stream-read       ( count stream -- string )
-GENERIC: stream-write1     ( char stream -- )
-GENERIC: stream-write-attr ( string style stream -- )
-GENERIC: stream-close      ( stream -- )
-GENERIC: set-timeout       ( timeout stream -- )
+GENERIC: stream-flush  ( stream -- )
+GENERIC: stream-finish ( stream -- )
+GENERIC: stream-readln ( stream -- string )
+GENERIC: stream-read1  ( stream -- char/f )
+GENERIC: stream-read   ( count stream -- string )
+GENERIC: stream-write1 ( char stream -- )
+GENERIC: stream-format ( string style stream -- )
+GENERIC: stream-close  ( stream -- )
+GENERIC: set-timeout   ( timeout stream -- )
+
+: stream-write ( string stream -- )
+    f swap stream-format ;
 
 : stream-terpri ( stream -- )
     "\n" swap stream-write ;
 
-: stream-write ( string stream -- )
-    f swap stream-write-attr ;
-
 : stream-print ( string stream -- )
-    [ stream-write ] keep
-    [ stream-write ] keep
-    stream-finish ;
+    [ stream-write ] keep dup stream-terpri stream-finish ;
 
 : (stream-copy) ( in out -- )
-    4096 pick stream-read [
-        over stream-write (stream-copy)
-    ] [
-        2drop
-    ] ifte* ;
+    4096 pick stream-read
+    [ over stream-write (stream-copy) ] [ 2drop ] ifte* ;
 
 : stream-copy ( in out -- )
     [ 2dup (stream-copy) ]
@@ -47,7 +42,7 @@ M: null-stream stream-readln drop f ;
 M: null-stream stream-read 2drop f ;
 M: null-stream stream-read1 drop f ;
 M: null-stream stream-write1 2drop ;
-M: null-stream stream-write-attr 3drop ;
+M: null-stream stream-format 3drop ;
 M: null-stream stream-close drop ;
 
 ! Sometimes, we want to have a delegating stream that uses stdio
index 8173cd93a67302d7706f5a75fec895f6d96db136..d0726ec0ae1ef5d046bc54abfd123241233ad419 100644 (file)
@@ -2,7 +2,7 @@ USING: io kernel math namespaces sequences strings ;
 
 ! String buffers support the stream output protocol.
 M: sbuf stream-write1 push ;
-M: sbuf stream-write-attr rot nappend drop ;
+M: sbuf stream-format rot nappend drop ;
 M: sbuf stream-close drop ;
 M: sbuf stream-flush drop ;
 M: sbuf stream-finish drop ;
index 396b52924c0cdbdb4cf9e14fdd3d617c0ad1ce90..8b5b373298f0ba12b4f4d55c40a3012c6eab2a23 100644 (file)
@@ -13,7 +13,7 @@ SYMBOL: recursion-check
 GENERIC: prettyprint* ( indent obj -- indent )
 
 : unparse. ( obj -- )
-    dup unparse swap presented swons unit write-attr ;
+    dup unparse swap presented swons unit format ;
 
 M: object prettyprint* ( indent obj -- indent )
     unparse. ;
index d78c981802f65063bb28a5e954d135b77c8842a2..01a4c93ca198c4e267ae290a2253b1bac85c1581 100644 (file)
@@ -20,7 +20,7 @@ streams strings styles unparser words ;
     \ inline prettyprint-prop ;
 
 : comment. ( comment -- )
-    [ [[ font-style italic ]] ] write-attr ;
+    [ [[ font-style italic ]] ] format ;
 
 : infer-effect. ( effect -- )
     [
index 89fd7243b1249e59ef4da751ceb42e70a6eb946d..6e06a44053901bf6f7f5dd8a7c7f20c019cf4e0e 100644 (file)
@@ -38,12 +38,12 @@ USING: html io kernel namespaces styles test ;
     ] string-out
 ] unit-test
 
-: html-write-attr ( string style -- string )
-    [ write-attr ] with-html-stream ;
+: html-format ( string style -- string )
+    [ format ] with-html-stream ;
 
 [ "hello world" ]
 [
-    [ "hello world" [ ] html-write-attr ] string-out
+    [ "hello world" [ ] html-format ] string-out
 ] unit-test
 
 [ "<span style='color: #ff00ff; font-family: Monospaced; '>car</span>" ]
@@ -51,7 +51,7 @@ USING: html io kernel namespaces styles test ;
     [
         "car"
         [ [ foreground 255 0 255 ] [[ font "Monospaced" ]] ]
-        html-write-attr
+        html-format
     ] string-out
 ] unit-test
 
index 6accf705010cf449fa17a2dff40e2f675bfa65c3..0f97c3578a06ed36963a753309f48dcb7a21244a 100644 (file)
@@ -4,7 +4,7 @@ USING: io kernel math parser strings test ;
 [ 4 ] [ "/library/test/io/no-trailing-eol.factor" run-resource ] unit-test
 
 : lines-test ( stream -- line1 line2 )
-    [ read-line read-line ] with-stream ;
+    [ readln readln ] with-stream ;
 
 [
     "This is a line."
index 78b742ef569d5d8c654254f936fb65f1fb4a8f7f..cf556e781040df3b9c714d0815ec8a5550f47e7b 100644 (file)
@@ -13,9 +13,9 @@ unparser words ;
 
 : jedit-server-info ( -- port auth )
     jedit-server-file <file-reader> [
-        read-line drop
-        read-line parse-number
-        read-line parse-number
+        readln drop
+        readln parse-number
+        readln parse-number
     ] with-stream ;
 
 : make-jedit-request ( files params -- code )
index 57066e8e1f986ef8701c1a3c414793818ef046ed..ea3e3a6c2deb6df7766d0adada2dc47071aeb445 100644 (file)
@@ -16,7 +16,7 @@ global [ "  " listener-prompt set ] bind
 
 : (read-multiline) ( quot depth -- quot ? )
     #! Flag indicates EOF.
-    >r read-line dup [
+    >r readln dup [
         (parse) depth r> dup >r <= [
             ( we're done ) r> drop t
         ] [
index 705a79d8037313d2dcfa96954f00ce070a03bdfe..7ae0e6017a3376d6f3bed28489c4702153fcb5ef 100644 (file)
@@ -101,7 +101,7 @@ M: pane stream-readln ( stream -- line )
 M: pane stream-write1 ( string style stream -- )
     [ rot ch>string unit pane-write ] keep scroll>bottom ;
 
-M: pane stream-write-attr ( string style stream -- )
+M: pane stream-format ( string style stream -- )
     [ rot "\n" split pane-write ] keep scroll>bottom ;
 
 M: pane stream-close ( stream -- ) drop ;
index 59ee9934d74c84046667de580221801893acafb5..561a3b841ad3b0276d46a665a5db694818a58ca1 100644 (file)
@@ -288,7 +288,7 @@ M: port stream-finish ( stream -- ) drop ;
 M: port stream-write1 ( char writer -- )
     1 over wait-to-write ch>buffer ;
 
-M: port stream-write-attr ( string style writer -- )
+M: port stream-format ( string style writer -- )
     nip over length over wait-to-write >buffer ;
 
 M: port stream-close ( stream -- )