From: Doug Coleman Date: Sun, 30 Aug 2009 01:52:14 +0000 (-0500) Subject: remove dead code, use ${ and GUID:, structs X-Git-Tag: 0.97~5635^2~11^2~4 X-Git-Url: https://gitweb.factorcode.org/gitweb.cgi?p=factor.git;a=commitdiff_plain;h=fb3fa1f7971e90ee4dafd230f08ba6e63f55277f remove dead code, use ${ and GUID:, structs --- diff --git a/basis/io/sockets/windows/nt/nt.factor b/basis/io/sockets/windows/nt/nt.factor index 6780fdcdd6..1bb5e0d102 100755 --- a/basis/io/sockets/windows/nt/nt.factor +++ b/basis/io/sockets/windows/nt/nt.factor @@ -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*" [ "void*" heap-size diff --git a/basis/windows/shell32/shell32.factor b/basis/windows/shell32/shell32.factor index 016f5ab149..635c59a692 100644 --- a/basis/windows/shell32/shell32.factor +++ b/basis/windows/shell32/shell32.factor @@ -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" + MAX_UNICODE_PATH [ SHGetFolderPath drop ] keep utf16n alien>string ; : desktop ( -- str ) diff --git a/basis/windows/winsock/winsock.factor b/basis/windows/winsock/winsock.factor index d19e4aca09..74f67a4924 100755 --- a/basis/windows/winsock/winsock.factor +++ b/basis/windows/winsock/winsock.factor @@ -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 ; +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