From 16d524802acd0893fef05aec46ba35c51e438f24 Mon Sep 17 00:00:00 2001 From: Keita Haga Date: Fri, 4 Feb 2011 15:56:02 +0900 Subject: [PATCH 01/31] syntax: trim trailing whitespace to $syntax section in the HOOK:'s help page --- core/syntax/syntax-docs.factor | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/core/syntax/syntax-docs.factor b/core/syntax/syntax-docs.factor index 18434166b9..707f1276a0 100644 --- a/core/syntax/syntax-docs.factor +++ b/core/syntax/syntax-docs.factor @@ -716,7 +716,7 @@ HELP: MATH: { $description "Defines a new generic word which uses the " { $link math-combination } " method combination." } ; HELP: HOOK: -{ $syntax "HOOK: word variable ( stack -- effect ) " } +{ $syntax "HOOK: word variable ( stack -- effect )" } { $values { "word" "a new word to define" } { "variable" word } } { $description "Defines a new hook word in the current vocabulary. Hook words are generic words which dispatch on the value of a variable, so methods are defined with " { $link POSTPONE: M: } ". Hook words differ from other generic words in that the dispatch value is removed from the stack before the chosen method is called." } { $examples From 65773e520dec47c9ce49c1655167129b69a89013 Mon Sep 17 00:00:00 2001 From: Keita Haga Date: Fri, 4 Feb 2011 16:25:35 +0900 Subject: [PATCH 02/31] words: replace the trailing comma with a period in the article of words --- core/words/words-docs.factor | 18 +++++++++--------- 1 file changed, 9 insertions(+), 9 deletions(-) diff --git a/core/words/words-docs.factor b/core/words/words-docs.factor index 69933a913c..442bf29ead 100644 --- a/core/words/words-docs.factor +++ b/core/words/words-docs.factor @@ -98,17 +98,17 @@ $nl { { { $snippet "\"inline\"" } ", " { $snippet "\"foldable\"" } ", " { $snippet "flushable" } } { $link "declarations" } } { { $snippet "\"loc\"" } { "Location information - " { $link where } } } - + { { { $snippet "\"methods\"" } ", " { $snippet "\"combination\"" } } { "Set on generic words - " { $link "generic" } } } - + { { { $snippet "\"reading\"" } ", " { $snippet "\"writing\"" } } { "Set on slot accessor words - " { $link "slots" } } } { { $snippet "\"declared-effect\"" } { $link "effects" } } - + { { { $snippet "\"help\"" } ", " { $snippet "\"help-loc\"" } ", " { $snippet "\"help-parent\"" } } { "Where word help is stored - " { $link "writing-help" } } } { { $snippet "\"specializer\"" } { $link "hints" } } - + { { $snippet "\"predicating\"" } " Set on class predicates, stores the corresponding class word" } } "Properties which are defined for classes only:" @@ -117,13 +117,13 @@ $nl { { $snippet "\"class\"" } { "A boolean indicating whether this word is a class - " { $link "classes" } } } { { $snippet "\"coercer\"" } { "A quotation for converting the top of the stack to an instance of this class" } } - + { { $snippet "\"constructor\"" } { $link "tuple-constructors" } } - + { { $snippet "\"type\"" } { $link "builtin-classes" } } - + { { { $snippet "\"superclass\"" } ", " { $snippet "\"predicate-definition\"" } } { $link "predicates" } } - + { { $snippet "\"members\"" } { $link "unions" } } { { $snippet "\"slots\"" } { $link "slots" } } @@ -165,7 +165,7 @@ ARTICLE: "words" "Words" $nl "There are two ways of creating word definitions:" { $list - "using parsing words at parse time," + "using parsing words at parse time." "using defining words at run time." } "The latter is a more dynamic feature that can be used to implement code generation and such, and in fact parse time defining words are implemented in terms of run time defining words." From c997e43ca8e9ea40dabc97061da1daddf6968af2 Mon Sep 17 00:00:00 2001 From: Keita Haga Date: Fri, 4 Feb 2011 17:53:00 +0900 Subject: [PATCH 03/31] combinators: minor improvement to usage example of cond word --- core/combinators/combinators-docs.factor | 14 ++++++++------ 1 file changed, 8 insertions(+), 6 deletions(-) diff --git a/core/combinators/combinators-docs.factor b/core/combinators/combinators-docs.factor index 9c22221e70..f408a44257 100644 --- a/core/combinators/combinators-docs.factor +++ b/core/combinators/combinators-docs.factor @@ -326,12 +326,14 @@ HELP: cond } { $errors "Throws a " { $link no-cond } " error if none of the test quotations yield a true value." } { $examples - { $code - "{" - " { [ dup 0 > ] [ \"positive\" ] }" - " { [ dup 0 < ] [ \"negative\" ] }" - " [ \"zero\" ]" - "} cond" + { $example + "USING: combinators io kernel math ;" + "0 {" + " { [ dup 0 > ] [ drop \"positive\" ] }" + " { [ dup 0 < ] [ drop \"negative\" ] }" + " [ drop \"zero\" ]" + "} cond print" + "zero" } } ; From 19eb5d9689f7e34d0d6debd760d27e224edca089 Mon Sep 17 00:00:00 2001 From: Keita Haga Date: Fri, 4 Feb 2011 21:04:08 +0900 Subject: [PATCH 04/31] combinators: insert a space after a comma in the documentation --- core/combinators/combinators-docs.factor | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/core/combinators/combinators-docs.factor b/core/combinators/combinators-docs.factor index f408a44257..28ef4a764f 100644 --- a/core/combinators/combinators-docs.factor +++ b/core/combinators/combinators-docs.factor @@ -342,7 +342,7 @@ HELP: no-cond { $error-description "Thrown by " { $link cond } " if none of the test quotations yield a true value. Some uses of " { $link cond } " include a default case where the test quotation is " { $snippet "[ t ]" } "; such a " { $link cond } " form will never throw this error." } ; HELP: case -{ $values { "obj" object } { "assoc" "a sequence of object/word,quotation pairs, with an optional quotation at the end" } } +{ $values { "obj" object } { "assoc" "a sequence of object/word, quotation pairs, with an optional quotation at the end" } } { $description "Compares " { $snippet "obj" } " against the first element of every pair, first evaluating the first element if it is a word. If some pair matches, removes " { $snippet "obj" } " from the stack and calls the second element of that pair, which must be a quotation." $nl From fba461fe644348beb54de6d65e1d2c5aed056010 Mon Sep 17 00:00:00 2001 From: Keita Haga Date: Fri, 4 Feb 2011 22:53:05 +0900 Subject: [PATCH 05/31] help.topics: fix typo in docs --- basis/help/topics/topics-docs.factor | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/basis/help/topics/topics-docs.factor b/basis/help/topics/topics-docs.factor index 08195ee07d..720991a609 100644 --- a/basis/help/topics/topics-docs.factor +++ b/basis/help/topics/topics-docs.factor @@ -8,7 +8,7 @@ HELP: articles HELP: no-article { $values { "name" "an article name" } } { $description "Throws a " { $link no-article } " error." } -{ $error-description "Thrown by " { $link help } " if the given help topic does not exist, or if the help topic being dispayed links to a help topic which does not exist." } ; +{ $error-description "Thrown by " { $link help } " if the given help topic does not exist, or if the help topic being displayed links to a help topic which does not exist." } ; HELP: article { $values { "name" "an article name" } { "article" "an " { $link article } " object" } } From 90511c90af0320620d9210039be292613324dd92 Mon Sep 17 00:00:00 2001 From: Keita Haga Date: Sat, 5 Feb 2011 00:00:14 +0900 Subject: [PATCH 06/31] macros: clean up the usage example of MACRO: syntax --- basis/macros/macros-docs.factor | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/basis/macros/macros-docs.factor b/basis/macros/macros-docs.factor index 133509687f..91aa2fa3e5 100644 --- a/basis/macros/macros-docs.factor +++ b/basis/macros/macros-docs.factor @@ -16,9 +16,9 @@ HELP: MACRO: { $examples "A macro that calls a quotation but preserves any values it consumes off the stack:" { $code - "USING: fry generalizations ;" + "USING: fry generalizations kernel macros stack-checker ;" "MACRO: preserving ( quot -- )" - " [ infer in>> length ] keep '[ _ ndup @ ] ;" + " [ inputs ] keep '[ _ ndup @ ] ;" } "Using this macro, we can define a variant of " { $link if } " which takes a predicate quotation instead of a boolean; any values consumed by the predicate quotation are restored immediately after:" { $code From 032c9d061aa01fa15e5177fe75ab83bf1228c032 Mon Sep 17 00:00:00 2001 From: Keita Haga Date: Sun, 6 Feb 2011 17:05:20 +0900 Subject: [PATCH 07/31] colors.hex: fix typo in docs --- basis/colors/hex/hex-docs.factor | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/basis/colors/hex/hex-docs.factor b/basis/colors/hex/hex-docs.factor index ca49692200..9f67875da2 100644 --- a/basis/colors/hex/hex-docs.factor +++ b/basis/colors/hex/hex-docs.factor @@ -27,7 +27,7 @@ HELP: HEXCOLOR: ARTICLE: "colors.hex" "HEX colors" "The " { $vocab-link "colors.hex" } " vocabulary implements colors specified " -"by their hexidecimal value." +"by their hexadecimal value." { $subsections hex>rgba rgba>hex From 2696c59aabe3c4532bc477838fa94d803dce99c0 Mon Sep 17 00:00:00 2001 From: Keita Haga Date: Sun, 6 Feb 2011 17:40:03 +0900 Subject: [PATCH 08/31] io.sockets: fix a few typos in docs --- basis/io/sockets/sockets-docs.factor | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/basis/io/sockets/sockets-docs.factor b/basis/io/sockets/sockets-docs.factor index afd0ae1c44..ea95ae9726 100644 --- a/basis/io/sockets/sockets-docs.factor +++ b/basis/io/sockets/sockets-docs.factor @@ -110,7 +110,7 @@ HELP: local HELP: inet { $class-description "Host name/port number specifier for TCP/IP and UDP/IP connections. The " { $snippet "host" } " and " { $snippet "port" } " slots hold the host name and port name or number, respectively. New instances are created by calling " { $link } "." } { $notes - "This address specifier is only supported by " { $link } ", which calls " { $link resolve-host } " to obtain a list of IP addresses associated with the host name, and attempts a connection to each one in turn until one succeeds. Other network words do not accept this address specifier, and " { $link resolve-host } " must be called directly; it is then up to the application to pick the correct address from the (possibly several) addresses associated to the host name." + "This address specifier is only supported by " { $link } ", which calls " { $link resolve-host } " to obtain a list of IP addresses associated with the host name, and attempts a connection to each one in turn until one succeeds. Other network words do not accept this address specifier, and " { $link resolve-host } " must be called directly; it is then up to the application to pick the correct address from the (possibly several) addresses associated to the host name." } { $examples { $code "\"www.apple.com\" 80 " } @@ -143,7 +143,7 @@ HELP: { $description "Creates a new " { $link inet6 } " address specifier. A value of " { $link f } " as the host refers to localhost, while " { $link f } " as the port defers the port choice until a later time." } ; HELP: -{ $values { "remote" "an address specifier" } { "encoding" "an encding descriptor" } { "stream" "a bidirectional stream" } { "local" "an address specifier" } } +{ $values { "remote" "an address specifier" } { "encoding" "an encoding descriptor" } { "stream" "a bidirectional stream" } { "local" "an address specifier" } } { $description "Opens a network connection and outputs a bidirectional stream using the given encoding, together with the local address the socket was bound to." } { $errors "Throws an error if the connection cannot be established." } { $notes "The " { $link with-client } " word is easier to use in most situations." } @@ -157,7 +157,7 @@ HELP: with-client { $errors "Throws an error if the connection cannot be established." } ; HELP: -{ $values { "addrspec" "an address specifier" } { "encoding" "an encoding descriptor" } { "server" "a handle" } } +{ $values { "addrspec" "an address specifier" } { "encoding" "an encoding descriptor" } { "server" "a handle" } } { $description "Begins listening for network connections to a local address. Server objects respond to two words:" { $list @@ -225,7 +225,7 @@ HELP: with-local-address { $description "Client sockets opened within the scope of the quotation passed to this combinator will have their local address bound to the given address." } { $examples { "Binds the local address of a newly created client socket within the quotation to 127.0.0.1." - "This ensures that all traffic originates from the given address (the port is choosen by the TCP stack)." } + "This ensures that all traffic originates from the given address (the port is chosen by the TCP stack)." } { $code "\"127.0.0.1\" 0 [ ] with-local-address" } $nl { "Binds the local address of a newly created client socket within the quotation to the local address 192.168.0.1 and the local port 23000. " From 65de18993b33a167fd59edaf9caa7c3bd91024f3 Mon Sep 17 00:00:00 2001 From: Keita Haga Date: Mon, 7 Feb 2011 22:56:50 +0900 Subject: [PATCH 09/31] syntax: add stack effect declaration to word definition in usage example of C: syntax --- core/syntax/syntax-docs.factor | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/core/syntax/syntax-docs.factor b/core/syntax/syntax-docs.factor index 707f1276a0..2afefe1f2b 100644 --- a/core/syntax/syntax-docs.factor +++ b/core/syntax/syntax-docs.factor @@ -850,7 +850,7 @@ HELP: C: "The following two lines are equivalent:" { $code "C: color" - ": color boa ;" + ": ( red green blue -- color ) color boa ;" } "In both cases, a word " { $snippet "" } " is defined, which reads three values from the stack and creates a " { $snippet "color" } " instance having these values in the " { $snippet "red" } ", " { $snippet "green" } " and " { $snippet "blue" } " slots, respectively." } ; From a7665bc7fee48afa109bdfa15b86213353b2c799 Mon Sep 17 00:00:00 2001 From: Keita Haga Date: Mon, 7 Feb 2011 23:42:44 +0900 Subject: [PATCH 10/31] continuations: fix typo in docs --- core/continuations/continuations-docs.factor | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/core/continuations/continuations-docs.factor b/core/continuations/continuations-docs.factor index 300c9c63bc..b553c0c384 100644 --- a/core/continuations/continuations-docs.factor +++ b/core/continuations/continuations-docs.factor @@ -265,7 +265,7 @@ HELP: return HELP: with-return { $values { "quot" quotation } } -{ $description "Captures a continuation that can be reified by calling the " { $link return } " word. If so, it will resume execution immediatly after the " { $link with-return } " word. If " { $link return } " is not called, then execution proceeds as if this word were simply " { $link call } "." } +{ $description "Captures a continuation that can be reified by calling the " { $link return } " word. If so, it will resume execution immediately after the " { $link with-return } " word. If " { $link return } " is not called, then execution proceeds as if this word were simply " { $link call } "." } { $examples "Only \"Hi\" will print:" { $example From 27f1abd70e80f71940f685a6378d77db4574cf15 Mon Sep 17 00:00:00 2001 From: Keita Haga Date: Tue, 8 Feb 2011 00:35:15 +0900 Subject: [PATCH 11/31] assocs: fix a few typos in docs --- core/assocs/assocs-docs.factor | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/core/assocs/assocs-docs.factor b/core/assocs/assocs-docs.factor index 8098f91eee..f4c27776e2 100644 --- a/core/assocs/assocs-docs.factor +++ b/core/assocs/assocs-docs.factor @@ -323,7 +323,7 @@ HELP: assoc-stack HELP: value-at* { $values { "value" object } { "assoc" assoc } { "key/f" "the key associated to the value, or " { $link f } } { "?" boolean } } -{ $description "Looks up the key associated with a value. The boolean flag can decide beteen the case of a missing key, and a key of " { $link f } "." } ; +{ $description "Looks up the key associated with a value. The boolean flag can decide between the case of a missing key, and a key of " { $link f } "." } ; HELP: value-at { $values { "value" object } { "assoc" assoc } { "key/f" "the key associated to the value, or " { $link f } } } @@ -438,7 +438,7 @@ HELP: assoc-map-as { $values { "assoc" assoc } { "quot" { $quotation "( ... key value -- ... newkey newvalue )" } } { "exemplar" assoc } { "newassoc" assoc } } -{ $description "Applies the quotation to each entry in the input assoc and collects the results in a new assoc of the stame type as the exemplar." } +{ $description "Applies the quotation to each entry in the input assoc and collects the results in a new assoc of the same type as the exemplar." } { $examples { $example "USING: prettyprint assocs hashtables math ;" " H{ { 1 2 } { 3 4 } } [ sq ] { } assoc-map-as ." "{ { 1 4 } { 3 16 } }" } } ; HELP: extract-keys @@ -457,7 +457,7 @@ HELP: push-at { $values { "value" object } { "key" object } { "assoc" assoc } } { $description "Pushes the " { $snippet "value" } " onto a " { $snippet "vector" } " stored at the " { $snippet "key" } " in the " { $snippet "assoc" } ". If the " { $snippet "key" } " does not yet exist, creates a new " { $snippet "vector" } " at that " { $snippet "key" } " and pushes the " { $snippet "value" } "." } -{ $examples { $example "USING: prettyprint assocs kernel ;" +{ $examples { $example "USING: prettyprint assocs kernel ;" "H{ { \"cats\" V{ \"Mittens\" } } } \"Mew\" \"cats\" pick push-at ." "H{ { \"cats\" V{ \"Mittens\" \"Mew\" } } }" } } ; @@ -467,7 +467,7 @@ HELP: search-alist { "key" object } { "alist" "an array of key/value pairs" } { "pair/f" "a key/value pair" } { "i/f" integer } } { $description "Iterates over " { $snippet "alist" } " and stops when the key is matched or the end of the " { $snippet "alist" } " has been reached. If there is no match, both outputs are " { $link f } "." } -{ $notes "This word is used to implement " { $link at* } " and " { $link set-at } " on sequences, and should not be called direclty." } +{ $notes "This word is used to implement " { $link at* } " and " { $link set-at } " on sequences, and should not be called directly." } { $examples { $example "USING: prettyprint assocs.private kernel ;" "3 { { 1 2 } { 3 4 } } search-alist [ . ] bi@" "{ 3 4 }\n1" From 073eda332a7ec5aef6d6c18cfb9bac807d8c2f70 Mon Sep 17 00:00:00 2001 From: Keita Haga Date: Thu, 10 Feb 2011 01:51:13 +0900 Subject: [PATCH 12/31] In several documentation, remove whitespace before or after the colon or period --- .../distributed/distributed-docs.factor | 4 ++-- basis/http/http-docs.factor | 4 ++-- basis/math/vectors/vectors-docs.factor | 2 +- basis/peg/ebnf/ebnf-docs.factor | 12 ++++++------ basis/stack-checker/stack-checker-docs.factor | 2 +- core/classes/classes-docs.factor | 8 ++++---- extra/images/viewer/viewer-docs.factor | 16 ++++++++-------- 7 files changed, 24 insertions(+), 24 deletions(-) diff --git a/basis/concurrency/distributed/distributed-docs.factor b/basis/concurrency/distributed/distributed-docs.factor index 80e07027ce..19cfef8872 100644 --- a/basis/concurrency/distributed/distributed-docs.factor +++ b/basis/concurrency/distributed/distributed-docs.factor @@ -4,7 +4,7 @@ IN: concurrency.distributed ARTICLE: "concurrency.distributed.example" "Distributed Concurrency Example" "In this example the Factor instance associated with port 9000 will run " "a thread that receives and prints messages " -"in the listener. The code to start the thread is: " +"in the listener. The code to start the thread is:" { $examples { $unchecked-example ": log-message ( -- ) receive . flush log-message ;" @@ -40,7 +40,7 @@ ARTICLE: "concurrency.distributed" "Distributed message passing" "The " { $vocab-link "concurrency.distributed" } " implements transparent distributed message passing, inspired by Erlang and Termite." $nl "Instances of " { $link thread } " can be sent to remote threads, at which point they are converted to objects holding the thread ID and the current node's host name:" { $subsections remote-thread } -"The " { $vocab-link "serialize" } " vocabulary is used to convert Factor objects to byte arrays for transfer over a socket." +"The " { $vocab-link "serialize" } " vocabulary is used to convert Factor objects to byte arrays for transfer over a socket." { $subsections "concurrency.distributed.example" } ; ABOUT: "concurrency.distributed" diff --git a/basis/http/http-docs.factor b/basis/http/http-docs.factor index a9695c667a..fb2e003c41 100644 --- a/basis/http/http-docs.factor +++ b/basis/http/http-docs.factor @@ -17,7 +17,7 @@ $nl { { $slot "header" } { "An assoc of HTTP header values. See " { $link "http.headers" } } } { { $slot "post-data" } { "See " { $link "http.post-data" } } } { { $slot "cookies" } { "A sequence of HTTP cookies. See " { $link "http.cookies" } } } - { { $slot "redirects" } { "Number of redirects to attempt before throwing an error. Default is " { $snippet "max-redirects" } " ." } } + { { $slot "redirects" } { "Number of redirects to attempt before throwing an error. Default is " { $snippet "max-redirects" } "." } } } } ; HELP: @@ -105,7 +105,7 @@ $nl "Instances contain the following slots:" { $table { { $slot "data" } { "The POST data. This can be in a higher-level form, such as an assoc of POST parameters, a string, or an XML document" } } - { { $slot "params" } { "Parameters passed in the POST request." } } + { { $slot "params" } { "Parameters passed in the POST request." } } { { $slot "content-type" } { "A MIME type" } } { { $slot "content-encoding" } { "Encoding used for the POST data" } } } } ; diff --git a/basis/math/vectors/vectors-docs.factor b/basis/math/vectors/vectors-docs.factor index 59246a6e64..3c8e6ae336 100644 --- a/basis/math/vectors/vectors-docs.factor +++ b/basis/math/vectors/vectors-docs.factor @@ -150,7 +150,7 @@ int-4{ f f t f } .""" $nl "Providing a SIMD boolean vector with element values other than the proper true and false representations as an input to the vector logical or test operations is undefined. Do not count on operations such as " { $link vall? } " or " { $link v? } " using bitwise operations to construct their results." $nl -"This applies to the output of the following element comparison words: " +"This applies to the output of the following element comparison words:" { $list { $link v< } { $link v<= } diff --git a/basis/peg/ebnf/ebnf-docs.factor b/basis/peg/ebnf/ebnf-docs.factor index 7b740a4dc3..b03ec45526 100644 --- a/basis/peg/ebnf/ebnf-docs.factor +++ b/basis/peg/ebnf/ebnf-docs.factor @@ -319,7 +319,7 @@ ARTICLE: "peg.ebnf.tokenizers" "Tokenizers" "This parser when run with the string \"++--\" or the array " "{ CHAR: + CHAR: + CHAR: - CHAR: - } will succeed with an AST of { \"++\" \"--\" }. " "If you want to add whitespace handling to the grammar you need to put it " -"between the terminals: " +"between the terminals:" { $examples { $code "EBNF: foo" @@ -332,7 +332,7 @@ ARTICLE: "peg.ebnf.tokenizers" "Tokenizers" "In a large grammar this gets tedious and makes the grammar hard to read. " "Instead you can write a rule to split the input sequence into tokens, and " "have the grammar operate on these tokens. This is how the previous example " -"might look: " +"might look:" { $examples { $code "EBNF: foo" @@ -355,7 +355,7 @@ ARTICLE: "peg.ebnf.tokenizers" "Tokenizers" $nl "In this example I split the tokenizer into a separate parser and use " "'foreign' to call it from the main one. This allows testing of the " -"tokenizer separately: " +"tokenizer separately:" { $examples { $example "USING: prettyprint peg peg.ebnf kernel math.parser strings" @@ -397,7 +397,7 @@ $nl "working in one pass. There is no tokenization occurring over the whole string " "followed by the parse of that result. It tokenizes as it needs to. You can even " "switch tokenizers multiple times during a grammar. Rules use the tokenizer that " -"was defined lexically before the rule. This is usefull in the JavaScript grammar: " +"was defined lexically before the rule. This is usefull in the JavaScript grammar:" { $examples { $code "EBNF: javascript" @@ -440,7 +440,7 @@ ARTICLE: "peg.ebnf" "EBNF" POSTPONE: [EBNF POSTPONE: EBNF: } -"The EBNF syntax is composed of a series of rules of the form: " +"The EBNF syntax is composed of a series of rules of the form:" { $code "rule1 = ..." "rule2 = ..." @@ -448,7 +448,7 @@ ARTICLE: "peg.ebnf" "EBNF" "The last defined rule is the main rule for the EBNF. It is the first one run " "and it is expected that the remaining rules are used by that rule. Rules may be " "left recursive. " -"Each rule can contain the following: " +"Each rule can contain the following:" { $subsections "peg.ebnf.strings" "peg.ebnf.any" "peg.ebnf.sequence" diff --git a/basis/stack-checker/stack-checker-docs.factor b/basis/stack-checker/stack-checker-docs.factor index 6b3bdd354f..620b3759a2 100644 --- a/basis/stack-checker/stack-checker-docs.factor +++ b/basis/stack-checker/stack-checker-docs.factor @@ -48,7 +48,7 @@ ARTICLE: "inference-combinators" "Combinator stack effects" ": perform ( value action -- result ) quot>> call( value -- result ) ;" } { $subheading "Passing an unknown quotation to an inline combinator" } -"Suppose we want to write :" +"Suppose we want to write:" { $code ": perform ( values action -- results ) quot>> map ;" } "However this fails to pass the stack checker since there is no guarantee the quotation has the right stack effect for " { $link map } ". It can be wrapped in a new quotation with a declaration:" { $code ": perform ( values action -- results )" " quot>> [ call( value -- result ) ] curry map ;" } diff --git a/core/classes/classes-docs.factor b/core/classes/classes-docs.factor index afcb42b111..1c5bec6716 100644 --- a/core/classes/classes-docs.factor +++ b/core/classes/classes-docs.factor @@ -5,7 +5,7 @@ classes.predicate quotations ; IN: classes ARTICLE: "class-predicates" "Class predicate words" -"With a handful of exceptions, each class has a membership predicate word, named " { $snippet { $emphasis "class" } "?" } " . A quotation calling this predicate is stored in the " { $snippet "\"predicate\"" } " word property." +"With a handful of exceptions, each class has a membership predicate word, named " { $snippet { $emphasis "class" } "?" } ". A quotation calling this predicate is stored in the " { $snippet "\"predicate\"" } " word property." $nl "When it comes to predicates, the exceptional classes are:" { $table @@ -94,7 +94,7 @@ $low-level-note ; HELP: superclass { $values { "class" class } { "super" class } } { $description "Outputs the superclass of a class. All instances of this class are also instances of the superclass." } -{ $examples +{ $examples { $example "USING: classes prettyprint ;" "t superclass ." "word" @@ -106,7 +106,7 @@ HELP: superclasses { "class" class } { "supers" sequence } } { $description "Outputs a sequence of superclasses of a class along with the class itself." } -{ $examples +{ $examples { $example "USING: classes prettyprint ;" "t superclasses ." "{ word t }" @@ -120,7 +120,7 @@ HELP: subclass-of? { "?" boolean } } { $description "Outputs a boolean value indicating whether " { $snippet "class" } " is at any level a subclass of " { $snippet "superclass" } "." } -{ $examples +{ $examples { $example "USING: classes classes.tuple prettyprint words ;" "tuple-class \\ class subclass-of? ." "t" diff --git a/extra/images/viewer/viewer-docs.factor b/extra/images/viewer/viewer-docs.factor index 1d24bef2e3..4e1b005276 100644 --- a/extra/images/viewer/viewer-docs.factor +++ b/extra/images/viewer/viewer-docs.factor @@ -1,6 +1,6 @@ ! Copyright (C) 2010 Jon Harper. ! See http://factorcode.org/license.txt for BSD license. -USING: help.markup help.syntax kernel strings io.pathnames images +USING: help.markup help.syntax kernel strings io.pathnames images models opengl.textures classes ui.gadgets ; IN: images.viewer @@ -69,10 +69,10 @@ HELP: stop-control } { $description "Removes the connection between the gadget and it's model" } ; ARTICLE: "images.viewer" "Displaying Images" -"The " { $vocab-link "images.viewer" } " vocabulary uses the " { $vocab-link "opengl.textures" } -" vocabulary to display any instance of " { $link image } "."$nl -"An " { $link image-gadget } " can be used for static images and " { $instance image-control } -" for changing images (for example a video feed). For changing images, the image should be containted in " { $instance model } +"The " { $vocab-link "images.viewer" } " vocabulary uses the " { $vocab-link "opengl.textures" } +" vocabulary to display any instance of " { $link image } "."$nl +"An " { $link image-gadget } " can be used for static images and " { $instance image-control } +" for changing images (for example a video feed). For changing images, the image should be containted in " { $instance model } ". Change the model value with " { $link set-model } " or mutate the image and call " { $link notify-connections } " when you want to update the image. To stop refreshing the image, call " { $link stop-control } "." " To start refreshing again, call " { $link start-control } "." @@ -83,19 +83,19 @@ $nl { $subsections } "The " { $link image } " or " { $link model } " can also be given after the construction of the object. In this case, use " -{ $link new-image-gadget } " and " { $link set-image } "." +{ $link new-image-gadget } " and " { $link set-image } "." " The gadget will automatically detect if the image changes size or format and reallocate a new texture if needed." " This means images can be set even after the gadget has been grafted. Grafted gadgets without an image will display a blank screen." { $notes "The image can be set after the gadget has been grafted. However, for " { $instance image-gadget } ", this can " -" be done only once. If your image is changing, you should be using " { $instance image-control } " and " { $instance model } "." +" be done only once. If your image is changing, you should be using " { $instance image-control } " and " { $instance model } "." $nl " Performance will be greatly reduced if you are using images that have more than 512 pixels on one of their" " axis." } $nl -"Utility words for displaying images :" +"Utility words for displaying images:" { $subsections image. image-window } From 5a71a0d67167523071c4a66d711496b0557329a4 Mon Sep 17 00:00:00 2001 From: Keita Haga Date: Sun, 20 Feb 2011 03:08:01 +0900 Subject: [PATCH 13/31] math.combinatorics: fix typo in docs --- basis/math/combinatorics/combinatorics-docs.factor | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/basis/math/combinatorics/combinatorics-docs.factor b/basis/math/combinatorics/combinatorics-docs.factor index 75a54c2300..9b2a29bd73 100644 --- a/basis/math/combinatorics/combinatorics-docs.factor +++ b/basis/math/combinatorics/combinatorics-docs.factor @@ -4,7 +4,7 @@ IN: math.combinatorics HELP: factorial { $values { "n" "a non-negative integer" } { "n!" integer } } { $description "Outputs the product of all positive integers less than or equal to " { $snippet "n" } "." } -{ $examples +{ $examples { $example "USING: math.combinatorics prettyprint ;" "4 factorial ." "24" } } ; @@ -46,7 +46,7 @@ HELP: all-permutations HELP: each-permutation { $values { "seq" sequence } { "quot" { $quotation "( seq -- )" } } } -{ $description "Applies the quotation to each permuation of " { $snippet "seq" } " in order." } ; +{ $description "Applies the quotation to each permutation of " { $snippet "seq" } " in order." } ; HELP: inverse-permutation { $values { "seq" sequence } { "permutation" sequence } } @@ -121,7 +121,7 @@ HELP: selections { $description "Returns all the ways to take n (possibly the same) items from the " "sequence of items." -} +} { $examples { $example "USING: math.combinatorics prettyprint ;" From 70d06dc4c77c4b551b2eeadb0a5771c3d9c8f969 Mon Sep 17 00:00:00 2001 From: Keita Haga Date: Sun, 20 Feb 2011 03:38:54 +0900 Subject: [PATCH 14/31] combinators.random: fix a couple of usage examples in casep and casep* --- basis/combinators/random/random-docs.factor | 40 ++++++++++++--------- 1 file changed, 24 insertions(+), 16 deletions(-) diff --git a/basis/combinators/random/random-docs.factor b/basis/combinators/random/random-docs.factor index 2fc0b8c00e..826474420c 100644 --- a/basis/combinators/random/random-docs.factor +++ b/basis/combinators/random/random-docs.factor @@ -32,17 +32,21 @@ HELP: casep { $examples "The following two forms will output 1 with 0.2 probability, 2 with 0.3 probability and 3 with 0.5 probability" { $code - "USING: combinators.random ;" - "{ { 0.2 [ 1 ] }" - " { 0.3 [ 2 ] }" - " { 0.5 [ 3 ] } } casep ." + "USING: combinators.random prettyprint ;" + "{" + " { 0.2 [ 1 ] }" + " { 0.3 [ 2 ] }" + " { 0.5 [ 3 ] }" + "} casep ." } $nl { $code - "USING: combinators.random ;" - "{ { 0.2 [ 1 ] }" - " { 0.3 [ 2 ] }" - " { [ 3 ] } } casep ." + "USING: combinators.random prettyprint ;" + "{" + " { 0.2 [ 1 ] }" + " { 0.3 [ 2 ] }" + " [ 3 ]" + "} casep ." } } @@ -62,17 +66,21 @@ HELP: casep* { $examples "The following two forms will output 1 with 0.5 probability, 2 with 0.25 probability and 3 with 0.25 probability" { $code - "USING: combinators.random ;" - "{ { 0.5 [ 1 ] }" - " { 0.5 [ 2 ] }" - " { 1 [ 3 ] } } casep* ." + "USING: combinators.random prettyprint ;" + "{" + " { 0.5 [ 1 ] }" + " { 0.5 [ 2 ] }" + " { 1 [ 3 ] }" + "} casep* ." } $nl { $code - "USING: combinators.random ;" - "{ { 0.5 [ 1 ] }" - " { 0.5 [ 2 ] }" - " { [ 3 ] } } casep* ." + "USING: combinators.random prettyprint ;" + "{" + " { 0.5 [ 1 ] }" + " { 0.5 [ 2 ] }" + " [ 3 ]" + "} casep* ." } } From 77922f61f7d8e8a7355a1af336b9a8a86995652b Mon Sep 17 00:00:00 2001 From: Keita Haga Date: Sun, 20 Feb 2011 04:08:45 +0900 Subject: [PATCH 15/31] environment: add using list to usage example of os-env word --- basis/environment/environment-docs.factor | 8 ++++++-- 1 file changed, 6 insertions(+), 2 deletions(-) diff --git a/basis/environment/environment-docs.factor b/basis/environment/environment-docs.factor index 3df3a8da8f..7e08a78920 100644 --- a/basis/environment/environment-docs.factor +++ b/basis/environment/environment-docs.factor @@ -5,7 +5,7 @@ IN: environment HELP: (os-envs) { $values - + { "seq" sequence } } { $description "Returns a sequence of key/value pairs from the operating system." } { $notes "In most cases, use " { $link os-envs } " instead." } ; @@ -22,7 +22,11 @@ HELP: os-env { $description "Looks up the value of a shell environment variable." } { $examples "This is an operating system-specific feature. On Unix, you can do:" - { $unchecked-example "\"USER\" os-env print" "jane" } + { $unchecked-example + "USING: environment io ;" + "\"USER\" os-env print" + "jane" + } } ; HELP: os-envs From 42ef23feed041ef5e7d5d1cf9edeb5388b7fad45 Mon Sep 17 00:00:00 2001 From: Keita Haga Date: Sun, 20 Feb 2011 04:53:35 +0900 Subject: [PATCH 16/31] definitions: import of make vocab in refactored a.factor --- core/definitions/definitions-docs.factor | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/core/definitions/definitions-docs.factor b/core/definitions/definitions-docs.factor index 049104e61c..390ecd1b73 100644 --- a/core/definitions/definitions-docs.factor +++ b/core/definitions/definitions-docs.factor @@ -34,7 +34,7 @@ $nl $nl "Now, after some heavily editing and refactoring, the file looks like this:" { $code - "USING: namespaces ;" + "USING: make namespaces ;" "IN: a" ": hello ( -- ) \"Hello\" % ;" ": hello-world ( -- str ) [ hello \" \" % world ] \"\" make ;" From 93b3cc0a930011f6058bb4a9529d4cbc7389b1bc Mon Sep 17 00:00:00 2001 From: Keita Haga Date: Sun, 20 Feb 2011 06:11:31 +0900 Subject: [PATCH 17/31] io.styles: remove a nl in usage example of background --- basis/io/styles/styles-docs.factor | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/basis/io/styles/styles-docs.factor b/basis/io/styles/styles-docs.factor index 98338639bb..437bcfe9bb 100644 --- a/basis/io/styles/styles-docs.factor +++ b/basis/io/styles/styles-docs.factor @@ -221,7 +221,7 @@ HELP: background "10 iota [" " \"Hello world\\n\"" " swap 10 / 1 over - over 1 " - " background associate format nl" + " background associate format" "] each" } } ; From 7703d7323094ee01a9d370e2808d48d7fc3584fe Mon Sep 17 00:00:00 2001 From: Keita Haga Date: Sun, 20 Feb 2011 09:16:41 +0900 Subject: [PATCH 18/31] locals: remove trailing whitespace in docs --- basis/locals/locals-docs.factor | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/basis/locals/locals-docs.factor b/basis/locals/locals-docs.factor index 69a7ef25f6..b2275360c7 100644 --- a/basis/locals/locals-docs.factor +++ b/basis/locals/locals-docs.factor @@ -55,7 +55,7 @@ $nl { $examples "See " { $link "locals-examples" } "." } ; { POSTPONE: MEMO: POSTPONE: MEMO:: } related-words - + HELP: M:: { $syntax "M:: class generic ( vars... -- outputs... ) body... ;" } { $description "Defines a new method on " { $snippet "generic" } " for " { $snippet "class" } " with named inputs. The method binds its input values to lexical variables from left to right, then executes the body with those bindings in scope." @@ -127,7 +127,7 @@ TUPLE: counter adder subtractor ; [ adder>> call . ] [ adder>> call . ] -[ subtractor>> call . ] tri """ +[ subtractor>> call . ] tri""" """1 2 1""" @@ -149,7 +149,7 @@ mutable-example [ call . ] bi@""" 6 6 6""" -} +} "In " { $snippet "rebinding-example" } ", the binding of " { $snippet "a" } " to " { $snippet "5" } " is closed over in the first quotation, and the binding of " { $snippet "a" } " to " { $snippet "6" } " is closed over in the second, so calling both quotations results in " { $snippet "5" } " and " { $snippet "6" } " respectively. By contrast, in " { $snippet "mutable-example" } ", both quotations close over a single binding of " { $snippet "a" } ". Even though " { $snippet "a" } " is assigned to " { $snippet "6" } " after the first quotation is made, calling either quotation will output the new value of " { $snippet "a" } "." { $heading "Lexical variables in literals" } "Some kinds of literals can include references to lexical variables as described in " { $link "locals-literals" } ". For example, the " { $link 3array } " word could be implemented as follows:" @@ -161,7 +161,7 @@ IN: scratchpad 1 "two" 3.0 my-3array .""" """{ 1 "two" 3.0 }""" } ; - + ARTICLE: "locals-literals" "Lexical variables in literals" "Certain data type literals are permitted to contain lexical variables. Any such literals are rewritten into code which constructs an instance of the type with the values of the variables spliced in. Conceptually, this is similar to the transformation applied to quotations containing free variables." $nl From 32e3e1cfefd43db7cbd4f2064c693f3500d1eee2 Mon Sep 17 00:00:00 2001 From: Keita Haga Date: Sun, 20 Feb 2011 15:58:57 +0900 Subject: [PATCH 19/31] ui.tools.listener: highlighting F1 key in tips --- basis/ui/tools/listener/listener-docs.factor | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/basis/ui/tools/listener/listener-docs.factor b/basis/ui/tools/listener/listener-docs.factor index 966ac37d30..fd09e60266 100644 --- a/basis/ui/tools/listener/listener-docs.factor +++ b/basis/ui/tools/listener/listener-docs.factor @@ -32,7 +32,7 @@ $nl { $heading "Implementation" } "Listeners are instances of " { $link listener-gadget } ". The listener consists of an output area (instance of " { $link pane } ") and an input area (instance of " { $link interactor } "). Clickable presentations can also be printed to the listener; see " { $link "ui-presentations" } "." ; -TIP: "You can read documentation by pressing F1." ; +TIP: "You can read documentation by pressing " { $snippet "F1" } "." ; TIP: "The listener tool remembers previous lines of input. Press " { $command interactor "completion" recall-previous } " and " { $command interactor "completion" recall-next } " to cycle through them." ; From e374d55d0993fbbbbe2247e31b9b5f981005433f Mon Sep 17 00:00:00 2001 From: Keita Haga Date: Mon, 21 Feb 2011 02:46:06 +0900 Subject: [PATCH 20/31] io.encodings.8-bit.latin9, io.encodings.shift-jis: fix typo in docs. offical => official --- basis/io/encodings/8-bit/latin9/latin9-docs.factor | 4 ++-- basis/io/encodings/shift-jis/shift-jis-docs.factor | 2 +- 2 files changed, 3 insertions(+), 3 deletions(-) diff --git a/basis/io/encodings/8-bit/latin9/latin9-docs.factor b/basis/io/encodings/8-bit/latin9/latin9-docs.factor index 2416db382f..ffb19280c5 100644 --- a/basis/io/encodings/8-bit/latin9/latin9-docs.factor +++ b/basis/io/encodings/8-bit/latin9/latin9-docs.factor @@ -4,10 +4,10 @@ USING: help.markup help.syntax ; IN: io.encodings.8-bit.latin9 HELP: latin9 -{ $var-description "This is the ISO-8859-15 encoding, also called Latin-9 and unoffically as Latin-0. It is an 8-bit superset of ASCII designed as a modification of Latin-1, removing little-used characters in favor of the Euro symbol and other characters." } +{ $var-description "This is the ISO-8859-15 encoding, also called Latin-9 and unofficially as Latin-0. It is an 8-bit superset of ASCII designed as a modification of Latin-1, removing little-used characters in favor of the Euro symbol and other characters." } { $see-also "encodings-introduction" } ; ARTICLE: "io.encodings.8-bit.latin9" "Latin9 encoding" -"The " { $vocab-link "io.encodings.8-bit.latin9" } " vocabulary provides the " { $link latin9 } " encoding." ; +"The " { $vocab-link "io.encodings.8-bit.latin9" } " vocabulary provides the " { $link latin9 } " encoding." ; ABOUT: "io.encodings.8-bit.latin9" diff --git a/basis/io/encodings/shift-jis/shift-jis-docs.factor b/basis/io/encodings/shift-jis/shift-jis-docs.factor index b8f5603200..50a553c948 100644 --- a/basis/io/encodings/shift-jis/shift-jis-docs.factor +++ b/basis/io/encodings/shift-jis/shift-jis-docs.factor @@ -4,7 +4,7 @@ USING: help.markup help.syntax ; IN: io.encodings.shift-jis ARTICLE: "io.encodings.shift-jis" "Shift JIS" -"Shift JIS is a text encoding for Japanese. There are multiple versions, depending on whether the offical standard or the modified Microsoft version is required." +"Shift JIS is a text encoding for Japanese. There are multiple versions, depending on whether the official standard or the modified Microsoft version is required." { $subsections shift-jis windows-31j From f515dd2cfcc8644b3a02bdc3f05f1a22916b0e8c Mon Sep 17 00:00:00 2001 From: Keita Haga Date: Thu, 24 Feb 2011 15:37:41 +0900 Subject: [PATCH 21/31] definitions: remove unused vocabulary in refactored a.factor --- core/definitions/definitions-docs.factor | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/core/definitions/definitions-docs.factor b/core/definitions/definitions-docs.factor index 390ecd1b73..d92c250faf 100644 --- a/core/definitions/definitions-docs.factor +++ b/core/definitions/definitions-docs.factor @@ -34,7 +34,7 @@ $nl $nl "Now, after some heavily editing and refactoring, the file looks like this:" { $code - "USING: make namespaces ;" + "USING: make ;" "IN: a" ": hello ( -- ) \"Hello\" % ;" ": hello-world ( -- str ) [ hello \" \" % world ] \"\" make ;" From 4c864999e4a2afb36db4d193849a554c1bb1f155 Mon Sep 17 00:00:00 2001 From: Keita Haga Date: Fri, 25 Feb 2011 19:59:44 +0900 Subject: [PATCH 22/31] lists: fix a few typos in docs --- basis/lists/lists-docs.factor | 20 ++++++++++---------- 1 file changed, 10 insertions(+), 10 deletions(-) diff --git a/basis/lists/lists-docs.factor b/basis/lists/lists-docs.factor index a3056b0332..bb47d31fcf 100644 --- a/basis/lists/lists-docs.factor +++ b/basis/lists/lists-docs.factor @@ -62,11 +62,11 @@ ARTICLE: { "lists" "manipulation" } "Manipulating lists" lcut } ; -HELP: cons +HELP: cons { $values { "car" "the head of the list cell" } { "cdr" "the tail of the list cell" } { "cons" list } } { $description "Constructs a cons cell." } ; -HELP: swons +HELP: swons { $values { "cdr" "the tail of the list cell" } { "car" "the head of the list cell" } { "cons" list } } { $description "Constructs a cons cell." } ; @@ -82,11 +82,11 @@ HELP: cdr { car cdr } related-words -HELP: nil +HELP: nil { $values { "symbol" "The empty cons (+nil+)" } } { $description "Returns a symbol representing the empty list" } ; -HELP: nil? +HELP: nil? { $values { "object" object } { "?" "a boolean" } } { $description "Return true if the cons object is the nil cons." } ; @@ -108,12 +108,12 @@ HELP: 3list HELP: lnth { $values { "n" "an integer index" } { "list" list } { "elt" "the element at the nth index" } } -{ $description "Outputs the nth element of the list." } +{ $description "Outputs the nth element of the list." } { $see-also llength cons car cdr } ; HELP: llength { $values { "list" list } { "n" "a non-negative integer" } } -{ $description "Outputs the length of the list. This should not be called on an infinite list." } +{ $description "Outputs the length of the list. This should not be called on an infinite list." } { $see-also lnth cons car cdr } ; HELP: uncons @@ -132,11 +132,11 @@ HELP: leach HELP: foldl { $values { "list" list } { "identity" "an object" } { "quot" { $quotation "( ... prev elt -- ... next )" } } { "result" "the final result" } } -{ $description "Combines successive elements of the list (in a left-assocative order) using a binary operation and outputs the final result." } ; +{ $description "Combines successive elements of the list (in a left-associative order) using a binary operation and outputs the final result." } ; HELP: foldr { $values { "list" list } { "identity" "an object" } { "quot" { $quotation "( ... prev elt -- ... next )" } } { "result" "the final result" } } -{ $description "Combines successive elements of the list (in a right-assocative order) using a binary operation, and outputs the final result." } ; +{ $description "Combines successive elements of the list (in a right-associative order) using a binary operation, and outputs the final result." } ; HELP: lmap { $values { "list" list } { "quot" { $quotation "( ... elt -- ... newelt )" } } { "result" "the final result" } } @@ -144,9 +144,9 @@ HELP: lmap HELP: lreverse { $values { "list" list } { "newlist" list } } -{ $description "Reverses the input list, outputing a new, reversed list. The output is a strict cons list." } ; +{ $description "Reverses the input list, outputting a new, reversed list. The output is a strict cons list." } ; -HELP: list>array +HELP: list>array { $values { "list" list } { "array" array } } { $description "Convert a list into an array." } ; From c10d0377631396fa9949ee3d412d48a23972fc03 Mon Sep 17 00:00:00 2001 From: Joe Groff Date: Fri, 25 Feb 2011 10:22:14 -0800 Subject: [PATCH 23/31] bunny.model, gpu.demos.bunny: update url for bunny model download --- extra/bunny/model/model.factor | 2 +- extra/gpu/demos/bunny/bunny.factor | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/extra/bunny/model/model.factor b/extra/bunny/model/model.factor index 0f22b531c6..4d3c80cbaa 100644 --- a/extra/bunny/model/model.factor +++ b/extra/bunny/model/model.factor @@ -42,7 +42,7 @@ IN: bunny.model : model-path ( -- path ) "bun_zipper.ply" temp-file ; -: model-url ( -- url ) "http://factorcode.org/slava/bun_zipper.ply" ; +: model-url ( -- url ) "http://duriansoftware.com/joe/media/bun_zipper.ply" ; : maybe-download ( -- path ) model-path dup exists? [ diff --git a/extra/gpu/demos/bunny/bunny.factor b/extra/gpu/demos/bunny/bunny.factor index 0491191c63..cb769add14 100644 --- a/extra/gpu/demos/bunny/bunny.factor +++ b/extra/gpu/demos/bunny/bunny.factor @@ -145,7 +145,7 @@ UNIFORM-TUPLE: loading-uniforms : bunny-model-path ( -- path ) "bun_zipper.ply" temp-file ; -CONSTANT: bunny-model-url "http://factorcode.org/slava/bun_zipper.ply" +CONSTANT: bunny-model-url "http://duriansoftware.com/joe/media/bun_zipper.ply" : download-bunny ( -- path ) bunny-model-path dup exists? [ From 6f7e4e32d023b40475d920aea59204755ba61f6a Mon Sep 17 00:00:00 2001 From: Slava Pestov Date: Fri, 25 Feb 2011 21:05:38 -0800 Subject: [PATCH 24/31] compiler.cfg.ssa.construction: update unit tests for nths change --- .../cfg/ssa/construction/tdmsc/tdmsc-tests.factor | 12 ++++++------ 1 file changed, 6 insertions(+), 6 deletions(-) diff --git a/basis/compiler/cfg/ssa/construction/tdmsc/tdmsc-tests.factor b/basis/compiler/cfg/ssa/construction/tdmsc/tdmsc-tests.factor index 9b24c55078..2b80ce9d59 100644 --- a/basis/compiler/cfg/ssa/construction/tdmsc/tdmsc-tests.factor +++ b/basis/compiler/cfg/ssa/construction/tdmsc/tdmsc-tests.factor @@ -24,10 +24,10 @@ V{ } 5 test-bb [ ] [ test-tdmsc ] unit-test -[ V{ 4 } ] [ 1 get 1array merge-set [ number>> ] map ] unit-test -[ V{ 4 } ] [ 2 get 1array merge-set [ number>> ] map ] unit-test -[ V{ } ] [ 0 get 1array merge-set ] unit-test -[ V{ } ] [ 4 get 1array merge-set ] unit-test +[ { 4 } ] [ 1 get 1array merge-set [ number>> ] map ] unit-test +[ { 4 } ] [ 2 get 1array merge-set [ number>> ] map ] unit-test +[ { } ] [ 0 get 1array merge-set ] unit-test +[ { } ] [ 4 get 1array merge-set ] unit-test V{ } 0 test-bb V{ } 1 test-bb @@ -70,5 +70,5 @@ V{ } 7 test-bb [ ] [ test-tdmsc ] unit-test -[ V{ 2 } ] [ { 2 3 4 5 } [ get ] map merge-set [ number>> ] map ] unit-test -[ V{ } ] [ { 0 1 6 7 } [ get ] map merge-set ] unit-test +[ { 2 } ] [ { 2 3 4 5 } [ get ] map merge-set [ number>> ] map ] unit-test +[ { } ] [ { 0 1 6 7 } [ get ] map merge-set ] unit-test From 78a85d0b059a00d2261d7c250f8defe9f5c07888 Mon Sep 17 00:00:00 2001 From: Slava Pestov Date: Fri, 25 Feb 2011 21:05:56 -0800 Subject: [PATCH 25/31] io.sockets.secure.unix: update unit test for close-notify change --- basis/io/sockets/secure/unix/unix-tests.factor | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-) diff --git a/basis/io/sockets/secure/unix/unix-tests.factor b/basis/io/sockets/secure/unix/unix-tests.factor index f87ad93fbd..3572a9a845 100644 --- a/basis/io/sockets/secure/unix/unix-tests.factor +++ b/basis/io/sockets/secure/unix/unix-tests.factor @@ -41,7 +41,11 @@ io.sockets.secure.unix.debug ; ] server-test ] unit-test -[ client-test ] [ premature-close? ] must-fail-with +! Actually, this should not be an error since many HTTPS servers +! (eg, google.com) do this. + +! [ client-test ] [ premature-close? ] must-fail-with +[ "hello" ] [ client-test ] unit-test ! Now, try validating the certificate. This should fail because its ! actually an invalid certificate From 836743b25b3fa5da1522a62a05ce26738ec1fdd4 Mon Sep 17 00:00:00 2001 From: Slava Pestov Date: Fri, 25 Feb 2011 21:06:10 -0800 Subject: [PATCH 26/31] combinators: fix help lint --- core/combinators/combinators-docs.factor | 1 + 1 file changed, 1 insertion(+) diff --git a/core/combinators/combinators-docs.factor b/core/combinators/combinators-docs.factor index 28ef4a764f..a1488ca5c6 100644 --- a/core/combinators/combinators-docs.factor +++ b/core/combinators/combinators-docs.factor @@ -355,6 +355,7 @@ HELP: case { $examples { $example "USING: combinators io kernel ;" + "IN: scratchpad" "SYMBOLS: yes no maybe ;" "maybe {" " { yes [ ] } ! Do nothing" From e5dba6b64ccf0de89e3659277604cd6c3f3b3168 Mon Sep 17 00:00:00 2001 From: Slava Pestov Date: Fri, 25 Feb 2011 21:06:22 -0800 Subject: [PATCH 27/31] tools.deploy: fix a test on Windows --- basis/tools/deploy/deploy-tests.factor | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/basis/tools/deploy/deploy-tests.factor b/basis/tools/deploy/deploy-tests.factor index 0d0dba325f..b738a7852c 100644 --- a/basis/tools/deploy/deploy-tests.factor +++ b/basis/tools/deploy/deploy-tests.factor @@ -137,8 +137,8 @@ os macosx? [ [ ] [ "tools.deploy.test.20" shake-and-bake ] unit-test -[ "Factor\n" ] -[ deploy-test-command ascii [ contents ] with-process-reader ] unit-test +[ "Factor" ] +[ deploy-test-command ascii [ readln ] with-process-reader ] unit-test [ ] [ 800000 small-enough? ] unit-test From e90fd3b942e0113e627d9cc76636f86d8228a33b Mon Sep 17 00:00:00 2001 From: Slava Pestov Date: Fri, 25 Feb 2011 21:08:00 -0800 Subject: [PATCH 28/31] Fix usage note in dns vocab, move tools.dns from basis to extra since dns vocab is in extra --- extra/dns/dns.factor | 1 - {basis => extra}/tools/dns/authors.txt | 0 {basis => extra}/tools/dns/dns.factor | 2 +- 3 files changed, 1 insertion(+), 2 deletions(-) rename {basis => extra}/tools/dns/authors.txt (100%) rename {basis => extra}/tools/dns/dns.factor (92%) diff --git a/extra/dns/dns.factor b/extra/dns/dns.factor index a0e6ba5f6e..802d4d7277 100644 --- a/extra/dns/dns.factor +++ b/extra/dns/dns.factor @@ -368,7 +368,6 @@ M: SOA rdata>byte-array : message>query-name ( message -- string ) query>> first name>> dotted> ; -USE: nested-comments (* M: string resolve-host dup >lower "localhost" = [ diff --git a/basis/tools/dns/authors.txt b/extra/tools/dns/authors.txt similarity index 100% rename from basis/tools/dns/authors.txt rename to extra/tools/dns/authors.txt diff --git a/basis/tools/dns/dns.factor b/extra/tools/dns/dns.factor similarity index 92% rename from basis/tools/dns/dns.factor rename to extra/tools/dns/dns.factor index f59a9da217..c3b6ad87e1 100644 --- a/basis/tools/dns/dns.factor +++ b/extra/tools/dns/dns.factor @@ -7,7 +7,7 @@ IN: tools.dns [ write " has address " write ] [ print ] bi* ; : a-message. ( message -- ) - [ message>query-name ] [ message>names ] bi + [ message>query-name ] [ message>a-names ] bi [ a-line. ] with each ; : mx-line. ( host pair -- ) From cd39ab0d10be192f4d6899846d114be363961540 Mon Sep 17 00:00:00 2001 From: Slava Pestov Date: Fri, 25 Feb 2011 21:26:11 -0800 Subject: [PATCH 29/31] tools.deploy: add test for formatting vocab --- basis/tools/deploy/test/21/21.factor | 7 +++++++ basis/tools/deploy/test/21/deploy.factor | 15 +++++++++++++++ 2 files changed, 22 insertions(+) create mode 100644 basis/tools/deploy/test/21/21.factor create mode 100644 basis/tools/deploy/test/21/deploy.factor diff --git a/basis/tools/deploy/test/21/21.factor b/basis/tools/deploy/test/21/21.factor new file mode 100644 index 0000000000..1f5cbc9a31 --- /dev/null +++ b/basis/tools/deploy/test/21/21.factor @@ -0,0 +1,7 @@ +USING: formatting ; +IN: tools.deploy.test.21 + +: formatting-test ( -- ) + 1 2 3 "%d %d %d" printf ; + +MAIN: formatting-test diff --git a/basis/tools/deploy/test/21/deploy.factor b/basis/tools/deploy/test/21/deploy.factor new file mode 100644 index 0000000000..7c155dee3e --- /dev/null +++ b/basis/tools/deploy/test/21/deploy.factor @@ -0,0 +1,15 @@ +USING: tools.deploy.config ; +H{ + { deploy-name "tools.deploy.test.21" } + { deploy-ui? f } + { deploy-c-types? f } + { deploy-console? t } + { deploy-unicode? f } + { "stop-after-last-window?" t } + { deploy-io 2 } + { deploy-reflection 1 } + { deploy-word-props? f } + { deploy-math? t } + { deploy-threads? t } + { deploy-word-defs? f } +} From e9bccc0d59237ff80228e2954f451c7de4e434aa Mon Sep 17 00:00:00 2001 From: Slava Pestov Date: Fri, 25 Feb 2011 22:13:54 -0800 Subject: [PATCH 30/31] tools.deploy: actually add the new test --- basis/tools/deploy/deploy-tests.factor | 7 +++++++ 1 file changed, 7 insertions(+) diff --git a/basis/tools/deploy/deploy-tests.factor b/basis/tools/deploy/deploy-tests.factor index b738a7852c..aa2bca26f1 100644 --- a/basis/tools/deploy/deploy-tests.factor +++ b/basis/tools/deploy/deploy-tests.factor @@ -142,4 +142,11 @@ os macosx? [ [ ] [ 800000 small-enough? ] unit-test +[ ] [ "tools.deploy.test.21" shake-and-bake ] unit-test + +[ "1 2 3" ] +[ deploy-test-command ascii [ readln ] with-process-reader ] unit-test + +[ ] [ 600000 small-enough? ] unit-test + [ ] [ "benchmark.ui-panes" shake-and-bake run-temp-image ] unit-test From 266c6d32e719cbaf29a0621393a9aad8c540e34c Mon Sep 17 00:00:00 2001 From: Slava Pestov Date: Fri, 25 Feb 2011 22:33:28 -0800 Subject: [PATCH 31/31] io.sockets: add scope-id to ipv6 addrspecs, fixing a problem with connecting to localhost on Mac OS X (and other systems) where localhost is associated with a link-local address such as fe80::1 --- basis/io/sockets/icmp/icmp.factor | 2 +- basis/io/sockets/sockets-tests.factor | 20 +++++++++++++++++--- basis/io/sockets/sockets.factor | 26 ++++++++++++++++++-------- 3 files changed, 36 insertions(+), 12 deletions(-) diff --git a/basis/io/sockets/icmp/icmp.factor b/basis/io/sockets/icmp/icmp.factor index 80693c0963..095a03ab7b 100644 --- a/basis/io/sockets/icmp/icmp.factor +++ b/basis/io/sockets/icmp/icmp.factor @@ -41,7 +41,7 @@ M: icmp4 resolve-host 1array ; TUPLE: icmp6 < ipv6 ; -C: icmp6 +: ( host -- icmp6 ) 0 icmp6 boa ; M: ipv6 with-icmp host>> ; diff --git a/basis/io/sockets/sockets-tests.factor b/basis/io/sockets/sockets-tests.factor index d601512753..0c79323a24 100644 --- a/basis/io/sockets/sockets-tests.factor +++ b/basis/io/sockets/sockets-tests.factor @@ -1,11 +1,12 @@ USING: io.sockets io.sockets.private sequences math tools.test namespaces accessors kernel destructors calendar io.timeouts io.encodings.utf8 io concurrency.promises threads -io.streams.string ; +io.streams.string present ; IN: io.sockets.tests +[ T{ local f "/tmp/foo" } ] [ "/tmp/foo" ] unit-test [ T{ inet4 f f 0 } ] [ f 0 ] unit-test -[ T{ inet6 f f 0 } ] [ f 0 ] unit-test +[ T{ inet6 f f 0 1 } ] [ f 1 ] unit-test [ T{ inet f "google.com" f } ] [ "google.com" f ] unit-test @@ -13,10 +14,23 @@ IN: io.sockets.tests [ T{ inet f "google.com" 80 } ] [ "google.com" 0 80 with-port ] unit-test [ T{ inet4 f "8.8.8.8" 0 } ] [ "8.8.8.8" 0 ] unit-test [ T{ inet4 f "8.8.8.8" 53 } ] [ "8.8.8.8" 0 53 with-port ] unit-test -[ T{ inet6 f "5:5:5:5:6:6:6:6" 12 } ] [ "5:5:5:5:6:6:6:6" 0 12 with-port ] unit-test +[ T{ inet6 f "5:5:5:5:6:6:6:6" 0 12 } ] [ "5:5:5:5:6:6:6:6" 0 12 with-port ] unit-test +[ T{ inet6 f "fe80::1" 1 80 } ] [ T{ ipv6 f "fe80::1" 1 } 80 with-port ] unit-test + +: test-sockaddr ( addrspec -- ) + [ dup make-sockaddr ] keep parse-sockaddr assert= ; + +[ ] [ T{ inet4 f "8.8.8.8" 53 } test-sockaddr ] unit-test +[ ] [ T{ inet6 f "5:5:5:5:6:6:6:6" 0 12 } test-sockaddr ] unit-test +[ ] [ T{ inet6 f "fe80:0:0:0:0:0:0:1" 1 80 } test-sockaddr ] unit-test [ T{ inet f "google.com" 80 } ] [ "google.com" 80 with-port ] unit-test +! Test present on addrspecs +[ "4.4.4.4:12" ] [ "4.4.4.4" 12 present ] unit-test +[ "::1:12" ] [ "::1" 12 present ] unit-test +[ "fe80::1%1:12" ] [ "fe80::1" 1 12 inet6 boa present ] unit-test + [ B{ 1 2 3 4 } ] [ "1.2.3.4" T{ inet4 } inet-pton ] unit-test diff --git a/basis/io/sockets/sockets.factor b/basis/io/sockets/sockets.factor index fcdc00d127..b567721e3f 100644 --- a/basis/io/sockets/sockets.factor +++ b/basis/io/sockets/sockets.factor @@ -125,9 +125,11 @@ M: inet4 present M: inet4 protocol drop 0 ; -TUPLE: ipv6 { host ?string read-only } ; +TUPLE: ipv6 +{ host ?string read-only } +{ scope-id integer read-only } ; -C: ipv6 +: ( host -- ipv6 ) 0 ipv6 boa ; M: ipv6 inet-ntop ( data addrspec -- str ) drop 16 memory>byte-array 2 [ be> >hex ] map ":" join ; @@ -184,23 +186,31 @@ M: ipv6 make-sockaddr ( inet -- sockaddr ) AF_INET6 >>family swap [ port>> htons >>port ] - [ host>> "::" or ] - [ inet-pton >>addr ] tri ; + [ [ host>> "::" or ] keep inet-pton >>addr ] + [ scope-id>> >>scopeid ] + tri ; M: ipv6 parse-sockaddr - [ addr>> ] dip inet-ntop ; + [ [ addr>> ] dip inet-ntop ] [ drop scopeid>> ] 2bi + ipv6 boa ; + +M: ipv6 present + [ host>> ] [ scope-id>> ] bi + [ number>string "%" glue ] unless-zero ; TUPLE: inet6 < ipv6 { port integer read-only } ; -C: inet6 +: ( host port -- inet6 ) [ 0 ] dip inet6 boa ; -M: ipv6 with-port [ host>> ] dip ; +M: ipv6 with-port + [ [ host>> ] [ scope-id>> ] bi ] dip + inet6 boa ; M: inet6 parse-sockaddr [ call-next-method ] [ drop port>> ntohs ] 2bi with-port ; M: inet6 present - [ host>> ] [ port>> number>string ] bi ":" glue ; + [ call-next-method ] [ port>> number>string ] bi ":" glue ; M: inet6 protocol drop 0 ;