package camomile-embedded

  1. Overview
  2. Docs
Camomile Unicode library with data files embedded at compile time

Install

dune-project
 Dependency

Authors

Maintainers

Sources

v2.1.0.tar.gz
md5=35c450853b72e286bef9b75ae4821621
sha512=fff70942e1866c5ad180a9de392a153809db7858f6d9f1067cd88db8b23b03643d09666abf09e6fae3d4da99f44570158b83170104cee68fdd5c1fc41b7c3e7b

doc/src/camomile-embedded.charencoding/camomile_embedded_charencoding.ml.html

Source file camomile_embedded_charencoding.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
(* Charset conversion alone, with only the data it needs embedded:
   CharEncoding reads charmapdir and unimapdir and nothing else, so
   database/ and locales/ are left out. Use camomile-embedded for the
   full API. *)

module Config : CamomileLib.Config.Type = struct
  let datadir = "database"
  let charmapdir = "charmaps"
  let unimapdir = "mappings"
  let localedir = "locales"

  let get path =
    let data =
      match (Filename.dirname path, Filename.basename path) with
        | "charmaps", name -> Charmaps_data.read name
        | "mappings", name -> Unimaps_data.read name
        | _ -> None
    in
    match data with
      | Some data -> Marshal.from_string data 0
      | None -> raise Not_found
end

module CharEncoding = CamomileLib.CharEncoding.Configure (Config)