| 1 |
(**************************************************************************) |
| 2 |
(* *) |
| 3 |
(* Copyright 2012-2017 OCamlPro *) |
| 4 |
(* Copyright 2012 INRIA *) |
| 5 |
(* *) |
| 6 |
(* All rights reserved. This file is distributed under the terms of the *) |
| 7 |
(* GNU Lesser General Public License version 2.1, with the special *) |
| 8 |
(* exception on linking described in the file LICENSE. *) |
| 9 |
(* *) |
| 10 |
(**************************************************************************) |
| 11 |
|
| 12 |
(** OPAM variables with scope (global or module), used in "opam" package |
| 13 |
definition files in "filters" *) |
| 14 |
|
| 15 |
(** {2 Variable names} *) |
| 16 |
|
| 17 |
include OpamStd.ABSTRACT |
| 18 |
|
| 19 |
(** Shortcut to variables *) |
| 20 |
type variable = t |
| 21 |
|
| 22 |
(** Variable contents *) |
| 23 |
type variable_contents = |
| 24 |
| B of bool |
| 25 |
| S of string |
| 26 |
| L of string list |
| 27 |
|
| 28 |
(** Pretty print of variable contents *) |
| 29 |
val string_of_variable_contents: variable_contents -> string |
| 30 |
|
| 31 |
(** Variable contents constructors *) |
| 32 |
|
| 33 |
val string: string -> variable_contents |
| 34 |
val int: int -> variable_contents |
| 35 |
val bool: bool -> variable_contents |
| 36 |
val dirname: OpamFilename.Dir.t -> variable_contents |
| 37 |
|
| 38 |
module Full: sig |
| 39 |
|
| 40 |
(** Fully qualified variable. *) |
| 41 |
|
| 42 |
include OpamStd.ABSTRACT |
| 43 |
|
| 44 |
type scope = |
| 45 |
| Global (** Note: this is attributed to unqualified variables, and may |
| 46 |
also design self-referring ones *) |
| 47 |
| Self (** Variable in a package-specific file referring to that |
| 48 |
package [_:varname] *) |
| 49 |
| Package of OpamPackage.Name.t (** [pkgname:varname] *) |
| 50 |
|
| 51 |
(** Returns the scope of the variable *) |
| 52 |
val scope: t -> scope |
| 53 |
|
| 54 |
(** Returns the unqualified variable name *) |
| 55 |
val variable: t -> variable |
| 56 |
|
| 57 |
val is_global: t -> bool |
| 58 |
|
| 59 |
(** Return the package corresponding to the scope of the variable *) |
| 60 |
val package: ?self:OpamPackage.Name.t -> t -> OpamPackage.Name.t option |
| 61 |
|
| 62 |
(** Create a variable local for a given library/syntax extension *) |
| 63 |
val create: OpamPackage.Name.t -> variable -> t |
| 64 |
|
| 65 |
(** Create a global variable *) |
| 66 |
val global: variable -> t |
| 67 |
|
| 68 |
(** Create a variable in the [Self] scope *) |
| 69 |
val self: variable -> t |
| 70 |
|
| 71 |
(** Looks up for an environment override through the environment, by means of |
| 72 |
[OPAMVAR_glovar] or [OPAMVAR_pkg_pkgvar] *) |
| 73 |
val read_from_env: t -> variable_contents option |
| 74 |
|
| 75 |
end |