windows.winsock: Add sockaddr>ip.
parent
8bfed897a8
commit
6f8043241e
|
@ -1,9 +1,10 @@
|
||||||
! Copyright (C) 2006 Mackenzie Straight, Doug Coleman.
|
! Copyright (C) 2006 Mackenzie Straight, Doug Coleman.
|
||||||
! 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: accessors alien alien.c-types alien.data alien.strings
|
||||||
byte-arrays kernel literals math sequences windows.types
|
alien.syntax arrays byte-arrays classes.struct grouping init
|
||||||
windows.kernel32 windows.errors math.bitwise io.encodings.utf16n
|
io.encodings.utf16n kernel literals math math.bitwise
|
||||||
classes.struct windows.com.syntax init ;
|
math.parser sequences windows.com.syntax windows.errors
|
||||||
|
windows.kernel32 windows.types ;
|
||||||
FROM: alien.c-types => short ;
|
FROM: alien.c-types => short ;
|
||||||
IN: windows.winsock
|
IN: windows.winsock
|
||||||
|
|
||||||
|
@ -145,6 +146,14 @@ STRUCT: timeval
|
||||||
{ sec long }
|
{ sec long }
|
||||||
{ usec long } ;
|
{ usec long } ;
|
||||||
|
|
||||||
|
GENERIC: sockaddr>ip ( sockaddr -- string )
|
||||||
|
|
||||||
|
M: sockaddr-in sockaddr>ip ( sockaddr -- string )
|
||||||
|
addr>> uint <ref> [ number>string ] { } map-as "." join ;
|
||||||
|
|
||||||
|
M: sockaddr-in6 sockaddr>ip ( uchar-array -- string )
|
||||||
|
addr>> [ >hex ] { } map-as 2 group [ concat ] map ":" join ;
|
||||||
|
|
||||||
C-TYPE: fd_set
|
C-TYPE: fd_set
|
||||||
|
|
||||||
LIBRARY: winsock
|
LIBRARY: winsock
|
||||||
|
|
Loading…
Reference in New Issue