4fbfc1cdeabcbda8bfb6175921b87d577ada82b9
[tatoo.git] / src / state.ml
1 (***********************************************************************)
2 (*                                                                     *)
3 (*                               TAToo                                 *)
4 (*                                                                     *)
5 (*                     Kim Nguyen, LRI UMR8623                         *)
6 (*                   Université Paris-Sud & CNRS                       *)
7 (*                                                                     *)
8 (*  Copyright 2010-2012 Université Paris-Sud and Centre National de la *)
9 (*  Recherche Scientifique. All rights reserved.  This file is         *)
10 (*  distributed under the terms of the GNU Lesser General Public       *)
11 (*  License, with the special exception on linking described in file   *)
12 (*  ../LICENSE.                                                        *)
13 (*                                                                     *)
14 (***********************************************************************)
15
16 open Format
17
18 type t = int
19 let make =
20   let id = ref ~-1 in
21     fun () -> incr id; !id
22
23 let compare = (-)
24
25 let equal = (==)
26
27 external hash : t -> int =  "%identity"
28
29 let print fmt x = fprintf fmt "q%a" Pretty.pp_subscript x
30
31 let dump fmt x = print fmt x
32
33 let check x =
34   if x < 0 then failwith (Printf.sprintf "State: Assertion %i < 0 failed" x)
35
36 let dummy = max_int