factor: ALIEN: to alien:
parent
5507c2b676
commit
2114b7efc5
|
@ -46,7 +46,7 @@ SPECIALIZED-ARRAY: foo
|
||||||
{ f } [ B{ } binary-zero? ] unit-test
|
{ f } [ B{ } binary-zero? ] unit-test
|
||||||
{ t } [ S{ foo f 0 f f } binary-zero? ] unit-test
|
{ t } [ S{ foo f 0 f f } binary-zero? ] unit-test
|
||||||
{ f } [ S{ foo f 1 f f } binary-zero? ] unit-test
|
{ f } [ S{ foo f 1 f f } binary-zero? ] unit-test
|
||||||
{ f } [ S{ foo f 0 ALIEN: 8 f } binary-zero? ] unit-test
|
{ f } [ S{ foo f 0 alien: 8 f } binary-zero? ] unit-test
|
||||||
{ f } [ S{ foo f 0 f t } binary-zero? ] unit-test
|
{ f } [ S{ foo f 0 f t } binary-zero? ] unit-test
|
||||||
{ t t f } [
|
{ t t f } [
|
||||||
foo-array{
|
foo-array{
|
||||||
|
|
|
@ -11,7 +11,7 @@ M: alien pprint*
|
||||||
{
|
{
|
||||||
{ [ dup expired? ] [ drop \ BAD-ALIEN pprint-word ] }
|
{ [ dup expired? ] [ drop \ BAD-ALIEN pprint-word ] }
|
||||||
{ [ dup pinned-c-ptr? not ] [ drop "( displaced alien )" text ] }
|
{ [ dup pinned-c-ptr? not ] [ drop "( displaced alien )" text ] }
|
||||||
[ \ ALIEN: [ alien-address >hex text ] pprint-prefix ]
|
[ \ alien: [ alien-address >hex text ] pprint-prefix ]
|
||||||
} cond ;
|
} cond ;
|
||||||
|
|
||||||
M: dll pprint* dll-path dup "DLL\" " "\"" pprint-string ;
|
M: dll pprint* dll-path dup "DLL\" " "\"" pprint-string ;
|
||||||
|
|
|
@ -7,15 +7,15 @@ HELP: DLL"
|
||||||
{ $values { "path" "a pathname string" } }
|
{ $values { "path" "a pathname string" } }
|
||||||
{ $description "Constructs a DLL handle at parse time." } ;
|
{ $description "Constructs a DLL handle at parse time." } ;
|
||||||
|
|
||||||
HELP: ALIEN:
|
HELP: alien:
|
||||||
{ $syntax "ALIEN: address" }
|
{ $syntax "alien: address" }
|
||||||
{ $values { "address" "a non-negative hexadecimal integer" } }
|
{ $values { "address" "a non-negative hexadecimal integer" } }
|
||||||
{ $description "Creates an alien object at parse time." }
|
{ $description "Creates an alien object at parse time." }
|
||||||
{ $notes "Alien objects are invalidated between image saves and loads, and hence source files should not contain alien literals; this word is for interactive use only. See " { $link "alien-expiry" } " for details." } ;
|
{ $notes "Alien objects are invalidated between image saves and loads, and hence source files should not contain alien literals; this word is for interactive use only. See " { $link "alien-expiry" } " for details." } ;
|
||||||
|
|
||||||
ARTICLE: "syntax-aliens" "Alien object literal syntax"
|
ARTICLE: "syntax-aliens" "Alien object literal syntax"
|
||||||
{ $subsections
|
{ $subsections
|
||||||
postpone: ALIEN:
|
postpone: alien:
|
||||||
postpone: DLL"
|
postpone: DLL"
|
||||||
} ;
|
} ;
|
||||||
|
|
||||||
|
|
|
@ -8,7 +8,7 @@ IN: alien.syntax
|
||||||
|
|
||||||
SYNTAX: \DLL" lexer get skip-blank parse-string dlopen suffix! ;
|
SYNTAX: \DLL" lexer get skip-blank parse-string dlopen suffix! ;
|
||||||
|
|
||||||
SYNTAX: \ALIEN: 16 scan-base <alien> suffix! ;
|
SYNTAX: \alien: 16 scan-base <alien> suffix! ;
|
||||||
|
|
||||||
SYNTAX: \BAD-ALIEN <bad-alien> suffix! ;
|
SYNTAX: \BAD-ALIEN <bad-alien> suffix! ;
|
||||||
|
|
||||||
|
|
|
@ -451,7 +451,7 @@ TUPLE: myseq { underlying1 byte-array read-only } { underlying2 byte-array read-
|
||||||
] unit-test
|
] unit-test
|
||||||
|
|
||||||
! ##box-displaced-alien is a def-is-use instruction
|
! ##box-displaced-alien is a def-is-use instruction
|
||||||
[ ALIEN: 3e9 ] [
|
[ alien: 3e9 ] [
|
||||||
[
|
[
|
||||||
f
|
f
|
||||||
100 [ 10 swap <displaced-alien> ] times
|
100 [ 10 swap <displaced-alien> ] times
|
||||||
|
|
|
@ -437,8 +437,8 @@ ERROR: bug-in-fixnum* x y a b ;
|
||||||
[ ] [ "s" get free ] unit-test
|
[ ] [ "s" get free ] unit-test
|
||||||
] when
|
] when
|
||||||
|
|
||||||
[ ALIEN: 1234 ] [ ALIEN: 1234 [ { alien } declare void* <ref> ] compile-call void* deref ] unit-test
|
[ alien: 1234 ] [ alien: 1234 [ { alien } declare void* <ref> ] compile-call void* deref ] unit-test
|
||||||
[ ALIEN: 1234 ] [ ALIEN: 1234 [ { c-ptr } declare void* <ref> ] compile-call void* deref ] unit-test
|
[ alien: 1234 ] [ alien: 1234 [ { c-ptr } declare void* <ref> ] compile-call void* deref ] unit-test
|
||||||
[ f ] [ f [ { postpone: f } declare void* <ref> ] compile-call void* deref ] unit-test
|
[ f ] [ f [ { postpone: f } declare void* <ref> ] compile-call void* deref ] unit-test
|
||||||
|
|
||||||
[ 252 ] [ B{ 1 2 3 -4 5 } 3 [ { byte-array fixnum } declare alien-unsigned-1 ] compile-call ] unit-test
|
[ 252 ] [ B{ 1 2 3 -4 5 } 3 [ { byte-array fixnum } declare alien-unsigned-1 ] compile-call ] unit-test
|
||||||
|
@ -478,15 +478,15 @@ ERROR: bug-in-fixnum* x y a b ;
|
||||||
] compile-call
|
] compile-call
|
||||||
] unit-test
|
] unit-test
|
||||||
|
|
||||||
[ ALIEN: 123 ] [
|
[ alien: 123 ] [
|
||||||
0x123 [ <alien> ] compile-call
|
0x123 [ <alien> ] compile-call
|
||||||
] unit-test
|
] unit-test
|
||||||
|
|
||||||
[ ALIEN: 123 ] [
|
[ alien: 123 ] [
|
||||||
0x123 [ { fixnum } declare <alien> ] compile-call
|
0x123 [ { fixnum } declare <alien> ] compile-call
|
||||||
] unit-test
|
] unit-test
|
||||||
|
|
||||||
[ ALIEN: 123 ] [
|
[ alien: 123 ] [
|
||||||
[ 0x123 <alien> ] compile-call
|
[ 0x123 <alien> ] compile-call
|
||||||
] unit-test
|
] unit-test
|
||||||
|
|
||||||
|
@ -502,16 +502,16 @@ ERROR: bug-in-fixnum* x y a b ;
|
||||||
[ 0 <alien> ] compile-call
|
[ 0 <alien> ] compile-call
|
||||||
] unit-test
|
] unit-test
|
||||||
|
|
||||||
[ ALIEN: 321 ] [
|
[ alien: 321 ] [
|
||||||
0 ALIEN: 321 [ <displaced-alien> ] compile-call
|
0 alien: 321 [ <displaced-alien> ] compile-call
|
||||||
] unit-test
|
] unit-test
|
||||||
|
|
||||||
[ ALIEN: 321 ] [
|
[ alien: 321 ] [
|
||||||
0 ALIEN: 321 [ { fixnum c-ptr } declare <displaced-alien> ] compile-call
|
0 alien: 321 [ { fixnum c-ptr } declare <displaced-alien> ] compile-call
|
||||||
] unit-test
|
] unit-test
|
||||||
|
|
||||||
[ ALIEN: 321 ] [
|
[ alien: 321 ] [
|
||||||
ALIEN: 321 [ 0 swap <displaced-alien> ] compile-call
|
alien: 321 [ 0 swap <displaced-alien> ] compile-call
|
||||||
] unit-test
|
] unit-test
|
||||||
|
|
||||||
[ B{ 0 1 2 3 4 } ] [
|
[ B{ 0 1 2 3 4 } ] [
|
||||||
|
@ -526,8 +526,8 @@ ERROR: bug-in-fixnum* x y a b ;
|
||||||
underlying>>
|
underlying>>
|
||||||
] unit-test
|
] unit-test
|
||||||
|
|
||||||
[ ALIEN: 1234 ALIEN: 2234 ] [
|
[ alien: 1234 alien: 2234 ] [
|
||||||
ALIEN: 234 [
|
alien: 234 [
|
||||||
{ c-ptr } declare
|
{ c-ptr } declare
|
||||||
[ 0x1000 swap <displaced-alien> ]
|
[ 0x1000 swap <displaced-alien> ]
|
||||||
[ 0x2000 swap <displaced-alien> ] bi
|
[ 0x2000 swap <displaced-alien> ] bi
|
||||||
|
|
|
@ -440,10 +440,10 @@ M: object bad-push-test-case "foo" throw ; inline
|
||||||
|
|
||||||
STRUCT: BitmapData { Scan0 void* } ;
|
STRUCT: BitmapData { Scan0 void* } ;
|
||||||
|
|
||||||
[ ALIEN: 123 ] [
|
[ alien: 123 ] [
|
||||||
[
|
[
|
||||||
{ BitmapData }
|
{ BitmapData }
|
||||||
[ BitmapData memory>struct ALIEN: 123 >>Scan0 drop ]
|
[ BitmapData memory>struct alien: 123 >>Scan0 drop ]
|
||||||
with-out-parameters Scan0>>
|
with-out-parameters Scan0>>
|
||||||
] compile-call
|
] compile-call
|
||||||
] unit-test
|
] unit-test
|
||||||
|
|
|
@ -8,6 +8,6 @@ HELP: open-read
|
||||||
{ $unchecked-example
|
{ $unchecked-example
|
||||||
"USING: io.files.windows prettyprint ;"
|
"USING: io.files.windows prettyprint ;"
|
||||||
"\"resource:core/kernel/kernel.factor\" absolute-path open-read ."
|
"\"resource:core/kernel/kernel.factor\" absolute-path open-read ."
|
||||||
"T{ win32-file { handle ALIEN: 234 } { ptr 0 } }"
|
"T{ win32-file { handle alien: 234 } { ptr 0 } }"
|
||||||
}
|
}
|
||||||
} ;
|
} ;
|
||||||
|
|
|
@ -45,7 +45,7 @@ SPECIALIZED-ARRAYS: bool uchar ushort char uint float ulonglong ;
|
||||||
{ f } [ [ float-array{ 4 3 2 1 } dup clone [ underlying>> ] bi@ eq? ] compile-call ] unit-test
|
{ f } [ [ float-array{ 4 3 2 1 } dup clone [ underlying>> ] bi@ eq? ] compile-call ] unit-test
|
||||||
|
|
||||||
{ ushort-array{ 0 0 0 } } [
|
{ ushort-array{ 0 0 0 } } [
|
||||||
3 ALIEN: 123 100 <direct-ushort-array> new-sequence
|
3 alien: 123 100 <direct-ushort-array> new-sequence
|
||||||
[ drop 0 ] map!
|
[ drop 0 ] map!
|
||||||
] unit-test
|
] unit-test
|
||||||
|
|
||||||
|
@ -83,7 +83,7 @@ SPECIALIZED-ARRAY: test-struct
|
||||||
] with-destructors
|
] with-destructors
|
||||||
] unit-test
|
] unit-test
|
||||||
|
|
||||||
{ } [ ALIEN: 123 10 <direct-test-struct-array> drop ] unit-test
|
{ } [ alien: 123 10 <direct-test-struct-array> drop ] unit-test
|
||||||
|
|
||||||
{ } [
|
{ } [
|
||||||
[
|
[
|
||||||
|
@ -113,13 +113,13 @@ STRUCT: fixed-string { text char[64] } ;
|
||||||
|
|
||||||
SPECIALIZED-ARRAY: fixed-string
|
SPECIALIZED-ARRAY: fixed-string
|
||||||
|
|
||||||
{ { ALIEN: 100 ALIEN: 140 ALIEN: 180 ALIEN: 1c0 } } [
|
{ { alien: 100 alien: 140 alien: 180 alien: 1c0 } } [
|
||||||
ALIEN: 100 4 <direct-fixed-string-array> [ (underlying)>> ] { } map-as
|
alien: 100 4 <direct-fixed-string-array> [ (underlying)>> ] { } map-as
|
||||||
] unit-test
|
] unit-test
|
||||||
|
|
||||||
! Ensure that byte-length works with direct arrays
|
! Ensure that byte-length works with direct arrays
|
||||||
{ 400 } [
|
{ 400 } [
|
||||||
ALIEN: 123 100 <direct-int-array> byte-length
|
alien: 123 100 <direct-int-array> byte-length
|
||||||
] unit-test
|
] unit-test
|
||||||
|
|
||||||
{ } [
|
{ } [
|
||||||
|
|
|
@ -62,7 +62,7 @@ IN: tools.ps.windows
|
||||||
PVOID heap-size
|
PVOID heap-size
|
||||||
read-process-memory
|
read-process-memory
|
||||||
PVOID deref :> args-offset
|
PVOID deref :> args-offset
|
||||||
args-offset ALIEN: 0 = [
|
args-offset alien: 0 = [
|
||||||
f
|
f
|
||||||
] [
|
] [
|
||||||
handle
|
handle
|
||||||
|
|
|
@ -5,13 +5,13 @@ IN: ui.backend.gtk.tests
|
||||||
: gdk-key-release-event ( -- event )
|
: gdk-key-release-event ( -- event )
|
||||||
S{ GdkEventKey
|
S{ GdkEventKey
|
||||||
{ type 9 }
|
{ type 9 }
|
||||||
{ window ALIEN: 1672900 }
|
{ window alien: 1672900 }
|
||||||
{ send_event 0 }
|
{ send_event 0 }
|
||||||
{ time 1332590199 }
|
{ time 1332590199 }
|
||||||
{ state 17 }
|
{ state 17 }
|
||||||
{ keyval 72 }
|
{ keyval 72 }
|
||||||
{ length 1 }
|
{ length 1 }
|
||||||
{ string ALIEN: 1b25c80 }
|
{ string alien: 1b25c80 }
|
||||||
{ hardware_keycode 43 }
|
{ hardware_keycode 43 }
|
||||||
{ group 0 }
|
{ group 0 }
|
||||||
{ is_modifier 0 }
|
{ is_modifier 0 }
|
||||||
|
@ -20,13 +20,13 @@ IN: ui.backend.gtk.tests
|
||||||
: gdk-key-press-event ( -- event )
|
: gdk-key-press-event ( -- event )
|
||||||
S{ GdkEventKey
|
S{ GdkEventKey
|
||||||
{ type 8 }
|
{ type 8 }
|
||||||
{ window ALIEN: 16727e0 }
|
{ window alien: 16727e0 }
|
||||||
{ send_event 0 }
|
{ send_event 0 }
|
||||||
{ time 1332864912 }
|
{ time 1332864912 }
|
||||||
{ state 16 }
|
{ state 16 }
|
||||||
{ keyval 65471 }
|
{ keyval 65471 }
|
||||||
{ length 0 }
|
{ length 0 }
|
||||||
{ string ALIEN: 19c9700 }
|
{ string alien: 19c9700 }
|
||||||
{ hardware_keycode 68 }
|
{ hardware_keycode 68 }
|
||||||
{ group 0 }
|
{ group 0 }
|
||||||
{ is_modifier 0 }
|
{ is_modifier 0 }
|
||||||
|
@ -35,13 +35,13 @@ IN: ui.backend.gtk.tests
|
||||||
: gdk-space-key-press-event ( -- event )
|
: gdk-space-key-press-event ( -- event )
|
||||||
S{ GdkEventKey
|
S{ GdkEventKey
|
||||||
{ type 8 }
|
{ type 8 }
|
||||||
{ window ALIEN: 1b66360 }
|
{ window alien: 1b66360 }
|
||||||
{ send_event 0 }
|
{ send_event 0 }
|
||||||
{ time 28246628 }
|
{ time 28246628 }
|
||||||
{ state 0 }
|
{ state 0 }
|
||||||
{ keyval 32 }
|
{ keyval 32 }
|
||||||
{ length 0 }
|
{ length 0 }
|
||||||
{ string ALIEN: 20233b0 }
|
{ string alien: 20233b0 }
|
||||||
{ hardware_keycode 64 }
|
{ hardware_keycode 64 }
|
||||||
{ group 0 }
|
{ group 0 }
|
||||||
{ is_modifier 1 }
|
{ is_modifier 1 }
|
||||||
|
@ -50,13 +50,13 @@ IN: ui.backend.gtk.tests
|
||||||
: gdk-windows-key-release-event ( -- event )
|
: gdk-windows-key-release-event ( -- event )
|
||||||
S{ GdkEventKey
|
S{ GdkEventKey
|
||||||
{ type 9 }
|
{ type 9 }
|
||||||
{ window ALIEN: 1a71d80 }
|
{ window alien: 1a71d80 }
|
||||||
{ send_event 0 }
|
{ send_event 0 }
|
||||||
{ time 47998769 }
|
{ time 47998769 }
|
||||||
{ state 67108928 }
|
{ state 67108928 }
|
||||||
{ keyval 119 }
|
{ keyval 119 }
|
||||||
{ length 1 }
|
{ length 1 }
|
||||||
{ string ALIEN: 2017640 }
|
{ string alien: 2017640 }
|
||||||
{ hardware_keycode 25 }
|
{ hardware_keycode 25 }
|
||||||
{ group 0 }
|
{ group 0 }
|
||||||
{ is_modifier 0 }
|
{ is_modifier 0 }
|
||||||
|
|
|
@ -32,9 +32,9 @@ CONSTANT: DT_LNK 10
|
||||||
CONSTANT: DT_SOCK 12
|
CONSTANT: DT_SOCK 12
|
||||||
CONSTANT: DT_WHT 14
|
CONSTANT: DT_WHT 14
|
||||||
|
|
||||||
: SIG_EFF ( -- obj ) ALIEN: -1 void* <ref> ; inline
|
: SIG_EFF ( -- obj ) alien: -1 void* <ref> ; inline
|
||||||
: SIG_DFL ( -- obj ) ALIEN: 0 void* <ref> ; inline
|
: SIG_DFL ( -- obj ) alien: 0 void* <ref> ; inline
|
||||||
: SIG_IGN ( -- obj ) ALIEN: 1 void* <ref> ; inline
|
: SIG_IGN ( -- obj ) alien: 1 void* <ref> ; inline
|
||||||
|
|
||||||
! Possible values for 'ai_flags' in 'addrinfo'.
|
! Possible values for 'ai_flags' in 'addrinfo'.
|
||||||
CONSTANT: AI_PASSIVE 0x0001
|
CONSTANT: AI_PASSIVE 0x0001
|
||||||
|
|
|
@ -149,7 +149,7 @@ HELP: alien-assembly
|
||||||
ARTICLE: "alien-expiry" "Alien expiry"
|
ARTICLE: "alien-expiry" "Alien expiry"
|
||||||
"When an image is loaded, any alien objects which persisted from the previous session are marked as having expired. This is because the C pointers they contain are almost certainly no longer valid."
|
"When an image is loaded, any alien objects which persisted from the previous session are marked as having expired. This is because the C pointers they contain are almost certainly no longer valid."
|
||||||
$nl
|
$nl
|
||||||
"For this reason, the " { $link postpone: ALIEN: } " word should not be used in source files, since loading the source file then saving the image will result in the literal becoming expired. Use " { $link <alien> } " instead, and ensure the word calling " { $link <alien> } " is not declared " { $link postpone: flushable } "."
|
"For this reason, the " { $link postpone: alien: } " word should not be used in source files, since loading the source file then saving the image will result in the literal becoming expired. Use " { $link <alien> } " instead, and ensure the word calling " { $link <alien> } " is not declared " { $link postpone: flushable } "."
|
||||||
{ $subsections expired? } ;
|
{ $subsections expired? } ;
|
||||||
|
|
||||||
ARTICLE: "aliens" "Alien addresses"
|
ARTICLE: "aliens" "Alien addresses"
|
||||||
|
|
|
@ -56,7 +56,7 @@ cell 8 = [
|
||||||
] unit-test
|
] unit-test
|
||||||
] when
|
] when
|
||||||
|
|
||||||
{ "ALIEN: 1234" } [ 0x1234 <alien> unparse ] unit-test
|
{ "alien: 1234" } [ 0x1234 <alien> unparse ] unit-test
|
||||||
|
|
||||||
{ } [ 0 B{ 1 2 3 } <displaced-alien> drop ] unit-test
|
{ } [ 0 B{ 1 2 3 } <displaced-alien> drop ] unit-test
|
||||||
|
|
||||||
|
|
|
@ -41,7 +41,7 @@ M: object g drop "object" ;
|
||||||
123.456 ,
|
123.456 ,
|
||||||
1/6 ,
|
1/6 ,
|
||||||
C{ 1 2 } ,
|
C{ 1 2 } ,
|
||||||
ALIEN: 1234 ,
|
alien: 1234 ,
|
||||||
] { } make ;
|
] { } make ;
|
||||||
|
|
||||||
: dispatch3-benchmark ( -- )
|
: dispatch3-benchmark ( -- )
|
||||||
|
|
|
@ -223,8 +223,8 @@ CONSTRUCTOR: <info> fdb-info ( filename new-filename doc-count space-used file-s
|
||||||
! Example fdb_doc and converted doc
|
! Example fdb_doc and converted doc
|
||||||
S{ fdb_doc
|
S{ fdb_doc
|
||||||
{ keylen 4 } { metalen 0 } { bodylen 4 } { size_ondisk 0 }
|
{ keylen 4 } { metalen 0 } { bodylen 4 } { size_ondisk 0 }
|
||||||
{ key ALIEN: 1002f2f10 } { seqnum 5 } { offset 4256 }
|
{ key alien: 1002f2f10 } { seqnum 5 } { offset 4256 }
|
||||||
{ meta ALIEN: 1002dc790 } { body f } { deleted f }
|
{ meta alien: 1002dc790 } { body f } { deleted f }
|
||||||
}
|
}
|
||||||
T{ doc
|
T{ doc
|
||||||
{ seqnum 5 }
|
{ seqnum 5 }
|
||||||
|
|
|
@ -15,6 +15,6 @@ HELP: load-module
|
||||||
{ $unchecked-example
|
{ $unchecked-example
|
||||||
"USING: io.pathnames llvm.reader ;"
|
"USING: io.pathnames llvm.reader ;"
|
||||||
"\"resource:extra/llvm/wrappers/add.bc\" absolute-path load-module"
|
"\"resource:extra/llvm/wrappers/add.bc\" absolute-path load-module"
|
||||||
"T{ module { value ALIEN: 1be7120 } }"
|
"T{ module { value alien: 1be7120 } }"
|
||||||
}
|
}
|
||||||
} ;
|
} ;
|
||||||
|
|
|
@ -96,7 +96,7 @@ FUNCTION: int futimes ( int id,
|
||||||
FUNCTION: int booyah ( int x )
|
FUNCTION: int booyah ( int x )
|
||||||
FUNCTION-ALIAS: test int bah ( int* ah, int[] eh )
|
FUNCTION-ALIAS: test int bah ( int* ah, int[] eh )
|
||||||
|
|
||||||
hexcolor: ffffff color: green nan: 1234 char: m ALIEN: 93
|
hexcolor: ffffff color: green nan: 1234 char: m alien: 93
|
||||||
2drop 2drop drop
|
2drop 2drop drop
|
||||||
|
|
||||||
PRIMITIVE: one ( a -- b )
|
PRIMITIVE: one ( a -- b )
|
||||||
|
|
Loading…
Reference in New Issue