Clickable vocabularies in documentation

darcs
slava 2006-07-09 23:50:56 +00:00
parent bdd295f086
commit a277280e90
24 changed files with 91 additions and 75 deletions

View File

@ -1,8 +1,6 @@
+ tomorrow:
- amd64 crash
+ day after:
- make-frame should compile
- httpd search tools
[2:45pm] tathi: Factor's text display is a bit odd sometimes, until you mouse over (or click, if there's no "live" text)
@ -14,29 +12,28 @@
- unix i/o: problems with passing f to syscalls
- factorcode httpd started using 99% CPU, but still received connections;
closing read-fds solved it
- sometimes darcs get fails with the httpd
- gdb triggers 'mutliple i/o ops on port' error
- "localhost" 50 <client> won't fail
+ ui:
- integrated error documentation
- roundoff is still not quite right with tracks and sliders
- 'show' doesn't work if invoked from a listener on an object which is
itself inspected in the listener
- ui uses too much cpu time idling
- add some handy services:
- base conversion
- search help for selection
- services do not launch if factor not running
- grid slows down with 2000 lines
- clickable vocabs
- integrated error documentation
- roundoff is still not quite right with tracks
- 'show' doesn't work if invoked from a listener on an object which is
itself inspected in the listener
- ui uses too much cpu time idling
- remaining HTML issues need fixing
- better component padding and spacing in UI
- see if its possible to only repaint dirty regions
- x11 title bars are funny
- if the listener is running a command when the image is saved, it
restores to an unresponsive gadget
- fix top level window positioning
- services do not launch if factor not running
- prettyprinter's highlighting of non-leaves doesn't really work
- rollover is not updated on window focus changes
- x11 input methods
@ -44,7 +41,6 @@
- browse generic words and classes
- need actions for reloading the source file and opening word in jEdit
- highlight showing panes in originating list
- make-frame should compile
- reimplement tab completion
- cocoa:
- horizontal wheel scrolling
@ -57,7 +53,6 @@
+ compiler/ffi:
- mach_signal: fault address reporting is not reliable
- mac intel: struct returns from objc methods
- see if alien calls can be made faster
- faster sequence= for UI
@ -66,7 +61,7 @@
- float boxing and overflow checks need a gc check too
- constant branch folding
- type inference at branch merge points
- float= on powerpc doesn't consider nans equal
- float= doesn't consider nans equal
- intrinsic fixnum>float float>fixnum
- remove literal table
- C functions returning structs by value
@ -76,7 +71,7 @@
+ misc:
- mac intel: fault address not reported
- mach_signal: fault address reporting is not reliable
- slice: if sequence or seq start is changed, abstraction violation
- hashed generic method dispatch
- fix this:

View File

@ -5,7 +5,7 @@ ARTICLE: "alien" "C library interface"
$terpri
"The C library interface is entirely self-contained; there is no C code which one must write in order to wrap a library."
$terpri
"C library interface words are found in the " { $snippet "alien" } " vocabulary."
"C library interface words are found in the " { $vocab-link "alien" } " vocabulary."
{ $warning "Since C does not retain runtime type information or do any kind of runtime type checking, any C library interface is not pointer safe. Improper use of C functions can crash the runtime or corrupt memory in unpredictible ways." }
{ $subsection "loading-libs" }
{ $subsection "alien-invoke" }
@ -253,7 +253,7 @@ $terpri
{ $subsection <malloc-object> }
{ $subsection <malloc-array> }
{ $subsection <malloc-string> }
"These words are built on some words in the " { $snippet "libc" } " vocabulary, which themselves use the C library interface to call C standard library functions:"
"These words are built on some words in the " { $vocab-link "libc" } " vocabulary, which themselves use the C library interface to call C standard library functions:"
{ $subsection malloc }
{ $subsection calloc }
{ $subsection realloc }

View File

@ -45,6 +45,6 @@ ARTICLE: "bootstrap-cli-args" "Switches available when bootstrapping"
ARTICLE: "standard-cli-args" "General command line switches"
"The following command line switches can be passed to a bootstrapped Factor image:"
{ $table
{ { $snippet "-shell=" { $emphasis "shell" } } { { $snippet { $emphasis "shell" } } " is either " { $link tty } ", " { $link ui } ", or the name of any other word in the " { $snippet "shells" } " vocabulary. This specifies the user interface to run on startup." } }
{ { $snippet "-shell=" { $emphasis "shell" } } { { $snippet { $emphasis "shell" } } " is either " { $link tty } ", " { $link ui } ", or the name of any other word in the " { $vocab-link "shells" } " vocabulary. This specifies the user interface to run on startup." } }
{ { $snippet "-no-user-init" } { "If specified, Factor will not run the " { $snippet "~/.factor-rc" } " file on startup" } }
} ;

