factor: more lowercase.

locals-and-roots
Doug Coleman 2016-06-04 00:07:40 -07:00
parent af65a995a4
commit 9910c373c2
519 changed files with 974 additions and 974 deletions

View File

@ -26,8 +26,8 @@ in: benchmark.ant
TUPLE: point x y ;
C: <point> point
! USE: alien.c-types
! USE: classes.struct
! use: alien.c-types
! use: classes.struct
! STRUCT: point { x uint } { y uint } ;
! : <point> ( x y -- point ) point <struct-boa> ; inline

View File

@ -175,7 +175,7 @@ GENERIC: next-index ( object -- index ) ;
SYNTAX: sa{ \ } [ >shaped-array ] parse-literal ;
USE: prettyprint.custom
use: prettyprint.custom
! M: row-array pprint* shaped-array>array pprint* ;
! M: col-array pprint* shaped-array>array flip pprint* ;
M: shaped-array pprint-delims drop \ sa{ \ } ;

View File

@ -29,14 +29,14 @@ $nl
bit-array>integer
}
"Bit array literal syntax:"
{ $subsections POSTPONE: ?{ } ;
{ $subsections postpone: ?{ } ;
ABOUT: "bit-arrays"
HELP: ?{
{ $syntax "?{ elements... }" }
{ $values { "elements" "a list of booleans" } }
{ $description "Marks the beginning of a literal bit array. Literal bit arrays are terminated by " { $link POSTPONE: } } "." }
{ $description "Marks the beginning of a literal bit array. Literal bit arrays are terminated by " { $link postpone: } } "." }
{ $examples { $code "?{ t f t }" } } ;
HELP: bit-array

View File

@ -15,7 +15,7 @@ $nl
<bit-vector>
}
"Literal syntax:"
{ $subsections POSTPONE: ?V{ }
{ $subsections postpone: ?V{ }
"If you don't care about initial capacity, a more elegant way to create a new bit vector is to write:"
{ $code "?V{ } clone" } ;
@ -35,5 +35,5 @@ HELP: >bit-vector
HELP: ?V{
{ $syntax "?V{ elements... }" }
{ $values { "elements" "a list of booleans" } }
{ $description "Marks the beginning of a literal bit vector. Literal bit vectors are terminated by " { $link POSTPONE: } } "." }
{ $description "Marks the beginning of a literal bit vector. Literal bit vectors are terminated by " { $link postpone: } } "." }
{ $examples { $code "?V{ t f t }" } } ;

View File

@ -33,10 +33,10 @@ HELP: new-from-pool
}
{ $description "Allocates an object from the " { $link pool } " associated with " { $snippet "class" } ". If the pool is exhausted, " { $link f } " is returned." } ;
{ POSTPONE: POOL: class-pool set-class-pool new-from-pool free-to-pool } related-words
{ postpone: POOL: class-pool set-class-pool new-from-pool free-to-pool } related-words
HELP: pool
{ $class-description "A " { $snippet "pool" } " contains a fixed-size set of preallocated tuple objects. Once the pool has been allocated, its objects can be allocated with " { $link pool-new } " and freed with " { $link pool-free } " in constant time. A pool can also be associated with its class with the " { $link POSTPONE: POOL: } " syntax or the " { $link set-class-pool } " word, after which the words " { $link new-from-pool } " and " { $link free-to-pool } " can be used with the class name to allocate and free objects." } ;
{ $class-description "A " { $snippet "pool" } " contains a fixed-size set of preallocated tuple objects. Once the pool has been allocated, its objects can be allocated with " { $link pool-new } " and freed with " { $link pool-free } " in constant time. A pool can also be associated with its class with the " { $link postpone: POOL: } " syntax or the " { $link set-class-pool } " word, after which the words " { $link new-from-pool } " and " { $link free-to-pool } " can be used with the class name to allocate and free objects." } ;
HELP: pool-free
{ $values
@ -70,7 +70,7 @@ ARTICLE: "memory.pools" "Pools"
"The " { $vocab-link "memory.pools" } " vocabulary provides " { $link pool } " objects which manage preallocated collections of objects."
{ $subsections
pool
POSTPONE: POOL:
postpone: POOL:
new-from-pool
free-to-pool
} ;

View File

@ -20,7 +20,7 @@ $nl
"Converting a sequence into a persistent vector:"
{ $subsections >persistent-vector }
"Persistent vectors have a literal syntax:"
{ $subsections POSTPONE: PV{ }
{ $subsections postpone: PV{ }
"The empty persistent vector, written " { $snippet "PV{ }" } ", is used for building up all other persistent vectors."
$nl
"This implementation of persistent vectors is based on the " { $snippet "clojure.lang.PersistentVector" } " class from Rich Hickey's Clojure language for the JVM (" { $url "http://clojure.org" } ")." ;

View File

@ -11,7 +11,7 @@ HELP: SPECIALIZED-ARRAYS:
{ $values { "type" "a C type" } }
{ $description "Brings a set of specialized arrays for holding values of each " { $snippet "type" } " into the vocabulary search path. The generated words are documented in " { $link "specialized-array-words" } "." } ;
{ POSTPONE: SPECIALIZED-ARRAY: POSTPONE: SPECIALIZED-ARRAYS: } related-words
{ postpone: SPECIALIZED-ARRAY: postpone: SPECIALIZED-ARRAYS: } related-words
HELP: direct-slice
{ $values { "from" integer } { "to" integer } { "seq" "a specialized array" } { "seq'" "a new specialized array" } }
@ -36,7 +36,7 @@ HELP: direct-tail*
{ direct-slice direct-head direct-tail direct-head* direct-tail* } related-words
ARTICLE: "specialized-array-words" "Specialized array words"
"The " { $link POSTPONE: SPECIALIZED-ARRAY: } " and " { $link POSTPONE: SPECIALIZED-ARRAYS: } " parsing words generate specialized array types if they haven't been generated already and add the following words to the vocabulary search path, where " { $snippet "T" } " is the C type in question:"
"The " { $link postpone: SPECIALIZED-ARRAY: } " and " { $link postpone: SPECIALIZED-ARRAYS: } " parsing words generate specialized array types if they haven't been generated already and add the following words to the vocabulary search path, where " { $snippet "T" } " is the C type in question:"
{ $table
{ { $snippet "T-array" } { "The class of arrays with elements of type " { $snippet "T" } } }
{ { $snippet "<T-array>" } { "Constructor for arrays with elements of type " { $snippet "T" } "; stack effect " { $snippet "( len -- array )" } } }
@ -44,7 +44,7 @@ ARTICLE: "specialized-array-words" "Specialized array words"
{ { $snippet "<direct-T-array>" } { "Constructor for arrays with elements of type " { $snippet "T" } " backed by raw memory; stack effect " { $snippet "( alien len -- array )" } } }
{ { $snippet "T-array{" } { "Literal syntax, consists of a series of values terminated by " { $snippet "}" } } }
}
"Behind the scenes, these words are placed in a vocabulary named " { $snippet "specialized-arrays.instances.T" } ", however this vocabulary should not be placed in a " { $link POSTPONE: USING: } " form directly. Instead, always use " { $link POSTPONE: SPECIALIZED-ARRAY: } " or " { $link POSTPONE: SPECIALIZED-ARRAYS: } ". This ensures that the vocabulary can get generated the first time it is needed."
"Behind the scenes, these words are placed in a vocabulary named " { $snippet "specialized-arrays.instances.T" } ", however this vocabulary should not be placed in a " { $link postpone: USING: } " form directly. Instead, always use " { $link postpone: SPECIALIZED-ARRAY: } " or " { $link postpone: SPECIALIZED-ARRAYS: } ". This ensures that the vocabulary can get generated the first time it is needed."
$nl
"Additionally, special versions of the standard " { $link <slice> } ", " { $link head } ", and " { $link tail } " sequence operations are provided for specialized arrays to create a new specialized array object sharing storage with a subsequence of an existing array:"
{ $subsections
@ -116,8 +116,8 @@ ARTICLE: "specialized-arrays" "Specialized arrays"
$nl
"A specialized array type needs to be generated for each element type. This is done with parsing words:"
{ $subsections
POSTPONE: SPECIALIZED-ARRAY:
POSTPONE: SPECIALIZED-ARRAYS:
postpone: SPECIALIZED-ARRAY:
postpone: SPECIALIZED-ARRAYS:
}
"This parsing word adds new words to the search path, documented in the next section."
{ $subsections

View File

@ -180,7 +180,7 @@ SPECIALIZED-ARRAY: struct-resize-test
{ { 10 20 30 } } [ { 10 20 30 } struct-resize-test-usage ] unit-test
{ } [ "IN: specialized-arrays.tests USE: classes.struct USE: alien.c-types STRUCT: struct-resize-test { x int } { y int } ;" eval( -- ) ] unit-test
{ } [ "in: specialized-arrays.tests use: classes.struct use: alien.c-types STRUCT: struct-resize-test { x int } { y int } ;" eval( -- ) ] unit-test
{ 80 } [ 10 <struct-resize-test-array> byte-length ] unit-test

View File

@ -11,17 +11,17 @@ HELP: SPECIALIZED-VECTORS:
{ $values { "type" "a C type" } }
{ $description "Brings a set of specialized vectors for holding values of each " { $snippet "type" } " into the vocabulary search path. The generated words are documented in " { $link "specialized-vector-words" } "." } ;
{ POSTPONE: SPECIALIZED-VECTOR: POSTPONE: SPECIALIZED-VECTORS: } related-words
{ postpone: SPECIALIZED-VECTOR: postpone: SPECIALIZED-VECTORS: } related-words
ARTICLE: "specialized-vector-words" "Specialized vector words"
"The " { $link POSTPONE: SPECIALIZED-VECTOR: } " parsing word generates the specialized vector type if it hasn't been generated already, and adds the following words to the vocabulary search path, where " { $snippet "T" } " is the C type in question:"
"The " { $link postpone: SPECIALIZED-VECTOR: } " parsing word generates the specialized vector type if it hasn't been generated already, and adds the following words to the vocabulary search path, where " { $snippet "T" } " is the C type in question:"
{ $table
{ { $snippet "T-vector" } { "The class of vectors with elements of type " { $snippet "T" } } }
{ { $snippet "<T-vector>" } { "Constructor for vectors with elements of type " { $snippet "T" } "; stack effect " { $snippet "( len -- vector )" } } }
{ { $snippet ">T-vector" } { "Converts a sequence into a specialized vector of type " { $snippet "T" } "; stack effect " { $snippet "( seq -- vector )" } } }
{ { $snippet "T-vector{" } { "Literal syntax, consists of a series of values terminated by " { $snippet "}" } } }
}
"Behind the scenes, these words are placed in a vocabulary named " { $snippet "specialized-vectors.instances.T" } ", however this vocabulary should not be placed in a " { $link POSTPONE: USING: } " form directly. Instead, always use " { $link POSTPONE: SPECIALIZED-VECTOR: } ". This ensures that the vocabulary can get generated the first time it is needed." ;
"Behind the scenes, these words are placed in a vocabulary named " { $snippet "specialized-vectors.instances.T" } ", however this vocabulary should not be placed in a " { $link postpone: USING: } " form directly. Instead, always use " { $link postpone: SPECIALIZED-VECTOR: } ". This ensures that the vocabulary can get generated the first time it is needed." ;
HELP: push-new
{ $values { "vector" "a specialized vector of structs" } { "new" "a new value of the specialized vector's type" } }
@ -45,8 +45,8 @@ ARTICLE: "specialized-vectors" "Specialized vectors"
$nl
"A specialized vector type needs to be generated for each element type. This is done with parsing words:"
{ $subsections
POSTPONE: SPECIALIZED-VECTOR:
POSTPONE: SPECIALIZED-VECTORS:
postpone: SPECIALIZED-VECTOR:
postpone: SPECIALIZED-VECTORS:
}
{ $subsections
"specialized-vector-words"

View File

@ -31,7 +31,7 @@ ARTICLE: "suffix-arrays" "Suffix arrays"
"Creating new suffix arrays:"
{ $subsections >suffix-array }
"Literal suffix arrays:"
{ $subsections POSTPONE: SA{ }
{ $subsections postpone: SA{ }
"Querying suffix arrays:"
{ $subsections query } ;

View File

@ -23,7 +23,7 @@ ARTICLE: "trees.avl" "AVL trees"
avl
<avl>
>avl
POSTPONE: AVL{
postpone: AVL{
} ;
ABOUT: "trees.avl"

View File

@ -23,7 +23,7 @@ ARTICLE: "trees.splay" "Splay trees"
splay
<splay>
>splay
POSTPONE: SPLAY{
postpone: SPLAY{
} ;
ABOUT: "trees.splay"

View File

@ -23,7 +23,7 @@ ARTICLE: "trees" "Binary search trees"
tree
<tree>
>tree
POSTPONE: TREE{
postpone: TREE{
} ;
ABOUT: "trees"

View File

@ -1,30 +1,30 @@
auto-use
in: syntax
USE: delegate.private
use: delegate.private
<< forget: POSTPONE: MACRO: >>
<< forget: POSTPONE: MACRO:: >>
<< forget: POSTPONE: MEMO: >>
<< forget: POSTPONE: MEMO:: >>
<< forget: POSTPONE: M:: >>
<< forget: POSTPONE: IDENTITY-MEMO: >>
<< forget: POSTPONE: IDENTITY-MEMO:: >>
<< forget: POSTPONE: TYPED: >>
<< forget: POSTPONE: TYPED:: >>
<< forget: postpone: MACRO: >>
<< forget: postpone: MACRO:: >>
<< forget: postpone: MEMO: >>
<< forget: postpone: MEMO:: >>
<< forget: postpone: M:: >>
<< forget: postpone: IDENTITY-MEMO: >>
<< forget: postpone: IDENTITY-MEMO:: >>
<< forget: postpone: TYPED: >>
<< forget: postpone: TYPED:: >>
<< forget: POSTPONE: '[ >>
<< forget: POSTPONE: :: >>
<< forget: POSTPONE: :> >>
<< forget: postpone: '[ >>
<< forget: postpone: :: >>
<< forget: postpone: :> >>
<< forget: _ >>
<< forget: @ >>
<< forget: POSTPONE: [| >>
<< forget: POSTPONE: [let >>
<< forget: POSTPONE: IH{ >>
<< forget: POSTPONE: PROTOCOL: >>
<< forget: POSTPONE: CONSULT: >>
<< forget: POSTPONE: BROADCAST: >>
<< forget: POSTPONE: SLOT-PROTOCOL: >>
<< forget: POSTPONE: HINTS: >>
<< forget: postpone: [| >>
<< forget: postpone: [let >>
<< forget: postpone: IH{ >>
<< forget: postpone: PROTOCOL: >>
<< forget: postpone: CONSULT: >>
<< forget: postpone: BROADCAST: >>
<< forget: postpone: SLOT-PROTOCOL: >>
<< forget: postpone: HINTS: >>
@ -88,7 +88,7 @@ SYNTAX: HINTS:
H{ } clone root-cache set-global
USE: io.directories.search
use: io.directories.search
"/Users/erg/factor/core/locals" t recursive-directory-files
[ "/Users/erg/factor/core/" ?head drop ] map
[ "." swap subseq? ] reject
@ -97,8 +97,8 @@ SYNTAX: HINTS:
[ reload ] each
USE: io.directories.search
USE: ui.tools.listener
use: io.directories.search
use: ui.tools.listener
"/Users/erg/factor/core/stack-checker" t recursive-directory-files
[ "/Users/erg/factor/core/" ?head drop ] map
[ "." swap subseq? ] reject

View File

@ -75,7 +75,7 @@ HELP: class
HELP: class-of
{ $values { "object" object } { "class" class } }
{ $description "Outputs an object's canonical class. While an object may be an instance of more than one class, the canonical class is either its built-in class, or if the object is a tuple, its tuple class." }
{ $examples { $example "USING: classes prettyprint ;" "1.0 class-of ." "float" } { $example "USING: classes prettyprint ;" "IN: scratchpad" "TUPLE: point x y z ;\nT{ point f 1 2 3 } class-of ." "point" } } ;
{ $examples { $example "USING: classes prettyprint ;" "1.0 class-of ." "float" } { $example "USING: classes prettyprint ;" "in: scratchpad" "TUPLE: point x y z ;\nT{ point f 1 2 3 } class-of ." "point" } } ;
HELP: classes
{ $values { "seq" "a sequence of class words" } }

View File

@ -62,5 +62,5 @@ M: f lol2 drop "lol22" ;
{ "lol22" } [ f lol2 ] unit-test
[ 3 lol2 ] [ no-method? ] must-fail-with
[ "IN: classes-tests maybe{ 1 2 3 }" eval( -- ) ]
[ "in: classes-tests maybe{ 1 2 3 }" eval( -- ) ]
[ error>> not-classoids? ] must-fail-with

View File

@ -350,7 +350,7 @@ ABOUT: "tuples"
HELP: tuple-class
{ $class-description "The class of tuple class words." }
{ $examples { $example "USING: classes.tuple prettyprint ;" "IN: scratchpad" "TUPLE: name title first last ;" "name tuple-class? ." "t" } } ;
{ $examples { $example "USING: classes.tuple prettyprint ;" "in: scratchpad" "TUPLE: name title first last ;" "name tuple-class? ." "t" } } ;
HELP: tuple=
{ $values { "tuple1" tuple } { "tuple2" tuple } { "?" boolean } }
@ -437,7 +437,7 @@ HELP: new
{ $examples
{ $example
"USING: kernel prettyprint ;"
"IN: scratchpad"
"in: scratchpad"
"TUPLE: employee number name department ;"
"employee new ."
"T{ employee }"

View File

@ -301,7 +301,7 @@ HELP: to-fixed-point
{ $examples
{ $example
"USING: combinators kernel math prettyprint sequences ;"
"IN: scratchpad"
"in: scratchpad"
": flatten ( sequence -- sequence' )"
" \"flatten\" over index"
" [ [ 1 + swap nth ] [ nip dup 2 + ] [ drop ] 2tri replace-slice ] when* ;"
@ -356,7 +356,7 @@ HELP: case
{ $examples
{ $example
"USING: combinators io kernel ;"
"IN: scratchpad"
"in: scratchpad"
"SYMBOLS: yes no maybe ;"
"maybe {"
" { yes [ ] } ! Do nothing"

View File

@ -104,7 +104,7 @@ $nl
"Manually creating a word using the non-optimizing compiler:"
{ $example
"USING: compiler.units io ;"
"IN: test symbol: foo"
"in: test symbol: foo"
"{ { foo [ \"hello!\" write nl ] } } t t modify-code-heap foo"
"hello!"
}

View File

@ -54,7 +54,7 @@ observer add-definition-observer
defer: nesting-test
{ } [ "IN: compiler.units.tests << : nesting-test ( -- ) ; >>" eval( -- ) ] unit-test
{ } [ "in: compiler.units.tests << : nesting-test ( -- ) ; >>" eval( -- ) ] unit-test
observer remove-definition-observer

View File

@ -133,7 +133,7 @@ HELP: <clumps>
"Running averages:"
{ $example
"USING: grouping sequences math prettyprint kernel ;"
"IN: scratchpad"
"in: scratchpad"
"CONSTANT: share-price { 13/50 51/100 13/50 1/10 4/5 17/20 33/50 3/25 19/100 3/100 }"
""
"share-price 4 <clumps> [ [ sum ] [ length ] bi / ] map ."

View File

@ -214,7 +214,7 @@ HELP: execute
{ $values { "word" word } }
{ $description "Executes a word. Words which " { $link execute } " an input parameter must be declared " { $link postpone: inline } " so that a caller which passes in a literal word can have a static stack effect." }
{ $examples
{ $example "USING: kernel io words ;" "IN: scratchpad" ": twice ( word -- ) dup execute execute ; inline\n: hello ( -- ) \"Hello\" print ;\n\\ hello twice" "Hello\nHello" }
{ $example "USING: kernel io words ;" "in: scratchpad" ": twice ( word -- ) dup execute execute ; inline\n: hello ( -- ) \"Hello\" print ;\n\\ hello twice" "Hello\nHello" }
} ;
{ execute postpone: execute( } related-words
@ -632,7 +632,7 @@ $nl
{ $examples
{ $example
"USING: kernel math prettyprint sequences ;"
"IN: scratchpad"
"in: scratchpad"
""
"CONSTANT: american-cities {"
" \"San Francisco\""
@ -660,7 +660,7 @@ $nl
"Notice how in this example, the same value is tested by the conditional, and then used in the true branch; the false branch does not need to drop the value because of how " { $link if* } " works:"
{ $example
"USING: assocs io kernel math.parser ;"
"IN: scratchpad"
"in: scratchpad"
""
": curry-price ( meat -- price )
{

View File

@ -23,13 +23,13 @@ MEMO: x ( a b c d e -- f g h i j )
MEMO: see-test ( a -- b ) reverse ;
{ "USING: sequences ;\nIN: memoize.tests\nMEMO: see-test ( a -- b ) reverse ;\n" }
{ "USING: sequences ;\nin: memoize.tests\nMEMO: see-test ( a -- b ) reverse ;\n" }
[ [ \ see-test see ] with-string-writer ]
unit-test
{ } [ "IN: memoize.tests : fib ( -- ) ;" eval( -- ) ] unit-test
{ } [ "in: memoize.tests : fib ( -- ) ;" eval( -- ) ] unit-test
{ "IN: memoize.tests\n: fib ( -- ) ;\n" } [ [ \ fib see ] with-string-writer ] unit-test
{ "in: memoize.tests\n: fib ( -- ) ;\n" } [ [ \ fib see ] with-string-writer ] unit-test
[ sq ] ( a -- b ) memoize-quot "q" set

View File

@ -110,7 +110,7 @@ HELP: +@
{ $description "Adds " { $snippet "n" } " to the value of the variable. A variable value of " { $link f } " is interpreted as being zero." }
{ $side-effects "variable" }
{ $examples
{ $example "USING: namespaces prettyprint ;" "IN: scratchpad" "symbol: foo\n1 foo +@\n10 foo +@\nfoo get ." "11" }
{ $example "USING: namespaces prettyprint ;" "in: scratchpad" "symbol: foo\n1 foo +@\n10 foo +@\nfoo get ." "11" }
} ;
HELP: inc
@ -133,7 +133,7 @@ HELP: with-scope
{ $values { "quot" quotation } }
{ $description "Calls the quotation in a new namespace. Any variables set by the quotation are discarded when it returns." }
{ $examples
{ $example "USING: math namespaces prettyprint ;" "IN: scratchpad" "symbol: x" "0 x set" "[ x [ 5 + ] change x get . ] with-scope x get ." "5\n0" }
{ $example "USING: math namespaces prettyprint ;" "in: scratchpad" "symbol: x" "0 x set" "[ x [ 5 + ] change x get . ] with-scope x get ." "5\n0" }
} ;
HELP: with-variable

View File

@ -451,7 +451,7 @@ defer: foo
{ } [
2 [
"in: parser.tests defer: twice-fails forget: twice-fails MIXin: twice-fails"
"in: parser.tests defer: twice-fails forget: twice-fails mixin: twice-fails"
<string-reader> "twice-fails-test" parse-stream drop
] times
] unit-test

View File

@ -32,7 +32,7 @@ ARTICLE: "wrappers" "Wrappers"
}
"Wrapper literal syntax is documented in " { $link "syntax-words" } "."
{ $example
"IN: scratchpad"
"in: scratchpad"
"defer: my-word"
"\\ my-word name>> ."
"\"my-word\""

View File

@ -2,10 +2,10 @@ USING: effects eval math tools.test ;
in: words.alias.tests
ALIAS: foo +
{ } [ "IN: words.alias.tests CONSTANT: foo 5" eval( -- ) ] unit-test
{ } [ "in: words.alias.tests CONSTANT: foo 5" eval( -- ) ] unit-test
{ ( -- value ) } [ \ foo stack-effect ] unit-test
ALIAS: MY-H{ H{
{ H{ { 1 2 } } } [
"IN: words.alias.tests MY-H{ { 1 2 } }" eval( -- x )
"in: words.alias.tests MY-H{ { 1 2 } }" eval( -- x )
] unit-test

View File

@ -1,4 +1,4 @@
USE: io
use: io
in: hello-world
: hello ( -- ) "Hello world" print ;

View File

@ -31,7 +31,7 @@ in: rosetta-code.ternary-logic
! algorithm and is preferable to binary logic.
singleton: m
UNION: trit t m POSTPONE: f ;
UNION: trit t m postpone: f ;
GENERIC: >trit ( object -- trit ) ;
M: trit >trit ;

View File

@ -28,7 +28,7 @@ CONSTANT: galois-slides
{ $slide "Vocabularies"
"Vocabularies: named sets of words"
{ $link "vocab-index" }
{ { $link POSTPONE: USING: } " loads dependencies" }
{ { $link postpone: USING: } " loads dependencies" }
"Source, docs, tests in one place"
}
{ $slide "Interactive development"
@ -68,7 +68,7 @@ CONSTANT: galois-slides
{ $code "GENERIC: area ( shape -- n ) ;" }
"Two methods:"
{ $code
"USE: math.constants"
"use: math.constants"
""
"M: rectangle area"
" [ width>> ] [ height>> ] bi * ;"
@ -132,12 +132,12 @@ CONSTANT: galois-slides
{ $vocab-link "regexp" }
"Pre-compiles regexp at parse time"
"Implemented with library code"
{ $code "USE: regexp" }
{ $code "use: regexp" }
{ $code "\"ababbc\" \"[ab]+c\" <regexp> matches? ." }
{ $code "\"ababbc\" R/ [ab]+c/ matches? ." }
}
{ $slide "Example: memoization"
{ "Memoization with " { $link POSTPONE: MEMO: } }
{ "Memoization with " { $link postpone: MEMO: } }
{ $code
": fib ( m -- n )"
" dup 1 > ["
@ -147,7 +147,7 @@ CONSTANT: galois-slides
"Very slow! Let's profile it..."
}
{ $slide "Example: memoization"
{ "Let's use " { $link POSTPONE: : } " instead of " { $link POSTPONE: MEMO: } }
{ "Let's use " { $link postpone: : } " instead of " { $link postpone: MEMO: } }
{ $code
"MEMO: fib ( m -- n )"
" dup 1 > ["
@ -157,10 +157,10 @@ CONSTANT: galois-slides
"Much faster"
}
{ $slide "Meta-circularity"
{ { $link POSTPONE: MEMO: } " is just a library word" }
{ "But so is " { $link POSTPONE: : } }
{ { $link postpone: MEMO: } " is just a library word" }
{ "But so is " { $link postpone: : } }
"Factor's parser is written in Factor"
{ "All syntax is just parsing words: " { $link POSTPONE: [ } ", " { $link POSTPONE: " } }
{ "All syntax is just parsing words: " { $link postpone: [ } ", " { $link postpone: " } }
}
{ $slide "Extensible syntax, DSLs"
"Most parsing words fall in one of two categories"
@ -169,7 +169,7 @@ CONSTANT: galois-slides
"Some parsing words are more complicated"
}
{ $slide "Example: printf"
{ { $link POSTPONE: EBNF: } ": a complex parsing word" }
{ { $link postpone: EBNF: } ": a complex parsing word" }
"Implements a custom syntax for expressing parsers: like OMeta!"
{ "Example: " { $vocab-link "printf-example" } }
{ $code "\"vegan\" \"cheese\" \"%s is not %s\\n\" printf" }
@ -188,10 +188,10 @@ CONSTANT: galois-slides
"Influenced by Scheme and Lisp"
}
{ $slide "Locals and lexical scope"
{ "Define lambda words with " { $link POSTPONE: :: } }
{ "Establish bindings with " { $link POSTPONE: [let } " and " { $snippet "[let*" } }
{ "Define lambda words with " { $link postpone: :: } }
{ "Establish bindings with " { $link postpone: [let } " and " { $snippet "[let*" } }
"Mutable bindings with correct semantics"
{ "Named inputs for quotations with " { $link POSTPONE: [| } }
{ "Named inputs for quotations with " { $link postpone: [| } }
"Full closures"
}
{ $slide "Locals and lexical scope"
@ -219,7 +219,7 @@ CONSTANT: galois-slides
"In the base image, only 59 words out of 13,000 use locals"
}
{ $slide "More about partial application"
{ { $link POSTPONE: '[ } " is \"fry syntax\"" }
{ { $link postpone: '[ } " is \"fry syntax\"" }
{ $code "'[ _ + ] == [ + ] curry" }
{ $code "'[ @ t ] == [ t ] compose" }
{ $code "'[ _ nth @ ] == [ [ nth ] curry ] dip compose" }

View File

@ -28,7 +28,7 @@ CONSTANT: google-slides
}
{ $slide "Example: factorial"
"Lame example, but..."
{ $code "USE: math.ranges" ": factorial ( n -- n! )" " 1 [a,b] product ;" }
{ $code "use: math.ranges" ": factorial ( n -- n! )" " 1 [a,b] product ;" }
{ $code "100 factorial ." }
}
{ $slide "Example: sending an e-mail"
@ -114,7 +114,7 @@ CONSTANT: google-slides
{ $code "GENERIC: area ( shape -- n ) ;" }
"Two methods:"
{ $code
"USE: math.constants"
"use: math.constants"
""
"M: rectangle area"
" [ width>> ] [ height>> ] bi * ;"
@ -246,12 +246,12 @@ CONSTANT: google-slides
}
{ $slide "Unicode strings"
"Unicode-aware case conversion, char classes, collation, word breaks, and so on..."
{ $code "USE: unicode" "\"ß\" >upper ." }
{ $code "use: unicode" "\"ß\" >upper ." }
}
{ $slide "Unicode strings"
"All external byte I/O is encoded/decoded"
"ASCII, UTF8, UTF16, EBCDIC..."
{ $code "USE: io.encodings.utf8" "\"document.txt\" utf8" "[ readln ] with-file-reader" }
{ $code "use: io.encodings.utf8" "\"document.txt\" utf8" "[ readln ] with-file-reader" }
{ "Binary I/O is supported as well with the " { $link binary } " encoding" }
}
{ $slide "Associative mappings"
@ -271,10 +271,10 @@ CONSTANT: google-slides
"Influenced by Scheme and Lisp"
}
{ $slide "Locals and lexical scope"
{ "Define lambda words with " { $link POSTPONE: :: } }
{ "Establish bindings with " { $link POSTPONE: [let } " and " { $snippet "[let*" } }
{ "Define lambda words with " { $link postpone: :: } }
{ "Establish bindings with " { $link postpone: [let } " and " { $snippet "[let*" } }
"Mutable bindings with correct semantics"
{ "Named inputs for quotations with " { $link POSTPONE: [| } }
{ "Named inputs for quotations with " { $link postpone: [| } }
"Full closures"
}
{ $slide "Locals and lexical scope"
@ -296,11 +296,11 @@ CONSTANT: google-slides
"Libraries can define new parsing words"
}
{ $slide "The parser"
{ "Example: URLs define a " { $link POSTPONE: URL" } " word" }
{ "Example: URLs define a " { $link postpone: URL" } " word" }
{ $code "URL\" http://paste.factorcode.org/paste?id=81\"" }
}
{ $slide "Example: memoization"
{ "Memoization with " { $link POSTPONE: MEMO: } }
{ "Memoization with " { $link postpone: MEMO: } }
{ $code
": fib ( m -- n )"
" dup 1 > ["
@ -310,7 +310,7 @@ CONSTANT: google-slides
"Very slow! Let's profile it..."
}
{ $slide "Example: memoization"
{ "Let's use " { $link POSTPONE: : } " instead of " { $link POSTPONE: MEMO: } }
{ "Let's use " { $link postpone: : } " instead of " { $link postpone: MEMO: } }
{ $code
"MEMO: fib ( m -- n )"
" dup 1 > ["
@ -320,10 +320,10 @@ CONSTANT: google-slides
"Much faster"
}
{ $slide "Meta-circularity"
{ { $link POSTPONE: MEMO: } " is just a library word" }
{ "But so is " { $link POSTPONE: : } }
{ { $link postpone: MEMO: } " is just a library word" }
{ "But so is " { $link postpone: : } }
"Factor's parser is written in Factor"
{ "All syntax is just parsing words: " { $link POSTPONE: [ } ", " { $link POSTPONE: " } }
{ "All syntax is just parsing words: " { $link postpone: [ } ", " { $link postpone: " } }
}
{ $slide "Extensible syntax, DSLs"
"Most parsing words fall in one of two categories"
@ -332,7 +332,7 @@ CONSTANT: google-slides
"Some parsing words are more complicated"
}
{ $slide "Parser expression grammars"
{ { $link POSTPONE: EBNF: } ": a complex parsing word" }
{ { $link postpone: EBNF: } ": a complex parsing word" }
"Implements a custom syntax for expressing parsers"
{ "Example: " { $vocab-link "printf-example" } }
{ $code "\"vegan\" \"cheese\" \"%s is not %s\\n\" printf" }
@ -349,7 +349,7 @@ CONSTANT: google-slides
}
{ $slide "Example: file system monitors"
{ $code
"USE: io.monitors"
"use: io.monitors"
""
": forever ( quot -- ) '[ @ t ] loop ; inline"
""
@ -437,7 +437,7 @@ CONSTANT: google-slides
}
{ $slide "Compiler: escape analysis"
"We identify allocations for tuples which are never returned or passed to other words (except slot access)"
{ "Partial application with " { $link POSTPONE: '[ } }
{ "Partial application with " { $link postpone: '[ } }
"Complex numbers"
}
{ $slide "Compiler: escape analysis"

View File

@ -80,7 +80,7 @@ CONSTANT: minneapolis-slides
STRIP-TEASE:
$slide "An example"
{ $code
"USE: math.constants"
"use: math.constants"
"GENERIC: area ( shape -- meters^2 ) ;"
"M: square area square-dimension sq ;"
"M: circle area circle-radius sq pi * ;"
@ -110,14 +110,14 @@ CONSTANT: minneapolis-slides
"Let's profile it!"
}
{ $slide "Memoization"
{ { $link POSTPONE: : } " is just another word" }
{ { $link postpone: : } " is just another word" }
"What if we could define a word which caches its results?"
{ "The " { $vocab-link "memoize" } " library provides such a feature" }
{ "Just change " { $link POSTPONE: : } " to " { $link POSTPONE: MEMO: } }
{ "Just change " { $link postpone: : } " to " { $link postpone: MEMO: } }
}
{ $slide "Memoization"
{ $code
"USE: memoize"
"use: memoize"
""
"MEMO: fib ( x -- y )"
" dup 1 > ["

View File

@ -53,7 +53,7 @@ CONSTANT: otug-slides
{ $slide "Constructing quotations"
{ "Suppose we want a " { $snippet "remove-comments*" } " word" }
{ $code ": remove-comments* ( lines string -- lines' )" " [ ??? head? ] reject ;" }
{ "We use " { $link POSTPONE: '[ } " instead of " { $link POSTPONE: [ } }
{ "We use " { $link postpone: '[ } " instead of " { $link postpone: [ } }
{ "Create “holes” with " { $link _ } }
"Holes filled in left to right when quotation pushed on the stack"
}

View File

@ -17,7 +17,7 @@ CONSTANT: tc-lisp-slides
}
{ $slide "First, some examples"
{ $code "3 weeks ago noon monday ." }
{ $code "USE: roman 2009 >roman ." }
{ $code "use: roman 2009 >roman ." }
{ $code ": average ( seq -- x )
[ sum ] [ length ] bi / ;" }
{ $code "1 miles [ km ] undo >float ." }
@ -78,11 +78,11 @@ CONSTANT: tc-lisp-slides
}
{ $slide "Object system"
"Based on CLOS"
{ "We define generic words that operate on the top of the stack with " { $link POSTPONE: GENERIC: } " or on an implicit parameter with " { $link POSTPONE: HOOK: } }
{ "We define generic words that operate on the top of the stack with " { $link postpone: GENERIC: } " or on an implicit parameter with " { $link postpone: HOOK: } }
}
{ $slide "Object system example: shape protocol"
"In ~/factor/work/shapes/shapes.factor"
{ $code "IN: shapes
{ $code "in: shapes
GENERIC: area ( shape -- x ) ;
GENERIC: perimeter ( shape -- x ) ;"

View File

@ -64,7 +64,7 @@ CONSTANT: vpri-slides
{ $code "GENERIC: area ( shape -- n ) ;" }
"Two methods:"
{ $code
"USE: math.constants"
"use: math.constants"
""
"M: rectangle area"
" [ width>> ] [ height>> ] bi * ;"
@ -157,7 +157,7 @@ CONSTANT: vpri-slides
{ $code "float-array{ 3.14 7.6 10.3 }" }
}
{ $slide "Example: memoization"
{ "Memoization with " { $link POSTPONE: MEMO: } }
{ "Memoization with " { $link postpone: MEMO: } }
{ $code
": fib ( m -- n )"
" dup 1 > ["
@ -167,7 +167,7 @@ CONSTANT: vpri-slides
"Very slow! Let's profile it..."
}
{ $slide "Example: memoization"
{ "Let's use " { $link POSTPONE: : } " instead of " { $link POSTPONE: MEMO: } }
{ "Let's use " { $link postpone: : } " instead of " { $link postpone: MEMO: } }
{ $code
"MEMO: fib ( m -- n )"
" dup 1 > ["
@ -177,10 +177,10 @@ CONSTANT: vpri-slides
"Much faster"
}
{ $slide "Meta-circularity"
{ { $link POSTPONE: MEMO: } " is just a library word" }
{ "But so is " { $link POSTPONE: : } }
{ { $link postpone: MEMO: } " is just a library word" }
{ "But so is " { $link postpone: : } }
"Factor's parser is written in Factor"
{ "All syntax is just parsing words: " { $link POSTPONE: [ } ", " { $link POSTPONE: " } }
{ "All syntax is just parsing words: " { $link postpone: [ } ", " { $link postpone: " } }
}
{ $slide "Extensible syntax, DSLs"
"Most parsing words fall in one of two categories"
@ -189,7 +189,7 @@ CONSTANT: vpri-slides
"Some parsing words are more complicated"
}
{ $slide "Example: printf"
{ { $link POSTPONE: EBNF: } ": a complex parsing word" }
{ { $link postpone: EBNF: } ": a complex parsing word" }
"Implements a custom syntax for expressing parsers: like OMeta!"
{ "Example: " { $vocab-link "printf-example" } }
{ $code "\"vegan\" \"cheese\" \"%s is not %s\\n\" printf" }
@ -208,10 +208,10 @@ CONSTANT: vpri-slides
"Influenced by Scheme and Lisp"
}
{ $slide "Locals and lexical scope"
{ "Define lambda words with " { $link POSTPONE: :: } }
{ "Establish bindings with " { $link POSTPONE: [let } " and " { $snippet "[let*" } }
{ "Define lambda words with " { $link postpone: :: } }
{ "Establish bindings with " { $link postpone: [let } " and " { $snippet "[let*" } }
"Mutable bindings with correct semantics"
{ "Named inputs for quotations with " { $link POSTPONE: [| } }
{ "Named inputs for quotations with " { $link postpone: [| } }
"Full closures"
}
{ $slide "Locals and lexical scope"
@ -241,7 +241,7 @@ CONSTANT: vpri-slides
"In the base image, only 59 words out of 13,000 use locals"
}
{ $slide "More about partial application"
{ { $link POSTPONE: '[ } " is \"fry syntax\"" }
{ { $link postpone: '[ } " is \"fry syntax\"" }
{ $code "'[ _ + ] == [ + ] curry" }
{ $code "'[ @ t ] == [ t ] compose" }
{ $code "'[ _ nth @ ] == [ [ nth ] curry ] dip compose" }

View File

@ -21,8 +21,8 @@ in: cairo-demo
TUPLE: cairo-demo-gadget < gadget image-array cairo-t ;
USE: io
USE: formatting
use: io
use: formatting
M: cairo-demo-gadget draw-gadget* ( gadget -- )
0 0 glRasterPos2i

View File

@ -14,7 +14,7 @@ HELP: SUPER->
{ $description "A sugared form of the following:" }
{ $code "\"selector\" send-super" } ;
{ send super-send POSTPONE: -> POSTPONE: SUPER-> } related-words
{ send super-send postpone: -> postpone: SUPER-> } related-words
HELP: IMPORT:
{ $syntax "IMPORT: name" }
@ -25,13 +25,13 @@ HELP: IMPORT:
ARTICLE: "objc-calling" "Calling Objective C code"
"Before an Objective C class can be used, it must be imported; by default, a small set of common classes are imported automatically, but additional classes can be imported as needed."
{ $subsections POSTPONE: IMPORT: }
{ $subsections postpone: IMPORT: }
"Every imported Objective C class has as corresponding class word in the " { $vocab-link "cocoa.classes" } " vocabulary. Class words push the class object in the stack, allowing class methods to be invoked."
$nl
"Messages can be sent to classes and instances using a pair of parsing words:"
{ $subsections
POSTPONE: ->
POSTPONE: SUPER->
postpone: ->
postpone: SUPER->
}
"These parsing words are actually syntax sugar for a pair of ordinary words; they can be used instead of the parsing words if the selector name is dynamically computed:"
{ $subsections

View File

@ -3,21 +3,21 @@ in: cocoa.subclassing
HELP: CLASS:
{ $syntax "CLASS: name < superclass protocols... imeth... ;" }
{ $values { "name" "a new class name" } { "superclass" "a superclass name" } { "protocols" "zero or more protocol names" } { "imeth" "instance method definitions using " { $link POSTPONE: METHOD: } } }
{ $description "Defines a new Objective C class. Instance methods are defined with the " { $link POSTPONE: METHOD: } " parsing word."
{ $values { "name" "a new class name" } { "superclass" "a superclass name" } { "protocols" "zero or more protocol names" } { "imeth" "instance method definitions using " { $link postpone: METHOD: } } }
{ $description "Defines a new Objective C class. Instance methods are defined with the " { $link postpone: METHOD: } " parsing word."
$nl
"This word is preferred to calling " { $link define-objc-class } ", because it creates a class word in the " { $vocab-link "cocoa.classes" } " vocabulary at parse time, allowing code to refer to the class word in the same source file where the class is defined." } ;
{ define-objc-class POSTPONE: CLASS: POSTPONE: METHOD: } related-words
{ define-objc-class postpone: CLASS: postpone: METHOD: } related-words
HELP: METHOD:
{ $syntax "METHOD: return foo: type1 arg1 bar: type2 arg2 baz: ... [ body ] ;" }
{ $values { "return" "a C type name" } { "type1" "a C type name" } { "arg1" "a local variable name" } { "body" "arbitrary code" } }
{ $description "Defines a method inside of a " { $link POSTPONE: CLASS: } " form." } ;
{ $description "Defines a method inside of a " { $link postpone: CLASS: } " form." } ;
ARTICLE: "objc-subclassing" "Subclassing Objective C classes"
"Objective C classes can be subclassed, with new methods defined in Factor, using parsing words:"
{ $subsections POSTPONE: CLASS: POSTPONE: METHOD: }
{ $subsections postpone: CLASS: postpone: METHOD: }
"Objective C class definitions are saved in the image. If the image is saved and Factor is restarted with the saved image, custom class definitions are made available to the Objective C runtime when they are first accessed from within Factor." ;
ABOUT: "objc-subclassing"

View File

@ -7,7 +7,7 @@ in: gobject.ffi
! these two are needed for the definition of GError and others.
! otherwise we generate GError and some others in this vocab as well.
<< "glib.ffi" require >>
USE: glib.ffi
use: glib.ffi
LIBRARY: gobject

View File

@ -20,7 +20,7 @@ TUPLE: mdb-connection instance node handle remote local buffer ;
: connection-buffer ( -- buffer )
mdb-connection get buffer>> 0 >>length ; inline
USE: mongodb.operations
use: mongodb.operations
CONSTRUCTOR: <mdb-connection> mdb-connection ( instance -- mdb-connection ) ;

View File

@ -20,9 +20,9 @@ HELP: GB
{ $description "A shorthand for " { $link gl-break } "." } ;
HELP: gl-break
{ $description "Suspends the current thread and activates the walker like " { $link break } ", but also preserves the current OpenGL context, saves it to " { $link G-world } " for interactive use through " { $link G } ", and restores the current context when the suspended thread is continued. The shorthand word " { $link POSTPONE: GB } " can also be used." } ;
{ $description "Suspends the current thread and activates the walker like " { $link break } ", but also preserves the current OpenGL context, saves it to " { $link G-world } " for interactive use through " { $link G } ", and restores the current context when the suspended thread is continued. The shorthand word " { $link postpone: GB } " can also be used." } ;
{ G F G-world POSTPONE: GB gl-break } related-words
{ G F G-world postpone: GB gl-break } related-words
ARTICLE: "opengl.debug" "Interactive debugging of OpenGL applications"
"The " { $vocab-link "opengl.debug" } " vocabulary provides words to assist with interactive debugging of OpenGL applications in the Factor UI."

View File

@ -26,7 +26,7 @@ HELP: findall
{ $description "Finds all matches of the given regexp in the string. Matches is sequence of associative array where the key is the name of the capturing group, or f to denote the full match." }
{ $examples
{ $code
"USE: pcre"
"use: pcre"
"\"foobar\" \"(?<ch1>\\\\w)(?<ch2>\\\\w)\" findall ."
"{"
" { { f \"fo\" } { \"ch1\" \"f\" } { \"ch2\" \"o\" } }"

View File

@ -94,6 +94,6 @@ SYNTAX: COM-INTERFACE:
SYNTAX: GUID: scan-token string>guid suffix! ;
USE: vocabs.loader
use: vocabs.loader
{ "windows.com" "prettyprint" } "windows.com.prettyprint" require-when

View File

@ -5,7 +5,7 @@ in: windows.com.wrapper
HELP: <com-wrapper>
{ $values { "implementations" "an assoc relating COM interface names to arrays of quotations implementing that interface" } { "wrapper" "a " { $link com-wrapper } " tuple" } }
{ $description "Constructs a " { $link com-wrapper } " tuple. Each key in the " { $snippet "implementations" } " assoc must be the name of an interface defined with " { $link POSTPONE: COM-INTERFACE: } ". The corresponding value must be an array of quotations implementing the methods of that interface in order, including those of its parent interfaces. The " { $snippet "IUnknown" } " methods (" { $link IUnknown::QueryInterface } ", " { $link IUnknown::AddRef } ", and " { $link IUnknown::Release } ") will be defined automatically and must not be specified in the array. These quotations should have stack effects mirroring those of the interface methods being implemented; for example, a method " { $snippet "void foobar ( int foo, int bar )" } " should be implemented with a quotation of effect " { $snippet "( this foo bar -- )" } ". The " { $snippet "this" } " parameter (that is, the leftmost parameter of any COM method) will be automatically converted from an alien pointer to the underlying Factor object before the quotation is invoked.\n\nThe resulting wrapper can be applied to a Factor object using the " { $link com-wrap } " word. The COM interface pointer returned by " { $snippet "com-wrap" } " can then be passed to C functions requiring a COM object as a parameter. The vtables constructed by " { $snippet "<com-wrapper>" } " are stored on the non-GC heap in order to be accessible to C functions; when the wrapper object and its vtables are no longer needed, the object's resources must be freed using " { $link dispose } ".\n\nExample:" }
{ $description "Constructs a " { $link com-wrapper } " tuple. Each key in the " { $snippet "implementations" } " assoc must be the name of an interface defined with " { $link postpone: COM-INTERFACE: } ". The corresponding value must be an array of quotations implementing the methods of that interface in order, including those of its parent interfaces. The " { $snippet "IUnknown" } " methods (" { $link IUnknown::QueryInterface } ", " { $link IUnknown::AddRef } ", and " { $link IUnknown::Release } ") will be defined automatically and must not be specified in the array. These quotations should have stack effects mirroring those of the interface methods being implemented; for example, a method " { $snippet "void foobar ( int foo, int bar )" } " should be implemented with a quotation of effect " { $snippet "( this foo bar -- )" } ". The " { $snippet "this" } " parameter (that is, the leftmost parameter of any COM method) will be automatically converted from an alien pointer to the underlying Factor object before the quotation is invoked.\n\nThe resulting wrapper can be applied to a Factor object using the " { $link com-wrap } " word. The COM interface pointer returned by " { $snippet "com-wrap" } " can then be passed to C functions requiring a COM object as a parameter. The vtables constructed by " { $snippet "<com-wrapper>" } " are stored on the non-GC heap in order to be accessible to C functions; when the wrapper object and its vtables are no longer needed, the object's resources must be freed using " { $link dispose } ".\n\nExample:" }
{ $code "
COM-INTERFACE: ISimple IUnknown {216fb341-0eb2-44b1-8edb-60b76e353abc}
HRESULT returnOK ( )

View File

@ -7,7 +7,7 @@ io.directories namespaces accessors kernel math destructors ;
{ 1 0 } [ [ ] with-pooled-db ] must-infer-as
! Test behavior after image save/load
USE: db.sqlite
use: db.sqlite
[ "pool-test.db" temp-file delete-file ] ignore-errors

View File

@ -2,7 +2,7 @@
! See http://factorcode.org/license.txt for BSD license.
in: furnace
USE: vocabs
use: vocabs
"furnace.actions" require
"furnace.alloy" require
"furnace.asides" require

View File

@ -13,7 +13,7 @@ dummy-vocab "dummy.factor" temp-file [ utf8 set-file-contents ] keep run-file
>>
{ t } [
USE: dummy-vocab
use: dummy-vocab
{ dummy-word "index" } resolve-template-path "index" temp-file =
] unit-test

View File

@ -160,17 +160,17 @@ HELP: mouse-state
{ keyboard-state read-keyboard } related-words
HELP: button-delta
{ $values { "old?" boolean } { "new?" boolean } { "delta" { $link pressed } ", " { $link released } ", or " { $link POSTPONE: f } } }
{ $description "Outputs a symbol representing the change in a key or button's state given a \"before\" and \"after\" sample of its state. Outputs " { $link pressed } " if " { $snippet "old?" } " is false and " { $snippet "new?" } " is true, " { $link released } " if " { $snippet "old?" } " is true and " { $snippet "new?" } " is false, or " { $link POSTPONE: f } " if the two inputs have the same boolean value." } ;
{ $values { "old?" boolean } { "new?" boolean } { "delta" { $link pressed } ", " { $link released } ", or " { $link postpone: f } } }
{ $description "Outputs a symbol representing the change in a key or button's state given a \"before\" and \"after\" sample of its state. Outputs " { $link pressed } " if " { $snippet "old?" } " is false and " { $snippet "new?" } " is true, " { $link released } " if " { $snippet "old?" } " is true and " { $snippet "new?" } " is false, or " { $link postpone: f } " if the two inputs have the same boolean value." } ;
HELP: buttons-delta
{ $values { "old-buttons" sequence } { "new-buttons" sequence } { "delta" "an array of " { $link pressed } ", " { $link released } ", or " { $link POSTPONE: f } } }
{ $description "Outputs an array of symbols representing the change in a set of keys or buttons' states given \"before\" and \"after\" samples of their state. For each corresponding pair of values in the two input sequences, outputs " { $link pressed } " if " { $snippet "old-buttons" } " contains a false and " { $snippet "new-buttons" } " a true value, " { $link released } " if " { $snippet "old-buttons" } " contains true and " { $snippet "new-buttons" } " false, or " { $link POSTPONE: f } " if the two elements have the same boolean value."
{ $values { "old-buttons" sequence } { "new-buttons" sequence } { "delta" "an array of " { $link pressed } ", " { $link released } ", or " { $link postpone: f } } }
{ $description "Outputs an array of symbols representing the change in a set of keys or buttons' states given \"before\" and \"after\" samples of their state. For each corresponding pair of values in the two input sequences, outputs " { $link pressed } " if " { $snippet "old-buttons" } " contains a false and " { $snippet "new-buttons" } " a true value, " { $link released } " if " { $snippet "old-buttons" } " contains true and " { $snippet "new-buttons" } " false, or " { $link postpone: f } " if the two elements have the same boolean value."
$nl
"This word can be used with two samples of a " { $link keyboard-state } "'s " { $snippet "keys" } " slot or of a " { $link mouse-state } "'s or " { $link controller-state } "'s " { $snippet "buttons" } " slot to convert the button states into pressed/released values. Remember to " { $link clone } " state objects to record snapshots of their state." } ;
HELP: buttons-delta-as
{ $values { "old-buttons" sequence } { "new-buttons" sequence } { "exemplar" sequence } { "delta" "a sequence of " { $link pressed } ", " { $link released } ", or " { $link POSTPONE: f } } }
{ $values { "old-buttons" sequence } { "new-buttons" sequence } { "exemplar" sequence } { "delta" "a sequence of " { $link pressed } ", " { $link released } ", or " { $link postpone: f } } }
{ $description "Like " { $link buttons-delta } ", but returns a sequence matching the type of the " { $snippet "exemplar" } "." } ;
{ button-delta buttons-delta buttons-delta-as } related-words

View File

@ -9,7 +9,7 @@ HELP: game-attributes
{ { $snippet "tick-interval-nanos" } " specifies the number of nanoseconds between consecutive calls to the world's " { $link tick-game-world } " method by the game loop. An integer greater than zero must be provided." }
{ { $snippet "use-game-input?" } " specifies whether the game world should initialize the " { $vocab-link "game.input" } " library for use by the game. False by default." }
{ { $snippet "use-audio-engine?" } " specifies whether the game world should manage an " { $link audio-engine } " instance. False by default." }
{ { $snippet "audio-engine-device" } " specifies the string name of the OpenAL device the audio engine, if any, should try to open. The default value of " { $link POSTPONE: f } " attempts to open the default OpenAL device." }
{ { $snippet "audio-engine-device" } " specifies the string name of the OpenAL device the audio engine, if any, should try to open. The default value of " { $link postpone: f } " attempts to open the default OpenAL device." }
{ { $snippet "audio-engine-voice-count" } " determines the number of independent voices the audio engine will make available. This determines how many individual audio clips can play simultaneously. This cannot exceed the OpenAL implementation's limit on supported voices." }
} ;
@ -18,8 +18,8 @@ HELP: game-world
$nl
"The game-world tuple has the following publicly accessible slots:"
{ $list
{ { $snippet "game-loop" } " contains the " { $link game-loop } " instance managed by the game world. If the world is inactive, this slot will contain " { $link POSTPONE: f } "." }
{ { $snippet "audio-engine" } " contains the " { $link audio-engine } " instance managed by the game world. If the world is inactive, or the " { $snippet "use-audio-engine?" } " slot of the " { $link game-attributes } " object used to initialize the world was false, this slot will contain " { $link POSTPONE: f } "." }
{ { $snippet "game-loop" } " contains the " { $link game-loop } " instance managed by the game world. If the world is inactive, this slot will contain " { $link postpone: f } "." }
{ { $snippet "audio-engine" } " contains the " { $link audio-engine } " instance managed by the game world. If the world is inactive, or the " { $snippet "use-audio-engine?" } " slot of the " { $link game-attributes } " object used to initialize the world was false, this slot will contain " { $link postpone: f } "." }
} } ;
HELP: begin-game-world

View File

@ -114,7 +114,7 @@ VARIANT: non-color-attachment-ref
UNION: attachment-ref
color-attachment-ref
non-color-attachment-ref
POSTPONE: f ;
postpone: f ;
TUPLE: framebuffer-rect
{ framebuffer any-framebuffer read-only initial: system-framebuffer }

View File

@ -93,7 +93,7 @@ HELP: define-uniform-tuple
{ $values
{ "class" class } { "superclass" class } { "uniforms" sequence }
}
{ $description "Defines a new " { $link uniform-tuple } " as a subclass of " { $snippet "superclass" } " with the slots specified by the " { $link uniform } " tuple values in " { $snippet "uniforms" } ". The runtime equivalent of " { $link POSTPONE: UNIFORM-TUPLE: } ". This word must be called inside a compilation unit." } ;
{ $description "Defines a new " { $link uniform-tuple } " as a subclass of " { $snippet "superclass" } " with the slots specified by the " { $link uniform } " tuple values in " { $snippet "uniforms" } ". The runtime equivalent of " { $link postpone: UNIFORM-TUPLE: } ". This word must be called inside a compilation unit." } ;
HELP: float-uniform
{ $class-description "This " { $link uniform-type } " indicates that a slot of a " { $link uniform-tuple } " corresponds to a float uniform parameter." } ;
@ -258,10 +258,10 @@ HELP: uniform
{ $class-description "Values of this tuple type are passed to " { $link define-uniform-tuple } " to define a new " { $link uniform-tuple } " type." } ;
HELP: uniform-tuple
{ $class-description "The base class for tuple types defined with " { $link POSTPONE: UNIFORM-TUPLE: } ". A uniform tuple is used as part of a " { $link render-set } " to supply values for a shader program's uniform parameters. See the " { $link POSTPONE: UNIFORM-TUPLE: } " documentation for details on how uniform tuples are defined and used." } ;
{ $class-description "The base class for tuple types defined with " { $link postpone: UNIFORM-TUPLE: } ". A uniform tuple is used as part of a " { $link render-set } " to supply values for a shader program's uniform parameters. See the " { $link postpone: UNIFORM-TUPLE: } " documentation for details on how uniform tuples are defined and used." } ;
HELP: uniform-type
{ $class-description { $snippet "uniform-type" } " values are used as part of a " { $link POSTPONE: UNIFORM-TUPLE: } " definition to define the types of uniform slots." } ;
{ $class-description { $snippet "uniform-type" } " values are used as part of a " { $link postpone: UNIFORM-TUPLE: } " definition to define the types of uniform slots." } ;
HELP: ushort-indexes
{ $class-description "This " { $link index-type } " indicates that an " { $link index-elements } " or " { $link multi-index-elements } " buffer consists of two-byte unsigned short indexes." } ;
@ -303,7 +303,7 @@ ARTICLE: "gpu.render" "Rendering"
render-set
}
{ $link uniform-tuple } "s provide Factor types for containing and submitting shader uniform parameters:"
{ $subsections POSTPONE: UNIFORM-TUPLE: }
{ $subsections postpone: UNIFORM-TUPLE: }
;
ABOUT: "gpu.render"

View File

@ -580,7 +580,7 @@ M: buffer-ptr bind-transform-feedback-output
PRIVATE>
UNION: transform-feedback-output buffer buffer-range POSTPONE: f ;
UNION: transform-feedback-output buffer buffer-range postpone: f ;
TUPLE: render-set
{ primitive-mode primitive-mode read-only }

View File

@ -27,11 +27,11 @@ HELP: <multi-vertex-array>
HELP: feedback-format:
{ $syntax "feedback-format: vertex-format" }
{ $description "When used as part of a " { $link POSTPONE: GLSL-PROGRAM: } " definition, this syntax specifies the " { $link vertex-format } " in which transform feedback output will be generated." } ;
{ $description "When used as part of a " { $link postpone: GLSL-PROGRAM: } " definition, this syntax specifies the " { $link vertex-format } " in which transform feedback output will be generated." } ;
HELP: GLSL-PROGRAM:
{ $syntax "GLSL-PROGRAM: program-name shader shader ... [vertex-format vertex-format ...] [feedback-format: vertex-format] ;" }
{ $description "Defines a new " { $link program } " named " { $snippet "program-name" } ". When the program is instantiated with " { $link <program-instance> } ", it will link together instances of all of the specified " { $link shader } "s to create the program instance. If any " { $link vertex-format } "s are specified, their attributes will be pre-assigned attribute indexes at link time, to ensure that their indexes remain constant if the program is refreshed with " { $link refresh-program } ". A transform feedback vertex format may optionally be specified with " { $link POSTPONE: feedback-format: } "; if the program is used to collect transform feedback, the given vertex format will be used for the output." }
{ $description "Defines a new " { $link program } " named " { $snippet "program-name" } ". When the program is instantiated with " { $link <program-instance> } ", it will link together instances of all of the specified " { $link shader } "s to create the program instance. If any " { $link vertex-format } "s are specified, their attributes will be pre-assigned attribute indexes at link time, to ensure that their indexes remain constant if the program is refreshed with " { $link refresh-program } ". A transform feedback vertex format may optionally be specified with " { $link postpone: feedback-format: } "; if the program is used to collect transform feedback, the given vertex format will be used for the output." }
{ $notes "Transform feedback requires OpenGL 3.0 or one of the " { $snippet "GL_EXT_transform_feedback" } " or " { $snippet "GL_ARB_transform_feedback" } " extensions." } ;
HELP: GLSL-SHADER-FILE:
@ -56,9 +56,9 @@ HELP: VERTEX-FORMAT:
HELP: VERTEX-STRUCT:
{ $syntax "VERTEX-STRUCT: struct-name format-name" }
{ $description "Defines a struct class (like " { $link POSTPONE: STRUCT: } ") with the same binary format and component types as the given " { $link vertex-format } "." } ;
{ $description "Defines a struct class (like " { $link postpone: STRUCT: } ") with the same binary format and component types as the given " { $link vertex-format } "." } ;
{ POSTPONE: GLSL-PROGRAM: POSTPONE: GLSL-SHADER-FILE: POSTPONE: GLSL-SHADER: } related-words
{ postpone: GLSL-PROGRAM: postpone: GLSL-SHADER-FILE: postpone: GLSL-SHADER: } related-words
HELP: attribute-index
{ $values
@ -72,7 +72,7 @@ HELP: <vertex-array>
{ "vertex-buffer" "a " { $link buffer } " or " { $link buffer-ptr } } { "program-instance" program-instance }
{ "vertex-array" vertex-array }
}
{ $description "Creates a new " { $link vertex-array } " from the entire contents of a single " { $link buffer } " for use with a " { $link program-instance } ". The data in " { $snippet "buffer" } " is taken in the first " { $link vertex-format } " specified in the program instance's originating " { $link POSTPONE: GLSL-PROGRAM: } " definition. If the program has no associated vertex formats, an error will be thrown. To specify a different vertex format, use " { $link <vertex-array*> } "." } ;
{ $description "Creates a new " { $link vertex-array } " from the entire contents of a single " { $link buffer } " for use with a " { $link program-instance } ". The data in " { $snippet "buffer" } " is taken in the first " { $link vertex-format } " specified in the program instance's originating " { $link postpone: GLSL-PROGRAM: } " definition. If the program has no associated vertex formats, an error will be thrown. To specify a different vertex format, use " { $link <vertex-array*> } "." } ;
HELP: <vertex-array*>
{ $values
@ -94,13 +94,13 @@ HELP: define-vertex-format
{ $values
{ "class" class } { "vertex-attributes" sequence }
}
{ $description "Defines a new " { $link vertex-format } " with the binary format specified by the " { $link vertex-attribute } " tuple values in " { $snippet "vertex-attributes" } ". The runtime equivalent of " { $link POSTPONE: VERTEX-FORMAT: } ". This word must be called inside a compilation unit." } ;
{ $description "Defines a new " { $link vertex-format } " with the binary format specified by the " { $link vertex-attribute } " tuple values in " { $snippet "vertex-attributes" } ". The runtime equivalent of " { $link postpone: VERTEX-FORMAT: } ". This word must be called inside a compilation unit." } ;
HELP: define-vertex-struct
{ $values
{ "class" word } { "vertex-format" vertex-format }
}
{ $description "Defines a new struct C type from a " { $link vertex-format } ". The runtime equivalent of " { $link POSTPONE: VERTEX-STRUCT: } ". This word must be called inside a compilation unit." } ;
{ $description "Defines a new struct C type from a " { $link vertex-format } ". The runtime equivalent of " { $link postpone: VERTEX-STRUCT: } ". This word must be called inside a compilation unit." } ;
HELP: fragment-shader
{ $class-description "This " { $link shader-kind } " indicates that a " { $link shader } " is a fragment shader." } ;
@ -123,7 +123,7 @@ HELP: output-index
{ $notes "Named fragment shader outputs require OpenGL 3.0 or later and GLSL 1.30 or later, or OpenGL 2.0 or later and GLSL 1.20 or earlier with the " { $snippet "GL_EXT_gpu_shader4" } " extension." } ;
HELP: program
{ $class-description "A " { $snippet "program" } " provides a specification for linking a " { $link program-instance } " in a graphics context. Programs are defined with " { $link POSTPONE: GLSL-PROGRAM: } " and instantiated for a context with " { $link <program-instance> } "." } ;
{ $class-description "A " { $snippet "program" } " provides a specification for linking a " { $link program-instance } " in a graphics context. Programs are defined with " { $link postpone: GLSL-PROGRAM: } " and instantiated for a context with " { $link <program-instance> } "." } ;
HELP: program-instance
{ $class-description "A " { $snippet "program-instance" } " is a shader " { $link program } " that has been compiled and linked for a graphics context using " { $link <program-instance> } "." } ;
@ -135,20 +135,20 @@ HELP: refresh-program
{ $description "Rereads the source code for every " { $link shader } " in " { $link program } " and attempts to refresh all the existing " { $link shader-instance } "s and " { $link program-instance } "s for those shaders. If any of the new source code fails to compile or link, the existing valid shader and program instances will remain untouched. However, subsequent attempts to compile new shader or program instances will still attempt to use the new source code. If the compilation and linking succeed, the existing shader and program instances will be updated on the fly to reference the newly compiled code." } ;
HELP: shader
{ $class-description "A " { $snippet "shader" } " provides a block of GLSL source code that can be compiled into a " { $link shader-instance } " in a graphics context. Shaders are defined with " { $link POSTPONE: GLSL-SHADER: } " or " { $link POSTPONE: GLSL-SHADER-FILE: } " and instantiated for a context with " { $link <shader-instance> } "." } ;
{ $class-description "A " { $snippet "shader" } " provides a block of GLSL source code that can be compiled into a " { $link shader-instance } " in a graphics context. Shaders are defined with " { $link postpone: GLSL-SHADER: } " or " { $link postpone: GLSL-SHADER-FILE: } " and instantiated for a context with " { $link <shader-instance> } "." } ;
HELP: shader-instance
{ $class-description "A " { $snippet "shader-instance" } " is a " { $link shader } " that has been compiled for a graphics context using " { $link <shader-instance> } "." } ;
HELP: shader-kind
{ $class-description "A " { $snippet "shader-kind" } " value is passed as part of a " { $link POSTPONE: GLSL-SHADER: } " or " { $link POSTPONE: GLSL-SHADER-FILE: } " definition to indicate the kind of " { $link shader } " being defined."
{ $class-description "A " { $snippet "shader-kind" } " value is passed as part of a " { $link postpone: GLSL-SHADER: } " or " { $link postpone: GLSL-SHADER-FILE: } " definition to indicate the kind of " { $link shader } " being defined."
{ $list
{ { $link vertex-shader } "s run during primitive assembly and map input vertex data to positions in screen space for rasterization." }
{ { $link fragment-shader } "s run as part of rasterization and decide the final rendered output of a primitive as the outputs of the vertex shader are interpolated across its surface." }
} } ;
HELP: too-many-feedback-formats-error
{ $class-description "This error is thrown when a " { $link POSTPONE: GLSL-PROGRAM: } " definition attempts to include more than one " { $link vertex-format } " for transform feedback formatting." } ;
{ $class-description "This error is thrown when a " { $link postpone: GLSL-PROGRAM: } " definition attempts to include more than one " { $link vertex-format } " for transform feedback formatting." } ;
HELP: invalid-link-feedback-format-error
{ $class-description "This error is thrown when the " { $link vertex-format } " specified as the transform feedback output format of a " { $link program } " is not suitable for the purpose. Transform feedback formats do not support padding (fields with a name of " { $link f } ")." } ;
@ -189,7 +189,7 @@ HELP: vertex-attribute
{ $class-description "This tuple type is passed to " { $link define-vertex-format } " to define a new " { $link vertex-format } " type." } ;
HELP: vertex-format
{ $class-description "This class encompasses all vertex formats defined by " { $link POSTPONE: VERTEX-FORMAT: } ". A vertex format defines the binary layout of vertex attribute data in a " { $link buffer } " for use as part of a " { $link vertex-array } ". See the " { $link POSTPONE: VERTEX-FORMAT: } " documentation for details on how vertex formats are defined." } ;
{ $class-description "This class encompasses all vertex formats defined by " { $link postpone: VERTEX-FORMAT: } ". A vertex format defines the binary layout of vertex attribute data in a " { $link buffer } " for use as part of a " { $link vertex-array } ". See the " { $link postpone: VERTEX-FORMAT: } " documentation for details on how vertex formats are defined." } ;
HELP: vertex-format-size
{ $values
@ -201,9 +201,9 @@ HELP: vertex-format-size
ARTICLE: "gpu.shaders" "Shader objects"
"The " { $vocab-link "gpu.shaders" } " vocabulary supports defining, compiling, and linking " { $link shader } "s into " { $link program } "s that run on the GPU and control rendering."
{ $subsections
POSTPONE: GLSL-PROGRAM:
POSTPONE: GLSL-SHADER:
POSTPONE: GLSL-SHADER-FILE:
postpone: GLSL-PROGRAM:
postpone: GLSL-SHADER:
postpone: GLSL-SHADER-FILE:
}
"A program must be instantiated for each graphics context it is used in:"
{ $subsections <program-instance> }
@ -215,7 +215,7 @@ ARTICLE: "gpu.shaders" "Shader objects"
<multi-vertex-array>
<vertex-array*>
<vertex-array>
POSTPONE: VERTEX-FORMAT:
postpone: VERTEX-FORMAT:
} ;
ABOUT: "gpu.shaders"

View File

@ -24,7 +24,7 @@ HELP: command-name
{ $examples
{ $example
"USING: io ui.commands ;"
"IN: scratchpad"
"in: scratchpad"
": com-my-command ( -- ) ;"
"\\ com-my-command command-name write"
"My Command"

View File

@ -397,6 +397,6 @@ M: f request-focus-on 2drop ;
: focus-path ( gadget -- seq )
[ focus>> ] follow ;
USE: vocabs.loader
use: vocabs.loader
{ "ui.gadgets" "prettyprint" } "ui.gadgets.prettyprint" require-when

View File

@ -61,7 +61,7 @@ HELP: <pane-stream>
HELP: content-gadget
{ $values { "object" object } { "gadget/f" { $maybe gadget } } }
{ $description "This generic function may be implemented for objects in order to display a rich representation of the object in the " { $link "ui-inspector" } ". If " { $snippet "content-gadget" } " returns a gadget for an inspected object, the returned gadget is displayed under the \"Content\" heading in the inspector window. If " { $snippet "content-gadget" } " returns " { $link POSTPONE: f } ", no content section is included in the given object's inspector." } ;
{ $description "This generic function may be implemented for objects in order to display a rich representation of the object in the " { $link "ui-inspector" } ". If " { $snippet "content-gadget" } " returns a gadget for an inspected object, the returned gadget is displayed under the \"Content\" heading in the inspector window. If " { $snippet "content-gadget" } " returns " { $link postpone: f } ", no content section is included in the given object's inspector." } ;
ARTICLE: "ui.gadgets.panes" "Pane gadgets"
"The " { $vocab-link "ui.gadgets.panes" } " vocabulary implements panes, which display formatted text."

View File

@ -39,7 +39,7 @@ in: ui.theme.switching
listener-word-style text-color foreground update-style
! prettyprint.stylesheet
{ POSTPONE: USING: POSTPONE: USE: POSTPONE: IN: }
{ postpone: USING: postpone: use: postpone: in: }
[ "word-style" word-prop [ dim-color foreground ] dip set-at ] each
base-word-style text-color foreground update-style
highlighted-word-style highlighted-word-color foreground update-style

View File

@ -89,7 +89,7 @@ TIP: "When you mouse over certain objects, a black border will appear. Left-clic
TIP: "The status bar displays stack effects of recognized words as they are being typed in." ;
TIP: "Press " { $command interactor "completion" code-completion-popup } " to complete word, vocabulary and Unicode character names. The latter two features become available if the cursor is after a " { $link POSTPONE: USE: } ", " { $link POSTPONE: USING: } " or " { $link POSTPONE: char: } "." ;
TIP: "Press " { $command interactor "completion" code-completion-popup } " to complete word, vocabulary and Unicode character names. The latter two features become available if the cursor is after a " { $link postpone: use: } ", " { $link postpone: USING: } " or " { $link postpone: char: } "." ;
TIP: "If a word's vocabulary is loaded, but not in the search path, you can use restarts to add the vocabulary to the search path. Auto-use mode (" { $command listener-gadget "toolbar" com-auto-use } ") invokes restarts automatically if there is only one restart." ;

View File

@ -13,7 +13,7 @@ ARTICLE: "starting-ui-tools" "Starting the UI tools"
{ "On Mac OS X, the tools start if the " { $snippet "Factor.app" } " application bundle is run." }
}
"In all cases, passing the " { $snippet "-run=listener" } " command line switch starts the terminal listener instead. The UI can be started from the terminal by issuing the following command:"
{ $code "USE: threads" "[ \"ui.tools\" run ] in-thread" } ;
{ $code "use: threads" "[ \"ui.tools\" run ] in-thread" } ;
ARTICLE: "ui-shortcuts" "UI tool keyboard shortcuts"
"Every UI tool has its own set of keyboard shortcuts. Mouse-over a toolbar button to see its shortcut, if any, in the status bar, or press " { $snippet "F1" } " to see a list of all shortcuts supported by the tool."

View File

@ -80,7 +80,7 @@ HELP: raise-window
HELP: with-ui
{ $values { "quot" { $quotation ( -- ) } } }
{ $description "Calls the quotation, starting the UI if necessary. If starting the UI is necessary, this word does not return and the UI will start after the quotation returns." }
{ $notes "This word should be used in the " { $link POSTPONE: main: } " word of an application that uses the UI in order for the vocabulary to work when run from either the UI listener (" { $snippet "\"my-app\" run" } ") and the command line (" { $snippet "./factor -run=my-app" } ")." }
{ $notes "This word should be used in the " { $link postpone: main: } " word of an application that uses the UI in order for the vocabulary to work when run from either the UI listener (" { $snippet "\"my-app\" run" } ") and the command line (" { $snippet "./factor -run=my-app" } ")." }
{ $examples "The " { $vocab-link "hello-ui" } " vocabulary implements a simple UI application which uses this word." } ;
HELP: beep
@ -163,8 +163,8 @@ ARTICLE: "ui-windows" "Top-level windows"
{ $subsections world }
"There is also syntax for defining window words, including a main window that is the entry point for a vocabulary:"
{ $subsections
POSTPONE: WINDOW:
POSTPONE: MAIN-WINDOW:
postpone: WINDOW:
postpone: MAIN-WINDOW:
} ;
ARTICLE: "ui-backend" "Developing UI backends"
@ -178,7 +178,7 @@ ARTICLE: "ui-backend" "Developing UI backends"
ARTICLE: "ui-backend-init" "UI initialization and the event loop"
"An UI backend is required to define a method on the " { $link (with-ui) } " word. This word should contain backend initialization, together with some boilerplate:"
{ $code
"IN: shells"
"in: shells"
""
": ui"
" ... backend-specific initialization ..."
@ -360,7 +360,7 @@ WINDOW: hello { { title \"Hi\" } }
HELP: MAIN-WINDOW:
{ $syntax "MAIN-WINDOW: window-word { attributes }
attribute-code ;" }
{ $description "Defines a " { $link POSTPONE: main: } " word for the current vocabulary named " { $snippet "window-word" } " that opens a UI window when the vocabulary is " { $link run } ". The " { $snippet "attributes" } " specify the key-value pairs of the window's " { $link world-attributes } ". The " { $snippet "attribute-code" } " is run with the " { $snippet "world-attributes" } " on the stack; this allows the word to construct gadget objects to place in the " { $snippet "gadget" } " slot or set other runtime-dependent world attributes." }
{ $description "Defines a " { $link postpone: main: } " word for the current vocabulary named " { $snippet "window-word" } " that opens a UI window when the vocabulary is " { $link run } ". The " { $snippet "attributes" } " specify the key-value pairs of the window's " { $link world-attributes } ". The " { $snippet "attribute-code" } " is run with the " { $snippet "world-attributes" } " on the stack; this allows the word to construct gadget objects to place in the " { $snippet "gadget" } " slot or set other runtime-dependent world attributes." }
{ $examples
"From the " { $vocab-link "hello-ui" } " vocabulary. Creates a window with the title \"Hi\" containing a label reading \"Hello world\":"
{ $code
@ -371,7 +371,7 @@ MAIN-WINDOW: hello { { title \"Hi\" } }
\"Hello world\" <label> >>gadgets ;"
} } ;
{ POSTPONE: WINDOW: POSTPONE: MAIN-WINDOW: } related-words
{ postpone: WINDOW: postpone: MAIN-WINDOW: } related-words
ARTICLE: "ui.gadgets.worlds-window-controls" "Window controls"
"The following window controls can be placed in a " { $link world } " window:"

View File

@ -5,7 +5,7 @@ HELP: 24-game
{ $description "Starts the game!" }
{ $examples
{ $unchecked-example
"USE: 24-game"
"use: 24-game"
"24-game"
"{ 8 2 1 2 }\n"
"Commands: { + - * / rot swap q }\n"

View File

@ -159,7 +159,7 @@ $nl
{ $subsections "alien.enums" }
"A utility for defining " { $link "destructors" } " for deallocating memory:"
{ $subsections "alien.destructors" }
"C struct and union types can be defined with " { $link POSTPONE: STRUCT: } " and " { $link POSTPONE: UNION-STRUCT: } ". See " { $link "classes.struct" } " for details. For passing arrays to and from C, use the " { $link "specialized-arrays" } " vocabulary." ;
"C struct and union types can be defined with " { $link postpone: STRUCT: } " and " { $link postpone: UNION-STRUCT: } ". See " { $link "classes.struct" } " for details. For passing arrays to and from C, use the " { $link "specialized-arrays" } " vocabulary." ;
HELP: malloc-string
{ $values { "string" string } { "encoding" "an encoding descriptor" } { "alien" c-ptr } }
@ -179,7 +179,7 @@ HELP: <c-direct-array>
{ $notes "The appropriate specialized array vocabulary must be loaded; otherwise, an error will be thrown. See the " { $vocab-link "specialized-arrays" } " vocabulary for details on the underlying sequence type constructed." } ;
ARTICLE: "c-strings" "C strings"
"C string types are arrays with shape " { $snippet "{ c-string encoding }" } ", where " { $snippet "encoding" } " is an encoding descriptor. The type " { $link c-string } " is an alias for " { $snippet "{ c-string utf8 }" } ". See " { $link "encodings-descriptors" } " for information about encoding descriptors. In " { $link POSTPONE: TYPEDEF: } ", " { $link POSTPONE: FUNCTION: } ", " { $link POSTPONE: CALLBACK: } ", and " { $link POSTPONE: STRUCT: } " definitions, the shorthand syntax " { $snippet "c-string[encoding]" } " can be used to specify the string encoding."
"C string types are arrays with shape " { $snippet "{ c-string encoding }" } ", where " { $snippet "encoding" } " is an encoding descriptor. The type " { $link c-string } " is an alias for " { $snippet "{ c-string utf8 }" } ". See " { $link "encodings-descriptors" } " for information about encoding descriptors. In " { $link postpone: TYPEDEF: } ", " { $link postpone: FUNCTION: } ", " { $link postpone: CALLBACK: } ", and " { $link postpone: STRUCT: } " definitions, the shorthand syntax " { $snippet "c-string[encoding]" } " can be used to specify the string encoding."
$nl
"Using C string types triggers automatic conversions:"
{ $list
@ -188,7 +188,7 @@ $nl
"Passing an already encoded " { $link byte-array } " also works and performs no conversion."
}
{ "Returning a C string from a C function allocates a Factor string in the Factor heap; the memory pointed to by the returned pointer is then decoded with the requested encoding into the Factor string." }
{ "Reading " { $link c-string } " slots of " { $link POSTPONE: STRUCT: } " or " { $link POSTPONE: UNION-STRUCT: } " returns Factor strings." }
{ "Reading " { $link c-string } " slots of " { $link postpone: STRUCT: } " or " { $link postpone: UNION-STRUCT: } " returns Factor strings." }
}
$nl
"Care must be taken if the C function expects a pointer to a string with its length represented by another parameter rather than a null terminator. Passing the result of calling " { $link length } " on the string object will not suffice. This is because a Factor string of " { $emphasis "n" } " characters will not necessarily encode to " { $emphasis "n" } " bytes. The correct idiom for C functions which take a string with a length is to first encode the string using " { $link encode } ", and then pass the resulting byte array together with the length of this byte array."

View File

@ -25,6 +25,6 @@ HELP: DESTRUCTOR:
ARTICLE: "alien.destructors" "Alien destructors"
"The " { $vocab-link "alien.destructors" } " vocabulary defines a utility parsing word for defining new disposable classes."
{ $subsections POSTPONE: DESTRUCTOR: } ;
{ $subsections postpone: DESTRUCTOR: } ;
ABOUT: "alien.destructors"

View File

@ -9,7 +9,7 @@ HELP: BE-PACKED-STRUCT:
{ $unchecked-example
"! When run on a big-endian platform, this struct should prettyprint the same as defined"
"! The output of this example is from a little-endian platform"
"USE: alien.endian"
"use: alien.endian"
"BE-PACKED-STRUCT: s1 { a char[7] } { b int } ;"
"\\ s1 see"
"USING: alien.c-types alien.endian classes.struct ;
@ -22,7 +22,7 @@ HELP: BE-STRUCT:
{ $unchecked-example
"! When run on a big-endian platform, this struct should prettyprint the same as defined"
"! The output of this example is from a little-endian platform"
"USE: alien.endian"
"use: alien.endian"
"BE-STRUCT: s1 { a int } { b le32 } ;"
"\\ s1 see"
"USING: alien.c-types alien.endian classes.struct ;
@ -35,7 +35,7 @@ HELP: LE-PACKED-STRUCT:
{ $unchecked-example
"! When run on a little-endian platform, this struct should prettyprint the same as defined"
"! The output of this example is from a little-endian platform"
"USE: alien.endian"
"use: alien.endian"
"LE-PACKED-STRUCT: s1 { a char[7] } { b int } ;"
"\\ s1 see"
"USING: alien.c-types alien.endian classes.struct ;
@ -48,7 +48,7 @@ HELP: LE-STRUCT:
{ $unchecked-example
"! When run on a little-endian platform, this struct should prettyprint the same as defined"
"! The output of this example is from a little-endian platform"
"USE: alien.endian"
"use: alien.endian"
"LE-STRUCT: s1 { a int } { b be32 } ;"
"\\ s1 see"
"USING: alien.c-types alien.endian classes.struct ;
@ -141,10 +141,10 @@ ARTICLE: "alien.endian" "Alien endian-aware types"
}
"Syntax for making endian-aware structs out of native types:"
{ $subsections
POSTPONE: LE-STRUCT:
POSTPONE: BE-STRUCT:
POSTPONE: LE-PACKED-STRUCT:
POSTPONE: BE-PACKED-STRUCT:
postpone: LE-STRUCT:
postpone: BE-STRUCT:
postpone: LE-PACKED-STRUCT:
postpone: BE-PACKED-STRUCT:
} ;
ABOUT: "alien.endian"

View File

@ -7,7 +7,7 @@ HELP: define-enum
{ $values
{ "word" word } { "base-type" c-type } { "members" "sequence of word and value pairs" }
}
{ $description "Defines an enum. This is the run-time equivalent of " { $link POSTPONE: ENUM: } "." } ;
{ $description "Defines an enum. This is the run-time equivalent of " { $link postpone: ENUM: } "." } ;
HELP: enum>number
{ $values
@ -23,6 +23,6 @@ HELP: number>enum
}
{ $description "Convert a number to an enum." } ;
{ POSTPONE: ENUM: define-enum enum>number number>enum } related-words
{ postpone: ENUM: define-enum enum>number number>enum } related-words
ABOUT: "alien.enums"

View File

@ -25,7 +25,7 @@ ARTICLE: "alien.fortran-types" "Fortran types"
{ { $snippet "DOUBLE-COMPLEX" } " specifies a double-precision floating-point complex value. The alias " { $snippet "COMPLEX*16" } " is also recognized." }
{ { $snippet "CHARACTER(n)" } " specifies a character string of length " { $snippet "n" } ". The Fortran 77 syntax " { $snippet "CHARACTER*n" } " is also recognized." }
{ "Fortran arrays can be specified by suffixing a comma-separated set of dimensions in parentheses, e.g. " { $snippet "REAL(2,3,4)" } ". Arrays of unspecified length can be specified using " { $snippet "*" } " as a dimension. Arrays are passed in as flat " { $link "specialized-arrays" } "." }
{ "Struct classes defined by " { $link POSTPONE: STRUCT: } " are also supported as parameter and return types." }
{ "Struct classes defined by " { $link postpone: STRUCT: } " are also supported as parameter and return types." }
}
"When declaring the parameters of Fortran functions, an output argument can be specified by prefixing an exclamation point to the type name. This will cause the function word to leave the final value of the parameter on the stack." ;
@ -40,11 +40,11 @@ HELP: SUBROUTINE:
HELP: LIBRARY:
{ $syntax "LIBRARY: name" }
{ $values { "name" "a logical library name" } }
{ $description "Sets the logical library for subsequent " { $link POSTPONE: FUNCTION: } " and " { $link POSTPONE: SUBROUTINE: } " definitions. The given library name must have been opened with a previous call to " { $link add-fortran-library } "." } ;
{ $description "Sets the logical library for subsequent " { $link postpone: FUNCTION: } " and " { $link postpone: SUBROUTINE: } " definitions. The given library name must have been opened with a previous call to " { $link add-fortran-library } "." } ;
HELP: add-fortran-library
{ $values { "name" string } { "soname" string } { "fortran-abi" symbol } }
{ $description "Opens the shared library in the file specified by " { $snippet "soname" } " under the logical name " { $snippet "name" } " so that it may be used in subsequent " { $link POSTPONE: LIBRARY: } " and " { $link fortran-invoke } " calls. Functions and subroutines from the library will be defined using the specified " { $snippet "fortran-abi" } ", which must be one of the supported " { $link "alien.fortran-abis" } "." }
{ $description "Opens the shared library in the file specified by " { $snippet "soname" } " under the logical name " { $snippet "name" } " so that it may be used in subsequent " { $link postpone: LIBRARY: } " and " { $link fortran-invoke } " calls. Functions and subroutines from the library will be defined using the specified " { $snippet "fortran-abi" } ", which must be one of the supported " { $link "alien.fortran-abis" } "." }
;
HELP: fortran-invoke
@ -60,9 +60,9 @@ ARTICLE: "alien.fortran" "Fortran FFI"
"alien.fortran-types"
"alien.fortran-abis"
add-fortran-library
POSTPONE: LIBRARY:
POSTPONE: FUNCTION:
POSTPONE: SUBROUTINE:
postpone: LIBRARY:
postpone: FUNCTION:
postpone: SUBROUTINE:
fortran-invoke
} ;

View File

@ -20,5 +20,5 @@ HELP: find-library
{ $code
"<< \"sqlite\" \"sqlite3\" find-library cdecl add-library >>"
}
"Note the parse time evaluation with " { $link POSTPONE: << } "."
"Note the parse time evaluation with " { $link postpone: << } "."
} ;

View File

@ -109,7 +109,7 @@ TYPEDEF: int alien-parser-test-int ! reasonably unique name...
{ "OK!" } [
[
"USE: specialized-arrays SPECIALIZED-ARRAY: alien-parser-test-int" eval( -- )
"use: specialized-arrays SPECIALIZED-ARRAY: alien-parser-test-int" eval( -- )
! after restart, we end up here
"OK!"
] [ :1 ] recover

View File

@ -15,20 +15,20 @@ HELP: ALIEN:
ARTICLE: "syntax-aliens" "Alien object literal syntax"
{ $subsections
POSTPONE: ALIEN:
POSTPONE: DLL"
postpone: ALIEN:
postpone: DLL"
} ;
HELP: LIBRARY:
{ $syntax "LIBRARY: name" }
{ $values { "name" "a logical library name" } }
{ $description "Sets the logical library for consequent " { $link POSTPONE: FUNCTION: } ", " { $link POSTPONE: C-GLOBAL: } " and " { $link POSTPONE: CALLBACK: } " definitions, as well as " { $link POSTPONE: &: } " forms." }
{ $description "Sets the logical library for consequent " { $link postpone: FUNCTION: } ", " { $link postpone: C-GLOBAL: } " and " { $link postpone: CALLBACK: } " definitions, as well as " { $link postpone: &: } " forms." }
{ $notes "Logical library names are defined with the " { $link add-library } " word." } ;
HELP: FUNCTION:
{ $syntax "FUNCTION: return name ( parameters )" }
{ $values { "return" "a C return type" } { "name" "a C function name" } { "parameters" "a comma-separated sequence of type/name pairs; " { $snippet "type1 arg1, type2 arg2, ..." } } }
{ $description "Defines a new word " { $snippet "name" } " which calls the C library function with the same " { $snippet "name" } " in the logical library given by the most recent " { $link POSTPONE: LIBRARY: } " declaration."
{ $description "Defines a new word " { $snippet "name" } " which calls the C library function with the same " { $snippet "name" } " in the logical library given by the most recent " { $link postpone: LIBRARY: } " declaration."
$nl
"The new word must be compiled before being executed." }
{ $examples
@ -45,18 +45,18 @@ $nl
"The answer to the question is 42."
} }
"Using the " { $link c-string } " type instead of " { $snippet "char*" } " causes the FFI to automatically convert Factor strings to C strings. See " { $link "c-strings" } " for more information on using strings with the FFI."
{ $notes "To make a Factor word with a name different from the C function, use " { $link POSTPONE: FUNCTION-ALIAS: } "." } ;
{ $notes "To make a Factor word with a name different from the C function, use " { $link postpone: FUNCTION-ALIAS: } "." } ;
HELP: FUNCTION-ALIAS:
{ $syntax "FUNCTION-ALIAS: factor-name
return c_name ( parameters ) ;" }
{ $values { "factor-name" "a Factor word name" } { "return" "a C return type" } { "name" "a C function name" } { "parameters" "a comma-separated sequence of type/name pairs; " { $snippet "type1 arg1, type2 arg2, ..." } } }
{ $description "Defines a new word " { $snippet "factor-name" } " which calls the C library function named " { $snippet "c_name" } " in the logical library given by the most recent " { $link POSTPONE: LIBRARY: } " declaration."
{ $description "Defines a new word " { $snippet "factor-name" } " which calls the C library function named " { $snippet "c_name" } " in the logical library given by the most recent " { $link postpone: LIBRARY: } " declaration."
$nl
"The new word must be compiled before being executed." }
{ $notes "Note that the parentheses and commas are only syntax sugar and can be omitted. They serve no purpose other than to make the declaration easier to read." } ;
{ POSTPONE: FUNCTION: POSTPONE: FUNCTION-ALIAS: } related-words
{ postpone: FUNCTION: postpone: FUNCTION-ALIAS: } related-words
HELP: TYPEDEF:
{ $syntax "TYPEDEF: old new" }
@ -84,7 +84,7 @@ HELP: ENUM:
HELP: C-TYPE:
{ $syntax "C-TYPE: type" }
{ $values { "type" "a new C type" } }
{ $description "Defines a new, opaque C type. Since it is opaque, " { $snippet "type" } " will not be directly usable as a parameter or return type of a " { $link POSTPONE: FUNCTION: } " or as a slot of a " { $link POSTPONE: STRUCT: } ". However, it can be used as the type of a " { $link pointer } "." $nl
{ $description "Defines a new, opaque C type. Since it is opaque, " { $snippet "type" } " will not be directly usable as a parameter or return type of a " { $link postpone: FUNCTION: } " or as a slot of a " { $link postpone: STRUCT: } ". However, it can be used as the type of a " { $link pointer } "." $nl
{ $snippet "C-TYPE:" } " can also be used to forward declare C types, allowing circular dependencies to occur between types. For example:"
{ $code "C-TYPE: forward
STRUCT: backward { x forward* } ;
@ -94,7 +94,7 @@ STRUCT: forward { x backward* } ;" } }
HELP: CALLBACK:
{ $syntax "CALLBACK: return type ( parameters )" }
{ $values { "return" "a C return type" } { "type" "a type name" } { "parameters" "a comma-separated sequence of type/name pairs; " { $snippet "type1 arg1, type2 arg2, ..." } } }
{ $description "Defines a new function pointer C type word " { $snippet "type" } ". The newly defined word works both as a C type and as a wrapper for " { $link alien-callback } " for callbacks that accept the given return type and parameters. The ABI of the callback is decided from the ABI of the active " { $link POSTPONE: LIBRARY: } " declaration." }
{ $description "Defines a new function pointer C type word " { $snippet "type" } ". The newly defined word works both as a C type and as a wrapper for " { $link alien-callback } " for callbacks that accept the given return type and parameters. The ABI of the callback is decided from the ABI of the active " { $link postpone: LIBRARY: } " declaration." }
{ $examples
{ $code
"CALLBACK: bool FakeCallback ( int message, void* payload )"
@ -111,25 +111,25 @@ HELP: CALLBACK:
HELP: &:
{ $syntax "&: symbol" }
{ $values { "symbol" "A C global variable name" } }
{ $description "Pushes the address of a symbol named " { $snippet "symbol" } " from the current library, set with " { $link POSTPONE: LIBRARY: } "." } ;
{ $description "Pushes the address of a symbol named " { $snippet "symbol" } " from the current library, set with " { $link postpone: LIBRARY: } "." } ;
HELP: typedef
{ $values { "old" "a C type" } { "new" "a C type" } }
{ $description "Aliases the C type " { $snippet "old" } " under the name " { $snippet "new" } "." }
{ $notes "Using this word in the same source file which defines C bindings can cause problems, because words are compiled before top-level forms are run. Use the " { $link POSTPONE: TYPEDEF: } " word instead." } ;
{ $notes "Using this word in the same source file which defines C bindings can cause problems, because words are compiled before top-level forms are run. Use the " { $link postpone: TYPEDEF: } " word instead." } ;
{ POSTPONE: TYPEDEF: typedef } related-words
{ postpone: TYPEDEF: typedef } related-words
HELP: C-GLOBAL:
{ $syntax "C-GLOBAL: type name" }
{ $values { "type" "a C type" } { "name" "a C global variable name" } }
{ $description "Defines a getter " { $snippet "name" } " and setter " { $snippet "set-name" } " for the global value in the current library, set with " { $link POSTPONE: LIBRARY: } "." } ;
{ $description "Defines a getter " { $snippet "name" } " and setter " { $snippet "set-name" } " for the global value in the current library, set with " { $link postpone: LIBRARY: } "." } ;
ARTICLE: "alien.enums" "Enumeration types"
"The " { $vocab-link "alien.enums" } " vocab contains the implementation for " { $link POSTPONE: ENUM: } " C types, and provides words for converting between enum singletons and integers. It is possible to dispatch off of members of an enum."
"The " { $vocab-link "alien.enums" } " vocab contains the implementation for " { $link postpone: ENUM: } " C types, and provides words for converting between enum singletons and integers. It is possible to dispatch off of members of an enum."
$nl
"Defining enums:"
{ $subsection POSTPONE: ENUM: }
{ $subsection postpone: ENUM: }
"Defining enums at run-time:"
{ $subsection define-enum }
"Conversions between enums and integers:"

View File

@ -1,6 +1,6 @@
! Copyright (C) 2008, 2011 Slava Pestov.
! See http://factorcode.org/license.txt for BSD license.
USE: vocabs
use: vocabs
"threads" require
"io.thread" require

View File

@ -1 +1 @@
USE: unicode
use: unicode

View File

@ -28,9 +28,9 @@ ARTICLE: "changer" "Changer syntax"
$nl
"Syntax word to change tuple slots:"
{ $subsections
POSTPONE: change:
postpone: change:
}
"Macro to implement " { $link POSTPONE: change: } ":"
"Macro to implement " { $link postpone: change: } ":"
{ $subsections
inline-changer
} ;

View File

@ -30,7 +30,7 @@ HELP: <struct>
HELP: STRUCT:
{ $syntax "STRUCT: class { slot type } { slot type } ... ;" }
{ $values { "class" "a new " { $link struct } " class to define" } { "slots" "a list of slot specifiers" } }
{ $description "Defines a new " { $link struct } " type. The syntax is nearly identical to " { $link POSTPONE: TUPLE: } "; however, there are some additional restrictions on struct types:"
{ $description "Defines a new " { $link struct } " type. The syntax is nearly identical to " { $link postpone: TUPLE: } "; however, there are some additional restrictions on struct types:"
{ $list
{ "Struct classes cannot have a superclass defined." }
{ "The slots of a struct must all have a type declared. The type must be a C type." }
@ -41,42 +41,42 @@ HELP: STRUCT:
HELP: S{
{ $syntax "S{ class slots... }" }
{ $values { "class" "a " { $link struct } " class word" } { "slots" "slot values" } }
{ $description "Marks the beginning of a literal struct. The syntax is identical to tuple literal syntax with " { $link POSTPONE: T{ } { $snippet " }" } "; either the assoc syntax (that is, " { $snippet "S{ class { slot value } { slot value } ... }" } ") or the simple syntax (" { $snippet "S{ class f value value ... }" } ") can be used." } ;
{ $description "Marks the beginning of a literal struct. The syntax is identical to tuple literal syntax with " { $link postpone: T{ } { $snippet " }" } "; either the assoc syntax (that is, " { $snippet "S{ class { slot value } { slot value } ... }" } ") or the simple syntax (" { $snippet "S{ class f value value ... }" } ") can be used." } ;
HELP: S@
{ $syntax "S@ class alien" }
{ $values { "class" "a " { $link struct } " class word" } { "alien" "a literal alien" } }
{ $description "Marks the beginning of a literal struct at a specific C address. The prettyprinter uses this syntax when the memory backing a struct object is invalid. This syntax should not generally be used in source code." } ;
{ POSTPONE: S{ POSTPONE: S@ } related-words
{ postpone: S{ postpone: S@ } related-words
HELP: UNION-STRUCT:
{ $syntax "UNION-STRUCT: class { slot type } { slot type } ... ;" }
{ $values { "class" "a new " { $link struct } " class to define" } { "slots" "a list of slot specifiers" } }
{ $description "Defines a new " { $link struct } " type where all of the slots share the same storage. See " { $link POSTPONE: STRUCT: } " for details on the syntax." } ;
{ $description "Defines a new " { $link struct } " type where all of the slots share the same storage. See " { $link postpone: STRUCT: } " for details on the syntax." } ;
HELP: PACKED-STRUCT:
{ $syntax "PACKED-STRUCT: class { slot type } { slot type } ... ;" }
{ $values { "class" "a new " { $link struct } " class to define" } { "slots" "a list of slot specifiers" } }
{ $description "Defines a new " { $link struct } " type with no alignment padding between slots or at the end. In all other respects, behaves like " { $link POSTPONE: STRUCT: } "." } ;
{ $description "Defines a new " { $link struct } " type with no alignment padding between slots or at the end. In all other respects, behaves like " { $link postpone: STRUCT: } "." } ;
HELP: define-struct-class
{ $values
{ "class" class } { "slots" "a sequence of " { $link struct-slot-spec } "s" }
}
{ $description "Defines a new " { $link struct } " class. This is the runtime equivalent of the " { $link POSTPONE: STRUCT: } " syntax." } ;
{ $description "Defines a new " { $link struct } " class. This is the runtime equivalent of the " { $link postpone: STRUCT: } " syntax." } ;
HELP: define-packed-struct-class
{ $values
{ "class" class } { "slots" "a sequence of " { $link struct-slot-spec } "s" }
}
{ $description "Defines a new " { $link struct } " class. This is the runtime equivalent of the " { $link POSTPONE: PACKED-STRUCT: } " syntax." } ;
{ $description "Defines a new " { $link struct } " class. This is the runtime equivalent of the " { $link postpone: PACKED-STRUCT: } " syntax." } ;
HELP: define-union-struct-class
{ $values
{ "class" class } { "slots" "a sequence of " { $link struct-slot-spec } "s" }
}
{ $description "Defines a new " { $link struct } " class where all of the slots share the same storage. This is the runtime equivalent of the " { $link POSTPONE: UNION-STRUCT: } " syntax." } ;
{ $description "Defines a new " { $link struct } " class where all of the slots share the same storage. This is the runtime equivalent of the " { $link postpone: UNION-STRUCT: } " syntax." } ;
HELP: malloc-struct
{ $values
@ -110,7 +110,7 @@ HELP: read-struct
HELP: struct
{ $class-description "The parent class of all struct types." } ;
{ struct POSTPONE: STRUCT: POSTPONE: UNION-STRUCT: } related-words
{ struct postpone: STRUCT: postpone: UNION-STRUCT: } related-words
HELP: struct-class
{ $class-description "The metaclass of all " { $link struct } " classes." } ;
@ -144,10 +144,10 @@ ARTICLE: "classes.struct.examples" "Struct class examples"
} ;
ARTICLE: "classes.struct.define" "Defining struct classes"
"Struct classes are defined using a syntax similar to the " { $link POSTPONE: TUPLE: } " syntax for defining tuple classes:"
{ $subsections POSTPONE: STRUCT: POSTPONE: PACKED-STRUCT: }
"Struct classes are defined using a syntax similar to the " { $link postpone: TUPLE: } " syntax for defining tuple classes:"
{ $subsections postpone: STRUCT: postpone: PACKED-STRUCT: }
"Union structs are also supported, which behave like structs but share the same memory for all the slots."
{ $subsections POSTPONE: UNION-STRUCT: } ;
{ $subsections postpone: UNION-STRUCT: } ;
ARTICLE: "classes.struct.create" "Creating instances of structs"
"Structs can be allocated with " { $link new } "- and " { $link boa } "-like constructor words. Additional words are provided for building structs from C memory and from existing buffers:"
@ -162,8 +162,8 @@ ARTICLE: "classes.struct.create" "Creating instances of structs"
(struct)
(malloc-struct)
}
"Structs have literal syntax, similar to " { $link POSTPONE: T{ } " for tuples:"
{ $subsections POSTPONE: S{ } ;
"Structs have literal syntax, similar to " { $link postpone: T{ } " for tuples:"
{ $subsections postpone: S{ } ;
ARTICLE: "classes.struct.c" "Passing structs to C functions"
"Structs can be passed and returned by value, or by reference."

View File

@ -132,7 +132,7 @@ STRUCT: struct-test-bar
[ make-mirror clear-assoc ] keep
] unit-test
{ POSTPONE: STRUCT: }
{ postpone: STRUCT: }
[ struct-test-foo struct-definer-word ] unit-test
UNION-STRUCT: struct-test-float-and-bits
@ -144,7 +144,7 @@ UNION-STRUCT: struct-test-float-and-bits
{ 123 } [ [ struct-test-foo malloc-struct &free y>> ] with-destructors ] unit-test
{ POSTPONE: UNION-STRUCT: }
{ postpone: UNION-STRUCT: }
[ struct-test-float-and-bits struct-definer-word ] unit-test
STRUCT: struct-test-string-ptr
@ -332,7 +332,7 @@ STRUCT: struct-that's-a-word { x int } ;
! Interactive parsing of struct slot definitions
[
"USE: classes.struct in: classes.struct.tests STRUCT: unexpected-eof-test" <string-reader>
"use: classes.struct in: classes.struct.tests STRUCT: unexpected-eof-test" <string-reader>
"struct-class-test-1" parse-stream
] [ error>> error>> unexpected-eof? ] must-fail-with
@ -346,7 +346,7 @@ STRUCT: struct-that's-a-word { x int } ;
! S{ with non-struct type
[
"USE: classes.struct in: classes.struct.tests TUPLE: not-a-struct ; S{ not-a-struct }"
"use: classes.struct in: classes.struct.tests TUPLE: not-a-struct ; S{ not-a-struct }"
eval( -- value )
] [ error>> no-method? ] must-fail-with
@ -491,7 +491,7 @@ PACKED-STRUCT: packed-struct-test
{ 10 } [ "g" packed-struct-test offset-of ] unit-test
{ 11 } [ "h" packed-struct-test offset-of ] unit-test
{ POSTPONE: PACKED-STRUCT: }
{ postpone: PACKED-STRUCT: }
[ packed-struct-test struct-definer-word ] unit-test
STRUCT: struct-1 { a c:int } ;

View File

@ -130,7 +130,7 @@ in: compiler.cfg.builder.tests
{
byte-array
alien
POSTPONE: f
postpone: f
} [| class |
{
alien-signed-1

View File

@ -116,7 +116,7 @@ PRIVATE>
! value-numbering subsume copy-propagation, thus eliminating
! this pass altogether.
USE: compiler.cfg
use: compiler.cfg
: copy-propagation ( cfg -- )
{

View File

@ -6,7 +6,7 @@ compiler.cfg.ssa.destruction compiler.cfg.utilities
compiler.cfg.value-numbering cpu.architecture kernel layouts
literals math namespaces sequences system tools.test ;
! need cfg simd loaded for some tests
USE: compiler.cfg.value-numbering.simd
use: compiler.cfg.value-numbering.simd
QUALIFIED-WITH: alien.c-types c
in: compiler.cfg.value-numbering.tests

View File

@ -5,15 +5,15 @@ compiler.cfg.instructions compiler.cfg.rpo
compiler.cfg.utilities kernel locals namespaces sequences
sequences.deep ;
USE: compiler.cfg.value-numbering.alien
USE: compiler.cfg.value-numbering.comparisons
USE: compiler.cfg.value-numbering.expressions
USE: compiler.cfg.value-numbering.folding
USE: compiler.cfg.value-numbering.graph
USE: compiler.cfg.value-numbering.math
USE: compiler.cfg.value-numbering.misc
USE: compiler.cfg.value-numbering.rewrite
USE: compiler.cfg.value-numbering.slots
use: compiler.cfg.value-numbering.alien
use: compiler.cfg.value-numbering.comparisons
use: compiler.cfg.value-numbering.expressions
use: compiler.cfg.value-numbering.folding
use: compiler.cfg.value-numbering.graph
use: compiler.cfg.value-numbering.math
use: compiler.cfg.value-numbering.misc
use: compiler.cfg.value-numbering.rewrite
use: compiler.cfg.value-numbering.slots
in: compiler.cfg.value-numbering

View File

@ -44,7 +44,7 @@ $nl
}
"The optimizing compiler also trades off compile time for performance of generated code, so loading certain vocabularies might take a while. Saving the image after loading vocabularies can save you a lot of time that you would spend waiting for the same code to load in every coding session; see " { $link "images" } " for information."
$nl
"Most code you write will run with the optimizing compiler. Sometimes, the non-optimizing compiler is used, for example for listener interactions, or for running the quotation passed to " { $link POSTPONE: call( } "."
"Most code you write will run with the optimizing compiler. Sometimes, the non-optimizing compiler is used, for example for listener interactions, or for running the quotation passed to " { $link postpone: call( } "."
{ $subsections
"compiler-errors"
"hints"

View File

@ -530,7 +530,7 @@ TUPLE: myseq { underlying1 byte-array read-only } { underlying2 byte-array read-
[ 3524578 5702887 ] [ fib-count2 ] unit-test
! Stupid repro
USE: compiler.cfg.registers
use: compiler.cfg.registers
reset-vreg-counter

View File

@ -439,7 +439,7 @@ ERROR: bug-in-fixnum* x y a b ;
[ ALIEN: 1234 ] [ ALIEN: 1234 [ { alien } declare void* <ref> ] compile-call void* deref ] unit-test
[ ALIEN: 1234 ] [ ALIEN: 1234 [ { c-ptr } declare void* <ref> ] compile-call void* deref ] unit-test
[ f ] [ f [ { POSTPONE: f } declare void* <ref> ] compile-call void* deref ] unit-test
[ f ] [ f [ { postpone: f } declare void* <ref> ] compile-call void* deref ] unit-test
[ 252 ] [ B{ 1 2 3 -4 5 } 3 [ { byte-array fixnum } declare alien-unsigned-1 ] compile-call ] unit-test
[ -4 ] [ B{ 1 2 3 -4 5 } 3 [ { byte-array fixnum } declare alien-signed-1 ] compile-call ] unit-test

View File

@ -284,7 +284,7 @@ HINTS: recursive-inline-hang-3 array ;
! Infinite expansion
TUPLE: cons car cdr ;
UNION: improper-list cons POSTPONE: f ;
UNION: improper-list cons postpone: f ;
PREDICATE: list < improper-list
[ cdr>> list instance? ] [ t ] if* ;

View File

@ -20,7 +20,7 @@ EBNF: expr
pipeline = "hello" => [[ ast>pipeline-expr ]]
;EBNF
USE: tools.test
use: tools.test
[ t ] [ \ expr word-optimized? ] unit-test
[ t ] [ \ ast>pipeline-expr word-optimized? ] unit-test

View File

@ -26,7 +26,7 @@ in: compiler.tests.redefine0
[ ] [ test-4 ] unit-test
[ ] [ "in: compiler.tests.redefine0 USE: kernel : test-3 ( a -- ) call ; inline" eval( -- ) ] unit-test
[ ] [ "in: compiler.tests.redefine0 use: kernel : test-3 ( a -- ) call ; inline" eval( -- ) ] unit-test
[ test-4 ] [ not-compiled? ] must-fail-with

View File

@ -11,7 +11,7 @@ M: integer method-redefine-generic-1 3 + ;
[ 6 ] [ method-redefine-test-1 ] unit-test
[ ] [ "in: compiler.tests.redefine1 USE: math M: fixnum method-redefine-generic-1 4 + ;" eval( -- ) ] unit-test
[ ] [ "in: compiler.tests.redefine1 use: math M: fixnum method-redefine-generic-1 4 + ;" eval( -- ) ] unit-test
[ 7 ] [ method-redefine-test-1 ] unit-test
@ -27,7 +27,7 @@ M: integer method-redefine-generic-2 3 + ;
[ 6 ] [ method-redefine-test-2 ] unit-test
[ ] [ "in: compiler.tests.redefine1 USE: kernel USE: math M: fixnum method-redefine-generic-2 4 + ; USE: strings M: string method-redefine-generic-2 drop f ;" eval( -- ) ] unit-test
[ ] [ "in: compiler.tests.redefine1 use: kernel use: math M: fixnum method-redefine-generic-2 4 + ; use: strings M: string method-redefine-generic-2 drop f ;" eval( -- ) ] unit-test
[ 7 ] [ method-redefine-test-2 ] unit-test

View File

@ -15,6 +15,6 @@ M: object g drop t ;
TUPLE: jeah ;
[ ] [ "USE: kernel in: compiler.tests.redefine12 M: jeah g drop f ;" eval( -- ) ] unit-test
[ ] [ "use: kernel in: compiler.tests.redefine12 M: jeah g drop f ;" eval( -- ) ] unit-test
[ f ] [ T{ jeah } h ] unit-test

View File

@ -5,7 +5,7 @@ in: compiler.tests.redefine2
defer: redefine2-test
[ ] [ "USE: sequences USE: kernel in: compiler.tests.redefine2 TUPLE: redefine2-test ; M: redefine2-test nth 2drop 3 ; INSTANCE: redefine2-test sequence" eval( -- ) ] unit-test
[ ] [ "use: sequences use: kernel in: compiler.tests.redefine2 TUPLE: redefine2-test ; M: redefine2-test nth 2drop 3 ; INSTANCE: redefine2-test sequence" eval( -- ) ] unit-test
[ t ] [ \ redefine2-test symbol? ] unit-test

View File

@ -21,7 +21,7 @@ M: empty-mixin sheeple drop "wake up" ; inline
[ t ] [ object \ sheeple lookup-method \ sheeple-test compiled-use? ] unit-test
[ f ] [ empty-mixin \ sheeple lookup-method \ sheeple-test compiled-use? ] unit-test
[ ] [ "in: compiler.tests.redefine3 USE: arrays INSTANCE: array empty-mixin" eval( -- ) ] unit-test
[ ] [ "in: compiler.tests.redefine3 use: arrays INSTANCE: array empty-mixin" eval( -- ) ] unit-test
[ "wake up" ] [ sheeple-test ] unit-test
[ f ] [ object \ sheeple lookup-method \ sheeple-test compiled-use? ] unit-test

View File

@ -7,6 +7,6 @@ in: compiler.tests.redefine4
[ "" ] [ [ declaration-test ] with-string-writer ] unit-test
[ ] [ "in: compiler.tests.redefine4 USE: io : declaration-test-1 ( -- a ) \"X\" write f ;" eval( -- ) ] unit-test
[ ] [ "in: compiler.tests.redefine4 use: io : declaration-test-1 ( -- a ) \"X\" write f ;" eval( -- ) ] unit-test
[ "X" ] [ [ declaration-test ] with-string-writer ] unit-test

View File

@ -16,7 +16,7 @@ in: compiler.tests.redefine5
] unit-test
[ ] [
"USE: kernel
"use: kernel
in: compiler.tests.redefine5
TUPLE: my-tuple ;
M: my-tuple my-generic drop 0 ;" eval( -- )

View File

@ -16,7 +16,7 @@ in: compiler.tests.redefine7
] unit-test
[ ] [
"USE: math
"use: math
in: compiler.tests.redefine7
INSTANCE: float my-mixin"
eval( -- )

View File

@ -19,7 +19,7 @@ in: compiler.tests.redefine8
] unit-test
[ ] [
"USE: math
"use: math
in: compiler.tests.redefine8
INSTANCE: float my-mixin"
eval( -- )

View File

@ -8,7 +8,7 @@ in: compiler.tests.redefine9
[ ] [
"USING: kernel math math.order sorting ;
IN: compiler.tests.redefine9
in: compiler.tests.redefine9
mixin: my-mixin
INSTANCE: fixnum my-mixin
GENERIC: my-generic ( a -- b ) ;
@ -19,8 +19,8 @@ in: compiler.tests.redefine9
] unit-test
[ ] [
"USE: math
IN: compiler.tests.redefine9
"use: math
in: compiler.tests.redefine9
TUPLE: my-tuple ;
INSTANCE: my-tuple my-mixin"
eval( -- )

View File

@ -1,4 +1,4 @@
USE: vocabs.loader
use: vocabs.loader
in: compiler.tests.reload
! "parser" reload

View File

@ -3,9 +3,9 @@
USING: compiler.tree.escape-analysis.allocations
compiler.tree.escape-analysis.nodes kernel namespaces ;
USE: compiler.tree.escape-analysis.recursive
USE: compiler.tree.escape-analysis.branches
USE: compiler.tree.escape-analysis.simple
use: compiler.tree.escape-analysis.recursive
use: compiler.tree.escape-analysis.branches
use: compiler.tree.escape-analysis.simple
in: compiler.tree.escape-analysis

View File

@ -132,7 +132,7 @@ TUPLE: a-tuple x ;
{ t } [ test-quotatation cached-effect ( a -- b ) effect<= ] unit-test
{ } [ "in: compiler.tree.propagation.call-effect.tests USE: math : call(-redefine-test ( a b -- c ) + ;" eval( -- ) ] unit-test
{ } [ "in: compiler.tree.propagation.call-effect.tests use: math : call(-redefine-test ( a b -- c ) + ;" eval( -- ) ] unit-test
{ t } [ test-quotatation cached-effect ( a b -- c ) effect<= ] unit-test
@ -140,7 +140,7 @@ TUPLE: a-tuple x ;
{ 4 } [ 1 3 test-quotatation inline-cache-invalidation-test ] unit-test
{ } [ "in: compiler.tree.propagation.call-effect.tests USE: math : call(-redefine-test ( a -- c ) 1 + ;" eval( -- ) ] unit-test
{ } [ "in: compiler.tree.propagation.call-effect.tests use: math : call(-redefine-test ( a -- c ) 1 + ;" eval( -- ) ] unit-test
[ 1 3 test-quotatation inline-cache-invalidation-test ] [ T{ wrong-values f [ call(-redefine-test ] ( a b -- c ) } = ] must-fail-with

View File

@ -577,7 +577,7 @@ TUPLE: immutable-prop-test-tuple { x sequence read-only } ;
{ V{ number } } [ [ [ "Oops" throw ] [ 2 + ] if ] final-classes ] unit-test
{ V{ number } } [ [ [ 2 + ] [ "Oops" throw ] if ] final-classes ] unit-test
{ V{ POSTPONE: f } } [
{ V{ postpone: f } } [
[ dup 1.0 <= [ drop f ] [ 0 number= ] if ] final-classes
] unit-test
@ -720,7 +720,7 @@ M: array iterate first t ; inline
[ { hashtable } declare hashtable instance? ] final-classes
] unit-test
{ V{ POSTPONE: f } } [
{ V{ postpone: f } } [
[ { vector } declare hashtable instance? ] final-classes
] unit-test
@ -728,7 +728,7 @@ M: array iterate first t ; inline
[ { assoc } declare hashtable instance? ] final-classes
] unit-test
{ V{ POSTPONE: f } } [
{ V{ postpone: f } } [
[ 3 string? ] final-classes
] unit-test
@ -788,7 +788,7 @@ mixin: empty-mixin
] final-classes
] unit-test
{ V{ POSTPONE: f } } [
{ V{ postpone: f } } [
[ { float } declare 0 eq? ] final-classes
] unit-test
@ -872,7 +872,7 @@ mixin: empty-mixin
[ { fixnum } declare log2 0 >= ] final-classes
] unit-test
{ V{ POSTPONE: f } } [
{ V{ postpone: f } } [
[ { word object } declare equal? ] final-classes
] unit-test
@ -1074,7 +1074,7 @@ M: tuple-with-read-only-slot clone
] unit-test
{ t } [
[ { POSTPONE: f } declare <displaced-alien> ] final-classes
[ { postpone: f } declare <displaced-alien> ] final-classes
first \ f alien class-or class=
] unit-test

View File

@ -68,7 +68,7 @@ SLOT-CONSTRUCTOR: a-monster
{ 18 } [ "Phil" 11 11 <b-monster> stop>> ] unit-test
[
"USE: constructors
"use: constructors
in: constructors.tests
TUPLE: foo a b ;
CONSTRUCTOR: <foo> foo ( a a -- obj )" eval( -- )
@ -77,7 +77,7 @@ CONSTRUCTOR: <foo> foo ( a a -- obj )" eval( -- )
] must-fail-with
[
"USE: constructors
"use: constructors
in: constructors.tests
TUPLE: foo a b ;
CONSTRUCTOR: <foo> foo ( a c -- obj )" eval( -- )

View File

@ -1059,7 +1059,7 @@ M: ppc immediate-arithmetic? ( n -- ? ) -32768 32767 between? ;
M: ppc immediate-bitwise? ( n -- ? ) 0 65535 between? ;
M: ppc immediate-store? ( n -- ? ) immediate-comparand? ;
USE: vocabs
use: vocabs
{
{ [ os linux? ] [
{

View File

@ -7,6 +7,6 @@ ARTICLE: "definitions.icons" "Definition icons"
"Looking up the icon associated with a definition:"
{ $subsections definition-icon }
"Defining new icons:"
{ $subsections POSTPONE: ICON: } ;
{ $subsections postpone: ICON: } ;
ABOUT: "definitions.icons"

Some files were not shown because too many files have changed in this diff Show More