Better DNS slave handling
[hcoop/domtool2.git] / src / env.sig
CommitLineData
492c1cff
AC
1(* HCoop Domtool (http://hcoop.sourceforge.net/)
2 * Copyright (c) 2006, Adam Chlipala
3 *
4 * This program is free software; you can redistribute it and/or
5 * modify it under the terms of the GNU General Public License
6 * as published by the Free Software Foundation; either version 2
7 * of the License, or (at your option) any later version.
8 *
9 * This program is distributed in the hope that it will be useful,
10 * but WITHOUT ANY WARRANTY; without even the implied warranty of
11 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
12 * GNU General Public License for more details.
13 *
14 * You should have received a copy of the GNU General Public License
15 * along with this program; if not, write to the Free Software
16 * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
dac62e84 17 *)
492c1cff
AC
18
19(* Domtool type-checking and reduction environments *)
20
21signature ENV = sig
22
a3698041
AC
23 type typeRule = Ast.exp -> bool
24 val registerType : string * typeRule -> unit
25 val typeRule : string -> typeRule option
26
27 type env_vars = Ast.exp Ast.StringMap.map
28 type action = env_vars * Ast.exp list -> env_vars
29 val registerAction : string * action -> unit
30 val action : string -> action option
31
32 val registerContainer : string * action * (unit -> unit) -> unit
33 val container : string -> (action * (unit -> unit)) option
34
e0b0abd2
AC
35 (* Actions to take before and after evaluating a file *)
36 val registerPre : (unit -> unit) -> unit
37 val pre : unit -> unit
38 val registerPost : (unit -> unit) -> unit
39 val post : unit -> unit
40
629a34f6
AC
41 val badArgs : string * Ast.exp list -> 'a
42 val badArg : string * string * Ast.exp -> 'a
43
44 type 'a arg = Ast.exp -> 'a option
45
46 val int : int arg
47 val string : string arg
48 val list : 'a arg -> 'a list arg
49
ed9fda3a 50 val none : string -> (unit -> unit) -> action
629a34f6
AC
51 val one : string -> string * 'a arg -> ('a -> unit) -> action
52 val two : string -> string * 'a arg * string * 'b arg -> ('a * 'b -> unit) -> action
53
6ae327f8 54 val oneV : string -> string * 'a arg -> (env_vars * 'a -> unit) -> action
e0b0abd2 55 val twoV : string -> string * 'a arg * string * 'b arg -> (env_vars * 'a * 'b -> unit) -> action
6ae327f8
AC
56
57 val env : 'a arg -> env_vars * string -> 'a
58
629a34f6
AC
59 val type_one : string -> 'a arg -> ('a -> bool) -> unit
60
ed9fda3a 61 val action_none : string -> (unit -> unit) -> unit
629a34f6
AC
62 val action_one : string -> string * 'a arg -> ('a -> unit) -> unit
63 val action_two : string -> string * 'a arg * string * 'b arg -> ('a * 'b -> unit) -> unit
64
e0b0abd2 65 val actionV_none : string -> (env_vars -> unit) -> unit
6ae327f8 66 val actionV_one : string -> string * 'a arg -> (env_vars * 'a -> unit) -> unit
e0b0abd2 67 val actionV_two : string -> string * 'a arg * string * 'b arg -> (env_vars * 'a * 'b -> unit) -> unit
6ae327f8
AC
68
69 val container_none : string -> (unit -> unit) * (unit -> unit) -> unit
629a34f6 70 val container_one : string -> string * 'a arg -> ('a -> unit) * (unit -> unit) -> unit
6be996d4 71
6ae327f8
AC
72 val containerV_one : string -> string * 'a arg -> (env_vars * 'a -> unit) * (unit -> unit) -> unit
73
492c1cff
AC
74 type env
75 val empty : env
76
77 val bindType : env -> string -> env
78 val bindVal : env -> string * Ast.typ * Ast.exp option -> env
095de39e 79 val bindContext : env -> string -> env
492c1cff
AC
80
81 val lookupType : env -> string -> bool
82 val lookupVal : env -> string -> Ast.typ option
83 val lookupEquation : env -> string -> Ast.exp option
095de39e 84 val lookupContext : env -> string -> bool
492c1cff 85
095de39e
AC
86 val types : env -> Ast.StringSet.set
87 val vals : env -> Ast.StringSet.set
88 val contexts : env -> Ast.StringSet.set
492c1cff 89end