View File

@ -14,7 +14,7 @@ ARTICLE: "collections" "Collections"
{ $subsection "buffers" } ;
ARTICLE: "queues" "Queues"
"Last-in-first-out queues can be found in the " { $snippet "queues" } " vocabulary."
"Last-in-first-out queues can be found in the " { $vocab-link "queues" } " vocabulary."
{ $subsection queue? }
{ $subsection <queue> }
{ $subsection queue-empty? }
@ -35,7 +35,7 @@ ARTICLE: "queues" "Queues"
} ;
ARTICLE: "graphs" "Directed graphs"
"A minimalist directed graph data type can be found in the " { $snippet "graphs" } " vocabulary. A directed graph is represented as a hashtable mapping each vertex to a set of edges entering that vertex, where the set is represented as a hashtable with equal keys and values."
"A minimalist directed graph data type can be found in the " { $vocab-link "graphs" } " vocabulary. A directed graph is represented as a hashtable mapping each vertex to a set of edges entering that vertex, where the set is represented as a hashtable with equal keys and values."
$terpri
"To create a new graph, just call " { $link <hashtable> } " or construct a hashtable by some other means. To add vertices and edges to a graph:"
{ $subsection add-vertex }
@ -51,7 +51,7 @@ $terpri
ARTICLE: "buffers" "Locked I/O buffers"
"I/O buffers are a circular ring structure, a fixed-size queue of characters. Their key feature is that they are backed by manually allocated storage that does not get moved by the garbage collector. They are typically used for asynchronous I/O in conjunction with the C library interface in Factor's implementation."
$terpri
"Buffer words are in the " { $snippet "io-internals" } " vocabulary."
"Buffer words are in the " { $vocab-link "io-internals" } " vocabulary."
{ $subsection buffer }
{ $subsection <buffer> }
"Buffers must be manually deallocated:"

View File

