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

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

Parent Directory Parent Directory | Revision Log Revision Log


Revision 1193 - (download) (annotate)
Thu May 16 18:44:04 2002 UTC (17 years, 3 months ago) by jhr
File size: 1058 byte(s)
  Bringing the Yale repository upto date (see CHANGES file for details).
(* control-reps.sml
 *
 * COPYRIGHT (c) 2002 Bell Labs, Lucent Technologies
 *)

structure ControlReps =
  struct

  (* priorities are used for ordering help messages (lexical order) *)
    type priority = int list

    datatype 'a control = Ctl of {
	name : Atom.atom,		(* name of the control *)
	set : 'a -> unit,		(* function to set the control's value *)
	get : unit -> 'a,		(* return the control's value *)
	priority : priority,		(* control's priority *)
	obscurity : int,		(* control's detail level; higher means *)
					(* more obscure *)
	help : string			(* control's description *)
      }

    withtype ('a, 'b) control_set =
	  {ctl : 'a control, info : 'b} AtomTable.hash_table

  (* conversion functions for control values *)
    type 'a value_cvt = {
	tyName : string,
	fromString : string -> 'a option,
	toString : 'a -> string
      }

  (* ">" ordering on priorities *)
    fun priorityGT ([], _) = false
      | priorityGT (_, []) = true
      | priorityGT (x::xs, y::ys) =
	  Int.>(x, y) orelse ((x = y) andalso priorityGT(xs, ys))

  end

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