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 1633 - (download) (annotate)
Tue Sep 28 03:08:33 2004 UTC (16 years, 1 month ago) by mblume
File size: 1210 byte(s)
improved Controls interface; minor changes and bug fixes in CM
(* 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 *)
	set' : 'a -> unit -> unit,      (* delayed set (error checking in 1st
					 * stage, actual assignment in 2nd) *)
	get : unit -> 'a,		(* return the control's value *)
	save'restore: unit -> unit -> unit,
	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