@ -147,14 +147,14 @@ ARTICLE: "cookbook-vocabs" "Vocabularies cookbook"
$terpri
"For example, a source file containing the following code will print a parse error if you try loading it:"
{ $code "\"Hello world\" print" }
"The " { $link print } " word is contained inside the " { $snippet "io" } " vocabulary, which is available in the listener but must be explicitly added to the search path in source files:"
"The " { $link print } " word is contained inside the " { $vocab-link "io" } " vocabulary, which is available in the listener but must be explicitly added to the search path in source files:"
{ $code
"USE: io"
"\"Hello world\" print"
}
"Typically a source file will refer to words in multiple vocabularies, and they can all be added to the search path in one go:"
{ $code "USING: arrays kernel math ;" }
"New words go into the " { $snippet "scratchpad" } " vocabulary by default. You can change this with " { $link POSTPONE: IN: } ":"
"New words go into the " { $vocab-link "scratchpad" } " vocabulary by default. You can change this with " { $link POSTPONE: IN: } ":"
{ $code
"IN: time-machine"
": time-travel ( when what -- ) frob fizz flap ;"

View File

@ -4,7 +4,7 @@ kernel-internals namespaces queues ;
ARTICLE: "hashtables" "Hashtables"
"A hashtable provides efficient (expected constant time) lookup and storage of key/value pairs. Keys are compared for equality, and a hashing function is used to reduce the number of comparisons made."
$terpri
"Hashtable words are in the " { $snippet "hashtables" } " vocabulary. Unsafe implementation words are in the " { $snippet "hashtables-internals" } " vocabulary."
"Hashtable words are in the " { $vocab-link "hashtables" } " vocabulary. Unsafe implementation words are in the " { $vocab-link "hashtables-internals" } " vocabulary."
$terpri
"Hashtables form a class of objects."
{ $subsection hashcode }

View File

@ -3,7 +3,7 @@ USING: help math prettyprint sequences ;
ARTICLE: "math" "Numbers"
"Factor attempts to preserve natural mathematical semantics for numbers. Multiplying two large integers never results in overflow, and dividing two integers yields an exact ratio. Floating point numbers are also supported, along with complex numbers."
$terpri
"Math words are in the " { $snippet "math" } " vocabulary. Implementation details are in the " { $snippet "math-internals" } " vocabulary."
"Math words are in the " { $vocab-link "math" } " vocabulary. Implementation details are in the " { $vocab-link "math-internals" } " vocabulary."
{ $subsection "number-protocol" }
{ $subsection "number-types" }
{ $subsection "math-functions" }
@ -50,7 +50,7 @@ $terpri
{ $subsection bignum? }
{ $subsection >fixnum }
{ $subsection >bignum }
"The " { $link . } " word prints numbers in decimal. A set of words in the " { $snippet "prettyprint" } " vocabulary is provided to print integers using another base."
"The " { $link . } " word prints numbers in decimal. A set of words in the " { $vocab-link "prettyprint" } " vocabulary is provided to print integers using another base."
{ $subsection .b }
{ $subsection .o }
{ $subsection .h }

View File

@ -3,7 +3,7 @@ USING: help io parser sequences words ;
ARTICLE: "parser" "The parser"
"This section concerns itself with reflective access and extension of the Factor parser. The parser algorithm and standard syntax is described in " { $link "syntax" } "."
$terpri
"The set of words making up the parser are found in the " { $snippet "parser" } " and " { $snippet "syntax" } " vocabularies."
"The set of words making up the parser are found in the " { $vocab-link "parser" } " and " { $vocab-link "syntax" } " vocabularies."
$terpri
"As documented in " { $link "vocabulary-search" } ", the parser looks up words in the vocabulary search path. New word definitions are added to the current vocabulary. These two parameters are stored in a pair of variables:"
{ $subsection use }

View File

@ -3,7 +3,7 @@ USING: help io prettyprint ;
ARTICLE: "prettyprint" "The prettyprinter"
"One of Factor's key features is the ability to print almost any object as a valid source literal expression. This greatly aids debugging and provides the building blocks for light-weight object serialization facilities."
$terpri
"Prettyprinter words are found in the " { $snippet "prettyprint" } " vocabulary."
"Prettyprinter words are found in the " { $vocab-link "prettyprint" } " vocabulary."
$terpri
"The key words to print an object to the " { $link stdio } " stream; the first two emit a trailing newline, the second two do not:"
{ $subsection . }

View File

@ -183,7 +183,7 @@ ARTICLE: "sequence-protocol" "Sequence protocol"
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 "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."
"Array words are in the " { $vocab-link "arrays" } " vocabulary. Unsafe implementation words are in the " { $vocab-link "kernel-internals" } " vocabulary."
$terpri
"Arrays form a class of objects."
{ $subsection array }
@ -201,7 +201,7 @@ $terpri
ARTICLE: "strings" "Strings"
"A string is a fixed-size mutable sequence of characters."
$terpri
"String words are found in the " { $snippet "strings" } " vocabulary."
"String words are found in the " { $vocab-link "strings" } " vocabulary."
{ $subsection string? }
{ $subsection >string }
{ $subsection <string> }
@ -222,7 +222,7 @@ $terpri
ARTICLE: "sbufs" "String buffers"
"A string buffer is a resizable mutable sequence of characters. String buffers can be used to construct new strings by accumilating substrings and characters, however usually they are only used indirectly, since the sequence construction words are more convenient to use in most cases (see " { $link "namespaces-make" } ")."
$terpri
"String buffer words are found in the " { $snippet "strings" } " vocabulary."
"String buffer words are found in the " { $vocab-link "strings" } " vocabulary."
{ $subsection sbuf? }
{ $subsection >sbuf }
{ $subsection <sbuf> }
@ -230,7 +230,7 @@ $terpri
{ $code "SBUF\" \" clone" } ;
ARTICLE: "vectors" "Vectors"
"A vector is a resizable mutable sequence of objects. Vector words are found in the " { $snippet "vectors" } " vocabulary."
"A vector is a resizable mutable sequence of objects. Vector words are found in the " { $vocab-link "vectors" } " vocabulary."
{ $subsection vector? }
{ $subsection >vector }
{ $subsection <vector> }

View File

@ -6,7 +6,7 @@ styles ;
ARTICLE: "streams" "Streams"
"Input and output centers on the concept of a " { $emphasis "stream" } ", which is a source or sink of characters. Streams also support formatted output, which may be used to present styled text in a manner independent of output medium."
$terpri
"Stream words are in the " { $snippet "io" } " vocabulary."
"Stream words are in the " { $vocab-link "io" } " vocabulary."
{ $subsection "stream-protocol" }
{ $subsection "stream-utils" }
{ $subsection "stdio" }
@ -66,7 +66,7 @@ ARTICLE: "stdio" "The default stream"
ARTICLE: "styles" "Formatted output"
"The " { $link stream-format } " and " { $link with-nested-stream } " words take a hashtable of style attributes. The former acts on character styles, and the latter acts on paragraph styles. Output stream implementations are free to ignore style information."
$terpri
"Style hashtables are keyed by symbols from the " { $snippet "styles" } " vocabulary."
"Style hashtables are keyed by symbols from the " { $vocab-link "styles" } " vocabulary."
{ $subsection "character-styles" }
{ $subsection "paragraph-styles" }
{ $subsection "presentations" } ;

View File

@ -28,7 +28,7 @@ $terpri
$terpri
"Parsing words play a key role in parsing; while ordinary words and numbers are simply added to the parse tree, parsing words execute in the context of the parser, and can do their own parsing and create nested data structures in the parse tree. Parsing words are also able to define new words."
$terpri
"While parsing words supporting arbitrary syntax can be defined, the default set is found in the " { $snippet "syntax" } " vocabulary and provides the basis for all further syntactic interaction with Factor." ;
"While parsing words supporting arbitrary syntax can be defined, the default set is found in the " { $vocab-link "syntax" } " vocabulary and provides the basis for all further syntactic interaction with Factor." ;
ARTICLE: "vocabulary-search" "Vocabulary search"
"A " { $emphasis "word" } " is a code definition identified by a name. Words are sorted into " { $emphasis "vocabularies" } ". Words are discussed in depth in " { $link "words" } "."
@ -39,7 +39,7 @@ $terpri
$terpri
"For a source file the vocabulary search path starts off with two vocabularies:"
{ $code "syntax\nscratchpad" }
"The " { $snippet "syntax" } " vocabulary consists of a set of parsing words for reading Factor data and defining new words. The " { $snippet "scratchpad" } " vocabulary is the default vocabulary for new word definitions."
"The " { $vocab-link "syntax" } " vocabulary consists of a set of parsing words for reading Factor data and defining new words. The " { $vocab-link "scratchpad" } " vocabulary is the default vocabulary for new word definitions."
$terpri
"At the interactive listener, the default search path contains many more vocabularies. Details on the default search path and parser invocation are found in " { $link "parser" } "."
$terpri

View File

@ -94,7 +94,7 @@ ARTICLE: "debugger" "The debugger"
ARTICLE: "inspector" "The inspector"
"The prettyprinter (see " { $link "prettyprint" } ") can turn any object into a source representation. Sometimes this source representation is hard to read for a human, so the inspector provides an alternative tabular view of an object:"
{ $subsection inspect }
"Once running, the inspector spawns a new nested listener with an " { $snippet "inspector" } " prompt. The inspector supports a number of commands:"
"Once running, the inspector spawns a new nested listener with an " { $vocab-link "inspector" } " prompt. The inspector supports a number of commands:"
{ $subsection inspecting }
{ $subsection go }
{ $subsection up }

View File

@ -8,7 +8,7 @@ ARTICLE: "words" "Words"
"a definition, specifying the behavior of the word when executed,"
"a set of word properties, including documentation and other meta-data."
}
"Words for working with words are in the " { $snippet "words" } " vocabulary."
"Words for working with words are in the " { $vocab-link "words" } " vocabulary."
{ $subsection "vocabularies" }
{ $subsection "word-definition" }
{ $subsection "word-crossref" }
@ -21,7 +21,7 @@ ARTICLE: "vocabularies" "Vocabularies"
$terpri
"Words whose names are known at parse time -- that is, most words making up your program -- can be referenced in source code by stating their name. However, the parser itself, and sometimes code you write, will need to create look up words dynamically."
$terpri
"Parsing words add definitions to the current vocabulary. When a source file is being parsed, the current vocabulary is initially set to " { $snippet "scratchpad" } ". The current vocabulary may be changed with the " { $link POSTPONE: IN: } " parsing word (see " { $link "vocabulary-search" } ")."
"Parsing words add definitions to the current vocabulary. When a source file is being parsed, the current vocabulary is initially set to " { $vocab-link "scratchpad" } ". The current vocabulary may be changed with the " { $link POSTPONE: IN: } " parsing word (see " { $link "vocabulary-search" } ")."
{ $subsection create }
{ $subsection create-in }
{ $subsection gensym }

