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

Diff of /sml/branches/SMLNJ/src/compiler/PervEnv/OS/os-path-fn.sml

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

revision 142, Mon Sep 7 21:37:09 1998 UTC revision 143, Mon Sep 7 21:46:44 1998 UTC
# Line 173  Line 173 
173      fun isAbsolute p = #isAbs(fromString p)      fun isAbsolute p = #isAbs(fromString p)
174      fun isRelative p = Bool.not(#isAbs(fromString p))      fun isRelative p = Bool.not(#isAbs(fromString p))
175    
176      fun mkAbsolute (p1, p2) = (case (fromString p1, fromString p2)      fun mkAbsolute {path, relativeTo} = (
177              case (fromString path, fromString relativeTo)
178             of (_, {isAbs=false, ...}) => raise Path             of (_, {isAbs=false, ...}) => raise Path
179              | ({isAbs=true, ...}, _) => p1              | ({isAbs=true, ...}, _) => path
180              | ({vol=v1, arcs=al1, ...}, {vol=v2, arcs=al2, ...}) => let              | ({vol=v1, arcs=al1, ...}, {vol=v2, arcs=al2, ...}) => let
181                  fun mkCanon vol = mkCanonical(toString{                  fun mkCanon vol = mkCanonical(toString{
182                          isAbs=true, vol=vol, arcs=List.@(al2, al1)                          isAbs=true, vol=vol, arcs=List.@(al2, al1)
# Line 187  Line 188 
188                      else raise Path                      else raise Path
189                  end                  end
190            (* end case *))            (* end case *))
191      fun mkRelative (p1, p2) =      fun mkRelative {path, relativeTo} =
192            if (isAbsolute p2)            if (isAbsolute relativeTo)
193              then if (isRelative p1)              then if (isRelative path)
194                then p1                then path
195                else let                else let
196                  val {vol=v1, arcs=al1, ...} = fromString p1                  val {vol=v1, arcs=al1, ...} = fromString path
197                  val {vol=v2, arcs=al2, ...} = fromString(mkCanonical p2)                  val {vol=v2, arcs=al2, ...} = fromString(mkCanonical relativeTo)
198                  fun strip (l, []) = mkArcs l                  fun strip (l, []) = mkArcs l
199                    | strip ([], l) = dotDot([], l)                    | strip ([], l) = dotDot([], l)
200                    | strip (l1 as (x1::r1), l2 as (x2::r2)) = if (x1 = x2)                    | strip (l1 as (x1::r1), l2 as (x2::r2)) = if (x1 = x2)
# Line 232  Line 233 
233    end;    end;
234    
235    
 (*  
  * $Log$  
  *)  

Legend:
Removed from v.142  
changed lines
  Added in v.143

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