Rename tools.disassembler.udis:& to alien.syntax:&: and fix it to survive image save/load
parent
0cc4dc4e0a
commit
c679ae025b
|
@ -8,7 +8,7 @@ sequences system libc alien.strings io.encodings.utf8 ;
|
||||||
|
|
||||||
[ { "blah" 123 } ] [ { "blah" xyz } expand-constants ] unit-test
|
[ { "blah" 123 } ] [ { "blah" xyz } expand-constants ] unit-test
|
||||||
|
|
||||||
: foo ( -- n ) "fdafd" f dlsym [ 123 ] unless* ;
|
: foo ( -- n ) &: fdafd [ 123 ] unless* ;
|
||||||
|
|
||||||
[ 123 ] [ foo ] unit-test
|
[ 123 ] [ foo ] unit-test
|
||||||
|
|
||||||
|
|
|
@ -77,6 +77,11 @@ HELP: C-ENUM:
|
||||||
{ $code "C-ENUM: red green blue ;" ": red 0 ; : green 1 ; : blue 2 ;" }
|
{ $code "C-ENUM: red green blue ;" ": red 0 ; : green 1 ; : blue 2 ;" }
|
||||||
} ;
|
} ;
|
||||||
|
|
||||||
|
HELP: &:
|
||||||
|
{ $syntax "&: symbol" }
|
||||||
|
{ $values { "symbol" "A C library symbol name" } }
|
||||||
|
{ $description "Pushes the address of a symbol named " { $snippet "symbol" } " from the current library, set with " { $link POSTPONE: LIBRARY: } "." } ;
|
||||||
|
|
||||||
HELP: typedef
|
HELP: typedef
|
||||||
{ $values { "old" "a string" } { "new" "a string" } }
|
{ $values { "old" "a string" } { "new" "a string" } }
|
||||||
{ $description "Alises the C type " { $snippet "old" } " under the name " { $snippet "new" } "." }
|
{ $description "Alises the C type " { $snippet "old" } " under the name " { $snippet "new" } "." }
|
||||||
|
|
|
@ -3,7 +3,8 @@
|
||||||
USING: accessors arrays alien alien.c-types alien.structs
|
USING: accessors arrays alien alien.c-types alien.structs
|
||||||
alien.arrays alien.strings kernel math namespaces parser
|
alien.arrays alien.strings kernel math namespaces parser
|
||||||
sequences words quotations math.parser splitting grouping
|
sequences words quotations math.parser splitting grouping
|
||||||
effects assocs combinators lexer strings.parser alien.parser ;
|
effects assocs combinators lexer strings.parser alien.parser
|
||||||
|
fry ;
|
||||||
IN: alien.syntax
|
IN: alien.syntax
|
||||||
|
|
||||||
: DLL" lexer get skip-blank parse-string dlopen parsed ; parsing
|
: DLL" lexer get skip-blank parse-string dlopen parsed ; parsing
|
||||||
|
@ -33,3 +34,7 @@ IN: alien.syntax
|
||||||
dup length
|
dup length
|
||||||
[ [ create-in ] dip 1quotation define ] 2each ;
|
[ [ create-in ] dip 1quotation define ] 2each ;
|
||||||
parsing
|
parsing
|
||||||
|
|
||||||
|
: &:
|
||||||
|
scan "c-library" get
|
||||||
|
'[ _ _ load-library dlsym ] over push-all ; parsing
|
||||||
|
|
|
@ -83,14 +83,14 @@ FUNCTION: tiny ffi_test_17 int x ;
|
||||||
|
|
||||||
{ 1 1 } [ indirect-test-1 ] must-infer-as
|
{ 1 1 } [ indirect-test-1 ] must-infer-as
|
||||||
|
|
||||||
[ 3 ] [ "ffi_test_1" f dlsym indirect-test-1 ] unit-test
|
[ 3 ] [ &: ffi_test_1 indirect-test-1 ] unit-test
|
||||||
|
|
||||||
: indirect-test-1' ( ptr -- )
|
: indirect-test-1' ( ptr -- )
|
||||||
"int" { } "cdecl" alien-indirect drop ;
|
"int" { } "cdecl" alien-indirect drop ;
|
||||||
|
|
||||||
{ 1 0 } [ indirect-test-1' ] must-infer-as
|
{ 1 0 } [ indirect-test-1' ] must-infer-as
|
||||||
|
|
||||||
[ ] [ "ffi_test_1" f dlsym indirect-test-1' ] unit-test
|
[ ] [ &: ffi_test_1 indirect-test-1' ] unit-test
|
||||||
|
|
||||||
[ -1 indirect-test-1 ] must-fail
|
[ -1 indirect-test-1 ] must-fail
|
||||||
|
|
||||||
|
@ -100,7 +100,7 @@ FUNCTION: tiny ffi_test_17 int x ;
|
||||||
{ 3 1 } [ indirect-test-2 ] must-infer-as
|
{ 3 1 } [ indirect-test-2 ] must-infer-as
|
||||||
|
|
||||||
[ 5 ]
|
[ 5 ]
|
||||||
[ 2 3 "ffi_test_2" f dlsym indirect-test-2 ]
|
[ 2 3 &: ffi_test_2 indirect-test-2 ]
|
||||||
unit-test
|
unit-test
|
||||||
|
|
||||||
: indirect-test-3 ( a b c d ptr -- result )
|
: indirect-test-3 ( a b c d ptr -- result )
|
||||||
|
|
|
@ -118,7 +118,7 @@ FUNCTION: CFStringRef FSEventStreamCopyDescription ( FSEventStreamRef streamRef
|
||||||
FSEventStreamCreate ;
|
FSEventStreamCreate ;
|
||||||
|
|
||||||
: kCFRunLoopCommonModes ( -- string )
|
: kCFRunLoopCommonModes ( -- string )
|
||||||
"kCFRunLoopCommonModes" f dlsym *void* ;
|
&: kCFRunLoopCommonModes *void* ;
|
||||||
|
|
||||||
: schedule-event-stream ( event-stream -- )
|
: schedule-event-stream ( event-stream -- )
|
||||||
CFRunLoopGetMain
|
CFRunLoopGetMain
|
||||||
|
|
|
@ -2,12 +2,13 @@
|
||||||
! See http://factorcode.org/license.txt for BSD license.
|
! See http://factorcode.org/license.txt for BSD license.
|
||||||
USING: alien alien.c-types alien.strings alien.syntax kernel
|
USING: alien alien.c-types alien.strings alien.syntax kernel
|
||||||
layouts sequences system unix environment io.encodings.utf8
|
layouts sequences system unix environment io.encodings.utf8
|
||||||
unix.utilities vocabs.loader combinators alien.accessors ;
|
unix.utilities vocabs.loader combinators alien.accessors
|
||||||
|
alien.syntax ;
|
||||||
IN: environment.unix
|
IN: environment.unix
|
||||||
|
|
||||||
HOOK: environ os ( -- void* )
|
HOOK: environ os ( -- void* )
|
||||||
|
|
||||||
M: unix environ ( -- void* ) "environ" f dlsym ;
|
M: unix environ ( -- void* ) &: environ ;
|
||||||
|
|
||||||
M: unix os-env ( key -- value ) getenv ;
|
M: unix os-env ( key -- value ) getenv ;
|
||||||
|
|
||||||
|
|
|
@ -1,8 +1,8 @@
|
||||||
! Copyright (C) 2004, 2008 Slava Pestov.
|
! Copyright (C) 2004, 2008 Slava Pestov.
|
||||||
! See http://factorcode.org/license.txt for BSD license.
|
! See http://factorcode.org/license.txt for BSD license.
|
||||||
USING: alien alien.c-types generic assocs kernel kernel.private
|
USING: alien alien.c-types alien.syntax generic assocs kernel
|
||||||
math io.ports sequences strings sbufs threads unix
|
kernel.private math io.ports sequences strings sbufs threads
|
||||||
vectors io.buffers io.backend io.encodings math.parser
|
unix vectors io.buffers io.backend io.encodings math.parser
|
||||||
continuations system libc qualified namespaces make io.timeouts
|
continuations system libc qualified namespaces make io.timeouts
|
||||||
io.encodings.utf8 destructors accessors summary combinators
|
io.encodings.utf8 destructors accessors summary combinators
|
||||||
locals unix.time fry ;
|
locals unix.time fry ;
|
||||||
|
@ -184,11 +184,11 @@ M: stdin dispose*
|
||||||
M: stdin refill
|
M: stdin refill
|
||||||
[ buffer>> ] [ dup wait-for-stdin ] bi* refill-stdin f ;
|
[ buffer>> ] [ dup wait-for-stdin ] bi* refill-stdin f ;
|
||||||
|
|
||||||
: control-write-fd ( -- fd ) "control_write" f dlsym *uint ;
|
: control-write-fd ( -- fd ) &: control_write *uint ;
|
||||||
|
|
||||||
: size-read-fd ( -- fd ) "size_read" f dlsym *uint ;
|
: size-read-fd ( -- fd ) &: size_read *uint ;
|
||||||
|
|
||||||
: data-read-fd ( -- fd ) "stdin_read" f dlsym *uint ;
|
: data-read-fd ( -- fd ) &: stdin_read *uint ;
|
||||||
|
|
||||||
: <stdin> ( -- stdin )
|
: <stdin> ( -- stdin )
|
||||||
stdin new
|
stdin new
|
||||||
|
|
|
@ -5,8 +5,6 @@ alien alien.syntax alien.c-types lexer parser kernel
|
||||||
sequences layouts math math.parser system make fry arrays ;
|
sequences layouts math math.parser system make fry arrays ;
|
||||||
IN: tools.disassembler.udis
|
IN: tools.disassembler.udis
|
||||||
|
|
||||||
<< : & scan "c-library" get load-library dlsym parsed ; parsing >>
|
|
||||||
|
|
||||||
<<
|
<<
|
||||||
"libudis86" {
|
"libudis86" {
|
||||||
{ [ os macosx? ] [ "libudis86.0.dylib" ] }
|
{ [ os macosx? ] [ "libudis86.0.dylib" ] }
|
||||||
|
@ -22,8 +20,8 @@ TYPEDEF: char[592] ud
|
||||||
FUNCTION: void ud_translate_intel ( ud* u ) ;
|
FUNCTION: void ud_translate_intel ( ud* u ) ;
|
||||||
FUNCTION: void ud_translate_att ( ud* u ) ;
|
FUNCTION: void ud_translate_att ( ud* u ) ;
|
||||||
|
|
||||||
: UD_SYN_INTEL & ud_translate_intel ; inline
|
: UD_SYN_INTEL &: ud_translate_intel ; inline
|
||||||
: UD_SYN_ATT & ud_translate_att ; inline
|
: UD_SYN_ATT &: ud_translate_att ; inline
|
||||||
: UD_EOI -1 ; inline
|
: UD_EOI -1 ; inline
|
||||||
: UD_INP_CACHE_SZ 32 ; inline
|
: UD_INP_CACHE_SZ 32 ; inline
|
||||||
: UD_VENDOR_AMD 0 ; inline
|
: UD_VENDOR_AMD 0 ; inline
|
||||||
|
|
Loading…
Reference in New Issue