Skip to content

Commit b6b13c8

Browse files
committed
Compatibility with OCaml < 5
Use a fake implementation of mutexes and domains in this case to avoid a dependency on the threads library
1 parent f22033e commit b6b13c8

File tree

3 files changed

+36
-0
lines changed

3 files changed

+36
-0
lines changed

lib/dune

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -3,3 +3,8 @@
33
(synopsis "Pure OCaml regular expression library")
44
(libraries seq)
55
(public_name re))
6+
7+
(copy_files#
8+
(enabled_if
9+
(< %{ocaml_version} 5))
10+
(files fake/*))

lib/fake/domain.ml

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,5 @@
1+
module DLS = struct
2+
let new_key f = ref (f())
3+
let set x y = x := y
4+
let get x = !x
5+
end

lib/fake/mutex.ml

Lines changed: 26 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,26 @@
1+
(*
2+
RE - A regular expression library
3+
4+
Copyright (C) 2025 Jerome Vouillon
5+
6+
This library is free software; you can redistribute it and/or
7+
modify it under the terms of the GNU Lesser General Public
8+
License as published by the Free Software Foundation, with
9+
linking exception; either version 2.1 of the License, or (at
10+
your option) any later version.
11+
12+
This library is distributed in the hope that it will be useful,
13+
but WITHOUT ANY WARRANTY; without even the implied warranty of
14+
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
15+
Lesser General Public License for more details.
16+
17+
You should have received a copy of the GNU Lesser General Public
18+
License along with this library; if not, write to the Free Software
19+
Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
20+
*)
21+
22+
type t = unit
23+
24+
let create _ = ()
25+
let lock _ = ()
26+
let unlock _ = ()

0 commit comments

Comments
 (0)