/usr/lib/ocaml/compiler-libs/typing/primitive.ml is in ocaml-compiler-libs 3.12.1-2ubuntu2.
This file is owned by root:root, with mode 0o644.
The actual contents of the file can be viewed below.
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 | (***********************************************************************)
(* *)
(* Objective Caml *)
(* *)
(* Xavier Leroy, projet Cristal, INRIA Rocquencourt *)
(* *)
(* Copyright 1996 Institut National de Recherche en Informatique et *)
(* en Automatique. All rights reserved. This file is distributed *)
(* under the terms of the Q Public License version 1.0. *)
(* *)
(***********************************************************************)
(* $Id: primitive.ml 8930 2008-07-24 05:35:22Z frisch $ *)
(* Description of primitive functions *)
open Misc
type description =
{ prim_name: string; (* Name of primitive or C function *)
prim_arity: int; (* Number of arguments *)
prim_alloc: bool; (* Does it allocates or raise? *)
prim_native_name: string; (* Name of C function for the nat. code gen. *)
prim_native_float: bool } (* Does the above operate on unboxed floats? *)
let parse_declaration arity decl =
match decl with
| name :: "noalloc" :: name2 :: "float" :: _ ->
{prim_name = name; prim_arity = arity; prim_alloc = false;
prim_native_name = name2; prim_native_float = true}
| name :: "noalloc" :: name2 :: _ ->
{prim_name = name; prim_arity = arity; prim_alloc = false;
prim_native_name = name2; prim_native_float = false}
| name :: name2 :: "float" :: _ ->
{prim_name = name; prim_arity = arity; prim_alloc = true;
prim_native_name = name2; prim_native_float = true}
| name :: "noalloc" :: _ ->
{prim_name = name; prim_arity = arity; prim_alloc = false;
prim_native_name = ""; prim_native_float = false}
| name :: name2 :: _ ->
{prim_name = name; prim_arity = arity; prim_alloc = true;
prim_native_name = name2; prim_native_float = false}
| name :: _ ->
{prim_name = name; prim_arity = arity; prim_alloc = true;
prim_native_name = ""; prim_native_float = false}
| [] ->
fatal_error "Primitive.parse_declaration"
let description_list p =
let list = [p.prim_name] in
let list = if not p.prim_alloc then "noalloc" :: list else list in
let list =
if p.prim_native_name <> "" then p.prim_native_name :: list else list
in
let list = if p.prim_native_float then "float" :: list else list in
List.rev list
let native_name p =
if p.prim_native_name <> ""
then p.prim_native_name
else p.prim_name
let byte_name p =
p.prim_name
|