This commit is contained in:
parent
49352fa7ca
commit
39b91016fb
1 changed files with 24 additions and 22 deletions
|
|
@ -57,7 +57,14 @@ type purpose = {
|
||||||
comment: string;
|
comment: string;
|
||||||
}
|
}
|
||||||
|
|
||||||
let f records =
|
let read_file file = In_channel.with_open_bin file In_channel.input_all
|
||||||
|
|
||||||
|
let () =
|
||||||
|
let content = read_file "registry.rec" in
|
||||||
|
match parse content with
|
||||||
|
| Error msg -> Fmt.failwith "Parse error: %s" msg
|
||||||
|
| Ok records ->
|
||||||
|
let purposes =
|
||||||
records
|
records
|
||||||
|> List.filter_map (fun l ->
|
|> List.filter_map (fun l ->
|
||||||
match l with
|
match l with
|
||||||
|
|
@ -72,23 +79,18 @@ let f records =
|
||||||
comment= c.v;
|
comment= c.v;
|
||||||
})
|
})
|
||||||
| _ -> None)
|
| _ -> None)
|
||||||
|>
|
|> List.filter (fun v -> v.number >= 1000_l)
|
||||||
(*GNU Taler, >= 1000*)
|
in
|
||||||
List.filter (fun v -> v.number >= 1000_l)
|
|
||||||
|
|
||||||
let read_file file = In_channel.with_open_bin file In_channel.input_all
|
let header =
|
||||||
let file_header = {|...|}
|
{|(* This file was generated from the GANA database:
|
||||||
|
https://git-www.gnunet.org/gana.git/tree/gnunet-signatures/registry.rec *)
|
||||||
let () =
|
|}
|
||||||
let content = read_file "registry.rec" in
|
in
|
||||||
match parse content with
|
|
||||||
| Error msg -> Fmt.failwith "Parse error: %s" msg
|
|
||||||
| Ok records ->
|
|
||||||
let purposes = f records in
|
|
||||||
|
|
||||||
let pp_purpose ppf { number; name; comment } =
|
let pp_purpose ppf { number; name; comment } =
|
||||||
Fmt.pf ppf "(** %s *)\nlet %s : int32 = %ld\n\n" comment name number
|
Fmt.pf ppf "(** %s *)\nlet %s : int32 = %ld\n\n" comment name number
|
||||||
in
|
in
|
||||||
|
|
||||||
Fmt.pr "%a@." (Fmt.list ~sep:Fmt.nop pp_purpose) purposes;
|
Fmt.pr "%s\n\n%a@." header (Fmt.list ~sep:Fmt.nop pp_purpose) purposes;
|
||||||
()
|
()
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue