core: using lowercase colon words.
parent
72f88bb950
commit
99ed27a833
|
@ -1,6 +1,6 @@
|
||||||
! Copyright (C) 2015 Doug Coleman.
|
! Copyright (C) 2015 Doug Coleman.
|
||||||
! See http://factorcode.org/license.txt for BSD license.
|
! See http://factorcode.org/license.txt for BSD license.
|
||||||
IN: alien.accessors
|
in: alien.accessors
|
||||||
|
|
||||||
PRIMITIVE: alien-cell ( c-ptr n -- value )
|
PRIMITIVE: alien-cell ( c-ptr n -- value )
|
||||||
PRIMITIVE: alien-double ( c-ptr n -- value )
|
PRIMITIVE: alien-double ( c-ptr n -- value )
|
||||||
|
|
|
@ -2,7 +2,7 @@ USING: alien.accessors alien.c-types alien.libraries alien.strings
|
||||||
alien.syntax byte-arrays cpu.x86 eval help.markup help.syntax io
|
alien.syntax byte-arrays cpu.x86 eval help.markup help.syntax io
|
||||||
io.backend io.encodings.utf16n io.encodings.utf8 kernel math
|
io.backend io.encodings.utf16n io.encodings.utf8 kernel math
|
||||||
quotations sequences system ;
|
quotations sequences system ;
|
||||||
IN: alien
|
in: alien
|
||||||
|
|
||||||
HELP: callee-cleanup?
|
HELP: callee-cleanup?
|
||||||
{ $values { "abi" abi } { "?" boolean } }
|
{ $values { "abi" abi } { "?" boolean } }
|
||||||
|
|
|
@ -2,7 +2,7 @@ USING: accessors alien alien.accessors alien.c-types
|
||||||
alien.syntax byte-arrays continuations fry kernel layouts math
|
alien.syntax byte-arrays continuations fry kernel layouts math
|
||||||
namespaces prettyprint sequences tools.memory tools.test ;
|
namespaces prettyprint sequences tools.memory tools.test ;
|
||||||
QUALIFIED: sets
|
QUALIFIED: sets
|
||||||
IN: alien.tests
|
in: alien.tests
|
||||||
|
|
||||||
{ t } [ -1 <alien> alien-address 0 > ] unit-test
|
{ t } [ -1 <alien> alien-address 0 > ] unit-test
|
||||||
|
|
||||||
|
@ -72,7 +72,7 @@ cell 8 = [
|
||||||
|
|
||||||
{ "( displaced alien )" } [ 1 B{ 1 2 3 } <displaced-alien> unparse ] unit-test
|
{ "( displaced alien )" } [ 1 B{ 1 2 3 } <displaced-alien> unparse ] unit-test
|
||||||
|
|
||||||
SYMBOL: initialize-test
|
symbol: initialize-test
|
||||||
|
|
||||||
f initialize-test set-global
|
f initialize-test set-global
|
||||||
|
|
||||||
|
@ -91,7 +91,7 @@ f initialize-test set-global
|
||||||
: produce-until-error ( quot -- error seq )
|
: produce-until-error ( quot -- error seq )
|
||||||
'[ [ @ t ] [ f ] recover ] [ ] produce ; inline
|
'[ [ @ t ] [ f ] recover ] [ ] produce ; inline
|
||||||
|
|
||||||
SYMBOL: foo
|
symbol: foo
|
||||||
|
|
||||||
: fill-and-free-callback-heap ( -- )
|
: fill-and-free-callback-heap ( -- )
|
||||||
[ \ foo 33 <callback> ] produce-until-error nip [ free-callback ] each ;
|
[ \ foo 33 <callback> ] produce-until-error nip [ free-callback ] each ;
|
||||||
|
|
|
@ -3,7 +3,7 @@
|
||||||
USING: accessors assocs byte-arrays byte-vectors continuations
|
USING: accessors assocs byte-arrays byte-vectors continuations
|
||||||
continuations.private init kernel kernel.private math namespaces
|
continuations.private init kernel kernel.private math namespaces
|
||||||
sequences ;
|
sequences ;
|
||||||
IN: alien
|
in: alien
|
||||||
|
|
||||||
BUILTIN: alien { underlying c-ptr read-only initial: f } expired ;
|
BUILTIN: alien { underlying c-ptr read-only initial: f } expired ;
|
||||||
BUILTIN: dll { path byte-array read-only initial: B{ } } ;
|
BUILTIN: dll { path byte-array read-only initial: B{ } } ;
|
||||||
|
@ -109,7 +109,7 @@ ERROR: alien-assembly-error code ;
|
||||||
! are also pinned in a special callback area, so clearing this
|
! are also pinned in a special callback area, so clearing this
|
||||||
! hashtable will not reclaim callbacks. It should only be
|
! hashtable will not reclaim callbacks. It should only be
|
||||||
! cleared on startup.
|
! cleared on startup.
|
||||||
SYMBOL: callbacks
|
symbol: callbacks
|
||||||
|
|
||||||
[ H{ } clone callbacks set-global ] "alien" add-startup-hook
|
[ H{ } clone callbacks set-global ] "alien" add-startup-hook
|
||||||
|
|
||||||
|
|
|
@ -2,7 +2,7 @@ USING: alien help.syntax help.markup libc kernel.private
|
||||||
byte-arrays strings hashtables alien.syntax alien.strings
|
byte-arrays strings hashtables alien.syntax alien.strings
|
||||||
sequences io.encodings.string debugger destructors vocabs.loader
|
sequences io.encodings.string debugger destructors vocabs.loader
|
||||||
classes.struct math kernel ;
|
classes.struct math kernel ;
|
||||||
IN: alien.c-types
|
in: alien.c-types
|
||||||
|
|
||||||
HELP: heap-size
|
HELP: heap-size
|
||||||
{ $values { "name" c-type-name } { "size" math:integer } }
|
{ $values { "name" c-type-name } { "size" math:integer } }
|
||||||
|
|
|
@ -2,7 +2,7 @@ USING: accessors alien.c-types alien.syntax classes
|
||||||
classes.struct compiler.units eval io.encodings.ascii kernel
|
classes.struct compiler.units eval io.encodings.ascii kernel
|
||||||
math.constants tools.test ;
|
math.constants tools.test ;
|
||||||
FROM: alien.c-types => short ;
|
FROM: alien.c-types => short ;
|
||||||
IN: alien.c-types.tests
|
in: alien.c-types.tests
|
||||||
|
|
||||||
CONSTANT: xyz 123
|
CONSTANT: xyz 123
|
||||||
|
|
||||||
|
@ -126,26 +126,26 @@ must-fail-with
|
||||||
|
|
||||||
! generic -> callback
|
! generic -> callback
|
||||||
"IN: alien.c-types.tests
|
"IN: alien.c-types.tests
|
||||||
USE: alien.syntax
|
use: alien.syntax
|
||||||
USE: alien.c-types
|
use: alien.c-types
|
||||||
GENERIC: foo-func ( x -- )
|
GENERIC: foo-func ( x -- )
|
||||||
" eval( -- )
|
" eval( -- )
|
||||||
|
|
||||||
"IN: alien.c-types.tests
|
"IN: alien.c-types.tests
|
||||||
USE: alien.syntax
|
use: alien.syntax
|
||||||
USE: alien.c-types
|
use: alien.c-types
|
||||||
CALLBACK: void foo-func ( )
|
CALLBACK: void foo-func ( )
|
||||||
" eval( -- )
|
" eval( -- )
|
||||||
|
|
||||||
! generic -> typedef
|
! generic -> typedef
|
||||||
"IN: alien.c-types.tests
|
"IN: alien.c-types.tests
|
||||||
USE: alien.syntax
|
use: alien.syntax
|
||||||
USE: alien.c-types
|
use: alien.c-types
|
||||||
GENERIC: foo-func ( x -- )
|
GENERIC: foo-func ( x -- )
|
||||||
" eval( -- )
|
" eval( -- )
|
||||||
|
|
||||||
"IN: alien.c-types.tests
|
"IN: alien.c-types.tests
|
||||||
USE: alien.syntax
|
use: alien.syntax
|
||||||
USE: alien.c-types
|
use: alien.c-types
|
||||||
TYPEDEF: void* foo-func
|
TYPEDEF: void* foo-func
|
||||||
" eval( -- )
|
" eval( -- )
|
||||||
|
|
|
@ -4,7 +4,7 @@ USING: accessors alien alien.accessors arrays byte-arrays
|
||||||
classes combinators compiler.units cpu.architecture delegate
|
classes combinators compiler.units cpu.architecture delegate
|
||||||
fry kernel layouts locals macros math math.order quotations
|
fry kernel layouts locals macros math math.order quotations
|
||||||
sequences system words words.symbol summary ;
|
sequences system words words.symbol summary ;
|
||||||
IN: alien.c-types
|
in: alien.c-types
|
||||||
|
|
||||||
SYMBOLS:
|
SYMBOLS:
|
||||||
char uchar
|
char uchar
|
||||||
|
@ -15,7 +15,7 @@ SYMBOLS:
|
||||||
float double
|
float double
|
||||||
void* bool ;
|
void* bool ;
|
||||||
|
|
||||||
SINGLETON: void
|
singleton: void
|
||||||
|
|
||||||
TUPLE: abstract-c-type
|
TUPLE: abstract-c-type
|
||||||
{ class class initial: object }
|
{ class class initial: object }
|
||||||
|
|
|
@ -2,7 +2,7 @@
|
||||||
! See http://factorcode.org/license.txt for BSD license.
|
! See http://factorcode.org/license.txt for BSD license.
|
||||||
USING: accessors alien alien.syntax assocs help.markup
|
USING: accessors alien alien.syntax assocs help.markup
|
||||||
help.syntax io.backend kernel namespaces strings ;
|
help.syntax io.backend kernel namespaces strings ;
|
||||||
IN: alien.libraries
|
in: alien.libraries
|
||||||
|
|
||||||
HELP: make-library
|
HELP: make-library
|
||||||
{ $values
|
{ $values
|
||||||
|
|
|
@ -3,7 +3,7 @@
|
||||||
USING: accessors alien alien.strings assocs compiler.errors
|
USING: accessors alien alien.strings assocs compiler.errors
|
||||||
io.backend kernel namespaces destructors sequences strings
|
io.backend kernel namespaces destructors sequences strings
|
||||||
system io.pathnames fry combinators vocabs ;
|
system io.pathnames fry combinators vocabs ;
|
||||||
IN: alien.libraries
|
in: alien.libraries
|
||||||
|
|
||||||
PRIMITIVE: dll-valid? ( dll -- ? )
|
PRIMITIVE: dll-valid? ( dll -- ? )
|
||||||
PRIMITIVE: (dlopen) ( path -- dll )
|
PRIMITIVE: (dlopen) ( path -- dll )
|
||||||
|
@ -19,7 +19,7 @@ PRIMITIVE: (dlsym-raw) ( name dll -- alien )
|
||||||
|
|
||||||
HOOK: dlerror os ( -- message/f )
|
HOOK: dlerror os ( -- message/f )
|
||||||
|
|
||||||
SYMBOL: libraries
|
symbol: libraries
|
||||||
|
|
||||||
libraries [ H{ } clone ] initialize
|
libraries [ H{ } clone ] initialize
|
||||||
|
|
||||||
|
@ -89,7 +89,7 @@ M: library dispose dll>> [ dispose ] when* ;
|
||||||
2dup load-library dlsym-raw
|
2dup load-library dlsym-raw
|
||||||
[ 2nip ] [ no-such-symbol ] if* ;
|
[ 2nip ] [ no-such-symbol ] if* ;
|
||||||
|
|
||||||
SYMBOL: deploy-libraries
|
symbol: deploy-libraries
|
||||||
|
|
||||||
deploy-libraries [ V{ } clone ] initialize
|
deploy-libraries [ V{ } clone ] initialize
|
||||||
|
|
||||||
|
|
|
@ -1,6 +1,6 @@
|
||||||
USING: help.markup help.syntax strings byte-arrays alien libc
|
USING: help.markup help.syntax strings byte-arrays alien libc
|
||||||
debugger io.encodings.string sequences ;
|
debugger io.encodings.string sequences ;
|
||||||
IN: alien.strings
|
in: alien.strings
|
||||||
|
|
||||||
HELP: string>alien
|
HELP: string>alien
|
||||||
{ $values { "string" string } { "encoding" "an encoding descriptor" } { "byte-array" byte-array } }
|
{ $values { "string" string } { "encoding" "an encoding descriptor" } { "byte-array" byte-array } }
|
||||||
|
|
|
@ -1,7 +1,7 @@
|
||||||
USING: alien.strings alien.c-types alien.data tools.test
|
USING: alien.strings alien.c-types alien.data tools.test
|
||||||
kernel libc io.encodings.utf8 io.encodings.utf16 io.encodings.utf16n
|
kernel libc io.encodings.utf8 io.encodings.utf16 io.encodings.utf16n
|
||||||
io.encodings.ascii alien io.encodings.string io.encodings.8-bit.latin1 ;
|
io.encodings.ascii alien io.encodings.string io.encodings.8-bit.latin1 ;
|
||||||
IN: alien.strings.tests
|
in: alien.strings.tests
|
||||||
|
|
||||||
{ "\u0000ff" }
|
{ "\u0000ff" }
|
||||||
[ "\u0000ff" latin1 string>alien latin1 alien>string ]
|
[ "\u0000ff" latin1 string>alien latin1 alien>string ]
|
||||||
|
|
|
@ -5,7 +5,7 @@ io.encodings io.encodings.ascii io.encodings.utf16n
|
||||||
io.encodings.utf8 io.streams.memory kernel kernel.private math
|
io.encodings.utf8 io.streams.memory kernel kernel.private math
|
||||||
namespaces sequences sequences.private strings strings.private
|
namespaces sequences sequences.private strings strings.private
|
||||||
system system.private ;
|
system system.private ;
|
||||||
IN: alien.strings
|
in: alien.strings
|
||||||
|
|
||||||
GENERIC# alien>string 1 ( c-ptr encoding -- string/f )
|
GENERIC# alien>string 1 ( c-ptr encoding -- string/f )
|
||||||
|
|
||||||
|
|
|
@ -1,6 +1,6 @@
|
||||||
USING: help.markup help.syntax
|
USING: help.markup help.syntax
|
||||||
kernel kernel.private prettyprint sequences.private sequences ;
|
kernel kernel.private prettyprint sequences.private sequences ;
|
||||||
IN: arrays
|
in: arrays
|
||||||
|
|
||||||
ARTICLE: "arrays-unsafe" "Unsafe array operations"
|
ARTICLE: "arrays-unsafe" "Unsafe array operations"
|
||||||
"These two words are used internally by the Factor implementation. User code should never need to call them; instead use " { $link nth } " and " { $link set-nth } "."
|
"These two words are used internally by the Factor implementation. User code should never need to call them; instead use " { $link nth } " and " { $link set-nth } "."
|
||||||
|
|
|
@ -1,7 +1,7 @@
|
||||||
! Copyright (C) 2005, 2010 Slava Pestov.
|
! Copyright (C) 2005, 2010 Slava Pestov.
|
||||||
! See http://factorcode.org/license.txt for BSD license.
|
! See http://factorcode.org/license.txt for BSD license.
|
||||||
USING: accessors kernel math sequences sequences.private ;
|
USING: accessors kernel math sequences sequences.private ;
|
||||||
IN: arrays
|
in: arrays
|
||||||
|
|
||||||
BUILTIN: array { length array-capacity read-only initial: 0 } ;
|
BUILTIN: array { length array-capacity read-only initial: 0 } ;
|
||||||
|
|
||||||
|
|
|
@ -3,7 +3,7 @@
|
||||||
USING: help.markup help.syntax kernel sequences
|
USING: help.markup help.syntax kernel sequences
|
||||||
sequences.private namespaces math quotations assocs.private
|
sequences.private namespaces math quotations assocs.private
|
||||||
sets ;
|
sets ;
|
||||||
IN: assocs
|
in: assocs
|
||||||
|
|
||||||
ARTICLE: "alists" "Association lists"
|
ARTICLE: "alists" "Association lists"
|
||||||
"An " { $emphasis "association list" } ", abbreviated " { $emphasis "alist" } ", is an association represented as a sequence where all elements are key/value pairs. The " { $link sequence } " mixin is an instance of the " { $link assoc } " mixin, hence all sequences support the " { $link "assocs-protocol" } " in this way."
|
"An " { $emphasis "association list" } ", abbreviated " { $emphasis "alist" } ", is an association represented as a sequence where all elements are key/value pairs. The " { $link sequence } " mixin is an instance of the " { $link assoc } " mixin, hence all sequences support the " { $link "assocs-protocol" } " in this way."
|
||||||
|
|
|
@ -1,8 +1,8 @@
|
||||||
USING: alien.c-types assocs kernel make math namespaces
|
USING: alien.c-types assocs kernel make math namespaces
|
||||||
sequences specialized-arrays tools.test ;
|
sequences specialized-arrays tools.test ;
|
||||||
IN: assocs.tests
|
in: assocs.tests
|
||||||
SPECIALIZED-ARRAY: double
|
SPECIALIZED-ARRAY: double
|
||||||
IN: assocs.tests
|
in: assocs.tests
|
||||||
|
|
||||||
{ t } [ H{ } dup assoc-subset? ] unit-test
|
{ t } [ H{ } dup assoc-subset? ] unit-test
|
||||||
{ f } [ H{ { 1 3 } } H{ } assoc-subset? ] unit-test
|
{ f } [ H{ { 1 3 } } H{ } assoc-subset? ] unit-test
|
||||||
|
|
|
@ -2,7 +2,7 @@
|
||||||
! See http://factorcode.org/license.txt for BSD license.
|
! See http://factorcode.org/license.txt for BSD license.
|
||||||
USING: accessors arrays kernel math sequences sequences.private
|
USING: accessors arrays kernel math sequences sequences.private
|
||||||
vectors ;
|
vectors ;
|
||||||
IN: assocs
|
in: assocs
|
||||||
|
|
||||||
MIXIN: assoc
|
MIXIN: assoc
|
||||||
|
|
||||||
|
|
|
@ -1,5 +1,5 @@
|
||||||
USING: bootstrap.image.private effects help.markup help.syntax strings ;
|
USING: bootstrap.image.private effects help.markup help.syntax strings ;
|
||||||
IN: bootstrap.primitives
|
in: bootstrap.primitives
|
||||||
|
|
||||||
ARTICLE: "bootstrap.primitives" "Bootstrap primitives"
|
ARTICLE: "bootstrap.primitives" "Bootstrap primitives"
|
||||||
"A script file run to create the bootstrap image. Also see the vocab " { $link "bootstrap.image.primitives" } "." ;
|
"A script file run to create the bootstrap image. Also see the vocab " { $link "bootstrap.image.primitives" } "." ;
|
||||||
|
|
|
@ -7,7 +7,7 @@ classes.tuple.private classes.union combinators compiler.units io
|
||||||
kernel kernel.private layouts make math math.private namespaces parser
|
kernel kernel.private layouts make math math.private namespaces parser
|
||||||
quotations sequences slots source-files splitting vocabs vocabs.loader
|
quotations sequences slots source-files splitting vocabs vocabs.loader
|
||||||
words ;
|
words ;
|
||||||
IN: bootstrap.primitives
|
in: bootstrap.primitives
|
||||||
|
|
||||||
"* Creating primitives and basic runtime structures..." print flush
|
"* Creating primitives and basic runtime structures..." print flush
|
||||||
|
|
||||||
|
|
|
@ -5,7 +5,7 @@ hashtables.wrapped init io io.files kernel kernel.private make
|
||||||
memory namespaces parser parser.notes sequences system vocabs
|
memory namespaces parser parser.notes sequences system vocabs
|
||||||
vocabs.loader vocabs.hierarchy ;
|
vocabs.loader vocabs.hierarchy ;
|
||||||
QUALIFIED: bootstrap.image.private
|
QUALIFIED: bootstrap.image.private
|
||||||
IN: bootstrap.stage1
|
in: bootstrap.stage1
|
||||||
|
|
||||||
"Bootstrap stage 1..." print flush
|
"Bootstrap stage 1..." print flush
|
||||||
|
|
||||||
|
|
|
@ -2,7 +2,7 @@
|
||||||
! See http://factorcode.org/license.txt for BSD license.
|
! See http://factorcode.org/license.txt for BSD license.
|
||||||
USING: words words.symbol sequences vocabs kernel
|
USING: words words.symbol sequences vocabs kernel
|
||||||
compiler.units ;
|
compiler.units ;
|
||||||
IN: bootstrap.syntax
|
in: bootstrap.syntax
|
||||||
|
|
||||||
[
|
[
|
||||||
"syntax" create-vocab drop
|
"syntax" create-vocab drop
|
||||||
|
|
|
@ -1,5 +1,5 @@
|
||||||
USING: kernel help.markup help.syntax sequences ;
|
USING: kernel help.markup help.syntax sequences ;
|
||||||
IN: byte-arrays
|
in: byte-arrays
|
||||||
|
|
||||||
ARTICLE: "byte-arrays" "Byte arrays"
|
ARTICLE: "byte-arrays" "Byte arrays"
|
||||||
"Byte arrays are fixed-size mutable sequences (" { $link "sequence-protocol" } ") whose elements are integers in the range 0-255, inclusive. Each element only uses one byte of storage, hence the name. The literal syntax is covered in " { $link "syntax-byte-arrays" } "."
|
"Byte arrays are fixed-size mutable sequences (" { $link "sequence-protocol" } ") whose elements are integers in the range 0-255, inclusive. Each element only uses one byte of storage, hence the name. The literal syntax is covered in " { $link "syntax-byte-arrays" } "."
|
||||||
|
|
|
@ -2,7 +2,7 @@
|
||||||
! See http://factorcode.org/license.txt for BSD license.
|
! See http://factorcode.org/license.txt for BSD license.
|
||||||
USING: accessors alien.accessors kernel math sequences
|
USING: accessors alien.accessors kernel math sequences
|
||||||
sequences.private ;
|
sequences.private ;
|
||||||
IN: byte-arrays
|
in: byte-arrays
|
||||||
|
|
||||||
BUILTIN: byte-array
|
BUILTIN: byte-array
|
||||||
{ length array-capacity read-only initial: 0 } ;
|
{ length array-capacity read-only initial: 0 } ;
|
||||||
|
|
|
@ -1,5 +1,5 @@
|
||||||
USING: help.markup help.syntax sequences ;
|
USING: help.markup help.syntax sequences ;
|
||||||
IN: byte-vectors
|
in: byte-vectors
|
||||||
|
|
||||||
ARTICLE: "byte-vectors" "Byte vectors"
|
ARTICLE: "byte-vectors" "Byte vectors"
|
||||||
"The " { $vocab-link "byte-vectors" } " vocabulary implements resizable mutable sequence of unsigned bytes. Byte vectors implement the " { $link "sequence-protocol" } " and thus all " { $link "sequences" } " can be used with them."
|
"The " { $vocab-link "byte-vectors" } " vocabulary implements resizable mutable sequence of unsigned bytes. Byte vectors implement the " { $link "sequence-protocol" } " and thus all " { $link "sequences" } " can be used with them."
|
||||||
|
|
|
@ -1,6 +1,6 @@
|
||||||
USING: byte-vectors math prettyprint sequences tools.test
|
USING: byte-vectors math prettyprint sequences tools.test
|
||||||
vectors ;
|
vectors ;
|
||||||
IN: byte-vectors.tests
|
in: byte-vectors.tests
|
||||||
|
|
||||||
{ 0 } [ 123 <byte-vector> length ] unit-test
|
{ 0 } [ 123 <byte-vector> length ] unit-test
|
||||||
|
|
||||||
|
|
|
@ -2,7 +2,7 @@
|
||||||
! See http://factorcode.org/license.txt for BSD license.
|
! See http://factorcode.org/license.txt for BSD license.
|
||||||
USING: accessors byte-arrays growable kernel math sequences
|
USING: accessors byte-arrays growable kernel math sequences
|
||||||
sequences.private ;
|
sequences.private ;
|
||||||
IN: byte-vectors
|
in: byte-vectors
|
||||||
|
|
||||||
TUPLE: byte-vector
|
TUPLE: byte-vector
|
||||||
{ underlying byte-array }
|
{ underlying byte-array }
|
||||||
|
|
|
@ -1,5 +1,5 @@
|
||||||
USING: byte-arrays help.markup help.syntax sequences strings ;
|
USING: byte-arrays help.markup help.syntax sequences strings ;
|
||||||
IN: checksums
|
in: checksums
|
||||||
|
|
||||||
HELP: checksum
|
HELP: checksum
|
||||||
{ $class-description "The class of checksum algorithms." } ;
|
{ $class-description "The class of checksum algorithms." } ;
|
||||||
|
|
|
@ -2,7 +2,7 @@
|
||||||
! See http://factorcode.org/license.txt for BSD license.
|
! See http://factorcode.org/license.txt for BSD license.
|
||||||
USING: accessors byte-arrays byte-vectors io io.backend io.files
|
USING: accessors byte-arrays byte-vectors io io.backend io.files
|
||||||
kernel math math.parser sequences ;
|
kernel math math.parser sequences ;
|
||||||
IN: checksums
|
in: checksums
|
||||||
|
|
||||||
MIXIN: checksum
|
MIXIN: checksum
|
||||||
|
|
||||||
|
|
|
@ -1,5 +1,5 @@
|
||||||
USING: help.markup help.syntax math ;
|
USING: help.markup help.syntax math ;
|
||||||
IN: checksums.crc32
|
in: checksums.crc32
|
||||||
|
|
||||||
HELP: crc32
|
HELP: crc32
|
||||||
{ $class-description "The CRC32 checksum algorithm." } ;
|
{ $class-description "The CRC32 checksum algorithm." } ;
|
||||||
|
|
|
@ -2,7 +2,7 @@
|
||||||
! See http://factorcode.org/license.txt for BSD license.
|
! See http://factorcode.org/license.txt for BSD license.
|
||||||
USING: checksums io.binary kernel math sequences
|
USING: checksums io.binary kernel math sequences
|
||||||
sequences.private ;
|
sequences.private ;
|
||||||
IN: checksums.crc32
|
in: checksums.crc32
|
||||||
|
|
||||||
CONSTANT: crc32-polynomial 0xedb88320
|
CONSTANT: crc32-polynomial 0xedb88320
|
||||||
|
|
||||||
|
@ -19,7 +19,7 @@ CONSTANT: crc32-table V{ }
|
||||||
mask-byte crc32-table nth-unsafe
|
mask-byte crc32-table nth-unsafe
|
||||||
swap -8 shift bitxor ; inline
|
swap -8 shift bitxor ; inline
|
||||||
|
|
||||||
SINGLETON: crc32
|
singleton: crc32
|
||||||
|
|
||||||
INSTANCE: crc32 checksum
|
INSTANCE: crc32 checksum
|
||||||
|
|
||||||
|
|
|
@ -1,6 +1,6 @@
|
||||||
USING: classes classes.private help.markup help.syntax kernel
|
USING: classes classes.private help.markup help.syntax kernel
|
||||||
math sequences ;
|
math sequences ;
|
||||||
IN: classes.algebra
|
in: classes.algebra
|
||||||
|
|
||||||
ARTICLE: "class-operations" "Class operations"
|
ARTICLE: "class-operations" "Class operations"
|
||||||
"Set-theoretic operations on classes:"
|
"Set-theoretic operations on classes:"
|
||||||
|
|
|
@ -2,7 +2,7 @@ USING: accessors arrays assocs classes classes.algebra
|
||||||
classes.tuple classes.union generic generic.private growable
|
classes.tuple classes.union generic generic.private growable
|
||||||
kernel math prettyprint quotations random sbufs sequences
|
kernel math prettyprint quotations random sbufs sequences
|
||||||
stack-checker strings tools.test vectors words ;
|
stack-checker strings tools.test vectors words ;
|
||||||
IN: classes.algebra.tests
|
in: classes.algebra.tests
|
||||||
|
|
||||||
TUPLE: first-one ;
|
TUPLE: first-one ;
|
||||||
TUPLE: second-one ;
|
TUPLE: second-one ;
|
||||||
|
@ -26,9 +26,9 @@ UNION: x1 a1 b1 ;
|
||||||
UNION: y1 a1 c1 ;
|
UNION: y1 a1 c1 ;
|
||||||
UNION: z1 b1 c1 ;
|
UNION: z1 b1 c1 ;
|
||||||
|
|
||||||
SINGLETON: sa
|
singleton: sa
|
||||||
SINGLETON: sb
|
singleton: sb
|
||||||
SINGLETON: sc
|
singleton: sc
|
||||||
|
|
||||||
INTERSECTION: empty-intersection ;
|
INTERSECTION: empty-intersection ;
|
||||||
|
|
||||||
|
@ -334,7 +334,7 @@ MIXIN: empty-mixin
|
||||||
] unit-test
|
] unit-test
|
||||||
] times
|
] times
|
||||||
|
|
||||||
SINGLETON: xxx
|
singleton: xxx
|
||||||
UNION: yyy xxx ;
|
UNION: yyy xxx ;
|
||||||
|
|
||||||
{ { yyy xxx } } [ { xxx yyy } sort-classes ] unit-test
|
{ { yyy xxx } } [ { xxx yyy } sort-classes ] unit-test
|
||||||
|
|
|
@ -3,7 +3,7 @@
|
||||||
USING: accessors arrays assocs classes classes.private
|
USING: accessors arrays assocs classes classes.private
|
||||||
combinators kernel make math math.order namespaces sequences
|
combinators kernel make math math.order namespaces sequences
|
||||||
sets sorting vectors words ;
|
sets sorting vectors words ;
|
||||||
IN: classes.algebra
|
in: classes.algebra
|
||||||
|
|
||||||
DEFER: sort-classes
|
DEFER: sort-classes
|
||||||
|
|
||||||
|
@ -107,7 +107,7 @@ PRIVATE>
|
||||||
: class-or ( first second -- class )
|
: class-or ( first second -- class )
|
||||||
class-or-cache get [ (class-or) ] symmetric-class-op ;
|
class-or-cache get [ (class-or) ] symmetric-class-op ;
|
||||||
|
|
||||||
SYMBOL: +incomparable+
|
symbol: +incomparable+
|
||||||
|
|
||||||
: compare-classes ( first second -- <=> )
|
: compare-classes ( first second -- <=> )
|
||||||
[ swap class<= ] [ class<= ] 2bi
|
[ swap class<= ] [ class<= ] 2bi
|
||||||
|
|
|
@ -1,5 +1,5 @@
|
||||||
USING: help.syntax help.markup classes layouts ;
|
USING: help.syntax help.markup classes layouts ;
|
||||||
IN: classes.builtin
|
in: classes.builtin
|
||||||
|
|
||||||
ARTICLE: "builtin-classes" "Built-in classes"
|
ARTICLE: "builtin-classes" "Built-in classes"
|
||||||
"Every object is an instance of exactly one canonical " { $emphasis "built-in class" } " which defines its layout in memory and basic behavior."
|
"Every object is an instance of exactly one canonical " { $emphasis "built-in class" } " which defines its layout in memory and basic behavior."
|
||||||
|
|
|
@ -1,5 +1,5 @@
|
||||||
USING: accessors kernel memory sequences tools.test words ;
|
USING: accessors kernel memory sequences tools.test words ;
|
||||||
IN: classes.builtin.tests
|
in: classes.builtin.tests
|
||||||
|
|
||||||
{ f } [
|
{ f } [
|
||||||
[ word? ] instances
|
[ word? ] instances
|
||||||
|
|
|
@ -2,9 +2,9 @@
|
||||||
! See http://factorcode.org/license.txt for BSD license.
|
! See http://factorcode.org/license.txt for BSD license.
|
||||||
USING: classes classes.algebra.private classes.private kernel
|
USING: classes classes.algebra.private classes.private kernel
|
||||||
kernel.private make namespaces sequences words ;
|
kernel.private make namespaces sequences words ;
|
||||||
IN: classes.builtin
|
in: classes.builtin
|
||||||
|
|
||||||
SYMBOL: builtins
|
symbol: builtins
|
||||||
|
|
||||||
PREDICATE: builtin-class < class
|
PREDICATE: builtin-class < class
|
||||||
"metaclass" word-prop builtin-class eq? ;
|
"metaclass" word-prop builtin-class eq? ;
|
||||||
|
|
|
@ -1,6 +1,6 @@
|
||||||
USING: classes.private help.markup help.syntax kernel quotations
|
USING: classes.private help.markup help.syntax kernel quotations
|
||||||
sequences words ;
|
sequences words ;
|
||||||
IN: classes
|
in: classes
|
||||||
|
|
||||||
ARTICLE: "class-predicates" "Class predicate words"
|
ARTICLE: "class-predicates" "Class predicate words"
|
||||||
"With a handful of exceptions, each class has a membership predicate word, named " { $snippet { $emphasis "class" } "?" } ". A quotation calling this predicate is stored in the " { $snippet "\"predicate\"" } " word property."
|
"With a handful of exceptions, each class has a membership predicate word, named " { $snippet { $emphasis "class" } "?" } ". A quotation calling this predicate is stored in the " { $snippet "\"predicate\"" } " word property."
|
||||||
|
|
|
@ -1,7 +1,7 @@
|
||||||
USING: assocs classes classes.private compiler.units definitions
|
USING: assocs classes classes.private compiler.units definitions
|
||||||
eval generic io.streams.string kernel math multiline namespaces
|
eval generic io.streams.string kernel math multiline namespaces
|
||||||
parser sequences sets sorting tools.test vocabs words ;
|
parser sequences sets sorting tools.test vocabs words ;
|
||||||
IN: classes.tests
|
in: classes.tests
|
||||||
|
|
||||||
{ t } [ 3 object instance? ] unit-test
|
{ t } [ 3 object instance? ] unit-test
|
||||||
{ t } [ 3 fixnum instance? ] unit-test
|
{ t } [ 3 fixnum instance? ] unit-test
|
||||||
|
@ -26,7 +26,7 @@ M: method-forget-class method-forget-test ;
|
||||||
] unit-test
|
] unit-test
|
||||||
|
|
||||||
! Long-standing problem
|
! Long-standing problem
|
||||||
USE: multiline
|
use: multiline
|
||||||
|
|
||||||
! So the user has some code...
|
! So the user has some code...
|
||||||
{ } [
|
{ } [
|
||||||
|
|
|
@ -2,7 +2,7 @@
|
||||||
! See http://factorcode.org/license.txt for BSD license.
|
! See http://factorcode.org/license.txt for BSD license.
|
||||||
USING: accessors assocs combinators definitions graphs kernel
|
USING: accessors assocs combinators definitions graphs kernel
|
||||||
make namespaces quotations sequences sets words words.symbol ;
|
make namespaces quotations sequences sets words words.symbol ;
|
||||||
IN: classes
|
in: classes
|
||||||
|
|
||||||
ERROR: bad-inheritance class superclass ;
|
ERROR: bad-inheritance class superclass ;
|
||||||
|
|
||||||
|
@ -16,12 +16,12 @@ INSTANCE: defining-class classoid
|
||||||
|
|
||||||
<PRIVATE
|
<PRIVATE
|
||||||
|
|
||||||
SYMBOL: class<=-cache
|
symbol: class<=-cache
|
||||||
SYMBOL: class-not-cache
|
symbol: class-not-cache
|
||||||
SYMBOL: classes-intersect-cache
|
symbol: classes-intersect-cache
|
||||||
SYMBOL: class-and-cache
|
symbol: class-and-cache
|
||||||
SYMBOL: class-or-cache
|
symbol: class-or-cache
|
||||||
SYMBOL: next-method-quot-cache
|
symbol: next-method-quot-cache
|
||||||
|
|
||||||
: init-caches ( -- )
|
: init-caches ( -- )
|
||||||
H{ } clone class<=-cache namespaces:set
|
H{ } clone class<=-cache namespaces:set
|
||||||
|
@ -39,9 +39,9 @@ SYMBOL: next-method-quot-cache
|
||||||
class-or-cache get clear-assoc
|
class-or-cache get clear-assoc
|
||||||
next-method-quot-cache get clear-assoc ;
|
next-method-quot-cache get clear-assoc ;
|
||||||
|
|
||||||
SYMBOL: update-map
|
symbol: update-map
|
||||||
|
|
||||||
SYMBOL: implementors-map
|
symbol: implementors-map
|
||||||
|
|
||||||
GENERIC: class-name ( class -- string )
|
GENERIC: class-name ( class -- string )
|
||||||
|
|
||||||
|
|
|
@ -2,7 +2,7 @@
|
||||||
! See http://factorcode.org/license.txt for BSD license.
|
! See http://factorcode.org/license.txt for BSD license.
|
||||||
USING: accessors classes classes.error classes.tuple
|
USING: accessors classes classes.error classes.tuple
|
||||||
compiler.units effects eval generic kernel tools.test words ;
|
compiler.units effects eval generic kernel tools.test words ;
|
||||||
IN: classes.error.tests
|
in: classes.error.tests
|
||||||
|
|
||||||
! Test error classes
|
! Test error classes
|
||||||
ERROR: error-class-test a b c ;
|
ERROR: error-class-test a b c ;
|
||||||
|
|
|
@ -2,7 +2,7 @@
|
||||||
! See http://factorcode.org/license.txt for BSD license.
|
! See http://factorcode.org/license.txt for BSD license.
|
||||||
USING: accessors classes.private classes.tuple
|
USING: accessors classes.private classes.tuple
|
||||||
classes.tuple.private combinators kernel parser sequences words ;
|
classes.tuple.private combinators kernel parser sequences words ;
|
||||||
IN: classes.error
|
in: classes.error
|
||||||
|
|
||||||
PREDICATE: error-class < tuple-class
|
PREDICATE: error-class < tuple-class
|
||||||
"error-class" word-prop ;
|
"error-class" word-prop ;
|
||||||
|
|
|
@ -1,7 +1,7 @@
|
||||||
USING: generic help.markup help.syntax kernel kernel.private
|
USING: generic help.markup help.syntax kernel kernel.private
|
||||||
namespaces sequences words arrays help effects math
|
namespaces sequences words arrays help effects math
|
||||||
layouts classes.private classes compiler.units ;
|
layouts classes.private classes compiler.units ;
|
||||||
IN: classes.intersection
|
in: classes.intersection
|
||||||
|
|
||||||
ARTICLE: "intersections" "Intersection classes"
|
ARTICLE: "intersections" "Intersection classes"
|
||||||
"An object is an instance of a intersection class if it is an instance of all of its participants."
|
"An object is an instance of a intersection class if it is an instance of all of its participants."
|
||||||
|
|
|
@ -1,5 +1,5 @@
|
||||||
USING: accessors generic kernel math math.order slots tools.test ;
|
USING: accessors generic kernel math math.order slots tools.test ;
|
||||||
IN: classes.intersection.tests
|
in: classes.intersection.tests
|
||||||
|
|
||||||
TUPLE: a ;
|
TUPLE: a ;
|
||||||
TUPLE: a1 < a ; TUPLE: a2 < a ; TUPLE: a3 < a2 ;
|
TUPLE: a1 < a ; TUPLE: a2 < a ; TUPLE: a3 < a2 ;
|
||||||
|
|
|
@ -3,7 +3,7 @@
|
||||||
USING: accessors assocs classes classes.algebra
|
USING: accessors assocs classes classes.algebra
|
||||||
classes.algebra.private classes.builtin classes.private
|
classes.algebra.private classes.builtin classes.private
|
||||||
combinators kernel make sequences words ;
|
combinators kernel make sequences words ;
|
||||||
IN: classes.intersection
|
in: classes.intersection
|
||||||
|
|
||||||
PREDICATE: intersection-class < class
|
PREDICATE: intersection-class < class
|
||||||
"metaclass" word-prop intersection-class eq? ;
|
"metaclass" word-prop intersection-class eq? ;
|
||||||
|
|
|
@ -2,7 +2,7 @@
|
||||||
! See http://factorcode.org/license.txt for BSD license.
|
! See http://factorcode.org/license.txt for BSD license.
|
||||||
USING: accessors classes classes.algebra classes.algebra.private
|
USING: accessors classes classes.algebra classes.algebra.private
|
||||||
classes.maybe eval generic.single kernel math slots tools.test ;
|
classes.maybe eval generic.single kernel math slots tools.test ;
|
||||||
IN: classes.maybe.tests
|
in: classes.maybe.tests
|
||||||
|
|
||||||
{ t } [ 3 maybe{ integer } instance? ] unit-test
|
{ t } [ 3 maybe{ integer } instance? ] unit-test
|
||||||
{ t } [ f maybe{ integer } instance? ] unit-test
|
{ t } [ f maybe{ integer } instance? ] unit-test
|
||||||
|
|
|
@ -3,7 +3,7 @@
|
||||||
USING: accessors arrays classes classes.algebra
|
USING: accessors arrays classes classes.algebra
|
||||||
classes.algebra.private classes.private classes.union.private
|
classes.algebra.private classes.private classes.union.private
|
||||||
kernel words ;
|
kernel words ;
|
||||||
IN: classes.maybe
|
in: classes.maybe
|
||||||
|
|
||||||
TUPLE: maybe { class classoid initial: object read-only } ;
|
TUPLE: maybe { class classoid initial: object read-only } ;
|
||||||
|
|
||||||
|
|
|
@ -1,6 +1,6 @@
|
||||||
USING: help.markup help.syntax help words compiler.units
|
USING: help.markup help.syntax help words compiler.units
|
||||||
classes sequences ;
|
classes sequences ;
|
||||||
IN: classes.mixin
|
in: classes.mixin
|
||||||
|
|
||||||
ARTICLE: "mixins" "Mixin classes"
|
ARTICLE: "mixins" "Mixin classes"
|
||||||
"An object is an instance of a union class if it is an instance of one of its members. In this respect, mixin classes are identical to union classes. However, mixin classes have the additional property that they are " { $emphasis "open" } "; new classes can be added to the mixin after the original definition of the mixin."
|
"An object is an instance of a union class if it is an instance of one of its members. In this respect, mixin classes are identical to union classes. However, mixin classes have the additional property that they are " { $emphasis "open" } "; new classes can be added to the mixin after the original definition of the mixin."
|
||||||
|
|
|
@ -2,7 +2,7 @@ USING: arrays assocs classes classes.algebra classes.mixin
|
||||||
compiler.units definitions eval hashtables io.streams.string
|
compiler.units definitions eval hashtables io.streams.string
|
||||||
kernel math parser sequences source-files strings tools.test
|
kernel math parser sequences source-files strings tools.test
|
||||||
vectors words ;
|
vectors words ;
|
||||||
IN: classes.mixin.tests
|
in: classes.mixin.tests
|
||||||
|
|
||||||
! Test mixins
|
! Test mixins
|
||||||
MIXIN: sequence-mixin
|
MIXIN: sequence-mixin
|
||||||
|
@ -47,7 +47,7 @@ INSTANCE: integer mx1
|
||||||
|
|
||||||
[ \ mx1 forget ] with-compilation-unit
|
[ \ mx1 forget ] with-compilation-unit
|
||||||
|
|
||||||
USE: io.streams.string
|
use: io.streams.string
|
||||||
|
|
||||||
2 [
|
2 [
|
||||||
[ "mixin-forget-test" forget-source ] with-compilation-unit
|
[ "mixin-forget-test" forget-source ] with-compilation-unit
|
||||||
|
@ -119,11 +119,11 @@ MIXIN: move-instance-declaration-mixin
|
||||||
{ { string } } [ move-instance-declaration-mixin class-members ] unit-test
|
{ { string } } [ move-instance-declaration-mixin class-members ] unit-test
|
||||||
|
|
||||||
MIXIN: silly-mixin
|
MIXIN: silly-mixin
|
||||||
SYMBOL: not-a-class
|
symbol: not-a-class
|
||||||
|
|
||||||
[ [ \ not-a-class \ silly-mixin add-mixin-instance ] with-compilation-unit ] must-fail
|
[ [ \ not-a-class \ silly-mixin add-mixin-instance ] with-compilation-unit ] must-fail
|
||||||
|
|
||||||
SYMBOL: not-a-mixin
|
symbol: not-a-mixin
|
||||||
TUPLE: a-class ;
|
TUPLE: a-class ;
|
||||||
|
|
||||||
[ [ \ a-class \ not-a-mixin add-mixin-instance ] with-compilation-unit ] must-fail
|
[ [ \ a-class \ not-a-mixin add-mixin-instance ] with-compilation-unit ] must-fail
|
||||||
|
|
|
@ -4,7 +4,7 @@ USING: accessors assocs classes classes.algebra
|
||||||
classes.algebra.private classes.private classes.union
|
classes.algebra.private classes.private classes.union
|
||||||
classes.union.private combinators definitions kernel sequences
|
classes.union.private combinators definitions kernel sequences
|
||||||
words ;
|
words ;
|
||||||
IN: classes.mixin
|
in: classes.mixin
|
||||||
|
|
||||||
PREDICATE: mixin-class < union-class "mixin" word-prop ;
|
PREDICATE: mixin-class < union-class "mixin" word-prop ;
|
||||||
|
|
||||||
|
|
|
@ -1,7 +1,7 @@
|
||||||
! Copyright (C) 2008, 2010 Slava Pestov.
|
! Copyright (C) 2008, 2010 Slava Pestov.
|
||||||
! See http://factorcode.org/license.txt for BSD license.
|
! See http://factorcode.org/license.txt for BSD license.
|
||||||
USING: classes compiler.units kernel parser vocabs.parser words ;
|
USING: classes compiler.units kernel parser vocabs.parser words ;
|
||||||
IN: classes.parser
|
in: classes.parser
|
||||||
|
|
||||||
: save-class-location ( class -- )
|
: save-class-location ( class -- )
|
||||||
location remember-class ;
|
location remember-class ;
|
||||||
|
|
|
@ -1,7 +1,7 @@
|
||||||
USING: generic help.markup help.syntax kernel kernel.private
|
USING: generic help.markup help.syntax kernel kernel.private
|
||||||
namespaces sequences words arrays layouts help effects math
|
namespaces sequences words arrays layouts help effects math
|
||||||
classes.private classes compiler.units ;
|
classes.private classes compiler.units ;
|
||||||
IN: classes.predicate
|
in: classes.predicate
|
||||||
|
|
||||||
ARTICLE: "predicates" "Predicate classes"
|
ARTICLE: "predicates" "Predicate classes"
|
||||||
"Predicate classes allow fine-grained control over method dispatch."
|
"Predicate classes allow fine-grained control over method dispatch."
|
||||||
|
|
|
@ -1,6 +1,6 @@
|
||||||
USING: accessors assocs classes classes.algebra compiler.units
|
USING: accessors assocs classes classes.algebra compiler.units
|
||||||
eval generic.single kernel math strings tools.test words ;
|
eval generic.single kernel math strings tools.test words ;
|
||||||
IN: classes.predicate.tests
|
in: classes.predicate.tests
|
||||||
|
|
||||||
PREDICATE: negative < integer 0 < ;
|
PREDICATE: negative < integer 0 < ;
|
||||||
PREDICATE: positive < integer 0 > ;
|
PREDICATE: positive < integer 0 > ;
|
||||||
|
|
|
@ -2,7 +2,7 @@
|
||||||
! See http://factorcode.org/license.txt for BSD license.
|
! See http://factorcode.org/license.txt for BSD license.
|
||||||
USING: classes classes.algebra classes.algebra.private
|
USING: classes classes.algebra classes.algebra.private
|
||||||
classes.private kernel make words ;
|
classes.private kernel make words ;
|
||||||
IN: classes.predicate
|
in: classes.predicate
|
||||||
|
|
||||||
PREDICATE: predicate-class < class
|
PREDICATE: predicate-class < class
|
||||||
"metaclass" word-prop predicate-class eq? ;
|
"metaclass" word-prop predicate-class eq? ;
|
||||||
|
|
|
@ -1,5 +1,5 @@
|
||||||
USING: help.markup help.syntax kernel words ;
|
USING: help.markup help.syntax kernel words ;
|
||||||
IN: classes.singleton
|
in: classes.singleton
|
||||||
|
|
||||||
ARTICLE: "singletons" "Singleton classes"
|
ARTICLE: "singletons" "Singleton classes"
|
||||||
"A singleton is a class with only one instance and with no state."
|
"A singleton is a class with only one instance and with no state."
|
||||||
|
|
|
@ -1,5 +1,5 @@
|
||||||
USING: classes.singleton io.streams.string kernel see tools.test ;
|
USING: classes.singleton io.streams.string kernel see tools.test ;
|
||||||
IN: classes.singleton.tests
|
in: classes.singleton.tests
|
||||||
|
|
||||||
{ } [ SINGLETON: bzzt ] unit-test
|
{ } [ SINGLETON: bzzt ] unit-test
|
||||||
{ t } [ bzzt bzzt? ] unit-test
|
{ t } [ bzzt bzzt? ] unit-test
|
||||||
|
@ -11,7 +11,7 @@ GENERIC: zammo ( obj -- str )
|
||||||
{ t } [ omg singleton-class? ] unit-test
|
{ t } [ omg singleton-class? ] unit-test
|
||||||
{ "IN: classes.singleton.tests\nSINGLETON: omg\n" } [ [ omg see ] with-string-writer ] unit-test
|
{ "IN: classes.singleton.tests\nSINGLETON: omg\n" } [ [ omg see ] with-string-writer ] unit-test
|
||||||
|
|
||||||
SINGLETON: word-and-singleton
|
singleton: word-and-singleton
|
||||||
|
|
||||||
: word-and-singleton ( -- x ) 3 ;
|
: word-and-singleton ( -- x ) 3 ;
|
||||||
|
|
||||||
|
|
|
@ -2,7 +2,7 @@
|
||||||
! See http://factorcode.org/license.txt for BSD license.
|
! See http://factorcode.org/license.txt for BSD license.
|
||||||
USING: classes classes.algebra.private classes.predicate
|
USING: classes classes.algebra.private classes.predicate
|
||||||
classes.predicate.private kernel sequences words ;
|
classes.predicate.private kernel sequences words ;
|
||||||
IN: classes.singleton
|
in: classes.singleton
|
||||||
|
|
||||||
<PRIVATE
|
<PRIVATE
|
||||||
|
|
||||||
|
|
|
@ -1,4 +1,4 @@
|
||||||
IN: classes.tuple.parser
|
in: classes.tuple.parser
|
||||||
USING: strings help.markup help.syntax ;
|
USING: strings help.markup help.syntax ;
|
||||||
|
|
||||||
HELP: invalid-slot-name
|
HELP: invalid-slot-name
|
||||||
|
|
|
@ -1,7 +1,7 @@
|
||||||
USING: accessors classes.tuple.parser lexer words classes
|
USING: accessors classes.tuple.parser lexer words classes
|
||||||
sequences math kernel slots tools.test parser compiler.units
|
sequences math kernel slots tools.test parser compiler.units
|
||||||
arrays classes.tuple eval multiline ;
|
arrays classes.tuple eval multiline ;
|
||||||
IN: classes.tuple.parser.tests
|
in: classes.tuple.parser.tests
|
||||||
|
|
||||||
TUPLE: test-1 ;
|
TUPLE: test-1 ;
|
||||||
|
|
||||||
|
|
|
@ -3,7 +3,7 @@
|
||||||
USING: accessors arrays assocs classes.parser classes.tuple
|
USING: accessors arrays assocs classes.parser classes.tuple
|
||||||
combinators kernel lexer make parser parser.notes sequences
|
combinators kernel lexer make parser parser.notes sequences
|
||||||
sets slots ;
|
sets slots ;
|
||||||
IN: classes.tuple.parser
|
in: classes.tuple.parser
|
||||||
|
|
||||||
: slot-names ( slots -- seq )
|
: slot-names ( slots -- seq )
|
||||||
[ dup array? [ first ] when ] map ;
|
[ dup array? [ first ] when ] map ;
|
||||||
|
|
|
@ -1,7 +1,7 @@
|
||||||
USING: arrays assocs classes classes.tuple.private
|
USING: arrays assocs classes classes.tuple.private
|
||||||
compiler.units growable help.markup help.syntax kernel math
|
compiler.units growable help.markup help.syntax kernel math
|
||||||
sbufs sequences slots strings vectors words ;
|
sbufs sequences slots strings vectors words ;
|
||||||
IN: classes.tuple
|
in: classes.tuple
|
||||||
|
|
||||||
ARTICLE: "slot-read-only-declaration" "Read-only slots"
|
ARTICLE: "slot-read-only-declaration" "Read-only slots"
|
||||||
"By default, all slots are writable. If a slot is explicitly declared " { $link read-only } ", then no writer method is generated for the slot, and the only way to set it to a value other than its initial value is to construct an instance of the tuple with " { $link boa } ", passing the initial value for the read-only slot on the stack; the common idiom of calling " { $link new } " and then immediately filling in slot values with setter words will not work with read-only slots." ;
|
"By default, all slots are writable. If a slot is explicitly declared " { $link read-only } ", then no writer method is generated for the slot, and the only way to set it to a value other than its initial value is to construct an instance of the tuple with " { $link boa } ", passing the initial value for the read-only slot on the stack; the common idiom of calling " { $link new } " and then immediately filling in slot values with setter words will not work with read-only slots." ;
|
||||||
|
|
|
@ -6,7 +6,7 @@ kernel.private literals math math.constants memory namespaces
|
||||||
parser parser.notes see sequences sequences.private slots
|
parser parser.notes see sequences sequences.private slots
|
||||||
splitting strings threads tools.test vectors vocabs words
|
splitting strings threads tools.test vectors vocabs words
|
||||||
words.symbol ;
|
words.symbol ;
|
||||||
IN: classes.tuple.tests
|
in: classes.tuple.tests
|
||||||
|
|
||||||
TUPLE: rect x y w h ;
|
TUPLE: rect x y w h ;
|
||||||
: <rect> ( x y w h -- rect ) rect boa ;
|
: <rect> ( x y w h -- rect ) rect boa ;
|
||||||
|
@ -191,7 +191,7 @@ M: vector silly "z" ;
|
||||||
{ "zz" } [ 123 <reversed> silly nip ] unit-test
|
{ "zz" } [ 123 <reversed> silly nip ] unit-test
|
||||||
|
|
||||||
! Typo
|
! Typo
|
||||||
SYMBOL: not-a-tuple-class
|
symbol: not-a-tuple-class
|
||||||
|
|
||||||
! Missing check
|
! Missing check
|
||||||
[ not-a-tuple-class boa ] must-fail
|
[ not-a-tuple-class boa ] must-fail
|
||||||
|
|
|
@ -5,7 +5,7 @@ classes.algebra.private classes.builtin classes.private
|
||||||
combinators definitions effects generic kernel kernel.private
|
combinators definitions effects generic kernel kernel.private
|
||||||
make math math.private memory namespaces quotations
|
make math math.private memory namespaces quotations
|
||||||
sequences sequences.private slots slots.private strings words ;
|
sequences sequences.private slots slots.private strings words ;
|
||||||
IN: classes.tuple
|
in: classes.tuple
|
||||||
|
|
||||||
<PRIVATE
|
<PRIVATE
|
||||||
PRIMITIVE: <tuple> ( layout -- tuple )
|
PRIMITIVE: <tuple> ( layout -- tuple )
|
||||||
|
@ -211,7 +211,7 @@ M: object final-class? drop f ;
|
||||||
: apply-slot-permutation ( old-values triples -- new-values )
|
: apply-slot-permutation ( old-values triples -- new-values )
|
||||||
[ first3 update-slot ] with map ;
|
[ first3 update-slot ] with map ;
|
||||||
|
|
||||||
SYMBOL: outdated-tuples
|
symbol: outdated-tuples
|
||||||
|
|
||||||
: permute-slots ( old-values layout -- new-values )
|
: permute-slots ( old-values layout -- new-values )
|
||||||
[ first all-slots ] [ outdated-tuples get at ] bi
|
[ first all-slots ] [ outdated-tuples get at ] bi
|
||||||
|
|
|
@ -1,7 +1,7 @@
|
||||||
USING: generic help.markup help.syntax kernel kernel.private
|
USING: generic help.markup help.syntax kernel kernel.private
|
||||||
namespaces sequences words arrays help effects math
|
namespaces sequences words arrays help effects math
|
||||||
classes.private classes compiler.units ;
|
classes.private classes compiler.units ;
|
||||||
IN: classes.union
|
in: classes.union
|
||||||
|
|
||||||
ARTICLE: "unions" "Union classes"
|
ARTICLE: "unions" "Union classes"
|
||||||
"An object is an instance of a union class if it is an instance of one of its members."
|
"An object is an instance of a union class if it is an instance of one of its members."
|
||||||
|
|
|
@ -2,7 +2,7 @@ USING: accessors alien assocs classes classes.algebra
|
||||||
classes.predicate classes.union classes.union.private
|
classes.predicate classes.union classes.union.private
|
||||||
compiler.units eval io.streams.string kernel math math.private
|
compiler.units eval io.streams.string kernel math math.private
|
||||||
parser quotations see sequences slots strings tools.test words ;
|
parser quotations see sequences slots strings tools.test words ;
|
||||||
IN: classes.union.tests
|
in: classes.union.tests
|
||||||
|
|
||||||
! DEFER: bah
|
! DEFER: bah
|
||||||
! FORGET: bah
|
! FORGET: bah
|
||||||
|
@ -134,7 +134,7 @@ PREDICATE: numba-ova-10 < union{ float integer }
|
||||||
[ "IN: issue-420 UNION: omg omg ;" eval( -- ) ]
|
[ "IN: issue-420 UNION: omg omg ;" eval( -- ) ]
|
||||||
[ error>> cannot-reference-self? ] must-fail-with
|
[ error>> cannot-reference-self? ] must-fail-with
|
||||||
|
|
||||||
IN: issue-420
|
in: issue-420
|
||||||
UNION: a ;
|
UNION: a ;
|
||||||
UNION: b a ;
|
UNION: b a ;
|
||||||
|
|
||||||
|
|
|
@ -4,7 +4,7 @@ USING: accessors assocs classes classes.algebra
|
||||||
classes.algebra.private classes.builtin classes.private
|
classes.algebra.private classes.builtin classes.private
|
||||||
combinators definitions kernel kernel.private math math.private
|
combinators definitions kernel kernel.private math math.private
|
||||||
quotations sequences sets words ;
|
quotations sequences sets words ;
|
||||||
IN: classes.union
|
in: classes.union
|
||||||
|
|
||||||
PREDICATE: union-class < class
|
PREDICATE: union-class < class
|
||||||
"metaclass" word-prop union-class eq? ;
|
"metaclass" word-prop union-class eq? ;
|
||||||
|
|
|
@ -2,7 +2,7 @@ USING: arrays help.markup help.syntax strings sbufs vectors
|
||||||
kernel quotations generic generic.standard classes
|
kernel quotations generic generic.standard classes
|
||||||
math assocs sequences sequences.private combinators.private
|
math assocs sequences sequences.private combinators.private
|
||||||
effects words ;
|
effects words ;
|
||||||
IN: combinators
|
in: combinators
|
||||||
|
|
||||||
ARTICLE: "cleave-combinators" "Cleave combinators"
|
ARTICLE: "cleave-combinators" "Cleave combinators"
|
||||||
"The cleave combinators apply multiple quotations to a single value or set of values."
|
"The cleave combinators apply multiple quotations to a single value or set of values."
|
||||||
|
|
|
@ -1,7 +1,7 @@
|
||||||
USING: accessors arrays combinators combinators.private io
|
USING: accessors arrays combinators combinators.private io
|
||||||
kernel math math.functions prettyprint sequences stack-checker
|
kernel math math.functions prettyprint sequences stack-checker
|
||||||
tools.test words ;
|
tools.test words ;
|
||||||
IN: combinators.tests
|
in: combinators.tests
|
||||||
|
|
||||||
{ 3 } [ 1 2 [ + ] call( x y -- z ) ] unit-test
|
{ 3 } [ 1 2 [ + ] call( x y -- z ) ] unit-test
|
||||||
[ 1 2 [ + ] call( -- z ) ] must-fail
|
[ 1 2 [ + ] call( -- z ) ] must-fail
|
||||||
|
|
|
@ -3,7 +3,7 @@
|
||||||
USING: accessors arrays assocs hashtables kernel kernel.private
|
USING: accessors arrays assocs hashtables kernel kernel.private
|
||||||
make math math.order math.private quotations sequences
|
make math math.order math.private quotations sequences
|
||||||
sequences.private sets sorting words ;
|
sequences.private sets sorting words ;
|
||||||
IN: combinators
|
in: combinators
|
||||||
|
|
||||||
! Most of these combinators have compile-time expansions in
|
! Most of these combinators have compile-time expansions in
|
||||||
! the optimizing compiler. See stack-checker.transforms and
|
! the optimizing compiler. See stack-checker.transforms and
|
||||||
|
|
|
@ -2,7 +2,7 @@
|
||||||
! See http://factorcode.org/license.txt for BSD license.
|
! See http://factorcode.org/license.txt for BSD license.
|
||||||
USING: help.markup help.syntax io.streams.string quotations
|
USING: help.markup help.syntax io.streams.string quotations
|
||||||
math kernel ;
|
math kernel ;
|
||||||
IN: combinators.short-circuit
|
in: combinators.short-circuit
|
||||||
|
|
||||||
HELP: 0&&
|
HELP: 0&&
|
||||||
{ $values { "quots" "a sequence of quotations with stack effect " { $snippet "( -- ? )" } } { "?" "the result of the last quotation, or " { $link f } } }
|
{ $values { "quots" "a sequence of quotations with stack effect " { $snippet "( -- ? )" } } { "?" "the result of the last quotation, or " { $link f } } }
|
||||||
|
|
|
@ -1,6 +1,6 @@
|
||||||
USING: accessors combinators.short-circuit kernel math
|
USING: accessors combinators.short-circuit kernel math
|
||||||
tools.test ;
|
tools.test ;
|
||||||
IN: combinators.short-circuit.tests
|
in: combinators.short-circuit.tests
|
||||||
|
|
||||||
{ 3 } [ { [ 1 ] [ 2 ] [ 3 ] } 0&& ] unit-test
|
{ 3 } [ { [ 1 ] [ 2 ] [ 3 ] } 0&& ] unit-test
|
||||||
{ 5 } [ 3 { [ 0 > ] [ odd? ] [ 2 + ] } 1&& ] unit-test
|
{ 5 } [ 3 { [ 0 > ] [ odd? ] [ 2 + ] } 1&& ] unit-test
|
||||||
|
|
|
@ -1,6 +1,6 @@
|
||||||
USING: arrays combinators fry generalizations kernel macros
|
USING: arrays combinators fry generalizations kernel macros
|
||||||
math sequences ;
|
math sequences ;
|
||||||
IN: combinators.short-circuit
|
in: combinators.short-circuit
|
||||||
|
|
||||||
<PRIVATE
|
<PRIVATE
|
||||||
|
|
||||||
|
|
|
@ -1,7 +1,7 @@
|
||||||
! Copyright (C) 2008 Doug Coleman.
|
! Copyright (C) 2008 Doug Coleman.
|
||||||
! See http://factorcode.org/license.txt for BSD license.
|
! See http://factorcode.org/license.txt for BSD license.
|
||||||
USING: help.markup help.syntax io.streams.string quotations ;
|
USING: help.markup help.syntax io.streams.string quotations ;
|
||||||
IN: combinators.short-circuit.smart
|
in: combinators.short-circuit.smart
|
||||||
|
|
||||||
HELP: &&
|
HELP: &&
|
||||||
{ $values
|
{ $values
|
||||||
|
|
|
@ -1,6 +1,6 @@
|
||||||
USING: kernel sequences math stack-checker effects accessors
|
USING: kernel sequences math stack-checker effects accessors
|
||||||
macros fry combinators.short-circuit ;
|
macros fry combinators.short-circuit ;
|
||||||
IN: combinators.short-circuit.smart
|
in: combinators.short-circuit.smart
|
||||||
|
|
||||||
<PRIVATE
|
<PRIVATE
|
||||||
|
|
||||||
|
|
|
@ -1,6 +1,6 @@
|
||||||
USING: help.markup help.syntax parser vocabs.loader strings
|
USING: help.markup help.syntax parser vocabs.loader strings
|
||||||
vocabs ;
|
vocabs ;
|
||||||
IN: command-line
|
in: command-line
|
||||||
|
|
||||||
HELP: run-bootstrap-init
|
HELP: run-bootstrap-init
|
||||||
{ $description "Runs the bootstrap initialization file in the user's home directory, unless the " { $snippet "-no-user-init" } " command line switch was given. This file is named " { $snippet ".factor-boot-rc" } "." } ;
|
{ $description "Runs the bootstrap initialization file in the user's home directory, unless the " { $snippet "-no-user-init" } " command line switch was given. This file is named " { $snippet ".factor-boot-rc" } "." } ;
|
||||||
|
|
|
@ -4,10 +4,10 @@ USING: accessors alien.strings assocs continuations fry init
|
||||||
io.encodings.utf8 io.files io.pathnames kernel kernel.private
|
io.encodings.utf8 io.files io.pathnames kernel kernel.private
|
||||||
namespaces parser parser.notes sequences source-files
|
namespaces parser parser.notes sequences source-files
|
||||||
source-files.errors splitting system vocabs.loader ;
|
source-files.errors splitting system vocabs.loader ;
|
||||||
IN: command-line
|
in: command-line
|
||||||
|
|
||||||
SYMBOL: user-init-errors
|
symbol: user-init-errors
|
||||||
SYMBOL: +user-init-error+
|
symbol: +user-init-error+
|
||||||
|
|
||||||
TUPLE: user-init-error error path line# asset ;
|
TUPLE: user-init-error error path line# asset ;
|
||||||
|
|
||||||
|
@ -18,9 +18,9 @@ M: user-init-error error-file path>> ;
|
||||||
M: user-init-error error-line line#>> ;
|
M: user-init-error error-line line#>> ;
|
||||||
M: user-init-error error-type drop +user-init-error+ ;
|
M: user-init-error error-type drop +user-init-error+ ;
|
||||||
|
|
||||||
SYMBOL: executable
|
symbol: executable
|
||||||
SYMBOL: script
|
symbol: script
|
||||||
SYMBOL: command-line
|
symbol: command-line
|
||||||
|
|
||||||
: (command-line) ( -- args )
|
: (command-line) ( -- args )
|
||||||
OBJ-ARGS special-object sift [ alien>native-string ] map ;
|
OBJ-ARGS special-object sift [ alien>native-string ] map ;
|
||||||
|
@ -84,7 +84,7 @@ SYMBOL: command-line
|
||||||
unclip executable set
|
unclip executable set
|
||||||
(parse-command-line) ;
|
(parse-command-line) ;
|
||||||
|
|
||||||
SYMBOL: main-vocab-hook
|
symbol: main-vocab-hook
|
||||||
|
|
||||||
: main-vocab ( -- vocab )
|
: main-vocab ( -- vocab )
|
||||||
embedded? [
|
embedded? [
|
||||||
|
|
|
@ -1,6 +1,6 @@
|
||||||
USING: accessors debugger io kernel make math.parser
|
USING: accessors debugger io kernel make math.parser
|
||||||
prettyprint command-line summary ;
|
prettyprint command-line summary ;
|
||||||
IN: command-line.debugger
|
in: command-line.debugger
|
||||||
|
|
||||||
M: user-init-error error.
|
M: user-init-error error.
|
||||||
error>> error. ;
|
error>> error. ;
|
||||||
|
|
|
@ -2,7 +2,7 @@
|
||||||
! See http://factorcode.org/license.txt for BSD license.
|
! See http://factorcode.org/license.txt for BSD license.
|
||||||
USING: command-line eval io io.pathnames kernel namespaces
|
USING: command-line eval io io.pathnames kernel namespaces
|
||||||
sequences system vocabs.loader ;
|
sequences system vocabs.loader ;
|
||||||
IN: command-line.startup
|
in: command-line.startup
|
||||||
|
|
||||||
: cli-usage ( -- )
|
: cli-usage ( -- )
|
||||||
"Usage: " write vm-path file-name write " [Factor arguments] [script] [script arguments]
|
"Usage: " write vm-path file-name write " [Factor arguments] [script] [script arguments]
|
||||||
|
|
|
@ -1,4 +1,4 @@
|
||||||
IN: compiler.errors
|
in: compiler.errors
|
||||||
USING: help.markup help.syntax vocabs.loader words io
|
USING: help.markup help.syntax vocabs.loader words io
|
||||||
quotations words.symbol ;
|
quotations words.symbol ;
|
||||||
|
|
||||||
|
|
|
@ -2,10 +2,10 @@
|
||||||
! See http://factorcode.org/license.txt for BSD license.
|
! See http://factorcode.org/license.txt for BSD license.
|
||||||
USING: accessors assocs command-line fry kernel namespaces
|
USING: accessors assocs command-line fry kernel namespaces
|
||||||
source-files.errors summary ;
|
source-files.errors summary ;
|
||||||
IN: compiler.errors
|
in: compiler.errors
|
||||||
|
|
||||||
SYMBOL: +compiler-error+
|
symbol: +compiler-error+
|
||||||
SYMBOL: compiler-errors
|
symbol: compiler-errors
|
||||||
|
|
||||||
compiler-errors [ H{ } clone ] initialize
|
compiler-errors [ H{ } clone ] initialize
|
||||||
|
|
||||||
|
@ -13,8 +13,8 @@ TUPLE: compiler-error < source-file-error ;
|
||||||
|
|
||||||
M: compiler-error error-type drop +compiler-error+ ;
|
M: compiler-error error-type drop +compiler-error+ ;
|
||||||
|
|
||||||
SYMBOL: +linkage-error+
|
symbol: +linkage-error+
|
||||||
SYMBOL: linkage-errors
|
symbol: linkage-errors
|
||||||
|
|
||||||
linkage-errors [ H{ } clone ] initialize
|
linkage-errors [ H{ } clone ] initialize
|
||||||
|
|
||||||
|
|
|
@ -1,7 +1,7 @@
|
||||||
USING: compiler.units.private definitions help.markup help.syntax kernel
|
USING: compiler.units.private definitions help.markup help.syntax kernel
|
||||||
kernel.private parser quotations sequences source-files stack-checker.errors
|
kernel.private parser quotations sequences source-files stack-checker.errors
|
||||||
words ;
|
words ;
|
||||||
IN: compiler.units
|
in: compiler.units
|
||||||
|
|
||||||
ARTICLE: "compilation-units-internals" "Compilation units internals"
|
ARTICLE: "compilation-units-internals" "Compilation units internals"
|
||||||
"These words do not need to be called directly, and only serve to support the implementation."
|
"These words do not need to be called directly, and only serve to support the implementation."
|
||||||
|
|
|
@ -1,6 +1,6 @@
|
||||||
USING: arrays compiler compiler.units definitions eval fry
|
USING: arrays compiler compiler.units definitions eval fry
|
||||||
kernel math namespaces quotations sequences tools.test words ;
|
kernel math namespaces quotations sequences tools.test words ;
|
||||||
IN: compiler.units.tests
|
in: compiler.units.tests
|
||||||
|
|
||||||
[ [ [ ] define-temp ] with-compilation-unit ] must-infer
|
[ [ [ ] define-temp ] with-compilation-unit ] must-infer
|
||||||
[ [ [ ] define-temp ] with-nested-compilation-unit ] must-infer
|
[ [ [ ] define-temp ] with-nested-compilation-unit ] must-infer
|
||||||
|
@ -30,11 +30,11 @@ IN: compiler.units.tests
|
||||||
] unit-test
|
] unit-test
|
||||||
|
|
||||||
! Check that we notify observers
|
! Check that we notify observers
|
||||||
SINGLETON: observer
|
singleton: observer
|
||||||
|
|
||||||
observer add-definition-observer
|
observer add-definition-observer
|
||||||
|
|
||||||
SYMBOL: counter
|
symbol: counter
|
||||||
|
|
||||||
0 counter set-global
|
0 counter set-global
|
||||||
|
|
||||||
|
|
|
@ -4,12 +4,12 @@ USING: accessors arrays assocs classes classes.private
|
||||||
classes.tuple.private continuations definitions generic
|
classes.tuple.private continuations definitions generic
|
||||||
hash-sets init kernel kernel.private math namespaces sequences
|
hash-sets init kernel kernel.private math namespaces sequences
|
||||||
sets source-files.errors vocabs words ;
|
sets source-files.errors vocabs words ;
|
||||||
IN: compiler.units
|
in: compiler.units
|
||||||
|
|
||||||
PRIMITIVE: modify-code-heap ( alist update-existing? reset-pics? -- )
|
PRIMITIVE: modify-code-heap ( alist update-existing? reset-pics? -- )
|
||||||
|
|
||||||
SYMBOL: old-definitions
|
symbol: old-definitions
|
||||||
SYMBOL: new-definitions
|
symbol: new-definitions
|
||||||
|
|
||||||
TUPLE: redefine-error def ;
|
TUPLE: redefine-error def ;
|
||||||
|
|
||||||
|
@ -42,7 +42,7 @@ PRIVATE>
|
||||||
new-definitions get [ in? ] with any? not
|
new-definitions get [ in? ] with any? not
|
||||||
] [ drop f ] if ;
|
] [ drop f ] if ;
|
||||||
|
|
||||||
SYMBOL: compiler-impl
|
symbol: compiler-impl
|
||||||
|
|
||||||
HOOK: update-call-sites compiler-impl ( class generic -- words )
|
HOOK: update-call-sites compiler-impl ( class generic -- words )
|
||||||
|
|
||||||
|
@ -84,7 +84,7 @@ M: f process-forgotten-words drop ;
|
||||||
|
|
||||||
: <definitions> ( -- pair ) { HS{ } HS{ } } [ clone ] map ;
|
: <definitions> ( -- pair ) { HS{ } HS{ } } [ clone ] map ;
|
||||||
|
|
||||||
SYMBOL: definition-observers
|
symbol: definition-observers
|
||||||
|
|
||||||
GENERIC: definitions-changed ( set obj -- )
|
GENERIC: definitions-changed ( set obj -- )
|
||||||
|
|
||||||
|
|
|
@ -1,6 +1,6 @@
|
||||||
USING: continuations.private help.markup help.syntax kernel
|
USING: continuations.private help.markup help.syntax kernel
|
||||||
kernel.private lexer namespaces quotations sequences vectors ;
|
kernel.private lexer namespaces quotations sequences vectors ;
|
||||||
IN: continuations
|
in: continuations
|
||||||
|
|
||||||
ARTICLE: "errors-restartable" "Restartable errors"
|
ARTICLE: "errors-restartable" "Restartable errors"
|
||||||
"Support for restartable errors is built on top of the basic error handling facility. The following words signals recoverable errors:"
|
"Support for restartable errors is built on top of the basic error handling facility. The following words signals recoverable errors:"
|
||||||
|
|
|
@ -1,7 +1,7 @@
|
||||||
USING: accessors continuations debugger eval io kernel
|
USING: accessors continuations debugger eval io kernel
|
||||||
kernel.private math memory namespaces sequences tools.test
|
kernel.private math memory namespaces sequences tools.test
|
||||||
vectors words ;
|
vectors words ;
|
||||||
IN: continuations.tests
|
in: continuations.tests
|
||||||
|
|
||||||
: (callcc1-test) ( n obj -- n' obj )
|
: (callcc1-test) ( n obj -- n' obj )
|
||||||
[ 1 - dup ] dip ?push
|
[ 1 - dup ] dip ?push
|
||||||
|
@ -62,8 +62,8 @@ IN: continuations.tests
|
||||||
|
|
||||||
{ 1 } [ "c" get innermost-frame-scan ] unit-test
|
{ 1 } [ "c" get innermost-frame-scan ] unit-test
|
||||||
|
|
||||||
SYMBOL: always-counter
|
symbol: always-counter
|
||||||
SYMBOL: error-counter
|
symbol: error-counter
|
||||||
|
|
||||||
H{
|
H{
|
||||||
{ always-counter 0 }
|
{ always-counter 0 }
|
||||||
|
|
|
@ -2,7 +2,7 @@
|
||||||
! See http://factorcode.org/license.txt for BSD license.
|
! See http://factorcode.org/license.txt for BSD license.
|
||||||
USING: accessors assocs combinators combinators.private kernel
|
USING: accessors assocs combinators combinators.private kernel
|
||||||
kernel.private make namespaces sequences vectors ;
|
kernel.private make namespaces sequences vectors ;
|
||||||
IN: continuations
|
in: continuations
|
||||||
|
|
||||||
: with-datastack ( stack quot -- new-stack )
|
: with-datastack ( stack quot -- new-stack )
|
||||||
[
|
[
|
||||||
|
@ -11,11 +11,11 @@ IN: continuations
|
||||||
swap [ set-datastack ] dip
|
swap [ set-datastack ] dip
|
||||||
] ( stack quot -- new-stack ) call-effect-unsafe ;
|
] ( stack quot -- new-stack ) call-effect-unsafe ;
|
||||||
|
|
||||||
SYMBOL: original-error
|
symbol: original-error
|
||||||
SYMBOL: error
|
symbol: error
|
||||||
SYMBOL: error-continuation
|
symbol: error-continuation
|
||||||
SYMBOL: error-thread
|
symbol: error-thread
|
||||||
SYMBOL: restarts
|
symbol: restarts
|
||||||
|
|
||||||
<PRIVATE
|
<PRIVATE
|
||||||
|
|
||||||
|
@ -97,7 +97,7 @@ PRIVATE>
|
||||||
: continue ( continuation -- * )
|
: continue ( continuation -- * )
|
||||||
f swap continue-with ;
|
f swap continue-with ;
|
||||||
|
|
||||||
SYMBOL: return-continuation
|
symbol: return-continuation
|
||||||
|
|
||||||
: with-return ( quot -- )
|
: with-return ( quot -- )
|
||||||
[ return-continuation ] dip [ with-variable ] 2curry callcc0 ; inline
|
[ return-continuation ] dip [ with-variable ] 2curry callcc0 ; inline
|
||||||
|
@ -117,14 +117,14 @@ PRIVATE>
|
||||||
|
|
||||||
GENERIC: error-in-thread ( error thread -- * )
|
GENERIC: error-in-thread ( error thread -- * )
|
||||||
|
|
||||||
SYMBOL: thread-error-hook ! ( error thread -- * )
|
symbol: thread-error-hook ! ( error thread -- * )
|
||||||
|
|
||||||
M: object error-in-thread
|
M: object error-in-thread
|
||||||
thread-error-hook get-global call( error thread -- * ) ;
|
thread-error-hook get-global call( error thread -- * ) ;
|
||||||
|
|
||||||
: in-callback? ( -- ? ) CONTEXT-OBJ-IN-CALLBACK-P context-object ;
|
: in-callback? ( -- ? ) CONTEXT-OBJ-IN-CALLBACK-P context-object ;
|
||||||
|
|
||||||
SYMBOL: callback-error-hook ! ( error -- * )
|
symbol: callback-error-hook ! ( error -- * )
|
||||||
|
|
||||||
: rethrow ( error -- * )
|
: rethrow ( error -- * )
|
||||||
dup save-error
|
dup save-error
|
||||||
|
|
|
@ -2,7 +2,7 @@ USING: alien assocs classes compiler.cfg.instructions
|
||||||
compiler.cfg.registers compiler.cfg.stack-frame cpu.x86.assembler
|
compiler.cfg.registers compiler.cfg.stack-frame cpu.x86.assembler
|
||||||
cpu.x86.assembler.operands help.markup help.syntax kernel layouts
|
cpu.x86.assembler.operands help.markup help.syntax kernel layouts
|
||||||
literals math multiline sequences strings system vm words ;
|
literals math multiline sequences strings system vm words ;
|
||||||
IN: cpu.architecture
|
in: cpu.architecture
|
||||||
|
|
||||||
<<
|
<<
|
||||||
STRING: ex-%allot
|
STRING: ex-%allot
|
||||||
|
|
|
@ -1,7 +1,7 @@
|
||||||
USING: accessors compiler.cfg compiler.cfg.instructions
|
USING: accessors compiler.cfg compiler.cfg.instructions
|
||||||
compiler.cfg.stack-frame compiler.cfg.utilities cpu.architecture
|
compiler.cfg.stack-frame compiler.cfg.utilities cpu.architecture
|
||||||
cpu.x86 kernel layouts math namespaces system tools.test ;
|
cpu.x86 kernel layouts math namespaces system tools.test ;
|
||||||
IN: cpu.architecture.tests
|
in: cpu.architecture.tests
|
||||||
|
|
||||||
: cfg-w-spill-area-base ( base -- cfg )
|
: cfg-w-spill-area-base ( base -- cfg )
|
||||||
stack-frame new swap >>spill-area-base
|
stack-frame new swap >>spill-area-base
|
||||||
|
|
|
@ -4,13 +4,13 @@ USING: accessors arrays assocs generic kernel kernel.private
|
||||||
math math.order memory namespaces make sequences layouts system
|
math math.order memory namespaces make sequences layouts system
|
||||||
hashtables classes alien byte-arrays combinators words sets fry
|
hashtables classes alien byte-arrays combinators words sets fry
|
||||||
;
|
;
|
||||||
IN: cpu.architecture
|
in: cpu.architecture
|
||||||
|
|
||||||
! Representations -- these are like low-level types
|
! Representations -- these are like low-level types
|
||||||
|
|
||||||
! Unknown representation; this is used for ##copy instructions which
|
! Unknown representation; this is used for ##copy instructions which
|
||||||
! get eliminated later
|
! get eliminated later
|
||||||
SINGLETON: any-rep
|
singleton: any-rep
|
||||||
|
|
||||||
! Integer registers can contain data with one of these three representations
|
! Integer registers can contain data with one of these three representations
|
||||||
! tagged-rep: tagged pointer or fixnum
|
! tagged-rep: tagged pointer or fixnum
|
||||||
|
|
|
@ -1,6 +1,6 @@
|
||||||
USING: generic hash-sets help.markup help.syntax words math source-files
|
USING: generic hash-sets help.markup help.syntax words math source-files
|
||||||
parser quotations compiler.units ;
|
parser quotations compiler.units ;
|
||||||
IN: definitions
|
in: definitions
|
||||||
|
|
||||||
ARTICLE: "definition-protocol" "Definition protocol"
|
ARTICLE: "definition-protocol" "Definition protocol"
|
||||||
"A common protocol is used to build generic tools for working with all definitions."
|
"A common protocol is used to build generic tools for working with all definitions."
|
||||||
|
|
|
@ -1,18 +1,18 @@
|
||||||
USING: arrays bit-arrays byte-arrays compiler.units definitions
|
USING: arrays bit-arrays byte-arrays compiler.units definitions
|
||||||
tools.test ;
|
tools.test ;
|
||||||
IN: definitions.tests
|
in: definitions.tests
|
||||||
|
|
||||||
GENERIC: some-generic ( a -- b )
|
GENERIC: some-generic ( a -- b )
|
||||||
|
|
||||||
USE: arrays
|
use: arrays
|
||||||
|
|
||||||
M: array some-generic ;
|
M: array some-generic ;
|
||||||
|
|
||||||
USE: bit-arrays
|
use: bit-arrays
|
||||||
|
|
||||||
M: bit-array some-generic ;
|
M: bit-array some-generic ;
|
||||||
|
|
||||||
USE: byte-arrays
|
use: byte-arrays
|
||||||
|
|
||||||
M: byte-array some-generic ;
|
M: byte-array some-generic ;
|
||||||
|
|
||||||
|
|
|
@ -1,7 +1,7 @@
|
||||||
! Copyright (C) 2006, 2010 Slava Pestov.
|
! Copyright (C) 2006, 2010 Slava Pestov.
|
||||||
! See http://factorcode.org/license.txt for BSD license.
|
! See http://factorcode.org/license.txt for BSD license.
|
||||||
USING: accessors assocs kernel namespaces sequences sets ;
|
USING: accessors assocs kernel namespaces sequences sets ;
|
||||||
IN: definitions
|
in: definitions
|
||||||
|
|
||||||
MIXIN: definition-mixin
|
MIXIN: definition-mixin
|
||||||
|
|
||||||
|
@ -10,21 +10,21 @@ ERROR: no-compilation-unit definition ;
|
||||||
: add-to-unit ( key set -- )
|
: add-to-unit ( key set -- )
|
||||||
[ adjoin ] [ no-compilation-unit ] if* ;
|
[ adjoin ] [ no-compilation-unit ] if* ;
|
||||||
|
|
||||||
SYMBOL: changed-definitions
|
symbol: changed-definitions
|
||||||
|
|
||||||
: changed-definition ( defspec -- )
|
: changed-definition ( defspec -- )
|
||||||
changed-definitions get add-to-unit ;
|
changed-definitions get add-to-unit ;
|
||||||
|
|
||||||
SYMBOL: maybe-changed
|
symbol: maybe-changed
|
||||||
|
|
||||||
: changed-conditionally ( class -- )
|
: changed-conditionally ( class -- )
|
||||||
maybe-changed get add-to-unit ;
|
maybe-changed get add-to-unit ;
|
||||||
|
|
||||||
SYMBOL: changed-effects
|
symbol: changed-effects
|
||||||
|
|
||||||
SYMBOL: outdated-generics
|
symbol: outdated-generics
|
||||||
|
|
||||||
SYMBOL: new-words
|
symbol: new-words
|
||||||
|
|
||||||
: new-word ( word -- )
|
: new-word ( word -- )
|
||||||
new-words get add-to-unit ;
|
new-words get add-to-unit ;
|
||||||
|
@ -37,7 +37,7 @@ GENERIC: set-where ( loc defspec -- )
|
||||||
|
|
||||||
GENERIC: forget* ( defspec -- )
|
GENERIC: forget* ( defspec -- )
|
||||||
|
|
||||||
SYMBOL: forgotten-definitions
|
symbol: forgotten-definitions
|
||||||
|
|
||||||
: forgotten-definition ( defspec -- )
|
: forgotten-definition ( defspec -- )
|
||||||
forgotten-definitions get add-to-unit ;
|
forgotten-definitions get add-to-unit ;
|
||||||
|
|
|
@ -1,5 +1,5 @@
|
||||||
USING: help.syntax help.markup delegate.private ;
|
USING: help.syntax help.markup delegate.private ;
|
||||||
IN: delegate
|
in: delegate
|
||||||
|
|
||||||
HELP: define-protocol
|
HELP: define-protocol
|
||||||
{ $values { "protocol" "a word for the new protocol" } { "wordlist" "a sequence of words" } }
|
{ $values { "protocol" "a word for the new protocol" } { "wordlist" "a sequence of words" } }
|
||||||
|
|
|
@ -2,7 +2,7 @@ USING: delegate kernel arrays tools.test words math definitions
|
||||||
compiler.units parser generic prettyprint io.streams.string
|
compiler.units parser generic prettyprint io.streams.string
|
||||||
accessors eval multiline generic.single delegate.protocols
|
accessors eval multiline generic.single delegate.protocols
|
||||||
delegate.private assocs see make ;
|
delegate.private assocs see make ;
|
||||||
IN: delegate.tests
|
in: delegate.tests
|
||||||
|
|
||||||
TUPLE: hello this that ;
|
TUPLE: hello this that ;
|
||||||
C: <hello> hello
|
C: <hello> hello
|
||||||
|
|
|
@ -5,7 +5,7 @@ USING: accessors arrays assocs classes.tuple definitions effects generic
|
||||||
generic.standard hashtables kernel lexer math parser
|
generic.standard hashtables kernel lexer math parser
|
||||||
generic.parser sequences sets slots words words.symbol fry
|
generic.parser sequences sets slots words words.symbol fry
|
||||||
compiler.units make ;
|
compiler.units make ;
|
||||||
IN: delegate
|
in: delegate
|
||||||
|
|
||||||
ERROR: broadcast-words-must-have-no-outputs group ;
|
ERROR: broadcast-words-must-have-no-outputs group ;
|
||||||
|
|
||||||
|
|
|
@ -1,7 +1,7 @@
|
||||||
! Copyright (C) 2007 Daniel Ehrenberg
|
! Copyright (C) 2007 Daniel Ehrenberg
|
||||||
! See http://factorcode.org/license.txt for BSD license.
|
! See http://factorcode.org/license.txt for BSD license.
|
||||||
USING: assocs delegate io sequences sequences.private sets ;
|
USING: assocs delegate io sequences sequences.private sets ;
|
||||||
IN: delegate.protocols
|
in: delegate.protocols
|
||||||
|
|
||||||
PROTOCOL: sequence-protocol
|
PROTOCOL: sequence-protocol
|
||||||
like new-sequence new-resizable nth nth-unsafe
|
like new-sequence new-resizable nth nth-unsafe
|
||||||
|
|
|
@ -1,5 +1,5 @@
|
||||||
USING: classes help.markup help.syntax io quotations sequences ;
|
USING: classes help.markup help.syntax io quotations sequences ;
|
||||||
IN: destructors
|
in: destructors
|
||||||
|
|
||||||
HELP: debug-leaks?
|
HELP: debug-leaks?
|
||||||
{ $var-description "When this variable is on, " { $link new-disposable } " stores the current continuation in the " { $link disposable } "'s " { $slot "continuation" } " slot." }
|
{ $var-description "When this variable is on, " { $link new-disposable } " stores the current continuation in the " { $link disposable } "'s " { $slot "continuation" } " slot." }
|
||||||
|
|
|
@ -1,6 +1,6 @@
|
||||||
USING: accessors continuations destructors destructors.private
|
USING: accessors continuations destructors destructors.private
|
||||||
kernel namespaces sequences tools.test ;
|
kernel namespaces sequences tools.test ;
|
||||||
IN: destructors.tests
|
in: destructors.tests
|
||||||
|
|
||||||
TUPLE: dispose-error ;
|
TUPLE: dispose-error ;
|
||||||
|
|
||||||
|
|
|
@ -2,13 +2,13 @@
|
||||||
! See http://factorcode.org/license.txt for BSD license.
|
! See http://factorcode.org/license.txt for BSD license.
|
||||||
USING: accessors assocs continuations init kernel namespaces
|
USING: accessors assocs continuations init kernel namespaces
|
||||||
sequences sets ;
|
sequences sets ;
|
||||||
IN: destructors
|
in: destructors
|
||||||
|
|
||||||
SYMBOL: disposables
|
symbol: disposables
|
||||||
|
|
||||||
ERROR: already-unregistered disposable ;
|
ERROR: already-unregistered disposable ;
|
||||||
|
|
||||||
SYMBOL: debug-leaks?
|
symbol: debug-leaks?
|
||||||
|
|
||||||
<PRIVATE
|
<PRIVATE
|
||||||
|
|
||||||
|
@ -63,9 +63,9 @@ M: disposable dispose
|
||||||
|
|
||||||
<PRIVATE
|
<PRIVATE
|
||||||
|
|
||||||
SYMBOL: always-destructors
|
symbol: always-destructors
|
||||||
|
|
||||||
SYMBOL: error-destructors
|
symbol: error-destructors
|
||||||
|
|
||||||
: do-always-destructors ( -- )
|
: do-always-destructors ( -- )
|
||||||
always-destructors get <reversed> dispose-each ;
|
always-destructors get <reversed> dispose-each ;
|
||||||
|
|
|
@ -1,6 +1,6 @@
|
||||||
USING: arrays classes help.markup help.syntax kernel math
|
USING: arrays classes help.markup help.syntax kernel math
|
||||||
sequences strings words ;
|
sequences strings words ;
|
||||||
IN: effects
|
in: effects
|
||||||
|
|
||||||
ARTICLE: "effects" "Stack effect declarations"
|
ARTICLE: "effects" "Stack effect declarations"
|
||||||
"Word definition words such as " { $link POSTPONE: : } " and " { $link POSTPONE: GENERIC: } " have a " { $emphasis "stack effect declaration" } " as part of their syntax. A stack effect declaration takes the following form:"
|
"Word definition words such as " { $link POSTPONE: : } " and " { $link POSTPONE: GENERIC: } " have a " { $emphasis "stack effect declaration" } " as part of their syntax. A stack effect declaration takes the following form:"
|
||||||
|
|
|
@ -1,6 +1,6 @@
|
||||||
USING: accessors effects effects.parser eval kernel prettyprint
|
USING: accessors effects effects.parser eval kernel prettyprint
|
||||||
sequences tools.test math ;
|
sequences tools.test math ;
|
||||||
IN: effects.tests
|
in: effects.tests
|
||||||
|
|
||||||
{ t } [ { "a" } { "a" } <effect> { "a" "b" } { "a" "b" } <effect> effect<= ] unit-test
|
{ t } [ { "a" } { "a" } <effect> { "a" "b" } { "a" "b" } <effect> effect<= ] unit-test
|
||||||
{ f } [ { "a" } { } <effect> { "a" "b" } { "a" "b" } <effect> effect<= ] unit-test
|
{ f } [ { "a" } { } <effect> { "a" "b" } { "a" "b" } <effect> effect<= ] unit-test
|
||||||
|
|
Some files were not shown because too many files have changed in this diff Show More
Loading…
Reference in New Issue