New slots are now in the core
parent
d517bad9ca
commit
02727576c2
|
@ -1,6 +1,65 @@
|
|||
IN: alien.structs
|
||||
USING: alien.c-types strings help.markup help.syntax
|
||||
alien.syntax sequences io arrays ;
|
||||
alien.syntax sequences io arrays slots.deprecated
|
||||
kernel words slots assocs namespaces ;
|
||||
|
||||
! Deprecated code
|
||||
: ($spec-reader-values) ( slot-spec class -- element )
|
||||
dup ?word-name swap 2array
|
||||
over slot-spec-name
|
||||
rot slot-spec-type 2array 2array
|
||||
[ { $instance } swap add ] assoc-map ;
|
||||
|
||||
: $spec-reader-values ( slot-spec class -- )
|
||||
($spec-reader-values) $values ;
|
||||
|
||||
: $spec-reader-description ( slot-spec class -- )
|
||||
[
|
||||
"Outputs the value stored in the " ,
|
||||
{ $snippet } rot slot-spec-name add ,
|
||||
" slot of " ,
|
||||
{ $instance } swap add ,
|
||||
" instance." ,
|
||||
] { } make $description ;
|
||||
|
||||
: $spec-reader ( reader slot-specs class -- )
|
||||
>r slot-of-reader r>
|
||||
over [
|
||||
2dup $spec-reader-values
|
||||
2dup $spec-reader-description
|
||||
] when 2drop ;
|
||||
|
||||
GENERIC: slot-specs ( help-type -- specs )
|
||||
|
||||
M: word slot-specs "slots" word-prop ;
|
||||
|
||||
: $slot-reader ( reader -- )
|
||||
first dup "reading" word-prop [ slot-specs ] keep
|
||||
$spec-reader ;
|
||||
|
||||
: $spec-writer-values ( slot-spec class -- )
|
||||
($spec-reader-values) reverse $values ;
|
||||
|
||||
: $spec-writer-description ( slot-spec class -- )
|
||||
[
|
||||
"Stores a new value to the " ,
|
||||
{ $snippet } rot slot-spec-name add ,
|
||||
" slot of " ,
|
||||
{ $instance } swap add ,
|
||||
" instance." ,
|
||||
] { } make $description ;
|
||||
|
||||
: $spec-writer ( writer slot-specs class -- )
|
||||
>r slot-of-writer r>
|
||||
over [
|
||||
2dup $spec-writer-values
|
||||
2dup $spec-writer-description
|
||||
dup ?word-name 1array $side-effects
|
||||
] when 2drop ;
|
||||
|
||||
: $slot-writer ( reader -- )
|
||||
first dup "writing" word-prop [ slot-specs ] keep
|
||||
$spec-writer ;
|
||||
|
||||
M: string slot-specs c-type struct-type-fields ;
|
||||
|
||||
|
|
|
@ -2,7 +2,7 @@
|
|||
! See http://factorcode.org/license.txt for BSD license.
|
||||
USING: arrays generic hashtables kernel kernel.private math
|
||||
namespaces parser sequences strings words libc slots
|
||||
alien.c-types cpu.architecture ;
|
||||
slots.deprecated alien.c-types cpu.architecture ;
|
||||
IN: alien.structs
|
||||
|
||||
: align-offset ( offset type -- offset )
|
||||
|
|
|
@ -1,12 +1,12 @@
|
|||
! Copyright (C) 2004, 2008 Slava Pestov.
|
||||
! See http://factorcode.org/license.txt for BSD license.
|
||||
IN: bootstrap.primitives
|
||||
USING: alien arrays byte-arrays generic hashtables
|
||||
hashtables.private io kernel math namespaces parser sequences
|
||||
strings vectors words quotations assocs layouts classes tuples
|
||||
kernel.private vocabs vocabs.loader source-files definitions
|
||||
slots classes.union compiler.units bootstrap.image.private
|
||||
io.files ;
|
||||
slots.deprecated classes.union compiler.units
|
||||
bootstrap.image.private io.files ;
|
||||
IN: bootstrap.primitives
|
||||
|
||||
"Creating primitives and basic runtime structures..." print flush
|
||||
|
||||
|
@ -32,6 +32,9 @@ H{ } clone dictionary set
|
|||
H{ } clone changed-words set
|
||||
H{ } clone root-cache set
|
||||
|
||||
! Vocabulary for slot accessors
|
||||
"accessors" create-vocab drop
|
||||
|
||||
! Trivial recompile hook. We don't want to touch the code heap
|
||||
! during stage1 bootstrap, it would just waste time.
|
||||
[ drop { } ] recompile-hook set
|
||||
|
|
|
@ -0,0 +1,95 @@
|
|||
! Copyright (C) 2005, 2008 Slava Pestov.
|
||||
! See http://factorcode.org/license.txt for BSD license.
|
||||
USING: arrays kernel kernel.private math namespaces
|
||||
sequences strings words effects generic generic.standard
|
||||
classes slots.private combinators slots ;
|
||||
IN: slots.deprecated
|
||||
|
||||
: reader-effect ( class spec -- effect )
|
||||
>r ?word-name 1array r> slot-spec-name 1array <effect> ;
|
||||
|
||||
PREDICATE: word slot-reader "reading" word-prop >boolean ;
|
||||
|
||||
: set-reader-props ( class spec -- )
|
||||
2dup reader-effect
|
||||
over slot-spec-reader
|
||||
swap "declared-effect" set-word-prop
|
||||
slot-spec-reader swap "reading" set-word-prop ;
|
||||
|
||||
: define-reader ( class spec -- )
|
||||
dup slot-spec-reader [
|
||||
[ set-reader-props ] 2keep
|
||||
dup slot-spec-offset
|
||||
over slot-spec-reader
|
||||
rot slot-spec-type reader-quot
|
||||
define-slot-word
|
||||
] [
|
||||
2drop
|
||||
] if ;
|
||||
|
||||
: writer-effect ( class spec -- effect )
|
||||
slot-spec-name swap ?word-name 2array 0 <effect> ;
|
||||
|
||||
PREDICATE: word slot-writer "writing" word-prop >boolean ;
|
||||
|
||||
: set-writer-props ( class spec -- )
|
||||
2dup writer-effect
|
||||
over slot-spec-writer
|
||||
swap "declared-effect" set-word-prop
|
||||
slot-spec-writer swap "writing" set-word-prop ;
|
||||
|
||||
: define-writer ( class spec -- )
|
||||
dup slot-spec-writer [
|
||||
[ set-writer-props ] 2keep
|
||||
dup slot-spec-offset
|
||||
swap slot-spec-writer
|
||||
[ set-slot ]
|
||||
define-slot-word
|
||||
] [
|
||||
2drop
|
||||
] if ;
|
||||
|
||||
: define-slot ( class spec -- )
|
||||
2dup define-reader define-writer ;
|
||||
|
||||
: define-slots ( class specs -- )
|
||||
[ define-slot ] with each ;
|
||||
|
||||
: reader-word ( class name vocab -- word )
|
||||
>r >r "-" r> 3append r> create ;
|
||||
|
||||
: writer-word ( class name vocab -- word )
|
||||
>r [ swap "set-" % % "-" % % ] "" make r> create ;
|
||||
|
||||
: (simple-slot-word) ( class name -- class name vocab )
|
||||
over word-vocabulary >r >r word-name r> r> ;
|
||||
|
||||
: simple-reader-word ( class name -- word )
|
||||
(simple-slot-word) reader-word ;
|
||||
|
||||
: simple-writer-word ( class name -- word )
|
||||
(simple-slot-word) writer-word ;
|
||||
|
||||
: short-slot ( class name # -- spec )
|
||||
>r object bootstrap-word over r> f f <slot-spec>
|
||||
2over simple-reader-word over set-slot-spec-reader
|
||||
-rot simple-writer-word over set-slot-spec-writer ;
|
||||
|
||||
: long-slot ( spec # -- spec )
|
||||
>r [ dup array? [ first2 create ] when ] map first4 r>
|
||||
-rot <slot-spec> ;
|
||||
|
||||
: simple-slots ( class slots base -- specs )
|
||||
over length [ + ] with map [
|
||||
{
|
||||
{ [ over not ] [ 2drop f ] }
|
||||
{ [ over string? ] [ >r dupd r> short-slot ] }
|
||||
{ [ over array? ] [ long-slot ] }
|
||||
} cond
|
||||
] 2map [ ] subset nip ;
|
||||
|
||||
: slot-of-reader ( reader specs -- spec/f )
|
||||
[ slot-spec-reader eq? ] with find nip ;
|
||||
|
||||
: slot-of-writer ( writer specs -- spec/f )
|
||||
[ slot-spec-writer eq? ] with find nip ;
|
|
@ -12,15 +12,11 @@ $nl
|
|||
"The " { $snippet "\"slots\"" } " word property of built-in and tuple classes holds an array of " { $emphasis "slot specifiers" } " describing the slot layout of each instance."
|
||||
{ $subsection slot-spec }
|
||||
"Each slot has a reader word; mutable slots have an optional writer word. All tuple slots are mutable, but some slots on built-in classes are not."
|
||||
{ $subsection slot-spec-reader }
|
||||
{ $subsection slot-spec-writer }
|
||||
"Given a reader or writer word and a class, it is possible to find the slot specifier corresponding to this word:"
|
||||
{ $subsection slot-of-reader }
|
||||
{ $subsection slot-of-writer }
|
||||
"Reader and writer words form classes:"
|
||||
{ $subsection slot-reader }
|
||||
{ $subsection slot-writer }
|
||||
"Slot readers and writers type check, then call unsafe primitives:"
|
||||
{ $subsection reader-word }
|
||||
{ $subsection writer-word }
|
||||
{ $subsection setter-word }
|
||||
{ $subsection changer-word }
|
||||
"Slot methods type check, then call unsafe primitives:"
|
||||
{ $subsection slot }
|
||||
{ $subsection set-slot } ;
|
||||
|
||||
|
@ -59,17 +55,7 @@ $low-level-note ;
|
|||
|
||||
HELP: reader-effect
|
||||
{ $values { "class" class } { "spec" slot-spec } { "effect" "an instance of " { $link effect } } }
|
||||
{ $description "The stack effect of slot reader words is " { $snippet "( obj -- value )" } "." } ;
|
||||
|
||||
HELP: reader-quot
|
||||
{ $values { "decl" class } { "quot" "a quotation with stack effect " { $snippet "( obj n -- value )" } } }
|
||||
{ $description "Outputs a quotation which reads the " { $snippet "n" } "th slot of an object and declares it as an instance of a class." } ;
|
||||
|
||||
HELP: slot-reader
|
||||
{ $class-description "The class of slot reader words." }
|
||||
{ $examples
|
||||
{ $example "USING: classes prettyprint slots ;" "TUPLE: circle center radius ;" "\\ circle-center slot-reader? ." "t" }
|
||||
} ;
|
||||
{ $description "The stack effect of slot reader words is " { $snippet "( object -- value )" } "." } ;
|
||||
|
||||
HELP: define-reader
|
||||
{ $values { "class" class } { "spec" slot-spec } }
|
||||
|
@ -80,32 +66,21 @@ HELP: writer-effect
|
|||
{ $values { "class" class } { "spec" slot-spec } { "effect" "an instance of " { $link effect } } }
|
||||
{ $description "The stack effect of slot writer words is " { $snippet "( value obj -- )" } "." } ;
|
||||
|
||||
HELP: slot-writer
|
||||
{ $class-description "The class of slot writer words." }
|
||||
{ $examples
|
||||
{ $example "USING: classes prettyprint slots ;" "TUPLE: circle center radius ;" "\\ set-circle-center slot-writer? ." "t" }
|
||||
} ;
|
||||
|
||||
HELP: define-writer
|
||||
{ $values { "class" class } { "spec" slot-spec } }
|
||||
{ $description "Defines a generic word " { $snippet "writer" } " to write a new value to a slot in instances of " { $snippet "class" } "." }
|
||||
$low-level-note ;
|
||||
|
||||
HELP: define-slot
|
||||
HELP: define-slot-methods
|
||||
{ $values { "class" class } { "spec" slot-spec } }
|
||||
{ $description "Defines a pair of generic words for reading and writing a slot value in instances of " { $snippet "class" } "." }
|
||||
$low-level-note ;
|
||||
|
||||
HELP: define-slots
|
||||
HELP: define-accessors
|
||||
{ $values { "class" class } { "specs" "a sequence of " { $link slot-spec } " instances" } }
|
||||
{ $description "Defines a set of slot reader/writer words." }
|
||||
{ $description "Defines slot methods." }
|
||||
$low-level-note ;
|
||||
|
||||
HELP: simple-slots
|
||||
{ $values { "class" class } { "slots" "a sequence of strings" } { "base" "a slot number" } { "specs" "a sequence of " { $link slot-spec } " instances" } }
|
||||
{ $description "Constructs a slot specification for " { $link define-slots } " where each slot is named by an element of " { $snippet "slots" } " prefixed by the name of the class. Slots are numbered consecutively starting from " { $snippet "base" } ". Reader and writer words are defined in the current vocabulary, with the reader word having the same name as the slot, and the writer word name prefixed by " { $snippet "\"set-\"" } "." }
|
||||
{ $notes "This word is used by " { $link define-tuple-class } " and " { $link POSTPONE: TUPLE: } "." } ;
|
||||
|
||||
HELP: slot ( obj m -- value )
|
||||
{ $values { "obj" object } { "m" "a non-negative fixnum" } { "value" object } }
|
||||
{ $description "Reads the object stored at the " { $snippet "n" } "th slot of " { $snippet "obj" } "." }
|
||||
|
@ -116,18 +91,6 @@ HELP: set-slot ( value obj n -- )
|
|||
{ $description "Writes " { $snippet "value" } " to the " { $snippet "n" } "th slot of " { $snippet "obj" } "." }
|
||||
{ $warning "This word is in the " { $vocab-link "slots.private" } " vocabulary because it does not perform type or bounds checks, and slot numbers are implementation detail." } ;
|
||||
|
||||
HELP: slot-of-reader
|
||||
{ $values { "reader" slot-reader } { "specs" "a sequence of " { $link slot-spec } " instances" } { "spec/f" "a " { $link slot-spec } " or " { $link f } } }
|
||||
{ $description "Outputs the " { $link slot-spec } " whose " { $link slot-spec-reader } " is equal to " { $snippet "reader" } "." } ;
|
||||
|
||||
HELP: slot-of-writer
|
||||
{ $values { "writer" slot-writer } { "specs" "a sequence of " { $link slot-spec } " instances" } { "spec/f" "a " { $link slot-spec } " or " { $link f } } }
|
||||
{ $description "Outputs the " { $link slot-spec } " whose " { $link slot-spec-writer } " is equal to " { $snippet "writer" } "." } ;
|
||||
|
||||
HELP: reader-word
|
||||
{ $values { "class" string } { "name" string } { "vocab" string } { "word" word } }
|
||||
{ $description "Creates a word named " { $snippet { $emphasis "class" } "-" { $emphasis "name" } } " in the " { $snippet "vocab" } " vocabulary." } ;
|
||||
|
||||
HELP: writer-word
|
||||
{ $values { "class" string } { "name" string } { "vocab" string } { "word" word } }
|
||||
{ $description "Creates a word named " { $snippet "set-" { $emphasis "class" } "-" { $emphasis "name" } } " in the " { $snippet "vocab" } " vocabulary." } ;
|
||||
HELP: slot-named
|
||||
{ $values { "name" string } { "specs" "a sequence of " { $link slot-spec } " instances" } { "spec/f" "a " { $link slot-spec } " or " { $link f } } }
|
||||
{ $description "Outputs the " { $link slot-spec } " with the given name." } ;
|
||||
|
|
|
@ -16,9 +16,6 @@ C: <slot-spec> slot-spec
|
|||
: define-slot-word ( class slot word quot -- )
|
||||
rot >fixnum add* define-typecheck ;
|
||||
|
||||
: reader-effect ( class spec -- effect )
|
||||
>r ?word-name 1array r> slot-spec-name 1array <effect> ;
|
||||
|
||||
: reader-quot ( decl -- quot )
|
||||
[
|
||||
\ slot ,
|
||||
|
@ -26,91 +23,62 @@ C: <slot-spec> slot-spec
|
|||
[ drop ] [ 1array , \ declare , ] if
|
||||
] [ ] make ;
|
||||
|
||||
PREDICATE: word slot-reader "reading" word-prop >boolean ;
|
||||
|
||||
: set-reader-props ( class spec -- )
|
||||
2dup reader-effect
|
||||
over slot-spec-reader
|
||||
swap "declared-effect" set-word-prop
|
||||
slot-spec-reader swap "reading" set-word-prop ;
|
||||
|
||||
: define-reader ( class spec -- )
|
||||
dup slot-spec-reader [
|
||||
[ set-reader-props ] 2keep
|
||||
dup slot-spec-offset
|
||||
over slot-spec-reader
|
||||
rot slot-spec-type reader-quot
|
||||
define-slot-word
|
||||
] [
|
||||
2drop
|
||||
] if ;
|
||||
|
||||
: writer-effect ( class spec -- effect )
|
||||
slot-spec-name swap ?word-name 2array 0 <effect> ;
|
||||
|
||||
PREDICATE: word slot-writer "writing" word-prop >boolean ;
|
||||
|
||||
: set-writer-props ( class spec -- )
|
||||
2dup writer-effect
|
||||
over slot-spec-writer
|
||||
swap "declared-effect" set-word-prop
|
||||
slot-spec-writer swap "writing" set-word-prop ;
|
||||
|
||||
: define-writer ( class spec -- )
|
||||
dup slot-spec-writer [
|
||||
[ set-writer-props ] 2keep
|
||||
dup slot-spec-offset
|
||||
swap slot-spec-writer
|
||||
[ set-slot ]
|
||||
define-slot-word
|
||||
] [
|
||||
2drop
|
||||
] if ;
|
||||
|
||||
: define-slot ( class spec -- )
|
||||
2dup define-reader define-writer ;
|
||||
|
||||
: define-slots ( class specs -- )
|
||||
[ define-slot ] with each ;
|
||||
|
||||
: reader-word ( class name vocab -- word )
|
||||
>r >r "-" r> 3append r> create ;
|
||||
|
||||
: writer-word ( class name vocab -- word )
|
||||
>r [ swap "set-" % % "-" % % ] "" make r> create ;
|
||||
|
||||
: (simple-slot-word) ( class name -- class name vocab )
|
||||
over word-vocabulary >r >r word-name r> r> ;
|
||||
|
||||
: simple-reader-word ( class name -- word )
|
||||
(simple-slot-word) reader-word ;
|
||||
|
||||
: simple-writer-word ( class name -- word )
|
||||
(simple-slot-word) writer-word ;
|
||||
|
||||
: short-slot ( class name # -- spec )
|
||||
>r object bootstrap-word over r> f f <slot-spec>
|
||||
2over simple-reader-word over set-slot-spec-reader
|
||||
-rot simple-writer-word over set-slot-spec-writer ;
|
||||
|
||||
: long-slot ( spec # -- spec )
|
||||
>r [ dup array? [ first2 create ] when ] map first4 r>
|
||||
-rot <slot-spec> ;
|
||||
|
||||
: simple-slots ( class slots base -- specs )
|
||||
over length [ + ] with map [
|
||||
{
|
||||
{ [ over not ] [ 2drop f ] }
|
||||
{ [ over string? ] [ >r dupd r> short-slot ] }
|
||||
{ [ over array? ] [ long-slot ] }
|
||||
} cond
|
||||
] 2map [ ] subset nip ;
|
||||
|
||||
: slot-of-reader ( reader specs -- spec/f )
|
||||
[ slot-spec-reader eq? ] with find nip ;
|
||||
|
||||
: slot-of-writer ( writer specs -- spec/f )
|
||||
[ slot-spec-writer eq? ] with find nip ;
|
||||
|
||||
: slot-named ( string specs -- spec/f )
|
||||
[ slot-spec-name = ] with find nip ;
|
||||
|
||||
: create-accessor ( name effect -- word )
|
||||
>r "accessors" create dup r>
|
||||
"declared-effect" set-word-prop ;
|
||||
|
||||
: reader-effect T{ effect f { "object" } { "value" } } ; inline
|
||||
|
||||
: reader-word ( name -- word )
|
||||
">>" append reader-effect create-accessor ;
|
||||
|
||||
: define-reader ( class slot name -- )
|
||||
reader-word object reader-quot define-slot-word ;
|
||||
|
||||
: writer-effect T{ effect f { "value" "object" } { } } ; inline
|
||||
|
||||
: writer-word ( name -- word )
|
||||
"(>>" swap ")" 3append writer-effect create-accessor ;
|
||||
|
||||
: define-writer ( class slot name -- )
|
||||
writer-word [ set-slot ] define-slot-word ;
|
||||
|
||||
: setter-effect T{ effect f { "object" "value" } { "value" } } ; inline
|
||||
|
||||
: setter-word ( name -- word )
|
||||
">>" prepend setter-effect create-accessor ;
|
||||
|
||||
: define-setter ( name -- )
|
||||
dup setter-word dup deferred? [
|
||||
[ \ over , swap writer-word , ] [ ] make define-inline
|
||||
] [ 2drop ] if ;
|
||||
|
||||
: changer-effect T{ effect f { "object" "quot" } { "object" } } ; inline
|
||||
|
||||
: changer-word ( name -- word )
|
||||
"change-" prepend changer-effect create-accessor ;
|
||||
|
||||
: define-changer ( name -- )
|
||||
dup changer-word dup deferred? [
|
||||
[
|
||||
[ over >r >r ] %
|
||||
over reader-word ,
|
||||
[ r> call r> swap ] %
|
||||
swap setter-word ,
|
||||
] [ ] make define-inline
|
||||
] [ 2drop ] if ;
|
||||
|
||||
: define-slot-methods ( class slot name -- )
|
||||
dup define-changer
|
||||
dup define-setter
|
||||
3dup define-reader
|
||||
define-writer ;
|
||||
|
||||
: define-accessors ( class specs -- )
|
||||
[
|
||||
dup slot-spec-offset swap slot-spec-name
|
||||
define-slot-methods
|
||||
] with each ;
|
||||
|
|
|
@ -3,7 +3,8 @@
|
|||
USING: arrays definitions hashtables kernel
|
||||
kernel.private math namespaces sequences sequences.private
|
||||
strings vectors words quotations memory combinators generic
|
||||
classes classes.private slots slots.private compiler.units ;
|
||||
classes classes.private slots slots.deprecated slots.private
|
||||
compiler.units ;
|
||||
IN: tuples
|
||||
|
||||
M: tuple delegate 3 slot ;
|
||||
|
@ -85,7 +86,8 @@ PRIVATE>
|
|||
dupd 4 simple-slots
|
||||
2dup [ slot-spec-name ] map "slot-names" set-word-prop
|
||||
2dup delegate-slot-spec add* "slots" set-word-prop
|
||||
define-slots ;
|
||||
2dup define-slots
|
||||
define-accessors ;
|
||||
|
||||
TUPLE: check-tuple class ;
|
||||
|
||||
|
|
|
@ -7,8 +7,7 @@ IN: vocabs
|
|||
SYMBOL: dictionary
|
||||
|
||||
TUPLE: vocab
|
||||
name root
|
||||
words
|
||||
name words
|
||||
main help
|
||||
source-loaded? docs-loaded? ;
|
||||
|
||||
|
|
|
@ -1,7 +1,7 @@
|
|||
! Copyright (C) 2008 Doug Coleman.
|
||||
! See http://factorcode.org/license.txt for BSD license.
|
||||
USING: alien.c-types cairo.ffi continuations destructors
|
||||
kernel libc locals math combinators.cleave shuffle new-slots
|
||||
kernel libc locals math combinators.cleave shuffle
|
||||
accessors ;
|
||||
IN: cairo.lib
|
||||
|
||||
|
|
|
@ -1,6 +1,6 @@
|
|||
! Copyright (C) 2008 Doug Coleman.
|
||||
! See http://factorcode.org/license.txt for BSD license.
|
||||
USING: arrays combinators.cleave kernel new-slots
|
||||
USING: arrays combinators.cleave kernel
|
||||
accessors math ui.gadgets ui.render opengl.gl byte-arrays
|
||||
namespaces opengl cairo.ffi cairo.lib ;
|
||||
IN: cairo.png
|
||||
|
|
|
@ -3,7 +3,7 @@
|
|||
|
||||
USING: arrays kernel math math.functions namespaces sequences
|
||||
strings tuples system vocabs.loader calendar.backend threads
|
||||
new-slots accessors combinators locals ;
|
||||
accessors combinators locals ;
|
||||
IN: calendar
|
||||
|
||||
TUPLE: timestamp year month day hour minute second gmt-offset ;
|
||||
|
|
|
@ -3,7 +3,7 @@
|
|||
USING: serialize sequences concurrency.messaging
|
||||
threads io io.server qualified arrays
|
||||
namespaces kernel io.encodings.binary combinators.cleave
|
||||
new-slots accessors ;
|
||||
accessors ;
|
||||
QUALIFIED: io.sockets
|
||||
IN: concurrency.distributed
|
||||
|
||||
|
|
|
@ -2,7 +2,7 @@
|
|||
! See http://factorcode.org/license.txt for BSD license.
|
||||
USING: arrays assocs classes continuations kernel math
|
||||
namespaces sequences sequences.lib tuples words strings
|
||||
tools.walker new-slots accessors ;
|
||||
tools.walker accessors ;
|
||||
IN: db
|
||||
|
||||
TUPLE: db
|
||||
|
|
|
@ -4,7 +4,7 @@ USING: arrays continuations db io kernel math namespaces
|
|||
quotations sequences db.postgresql.ffi alien alien.c-types
|
||||
db.types tools.walker ascii splitting math.parser
|
||||
combinators combinators.cleave libc shuffle calendar.format
|
||||
byte-arrays destructors prettyprint new-slots accessors
|
||||
byte-arrays destructors prettyprint accessors
|
||||
strings serialize io.encodings.binary io.streams.byte-array ;
|
||||
IN: db.postgresql.lib
|
||||
|
||||
|
|
|
@ -1,6 +1,6 @@
|
|||
! Copyright (C) 2008 Alex Chapman
|
||||
! See http://factorcode.org/license.txt for BSD license.
|
||||
USING: accessors assocs kernel new-slots sequences vectors ;
|
||||
USING: accessors assocs kernel sequences vectors ;
|
||||
IN: digraphs
|
||||
|
||||
TUPLE: digraph ;
|
||||
|
|
|
@ -25,10 +25,6 @@ GENERIC: word-help* ( word -- content )
|
|||
|
||||
M: word word-help* drop f ;
|
||||
|
||||
M: slot-reader word-help* drop \ $slot-reader ;
|
||||
|
||||
M: slot-writer word-help* drop \ $slot-writer ;
|
||||
|
||||
M: predicate word-help* drop \ $predicate ;
|
||||
|
||||
: all-articles ( -- seq )
|
||||
|
|
|
@ -296,63 +296,6 @@ M: string ($instance)
|
|||
{ $link with-pprint } " combinator."
|
||||
} $notes ;
|
||||
|
||||
: ($spec-reader-values) ( slot-spec class -- element )
|
||||
dup ?word-name swap 2array
|
||||
over slot-spec-name
|
||||
rot slot-spec-type 2array 2array
|
||||
[ { $instance } swap add ] assoc-map ;
|
||||
|
||||
: $spec-reader-values ( slot-spec class -- )
|
||||
($spec-reader-values) $values ;
|
||||
|
||||
: $spec-reader-description ( slot-spec class -- )
|
||||
[
|
||||
"Outputs the value stored in the " ,
|
||||
{ $snippet } rot slot-spec-name add ,
|
||||
" slot of " ,
|
||||
{ $instance } swap add ,
|
||||
" instance." ,
|
||||
] { } make $description ;
|
||||
|
||||
: $spec-reader ( reader slot-specs class -- )
|
||||
>r slot-of-reader r>
|
||||
over [
|
||||
2dup $spec-reader-values
|
||||
2dup $spec-reader-description
|
||||
] when 2drop ;
|
||||
|
||||
GENERIC: slot-specs ( help-type -- specs )
|
||||
|
||||
M: word slot-specs "slots" word-prop ;
|
||||
|
||||
: $slot-reader ( reader -- )
|
||||
first dup "reading" word-prop [ slot-specs ] keep
|
||||
$spec-reader ;
|
||||
|
||||
: $spec-writer-values ( slot-spec class -- )
|
||||
($spec-reader-values) reverse $values ;
|
||||
|
||||
: $spec-writer-description ( slot-spec class -- )
|
||||
[
|
||||
"Stores a new value to the " ,
|
||||
{ $snippet } rot slot-spec-name add ,
|
||||
" slot of " ,
|
||||
{ $instance } swap add ,
|
||||
" instance." ,
|
||||
] { } make $description ;
|
||||
|
||||
: $spec-writer ( writer slot-specs class -- )
|
||||
>r slot-of-writer r>
|
||||
over [
|
||||
2dup $spec-writer-values
|
||||
2dup $spec-writer-description
|
||||
dup ?word-name 1array $side-effects
|
||||
] when 2drop ;
|
||||
|
||||
: $slot-writer ( reader -- )
|
||||
first dup "writing" word-prop [ slot-specs ] keep
|
||||
$spec-writer ;
|
||||
|
||||
GENERIC: elements* ( elt-type element -- )
|
||||
|
||||
M: simple-element elements* [ elements* ] with each ;
|
||||
|
|
|
@ -3,7 +3,7 @@
|
|||
USING: fry hashtables io io.streams.string kernel math
|
||||
namespaces math.parser assocs sequences strings splitting ascii
|
||||
io.encodings.utf8 io.encodings.string namespaces unicode.case
|
||||
combinators vectors sorting new-slots accessors calendar
|
||||
combinators vectors sorting accessors calendar
|
||||
calendar.format quotations arrays combinators.cleave
|
||||
combinators.lib byte-arrays ;
|
||||
IN: http
|
||||
|
|
|
@ -1,6 +1,6 @@
|
|||
! Copyright (C) 2008 Slava Pestov.
|
||||
! See http://factorcode.org/license.txt for BSD license.
|
||||
USING: accessors new-slots sequences kernel assocs combinators
|
||||
USING: accessors sequences kernel assocs combinators
|
||||
http.server http.server.validators http hashtables namespaces
|
||||
combinators.cleave fry continuations locals ;
|
||||
IN: http.server.actions
|
||||
|
|
|
@ -1,6 +1,6 @@
|
|||
! Copyright (c) 2007 Chris Double.
|
||||
! See http://factorcode.org/license.txt for BSD license.
|
||||
USING: accessors new-slots quotations assocs kernel splitting
|
||||
USING: accessors quotations assocs kernel splitting
|
||||
base64 html.elements io combinators http.server
|
||||
http.server.auth.providers http.server.auth.providers.null
|
||||
http sequences ;
|
||||
|
|
|
@ -1,6 +1,6 @@
|
|||
! Copyright (c) 2008 Slava Pestov
|
||||
! See http://factorcode.org/license.txt for BSD license.
|
||||
USING: accessors new-slots quotations assocs kernel splitting
|
||||
USING: accessors quotations assocs kernel splitting
|
||||
base64 html.elements io combinators http.server
|
||||
http.server.auth.providers http.server.auth.providers.null
|
||||
http.server.actions http.server.components http.server.sessions
|
||||
|
|
|
@ -1,7 +1,7 @@
|
|||
! Copyright (C) 2008 Slava Pestov.
|
||||
! See http://factorcode.org/license.txt for BSD license.
|
||||
IN: http.server.auth.providers.assoc
|
||||
USING: new-slots accessors assocs kernel
|
||||
USING: accessors assocs kernel
|
||||
http.server.auth.providers ;
|
||||
|
||||
TUPLE: users-in-memory assoc ;
|
||||
|
|
|
@ -1,6 +1,6 @@
|
|||
! Copyright (C) 2008 Slava Pestov.
|
||||
! See http://factorcode.org/license.txt for BSD license.
|
||||
USING: db db.tuples db.types new-slots accessors
|
||||
USING: db db.tuples db.types accessors
|
||||
http.server.auth.providers kernel continuations
|
||||
singleton ;
|
||||
IN: http.server.auth.providers.db
|
||||
|
|
|
@ -1,6 +1,6 @@
|
|||
! Copyright (C) 2008 Slava Pestov.
|
||||
! See http://factorcode.org/license.txt for BSD license.
|
||||
USING: kernel new-slots accessors random math.parser locals
|
||||
USING: kernel accessors random math.parser locals
|
||||
sequences math crypto.sha2 ;
|
||||
IN: http.server.auth.providers
|
||||
|
||||
|
|
|
@ -2,7 +2,7 @@
|
|||
! Copyright (C) 2006, 2008 Slava Pestov.
|
||||
! See http://factorcode.org/license.txt for BSD license.
|
||||
USING: html http http.server io kernel math namespaces
|
||||
continuations calendar sequences assocs new-slots hashtables
|
||||
continuations calendar sequences assocs hashtables
|
||||
accessors arrays alarms quotations combinators
|
||||
combinators.cleave fry assocs.lib ;
|
||||
IN: http.server.callbacks
|
||||
|
|
|
@ -1,6 +1,6 @@
|
|||
IN: http.server.components.tests
|
||||
USING: http.server.components http.server.validators
|
||||
namespaces tools.test kernel accessors new-slots
|
||||
namespaces tools.test kernel accessors
|
||||
tuple-syntax mirrors http.server.actions ;
|
||||
|
||||
validation-failed? off
|
||||
|
|
|
@ -1,6 +1,6 @@
|
|||
! Copyright (C) 2008 Slava Pestov
|
||||
! See http://factorcode.org/license.txt for BSD license.
|
||||
USING: new-slots html.elements http.server.validators accessors
|
||||
USING: html.elements http.server.validators accessors
|
||||
namespaces kernel io math.parser assocs classes words tuples
|
||||
arrays sequences io.files http.server.templating.fhtml
|
||||
http.server.actions splitting mirrors hashtables
|
||||
|
|
|
@ -1,6 +1,6 @@
|
|||
! Copyright (C) 2008 Slava Pestov.
|
||||
! See http://factorcode.org/license.txt for BSD license.
|
||||
USING: db http.server kernel new-slots accessors
|
||||
USING: db http.server kernel accessors
|
||||
continuations namespaces destructors combinators.cleave ;
|
||||
IN: http.server.db
|
||||
|
||||
|
|
|
@ -1,5 +1,5 @@
|
|||
USING: http.server tools.test kernel namespaces accessors
|
||||
new-slots io http math sequences assocs ;
|
||||
io http math sequences assocs ;
|
||||
IN: http.server.tests
|
||||
|
||||
[
|
||||
|
|
|
@ -2,7 +2,7 @@
|
|||
! See http://factorcode.org/license.txt for BSD license.
|
||||
USING: assocs kernel namespaces io io.timeouts strings splitting
|
||||
threads http sequences prettyprint io.server logging calendar
|
||||
new-slots html.elements accessors math.parser combinators.lib
|
||||
html.elements accessors math.parser combinators.lib
|
||||
tools.vocabs debugger html continuations random combinators
|
||||
destructors io.encodings.latin1 fry combinators.cleave ;
|
||||
IN: http.server
|
||||
|
|
|
@ -1,7 +1,7 @@
|
|||
! Copyright (C) 2008 Doug Coleman, Slava Pestov.
|
||||
! See http://factorcode.org/license.txt for BSD license.
|
||||
USING: assocs calendar kernel math.parser namespaces random
|
||||
new-slots accessors http http.server
|
||||
accessors http http.server
|
||||
http.server.sessions.storage http.server.sessions.storage.assoc
|
||||
quotations hashtables sequences fry combinators.cleave
|
||||
html.elements symbols continuations destructors ;
|
||||
|
|
|
@ -1,6 +1,6 @@
|
|||
! Copyright (C) 2008 Slava Pestov.
|
||||
! See http://factorcode.org/license.txt for BSD license.
|
||||
USING: assocs assocs.lib new-slots accessors
|
||||
USING: assocs assocs.lib accessors
|
||||
http.server.sessions.storage combinators.cleave alarms kernel
|
||||
fry http.server ;
|
||||
IN: http.server.sessions.storage.assoc
|
||||
|
|
|
@ -1,6 +1,6 @@
|
|||
! Copyright (C) 2008 Slava Pestov.
|
||||
! See http://factorcode.org/license.txt for BSD license.
|
||||
USING: assocs new-slots accessors http.server.sessions.storage
|
||||
USING: assocs accessors http.server.sessions.storage
|
||||
alarms kernel http.server db.tuples db.types singleton
|
||||
combinators.cleave math.parser ;
|
||||
IN: http.server.sessions.storage.db
|
||||
|
|
|
@ -3,7 +3,7 @@
|
|||
USING: calendar html io io.files kernel math math.parser http
|
||||
http.server namespaces parser sequences strings assocs
|
||||
hashtables debugger http.mime sorting html.elements logging
|
||||
calendar.format new-slots accessors io.encodings.binary
|
||||
calendar.format accessors io.encodings.binary
|
||||
combinators.cleave fry ;
|
||||
IN: http.server.static
|
||||
|
||||
|
|
|
@ -1,7 +1,7 @@
|
|||
! Copyright (C) 2006, 2008 Slava Pestov
|
||||
! See http://factorcode.org/license.txt for BSD license.
|
||||
USING: kernel continuations sequences math namespaces
|
||||
math.parser assocs new-slots regexp fry unicode.categories
|
||||
math.parser assocs regexp fry unicode.categories
|
||||
combinators.cleave sequences ;
|
||||
IN: http.server.validators
|
||||
|
||||
|
|
|
@ -3,7 +3,7 @@
|
|||
USING: io io.backend io.timeouts system kernel namespaces
|
||||
strings hashtables sequences assocs combinators vocabs.loader
|
||||
init threads continuations math io.encodings io.streams.duplex
|
||||
io.nonblocking new-slots accessors ;
|
||||
io.nonblocking accessors ;
|
||||
IN: io.launcher
|
||||
|
||||
|
||||
|
|
|
@ -1,4 +1,4 @@
|
|||
USING: io.files kernel sequences new-slots accessors
|
||||
USING: io.files kernel sequences accessors
|
||||
dlists arrays sequences.lib ;
|
||||
IN: io.paths
|
||||
|
||||
|
|
|
@ -4,7 +4,7 @@ USING: io io.backend io.launcher io.nonblocking io.unix.backend
|
|||
io.unix.files io.nonblocking sequences kernel namespaces math
|
||||
system alien.c-types debugger continuations arrays assocs
|
||||
combinators unix.process strings threads unix
|
||||
io.unix.launcher.parser io.encodings.latin1 accessors new-slots ;
|
||||
io.unix.launcher.parser io.encodings.latin1 accessors ;
|
||||
IN: io.unix.launcher
|
||||
|
||||
! Search unix first
|
||||
|
|
|
@ -5,7 +5,7 @@ io.windows io.windows.nt.pipes libc io.nonblocking
|
|||
io.streams.duplex windows.types math windows.kernel32 windows
|
||||
namespaces io.launcher kernel sequences windows.errors assocs
|
||||
splitting system threads init strings combinators
|
||||
io.backend new-slots accessors concurrency.flags ;
|
||||
io.backend accessors concurrency.flags ;
|
||||
IN: io.windows.launcher
|
||||
|
||||
TUPLE: CreateProcess-args
|
||||
|
|
|
@ -3,7 +3,7 @@
|
|||
USING: alien alien.c-types arrays destructors io io.windows libc
|
||||
windows.types math windows.kernel32 windows namespaces kernel
|
||||
sequences windows.errors assocs math.parser system random
|
||||
combinators new-slots accessors ;
|
||||
combinators accessors ;
|
||||
IN: io.windows.nt.pipes
|
||||
|
||||
! This code is based on
|
||||
|
|
|
@ -5,7 +5,7 @@ inference.transforms parser words quotations debugger macros
|
|||
arrays macros splitting combinators prettyprint.backend
|
||||
definitions prettyprint hashtables combinators.lib
|
||||
prettyprint.sections sequences.private effects generic
|
||||
compiler.units combinators.cleave new-slots accessors ;
|
||||
compiler.units combinators.cleave accessors ;
|
||||
IN: locals
|
||||
|
||||
! Inspired by
|
||||
|
|
|
@ -1,6 +1,6 @@
|
|||
USING: kernel math sequences namespaces
|
||||
math.miller-rabin combinators.cleave combinators.lib
|
||||
math.functions new-slots accessors random ;
|
||||
math.functions accessors random ;
|
||||
IN: random.blum-blum-shub
|
||||
|
||||
! TODO: take (log log M) bits instead of 1 bit
|
||||
|
|
|
@ -1,4 +1,4 @@
|
|||
USING: kernel random math new-slots accessors ;
|
||||
USING: kernel random math accessors ;
|
||||
IN: random.dummy
|
||||
|
||||
TUPLE: random-dummy i ;
|
||||
|
|
|
@ -4,7 +4,7 @@
|
|||
! http://www.math.sci.hiroshima-u.ac.jp/~m-mat/MT/MT2002/CODES/mt19937ar.c
|
||||
|
||||
USING: arrays kernel math namespaces sequences system init
|
||||
new-slots accessors math.ranges combinators.cleave random ;
|
||||
accessors math.ranges combinators.cleave random ;
|
||||
IN: random.mersenne-twister
|
||||
|
||||
<PRIVATE
|
||||
|
|
|
@ -1,6 +1,6 @@
|
|||
! Copyright (C) 2008 Alex Chapman
|
||||
! See http://factorcode.org/license.txt for BSD license.
|
||||
USING: accessors db.tuples hashtables kernel new-slots
|
||||
USING: accessors db.tuples hashtables kernel
|
||||
semantic-db semantic-db.relations sequences sequences.deep ;
|
||||
IN: semantic-db.hierarchy
|
||||
|
||||
|
|
|
@ -1,6 +1,6 @@
|
|||
! Copyright (C) 2008 Alex Chapman
|
||||
! See http://factorcode.org/license.txt for BSD license.
|
||||
USING: accessors arrays continuations db db.tuples db.types db.sqlite kernel math math.parser new-slots sequences ;
|
||||
USING: accessors arrays continuations db db.tuples db.types db.sqlite kernel math math.parser sequences ;
|
||||
IN: semantic-db
|
||||
|
||||
TUPLE: node id content ;
|
||||
|
|
|
@ -11,7 +11,7 @@ io.binary strings classes words sbufs tuples arrays vectors
|
|||
byte-arrays bit-arrays quotations hashtables assocs help.syntax
|
||||
help.markup float-arrays splitting io.streams.byte-array
|
||||
io.encodings.string io.encodings.utf8 io.encodings.binary
|
||||
combinators combinators.cleave new-slots accessors locals
|
||||
combinators combinators.cleave accessors locals
|
||||
prettyprint compiler.units sequences.private tuples.private ;
|
||||
IN: serialize
|
||||
|
||||
|
|
|
@ -4,7 +4,7 @@
|
|||
USING: namespaces io io.timeouts kernel logging io.sockets
|
||||
sequences combinators sequences.lib splitting assocs strings
|
||||
math.parser random system calendar io.encodings.ascii
|
||||
calendar.format new-slots accessors ;
|
||||
calendar.format accessors ;
|
||||
IN: smtp
|
||||
|
||||
SYMBOL: smtp-domain
|
||||
|
|
|
@ -1,6 +1,6 @@
|
|||
USING: alien alien.c-types kernel windows.ole32
|
||||
combinators.lib parser splitting sequences.lib
|
||||
sequences namespaces new-slots combinators.cleave
|
||||
sequences namespaces combinators.cleave
|
||||
assocs quotations shuffle accessors words macros
|
||||
alien.syntax fry ;
|
||||
IN: windows.com.syntax
|
||||
|
|
Loading…
Reference in New Issue