Merge branch 'master' of git://factorcode.org/git/factor

Conflicts:
	basis/game/input/input.factor
db4
William Schlieper 2010-02-20 08:18:33 -05:00
commit e342e92f86
763 changed files with 2170 additions and 1070 deletions

View File

@ -1 +1 @@
unportable
untested

View File

@ -309,7 +309,7 @@ HELP: time-
} ;
HELP: convert-timezone
{ $values { "timestamp" timestamp } { "duration" duration } { "timestamp" timestamp } }
{ $values { "timestamp" timestamp } { "duration" duration } { "timestamp'" timestamp } }
{ $description "Converts the " { $snippet "timestamp" } "'s " { $snippet "gmt-offset" } " to the GMT offset represented by the " { $snippet "duration" } "." }
{ $examples
{ $example "USING: accessors calendar prettyprint ;"
@ -319,7 +319,7 @@ HELP: convert-timezone
} ;
HELP: >local-time
{ $values { "timestamp" timestamp } { "timestamp" timestamp } }
{ $values { "timestamp" timestamp } { "timestamp'" timestamp } }
{ $description "Converts the " { $snippet "timestamp" } " to the timezone of your computer." }
{ $examples
{ $example "USING: accessors calendar kernel prettyprint ;"
@ -329,7 +329,7 @@ HELP: >local-time
} ;
HELP: >gmt
{ $values { "timestamp" timestamp } { "timestamp" timestamp } }
{ $values { "timestamp" timestamp } { "timestamp'" timestamp } }
{ $description "Converts the " { $snippet "timestamp" } " to the GMT timezone." }
{ $examples
{ $example "USING: accessors calendar kernel prettyprint ;"

View File

@ -316,15 +316,15 @@ M: duration <=> [ duration>years ] compare ;
GENERIC: time- ( time1 time2 -- time3 )
: convert-timezone ( timestamp duration -- timestamp )
: convert-timezone ( timestamp duration -- timestamp' )
over gmt-offset>> over = [ drop ] [
[ over gmt-offset>> time- time+ ] keep >>gmt-offset
] if ;
: >local-time ( timestamp -- timestamp )
: >local-time ( timestamp -- timestamp' )
gmt-offset-duration convert-timezone ;
: >gmt ( timestamp -- timestamp )
: >gmt ( timestamp -- timestamp' )
instant convert-timezone ;
M: timestamp <=> ( ts1 ts2 -- n )

View File

@ -0,0 +1 @@
unix

View File

@ -1 +0,0 @@
unportable

View File

@ -0,0 +1 @@
windows

View File

@ -1 +0,0 @@
unportable

View File

@ -1,11 +1,11 @@
! (c)Joe Groff bsd license
USING: accessors alien alien.c-types alien.data ascii
assocs byte-arrays classes.struct classes.tuple.private
assocs byte-arrays classes.struct classes.tuple.private classes.tuple
combinators compiler.tree.debugger compiler.units destructors
io.encodings.utf8 io.pathnames io.streams.string kernel libc
literals math mirrors namespaces prettyprint
prettyprint.config see sequences specialized-arrays system
tools.test parser lexer eval layouts ;
tools.test parser lexer eval layouts generic.single classes ;
FROM: math => float ;
QUALIFIED-WITH: alien.c-types c
SPECIALIZED-ARRAY: char
@ -338,13 +338,28 @@ STRUCT: struct-that's-a-word { x int } ;
[
"USE: classes.struct IN: classes.struct.tests TUPLE: not-a-struct ; S{ not-a-struct }"
eval( -- value )
] must-fail
] [ error>> no-method? ] must-fail-with
! Subclassing a struct class should not be allowed
[
"USE: classes.struct IN: classes.struct.tests STRUCT: a-struct { x int } ; TUPLE: not-a-struct < a-struct ;"
"USING: alien.c-types classes.struct ; IN: classes.struct.tests STRUCT: a-struct { x int } ; TUPLE: not-a-struct < a-struct ;"
eval( -- )
] must-fail
] [ error>> bad-superclass? ] must-fail-with
! Changing a superclass into a struct should reset the subclass
TUPLE: will-become-struct ;
TUPLE: a-subclass < will-become-struct ;
[ f ] [ will-become-struct struct-class? ] unit-test
[ will-become-struct ] [ a-subclass superclass ] unit-test
[ ] [ "IN: classes.struct.tests USING: classes.struct alien.c-types ; STRUCT: will-become-struct { x int } ;" eval( -- ) ] unit-test
[ t ] [ will-become-struct struct-class? ] unit-test
[ tuple ] [ a-subclass superclass ] unit-test
! Remove c-type when struct class is forgotten
[ ] [

View File

@ -32,8 +32,6 @@ TUPLE: struct-bit-slot-spec < struct-slot-spec
PREDICATE: struct-class < tuple-class
superclass \ struct eq? ;
M: struct-class valid-superclass? drop f ;
SLOT: fields
: struct-slots ( struct-class -- slots )
@ -273,7 +271,7 @@ M: struct binary-zero? >c-ptr [ 0 = ] all? ;
[ type>> c-type drop ] each ;
: redefine-struct-tuple-class ( class -- )
[ dup class? [ forget-class ] [ drop ] if ] [ struct f define-tuple-class ] bi ;
[ struct f define-tuple-class ] [ make-final ] bi ;
:: (define-struct-class) ( class slots offsets-quot -- )
slots empty? [ struct-must-have-slots ] when

View File

@ -0,0 +1 @@
macosx

View File

@ -1 +0,0 @@
unportable

View File

@ -1,7 +1,7 @@
! Copyright (C) 2005, 2006 Kevin Reid.
! See http://factorcode.org/license.txt for BSD license.
USING: assocs kernel namespaces cocoa cocoa.classes
cocoa.subclassing debugger ;
USING: alien.c-types assocs kernel namespaces cocoa
cocoa.classes cocoa.runtime cocoa.subclassing debugger ;
IN: cocoa.callbacks
SYMBOL: callbacks

View File

@ -0,0 +1 @@
macosx

View File

@ -1 +0,0 @@
unportable

View File

@ -0,0 +1 @@
macosx

View File

@ -1 +0,0 @@
unportable

View File

@ -0,0 +1 @@
macosx

View File

@ -1 +0,0 @@
unportable

View File

@ -0,0 +1 @@
macosx

View File

@ -1 +0,0 @@
unportable

View File

@ -0,0 +1 @@
macosx

View File

@ -1 +0,0 @@
unportable

View File

@ -0,0 +1 @@
macosx

View File

@ -1 +0,0 @@
unportable

View File

@ -0,0 +1 @@
macosx

View File

@ -0,0 +1 @@
macosx

View File

@ -1 +0,0 @@
unportable

View File

@ -0,0 +1 @@
macosx

View File

@ -1 +0,0 @@
unportable

View File

@ -0,0 +1 @@
macosx

View File

@ -1 +0,0 @@
unportable

View File

@ -1,3 +1,2 @@
unportable
bindings
ffi

View File

@ -0,0 +1 @@
macosx

View File

@ -1 +0,0 @@
unportable

View File

@ -0,0 +1 @@
macosx

View File

@ -1 +0,0 @@
unportable

View File

@ -0,0 +1 @@
macosx

View File

@ -1 +0,0 @@
unportable

View File

@ -0,0 +1,9 @@
USING: compiler.crossref fry kernel sequences tools.test vocabs words ;
IN: compiler.crossref.tests
! Dependencies of all words should always be satisfied unless we're
! in the middle of recompiling something
[ { } ] [
all-words dup [ subwords ] map concat append
H{ } clone '[ _ dependencies-satisfied? not ] filter
] unit-test

View File

@ -0,0 +1,11 @@
IN: compiler.tests.redefine22
USING: kernel sequences compiler.units vocabs tools.test definitions ;
TUPLE: ttt ;
INSTANCE: ttt sequence
M: ttt new-sequence 2drop ttt new ;
: www-1 ( a -- b ) T{ ttt } new-sequence ;
! This used to break with a compiler error in the above word
[ ] [ [ \ ttt forget ] with-compilation-unit ] unit-test

View File

@ -0,0 +1,13 @@
IN: compiler.tests.redefine23
USING: classes.struct specialized-arrays alien.c-types sequences
compiler.units vocabs tools.test ;
STRUCT: my-struct { x int } ;
SPECIALIZED-ARRAY: my-struct
: my-word ( a -- b ) iota [ my-struct <struct-boa> ] my-struct-array{ } map-as ;
[ ] [
[
"specialized-arrays.instances.compiler.tests.redefine23" forget-vocab
] with-compilation-unit
] unit-test

View File

@ -51,11 +51,16 @@ GENERIC: cleanup* ( node -- node/nodes )
[ in-d>> #drop ]
bi prefix ;
: record-predicate-folding ( #call -- )
[ node-input-infos first class>> ]
: >predicate-folding< ( #call -- value-info class result )
[ node-input-infos first ]
[ word>> "predicating" word-prop ]
[ node-output-infos first literal>> ] tri
[ depends-on-class<= ] [ depends-on-classes-disjoint ] if ;
[ node-output-infos first literal>> ] tri ;
: record-predicate-folding ( #call -- )
>predicate-folding< pick literal?>>
[ [ literal>> ] 2dip depends-on-instance-predicate ]
[ [ class>> ] 2dip depends-on-class-predicate ]
if ;
: record-folding ( #call -- )
dup word>> predicate?

View File

@ -1,10 +1,11 @@
! Copyright (C) 2008, 2009 Slava Pestov.
! Copyright (C) 2008, 2010 Slava Pestov.
! See http://factorcode.org/license.txt for BSD license.
USING: assocs classes classes.algebra classes.tuple
classes.tuple.private kernel accessors math math.intervals namespaces
sequences sequences.private words combinators memoize
combinators.short-circuit byte-arrays strings arrays layouts
cpu.architecture compiler.tree.propagation.copy ;
classes.tuple.private classes.singleton kernel accessors math
math.intervals namespaces sequences sequences.private words
combinators memoize combinators.short-circuit byte-arrays
strings arrays layouts cpu.architecture
compiler.tree.propagation.copy ;
IN: compiler.tree.propagation.info
: false-class? ( class -- ? ) \ f class<= ;
@ -65,9 +66,17 @@ DEFER: <literal-info>
UNION: fixed-length array byte-array string ;
: literal-class ( obj -- class )
#! Handle forgotten tuples and singleton classes properly
dup singleton-class? [
class dup class? [
drop tuple
] unless
] unless ;
: init-literal-info ( info -- info )
empty-interval >>interval
dup literal>> class >>class
dup literal>> literal-class >>class
dup literal>> {
{ [ dup real? ] [ [a,a] >>interval ] }
{ [ dup tuple? ] [ tuple-slot-infos >>slots ] }

View File

@ -648,7 +648,7 @@ M: array iterate first t ; inline
] final-info drop
] unit-test
[ V{ word } ] [
[ V{ t } ] [
[ { hashtable } declare hashtable instance? ] final-classes
] unit-test
@ -660,7 +660,7 @@ M: array iterate first t ; inline
[ { assoc } declare hashtable instance? ] final-classes
] unit-test
[ V{ word } ] [
[ V{ t } ] [
[ { string } declare string? ] final-classes
] unit-test
@ -774,7 +774,7 @@ MIXIN: empty-mixin
[ { fixnum } declare log2 ] final-classes
] unit-test
[ V{ word } ] [
[ V{ t } ] [
[ { fixnum } declare log2 0 >= ] final-classes
] unit-test

View File

@ -1,4 +1,4 @@
! Copyright (C) 2008, 2009 Slava Pestov.
! Copyright (C) 2008, 2010 Slava Pestov.
! See http://factorcode.org/license.txt for BSD license.
USING: fry accessors kernel sequences sequences.private assocs
words namespaces classes.algebra combinators
@ -93,11 +93,8 @@ M: #declare propagate-before
recover ;
: predicate-output-infos/class ( info class -- info )
[ class>> ] dip {
{ [ 2dup class<= ] [ t <literal-info> ] }
{ [ 2dup classes-intersect? not ] [ f <literal-info> ] }
[ object-info ]
} cond 2nip ;
[ class>> ] dip compare-classes
dup +incomparable+ eq? [ drop object-info ] [ <literal-info> ] if ;
: predicate-output-infos ( info class -- info )
over literal?>>

View File

@ -20,7 +20,6 @@ HELP: tiff-lzw-uncompress
HELP: lzw-read
{ $values
{ "lzw" lzw }
{ "lzw" lzw } { "n" integer }
}
{ $description "Read the next LZW code." } ;
@ -48,7 +47,6 @@ HELP: code-space-full?
HELP: reset-lzw-uncompress
{ $values
{ "lzw" lzw }
{ "lzw" lzw }
}
{ $description "Reset the LZW uncompressor state (either at initialization time or immediately after receiving a Clear Code). " } ;

View File

@ -42,40 +42,6 @@ IN: concurrency.mailboxes.tests
mailbox-get
] unit-test
<mailbox> "m" set
1 <count-down> "c" set
1 <count-down> "d" set
[
"c" get await
[ "m" get mailbox-get drop ]
[ drop "d" get count-down ] recover
] "Mailbox close test" spawn drop
[ ] [ "c" get count-down ] unit-test
[ ] [ "m" get dispose ] unit-test
[ ] [ "d" get 5 seconds await-timeout ] unit-test
[ ] [ "m" get dispose ] unit-test
<mailbox> "m" set
1 <count-down> "c" set
1 <count-down> "d" set
[
"c" get await
"m" get wait-for-close
"d" get count-down
] "Mailbox close test" spawn drop
[ ] [ "c" get count-down ] unit-test
[ ] [ "m" get dispose ] unit-test
[ ] [ "d" get 5 seconds await-timeout ] unit-test
[ ] [ "m" get dispose ] unit-test
[ { "foo" "bar" } ] [
<mailbox>
"foo" over mailbox-put
@ -86,4 +52,3 @@ IN: concurrency.mailboxes.tests
[
<mailbox> 1 seconds mailbox-get-timeout
] [ wait-timeout? ] must-fail-with

View File

@ -1,17 +1,17 @@
! Copyright (C) 2005, 2008 Chris Double, Slava Pestov.
! Copyright (C) 2005, 2010 Chris Double, Slava Pestov.
! See http://factorcode.org/license.txt for BSD license.
USING: dlists deques threads sequences continuations
destructors namespaces math quotations words kernel
arrays assocs init system concurrency.conditions accessors
debugger debugger.threads locals fry ;
USING: dlists deques threads sequences continuations namespaces
math quotations words kernel arrays assocs init system
concurrency.conditions accessors debugger debugger.threads
locals fry ;
IN: concurrency.mailboxes
TUPLE: mailbox < disposable threads data ;
M: mailbox dispose* threads>> notify-all ;
TUPLE: mailbox threads data ;
: <mailbox> ( -- mailbox )
mailbox new-disposable <dlist> >>threads <dlist> >>data ;
mailbox new
<dlist> >>threads
<dlist> >>data ;
: mailbox-empty? ( mailbox -- bool )
data>> deque-empty? ;
@ -24,14 +24,12 @@ M: mailbox dispose* threads>> notify-all ;
[ threads>> ] dip "mailbox" wait ;
:: block-unless-pred ( mailbox timeout pred: ( message -- ? ) -- )
mailbox check-disposed
mailbox data>> pred dlist-any? [
mailbox timeout wait-for-mailbox
mailbox timeout pred block-unless-pred
] unless ; inline recursive
: block-if-empty ( mailbox timeout -- mailbox )
over check-disposed
over mailbox-empty? [
2dup wait-for-mailbox block-if-empty
] [

View File

@ -12,6 +12,7 @@ TUPLE: promise mailbox ;
mailbox>> mailbox-empty? not ;
ERROR: promise-already-fulfilled promise ;
: fulfill ( value promise -- )
dup promise-fulfilled? [
promise-already-fulfilled

View File

@ -0,0 +1 @@
macosx

View File

@ -1,2 +1 @@
unportable
bindings

View File

@ -0,0 +1 @@
macosx

View File

@ -1,2 +1 @@
unportable
bindings

View File

@ -0,0 +1 @@
macosx

View File

@ -1,2 +1 @@
unportable
bindings

View File

@ -0,0 +1 @@
macosx

View File

@ -1,2 +1 @@
unportable
bindings

View File

@ -0,0 +1 @@
macosx

View File

@ -1,2 +1 @@
unportable
bindings

View File

@ -0,0 +1 @@
macosx

View File

@ -1,2 +1 @@
unportable
bindings

View File

@ -0,0 +1 @@
macosx

View File

@ -1 +0,0 @@
unportable

View File

@ -0,0 +1 @@
macosx

View File

@ -1 +0,0 @@
unportable

View File

@ -0,0 +1 @@
macosx

View File

@ -0,0 +1 @@
macosx

View File

@ -1 +0,0 @@
unportable

View File

@ -0,0 +1 @@
macosx

View File

@ -1,2 +1 @@
unportable
bindings

View File

@ -1,2 +1 @@
unportable
bindings

View File

@ -0,0 +1 @@
macosx

View File

@ -1,2 +1 @@
unportable
bindings

View File

@ -0,0 +1 @@
macosx

View File

@ -1,2 +1 @@
unportable
bindings

View File

@ -0,0 +1 @@
macosx

View File

@ -1 +0,0 @@
unportable

View File

@ -0,0 +1 @@
macosx

View File

@ -1,2 +1 @@
unportable
bindings

View File

@ -0,0 +1 @@
macosx

View File

@ -1,2 +1 @@
unportable
bindings

View File

@ -0,0 +1 @@
macosx

View File

@ -1,2 +1 @@
unportable
bindings

View File

@ -1 +0,0 @@
unportable

View File

@ -1 +1 @@
unportable
untested

View File

@ -1 +1 @@
unportable
untested

View File

@ -1,2 +1,2 @@
unportable
compiler
untested

View File

@ -1,2 +1,2 @@
unportable
untested
compiler

View File

@ -1,2 +1,2 @@
unportable
untested
compiler

View File

@ -1 +1 @@
unportable
untested

View File

@ -1 +1 @@
unportable
untested

View File

@ -1 +0,0 @@
unportable

View File

@ -1 +1 @@
unportable
untested

View File

@ -1,2 +1,2 @@
unportable
untested
compiler

View File

@ -51,7 +51,7 @@ HELP: <insert-user-assigned-statement>
HELP: <select-by-slots-statement>
{ $values
{ "tuple" tuple } { "class" class }
{ "tuple" tuple } }
{ "statement" tuple } }
{ $description "A database-specific hook for generating the SQL for a select statement." } ;
HELP: <update-tuple-statement>
@ -267,7 +267,7 @@ T{ book
{ $list
"Make a new tuple to represent your data"
{ "Map the Factor types to the database types with " { $link define-persistent } }
{ "Make a custom database combinator (see" { $link "db-custom-database-combinators" } ") to open your database and run a " { $link quotation } }
{ "Make a custom database combinator (see " { $link "db-custom-database-combinators" } ") to open your database and run a " { $link quotation } }
{ "Create a table with " { $link create-table } ", " { $link ensure-table } ", or " { $link recreate-table } }
{ "Start making and storing objects with " { $link insert-tuple } ", " { $link update-tuple } ", " { $link delete-tuples } ", and " { $link select-tuples } }
} ;

View File

@ -14,7 +14,7 @@ HOOK: <insert-db-assigned-statement> db-connection ( class -- object )
HOOK: <insert-user-assigned-statement> db-connection ( class -- object )
HOOK: <update-tuple-statement> db-connection ( class -- object )
HOOK: <delete-tuples-statement> db-connection ( tuple class -- object )
HOOK: <select-by-slots-statement> db-connection ( tuple class -- tuple )
HOOK: <select-by-slots-statement> db-connection ( tuple class -- statement )
HOOK: <count-statement> db-connection ( query -- statement )
HOOK: query>statement db-connection ( query -- statement )
HOOK: insert-tuple-set-key db-connection ( tuple statement -- )

View File

@ -194,7 +194,7 @@ M: not-a-tuple summary
drop "Not a tuple" ;
M: bad-superclass summary
drop "Tuple classes can only inherit from other tuple classes" ;
drop "Tuple classes can only inherit from non-final tuple classes" ;
M: no-initial-value summary
drop "Initial value must be provided for slots specialized to this class" ;

View File

@ -0,0 +1 @@
windows

View File

@ -1 +0,0 @@
unportable

View File

@ -48,7 +48,7 @@ HELP: dlist-find
} ;
HELP: dlist-filter
{ $values { "dlist" { $link dlist } } { "quot" quotation } { "dlist" { $link dlist } } }
{ $values { "dlist" { $link dlist } } { "quot" quotation } { "dlist'" { $link dlist } } }
{ $description "Applies the quotation to each element of the " { $link dlist } " in turn, removing the corresponding nodes if the quotation returns " { $link f } "." }
{ $side-effects { "dlist" } } ;

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