fix weirdness

cvs
Slava Pestov 2006-01-14 01:13:14 +00:00
parent 05d800ed28
commit 5784027842
14 changed files with 49 additions and 36 deletions

View File

@ -24,6 +24,8 @@
initial size.</li> initial size.</li>
<li>The <code>fill</code> word to create a new string with an initial character <li>The <code>fill</code> word to create a new string with an initial character
repeated a certain number of times has been renamed to <code>&lt;string&gt;</code>.</li> repeated a certain number of times has been renamed to <code>&lt;string&gt;</code>.</li>
<li>The <code>sum</code> and <code>product</code> words have been moved to
<code>contrib/math/</code>.</li>
</li> </li>
<li><code>stream-format ( string style stream -- )</code> now takes a hashtable <li><code>stream-format ( string style stream -- )</code> now takes a hashtable
@ -102,6 +104,7 @@ USE: image
<li>Contributed libraries: <li>Contributed libraries:
<ul> <ul>
<li>Updated <code>contrib/x11/</code> with many more examples (Eduardo Cavazos)</li>
<li>Added splay tree library in <code>contrib/splay-trees.factor</code> (Mackenzie Straight)</li> <li>Added splay tree library in <code>contrib/splay-trees.factor</code> (Mackenzie Straight)</li>
</ul> </ul>

View File

