1 (**************************************************************************)
2 (* *)
3 (* OCaml *)
4 (* *)
5 (* Damien Doligez, projet Para, INRIA Rocquencourt *)
6 (* *)
7 (* Copyright 1999 Institut National de Recherche en Informatique et *)
8 (* en Automatique. *)
9 (* *)
10 (* All rights reserved. This file is distributed under the terms of *)
11 (* the GNU Lesser General Public License version 2.1, with the *)
12 (* special exception on linking described in the file LICENSE. *)
13 (* *)
14 (**************************************************************************)
15
16 external raise : exn -> 'a = "%raise"
17
18 external not : bool -> bool = "%boolnot"
19
20 external (=) : 'a -> 'a -> bool = "%equal"
21 external (<>) : 'a -> 'a -> bool = "%notequal"
22 external (<) : 'a -> 'a -> bool = "%lessthan"
23 external (>) : 'a -> 'a -> bool = "%greaterthan"
24 external (<=) : 'a -> 'a -> bool = "%lessequal"
25 external (>=) : 'a -> 'a -> bool = "%greaterequal"
26
27 external (~-) : int -> int = "%negint"
28 external (+) : int -> int -> int = "%addint"
29 external (-) : int -> int -> int = "%subint"
30 external ( * ) : int -> int -> int = "%mulint"
31 external (/) : int -> int -> int = "%divint"
32 external (mod) : int -> int -> int = "%modint"
33
34 external (land) : int -> int -> int = "%andint"
35 external (lor) : int -> int -> int = "%orint"
36 external (lxor) : int -> int -> int = "%xorint"
37 external (lsl) : int -> int -> int = "%lslint"
38 external (lsr) : int -> int -> int = "%lsrint"
39 external (asr) : int -> int -> int = "%asrint"
40
41 external ignore : 'a -> unit = "%ignore"
42
43 type 'a ref = { mutable contents: 'a }
44 external ref : 'a -> 'a ref = "%makemutable"
45 external (!) : 'a ref -> 'a = "%field0"
46 external (:=) : 'a ref -> 'a -> unit = "%setfield0"
47 external incr : int ref -> unit = "%incr"
48 external decr : int ref -> unit = "%decr"
49
50 type 'a option = None | Some of 'a
51
52 type 'a weak_t;;
53 external weak_create: int -> 'a weak_t = "caml_weak_create";;
54 external weak_set : 'a weak_t -> int -> 'a option -> unit = "caml_weak_set";;
55 external weak_get: 'a weak_t -> int -> 'a option = "caml_weak_get";;
56
57 let x = 42;;
58