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

Annotation of /sml/trunk/src/cm/main/envcfg.sml

Parent Directory Parent Directory | Revision Log Revision Log


Revision 275 - (view) (download)

1 : blume 275 (*
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 EnvConfig = struct
9 :     local
10 :     fun cfg cvt reg session fallback = let
11 :     val default = session ^ "_DEFAULT"
12 :     val getEnv = Option.join o (Option.map cvt) o OS.Process.getEnv
13 :     val r = ref (getOpt (getEnv default, fallback))
14 :     fun getterSetter arg =
15 :     !r before (case arg of SOME new => r := new | NONE => ())
16 :     val reg = fn () => (reg (); ignore (getterSetter (getEnv session)))
17 :     in
18 :     (getterSetter, reg)
19 :     end
20 :     val bool = Bool.fromString
21 :     fun string s = SOME s
22 :     val int = Int.fromString
23 :     in
24 :     val r = fn () => ()
25 :    
26 :     val (verbose, r) = cfg bool r "CM_VERBOSE" true
27 :     val (debug, r) = cfg bool r "CM_DEBUG" false
28 :     val (keep_going, r) = cfg bool r "CM_KEEP_GOING" false
29 :     val (show_exports, r) = cfg bool r "CM_SHOW_EXPORTS" false
30 :    
31 :     val (lex, r) = cfg string r "CM_LEX" "ml-lex"
32 :     val (yacc, r) = cfg string r "CM_YACC" "ml-yacc"
33 :     val (burg, r) = cfg string r "CM_BURG" "ml-burg"
34 :     val (rcsco, r) = cfg string r "CM_RCSCO" "co -q"
35 :    
36 :     val (parse_caching, r) = cfg int r "CM_PARSE_CACHING" 100
37 :    
38 :     val register_all = r
39 :     end
40 :     end

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