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/controls-sig.sml
ViewVC logotype

Annotation of /sml/trunk/src/smlnj-lib/Controls/controls-sig.sml

Parent Directory Parent Directory | Revision Log Revision Log


Revision 1633 - (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 : mblume 1633 val set' : 'a control * 'a -> unit -> unit (* delayed,
51 :     * error checking in 1st stage *)
52 : jhr 1193 val info : 'a control -> {priority : priority, obscurity : int, help : string}
53 :    
54 : mblume 1633 (* capture current value (1st stage) and restore it (2nd stage) *)
55 :     val save'restore : 'a control -> unit -> unit
56 :    
57 : jhr 1193 (* compare the priority of two controls *)
58 :     val compare : ('a control * 'a control) -> order
59 :    
60 :     end

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