remove dead code, use ${ and GUID:, structs

db4
Doug Coleman 2009-08-29 20:52:14 -05:00
parent d2dd206638
commit fb3fa1f797
3 changed files with 14 additions and 23 deletions

View File

@ -3,7 +3,7 @@ continuations destructors io.ports io.timeouts io.sockets
io namespaces io.streams.duplex io.backend.windows io namespaces io.streams.duplex io.backend.windows
io.sockets.windows io.backend.windows.nt windows.winsock kernel io.sockets.windows io.backend.windows.nt windows.winsock kernel
libc math sequences threads system combinators accessors libc math sequences threads system combinators accessors
classes.struct ; classes.struct windows.kernel32 ;
IN: io.sockets.windows.nt IN: io.sockets.windows.nt
: malloc-int ( object -- object ) : malloc-int ( object -- object )
@ -15,7 +15,7 @@ M: winnt WSASocket-flags ( -- DWORD )
: get-ConnectEx-ptr ( socket -- void* ) : get-ConnectEx-ptr ( socket -- void* )
SIO_GET_EXTENSION_FUNCTION_POINTER SIO_GET_EXTENSION_FUNCTION_POINTER
WSAID_CONNECTEX WSAID_CONNECTEX
"GUID" heap-size GUID heap-size
"void*" <c-object> "void*" <c-object>
[ [
"void*" heap-size "void*" heap-size

View File

@ -3,7 +3,7 @@
USING: alien alien.c-types alien.strings alien.syntax USING: alien alien.c-types alien.strings alien.syntax
combinators io.encodings.utf16n io.files io.pathnames kernel combinators io.encodings.utf16n io.files io.pathnames kernel
windows.errors windows.com windows.com.syntax windows.user32 windows.errors windows.com windows.com.syntax windows.user32
windows.ole32 windows ; windows.ole32 windows specialized-arrays.ushort ;
IN: windows.shell32 IN: windows.shell32
CONSTANT: CSIDL_DESKTOP HEX: 00 CONSTANT: CSIDL_DESKTOP HEX: 00
@ -90,7 +90,7 @@ ALIAS: ShellExecute ShellExecuteW
: shell32-directory ( n -- str ) : shell32-directory ( n -- str )
f swap f SHGFP_TYPE_DEFAULT f swap f SHGFP_TYPE_DEFAULT
MAX_UNICODE_PATH "ushort" <c-array> MAX_UNICODE_PATH <ushort-array>
[ SHGetFolderPath drop ] keep utf16n alien>string ; [ SHGetFolderPath drop ] keep utf16n alien>string ;
: desktop ( -- str ) : desktop ( -- str )

View File

@ -2,7 +2,8 @@
! 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 arrays USING: alien alien.c-types alien.strings alien.syntax arrays
byte-arrays kernel math sequences windows.types windows.kernel32 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 IN: windows.winsock
USE: libc USE: libc
@ -121,12 +122,12 @@ C-STRUCT: sockaddr-in6
{ { "uchar" 16 } "addr" } { { "uchar" 16 } "addr" }
{ "uint" "scopeid" } ; { "uint" "scopeid" } ;
C-STRUCT: hostent STRUCT: hostent
{ "char*" "name" } { name char* }
{ "void*" "aliases" } { aliases void* }
{ "short" "addrtype" } { addrtype short }
{ "short" "length" } { length short }
{ "void*" "addr-list" } ; { addr-list void* } ;
C-STRUCT: addrinfo C-STRUCT: addrinfo
{ "int" "flags" } { "int" "flags" }
@ -142,11 +143,8 @@ C-STRUCT: timeval
{ "long" "sec" } { "long" "sec" }
{ "long" "usec" } ; { "long" "usec" } ;
: hostent-addr ( hostent -- addr ) hostent-addr-list *void* ; ! *uint ;
LIBRARY: winsock LIBRARY: winsock
FUNCTION: int setsockopt ( SOCKET s, int level, int optname, char* optval, int optlen ) ; FUNCTION: int setsockopt ( SOCKET s, int level, int optname, char* optval, int optlen ) ;
FUNCTION: ushort htons ( ushort n ) ; 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 CONSTANT: SIO_GET_EXTENSION_FUNCTION_POINTER -939524090
: WSAID_CONNECTEX ( -- GUID ) CONSTANT: WSAID_CONNECTEX GUID: {25a207b9-ddf3-4660-8ee9-76e58c74063e}
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> ;
: winsock-expected-error? ( n -- ? ) : 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 ) : (winsock-error-string) ( n -- str )
! #! WSAStartup returns the error code 'n' directly ! #! WSAStartup returns the error code 'n' directly