Skip to content

Commit 537a201

Browse files
author
Jean-Baptiste Doderlein
committed
Bump to OCaml 5.1
1 parent 6b9878a commit 537a201

5 files changed

Lines changed: 34 additions & 23 deletions

File tree

src/index.html

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -49,7 +49,7 @@
4949
let params = new URLSearchParams(window.location.search);
5050
let version = params.get("version");
5151

52-
let versions = ["4.14.1", "4.14.0", "4.13.1", "4.13.0", "4.12.1", "4.12.0", "4.11.2", "4.11.1", "4.11.0", "4.10.2", "4.10.1", "4.10.0", "4.09.1", "4.09.0", "4.08.1", "4.08.0", "4.07.1", "4.07.0", "4.06.1", "4.06.0"];
52+
let versions = ["5.1.0", "4.14.1", "4.14.0", "4.13.1", "4.13.0", "4.12.1", "4.12.0", "4.11.2", "4.11.1", "4.11.0", "4.10.2", "4.10.1", "4.10.0", "4.09.1", "4.09.0", "4.08.1", "4.08.0", "4.07.1", "4.07.0", "4.06.1", "4.06.0"];
5353

5454
if (!versions.includes(version)) {
5555
version = versions[0];

toplevel_build/compile.sh

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -90,8 +90,9 @@ Build_Toplevel () {
9090
cp _build/default/toplevel.js "$OUTPUT_DIR/toplevel-$BUILD_VERSION.js"
9191

9292
# Clean after build
93-
rm -rf "_build"
9493
dune clean
94+
95+
9596
}
9697

9798
Usage () {
@@ -113,7 +114,7 @@ Usage () {
113114

114115
# These are all the known to work versions
115116
# You can edit this to try older versions but we cannot guarantee it will work
116-
SUPPORTED_OCAML_VERSIONS=(4.14.1 4.14.0 4.13.1 4.13.0 4.12.1 4.12.0 4.11.2 4.11.1 4.11.0 4.10.2 4.10.1 4.10.0 4.09.1 4.09.0 4.08.1 4.08.0 4.07.1 4.07.0 4.06.1 4.06.0)
117+
SUPPORTED_OCAML_VERSIONS=(5.1.0 4.14.1 4.14.0 4.13.1 4.13.0 4.12.1 4.12.0 4.11.2 4.11.1 4.11.0 4.10.2 4.10.1 4.10.0 4.09.1 4.09.0 4.08.1 4.08.0 4.07.1 4.07.0 4.06.1 4.06.0)
117118

118119
KEEP=false
119120
FORCE=false

toplevel_build/dune

Lines changed: 24 additions & 13 deletions
Original file line numberDiff line numberDiff line change
@@ -10,14 +10,28 @@
1010
ocp-indent.lib
1111
lwt
1212
;; not used directly
13-
graphics
14-
bigarray
15-
zarith
1613
str
14+
zarith
15+
dynlink
1716
)
18-
(flags (:standard -rectypes -linkall))
17+
(flags
18+
(:standard -rectypes -linkall))
1919
(modes byte)
2020
(modules (:standard))
21+
(js_of_ocaml
22+
(link_flags (:standard))
23+
(build_runtime_flags
24+
(:standard
25+
+base/runtime.js
26+
+toplevel.js
27+
+dynlink.js
28+
+zarith_stubs_js/runtime.js
29+
+zarith_stubs_js/biginteger.js
30+
))
31+
(flags
32+
(:standard
33+
--toplevel))
34+
)
2135
(preprocess (pps sedlex.ppx js_of_ocaml-ppx))
2236
)
2337

@@ -26,11 +40,9 @@
2640
(action
2741
(run jsoo_listunits -o %{targets}
2842
stdlib
29-
graphics
3043
str
31-
bigarray
32-
zarith
3344
dynlink
45+
zarith
3446
)
3547
)
3648
)
@@ -39,16 +51,15 @@
3951
(targets toplevel.js)
4052
(action
4153
(run %{bin:js_of_ocaml}
42-
-I %{lib:reactiveData:.}
43-
-I %{lib:zarith:.}
44-
--export %{dep:export.txt}
45-
--toplevel
46-
--opt 3
4754
+base/runtime.js
4855
+toplevel.js
4956
+dynlink.js
50-
+zarith_stubs_js/biginteger.js
5157
+zarith_stubs_js/runtime.js
58+
+zarith_stubs_js/biginteger.js
59+
--export %{dep:export.txt}
60+
--toplevel
61+
--opt 3
62+
--enable=effects
5263
%{dep:toplevel.bc}
5364
-o %{targets}
5465
)

toplevel_build/dune-project

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1 +1 @@
1-
(lang dune 2.9)
1+
(lang dune 3.14)

toplevel_build/toplevel.ml

Lines changed: 5 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -173,8 +173,6 @@ module Ppx_support = struct
173173
end
174174

175175
module Version = struct
176-
type t = int list
177-
178176
let from_string v = List.map int_of_string (String.split_on_char '.' v)
179177

180178
let rec comp v v' = match v, v' with
@@ -247,8 +245,6 @@ let by_id s = Dom_html.getElementById s
247245

248246
let by_id_coerce s f = Js.Opt.get (f (Dom_html.getElementById s)) (fun () -> raise Not_found)
249247

250-
let do_by_id s f = try f (Dom_html.getElementById s) with Not_found -> ()
251-
252248
(* load file using a synchronous XMLHttpRequest *)
253249
let load_resource_aux filename url =
254250
Js_of_ocaml_lwt.XmlHttpRequest.perform_raw ~response_type:XmlHttpRequest.ArrayBuffer url
@@ -339,8 +335,11 @@ let highlight_location loc =
339335
let to_ = if !x = line2 then `Pos col2 else `Last in
340336
Colorize.highlight from_ to_ e)
341337

342-
let append colorize output cl s =
343-
Dom.appendChild output (Tyxml_js.To_dom.of_element (colorize ~a_class:cl s))
338+
let append colorize output cl (s:string) =
339+
if String.length s > 0 then
340+
Dom.appendChild output (Tyxml_js.To_dom.of_element (colorize ~a_class:cl s))
341+
else
342+
Dom.appendChild output (Tyxml_js.To_dom.of_element (colorize ~a_class:cl "empty output"))
344343

345344
let append_to_console s =
346345
Firebug.console##log (Js.string s)

0 commit comments

Comments
 (0)