@ -42,7 +42,7 @@ ARTICLE: "integers" "Integers"
{ $example "128 class ." "fixnum" } { $example "128 class ." "fixnum" }
{ $example "134217728 128 * ." "17179869184" } { $example "134217728 128 * ." "17179869184" }
{ $example "134217728 128 * class ." "bignum" } { $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 $terpri
"Integers can be tested for, and real numbers can be converted to integers:" "Integers can be tested for, and real numbers can be converted to integers:"
{ $subsection fixnum? } { $subsection fixnum? }
@ -116,7 +116,7 @@ $terpri
ARTICLE: "complex-numbers" "Complex numbers" ARTICLE: "complex-numbers" "Complex numbers"
{ $subsection complex } { $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 $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." "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 $terpri

View File

@ -188,7 +188,7 @@ GLOSSARY: "array"
"an instance of the" { $link array } "class, implementing a fixed-length mutable sequence of objects" ; "an instance of the" { $link array } "class, implementing a fixed-length mutable sequence of objects" ;
ARTICLE: "arrays" "Arrays" 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 $terpri
"Array words are in the " { $snippet "arrays" } " vocabulary. Unsafe implementation words are in the " { $snippet "kernel-internals" } " vocabulary." "Array words are in the " { $snippet "arrays" } " vocabulary. Unsafe implementation words are in the " { $snippet "kernel-internals" } " vocabulary."
$terpri $terpri

View File

@ -119,7 +119,7 @@ $terpri
GLOSSARY: "number" "an instance of the " { $link number } " class" ; 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." "If a vocabulary lookup of a token fails, the parser attempts to parse it as a number."
{ $subsection "syntax-integers" } { $subsection "syntax-integers" }
{ $subsection "syntax-ratios" } { $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" ; 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." "The printed representation of an integer consists of a sequence of digits, optionally prefixed by a sign."
{ $code { $code
"123456" "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" ; 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." "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 { $code
"75/33" "75/33"
"1/10" "1/10"
"-5/-6" "-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" ; 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." "Floating point numbers contain an optional decimal part, an optional exponent, with an optional sign prefix on either the mantissa or exponent."
{ $code { $code
"10.5" "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" ; 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." "A complex number is given by two components, a ``real'' part and ''imaginary'' part. The components must either be integers, ratios or floats."
{ $code { $code
"C{ 1/2 1/3 } ! the complex number 1/2+1/3i" "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" ; 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" } ")." "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: \ }
{ $subsection POSTPONE: 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" } ; 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." "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: CHAR: }
{ $subsection POSTPONE: " } { $subsection POSTPONE: " }
@ -227,31 +227,31 @@ ARTICLE: "escape" "Character escape codes"
} }
"While not useful for single characters, this syntax is also permitted inside strings." ; "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" } { $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: { }
{ $subsection POSTPONE: } } { $subsection POSTPONE: } }
"Arrays are documented in " { $link "arrays" } "." ; "Arrays are documented in " { $link "arrays" } "." ;
ARTICLE: "syntax-vectors" "Vectors" ARTICLE: "syntax-vectors" "Vector syntax"
{ $subsection POSTPONE: V{ } { $subsection POSTPONE: V{ }
{ $subsection POSTPONE: } } { $subsection POSTPONE: } }
"Vectors are documented in " { $link "vectors" } "." ; "Vectors are documented in " { $link "vectors" } "." ;
ARTICLE: "syntax-hashtables" "Hashtables" ARTICLE: "syntax-hashtables" "Hashtable syntax"
{ $subsection POSTPONE: H{ } { $subsection POSTPONE: H{ }
{ $subsection POSTPONE: } } { $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: T{ }
{ $subsection POSTPONE: } } { $subsection POSTPONE: } }
"Tuples are documented in " { $link "tuples" } "." ; "Tuples are documented in " { $link "tuples" } "." ;
ARTICLE: "syntax-lists" "Lists" ARTICLE: "syntax-lists" "Quotation syntax"
{ $subsection POSTPONE: [ } { $subsection POSTPONE: [ }
{ $subsection POSTPONE: ] } { $subsection POSTPONE: ] }
"Lists are documented in " { $link "lists" } "." ; "Quotations are documented in " { $link "quotations" } "." ;

View File

@ -74,13 +74,13 @@ C: alien-node make-node ;
dup class get swap fastcall-regs >= ; dup class get swap fastcall-regs >= ;
: spill-param ( reg-class -- n reg-class ) : spill-param ( reg-class -- n reg-class )
reg-class-size stack-params [ tuck + ] change reg-size stack-params [ tuck + ] change
T{ stack-params } ; T{ stack-params } ;
: inc-reg-class ( reg-class -- ) : inc-reg-class ( reg-class -- )
#! On Mac OS X, float parameters 'shadow' integer registers. #! On Mac OS X, float parameters 'shadow' integer registers.
dup class inc dup float-regs? dual-fp/int-regs? and [ 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 ; ] when drop ;
: fastcall-param ( reg-class -- n reg-class ) : fastcall-param ( reg-class -- n reg-class )

View File

@ -28,7 +28,7 @@ HELP: ensure "( n seq -- )"
{ $values { "n" "a positive integer" } { "seq" "a growable sequence" } } { $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." { $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 $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 -- )" HELP: bounds-error "( n seq -- )"
@ -41,8 +41,8 @@ HELP: bounds-check "( n seq -- n seq )"
HELP: grow-length "( n seq -- )" HELP: grow-length "( n seq -- )"
{ $values { "n" "a positive integer" } { "seq" "a sequence" } } { $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 )" HELP: clone-growable "( seq -- seq )"
{ $values { "seq" "a sequence" } { "seq" "a fresh sequence" } } { $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" } ")." } ;

View File

@ -1,6 +1,6 @@
IN: help IN: help
USING: gadgets-listener gadgets-presentations words ; 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 term definition" [ term? ] [ help ] \ in-browser define-default-command
"Show article" [ link? ] [ help ] \ in-browser define-default-command "Show article" [ link? ] [ help ] \ in-browser define-default-command

View File

@ -55,7 +55,7 @@ M: word print-element
: $url url-style ($span) ; : $url url-style ($span) ;
: $terpri terpri drop ; : $terpri terpri terpri drop ;
! Some blocks ! Some blocks
M: simple-element print-element [ print-element ] each ; M: simple-element print-element [ print-element ] each ;
@ -138,7 +138,13 @@ DEFER: help
] with-style ; ] with-style ;
: $link ( article -- ) : $link ( article -- )
first dup article-name swap <link> simple-object ; first dup word? [
pprint
] [
link-style [
dup article-name swap <link> simple-object
] with-style
] if ;
: $glossary ( element -- ) : $glossary ( element -- )
first dup <term> simple-object ; first dup <term> simple-object ;

View File

@ -8,6 +8,9 @@ USING: styles ;
{ wrap-margin 500 } { wrap-margin 500 }
} ; } ;
: link-style
H{ { foreground { 0.3 0 0 1 } } { font-style bold } } ;
: emphasis-style : emphasis-style
H{ { font-style italic } } ; H{ { font-style italic } } ;

View File

@ -1,6 +1,7 @@
! Combine an input and output stream into one, and flush the ! Combine an input and output stream into one, and flush the
! stream more often. ! stream more often.
USING: io kernel ; IN: io
USING: kernel ;
TUPLE: duplex-stream in out ; TUPLE: duplex-stream in out ;

View File

@ -36,7 +36,7 @@ HELP: + "( x y -- z )"
HELP: - "( x y -- z )" HELP: - "( x y -- z )"
{ $values { "x" "a number" } { "y" "a number" } { "z" "a number" } } { $values { "x" "a number" } { "y" "a number" } { "z" "a number" } }
{ $description { $description
"Subtracts " { $link "y" } " from " { $snippet "x" } "." "Subtracts " { $snippet "y" } " from " { $snippet "x" } "."
{ $list { $list
"Subtraction of fixnums may overflow and convert the result to a bignum." "Subtraction of fixnums may overflow and convert the result to a bignum."
"Subtraction of bignums always yields a bignum." "Subtraction of bignums always yields a bignum."

View File

@ -77,7 +77,7 @@ HELP: V{ "elements... }"
HELP: H{ "{ key value }... }" HELP: H{ "{ key value }... }"
{ $values { "key" "an object" } { "value" "an object" } } { $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." } { $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 }" HELP: C{ "real imaginary }"
{ $values { "real" "a real number" } { "imaginary" "a real number" } } { $values { "real" "a real number" } { "imaginary" "a real number" } }
@ -115,7 +115,7 @@ HELP: SYMBOL: "word"
HELP: \ "word" HELP: \ "word"
{ $values { "word" "a 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." } { $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 \\ <vector> execute\n<vector>" } } ; { $examples "The following two lines are equivalent:" { $code "0 \\ <vector> execute\n0 <vector>" } } ;
HELP: DEFER: "word" HELP: DEFER: "word"
{ $values { "word" "a new word to define" } } { $values { "word" "a new word to define" } }
@ -194,7 +194,7 @@ HELP: GENERIC: "word"
{ $values { "word" "a new word to define" } } { $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." } { $description "Defines a new generic word in the current vocabulary. Initially, it contains no methods, and thus will throw an error when called." }
{ $notes { $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 $terpri
"This parsing word is equivalent to the following usage of the more general " { $link POSTPONE: G: } " word:" "This parsing word is equivalent to the following usage of the more general " { $link POSTPONE: G: } " word:"
{ $code "G: word simple-combination ;" } { $code "G: word simple-combination ;" }

View File

@ -94,7 +94,7 @@ $parsing-note ;
HELP: create-constructor "( word -- constructor )" HELP: create-constructor "( word -- constructor )"
{ $values { "class" "a word" } { "constructor" "a new word" } } { $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 )" HELP: CREATE "( -- word )"
{ $values { "word" "a word" } } { $values { "word" "a word" } }

View File

@ -145,6 +145,6 @@ HELP: definer "( word -- definer )"
{ $values { "word" "a word" } { "definer" "a word" } } { $values { "word" "a word" } { "definer" "a word" } }
{ $description "Outputs the parsing word that defines the given word." } { $description "Outputs the parsing word that defines the given word." }
{ $examples { $examples
{ $example ": foo ; \ foo definer ." "POSTPONE: :" } { $example ": foo ; \\ foo definer ." "POSTPONE: :" }
{ $example "SYMBOL: foo \ foo definer ." "POSTPONE: SYMBOL:" } { $example "SYMBOL: foo \\ foo definer ." "POSTPONE: SYMBOL:" }
} ; } ;