package dkml-c-probe

  1. Overview
  2. Docs
Cross-compiler friendly ABI and library discovery for OCaml's native C compilers

Install

Dune Dependency

Authors

Maintainers

Sources

v3.0.0.tar.gz
md5=6cb75ec4f6d6de79904177c42e38fbe1
sha512=05e71a0605d93d5161ef9bffcc6264a205fcc89e497e726db9e622c7e61bc505f5973acbffe8c949186c26c9b05fd0b7b4e2ac4376754fb8700e428a391f1a76

doc/src/dkml-c-probe.common/probe_common.ml.html

Source file probe_common.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
(******************************************************************************)
(*  Copyright 2022 Diskuv, Inc.                                               *)
(*                                                                            *)
(*  Licensed under the Apache License, Version 2.0 (the "License");           *)
(*  you may not use this file except in compliance with the License.          *)
(*  You may obtain a copy of the License at                                   *)
(*                                                                            *)
(*      http://www.apache.org/licenses/LICENSE-2.0                            *)
(*                                                                            *)
(*  Unless required by applicable law or agreed to in writing, software       *)
(*  distributed under the License is distributed on an "AS IS" BASIS,         *)
(*  WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.  *)
(*  See the License for the specific language governing permissions and       *)
(*  limitations under the License.                                            *)
(******************************************************************************)

(** [dos2unix s] converts all CRLF sequences in [s] into LF. Assumes [s] is ASCII encoded. *)
let dos2unix s =
  let l = String.length s in
  String.to_seqi s
  (* Shrink [\r\n] into [\n] *)
  |> Seq.filter_map (function
       | i, '\r' when i + 1 < l && s.[i + 1] == '\n' -> None
       | _, c -> Some c)
  |> String.of_seq

(** [normalize_into_upper_alnum s] translates the ASCII string [s] into only
    the letters and numbers; lowercase letters are converted into uppercase,
    and any non alphanumeric character is translated into an underscore. *)
let normalize_into_upper_alnum =
  String.map (function
    | c when (c >= 'A' && c <= 'Z') || (c >= '0' && c <= '9') -> c
    | c when c >= 'a' && c <= 'z' -> Char.uppercase_ascii c
    | _ -> '_')
OCaml

Innovation. Community. Security.