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

Annotation of /sml/trunk/src/cm/tools/stdtool.sml

Parent Directory Parent Directory | Revision Log Revision Log


Revision 277 - (view) (download)

1 : blume 277 (*
2 :     * A functor for making "standard" tools (e.g., yacctool, lextool, ...)
3 :     *
4 :     * (C) 1999 Lucent Technologies, Bell Laboratories
5 :     *
6 :     * Author: Matthias Blume (blume@kurims.kyoto-u.ac.jp)
7 :     *)
8 : blume 276 signature STDTOOL = sig
9 :     val command : string option -> string
10 :     end
11 :    
12 :     functor StdShellCmdTool
13 :     (val tool : string
14 :     val class : string
15 :     val suffixes : string list
16 :     val command : string * string
17 :     val extensionStyle : Tools.extensionStyle
18 :     val sml : bool) : STDTOOL =
19 :     struct
20 :     val command = EnvConfig.new SOME command
21 :     fun rule (f, ctxt) = let
22 :     val targetfiles = Tools.extend extensionStyle f
23 :     val mkTarget =
24 :     if sml then (fn tf => (tf, SOME "sml")) else (fn tf => (tf, NONE))
25 :     val targets = map mkTarget targetfiles
26 :     fun runcmd () = let
27 :     val cmd = concat [command NONE, " ", f]
28 :     val _ = Say.vsay (concat ["[", cmd, "]\n"])
29 :     in
30 :     if OS.Process.system cmd = OS.Process.success then ()
31 :     else raise Tools.ToolError { tool = tool, msg = cmd }
32 :     end
33 :     fun rfun () =
34 :     (if Tools.outdated tool (targetfiles, f) then runcmd () else ();
35 :     targets)
36 :     in
37 :     ctxt rfun
38 :     end
39 :    
40 :     val _ = Tools.registerClass (class, rule)
41 :    
42 :     fun sfx s =
43 :     Tools.registerClassifier
44 :     (Tools.stdSfxClassifier { sfx = s, class = class })
45 :    
46 :     val _ = app sfx suffixes
47 :     end

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