├── VERSION ├── compiler ├── tests-num │ ├── .ocamlformat │ ├── main.ml │ └── dune ├── tests-re │ ├── .ocamlformat │ └── dune ├── tests-ocaml │ ├── .ocamlformat │ ├── lib-set │ │ ├── testmap.reference │ │ ├── testset.reference │ │ └── dune │ ├── lib-bool │ │ ├── test.reference │ │ └── dune │ ├── lib-filename │ │ ├── extension.reference │ │ ├── suffix.reference │ │ ├── extension.ml │ │ ├── dune │ │ └── suffix.ml │ ├── lib-float │ │ ├── test.reference │ │ └── dune │ ├── lib-fun │ │ ├── test.reference │ │ ├── dune │ │ └── test.ml │ ├── lib-int │ │ ├── test.reference │ │ └── dune │ ├── lib-int64 │ │ ├── test.reference │ │ └── dune │ ├── lib-list │ │ ├── test.reference │ │ └── dune │ ├── lib-option │ │ ├── test.reference │ │ └── dune │ ├── lib-queue │ │ ├── test.reference │ │ └── dune │ ├── lib-result │ │ ├── test.reference │ │ └── dune │ ├── lib-seq │ │ ├── test.reference │ │ ├── dune │ │ └── test.ml │ ├── lib-stack │ │ ├── test.reference │ │ └── dune │ ├── lib-string │ │ ├── test_string.reference │ │ └── dune │ ├── lib-uchar │ │ ├── test.reference │ │ └── dune │ ├── lib-random │ │ ├── rand.reference │ │ ├── dune │ │ └── rand.ml │ ├── lib-digest │ │ ├── md5.reference │ │ └── dune │ ├── lib-bigarray │ │ ├── pr5115.reference │ │ ├── weak_bigarray.reference │ │ ├── change_layout.reference │ │ ├── fftba.reference │ │ ├── pr5115.ml │ │ └── weak_bigarray.ml │ ├── prim-revapply │ │ ├── revapply.reference │ │ ├── apply.reference │ │ ├── revapply.ml │ │ ├── dune │ │ └── apply.ml │ ├── lib-format │ │ ├── pr6824.reference │ │ ├── print_if_newline.reference │ │ ├── pr6824.ml │ │ └── print_if_newline.ml │ ├── lib-bytes │ │ ├── test_bytes.reference │ │ └── dune │ ├── prim-bswap │ │ ├── bswap.reference │ │ ├── dune │ │ └── bswap.ml │ ├── prim-bigstring │ │ ├── bigstring_access.reference │ │ ├── string_access.reference │ │ └── dune │ ├── lib-floatarray │ │ └── dune │ ├── lib-str │ │ └── dune │ ├── lib-buffer │ │ ├── dune │ │ └── test.reference │ ├── basic-modules │ │ ├── dune │ │ └── recursive_module_init.reference │ └── lib-hashtbl │ │ ├── hfun.reference │ │ └── dune ├── tests-check-prim │ ├── main.ml │ └── dune ├── tests-dynlink │ ├── main.out.expected │ ├── plugin.ml │ ├── main.ml │ └── dune ├── tests-compiler │ ├── gen-rules │ │ ├── dune │ │ └── gen.ml │ ├── util │ │ └── dune │ └── dune ├── tests-io │ ├── cat.ml │ └── dune ├── tests-jsoo │ ├── bin │ │ ├── error1.expected │ │ ├── error1-unregister.expected │ │ ├── error2-unregister.expected │ │ ├── error2.expected │ │ ├── error3.ml │ │ ├── error2.ml │ │ ├── error1.ml │ │ ├── error1.html │ │ ├── error2.html │ │ ├── error3.html │ │ ├── error1-unregister.html │ │ ├── error2-unregister.html │ │ └── error3-unregister.html │ └── dune ├── lib-runtime │ ├── gen │ │ └── dune │ ├── tests │ │ └── dune │ └── dune ├── lib-cmdline │ └── dune ├── ppx │ ├── dune │ └── properties.ml ├── lib │ ├── .ocamlformat-ignore │ ├── js_lexer.mli │ ├── js_assign.mli │ ├── constant.ml │ ├── annot_lexer.mli │ ├── dune │ ├── macro.mli │ ├── reserved.mli │ ├── fs.mli │ ├── phisimpl.mli │ ├── tailcall.mli │ ├── deadcode.mli │ ├── inline.mli │ ├── vlq64.mli │ ├── generate_closure.mli │ ├── specialize.mli │ ├── compiler_version.mli │ ├── timer.mli │ ├── freevars.mli │ ├── eval.mli │ ├── js_output.mli │ ├── specialize_js.mli │ ├── source_map_io.mli │ ├── link_js.mli │ ├── debug.mli │ ├── findlib.mli │ ├── timer.ml │ ├── generate.mli │ ├── source_map_io.unsupported.ml │ ├── target_env.mli │ ├── pure_fun.mli │ └── builtins.mli ├── lib-findlib-support │ ├── dune │ ├── jsoo_findlib_support.mli │ └── jsoo_findlib_support.ml ├── bin-jsoo_fs │ ├── dune │ └── jsoo_fs.mli ├── bin-jsoo_link │ ├── dune │ └── jsoo_link.mli ├── bin-jsoo_minify │ ├── dune │ ├── jsoo_minify.mli │ └── cmd_arg.mli └── bin-js_of_ocaml │ ├── js_of_ocaml.mli │ ├── findlib_support.empty.ml │ ├── link.mli │ ├── build_fs.mli │ ├── build_runtime.mli │ ├── print_runtime.mli │ ├── info.mli │ └── compile.mli ├── ppx ├── ppx_deriving_json │ ├── lib │ │ ├── .ocamlformat-ignore │ │ ├── dune │ │ └── ppx_deriving_json.mli │ └── tests │ │ ├── main.ml │ │ └── dune └── ppx_js │ ├── tests │ ├── main.ml │ └── dune │ ├── lib_internal │ ├── dune │ └── ppx_js_internal.mli │ ├── bin │ ├── dune │ └── main.ml │ ├── lib │ ├── dune │ ├── ppx_js_rewriter.ml │ └── ppx_js_rewriter.mli │ └── as-lib │ ├── dune │ ├── ppx_js.ml │ └── ppx_js.mli ├── api └── dune ├── benchmarks ├── sources │ ├── ml │ │ ├── loop.ml │ │ ├── dune │ │ ├── taku.ml │ │ └── fib.ml │ └── js │ │ ├── fib.js │ │ └── loop.js ├── dune ├── report-js.config ├── report-nativejs.config ├── utils │ └── remove_comments.pl ├── report-time-optim.config ├── report-time.config ├── run.config ├── report-size.config ├── report-size-optim.config └── report-compiletime.config ├── tools ├── version │ ├── gen │ │ ├── dune │ │ └── gen.ml │ └── dune ├── select │ └── dune ├── sourcemap │ └── dune ├── format-js.sh ├── toplevel_expect │ └── dune └── emacs-format-js.el ├── toplevel ├── examples │ ├── lwt_toplevel │ │ ├── ppx_support.disabled.ml │ │ ├── graphics_support.disabled.ml │ │ ├── graphics_support.enabled.ml │ │ ├── ocp_indent.fake.ml │ │ ├── indent.mli │ │ ├── ppx_support.enabled.ml │ │ ├── test_dynlink.ml │ │ ├── colorize.mli │ │ ├── ocp_indent.ok.ml │ │ └── colorize.fake.ml │ ├── server │ │ └── dune │ └── eval │ │ ├── dune │ │ └── index.html ├── test │ ├── test_toplevel.reference │ ├── test_toplevel.ml │ └── dune ├── bin │ └── dune └── lib │ ├── dune │ ├── js_of_ocaml_toplevel.ml │ └── jsooTopError.mli ├── examples ├── boulderdash │ ├── README │ ├── sprites │ │ ├── D.png │ │ ├── L.png │ │ ├── R.png │ │ ├── U.png │ │ ├── bD.png │ │ ├── bL.png │ │ ├── bR.png │ │ ├── bU.png │ │ ├── bam.png │ │ ├── end.png │ │ ├── guy.png │ │ ├── bomb.png │ │ ├── door.png │ │ ├── empty.png │ │ ├── grass.png │ │ ├── push_l.png │ │ ├── push_r.png │ │ ├── wall.png │ │ ├── boulder.png │ │ ├── diamond.png │ │ ├── red_diamond.png │ │ └── blue_diamond.png │ ├── maps │ │ ├── level0.map │ │ ├── level3.map │ │ ├── level1.map │ │ ├── level2.map │ │ └── level4.map │ ├── maps.txt │ ├── index.html │ ├── dune │ └── LICENSE ├── minesweeper │ ├── README │ ├── sprites │ │ ├── 1.png │ │ ├── 2.png │ │ ├── 3.png │ │ ├── 4.png │ │ ├── 5.png │ │ ├── 6.png │ │ ├── 7.png │ │ ├── 8.png │ │ ├── bomb.png │ │ ├── empty.png │ │ ├── flag.png │ │ └── normal.png │ ├── dune │ ├── index.html │ └── LICENSE ├── dune ├── separate_compilation │ ├── module2.ml │ ├── module1.ml │ └── index.html ├── ocsigen8-100x30.png ├── planet │ ├── texture.jpg │ ├── dune │ └── index.html ├── wiki │ ├── wiki_syntax.ml │ ├── wikicreole.mll │ ├── dune │ ├── index.html │ └── test.ml ├── hyperbolic │ ├── icons │ │ ├── favicon.png │ │ ├── globe-38.png │ │ ├── info-38.png │ │ ├── commons-38.png │ │ ├── wikipedia-38.png │ │ └── meeting-point-38.png │ ├── thumbnails │ │ ├── bos.jpg │ │ ├── homo.jpg │ │ ├── lama.jpg │ │ ├── lynx.jpg │ │ ├── mus.jpg │ │ ├── oryx.jpg │ │ ├── pan.jpg │ │ ├── sus.jpg │ │ ├── alces.jpg │ │ ├── ateles.jpg │ │ ├── bison.jpg │ │ ├── camel.jpg │ │ ├── canis.jpg │ │ ├── capra.jpg │ │ ├── castor.jpg │ │ ├── cervus.jpg │ │ ├── felis.jpg │ │ ├── koala.jpg │ │ ├── lemur.jpg │ │ ├── lepus.jpg │ │ ├── lutra.jpg │ │ ├── macaca.jpg │ │ ├── mouton.jpg │ │ ├── okapia.jpg │ │ ├── ovibos.jpg │ │ ├── pongo.jpg │ │ ├── sorex.jpg │ │ ├── talpa.jpg │ │ ├── ursus.jpg │ │ ├── vulpes.jpg │ │ ├── acinonyx.jpg │ │ ├── aepyceros.jpg │ │ ├── bradypus.jpg │ │ ├── callitrix.jpg │ │ ├── capreolus.jpg │ │ ├── echidne.jpg │ │ ├── eliomys.jpg │ │ ├── erinaceus.jpg │ │ ├── giraffa.jpg │ │ ├── gorilla.jpg │ │ ├── hystrix.jpg │ │ ├── lamantins.jpg │ │ ├── loxodonta.jpg │ │ ├── macropus.jpg │ │ ├── marmota.jpg │ │ ├── mephitis.jpg │ │ ├── mirounga.jpg │ │ ├── monodon.jpg │ │ ├── mouflon.jpg │ │ ├── neofelis.jpg │ │ ├── odobenus.jpg │ │ ├── orcinus.jpg │ │ ├── panthera.jpg │ │ ├── phocoena.jpg │ │ ├── plecotus.jpg │ │ ├── procyon.jpg │ │ ├── rupicapra.jpg │ │ ├── sciurus.jpg │ │ ├── simocyon.jpg │ │ ├── suricata.jpg │ │ ├── syncerus.jpg │ │ ├── tarsius.jpg │ │ ├── ailuropoda.jpg │ │ ├── parahyaena.jpg │ │ ├── priodontes.jpg │ │ ├── rhinolophus.jpg │ │ ├── synaptomys.jpg │ │ ├── tremarctos.jpg │ │ ├── arctocephalus.jpg │ │ ├── balaenoptera.jpg │ │ ├── ceratotherium.jpg │ │ ├── connochaetes.jpg │ │ ├── delphinapterus.jpg │ │ ├── equus_asinus.jpg │ │ ├── equus_caballus.jpg │ │ ├── equus_grevyi.jpg │ │ ├── hippopotamus.jpg │ │ ├── mesocricetus.jpg │ │ ├── myrmecophaga.jpg │ │ ├── ornithorynque.jpg │ │ ├── phacochoerus.jpg │ │ └── platacanthomys.jpg │ ├── messages.json │ └── dune ├── README.md ├── wysiwyg │ ├── dune │ └── index.html ├── cubes │ ├── index.html │ └── dune ├── graph_viewer │ ├── index.html │ ├── dune │ ├── dot_render.mli │ ├── dot_lexer.mli │ ├── viewer.mli │ ├── scene_extents.mli │ └── main.ml └── webgl │ └── dune ├── lib ├── gen_stubs │ └── dune ├── lwt │ ├── dune │ ├── log │ │ └── dune │ └── graphics │ │ ├── dune │ │ └── graphics_js_stubs.c ├── tests │ └── dune ├── deriving_json │ ├── tests │ │ └── dune │ └── dune ├── tyxml │ ├── dune │ └── js_of_ocaml_tyxml.ml └── js_of_ocaml │ └── dune ├── manual ├── files │ └── performances │ │ ├── perf.png │ │ └── size.png ├── install.wiki ├── dune └── rev-bindings.wiki ├── ocamlbuild └── dune ├── .github ├── ISSUE_TEMPLATE │ ├── other.md │ ├── bug_report.md │ └── feature_request.md └── workflows │ └── changelog.yml ├── dune ├── js_of_ocaml.opam.template ├── js_of_ocaml-lwt.opam.template ├── js_of_ocaml-ppx.opam.template ├── js_of_ocaml-compiler.opam.template ├── js_of_ocaml-toplevel.opam.template ├── js_of_ocaml-tyxml.opam.template ├── js_of_ocaml-ocamlbuild.opam.template ├── js_of_ocaml-ppx_deriving_json.opam.template ├── .ocamlformat ├── runtime ├── dune ├── bigstring-cstruct.js └── bigstring-core_kernel.js ├── HACKING.md ├── Makefile ├── dune-workspace.dev └── .gitignore /VERSION: -------------------------------------------------------------------------------- 1 | 3.11.0 2 | -------------------------------------------------------------------------------- /compiler/tests-num/.ocamlformat: -------------------------------------------------------------------------------- 1 | disable -------------------------------------------------------------------------------- /compiler/tests-re/.ocamlformat: -------------------------------------------------------------------------------- 1 | disable -------------------------------------------------------------------------------- /compiler/tests-ocaml/.ocamlformat: -------------------------------------------------------------------------------- 1 | disable -------------------------------------------------------------------------------- /compiler/tests-ocaml/lib-set/testmap.reference: -------------------------------------------------------------------------------- 1 | -------------------------------------------------------------------------------- /compiler/tests-ocaml/lib-set/testset.reference: -------------------------------------------------------------------------------- 1 | -------------------------------------------------------------------------------- /compiler/tests-ocaml/lib-bool/test.reference: -------------------------------------------------------------------------------- 1 | OK 2 | -------------------------------------------------------------------------------- /compiler/tests-ocaml/lib-filename/extension.reference: -------------------------------------------------------------------------------- 1 | -------------------------------------------------------------------------------- /compiler/tests-ocaml/lib-filename/suffix.reference: -------------------------------------------------------------------------------- 1 | -------------------------------------------------------------------------------- /compiler/tests-ocaml/lib-float/test.reference: -------------------------------------------------------------------------------- 1 | OK 2 | -------------------------------------------------------------------------------- /compiler/tests-ocaml/lib-fun/test.reference: -------------------------------------------------------------------------------- 1 | OK 2 | -------------------------------------------------------------------------------- /compiler/tests-ocaml/lib-int/test.reference: -------------------------------------------------------------------------------- 1 | OK 2 | -------------------------------------------------------------------------------- /compiler/tests-ocaml/lib-int64/test.reference: -------------------------------------------------------------------------------- 1 | OK 2 | -------------------------------------------------------------------------------- /compiler/tests-ocaml/lib-list/test.reference: -------------------------------------------------------------------------------- 1 | OK 2 | -------------------------------------------------------------------------------- /compiler/tests-ocaml/lib-option/test.reference: -------------------------------------------------------------------------------- 1 | OK 2 | -------------------------------------------------------------------------------- /compiler/tests-ocaml/lib-queue/test.reference: -------------------------------------------------------------------------------- 1 | OK 2 | -------------------------------------------------------------------------------- /compiler/tests-ocaml/lib-result/test.reference: -------------------------------------------------------------------------------- 1 | OK 2 | -------------------------------------------------------------------------------- /compiler/tests-ocaml/lib-seq/test.reference: -------------------------------------------------------------------------------- 1 | OK 2 | -------------------------------------------------------------------------------- /compiler/tests-ocaml/lib-stack/test.reference: -------------------------------------------------------------------------------- 1 | OK 2 | -------------------------------------------------------------------------------- /compiler/tests-ocaml/lib-string/test_string.reference: -------------------------------------------------------------------------------- 1 | -------------------------------------------------------------------------------- /compiler/tests-ocaml/lib-uchar/test.reference: -------------------------------------------------------------------------------- 1 | OK 2 | -------------------------------------------------------------------------------- /compiler/tests-check-prim/main.ml: -------------------------------------------------------------------------------- 1 | (* this is empty *) 2 | -------------------------------------------------------------------------------- /compiler/tests-ocaml/lib-random/rand.reference: -------------------------------------------------------------------------------- 1 | PASSED 2 | -------------------------------------------------------------------------------- /compiler/tests-dynlink/main.out.expected: -------------------------------------------------------------------------------- 1 | hello 2 | plugin loaded 3 | -------------------------------------------------------------------------------- /compiler/tests-compiler/gen-rules/dune: -------------------------------------------------------------------------------- 1 | (executable 2 | (name gen)) 3 | -------------------------------------------------------------------------------- /compiler/tests-ocaml/lib-digest/md5.reference: -------------------------------------------------------------------------------- 1 | Test vectors passed. 2 | -------------------------------------------------------------------------------- /ppx/ppx_deriving_json/lib/.ocamlformat-ignore: -------------------------------------------------------------------------------- 1 | ppx_deriving_json.cppo.ml -------------------------------------------------------------------------------- /api/dune: -------------------------------------------------------------------------------- 1 | (alias 2 | (name ocsigen-doc) 3 | (deps 4 | (alias ../doc))) 5 | -------------------------------------------------------------------------------- /benchmarks/sources/ml/loop.ml: -------------------------------------------------------------------------------- 1 | for _ = 1 to 1000000000 do 2 | () 3 | done 4 | -------------------------------------------------------------------------------- /compiler/tests-dynlink/plugin.ml: -------------------------------------------------------------------------------- 1 | let () = print_endline "plugin loaded" 2 | -------------------------------------------------------------------------------- /compiler/tests-io/cat.ml: -------------------------------------------------------------------------------- 1 | let () = input_line stdin |> output_string stdout 2 | -------------------------------------------------------------------------------- /tools/version/gen/dune: -------------------------------------------------------------------------------- 1 | (executable 2 | (name gen) 3 | (libraries unix)) 4 | -------------------------------------------------------------------------------- /toplevel/examples/lwt_toplevel/ppx_support.disabled.ml: -------------------------------------------------------------------------------- 1 | let init () = () 2 | -------------------------------------------------------------------------------- /compiler/tests-jsoo/bin/error1.expected: -------------------------------------------------------------------------------- 1 | Fatal error: exception custom printer 2 | -------------------------------------------------------------------------------- /compiler/tests-ocaml/lib-bigarray/pr5115.reference: -------------------------------------------------------------------------------- 1 | ***EXEC*** 2 | ***EXEC*** 3 | -------------------------------------------------------------------------------- /toplevel/examples/lwt_toplevel/graphics_support.disabled.ml: -------------------------------------------------------------------------------- 1 | let init _ = () 2 | -------------------------------------------------------------------------------- /compiler/tests-ocaml/prim-revapply/revapply.reference: -------------------------------------------------------------------------------- 1 | 6 2 | 36 3 | 18 4 | 37 5 | 260 6 | -------------------------------------------------------------------------------- /ppx/ppx_js/tests/main.ml: -------------------------------------------------------------------------------- 1 | let () = Toplevel_expect_test.run (fun _ -> Ppx_js.mapper) 2 | -------------------------------------------------------------------------------- /examples/boulderdash/README: -------------------------------------------------------------------------------- 1 | This is a port of the Boulder Dash example from O'Browser. 2 | -------------------------------------------------------------------------------- /examples/minesweeper/README: -------------------------------------------------------------------------------- 1 | This is a port of the Minesweeper example from O'Browser. 2 | -------------------------------------------------------------------------------- /tools/select/dune: -------------------------------------------------------------------------------- 1 | (executables 2 | (names select) 3 | (preprocess no_preprocessing)) 4 | -------------------------------------------------------------------------------- /lib/gen_stubs/dune: -------------------------------------------------------------------------------- 1 | (executable 2 | (name gen_stubs) 3 | (libraries compiler-libs.common)) 4 | -------------------------------------------------------------------------------- /compiler/lib-runtime/gen/dune: -------------------------------------------------------------------------------- 1 | (executable 2 | (name gen) 3 | (libraries js_of_ocaml-compiler)) 4 | -------------------------------------------------------------------------------- /examples/dune: -------------------------------------------------------------------------------- 1 | (alias 2 | (name default) 3 | (deps 4 | index.html 5 | (glob_files *.{png}))) 6 | -------------------------------------------------------------------------------- /toplevel/examples/lwt_toplevel/graphics_support.enabled.ml: -------------------------------------------------------------------------------- 1 | let init elt = Graphics_js.open_canvas elt 2 | -------------------------------------------------------------------------------- /compiler/lib-cmdline/dune: -------------------------------------------------------------------------------- 1 | (library 2 | (name jsoo_cmdline) 3 | (libraries cmdliner js_of_ocaml-compiler)) 4 | -------------------------------------------------------------------------------- /compiler/tests-ocaml/lib-format/pr6824.reference: -------------------------------------------------------------------------------- 1 | [1] 2 | [2] 3 | [1] 4 | [2] 5 | 6 | All tests succeeded. 7 | -------------------------------------------------------------------------------- /examples/separate_compilation/module2.ml: -------------------------------------------------------------------------------- 1 | let () = try raise Not_found with Not_found -> Module1.hello "world" 2 | -------------------------------------------------------------------------------- /compiler/tests-jsoo/bin/error1-unregister.expected: -------------------------------------------------------------------------------- 1 | Fatal error: exception Dune__exe__Error1.D(2, "test", _) 2 | 3 | -------------------------------------------------------------------------------- /compiler/tests-ocaml/lib-bytes/test_bytes.reference: -------------------------------------------------------------------------------- 1 | 0 1 2 3 4 5 6 7 8 9 10 11 12 13 14 2 | All tests succeeded. 3 | -------------------------------------------------------------------------------- /examples/ocsigen8-100x30.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/philzook58/js_of_ocaml/master/examples/ocsigen8-100x30.png -------------------------------------------------------------------------------- /examples/planet/texture.jpg: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/philzook58/js_of_ocaml/master/examples/planet/texture.jpg -------------------------------------------------------------------------------- /examples/wiki/wiki_syntax.ml: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/philzook58/js_of_ocaml/master/examples/wiki/wiki_syntax.ml -------------------------------------------------------------------------------- /examples/wiki/wikicreole.mll: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/philzook58/js_of_ocaml/master/examples/wiki/wikicreole.mll -------------------------------------------------------------------------------- /toplevel/examples/server/dune: -------------------------------------------------------------------------------- 1 | (executables 2 | (names server) 3 | (libraries bytes findlib cohttp-lwt-unix)) 4 | -------------------------------------------------------------------------------- /compiler/tests-ocaml/lib-bigarray/weak_bigarray.reference: -------------------------------------------------------------------------------- 1 | a.(0) = 42.000000 2 | b.(0) = 42.000000 3 | b.(0) = 42.000000 4 | -------------------------------------------------------------------------------- /toplevel/examples/lwt_toplevel/ocp_indent.fake.ml: -------------------------------------------------------------------------------- 1 | let indent s _in_lines = s 2 | 3 | (* ocp-indent not available *) 4 | -------------------------------------------------------------------------------- /examples/boulderdash/sprites/D.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/philzook58/js_of_ocaml/master/examples/boulderdash/sprites/D.png -------------------------------------------------------------------------------- /examples/boulderdash/sprites/L.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/philzook58/js_of_ocaml/master/examples/boulderdash/sprites/L.png -------------------------------------------------------------------------------- /examples/boulderdash/sprites/R.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/philzook58/js_of_ocaml/master/examples/boulderdash/sprites/R.png -------------------------------------------------------------------------------- /examples/boulderdash/sprites/U.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/philzook58/js_of_ocaml/master/examples/boulderdash/sprites/U.png -------------------------------------------------------------------------------- /examples/minesweeper/sprites/1.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/philzook58/js_of_ocaml/master/examples/minesweeper/sprites/1.png -------------------------------------------------------------------------------- /examples/minesweeper/sprites/2.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/philzook58/js_of_ocaml/master/examples/minesweeper/sprites/2.png -------------------------------------------------------------------------------- /examples/minesweeper/sprites/3.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/philzook58/js_of_ocaml/master/examples/minesweeper/sprites/3.png -------------------------------------------------------------------------------- /examples/minesweeper/sprites/4.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/philzook58/js_of_ocaml/master/examples/minesweeper/sprites/4.png -------------------------------------------------------------------------------- /examples/minesweeper/sprites/5.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/philzook58/js_of_ocaml/master/examples/minesweeper/sprites/5.png -------------------------------------------------------------------------------- /examples/minesweeper/sprites/6.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/philzook58/js_of_ocaml/master/examples/minesweeper/sprites/6.png -------------------------------------------------------------------------------- /examples/minesweeper/sprites/7.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/philzook58/js_of_ocaml/master/examples/minesweeper/sprites/7.png -------------------------------------------------------------------------------- /examples/minesweeper/sprites/8.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/philzook58/js_of_ocaml/master/examples/minesweeper/sprites/8.png -------------------------------------------------------------------------------- /manual/files/performances/perf.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/philzook58/js_of_ocaml/master/manual/files/performances/perf.png -------------------------------------------------------------------------------- /manual/files/performances/size.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/philzook58/js_of_ocaml/master/manual/files/performances/size.png -------------------------------------------------------------------------------- /toplevel/examples/lwt_toplevel/indent.mli: -------------------------------------------------------------------------------- 1 | open Js_of_ocaml 2 | 3 | val textarea : Dom_html.textAreaElement Js.t -> unit 4 | -------------------------------------------------------------------------------- /compiler/ppx/dune: -------------------------------------------------------------------------------- 1 | (library 2 | (name ppx_optcomp_light) 3 | (libraries compiler-libs.common ppxlib) 4 | (kind ppx_rewriter)) 5 | -------------------------------------------------------------------------------- /compiler/tests-ocaml/prim-bswap/bswap.reference: -------------------------------------------------------------------------------- 1 | 4433 2 | f0f0 3 | 44332211 4 | f0f0f0f0 5 | 8877665544332211 6 | f0f0f0f0f0f0f0f0 7 | -------------------------------------------------------------------------------- /compiler/tests-ocaml/prim-revapply/apply.reference: -------------------------------------------------------------------------------- 1 | 6 2 | 36 3 | 18 4 | 37 5 | 260 6 | 6 7 | 36 8 | 18 9 | 37 10 | 260 11 | -------------------------------------------------------------------------------- /examples/boulderdash/sprites/bD.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/philzook58/js_of_ocaml/master/examples/boulderdash/sprites/bD.png -------------------------------------------------------------------------------- /examples/boulderdash/sprites/bL.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/philzook58/js_of_ocaml/master/examples/boulderdash/sprites/bL.png -------------------------------------------------------------------------------- /examples/boulderdash/sprites/bR.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/philzook58/js_of_ocaml/master/examples/boulderdash/sprites/bR.png -------------------------------------------------------------------------------- /examples/boulderdash/sprites/bU.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/philzook58/js_of_ocaml/master/examples/boulderdash/sprites/bU.png -------------------------------------------------------------------------------- /examples/boulderdash/sprites/bam.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/philzook58/js_of_ocaml/master/examples/boulderdash/sprites/bam.png -------------------------------------------------------------------------------- /examples/boulderdash/sprites/end.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/philzook58/js_of_ocaml/master/examples/boulderdash/sprites/end.png -------------------------------------------------------------------------------- /examples/boulderdash/sprites/guy.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/philzook58/js_of_ocaml/master/examples/boulderdash/sprites/guy.png -------------------------------------------------------------------------------- /examples/separate_compilation/module1.ml: -------------------------------------------------------------------------------- 1 | let hello_string = "hello" 2 | 3 | let hello name = Printf.printf "hello %s!\n" name 4 | -------------------------------------------------------------------------------- /toplevel/examples/lwt_toplevel/ppx_support.enabled.ml: -------------------------------------------------------------------------------- 1 | let init () = Ast_mapper.register "js_of_ocaml" (fun _ -> Ppx_js.mapper) 2 | -------------------------------------------------------------------------------- /examples/boulderdash/sprites/bomb.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/philzook58/js_of_ocaml/master/examples/boulderdash/sprites/bomb.png -------------------------------------------------------------------------------- /examples/boulderdash/sprites/door.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/philzook58/js_of_ocaml/master/examples/boulderdash/sprites/door.png -------------------------------------------------------------------------------- /examples/boulderdash/sprites/empty.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/philzook58/js_of_ocaml/master/examples/boulderdash/sprites/empty.png -------------------------------------------------------------------------------- /examples/boulderdash/sprites/grass.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/philzook58/js_of_ocaml/master/examples/boulderdash/sprites/grass.png -------------------------------------------------------------------------------- /examples/boulderdash/sprites/push_l.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/philzook58/js_of_ocaml/master/examples/boulderdash/sprites/push_l.png -------------------------------------------------------------------------------- /examples/boulderdash/sprites/push_r.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/philzook58/js_of_ocaml/master/examples/boulderdash/sprites/push_r.png -------------------------------------------------------------------------------- /examples/boulderdash/sprites/wall.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/philzook58/js_of_ocaml/master/examples/boulderdash/sprites/wall.png -------------------------------------------------------------------------------- /examples/hyperbolic/icons/favicon.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/philzook58/js_of_ocaml/master/examples/hyperbolic/icons/favicon.png -------------------------------------------------------------------------------- /examples/hyperbolic/icons/globe-38.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/philzook58/js_of_ocaml/master/examples/hyperbolic/icons/globe-38.png -------------------------------------------------------------------------------- /examples/hyperbolic/icons/info-38.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/philzook58/js_of_ocaml/master/examples/hyperbolic/icons/info-38.png -------------------------------------------------------------------------------- /examples/hyperbolic/thumbnails/bos.jpg: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/philzook58/js_of_ocaml/master/examples/hyperbolic/thumbnails/bos.jpg -------------------------------------------------------------------------------- /examples/hyperbolic/thumbnails/homo.jpg: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/philzook58/js_of_ocaml/master/examples/hyperbolic/thumbnails/homo.jpg -------------------------------------------------------------------------------- /examples/hyperbolic/thumbnails/lama.jpg: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/philzook58/js_of_ocaml/master/examples/hyperbolic/thumbnails/lama.jpg -------------------------------------------------------------------------------- /examples/hyperbolic/thumbnails/lynx.jpg: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/philzook58/js_of_ocaml/master/examples/hyperbolic/thumbnails/lynx.jpg -------------------------------------------------------------------------------- /examples/hyperbolic/thumbnails/mus.jpg: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/philzook58/js_of_ocaml/master/examples/hyperbolic/thumbnails/mus.jpg -------------------------------------------------------------------------------- /examples/hyperbolic/thumbnails/oryx.jpg: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/philzook58/js_of_ocaml/master/examples/hyperbolic/thumbnails/oryx.jpg -------------------------------------------------------------------------------- /examples/hyperbolic/thumbnails/pan.jpg: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/philzook58/js_of_ocaml/master/examples/hyperbolic/thumbnails/pan.jpg -------------------------------------------------------------------------------- /examples/hyperbolic/thumbnails/sus.jpg: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/philzook58/js_of_ocaml/master/examples/hyperbolic/thumbnails/sus.jpg -------------------------------------------------------------------------------- /examples/minesweeper/sprites/bomb.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/philzook58/js_of_ocaml/master/examples/minesweeper/sprites/bomb.png -------------------------------------------------------------------------------- /examples/minesweeper/sprites/empty.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/philzook58/js_of_ocaml/master/examples/minesweeper/sprites/empty.png -------------------------------------------------------------------------------- /examples/minesweeper/sprites/flag.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/philzook58/js_of_ocaml/master/examples/minesweeper/sprites/flag.png -------------------------------------------------------------------------------- /examples/minesweeper/sprites/normal.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/philzook58/js_of_ocaml/master/examples/minesweeper/sprites/normal.png -------------------------------------------------------------------------------- /compiler/lib/.ocamlformat-ignore: -------------------------------------------------------------------------------- 1 | annot_lexer.ml 2 | annot_parser.ml 3 | annot_parser.mli 4 | js_lexer.ml 5 | js_parser.ml 6 | js_parser.mli 7 | -------------------------------------------------------------------------------- /compiler/tests-compiler/util/dune: -------------------------------------------------------------------------------- 1 | (library 2 | (name jsoo_compiler_expect_tests_helper) 3 | (libraries js_of_ocaml_compiler unix str)) 4 | -------------------------------------------------------------------------------- /compiler/tests-jsoo/bin/error2-unregister.expected: -------------------------------------------------------------------------------- 1 | Fatal error: exception Match_failure("compiler/tests-jsoo/bin/error2.ml", 11, 2) 2 | 3 | -------------------------------------------------------------------------------- /examples/boulderdash/sprites/boulder.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/philzook58/js_of_ocaml/master/examples/boulderdash/sprites/boulder.png -------------------------------------------------------------------------------- /examples/boulderdash/sprites/diamond.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/philzook58/js_of_ocaml/master/examples/boulderdash/sprites/diamond.png -------------------------------------------------------------------------------- /examples/hyperbolic/icons/commons-38.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/philzook58/js_of_ocaml/master/examples/hyperbolic/icons/commons-38.png -------------------------------------------------------------------------------- /examples/hyperbolic/thumbnails/alces.jpg: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/philzook58/js_of_ocaml/master/examples/hyperbolic/thumbnails/alces.jpg -------------------------------------------------------------------------------- /examples/hyperbolic/thumbnails/ateles.jpg: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/philzook58/js_of_ocaml/master/examples/hyperbolic/thumbnails/ateles.jpg -------------------------------------------------------------------------------- /examples/hyperbolic/thumbnails/bison.jpg: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/philzook58/js_of_ocaml/master/examples/hyperbolic/thumbnails/bison.jpg -------------------------------------------------------------------------------- /examples/hyperbolic/thumbnails/camel.jpg: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/philzook58/js_of_ocaml/master/examples/hyperbolic/thumbnails/camel.jpg -------------------------------------------------------------------------------- /examples/hyperbolic/thumbnails/canis.jpg: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/philzook58/js_of_ocaml/master/examples/hyperbolic/thumbnails/canis.jpg -------------------------------------------------------------------------------- /examples/hyperbolic/thumbnails/capra.jpg: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/philzook58/js_of_ocaml/master/examples/hyperbolic/thumbnails/capra.jpg -------------------------------------------------------------------------------- /examples/hyperbolic/thumbnails/castor.jpg: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/philzook58/js_of_ocaml/master/examples/hyperbolic/thumbnails/castor.jpg -------------------------------------------------------------------------------- /examples/hyperbolic/thumbnails/cervus.jpg: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/philzook58/js_of_ocaml/master/examples/hyperbolic/thumbnails/cervus.jpg -------------------------------------------------------------------------------- /examples/hyperbolic/thumbnails/felis.jpg: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/philzook58/js_of_ocaml/master/examples/hyperbolic/thumbnails/felis.jpg -------------------------------------------------------------------------------- /examples/hyperbolic/thumbnails/koala.jpg: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/philzook58/js_of_ocaml/master/examples/hyperbolic/thumbnails/koala.jpg -------------------------------------------------------------------------------- /examples/hyperbolic/thumbnails/lemur.jpg: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/philzook58/js_of_ocaml/master/examples/hyperbolic/thumbnails/lemur.jpg -------------------------------------------------------------------------------- /examples/hyperbolic/thumbnails/lepus.jpg: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/philzook58/js_of_ocaml/master/examples/hyperbolic/thumbnails/lepus.jpg -------------------------------------------------------------------------------- /examples/hyperbolic/thumbnails/lutra.jpg: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/philzook58/js_of_ocaml/master/examples/hyperbolic/thumbnails/lutra.jpg -------------------------------------------------------------------------------- /examples/hyperbolic/thumbnails/macaca.jpg: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/philzook58/js_of_ocaml/master/examples/hyperbolic/thumbnails/macaca.jpg -------------------------------------------------------------------------------- /examples/hyperbolic/thumbnails/mouton.jpg: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/philzook58/js_of_ocaml/master/examples/hyperbolic/thumbnails/mouton.jpg -------------------------------------------------------------------------------- /examples/hyperbolic/thumbnails/okapia.jpg: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/philzook58/js_of_ocaml/master/examples/hyperbolic/thumbnails/okapia.jpg -------------------------------------------------------------------------------- /examples/hyperbolic/thumbnails/ovibos.jpg: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/philzook58/js_of_ocaml/master/examples/hyperbolic/thumbnails/ovibos.jpg -------------------------------------------------------------------------------- /examples/hyperbolic/thumbnails/pongo.jpg: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/philzook58/js_of_ocaml/master/examples/hyperbolic/thumbnails/pongo.jpg -------------------------------------------------------------------------------- /examples/hyperbolic/thumbnails/sorex.jpg: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/philzook58/js_of_ocaml/master/examples/hyperbolic/thumbnails/sorex.jpg -------------------------------------------------------------------------------- /examples/hyperbolic/thumbnails/talpa.jpg: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/philzook58/js_of_ocaml/master/examples/hyperbolic/thumbnails/talpa.jpg -------------------------------------------------------------------------------- /examples/hyperbolic/thumbnails/ursus.jpg: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/philzook58/js_of_ocaml/master/examples/hyperbolic/thumbnails/ursus.jpg -------------------------------------------------------------------------------- /examples/hyperbolic/thumbnails/vulpes.jpg: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/philzook58/js_of_ocaml/master/examples/hyperbolic/thumbnails/vulpes.jpg -------------------------------------------------------------------------------- /toplevel/examples/lwt_toplevel/test_dynlink.ml: -------------------------------------------------------------------------------- 1 | let _ = print_endline "Dynlink OK" 2 | 3 | let f () = print_endline "Test_dynlink.f Ok" 4 | -------------------------------------------------------------------------------- /benchmarks/dune: -------------------------------------------------------------------------------- 1 | (executables 2 | (names report run) 3 | (libraries unix)) 4 | 5 | (alias 6 | (name default) 7 | (deps report.exe run.exe)) 8 | -------------------------------------------------------------------------------- /examples/boulderdash/sprites/red_diamond.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/philzook58/js_of_ocaml/master/examples/boulderdash/sprites/red_diamond.png -------------------------------------------------------------------------------- /examples/hyperbolic/icons/wikipedia-38.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/philzook58/js_of_ocaml/master/examples/hyperbolic/icons/wikipedia-38.png -------------------------------------------------------------------------------- /examples/hyperbolic/thumbnails/acinonyx.jpg: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/philzook58/js_of_ocaml/master/examples/hyperbolic/thumbnails/acinonyx.jpg -------------------------------------------------------------------------------- /examples/hyperbolic/thumbnails/aepyceros.jpg: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/philzook58/js_of_ocaml/master/examples/hyperbolic/thumbnails/aepyceros.jpg -------------------------------------------------------------------------------- /examples/hyperbolic/thumbnails/bradypus.jpg: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/philzook58/js_of_ocaml/master/examples/hyperbolic/thumbnails/bradypus.jpg -------------------------------------------------------------------------------- /examples/hyperbolic/thumbnails/callitrix.jpg: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/philzook58/js_of_ocaml/master/examples/hyperbolic/thumbnails/callitrix.jpg -------------------------------------------------------------------------------- /examples/hyperbolic/thumbnails/capreolus.jpg: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/philzook58/js_of_ocaml/master/examples/hyperbolic/thumbnails/capreolus.jpg -------------------------------------------------------------------------------- /examples/hyperbolic/thumbnails/echidne.jpg: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/philzook58/js_of_ocaml/master/examples/hyperbolic/thumbnails/echidne.jpg -------------------------------------------------------------------------------- /examples/hyperbolic/thumbnails/eliomys.jpg: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/philzook58/js_of_ocaml/master/examples/hyperbolic/thumbnails/eliomys.jpg -------------------------------------------------------------------------------- /examples/hyperbolic/thumbnails/erinaceus.jpg: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/philzook58/js_of_ocaml/master/examples/hyperbolic/thumbnails/erinaceus.jpg -------------------------------------------------------------------------------- /examples/hyperbolic/thumbnails/giraffa.jpg: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/philzook58/js_of_ocaml/master/examples/hyperbolic/thumbnails/giraffa.jpg -------------------------------------------------------------------------------- /examples/hyperbolic/thumbnails/gorilla.jpg: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/philzook58/js_of_ocaml/master/examples/hyperbolic/thumbnails/gorilla.jpg -------------------------------------------------------------------------------- /examples/hyperbolic/thumbnails/hystrix.jpg: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/philzook58/js_of_ocaml/master/examples/hyperbolic/thumbnails/hystrix.jpg -------------------------------------------------------------------------------- /examples/hyperbolic/thumbnails/lamantins.jpg: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/philzook58/js_of_ocaml/master/examples/hyperbolic/thumbnails/lamantins.jpg -------------------------------------------------------------------------------- /examples/hyperbolic/thumbnails/loxodonta.jpg: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/philzook58/js_of_ocaml/master/examples/hyperbolic/thumbnails/loxodonta.jpg -------------------------------------------------------------------------------- /examples/hyperbolic/thumbnails/macropus.jpg: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/philzook58/js_of_ocaml/master/examples/hyperbolic/thumbnails/macropus.jpg -------------------------------------------------------------------------------- /examples/hyperbolic/thumbnails/marmota.jpg: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/philzook58/js_of_ocaml/master/examples/hyperbolic/thumbnails/marmota.jpg -------------------------------------------------------------------------------- /examples/hyperbolic/thumbnails/mephitis.jpg: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/philzook58/js_of_ocaml/master/examples/hyperbolic/thumbnails/mephitis.jpg -------------------------------------------------------------------------------- /examples/hyperbolic/thumbnails/mirounga.jpg: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/philzook58/js_of_ocaml/master/examples/hyperbolic/thumbnails/mirounga.jpg -------------------------------------------------------------------------------- /examples/hyperbolic/thumbnails/monodon.jpg: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/philzook58/js_of_ocaml/master/examples/hyperbolic/thumbnails/monodon.jpg -------------------------------------------------------------------------------- /examples/hyperbolic/thumbnails/mouflon.jpg: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/philzook58/js_of_ocaml/master/examples/hyperbolic/thumbnails/mouflon.jpg -------------------------------------------------------------------------------- /examples/hyperbolic/thumbnails/neofelis.jpg: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/philzook58/js_of_ocaml/master/examples/hyperbolic/thumbnails/neofelis.jpg -------------------------------------------------------------------------------- /examples/hyperbolic/thumbnails/odobenus.jpg: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/philzook58/js_of_ocaml/master/examples/hyperbolic/thumbnails/odobenus.jpg -------------------------------------------------------------------------------- /examples/hyperbolic/thumbnails/orcinus.jpg: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/philzook58/js_of_ocaml/master/examples/hyperbolic/thumbnails/orcinus.jpg -------------------------------------------------------------------------------- /examples/hyperbolic/thumbnails/panthera.jpg: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/philzook58/js_of_ocaml/master/examples/hyperbolic/thumbnails/panthera.jpg -------------------------------------------------------------------------------- /examples/hyperbolic/thumbnails/phocoena.jpg: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/philzook58/js_of_ocaml/master/examples/hyperbolic/thumbnails/phocoena.jpg -------------------------------------------------------------------------------- /examples/hyperbolic/thumbnails/plecotus.jpg: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/philzook58/js_of_ocaml/master/examples/hyperbolic/thumbnails/plecotus.jpg -------------------------------------------------------------------------------- /examples/hyperbolic/thumbnails/procyon.jpg: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/philzook58/js_of_ocaml/master/examples/hyperbolic/thumbnails/procyon.jpg -------------------------------------------------------------------------------- /examples/hyperbolic/thumbnails/rupicapra.jpg: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/philzook58/js_of_ocaml/master/examples/hyperbolic/thumbnails/rupicapra.jpg -------------------------------------------------------------------------------- /examples/hyperbolic/thumbnails/sciurus.jpg: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/philzook58/js_of_ocaml/master/examples/hyperbolic/thumbnails/sciurus.jpg -------------------------------------------------------------------------------- /examples/hyperbolic/thumbnails/simocyon.jpg: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/philzook58/js_of_ocaml/master/examples/hyperbolic/thumbnails/simocyon.jpg -------------------------------------------------------------------------------- /examples/hyperbolic/thumbnails/suricata.jpg: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/philzook58/js_of_ocaml/master/examples/hyperbolic/thumbnails/suricata.jpg -------------------------------------------------------------------------------- /examples/hyperbolic/thumbnails/syncerus.jpg: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/philzook58/js_of_ocaml/master/examples/hyperbolic/thumbnails/syncerus.jpg -------------------------------------------------------------------------------- /examples/hyperbolic/thumbnails/tarsius.jpg: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/philzook58/js_of_ocaml/master/examples/hyperbolic/thumbnails/tarsius.jpg -------------------------------------------------------------------------------- /benchmarks/report-js.config: -------------------------------------------------------------------------------- 1 | histogramref times node js_of_ocaml #d98e2d compiled to JS (node) 2 | histogram times node js #d9112d native JS (node) 3 | -------------------------------------------------------------------------------- /examples/boulderdash/sprites/blue_diamond.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/philzook58/js_of_ocaml/master/examples/boulderdash/sprites/blue_diamond.png -------------------------------------------------------------------------------- /examples/hyperbolic/icons/meeting-point-38.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/philzook58/js_of_ocaml/master/examples/hyperbolic/icons/meeting-point-38.png -------------------------------------------------------------------------------- /examples/hyperbolic/thumbnails/ailuropoda.jpg: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/philzook58/js_of_ocaml/master/examples/hyperbolic/thumbnails/ailuropoda.jpg -------------------------------------------------------------------------------- /examples/hyperbolic/thumbnails/parahyaena.jpg: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/philzook58/js_of_ocaml/master/examples/hyperbolic/thumbnails/parahyaena.jpg -------------------------------------------------------------------------------- /examples/hyperbolic/thumbnails/priodontes.jpg: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/philzook58/js_of_ocaml/master/examples/hyperbolic/thumbnails/priodontes.jpg -------------------------------------------------------------------------------- /examples/hyperbolic/thumbnails/rhinolophus.jpg: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/philzook58/js_of_ocaml/master/examples/hyperbolic/thumbnails/rhinolophus.jpg -------------------------------------------------------------------------------- /examples/hyperbolic/thumbnails/synaptomys.jpg: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/philzook58/js_of_ocaml/master/examples/hyperbolic/thumbnails/synaptomys.jpg -------------------------------------------------------------------------------- /examples/hyperbolic/thumbnails/tremarctos.jpg: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/philzook58/js_of_ocaml/master/examples/hyperbolic/thumbnails/tremarctos.jpg -------------------------------------------------------------------------------- /benchmarks/report-nativejs.config: -------------------------------------------------------------------------------- 1 | histogram times node js #775588 native JS (node) 2 | histogramref times node js_of_ocaml #fbaf4f compiled to JS (node) 3 | -------------------------------------------------------------------------------- /benchmarks/utils/remove_comments.pl: -------------------------------------------------------------------------------- 1 | #!/usr/bin/perl 2 | $/ = undef; 3 | $_ = <>; 4 | s#\(\*[^*]*\*+([^)*][^*]*\*+)*\)#defined $2 ? $2 : ""#gse; 5 | print; 6 | -------------------------------------------------------------------------------- /compiler/tests-jsoo/bin/error2.expected: -------------------------------------------------------------------------------- 1 | Fatal error: exception File "compiler/tests-jsoo/bin/error2.ml", line 11, characters 2-7: Pattern matching failed 2 | -------------------------------------------------------------------------------- /examples/boulderdash/maps/level0.map: -------------------------------------------------------------------------------- 1 | ################### 2 | #S........+.......# 3 | #+....+.........+## 4 | #...+........+.#.E# 5 | ################### 6 | -------------------------------------------------------------------------------- /examples/hyperbolic/thumbnails/arctocephalus.jpg: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/philzook58/js_of_ocaml/master/examples/hyperbolic/thumbnails/arctocephalus.jpg -------------------------------------------------------------------------------- /examples/hyperbolic/thumbnails/balaenoptera.jpg: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/philzook58/js_of_ocaml/master/examples/hyperbolic/thumbnails/balaenoptera.jpg -------------------------------------------------------------------------------- /examples/hyperbolic/thumbnails/ceratotherium.jpg: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/philzook58/js_of_ocaml/master/examples/hyperbolic/thumbnails/ceratotherium.jpg -------------------------------------------------------------------------------- /examples/hyperbolic/thumbnails/connochaetes.jpg: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/philzook58/js_of_ocaml/master/examples/hyperbolic/thumbnails/connochaetes.jpg -------------------------------------------------------------------------------- /examples/hyperbolic/thumbnails/delphinapterus.jpg: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/philzook58/js_of_ocaml/master/examples/hyperbolic/thumbnails/delphinapterus.jpg -------------------------------------------------------------------------------- /examples/hyperbolic/thumbnails/equus_asinus.jpg: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/philzook58/js_of_ocaml/master/examples/hyperbolic/thumbnails/equus_asinus.jpg -------------------------------------------------------------------------------- /examples/hyperbolic/thumbnails/equus_caballus.jpg: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/philzook58/js_of_ocaml/master/examples/hyperbolic/thumbnails/equus_caballus.jpg -------------------------------------------------------------------------------- /examples/hyperbolic/thumbnails/equus_grevyi.jpg: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/philzook58/js_of_ocaml/master/examples/hyperbolic/thumbnails/equus_grevyi.jpg -------------------------------------------------------------------------------- /examples/hyperbolic/thumbnails/hippopotamus.jpg: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/philzook58/js_of_ocaml/master/examples/hyperbolic/thumbnails/hippopotamus.jpg -------------------------------------------------------------------------------- /examples/hyperbolic/thumbnails/mesocricetus.jpg: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/philzook58/js_of_ocaml/master/examples/hyperbolic/thumbnails/mesocricetus.jpg -------------------------------------------------------------------------------- /examples/hyperbolic/thumbnails/myrmecophaga.jpg: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/philzook58/js_of_ocaml/master/examples/hyperbolic/thumbnails/myrmecophaga.jpg -------------------------------------------------------------------------------- /examples/hyperbolic/thumbnails/ornithorynque.jpg: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/philzook58/js_of_ocaml/master/examples/hyperbolic/thumbnails/ornithorynque.jpg -------------------------------------------------------------------------------- /examples/hyperbolic/thumbnails/phacochoerus.jpg: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/philzook58/js_of_ocaml/master/examples/hyperbolic/thumbnails/phacochoerus.jpg -------------------------------------------------------------------------------- /examples/hyperbolic/thumbnails/platacanthomys.jpg: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/philzook58/js_of_ocaml/master/examples/hyperbolic/thumbnails/platacanthomys.jpg -------------------------------------------------------------------------------- /lib/lwt/dune: -------------------------------------------------------------------------------- 1 | (library 2 | (name js_of_ocaml_lwt) 3 | (public_name js_of_ocaml-lwt) 4 | (libraries js_of_ocaml lwt) 5 | (preprocess 6 | (pps js_of_ocaml-ppx))) 7 | -------------------------------------------------------------------------------- /toplevel/test/test_toplevel.reference: -------------------------------------------------------------------------------- 1 | 2 | let () = print_endline "hello";; 3 | hello 4 | 1+;; 5 | : Line 3, characters 2-4: 6 | : Error: Syntax error 7 | -------------------------------------------------------------------------------- /benchmarks/sources/js/fib.js: -------------------------------------------------------------------------------- 1 | function fib(n) { 2 | return (n < 2)?1:(fib(n-1) + fib(n-2)); 3 | } 4 | 5 | var n = 40; 6 | 7 | if (fib(n) !== 165580141) throw "error!"; 8 | -------------------------------------------------------------------------------- /compiler/tests-num/main.ml: -------------------------------------------------------------------------------- 1 | include Test_nats 2 | include Test_big_ints 3 | include Test_ratios 4 | include Test_nums 5 | include Test_io 6 | 7 | let () = Test.end_tests () 8 | -------------------------------------------------------------------------------- /compiler/tests-ocaml/lib-bigarray/change_layout.reference: -------------------------------------------------------------------------------- 1 | Generic rank test: Ok 2 | Scalar test: Ok 3 | Rank-1 array test: Ok 4 | Rank-2 array test: Ok 5 | Rank-3 array test: Ok 6 | -------------------------------------------------------------------------------- /ocamlbuild/dune: -------------------------------------------------------------------------------- 1 | (library 2 | (name ocamlbuild_js_of_ocaml) 3 | (public_name js_of_ocaml-ocamlbuild) 4 | (synopsis "Js_of_ocaml ocamlbuild plugin") 5 | (libraries ocamlbuild str)) 6 | -------------------------------------------------------------------------------- /ppx/ppx_js/lib_internal/dune: -------------------------------------------------------------------------------- 1 | (library 2 | (name ppx_js_internal) 3 | (libraries compiler-libs.common ppxlib) 4 | (kind ppx_rewriter) 5 | (preprocess 6 | (pps ppxlib.metaquot))) 7 | -------------------------------------------------------------------------------- /lib/tests/dune: -------------------------------------------------------------------------------- 1 | (library 2 | (name jsoo_lib_expect_tests) 3 | (libraries js_of_ocaml unix) 4 | (inline_tests 5 | (modes js)) 6 | (preprocess 7 | (pps ppx_js_internal ppx_expect))) 8 | -------------------------------------------------------------------------------- /.github/ISSUE_TEMPLATE/other.md: -------------------------------------------------------------------------------- 1 | --- 2 | name: Other 3 | about: Anything that is neither a bug report nor a feature request 4 | title: '' 5 | labels: '' 6 | assignees: '' 7 | 8 | --- 9 | 10 | 11 | -------------------------------------------------------------------------------- /compiler/tests-ocaml/lib-format/print_if_newline.reference: -------------------------------------------------------------------------------- 1 | 2 | test print_if_newline 3 | newline here 4 | this gets printed 5 | print_if_newline doesn't crash when last statement 6 | newline here 7 | -------------------------------------------------------------------------------- /ppx/ppx_js/bin/dune: -------------------------------------------------------------------------------- 1 | (executables 2 | (names main) 3 | (libraries ppx_js ppxlib)) 4 | 5 | (install 6 | (section lib) 7 | (package js_of_ocaml-ppx) 8 | (files 9 | (main.exe as ppx_js))) 10 | -------------------------------------------------------------------------------- /compiler/ppx/properties.ml: -------------------------------------------------------------------------------- 1 | let table : (string, string) Hashtbl.t = Hashtbl.create 17 2 | 3 | let set k v = Hashtbl.add table k v 4 | 5 | let get k = try Some (Hashtbl.find table k) with Not_found -> None 6 | -------------------------------------------------------------------------------- /benchmarks/report-time-optim.config: -------------------------------------------------------------------------------- 1 | histogramref times node js_of_ocaml #fbaf4f default 2 | histogram times node unsafe/js_of_ocaml #d98e2d unsafe 3 | histogram times node nooptcall #a75f0c No call optimisation 4 | -------------------------------------------------------------------------------- /examples/boulderdash/maps/level3.map: -------------------------------------------------------------------------------- 1 | ############## 2 | #XXXX# # 3 | #XXX+# + # 4 | #X..S# X## # 5 | #+ +X+# # 6 | # #X#X# # 7 | # +E.... # 8 | # #++ # 9 | ############## 10 | -------------------------------------------------------------------------------- /compiler/tests-dynlink/main.ml: -------------------------------------------------------------------------------- 1 | let () = print_endline "hello" 2 | 3 | let () = Js_of_ocaml_toplevel.JsooTop.initialize () 4 | 5 | let () = 6 | Sys.interactive := false; 7 | Dynlink.loadfile "/static/plugin.cmo" 8 | -------------------------------------------------------------------------------- /examples/boulderdash/maps/level1.map: -------------------------------------------------------------------------------- 1 | ################## 2 | #S X # # 3 | # + #.X..XX....# 4 | # X #.+..++....# 5 | # + # + # 6 | # # XX # 7 | # . +. E# 8 | ################## 9 | -------------------------------------------------------------------------------- /ppx/ppx_js/lib/dune: -------------------------------------------------------------------------------- 1 | (library 2 | (name ppx_js_rewriter) 3 | (public_name js_of_ocaml-ppx) 4 | (synopsis "Js_of_ocaml ppx") 5 | (libraries ppx_js) 6 | (ppx_runtime_libraries js_of_ocaml) 7 | (kind ppx_rewriter)) 8 | -------------------------------------------------------------------------------- /benchmarks/report-time.config: -------------------------------------------------------------------------------- 1 | histogram times "" opt #729fcf ocamlopt 2 | histogram times "" byte #204a87 ocamlc 3 | histogramref times node js_of_ocaml #fbaf4f node 4 | histogram times sm js_of_ocaml #fb4f4f SpiderMonkey 5 | -------------------------------------------------------------------------------- /compiler/lib-runtime/tests/dune: -------------------------------------------------------------------------------- 1 | (library 2 | (name jsoo_lib_runtime_test) 3 | (libraries jsoo_runtime) 4 | (inline_tests 5 | (flags -allow-output-patterns) 6 | (modes native)) 7 | (preprocess 8 | (pps ppx_expect))) 9 | -------------------------------------------------------------------------------- /compiler/tests-re/dune: -------------------------------------------------------------------------------- 1 | (executables 2 | (names test_str) 3 | (libraries str re) 4 | (modes js)) 5 | 6 | (rule 7 | (alias runtest) 8 | (deps test_str.bc.js) 9 | (action 10 | (run node ./test_str.bc.js))) 11 | -------------------------------------------------------------------------------- /lib/deriving_json/tests/dune: -------------------------------------------------------------------------------- 1 | (library 2 | (name deriving_expect_tests) 3 | (libraries unix js_of_ocaml js_of_ocaml.deriving) 4 | (inline_tests 5 | (modes js)) 6 | (preprocess 7 | (pps ppx_expect ppx_deriving_json))) 8 | -------------------------------------------------------------------------------- /tools/sourcemap/dune: -------------------------------------------------------------------------------- 1 | (executables 2 | (names jsoo_sourcemap) 3 | (libraries 4 | js_of_ocaml-compiler 5 | compiler-libs.common 6 | js_of_ocaml-compiler.findlib-support) 7 | (flags 8 | (:standard -safe-string))) 9 | -------------------------------------------------------------------------------- /compiler/lib-findlib-support/dune: -------------------------------------------------------------------------------- 1 | (library 2 | (name jsoo_findlib_support) 3 | (libraries js_of_ocaml-compiler findlib) 4 | (optional) 5 | (public_name js_of_ocaml-compiler.findlib-support) 6 | (library_flags (-linkall))) 7 | -------------------------------------------------------------------------------- /compiler/tests-ocaml/prim-bigstring/bigstring_access.reference: -------------------------------------------------------------------------------- 1 | 1234 12 0 2 | fedc fe 0 3 | 12345678 123456 1234 4 | fedcba09 fedcba fedc 5 | 1234567890abcdef 1234567890abcd 1234567890ab 6 | fedcba0987654321 fedcba09876543 fedcba098765 7 | -------------------------------------------------------------------------------- /compiler/tests-ocaml/prim-bigstring/string_access.reference: -------------------------------------------------------------------------------- 1 | 1234 12 0 2 | fedc fe 0 3 | 12345678 123456 1234 4 | fedcba09 fedcba fedc 5 | 1234567890abcdef 1234567890abcd 1234567890ab 6 | fedcba0987654321 fedcba09876543 fedcba098765 7 | -------------------------------------------------------------------------------- /examples/boulderdash/maps/level2.map: -------------------------------------------------------------------------------- 1 | #################### 2 | #S# XXXXX # 3 | # # XX .XXX. # 4 | # # .XX. .X. # 5 | # # +. + # 6 | # ## XX # 7 | # +X. E# 8 | #################### 9 | -------------------------------------------------------------------------------- /lib/deriving_json/dune: -------------------------------------------------------------------------------- 1 | (library 2 | (name js_of_ocaml_deriving) 3 | (public_name js_of_ocaml.deriving) 4 | (synopsis "Runtime library for the class Json.") 5 | (libraries bytes) 6 | (wrapped false)) 7 | 8 | (ocamllex deriving_Json_lexer) 9 | -------------------------------------------------------------------------------- /benchmarks/sources/js/loop.js: -------------------------------------------------------------------------------- 1 | for (var i = 1; i <= 1000000000; i++) {}; 2 | //for (var i = 1;;) {i=i+1|0; if (i <= 1000000000) continue; break;}; 3 | //for (var i = 1; i <= 1000000000; i=i+1|0) {}; 4 | //for (var i = 1; i <= 1000000000; i=i+1) {}; 5 | -------------------------------------------------------------------------------- /compiler/tests-ocaml/lib-bigarray/fftba.reference: -------------------------------------------------------------------------------- 1 | 16... ok 2 | 32... ok 3 | 64... ok 4 | 128... ok 5 | 256... ok 6 | 512... ok 7 | 1024... ok 8 | 2048... ok 9 | 4096... ok 10 | 8192... ok 11 | 16384... ok 12 | 32768... ok 13 | 65536... ok 14 | -------------------------------------------------------------------------------- /lib/lwt/log/dune: -------------------------------------------------------------------------------- 1 | (library 2 | (name lwt_log_js) 3 | (public_name js_of_ocaml-lwt.logger) 4 | (synopsis "Lwt logger for js_of_ocaml.") 5 | (optional) 6 | (libraries js_of_ocaml lwt lwt_log.core) 7 | (preprocess 8 | (pps js_of_ocaml-ppx))) 9 | -------------------------------------------------------------------------------- /lib/tyxml/dune: -------------------------------------------------------------------------------- 1 | (library 2 | (name js_of_ocaml_tyxml) 3 | (public_name js_of_ocaml-tyxml) 4 | (synopsis "Tyxml for js_of_ocaml.") 5 | (libraries js_of_ocaml tyxml tyxml.functor react reactiveData) 6 | (preprocess 7 | (pps js_of_ocaml-ppx))) 8 | -------------------------------------------------------------------------------- /examples/boulderdash/maps.txt: -------------------------------------------------------------------------------- 1 | "maps/level0.map" "Level without boulders" 2 | "maps/level1.map" "Simple falls" 3 | "maps/level2.map" "More falls" 4 | "maps/level3.map" "Real (yet little) puzzle" 5 | "maps/level4.map" "Bigger puzzle (copie de BeeDeeDash)" 6 | -------------------------------------------------------------------------------- /benchmarks/run.config: -------------------------------------------------------------------------------- 1 | #Node: apt-get install nodejs 2 | interpreter node /usr/bin/node 3 | # 4 | #SpiderMonkey: apt-get install libmozjs-52-dev 5 | interpreter sm /usr/bin/js52 -f 6 | # 7 | #interpreter v8 8 | #interpreter nitro 9 | #interpreter tracemonkey 10 | -------------------------------------------------------------------------------- /benchmarks/report-size.config: -------------------------------------------------------------------------------- 1 | histogram sizes "" ml #83afdf Source 2 | histogram sizes "" byte #204a87 Bytecode 3 | histogramref sizes "" js_of_ocaml/full #371f00 Runtime 4 | 5 | histogram blank 6 | histogram blank 7 | histogram sizes "" js_of_ocaml/generated #fbaf4f Generated code 8 | -------------------------------------------------------------------------------- /compiler/tests-compiler/dune: -------------------------------------------------------------------------------- 1 | (include dune.inc) 2 | 3 | (rule 4 | (deps 5 | (glob_files *.ml)) 6 | (action 7 | (with-stdout-to 8 | dune.inc.gen 9 | (run gen-rules/gen.exe)))) 10 | 11 | (rule 12 | (alias runtest) 13 | (action 14 | (diff dune.inc dune.inc.gen))) 15 | -------------------------------------------------------------------------------- /compiler/tests-jsoo/dune: -------------------------------------------------------------------------------- 1 | (library 2 | (name jsoo_testsuite) 3 | (libraries unix) 4 | (foreign_stubs 5 | (language c) 6 | (names bigarray_stubs)) 7 | (inline_tests 8 | (flags -allow-output-patterns) 9 | (modes js native)) 10 | (preprocess 11 | (pps ppx_expect))) 12 | -------------------------------------------------------------------------------- /dune: -------------------------------------------------------------------------------- 1 | (env 2 | (dev 3 | (flags 4 | (:standard -w +a-4-40-41-42-44-48-58-66-70)))) 5 | 6 | (rule 7 | (targets version.ml.in) 8 | (action 9 | (with-stdout-to 10 | %{targets} 11 | (run 12 | %{dep:tools/version/gen/gen.exe} 13 | %{dep:VERSION} 14 | %{dep:tools/version/GIT-VERSION})))) 15 | -------------------------------------------------------------------------------- /examples/README.md: -------------------------------------------------------------------------------- 1 | # Example projects 2 | 3 | Build all projects: 4 | ``` 5 | $> dune build @examples/default 6 | ``` 7 | 8 | Or a single one: 9 | ``` 10 | $> dune build @examples//default 11 | ``` 12 | 13 | Compilation artifacts can be found in `${REPO_ROOT}/_build/default/examples/`. 14 | -------------------------------------------------------------------------------- /toplevel/bin/dune: -------------------------------------------------------------------------------- 1 | (executables 2 | (names jsoo_mkcmis jsoo_mktop jsoo_listunits) 3 | (public_names jsoo_mkcmis jsoo_mktop jsoo_listunits) 4 | (package js_of_ocaml-toplevel) 5 | (libraries 6 | bytes 7 | js_of_ocaml-compiler 8 | js_of_ocaml-compiler.findlib-support 9 | js_of_ocaml-compiler.runtime)) 10 | -------------------------------------------------------------------------------- /compiler/tests-ocaml/lib-format/pr6824.ml: -------------------------------------------------------------------------------- 1 | (* TEST 2 | include testing 3 | *) 4 | 5 | let f = Format.sprintf "[%i]";; 6 | print_endline (f 1);; 7 | print_endline (f 2);; 8 | 9 | let f = Format.asprintf "[%i]";; 10 | print_endline (f 1);; 11 | print_endline (f 2);; 12 | 13 | include Testing 14 | let () = exit 0 15 | -------------------------------------------------------------------------------- /js_of_ocaml.opam.template: -------------------------------------------------------------------------------- 1 | build: [ 2 | ["dune" "subst"] {dev} 3 | [ 4 | "dune" 5 | "build" 6 | "-p" 7 | name 8 | "-j" 9 | jobs 10 | "--promote-install-files=false" 11 | "@install" 12 | "@doc" {with-doc} 13 | ] 14 | ["dune" "install" "-p" name "--create-install-files" name] 15 | ] 16 | -------------------------------------------------------------------------------- /ppx/ppx_deriving_json/lib/dune: -------------------------------------------------------------------------------- 1 | (library 2 | (name ppx_deriving_json) 3 | (public_name js_of_ocaml-ppx_deriving_json) 4 | (synopsis "[@@deriving json]") 5 | (libraries compiler-libs.common ppxlib) 6 | (ppx_runtime_libraries js_of_ocaml.deriving) 7 | (kind ppx_deriver) 8 | (preprocess 9 | (pps ppxlib.metaquot))) 10 | -------------------------------------------------------------------------------- /js_of_ocaml-lwt.opam.template: -------------------------------------------------------------------------------- 1 | build: [ 2 | ["dune" "subst"] {dev} 3 | [ 4 | "dune" 5 | "build" 6 | "-p" 7 | name 8 | "-j" 9 | jobs 10 | "--promote-install-files=false" 11 | "@install" 12 | "@doc" {with-doc} 13 | ] 14 | ["dune" "install" "-p" name "--create-install-files" name] 15 | ] 16 | -------------------------------------------------------------------------------- /js_of_ocaml-ppx.opam.template: -------------------------------------------------------------------------------- 1 | build: [ 2 | ["dune" "subst"] {dev} 3 | [ 4 | "dune" 5 | "build" 6 | "-p" 7 | name 8 | "-j" 9 | jobs 10 | "--promote-install-files=false" 11 | "@install" 12 | "@doc" {with-doc} 13 | ] 14 | ["dune" "install" "-p" name "--create-install-files" name] 15 | ] 16 | -------------------------------------------------------------------------------- /compiler/lib-runtime/dune: -------------------------------------------------------------------------------- 1 | (library 2 | (name jsoo_runtime) 3 | (libraries js_of_ocaml-compiler) 4 | (public_name js_of_ocaml-compiler.runtime)) 5 | 6 | (rule 7 | (target files.ml) 8 | (deps 9 | gen/gen.exe 10 | (glob_files ../../runtime/*.js)) 11 | (action 12 | (with-stdout-to 13 | %{target} 14 | (run %{deps})))) 15 | -------------------------------------------------------------------------------- /js_of_ocaml-compiler.opam.template: -------------------------------------------------------------------------------- 1 | build: [ 2 | ["dune" "subst"] {dev} 3 | [ 4 | "dune" 5 | "build" 6 | "-p" 7 | name 8 | "-j" 9 | jobs 10 | "--promote-install-files=false" 11 | "@install" 12 | "@doc" {with-doc} 13 | ] 14 | ["dune" "install" "-p" name "--create-install-files" name] 15 | ] 16 | -------------------------------------------------------------------------------- /js_of_ocaml-toplevel.opam.template: -------------------------------------------------------------------------------- 1 | build: [ 2 | ["dune" "subst"] {dev} 3 | [ 4 | "dune" 5 | "build" 6 | "-p" 7 | name 8 | "-j" 9 | jobs 10 | "--promote-install-files=false" 11 | "@install" 12 | "@doc" {with-doc} 13 | ] 14 | ["dune" "install" "-p" name "--create-install-files" name] 15 | ] 16 | -------------------------------------------------------------------------------- /js_of_ocaml-tyxml.opam.template: -------------------------------------------------------------------------------- 1 | build: [ 2 | ["dune" "subst"] {dev} 3 | [ 4 | "dune" 5 | "build" 6 | "-p" 7 | name 8 | "-j" 9 | jobs 10 | "--promote-install-files=false" 11 | "@install" 12 | "@doc" {with-doc} 13 | ] 14 | ["dune" "install" "-p" name "--create-install-files" name] 15 | ] 16 | -------------------------------------------------------------------------------- /compiler/tests-jsoo/bin/error3.ml: -------------------------------------------------------------------------------- 1 | let () = 2 | match Array.to_list Sys.argv with 3 | | _ :: "unregister" :: _ -> 4 | let null = Array.unsafe_get [| 1 |] 1 in 5 | Callback.register "Printexc.handle_uncaught_exception" null 6 | | _ -> () 7 | 8 | let null : _ -> _ -> _ = Array.unsafe_get [||] 0 9 | 10 | let _ = null 1 2 11 | -------------------------------------------------------------------------------- /js_of_ocaml-ocamlbuild.opam.template: -------------------------------------------------------------------------------- 1 | build: [ 2 | ["dune" "subst"] {dev} 3 | [ 4 | "dune" 5 | "build" 6 | "-p" 7 | name 8 | "-j" 9 | jobs 10 | "--promote-install-files=false" 11 | "@install" 12 | "@doc" {with-doc} 13 | ] 14 | ["dune" "install" "-p" name "--create-install-files" name] 15 | ] 16 | -------------------------------------------------------------------------------- /compiler/tests-jsoo/bin/error2.ml: -------------------------------------------------------------------------------- 1 | let () = 2 | match Array.to_list Sys.argv with 3 | | _ :: "unregister" :: _ -> 4 | let null = Array.unsafe_get [| 1 |] 1 in 5 | Callback.register "Printexc.handle_uncaught_exception" null 6 | | _ -> () 7 | 8 | [@@@ocaml.warning "-8"] 9 | 10 | let _ = 11 | match 3 with 12 | | 2 -> () 13 | -------------------------------------------------------------------------------- /js_of_ocaml-ppx_deriving_json.opam.template: -------------------------------------------------------------------------------- 1 | build: [ 2 | ["dune" "subst"] {dev} 3 | [ 4 | "dune" 5 | "build" 6 | "-p" 7 | name 8 | "-j" 9 | jobs 10 | "--promote-install-files=false" 11 | "@install" 12 | "@doc" {with-doc} 13 | ] 14 | ["dune" "install" "-p" name "--create-install-files" name] 15 | ] 16 | -------------------------------------------------------------------------------- /compiler/tests-ocaml/lib-bigarray/pr5115.ml: -------------------------------------------------------------------------------- 1 | (* TEST 2 | *) 3 | 4 | (* PR#5115 - multiple evaluation of bigarray expr *) 5 | 6 | open Bigarray 7 | 8 | let f y0 = 9 | Printf.printf "***EXEC***\n%!"; 10 | y0 11 | 12 | let _ = 13 | let y = Array1.of_array float64 fortran_layout [| 1. |] in 14 | ignore ((f y).{1}); 15 | (f y).{1} <- 3.14 16 | -------------------------------------------------------------------------------- /toplevel/lib/dune: -------------------------------------------------------------------------------- 1 | (library 2 | (name js_of_ocaml_toplevel) 3 | (public_name js_of_ocaml-toplevel) 4 | (synopsis "Js_of_ocaml toplevel library") 5 | (libraries 6 | js_of_ocaml-compiler 7 | js_of_ocaml 8 | bytes 9 | compiler-libs.bytecomp 10 | compiler-libs.toplevel) 11 | (preprocess 12 | (pps ppx_optcomp_light js_of_ocaml-ppx))) 13 | -------------------------------------------------------------------------------- /ppx/ppx_js/as-lib/dune: -------------------------------------------------------------------------------- 1 | (library 2 | (name ppx_js) 3 | (public_name js_of_ocaml-ppx.as-lib) 4 | (synopsis "Js_of_ocaml ppx") 5 | (libraries compiler-libs.common ppxlib) 6 | (preprocess 7 | (pps ppxlib.metaquot))) 8 | 9 | (rule 10 | (targets ppx_js_internal.ml) 11 | (action 12 | (copy %{dep:../lib_internal/ppx_js_internal.ml} %{targets}))) 13 | -------------------------------------------------------------------------------- /examples/wysiwyg/dune: -------------------------------------------------------------------------------- 1 | (executables 2 | (names main) 3 | (libraries js_of_ocaml-lwt) 4 | (modes byte) 5 | (preprocess 6 | (pps js_of_ocaml-ppx))) 7 | 8 | (rule 9 | (targets main.js) 10 | (action 11 | (run %{bin:js_of_ocaml} --source-map %{dep:main.bc} -o %{targets} --pretty))) 12 | 13 | (alias 14 | (name default) 15 | (deps main.js index.html)) 16 | -------------------------------------------------------------------------------- /compiler/tests-ocaml/lib-floatarray/dune: -------------------------------------------------------------------------------- 1 | (executables 2 | (names floatarray) 3 | (libraries) 4 | (modes js)) 5 | 6 | (rule 7 | (target floatarray.referencejs) 8 | (deps floatarray.bc.js) 9 | (action 10 | (with-stdout-to 11 | %{target} 12 | (run node ./floatarray.bc.js)))) 13 | 14 | (alias 15 | (name runtest) 16 | (deps floatarray.referencejs)) 17 | -------------------------------------------------------------------------------- /tools/format-js.sh: -------------------------------------------------------------------------------- 1 | #!/bin/bash 2 | 3 | echo "# Removing tabs" 4 | find ./ -regex "^\.\(/[a-zA-Z0-9_-.]*\)*\.js" -exec sed -i 's/ //g' {} \; 5 | 6 | echo "# Indent files" 7 | SCRIPT=$(readlink -f $0) 8 | SCRIPTPATH=`dirname $SCRIPT` 9 | find ./ -regex "^\.\(/[a-zA-Z0-9_-.]*\)*\.js" -exec emacs -batch {} -l ${SCRIPTPATH}/emacs-format-js.el -f emacs-format-js \; 10 | -------------------------------------------------------------------------------- /compiler/tests-check-prim/dune: -------------------------------------------------------------------------------- 1 | (executables 2 | (names main) 3 | (libraries js_of_ocaml num) 4 | (link_flags 5 | (:standard -linkall)) 6 | (modes byte)) 7 | 8 | (rule 9 | (targets output) 10 | (deps main.bc) 11 | (mode 12 | (promote (until-clean))) 13 | (action 14 | (with-stdout-to 15 | %{targets} 16 | (run %{bin:js_of_ocaml} check-runtime main.bc)))) 17 | -------------------------------------------------------------------------------- /.ocamlformat: -------------------------------------------------------------------------------- 1 | break-cases=fit-or-vertical 2 | break-fun-decl=fit-or-vertical 3 | break-infix=fit-or-vertical 4 | if-then-else=keyword-first 5 | parens-tuple=multi-line-only 6 | type-decl=sparse 7 | wrap-fun-args=false 8 | break-infix-before-func 9 | break-separators=before 10 | dock-collection-brackets=false 11 | margin=90 12 | module-item-spacing=sparse 13 | version=0.20.0 14 | -------------------------------------------------------------------------------- /benchmarks/report-size-optim.config: -------------------------------------------------------------------------------- 1 | #histogram sizes "" unsafe/js_of_ocaml #fb9f3f Unsafe 2 | histogramref sizes "" js_of_ocaml/generated #fbaf4f Default 3 | #histogram sizes "" nooptcall #a75f0c no optimization of calls 4 | histogram sizes "" noinline #d98e2d no inlining 5 | histogram sizes "" notcompact #a75f0c no compact code 6 | histogram sizes "" nodeadcode #752d09 no dead code removal 7 | -------------------------------------------------------------------------------- /toplevel/examples/lwt_toplevel/colorize.mli: -------------------------------------------------------------------------------- 1 | open Js_of_ocaml 2 | open Js_of_ocaml_tyxml 3 | 4 | val text : a_class:string -> string -> [> Html_types.div_content ] Tyxml_js.Html.elt 5 | 6 | val ocaml : a_class:string -> string -> [> Html_types.div_content ] Tyxml_js.Html.elt 7 | 8 | val highlight : 9 | [ `Pos of int ] -> [ `Last | `Pos of int ] -> Dom_html.element Js.t -> unit 10 | -------------------------------------------------------------------------------- /examples/cubes/index.html: -------------------------------------------------------------------------------- 1 | 2 | 4 | 5 | 6 | Cubes 7 | 8 | 9 | 10 | 11 | 12 | -------------------------------------------------------------------------------- /examples/hyperbolic/messages.json: -------------------------------------------------------------------------------- 1 | { 2 | "fr": 3 | {"info": "Informations", 4 | "recenter": "Recentrer", 5 | "close": "Cliquez n'importe où pour retourner à l'arbre", 6 | "wikimediaCommons": "Voir la description de l'image sur Wikimedia Commons", 7 | "language": "En français", 8 | "noRef": "Aucune référence disponible.", 9 | "languages": "Langues", 10 | "ok": "OK" 11 | } 12 | } 13 | -------------------------------------------------------------------------------- /examples/wiki/dune: -------------------------------------------------------------------------------- 1 | (executables 2 | (names main) 3 | (libraries js_of_ocaml-lwt) 4 | (modes byte) 5 | (preprocess 6 | (pps js_of_ocaml-ppx))) 7 | 8 | (ocamllex wikicreole) 9 | 10 | (rule 11 | (targets main.js) 12 | (action 13 | (run %{bin:js_of_ocaml} --source-map %{dep:main.bc} -o %{targets} --pretty))) 14 | 15 | (alias 16 | (name default) 17 | (deps main.js index.html)) 18 | -------------------------------------------------------------------------------- /ppx/ppx_js/tests/dune: -------------------------------------------------------------------------------- 1 | (executables 2 | (names main) 3 | (libraries toplevel_expect_test js_of_ocaml-ppx stdlib) 4 | (modes byte) 5 | (link_flags (-linkall))) 6 | 7 | (rule 8 | (targets ppx.mlt.corrected) 9 | (action 10 | (run %{exe:main.bc} %{dep:ppx.mlt}))) 11 | 12 | (rule 13 | (alias runtest) 14 | (package js_of_ocaml-ppx) 15 | (action 16 | (diff ppx.mlt ppx.mlt.corrected))) 17 | -------------------------------------------------------------------------------- /compiler/tests-ocaml/lib-digest/dune: -------------------------------------------------------------------------------- 1 | (executables 2 | (names md5) 3 | (libraries) 4 | (modes js)) 5 | 6 | (rule 7 | (target md5.referencejs) 8 | (deps md5.bc.js) 9 | (action 10 | (with-stdout-to 11 | %{target} 12 | (run node ./md5.bc.js)))) 13 | 14 | (rule 15 | (alias runtest) 16 | (deps md5.reference md5.referencejs) 17 | (action 18 | (diff md5.reference md5.referencejs))) 19 | -------------------------------------------------------------------------------- /compiler/tests-ocaml/lib-str/dune: -------------------------------------------------------------------------------- 1 | (executables 2 | (names t01) 3 | (libraries str) 4 | (modes js)) 5 | 6 | (rule 7 | (target t01.referencejs) 8 | (deps t01.bc.js) 9 | (action 10 | (with-stdout-to 11 | %{target} 12 | (run node ./t01.bc.js)))) 13 | 14 | (rule 15 | (alias runtest) 16 | (deps t01.reference t01.referencejs) 17 | (action 18 | (diff t01.reference t01.referencejs))) 19 | -------------------------------------------------------------------------------- /compiler/tests-ocaml/lib-bool/dune: -------------------------------------------------------------------------------- 1 | (executables 2 | (names test) 3 | (libraries) 4 | (modes js)) 5 | 6 | (rule 7 | (target test.referencejs) 8 | (deps test.bc.js) 9 | (action 10 | (with-stdout-to 11 | %{target} 12 | (run node ./test.bc.js)))) 13 | 14 | (rule 15 | (alias runtest) 16 | (deps test.reference test.referencejs) 17 | (action 18 | (diff test.reference test.referencejs))) 19 | -------------------------------------------------------------------------------- /compiler/tests-ocaml/lib-float/dune: -------------------------------------------------------------------------------- 1 | (executables 2 | (names test) 3 | (libraries) 4 | (modes js)) 5 | 6 | (rule 7 | (target test.referencejs) 8 | (deps test.bc.js) 9 | (action 10 | (with-stdout-to 11 | %{target} 12 | (run node ./test.bc.js)))) 13 | 14 | (rule 15 | (alias runtest) 16 | (deps test.reference test.referencejs) 17 | (action 18 | (diff test.reference test.referencejs))) 19 | -------------------------------------------------------------------------------- /compiler/tests-ocaml/lib-fun/dune: -------------------------------------------------------------------------------- 1 | (executables 2 | (names test) 3 | (libraries) 4 | (modes js)) 5 | 6 | (rule 7 | (target test.referencejs) 8 | (deps test.bc.js) 9 | (action 10 | (with-stdout-to 11 | %{target} 12 | (run node ./test.bc.js)))) 13 | 14 | (rule 15 | (alias runtest) 16 | (deps test.reference test.referencejs) 17 | (action 18 | (diff test.reference test.referencejs))) 19 | -------------------------------------------------------------------------------- /compiler/tests-ocaml/lib-int/dune: -------------------------------------------------------------------------------- 1 | (executables 2 | (names test) 3 | (libraries) 4 | (modes js)) 5 | 6 | (rule 7 | (target test.referencejs) 8 | (deps test.bc.js) 9 | (action 10 | (with-stdout-to 11 | %{target} 12 | (run node ./test.bc.js)))) 13 | 14 | (rule 15 | (alias runtest) 16 | (deps test.reference test.referencejs) 17 | (action 18 | (diff test.reference test.referencejs))) 19 | -------------------------------------------------------------------------------- /compiler/tests-ocaml/lib-int64/dune: -------------------------------------------------------------------------------- 1 | (executables 2 | (names test) 3 | (libraries) 4 | (modes js)) 5 | 6 | (rule 7 | (target test.referencejs) 8 | (deps test.bc.js) 9 | (action 10 | (with-stdout-to 11 | %{target} 12 | (run node ./test.bc.js)))) 13 | 14 | (rule 15 | (alias runtest) 16 | (deps test.reference test.referencejs) 17 | (action 18 | (diff test.reference test.referencejs))) 19 | -------------------------------------------------------------------------------- /compiler/tests-ocaml/lib-list/dune: -------------------------------------------------------------------------------- 1 | (executables 2 | (names test) 3 | (libraries) 4 | (modes js)) 5 | 6 | (rule 7 | (target test.referencejs) 8 | (deps test.bc.js) 9 | (action 10 | (with-stdout-to 11 | %{target} 12 | (run node ./test.bc.js)))) 13 | 14 | (rule 15 | (alias runtest) 16 | (deps test.reference test.referencejs) 17 | (action 18 | (diff test.reference test.referencejs))) 19 | -------------------------------------------------------------------------------- /compiler/tests-ocaml/lib-queue/dune: -------------------------------------------------------------------------------- 1 | (executables 2 | (names test) 3 | (libraries) 4 | (modes js)) 5 | 6 | (rule 7 | (target test.referencejs) 8 | (deps test.bc.js) 9 | (action 10 | (with-stdout-to 11 | %{target} 12 | (run node ./test.bc.js)))) 13 | 14 | (rule 15 | (alias runtest) 16 | (deps test.reference test.referencejs) 17 | (action 18 | (diff test.reference test.referencejs))) 19 | -------------------------------------------------------------------------------- /compiler/tests-ocaml/lib-seq/dune: -------------------------------------------------------------------------------- 1 | (executables 2 | (names test) 3 | (libraries) 4 | (modes js)) 5 | 6 | (rule 7 | (target test.referencejs) 8 | (deps test.bc.js) 9 | (action 10 | (with-stdout-to 11 | %{target} 12 | (run node ./test.bc.js)))) 13 | 14 | (rule 15 | (alias runtest) 16 | (deps test.reference test.referencejs) 17 | (action 18 | (diff test.reference test.referencejs))) 19 | -------------------------------------------------------------------------------- /compiler/tests-ocaml/lib-stack/dune: -------------------------------------------------------------------------------- 1 | (executables 2 | (names test) 3 | (libraries) 4 | (modes js)) 5 | 6 | (rule 7 | (target test.referencejs) 8 | (deps test.bc.js) 9 | (action 10 | (with-stdout-to 11 | %{target} 12 | (run node ./test.bc.js)))) 13 | 14 | (rule 15 | (alias runtest) 16 | (deps test.reference test.referencejs) 17 | (action 18 | (diff test.reference test.referencejs))) 19 | -------------------------------------------------------------------------------- /compiler/tests-ocaml/lib-uchar/dune: -------------------------------------------------------------------------------- 1 | (executables 2 | (names test) 3 | (libraries) 4 | (modes js)) 5 | 6 | (rule 7 | (target test.referencejs) 8 | (deps test.bc.js) 9 | (action 10 | (with-stdout-to 11 | %{target} 12 | (run node ./test.bc.js)))) 13 | 14 | (rule 15 | (alias runtest) 16 | (deps test.reference test.referencejs) 17 | (action 18 | (diff test.reference test.referencejs))) 19 | -------------------------------------------------------------------------------- /compiler/tests-ocaml/lib-buffer/dune: -------------------------------------------------------------------------------- 1 | (executables 2 | (names test) 3 | (libraries) 4 | (modes js)) 5 | 6 | (rule 7 | (target test.referencejs) 8 | (deps test.bc.js) 9 | (action 10 | (with-stdout-to 11 | %{target} 12 | (run node ./test.bc.js)))) 13 | 14 | (rule 15 | (alias runtest) 16 | (deps test.reference test.referencejs) 17 | (action 18 | (diff test.reference test.referencejs))) 19 | -------------------------------------------------------------------------------- /compiler/tests-ocaml/lib-option/dune: -------------------------------------------------------------------------------- 1 | (executables 2 | (names test) 3 | (libraries) 4 | (modes js)) 5 | 6 | (rule 7 | (target test.referencejs) 8 | (deps test.bc.js) 9 | (action 10 | (with-stdout-to 11 | %{target} 12 | (run node ./test.bc.js)))) 13 | 14 | (rule 15 | (alias runtest) 16 | (deps test.reference test.referencejs) 17 | (action 18 | (diff test.reference test.referencejs))) 19 | -------------------------------------------------------------------------------- /compiler/tests-ocaml/lib-random/dune: -------------------------------------------------------------------------------- 1 | (executables 2 | (names rand) 3 | (libraries) 4 | (modes js)) 5 | 6 | (rule 7 | (target rand.referencejs) 8 | (deps rand.bc.js) 9 | (action 10 | (with-stdout-to 11 | %{target} 12 | (run node ./rand.bc.js)))) 13 | 14 | (rule 15 | (alias runtest) 16 | (deps rand.reference rand.referencejs) 17 | (action 18 | (diff rand.reference rand.referencejs))) 19 | -------------------------------------------------------------------------------- /compiler/tests-ocaml/lib-result/dune: -------------------------------------------------------------------------------- 1 | (executables 2 | (names test) 3 | (libraries) 4 | (modes js)) 5 | 6 | (rule 7 | (target test.referencejs) 8 | (deps test.bc.js) 9 | (action 10 | (with-stdout-to 11 | %{target} 12 | (run node ./test.bc.js)))) 13 | 14 | (rule 15 | (alias runtest) 16 | (deps test.reference test.referencejs) 17 | (action 18 | (diff test.reference test.referencejs))) 19 | -------------------------------------------------------------------------------- /examples/cubes/dune: -------------------------------------------------------------------------------- 1 | (executables 2 | (names cubes) 3 | (libraries js_of_ocaml-lwt) 4 | (modes byte) 5 | (preprocess 6 | (pps js_of_ocaml-ppx))) 7 | 8 | (rule 9 | (targets cubes.js) 10 | (action 11 | (run 12 | %{bin:js_of_ocaml} 13 | --source-map 14 | %{dep:cubes.bc} 15 | -o 16 | %{targets} 17 | --pretty))) 18 | 19 | (alias 20 | (name default) 21 | (deps cubes.js index.html)) 22 | -------------------------------------------------------------------------------- /examples/graph_viewer/index.html: -------------------------------------------------------------------------------- 1 | 2 | 4 | 5 | 6 | Graph viewer 7 | 8 | 9 | 10 | 11 | 12 | -------------------------------------------------------------------------------- /compiler/tests-ocaml/prim-bswap/dune: -------------------------------------------------------------------------------- 1 | (executables 2 | (names bswap) 3 | (libraries) 4 | (modes js)) 5 | 6 | (rule 7 | (target bswap.referencejs) 8 | (deps bswap.bc.js) 9 | (action 10 | (with-stdout-to 11 | %{target} 12 | (run node ./bswap.bc.js)))) 13 | 14 | (rule 15 | (alias runtest) 16 | (deps bswap.reference bswap.referencejs) 17 | (action 18 | (diff bswap.reference bswap.referencejs))) 19 | -------------------------------------------------------------------------------- /compiler/tests-ocaml/lib-buffer/test.reference: -------------------------------------------------------------------------------- 1 | Standard Library: Module Buffer 2 | Buffer truncate: negative passed 3 | Buffer truncate: large passed 4 | Buffer truncate: in-range passed 5 | Buffer reset: non-zero passed 6 | Buffer reset: zero passed 7 | Buffer add_utf_8_uchar: test against spec passed 8 | Buffer add_utf_16be_uchar: test against spec passed 9 | Buffer add_utf_16le_uchar: test against spec passed 10 | -------------------------------------------------------------------------------- /examples/minesweeper/dune: -------------------------------------------------------------------------------- 1 | (executables 2 | (names main) 3 | (libraries js_of_ocaml-lwt) 4 | (modes byte) 5 | (preprocess 6 | (pps js_of_ocaml-ppx))) 7 | 8 | (rule 9 | (targets main.js) 10 | (action 11 | (run %{bin:js_of_ocaml} --source-map %{dep:main.bc} -o %{targets} --pretty))) 12 | 13 | (alias 14 | (name default) 15 | (deps 16 | main.js 17 | index.html 18 | (glob_files sprites/*.{png,svg}))) 19 | -------------------------------------------------------------------------------- /examples/planet/dune: -------------------------------------------------------------------------------- 1 | (executables 2 | (names planet) 3 | (libraries js_of_ocaml-lwt) 4 | (modes byte) 5 | (preprocess 6 | (pps js_of_ocaml-ppx))) 7 | 8 | (rule 9 | (targets planet.js) 10 | (action 11 | (run 12 | %{bin:js_of_ocaml} 13 | --source-map 14 | %{dep:planet.bc} 15 | -o 16 | %{targets} 17 | --pretty))) 18 | 19 | (alias 20 | (name default) 21 | (deps planet.js index.html texture.jpg)) 22 | -------------------------------------------------------------------------------- /ppx/ppx_deriving_json/tests/main.ml: -------------------------------------------------------------------------------- 1 | let mapper _args = 2 | (*this mapper can only be used the way it is defined here, i.e. 3 | no other fields can be updated.*) 4 | let structure _ st = 5 | Ppxlib_ast.Selected_ast.of_ocaml Structure st 6 | |> Ppxlib.Driver.map_structure 7 | |> Ppxlib.Selected_ast.to_ocaml Structure 8 | in 9 | { Ast_mapper.default_mapper with structure } 10 | 11 | let () = Toplevel_expect_test.run mapper 12 | -------------------------------------------------------------------------------- /toplevel/test/test_toplevel.ml: -------------------------------------------------------------------------------- 1 | let () = Js_of_ocaml_toplevel.JsooTop.initialize () 2 | 3 | let fmt = Format.std_formatter 4 | 5 | let () = 6 | Js_of_ocaml.Sys_js.set_channel_flusher stderr (fun str -> Printf.printf ": %s" str) 7 | 8 | let () = 9 | Js_of_ocaml_toplevel.JsooTop.execute 10 | true 11 | ~pp_code:fmt 12 | ~highlight_location:(fun _ -> ()) 13 | fmt 14 | {| 15 | let () = print_endline "hello";; 16 | 1+;;|} 17 | -------------------------------------------------------------------------------- /.github/workflows/changelog.yml: -------------------------------------------------------------------------------- 1 | name: Check changelog 2 | 3 | on: 4 | pull_request: 5 | branches: 6 | - master 7 | types: 8 | - labeled 9 | - opened 10 | - reopened 11 | - synchronize 12 | - unlabeled 13 | 14 | jobs: 15 | check-changelog: 16 | name: Check changelog 17 | runs-on: ubuntu-latest 18 | steps: 19 | - name: Check changelog 20 | uses: tarides/changelog-check-action@v1 21 | -------------------------------------------------------------------------------- /benchmarks/report-compiletime.config: -------------------------------------------------------------------------------- 1 | histogram compiletimes "" opt #729fcf ocamlopt 2 | histogram compiletimes "" byte #204a87 ocamlc 3 | histogramref compiletimes "" js_of_ocaml #d98e2d js_of_ocaml 4 | histogram compiletimes "" nodeadcode #fb3f00 No deadcode elimination 5 | histogram compiletimes "" noinline #fb7f1f No inlining 6 | histogram compiletimes "" nooptcall #a75f0c No call optimisation 7 | histogram compiletimes "" notcompact #fb5f0f No compact expression 8 | -------------------------------------------------------------------------------- /compiler/tests-ocaml/lib-string/dune: -------------------------------------------------------------------------------- 1 | (executables 2 | (names test_string) 3 | (libraries) 4 | (modes js)) 5 | 6 | (rule 7 | (target test_string.referencejs) 8 | (deps test_string.bc.js) 9 | (action 10 | (with-stdout-to 11 | %{target} 12 | (run node ./test_string.bc.js)))) 13 | 14 | (rule 15 | (alias runtest) 16 | (deps test_string.reference test_string.referencejs) 17 | (action 18 | (diff test_string.reference test_string.referencejs))) 19 | -------------------------------------------------------------------------------- /tools/version/dune: -------------------------------------------------------------------------------- 1 | (* -*- tuareg -*- *) 2 | open StdLabels 3 | open Jbuild_plugin.V1 4 | 5 | let git_version = 6 | match run_and_read_lines "git describe --always --dirty" with 7 | | exception _ -> "" 8 | | version :: _ -> version 9 | | [] -> "" 10 | 11 | let dyn = 12 | Printf.sprintf 13 | {| 14 | (rule 15 | (target GIT-VERSION) 16 | (action (with-stdout-to %%{target} (echo "%s")))) 17 | |} 18 | git_version 19 | 20 | let () = send dyn 21 | -------------------------------------------------------------------------------- /.github/ISSUE_TEMPLATE/bug_report.md: -------------------------------------------------------------------------------- 1 | --- 2 | name: Bug report 3 | about: Create a report 4 | title: "[BUG]" 5 | labels: bug 6 | assignees: '' 7 | 8 | --- 9 | 10 | **Describe the bug** 11 | A clear and concise description of what the bug is and how to reproduce it. 12 | 13 | **Expected behavior** 14 | A clear and concise description of what you expected to happen. 15 | 16 | **Versions** 17 | Version of packages used to reproduce the bug 18 | (ocamlc, js_of_ocaml, ..) 19 | -------------------------------------------------------------------------------- /compiler/tests-jsoo/bin/error1.ml: -------------------------------------------------------------------------------- 1 | let () = 2 | match Array.to_list Sys.argv with 3 | | _ :: "unregister" :: _ -> 4 | let null = Array.unsafe_get [| 1 |] 1 in 5 | Callback.register "Printexc.handle_uncaught_exception" null 6 | | _ -> () 7 | 8 | exception D of int * string * Int64.t 9 | 10 | let _ = 11 | Printexc.register_printer (function 12 | | D _ -> Some "custom printer" 13 | | _ -> None) 14 | 15 | let _ = raise (D (2, "test", 43L)) 16 | -------------------------------------------------------------------------------- /compiler/tests-ocaml/lib-filename/extension.ml: -------------------------------------------------------------------------------- 1 | (* TEST 2 | *) 3 | 4 | let () = 5 | let test f e = 6 | assert(Filename.extension f = e); 7 | assert(Filename.extension ("foo/" ^ f) = e); 8 | assert(f = Filename.remove_extension f ^ Filename.extension f) 9 | in 10 | test "" ""; 11 | test "foo" ""; 12 | test "foo.txt" ".txt"; 13 | test "foo.txt.gz" ".gz"; 14 | test ".foo" ""; 15 | test "." ""; 16 | test ".." ""; 17 | test "foo..txt" ".txt" 18 | -------------------------------------------------------------------------------- /toplevel/examples/lwt_toplevel/ocp_indent.ok.ml: -------------------------------------------------------------------------------- 1 | let _ = Approx_lexer.enable_extension "lwt" 2 | 3 | let indent s in_lines = 4 | let output = 5 | { IndentPrinter.debug = false 6 | ; config = IndentConfig.default 7 | ; in_lines 8 | ; indent_empty = true 9 | ; adaptive = true 10 | ; kind = IndentPrinter.Print (fun s acc -> acc ^ s) 11 | } 12 | in 13 | let stream = Nstream.of_string s in 14 | IndentPrinter.proceed output stream IndentBlock.empty "" 15 | -------------------------------------------------------------------------------- /compiler/bin-jsoo_fs/dune: -------------------------------------------------------------------------------- 1 | (executable 2 | (name jsoo_fs) 3 | (public_name jsoo_fs) 4 | (package js_of_ocaml-compiler) 5 | (libraries jsoo_cmdline js_of_ocaml-compiler cmdliner compiler-libs.common) 6 | (flags 7 | (:standard -safe-string))) 8 | 9 | (rule 10 | (targets jsoo_fs.1) 11 | (action 12 | (with-stdout-to 13 | %{targets} 14 | (run %{bin:jsoo_fs} --help=groff)))) 15 | 16 | (install 17 | (section man) 18 | (package js_of_ocaml-compiler) 19 | (files jsoo_fs.1)) 20 | -------------------------------------------------------------------------------- /compiler/tests-ocaml/lib-random/rand.ml: -------------------------------------------------------------------------------- 1 | (* TEST 2 | *) 3 | 4 | (* Test that two Random.self_init() in close succession will not result 5 | in the same PRNG state. 6 | Note that even when the code is correct this test is expected to fail 7 | once in 10000 runs. 8 | *) 9 | 10 | let () = 11 | Random.self_init (); 12 | let x = Random.int 10000 in 13 | Random.self_init (); 14 | let y = Random.int 10000 in 15 | if x = y then print_endline "FAILED" else print_endline "PASSED" 16 | -------------------------------------------------------------------------------- /examples/webgl/dune: -------------------------------------------------------------------------------- 1 | (executables 2 | (names webgldemo) 3 | (libraries js_of_ocaml-lwt) 4 | (modes byte) 5 | (preprocess 6 | (pps js_of_ocaml-ppx))) 7 | 8 | (rule 9 | (targets webgldemo.js) 10 | (action 11 | (run 12 | %{bin:js_of_ocaml} 13 | --source-map 14 | %{dep:webgldemo.bc} 15 | -o 16 | %{targets} 17 | --pretty 18 | -I 19 | ./ 20 | --file 21 | %{dep:monkey.model}))) 22 | 23 | (alias 24 | (name default) 25 | (deps webgldemo.js index.html)) 26 | -------------------------------------------------------------------------------- /examples/wiki/index.html: -------------------------------------------------------------------------------- 1 | 2 | 4 | 5 | 6 | Realtime wiki syntax parsing 7 | 8 | 9 | 10 | 11 | 12 | 13 | -------------------------------------------------------------------------------- /compiler/bin-jsoo_link/dune: -------------------------------------------------------------------------------- 1 | (executable 2 | (name jsoo_link) 3 | (public_name jsoo_link) 4 | (package js_of_ocaml-compiler) 5 | (libraries jsoo_cmdline js_of_ocaml-compiler cmdliner compiler-libs.common) 6 | (flags 7 | (:standard -safe-string))) 8 | 9 | (rule 10 | (targets jsoo_link.1) 11 | (action 12 | (with-stdout-to 13 | %{targets} 14 | (run %{bin:jsoo_link} --help=groff)))) 15 | 16 | (install 17 | (section man) 18 | (package js_of_ocaml-compiler) 19 | (files jsoo_link.1)) 20 | -------------------------------------------------------------------------------- /compiler/tests-ocaml/lib-seq/test.ml: -------------------------------------------------------------------------------- 1 | (* TEST 2 | *) 3 | 4 | let filter1 x = x mod 2 = 0 ;; 5 | 6 | (* Standard test case *) 7 | let () = 8 | assert 9 | ([2;4] = 10 | (List.to_seq [1;2;3;4;5] 11 | |> Seq.filter (fun x -> x mod 2 = 0) 12 | |> List.of_seq)); 13 | () 14 | ;; 15 | 16 | (* MPR 7820 *) 17 | let () = 18 | assert 19 | ([| 1;2;3 |] = 20 | (Array.to_seq [| 1;2;3 |] 21 | |> Array.of_seq)); 22 | () 23 | ;; 24 | 25 | let () = print_endline "OK";; 26 | -------------------------------------------------------------------------------- /examples/boulderdash/index.html: -------------------------------------------------------------------------------- 1 | 2 | 4 | 5 | 6 | Boulder Dash 7 | 8 | 9 | 10 | 11 | 12 | 13 | -------------------------------------------------------------------------------- /examples/minesweeper/index.html: -------------------------------------------------------------------------------- 1 | 2 | 4 | 5 | 6 | Minesweeper 7 | 8 | 9 | 10 | 11 |
12 | 13 | 14 | -------------------------------------------------------------------------------- /examples/wysiwyg/index.html: -------------------------------------------------------------------------------- 1 | 2 | 4 | 5 | 6 | Kakadu's WYSIWYG wiki editor 7 | 8 | 9 | 10 | 11 | 12 | 13 | -------------------------------------------------------------------------------- /compiler/bin-jsoo_minify/dune: -------------------------------------------------------------------------------- 1 | (executable 2 | (name jsoo_minify) 3 | (public_name jsoo_minify) 4 | (package js_of_ocaml-compiler) 5 | (libraries jsoo_cmdline js_of_ocaml-compiler cmdliner compiler-libs.common) 6 | (flags 7 | (:standard -safe-string))) 8 | 9 | (rule 10 | (targets jsoo_minify.1) 11 | (action 12 | (with-stdout-to 13 | %{targets} 14 | (run %{bin:jsoo_minify} --help=groff)))) 15 | 16 | (install 17 | (section man) 18 | (package js_of_ocaml-compiler) 19 | (files jsoo_minify.1)) 20 | -------------------------------------------------------------------------------- /compiler/tests-ocaml/prim-revapply/revapply.ml: -------------------------------------------------------------------------------- 1 | (* TEST 2 | *) 3 | 4 | external ( |> ) : 'a -> ('a -> 'b) -> 'b = "%revapply" 5 | 6 | let f x = x + x 7 | let g x = x * x 8 | let h x = x + 1 9 | let add x y = x + y 10 | 11 | let _ = 12 | List.iter (fun x -> 13 | print_int x; print_newline () 14 | ) 15 | [ 16 | 3 |> f; (* 6 *) 17 | 3 |> f |> g; (* 36 *) 18 | 3 |> g |> f; (* 18 *) 19 | 3 |> f |> g |> h; (* 37 *) 20 | 3 |> add 2 |> add 3 |> f |> g |> add 4; (* 260 *) 21 | ] 22 | -------------------------------------------------------------------------------- /tools/version/gen/gen.ml: -------------------------------------------------------------------------------- 1 | let version = Sys.argv.(1) 2 | 3 | let git_version = Sys.argv.(2) 4 | 5 | let version = 6 | let ic = open_in version in 7 | let version = try input_line ic with End_of_file -> "" in 8 | close_in ic; 9 | version 10 | 11 | let git_version = 12 | let ic = open_in git_version in 13 | let git_version = try input_line ic with End_of_file -> "" in 14 | close_in ic; 15 | git_version 16 | 17 | let () = Printf.printf {| 18 | let s = "%s" 19 | let git_version = "%s" 20 | |} version git_version 21 | -------------------------------------------------------------------------------- /compiler/tests-ocaml/basic-modules/dune: -------------------------------------------------------------------------------- 1 | (executables 2 | (names recursive_module_init) 3 | (libraries) 4 | (modes js)) 5 | 6 | (rule 7 | (target recursive_module_init.referencejs) 8 | (deps recursive_module_init.bc.js) 9 | (action 10 | (with-stdout-to 11 | %{target} 12 | (run node ./recursive_module_init.bc.js)))) 13 | 14 | (rule 15 | (alias runtest) 16 | (deps recursive_module_init.reference recursive_module_init.referencejs) 17 | (action 18 | (diff recursive_module_init.reference recursive_module_init.referencejs))) 19 | -------------------------------------------------------------------------------- /lib/lwt/graphics/dune: -------------------------------------------------------------------------------- 1 | (library 2 | (name graphics_js) 3 | (public_name js_of_ocaml-lwt.graphics) 4 | (synopsis "Graphics for js_of_ocaml.") 5 | (optional) 6 | (libraries js_of_ocaml js_of_ocaml-lwt lwt graphics) 7 | (foreign_stubs 8 | (language c) 9 | (names graphics_js_stubs)) 10 | (preprocess 11 | (pps js_of_ocaml-ppx))) 12 | 13 | (rule 14 | (targets graphics_js_stubs.c) 15 | (deps 16 | (glob_files *.ml)) 17 | (mode promote) 18 | (action 19 | (with-stdout-to 20 | %{targets} 21 | (run ../../gen_stubs/gen_stubs.exe %{deps})))) 22 | -------------------------------------------------------------------------------- /compiler/tests-io/dune: -------------------------------------------------------------------------------- 1 | (executable 2 | (name cat) 3 | (modes native js)) 4 | 5 | (rule 6 | (target native.stdout) 7 | (action 8 | (with-stdout-to 9 | native.stdout 10 | (pipe-stdout 11 | (run printf "echo \226\152\160") 12 | (run %{dep:./cat.exe}))))) 13 | 14 | (rule 15 | (target js.stdout) 16 | (action 17 | (with-stdout-to 18 | js.stdout 19 | (pipe-stdout 20 | (run printf "echo \226\152\160") 21 | (run node %{dep:./cat.bc.js}))))) 22 | 23 | (rule 24 | (alias runtest) 25 | (action 26 | (diff js.stdout native.stdout))) 27 | -------------------------------------------------------------------------------- /compiler/tests-jsoo/bin/error1.html: -------------------------------------------------------------------------------- 1 | 2 | 4 | 5 | 6 | Error 1 7 | 8 | 11 | 12 | 13 | 14 | -------------------------------------------------------------------------------- /compiler/tests-jsoo/bin/error2.html: -------------------------------------------------------------------------------- 1 | 2 | 4 | 5 | 6 | Error 1 7 | 8 | 11 | 12 | 13 | 14 | -------------------------------------------------------------------------------- /compiler/tests-jsoo/bin/error3.html: -------------------------------------------------------------------------------- 1 | 2 | 4 | 5 | 6 | Error 1 7 | 8 | 11 | 12 | 13 | 14 | -------------------------------------------------------------------------------- /compiler/tests-ocaml/lib-hashtbl/hfun.reference: -------------------------------------------------------------------------------- 1 | -- Strings: 2 | "" 00000000 3 | "Hello world" 364b8272 4 | -- Integers: 5 | 0 07be548a 6 | -1 3653e015 7 | 42 1792870b 8 | 2^30-1 23c392d0 9 | -2^30 0c66fde3 10 | -- Floats: 11 | +0.0 07be548a 12 | -0.0 07be548a 13 | +infty 23ea56fb 14 | -infty 059f7872 15 | NaN 00000000 16 | NaN#2 00000000 17 | NaN#3 00000000 18 | -- Native integers: 19 | 0 07be548a 20 | -1 3653e015 21 | 42 1792870b 22 | 2^30-1 23c392d0 23 | -2^30 0c66fde3 24 | -- Lists: 25 | [0..10] 0ade0fc9 26 | [0..12] 0ade0fc9 27 | [10..0] 0cd6259d 28 | -------------------------------------------------------------------------------- /runtime/dune: -------------------------------------------------------------------------------- 1 | (install 2 | (section lib) 3 | (package js_of_ocaml-compiler) 4 | (files 5 | bigarray.js 6 | bigstring-base_bigstring.js 7 | bigstring-core_kernel.js 8 | bigstring-cstruct.js 9 | bigstring.js 10 | dynlink.js 11 | fs.js 12 | fs_fake.js 13 | fs_node.js 14 | gc.js 15 | graphics.js 16 | ieee_754.js 17 | int64.js 18 | internalMod.js 19 | io.js 20 | jslib.js 21 | jslib_js_of_ocaml.js 22 | lexing.js 23 | marshal.js 24 | md5.js 25 | mlBytes.js 26 | nat.js 27 | parsing.js 28 | stdlib.js 29 | toplevel.js 30 | unix.js 31 | weak.js)) 32 | -------------------------------------------------------------------------------- /compiler/tests-jsoo/bin/error1-unregister.html: -------------------------------------------------------------------------------- 1 | 2 | 4 | 5 | 6 | Error 1 7 | 8 | 11 | 12 | 13 | 14 | -------------------------------------------------------------------------------- /compiler/tests-jsoo/bin/error2-unregister.html: -------------------------------------------------------------------------------- 1 | 2 | 4 | 5 | 6 | Error 1 7 | 8 | 11 | 12 | 13 | 14 | -------------------------------------------------------------------------------- /compiler/tests-jsoo/bin/error3-unregister.html: -------------------------------------------------------------------------------- 1 | 2 | 4 | 5 | 6 | Error 1 7 | 8 | 11 | 12 | 13 | 14 | -------------------------------------------------------------------------------- /lib/js_of_ocaml/dune: -------------------------------------------------------------------------------- 1 | (library 2 | (name js_of_ocaml) 3 | (public_name js_of_ocaml) 4 | (libraries uchar bytes) 5 | (foreign_stubs 6 | (language c) 7 | (names js_of_ocaml_stubs)) 8 | (preprocess 9 | (pps ppx_js_internal))) 10 | 11 | (rule 12 | (targets js_of_ocaml_stubs.c) 13 | (deps 14 | (glob_files *.ml)) 15 | (mode promote) 16 | (action 17 | (with-stdout-to 18 | %{targets} 19 | (run ../gen_stubs/gen_stubs.exe %{deps})))) 20 | 21 | (rule 22 | (targets lib_version.ml) 23 | (deps 24 | (:input-file ../../version.ml.in)) 25 | (action 26 | (copy %{input-file} %{targets}))) 27 | -------------------------------------------------------------------------------- /compiler/tests-ocaml/basic-modules/recursive_module_init.reference: -------------------------------------------------------------------------------- 1 | f1[real]: nonrec => 42, self => 42, mod => __ 2 | f2[real]: nonrec => 42, self => 42, mod => __ 3 | f3[stub]: nonrec => __, self => __, mod => __ 4 | f4[real]: nonrec => 42, self => 42, mod => __ 5 | f5[stub]: nonrec => __, self => __, mod => __ 6 | M.f1[real]: nonrec => 42, self => 42, mod => 42 7 | M.f2[real]: nonrec => 42, self => 42, mod => 42 8 | M.f3[stub]: nonrec => 42, self => 42, mod => 42 9 | M.f4[real]: nonrec => 42, self => 42, mod => 42 10 | M.f5[real]: nonrec => 42, self => 42, mod => 42 11 | go 12 | go 13 | go 14 | -------------------------------------------------------------------------------- /.github/ISSUE_TEMPLATE/feature_request.md: -------------------------------------------------------------------------------- 1 | --- 2 | name: Feature request 3 | about: Suggest an idea 4 | title: "[FEATURE REQUEST]" 5 | labels: enhancement 6 | assignees: '' 7 | 8 | --- 9 | 10 | **Is your feature request related to a problem? Please describe.** 11 | A clear and concise description of what the problem is. Ex. I'm always frustrated when [...] 12 | 13 | **Describe the solution you'd like** 14 | A clear and concise description of what you want to happen. 15 | 16 | **Describe alternatives you've considered** 17 | A clear and concise description of any alternative solutions or features you've considered. 18 | -------------------------------------------------------------------------------- /compiler/tests-ocaml/prim-bswap/bswap.ml: -------------------------------------------------------------------------------- 1 | (* TEST 2 | *) 3 | 4 | open Printf 5 | 6 | external bswap16: int -> int = "%bswap16" 7 | external bswap32: int32 -> int32 = "%bswap_int32" 8 | external bswap64: int64 -> int64 = "%bswap_int64" 9 | 10 | let d16 = [0x11223344; 11 | 0x0000f0f0] 12 | let d32 = [0x11223344l; 13 | 0xf0f0f0f0l] 14 | let d64 = [0x1122334455667788L; 15 | 0xf0f0f0f0f0f0f0f0L] 16 | 17 | let _ = 18 | List.iter (fun x -> printf "%x\n" (bswap16 x)) d16; 19 | List.iter (fun x -> printf "%lx\n" (bswap32 x)) d32; 20 | List.iter (fun x -> printf "%Lx\n" (bswap64 x)) d64 21 | -------------------------------------------------------------------------------- /examples/boulderdash/dune: -------------------------------------------------------------------------------- 1 | (executables 2 | (names boulderdash) 3 | (libraries js_of_ocaml-lwt) 4 | (modes byte) 5 | (preprocess 6 | (pps js_of_ocaml-ppx))) 7 | 8 | (rule 9 | (targets boulderdash.js) 10 | (deps 11 | (glob_files maps/*.map)) 12 | (action 13 | (run 14 | %{bin:js_of_ocaml} 15 | --source-map 16 | %{dep:boulderdash.bc} 17 | -o 18 | %{targets} 19 | --pretty 20 | -I 21 | ./ 22 | --file 23 | %{dep:maps.txt} 24 | --file 25 | maps))) 26 | 27 | (alias 28 | (name default) 29 | (deps 30 | boulderdash.js 31 | index.html 32 | (glob_files sprites/*.{png,svg}))) 33 | -------------------------------------------------------------------------------- /lib/lwt/graphics/graphics_js_stubs.c: -------------------------------------------------------------------------------- 1 | #include 2 | #include 3 | void caml_gr_doc_of_state () { 4 | fprintf(stderr, "Unimplemented Javascript primitive caml_gr_doc_of_state!\n"); 5 | exit(1); 6 | } 7 | void caml_gr_state_create () { 8 | fprintf(stderr, "Unimplemented Javascript primitive caml_gr_state_create!\n"); 9 | exit(1); 10 | } 11 | void caml_gr_state_get () { 12 | fprintf(stderr, "Unimplemented Javascript primitive caml_gr_state_get!\n"); 13 | exit(1); 14 | } 15 | void caml_gr_state_set () { 16 | fprintf(stderr, "Unimplemented Javascript primitive caml_gr_state_set!\n"); 17 | exit(1); 18 | } 19 | -------------------------------------------------------------------------------- /compiler/tests-num/dune: -------------------------------------------------------------------------------- 1 | (executable 2 | (name main) 3 | (libraries num) 4 | (modes native js) 5 | (flags 6 | (:standard -linkall -w -3-7-33-35-37 -safe-string -no-strict-sequence))) 7 | 8 | (rule 9 | (target main.referencejs) 10 | (deps main.bc.js) 11 | (action 12 | (with-stdout-to 13 | %{target} 14 | (run node ./main.bc.js)))) 15 | 16 | (rule 17 | (target main.reference) 18 | (deps main.exe) 19 | (action 20 | (with-stdout-to 21 | %{target} 22 | (run ./main.exe)))) 23 | 24 | (rule 25 | (alias runtest) 26 | (deps main.reference main.referencejs) 27 | (action 28 | (diff main.reference main.referencejs))) 29 | -------------------------------------------------------------------------------- /HACKING.md: -------------------------------------------------------------------------------- 1 | # Release procedure 2 | * Documentation 3 | * Make sure the doc is up to date (See Documentation generation) 4 | * In the wikidoc branch, copy dev to VERSION 5 | * update VERSION 6 | * dune-release tag $(cat VERSION) 7 | * dune-release distrib 8 | * dune-release publish distrib 9 | * dune-release opam pkg 10 | * dune-release opam submit 11 | 12 | # Documentation generation 13 | * make doc 14 | * git checkout wikidoc && git reset --hard origin/wikidoc && git checkout master 15 | * make installdoc 16 | * cd _wikidoc 17 | * git diff # review diff 18 | * git commit -am "sync doc" && git push origin wikidoc 19 | * cd .. 20 | * git push origin wikidoc 21 | -------------------------------------------------------------------------------- /tools/toplevel_expect/dune: -------------------------------------------------------------------------------- 1 | (library 2 | (name toplevel_expect_test) 3 | (libraries compiler-libs.common compiler-libs.toplevel)) 4 | 5 | (rule 6 | (targets toplevel_expect_test.ml) 7 | (deps 8 | ../select/select.exe 9 | toplevel_expect_test.ml-4.04 10 | toplevel_expect_test.ml-4.05 11 | toplevel_expect_test.ml-4.08 12 | toplevel_expect_test.ml-4.09 13 | toplevel_expect_test.ml-4.10 14 | toplevel_expect_test.ml-4.11 15 | toplevel_expect_test.ml-4.12 16 | toplevel_expect_test.ml-4.13 17 | toplevel_expect_test.ml-4.14 18 | toplevel_expect_test.ml-default) 19 | (action 20 | (with-stdout-to 21 | %{targets} 22 | (run %{deps})))) 23 | -------------------------------------------------------------------------------- /examples/planet/index.html: -------------------------------------------------------------------------------- 1 | 2 | 4 | 5 | 6 | Planet 7 | 16 | 17 | 18 | 19 | 20 | 21 | -------------------------------------------------------------------------------- /examples/hyperbolic/dune: -------------------------------------------------------------------------------- 1 | (executables 2 | (names hypertree) 3 | (libraries js_of_ocaml-lwt) 4 | (modes byte) 5 | (preprocess 6 | (pps js_of_ocaml-ppx))) 7 | 8 | (rule 9 | (targets hypertree.js) 10 | (action 11 | (run 12 | %{bin:js_of_ocaml} 13 | --source-map 14 | %{dep:hypertree.bc} 15 | -o 16 | %{targets} 17 | --pretty 18 | -I 19 | ./ 20 | --file 21 | %{dep:image_info.json} 22 | --file 23 | %{dep:messages.json} 24 | --file 25 | %{dep:tree.json}))) 26 | 27 | (alias 28 | (name default) 29 | (deps 30 | hypertree.js 31 | index.html 32 | (glob_files icons/*.{png,jpg}) 33 | (glob_files thumbnails/*.{png,jpg}))) 34 | -------------------------------------------------------------------------------- /runtime/bigstring-cstruct.js: -------------------------------------------------------------------------------- 1 | //The following are defined in Cstruct 2 | //There are just provided here for compatibility reasons 3 | 4 | //Provides: caml_blit_bigstring_to_bigstring 5 | //Requires: caml_bigstring_blit_ba_to_ba 6 | //Weakdef 7 | var caml_blit_bigstring_to_bigstring = caml_bigstring_blit_ba_to_ba 8 | //Provides: caml_blit_bigstring_to_string 9 | //Requires: caml_bigstring_blit_ba_to_bytes 10 | //Weakdef 11 | var caml_blit_bigstring_to_string = caml_bigstring_blit_ba_to_bytes 12 | //Provides: caml_blit_string_to_bigstring 13 | //Requires: caml_bigstring_blit_string_to_ba 14 | //Weakdef 15 | var caml_blit_string_to_bigstring = caml_bigstring_blit_string_to_ba 16 | -------------------------------------------------------------------------------- /runtime/bigstring-core_kernel.js: -------------------------------------------------------------------------------- 1 | //The following are defined in Core_kernel 2 | //There are just provided here for compatibility reasons 3 | 4 | //Provides: bigstring_destroy_stub 5 | //Requires: caml_invalid_argument, caml_ba_create_unsafe 6 | //Weakdef 7 | function bigstring_destroy_stub(v_bstr) { 8 | if (v_bstr.hasOwnProperty('__is_deallocated')) { 9 | caml_invalid_argument("bigstring_destroy: bigstring is already deallocated"); 10 | } 11 | // Mutate the original bigstring in-place, to simulate what the C version does 12 | v_bstr.__is_deallocated = true; 13 | v_bstr.data = new v_bstr.data.__proto__.constructor(0); 14 | v_bstr.dims = [0]; 15 | return 0; 16 | } 17 | -------------------------------------------------------------------------------- /toplevel/examples/eval/dune: -------------------------------------------------------------------------------- 1 | (executables 2 | (names eval) 3 | (libraries js_of_ocaml-compiler js_of_ocaml-toplevel) 4 | (link_flags 5 | (:standard -linkall)) 6 | (modes byte) 7 | (preprocess 8 | (pps js_of_ocaml-ppx))) 9 | 10 | (rule 11 | (targets export.txt) 12 | (deps eval.bc) 13 | (action 14 | (run jsoo_listunits -o %{targets} stdlib))) 15 | 16 | (rule 17 | (targets eval.js) 18 | (action 19 | (run 20 | %{bin:js_of_ocaml} 21 | --export 22 | %{dep:export.txt} 23 | --toplevel 24 | --pretty 25 | +toplevel.js 26 | +dynlink.js 27 | %{dep:eval.bc} 28 | -o 29 | %{targets}))) 30 | 31 | (alias 32 | (name default) 33 | (deps eval.js index.html)) 34 | -------------------------------------------------------------------------------- /compiler/tests-ocaml/lib-bytes/dune: -------------------------------------------------------------------------------- 1 | (executables 2 | (names test_bytes binary) 3 | (libraries) 4 | (modes js)) 5 | 6 | (rule 7 | (target test_bytes.referencejs) 8 | (deps test_bytes.bc.js) 9 | (action 10 | (with-stdout-to 11 | %{target} 12 | (run node ./test_bytes.bc.js)))) 13 | 14 | (rule 15 | (alias runtest) 16 | (deps test_bytes.reference test_bytes.referencejs) 17 | (action 18 | (diff test_bytes.reference test_bytes.referencejs))) 19 | 20 | (rule 21 | (target binary.referencejs) 22 | (deps binary.bc.js) 23 | (action 24 | (with-stdout-to 25 | %{target} 26 | (run node ./binary.bc.js)))) 27 | 28 | (alias 29 | (name runtest) 30 | (deps binary.referencejs)) 31 | -------------------------------------------------------------------------------- /examples/separate_compilation/index.html: -------------------------------------------------------------------------------- 1 | 2 | 4 | 5 | 6 | Separate compilation 7 | 8 | 9 | 10 | 11 | 12 | 13 | 14 | 15 | 16 | -------------------------------------------------------------------------------- /Makefile: -------------------------------------------------------------------------------- 1 | all: 2 | dune build @all 3 | 4 | tests: 5 | dune runtest 6 | 7 | test runtest runtests: tests 8 | 9 | doc: 10 | dune build @ocsigen-doc 11 | 12 | promote: 13 | dune promote 14 | 15 | fmt: 16 | dune build @fmt --auto-promote 2> /dev/null || true 17 | git diff --exit-code 18 | 19 | clean: 20 | dune clean 21 | 22 | installdoc: 23 | rm -rf _wikidoc 24 | git clone ./ _wikidoc 25 | (cd _wikidoc && git checkout wikidoc) 26 | rm -rf _wikidoc/doc/dev/* 27 | cp -r _build/default/_doc/_html _wikidoc/doc/dev/api 28 | cp -r _build/default/manual _wikidoc/doc/dev/manual 29 | find _wikidoc/doc/dev/ -name dune -delete 30 | 31 | .PHONY: all tests test runtest runtests doc clean installdoc 32 | -------------------------------------------------------------------------------- /examples/graph_viewer/dune: -------------------------------------------------------------------------------- 1 | (executables 2 | (names viewer_js) ;; add converter & viewer 3 | (libraries js_of_ocaml-lwt) 4 | (modes byte) 5 | (modules 6 | (:standard 7 | \ 8 | scene_extents 9 | svg 10 | main 11 | viewer 12 | converter 13 | dot_lexer 14 | dot_graph 15 | dot_render)) 16 | (preprocess 17 | (pps js_of_ocaml-ppx))) 18 | 19 | (ocamllex dot_lexer) 20 | 21 | (rule 22 | (targets viewer_js.js) 23 | (action 24 | (run 25 | %{bin:js_of_ocaml} 26 | --source-map 27 | %{dep:viewer_js.bc} 28 | -o 29 | %{targets} 30 | --pretty 31 | -I 32 | ./ 33 | --file 34 | %{dep:scene.json}))) 35 | 36 | (alias 37 | (name default) 38 | (deps viewer_js.js index.html)) 39 | -------------------------------------------------------------------------------- /examples/wiki/test.ml: -------------------------------------------------------------------------------- 1 | (* This is demo input for wiki. It will be loaded automatically into window on startup *) 2 | 3 | let test1 = 4 | "\n\n\ 5 | ====this is h4\n\n\ 6 | # number list el 1\n\ 7 | # number list e2 2 //with italic text\n\n\n\ 8 | //with italic\n\n\ 9 | * bullet list el1 ** with bold text\n\ 10 | * bullet list el2 ** with bold // and italic text\n\n\ 11 | <>\n\n\ 12 | [[http://ya.ru|Link to Yandex]]\n\n\ 13 | [[http://google.com]]\n\n\ 14 | {{http://icons-search.com/img/yellowicon/firefox_win.zip/Firefox_Thunderbird_Win-icons-Firefox.ico-128x128.png|mail \ 15 | icon}}\n\n\ 16 | {{{\n\ 17 | == [[Nowiki]]:\n\ 18 | //**don't** format//\n\ 19 | }}}\n\n\n" 20 | -------------------------------------------------------------------------------- /tools/emacs-format-js.el: -------------------------------------------------------------------------------- 1 | ;;; File: emacs-format-file 2 | ;;; Stan Warford 3 | ;;; 17 May 2006 4 | 5 | (setq js-indent-level 2) 6 | (custom-set-variables 7 | '(indent-tabs-mode nil) 8 | '(tab-width 2)) 9 | 10 | (defun emacs-format-js () 11 | "Format the whole buffer." 12 | (js-mode) 13 | (indent-region (point-min) (point-max) nil) 14 | (delete-trailing-whitespace) 15 | (save-buffer) 16 | ) 17 | 18 | (defun emacs-format-js-ident () 19 | "Format the whole buffer." 20 | (js-mode) 21 | (indent-region (point-min) (point-max) nil) 22 | (save-buffer) 23 | ) 24 | 25 | (defun emacs-format-js-clean () 26 | "Format the whole buffer." 27 | (js-mode) 28 | (delete-trailing-whitespace) 29 | (save-buffer) 30 | ) 31 | -------------------------------------------------------------------------------- /compiler/tests-ocaml/lib-hashtbl/dune: -------------------------------------------------------------------------------- 1 | (executables 2 | (names hfun htbl) 3 | (libraries) 4 | (modes js)) 5 | 6 | (rule 7 | (target hfun.referencejs) 8 | (deps hfun.bc.js ../../../LICENSE) 9 | (action 10 | (with-stdout-to 11 | %{target} 12 | (run node ./hfun.bc.js)))) 13 | 14 | (rule 15 | (alias runtest) 16 | (deps hfun.referencejs hfun.reference) 17 | (action 18 | (diff hfun.referencejs hfun.reference))) 19 | 20 | (rule 21 | (target htbl.referencejs) 22 | (deps htbl.bc.js ../../../LICENSE) 23 | (action 24 | (with-stdout-to 25 | %{target} 26 | (run node ./htbl.bc.js)))) 27 | 28 | (rule 29 | (alias runtest) 30 | (deps htbl.reference htbl.referencejs) 31 | (action 32 | (diff htbl.reference htbl.referencejs))) 33 | -------------------------------------------------------------------------------- /compiler/tests-ocaml/lib-set/dune: -------------------------------------------------------------------------------- 1 | (executables 2 | (names testmap testset) 3 | (libraries) 4 | (modes js)) 5 | 6 | (rule 7 | (target testmap.referencejs) 8 | (deps testmap.bc.js) 9 | (action 10 | (with-stdout-to 11 | %{target} 12 | (run node ./testmap.bc.js)))) 13 | 14 | (rule 15 | (alias runtest) 16 | (deps testmap.reference testmap.referencejs) 17 | (action 18 | (diff testmap.reference testmap.referencejs))) 19 | 20 | (rule 21 | (target testset.referencejs) 22 | (deps testset.bc.js) 23 | (action 24 | (with-stdout-to 25 | %{target} 26 | (run node ./testset.bc.js)))) 27 | 28 | (rule 29 | (alias runtest) 30 | (deps testset.reference testset.referencejs) 31 | (action 32 | (diff testset.reference testset.referencejs))) 33 | -------------------------------------------------------------------------------- /compiler/tests-ocaml/prim-revapply/dune: -------------------------------------------------------------------------------- 1 | (executables 2 | (names apply revapply) 3 | (libraries) 4 | (modes js)) 5 | 6 | (rule 7 | (target apply.referencejs) 8 | (deps apply.bc.js) 9 | (action 10 | (with-stdout-to 11 | %{target} 12 | (run node ./apply.bc.js)))) 13 | 14 | (rule 15 | (alias runtest) 16 | (deps apply.reference apply.referencejs) 17 | (action 18 | (diff apply.reference apply.referencejs))) 19 | 20 | (rule 21 | (target revapply.referencejs) 22 | (deps revapply.bc.js) 23 | (action 24 | (with-stdout-to 25 | %{target} 26 | (run node ./revapply.bc.js)))) 27 | 28 | (rule 29 | (alias runtest) 30 | (deps revapply.reference revapply.referencejs) 31 | (action 32 | (diff revapply.reference revapply.referencejs))) 33 | -------------------------------------------------------------------------------- /compiler/tests-ocaml/lib-bigarray/weak_bigarray.ml: -------------------------------------------------------------------------------- 1 | (* TEST 2 | *) 3 | 4 | (** check that custom block are not copied by Weak.get_copy *) 5 | 6 | open Bigarray 7 | open Bigarray.Array1 8 | 9 | let () = 10 | let a = ref (create float64 c_layout 10) in 11 | Gc.compact (); 12 | set !a 0 42.; 13 | 14 | let w = Weak.create 1 in 15 | Weak.set w 0 (Some !a); 16 | 17 | let b = 18 | match Weak.get_copy w 0 with 19 | | None -> assert false 20 | | Some b -> b 21 | in 22 | Printf.printf "a.(0) = %f\n" (get !a 0); 23 | Printf.printf "b.(0) = %f\n" (get b 0); 24 | a := create float64 c_layout 10; 25 | Gc.compact (); 26 | 27 | let c = create float64 c_layout 10 in 28 | set c 0 33.; 29 | Printf.printf "b.(0) = %f\n" (get b 0); 30 | -------------------------------------------------------------------------------- /manual/install.wiki: -------------------------------------------------------------------------------- 1 | = Installation = 2 | == Requirements = 3 | * dune 4 | * Cmdliner, ppxlib 5 | 6 | See opam files at the root of the repository for version constraints. 7 | 8 | Optional dependencies: 9 | * tyxml, see https://github.com/ocsigen/tyxml 10 | * reactiveData, see https://github.com/ocsigen/reactiveData 11 | * yojson, see https://github.com/mjambon/yojson 12 | 13 | == Install from opam 14 | {{{opam install js_of_ocaml js_of_ocaml-ppx js_of_ocaml-lwt}}} 15 | 16 | == Build and install from source 17 | {{{ 18 | make 19 | }}} 20 | {{{ 21 | opam-installer js_of_ocaml-compiler 22 | }}} 23 | {{{ 24 | opam-installer js_of_ocaml 25 | }}} 26 | {{{ 27 | opam-installer js_of_ocaml-ppx 28 | }}} 29 | {{{ 30 | opam-installer js_of_ocaml-lwt 31 | }}} 32 | -------------------------------------------------------------------------------- /compiler/tests-ocaml/lib-filename/dune: -------------------------------------------------------------------------------- 1 | (executables 2 | (names suffix extension) 3 | (libraries) 4 | (modes js)) 5 | 6 | (rule 7 | (target suffix.referencejs) 8 | (deps suffix.bc.js) 9 | (action 10 | (with-stdout-to 11 | %{target} 12 | (run node ./suffix.bc.js)))) 13 | 14 | (rule 15 | (alias runtest) 16 | (deps suffix.reference suffix.referencejs) 17 | (action 18 | (diff suffix.reference suffix.referencejs))) 19 | 20 | (rule 21 | (target extension.referencejs) 22 | (deps extension.bc.js) 23 | (action 24 | (with-stdout-to 25 | %{target} 26 | (run node ./extension.bc.js)))) 27 | 28 | (rule 29 | (alias runtest) 30 | (deps extension.reference extension.referencejs) 31 | (action 32 | (diff extension.reference extension.referencejs))) 33 | -------------------------------------------------------------------------------- /benchmarks/sources/ml/dune: -------------------------------------------------------------------------------- 1 | (executables 2 | (names 3 | almabench 4 | bdd 5 | binary_trees 6 | boyer 7 | boyer_no_exc 8 | fannkuch_redux_2 9 | fannkuch_redux 10 | fft 11 | fib 12 | hamming 13 | kb 14 | kb_no_exc 15 | loop 16 | nucleic 17 | quicksort 18 | raytrace 19 | soli 20 | splay 21 | takc 22 | taku)) 23 | 24 | (alias 25 | (name benchmark) 26 | (deps 27 | almabench.exe 28 | bdd.exe 29 | binary_trees.exe 30 | boyer.exe 31 | boyer_no_exc.exe 32 | fannkuch_redux_2.exe 33 | fannkuch_redux.exe 34 | fft.exe 35 | fib.exe 36 | hamming.exe 37 | kb.exe 38 | kb_no_exc.exe 39 | loop.exe 40 | nucleic.exe 41 | quicksort.exe 42 | raytrace.exe 43 | soli.exe 44 | splay.exe 45 | takc.exe 46 | taku.exe)) 47 | -------------------------------------------------------------------------------- /compiler/tests-dynlink/dune: -------------------------------------------------------------------------------- 1 | (executable 2 | (name main) 3 | (modules main) 4 | (libraries dynlink js_of_ocaml-toplevel) 5 | (modes byte)) 6 | 7 | (rule 8 | (target main.js) 9 | (deps plugin.cmo) 10 | (action 11 | (run 12 | %{bin:js_of_ocaml} 13 | --dynlink 14 | +dynlink.js 15 | --toplevel 16 | +toplevel.js 17 | -I 18 | ./ 19 | --file 20 | ./plugin.cmo 21 | -o 22 | %{target} 23 | %{dep:main.bc}))) 24 | 25 | (rule 26 | (target plugin.cmo) 27 | (action 28 | (run %{bin:ocamlc} -c %{dep:./plugin.ml}))) 29 | 30 | (rule 31 | (target main.out) 32 | (action 33 | (with-outputs-to 34 | %{target} 35 | (run %{bin:node} %{dep:./main.js})))) 36 | 37 | (rule 38 | (alias runtest) 39 | (action 40 | (diff main.out.expected main.out))) 41 | -------------------------------------------------------------------------------- /dune-workspace.dev: -------------------------------------------------------------------------------- 1 | (lang dune 2.9) 2 | 3 | ;; Install the following opam switches, copy this file as 4 | ;; dune-workspace and run: 5 | ;; 6 | ;; $ dune build @install 7 | ;; 8 | ;; This will build js_of_ocaml against all these version of OCaml 9 | 10 | (context 11 | (opam 12 | (switch 4.04.2))) 13 | 14 | (context 15 | (opam 16 | (switch 4.05.0))) 17 | 18 | (context 19 | (opam 20 | (switch 4.06.1))) 21 | 22 | (context 23 | (opam 24 | (switch 4.07.1))) 25 | 26 | (context 27 | (opam 28 | (switch 4.08.1))) 29 | 30 | (context 31 | (opam 32 | (switch 4.09.1))) 33 | 34 | (context 35 | (opam 36 | (switch 4.10.2))) 37 | 38 | (context 39 | (opam 40 | (switch 4.11.2))) 41 | 42 | (context 43 | (opam 44 | (switch 4.12.1))) 45 | 46 | (context 47 | (opam 48 | (switch 4.13.1))) 49 | -------------------------------------------------------------------------------- /compiler/lib/js_lexer.mli: -------------------------------------------------------------------------------- 1 | (* Js_of_ocaml compiler 2 | * Copyright (C) 2013 Hugo Heuzard 3 | *) 4 | 5 | (* Yoann Padioleau 6 | * 7 | * Copyright (C) 2010 Facebook 8 | * 9 | * This library is free software; you can redistribute it and/or 10 | * modify it under the terms of the GNU Lesser General Public License 11 | * version 2.1 as published by the Free Software Foundation, with the 12 | * special exception on linking described in file license.txt. 13 | * 14 | * This library is distributed in the hope that it will be useful, but 15 | * WITHOUT ANY WARRANTY; without even the implied warranty of 16 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the file 17 | * license.txt for more details. 18 | *) 19 | 20 | val main : Lexing.lexbuf -> Js_token.t 21 | 22 | val main_regexp : Lexing.lexbuf -> Js_token.t 23 | -------------------------------------------------------------------------------- /compiler/tests-ocaml/lib-format/print_if_newline.ml: -------------------------------------------------------------------------------- 1 | [@@@ocaml.warning "-39"] 2 | 3 | (* TEST *) 4 | 5 | (* 6 | 7 | A test file for Format.print_if_newline. 8 | 9 | *) 10 | 11 | open Format;; 12 | 13 | printf "\ntest print_if_newline\n%!"; 14 | printf " newline here\n%!"; 15 | print_if_newline (); 16 | printf " this gets printed"; 17 | print_if_newline (); 18 | printf " this doesn't get printed"; 19 | 20 | printf "\nprint_if_newline doesn't crash when last statement\n%!"; 21 | printf " newline here\n"; 22 | (* Important that the following is the last statement in the file. 23 | 24 | [print_if_newline] sets up the Format module to skip printing 25 | the next printing command. However, it should not crash if there 26 | is no next printing statement. *) 27 | print_if_newline (); 28 | ;; 29 | 30 | let () = exit 0 31 | -------------------------------------------------------------------------------- /examples/boulderdash/LICENSE: -------------------------------------------------------------------------------- 1 | 2 | All files contained in this directory and its sub-directories are 3 | distributed under the terms of the DO WHAT THE FUCK YOU WANT TO PUBLIC 4 | LICENSE (included below). 5 | 6 | ------------------------------------------------------------------------ 7 | 8 | DO WHAT THE FUCK YOU WANT TO PUBLIC LICENSE 9 | Version 2, December 2004 10 | 11 | Copyright (C) 2004 Sam Hocevar 12 | 14 rue de Plaisance, 75014 Paris, France 13 | Everyone is permitted to copy and distribute verbatim or modified 14 | copies of this license document, and changing it is allowed as long 15 | as the name is changed. 16 | 17 | DO WHAT THE FUCK YOU WANT TO PUBLIC LICENSE 18 | TERMS AND CONDITIONS FOR COPYING, DISTRIBUTION AND MODIFICATION 19 | 20 | 0. You just DO WHAT THE FUCK YOU WANT TO. 21 | -------------------------------------------------------------------------------- /examples/minesweeper/LICENSE: -------------------------------------------------------------------------------- 1 | 2 | All files contained in this directory and its sub-directories are 3 | distributed under the terms of the DO WHAT THE FUCK YOU WANT TO PUBLIC 4 | LICENSE (included below). 5 | 6 | ------------------------------------------------------------------------ 7 | 8 | DO WHAT THE FUCK YOU WANT TO PUBLIC LICENSE 9 | Version 2, December 2004 10 | 11 | Copyright (C) 2004 Sam Hocevar 12 | 14 rue de Plaisance, 75014 Paris, France 13 | Everyone is permitted to copy and distribute verbatim or modified 14 | copies of this license document, and changing it is allowed as long 15 | as the name is changed. 16 | 17 | DO WHAT THE FUCK YOU WANT TO PUBLIC LICENSE 18 | TERMS AND CONDITIONS FOR COPYING, DISTRIBUTION AND MODIFICATION 19 | 20 | 0. You just DO WHAT THE FUCK YOU WANT TO. 21 | -------------------------------------------------------------------------------- /compiler/tests-ocaml/prim-bigstring/dune: -------------------------------------------------------------------------------- 1 | (executables 2 | (names bigstring_access string_access) 3 | (libraries) 4 | (modes js)) 5 | 6 | (rule 7 | (target bigstring_access.referencejs) 8 | (deps bigstring_access.bc.js) 9 | (action 10 | (with-stdout-to 11 | %{target} 12 | (run node ./bigstring_access.bc.js)))) 13 | 14 | (rule 15 | (alias runtest) 16 | (deps bigstring_access.reference bigstring_access.referencejs) 17 | (action 18 | (diff bigstring_access.reference bigstring_access.referencejs))) 19 | 20 | (rule 21 | (target string_access.referencejs) 22 | (deps string_access.bc.js) 23 | (action 24 | (with-stdout-to 25 | %{target} 26 | (run node ./string_access.bc.js)))) 27 | 28 | (rule 29 | (alias runtest) 30 | (deps string_access.reference string_access.referencejs) 31 | (action 32 | (diff string_access.reference string_access.referencejs))) 33 | -------------------------------------------------------------------------------- /ppx/ppx_js/lib/ppx_js_rewriter.ml: -------------------------------------------------------------------------------- 1 | (* Js_of_ocaml library 2 | * http://www.ocsigen.org/js_of_ocaml/ 3 | * 4 | * This program is free software; you can redistribute it and/or modify 5 | * it under the terms of the GNU Lesser General Public License as published by 6 | * the Free Software Foundation, with linking exception; 7 | * either version 2.1 of the License, or (at your option) any later version. 8 | * 9 | * This program is distributed in the hope that it will be useful, 10 | * but WITHOUT ANY WARRANTY; without even the implied warranty of 11 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 12 | * GNU Lesser General Public License for more details. 13 | * 14 | * You should have received a copy of the GNU Lesser General Public License 15 | * along with this program; if not, write to the Free Software 16 | * Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. 17 | *) 18 | 19 | include Ppx_js 20 | -------------------------------------------------------------------------------- /compiler/bin-jsoo_fs/jsoo_fs.mli: -------------------------------------------------------------------------------- 1 | (* Js_of_ocaml compiler 2 | * http://www.ocsigen.org/js_of_ocaml/ 3 | * Copyright (C) 2020 Hugo Heuzard 4 | * 5 | * This program is free software; you can redistribute it and/or modify 6 | * it under the terms of the GNU Lesser General Public License as published by 7 | * the Free Software Foundation, with linking exception; 8 | * either version 2.1 of the License, or (at your option) any later version. 9 | * 10 | * This program is distributed in the hope that it will be useful, 11 | * but WITHOUT ANY WARRANTY; without even the implied warranty of 12 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 13 | * GNU Lesser General Public License for more details. 14 | * 15 | * You should have received a copy of the GNU Lesser General Public License 16 | * along with this program; if not, write to the Free Software 17 | * Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. 18 | *) 19 | -------------------------------------------------------------------------------- /compiler/bin-jsoo_link/jsoo_link.mli: -------------------------------------------------------------------------------- 1 | (* Js_of_ocaml compiler 2 | * http://www.ocsigen.org/js_of_ocaml/ 3 | * Copyright (C) 2020 Hugo Heuzard 4 | * 5 | * This program is free software; you can redistribute it and/or modify 6 | * it under the terms of the GNU Lesser General Public License as published by 7 | * the Free Software Foundation, with linking exception; 8 | * either version 2.1 of the License, or (at your option) any later version. 9 | * 10 | * This program is distributed in the hope that it will be useful, 11 | * but WITHOUT ANY WARRANTY; without even the implied warranty of 12 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 13 | * GNU Lesser General Public License for more details. 14 | * 15 | * You should have received a copy of the GNU Lesser General Public License 16 | * along with this program; if not, write to the Free Software 17 | * Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. 18 | *) 19 | -------------------------------------------------------------------------------- /compiler/tests-ocaml/prim-revapply/apply.ml: -------------------------------------------------------------------------------- 1 | (* TEST 2 | *) 3 | 4 | external ( @@ ) : ('a -> 'b) -> 'a -> 'b = "%apply" 5 | 6 | let f x = x + x 7 | let g x = x * x 8 | let h x = x + 1 9 | let add x y = x + y 10 | 11 | let _ = 12 | List.iter (fun x -> 13 | print_int x; print_newline () 14 | ) 15 | [ 16 | f @@ 3; (* 6 *) 17 | g @@ f @@ 3; (* 36 *) 18 | f @@ g @@ 3; (* 18 *) 19 | h @@ g @@ f @@ 3; (* 37 *) 20 | add 4 @@ g @@ f @@ add 3 @@ add 2 @@ 3; (* 260 *) 21 | ] 22 | external ( @@ ) : ('a -> 'b) -> 'a -> 'b = "%apply" 23 | 24 | let f x = x + x 25 | let g x = x * x 26 | let h x = x + 1 27 | let add x y = x + y 28 | 29 | let _ = 30 | List.iter (fun x -> 31 | print_int x; print_newline () 32 | ) 33 | [ 34 | f @@ 3; (* 6 *) 35 | g @@ f @@ 3; (* 36 *) 36 | f @@ g @@ 3; (* 18 *) 37 | h @@ g @@ f @@ 3; (* 37 *) 38 | add 4 @@ g @@ f @@ add 3 @@ add 2 @@ 3; (* 260 *) 39 | ] 40 | -------------------------------------------------------------------------------- /compiler/bin-js_of_ocaml/js_of_ocaml.mli: -------------------------------------------------------------------------------- 1 | (* Js_of_ocaml compiler 2 | * http://www.ocsigen.org/js_of_ocaml/ 3 | * Copyright (C) 2020 Hugo Heuzard 4 | * 5 | * This program is free software; you can redistribute it and/or modify 6 | * it under the terms of the GNU Lesser General Public License as published by 7 | * the Free Software Foundation, with linking exception; 8 | * either version 2.1 of the License, or (at your option) any later version. 9 | * 10 | * This program is distributed in the hope that it will be useful, 11 | * but WITHOUT ANY WARRANTY; without even the implied warranty of 12 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 13 | * GNU Lesser General Public License for more details. 14 | * 15 | * You should have received a copy of the GNU Lesser General Public License 16 | * along with this program; if not, write to the Free Software 17 | * Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. 18 | *) 19 | -------------------------------------------------------------------------------- /compiler/bin-jsoo_minify/jsoo_minify.mli: -------------------------------------------------------------------------------- 1 | (* Js_of_ocaml compiler 2 | * http://www.ocsigen.org/js_of_ocaml/ 3 | * Copyright (C) 2020 Hugo Heuzard 4 | * 5 | * This program is free software; you can redistribute it and/or modify 6 | * it under the terms of the GNU Lesser General Public License as published by 7 | * the Free Software Foundation, with linking exception; 8 | * either version 2.1 of the License, or (at your option) any later version. 9 | * 10 | * This program is distributed in the hope that it will be useful, 11 | * but WITHOUT ANY WARRANTY; without even the implied warranty of 12 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 13 | * GNU Lesser General Public License for more details. 14 | * 15 | * You should have received a copy of the GNU Lesser General Public License 16 | * along with this program; if not, write to the Free Software 17 | * Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. 18 | *) 19 | -------------------------------------------------------------------------------- /compiler/bin-js_of_ocaml/findlib_support.empty.ml: -------------------------------------------------------------------------------- 1 | (* Js_of_ocaml compiler 2 | * http://www.ocsigen.org/js_of_ocaml/ 3 | * Copyright (C) 2020 Hugo Heuzard 4 | * 5 | * This program is free software; you can redistribute it and/or modify 6 | * it under the terms of the GNU Lesser General Public License as published by 7 | * the Free Software Foundation, with linking exception; 8 | * either version 2.1 of the License, or (at your option) any later version. 9 | * 10 | * This program is distributed in the hope that it will be useful, 11 | * but WITHOUT ANY WARRANTY; without even the implied warranty of 12 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 13 | * GNU Lesser General Public License for more details. 14 | * 15 | * You should have received a copy of the GNU Lesser General Public License 16 | * along with this program; if not, write to the Free Software 17 | * Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. 18 | *) 19 | -------------------------------------------------------------------------------- /toplevel/examples/eval/index.html: -------------------------------------------------------------------------------- 1 | 2 | 4 | 5 | 6 | 7 | 8 | 9 | 10 | 18 |
19 | 20 | 23 |
24 | 25 | 26 | 27 | 28 | 29 | -------------------------------------------------------------------------------- /compiler/lib-findlib-support/jsoo_findlib_support.mli: -------------------------------------------------------------------------------- 1 | (* Js_of_ocaml compiler 2 | * http://www.ocsigen.org/js_of_ocaml/ 3 | * Copyright (C) 2020 Hugo Heuzard 4 | * 5 | * This program is free software; you can redistribute it and/or modify 6 | * it under the terms of the GNU Lesser General Public License as published by 7 | * the Free Software Foundation, with linking exception; 8 | * either version 2.1 of the License, or (at your option) any later version. 9 | * 10 | * This program is distributed in the hope that it will be useful, 11 | * but WITHOUT ANY WARRANTY; without even the implied warranty of 12 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 13 | * GNU Lesser General Public License for more details. 14 | * 15 | * You should have received a copy of the GNU Lesser General Public License 16 | * along with this program; if not, write to the Free Software 17 | * Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. 18 | *) 19 | -------------------------------------------------------------------------------- /compiler/lib/js_assign.mli: -------------------------------------------------------------------------------- 1 | (* Js_of_ocaml compiler 2 | * http://www.ocsigen.org/js_of_ocaml/ 3 | * 4 | * This program is free software; you can redistribute it and/or modify 5 | * it under the terms of the GNU Lesser General Public License as published by 6 | * the Free Software Foundation, with linking exception; 7 | * either version 2.1 of the License, or (at your option) any later version. 8 | * 9 | * This program is distributed in the hope that it will be useful, 10 | * but WITHOUT ANY WARRANTY; without even the implied warranty of 11 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 12 | * GNU Lesser General Public License for more details. 13 | * 14 | * You should have received a copy of the GNU Lesser General Public License 15 | * along with this program; if not, write to the Free Software 16 | * Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. 17 | *) 18 | 19 | val program : Javascript.program -> Javascript.program 20 | -------------------------------------------------------------------------------- /ppx/ppx_js/lib/ppx_js_rewriter.mli: -------------------------------------------------------------------------------- 1 | (* Js_of_ocaml library 2 | * http://www.ocsigen.org/js_of_ocaml/ 3 | * 4 | * This program is free software; you can redistribute it and/or modify 5 | * it under the terms of the GNU Lesser General Public License as published by 6 | * the Free Software Foundation, with linking exception; 7 | * either version 2.1 of the License, or (at your option) any later version. 8 | * 9 | * This program is distributed in the hope that it will be useful, 10 | * but WITHOUT ANY WARRANTY; without even the implied warranty of 11 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 12 | * GNU Lesser General Public License for more details. 13 | * 14 | * You should have received a copy of the GNU Lesser General Public License 15 | * along with this program; if not, write to the Free Software 16 | * Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. 17 | *) 18 | 19 | (**/**) 20 | 21 | val mapper : Ast_mapper.mapper 22 | -------------------------------------------------------------------------------- /compiler/lib/constant.ml: -------------------------------------------------------------------------------- 1 | (* Js_of_ocaml compiler 2 | * http://www.ocsigen.org/js_of_ocaml/ 3 | * 4 | * This program is free software; you can redistribute it and/or modify 5 | * it under the terms of the GNU Lesser General Public License as published by 6 | * the Free Software Foundation, with linking exception; 7 | * either version 2.1 of the License, or (at your option) any later version. 8 | * 9 | * This program is distributed in the hope that it will be useful, 10 | * but WITHOUT ANY WARRANTY; without even the implied warranty of 11 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 12 | * GNU Lesser General Public License for more details. 13 | * 14 | * You should have received a copy of the GNU Lesser General Public License 15 | * along with this program; if not, write to the Free Software 16 | * Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. 17 | *) 18 | 19 | open! Stdlib 20 | 21 | let global_object = "joo_global_object" 22 | -------------------------------------------------------------------------------- /toplevel/examples/lwt_toplevel/colorize.fake.ml: -------------------------------------------------------------------------------- 1 | open Js_of_ocaml 2 | open Js_of_ocaml_tyxml 3 | 4 | let text ~a_class:cl s = Tyxml_js.Html.(span ~a:[ a_class [ cl ] ] [ txt s ]) 5 | 6 | let ocaml = text 7 | 8 | let highlight from_ to_ e = 9 | match Js.Opt.to_option e##.textContent with 10 | | None -> assert false 11 | | Some x -> 12 | let x = Js.to_string x in 13 | let (`Pos from_) = from_ in 14 | let to_ = 15 | match to_ with 16 | | `Pos n -> n 17 | | `Last -> String.length x - 1 18 | in 19 | e##.innerHTML := Js.string ""; 20 | let span kind s = 21 | if s <> "" 22 | then 23 | let span = Tyxml_js.Html.(span ~a:[ a_class [ kind ] ] [ txt s ]) in 24 | Dom.appendChild e (Tyxml_js.To_dom.of_element span) 25 | in 26 | span "normal" (String.sub x 0 from_); 27 | span "errorloc" (String.sub x from_ (to_ - from_)); 28 | span "normal" (String.sub x to_ (String.length x - to_)) 29 | -------------------------------------------------------------------------------- /compiler/tests-ocaml/lib-filename/suffix.ml: -------------------------------------------------------------------------------- 1 | (* TEST 2 | *) 3 | 4 | let () = 5 | let test ~suffix name exp = 6 | let r1 = Filename.chop_suffix_opt ~suffix name <> None in 7 | let r2 = Filename.check_suffix name suffix in 8 | assert (r1 = r2); 9 | assert (r1 = exp) 10 | in 11 | let full_test ~suffix name = 12 | test ~suffix name true; 13 | match Filename.chop_suffix_opt ~suffix name with 14 | | None -> assert false 15 | | Some base -> assert (base ^ suffix = name) 16 | in 17 | let win32 = Sys.os_type = "Win32" || Sys.os_type = "Cygwin" in 18 | full_test ~suffix:".txt" "foo.txt"; 19 | full_test ~suffix:"txt" "foo.txt"; 20 | full_test ~suffix:"" "foo.txt"; 21 | full_test ~suffix:"" ""; 22 | test ~suffix:".txt" "f" false; 23 | test ~suffix:".txt" "" false; 24 | test ~suffix:".txt" "foo.txt.bak" false; 25 | test ~suffix:".txt" "foo.TXT" win32; 26 | if win32 then 27 | assert (Filename.chop_suffix_opt ~suffix:".txt" "foo.TXT" = Some "foo") 28 | -------------------------------------------------------------------------------- /ppx/ppx_js/as-lib/ppx_js.ml: -------------------------------------------------------------------------------- 1 | (* Js_of_ocaml library 2 | * http://www.ocsigen.org/js_of_ocaml/ 3 | * 4 | * This program is free software; you can redistribute it and/or modify 5 | * it under the terms of the GNU Lesser General Public License as published by 6 | * the Free Software Foundation, with linking exception; 7 | * either version 2.1 of the License, or (at your option) any later version. 8 | * 9 | * This program is distributed in the hope that it will be useful, 10 | * but WITHOUT ANY WARRANTY; without even the implied warranty of 11 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 12 | * GNU Lesser General Public License for more details. 13 | * 14 | * You should have received a copy of the GNU Lesser General Public License 15 | * along with this program; if not, write to the Free Software 16 | * Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. 17 | *) 18 | 19 | include Ppx_js_internal 20 | 21 | let () = wrapper := Some "Js_of_ocaml" 22 | -------------------------------------------------------------------------------- /ppx/ppx_js/bin/main.ml: -------------------------------------------------------------------------------- 1 | (* Js_of_ocaml library 2 | * http://www.ocsigen.org/js_of_ocaml/ 3 | * Copyright (C) 2020 Hugo Heuzard 4 | * 5 | * This program is free software; you can redistribute it and/or modify 6 | * it under the terms of the GNU Lesser General Public License as published by 7 | * the Free Software Foundation, with linking exception; 8 | * either version 2.1 of the License, or (at your option) any later version. 9 | * 10 | * This program is distributed in the hope that it will be useful, 11 | * but WITHOUT ANY WARRANTY; without even the implied warranty of 12 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 13 | * GNU Lesser General Public License for more details. 14 | * 15 | * You should have received a copy of the GNU Lesser General Public License 16 | * along with this program; if not, write to the Free Software 17 | * Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. 18 | *) 19 | 20 | let () = Ppxlib.Driver.standalone () 21 | -------------------------------------------------------------------------------- /toplevel/lib/js_of_ocaml_toplevel.ml: -------------------------------------------------------------------------------- 1 | (* Js_of_ocaml library 2 | * http://www.ocsigen.org/js_of_ocaml/ 3 | * Copyright (C) 2017 Hugo Heuzard 4 | * 5 | * This program is free software; you can redistribute it and/or modify 6 | * it under the terms of the GNU Lesser General Public License as published by 7 | * the Free Software Foundation, with linking exception; 8 | * either version 2.1 of the License, or (at your option) any later version. 9 | * 10 | * This program is distributed in the hope that it will be useful, 11 | * but WITHOUT ANY WARRANTY; without even the implied warranty of 12 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 13 | * GNU Lesser General Public License for more details. 14 | * 15 | * You should have received a copy of the GNU Lesser General Public License 16 | * along with this program; if not, write to the Free Software 17 | * Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. 18 | *) 19 | 20 | module JsooTop = JsooTop 21 | -------------------------------------------------------------------------------- /toplevel/lib/jsooTopError.mli: -------------------------------------------------------------------------------- 1 | (* Js_of_ocaml library 2 | * http://www.ocsigen.org/js_of_ocaml/ 3 | * Copyright (C) 2017 Hugo Heuzard 4 | * 5 | * This program is free software; you can redistribute it and/or modify 6 | * it under the terms of the GNU Lesser General Public License as published by 7 | * the Free Software Foundation, with linking exception; 8 | * either version 2.1 of the License, or (at your option) any later version. 9 | * 10 | * This program is distributed in the hope that it will be useful, 11 | * but WITHOUT ANY WARRANTY; without even the implied warranty of 12 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 13 | * GNU Lesser General Public License for more details. 14 | * 15 | * You should have received a copy of the GNU Lesser General Public License 16 | * along with this program; if not, write to the Free Software 17 | * Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. 18 | *) 19 | 20 | val loc : exn -> Location.t option 21 | -------------------------------------------------------------------------------- /compiler/lib/annot_lexer.mli: -------------------------------------------------------------------------------- 1 | (* Js_of_ocaml compiler 2 | * http://www.ocsigen.org/js_of_ocaml/ 3 | * Copyright (C) 2013 Hugo Heuzard 4 | * 5 | * This program is free software; you can redistribute it and/or modify 6 | * it under the terms of the GNU Lesser General Public License as published by 7 | * the Free Software Foundation, with linking exception; 8 | * either version 2.1 of the License, or (at your option) any later version. 9 | * 10 | * This program is distributed in the hope that it will be useful, 11 | * but WITHOUT ANY WARRANTY; without even the implied warranty of 12 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 13 | * GNU Lesser General Public License for more details. 14 | * 15 | * You should have received a copy of the GNU Lesser General Public License 16 | * along with this program; if not, write to the Free Software 17 | * Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. 18 | *) 19 | 20 | val main : Lexing.lexbuf -> Annot_parser.token 21 | -------------------------------------------------------------------------------- /compiler/lib/dune: -------------------------------------------------------------------------------- 1 | (library 2 | (name js_of_ocaml_compiler) 3 | (public_name js_of_ocaml-compiler) 4 | (synopsis "Js_of_ocaml compiler library") 5 | (libraries 6 | compiler-libs.common 7 | compiler-libs.bytecomp 8 | bytes 9 | menhirLib 10 | (select 11 | source_map_io.ml 12 | from 13 | (yojson -> source_map_io.yojson.ml) 14 | (-> source_map_io.unsupported.ml))) 15 | (flags 16 | (:standard -w -7-37 -safe-string)) 17 | (preprocess 18 | (pps ppx_optcomp_light))) 19 | 20 | (ocamllex js_lexer annot_lexer) 21 | 22 | (menhir 23 | (modules js_parser) 24 | (flags 25 | --table 26 | --external-tokens 27 | Js_token 28 | --explain 29 | --unused-token 30 | TComment 31 | --unused-token 32 | TCommentLineDirective 33 | --unused-token 34 | TUnknown)) 35 | 36 | (menhir 37 | (modules annot_parser) 38 | (flags --explain)) 39 | 40 | (rule 41 | (targets compiler_version.ml) 42 | (deps 43 | (:input-file ../../version.ml.in)) 44 | (action 45 | (copy %{input-file} %{targets}))) 46 | -------------------------------------------------------------------------------- /examples/boulderdash/maps/level4.map: -------------------------------------------------------------------------------- 1 | ######################################## 2 | #...... ..+.X .....X.X....... ....X....# 3 | #.XSX...... .........X+..X.... ..... ..# 4 | #.......... ..X.....X.X..X........X....# 5 | #X.XX.........X......X..X....X...X.....# 6 | #X. X......... X..X........X......X.XX.# 7 | #... ..X........X.....X. X........X.XX.# 8 | ###############################...X..X.# 9 | #. ...X..+. ..X.X..........+.X+...... .# 10 | #..+.....X..... ........XX X..X....X...# 11 | #...X..X.X..............X .X..X........# 12 | #.X.....X........XXX.......X.. .+....X.# 13 | #.+.. ..X. .....X.X+..+....X...X..+. .# 14 | #. X..............X X..X........+.....X# 15 | #........############################### 16 | # X.........X...+....X.....X...X.......# 17 | # X......... X..X........X......X.XX..E# 18 | #. ..X........X.....X. ....+...X.XX...# 19 | #....X+..X........X......X.X+......X...# 20 | #... ..X. ..X.XX.........X.X+...... ..X# 21 | #.+.... ..... ......... .X..X....X...X.# 22 | ######################################## 23 | -------------------------------------------------------------------------------- /examples/graph_viewer/dot_render.mli: -------------------------------------------------------------------------------- 1 | (* Graph viewer 2 | * Copyright (C) 2010 Jérôme Vouillon 3 | * Laboratoire PPS - CNRS Université Paris Diderot 4 | * 5 | * This program is free software; you can redistribute it and/or modify 6 | * it under the terms of the GNU General Public License as published by 7 | * the Free Software Foundation; either version 2 of the License, or 8 | * (at your option) any later version. 9 | * 10 | * This program is distributed in the hope that it will be useful, 11 | * but WITHOUT ANY WARRANTY; without even the implied warranty of 12 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 13 | * GNU Lesser General Public License for more details. 14 | * 15 | * You should have received a copy of the GNU Lesser General Public License 16 | * along with this program; if not, write to the Free Software 17 | * Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. 18 | *) 19 | 20 | val f : Dot_graph.graph -> (float * float * float * float) * Scene.cairo_t 21 | -------------------------------------------------------------------------------- /toplevel/test/dune: -------------------------------------------------------------------------------- 1 | (executables 2 | (names test_toplevel) 3 | (libraries js_of_ocaml js_of_ocaml_toplevel) 4 | (flags 5 | (:standard -linkall)) 6 | (modes byte)) 7 | 8 | (rule 9 | (targets export.txt) 10 | (deps 11 | (package js_of_ocaml-toplevel)) 12 | (action 13 | (run jsoo_listunits -o %{targets} stdlib js_of_ocaml-toplevel))) 14 | 15 | (rule 16 | (targets test_toplevel.js) 17 | (action 18 | (run 19 | %{bin:js_of_ocaml} 20 | -I 21 | . 22 | --export 23 | %{dep:export.txt} 24 | --toplevel 25 | --disable 26 | shortvar 27 | +toplevel.js 28 | +dynlink.js 29 | %{dep:test_toplevel.bc} 30 | -o 31 | %{targets}))) 32 | 33 | (rule 34 | (target test_toplevel.referencejs) 35 | (deps test_toplevel.js) 36 | (action 37 | (with-stdout-to 38 | %{target} 39 | (run node ./test_toplevel.js)))) 40 | 41 | (rule 42 | (alias runtest) 43 | (deps test_toplevel.reference test_toplevel.referencejs) 44 | (action 45 | (diff test_toplevel.reference test_toplevel.referencejs))) 46 | -------------------------------------------------------------------------------- /compiler/bin-js_of_ocaml/link.mli: -------------------------------------------------------------------------------- 1 | (* Js_of_ocaml compiler 2 | * http://www.ocsigen.org/js_of_ocaml/ 3 | * Copyright (C) 2020 Hugo Heuzard 4 | * 5 | * This program is free software; you can redistribute it and/or modify 6 | * it under the terms of the GNU Lesser General Public License as published by 7 | * the Free Software Foundation, with linking exception; 8 | * either version 2.1 of the License, or (at your option) any later version. 9 | * 10 | * This program is distributed in the hope that it will be useful, 11 | * but WITHOUT ANY WARRANTY; without even the implied warranty of 12 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 13 | * GNU Lesser General Public License for more details. 14 | * 15 | * You should have received a copy of the GNU Lesser General Public License 16 | * along with this program; if not, write to the Free Software 17 | * Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. 18 | *) 19 | 20 | val command : unit Cmdliner.Term.t * Cmdliner.Term.info 21 | -------------------------------------------------------------------------------- /compiler/bin-js_of_ocaml/build_fs.mli: -------------------------------------------------------------------------------- 1 | (* Js_of_ocaml compiler 2 | * http://www.ocsigen.org/js_of_ocaml/ 3 | * Copyright (C) 2020 Hugo Heuzard 4 | * 5 | * This program is free software; you can redistribute it and/or modify 6 | * it under the terms of the GNU Lesser General Public License as published by 7 | * the Free Software Foundation, with linking exception; 8 | * either version 2.1 of the License, or (at your option) any later version. 9 | * 10 | * This program is distributed in the hope that it will be useful, 11 | * but WITHOUT ANY WARRANTY; without even the implied warranty of 12 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 13 | * GNU Lesser General Public License for more details. 14 | * 15 | * You should have received a copy of the GNU Lesser General Public License 16 | * along with this program; if not, write to the Free Software 17 | * Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. 18 | *) 19 | 20 | val command : unit Cmdliner.Term.t * Cmdliner.Term.info 21 | -------------------------------------------------------------------------------- /compiler/lib/macro.mli: -------------------------------------------------------------------------------- 1 | (* Js_of_ocaml compiler 2 | * http://www.ocsigen.org/js_of_ocaml/ 3 | * Copyright (C) 2019 Ty Overby, Jane Street Group LLC 4 | * 5 | * This program is free software; you can redistribute it and/or modify 6 | * it under the terms of the GNU Lesser General Public License as published by 7 | * the Free Software Foundation, with linking exception; 8 | * either version 2.1 of the License, or (at your option) any later version. 9 | * 10 | * This program is distributed in the hope that it will be useful, 11 | * but WITHOUT ANY WARRANTY; without even the implied warranty of 12 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 13 | * GNU Lesser General Public License for more details. 14 | * 15 | * You should have received a copy of the GNU Lesser General Public License 16 | * along with this program; if not, write to the Free Software 17 | * Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. 18 | *) 19 | 20 | val f : Javascript.program -> Javascript.program 21 | -------------------------------------------------------------------------------- /examples/graph_viewer/dot_lexer.mli: -------------------------------------------------------------------------------- 1 | (* Graph viewer 2 | * Copyright (C) 2010 Jérôme Vouillon 3 | * Laboratoire PPS - CNRS Université Paris Diderot 4 | * 5 | * This program is free software; you can redistribute it and/or modify 6 | * it under the terms of the GNU General Public License as published by 7 | * the Free Software Foundation; either version 2 of the License, or 8 | * (at your option) any later version. 9 | * 10 | * This program is distributed in the hope that it will be useful, 11 | * but WITHOUT ANY WARRANTY; without even the implied warranty of 12 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 13 | * GNU Lesser General Public License for more details. 14 | * 15 | * You should have received a copy of the GNU Lesser General Public License 16 | * along with this program; if not, write to the Free Software 17 | * Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. 18 | *) 19 | 20 | val reset : unit -> unit 21 | 22 | val token : Lexing.lexbuf -> Dot_parser.token 23 | -------------------------------------------------------------------------------- /examples/graph_viewer/viewer.mli: -------------------------------------------------------------------------------- 1 | (* Graph viewer 2 | * Copyright (C) 2010 Jérôme Vouillon 3 | * Laboratoire PPS - CNRS Université Paris Diderot 4 | * 5 | * This program is free software; you can redistribute it and/or modify 6 | * it under the terms of the GNU General Public License as published by 7 | * the Free Software Foundation; either version 2 of the License, or 8 | * (at your option) any later version. 9 | * 10 | * This program is distributed in the hope that it will be useful, 11 | * but WITHOUT ANY WARRANTY; without even the implied warranty of 12 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 13 | * GNU Lesser General Public License for more details. 14 | * 15 | * You should have received a copy of the GNU Lesser General Public License 16 | * along with this program; if not, write to the Free Software 17 | * Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. 18 | *) 19 | 20 | val create : ?full_screen:bool -> float * float * float * float -> Scene.cairo_t -> unit 21 | -------------------------------------------------------------------------------- /ppx/ppx_js/lib_internal/ppx_js_internal.mli: -------------------------------------------------------------------------------- 1 | (* Js_of_ocaml library 2 | * http://www.ocsigen.org/js_of_ocaml/ 3 | * 4 | * This program is free software; you can redistribute it and/or modify 5 | * it under the terms of the GNU Lesser General Public License as published by 6 | * the Free Software Foundation, with linking exception; 7 | * either version 2.1 of the License, or (at your option) any later version. 8 | * 9 | * This program is distributed in the hope that it will be useful, 10 | * but WITHOUT ANY WARRANTY; without even the implied warranty of 11 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 12 | * GNU Lesser General Public License for more details. 13 | * 14 | * You should have received a copy of the GNU Lesser General Public License 15 | * along with this program; if not, write to the Free Software 16 | * Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. 17 | *) 18 | 19 | (**/**) 20 | 21 | val wrapper : string option ref 22 | 23 | val mapper : Ast_mapper.mapper 24 | -------------------------------------------------------------------------------- /compiler/bin-js_of_ocaml/build_runtime.mli: -------------------------------------------------------------------------------- 1 | (* Js_of_ocaml compiler 2 | * http://www.ocsigen.org/js_of_ocaml/ 3 | * Copyright (C) 2020 Hugo Heuzard 4 | * 5 | * This program is free software; you can redistribute it and/or modify 6 | * it under the terms of the GNU Lesser General Public License as published by 7 | * the Free Software Foundation, with linking exception; 8 | * either version 2.1 of the License, or (at your option) any later version. 9 | * 10 | * This program is distributed in the hope that it will be useful, 11 | * but WITHOUT ANY WARRANTY; without even the implied warranty of 12 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 13 | * GNU Lesser General Public License for more details. 14 | * 15 | * You should have received a copy of the GNU Lesser General Public License 16 | * along with this program; if not, write to the Free Software 17 | * Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. 18 | *) 19 | 20 | val command : unit Cmdliner.Term.t * Cmdliner.Term.info 21 | -------------------------------------------------------------------------------- /compiler/bin-js_of_ocaml/print_runtime.mli: -------------------------------------------------------------------------------- 1 | (* Js_of_ocaml compiler 2 | * http://www.ocsigen.org/js_of_ocaml/ 3 | * Copyright (C) 2020 Hugo Heuzard 4 | * 5 | * This program is free software; you can redistribute it and/or modify 6 | * it under the terms of the GNU Lesser General Public License as published by 7 | * the Free Software Foundation, with linking exception; 8 | * either version 2.1 of the License, or (at your option) any later version. 9 | * 10 | * This program is distributed in the hope that it will be useful, 11 | * but WITHOUT ANY WARRANTY; without even the implied warranty of 12 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 13 | * GNU Lesser General Public License for more details. 14 | * 15 | * You should have received a copy of the GNU Lesser General Public License 16 | * along with this program; if not, write to the Free Software 17 | * Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. 18 | *) 19 | 20 | val command : unit Cmdliner.Term.t * Cmdliner.Term.info 21 | -------------------------------------------------------------------------------- /compiler/lib/reserved.mli: -------------------------------------------------------------------------------- 1 | (* Js_of_ocaml compiler 2 | * http://www.ocsigen.org/js_of_ocaml/ 3 | * Copyright (C) 2013 Hugo Heuzard 4 | * 5 | * This program is free software; you can redistribute it and/or modify 6 | * it under the terms of the GNU Lesser General Public License as published by 7 | * the Free Software Foundation, with linking exception; 8 | * either version 2.1 of the License, or (at your option) any later version. 9 | * 10 | * This program is distributed in the hope that it will be useful, 11 | * but WITHOUT ANY WARRANTY; without even the implied warranty of 12 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 13 | * GNU Lesser General Public License for more details. 14 | * 15 | * You should have received a copy of the GNU Lesser General Public License 16 | * along with this program; if not, write to the Free Software 17 | * Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. 18 | *) 19 | open Stdlib 20 | 21 | val keyword : StringSet.t 22 | 23 | val provided : StringSet.t 24 | -------------------------------------------------------------------------------- /compiler/bin-js_of_ocaml/info.mli: -------------------------------------------------------------------------------- 1 | (* Js_of_ocaml compiler 2 | * http://www.ocsigen.org/js_of_ocaml/ 3 | * Copyright (C) 2020 Hugo Heuzard 4 | * 5 | * This program is free software; you can redistribute it and/or modify 6 | * it under the terms of the GNU Lesser General Public License as published by 7 | * the Free Software Foundation, with linking exception; 8 | * either version 2.1 of the License, or (at your option) any later version. 9 | * 10 | * This program is distributed in the hope that it will be useful, 11 | * but WITHOUT ANY WARRANTY; without even the implied warranty of 12 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 13 | * GNU Lesser General Public License for more details. 14 | * 15 | * You should have received a copy of the GNU Lesser General Public License 16 | * along with this program; if not, write to the Free Software 17 | * Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. 18 | *) 19 | 20 | val make : name:string -> doc:string -> description:string -> Cmdliner.Term.info 21 | -------------------------------------------------------------------------------- /compiler/lib/fs.mli: -------------------------------------------------------------------------------- 1 | (* Js_of_ocaml compiler 2 | * http://www.ocsigen.org/js_of_ocaml/ 3 | * 4 | * This program is free software; you can redistribute it and/or modify 5 | * it under the terms of the GNU Lesser General Public License as published by 6 | * the Free Software Foundation, with linking exception; 7 | * either version 2.1 of the License, or (at your option) any later version. 8 | * 9 | * This program is distributed in the hope that it will be useful, 10 | * but WITHOUT ANY WARRANTY; without even the implied warranty of 11 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 12 | * GNU Lesser General Public License for more details. 13 | * 14 | * You should have received a copy of the GNU Lesser General Public License 15 | * along with this program; if not, write to the Free Software 16 | * Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. 17 | *) 18 | 19 | val find_in_path : string list -> string -> string 20 | 21 | val absolute_path : string -> string 22 | 23 | val read_file : string -> string 24 | -------------------------------------------------------------------------------- /compiler/lib/phisimpl.mli: -------------------------------------------------------------------------------- 1 | (* Js_of_ocaml compiler 2 | * http://www.ocsigen.org/js_of_ocaml/ 3 | * Copyright (C) 2010 Jérôme Vouillon 4 | * Laboratoire PPS - CNRS Université Paris Diderot 5 | * 6 | * This program is free software; you can redistribute it and/or modify 7 | * it under the terms of the GNU Lesser General Public License as published by 8 | * the Free Software Foundation, with linking exception; 9 | * either version 2.1 of the License, or (at your option) any later version. 10 | * 11 | * This program is distributed in the hope that it will be useful, 12 | * but WITHOUT ANY WARRANTY; without even the implied warranty of 13 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 14 | * GNU Lesser General Public License for more details. 15 | * 16 | * You should have received a copy of the GNU Lesser General Public License 17 | * along with this program; if not, write to the Free Software 18 | * Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. 19 | *) 20 | 21 | val f : Code.program -> Code.program 22 | -------------------------------------------------------------------------------- /compiler/lib/tailcall.mli: -------------------------------------------------------------------------------- 1 | (* Js_of_ocaml compiler 2 | * http://www.ocsigen.org/js_of_ocaml/ 3 | * Copyright (C) 2010 Jérôme Vouillon 4 | * Laboratoire PPS - CNRS Université Paris Diderot 5 | * 6 | * This program is free software; you can redistribute it and/or modify 7 | * it under the terms of the GNU Lesser General Public License as published by 8 | * the Free Software Foundation, with linking exception; 9 | * either version 2.1 of the License, or (at your option) any later version. 10 | * 11 | * This program is distributed in the hope that it will be useful, 12 | * but WITHOUT ANY WARRANTY; without even the implied warranty of 13 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 14 | * GNU Lesser General Public License for more details. 15 | * 16 | * You should have received a copy of the GNU Lesser General Public License 17 | * along with this program; if not, write to the Free Software 18 | * Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. 19 | *) 20 | 21 | val f : Code.program -> Code.program 22 | -------------------------------------------------------------------------------- /manual/dune: -------------------------------------------------------------------------------- 1 | (rule 2 | (alias ocsigen-doc) 3 | (deps 4 | (alias_rec ../examples/default) 5 | (alias ../toplevel/examples/lwt_toplevel/default) 6 | (source_tree ../examples) 7 | (source_tree ../toplevel/examples/lwt_toplevel) 8 | (glob_files *wiki) 9 | (source_tree files)) 10 | (action 11 | (bash 12 | "function copy { src=$1; shift; dst=$1; shift; mkdir -p files/$dst; cp -R ${@/#/$src/} files/$dst; }; copy ../toplevel/examples/lwt_toplevel toplevel index.html toplevel.js test_dynlink.js; copy ../examples/boulderdash boulderdash index.html boulderdash.js sprites; copy ../examples/webgl webgl index.html webgldemo.js; copy ../examples/graph_viewer graph_viewer index.html viewer_js.js; copy ../examples/planet planet index.html texture.jpg planet.js; copy ../examples/wiki wiki index.html main.js; copy ../examples/wysiwyg wysiwyg index.html main.js; copy ../examples/hyperbolic hyperbolic index.html hypertree.js icons thumbnails; copy ../examples/minesweeper minesweeper index.html main.js sprites; copy ../examples/cubes cubes index.html cubes.js; "))) 13 | -------------------------------------------------------------------------------- /compiler/lib/deadcode.mli: -------------------------------------------------------------------------------- 1 | (* Js_of_ocaml compiler 2 | * http://www.ocsigen.org/js_of_ocaml/ 3 | * Copyright (C) 2010 Jérôme Vouillon 4 | * Laboratoire PPS - CNRS Université Paris Diderot 5 | * 6 | * This program is free software; you can redistribute it and/or modify 7 | * it under the terms of the GNU Lesser General Public License as published by 8 | * the Free Software Foundation, with linking exception; 9 | * either version 2.1 of the License, or (at your option) any later version. 10 | * 11 | * This program is distributed in the hope that it will be useful, 12 | * but WITHOUT ANY WARRANTY; without even the implied warranty of 13 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 14 | * GNU Lesser General Public License for more details. 15 | * 16 | * You should have received a copy of the GNU Lesser General Public License 17 | * along with this program; if not, write to the Free Software 18 | * Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. 19 | *) 20 | 21 | val f : Code.program -> Code.program * int array 22 | -------------------------------------------------------------------------------- /compiler/lib/inline.mli: -------------------------------------------------------------------------------- 1 | (* Js_of_ocaml compiler 2 | * http://www.ocsigen.org/js_of_ocaml/ 3 | * Copyright (C) 2010 Jérôme Vouillon 4 | * Laboratoire PPS - CNRS Université Paris Diderot 5 | * 6 | * This program is free software; you can redistribute it and/or modify 7 | * it under the terms of the GNU Lesser General Public License as published by 8 | * the Free Software Foundation, with linking exception; 9 | * either version 2.1 of the License, or (at your option) any later version. 10 | * 11 | * This program is distributed in the hope that it will be useful, 12 | * but WITHOUT ANY WARRANTY; without even the implied warranty of 13 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 14 | * GNU Lesser General Public License for more details. 15 | * 16 | * You should have received a copy of the GNU Lesser General Public License 17 | * along with this program; if not, write to the Free Software 18 | * Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. 19 | *) 20 | 21 | val f : Code.program -> int array -> Code.program 22 | -------------------------------------------------------------------------------- /compiler/lib/vlq64.mli: -------------------------------------------------------------------------------- 1 | (* Js_of_ocaml compiler 2 | * http://www.ocsigen.org/js_of_ocaml/ 3 | * Copyright (C) 2013 Hugo Heuzard 4 | * 5 | * This program is free software; you can redistribute it and/or modify 6 | * it under the terms of the GNU Lesser General Public License as published by 7 | * the Free Software Foundation, with linking exception; 8 | * either version 2.1 of the License, or (at your option) any later version. 9 | * 10 | * This program is distributed in the hope that it will be useful, 11 | * but WITHOUT ANY WARRANTY; without even the implied warranty of 12 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 13 | * GNU Lesser General Public License for more details. 14 | * 15 | * You should have received a copy of the GNU Lesser General Public License 16 | * along with this program; if not, write to the Free Software 17 | * Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. 18 | *) 19 | 20 | val encode_l : Buffer.t -> int list -> unit 21 | 22 | val decode_l : string -> pos:int -> len:int -> int list 23 | -------------------------------------------------------------------------------- /ppx/ppx_deriving_json/tests/dune: -------------------------------------------------------------------------------- 1 | (executables 2 | (names main) 3 | (libraries 4 | ppxlib 5 | toplevel_expect_test 6 | js_of_ocaml.deriving 7 | js_of_ocaml-ppx_deriving_json) 8 | (modes byte) 9 | (link_flags (-linkall))) 10 | 11 | (rule 12 | (targets ppx.mlt.corrected) 13 | (deps 14 | ../../../lib/deriving_json/.js_of_ocaml_deriving.objs/byte/deriving_Json.cmi 15 | ../../../lib/deriving_json/.js_of_ocaml_deriving.objs/byte/deriving_Json_lexer.cmi) 16 | (action 17 | (run %{exe:main.bc} %{dep:ppx.mlt}))) 18 | 19 | (rule 20 | (targets gen.mlt.corrected) 21 | (deps 22 | ../../../lib/deriving_json/.js_of_ocaml_deriving.objs/byte/deriving_Json.cmi 23 | ../../../lib/deriving_json/.js_of_ocaml_deriving.objs/byte/deriving_Json_lexer.cmi) 24 | (action 25 | (run %{exe:main.bc} %{dep:gen.mlt}))) 26 | 27 | (rule 28 | (alias runtest) 29 | ;; (package js_of_ocaml-ppx) 30 | (action 31 | (diff ppx.mlt ppx.mlt.corrected))) 32 | 33 | (rule 34 | (alias runtest) 35 | ;; (package js_of_ocaml-ppx) 36 | (action 37 | (diff gen.mlt gen.mlt.corrected))) 38 | -------------------------------------------------------------------------------- /compiler/lib/generate_closure.mli: -------------------------------------------------------------------------------- 1 | (* Js_of_ocaml compiler 2 | * http://www.ocsigen.org/js_of_ocaml/ 3 | * Copyright (C) 2010 Jérôme Vouillon 4 | * Laboratoire PPS - CNRS Université Paris Diderot 5 | * 6 | * This program is free software; you can redistribute it and/or modify 7 | * it under the terms of the GNU Lesser General Public License as published by 8 | * the Free Software Foundation, with linking exception; 9 | * either version 2.1 of the License, or (at your option) any later version. 10 | * 11 | * This program is distributed in the hope that it will be useful, 12 | * but WITHOUT ANY WARRANTY; without even the implied warranty of 13 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 14 | * GNU Lesser General Public License for more details. 15 | * 16 | * You should have received a copy of the GNU Lesser General Public License 17 | * along with this program; if not, write to the Free Software 18 | * Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. 19 | *) 20 | 21 | open Code 22 | 23 | val f : program -> program 24 | -------------------------------------------------------------------------------- /compiler/lib/specialize.mli: -------------------------------------------------------------------------------- 1 | (* Js_of_ocaml compiler 2 | * http://www.ocsigen.org/js_of_ocaml/ 3 | * Copyright (C) 2010 Jérôme Vouillon 4 | * Laboratoire PPS - CNRS Université Paris Diderot 5 | * 6 | * This program is free software; you can redistribute it and/or modify 7 | * it under the terms of the GNU Lesser General Public License as published by 8 | * the Free Software Foundation, with linking exception; 9 | * either version 2.1 of the License, or (at your option) any later version. 10 | * 11 | * This program is distributed in the hope that it will be useful, 12 | * but WITHOUT ANY WARRANTY; without even the implied warranty of 13 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 14 | * GNU Lesser General Public License for more details. 15 | * 16 | * You should have received a copy of the GNU Lesser General Public License 17 | * along with this program; if not, write to the Free Software 18 | * Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. 19 | *) 20 | 21 | val f : Flow.info -> Code.program -> Code.program 22 | -------------------------------------------------------------------------------- /lib/tyxml/js_of_ocaml_tyxml.ml: -------------------------------------------------------------------------------- 1 | (* Js_of_ocaml library 2 | * http://www.ocsigen.org/js_of_ocaml/ 3 | * Copyright (C) 2017 Hugo Heuzard 4 | * 5 | * This program is free software; you can redistribute it and/or modify 6 | * it under the terms of the GNU Lesser General Public License as published by 7 | * the Free Software Foundation, with linking exception; 8 | * either version 2.1 of the License, or (at your option) any later version. 9 | * 10 | * This program is distributed in the hope that it will be useful, 11 | * but WITHOUT ANY WARRANTY; without even the implied warranty of 12 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 13 | * GNU Lesser General Public License for more details. 14 | * 15 | * You should have received a copy of the GNU Lesser General Public License 16 | * along with this program; if not, write to the Free Software 17 | * Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. 18 | *) 19 | 20 | module Tyxml_js = Tyxml_js 21 | module Tyxml_cast = Tyxml_cast 22 | module Tyxml_cast_sigs = Tyxml_cast_sigs 23 | -------------------------------------------------------------------------------- /compiler/lib/compiler_version.mli: -------------------------------------------------------------------------------- 1 | (* Js_of_ocaml compiler 2 | * http://www.ocsigen.org/js_of_ocaml/ 3 | * Copyright (C) 2014 Jérôme Vouillon 4 | * Laboratoire PPS - CNRS Université Paris Diderot 5 | * 6 | * This program is free software; you can redistribute it and/or modify 7 | * it under the terms of the GNU Lesser General Public License as published by 8 | * the Free Software Foundation, with linking exception; 9 | * either version 2.1 of the License, or (at your option) any later version. 10 | * 11 | * This program is distributed in the hope that it will be useful, 12 | * but WITHOUT ANY WARRANTY; without even the implied warranty of 13 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 14 | * GNU Lesser General Public License for more details. 15 | * 16 | * You should have received a copy of the GNU Lesser General Public License 17 | * along with this program; if not, write to the Free Software 18 | * Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. 19 | *) 20 | 21 | val s : string 22 | 23 | val git_version : string 24 | -------------------------------------------------------------------------------- /compiler/lib/timer.mli: -------------------------------------------------------------------------------- 1 | (* Js_of_ocaml compiler 2 | * http://www.ocsigen.org/js_of_ocaml/ 3 | * 4 | * This program is free software; you can redistribute it and/or modify 5 | * it under the terms of the GNU Lesser General Public License as published by 6 | * the Free Software Foundation, with linking exception; 7 | * either version 2.1 of the License, or (at your option) any later version. 8 | * 9 | * This program is distributed in the hope that it will be useful, 10 | * but WITHOUT ANY WARRANTY; without even the implied warranty of 11 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 12 | * GNU Lesser General Public License for more details. 13 | * 14 | * You should have received a copy of the GNU Lesser General Public License 15 | * along with this program; if not, write to the Free Software 16 | * Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. 17 | *) 18 | 19 | type t 20 | 21 | val init : (unit -> float) -> unit 22 | 23 | val make : unit -> t 24 | 25 | val get : t -> float 26 | 27 | val print : Format.formatter -> t -> unit 28 | -------------------------------------------------------------------------------- /compiler/lib/freevars.mli: -------------------------------------------------------------------------------- 1 | (* Js_of_ocaml compiler 2 | * http://www.ocsigen.org/js_of_ocaml/ 3 | * Copyright (C) 2010 Jérôme Vouillon 4 | * Laboratoire PPS - CNRS Université Paris Diderot 5 | * 6 | * This program is free software; you can redistribute it and/or modify 7 | * it under the terms of the GNU Lesser General Public License as published by 8 | * the Free Software Foundation, with linking exception; 9 | * either version 2.1 of the License, or (at your option) any later version. 10 | * 11 | * This program is distributed in the hope that it will be useful, 12 | * but WITHOUT ANY WARRANTY; without even the implied warranty of 13 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 14 | * GNU Lesser General Public License for more details. 15 | * 16 | * You should have received a copy of the GNU Lesser General Public License 17 | * along with this program; if not, write to the Free Software 18 | * Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. 19 | *) 20 | open! Stdlib 21 | 22 | val f : Code.program -> Code.Var.Set.t Code.Addr.Map.t 23 | -------------------------------------------------------------------------------- /examples/graph_viewer/scene_extents.mli: -------------------------------------------------------------------------------- 1 | (* Graph viewer 2 | * Copyright (C) 2010 Jérôme Vouillon 3 | * Laboratoire PPS - CNRS Université Paris Diderot 4 | * 5 | * This program is free software; you can redistribute it and/or modify 6 | * it under the terms of the GNU General Public License as published by 7 | * the Free Software Foundation; either version 2 of the License, or 8 | * (at your option) any later version. 9 | * 10 | * This program is distributed in the hope that it will be useful, 11 | * but WITHOUT ANY WARRANTY; without even the implied warranty of 12 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 13 | * GNU Lesser General Public License for more details. 14 | * 15 | * You should have received a copy of the GNU Lesser General Public License 16 | * along with this program; if not, write to the Free Software 17 | * Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. 18 | *) 19 | 20 | val compute : 21 | Cairo.t 22 | -> ('color, string * float, string) Scene.element array 23 | -> (float * float * float * float) array 24 | -------------------------------------------------------------------------------- /compiler/bin-js_of_ocaml/compile.mli: -------------------------------------------------------------------------------- 1 | (* Js_of_ocaml compiler 2 | * http://www.ocsigen.org/js_of_ocaml/ 3 | * 4 | * This program is free software; you can redistribute it and/or modify 5 | * it under the terms of the GNU Lesser General Public License as published by 6 | * the Free Software Foundation, with linking exception; 7 | * either version 2.1 of the License, or (at your option) any later version. 8 | * 9 | * This program is distributed in the hope that it will be useful, 10 | * but WITHOUT ANY WARRANTY; without even the implied warranty of 11 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 12 | * GNU Lesser General Public License for more details. 13 | * 14 | * You should have received a copy of the GNU Lesser General Public License 15 | * along with this program; if not, write to the Free Software 16 | * Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. 17 | *) 18 | 19 | val run : Cmd_arg.t -> unit 20 | 21 | val command : unit Cmdliner.Term.t * Cmdliner.Term.info 22 | 23 | val command_main : unit Cmdliner.Term.t * Cmdliner.Term.info 24 | -------------------------------------------------------------------------------- /compiler/lib/eval.mli: -------------------------------------------------------------------------------- 1 | (* Js_of_ocaml compiler 2 | * http://www.ocsigen.org/js_of_ocaml/ 3 | * Copyright (C) 2013 Hugo Heuzard 4 | * 5 | * This program is free software; you can redistribute it and/or modify 6 | * it under the terms of the GNU Lesser General Public License as published by 7 | * the Free Software Foundation, with linking exception; 8 | * either version 2.1 of the License, or (at your option) any later version. 9 | * 10 | * This program is distributed in the hope that it will be useful, 11 | * but WITHOUT ANY WARRANTY; without even the implied warranty of 12 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 13 | * GNU Lesser General Public License for more details. 14 | * 15 | * You should have received a copy of the GNU Lesser General Public License 16 | * along with this program; if not, write to the Free Software 17 | * Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. 18 | *) 19 | 20 | val clear_static_env : unit -> unit 21 | 22 | val set_static_env : string -> string -> unit 23 | 24 | val f : Flow.info -> Code.program -> Code.program 25 | -------------------------------------------------------------------------------- /compiler/lib/js_output.mli: -------------------------------------------------------------------------------- 1 | (* Js_of_ocaml compiler 2 | * http://www.ocsigen.org/js_of_ocaml/ 3 | * Copyright (C) 2010 Jérôme Vouillon 4 | * Laboratoire PPS - CNRS Université Paris Diderot 5 | * 6 | * This program is free software; you can redistribute it and/or modify 7 | * it under the terms of the GNU Lesser General Public License as published by 8 | * the Free Software Foundation, with linking exception; 9 | * either version 2.1 of the License, or (at your option) any later version. 10 | * 11 | * This program is distributed in the hope that it will be useful, 12 | * but WITHOUT ANY WARRANTY; without even the implied warranty of 13 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 14 | * GNU Lesser General Public License for more details. 15 | * 16 | * You should have received a copy of the GNU Lesser General Public License 17 | * along with this program; if not, write to the Free Software 18 | * Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. 19 | *) 20 | 21 | val program : 22 | Pretty_print.t -> ?source_map:string option * Source_map.t -> Javascript.program -> unit 23 | -------------------------------------------------------------------------------- /compiler/lib/specialize_js.mli: -------------------------------------------------------------------------------- 1 | (* Js_of_ocaml compiler 2 | * http://www.ocsigen.org/js_of_ocaml/ 3 | * Copyright (C) 2010 Jérôme Vouillon 4 | * Laboratoire PPS - CNRS Université Paris Diderot 5 | * 6 | * This program is free software; you can redistribute it and/or modify 7 | * it under the terms of the GNU Lesser General Public License as published by 8 | * the Free Software Foundation, with linking exception; 9 | * either version 2.1 of the License, or (at your option) any later version. 10 | * 11 | * This program is distributed in the hope that it will be useful, 12 | * but WITHOUT ANY WARRANTY; without even the implied warranty of 13 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 14 | * GNU Lesser General Public License for more details. 15 | * 16 | * You should have received a copy of the GNU Lesser General Public License 17 | * along with this program; if not, write to the Free Software 18 | * Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. 19 | *) 20 | 21 | val f : Flow.info -> Code.program -> Code.program 22 | 23 | val f_once : Code.program -> Code.program 24 | -------------------------------------------------------------------------------- /compiler/lib/source_map_io.mli: -------------------------------------------------------------------------------- 1 | (* Js_of_ocaml compiler 2 | * http://www.ocsigen.org/js_of_ocaml/ 3 | * Copyright (C) 2017 Hugo Heuzard 4 | * 5 | * This program is free software; you can redistribute it and/or modify 6 | * it under the terms of the GNU Lesser General Public License as published by 7 | * the Free Software Foundation, with linking exception; 8 | * either version 2.1 of the License, or (at your option) any later version. 9 | * 10 | * This program is distributed in the hope that it will be useful, 11 | * but WITHOUT ANY WARRANTY; without even the implied warranty of 12 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 13 | * GNU Lesser General Public License for more details. 14 | * 15 | * You should have received a copy of the GNU Lesser General Public License 16 | * along with this program; if not, write to the Free Software 17 | * Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. 18 | *) 19 | 20 | open Source_map 21 | 22 | val enabled : bool 23 | 24 | val to_string : t -> string 25 | 26 | val to_file : t -> string -> unit 27 | 28 | val of_string : string -> t 29 | -------------------------------------------------------------------------------- /ppx/ppx_deriving_json/lib/ppx_deriving_json.mli: -------------------------------------------------------------------------------- 1 | (* Js_of_ocaml library 2 | * http://www.ocsigen.org/js_of_ocaml/ 3 | * Copyright Hugo Heuzard 2019 4 | * 5 | * This program is free software; you can redistribute it and/or modify 6 | * it under the terms of the GNU Lesser General Public License as published by 7 | * the Free Software Foundation, with linking exception; 8 | * either version 2.1 of the License, or (at your option) any later version. 9 | * 10 | * This program is distributed in the hope that it will be useful, 11 | * but WITHOUT ANY WARRANTY; without even the implied warranty of 12 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 13 | * GNU Lesser General Public License for more details. 14 | * 15 | * You should have received a copy of the GNU Lesser General Public License 16 | * along with this program; if not, write to the Free Software 17 | * Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. 18 | *) 19 | 20 | val json_of : Ppxlib.Deriving.t 21 | 22 | val to_json : Ppxlib.Deriving.t 23 | 24 | val of_json : Ppxlib.Deriving.t 25 | 26 | val json : Ppxlib.Deriving.t 27 | -------------------------------------------------------------------------------- /compiler/lib/link_js.mli: -------------------------------------------------------------------------------- 1 | (* Js_of_ocaml compiler 2 | * http://www.ocsigen.org/js_of_ocaml/ 3 | * Copyright (C) 2017 Hugo Heuzard 4 | * 5 | * This program is free software; you can redistribute it and/or modify 6 | * it under the terms of the GNU Lesser General Public License as published by 7 | * the Free Software Foundation, with linking exception; 8 | * either version 2.1 of the License, or (at your option) any later version. 9 | * 10 | * This program is distributed in the hope that it will be useful, 11 | * but WITHOUT ANY WARRANTY; without even the implied warranty of 12 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 13 | * GNU Lesser General Public License for more details. 14 | * 15 | * You should have received a copy of the GNU Lesser General Public License 16 | * along with this program; if not, write to the Free Software 17 | * Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. 18 | *) 19 | 20 | val link : 21 | output:out_channel 22 | -> files:string list 23 | -> resolve_sourcemap_url:bool 24 | -> source_map:(string option * Source_map.t) option 25 | -> unit 26 | -------------------------------------------------------------------------------- /compiler/lib/debug.mli: -------------------------------------------------------------------------------- 1 | (* Js_of_ocaml compiler 2 | * http://www.ocsigen.org/js_of_ocaml/ 3 | * 4 | * This program is free software; you can redistribute it and/or modify 5 | * it under the terms of the GNU Lesser General Public License as published by 6 | * the Free Software Foundation, with linking exception; 7 | * either version 2.1 of the License, or (at your option) any later version. 8 | * 9 | * This program is distributed in the hope that it will be useful, 10 | * but WITHOUT ANY WARRANTY; without even the implied warranty of 11 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 12 | * GNU Lesser General Public License for more details. 13 | * 14 | * You should have received a copy of the GNU Lesser General Public License 15 | * along with this program; if not, write to the Free Software 16 | * Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. 17 | *) 18 | val available : unit -> string list 19 | 20 | val find : string -> unit -> bool 21 | 22 | val enable : string -> unit 23 | 24 | val disable : string -> unit 25 | 26 | val stop_profiling : unit -> unit 27 | 28 | val start_profiling : string -> unit 29 | -------------------------------------------------------------------------------- /compiler/lib/findlib.mli: -------------------------------------------------------------------------------- 1 | (* Js_of_ocaml compiler 2 | * http://www.ocsigen.org/js_of_ocaml/ 3 | * 4 | * This program is free software; you can redistribute it and/or modify 5 | * it under the terms of the GNU Lesser General Public License as published by 6 | * the Free Software Foundation, with linking exception; 7 | * either version 2.1 of the License, or (at your option) any later version. 8 | * 9 | * This program is distributed in the hope that it will be useful, 10 | * but WITHOUT ANY WARRANTY; without even the implied warranty of 11 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 12 | * GNU Lesser General Public License for more details. 13 | * 14 | * You should have received a copy of the GNU Lesser General Public License 15 | * along with this program; if not, write to the Free Software 16 | * Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. 17 | *) 18 | 19 | val path_require_findlib : string -> string option 20 | 21 | val set_find_pkg_dir : (string -> string) -> unit 22 | 23 | val find_pkg_dir : string -> string 24 | 25 | val find_in_findlib_paths : ?pkg:string -> string list -> string -> string 26 | -------------------------------------------------------------------------------- /compiler/lib/timer.ml: -------------------------------------------------------------------------------- 1 | (* Js_of_ocaml compiler 2 | * http://www.ocsigen.org/js_of_ocaml/ 3 | * 4 | * This program is free software; you can redistribute it and/or modify 5 | * it under the terms of the GNU Lesser General Public License as published by 6 | * the Free Software Foundation, with linking exception; 7 | * either version 2.1 of the License, or (at your option) any later version. 8 | * 9 | * This program is distributed in the hope that it will be useful, 10 | * but WITHOUT ANY WARRANTY; without even the implied warranty of 11 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 12 | * GNU Lesser General Public License for more details. 13 | * 14 | * You should have received a copy of the GNU Lesser General Public License 15 | * along with this program; if not, write to the Free Software 16 | * Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. 17 | *) 18 | 19 | open! Stdlib 20 | 21 | type t = float 22 | 23 | let timer = ref (fun _ -> 0.) 24 | 25 | let init f = timer := f 26 | 27 | let make () = !timer () 28 | 29 | let get t = !timer () -. t 30 | 31 | let print f t = Format.fprintf f "%.2f" (get t) 32 | -------------------------------------------------------------------------------- /manual/rev-bindings.wiki: -------------------------------------------------------------------------------- 1 | = Export OCaml code to JavaScript 2 | 3 | The easiest way to export OCaml values (e.g., functions) to JavaScript is to 4 | create a JavaScript object containing all values to export 5 | and to make the object reachable. 6 | 7 | <> 18 | 19 | <> 22 | 23 | == Using the Node.js module system 24 | {{{Js.export}}} and {{{Js.export_all}}} will export a value to {{{module.exports}}} if it exists. 25 | 26 | {{{ 27 | # cat math.ml 28 | open Js_of_ocaml 29 | 30 | let _ = 31 | Js.export_all 32 | (object%js 33 | method add x y = x +. y 34 | method abs x = abs_float x 35 | val zero = 0. 36 | end) 37 | # ocamlfind ocamlc -verbose \ 38 | -package js_of_ocaml -package js_of_ocaml-ppx \ 39 | -linkpkg math.ml -o math.byte 40 | # js_of_ocaml math.byte 41 | # node 42 | # > var math = require("./math.js"); 43 | # > math.add(2,3) 44 | }}} 45 | -------------------------------------------------------------------------------- /compiler/lib/generate.mli: -------------------------------------------------------------------------------- 1 | (* Js_of_ocaml compiler 2 | * http://www.ocsigen.org/js_of_ocaml/ 3 | * Copyright (C) 2010 Jérôme Vouillon 4 | * Laboratoire PPS - CNRS Université Paris Diderot 5 | * 6 | * This program is free software; you can redistribute it and/or modify 7 | * it under the terms of the GNU Lesser General Public License as published by 8 | * the Free Software Foundation, with linking exception; 9 | * either version 2.1 of the License, or (at your option) any later version. 10 | * 11 | * This program is distributed in the hope that it will be useful, 12 | * but WITHOUT ANY WARRANTY; without even the implied warranty of 13 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 14 | * GNU Lesser General Public License for more details. 15 | * 16 | * You should have received a copy of the GNU Lesser General Public License 17 | * along with this program; if not, write to the Free Software 18 | * Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. 19 | *) 20 | 21 | val f : 22 | Code.program 23 | -> exported_runtime:bool 24 | -> live_vars:int array 25 | -> Parse_bytecode.Debug.t 26 | -> Javascript.program 27 | -------------------------------------------------------------------------------- /compiler/lib/source_map_io.unsupported.ml: -------------------------------------------------------------------------------- 1 | (* Js_of_ocaml compiler 2 | * http://www.ocsigen.org/js_of_ocaml/ 3 | * Copyright (C) 2017 Hugo Heuzard 4 | * 5 | * This program is free software; you can redistribute it and/or modify 6 | * it under the terms of the GNU Lesser General Public License as published by 7 | * the Free Software Foundation, with linking exception; 8 | * either version 2.1 of the License, or (at your option) any later version. 9 | * 10 | * This program is distributed in the hope that it will be useful, 11 | * but WITHOUT ANY WARRANTY; without even the implied warranty of 12 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 13 | * GNU Lesser General Public License for more details. 14 | * 15 | * You should have received a copy of the GNU Lesser General Public License 16 | * along with this program; if not, write to the Free Software 17 | * Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. 18 | *) 19 | 20 | let fail () = failwith "Sourcemap support not available" 21 | 22 | let to_string _ = fail () 23 | 24 | let of_string _ = fail () 25 | 26 | let to_file _ _ = fail () 27 | 28 | let enabled = false 29 | -------------------------------------------------------------------------------- /compiler/lib/target_env.mli: -------------------------------------------------------------------------------- 1 | (* Js_of_ocaml compiler 2 | * http://www.ocsigen.org/js_of_ocaml/ 3 | * Copyright (C) 2020 Hugo Heuzard 4 | * 5 | * This program is free software; you can redistribute it and/or modify 6 | * it under the terms of the GNU Lesser General Public License as published by 7 | * the Free Software Foundation, with linking exception; 8 | * either version 2.1 of the License, or (at your option) any later version. 9 | * 10 | * This program is distributed in the hope that it will be useful, 11 | * but WITHOUT ANY WARRANTY; without even the implied warranty of 12 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 13 | * GNU Lesser General Public License for more details. 14 | * 15 | * You should have received a copy of the GNU Lesser General Public License 16 | * along with this program; if not, write to the Free Software 17 | * Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. 18 | *) 19 | 20 | type t = 21 | | Browser 22 | | Nodejs 23 | | Isomorphic 24 | 25 | val all : t list 26 | 27 | val equal : t -> t -> bool 28 | 29 | val to_string : t -> string 30 | 31 | val of_string : string -> t option 32 | -------------------------------------------------------------------------------- /ppx/ppx_js/as-lib/ppx_js.mli: -------------------------------------------------------------------------------- 1 | (* Js_of_ocaml library 2 | * http://www.ocsigen.org/js_of_ocaml/ 3 | * 4 | * This program is free software; you can redistribute it and/or modify 5 | * it under the terms of the GNU Lesser General Public License as published by 6 | * the Free Software Foundation, with linking exception; 7 | * either version 2.1 of the License, or (at your option) any later version. 8 | * 9 | * This program is distributed in the hope that it will be useful, 10 | * but WITHOUT ANY WARRANTY; without even the implied warranty of 11 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 12 | * GNU Lesser General Public License for more details. 13 | * 14 | * You should have received a copy of the GNU Lesser General Public License 15 | * along with this program; if not, write to the Free Software 16 | * Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. 17 | *) 18 | 19 | (**/**) 20 | 21 | val mapper : Ast_mapper.mapper 22 | (** You can use this mapper to register the extension when building a toplevel. 23 | You can only use it the way it is; it is not possible to update any fields 24 | of this mapper. *) 25 | -------------------------------------------------------------------------------- /compiler/lib/pure_fun.mli: -------------------------------------------------------------------------------- 1 | (* Js_of_ocaml compiler 2 | * http://www.ocsigen.org/js_of_ocaml/ 3 | * Copyright (C) 2010 Jérôme Vouillon 4 | * Laboratoire PPS - CNRS Université Paris Diderot 5 | * 6 | * This program is free software; you can redistribute it and/or modify 7 | * it under the terms of the GNU Lesser General Public License as published by 8 | * the Free Software Foundation, with linking exception; 9 | * either version 2.1 of the License, or (at your option) any later version. 10 | * 11 | * This program is distributed in the hope that it will be useful, 12 | * but WITHOUT ANY WARRANTY; without even the implied warranty of 13 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 14 | * GNU Lesser General Public License for more details. 15 | * 16 | * You should have received a copy of the GNU Lesser General Public License 17 | * along with this program; if not, write to the Free Software 18 | * Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. 19 | *) 20 | 21 | val pure_expr : Code.Var.Set.t -> Code.expr -> bool 22 | 23 | val pure_instr : Code.Var.Set.t -> Code.instr -> bool 24 | 25 | val f : Code.program -> Code.Var.Set.t 26 | -------------------------------------------------------------------------------- /compiler/lib-findlib-support/jsoo_findlib_support.ml: -------------------------------------------------------------------------------- 1 | (* Js_of_ocaml compiler 2 | * http://www.ocsigen.org/js_of_ocaml/ 3 | * Copyright (C) 2015 Hugo Heuzard 4 | * 5 | * This program is free software; you can redistribute it and/or modify 6 | * it under the terms of the GNU Lesser General Public License as published by 7 | * the Free Software Foundation, with linking exception; 8 | * either version 2.1 of the License, or (at your option) any later version. 9 | * 10 | * This program is distributed in the hope that it will be useful, 11 | * but WITHOUT ANY WARRANTY; without even the implied warranty of 12 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 13 | * GNU Lesser General Public License for more details. 14 | * 15 | * You should have received a copy of the GNU Lesser General Public License 16 | * along with this program; if not, write to the Free Software 17 | * Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. 18 | *) 19 | 20 | let () = 21 | let findlib_init = lazy (Findlib.init ()) in 22 | Js_of_ocaml_compiler.Findlib.set_find_pkg_dir (fun pkg -> 23 | Lazy.force findlib_init; 24 | Findlib.package_directory pkg) 25 | -------------------------------------------------------------------------------- /compiler/tests-compiler/gen-rules/gen.ml: -------------------------------------------------------------------------------- 1 | let is_implem x = 2 | if String.equal (Filename.extension x) ".ml" 3 | then 4 | let fname = Filename.chop_extension x in 5 | try 6 | String.iter 7 | (function 8 | | 'a' .. 'z' | 'A' .. 'Z' | '0' .. '9' | '_' -> () 9 | | _ -> raise Exit) 10 | fname; 11 | true 12 | with Exit -> false 13 | else false 14 | 15 | let () = set_binary_mode_out stdout true 16 | 17 | let () = 18 | Array.to_list (Sys.readdir ".") 19 | |> List.filter is_implem 20 | |> List.sort compare 21 | |> List.iter (fun f -> 22 | let basename = Filename.chop_extension f in 23 | Printf.printf 24 | {| 25 | (library 26 | (name jsooexp_%s) 27 | (modules %s) 28 | (libraries js_of_ocaml_compiler unix str jsoo_compiler_expect_tests_helper) 29 | (inline_tests 30 | (flags -allow-output-patterns) 31 | (deps 32 | (file ../../compiler/bin-js_of_ocaml/js_of_ocaml.exe) 33 | (file ../../compiler/bin-jsoo_minify/jsoo_minify.exe))) 34 | (flags (:standard -open Jsoo_compiler_expect_tests_helper)) 35 | (preprocess 36 | (pps ppx_expect))) 37 | |} 38 | basename 39 | basename) 40 | -------------------------------------------------------------------------------- /.gitignore: -------------------------------------------------------------------------------- 1 | # Boring file regexps: 2 | 3 | # Editor 4 | .vscode 5 | 6 | # C object files 7 | *.o 8 | *.a 9 | *.so 10 | # Ocaml object files 11 | *.cmi 12 | *.cmo 13 | *.cmx 14 | *.cma 15 | *.cmxa 16 | *.cmxs 17 | *.cmjs 18 | 19 | # generated by dune 20 | *.merlin 21 | *.install 22 | 23 | # backup files 24 | *~ 25 | *# 26 | .#* 27 | 28 | # Specific to Js_of_ocaml 29 | *.byte 30 | *.tmpjs 31 | *.map 32 | 33 | ocamltests 34 | 35 | gh-pages 36 | 37 | _opam 38 | _build 39 | 40 | # Benchmarks 41 | benchmarks/*.svg 42 | benchmarks/*.pdf 43 | benchmarks/__run 44 | benchmarks/build 45 | benchmarks/results 46 | benchmarks/config 47 | 48 | api/wiki/ 49 | api/html 50 | manual/files/boulderdash/ 51 | manual/files/cubes/ 52 | manual/files/graph_viewer/ 53 | manual/files/hyperbolic/ 54 | manual/files/minesweeper/ 55 | manual/files/planet/ 56 | manual/files/toplevel/ 57 | manual/files/webgl/ 58 | manual/files/wiki/ 59 | manual/files/wysiwyg/ 60 | 61 | toplevel/examples/lwt_toplevel_bin/*.cmis.js 62 | toplevel/examples/lwt_toplevel_bin/test_dynlink.js 63 | toplevel/examples/lwt_toplevel_bin/test_dynlink.cmi.js 64 | toplevel/examples/lwt_toplevel_bin/toplevel.js 65 | toplevel/examples/lwt_toplevel_bin/eval.js 66 | -------------------------------------------------------------------------------- /benchmarks/sources/ml/taku.ml: -------------------------------------------------------------------------------- 1 | (***********************************************************************) 2 | (* *) 3 | (* Objective Caml *) 4 | (* *) 5 | (* Xavier Leroy, projet Cristal, INRIA Rocquencourt *) 6 | (* *) 7 | (* Copyright 1996 Institut National de Recherche en Informatique et *) 8 | (* en Automatique. All rights reserved. This file is distributed *) 9 | (* under the terms of the Q Public License version 1.0. *) 10 | (* *) 11 | (***********************************************************************) 12 | 13 | (* $Id: taku.ml 7017 2005-08-12 09:22:04Z xleroy $ *) 14 | 15 | let rec tak (x, y, z) = 16 | if x > y then tak (tak (x - 1, y, z), tak (y - 1, z, x), tak (z - 1, x, y)) else z 17 | 18 | let rec repeat n accu = if n <= 0 then accu else repeat (n - 1) (tak (18, 12, 6) + accu) 19 | 20 | let _ = assert (repeat 2000 0 = 14000) 21 | -------------------------------------------------------------------------------- /compiler/lib/builtins.mli: -------------------------------------------------------------------------------- 1 | (* Js_of_ocaml compiler 2 | * http://www.ocsigen.org/js_of_ocaml/ 3 | * Copyright (C) 2020 Hugo Heuzard 4 | * 5 | * This program is free software; you can redistribute it and/or modify 6 | * it under the terms of the GNU Lesser General Public License as published by 7 | * the Free Software Foundation, with linking exception; 8 | * either version 2.1 of the License, or (at your option) any later version. 9 | * 10 | * This program is distributed in the hope that it will be useful, 11 | * but WITHOUT ANY WARRANTY; without even the implied warranty of 12 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 13 | * GNU Lesser General Public License for more details. 14 | * 15 | * You should have received a copy of the GNU Lesser General Public License 16 | * along with this program; if not, write to the Free Software 17 | * Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. 18 | *) 19 | 20 | module File : sig 21 | type t 22 | 23 | val name : t -> string 24 | 25 | val content : t -> string 26 | end 27 | 28 | val find : string -> File.t option 29 | 30 | val all : unit -> File.t list 31 | 32 | val register : name:string -> content:string -> File.t 33 | -------------------------------------------------------------------------------- /compiler/bin-jsoo_minify/cmd_arg.mli: -------------------------------------------------------------------------------- 1 | (* Js_of_ocaml compiler 2 | * http://www.ocsigen.org/js_of_ocaml/ 3 | * Copyright (C) 2014 Hugo Heuzard 4 | * 5 | * This program is free software; you can redistribute it and/or modify 6 | * it under the terms of the GNU Lesser General Public License as published by 7 | * the Free Software Foundation, with linking exception; 8 | * either version 2.1 of the License, or (at your option) any later version. 9 | * 10 | * This program is distributed in the hope that it will be useful, 11 | * but WITHOUT ANY WARRANTY; without even the implied warranty of 12 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 13 | * GNU Lesser General Public License for more details. 14 | * 15 | * You should have received a copy of the GNU Lesser General Public License 16 | * along with this program; if not, write to the Free Software 17 | * Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. 18 | *) 19 | 20 | type t = 21 | { common : Jsoo_cmdline.Arg.t 22 | ; (* minify option *) 23 | use_stdin : bool 24 | ; output_file : string option 25 | ; files : string list 26 | } 27 | 28 | val options : t Cmdliner.Term.t 29 | 30 | val info : Cmdliner.Term.info 31 | -------------------------------------------------------------------------------- /examples/graph_viewer/main.ml: -------------------------------------------------------------------------------- 1 | (* Graph viewer 2 | * Copyright (C) 2010 Jérôme Vouillon 3 | * Laboratoire PPS - CNRS Université Paris Diderot 4 | * 5 | * This program is free software; you can redistribute it and/or modify 6 | * it under the terms of the GNU General Public License as published by 7 | * the Free Software Foundation; either version 2 of the License, or 8 | * (at your option) any later version. 9 | * 10 | * This program is distributed in the hope that it will be useful, 11 | * but WITHOUT ANY WARRANTY; without even the implied warranty of 12 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 13 | * GNU Lesser General Public License for more details. 14 | * 15 | * You should have received a copy of the GNU Lesser General Public License 16 | * along with this program; if not, write to the Free Software 17 | * Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. 18 | *) 19 | 20 | let _ = 21 | let ch = if Array.length Sys.argv > 1 then open_in Sys.argv.(1) else stdin in 22 | let _, g = Dot_graph.of_channel ch in 23 | let bbox, scene = Dot_render.f g in 24 | ignore (GMain.Main.init ()); 25 | Viewer.create (*~full_screen:true*) bbox scene; 26 | GMain.main () 27 | -------------------------------------------------------------------------------- /benchmarks/sources/ml/fib.ml: -------------------------------------------------------------------------------- 1 | (***********************************************************************) 2 | (* *) 3 | (* Objective Caml *) 4 | (* *) 5 | (* Xavier Leroy, projet Cristal, INRIA Rocquencourt *) 6 | (* *) 7 | (* Copyright 1996 Institut National de Recherche en Informatique et *) 8 | (* en Automatique. All rights reserved. This file is distributed *) 9 | (* under the terms of the Q Public License version 1.0. *) 10 | (* *) 11 | (***********************************************************************) 12 | 13 | (* $Id: fib.ml 7017 2005-08-12 09:22:04Z xleroy $ *) 14 | 15 | let rec fib n = if n < 2 then 1 else fib (n - 1) + fib (n - 2) 16 | 17 | let _ = 18 | let n = 40 in 19 | (* 20 | if Array.length Sys.argv >= 2 21 | then int_of_string Sys.argv.(1) 22 | else 40 in 23 | *) 24 | assert (fib n = 165580141) 25 | 26 | (*; print_newline(); exit 0*) 27 | -------------------------------------------------------------------------------- /compiler/tests-ocaml/lib-fun/test.ml: -------------------------------------------------------------------------------- 1 | (* TEST 2 | *) 3 | 4 | let test_id () = 5 | assert (Fun.id true = true); 6 | assert (Fun.id 1 = 1); 7 | assert (not (Fun.id nan = nan)); 8 | () 9 | 10 | let test_const () = 11 | assert (Fun.const true false = true); 12 | assert (Fun.const 0 false = 0); 13 | assert (Fun.const 0 4 = 0); 14 | () 15 | 16 | let test_flip () = 17 | assert (Fun.flip ( ^ ) "of order" "out " = "out of order"); 18 | assert (Fun.flip List.append [2] [1] = [1;2]); 19 | assert (Fun.flip List.cons [2] 1 = [1;2]); 20 | () 21 | 22 | let test_negate () = 23 | assert (Fun.negate (Bool.equal true) true = false); 24 | assert (Fun.negate (Bool.equal true) false = true); 25 | () 26 | 27 | let test_protect () = 28 | let does_raise f x = 29 | try f x ; false 30 | with _ -> true 31 | in 32 | let double_raise () = 33 | let f () = raise Exit in 34 | try 35 | Fun.protect ~finally:f f () 36 | with 37 | | Exit -> () 38 | in 39 | assert (does_raise double_raise ()) 40 | 41 | let tests () = 42 | test_id (); 43 | test_const (); 44 | test_flip (); 45 | test_negate (); 46 | test_protect (); 47 | () 48 | 49 | let () = 50 | tests (); 51 | print_endline "OK"; 52 | () 53 | --------------------------------------------------------------------------------