X-Git-Url: http://git.nguyen.vg/gitweb/?a=blobdiff_plain;f=src%2Fuid.ml;fp=src%2Fuid.ml;h=46b86587695ccfab71fe506452268c44584ec25b;hb=cba2938d929fd5119b1491686ddc224d5af618c6;hp=0000000000000000000000000000000000000000;hpb=0cf8def92c8c6e708ec333b13dbe46decf554d81;p=tatoo.git diff --git a/src/uid.ml b/src/uid.ml new file mode 100644 index 0000000..46b8658 --- /dev/null +++ b/src/uid.ml @@ -0,0 +1,29 @@ +(***********************************************************************) +(* *) +(* TAToo *) +(* *) +(* Kim Nguyen, LRI UMR8623 *) +(* Université Paris-Sud & CNRS *) +(* *) +(* Copyright 2010-2012 Université Paris-Sud and Centre National de la *) +(* Recherche Scientifique. All rights reserved. This file is *) +(* distributed under the terms of the GNU Lesser General Public *) +(* License, with the special exception on linking described in file *) +(* ../LICENSE. *) +(* *) +(***********************************************************************) + +type t = int + +exception Overflow +let make_maker () = + let _id = ref ~-1 in + fun () -> + incr _id; + let i = !_id in + if i < 0 then raise Overflow else i + +let dummy = -1 + +external to_int : t -> int = "%identity" +external of_int : int -> t= "%identity"