From 57840278425c404ead5309234b243a6d949ebb6a Mon Sep 17 00:00:00 2001 From: Slava Pestov Date: Sat, 14 Jan 2006 01:13:14 +0000 Subject: [PATCH] fix weirdness --- CHANGES.html | 3 +++ doc/handbook/math.facts | 4 ++-- doc/handbook/sequences.facts | 2 +- doc/handbook/syntax.facts | 34 +++++++++++++++--------------- library/alien/compiler.factor | 4 ++-- library/collections/growable.facts | 6 +++--- library/help/commands.factor | 2 +- library/help/markup.factor | 10 +++++++-- library/help/stylesheet.factor | 3 +++ library/io/duplex-stream.factor | 3 ++- library/math/math.facts | 2 +- library/syntax/parse-syntax.facts | 6 +++--- library/syntax/parser.facts | 2 +- library/words.facts | 4 ++-- 14 files changed, 49 insertions(+), 36 deletions(-) diff --git a/CHANGES.html b/CHANGES.html index d7e4047d7a..1d8dbd0804 100644 --- a/CHANGES.html +++ b/CHANGES.html @@ -24,6 +24,8 @@ initial size.
  • The fill word to create a new string with an initial character repeated a certain number of times has been renamed to <string>.
  • +
  • The sum and product words have been moved to +contrib/math/.
  • stream-format ( string style stream -- ) now takes a hashtable @@ -102,6 +104,7 @@ USE: image
  • Contributed libraries: diff --git a/doc/handbook/math.facts b/doc/handbook/math.facts index 445e04ba17..085bc50ca2 100644 --- a/doc/handbook/math.facts +++ b/doc/handbook/math.facts @@ -42,7 +42,7 @@ ARTICLE: "integers" "Integers" { $example "128 class ." "fixnum" } { $example "134217728 128 * ." "17179869184" } { $example "134217728 128 * class ." "bignum" } -"Integers can be entered using a different base; see " { $link "integer-literals" } "." +"Integers can be entered using a different base; see " { $link "syntax-numbers" } "." $terpri "Integers can be tested for, and real numbers can be converted to integers:" { $subsection fixnum? } @@ -116,7 +116,7 @@ $terpri ARTICLE: "complex-numbers" "Complex numbers" { $subsection complex } -"Complex numbers arise as solutions to quadratic equations whose graph does not intersect the " { $emphasis "x" } " axis. Their literal syntax is covered in " { $link "complex-literals" } "." +"Complex numbers arise as solutions to quadratic equations whose graph does not intersect the " { $emphasis "x" } " axis. Their literal syntax is covered in " { $link "syntax-complex-numbers" } "." $terpri "Unlike math, where all real numbers are also complex numbers, Factor only considers a number to be a complex number if its imaginary part is non-zero. However, complex number operations are fully supported for real numbers; they are treated as having an imaginary part of zero." $terpri diff --git a/doc/handbook/sequences.facts b/doc/handbook/sequences.facts index a119c17637..d2af03469e 100644 --- a/doc/handbook/sequences.facts +++ b/doc/handbook/sequences.facts @@ -188,7 +188,7 @@ GLOSSARY: "array" "an instance of the" { $link array } "class, implementing a fixed-length mutable sequence of objects" ; ARTICLE: "arrays" "Arrays" -"An array is a fixed-size mutable sequence whose elements are stored in a contiguous range of memory. The literal syntax is covered in " { $link "array-literals" } ". Sometimes you need a growable array -- this is called a vector, and vectors are documented in " { $link "vectors" } "." +"An array is a fixed-size mutable sequence whose elements are stored in a contiguous range of memory. The literal syntax is covered in " { $link "syntax-arrays" } ". Sometimes you need a growable array -- this is called a vector, and vectors are documented in " { $link "vectors" } "." $terpri "Array words are in the " { $snippet "arrays" } " vocabulary. Unsafe implementation words are in the " { $snippet "kernel-internals" } " vocabulary." $terpri diff --git a/doc/handbook/syntax.facts b/doc/handbook/syntax.facts index a440f1cdd7..137a13865d 100644 --- a/doc/handbook/syntax.facts +++ b/doc/handbook/syntax.facts @@ -119,7 +119,7 @@ $terpri GLOSSARY: "number" "an instance of the " { $link number } " class" ; -ARTICLE: "syntax-numbers" "Numbers" +ARTICLE: "syntax-numbers" "Number syntax" "If a vocabulary lookup of a token fails, the parser attempts to parse it as a number." { $subsection "syntax-integers" } { $subsection "syntax-ratios" } @@ -132,7 +132,7 @@ GLOSSARY: "fixnum" "an instance of the " { $link fixnum } " class, representing GLOSSARY: "bignum" "an instance of the " { $link bignum } " class, representing an arbitrary-precision integer whose value is bounded by available object memory" ; -ARTICLE: "syntax-integers" "Integers" +ARTICLE: "syntax-integers" "Integer syntax" "The printed representation of an integer consists of a sequence of digits, optionally prefixed by a sign." { $code "123456" @@ -147,18 +147,18 @@ ARTICLE: "syntax-integers" "Integers" GLOSSARY: "ratio" "an instance of the " { $link ratio } " class, representing an exact ratio of two integers" ; -ARTICLE: "syntax-ratios" "Ratios" +ARTICLE: "syntax-ratios" "Ratio syntax" "The printed representation of a ratio is a pair of integers separated by a slash (/). No intermediate whitespace is permitted. Either integer may be signed, however the ratio will be normalized into a form where the denominator is positive and the greatest common divisor of the two terms is 1." { $code "75/33" "1/10" "-5/-6" } -"More information on ratios can be found in " { $link "ratios" } ; +"More information on ratios can be found in " { $link "rationals" } ; GLOSSARY: "float" "an instance of the " { $link float } " class, representing an IEEE 754 double-precision floating point number" ; -ARTICLE: "syntax-floats" "Floats" +ARTICLE: "syntax-floats" "Float syntax" "Floating point numbers contain an optional decimal part, an optional exponent, with an optional sign prefix on either the mantissa or exponent." { $code "10.5" @@ -170,7 +170,7 @@ ARTICLE: "syntax-floats" "Floats" GLOSSARY: "complex" "an instance of the " { $link complex } " class, representing a complex number with real and imaginary components, where both components are real numbers" ; -ARTICLE: "syntax-complex-numbers" "Complex numbers" +ARTICLE: "syntax-complex-numbers" "Complex number syntax" "A complex number is given by two components, a ``real'' part and ''imaginary'' part. The components must either be integers, ratios or floats." { $code "C{ 1/2 1/3 } ! the complex number 1/2+1/3i" @@ -180,7 +180,7 @@ ARTICLE: "syntax-complex-numbers" "Complex numbers" GLOSSARY: "wrapper" "an instance of the " { $link wrapper } " class, holding a reference to a single object. When the evaluator encounters a wrapper, it pushes the wrapped object on the data stack. Wrappers are used to push words literally on the data stack" ; -ARTICLE: "syntax-words" "Words" +ARTICLE: "syntax-words" "Word syntax" "A word occurring inside a quotation is executed when the quotation is called. Sometimes a word needs to be pushed on the data stack instead. The canonical use-case for this is passing the word to the " { $link execute } " combinator, or alternatively, reflectively accessing word properties (" { $link "word-props" } ")." { $subsection POSTPONE: \ } { $subsection POSTPONE: POSTPONE: } @@ -201,7 +201,7 @@ ARTICLE: "syntax-booleans" "Booleans" GLOSSARY: "escape" "a sequence allowing a non-literal character to be inserted in a string. For a list of escapes, see " { $link "escape" } ; -ARTICLE: "syntax-strings" "Characters and strings" +ARTICLE: "syntax-strings" "Character and string syntax" "Factor has no distinct character type, however Unicode character value integers can be read by specifying a literal character, or an escaped representation thereof." { $subsection POSTPONE: CHAR: } { $subsection POSTPONE: " } @@ -227,31 +227,31 @@ ARTICLE: "escape" "Character escape codes" } "While not useful for single characters, this syntax is also permitted inside strings." ; -ARTICLE: "syntax-sbufs" "String buffers" +ARTICLE: "syntax-sbufs" "String buffer syntax" { $subsection POSTPONE: SBUF" } -"String buffers are documented in " { $link "string-buffers" } "." ; +"String buffers are documented in " { $link "sbufs" } "." ; -ARTICLE: "syntax-arrays" "Arrays" +ARTICLE: "syntax-arrays" "Array syntax" { $subsection POSTPONE: { } { $subsection POSTPONE: } } "Arrays are documented in " { $link "arrays" } "." ; -ARTICLE: "syntax-vectors" "Vectors" +ARTICLE: "syntax-vectors" "Vector syntax" { $subsection POSTPONE: V{ } { $subsection POSTPONE: } } "Vectors are documented in " { $link "vectors" } "." ; -ARTICLE: "syntax-hashtables" "Hashtables" +ARTICLE: "syntax-hashtables" "Hashtable syntax" { $subsection POSTPONE: H{ } { $subsection POSTPONE: } } -"Hashtables are documented in " { $link "vectors" } "." ; +"Hashtables are documented in " { $link "hashtables" } "." ; -ARTICLE: "syntax-tuples" "Tuples" +ARTICLE: "syntax-tuples" "Tuple syntax" { $subsection POSTPONE: T{ } { $subsection POSTPONE: } } "Tuples are documented in " { $link "tuples" } "." ; -ARTICLE: "syntax-lists" "Lists" +ARTICLE: "syntax-lists" "Quotation syntax" { $subsection POSTPONE: [ } { $subsection POSTPONE: ] } -"Lists are documented in " { $link "lists" } "." ; +"Quotations are documented in " { $link "quotations" } "." ; diff --git a/library/alien/compiler.factor b/library/alien/compiler.factor index 9922ee64fc..1f745b4566 100644 --- a/library/alien/compiler.factor +++ b/library/alien/compiler.factor @@ -74,13 +74,13 @@ C: alien-node make-node ; dup class get swap fastcall-regs >= ; : spill-param ( reg-class -- n reg-class ) - reg-class-size stack-params [ tuck + ] change + reg-size stack-params [ tuck + ] change T{ stack-params } ; : inc-reg-class ( reg-class -- ) #! On Mac OS X, float parameters 'shadow' integer registers. dup class inc dup float-regs? dual-fp/int-regs? and [ - int-regs [ over reg-class-size 4 / + ] change + int-regs [ over reg-size 4 / + ] change ] when drop ; : fastcall-param ( reg-class -- n reg-class ) diff --git a/library/collections/growable.facts b/library/collections/growable.facts index 008037f213..392d7bc2c5 100644 --- a/library/collections/growable.facts +++ b/library/collections/growable.facts @@ -28,7 +28,7 @@ HELP: ensure "( n seq -- )" { $values { "n" "a positive integer" } { "seq" "a growable sequence" } } { $description "If " { $snippet "n" } " is less than the length of the sequence, does nothing. Otherwise, if " { $snippet "n" } " also exceeds the capacity of the underlying storage, the underlying storage is grown, and the fill pointer is reset. Finally, if " { $snippet "n" } " is greater than or equal to the length but less than the capacity of the underlying storage, the fill pointer is moved and nothing else is done." $terpri -"This word is used in the implementation of the " { $link set-nth } " generic for sequences supporting the growable sequence protocol (see " { $link "sequences-internals" } ")." +"This word is used in the implementation of the " { $link set-nth } " generic for sequences supporting the growable sequence protocol (see " { $link "sequences-growable" } ")." } ; HELP: bounds-error "( n seq -- )" @@ -41,8 +41,8 @@ HELP: bounds-check "( n seq -- n seq )" HELP: grow-length "( n seq -- )" { $values { "n" "a positive integer" } { "seq" "a sequence" } } -{ $description "An implementation of the " { $link set-length } " generic for sequences supporting the growable sequence protocol (see " { $link "sequences-internals" } ")." } ; +{ $description "An implementation of the " { $link set-length } " generic for sequences supporting the growable sequence protocol (see " { $link "sequences-growable" } ")." } ; HELP: clone-growable "( seq -- seq )" { $values { "seq" "a sequence" } { "seq" "a fresh sequence" } } -{ $description "An implementation of the " { $link clone } " generic for sequences supporting the growable sequence protocol (see " { $link "sequences-internals" } ")." } ; +{ $description "An implementation of the " { $link clone } " generic for sequences supporting the growable sequence protocol (see " { $link "sequences-growable" } ")." } ; diff --git a/library/help/commands.factor b/library/help/commands.factor index 984f1089c8..e2839d8b28 100644 --- a/library/help/commands.factor +++ b/library/help/commands.factor @@ -1,6 +1,6 @@ IN: help USING: gadgets-listener gadgets-presentations words ; -"Show word" [ word? ] [ help ] \ in-browser define-default-command +"Show word documentation" [ word? ] [ help ] \ in-browser define-default-command "Show term definition" [ term? ] [ help ] \ in-browser define-default-command "Show article" [ link? ] [ help ] \ in-browser define-default-command diff --git a/library/help/markup.factor b/library/help/markup.factor index 1ecb650692..1b19595ca7 100644 --- a/library/help/markup.factor +++ b/library/help/markup.factor @@ -55,7 +55,7 @@ M: word print-element : $url url-style ($span) ; -: $terpri terpri drop ; +: $terpri terpri terpri drop ; ! Some blocks M: simple-element print-element [ print-element ] each ; @@ -138,7 +138,13 @@ DEFER: help ] with-style ; : $link ( article -- ) - first dup article-name swap simple-object ; + first dup word? [ + pprint + ] [ + link-style [ + dup article-name swap simple-object + ] with-style + ] if ; : $glossary ( element -- ) first dup simple-object ; diff --git a/library/help/stylesheet.factor b/library/help/stylesheet.factor index df63620d76..e57f1d5544 100644 --- a/library/help/stylesheet.factor +++ b/library/help/stylesheet.factor @@ -8,6 +8,9 @@ USING: styles ; { wrap-margin 500 } } ; +: link-style + H{ { foreground { 0.3 0 0 1 } } { font-style bold } } ; + : emphasis-style H{ { font-style italic } } ; diff --git a/library/io/duplex-stream.factor b/library/io/duplex-stream.factor index 4e7edf1a20..6e344b13e7 100644 --- a/library/io/duplex-stream.factor +++ b/library/io/duplex-stream.factor @@ -1,6 +1,7 @@ ! Combine an input and output stream into one, and flush the ! stream more often. -USING: io kernel ; +IN: io +USING: kernel ; TUPLE: duplex-stream in out ; diff --git a/library/math/math.facts b/library/math/math.facts index 9d32314495..f098c877b7 100644 --- a/library/math/math.facts +++ b/library/math/math.facts @@ -36,7 +36,7 @@ HELP: + "( x y -- z )" HELP: - "( x y -- z )" { $values { "x" "a number" } { "y" "a number" } { "z" "a number" } } { $description - "Subtracts " { $link "y" } " from " { $snippet "x" } "." + "Subtracts " { $snippet "y" } " from " { $snippet "x" } "." { $list "Subtraction of fixnums may overflow and convert the result to a bignum." "Subtraction of bignums always yields a bignum." diff --git a/library/syntax/parse-syntax.facts b/library/syntax/parse-syntax.facts index b1cc8ac7cd..e15e966896 100644 --- a/library/syntax/parse-syntax.facts +++ b/library/syntax/parse-syntax.facts @@ -77,7 +77,7 @@ HELP: V{ "elements... }" HELP: H{ "{ key value }... }" { $values { "key" "an object" } { "value" "an object" } } { $description "Marks the beginning of a literal hashtable, given as a list of two-element arrays holding key/value pairs." } -{ $examples { $code "H{ { \"tuna\" \"fish\" } { \"jalapeno\" \"vegatable\" } }" } } ; +{ $examples { $code "H{ { \"tuna\" \"fish\" } { \"jalapeno\" \"vegetable\" } }" } } ; HELP: C{ "real imaginary }" { $values { "real" "a real number" } { "imaginary" "a real number" } } @@ -115,7 +115,7 @@ HELP: SYMBOL: "word" HELP: \ "word" { $values { "word" "a word" } } { $description "Reads the next word from the input and appends a wrapper holding the word to the parse tree. When the evaluator encounters a wrapper, it pushes the wrapped word literally on the data stack." } -{ $examples "The following two lines are equivalent:" { $code "0 \\ execute\n" } } ; +{ $examples "The following two lines are equivalent:" { $code "0 \\ execute\n0 " } } ; HELP: DEFER: "word" { $values { "word" "a new word to define" } } @@ -194,7 +194,7 @@ HELP: GENERIC: "word" { $values { "word" "a new word to define" } } { $description "Defines a new generic word in the current vocabulary. Initially, it contains no methods, and thus will throw an error when called." } { $notes - "A " { $link "method-combinations" "method combination" } " facility exists for customizing method dispatch behavior." + "A " { $link "method-combination" } " facility exists for customizing method dispatch behavior." $terpri "This parsing word is equivalent to the following usage of the more general " { $link POSTPONE: G: } " word:" { $code "G: word simple-combination ;" } diff --git a/library/syntax/parser.facts b/library/syntax/parser.facts index 9f75047bdf..85f73cfe60 100644 --- a/library/syntax/parser.facts +++ b/library/syntax/parser.facts @@ -94,7 +94,7 @@ $parsing-note ; HELP: create-constructor "( word -- constructor )" { $values { "class" "a word" } { "constructor" "a new word" } } -{ $description "Creates a new word in the current vocabulary, named by surrounding " { $link "word" } " with angle brackets." } ; +{ $description "Creates a new word in the current vocabulary, named by surrounding " { $snippet "word" } " with angle brackets." } ; HELP: CREATE "( -- word )" { $values { "word" "a word" } } diff --git a/library/words.facts b/library/words.facts index 8848dd0fbd..6772cf510d 100644 --- a/library/words.facts +++ b/library/words.facts @@ -145,6 +145,6 @@ HELP: definer "( word -- definer )" { $values { "word" "a word" } { "definer" "a word" } } { $description "Outputs the parsing word that defines the given word." } { $examples - { $example ": foo ; \ foo definer ." "POSTPONE: :" } - { $example "SYMBOL: foo \ foo definer ." "POSTPONE: SYMBOL:" } + { $example ": foo ; \\ foo definer ." "POSTPONE: :" } + { $example "SYMBOL: foo \\ foo definer ." "POSTPONE: SYMBOL:" } } ;