From 18fe2d0047bf69c11a661660358f96e12d1336c4 Mon Sep 17 00:00:00 2001
From: Slava Pestov <slava@slava-pestovs-macbook-pro.local>
Date: Sun, 11 May 2008 17:44:39 -0500
Subject: [PATCH] Preparing io.nonblocking for SSL

---
 extra/io/nonblocking/nonblocking.factor | 8 ++++----
 extra/io/unix/backend/backend.factor    | 4 ++--
 extra/io/windows/nt/files/files.factor  | 4 ++--
 3 files changed, 8 insertions(+), 8 deletions(-)

diff --git a/extra/io/nonblocking/nonblocking.factor b/extra/io/nonblocking/nonblocking.factor
index d25d4b7050..40605347b1 100755
--- a/extra/io/nonblocking/nonblocking.factor
+++ b/extra/io/nonblocking/nonblocking.factor
@@ -57,7 +57,7 @@ M: object cancel-io drop ;
 
 M: port timed-out cancel-io ;
 
-GENERIC: (wait-to-read) ( port -- )
+HOOK: (wait-to-read) io-backend ( port -- )
 
 : wait-to-read ( count port -- )
     tuck buffer>> buffer-length > [ (wait-to-read) ] [ drop ] if ;
@@ -126,16 +126,16 @@ M: output-port stream-write
         [ buffer>> >buffer ] 2bi
     ] if ;
 
-GENERIC: port-flush ( port -- )
+HOOK: flush-port io-backend ( port -- )
 
 M: output-port stream-flush ( port -- )
     check-closed
-    [ port-flush ] [ pending-error ] bi ;
+    [ flush-port ] [ pending-error ] bi ;
 
 GENERIC: close-port ( port -- )
 
 M: output-port close-port
-    [ port-flush ] [ call-next-method ] bi ;
+    [ flush-port ] [ call-next-method ] bi ;
 
 M: port close-port
     dup cancel-io
diff --git a/extra/io/unix/backend/backend.factor b/extra/io/unix/backend/backend.factor
index 902af8fe0d..6e738dc3e8 100644
--- a/extra/io/unix/backend/backend.factor
+++ b/extra/io/unix/backend/backend.factor
@@ -148,7 +148,7 @@ M: read-task do-io-task
     io-task-port dup refill
     [ [ reader-eof ] [ drop ] if ] keep ;
 
-M: input-port (wait-to-read)
+M: unix (wait-to-read)
     [ <read-task> add-io-task ] with-port-continuation
     pending-error ;
 
@@ -179,7 +179,7 @@ M: write-task do-io-task
 : (wait-to-write) ( port -- )
     [ add-write-io-task ] with-port-continuation drop ;
 
-M: output-port port-flush ( port -- )
+M: unix flush-port ( port -- )
     dup buffer>> buffer-empty? [ drop ] [ (wait-to-write) ] if ;
 
 M: unix io-multiplex ( ms/f -- )
diff --git a/extra/io/windows/nt/files/files.factor b/extra/io/windows/nt/files/files.factor
index 8839410d91..12fad1a2d0 100755
--- a/extra/io/windows/nt/files/files.factor
+++ b/extra/io/windows/nt/files/files.factor
@@ -85,7 +85,7 @@ M: winnt open-append
 : flush-output ( port -- )
     [ [ (flush-output) ] with-timeout ] with-destructors ;
 
-M: port port-flush
+M: winnt flush-port
     dup buffer>> buffer-empty? [ dup flush-output ] unless drop ;
 
 : finish-read ( overlapped port -- )
@@ -106,5 +106,5 @@ M: port port-flush
         finish-read
     ] [ 2drop ] if ;
 
-M: input-port (wait-to-read) ( port -- )
+M: winnt (wait-to-read) ( port -- )
     [ [ ((wait-to-read)) ] with-timeout ] with-destructors ;