]> gitweb.factorcode.org Git - factor.git/commitdiff
minor style cleanup
authorSlava Pestov <slava@factorcode.org>
Wed, 18 Jan 2006 23:50:52 +0000 (23:50 +0000)
committerSlava Pestov <slava@factorcode.org>
Wed, 18 Jan 2006 23:50:52 +0000 (23:50 +0000)
contrib/httpd/html.factor
doc/handbook/streams.facts [new file with mode: 0644]
examples/factoroids/factoroids.factor
library/io/styles.factor [new file with mode: 0644]
library/kernel.facts
library/styles.factor [deleted file]
library/ui/outliner.factor
library/ui/sliders.factor

index 6fb97cb766d3ba053720aa95ba028837267c1f6a..3a137f81a288710527bc8a1be398ebe522e9e7d2 100644 (file)
@@ -31,9 +31,6 @@ sequences strings styles words ;
     [ bold bold-italic ] member?
     [ "font-weight: bold; " % ] when ;
 
-: underline-css, ( flag -- )
-    [ "text-decoration: underline; " % ] when ;
-
 : size-css, ( size -- )
     "font-size: " % # "; " % ;
 
@@ -57,7 +54,6 @@ sequences strings styles words ;
             { font        [ font-css,      ] }
             { font-style  [ style-css,     ] }
             { font-size   [ size-css,      ] }
-            { underline   [ underline-css, ] }
         } hash-apply
     ] "" make ;
 
@@ -138,7 +134,6 @@ C: html-stream ( stream -- stream )
     #! font
     #! font-style
     #! font-size
-    #! underline
     #! file
     #! word
     #! vocab
diff --git a/doc/handbook/streams.facts b/doc/handbook/streams.facts
new file mode 100644 (file)
index 0000000..4dba28d
--- /dev/null
@@ -0,0 +1,70 @@
+USING: help io ;
+
+GLOSSARY: "stream" "an endpoint for input/output operations, supporting the " { $link "stream-protocol" } ;
+
+ARTICLE: "streams" "Streams"
+"Input and output centers on the concept of a " { $emphasis "stream" } ", which is a source or sink of characters. Streams also support formatted output, which may be used to present styled text in a manner independent of output medium."
+{ $subsection "stream-protocol" }
+{ $subsection "stream-utilities" }
+{ $subsection "stdio" }
+;
+
+GLOSSARY: "input stream" "an object responding to the input words of the " { $link "stream-protocol" } ;
+
+GLOSSARY: "output stream" "an object responding to the output words of the " { $link "stream-protocol" } ;
+
+GLOSSARY: "bidirectional stream" "an object that is both an input and output stream" } ;
+
+ARTICLE: "stream-protocol" "Stream protocol"
+"The stream protocol consits of a large number of generic words, many of which are optional."
+$terpri
+"A word required to be implemented for all streams:"
+{ $subsection stream-close }
+"Three words are required for input streams:"
+{ $subsection stream-read1 }
+{ $subsection stream-read }
+{ $subsection stream-readln }
+"If your stream supports the first two but not the last one, wrap it in a " { $link <line-reader> } " to get a default implementation."
+$terpri
+"Seven words are required for output streams:"
+{ $subsection stream-flush }
+{ $subsection stream-write1 }
+{ $subsection stream-write }
+{ $subsection stream-terpri }
+{ $subsection stream-terpri* }
+{ $subsection stream-format }
+{ $subsection with-nested-stream }
+"If your stream supports the first three but not the rest, wrap it in a " { $link <plain-writer> } ", which provides plain text implementations of the stream formatting words (the so called " { $emphasis "extended stream output protocol" } ")." ;
+
+ARTICLE: "stream-utils" "Stream utilities"
+"There are a few useful stream-related words which are not generic, but merely built up from the stream protocol."
+$terpri
+"First, a simple composition of " { $link stream-write } " and " { $link stream-terpri } ":"
+{ $subsection stream-print }
+"Next up, a pair of words for reading the entire contents of a stream as an array of lines, or a single string:"
+{ $subsection lines }
+{ $subsection contents }
+"Finally, a word to copy the contents of one stream to another:"
+{ $subsection stream-copy } ;
+
+GLOSSARY: "default stream" "see " { $link stdio } ;
+
+ARTICLE: "stdio" "The default stream"
+"Various words take an implicit stream parameter from the " { $link stdio } " variable to reduce stack shuffling. Unless rebound in a child namespace, this variable will be set to a console stream for interacting with the user."
+{ $link close }
+{ $subsection read1 }
+{ $subsection read }
+{ $subsection readln }
+{ $subsection flush }
+{ $subsection write1 }
+{ $subsection write }
+{ $subsection print }
+{ $subsection terpri }
+{ $subsection terpri* }
+{ $subsection format }
+{ $subsection with-nesting }
+"A pair of combinators support rebinding the " { $link stdio } " variable:"
+{ $subsection with-stream }
+{ $subsection with-stream* } ;
+
+
index 04fb203853c48df85174c91b18d62444af943158..41e3411ebcef11898dadc9b355ef008844597bbd 100644 (file)
@@ -11,7 +11,7 @@ IN: factoroids
 
 : draw-ground
     GL_DEPTH_TEST glDisable
