SCM Repository
Annotation of /sml/trunk/src/smlnj-lib/Controls/controls-sig.sml
Parent Directory
|
Revision Log
Revision 1195 - (view) (download)
1 : | jhr | 1193 | (* controls-sig.sml |
2 : | * | ||
3 : | * COPYRIGHT (c) 2002 Bell Labs, Lucent Technologies | ||
4 : | *) | ||
5 : | |||
6 : | signature CONTROLS = | ||
7 : | sig | ||
8 : | |||
9 : | type priority = int list | ||
10 : | type 'a control | ||
11 : | |||
12 : | (* a converter for control values *) | ||
13 : | type 'a value_cvt = { | ||
14 : | tyName : string, | ||
15 : | fromString : string -> 'a option, | ||
16 : | toString : 'a -> string | ||
17 : | } | ||
18 : | |||
19 : | (* create a new control *) | ||
20 : | val control : { | ||
21 : | name : string, (* name of the control *) | ||
22 : | pri : priority, (* control's priority *) | ||
23 : | obscurity : int, (* control's detail level; higher means *) | ||
24 : | (* more obscure *) | ||
25 : | help : string, (* control's description *) | ||
26 : | ctl : 'a ref (* ref cell holding control's state *) | ||
27 : | } -> 'a control | ||
28 : | |||
29 : | (* generate a control *) | ||
30 : | val genControl : { | ||
31 : | name : string, | ||
32 : | pri : priority, | ||
33 : | obscurity : int, | ||
34 : | help : string, | ||
35 : | default : 'a | ||
36 : | } -> 'a control | ||
37 : | |||
38 : | (* this exception is raised to communicate that there is a syntax error | ||
39 : | * in a string representation of a control value. | ||
40 : | *) | ||
41 : | jhr | 1195 | exception ValueSyntax of {tyName : string, ctlName : string, value : string} |
42 : | jhr | 1193 | |
43 : | (* create a string control from a typed control *) | ||
44 : | val stringControl : 'a value_cvt -> 'a control -> string control | ||
45 : | |||
46 : | (* control operations *) | ||
47 : | val name : 'a control -> string | ||
48 : | val get : 'a control -> 'a | ||
49 : | val set : 'a control * 'a -> unit | ||
50 : | val info : 'a control -> {priority : priority, obscurity : int, help : string} | ||
51 : | |||
52 : | (* compare the priority of two controls *) | ||
53 : | val compare : ('a control * 'a control) -> order | ||
54 : | |||
55 : | end |
root@smlnj-gforge.cs.uchicago.edu | ViewVC Help |
Powered by ViewVC 1.0.0 |