buf-fill [ swap str-length + ] change
] bind ;
+: buffer-append-char ( int buffer -- )
+ #! Append a single character to a buffer.
+ [
+ buf-ptr get buf-fill get + <alien> 0 set-alien-1
+ buf-fill [ 1 + ] change
+ ] bind ;
+
: buffer-extend ( length buffer -- )
#! Increases the size of the buffer by length.
[
M: win32-server accept ( server -- client )
[
- new-socket 1024 <buffer>
+ new-socket 64 <buffer>
[
alloc-io-task init-overlapped >r >r >r socket get r> r>
- buffer-ptr <alien> 0 "sockaddr-in" size 16 + dup NULL r> AcceptEx
+ buffer-ptr <alien> 0 32 32 NULL r> AcceptEx
[ handle-socket-error ] unless (yield)
] callcc0
swap dup add-completion <win32-stream> dupd <win32-client-stream>
TRAITS: win32-stream
GENERIC: win32-stream-handle
+GENERIC: do-write
SYMBOL: handle
SYMBOL: in-buffer
: maybe-flush-output ( -- )
out-buffer get buffer-length 0 > [ flush-output ] when ;
-: do-write ( str -- )
+M: integer do-write ( int -- )
+ out-buffer get [ buffer-capacity 0 = [ flush-output ] when ] keep
+ buffer-append-char ;
+
+M: string do-write ( str -- )
dup str-length out-buffer get buffer-capacity <= [
out-buffer get buffer-append
] [
{
}
-void primitive_accept_fd(void)
+void primitive_accept_fd(F_WORD *word)
{
- undefined();
+ undefined(word);
}
-void primitive_add_accept_io_task(void)
+void primitive_add_accept_io_task(F_WORD *word)
{
- undefined();
+ undefined(word);
}
-void primitive_server_socket(void)
+void primitive_server_socket(F_WORD *word)
{
- undefined();
+ undefined(word);
}
-void primitive_client_socket(void)
+void primitive_client_socket(F_WORD *word)
{
- undefined();
+ undefined(word);
}
-void primitive_call_profiling(void)
+void primitive_call_profiling(F_WORD *word)
{
- undefined();
+ undefined(word);
}