Skip to content

Commit

Permalink
Add 5.1.1 compilation + graphics
Browse files Browse the repository at this point in the history
  • Loading branch information
Jean-Baptiste Doderlein committed Mar 21, 2024
1 parent 9682ccf commit 014341f
Show file tree
Hide file tree
Showing 7 changed files with 75,005 additions and 5 deletions.
15 changes: 14 additions & 1 deletion src/index.html
Original file line number Diff line number Diff line change
Expand Up @@ -49,7 +49,7 @@
let params = new URLSearchParams(window.location.search);
let version = params.get("version");

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"];
let versions = ["5.1.1", "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"];

if (!versions.includes(version)) {
version = versions[0];
Expand Down Expand Up @@ -192,6 +192,8 @@ <h4>Configuration</h4>
<h4>Help</h4>
<a href="#shortcut" class="waves-effect waves-light btn shortcut-button modal-trigger"><i
class="material-icons right">code</i>Shortcuts</a>
<a href="#graphics" class="waves-effect waves-light btn shortcut-button modal-trigger"><i
class="material-icons right">code</i>Graphics</a>
<div class="help-section">
<a class="github-button" href="https://github.com/jbdo99/betterocaml" data-size="large"
aria-label="Issue jbdo99/betterocaml on GitHub">Open in Github</a>
Expand Down Expand Up @@ -274,6 +276,17 @@ <h4>Save as ...</h4>
</div>
</div>

<div id="graphics" class="modal help">
<div class="modal-content">
<h4>Graphics main window</h4>
<canvas id="test-canvas">
</canvas>
</div>
<div class="modal-footer help">
<a href="#" class="modal-close waves-effect waves-green btn-flat white-text">Close</a>
</div>
</div>

<div class="container-boc container horizontal">
<!-- Editor flexboxs -->
<div id="box_1" class="box editor-box" style="display:flex;flex-direction:column">
Expand Down
2 changes: 1 addition & 1 deletion src/manifest.json
Original file line number Diff line number Diff line change
Expand Up @@ -13,5 +13,5 @@
"display": "standalone",
"scope": "/index.html",
"theme_color": "#263238",
"description": "A small but efficient, intuitive and responsive OCaml IDE right in your browser! Ships OCaml v4.14.0, interpreter by your browser (so it works offline!), compiled with js_of_ocaml. Open-source on <a href='https://github.com/jbdo99/BetterOCaml'>GitHub.com/jbdo99/BetterOCaml</a>"
"description": "A small but efficient, intuitive and responsive OCaml IDE right in your browser! Ships OCaml v5.1.1, interpreter by your browser (so it works offline!), compiled with js_of_ocaml. Open-source on <a href='https://github.com/jbdoderlein/BetterOCaml'>GitHub.com/jbdoderlein/BetterOCaml</a>"
}
2 changes: 1 addition & 1 deletion src/serviceWorker.js
Original file line number Diff line number Diff line change
Expand Up @@ -53,7 +53,7 @@ const staticAssets = [
'./js/codemirror/show-hint.js',
'./js/codemirror/sublime.min.js',
// './toplevels/',
'./toplevels/toplevel-4.14.0.js',
'./toplevels/toplevel-5.1.1.js',
];

self.addEventListener('install', async event=>{
Expand Down
74,969 changes: 74,969 additions & 0 deletions src/toplevels/toplevel-5.1.1.js

Large diffs are not rendered by default.

4 changes: 2 additions & 2 deletions toplevel_build/compile.sh
Original file line number Diff line number Diff line change
Expand Up @@ -90,7 +90,7 @@ Build_Toplevel () {
cp _build/default/toplevel.js "$OUTPUT_DIR/toplevel-$BUILD_VERSION.js"

# Clean after build
dune clean
# dune clean


}
Expand All @@ -114,7 +114,7 @@ Usage () {

# These are all the known to work versions
# You can edit this to try older versions but we cannot guarantee it will work
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)
SUPPORTED_OCAML_VERSIONS=(5.1.1 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)

KEEP=false
FORCE=false
Expand Down
16 changes: 16 additions & 0 deletions toplevel_build/dune
Original file line number Diff line number Diff line change
Expand Up @@ -10,6 +10,8 @@
ocp-indent.lib
lwt
;; not used directly
graphics
js_of_ocaml-lwt.graphics
str
zarith
dynlink
Expand Down Expand Up @@ -37,9 +39,23 @@

(rule
(targets export.txt)
(deps
(package js_of_ocaml-ppx)
(package js_of_ocaml)
(package js_of_ocaml-compiler)
(package js_of_ocaml-lwt)
(package js_of_ocaml-tyxml)
(package js_of_ocaml-toplevel)
)
(action
(run jsoo_listunits -o %{targets}
stdlib
graphics
js_of_ocaml-lwt.graphics
js_of_ocaml-compiler.runtime
js_of_ocaml-lwt.graphics
js_of_ocaml-ppx.as-lib
js_of_ocaml.deriving
str
dynlink
zarith
Expand Down
2 changes: 2 additions & 0 deletions toplevel_build/toplevel.ml
Original file line number Diff line number Diff line change
Expand Up @@ -284,6 +284,7 @@ let setup_toplevel () =
exec' "#disable \"shortvar\";;";
exec' "#directory \"/static\";;";
exec' "module Num = Big_int_Z;;";
exec' "module Graph = Graphics_js;;";
Ppx_support.init ();
let[@alert "-deprecated"] new_directive n k = Hashtbl.add Toploop.directive_table n k in
new_directive
Expand Down Expand Up @@ -445,6 +446,7 @@ let run _ =
>>= fun () ->
textbox##focus;
Lwt.return_unit);
Graphics_js.open_canvas (by_id_coerce "test-canvas" Dom_html.CoerceTo.canvas);
Sys_js.set_channel_flusher caml_chan (append Colorize.ocaml output "caml");
Sys_js.set_channel_flusher sharp_chan (append Colorize.ocaml output "sharp");
Sys_js.set_channel_flusher stdout (append Colorize.text output "stdout");
Expand Down

0 comments on commit 014341f

Please sign in to comment.