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 /smlnj-lib/releases/release-110.63/Controls/control-reps.sml
ViewVC logotype

View of /smlnj-lib/releases/release-110.63/Controls/control-reps.sml

Parent Directory Parent Directory | Revision Log Revision Log


Revision 2371 - (download) (annotate)
Thu Mar 22 21:07:48 2007 UTC (13 years, 7 months ago) by blume
File size: 1177 byte(s)
Release 110.63
(* 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 option -> unit -> unit,(* function to set the control's value;
					 * it is delayed (error checking in 1st
					 * stage, actual assignment in 2nd);
					 * if the argument is NONE, then
					 * the 2nd stage will restore the
					 * value that was present during the
					 * first stage *)
	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
      }

    fun priorityGT priorities =
	List.collate Int.compare priorities = GREATER
  end

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