Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
3 changes: 2 additions & 1 deletion CHANGES.md
Original file line number Diff line number Diff line change
@@ -1,6 +1,7 @@
## unreleased

* Moved to Dune 3.17. (Antonin Décimo)
* Moved to Dune 3.0. (Antonin Décimo)
* Update to Unicode 16. (Antonin Décimo)

## v0.2.3 (2022-09-02)

Expand Down
1 change: 1 addition & 0 deletions notty-community.opam
Original file line number Diff line number Diff line change
Expand Up @@ -21,6 +21,7 @@ depends: [
"ocaml" {>= "4.08.0"}
"cppo" {build & >= "1.1.0"}
"uutf" {>= "1.0.0"}
"uucp" {with-dev-setup}
"odoc" {with-doc}
]
depopts: ["lwt"]
Expand Down
6 changes: 6 additions & 0 deletions src/no-uucp/dune
Original file line number Diff line number Diff line change
@@ -0,0 +1,6 @@
(rule
(targets notty_uucp_data.ml notty_uucp_data.mli)
(enabled_if (= %{profile} "regenerate"))
(action
(run ../../support/gen_unicode_props.exe))
(mode promote))
561 changes: 299 additions & 262 deletions src/no-uucp/notty_uucp_data.ml

Large diffs are not rendered by default.

4 changes: 2 additions & 2 deletions src/no-uucp/notty_uucp_data.mli
Original file line number Diff line number Diff line change
@@ -1,9 +1,9 @@
(* Do not edit.
*
* This module contains select unicode properties extracted from Uucp,
* using `./support/gen_unicode_props.ml`.
* using `../../support/gen_unicode_props.exe`.
*
* Unicode version 13.0.0.
* Unicode version 17.0.0.
*)

(* Uucp.Break.tty_width_hint *)
Expand Down
4 changes: 4 additions & 0 deletions support/dune
Original file line number Diff line number Diff line change
@@ -0,0 +1,4 @@
(executable
(name gen_unicode_props)
(enabled_if (= %{profile} "regenerate"))
(libraries uucp))
10 changes: 3 additions & 7 deletions support/gen_unicode_props.ml
100755 → 100644
Original file line number Diff line number Diff line change
@@ -1,10 +1,6 @@
#!/usr/bin/env ocaml
(* Copyright (c) 2020 David Kaloper Meršinjak. All rights reserved.
See LICENSE.md. *)

#use "topfind"
#require "uucp"

let filter p seq i = seq (fun x -> if p x then i x)
let map f seq i = seq (fun x -> i (f x))
let uchars it =
Expand All @@ -24,7 +20,7 @@ let intervals_kv seq i =
seq f;
match !s with Some e -> i e | _ -> ()

let intervals_p seq =
let[@warning "-32"] intervals_p seq =
map (fun x -> x, ()) seq |> intervals_kv |> map (fun (a, b, _) -> a, b)

(* Condenses code points into continuous range. *)
Expand Down Expand Up @@ -132,15 +128,15 @@ let extract (ppmli, ppml as ppfs) =

()

let file = "src/no-uucp/notty_uucp_data"
let file = "notty_uucp_data"

let with_new name f =
let o = open_out_gen [Open_trunc; Open_creat; Open_wronly] 0o664 name in
let ppf = Format.formatter_of_out_channel o in
f ppf; Format.pp_print_flush ppf (); close_out o

let () =
Format.printf "Dumping Unicode v%s data to %s.@." Uucp.unicode_version file;
Format.printf "Dumping Unicode v%s data to %s.ml and %s.mli.@." Uucp.unicode_version file file;
with_new (file ^ ".mli") @@ fun ppmli ->
with_new (file ^ ".ml") @@ fun ppml ->
extract (ppmli, ppml)