summaryrefslogtreecommitdiff
path: root/src/marker.ml
diff options
context:
space:
mode:
authorAkshay <[email protected]>2021-08-08 13:08:33 +0100
committerAkshay <[email protected]>2021-08-08 13:08:33 +0100
commitc9e8dff919c49a13bff601e78cc1e78a7cc8f506 (patch)
treeb9015effe9dc995b083658b12b0de17d61230364 /src/marker.ml
parented2a97502cb825877562c05881da4fb2e8eecad6 (diff)
dump
Diffstat (limited to 'src/marker.ml')
-rw-r--r--src/marker.ml57
1 files changed, 24 insertions, 33 deletions
diff --git a/src/marker.ml b/src/marker.ml
index 19b1be0..0c59804 100644
--- a/src/marker.ml
+++ b/src/marker.ml
@@ -1,36 +1,27 @@
1module type Marker = sig 1type t = Point
2 type t 2 | Pixel
3 val of_string : string -> t 3 | Circle
4 val pp : out_channel -> t -> unit 4 | TriangleDown
5end 5 | TriangleUp
6 | TriangleLeft
7 | TriangleRight
8 | Custom of string
6 9
7module Marker = struct 10exception Invalid_marker_length
8 type t = Point 11let of_string s =
9 | Pixel 12 if String.length s <> 1
10 | Circle 13 then raise Invalid_marker_length
11 | TriangleDown 14 else Custom(s)
12 | TriangleUp
13 | TriangleLeft
14 | TriangleRight
15 | Custom of string
16 15
17 exception Invalid_marker_length 16let pp channel n =
18 let of_string s = 17 (match n with
19 if String.length s <> 1 18 | Point -> "."
20 then raise Invalid_marker_length 19 | Pixel -> ","
21 else Custom(s) 20 | Circle -> "o"
22 21 | TriangleDown -> "v"
23 let pp channel n = 22 | TriangleUp -> "^"
24 (match n with 23 | TriangleLeft -> ">"
25 | Point -> "." 24 | TriangleRight -> "<"
26 | Pixel -> "," 25 | Custom(s) -> s)
27 | Circle -> "o" 26 |> Printf.fprintf channel "%s"
28 | TriangleDown -> "v"
29 | TriangleUp -> "^"
30 | TriangleLeft -> ">"
31 | TriangleRight -> "<"
32 | Custom(s) -> s)
33 |> Printf.fprintf channel "%s"
34
35end
36 27