Home My Page Projects Code Snippets Project Openings SML/NJ
Summary Activity Forums Tracker Lists Tasks Docs Surveys News SCM Files

SCM Repository

[smlnj] View of /sml/trunk/src/smlnj-lib/Controls/control-util.sml
ViewVC logotype

View of /sml/trunk/src/smlnj-lib/Controls/control-util.sml

Parent Directory Parent Directory | Revision Log Revision Log


Revision 1207 - (download) (annotate)
Tue May 21 01:42:14 2002 UTC (17 years, 3 months ago) by jhr
File size: 999 byte(s)
  New files.
(* control-util.sml
 *
 * COPYRIGHT (c) 2002 Bell Labs, Lucent Technologies
 *)

structure ControlUtil : CONTROL_UTIL =
  struct

    structure Cvt = struct
        val int = { tyName = "int",
		    fromString = Int.fromString,
		    toString = Int.toString }
        val bool = { tyName = "bool",
		     fromString = Bool.fromString,
		     toString = Bool.toString }
        val real = { tyName = "real",
		     fromString = Real.fromString,
		     toString = Real.toString }

	val stringList = {
		tyName = "string list",
		fromString = SOME o String.fields (fn c => c = #","),
		toString = (
		  fn [] => ""
		   | [x] => x
		   | x::r => concat(x :: List.foldr (fn (y, l) => ","::y::l) [] r)
		  (* end fn *))
	      }

	val string : string Controls.value_cvt =
	    { tyName = "string",
	      fromString = SOME,
	      toString = fn x => x }
      end

    structure EnvName = struct
	fun toUpper prefix s =
	    prefix ^ String.map (fn #"-" => #"_" | c => Char.toUpper c) s
      end

  end

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