View File

@ -5,7 +5,7 @@ HELP: set-fill "( n seq -- )"
{ $values { "n" "a new fill pointer" } { "seq" "a growable sequence" } }
{ $contract "Sets the fill pointer (number of occupied elements in the underlying storage) of a growable sequence." }
{ $side-effects "seq" }
{ $warning "This word is in the " { $snippet "sequences-internals" } " vocabulary because it is not safe. Changing the fill pointer to a negative value, or a value higher than the underlying sequence length can lead to memory corruption. User code should use " { $link set-length } " instead." } ;
{ $warning "This word is in the " { $vocab-link "sequences-internals" } " vocabulary because it is not safe. Changing the fill pointer to a negative value, or a value higher than the underlying sequence length can lead to memory corruption. User code should use " { $link set-length } " instead." } ;
HELP: underlying "( seq -- underlying )"
{ $values { "seq" "a growable sequence" } { "underlying" "the underlying sequence" } }
@ -14,7 +14,7 @@ HELP: underlying "( seq -- underlying )"
HELP: set-underlying "( underlying seq -- )"
{ $values { "underlying" "a growable sequence" } { "seq" "a vector, string buffer or hashtable" } }
{ $contract "Modifies the underlying storage of a growable sequence." }
{ $warning "This word is in the " { $snippet "sequences-internals" } " vocabulary because it is not safe. Setting an underlying sequence shorter than the fill pointer can lead to memory corruption." } ;
{ $warning "This word is in the " { $vocab-link "sequences-internals" } " vocabulary because it is not safe. Setting an underlying sequence shorter than the fill pointer can lead to memory corruption." } ;
HELP: capacity "( seq -- n )"
{ $values { "seq" "a vector or string buffer" } { "n" "the capacity of the sequence" } }

