windows.winsock: Add sockaddr>ip.

db4
Doug Coleman 2012-09-16 17:50:47 -07:00
parent 8bfed897a8
commit 6f8043241e
1 changed files with 13 additions and 4 deletions

View File

@ -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