package opam-format
sectionYPositions = computeSectionYPositions($el), 10)"
x-init="setTimeout(() => sectionYPositions = computeSectionYPositions($el), 10)"
>
Format library for opam 2.0
Install
dune-project
Dependency
Authors
-
VVincent Bernardoff <vb@luminar.eu.org>
-
RRaja Boujbel <raja.boujbel@ocamlpro.com>
-
RRoberto Di Cosmo <roberto@dicosmo.org>
-
TThomas Gazagnaire <thomas@gazagnaire.org>
-
LLouis Gesbert <louis.gesbert@ocamlpro.com>
-
FFabrice Le Fessant <Fabrice.Le_fessant@inria.fr>
-
AAnil Madhavapeddy <anil@recoil.org>
-
GGuillem Rieu <guillem.rieu@ocamlpro.com>
-
RRalf Treinen <ralf.treinen@pps.jussieu.fr>
-
FFrederic Tuong <tuong@users.gforge.inria.fr>
Maintainers
Sources
2.0.9.tar.gz
md5=abb7d7788f290d81d73b924b307b4bef
sha512=0d8ee19ac0f3df9de4fd9cfa8daab1f7228f090f5e2e7e26bedf24d8c2ab377aade95048f2d7cd9ee9dbbe738729e26dc99f41f730fa2252df74953362464a22
doc/src/opam-format/opamVariable.ml.html
Source file opamVariable.ml
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(**************************************************************************) (* *) (* Copyright 2012-2015 OCamlPro *) (* Copyright 2012 INRIA *) (* *) (* All rights reserved. This file is distributed under the terms of the *) (* GNU Lesser General Public License version 2.1, with the special *) (* exception on linking described in the file LICENSE. *) (* *) (**************************************************************************) include OpamStd.AbstractString type variable = t type variable_contents = | B of bool | S of string | L of string list let string_of_variable_contents = function | B b -> string_of_bool b | S s -> s | L l -> String.concat " " l let string str = S str let bool b = B b let int i = string (string_of_int i) let dirname dir = string (OpamFilename.Dir.to_string dir) module Full = struct type scope = | Global | Self | Package of OpamPackage.Name.t type t = { scope: scope; variable: variable; } let variable t = t.variable let scope t = t.scope let package ?self t = match t.scope with | Package p -> Some p | Self -> self | Global -> None let create package variable = let scope = if OpamPackage.Name.to_string package = "_" then Self else Package package in { scope; variable } (* Read the variables overridden through the environment *) let read_from_env v = let var_str = to_string (variable v) in let undash = OpamStd.String.map (function '-' -> '_' | c -> c) in let var_hook = match package v with | Some n -> Printf.sprintf "%s_%s" (undash (OpamPackage.Name.to_string n)) (undash var_str) | None -> undash var_str in try match OpamStd.Env.get ("OPAMVAR_" ^ var_hook) with | "true" | "1" -> Some (bool true) | "false" | "0" -> Some (bool false) | s -> Some (string s) with Not_found -> None let global variable = { scope = Global; variable } let self variable = { scope = Self; variable } let is_global variable = match variable.scope with | Global -> true | Self | Package _ -> false let of_string s = match OpamStd.String.rcut_at s ':' with | None -> global (of_string s) | Some ("_",v) -> { scope = Self; variable = of_string v } | Some (p,v) -> create (OpamPackage.Name.of_string p) (of_string v) let to_string t = let prefix = match t.scope with | Global -> "" | Self -> "_:" | Package p -> OpamPackage.Name.to_string p ^ ":" in prefix ^ to_string t.variable let to_json x = `String (to_string x) module O = struct type tmp = t type t = tmp let compare = compare let to_string = to_string let to_json = to_json end module Set = OpamStd.Set.Make(O) module Map = OpamStd.Map.Make(O) end
sectionYPositions = computeSectionYPositions($el), 10)"
x-init="setTimeout(() => sectionYPositions = computeSectionYPositions($el), 10)"
>