View File

@ -34,25 +34,25 @@ HELP: if-key "( key hash true false -- )"
HELP: nth-pair "( n seq -- key value )"
{ $values { "n" "an index in the sequence" } { "seq" "a sequence" } { "key" "the first element of the pair" } { "value" "the second element of the pair" } }
{ $description "Fetches the elements with index " { $snippet "n" } " and " { $snippet "n+1" } ", respectively." }
{ $warning "This word is in the " { $snippet "hashtables-internals" } " vocabulary because it does not perform bounds checks." }
{ $warning "This word is in the " { $vocab-link "hashtables-internals" } " vocabulary because it does not perform bounds checks." }
{ $see-also set-nth-pair } ;
HELP: set-nth-pair "( key value n seq -- )"
{ $values { "key" "the first element of the pair" } { "value" "the second element of the pair" } { "n" "an index in the sequence" } { "seq" "a sequence" } }
{ $description "Stores a pair of values into the elements with index " { $snippet "n" } " and " { $snippet "n+1" } ", respectively." }
{ $warning "This word is in the " { $snippet "hashtables-internals" } " vocabulary because it does not perform bounds checks." }
{ $warning "This word is in the " { $vocab-link "hashtables-internals" } " vocabulary because it does not perform bounds checks." }
{ $side-effects "seq" }
{ $see-also nth-pair } ;
HELP: each-pair "( array quot -- )"
{ $values { "array" "an array of pairs" } { "quot" "a quotation with stack effect " { $snippet "( key value -- )" } } }
{ $description "Applies a quotation to successive pairs in the array." }
{ $warning "This word is in the " { $snippet "hashtables-internals" } " vocabulary because passing an array of odd length can lead to memory corruption." } ;
{ $warning "This word is in the " { $vocab-link "hashtables-internals" } " vocabulary because passing an array of odd length can lead to memory corruption." } ;
HELP: all-pairs? "( array quot -- ? )"
{ $values { "array" "an array of pairs" } { "quot" "a quotation with stack effect " { $snippet "( key value -- ? )" } } { "?" "conjunction of quotation outputs" } }
{ $description "Applies a predicate quotation to successive pairs in the array, and outputs true if the array is empty or if the quotation yields true for each pair." }
{ $warning "This word is in the " { $snippet "hashtables-internals" } " vocabulary because passing an array of odd length can lead to memory corruption." } ;
{ $warning "This word is in the " { $vocab-link "hashtables-internals" } " vocabulary because passing an array of odd length can lead to memory corruption." } ;
HELP: reset-hash "( n hash -- )"
{ $values { "n" "a positive integer specifying hashtable capacity" } { "hash" "a hashtable" } }
@ -94,7 +94,7 @@ HELP: ?grow-hash "( hash -- )"
HELP: hash>seq "( i hash -- seq )"
{ $values { "i" "0 or 1" } { "hash" "a hashtable" } { "seq" "a sequence of keys or values" } }
{ $description "User code should not call this word. It is unsafe and only used in the implementation of " { $link hash-keys } " and " { $link hash-values } ", both of which are safe." }
{ $warning "This word is in the " { $snippet "hashtables-internals" } " vocabulary because passing an invalid value for " { $snippet "i" } " can lead to memory corruption." } ;
{ $warning "This word is in the " { $vocab-link "hashtables-internals" } " vocabulary because passing an invalid value for " { $snippet "i" } " can lead to memory corruption." } ;
HELP: <hashtable> "( n -- hash )"
{ $values { "n" "a positive integer specifying hashtable capacity" } { "hash" "a new hashtable" } }

