Kitty Graphics Protocol in OCaml
terminal
graphics
ocaml
1type t =
2 [ `All_visible
3 | `All_visible_and_free
4 | `By_id of int * int option
5 | `By_id_and_free of int * int option
6 | `By_number of int * int option
7 | `By_number_and_free of int * int option
8 | `At_cursor
9 | `At_cursor_and_free
10 | `At_cell of int * int
11 | `At_cell_and_free of int * int
12 | `At_cell_z of int * int * int
13 | `At_cell_z_and_free of int * int * int
14 | `By_column of int
15 | `By_column_and_free of int
16 | `By_row of int
17 | `By_row_and_free of int
18 | `By_z_index of int
19 | `By_z_index_and_free of int
20 | `By_id_range of int * int
21 | `By_id_range_and_free of int * int
22 | `Frames
23 | `Frames_and_free ]
24
25let to_char : t -> char = function
26 | `All_visible -> 'a'
27 | `All_visible_and_free -> 'A'
28 | `By_id _ -> 'i'
29 | `By_id_and_free _ -> 'I'
30 | `By_number _ -> 'n'
31 | `By_number_and_free _ -> 'N'
32 | `At_cursor -> 'c'
33 | `At_cursor_and_free -> 'C'
34 | `At_cell _ -> 'p'
35 | `At_cell_and_free _ -> 'P'
36 | `At_cell_z _ -> 'q'
37 | `At_cell_z_and_free _ -> 'Q'
38 | `By_column _ -> 'x'
39 | `By_column_and_free _ -> 'X'
40 | `By_row _ -> 'y'
41 | `By_row_and_free _ -> 'Y'
42 | `By_z_index _ -> 'z'
43 | `By_z_index_and_free _ -> 'Z'
44 | `By_id_range _ -> 'r'
45 | `By_id_range_and_free _ -> 'R'
46 | `Frames -> 'f'
47 | `Frames_and_free -> 'F'