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/tools/tools.sml
ViewVC logotype

Diff of /sml/trunk/src/cm/tools/tools.sml

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

revision 281, Tue May 18 14:57:00 1999 UTC revision 282, Wed May 19 05:14:03 1999 UTC
# Line 48  Line 48 
48          EXTEND of string list          EXTEND of string list
49        | REPLACE of string list * string list        | REPLACE of string list * string list
50    
51        type cmdGetterSetter = string option -> string
52    
53        val newCmdGetterSetter : string * string -> cmdGetterSetter
54    
55        val registerStdShellCmdTool : { tool : string,
56                                        class : string,
57                                        suffixes : string list,
58                                        command : cmdGetterSetter,
59                                        extensionStyle : extensionStyle,
60                                        sml : bool } -> unit
61    
62      (* perform filename extension *)      (* perform filename extension *)
63      val extend : extensionStyle -> fname -> fname list      val extend : extensionStyle -> fname -> fname list
64    
# Line 249  Line 260 
260          expand0          expand0
261      end      end
262    
     (* make the most common kind of rule *)  
263      datatype extensionStyle =      datatype extensionStyle =
264          EXTEND of string list          EXTEND of string list
265        | REPLACE of string list * string list        | REPLACE of string list * string list
# Line 279  Line 289 
289                                             msg = "cannot access " ^ f }                                             msg = "cannot access " ^ f }
290      end      end
291    
292        type cmdGetterSetter = string option -> string
293    
294        fun newCmdGetterSetter sp = EnvConfig.new SOME sp
295    
296        fun registerStdShellCmdTool arg = let
297            val { tool, class, suffixes, command, extensionStyle, sml } = arg
298            fun rule (f, ctxt) = let
299                val targetfiles = extend extensionStyle f
300                val mkTarget =
301                    if sml then (fn tf => (tf, SOME "sml"))
302                    else (fn tf => (tf, NONE))
303                val targets = map mkTarget targetfiles
304                fun runcmd () = let
305                    val cmd = concat [command NONE, " ", f]
306                    val _ = Say.vsay (concat ["[", cmd, "]\n"])
307                in
308                    if OS.Process.system cmd = OS.Process.success then ()
309                    else raise ToolError { tool = tool, msg = cmd }
310                end
311                fun rfun () =
312                    (if outdated tool (targetfiles, f) then runcmd ()
313                     else ();
314                     targets)
315            in
316                ctxt rfun
317            end
318    
319            fun sfx s =
320                registerClassifier (stdSfxClassifier { sfx = s, class = class })
321        in
322            registerClass (class, rule);
323            app sfx suffixes
324        end
325    
326      (* registering standard classes and classifiers *)      (* registering standard classes and classifiers *)
327      local      local
328          fun sfx (s, c) =          fun sfx (s, c) =

Legend:
Removed from v.281  
changed lines
  Added in v.282

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