View File

@ -7,12 +7,12 @@ HELP: string f
HELP: char-slot "( n string -- ch )"
{ $values { "n" "a fixnum" } { "string" "a string" } { "ch" "the character at the " { $snippet "n" } "th index" } }
{ $description "Unsafe string accessor, used to define " { $link nth } " on strings." }
{ $warning "This word is in the " { $snippet "kernel-internals" } " vocabulary because it does not perform type or bounds checking. User code should call " { $link nth } " instead." } ;
{ $warning "This word is in the " { $vocab-link "kernel-internals" } " vocabulary because it does not perform type or bounds checking. User code should call " { $link nth } " instead." } ;
HELP: set-char-slot "( ch n string -- )"
{ $values { "ch" "a character" } { "n" "a fixnum" } { "string" "a string" } }
{ $description "Unsafe string mutator, used to define " { $link set-nth } " on strings." }
{ $warning "This word is in the " { $snippet "kernel-internals" } " vocabulary because it does not perform type or bounds checking. User code should call " { $link set-nth } " instead." } ;
{ $warning "This word is in the " { $vocab-link "kernel-internals" } " vocabulary because it does not perform type or bounds checking. User code should call " { $link set-nth } " instead." } ;
HELP: <string> "( n ch -- string )"
{ $values { "n" "a positive integer specifying string length" } { "elt" "an initial character" } }

View File

@ -3,7 +3,7 @@ USING: generic help kernel kernel-internals ;
HELP: tuple= "( tuple1 tuple2 -- ? )"
{ $values { "tuple1" "a tuple" } { "tuple2" "a tuple" } }
{ $description "Low-level tuple equality test. User code should use " { $link = } " instead." }
{ $warning "This word is in the " { $snippet "kernel-internals" } " vocabulary because it does not do any type checking. Passing values which are not tuples can result in memory corruption." } ;
{ $warning "This word is in the " { $vocab-link "kernel-internals" } " vocabulary because it does not do any type checking. Passing values which are not tuples can result in memory corruption." } ;
HELP: tuple f
{ $description "The class of tuples. This class is further partitioned into disjoint subclasses; each tuple shape defined by " { $link POSTPONE: TUPLE: } " is a new class."
@ -75,7 +75,7 @@ HELP: tuple>array "( tuple -- array )"
HELP: array>tuple "( array -- tuple )"
{ $values { "array" "a array" } { "tuple" "a new tuple" } }
{ $description "Outputs a tuple having the same slot values as the array." }
{ $warning "This word is in the " { $snippet "kernel-internals" } " vocabulary since it is unsafe. Creating a tuple with the wrong shape can cause crashes or memory corruption. User code should construct tuples using generated tuple constructors instead; see " { $link "tuples" } "." } ;
{ $warning "This word is in the " { $vocab-link "kernel-internals" } " vocabulary since it is unsafe. Creating a tuple with the wrong shape can cause crashes or memory corruption. User code should construct tuples using generated tuple constructors instead; see " { $link "tuples" } "." } ;
HELP: <tuple> "( class n -- tuple )"
{ $values { "class" "a class word" } { "n" "a non-negative integer" } { "tuple" "a new tuple" } }

View File

@ -89,10 +89,6 @@ M: word print-element { } swap execute ;
: $code ( content -- )
"\n" join dup <input> [ write ] ($code) ;
: $vocabulary ( content -- )
first word-vocabulary
[ "Vocabulary" $heading $snippet ] when* ;
: $description ( content -- )
"Description" $heading print-element ;
@ -135,6 +131,15 @@ M: object >link <link> ;
dup article-title swap >link write-object
] with-style ;
: $vocab-link ( content -- )
first link-style [
dup <vocab-link> write-object
] with-style ;
: $vocabulary ( content -- )
[ word-vocabulary ] map
[ "Vocabulary" $heading terpri $vocab-link ] when* ;
: textual-list ( seq quot -- )
[ ", " print-element ] interleave ; inline

