this repo has no description

OxCaml compat: cppo preprocessing, version guards, and new exercises

- Add cppo preprocessing for merlin-js and x-ocaml workers to support
conditional compilation with OXCAML flag
- Guard day10 packages with enabled_if >= 5.3.0 since they need recent OCaml
- Remove fatal odoc warnings from dune-workspace (handled per-package now)
- Bump merlin-js dune lang to 3.17
- Add warning suppression flags where needed (-w -58, -w -67)
- Add interactive extension exercise pages (FOCS 2020/2024/2025, OxCaml
stack allocation)

Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>

+66 -5
+44
worker/dune
··· 1 (library 2 (name x_worker) 3 (libraries 4 brr 5 js_of_ocaml ··· 10 ocamlformat-lib 11 ocamlformat-lib.parser_extended 12 ocamlformat-lib.format_)) 13 14 (rule 15 (targets export.txt)
··· 1 + ; Generate eval.ml from eval.cppo.ml with conditional OXCAML flag 2 + 3 + (rule 4 + (targets eval.ml) 5 + (deps (:x eval.cppo.ml)) 6 + (enabled_if (not %{ocaml-config:ox})) 7 + (action (run %{bin:cppo} -V OCAML:%{ocaml_version} %{x} -o %{targets}))) 8 + 9 + (rule 10 + (targets eval.ml) 11 + (deps (:x eval.cppo.ml)) 12 + (enabled_if %{ocaml-config:ox}) 13 + (action (run %{bin:cppo} -V OCAML:%{ocaml_version} -D OXCAML %{x} -o %{targets}))) 14 + 15 + ; Generate ocamlfmt.ml from ocamlfmt.cppo.ml with conditional OXCAML flag 16 + 17 + (rule 18 + (targets ocamlfmt.ml) 19 + (deps (:x ocamlfmt.cppo.ml)) 20 + (enabled_if (not %{ocaml-config:ox})) 21 + (action (run %{bin:cppo} -V OCAML:%{ocaml_version} %{x} -o %{targets}))) 22 + 23 + (rule 24 + (targets ocamlfmt.ml) 25 + (deps (:x ocamlfmt.cppo.ml)) 26 + (enabled_if %{ocaml-config:ox}) 27 + (action (run %{bin:cppo} -V OCAML:%{ocaml_version} -D OXCAML %{x} -o %{targets}))) 28 + 29 + ; On OxCaml, ocamlformat-lib conflicts with js_of_ocaml-compiler (inconsistent 30 + ; Ocaml_common), so we exclude it. ocamlfmt.ml becomes a no-op stub on OxCaml. 31 (library 32 (name x_worker) 33 + (enabled_if (not %{ocaml-config:ox})) 34 + (ocamlopt_flags (:standard -w -58)) 35 (libraries 36 brr 37 js_of_ocaml ··· 42 ocamlformat-lib 43 ocamlformat-lib.parser_extended 44 ocamlformat-lib.format_)) 45 + 46 + (library 47 + (name x_worker) 48 + (enabled_if %{ocaml-config:ox}) 49 + (ocamlopt_flags (:standard -w -58)) 50 + (libraries 51 + brr 52 + js_of_ocaml 53 + js_of_ocaml-toplevel 54 + x-ocaml.protocol 55 + x-ocaml.lib 56 + merlin-js.worker)) 57 58 (rule 59 (targets export.txt)
+11 -1
worker/eval.ml worker/eval.cppo.ml
··· 18 List.fold_left 19 (fun t ident -> 20 let name = Translmod.toplevel_name ident in 21 let v = Topeval.getvalue name in 22 String_map.add name v t) 23 t idents 24 25 - let restore t = String_map.iter (fun name v -> Topeval.setvalue name v) t 26 end 27 28 module Environment = struct
··· 18 List.fold_left 19 (fun t ident -> 20 let name = Translmod.toplevel_name ident in 21 + #if defined OXCAML 22 + let v = Toploop.getvalue name in 23 + #else 24 let v = Topeval.getvalue name in 25 + #endif 26 String_map.add name v t) 27 t idents 28 29 + let restore t = String_map.iter (fun name v -> 30 + #if defined OXCAML 31 + Toploop.setvalue name v 32 + #else 33 + Topeval.setvalue name v 34 + #endif 35 + ) t 36 end 37 38 module Environment = struct
+11 -4
worker/ocamlfmt.ml worker/ocamlfmt.cppo.ml
··· 1 open Ocamlformat_stdlib 2 open Ocamlformat_lib 3 - module Format_ = Ocamlformat_format.Format_ 4 module Parser_extended = Ocamlformat_parser_extended 5 6 let default_conf = Ocamlformat_lib.Conf.default ··· 45 let ast = ast ~conf source in 46 let with_buffer_formatter ~buffer_size k = 47 let buffer = Buffer.create buffer_size in 48 - let fs = Format_.formatter_of_buffer buffer in 49 Fmt.eval fs k; 50 - Format_.pp_print_flush fs (); 51 - if Buffer.length buffer > 0 then Format_.pp_print_newline fs (); 52 Buffer.contents buffer 53 in 54 let print (ast : _ Parse_with_comments.with_comments) = ··· 66 67 let fmt source = 68 match !conf with `Disable -> source | `Conf conf -> fmt ~conf source
··· 1 + #if defined OXCAML 2 + (* On OxCaml, ocamlformat-lib conflicts with js_of_ocaml-compiler 3 + (inconsistent Ocaml_common). Formatting is disabled. *) 4 + let configure _ = () 5 + let fmt source = source 6 + #else 7 open Ocamlformat_stdlib 8 open Ocamlformat_lib 9 + module Ocamlfmt_format = Ocamlformat_format.Format_ 10 module Parser_extended = Ocamlformat_parser_extended 11 12 let default_conf = Ocamlformat_lib.Conf.default ··· 51 let ast = ast ~conf source in 52 let with_buffer_formatter ~buffer_size k = 53 let buffer = Buffer.create buffer_size in 54 + let fs = Ocamlfmt_format.formatter_of_buffer buffer in 55 Fmt.eval fs k; 56 + Ocamlfmt_format.pp_print_flush fs (); 57 + if Buffer.length buffer > 0 then Ocamlfmt_format.pp_print_newline fs (); 58 Buffer.contents buffer 59 in 60 let print (ast : _ Parse_with_comments.with_comments) = ··· 72 73 let fmt source = 74 match !conf with `Disable -> source | `Conf conf -> fmt ~conf source 75 + #endif