]> gitweb.factorcode.org Git - factor.git/commitdiff
remove dead code, use ${ and GUID:, structs
authorDoug Coleman <doug.coleman@gmail.com>
Sun, 30 Aug 2009 01:52:14 +0000 (20:52 -0500)
committerDoug Coleman <doug.coleman@gmail.com>
Sun, 30 Aug 2009 01:52:14 +0000 (20:52 -0500)
basis/io/sockets/windows/nt/nt.factor
basis/windows/shell32/shell32.factor
basis/windows/winsock/winsock.factor

index 6780fdcdd6f92f93af93b7a750131a3676bb318f..1bb5e0d10225588fba01d0d95f42c4605800e211 100755 (executable)
@@ -3,7 +3,7 @@ continuations destructors io.ports io.timeouts io.sockets
 io namespaces io.streams.duplex io.backend.windows
 io.sockets.windows io.backend.windows.nt windows.winsock kernel
 libc math sequences threads system combinators accessors
-classes.struct ;
+classes.struct windows.kernel32 ;
 IN: io.sockets.windows.nt
 
 : malloc-int ( object -- object )
@@ -15,7 +15,7 @@ M: winnt WSASocket-flags ( -- DWORD )
 : get-ConnectEx-ptr ( socket -- void* )
     SIO_GET_EXTENSION_FUNCTION_POINTER
     WSAID_CONNECTEX
-    "GUID" heap-size
+    GUID heap-size
     "void*" <c-object>
     [
         "void*" heap-size
index 016f5ab149dc2a5cb0fe810423969f5c440600cb..635c59a6923b0f8dfb13085d462b2af63ebdad0e 100644 (file)
@@ -3,7 +3,7 @@
 USING: alien alien.c-types alien.strings alien.syntax
 combinators io.encodings.utf16n io.files io.pathnames kernel
 windows.errors windows.com windows.com.syntax windows.user32
-windows.ole32 windows ;
+windows.ole32 windows specialized-arrays.ushort ;
 IN: windows.shell32
 
 CONSTANT: CSIDL_DESKTOP HEX: 00
@@ -90,7 +90,7 @@ ALIAS: ShellExecute ShellExecuteW
 
 : shell32-directory ( n -- str )
     f swap f SHGFP_TYPE_DEFAULT
-    MAX_UNICODE_PATH "ushort" <c-array>
+    MAX_UNICODE_PATH <ushort-array>
     [ SHGetFolderPath drop ] keep utf16n alien>string ;
 
 : desktop ( -- str )
index d19e4aca090b1f45813ac4e67b2ab1cfae10ba20..74f67a4924f901edb0f26ba70225af3ce0fc621b 100755 (executable)
@@ -2,7 +2,8 @@
 ! See http://factorcode.org/license.txt for BSD license.
 USING: alien alien.c-types alien.strings alien.syntax arrays
 byte-arrays kernel math sequences windows.types windows.kernel32
-windows.errors math.bitwise io.encodings.utf16n classes.struct ;
+windows.errors math.bitwise io.encodings.utf16n classes.struct
+literals windows.com.syntax ;
 IN: windows.winsock
 
 USE: libc
@@ -121,12 +122,12 @@ C-STRUCT: sockaddr-in6
     { { "uchar" 16 } "addr" }
     { "uint" "scopeid" } ;
 
-C-STRUCT: hostent
-    { "char*" "name" }
-    { "void*" "aliases" }
-    { "short" "addrtype" }
-    { "short" "length" }
-    { "void*" "addr-list" } ;
+STRUCT: hostent
+    { name char* }
+    { aliases void* }
+    { addrtype short }
+    { length short }
+    { addr-list void* } ;
 
 C-STRUCT: addrinfo
     { "int" "flags" }
@@ -142,11 +143,8 @@ C-STRUCT: timeval
     { "long" "sec" }
     { "long" "usec" } ;
 
-: hostent-addr ( hostent -- addr ) hostent-addr-list *void* ; ! *uint ;
-
 LIBRARY: winsock
 
-
 FUNCTION: int setsockopt ( SOCKET s, int level, int optname, char* optval, int optlen ) ;
 
 FUNCTION: ushort htons ( ushort n ) ;
@@ -385,17 +383,10 @@ FUNCTION: void GetAcceptExSockaddrs ( void* a, int b, int c, int d, void* e, voi
 
 CONSTANT: SIO_GET_EXTENSION_FUNCTION_POINTER -939524090
 
-: WSAID_CONNECTEX ( -- GUID )
-    HEX: 25a207b9
-    HEX: ddf3
-    HEX: 4660
-    B{
-        HEX: 8e HEX: e9 HEX: 76 HEX: e5
-        HEX: 8c HEX: 74 HEX: 06 HEX: 3e
-    } GUID <struct-boa> ;
+CONSTANT: WSAID_CONNECTEX GUID: {25a207b9-ddf3-4660-8ee9-76e58c74063e}
 
 : winsock-expected-error? ( n -- ? )
-    ERROR_IO_PENDING ERROR_SUCCESS WSA_IO_PENDING 3array member? ;
+    ${ ERROR_IO_PENDING ERROR_SUCCESS WSA_IO_PENDING } member? ;
 
 : (winsock-error-string) ( n -- str )
     ! #! WSAStartup returns the error code 'n' directly