View File

@ -31,3 +31,6 @@ SYMBOL: table-border
! Input history
TUPLE: input string ;
! Vocabulary links
TUPLE: vocab-link name ;

View File

@ -268,17 +268,17 @@ HELP: declare "( spec -- )"
HELP: array-capacity "( array -- n )"
{ $values { "array" "an array" } { "n" "a non-negative fixnum" } }
{ $description "Low-level array length accessor." }
{ $warning "This word is in the " { $snippet "kernel-internals" } " vocabulary because it is unsafe. It does not check types, so improper use can corrupt memory." } ;
{ $warning "This word is in the " { $vocab-link "kernel-internals" } " vocabulary because it is unsafe. It does not check types, so improper use can corrupt memory." } ;
HELP: array-nth "( n array -- elt )"
{ $values { "n" "a non-negative fixnum" } { "array" "an array" } { "elt" "an object" } }
{ $description "Low-level array element accessor." }
{ $warning "This word is in the " { $snippet "kernel-internals" } " vocabulary because it is unsafe. It does not check types or array bounds, and improper use can corrupt memory." } ;
{ $warning "This word is in the " { $vocab-link "kernel-internals" } " vocabulary because it is unsafe. It does not check types or array bounds, and improper use can corrupt memory." } ;
HELP: set-array-nth "( elt n array -- )"
{ $values { "elt" "an object" } { "n" "a non-negative fixnum" } { "array" "an array" } }
{ $description "Low-level array element mutator." }
{ $warning "This word is in the " { $snippet "kernel-internals" } " vocabulary because it is unsafe. It does not check types or array bounds, and improper use can corrupt memory." } ;
{ $warning "This word is in the " { $vocab-link "kernel-internals" } " vocabulary because it is unsafe. It does not check types or array bounds, and improper use can corrupt memory." } ;
HELP: cell "( -- n )"
{ $values { "n" "a positive integer" } }
@ -325,22 +325,22 @@ HELP: setenv "( obj n -- )"
HELP: integer-slot "( obj m -- n )"
{ $values { "obj" "an object" } { "m" "a non-negative fixnum" } { "n" "an integer" } }
{ $description "Reads the untagged integer stored at the " { $snippet "n" } "th slot of " { $snippet "obj" } "." }
{ $warning "This word is in the " { $snippet "kernel-internals" } " vocabulary because it does not perform type or bounds checks, and slot numbers are implementation detail." } ;
{ $warning "This word is in the " { $vocab-link "kernel-internals" } " vocabulary because it does not perform type or bounds checks, and slot numbers are implementation detail." } ;
HELP: set-integer-slot "( m obj n -- )"
{ $values { "n" "an integer" } { "obj" "an object" } { "m" "a non-negative fixnum" } }
{ $description "Writes an untagged integer to the " { $snippet "n" } "th slot of " { $snippet "obj" } "." }
{ $warning "This word is in the " { $snippet "kernel-internals" } " vocabulary because it does not perform type or bounds checks, and slot numbers are implementation detail." } ;
{ $warning "This word is in the " { $vocab-link "kernel-internals" } " vocabulary because it does not perform type or bounds checks, and slot numbers are implementation detail." } ;
HELP: slot "( obj m -- value )"
{ $values { "obj" "an object" } { "m" "a non-negative fixnum" } { "value" "an object" } }
{ $description "Reads the object stored at the " { $snippet "n" } "th slot of " { $snippet "obj" } "." }
{ $warning "This word is in the " { $snippet "kernel-internals" } " vocabulary because it does not perform type or bounds checks, and slot numbers are implementation detail." } ;
{ $warning "This word is in the " { $vocab-link "kernel-internals" } " vocabulary because it does not perform type or bounds checks, and slot numbers are implementation detail." } ;
HELP: set-slot "( value obj n -- )"
{ $values { "value" "an object" } { "obj" "an object" } { "m" "a non-negative fixnum" } }
{ $description "Writes " { $snippet "value" } " to the " { $snippet "n" } "th slot of " { $snippet "obj" } "." }
{ $warning "This word is in the " { $snippet "kernel-internals" } " vocabulary because it does not perform type or bounds checks, and slot numbers are implementation detail." } ;
{ $warning "This word is in the " { $vocab-link "kernel-internals" } " vocabulary because it does not perform type or bounds checks, and slot numbers are implementation detail." } ;
HELP: millis "( -- n )"
{ $values { "n" "an integer" } }
@ -357,4 +357,4 @@ HELP: os-env "( key -- value )"
HELP: dispatch "( n array -- )"
{ $values { "n" "a fixnum" } { "array" "an array of quotations" } }
{ $description "Calls the " { $snippet "n" } "th quotation in the array." }
{ $warning "This word is in the " { $snippet "kernel-internals" } " vocabulary because it is an implementation detail used by the generic word system to accelerate method dispatch. It does not perform type or bounds checks, and user code should not need to call it directly." } ;
{ $warning "This word is in the " { $vocab-link "kernel-internals" } " vocabulary because it is an implementation detail used by the generic word system to accelerate method dispatch. It does not perform type or bounds checks, and user code should not need to call it directly." } ;

