This file is indexed.

/usr/lib/ocaml/deriving/defs.mli is in libderiving-ocsigen-ocaml-dev 0.7.1-1.

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
 65
 66
 67
 68
 69
 70
 71
 72
 73
 74
 75
 76
 77
 78
 79
 80
 81
 82
 83
 84
 85
 86
 87
 88
 89
 90
 91
 92
 93
 94
 95
 96
 97
 98
 99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
(* Copyright Jeremy Yallop 2007.
   Copyright Grégoire Henry 2011.
   This file is free software, distributed under the MIT license.
   See the file COPYING for details.
*)

open Camlp4.PreCast

module type Loc = sig
  val _loc : Loc.t (* location of the type definition being derived *)
end

module type AstHelpers = sig

  module Untranslate : Type.Untranslate

  val seq: Ast.expr -> Ast.expr -> Ast.expr
  val seq_list: Ast.expr list -> Ast.expr

  val record_pattern: ?prefix:string -> Type.field list -> Ast.patt
  val record_expr: (string * Ast.expr) list -> Ast.expr
  val record_expression: ?prefix:string -> Type.field list -> Ast.expr

  val expr_list: Ast.expr list -> Ast.expr
  val patt_list: Ast.patt list -> Ast.patt

  val tuple_expr: Ast.expr list -> Ast.expr
  val tuple: ?param:string -> int -> string list * Ast.patt * Ast.expr

  val cast_pattern:
    Type.qname Type.NameMap.t  -> ?param:string -> Type.expr ->
    Ast.patt * Ast.expr * Ast.expr

  val modname_from_qname:
    qname:string list -> classname:string -> Ast.ident

end


module type Generator = sig

  type context

  module Loc : Loc
  module AstHelpers : AstHelpers

  val cast_pattern:
    context -> ?param:string -> Type.expr ->
    Ast.patt * Ast.expr * Ast.expr

  val instantiate_modargs_repr: context -> Type.repr -> Type.repr

  class virtual generator : object

    method pack:
      Type.qname Type.NameMap.t -> Type.expr -> Ast.module_expr -> Ast.expr
    method unpack:
      Type.qname Type.NameMap.t -> Type.expr -> Ast.expr -> Ast.module_expr

    method class_sig: Type.qname Type.NameMap.t -> Type.expr -> Ast.module_type

    method rhs: context -> Type.subst -> Type.decl -> Ast.module_expr
    method expr: context -> Type.expr -> Ast.module_expr

    method constr: context -> Type.qname * Type.expr list -> Ast.module_expr

    method param: context -> Type.param -> Ast.module_expr
    method gparam: context -> Type.param * Type.expr -> Ast.module_expr

    method wrap: context -> ?default:Type.name option -> Type.expr -> Ast.str_item list -> Ast.module_expr

    method call_expr: context -> Type.expr -> string -> Ast.expr
    method call_poly_expr: context -> Type.poly_expr -> string -> Ast.expr

    method virtual proxy: unit -> Type.name option * Ast.ident list
    method virtual sum:
	?eq:Type.expr -> context ->
	  Type.name -> Type.expr list -> Type.constraint_ list ->
	    Type.summand list -> Ast.str_item list
    method gsum:
	?eq:Type.expr -> context ->
	  Type.name -> Type.expr list -> Type.constraint_ list ->
	    Type.gsummand list -> Ast.str_item list
    method virtual tuple: context -> Type.expr list -> Ast.str_item list
    method virtual variant:
	context ->
	  Type.name -> Type.expr list -> Type.constraint_ list ->
	    Type.variant -> Ast.str_item list
    method virtual record:
	?eq:Type.expr -> context ->
	  Type.name -> Type.expr list -> Type.constraint_ list ->
	    Type.field list -> Ast.str_item list

    method class_: context -> [ `NYI ] -> Ast.str_item list
    method function_: context -> Type.expr * Type.expr -> Ast.str_item list
    method label:
      context ->
	[ `NonOptional | `Optional ] * Type.name * Type.expr * Type.expr ->
	  Ast.str_item list
    method object_: context -> [ `NYI ] -> Ast.str_item list

  end

  val generate: generator -> Type.decl list -> Ast.str_item
  val generate_sigs: generator -> Type.decl list -> Ast.sig_item
  val generate_expr:
    generator ->
    Ast.module_expr Type.EMap.t ->
    Type.qname Type.NameMap.t ->
    Type.expr -> Ast.module_expr

end

(** *)

module type Class = sig
  val generate: Type.decl list -> Ast.str_item
  val generate_sigs: Type.decl list -> Ast.sig_item
end

module type ClassBuilder = functor (Generator : Generator) -> Class
module type InnerClassBuilder = functor (Loc: Loc) -> Class

module type FullClass = sig
  val classname: Type.name
  val runtimename: Type.name
  include Class
  val generate_expr:
    Ast.module_expr Type.EMap.t ->
    Type.qname Type.NameMap.t ->
    Type.expr -> Ast.module_expr
end

module type FullBuilder = functor (Generator: Generator) -> FullClass
module type DepClassBuilder = functor (Loc: Loc) -> FullClass

module type ClassDescription = sig
  val classname: Type.name
  val runtimename: Type.name
  val default_module: Type.name option
  val alpha: Type.name option
  val allow_private: bool
  val predefs: (Type.qname * Type.qname) list
  val depends: (module DepClassBuilder) list
end

type generator = (module InnerClassBuilder)

(**/**)

(* Compat with <= 0.4-ocsigen *)

module type FullClassBuilder = functor (Loc: Loc) -> FullClass