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

Annotation of /sml/trunk/src/cm/util/stdcfg.sml

Parent Directory Parent Directory | Revision Log Revision Log


Revision 1201 - (view) (download)

1 : blume 354 (*
2 :     * CM parameters that are configurable via shell-environment variables.
3 :     *
4 :     * Copyright (c) 1999 by Lucent Technologies, Bell Laboratories.
5 :     *
6 :     * author: Matthias Blume (blume@cs.princeton.edu)
7 :     *)
8 :     structure StdConfig = struct
9 :     local
10 : blume 1201 val priority = [10, 2]
11 :     val obscurity = 2
12 :     val prefix = "cm"
13 : blume 1126
14 : blume 1201 fun uc #"-" = #"_"
15 :     | uc c = Char.toUpper c
16 :     fun en n = SOME ("CM_" ^ String.map uc n)
17 : blume 1126
18 : blume 1201 val registry = ControlRegistry.new
19 :     { help = "Compilation Manager (CM)" }
20 :    
21 :     val _ = BasicControl.nest (prefix, registry)
22 :    
23 :     val bool_cvt = { tyName = "bool",
24 :     fromString = Bool.fromString,
25 :     toString = Bool.toString }
26 :     val int_cvt = { tyName = "int",
27 :     fromString = Int.fromString,
28 :     toString = Int.toString }
29 :     val sot_cvt =
30 :     { tyName = "string", (* string option thunk *)
31 :     fromString = fn s => SOME (fn () => SOME s),
32 :     toString = fn th => (case th () of
33 :     SOME s => s
34 :     | NONE => "(not set)") }
35 :    
36 :     val string_cvt = { tyName = "string",
37 :     fromString = SOME,
38 :     toString = fn x => x }
39 :    
40 :     fun new (c, n, h, d) = let
41 :     val r = ref d
42 :     val ctl = Controls.control { name = n,
43 :     pri = priority,
44 :     obscurity = obscurity,
45 :     help = h,
46 :     ctl = r }
47 : blume 1126 in
48 : blume 1201 ControlRegistry.register
49 :     registry
50 :     { ctl = Controls.stringControl c ctl,
51 :     envName = en n };
52 :     { set = fn x => r := x,
53 :     get = fn () => !r }
54 : blume 1126 end
55 : blume 354 in
56 : blume 1201 val verbose = new (bool_cvt, "verbose", "CM chattiness", true)
57 :     val debug = new (bool_cvt, "debug", "CM debug mode", false)
58 :     val keep_going = new (bool_cvt, "keep-going",
59 :     "whether CM presses on in face of errors",
60 :     false)
61 :     val pathcfgspec = new (string_cvt, "pathconfig",
62 :     "global path configuration file",
63 :     "/usr/lib/smlnj-pathconfig")
64 : blume 1126 val parse_caching =
65 : blume 1201 new (int_cvt, "parse-caching", "limit on parse trees cached", 100)
66 : blume 369 val local_pathconfig =
67 : blume 1201 new (sot_cvt, "local-pathconfig", "local path configuration file",
68 :     fn () => Option.map (fn h => OS.Path.concat
69 :     (h, ".smlnj-pathconfig"))
70 :     (OS.Process.getEnv "HOME"))
71 :     val warn_obsolete = new (bool_cvt, "warn-obsolete",
72 :     "whether CM accepts old-style syntax",
73 :     true)
74 : blume 1126 val conserve_memory =
75 : blume 1201 new (bool_cvt, "conserve-memory", "CM memory stinginess", false)
76 :     val generate_index = new (bool_cvt, "generate-index",
77 :     "whether CM generates library indices",
78 :     false)
79 : blume 354 end
80 :     end

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