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 1057, Fri Feb 8 17:31:02 2002 UTC revision 1058, Fri Feb 8 20:02:56 2002 UTC
# Line 19  Line 19 
19    
20      val mkBinName : policy -> SrcPath.file -> string      val mkBinName : policy -> SrcPath.file -> string
21      val mkSkelName : policy -> SrcPath.file -> string      val mkSkelName : policy -> SrcPath.file -> string
22        val mkIdCacheName : policy -> SrcPath.file -> { file: string, key: string }
23      val mkStableName : policy -> SrcPath.file * Version.t option -> string      val mkStableName : policy -> SrcPath.file * Version.t option -> string
24      val mkIndexName : policy -> SrcPath.file -> string      val mkIndexName : policy -> SrcPath.file -> string
25    
# Line 28  Line 29 
29  functor FilenamePolicyFn (val cmdir : string  functor FilenamePolicyFn (val cmdir : string
30                            val versiondir: Version.t -> string                            val versiondir: Version.t -> string
31                            val skeldir : string                            val skeldir : string
32                              val icprefix : string
33                            val indexdir : string) :> FILENAMEPOLICY = struct                            val indexdir : string) :> FILENAMEPOLICY = struct
34    
35      type policy = { bin: SrcPath.file -> string,      type policy = { bin: SrcPath.file -> string,
36                      skel: SrcPath.file -> string,                      skel: SrcPath.file -> string,
37                        id_cache: SrcPath.file -> { file: string, key: string },
38                      stable: SrcPath.file * Version.t option -> string,                      stable: SrcPath.file * Version.t option -> string,
39                      index: SrcPath.file -> string }                      index: SrcPath.file -> string }
40    
# Line 44  Line 47 
47        | kind2name SMLofNJ.SysInfo.WIN32 = "win32"        | kind2name SMLofNJ.SysInfo.WIN32 = "win32"
48    
49      fun mkPolicy (shiftbin, shiftstable, ignoreversion) { arch, os } = let      fun mkPolicy (shiftbin, shiftstable, ignoreversion) { arch, os } = let
50            fun subDir (sd, d) = OS.Path.joinDirFile { dir = d, file = sd }
51          fun cmname dl s = let          fun cmname dl s = let
52              val { dir = d0, file = f } = OS.Path.splitDirFile s              val { dir = d0, file = f } = OS.Path.splitDirFile s
53              val d1 = OS.Path.joinDirFile { dir = d0, file = cmdir }              val d1 = OS.Path.joinDirFile { dir = d0, file = cmdir }
             fun subDir (sd, d) = OS.Path.joinDirFile { dir = d, file = sd }  
54              val d2 = foldl subDir d1 dl              val d2 = foldl subDir d1 dl
55          in          in
56              OS.Path.joinDirFile { dir = d2, file = f }              OS.Path.joinDirFile { dir = d2, file = f }
57          end          end
58          val archos = concat [arch, "-", os]          val archos = concat [arch, "-", os]
59            val archosidcache = concat [icprefix, "-", arch, "-", os]
60          val stable0 = cmname [archos] o shiftstable          val stable0 = cmname [archos] o shiftstable
61          val stable =          val stable =
62              if ignoreversion then stable0 o #1              if ignoreversion then stable0 o #1
# Line 65  Line 69 
69                       in                       in
70                           if exists then try else stable0 s                           if exists then try else stable0 s
71                       end)                       end)
72            fun id_cache src = let
73                val s = SrcPath.osstring src
74                val { dir = d0, file = key } = OS.Path.splitDirFile s
75                val file = foldl subDir d0 [cmdir, archosidcache]
76            in
77                { file = file, key = key }
78            end
79      in      in
80          { skel = cmname [skeldir] o SrcPath.osstring,          { skel = cmname [skeldir] o SrcPath.osstring,
81            bin = cmname [archos] o shiftbin,            bin = cmname [archos] o shiftbin,
82              id_cache = id_cache,
83            stable = stable,            stable = stable,
84            index = cmname [indexdir] o SrcPath.osstring }            index = cmname [indexdir] o SrcPath.osstring }
85      end      end
86    
87      fun ungeneric g { arch, os } = g { arch = arch, os = kind2name os }      fun ungeneric g { arch, os } = g { arch = arch, os = kind2name os }
88    
89      val colocate_generic = mkPolicy (SrcPath.osstring, SrcPath.osstring, false)      val colocate_generic =
90            mkPolicy (SrcPath.osstring, SrcPath.osstring, false)
91    
92      fun separate_generic { bindir, bootdir } = let      fun separate_generic { bindir, bootdir } = let
93          fun shiftname root p = let          fun shiftname root p = let
# Line 95  Line 108 
108    
109      fun mkBinName (p: policy) s = #bin p s      fun mkBinName (p: policy) s = #bin p s
110      fun mkSkelName (p: policy) s = #skel p s      fun mkSkelName (p: policy) s = #skel p s
111        fun mkIdCacheName (p: policy) s = #id_cache p s
112      fun mkStableName (p: policy) (s, v) = #stable p (s, v)      fun mkStableName (p: policy) (s, v) = #stable p (s, v)
113      fun mkIndexName (p: policy) s = #index p s      fun mkIndexName (p: policy) s = #index p s
114  end  end
# Line 102  Line 116 
116  structure FilenamePolicy =  structure FilenamePolicy =
117      FilenamePolicyFn (val cmdir = "CM"      FilenamePolicyFn (val cmdir = "CM"
118                        val skeldir = "SKEL"                        val skeldir = "SKEL"
119                          val icprefix = "IC"
120                        val indexdir = "INDEX"                        val indexdir = "INDEX"
121                        val versiondir = Version.toString)                        val versiondir = Version.toString)

Legend:
Removed from v.1057  
changed lines
  Added in v.1058

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