| 1 |
|
| 2 |
|
| 3 |
|
| 4 |
|
| 5 |
|
| 6 |
|
| 7 |
|
| 8 |
|
| 9 |
|
| 10 |
|
| 11 |
type t = int |
| 12 |
let initial = 1 |
| 13 |
let dummy = 0 |
| 14 |
let fresh = |
| 15 |
let cur = ref initial in |
| 16 |
fun () -> incr cur; !cur |
| 17 |
let to_string = string_of_int |
| 18 |
let of_int id = id |
| 19 |
let to_int id = id |
| 20 |
let newer_than id1 id2 = id1 > id2 |
| 21 |
|
| 22 |
let state_id_info : (t * t) Exninfo.t = Exninfo.make "stateid" |
| 23 |
let add exn ~valid id = |
| 24 |
Exninfo.add exn state_id_info (valid, id) |
| 25 |
let get exn = Exninfo.get exn state_id_info |
| 26 |
|
| 27 |
let equal = Int.equal |
| 28 |
let compare = Int.compare |
| 29 |
|
| 30 |
let print id = Pp.int id |
| 31 |
|
| 32 |
module Self = struct |
| 33 |
type t = int |
| 34 |
let compare = compare |
| 35 |
end |
| 36 |
|
| 37 |
module Set = Set.Make(Self) |
| 38 |
|
| 39 |
type exn_info = { id : t; valid : t } |
| 40 |
|
| 41 |
type ('a,'b) request = { |
| 42 |
exn_info : exn_info; |
| 43 |
stop : t; |
| 44 |
document : 'b; |
| 45 |
loc : Loc.t option; |
| 46 |
uuid : 'a; |
| 47 |
name : string |
| 48 |
} |
| 49 |
|
| 50 |
let is_valid_ref = ref (fun ~doc:_ (_ : t) -> true) |
| 51 |
let is_valid ~doc id = !is_valid_ref ~doc id |
| 52 |
let set_is_valid f = is_valid_ref := f |