View File

@ -14,9 +14,12 @@ sequences strings styles words ;
POSTPONE: foldable
} [ declaration. ] each-with ;
: write-vocab ( vocab -- )
dup <vocab-link> presented associate styled-text ;
: in. ( word -- )
word-vocabulary [
<block \ IN: pprint-word text block;
<block \ IN: pprint-word write-vocab block;
] when* ;
: (synopsis) ( word -- )
@ -82,7 +85,7 @@ GENERIC: class. ( word -- )
dup class? [
dup implementors [
newline
dup in. tuck dupd "methods" word-prop hash method.
tuck dupd "methods" word-prop hash method.
] each-with
] [
drop

View File

@ -1,7 +1,8 @@
! Copyright (C) 2005, 2006 Slava Pestov.
! See http://factorcode.org/license.txt for BSD license.
IN: gadgets-viewports
USING: arrays gadgets generic kernel math namespaces sequences ;
USING: arrays gadgets gadgets-borders generic kernel math
namespaces sequences ;
TUPLE: viewport ;
@ -10,7 +11,8 @@ TUPLE: viewport ;
: viewport-dim gadget-child pref-dim ;
C: viewport ( content -- viewport )
dup delegate>gadget [ add-gadget ] keep
dup delegate>gadget
[ >r 2 <border> r> add-gadget ] keep
t over set-gadget-clipped? ;
M: viewport layout* ( viewport -- )

View File

@ -1,12 +1,12 @@
! Copyright (C) 2006 Slava Pestov.
! See http://factorcode.org/license.txt for BSD license.
IN: gadgets-browser
USING: arrays gadgets gadgets-borders gadgets-buttons
gadgets-frames gadgets-labels gadgets-panes
USING: arrays gadgets gadgets-books gadgets-borders
gadgets-buttons gadgets-frames gadgets-labels gadgets-panes
gadgets-presentations gadgets-scrolling gadgets-search
gadgets-books gadgets-theme gadgets-tiles gadgets-tracks generic
hashtables help inspector kernel math models namespaces
prettyprint sequences words ;
gadgets-theme gadgets-tiles gadgets-tracks generic hashtables
help inspector kernel math models namespaces prettyprint
sequences styles words ;
TUPLE: asset-track showing builder closer ;
@ -155,9 +155,17 @@ M: browser gadget-title drop "Browser" <model> ;
: browser-window ( -- ) <browser> open-window ;
: browser-tool
[ browser? ]
[ <browser> ]
[ show-word ] ;
: browse ( obj browser -- )
over vocab-link? [
>r vocab-link-name r> show-vocab
] [
show-word
] if ;
: browser-tool [ browser? ] [ <browser> ] [ browse ] ;
M: word show ( word -- ) browser-tool call-tool ;
M: vocab-link show ( vocab -- ) browser-tool call-tool ;
M: f show ( f -- ) class show ;