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/cm/main/filename-policy.sml
ViewVC logotype

Diff of /sml/trunk/src/cm/main/filename-policy.sml

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

revision 356, Sun Jun 27 11:51:16 1999 UTC revision 357, Mon Jun 28 08:46:30 1999 UTC
# Line 11  Line 11 
11      type policyMaker = { arch: string, os: SMLofNJ.SysInfo.os_kind } -> policy      type policyMaker = { arch: string, os: SMLofNJ.SysInfo.os_kind } -> policy
12    
13      val colocate : policyMaker      val colocate : policyMaker
14      val separate : string -> policyMaker      val separate : { bindir: string, bootdir: string } -> policyMaker
15    
16      val mkBinName : policy -> SrcPath.t -> string      val mkBinName : policy -> SrcPath.t -> string
17      val mkSkelName : policy -> SrcPath.t -> string      val mkSkelName : policy -> SrcPath.t -> string
18      val mkStableName : policy -> SrcPath.t -> string      val mkStableName : policy -> SrcPath.t -> string
19    
20        val kind2name : SMLofNJ.SysInfo.os_kind -> string
21  end  end
22    
23  functor FilenamePolicyFn (val cmdir : string  functor FilenamePolicyFn (val cmdir : string
# Line 32  Line 34 
34        | kind2name SMLofNJ.SysInfo.UNIX = "unix"        | kind2name SMLofNJ.SysInfo.UNIX = "unix"
35        | kind2name SMLofNJ.SysInfo.WIN32 = "win32"        | kind2name SMLofNJ.SysInfo.WIN32 = "win32"
36    
37      fun mkPolicy shiftname { arch, os } = let      fun mkPolicy (shiftbin, shiftstable) { arch, os } = let
38          fun cmname d s = let          fun cmname d s = let
39              val { dir = d0, file = f } = OS.Path.splitDirFile s              val { dir = d0, file = f } = OS.Path.splitDirFile s
40              val d1 = OS.Path.joinDirFile { dir = d0, file = cmdir }              val d1 = OS.Path.joinDirFile { dir = d0, file = cmdir }
# Line 41  Line 43 
43              OS.Path.joinDirFile { dir = d2, file = f }              OS.Path.joinDirFile { dir = d2, file = f }
44          end          end
45          val archos = concat [arch, "-", kind2name os]          val archos = concat [arch, "-", kind2name os]
         val skel = cmname skeldir o SrcPath.osstring  
         val archosdep = cmname archos o shiftname  
46      in      in
47          { skel = skel, bin = archosdep, stable = archosdep }          { skel = cmname skeldir o SrcPath.osstring,
48              bin = cmname archos o shiftbin,
49              stable = cmname archos o shiftstable }
50      end      end
51    
52      val colocate = mkPolicy SrcPath.osstring      val colocate = mkPolicy (SrcPath.osstring, SrcPath.osstring)
53    
54      fun separate root = let      fun separate { bindir, bootdir } = let
55          fun shiftname p =          fun shiftname root p =
56              case SrcPath.reAnchoredName (p, root) of              case SrcPath.reAnchoredName (p, root) of
57                  SOME s => s                  SOME s => s
58                | NONE => (Say.say ["Failure: ", SrcPath.descr p,                | NONE => (Say.say ["Failure: ", SrcPath.descr p,
59                                    " is not an anchored path!\n"];                                    " is not an anchored path!\n"];
60                           raise Fail "bad path")                           raise Fail "bad path")
61      in      in
62          mkPolicy shiftname          mkPolicy (shiftname bindir, shiftname bootdir)
63      end      end
64    
65      fun mkBinName (p: policy) s = #bin p s      fun mkBinName (p: policy) s = #bin p s

Legend:
Removed from v.356  
changed lines
  Added in v.357

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