[/] [trunk/] [src/] [config/] [config_tree.sig] - Blame information for rev 67

Line No. Rev Author Line
1 4 tbourke
(* $Id: config_tree.sig 62 2008-08-20 11:20:33Z tbourke $
2
 *
3 62 tbourke
 * Copyright (c) 2008 Timothy Bourke (University of NSW and NICTA)
4
 * All rights reserved.
5
 *
6
 * This program is free software; you can redistribute it and/or modify it
7
 * under the terms of the "BSD License" which is distributed with the
8
 * software in the file LICENSE.
9
 *
10
 * This program is distributed in the hope that it will be useful, but
11
 * WITHOUT ANY WARRANTY; without even the implied warranty of
12
 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the BSD
13
 * License for more details.
14 4 tbourke
 *)
15
 
16
signature CONFIG_TREE = sig
17
 
18
  type symbol = Atom.atom
19
 
20
  exception ParseError of int
21
 
22
  datatype entry = Entry   of symbol * entry_type
23
                 | Section of symbol * entry list
24
 
25
       and entry_type = Id     of symbol
26
                      | Int    of int
27 55 tbourke
                      | Bool   of bool
28 4 tbourke
                      | Color  of string
29
                      | Real   of real
30
                      | String of string
31
 
32
  type t = entry list
33
 
34
  val entryToString : entry_type -> string
35
 
36
  val getEntry  : t * symbol list -> entry_type option
37
  val getSymbol : t * symbol list -> symbol option (* String -> symbol *)
38
  val getString : t * symbol list -> string option (* Id -> string,
39
                                                      Int -> string,
40
                                                      Color -> string  *)
41
  val getInt    : t * symbol list -> int option
42
  val getReal   : t * symbol list -> real option   (* Int -> Real      *)
43
  val getColor  : t * symbol list -> string option
44 55 tbourke
  val getBool   : t * symbol list -> bool option   (* give default value *)
45 4 tbourke
 
46
  val parse : (string, 'strm) StringCvt.reader -> 'strm -> t
47
  val output : TextIO.outstream * t -> unit
48
 
49
end
50