summaryrefslogtreecommitdiff
path: root/src/marker.ml
diff options
context:
space:
mode:
Diffstat (limited to 'src/marker.ml')
-rw-r--r--src/marker.ml45
1 files changed, 22 insertions, 23 deletions
diff --git a/src/marker.ml b/src/marker.ml
index 0c59804..7d37e2a 100644
--- a/src/marker.ml
+++ b/src/marker.ml
@@ -1,27 +1,26 @@
1type t = Point 1type t =
2 | Pixel 2 | Point
3 | Circle 3 | Pixel
4 | TriangleDown 4 | Circle
5 | TriangleUp 5 | TriangleDown
6 | TriangleLeft 6 | TriangleUp
7 | TriangleRight 7 | TriangleLeft
8 | Custom of string 8 | TriangleRight
9 | Custom of string
9 10
10exception Invalid_marker_length 11exception Invalid_marker_length
11let of_string s =
12 if String.length s <> 1
13 then raise Invalid_marker_length
14 else Custom(s)
15 12
16let pp channel n = 13let of_string s =
17 (match n with 14 if String.length s <> 1 then raise Invalid_marker_length else Custom s
18 | Point -> "."
19 | Pixel -> ","
20 | Circle -> "o"
21 | TriangleDown -> "v"
22 | TriangleUp -> "^"
23 | TriangleLeft -> ">"
24 | TriangleRight -> "<"
25 | Custom(s) -> s)
26 |> Printf.fprintf channel "%s"
27 15
16let pp formatter n =
17 (match n with
18 | Point -> "."
19 | Pixel -> ","
20 | Circle -> "o"
21 | TriangleDown -> "v"
22 | TriangleUp -> "^"
23 | TriangleLeft -> ">"
24 | TriangleRight -> "<"
25 | Custom s -> s)
26 |> Format.fprintf formatter "%s"