1 USING: io.ports io.windows threads.private kernel
2 io.backend windows.winsock windows.kernel32 windows
3 io.streams.duplex io namespaces alien.syntax system combinators
4 io.buffers io.encodings io.encodings.utf8 combinators.lib ;
5 IN: io.windows.ce.backend
7 : port-errored ( port -- )
8 win32-error-string swap set-port-error ;
10 M: wince io-multiplex ( ms -- )
11 60 60 * 1000 * or (sleep) ;
13 M: wince add-completion ( handle -- ) drop ;
15 GENERIC: wince-read ( port port-handle -- )
17 M: input-port (wait-to-read) ( port -- )
18 dup dup port-handle wince-read pending-error ;
20 GENERIC: wince-write ( port port-handle -- )
23 dup buffer-empty? over port-error or [
26 dup dup port-handle wince-write port-flush
29 M: wince init-io ( -- )
33 FUNCTION: void* _getstdfilex int fd ;
34 FUNCTION: void* _fileno void* file ;
36 M: wince (init-stdio) ( -- )
37 #! We support Windows NT too, to make this I/O backend
39 512 default-buffer-size [
41 STD_INPUT_HANDLE GetStdHandle
42 STD_OUTPUT_HANDLE GetStdHandle
43 STD_ERROR_HANDLE GetStdHandle
45 0 _getstdfilex _fileno
46 1 _getstdfilex _fileno
47 2 _getstdfilex _fileno
48 ] if [ f <win32-file> ] 3apply
49 [ <input-port> ] [ <output-port> ] [ <output-port> ] tri*