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/branches/SMLNJ/src/compiler/PervEnv/Win32/os-io.sml
ViewVC logotype

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

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

revision 93, Tue May 12 21:56:22 1998 UTC revision 113, Fri Jun 5 19:41:21 1998 UTC
# Line 1  Line 1 
1  (* os-io.sml  (* win32-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 of OS.IO structure for Win32.
7   *   * It implements a simple type of polling for file objects.
8   *)   *)
9    
10  structure OS_IO : OS_IO =  structure OS_IO : OS_IO =
11      struct      struct
12          structure W32G = Win32_General          structure W32G = Win32_General
13          structure W32FS = Win32_FileSys          structure W32FS = Win32_FileSys
14            type word32 = Word32.word
15    
16          exception SysErr = Assembly.SysErr          exception SysErr = Assembly.SysErr
17    
18          type iodesc = OS.IO.iodesc          type iodesc = OS.IO.iodesc (* IODesc of W32G.hndl ref *)
19    
20          (* hash: can't assume 32 bits *)          (* hash: can't assume 32 bits *)
21          fun hash (OS.IO.IODesc (ref (0wxffffffff : W32G.hndl))) =          fun hash (OS.IO.IODesc (ref (0wxffffffff : W32G.hndl))) =
# Line 45  Line 47 
47                      else Kind.dir                      else Kind.dir
48    
49          (* no win32 polling devices for now *)          (* no win32 polling devices for now *)
50          val noPolling = "polling not implemented for win32"          val noPolling = "polling not implemented for win32 for this device/type"
51    
52          type poll_desc = unit          datatype poll_desc = PollDesc of iodesc
53          type poll_info = unit          datatype poll_info = PollInfo of poll_desc
54    
55          fun pollDesc id = NONE : poll_desc option          fun pollDesc id = SOME (PollDesc id) (* NONE *)
56          fun pollToIODesc pd = raise Fail("pollToIODesc: "^noPolling)          fun pollToIODesc (PollDesc pd) = pd (* raise Fail("pollToIODesc: "^noPolling) *)
57          exception Poll          exception Poll
58    
59          fun pollIn pd = raise Fail("pollIn: "^noPolling)          fun pollIn pd = pd (* raise Fail("pollIn: "^noPolling) *)
60          fun pollOut pd = raise Fail("pollOut: "^noPolling)          fun pollOut pd = pd (* raise Fail("pollOut: "^noPolling) *)
61          fun pollPri pd = raise Fail("pollPri: "^noPolling)          fun pollPri pd = pd (* raise Fail("pollPri: "^noPolling) *)
62    
63          fun poll (pdl,t) = raise Fail("poll: "^noPolling)          local
64                val poll' : (word32 list * (Int32.int * int) option -> word32 list) =
65                    CInterface.c_function "WIN32-IO" "poll"
66                fun toPollInfo (w) = PollInfo (PollDesc (OS.IO.IODesc (ref w)))
67                fun fromPollDesc (PollDesc (OS.IO.IODesc (ref w))) = w
68            in
69                fun poll (pdl,t) =
70                    let val timeout = (case t
71                                         of SOME (t) => SOME (Time.toSeconds (t),
72                                                              Int.fromLarge (Time.toMicroseconds t))
73                                          | NONE => NONE)
74                        val info = poll' (List.map fromPollDesc pdl,timeout)
75                    in
76                        List.map toPollInfo info
77                    end
78            end
79    
80          fun isIn pd = raise Fail("isIn: "^noPolling)          fun isIn pd = raise Fail("isIn: "^noPolling)
81          fun isOut pd = raise Fail("isOut: "^noPolling)          fun isOut pd = raise Fail("isOut: "^noPolling)
82          fun isPri pd = raise Fail("isPri: "^noPolling)          fun isPri pd = raise Fail("isPri: "^noPolling)
83    
84          fun infoToPollDesc pi = raise Fail("infoToPollDesc: "^noPolling)          fun infoToPollDesc (PollInfo pd) = pd (* raise Fail("infoToPollDesc: "^noPolling) *)
85      end      end
   
   
 (*  
  * $Log: os-io.sml,v $  
  * Revision 1.1.1.1  1998/04/08 18:40:01  george  
  * Version 110.5  
  *  
  *)  

Legend:
Removed from v.93  
changed lines
  Added in v.113

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