remove dead code, use ${ and GUID:, structs
parent
d2dd206638
commit
fb3fa1f797
basis
io/sockets/windows/nt
windows
shell32
winsock
|
@ -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
|
||||
|
|
|
@ -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 )
|
||||
|
|
|
@ -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
|
||||
|
|
Loading…
Reference in New Issue