Home My Page Projects Code Snippets Project Openings SML/NJ
Summary Activity Forums Tracker Lists Tasks Docs Surveys News SCM Files

SCM Repository

[smlnj] Diff of /sml/trunk/src/compiler/PervEnv/Win32/os-io.sml
ViewVC logotype

Diff of /sml/trunk/src/compiler/PervEnv/Win32/os-io.sml

Parent Directory Parent Directory | Revision Log Revision Log | View Patch Patch

sml/branches/SMLNJ/src/compiler/PervEnv/Win32/os-io.sml revision 17, Wed Mar 11 21:00:18 1998 UTC sml/trunk/src/compiler/PervEnv/Win32/os-io.sml revision 144, Mon Sep 7 21:46:44 1998 UTC
# Line 1  Line 1 
1  (* os-io.sml  (* os-io.sml
2   *   *
3     * COPYRIGHT (c) 1998 Bell Labs, Lucent Technologies.
4   * COPYRIGHT (c) 1996 Bell Laboratories.   * COPYRIGHT (c) 1996 Bell Laboratories.
5   *   *
6   * Win32 implementation of the OS.IO structure.   * Replacement OS.IO structure for Win32.
7   *   * It implements a simple type of polling for file objects.
8     * This file requires a runtime system supporting polling in Win32-IO.
9   *)   *)
10    
11  structure OS_IO : OS_IO =  structure OS_IO : OS_IO =
12      struct      struct
13          structure W32G = Win32_General          structure W32G = Win32_General
14          structure W32FS = Win32_FileSys          structure W32FS = Win32_FileSys
15            type word32 = Word32.word
16    
17          exception SysErr = Assembly.SysErr          exception SysErr = Assembly.SysErr
18    
19          type iodesc = OS.IO.iodesc          type iodesc = OS.IO.iodesc (* IODesc of W32G.hndl ref *)
20    
21          (* hash: can't assume 32 bits *)          (* hash: can't assume 32 bits *)
22          fun hash (OS.IO.IODesc (ref (0wxffffffff : W32G.hndl))) =          fun hash (OS.IO.IODesc (ref (0wxffffffff : W32G.hndl))) =
# Line 45  Line 48 
48                      else Kind.dir                      else Kind.dir
49    
50          (* no win32 polling devices for now *)          (* no win32 polling devices for now *)
51          val noPolling = "polling not implemented for win32"          val noPolling = "polling not implemented for win32 for this device/type"
52    
53          type poll_desc = unit          datatype poll_desc = PollDesc of iodesc
54          type poll_info = unit          datatype poll_info = PollInfo of poll_desc
55    
56          fun pollDesc id = NONE : poll_desc option          fun pollDesc id = SOME (PollDesc id) (* NONE *)
57          fun pollToIODesc pd = raise Fail("pollToIODesc: "^noPolling)          fun pollToIODesc (PollDesc pd) = pd (* raise Fail("pollToIODesc: "^noPolling) *)
58          exception Poll          exception Poll
59    
60          fun pollIn pd = raise Fail("pollIn: "^noPolling)          fun pollIn pd = pd (* raise Fail("pollIn: "^noPolling) *)
61          fun pollOut pd = raise Fail("pollOut: "^noPolling)          fun pollOut pd = pd (* raise Fail("pollOut: "^noPolling) *)
62          fun pollPri pd = raise Fail("pollPri: "^noPolling)          fun pollPri pd = pd (* raise Fail("pollPri: "^noPolling) *)
63    
64          fun poll (pdl,t) = raise Fail("poll: "^noPolling)          local
65                val poll' : (word32 list * (Int32.int * int) option -> word32 list) =
66                    CInterface.c_function "WIN32-IO" "poll"
67                fun toPollInfo (w) = PollInfo (PollDesc (OS.IO.IODesc (ref w)))
68                fun fromPollDesc (PollDesc (OS.IO.IODesc (ref w))) = w
69            in
70                fun poll (pdl,t) =
71                    let val timeout = (case t
72                                         of SOME (t) => SOME (Time.toSeconds (t),
73                                                              Int.fromLarge (Time.toMicroseconds t))
74                                          | NONE => NONE)
75                        val info = poll' (List.map fromPollDesc pdl,timeout)
76                    in
77                        List.map toPollInfo info
78                    end
79            end
80    
81          fun isIn pd = raise Fail("isIn: "^noPolling)          fun isIn pd = raise Fail("isIn: "^noPolling)
82          fun isOut pd = raise Fail("isOut: "^noPolling)          fun isOut pd = raise Fail("isOut: "^noPolling)
83          fun isPri pd = raise Fail("isPri: "^noPolling)          fun isPri pd = raise Fail("isPri: "^noPolling)
84    
85          fun infoToPollDesc pi = raise Fail("infoToPollDesc: "^noPolling)          fun infoToPollDesc (PollInfo pd) = pd (* raise Fail("infoToPollDesc: "^noPolling) *)
86      end      end
   
   
 (*  
  * $Log: os-io.sml,v $  
  * Revision 1.2  1997/06/02 19:16:29  jhr  
  *   SML'97 Basis Library changes (phase 2)  
  *  
  * Revision 1.1.1.1  1997/01/14  01:38:26  george  
  *   Version 109.24  
  *  
  *)  

Legend:
Removed from v.17  
changed lines
  Added in v.144

root@smlnj-gforge.cs.uchicago.edu
ViewVC Help
Powered by ViewVC 1.0.0