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

SCM Repository

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

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

Parent Directory Parent Directory | Revision Log Revision Log


Revision 93 - (view) (download)
Original Path: sml/branches/SMLNJ/src/compiler/PervEnv/Win32/os-io.sml

1 : monnier 16 (* os-io.sml
2 :     *
3 :     * COPYRIGHT (c) 1996 Bell Laboratories.
4 :     *
5 :     * Win32 implementation of the OS.IO structure.
6 :     *
7 :     *)
8 :    
9 :     structure OS_IO : OS_IO =
10 :     struct
11 :     structure W32G = Win32_General
12 :     structure W32FS = Win32_FileSys
13 :    
14 :     exception SysErr = Assembly.SysErr
15 :    
16 :     type iodesc = OS.IO.iodesc
17 :    
18 :     (* hash: can't assume 32 bits *)
19 :     fun hash (OS.IO.IODesc (ref (0wxffffffff : W32G.hndl))) =
20 :     0wx7fffffff : word
21 :     | hash (OS.IO.IODesc (ref h)) = (Word.fromInt o W32G.Word.toInt) h
22 :    
23 :     fun compare (OS.IO.IODesc (ref wa),OS.IO.IODesc (ref wb)) =
24 :     W32G.Word.compare(wa,wb)
25 :    
26 :     datatype iodesc_kind = K of string
27 :    
28 :     structure Kind =
29 :     struct
30 :     val file = K "FILE"
31 :     val dir = K "DIR"
32 :     val symlink = K "LINK"
33 :     val tty = K "TTY"
34 :     val pipe = K "PIPE"
35 :     val socket = K "SOCK"
36 :     val device = K "DEV"
37 :     end
38 :    
39 :     fun kind (OS.IO.IODesc (ref h)) =
40 :     case W32FS.getFileAttributes' h of
41 :     NONE =>
42 :     K "UNKNOWN"
43 :     | SOME w =>
44 :     if W32FS.isRegularFile h then Kind.file
45 :     else Kind.dir
46 :    
47 :     (* no win32 polling devices for now *)
48 :     val noPolling = "polling not implemented for win32"
49 :    
50 :     type poll_desc = unit
51 :     type poll_info = unit
52 :    
53 :     fun pollDesc id = NONE : poll_desc option
54 :     fun pollToIODesc pd = raise Fail("pollToIODesc: "^noPolling)
55 :     exception Poll
56 :    
57 :     fun pollIn pd = raise Fail("pollIn: "^noPolling)
58 :     fun pollOut pd = raise Fail("pollOut: "^noPolling)
59 :     fun pollPri pd = raise Fail("pollPri: "^noPolling)
60 :    
61 :     fun poll (pdl,t) = raise Fail("poll: "^noPolling)
62 :    
63 :     fun isIn pd = raise Fail("isIn: "^noPolling)
64 :     fun isOut pd = raise Fail("isOut: "^noPolling)
65 :     fun isPri pd = raise Fail("isPri: "^noPolling)
66 :    
67 :     fun infoToPollDesc pi = raise Fail("infoToPollDesc: "^noPolling)
68 :     end
69 :    
70 :    
71 :     (*
72 :     * $Log: os-io.sml,v $
73 : monnier 93 * Revision 1.1.1.1 1998/04/08 18:40:01 george
74 :     * Version 110.5
75 : monnier 16 *
76 :     *)

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