From d6f4b25abe2e2f7acec070af6f45c32f257b84bf Mon Sep 17 00:00:00 2001 From: Slava Pestov Date: Wed, 14 Nov 2007 17:04:29 -0500 Subject: [PATCH] Fixes --- extra/destructors/destructors-docs.factor | 2 +- extra/io/windows/nt/backend/backend.factor | 21 ++++++++++++--------- 2 files changed, 13 insertions(+), 10 deletions(-) mode change 100644 => 100755 extra/destructors/destructors-docs.factor diff --git a/extra/destructors/destructors-docs.factor b/extra/destructors/destructors-docs.factor old mode 100644 new mode 100755 index dace054db8..695e3ed950 --- a/extra/destructors/destructors-docs.factor +++ b/extra/destructors/destructors-docs.factor @@ -23,7 +23,7 @@ HELP: close-later HELP: with-destructors { $values { "quot" "a quotation" } } -{ $description "Calls a quotation within a new dynamic scope. This quotation may register destructors, on any object, by wrapping the object in a destructor and implementing " { $link (destruct) } " on that object type. After the quotation finishes, if an error was thrown, all destructors are called and the error is then rethrown. However, if the quotation was successful, only those destructors created with an 'always cleanup' flag will be destroyed." } +{ $description "Calls a quotation within a new dynamic scope. This quotation may register destructors, on any object, by wrapping the object in a destructor and implementing " { $link destruct } " on that object type. After the quotation finishes, if an error was thrown, all destructors are called and the error is then rethrown. However, if the quotation was successful, only those destructors created with an 'always cleanup' flag will be destroyed." } { $notes "Destructors are not allowed to throw exceptions. No exceptions." } { $examples { $code "[ 10 malloc free-always ] with-destructors" } diff --git a/extra/io/windows/nt/backend/backend.factor b/extra/io/windows/nt/backend/backend.factor index c3a6bfd78b..2c6d152e3d 100755 --- a/extra/io/windows/nt/backend/backend.factor +++ b/extra/io/windows/nt/backend/backend.factor @@ -2,7 +2,8 @@ USING: alien alien.c-types arrays assocs combinators continuations destructors io io.backend io.nonblocking io.windows libc kernel math namespaces sequences threads tuples.lib windows windows.errors windows.kernel32 strings -splitting io.files windows.winsock ; +splitting io.files qualified ; +QUALIFIED: windows.winsock IN: io.windows.nt.backend : unicode-prefix ( -- seq ) @@ -62,14 +63,16 @@ C: io-callback : set-port-overlapped ( overlapped port -- ) port-handle set-win32-file-overlapped ; -: completion-port ( handle existing -- handle ) +: ( handle existing -- handle ) f 1 CreateIoCompletionPort dup win32-error=0/f ; -: master-completion-port ( -- handle ) - INVALID_HANDLE_VALUE f completion-port ; +SYMBOL: master-completion-port + +: ( -- handle ) + INVALID_HANDLE_VALUE f ; M: windows-nt-io add-completion ( handle -- ) - \ master-completion-port get-global completion-port drop ; + master-completion-port get-global drop ; TUPLE: GetOverlappedResult-args hFile* lpOverlapped* lpNumberOfBytesTransferred* bWait* port ; @@ -98,8 +101,8 @@ TUPLE: GetQueuedCompletionStatusParams hCompletionPort* lpNumberOfBytes* lpCompl C: GetQueuedCompletionStatusParams : wait-for-overlapped ( ms -- GetQueuedCompletionStatus-Params ret ) - >r \ master-completion-port get-global 0 - 0 0 r> [ + >r master-completion-port get-global 0 0 0 + r> [ GetQueuedCompletionStatusParams >tuple*< GetQueuedCompletionStatus ] keep swap ; @@ -146,7 +149,7 @@ M: windows-nt-io init-io ( -- ) #! Should only be called on startup. Calling this at any #! other time can have unintended consequences. global [ - master-completion-port \ master-completion-port set + master-completion-port set H{ } clone io-hash set - init-winsock + windows.winsock:init-winsock ] bind ;