-    black gl-color
+    { 0.0 0.0 0.0 1.0 } gl-color
     GL_QUADS [
         { -1000 0 -1000 } gl-vertex
         { -1000 0 1000 } gl-vertex
@@ -33,7 +33,7 @@ IN: factoroids
     ] do-matrix ;
 
 : draw-grid ( w h -- )
-    white gl-color [ swap [ grid-square ] each-with ] each-with ;
+    { 1.0 1.0 1.0 1.0 } gl-color [ swap [ grid-square ] each-with ] each-with ;
 
 : make-ground-list ( -- id )
     GL_COMPILE [ draw-ground 50 50 draw-grid ] make-dlist ;
diff --git a/library/io/styles.factor b/library/io/styles.factor
new file mode 100644 (file)
index 0000000..d3df557
--- /dev/null
@@ -0,0 +1,28 @@
+! Copyright (C) 2005, 2006 Slava Pestov.
+! See http://factorcode.org/license.txt for BSD license.
+IN: styles
+
+SYMBOL: plain
+SYMBOL: bold
+SYMBOL: italic
+SYMBOL: bold-italic
+
+! Character styles
+SYMBOL: foreground
+SYMBOL: background
+SYMBOL: font
+SYMBOL: font-size
+SYMBOL: font-style
+SYMBOL: presented
+SYMBOL: file
+SYMBOL: word-break
+
+! Paragraph styles
+SYMBOL: page-color
+SYMBOL: border-color
+SYMBOL: border-width
+SYMBOL: wrap-margin
+SYMBOL: outline
+
+! Input history
+TUPLE: input string ;
index 5599993894bdfd4ea50034e33c2aca58bf81b832..51995e6e9a8fbf982c31319b847cce169e7a0fa0 100644 (file)
@@ -203,14 +203,14 @@ $terpri
 "The following two lines are equivalent:"
 { $code "X [ Y ] [ Z ] if*" "X dup [ Y ] [ drop Z ] if" } } ;
 
-HELP: when* "( cond true false -- )"
+HELP: when* "( cond true -- )"
 { $values { "cond" "a generalized boolean" } { "true" "a quotation with stack effect " { $snippet "( cond -- )" } } }
 { $description "Variant of " { $link if* } " with no false quotation."
 $terpri
 "The following two lines are equivalent:"
 { $code "X [ Y ] when*" "X dup [ Y ] [ drop ] if" } } ;
 
-HELP: unless* "( cond true false -- )"
+HELP: unless* "( cond false -- )"
 { $values { "cond" "a generalized boolean" } { "false" "a quotation " } }
 { $description "Variant of " { $link if* } " with no true quotation."
 $terpri
diff --git a/library/styles.factor b/library/styles.factor
deleted file mode 100644 (file)
index e42f735..0000000
+++ /dev/null
@@ -1,47 +0,0 @@
-! Copyright (C) 2005, 2006 Slava Pestov.
-! See http://factor.sf.net/license.txt for BSD license.
-IN: styles
-
-! Colors are RGBA quadruples
-: black      { 0.0 0.0 0.0 1.0 } ;
-: dark-gray  { 0.25 0.25 0.25 1.0 } ;
-: gray       { 0.5 0.5 0.5 1.0 } ;
-: light-gray { 0.75 0.75 0.75 1.0 } ;
-: white      { 1.0 1.0 1.0 1.0 } ;
-: red        { 1.0 0.0 0.0 1.0 } ;
-: green      { 0.0 1.0 0.0 1.0 } ;
-: blue       { 0.0 0.0 1.0 1.0 } ;
-
-! Character styles
-
-SYMBOL: foreground ! Used for text and outline shapes.
-SYMBOL: background ! Used for filled shapes.
-
-SYMBOL: font
-SYMBOL: font-size
-SYMBOL: font-style
-
-SYMBOL: plain
-SYMBOL: bold
-SYMBOL: italic
-SYMBOL: bold-italic
-
-SYMBOL: underline
-
-SYMBOL: presented
-SYMBOL: file
-
-! A quotation that writes an outline expansion to stdio
-SYMBOL: outline
-
-! A word break inside a pragraph with wrap-margin set
-SYMBOL: word-break
-
-! Paragraph styles
-SYMBOL: page-color
-SYMBOL: border-color
-SYMBOL: border-width
-SYMBOL: wrap-margin
-
-! Input history
-TUPLE: input string ;
index 8defdda316c055e7375d74f62755ff5200e6e0e2..3cbf16c3031404922c613c73a3a8ef8b53869a75 100644 (file)
@@ -24,7 +24,7 @@ DEFER: <expand-button>
     [ outliner? ] find-parent ;
 
 : <expand-arrow> ( ? -- gadget )
-    arrow-right arrow-down ? gray swap
+    arrow-right arrow-down ? { 0.5 0.5 0.5 1.0 } swap
     <polygon-gadget> <default-border> ;
 
 : <expand-button> ( ? -- gadget )
index 88e961362a20d3836b18a6de64a2e8f3598adb51..150efa318c57f6e0d0d22ef494a97ea5af74f72b 100644 (file)
@@ -106,7 +106,7 @@ M: elevator layout* ( elevator -- )
 : slider-vertical? gadget-orientation { 0 1 0 } = ;
 
 : <slide-button> ( orientation polygon amount -- )
-    >r gray swap <polygon-gadget> r>
+    >r { 0.5 0.5 0.5 1.0 } swap <polygon-gadget> r>
     [ swap slide-by-line ] curry <repeat-button>
     [ set-gadget-orientation ] keep ;