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

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

Parent Directory Parent Directory | Revision Log Revision Log


Revision 1193 - (view) (download)

1 : jhr 1193 (* control-reps.sml
2 :     *
3 :     * COPYRIGHT (c) 2002 Bell Labs, Lucent Technologies
4 :     *)
5 :    
6 :     structure ControlReps =
7 :     struct
8 :    
9 :     (* priorities are used for ordering help messages (lexical order) *)
10 :     type priority = int list
11 :    
12 :     datatype 'a control = Ctl of {
13 :     name : Atom.atom, (* name of the control *)
14 :     set : 'a -> unit, (* function to set the control's value *)
15 :     get : unit -> 'a, (* return the control's value *)
16 :     priority : priority, (* control's priority *)
17 :     obscurity : int, (* control's detail level; higher means *)
18 :     (* more obscure *)
19 :     help : string (* control's description *)
20 :     }
21 :    
22 :     withtype ('a, 'b) control_set =
23 :     {ctl : 'a control, info : 'b} AtomTable.hash_table
24 :    
25 :     (* conversion functions for control values *)
26 :     type 'a value_cvt = {
27 :     tyName : string,
28 :     fromString : string -> 'a option,
29 :     toString : 'a -> string
30 :     }
31 :    
32 :     (* ">" ordering on priorities *)
33 :     fun priorityGT ([], _) = false
34 :     | priorityGT (_, []) = true
35 :     | priorityGT (x::xs, y::ys) =
36 :     Int.>(x, y) orelse ((x = y) andalso priorityGT(xs, ys))
37 :    
38 :     end

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