package b0
Software construction and deployment kit
Install
dune-project
Dependency
Authors
Maintainers
Sources
b0-0.0.6.tbz
sha512=e9aa779e66c08fc763019f16d4706f465d16c05d6400b58fbd0313317ef33ddea51952e2b058db28e65f7ddb7012f328c8bf02d8f1da17bb543348541a2587f0
doc/src/b0.std/b0_version.ml.html
Source file b0_version.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
(*--------------------------------------------------------------------------- Copyright (c) 2025 The b0 programmers. All rights reserved. SPDX-License-Identifier: ISC ---------------------------------------------------------------------------*) open B0_std type t = int * int * int * string option let next_major ?info (maj, _, _, _) = (maj + 1, 0, 0, info) let next_minor ?info (maj, min, _, _) = (maj, min + 1, 0, info) let next_patch ?info (maj, min, patch, _) = (maj, min, patch + 1, info) let with_info info (maj, min, patch, _) = (maj, min, patch, info) (* Converting *) let string_drop_initial_v s = if s = "" then s else match s.[0] with | 'v' | 'V' -> String.subrange ~first:1 s | _ -> s let of_string s = if s = "" then None else let cut_left_plus_or_tilde s = let cut = match String.index_opt s '+', String.index_opt s '~' with | None, None -> None | (Some _ as i), None | None, (Some _ as i) -> i | Some i, Some i' -> Some (if i < i' then i else i') in match cut with | None -> None | Some i -> Some (String.subrange ~last:(i - 1) s, String.subrange ~first:i s) in try match String.split_first ~sep:"." s with | None -> None | Some (maj, rest) -> let maj = int_of_string (string_drop_initial_v maj) in match String.split_first ~sep:"." rest with | None -> begin match cut_left_plus_or_tilde rest with | None -> Some (maj, int_of_string rest, 0, None) | Some (min, i) -> Some (maj, int_of_string min, 0, Some i) end | Some (min, rest) -> let min = int_of_string min in begin match cut_left_plus_or_tilde rest with | None -> Some (maj, min, int_of_string rest, None) | Some (p, i) -> Some (maj, min, int_of_string p, Some i) end with | Failure _ -> None let to_string (major, minor, patchlevel, info) = Fmt.str "%d.%d.%d%a" major minor patchlevel Fmt.(option string) info (* Formatting *) let version_st = [`Bold; `Fg `Magenta] let pp ppf v = Fmt.st version_st ppf (to_string v) let pp_string ppf v = Fmt.st version_st ppf v
sectionYPositions = computeSectionYPositions($el), 10)"
x-init="setTimeout(() => sectionYPositions = computeSectionYPositions($el), 10)"
>