]> gitweb.factorcode.org Git - factor.git/commitdiff
Rename tools.disassembler.udis:& to alien.syntax:&: and fix it to survive image save...
authorSlava Pestov <slava@slava-pestovs-macbook-pro.local>
Thu, 11 Dec 2008 06:03:58 +0000 (00:03 -0600)
committerSlava Pestov <slava@slava-pestovs-macbook-pro.local>
Thu, 11 Dec 2008 06:03:58 +0000 (00:03 -0600)
basis/alien/c-types/c-types-tests.factor
basis/alien/syntax/syntax-docs.factor
basis/alien/syntax/syntax.factor
basis/compiler/tests/alien.factor
basis/core-foundation/fsevents/fsevents.factor
basis/environment/unix/unix.factor
basis/io/unix/backend/backend.factor
basis/tools/disassembler/udis/udis.factor

index f57d102452ca132031787331aef8201729158683..31542b2699eb94224500aa3c5fe181e47d4f9fa0 100644 (file)
@@ -8,7 +8,7 @@ sequences system libc alien.strings io.encodings.utf8 ;
 
 [ { "blah" 123 } ] [ { "blah" xyz } expand-constants ] unit-test
 
-: foo ( -- n ) "fdafd" f dlsym [ 123 ] unless* ;
+: foo ( -- n ) &: fdafd [ 123 ] unless* ;
 
 [ 123 ] [ foo ] unit-test
 
index 586bb974028978b2e78e663c9b6061f21d49d0bf..a3215cd8c6ae737c739fd18208565f819aab6e04 100644 (file)
@@ -77,6 +77,11 @@ HELP: C-ENUM:
     { $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
 { $values { "old" "a string" } { "new" "a string" } }
 { $description "Alises the C type " { $snippet "old" } " under the name " { $snippet "new" } "." }
index b0ba10a316176e501699e8487a993e168d50f482..15d82884f9c82e6fa18bd4e3511a94471efe1f35 100644 (file)
@@ -3,7 +3,8 @@
 USING: accessors arrays alien alien.c-types alien.structs
 alien.arrays alien.strings kernel math namespaces parser
 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
 
 : DLL" lexer get skip-blank parse-string dlopen parsed ; parsing
@@ -33,3 +34,7 @@ IN: alien.syntax
     dup length
     [ [ create-in ] dip 1quotation define ] 2each ;
     parsing
+
+: &:
+    scan "c-library" get
+    '[ _ _ load-library dlsym ] over push-all ; parsing
index 230a7bf54213379bd5fcc0ccd66c31c05c4ed049..1b21e40bace1c762d5dd211f8ccebc53a6719f3d 100644 (file)
@@ -83,14 +83,14 @@ FUNCTION: tiny ffi_test_17 int x ;
 
 { 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 -- )
     "int" { } "cdecl" alien-indirect drop ;
 
 { 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
 
@@ -100,7 +100,7 @@ FUNCTION: tiny ffi_test_17 int x ;
 { 3 1 } [ indirect-test-2 ] must-infer-as
 
 [ 5 ]
-[ 2 3 "ffi_test_2" f dlsym indirect-test-2 ]
+[ 2 3 &: ffi_test_2 indirect-test-2 ]
 unit-test
 
 : indirect-test-3 ( a b c d ptr -- result )
index d4d5e88512e25c72c0e2c4d464a80c2b342d358f..b3c1444043c9ea6be3e706ce938db61aeae83516 100644 (file)
@@ -118,7 +118,7 @@ FUNCTION: CFStringRef FSEventStreamCopyDescription ( FSEventStreamRef streamRef
     FSEventStreamCreate ;
 
 : kCFRunLoopCommonModes ( -- string )
-    "kCFRunLoopCommonModes" f dlsym *void* ;
+    &: kCFRunLoopCommonModes *void* ;
 
 : schedule-event-stream ( event-stream -- )
     CFRunLoopGetMain
index c2dddc25ab8cea4444c18293680c85bd964aa232..7da19ee47b5f4b954ca1097d48df41539c0b6aee 100644 (file)
@@ -2,12 +2,13 @@
 ! See http://factorcode.org/license.txt for BSD license.
 USING: alien alien.c-types alien.strings alien.syntax kernel
 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
 
 HOOK: environ os ( -- void* )
 
-M: unix environ ( -- void* ) "environ" f dlsym ;
+M: unix environ ( -- void* ) &: environ ;
 
 M: unix os-env ( key -- value ) getenv ;
 
index 7f4e03ef09682f76ef8ab3e073183582577fbd76..954a0a61de93e6c6752633b5b0b2c8f6506fa9ea 100644 (file)
@@ -1,8 +1,8 @@
 ! Copyright (C) 2004, 2008 Slava Pestov.
 ! See http://factorcode.org/license.txt for BSD license.
-USING: alien alien.c-types generic assocs kernel kernel.private
-math io.ports sequences strings sbufs threads unix
-vectors io.buffers io.backend io.encodings math.parser
+USING: alien alien.c-types alien.syntax generic assocs kernel
+kernel.private math io.ports sequences strings sbufs threads
+unix vectors io.buffers io.backend io.encodings math.parser
 continuations system libc qualified namespaces make io.timeouts
 io.encodings.utf8 destructors accessors summary combinators
 locals unix.time fry ;
@@ -184,11 +184,11 @@ M: stdin dispose*
 M: stdin refill
     [ 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 new
index 113c07c8c359700bd1479fc7454e6c195e26cebb..c5b5c80d137661d514eac1bfd38a51a5e54f95ed 100644 (file)
@@ -5,8 +5,6 @@ alien alien.syntax alien.c-types lexer parser kernel
 sequences layouts math math.parser system make fry arrays ;
 IN: tools.disassembler.udis
 
-<< : & scan "c-library" get load-library dlsym parsed ; parsing >>
-
 <<
 "libudis86" {
     { [ os macosx? ] [ "libudis86.0.dylib" ] }
@@ -22,8 +20,8 @@ TYPEDEF: char[592] ud
 FUNCTION: void ud_translate_intel ( ud* u ) ;
 FUNCTION: void ud_translate_att ( ud* u ) ;
 
-: UD_SYN_INTEL    & ud_translate_intel ; inline
-: UD_SYN_ATT      & ud_translate_att ; inline
+: UD_SYN_INTEL    &: ud_translate_intel ; inline
+: UD_SYN_ATT      &: ud_translate_att ; inline
 : UD_EOI          -1 ; inline
 : UD_INP_CACHE_SZ 32 ; inline
 : UD_VENDOR_AMD   0 ; inline