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/Unix/os-path.sml
ViewVC logotype

Annotation of /sml/trunk/src/compiler/PervEnv/Unix/os-path.sml

Parent Directory Parent Directory | Revision Log Revision Log


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

1 : monnier 16 (* os-path.sml
2 :     *
3 :     * COPYRIGHT (c) 1995 AT&T Bell Laboratories.
4 :     *
5 :     * This is the UNIX implementation of the generic OS.Path structure.
6 :     *
7 :     *)
8 :    
9 :     structure OS_Path = OS_PathFn (
10 :     struct
11 :    
12 :     exception Path
13 :    
14 :     datatype arc_kind = Null | Parent | Current | Arc of string
15 :    
16 :     fun classify "" = Null
17 :     | classify "." = Current
18 :     | classify ".." = Parent
19 :     | classify a = Arc a
20 :    
21 :     val parentArc = ".."
22 :    
23 :     val currentArc = "."
24 :    
25 :     fun validVolume (_, vol)= Substring.isEmpty vol
26 :    
27 :     val volSS = Substring.all ""
28 :    
29 :     (* Note: we are guaranteed that this is never called with "" *)
30 :     fun splitVolPath s = if (InlineT.CharVector.sub(s, 0) = #"/")
31 :     then (true, volSS, Substring.triml 1 (Substring.all s))
32 :     else (false, volSS, Substring.all s)
33 :    
34 :     fun joinVolPath (true, "", "") = "/"
35 :     | joinVolPath (true, "", s) = "/" ^ s
36 :     | joinVolPath (false, "", s) = s
37 :     | joinVolPath _ = raise Path (* invalid volume *)
38 :    
39 :     val arcSepChar = #"/"
40 :    
41 :     end);
42 :    
43 :     (*
44 :     * $Log: os-path.sml,v $
45 : monnier 93 * Revision 1.1.1.1 1998/04/08 18:39:58 george
46 :     * Version 110.5
47 : monnier 16 *
48 :     *)

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