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