diff --git a/.github/workflows/build.yml b/.github/workflows/build.yml index e2ad9e1073..5618381360 100644 --- a/.github/workflows/build.yml +++ b/.github/workflows/build.yml @@ -63,6 +63,11 @@ jobs: skip-effects: false skip-test: false skip-doc: true + - os: ubuntu-latest + ocaml-compiler: ocaml-variants.5.3.0+trunk + skip-effects: false + skip-test: false + skip-doc: true runs-on: ${{ matrix.os }} @@ -85,8 +90,7 @@ jobs: default: https://github.com/ocaml-opam/opam-repository-mingw.git#sunset opam: https://github.com/ocaml/opam-repository.git dune-cache: true - opam-depext: ${{ !matrix.skip-test }} - opam-depext-flags: --with-test + opam-depext: false - name: Set-up OCaml ${{ matrix.ocaml-compiler }} if: runner.os != 'Windows' @@ -95,8 +99,12 @@ jobs: ocaml-compiler: ${{ matrix.ocaml-compiler }} allow-prerelease-opam: true dune-cache: true - opam-depext: ${{ !matrix.skip-test }} - opam-depext-flags: --with-test + opam-depext: false + + - run: opam pin add ppxlib git+https://github.com/hhugo/ppxlib.git#trunk-support-53 --no-action + if: ${{ matrix.ocaml-compiler == 'ocaml-variants.5.3.0+trunk' }} + + - run: opam pin add ./ --no-action - run: opam install . --best-effort if: ${{ matrix.skip-test }} diff --git a/CHANGES.md b/CHANGES.md index 271d9231fc..7c00ae4187 100644 --- a/CHANGES.md +++ b/CHANGES.md @@ -12,12 +12,14 @@ * Compiler: more inlining - duplicate small function. * Compiler: Make it possible to link runtime JavaScript file together with OCaml libraries #1509 +* Compiler: initial support for OCaml 5.3 * Runtime: abort instead of exit when calling unimplemented js primitives in bytecode/native. It should help if one tries to understand the source of the call with gdb (see #677) * Runtime: re-enable marshalling of floats, disabled in jsoo 2.0 * Runtime: new runtime api for channels + ## Bug fixes * Compiler: fix variable renaming for property binding and assignment target diff --git a/compiler/lib/magic_number.ml b/compiler/lib/magic_number.ml index d78ac3ca37..34718527f5 100644 --- a/compiler/lib/magic_number.ml +++ b/compiler/lib/magic_number.ml @@ -77,11 +77,12 @@ let v = | 5 :: 00 :: _ -> 32 | 5 :: 01 :: _ -> 33 | 5 :: 02 :: _ -> 34 + | 5 :: 03 :: _ -> 35 | _ -> - if Ocaml_version.compare current [ 4; 8 ] < 0 + if Ocaml_version.compare current [ 4; 08 ] < 0 then failwith "OCaml version unsupported. Upgrade to OCaml 4.08 or newer." else ( - assert (Ocaml_version.compare current [ 5; 3 ] >= 0); + assert (Ocaml_version.compare current [ 5; 04 ] >= 0); failwith "OCaml version unsupported. Upgrade js_of_ocaml.") let current_exe = "Caml1999X", v diff --git a/compiler/lib/parse_bytecode.ml b/compiler/lib/parse_bytecode.ml index b9e4b1e8c9..b0d33473a7 100644 --- a/compiler/lib/parse_bytecode.ml +++ b/compiler/lib/parse_bytecode.ml @@ -2439,7 +2439,6 @@ and compile infos pc state instrs = | true -> State.pop 2 state | false -> State.pop 3 state in - compile infos (pc + 1) diff --git a/compiler/tests-check-prim/main.output5 b/compiler/tests-check-prim/main.output5 index c2501c6317..0eb366941a 100644 --- a/compiler/tests-check-prim/main.output5 +++ b/compiler/tests-check-prim/main.output5 @@ -4,7 +4,6 @@ Missing From main.bc: caml_alloc_dummy_function caml_continuation_use -caml_drop_continuation caml_dynlink_add_primitive caml_dynlink_close_lib caml_dynlink_get_current_libs @@ -171,7 +170,6 @@ caml_spacetime_only_works_for_native_code caml_sys_const_naked_pointers_checked From +toplevel.js: -caml_get_section_table caml_static_alloc caml_static_free caml_terminfo_backup diff --git a/compiler/tests-check-prim/unix-unix.output5 b/compiler/tests-check-prim/unix-unix.output5 index 799210ad46..6ba27a9417 100644 --- a/compiler/tests-check-prim/unix-unix.output5 +++ b/compiler/tests-check-prim/unix-unix.output5 @@ -4,7 +4,6 @@ Missing From unix.bc: caml_alloc_dummy_function caml_continuation_use -caml_drop_continuation caml_dynlink_add_primitive caml_dynlink_close_lib caml_dynlink_get_current_libs @@ -282,7 +281,6 @@ caml_spacetime_only_works_for_native_code caml_sys_const_naked_pointers_checked From +toplevel.js: -caml_get_section_table caml_static_alloc caml_static_free caml_terminfo_backup diff --git a/compiler/tests-full/stdlib.cma.expected.js b/compiler/tests-full/stdlib.cma.expected.js index 0f681a662d..b9d5504993 100644 --- a/compiler/tests-full/stdlib.cma.expected.js +++ b/compiler/tests-full/stdlib.cma.expected.js @@ -1114,8 +1114,8 @@ caml_maybe_attach_backtrace = runtime.caml_maybe_attach_backtrace, caml_wrap_exception = runtime.caml_wrap_exception, global_data = runtime.caml_get_global_data(), - ocaml_version = "5.2.0~beta1", - ocaml_release = [0, 5, 2, 0, [0, [0, 1, "beta1"]]], + ocaml_version = "5.3.0+dev0-2023-12-22", + ocaml_release = [0, 5, 3, 0, [0, [0, 0, "dev0-2023-12-22"]]], Stdlib = global_data.Stdlib, /*<>*/ executable_name = /*<>*/ runtime.caml_sys_executable_name(0), @@ -1128,28 +1128,28 @@ max_floatarray_length = max_array_length / 2 | 0, max_string_length = (4 * max_array_length | 0) - 1 | 0; function getenv_opt(s){ - /*<>*/ try{ - /*<>*/ /*<>*/ var - _d_ = [0, /*<>*/ runtime.caml_sys_getenv(s)]; - /*<>*/ return _d_; + /*<>*/ try{ + /*<>*/ /*<>*/ var + _d_ = [0, /*<>*/ runtime.caml_sys_getenv(s)]; + /*<>*/ return _d_; } catch(_e_){ var _c_ = caml_wrap_exception(_e_); - if(_c_ === Stdlib[8]) /*<>*/ return 0; + if(_c_ === Stdlib[8]) /*<>*/ return 0; throw caml_maybe_attach_backtrace(_c_, 0); } - /*<>*/ } - /*<>*/ /*<>*/ var interactive = [0, 0]; - function set_signal(sig_num, sig_beh){ /*<>*/ return 0; - /*<>*/ } - /*<>*/ /*<>*/ var + /*<>*/ } + /*<>*/ /*<>*/ var interactive = [0, 0]; + function set_signal(sig_num, sig_beh){ /*<>*/ return 0; + /*<>*/ } + /*<>*/ /*<>*/ var Break = [248, "Stdlib.Sys.Break", runtime.caml_fresh_oo_id(0)]; function catch_break(on){ - /*<>*/ return on ? 0 : 0; - /*<>*/ } - function Make(_b_, _a_){ /*<>*/ return [0, 1];} - /*<>*/ var - /*<>*/ Immediate64 = [0, Make], + /*<>*/ return on ? 0 : 0; + /*<>*/ } + function Make(_b_, _a_){ /*<>*/ return [0, 1];} + /*<>*/ var + /*<>*/ Immediate64 = [0, Make], Stdlib_Sys = [0, executable_name, @@ -1198,7 +1198,7 @@ Break, catch_break, ocaml_version, - 0, + 1, ocaml_release, runtime.caml_ml_enable_runtime_warnings, runtime.caml_ml_runtime_warnings_enabled, @@ -3294,6 +3294,8 @@ cst_List_fold_right2 = "List.fold_right2", cst_List_for_all2 = "List.for_all2", cst_List_exists2 = "List.exists2", + cst_List_take = "List.take", + cst_List_drop = "List.drop", _a_ = [0, 0, 0], cst_List_combine = "List.combine"; function rev_append(l1, l2){ @@ -4048,117 +4050,203 @@ param$0 = xs; } } + function take(n, l){ + /*<>*/ if(n < 0) + /*<>*/ /*<>*/ caml_call1 + (Stdlib[1], cst_List_take); + if(0 !== n && l){ + /*<>*/ var + l$0 = l[2], + x = l[1], + /*<>*/ block = [0, x, 24029], + /*<>*/ n$0 = n - 1 | 0, + dst = block, + offset = 1, + n$1 = n$0, + l$1 = l$0; + /*<>*/ for(;;){ + if(0 !== n$1 && l$1){ + /*<>*/ var + l$2 = l$1[2], + x$0 = l$1[1], + /*<>*/ dst$0 = [0, x$0, 24029]; + dst[1 + offset] = dst$0; + /*<>*/ /*<>*/ var n$2 = n$1 - 1 | 0; + dst = dst$0; + offset = 1; + n$1 = n$2; + l$1 = l$2; + continue; + } + dst[1 + offset] = 0; + /*<>*/ return block; + } + } + /*<>*/ return 0; + /*<>*/ } + function drop(n, rest){ + /*<>*/ if(n < 0) + /*<>*/ /*<>*/ caml_call1 + (Stdlib[1], cst_List_drop); + var i = 0, rest$0 = rest; + for(;;){ + if(rest$0){ + var rest$1 = rest$0[2]; + if(i < n){var i$0 = i + 1 | 0; i = i$0; rest$0 = rest$1; continue;} + } + /*<>*/ return rest$0; + } + /*<>*/ } + function take_while(p, rest){ + /*<>*/ if(rest){ + var rest$0 = rest[2], x = rest[1]; + /*<>*/ if( /*<>*/ caml_call1(p, x)){ + /*<>*/ var + /*<>*/ block = [0, x, 24029], + dst = block, + offset = 1, + rest$1 = rest$0; + /*<>*/ for(;;){ + if(rest$1){ + var rest$2 = rest$1[2], x$0 = rest$1[1]; + /*<>*/ if( /*<>*/ caml_call1(p, x$0)){ + /*<>*/ /*<>*/ var + dst$0 = [0, x$0, 24029]; + dst[1 + offset] = dst$0; + dst = dst$0; + offset = 1; + rest$1 = rest$2; + continue; + } + } + dst[1 + offset] = 0; + /*<>*/ return block; + } + } + } + /*<>*/ return 0; + /*<>*/ } + function drop_while(p, rest){ + var rest$0 = rest; + for(;;){ + if(rest$0){ + var rest$1 = rest$0[2], x = rest$0[1]; + /*<>*/ if( /*<>*/ caml_call1(p, x)){rest$0 = rest$1; continue;} + } + /*<>*/ return rest$0; + } + } function fold_left_map(f, accu, l){ - /*<>*/ var accu$0 = accu, l_accu = 0, param = l; + /*<>*/ var accu$0 = accu, l_accu = 0, param = l; for(;;){ - if(! param) /*<>*/ return [0, accu$0, rev(l_accu)]; - /*<>*/ var + if(! param) /*<>*/ return [0, accu$0, rev(l_accu)]; + /*<>*/ var l$0 = param[2], x = param[1], - /*<>*/ match = - /*<>*/ caml_call2(f, accu$0, x), + /*<>*/ match = + /*<>*/ caml_call2(f, accu$0, x), x$0 = match[2], accu$1 = match[1], - /*<>*/ l_accu$0 = [0, x$0, l_accu]; + /*<>*/ l_accu$0 = [0, x$0, l_accu]; accu$0 = accu$1; l_accu = l_accu$0; param = l$0; } - /*<>*/ } + /*<>*/ } function partition(p, l){ - /*<>*/ var yes = 0, no = 0, param = l; + /*<>*/ var yes = 0, no = 0, param = l; for(;;){ if(! param){ - /*<>*/ /*<>*/ var _x_ = rev(no); - /*<>*/ return [0, rev(yes), _x_]; + /*<>*/ /*<>*/ var _x_ = rev(no); + /*<>*/ return [0, rev(yes), _x_]; } var l$0 = param[2], x = param[1]; - /*<>*/ if( /*<>*/ caml_call1(p, x)){ - /*<>*/ /*<>*/ var yes$0 = [0, x, yes]; + /*<>*/ if( /*<>*/ caml_call1(p, x)){ + /*<>*/ /*<>*/ var yes$0 = [0, x, yes]; yes = yes$0; param = l$0; } else{ - /*<>*/ /*<>*/ var no$0 = [0, x, no]; + /*<>*/ /*<>*/ var no$0 = [0, x, no]; no = no$0; param = l$0; } } - /*<>*/ } + /*<>*/ } function partition_map(p, l){ - /*<>*/ var left = 0, right = 0, param = l; + /*<>*/ var left = 0, right = 0, param = l; for(;;){ if(! param){ - /*<>*/ /*<>*/ var _w_ = rev(right); - /*<>*/ return [0, rev(left), _w_]; + /*<>*/ /*<>*/ var _w_ = rev(right); + /*<>*/ return [0, rev(left), _w_]; } - /*<>*/ var + /*<>*/ var l$0 = param[2], x = param[1], - /*<>*/ match = /*<>*/ caml_call1(p, x); + /*<>*/ match = /*<>*/ caml_call1(p, x); if(0 === match[0]){ - /*<>*/ var + /*<>*/ var v = match[1], - /*<>*/ left$0 = [0, v, left]; + /*<>*/ left$0 = [0, v, left]; left = left$0; param = l$0; } else{ - /*<>*/ var + /*<>*/ var v$0 = match[1], - /*<>*/ right$0 = [0, v$0, right]; + /*<>*/ right$0 = [0, v$0, right]; right = right$0; param = l$0; } } - /*<>*/ } + /*<>*/ } function split(param){ - /*<>*/ if(! param) /*<>*/ return _a_; - /*<>*/ var + /*<>*/ if(! param) /*<>*/ return _a_; + /*<>*/ var l = param[2], match = param[1], y = match[2], x = match[1], - /*<>*/ match$0 = split(l), + /*<>*/ match$0 = split(l), ry = match$0[2], rx = match$0[1]; - /*<>*/ return [0, [0, x, rx], [0, y, ry]]; - /*<>*/ } + /*<>*/ return [0, [0, x, rx], [0, y, ry]]; + /*<>*/ } function combine(l1, l2){ - /*<>*/ if(l1){ + /*<>*/ if(l1){ if(l2){ var l2$0 = l2[2], a2 = l2[1], l1$0 = l1[2], a1 = l1[1]; - /*<>*/ return [0, [0, a1, a2], combine(l1$0, l2$0)]; + /*<>*/ return [0, [0, a1, a2], combine(l1$0, l2$0)]; } } - else if(! l2) /*<>*/ return 0; - /*<>*/ return /*<>*/ caml_call1 + else if(! l2) /*<>*/ return 0; + /*<>*/ return /*<>*/ caml_call1 (Stdlib[1], cst_List_combine); - /*<>*/ } + /*<>*/ } function merge(cmp, l1, l2){ - /*<>*/ if(! l1) /*<>*/ return l2; - if(! l2) /*<>*/ return l1; + /*<>*/ if(! l1) /*<>*/ return l2; + if(! l2) /*<>*/ return l1; var t2 = l2[2], h2 = l2[1], t1 = l1[2], h1 = l1[1]; - /*<>*/ return 0 - < /*<>*/ caml_call2(cmp, h1, h2) + /*<>*/ return 0 + < /*<>*/ caml_call2(cmp, h1, h2) ? [0, h2, merge(cmp, l1, t2)] : [0, h1, merge(cmp, t1, l2)]; - /*<>*/ } + /*<>*/ } function stable_sort(cmp, l){ function sort(n, l){ - /*<>*/ if(2 === n){ + /*<>*/ if(2 === n){ if(l){ var match = l[2]; if(match){ - /*<>*/ var + /*<>*/ var tl = match[2], x2 = match[1], x1 = l[1], - /*<>*/ s = - 0 < /*<>*/ caml_call2(cmp, x1, x2) + /*<>*/ s = + 0 < /*<>*/ caml_call2(cmp, x1, x2) ? [0, x2, [0, x1, 0]] : [0, x1, [0, x2, 0]]; - /*<>*/ return [0, s, tl]; + /*<>*/ return [0, s, tl]; } } } @@ -4167,56 +4255,56 @@ if(_v_){ var match$2 = _v_[2]; if(match$2){ - /*<>*/ var + /*<>*/ var tl$1 = match$2[2], x3 = match$2[1], x2$0 = _v_[1], x1$0 = l[1], - /*<>*/ s$0 = - 0 < /*<>*/ caml_call2(cmp, x1$0, x2$0) + /*<>*/ s$0 = + 0 < /*<>*/ caml_call2(cmp, x1$0, x2$0) ? 0 - < /*<>*/ caml_call2(cmp, x1$0, x3) + < /*<>*/ caml_call2(cmp, x1$0, x3) ? 0 - < /*<>*/ caml_call2(cmp, x2$0, x3) + < /*<>*/ caml_call2(cmp, x2$0, x3) ? [0, x3, [0, x2$0, [0, x1$0, 0]]] : [0, x2$0, [0, x3, [0, x1$0, 0]]] : [0, x2$0, [0, x1$0, [0, x3, 0]]] : 0 - < /*<>*/ caml_call2(cmp, x2$0, x3) + < /*<>*/ caml_call2(cmp, x2$0, x3) ? 0 - < /*<>*/ caml_call2(cmp, x1$0, x3) + < /*<>*/ caml_call2(cmp, x1$0, x3) ? [0, x3, [0, x1$0, [0, x2$0, 0]]] : [0, x1$0, [0, x3, [0, x2$0, 0]]] : [0, x1$0, [0, x2$0, [0, x3, 0]]]; - /*<>*/ return [0, s$0, tl$1]; + /*<>*/ return [0, s$0, tl$1]; } } } - /*<>*/ var + /*<>*/ var n1 = n >> 1, n2 = n - n1 | 0, - /*<>*/ match$0 = rev_sort(n1, l), + /*<>*/ match$0 = rev_sort(n1, l), l2$0 = match$0[2], s1 = match$0[1], - /*<>*/ match$1 = rev_sort(n2, l2$0), + /*<>*/ match$1 = rev_sort(n2, l2$0), tl$0 = match$1[2], s2 = match$1[1], l1 = s1, l2 = s2, accu = 0; - /*<>*/ for(;;){ + /*<>*/ for(;;){ if(l1){ if(l2){ var t2 = l2[2], h2 = l2[1], t1 = l1[2], h1 = l1[1]; - /*<>*/ if - (0 < /*<>*/ caml_call2(cmp, h1, h2)){ - /*<>*/ /*<>*/ var + /*<>*/ if + (0 < /*<>*/ caml_call2(cmp, h1, h2)){ + /*<>*/ /*<>*/ var accu$0 = [0, h1, accu]; l1 = t1; accu = accu$0; continue; } - /*<>*/ /*<>*/ var + /*<>*/ /*<>*/ var accu$1 = [0, h2, accu]; l2 = t2; accu = accu$1; @@ -4226,23 +4314,23 @@ } else var _u_ = rev_append(l2, accu); - /*<>*/ return [0, _u_, tl$0]; + /*<>*/ return [0, _u_, tl$0]; } - /*<>*/ } + /*<>*/ } function rev_sort(n, l){ - /*<>*/ if(2 === n){ + /*<>*/ if(2 === n){ if(l){ var match = l[2]; if(match){ - /*<>*/ var + /*<>*/ var tl = match[2], x2 = match[1], x1 = l[1], - /*<>*/ s = - 0 < /*<>*/ caml_call2(cmp, x1, x2) + /*<>*/ s = + 0 < /*<>*/ caml_call2(cmp, x1, x2) ? [0, x1, [0, x2, 0]] : [0, x2, [0, x1, 0]]; - /*<>*/ return [0, s, tl]; + /*<>*/ return [0, s, tl]; } } } @@ -4251,56 +4339,56 @@ if(_t_){ var match$2 = _t_[2]; if(match$2){ - /*<>*/ var + /*<>*/ var tl$1 = match$2[2], x3 = match$2[1], x2$0 = _t_[1], x1$0 = l[1], - /*<>*/ s$0 = - 0 < /*<>*/ caml_call2(cmp, x1$0, x2$0) + /*<>*/ s$0 = + 0 < /*<>*/ caml_call2(cmp, x1$0, x2$0) ? 0 - < /*<>*/ caml_call2(cmp, x2$0, x3) + < /*<>*/ caml_call2(cmp, x2$0, x3) ? [0, x1$0, [0, x2$0, [0, x3, 0]]] : 0 - < /*<>*/ caml_call2(cmp, x1$0, x3) + < /*<>*/ caml_call2(cmp, x1$0, x3) ? [0, x1$0, [0, x3, [0, x2$0, 0]]] : [0, x3, [0, x1$0, [0, x2$0, 0]]] : 0 - < /*<>*/ caml_call2(cmp, x1$0, x3) + < /*<>*/ caml_call2(cmp, x1$0, x3) ? [0, x2$0, [0, x1$0, [0, x3, 0]]] : 0 - < /*<>*/ caml_call2(cmp, x2$0, x3) + < /*<>*/ caml_call2(cmp, x2$0, x3) ? [0, x2$0, [0, x3, [0, x1$0, 0]]] : [0, x3, [0, x2$0, [0, x1$0, 0]]]; - /*<>*/ return [0, s$0, tl$1]; + /*<>*/ return [0, s$0, tl$1]; } } } - /*<>*/ var + /*<>*/ var n1 = n >> 1, n2 = n - n1 | 0, - /*<>*/ match$0 = sort(n1, l), + /*<>*/ match$0 = sort(n1, l), l2$0 = match$0[2], s1 = match$0[1], - /*<>*/ match$1 = sort(n2, l2$0), + /*<>*/ match$1 = sort(n2, l2$0), tl$0 = match$1[2], s2 = match$1[1], l1 = s1, l2 = s2, accu = 0; - /*<>*/ for(;;){ + /*<>*/ for(;;){ if(l1){ if(l2){ var t2 = l2[2], h2 = l2[1], t1 = l1[2], h1 = l1[1]; - /*<>*/ if - (0 < /*<>*/ caml_call2(cmp, h1, h2)){ - /*<>*/ /*<>*/ var + /*<>*/ if + (0 < /*<>*/ caml_call2(cmp, h1, h2)){ + /*<>*/ /*<>*/ var accu$0 = [0, h2, accu]; l2 = t2; accu = accu$0; continue; } - /*<>*/ /*<>*/ var + /*<>*/ /*<>*/ var accu$1 = [0, h1, accu]; l1 = t1; accu = accu$1; @@ -4310,29 +4398,29 @@ } else var _s_ = rev_append(l2, accu); - /*<>*/ return [0, _s_, tl$0]; + /*<>*/ return [0, _s_, tl$0]; } - /*<>*/ } - /*<>*/ /*<>*/ var len = length(l); - /*<>*/ return 2 <= len ? sort(len, l)[1] : l; - /*<>*/ } + /*<>*/ } + /*<>*/ /*<>*/ var len = length(l); + /*<>*/ return 2 <= len ? sort(len, l)[1] : l; + /*<>*/ } function sort_uniq(cmp, l){ function sort(n, l){ - /*<>*/ if(2 === n){ + /*<>*/ if(2 === n){ if(l){ var match = l[2]; if(match){ - /*<>*/ var + /*<>*/ var tl = match[2], x2 = match[1], x1 = l[1], - /*<>*/ c$0 = - /*<>*/ caml_call2(cmp, x1, x2), - /*<>*/ s = + /*<>*/ c$0 = + /*<>*/ caml_call2(cmp, x1, x2), + /*<>*/ s = 0 === c$0 ? [0, x1, 0] : 0 <= c$0 ? [0, x2, [0, x1, 0]] : [0, x1, [0, x2, 0]]; - /*<>*/ return [0, s, tl]; + /*<>*/ return [0, s, tl]; } } } @@ -4341,32 +4429,32 @@ if(_m_){ var match$2 = _m_[2]; if(match$2){ - /*<>*/ var + /*<>*/ var tl$1 = match$2[2], x3 = match$2[1], x2$0 = _m_[1], x1$0 = l[1], - /*<>*/ c$1 = - /*<>*/ caml_call2(cmp, x1$0, x2$0); - /*<>*/ if(0 === c$1) - /*<>*/ var - /*<>*/ c$2 = - /*<>*/ caml_call2(cmp, x2$0, x3), - /*<>*/ _n_ = + /*<>*/ c$1 = + /*<>*/ caml_call2(cmp, x1$0, x2$0); + /*<>*/ if(0 === c$1) + /*<>*/ var + /*<>*/ c$2 = + /*<>*/ caml_call2(cmp, x2$0, x3), + /*<>*/ _n_ = 0 === c$2 ? [0, x2$0, 0] : 0 <= c$2 ? [0, x3, [0, x2$0, 0]] : [0, x2$0, [0, x3, 0]], s$0 = _n_; else if(0 <= c$1){ - /*<>*/ /*<>*/ var - c$3 = /*<>*/ caml_call2(cmp, x1$0, x3); - /*<>*/ if(0 === c$3) + /*<>*/ /*<>*/ var + c$3 = /*<>*/ caml_call2(cmp, x1$0, x3); + /*<>*/ if(0 === c$3) var _o_ = [0, x2$0, [0, x1$0, 0]]; else if(0 <= c$3) - /*<>*/ var - /*<>*/ c$4 = - /*<>*/ caml_call2(cmp, x2$0, x3), - /*<>*/ _p_ = + /*<>*/ var + /*<>*/ c$4 = + /*<>*/ caml_call2(cmp, x2$0, x3), + /*<>*/ _p_ = 0 === c$4 ? [0, x2$0, [0, x1$0, 0]] : 0 @@ -4379,15 +4467,15 @@ var s$0 = _o_; } else{ - /*<>*/ /*<>*/ var - c$5 = /*<>*/ caml_call2(cmp, x2$0, x3); - /*<>*/ if(0 === c$5) + /*<>*/ /*<>*/ var + c$5 = /*<>*/ caml_call2(cmp, x2$0, x3); + /*<>*/ if(0 === c$5) var _q_ = [0, x1$0, [0, x2$0, 0]]; else if(0 <= c$5) - /*<>*/ var - /*<>*/ c$6 = - /*<>*/ caml_call2(cmp, x1$0, x3), - /*<>*/ _r_ = + /*<>*/ var + /*<>*/ c$6 = + /*<>*/ caml_call2(cmp, x1$0, x3), + /*<>*/ _r_ = 0 === c$6 ? [0, x1$0, [0, x2$0, 0]] : 0 @@ -4399,34 +4487,34 @@ var _q_ = [0, x1$0, [0, x2$0, [0, x3, 0]]]; var s$0 = _q_; } - /*<>*/ return [0, s$0, tl$1]; + /*<>*/ return [0, s$0, tl$1]; } } } - /*<>*/ var + /*<>*/ var n1 = n >> 1, n2 = n - n1 | 0, - /*<>*/ match$0 = rev_sort(n1, l), + /*<>*/ match$0 = rev_sort(n1, l), l2$0 = match$0[2], s1 = match$0[1], - /*<>*/ match$1 = rev_sort(n2, l2$0), + /*<>*/ match$1 = rev_sort(n2, l2$0), tl$0 = match$1[2], s2 = match$1[1], l1 = s1, l2 = s2, accu = 0; - /*<>*/ for(;;){ + /*<>*/ for(;;){ if(l1){ if(l2){ - /*<>*/ var + /*<>*/ var t2 = l2[2], h2 = l2[1], t1 = l1[2], h1 = l1[1], - /*<>*/ c = - /*<>*/ caml_call2(cmp, h1, h2); - /*<>*/ if(0 === c){ - /*<>*/ /*<>*/ var + /*<>*/ c = + /*<>*/ caml_call2(cmp, h1, h2); + /*<>*/ if(0 === c){ + /*<>*/ /*<>*/ var accu$0 = [0, h1, accu]; l1 = t1; l2 = t2; @@ -4434,13 +4522,13 @@ continue; } if(0 < c){ - /*<>*/ /*<>*/ var + /*<>*/ /*<>*/ var accu$1 = [0, h1, accu]; l1 = t1; accu = accu$1; continue; } - /*<>*/ /*<>*/ var + /*<>*/ /*<>*/ var accu$2 = [0, h2, accu]; l2 = t2; accu = accu$2; @@ -4450,25 +4538,25 @@ } else var _l_ = rev_append(l2, accu); - /*<>*/ return [0, _l_, tl$0]; + /*<>*/ return [0, _l_, tl$0]; } - /*<>*/ } + /*<>*/ } function rev_sort(n, l){ - /*<>*/ if(2 === n){ + /*<>*/ if(2 === n){ if(l){ var match = l[2]; if(match){ - /*<>*/ var + /*<>*/ var tl = match[2], x2 = match[1], x1 = l[1], - /*<>*/ c$0 = - /*<>*/ caml_call2(cmp, x1, x2), - /*<>*/ s = + /*<>*/ c$0 = + /*<>*/ caml_call2(cmp, x1, x2), + /*<>*/ s = 0 === c$0 ? [0, x1, 0] : 0 < c$0 ? [0, x1, [0, x2, 0]] : [0, x2, [0, x1, 0]]; - /*<>*/ return [0, s, tl]; + /*<>*/ return [0, s, tl]; } } } @@ -4477,34 +4565,34 @@ if(_f_){ var match$2 = _f_[2]; if(match$2){ - /*<>*/ var + /*<>*/ var tl$1 = match$2[2], x3 = match$2[1], x2$0 = _f_[1], x1$0 = l[1], - /*<>*/ c$1 = - /*<>*/ caml_call2(cmp, x1$0, x2$0); - /*<>*/ if(0 === c$1) - /*<>*/ var - /*<>*/ c$2 = - /*<>*/ caml_call2(cmp, x2$0, x3), - /*<>*/ _g_ = + /*<>*/ c$1 = + /*<>*/ caml_call2(cmp, x1$0, x2$0); + /*<>*/ if(0 === c$1) + /*<>*/ var + /*<>*/ c$2 = + /*<>*/ caml_call2(cmp, x2$0, x3), + /*<>*/ _g_ = 0 === c$2 ? [0, x2$0, 0] : 0 < c$2 ? [0, x2$0, [0, x3, 0]] : [0, x3, [0, x2$0, 0]], s$0 = _g_; else if(0 < c$1){ - /*<>*/ /*<>*/ var - c$3 = /*<>*/ caml_call2(cmp, x2$0, x3); - /*<>*/ if(0 === c$3) + /*<>*/ /*<>*/ var + c$3 = /*<>*/ caml_call2(cmp, x2$0, x3); + /*<>*/ if(0 === c$3) var _h_ = [0, x1$0, [0, x2$0, 0]]; else if(0 < c$3) var _h_ = [0, x1$0, [0, x2$0, [0, x3, 0]]]; else - /*<>*/ var - /*<>*/ c$4 = - /*<>*/ caml_call2(cmp, x1$0, x3), - /*<>*/ _i_ = + /*<>*/ var + /*<>*/ c$4 = + /*<>*/ caml_call2(cmp, x1$0, x3), + /*<>*/ _i_ = 0 === c$4 ? [0, x1$0, [0, x2$0, 0]] : 0 @@ -4515,17 +4603,17 @@ var s$0 = _h_; } else{ - /*<>*/ /*<>*/ var - c$5 = /*<>*/ caml_call2(cmp, x1$0, x3); - /*<>*/ if(0 === c$5) + /*<>*/ /*<>*/ var + c$5 = /*<>*/ caml_call2(cmp, x1$0, x3); + /*<>*/ if(0 === c$5) var _j_ = [0, x2$0, [0, x1$0, 0]]; else if(0 < c$5) var _j_ = [0, x2$0, [0, x1$0, [0, x3, 0]]]; else - /*<>*/ var - /*<>*/ c$6 = - /*<>*/ caml_call2(cmp, x2$0, x3), - /*<>*/ _k_ = + /*<>*/ var + /*<>*/ c$6 = + /*<>*/ caml_call2(cmp, x2$0, x3), + /*<>*/ _k_ = 0 === c$6 ? [0, x2$0, [0, x1$0, 0]] : 0 @@ -4535,34 +4623,34 @@ _j_ = _k_; var s$0 = _j_; } - /*<>*/ return [0, s$0, tl$1]; + /*<>*/ return [0, s$0, tl$1]; } } } - /*<>*/ var + /*<>*/ var n1 = n >> 1, n2 = n - n1 | 0, - /*<>*/ match$0 = sort(n1, l), + /*<>*/ match$0 = sort(n1, l), l2$0 = match$0[2], s1 = match$0[1], - /*<>*/ match$1 = sort(n2, l2$0), + /*<>*/ match$1 = sort(n2, l2$0), tl$0 = match$1[2], s2 = match$1[1], l1 = s1, l2 = s2, accu = 0; - /*<>*/ for(;;){ + /*<>*/ for(;;){ if(l1){ if(l2){ - /*<>*/ var + /*<>*/ var t2 = l2[2], h2 = l2[1], t1 = l1[2], h1 = l1[1], - /*<>*/ c = - /*<>*/ caml_call2(cmp, h1, h2); - /*<>*/ if(0 === c){ - /*<>*/ /*<>*/ var + /*<>*/ c = + /*<>*/ caml_call2(cmp, h1, h2); + /*<>*/ if(0 === c){ + /*<>*/ /*<>*/ var accu$0 = [0, h1, accu]; l1 = t1; l2 = t2; @@ -4570,13 +4658,13 @@ continue; } if(0 <= c){ - /*<>*/ /*<>*/ var + /*<>*/ /*<>*/ var accu$1 = [0, h2, accu]; l2 = t2; accu = accu$1; continue; } - /*<>*/ /*<>*/ var + /*<>*/ /*<>*/ var accu$2 = [0, h1, accu]; l1 = t1; accu = accu$2; @@ -4586,116 +4674,116 @@ } else var _e_ = rev_append(l2, accu); - /*<>*/ return [0, _e_, tl$0]; + /*<>*/ return [0, _e_, tl$0]; } - /*<>*/ } - /*<>*/ /*<>*/ var len = length(l); - /*<>*/ return 2 <= len ? sort(len, l)[1] : l; - /*<>*/ } + /*<>*/ } + /*<>*/ /*<>*/ var len = length(l); + /*<>*/ return 2 <= len ? sort(len, l)[1] : l; + /*<>*/ } function compare_lengths(l1, l2){ - /*<>*/ var l1$0 = l1, l2$0 = l2; - /*<>*/ for(;;){ + /*<>*/ var l1$0 = l1, l2$0 = l2; + /*<>*/ for(;;){ if(! l1$0) return l2$0 ? -1 : 0; - if(! l2$0) /*<>*/ return 1; + if(! l2$0) /*<>*/ return 1; var l2$1 = l2$0[2], l1$1 = l1$0[2]; l1$0 = l1$1; l2$0 = l2$1; } - /*<>*/ } + /*<>*/ } function compare_length_with(l, n){ - /*<>*/ var l$0 = l, n$0 = n; - /*<>*/ for(;;){ + /*<>*/ var l$0 = l, n$0 = n; + /*<>*/ for(;;){ if(! l$0) return 0 === n$0 ? 0 : 0 < n$0 ? -1 : 1; var l$1 = l$0[2]; - /*<>*/ if(0 >= n$0) /*<>*/ return 1; - /*<>*/ /*<>*/ var n$1 = n$0 - 1 | 0; + /*<>*/ if(0 >= n$0) /*<>*/ return 1; + /*<>*/ /*<>*/ var n$1 = n$0 - 1 | 0; l$0 = l$1; n$0 = n$1; } - /*<>*/ } + /*<>*/ } function is_empty(param){ - /*<>*/ return param ? 0 : 1; - /*<>*/ } + /*<>*/ return param ? 0 : 1; + /*<>*/ } function equal(eq, l1, l2){ - /*<>*/ var l1$0 = l1, l2$0 = l2; - /*<>*/ for(;;){ + /*<>*/ var l1$0 = l1, l2$0 = l2; + /*<>*/ for(;;){ if(l1$0){ if(l2$0){ - /*<>*/ var + /*<>*/ var l2$1 = l2$0[2], a2 = l2$0[1], l1$1 = l1$0[2], a1 = l1$0[1], - /*<>*/ _d_ = - /*<>*/ caml_call2(eq, a1, a2); - /*<>*/ if(! _d_) /*<>*/ return _d_; + /*<>*/ _d_ = + /*<>*/ caml_call2(eq, a1, a2); + /*<>*/ if(! _d_) /*<>*/ return _d_; l1$0 = l1$1; l2$0 = l2$1; continue; } } - else if(! l2$0) /*<>*/ return 1; - /*<>*/ return 0; + else if(! l2$0) /*<>*/ return 1; + /*<>*/ return 0; } - /*<>*/ } + /*<>*/ } function compare(cmp, l1, l2){ - /*<>*/ var l1$0 = l1, l2$0 = l2; - /*<>*/ for(;;){ + /*<>*/ var l1$0 = l1, l2$0 = l2; + /*<>*/ for(;;){ if(! l1$0) return l2$0 ? -1 : 0; var l1$1 = l1$0[2], a1 = l1$0[1]; - if(! l2$0) /*<>*/ return 1; - /*<>*/ var + if(! l2$0) /*<>*/ return 1; + /*<>*/ var l2$1 = l2$0[2], a2 = l2$0[1], - /*<>*/ c = - /*<>*/ caml_call2(cmp, a1, a2); - /*<>*/ if(0 !== c) /*<>*/ return c; + /*<>*/ c = + /*<>*/ caml_call2(cmp, a1, a2); + /*<>*/ if(0 !== c) /*<>*/ return c; l1$0 = l1$1; l2$0 = l2$1; } - /*<>*/ } + /*<>*/ } function to_seq(l){ - /*<>*/ function aux(l, param){ - /*<>*/ if(! l) /*<>*/ return 0; + /*<>*/ function aux(l, param){ + /*<>*/ if(! l) /*<>*/ return 0; var tail = l[2], x = l[1]; - /*<>*/ return [0, + /*<>*/ return [0, x, function(_c_){ /*<>*/ return aux(tail, _c_);}]; - /*<>*/ } - /*<>*/ return function(_b_){ + /*<>*/ } + /*<>*/ return function(_b_){ /*<>*/ return aux(l, _b_);}; - /*<>*/ } + /*<>*/ } function of_seq(seq){ - /*<>*/ /*<>*/ var - match = /*<>*/ caml_call1(seq, 0); - if(! match) /*<>*/ return 0; - /*<>*/ var + /*<>*/ /*<>*/ var + match = /*<>*/ caml_call1(seq, 0); + if(! match) /*<>*/ return 0; + /*<>*/ var seq$0 = match[2], x1 = match[1], - /*<>*/ match$0 = - /*<>*/ caml_call1(seq$0, 0); - if(! match$0) /*<>*/ return [0, x1, 0]; - /*<>*/ var + /*<>*/ match$0 = + /*<>*/ caml_call1(seq$0, 0); + if(! match$0) /*<>*/ return [0, x1, 0]; + /*<>*/ var seq$1 = match$0[2], x2 = match$0[1], - /*<>*/ block = [0, x2, 24029], + /*<>*/ block = [0, x2, 24029], dst = block, offset = 1, seq$2 = seq$1; - /*<>*/ for(;;){ - /*<>*/ /*<>*/ var - match$1 = /*<>*/ caml_call1(seq$2, 0); + /*<>*/ for(;;){ + /*<>*/ /*<>*/ var + match$1 = /*<>*/ caml_call1(seq$2, 0); if(match$1){ - /*<>*/ var + /*<>*/ var seq$3 = match$1[2], x1$0 = match$1[1], - /*<>*/ match$2 = - /*<>*/ caml_call1(seq$3, 0); + /*<>*/ match$2 = + /*<>*/ caml_call1(seq$3, 0); if(match$2){ - /*<>*/ var + /*<>*/ var seq$4 = match$2[2], x2$0 = match$2[1], - /*<>*/ dst$0 = [0, x2$0, 24029]; + /*<>*/ dst$0 = [0, x2$0, 24029]; dst[1 + offset] = [0, x1$0, dst$0]; dst = dst$0; offset = 1; @@ -4706,9 +4794,9 @@ } else dst[1 + offset] = 0; - /*<>*/ return [0, x1, block]; + /*<>*/ return [0, x1, block]; } - /*<>*/ } + /*<>*/ } var Stdlib_List = [0, @@ -4758,6 +4846,10 @@ find_all, find_all, filteri, + take, + drop, + take_while, + drop_while, partition, partition_map, assoc, @@ -4777,7 +4869,7 @@ merge, to_seq, of_seq]; - runtime.caml_register_global(17, Stdlib_List, "Stdlib__List"); + runtime.caml_register_global(19, Stdlib_List, "Stdlib__List"); return; /*<>*/ } (globalThis)); @@ -11054,7 +11146,7 @@ if(_q_[2]){ /*<>*/ var /*<>*/ l$0 = - /*<>*/ caml_call2(Stdlib_List[62], Ord[1], l), + /*<>*/ caml_call2(Stdlib_List[66], Ord[1], l), sub = function(n, l){ /*<>*/ if(3 >= n >>> 0) @@ -12368,7 +12460,7 @@ /*<>*/ return caml_call3(Stdlib_List[26], f, acc, s[1]); /*<>*/ } function to_seq(s){ - /*<>*/ return caml_call1(Stdlib_List[64], s[1]); + /*<>*/ return caml_call1(Stdlib_List[68], s[1]); /*<>*/ } function add_seq(q, i){ /*<>*/ return /*<>*/ caml_call2 @@ -21359,89 +21451,91 @@ /*<>*/ } function of_list(li){ /*<>*/ /*<>*/ var a = create(0); - /*<>*/ /*<>*/ caml_call2 + /*<>*/ ensure_capacity + (a, /*<>*/ caml_call1(Stdlib_List[1], li)); + /*<>*/ /*<>*/ caml_call2 (Stdlib_List[18], function(x){ - /*<>*/ return add_last(a, x); - /*<>*/ }, + /*<>*/ return add_last(a, x); + /*<>*/ }, li); - /*<>*/ return a; - /*<>*/ } + /*<>*/ return a; + /*<>*/ } function to_list(a){ - /*<>*/ var length = a[1], arr = a[2]; - /*<>*/ check_valid_length(length, arr); - /*<>*/ var - /*<>*/ l = [0, 0], - /*<>*/ _l_ = length - 1 | 0; + /*<>*/ var length = a[1], arr = a[2]; + /*<>*/ check_valid_length(length, arr); + /*<>*/ var + /*<>*/ l = [0, 0], + /*<>*/ _l_ = length - 1 | 0; if(_l_ >= 0){ var i = _l_; for(;;){ var _m_ = l[1]; l[1] = [0, unsafe_get(arr, i, length), _m_]; - /*<>*/ /*<>*/ var + /*<>*/ /*<>*/ var _n_ = i - 1 | 0; if(0 === i) break; i = _n_; } } - /*<>*/ check_same_length(cst_to_list, a, length); + /*<>*/ check_same_length(cst_to_list, a, length); return l[1]; - /*<>*/ } + /*<>*/ } function of_seq(seq){ - /*<>*/ /*<>*/ var + /*<>*/ /*<>*/ var init = create(0); - /*<>*/ append_seq(init, seq); - /*<>*/ return init; - /*<>*/ } + /*<>*/ append_seq(init, seq); + /*<>*/ return init; + /*<>*/ } function to_seq(a){ - /*<>*/ var length = a[1], arr = a[2]; - /*<>*/ check_valid_length(length, arr); + /*<>*/ var length = a[1], arr = a[2]; + /*<>*/ check_valid_length(length, arr); function aux(i){ - /*<>*/ return function(param){ - /*<>*/ check_same_length(cst_to_seq, a, length); - if(length <= i) /*<>*/ return 0; - /*<>*/ /*<>*/ var + /*<>*/ return function(param){ + /*<>*/ check_same_length(cst_to_seq, a, length); + if(length <= i) /*<>*/ return 0; + /*<>*/ /*<>*/ var v = unsafe_get(arr, i, length); - /*<>*/ return [0, v, aux(i + 1 | 0)]; /*<>*/ }; - /*<>*/ } - /*<>*/ return aux(0); - /*<>*/ } + /*<>*/ return [0, v, aux(i + 1 | 0)]; /*<>*/ }; + /*<>*/ } + /*<>*/ return aux(0); + /*<>*/ } function to_seq_reentrant(a){ function aux(i){ - /*<>*/ return function(param){ - /*<>*/ if(a[1] <= i) - /*<>*/ return 0; - /*<>*/ /*<>*/ var + /*<>*/ return function(param){ + /*<>*/ if(a[1] <= i) + /*<>*/ return 0; + /*<>*/ /*<>*/ var v = get(a, i); - /*<>*/ return [0, v, aux(i + 1 | 0)]; /*<>*/ }; - /*<>*/ } - /*<>*/ return aux(0); - /*<>*/ } + /*<>*/ return [0, v, aux(i + 1 | 0)]; /*<>*/ }; + /*<>*/ } + /*<>*/ return aux(0); + /*<>*/ } function to_seq_rev(a){ - /*<>*/ var length = a[1], arr = a[2]; - /*<>*/ check_valid_length(length, arr); + /*<>*/ var length = a[1], arr = a[2]; + /*<>*/ check_valid_length(length, arr); function aux(i){ - /*<>*/ return function(param){ - /*<>*/ check_same_length(cst_to_seq_rev, a, length); - if(0 > i) /*<>*/ return 0; - /*<>*/ /*<>*/ var + /*<>*/ return function(param){ + /*<>*/ check_same_length(cst_to_seq_rev, a, length); + if(0 > i) /*<>*/ return 0; + /*<>*/ /*<>*/ var v = unsafe_get(arr, i, length); - /*<>*/ return [0, v, aux(i - 1 | 0)]; /*<>*/ }; - /*<>*/ } - /*<>*/ return aux(length - 1 | 0); - /*<>*/ } + /*<>*/ return [0, v, aux(i - 1 | 0)]; /*<>*/ }; + /*<>*/ } + /*<>*/ return aux(length - 1 | 0); + /*<>*/ } function to_seq_rev_reentrant(a){ function aux(i){ - /*<>*/ return function(param){ - /*<>*/ if(0 > i) - /*<>*/ return 0; - if(a[1] <= i) /*<>*/ return aux(a[1] - 1 | 0)(0); - /*<>*/ /*<>*/ var + /*<>*/ return function(param){ + /*<>*/ if(0 > i) + /*<>*/ return 0; + if(a[1] <= i) /*<>*/ return aux(a[1] - 1 | 0)(0); + /*<>*/ /*<>*/ var v = get(a, i); - /*<>*/ return [0, v, aux(i - 1 | 0)]; /*<>*/ }; - /*<>*/ } - /*<>*/ return aux(a[1] - 1 | 0); - /*<>*/ } + /*<>*/ return [0, v, aux(i - 1 | 0)]; /*<>*/ }; + /*<>*/ } + /*<>*/ return aux(a[1] - 1 | 0); + /*<>*/ } var Stdlib_Dynarray = [0, @@ -27131,15 +27225,15 @@ Stdlib_Int = global_data.Stdlib__Int, Stdlib_Bytes = global_data.Stdlib__Bytes; function id(x){ /*<>*/ return x; /*<>*/ } - /*<>*/ var + /*<>*/ var zero = 0, unknown = -1, - /*<>*/ String_tag = + /*<>*/ String_tag = [248, "Stdlib.Format.String_tag", runtime.caml_fresh_oo_id(0)]; function pp_enqueue(state, token){ - /*<>*/ state[13] = state[13] + token[3] | 0; + /*<>*/ state[13] = state[13] + token[3] | 0; return caml_call2(Stdlib_Queue[3], token, state[28]); - /*<>*/ } + /*<>*/ } var pp_infinity = 1000000010, _b_ = [0, cst$16], @@ -27149,65 +27243,65 @@ _f_ = [1, "max_indent < 2"], cst_Format_pp_set_geometry = "Format.pp_set_geometry: "; function pp_output_string(state, s){ - /*<>*/ return caml_call3 + /*<>*/ return caml_call3 (state[17], s, 0, caml_ml_string_length(s)); - /*<>*/ } + /*<>*/ } function pp_output_newline(state){ - /*<>*/ return /*<>*/ caml_call1 + /*<>*/ return /*<>*/ caml_call1 (state[19], 0); - /*<>*/ } + /*<>*/ } function format_pp_text(state, size, text){ - /*<>*/ state[9] = state[9] - size | 0; - /*<>*/ pp_output_string(state, text); + /*<>*/ state[9] = state[9] - size | 0; + /*<>*/ pp_output_string(state, text); state[11] = 0; return; - /*<>*/ } + /*<>*/ } function format_string(state, s){ - /*<>*/ /*<>*/ var - _a__ = s !== cst$16 ? 1 : 0; - /*<>*/ return _a__ + /*<>*/ /*<>*/ var + _a$_ = s !== cst$16 ? 1 : 0; + /*<>*/ return _a$_ ? format_pp_text(state, caml_ml_string_length(s), s) - : _a__; - /*<>*/ } + : _a$_; + /*<>*/ } function break_new_line(state, param, width){ var after = param[3], offset = param[2], before = param[1]; - /*<>*/ format_string(state, before); - /*<>*/ pp_output_newline(state); + /*<>*/ format_string(state, before); + /*<>*/ pp_output_newline(state); state[11] = 1; - /*<>*/ var + /*<>*/ var indent = (state[6] - width | 0) + offset | 0, - /*<>*/ real_indent = - /*<>*/ caml_call2(Stdlib_Int[10], state[8], indent); + /*<>*/ real_indent = + /*<>*/ caml_call2(Stdlib_Int[10], state[8], indent); state[10] = real_indent; state[9] = state[6] - state[10] | 0; var n = state[10]; - /*<>*/ /*<>*/ caml_call1 + /*<>*/ /*<>*/ caml_call1 (state[21], n); - /*<>*/ return format_string(state, after); + /*<>*/ return format_string(state, after); } function break_same_line(state, param){ var after = param[3], width = param[2], before = param[1]; - /*<>*/ format_string(state, before); + /*<>*/ format_string(state, before); state[9] = state[9] - width | 0; - /*<>*/ /*<>*/ caml_call1 + /*<>*/ /*<>*/ caml_call1 (state[20], width); - /*<>*/ return format_string(state, after); + /*<>*/ return format_string(state, after); } function format_pp_token(state, size$0, param){ /*<>*/ if(typeof param === "number") switch(param){ case 0: - /*<>*/ /*<>*/ var + /*<>*/ /*<>*/ var match$3 = - /*<>*/ caml_call1(Stdlib_Stack[8], state[3]); - if(! match$3) /*<>*/ return; - /*<>*/ var + /*<>*/ caml_call1(Stdlib_Stack[8], state[3]); + if(! match$3) /*<>*/ return; + /*<>*/ var tabs = match$3[1][1], - /*<>*/ add_tab = + /*<>*/ add_tab = function(n, ls){ - /*<>*/ if(! ls) /*<>*/ return [0, n, 0]; + /*<>*/ if(! ls) /*<>*/ return [0, n, 0]; var l = ls[2], x = ls[1]; - /*<>*/ return /*<>*/ runtime.caml_lessthan + /*<>*/ return /*<>*/ runtime.caml_lessthan (n, x) ? [0, n, ls] : [0, x, add_tab(n, l)]; @@ -27215,68 +27309,75 @@ tabs[1] = add_tab(state[6] - state[9] | 0, tabs[1]); return; case 1: - /*<>*/ /*<>*/ caml_call1 + /*<>*/ /*<>*/ caml_call1 (Stdlib_Stack[5], state[2]); - /*<>*/ return; + /*<>*/ return; case 2: - /*<>*/ /*<>*/ caml_call1 + /*<>*/ /*<>*/ caml_call1 (Stdlib_Stack[5], state[3]); - /*<>*/ return; + /*<>*/ return; case 3: - /*<>*/ /*<>*/ var + /*<>*/ /*<>*/ var match$4 = - /*<>*/ caml_call1(Stdlib_Stack[8], state[2]); + /*<>*/ caml_call1(Stdlib_Stack[8], state[2]); if(! match$4) - /*<>*/ return pp_output_newline(state); + /*<>*/ return pp_output_newline(state); var width$0 = match$4[1][2]; - /*<>*/ return break_new_line(state, _a_, width$0); + /*<>*/ return break_new_line(state, _a_, width$0); case 4: - var _a8_ = state[10] !== (state[6] - state[9] | 0) ? 1 : 0; - if(! _a8_) return _a8_; - /*<>*/ /*<>*/ var + var _a9_ = state[10] !== (state[6] - state[9] | 0) ? 1 : 0; + if(! _a9_) return _a9_; + /*<>*/ /*<>*/ var match$1 = - /*<>*/ caml_call1(Stdlib_Queue[6], state[28]); - if(! match$1) /*<>*/ return; + /*<>*/ caml_call1(Stdlib_Queue[6], state[28]); + if(! match$1) /*<>*/ return; var match$2 = match$1[1], size = match$2[1], length = match$2[3]; state[12] = state[12] - length | 0; state[9] = state[9] + size | 0; return; default: - /*<>*/ /*<>*/ var + /*<>*/ /*<>*/ var match$5 = - /*<>*/ caml_call1(Stdlib_Stack[5], state[5]); - if(! match$5) /*<>*/ return; - /*<>*/ var + /*<>*/ caml_call1(Stdlib_Stack[5], state[5]); + if(! match$5) /*<>*/ return; + /*<>*/ var tag_name = match$5[1], - /*<>*/ marker = - /*<>*/ caml_call1(state[25], tag_name); - /*<>*/ return pp_output_string(state, marker); + /*<>*/ marker = + /*<>*/ caml_call1(state[25], tag_name); + /*<>*/ return pp_output_string(state, marker); } switch(param[0]){ case 0: var s = param[1]; - /*<>*/ return format_pp_text(state, size$0, s); + /*<>*/ return format_pp_text(state, size$0, s); case 1: - /*<>*/ var + var len = param[3], pos = param[2], source = param[1]; + state[9] = state[9] - size$0 | 0; + /*<>*/ /*<>*/ caml_call3 + (state[17], source, pos, len); + state[11] = 0; + return; + case 2: + /*<>*/ var breaks = param[2], fits = param[1], - /*<>*/ off = breaks[2], + /*<>*/ off = breaks[2], before = breaks[1], - /*<>*/ match$6 = - /*<>*/ caml_call1(Stdlib_Stack[8], state[2]); - if(! match$6) /*<>*/ return; + /*<>*/ match$6 = + /*<>*/ caml_call1(Stdlib_Stack[8], state[2]); + if(! match$6) /*<>*/ return; var match$7 = match$6[1], width$1 = match$7[2], box_type$0 = match$7[1]; - /*<>*/ switch(box_type$0){ + /*<>*/ switch(box_type$0){ case 0: - /*<>*/ return break_same_line(state, fits); + /*<>*/ return break_same_line(state, fits); case 1: - /*<>*/ return break_new_line + /*<>*/ return break_new_line (state, breaks, width$1); case 2: - /*<>*/ return break_new_line + /*<>*/ return break_new_line (state, breaks, width$1); case 3: return state[9] < (size$0 + caml_ml_string_length(before) | 0) @@ -27299,240 +27400,240 @@ ? break_new_line(state, breaks, width$1) : break_same_line(state, fits); default: - /*<>*/ return break_same_line(state, fits); + /*<>*/ return break_same_line(state, fits); } - case 2: - /*<>*/ var + case 3: + /*<>*/ var off$0 = param[2], n = param[1], insertion_point = state[6] - state[9] | 0, - /*<>*/ match$8 = - /*<>*/ caml_call1(Stdlib_Stack[8], state[3]); - if(! match$8) /*<>*/ return; - /*<>*/ var + /*<>*/ match$8 = + /*<>*/ caml_call1(Stdlib_Stack[8], state[3]); + if(! match$8) /*<>*/ return; + /*<>*/ var tabs$0 = match$8[1][1], - /*<>*/ match$9 = tabs$0[1]; + /*<>*/ match$9 = tabs$0[1]; if(match$9){ var first = match$9[1], param$0 = tabs$0[1]; - /*<>*/ for(;;){ + /*<>*/ for(;;){ if(param$0){ var tail = param$0[2], head = param$0[1]; if(insertion_point > head){param$0 = tail; continue;} - var _a9_ = head; + var _a__ = head; } else - var _a9_ = first; - var tab = _a9_; + var _a__ = first; + var tab = _a__; break; } } else var tab = insertion_point; var offset = tab - insertion_point | 0; - /*<>*/ return 0 <= offset + /*<>*/ return 0 <= offset ? break_same_line(state, [0, cst$0, offset + n | 0, cst]) : break_new_line (state, [0, cst$2, tab + off$0 | 0, cst$1], state[6]); - case 3: + case 4: var ty = param[2], off$1 = param[1], insertion_point$0 = state[6] - state[9] | 0; if(state[8] < insertion_point$0){ - /*<>*/ /*<>*/ var + /*<>*/ /*<>*/ var match = - /*<>*/ caml_call1(Stdlib_Stack[8], state[2]); + /*<>*/ caml_call1(Stdlib_Stack[8], state[2]); if(match){ var match$0 = match[1], width = match$0[2], box_type = match$0[1]; if(state[9] < width && 3 >= box_type - 1 >>> 0) - /*<>*/ break_new_line(state, _a_, width); + /*<>*/ break_new_line(state, _a_, width); } else - /*<>*/ pp_output_newline(state); + /*<>*/ pp_output_newline(state); } - /*<>*/ var + /*<>*/ var width$2 = state[9] - off$1 | 0, - /*<>*/ box_type$1 = + /*<>*/ box_type$1 = 1 === ty ? 1 : state[9] < size$0 ? ty : 5; - /*<>*/ return /*<>*/ caml_call2 + /*<>*/ return /*<>*/ caml_call2 (Stdlib_Stack[3], [0, box_type$1, width$2], state[2]); - case 4: + case 5: var tbox = param[1]; - /*<>*/ return /*<>*/ caml_call2 + /*<>*/ return /*<>*/ caml_call2 (Stdlib_Stack[3], tbox, state[3]); default: - /*<>*/ var + /*<>*/ var tag_name$0 = param[1], - /*<>*/ marker$0 = - /*<>*/ caml_call1(state[24], tag_name$0); - /*<>*/ pp_output_string(state, marker$0); + /*<>*/ marker$0 = + /*<>*/ caml_call1(state[24], tag_name$0); + /*<>*/ pp_output_string(state, marker$0); return caml_call2(Stdlib_Stack[3], tag_name$0, state[5]); } } function advance_left(state){ - /*<>*/ for(;;){ - /*<>*/ /*<>*/ var - match = /*<>*/ caml_call1(Stdlib_Queue[9], state[28]); - if(! match) /*<>*/ return 0; - /*<>*/ var + /*<>*/ for(;;){ + /*<>*/ /*<>*/ var + match = /*<>*/ caml_call1(Stdlib_Queue[9], state[28]); + if(! match) /*<>*/ return 0; + /*<>*/ var match$0 = match[1], size = match$0[1], length = match$0[3], token = match$0[2], pending_count = state[13] - state[12] | 0, - _a6_ = 0 <= size ? 1 : 0, - /*<>*/ _a7_ = - _a6_ || (state[9] <= pending_count ? 1 : 0); - if(! _a7_) /*<>*/ return _a7_; - /*<>*/ /*<>*/ caml_call1 + _a7_ = 0 <= size ? 1 : 0, + /*<>*/ _a8_ = + _a7_ || (state[9] <= pending_count ? 1 : 0); + if(! _a8_) /*<>*/ return _a8_; + /*<>*/ /*<>*/ caml_call1 (Stdlib_Queue[5], state[28]); - /*<>*/ /*<>*/ var + /*<>*/ /*<>*/ var size$0 = 0 <= size ? size : pp_infinity; - /*<>*/ format_pp_token(state, size$0, token); + /*<>*/ format_pp_token(state, size$0, token); state[12] = length + state[12] | 0; } - /*<>*/ } + /*<>*/ } function enqueue_advance(state, tok){ - /*<>*/ pp_enqueue(state, tok); - /*<>*/ return advance_left(state); - /*<>*/ } + /*<>*/ pp_enqueue(state, tok); + /*<>*/ return advance_left(state); + /*<>*/ } function enqueue_string_as(state, size, s){ - /*<>*/ return enqueue_advance + /*<>*/ return enqueue_advance (state, [0, size, [0, s], size]); - /*<>*/ } + /*<>*/ } function initialize_scan_stack(stack){ - /*<>*/ /*<>*/ caml_call1 + /*<>*/ /*<>*/ caml_call1 (Stdlib_Stack[9], stack); - /*<>*/ /*<>*/ var + /*<>*/ /*<>*/ var queue_elem = [0, unknown, _b_, 0]; - /*<>*/ return /*<>*/ caml_call2 + /*<>*/ return /*<>*/ caml_call2 (Stdlib_Stack[3], [0, -1, queue_elem], stack); - /*<>*/ } + /*<>*/ } function set_size(state, ty){ - /*<>*/ /*<>*/ var - match = /*<>*/ caml_call1(Stdlib_Stack[8], state[1]); - if(! match) /*<>*/ return; - /*<>*/ var + /*<>*/ /*<>*/ var + match = /*<>*/ caml_call1(Stdlib_Stack[8], state[1]); + if(! match) /*<>*/ return; + /*<>*/ var match$0 = match[1], queue_elem = match$0[2], left_total = match$0[1], - /*<>*/ size = queue_elem[1]; + /*<>*/ size = queue_elem[1]; if(left_total < state[12]) return initialize_scan_stack(state[1]); - var _a5_ = queue_elem[2]; - if(typeof _a5_ !== "number") - switch(_a5_[0]){ - case 3: + var _a6_ = queue_elem[2]; + if(typeof _a6_ !== "number") + switch(_a6_[0]){ + case 4: if(1 - ty){ var x$0 = state[13] + size | 0; queue_elem[1] = x$0; - /*<>*/ /*<>*/ caml_call1 + /*<>*/ /*<>*/ caml_call1 (Stdlib_Stack[5], state[1]); } - /*<>*/ return; - case 1: + /*<>*/ return; case 2: + case 3: if(ty){ var x = state[13] + size | 0; queue_elem[1] = x; - /*<>*/ /*<>*/ caml_call1 + /*<>*/ /*<>*/ caml_call1 (Stdlib_Stack[5], state[1]); } - /*<>*/ return; + /*<>*/ return; } - /*<>*/ return; - /*<>*/ } + /*<>*/ return; + /*<>*/ } function scan_push(state, b, token){ - /*<>*/ pp_enqueue(state, token); - if(b) /*<>*/ set_size(state, 1); - /*<>*/ /*<>*/ var + /*<>*/ pp_enqueue(state, token); + if(b) /*<>*/ set_size(state, 1); + /*<>*/ /*<>*/ var elem = [0, state[13], token]; - /*<>*/ return /*<>*/ caml_call2 + /*<>*/ return /*<>*/ caml_call2 (Stdlib_Stack[3], elem, state[1]); - /*<>*/ } + /*<>*/ } function pp_open_box_gen(state, indent, br_ty){ - /*<>*/ state[14] = state[14] + 1 | 0; + /*<>*/ state[14] = state[14] + 1 | 0; if(state[14] < state[15]){ - /*<>*/ var + /*<>*/ var size = - state[13] | 0, - /*<>*/ elem = [0, size, [3, indent, br_ty], 0]; - /*<>*/ return scan_push(state, 0, elem); + /*<>*/ elem = [0, size, [4, indent, br_ty], 0]; + /*<>*/ return scan_push(state, 0, elem); } - var _a4_ = state[14] === state[15] ? 1 : 0; - if(! _a4_) return _a4_; + var _a5_ = state[14] === state[15] ? 1 : 0; + if(! _a5_) return _a5_; var s = state[16], x = caml_ml_string_length(s); - /*<>*/ return enqueue_string_as(state, x, s); - /*<>*/ } + /*<>*/ return enqueue_string_as(state, x, s); + /*<>*/ } function pp_close_box(state, param){ - /*<>*/ var _a2_ = 1 < state[14] ? 1 : 0; - if(_a2_){ + /*<>*/ var _a3_ = 1 < state[14] ? 1 : 0; + if(_a3_){ if(state[14] < state[15]){ - /*<>*/ pp_enqueue(state, [0, zero, 1, 0]); - /*<>*/ set_size(state, 1); - /*<>*/ set_size(state, 0); + /*<>*/ pp_enqueue(state, [0, zero, 1, 0]); + /*<>*/ set_size(state, 1); + /*<>*/ set_size(state, 0); } state[14] = state[14] - 1 | 0; - var _a3_ = 0; + var _a4_ = 0; } else - var _a3_ = _a2_; - return _a3_; - /*<>*/ } + var _a4_ = _a3_; + return _a4_; + /*<>*/ } function pp_open_stag(state, tag_name){ - /*<>*/ if(state[22]){ - /*<>*/ /*<>*/ caml_call2 + /*<>*/ if(state[22]){ + /*<>*/ /*<>*/ caml_call2 (Stdlib_Stack[3], tag_name, state[4]); - /*<>*/ /*<>*/ caml_call1 + /*<>*/ /*<>*/ caml_call1 (state[26], tag_name); } - var _a1_ = state[23]; - if(! _a1_) return _a1_; - /*<>*/ /*<>*/ var - token = [5, tag_name]; - /*<>*/ return pp_enqueue(state, [0, zero, token, 0]); - /*<>*/ } + var _a2_ = state[23]; + if(! _a2_) return _a2_; + /*<>*/ /*<>*/ var + token = [6, tag_name]; + /*<>*/ return pp_enqueue(state, [0, zero, token, 0]); + /*<>*/ } function pp_close_stag(state, param){ - /*<>*/ if(state[23]) - /*<>*/ pp_enqueue(state, [0, zero, 5, 0]); - var _aZ_ = state[22]; - if(_aZ_){ - /*<>*/ /*<>*/ var - match = /*<>*/ caml_call1(Stdlib_Stack[5], state[4]); + /*<>*/ if(state[23]) + /*<>*/ pp_enqueue(state, [0, zero, 5, 0]); + var _a0_ = state[22]; + if(_a0_){ + /*<>*/ /*<>*/ var + match = /*<>*/ caml_call1(Stdlib_Stack[5], state[4]); if(match){ var tag_name = match[1]; - /*<>*/ return /*<>*/ caml_call1 + /*<>*/ return /*<>*/ caml_call1 (state[27], tag_name); } - var _a0_ = 0; + var _a1_ = 0; } else - var _a0_ = _aZ_; - /*<>*/ return _a0_; - /*<>*/ } + var _a1_ = _a0_; + /*<>*/ return _a1_; + /*<>*/ } function pp_set_print_tags(state, b){ - /*<>*/ state[22] = b; + /*<>*/ state[22] = b; return 0; - /*<>*/ } + /*<>*/ } function pp_set_mark_tags(state, b){ - /*<>*/ state[23] = b; + /*<>*/ state[23] = b; return 0; - /*<>*/ } + /*<>*/ } function pp_get_print_tags(state, param){ - /*<>*/ return state[22]; - /*<>*/ } + /*<>*/ return state[22]; + /*<>*/ } function pp_get_mark_tags(state, param){ - /*<>*/ return state[23]; - /*<>*/ } + /*<>*/ return state[23]; + /*<>*/ } function pp_set_tags(state, b){ - /*<>*/ pp_set_print_tags(state, b); - /*<>*/ return pp_set_mark_tags(state, b); - /*<>*/ } + /*<>*/ pp_set_print_tags(state, b); + /*<>*/ return pp_set_mark_tags(state, b); + /*<>*/ } function pp_get_formatter_stag_function(state, param){ - /*<>*/ return [0, + /*<>*/ return [0, state[24], state[25], state[26], state[27]]; - /*<>*/ } + /*<>*/ } function pp_set_formatter_stag_function(state, param){ var pct = param[4], pot = param[3], mct = param[2], mot = param[1]; state[24] = mot; @@ -27542,153 +27643,165 @@ return 0; } function pp_rinit(state){ - /*<>*/ state[12] = 1; + /*<>*/ state[12] = 1; state[13] = 1; caml_call1(Stdlib_Queue[11], state[28]); - /*<>*/ initialize_scan_stack(state[1]); - /*<>*/ /*<>*/ caml_call1 + /*<>*/ initialize_scan_stack(state[1]); + /*<>*/ /*<>*/ caml_call1 (Stdlib_Stack[9], state[2]); - /*<>*/ /*<>*/ caml_call1 + /*<>*/ /*<>*/ caml_call1 (Stdlib_Stack[9], state[3]); - /*<>*/ /*<>*/ caml_call1 + /*<>*/ /*<>*/ caml_call1 (Stdlib_Stack[9], state[4]); - /*<>*/ /*<>*/ caml_call1 + /*<>*/ /*<>*/ caml_call1 (Stdlib_Stack[9], state[5]); state[10] = 0; state[14] = 0; state[9] = state[6]; - /*<>*/ return pp_open_box_gen(state, 0, 3); - /*<>*/ } + /*<>*/ return pp_open_box_gen(state, 0, 3); + /*<>*/ } function pp_flush_queue(state, end_with_newline){ - /*<>*/ /*<>*/ caml_call2 + /*<>*/ /*<>*/ caml_call2 (Stdlib_Stack[13], function(param){ - /*<>*/ return pp_close_stag(state, 0); - /*<>*/ }, + /*<>*/ return pp_close_stag(state, 0); + /*<>*/ }, state[4]); - /*<>*/ for(;;){ + /*<>*/ for(;;){ if(1 >= state[14]){ state[13] = pp_infinity; - /*<>*/ advance_left(state); - if(end_with_newline) /*<>*/ pp_output_newline(state); - /*<>*/ return pp_rinit(state); + /*<>*/ advance_left(state); + if(end_with_newline) /*<>*/ pp_output_newline(state); + /*<>*/ return pp_rinit(state); } - /*<>*/ pp_close_box(state, 0); + /*<>*/ pp_close_box(state, 0); } - /*<>*/ } + /*<>*/ } function pp_print_as_size(state, size, s){ - /*<>*/ var _aY_ = state[14] < state[15] ? 1 : 0; - return _aY_ ? enqueue_string_as(state, size, s) : _aY_; - /*<>*/ } + /*<>*/ var _aZ_ = state[14] < state[15] ? 1 : 0; + return _aZ_ ? enqueue_string_as(state, size, s) : _aZ_; + /*<>*/ } function pp_print_as(state, isize, s){ - /*<>*/ return pp_print_as_size(state, isize, s); - /*<>*/ } + /*<>*/ return pp_print_as_size(state, isize, s); + /*<>*/ } function pp_print_string(state, s){ - /*<>*/ var isize = caml_ml_string_length(s); - /*<>*/ return pp_print_as_size(state, isize, s); - /*<>*/ } + /*<>*/ var isize = caml_ml_string_length(s); + /*<>*/ return pp_print_as_size(state, isize, s); + /*<>*/ } + function pp_print_substring_as(pos, len, state, size, source){ + /*<>*/ var _aY_ = state[14] < state[15] ? 1 : 0; + if(! _aY_) return _aY_; + /*<>*/ /*<>*/ var + token = [1, source, pos, len]; + /*<>*/ return enqueue_advance + (state, [0, size, token, size]); + /*<>*/ } + function pp_print_substring(pos, len, state, s){ + /*<>*/ return pp_print_substring_as + (pos, len, state, len, s); + /*<>*/ } function pp_print_bytes(state, s){ - /*<>*/ var - /*<>*/ s$0 = - /*<>*/ caml_call1(Stdlib_Bytes[6], s), + /*<>*/ var + /*<>*/ s$0 = + /*<>*/ caml_call1(Stdlib_Bytes[6], s), isize = runtime.caml_ml_bytes_length(s); - /*<>*/ return pp_print_as_size(state, isize, s$0); - /*<>*/ } + /*<>*/ return pp_print_as_size(state, isize, s$0); + /*<>*/ } function pp_print_int(state, i){ - /*<>*/ return pp_print_string - (state, /*<>*/ caml_call1(Stdlib_Int[12], i)); - /*<>*/ } + /*<>*/ return pp_print_string + (state, /*<>*/ caml_call1(Stdlib_Int[12], i)); + /*<>*/ } function pp_print_float(state, f){ - /*<>*/ return pp_print_string - (state, /*<>*/ caml_call1(Stdlib[35], f)); - /*<>*/ } + /*<>*/ return pp_print_string + (state, /*<>*/ caml_call1(Stdlib[35], f)); + /*<>*/ } function pp_print_bool(state, b){ - /*<>*/ return pp_print_string - (state, /*<>*/ caml_call1(Stdlib[30], b)); - /*<>*/ } + /*<>*/ return pp_print_string + (state, /*<>*/ caml_call1(Stdlib[30], b)); + /*<>*/ } function pp_print_char(state, c){ - /*<>*/ /*<>*/ var - s = /*<>*/ caml_call2(Stdlib_String[1], 1, c); - /*<>*/ return pp_print_as_size(state, 1, s); - /*<>*/ } - function pp_print_nothing(state, param){ /*<>*/ return 0; - /*<>*/ } + /*<>*/ /*<>*/ var + s = /*<>*/ caml_call2(Stdlib_String[1], 1, c); + /*<>*/ return pp_print_as_size(state, 1, s); + /*<>*/ } + function pp_print_nothing(state, param){ /*<>*/ return 0; + /*<>*/ } function pp_open_hbox(state, param){ - /*<>*/ return pp_open_box_gen(state, 0, 0); - /*<>*/ } + /*<>*/ return pp_open_box_gen(state, 0, 0); + /*<>*/ } function pp_open_vbox(state, indent){ - /*<>*/ return pp_open_box_gen(state, indent, 1); - /*<>*/ } + /*<>*/ return pp_open_box_gen(state, indent, 1); + /*<>*/ } function pp_open_hvbox(state, indent){ - /*<>*/ return pp_open_box_gen(state, indent, 2); - /*<>*/ } + /*<>*/ return pp_open_box_gen(state, indent, 2); + /*<>*/ } function pp_open_hovbox(state, indent){ - /*<>*/ return pp_open_box_gen(state, indent, 3); - /*<>*/ } + /*<>*/ return pp_open_box_gen(state, indent, 3); + /*<>*/ } function pp_open_box(state, indent){ - /*<>*/ return pp_open_box_gen(state, indent, 4); - /*<>*/ } + /*<>*/ return pp_open_box_gen(state, indent, 4); + /*<>*/ } function pp_print_newline(state, param){ - /*<>*/ pp_flush_queue(state, 1); - /*<>*/ return /*<>*/ caml_call1 + /*<>*/ pp_flush_queue(state, 1); + /*<>*/ return /*<>*/ caml_call1 (state[18], 0); - /*<>*/ } + /*<>*/ } function pp_print_flush(state, param){ - /*<>*/ pp_flush_queue(state, 0); - /*<>*/ return /*<>*/ caml_call1 + /*<>*/ pp_flush_queue(state, 0); + /*<>*/ return /*<>*/ caml_call1 (state[18], 0); - /*<>*/ } + /*<>*/ } function pp_force_newline(state, param){ - /*<>*/ var _aX_ = state[14] < state[15] ? 1 : 0; + /*<>*/ var _aX_ = state[14] < state[15] ? 1 : 0; return _aX_ ? enqueue_advance(state, [0, zero, 3, 0]) : _aX_; - /*<>*/ } + /*<>*/ } function pp_print_if_newline(state, param){ - /*<>*/ var _aW_ = state[14] < state[15] ? 1 : 0; + /*<>*/ var _aW_ = state[14] < state[15] ? 1 : 0; return _aW_ ? enqueue_advance(state, [0, zero, 4, 0]) : _aW_; - /*<>*/ } + /*<>*/ } function pp_print_custom_break(state, fits, breaks){ - /*<>*/ var + /*<>*/ var after = fits[3], width = fits[2], before = fits[1], _aV_ = state[14] < state[15] ? 1 : 0; if(! _aV_) return _aV_; - /*<>*/ var + /*<>*/ var size = - state[13] | 0, - /*<>*/ token = [1, fits, breaks], + /*<>*/ token = [2, fits, breaks], length = (caml_ml_string_length(before) + width | 0) - + /*<>*/ caml_ml_string_length(after) + + /*<>*/ caml_ml_string_length(after) | 0, - /*<>*/ elem = [0, size, token, length]; - /*<>*/ return scan_push(state, 1, elem); - /*<>*/ } + /*<>*/ elem = [0, size, token, length]; + /*<>*/ return scan_push(state, 1, elem); + /*<>*/ } function pp_print_break(state, width, offset){ - /*<>*/ return pp_print_custom_break + /*<>*/ return pp_print_custom_break (state, [0, cst$6, width, cst$5], [0, cst$4, offset, cst$3]); - /*<>*/ } + /*<>*/ } function pp_print_space(state, param){ - /*<>*/ return pp_print_break(state, 1, 0); - /*<>*/ } + /*<>*/ return pp_print_break(state, 1, 0); + /*<>*/ } function pp_print_cut(state, param){ - /*<>*/ return pp_print_break(state, 0, 0); - /*<>*/ } + /*<>*/ return pp_print_break(state, 0, 0); + /*<>*/ } function pp_open_tbox(state, param){ - /*<>*/ state[14] = state[14] + 1 | 0; + /*<>*/ state[14] = state[14] + 1 | 0; var _aU_ = state[14] < state[15] ? 1 : 0; if(! _aU_) return _aU_; - /*<>*/ /*<>*/ var - elem = [0, zero, [4, [0, [0, 0]]], 0]; - /*<>*/ return enqueue_advance(state, elem); - /*<>*/ } + /*<>*/ /*<>*/ var + elem = [0, zero, [5, [0, [0, 0]]], 0]; + /*<>*/ return enqueue_advance(state, elem); + /*<>*/ } function pp_close_tbox(state, param){ - /*<>*/ var _aR_ = 1 < state[14] ? 1 : 0; + /*<>*/ var _aR_ = 1 < state[14] ? 1 : 0; if(_aR_){ var _aS_ = state[14] < state[15] ? 1 : 0; if(_aS_){ - /*<>*/ /*<>*/ var + /*<>*/ /*<>*/ var elem = [0, zero, 2, 0]; - /*<>*/ enqueue_advance(state, elem); + /*<>*/ enqueue_advance(state, elem); state[14] = state[14] - 1 | 0; var _aT_ = 0; } @@ -27698,126 +27811,126 @@ else var _aT_ = _aR_; return _aT_; - /*<>*/ } + /*<>*/ } function pp_print_tbreak(state, width, offset){ - /*<>*/ var _aQ_ = state[14] < state[15] ? 1 : 0; + /*<>*/ var _aQ_ = state[14] < state[15] ? 1 : 0; if(! _aQ_) return _aQ_; - /*<>*/ var + /*<>*/ var size = - state[13] | 0, - /*<>*/ elem = [0, size, [2, width, offset], width]; - /*<>*/ return scan_push(state, 1, elem); - /*<>*/ } + /*<>*/ elem = [0, size, [3, width, offset], width]; + /*<>*/ return scan_push(state, 1, elem); + /*<>*/ } function pp_print_tab(state, param){ - /*<>*/ return pp_print_tbreak(state, 0, 0); - /*<>*/ } + /*<>*/ return pp_print_tbreak(state, 0, 0); + /*<>*/ } function pp_set_tab(state, param){ - /*<>*/ var _aP_ = state[14] < state[15] ? 1 : 0; + /*<>*/ var _aP_ = state[14] < state[15] ? 1 : 0; if(! _aP_) return _aP_; - /*<>*/ /*<>*/ var + /*<>*/ /*<>*/ var elem = [0, zero, 0, 0]; - /*<>*/ return enqueue_advance(state, elem); - /*<>*/ } + /*<>*/ return enqueue_advance(state, elem); + /*<>*/ } function pp_set_max_boxes(state, n){ - /*<>*/ var + /*<>*/ var _aN_ = 1 < n ? 1 : 0, _aO_ = _aN_ ? (state[15] = n, 0) : _aN_; return _aO_; - /*<>*/ } + /*<>*/ } function pp_get_max_boxes(state, param){ - /*<>*/ return state[15]; - /*<>*/ } + /*<>*/ return state[15]; + /*<>*/ } function pp_over_max_boxes(state, param){ - /*<>*/ return state[14] === state[15] ? 1 : 0; - /*<>*/ } + /*<>*/ return state[14] === state[15] ? 1 : 0; + /*<>*/ } function pp_set_ellipsis_text(state, s){ - /*<>*/ state[16] = s; + /*<>*/ state[16] = s; return 0; - /*<>*/ } + /*<>*/ } function pp_get_ellipsis_text(state, param){ - /*<>*/ return state[16]; - /*<>*/ } + /*<>*/ return state[16]; + /*<>*/ } function pp_limit(n){ - /*<>*/ return n < 1000000010 ? n : 1000000009; - /*<>*/ } + /*<>*/ return n < 1000000010 ? n : 1000000009; + /*<>*/ } function pp_set_max_indent(state, n$0){ - /*<>*/ var _aM_ = 1 < n$0 ? 1 : 0; + /*<>*/ var _aM_ = 1 < n$0 ? 1 : 0; if(! _aM_) return _aM_; var n$1 = state[6] - n$0 | 0, _aL_ = 1 <= n$1 ? 1 : 0; if(! _aL_) return _aL_; - /*<>*/ /*<>*/ var n = pp_limit(n$1); + /*<>*/ /*<>*/ var n = pp_limit(n$1); state[7] = n; state[8] = state[6] - state[7] | 0; - /*<>*/ return pp_rinit(state); - /*<>*/ } + /*<>*/ return pp_rinit(state); + /*<>*/ } function pp_get_max_indent(state, param){ - /*<>*/ return state[8]; - /*<>*/ } + /*<>*/ return state[8]; + /*<>*/ } function pp_set_margin(state, n){ - /*<>*/ var _aJ_ = 1 <= n ? 1 : 0; + /*<>*/ var _aJ_ = 1 <= n ? 1 : 0; if(! _aJ_) return _aJ_; - /*<>*/ /*<>*/ var n$0 = pp_limit(n); + /*<>*/ /*<>*/ var n$0 = pp_limit(n); state[6] = n$0; if(state[8] <= state[6]) var new_max_indent = state[8]; else - /*<>*/ var - /*<>*/ _aK_ = - /*<>*/ caml_call2 + /*<>*/ var + /*<>*/ _aK_ = + /*<>*/ caml_call2 (Stdlib_Int[11], state[6] - state[7] | 0, state[6] / 2 | 0), new_max_indent = - /*<>*/ caml_call2(Stdlib_Int[11], _aK_, 1); - /*<>*/ return pp_set_max_indent(state, new_max_indent); - /*<>*/ } + /*<>*/ caml_call2(Stdlib_Int[11], _aK_, 1); + /*<>*/ return pp_set_max_indent(state, new_max_indent); + /*<>*/ } function validate_geometry(param){ var margin = param[2], max_indent = param[1]; - /*<>*/ return 2 <= max_indent + /*<>*/ return 2 <= max_indent ? margin <= max_indent ? _c_ : 1000000010 <= margin ? _d_ : _e_ : _f_; } function check_geometry(geometry){ - /*<>*/ return 0 === validate_geometry(geometry)[0] + /*<>*/ return 0 === validate_geometry(geometry)[0] ? 1 : 0; - /*<>*/ } + /*<>*/ } function pp_get_margin(state, param){ - /*<>*/ return state[6]; - /*<>*/ } + /*<>*/ return state[6]; + /*<>*/ } function pp_set_full_geometry(state, param){ var margin = param[2], max_indent = param[1]; - /*<>*/ pp_set_margin(state, margin); - /*<>*/ pp_set_max_indent(state, max_indent); - /*<>*/ return 0; + /*<>*/ pp_set_margin(state, margin); + /*<>*/ pp_set_max_indent(state, max_indent); + /*<>*/ return 0; } function pp_set_geometry(state, max_indent, margin){ - /*<>*/ var - /*<>*/ geometry = [0, max_indent, margin], - /*<>*/ match = validate_geometry(geometry); + /*<>*/ var + /*<>*/ geometry = [0, max_indent, margin], + /*<>*/ match = validate_geometry(geometry); if(0 === match[0]) - /*<>*/ return pp_set_full_geometry(state, geometry); - /*<>*/ var + /*<>*/ return pp_set_full_geometry(state, geometry); + /*<>*/ var msg = match[1], - /*<>*/ _aI_ = - /*<>*/ caml_call2 + /*<>*/ _aI_ = + /*<>*/ caml_call2 (Stdlib[28], cst_Format_pp_set_geometry, msg); - /*<>*/ throw /*<>*/ caml_maybe_attach_backtrace + /*<>*/ throw /*<>*/ caml_maybe_attach_backtrace ([0, Stdlib[6], _aI_], 1); - /*<>*/ } + /*<>*/ } function pp_safe_set_geometry(state, max_indent, margin){ - /*<>*/ /*<>*/ var + /*<>*/ /*<>*/ var geometry = [0, max_indent, margin]; return 0 === validate_geometry(geometry)[0] ? pp_set_full_geometry(state, geometry) : 0; - /*<>*/ } + /*<>*/ } function pp_get_geometry(state, param){ - /*<>*/ return [0, state[8], state[6]]; - /*<>*/ } + /*<>*/ return [0, state[8], state[6]]; + /*<>*/ } function pp_update_geometry(state, update){ - /*<>*/ /*<>*/ var + /*<>*/ /*<>*/ var geometry = pp_get_geometry(state, 0); - /*<>*/ return pp_set_full_geometry - (state, /*<>*/ caml_call1(update, geometry)); - /*<>*/ } + /*<>*/ return pp_set_full_geometry + (state, /*<>*/ caml_call1(update, geometry)); + /*<>*/ } function pp_set_formatter_out_functions(state, param){ var j = param[5], i = param[4], h = param[3], g = param[2], f = param[1]; state[17] = f; @@ -27828,103 +27941,103 @@ return 0; } function pp_get_formatter_out_functions(state, param){ - /*<>*/ return [0, + /*<>*/ return [0, state[17], state[18], state[19], state[20], state[21]]; - /*<>*/ } + /*<>*/ } function pp_set_formatter_output_functi(state, f, g){ - /*<>*/ state[17] = f; + /*<>*/ state[17] = f; state[18] = g; return 0; - /*<>*/ } + /*<>*/ } function pp_get_formatter_output_functi(state, param){ - /*<>*/ return [0, state[17], state[18]]; - /*<>*/ } + /*<>*/ return [0, state[17], state[18]]; + /*<>*/ } function display_newline(state, param){ - /*<>*/ return /*<>*/ caml_call3 + /*<>*/ return /*<>*/ caml_call3 (state[17], cst$7, 0, 1); - /*<>*/ } - /*<>*/ var - /*<>*/ blank_line = - /*<>*/ caml_call2(Stdlib_String[1], 80, 32), - _g_ = [3, 0, 3]; + /*<>*/ } + /*<>*/ var + /*<>*/ blank_line = + /*<>*/ caml_call2(Stdlib_String[1], 80, 32), + _g_ = [4, 0, 3]; function display_blanks(state, n){ - /*<>*/ var n$0 = n; - /*<>*/ for(;;){ + /*<>*/ var n$0 = n; + /*<>*/ for(;;){ var _aH_ = 0 < n$0 ? 1 : 0; if(! _aH_) return _aH_; if(80 >= n$0) - /*<>*/ return /*<>*/ caml_call3 + /*<>*/ return /*<>*/ caml_call3 (state[17], blank_line, 0, n$0); - /*<>*/ /*<>*/ caml_call3 + /*<>*/ /*<>*/ caml_call3 (state[17], blank_line, 0, 80); - /*<>*/ /*<>*/ var n$1 = n$0 - 80 | 0; + /*<>*/ /*<>*/ var n$1 = n$0 - 80 | 0; n$0 = n$1; } - /*<>*/ } + /*<>*/ } function pp_set_formatter_out_channel(state, oc){ - /*<>*/ state[17] = - /*<>*/ caml_call1(Stdlib[69], oc); + /*<>*/ state[17] = + /*<>*/ caml_call1(Stdlib[69], oc); state[18] = function(param){ - /*<>*/ return /*<>*/ caml_call1 + /*<>*/ return /*<>*/ caml_call1 (Stdlib[63], oc); - /*<>*/ }; + /*<>*/ }; state[19] = function(_aG_){ /*<>*/ return display_newline(state, _aG_);}; state[20] = function(_aF_){ /*<>*/ return display_blanks(state, _aF_);}; state[21] = function(_aE_){ /*<>*/ return display_blanks(state, _aE_);}; return 0; - /*<>*/ } + /*<>*/ } function default_pp_mark_open_tag(param){ - /*<>*/ if(param[1] !== String_tag) - /*<>*/ return cst$10; - /*<>*/ var + /*<>*/ if(param[1] !== String_tag) + /*<>*/ return cst$10; + /*<>*/ var s = param[2], - /*<>*/ _aD_ = - /*<>*/ caml_call2(Stdlib[28], s, cst$8); - /*<>*/ return /*<>*/ caml_call2 + /*<>*/ _aD_ = + /*<>*/ caml_call2(Stdlib[28], s, cst$8); + /*<>*/ return /*<>*/ caml_call2 (Stdlib[28], cst$9, _aD_); - /*<>*/ } + /*<>*/ } function default_pp_mark_close_tag(param){ - /*<>*/ if(param[1] !== String_tag) - /*<>*/ return cst$13; - /*<>*/ var + /*<>*/ if(param[1] !== String_tag) + /*<>*/ return cst$13; + /*<>*/ var s = param[2], - /*<>*/ _aC_ = - /*<>*/ caml_call2(Stdlib[28], s, cst$11); - /*<>*/ return /*<>*/ caml_call2 + /*<>*/ _aC_ = + /*<>*/ caml_call2(Stdlib[28], s, cst$11); + /*<>*/ return /*<>*/ caml_call2 (Stdlib[28], cst$12, _aC_); - /*<>*/ } + /*<>*/ } function default_pp_print_open_tag(_aB_){ /*<>*/ return 0;} function default_pp_print_close_tag(_aA_){ /*<>*/ return 0;} function pp_make_formatter(f, g, h, i, j){ - /*<>*/ var - /*<>*/ pp_queue = - /*<>*/ caml_call1(Stdlib_Queue[2], 0), - /*<>*/ sys_tok = [0, unknown, _g_, 0]; - /*<>*/ /*<>*/ caml_call2 + /*<>*/ var + /*<>*/ pp_queue = + /*<>*/ caml_call1(Stdlib_Queue[2], 0), + /*<>*/ sys_tok = [0, unknown, _g_, 0]; + /*<>*/ /*<>*/ caml_call2 (Stdlib_Queue[3], sys_tok, pp_queue); - /*<>*/ /*<>*/ var - scan_stack = /*<>*/ caml_call1(Stdlib_Stack[2], 0); - /*<>*/ initialize_scan_stack(scan_stack); - /*<>*/ /*<>*/ caml_call2 + /*<>*/ /*<>*/ var + scan_stack = /*<>*/ caml_call1(Stdlib_Stack[2], 0); + /*<>*/ initialize_scan_stack(scan_stack); + /*<>*/ /*<>*/ caml_call2 (Stdlib_Stack[3], [0, 1, sys_tok], scan_stack); - /*<>*/ var - /*<>*/ pp_margin = 78, + /*<>*/ var + /*<>*/ pp_margin = 78, _aw_ = Stdlib[19], - /*<>*/ _ax_ = - /*<>*/ caml_call1(Stdlib_Stack[2], 0), - /*<>*/ _ay_ = - /*<>*/ caml_call1(Stdlib_Stack[2], 0), - /*<>*/ _az_ = - /*<>*/ caml_call1(Stdlib_Stack[2], 0); - /*<>*/ return [0, + /*<>*/ _ax_ = + /*<>*/ caml_call1(Stdlib_Stack[2], 0), + /*<>*/ _ay_ = + /*<>*/ caml_call1(Stdlib_Stack[2], 0), + /*<>*/ _az_ = + /*<>*/ caml_call1(Stdlib_Stack[2], 0); + /*<>*/ return [0, scan_stack, - /*<>*/ caml_call1(Stdlib_Stack[2], 0), + /*<>*/ caml_call1(Stdlib_Stack[2], 0), _az_, _ay_, _ax_, @@ -27953,11 +28066,11 @@ pp_queue]; } function formatter_of_out_functions(out_funs){ - /*<>*/ return pp_make_formatter + /*<>*/ return pp_make_formatter (out_funs[1], out_funs[2], out_funs[3], out_funs[4], out_funs[5]); - /*<>*/ } + /*<>*/ } function make_formatter(output, flush){ - /*<>*/ /*<>*/ var + /*<>*/ /*<>*/ var ppf = pp_make_formatter (output, @@ -27968,96 +28081,96 @@ ppf[19] = function(_as_){ /*<>*/ return display_newline(ppf, _as_);}; ppf[20] = function(_ar_){ /*<>*/ return display_blanks(ppf, _ar_);}; ppf[21] = function(_aq_){ /*<>*/ return display_blanks(ppf, _aq_);}; - /*<>*/ return ppf; - /*<>*/ } + /*<>*/ return ppf; + /*<>*/ } function formatter_of_out_channel(oc){ - /*<>*/ return make_formatter - ( /*<>*/ caml_call1(Stdlib[69], oc), + /*<>*/ return make_formatter + ( /*<>*/ caml_call1(Stdlib[69], oc), function(param){ - /*<>*/ return /*<>*/ caml_call1 + /*<>*/ return /*<>*/ caml_call1 (Stdlib[63], oc); - /*<>*/ }); - /*<>*/ } + /*<>*/ }); + /*<>*/ } function formatter_of_buffer(b){ - /*<>*/ return make_formatter - ( /*<>*/ caml_call1(Stdlib_Buffer[18], b), + /*<>*/ return make_formatter + ( /*<>*/ caml_call1(Stdlib_Buffer[18], b), function(_ap_){ /*<>*/ return 0;}); - /*<>*/ } + /*<>*/ } var pp_buffer_size = 512; function pp_make_buffer(param){ - /*<>*/ return caml_call1 + /*<>*/ return caml_call1 (Stdlib_Buffer[1], pp_buffer_size); - /*<>*/ } - /*<>*/ var - /*<>*/ stdbuf = pp_make_buffer(0), - /*<>*/ std_formatter = + /*<>*/ } + /*<>*/ var + /*<>*/ stdbuf = pp_make_buffer(0), + /*<>*/ std_formatter = formatter_of_out_channel(Stdlib[39]), - /*<>*/ err_formatter = + /*<>*/ err_formatter = formatter_of_out_channel(Stdlib[40]), - /*<>*/ str_formatter = formatter_of_buffer(stdbuf), - /*<>*/ stdbuf_key = - /*<>*/ caml_call2 + /*<>*/ str_formatter = formatter_of_buffer(stdbuf), + /*<>*/ stdbuf_key = + /*<>*/ caml_call2 (Stdlib_Domain[10][1], 0, pp_make_buffer); - /*<>*/ /*<>*/ caml_call2 + /*<>*/ /*<>*/ caml_call2 (Stdlib_Domain[10][3], stdbuf_key, stdbuf); - /*<>*/ /*<>*/ var + /*<>*/ /*<>*/ var str_formatter_key = - /*<>*/ caml_call2 + /*<>*/ caml_call2 (Stdlib_Domain[10][1], 0, function(param){ - /*<>*/ return formatter_of_buffer - ( /*<>*/ caml_call1 + /*<>*/ return formatter_of_buffer + ( /*<>*/ caml_call1 (Stdlib_Domain[10][2], stdbuf_key)); - /*<>*/ }); - /*<>*/ /*<>*/ caml_call2 + /*<>*/ }); + /*<>*/ /*<>*/ caml_call2 (Stdlib_Domain[10][3], str_formatter_key, str_formatter); - /*<>*/ function buffered_out_string(key, str, ofs, len){ - /*<>*/ /*<>*/ var - _ao_ = /*<>*/ caml_call1(Stdlib_Domain[10][2], key); - /*<>*/ return /*<>*/ caml_call4 + /*<>*/ function buffered_out_string(key, str, ofs, len){ + /*<>*/ /*<>*/ var + _ao_ = /*<>*/ caml_call1(Stdlib_Domain[10][2], key); + /*<>*/ return /*<>*/ caml_call4 (Stdlib_Buffer[18], _ao_, str, ofs, len); - /*<>*/ } + /*<>*/ } function buffered_out_flush(oc, key, param){ - /*<>*/ var - /*<>*/ buf = - /*<>*/ caml_call1(Stdlib_Domain[10][2], key), - /*<>*/ len = - /*<>*/ caml_call1(Stdlib_Buffer[7], buf), - /*<>*/ str = - /*<>*/ caml_call1(Stdlib_Buffer[2], buf); - /*<>*/ /*<>*/ caml_call4 + /*<>*/ var + /*<>*/ buf = + /*<>*/ caml_call1(Stdlib_Domain[10][2], key), + /*<>*/ len = + /*<>*/ caml_call1(Stdlib_Buffer[7], buf), + /*<>*/ str = + /*<>*/ caml_call1(Stdlib_Buffer[2], buf); + /*<>*/ /*<>*/ caml_call4 (Stdlib[69], oc, str, 0, len); - /*<>*/ /*<>*/ caml_call1 + /*<>*/ /*<>*/ caml_call1 (Stdlib[63], oc); - /*<>*/ return /*<>*/ caml_call1 + /*<>*/ return /*<>*/ caml_call1 (Stdlib_Buffer[8], buf); - /*<>*/ } - /*<>*/ var - /*<>*/ std_buf_key = - /*<>*/ caml_call2 + /*<>*/ } + /*<>*/ var + /*<>*/ std_buf_key = + /*<>*/ caml_call2 (Stdlib_Domain[10][1], 0, function(param){ - /*<>*/ return caml_call1 + /*<>*/ return caml_call1 (Stdlib_Buffer[1], pp_buffer_size); - /*<>*/ }), - /*<>*/ err_buf_key = - /*<>*/ caml_call2 + /*<>*/ }), + /*<>*/ err_buf_key = + /*<>*/ caml_call2 (Stdlib_Domain[10][1], 0, function(param){ - /*<>*/ return /*<>*/ caml_call1 + /*<>*/ return /*<>*/ caml_call1 (Stdlib_Buffer[1], pp_buffer_size); - /*<>*/ }), - /*<>*/ std_formatter_key = - /*<>*/ caml_call2 + /*<>*/ }), + /*<>*/ std_formatter_key = + /*<>*/ caml_call2 (Stdlib_Domain[10][1], 0, function(param){ - /*<>*/ var + /*<>*/ var _ac_ = Stdlib[39], - /*<>*/ ppf = + /*<>*/ ppf = pp_make_formatter (function(_al_, _am_, _an_){ /*<>*/ return buffered_out_string @@ -28075,22 +28188,22 @@ function(_af_){ /*<>*/ return display_blanks(ppf, _af_);}; ppf[21] = function(_ae_){ /*<>*/ return display_blanks(ppf, _ae_);}; - /*<>*/ /*<>*/ caml_call1 + /*<>*/ /*<>*/ caml_call1 (Stdlib_Domain[6], function(_ad_){ /*<>*/ return pp_print_flush(ppf, _ad_);}); - /*<>*/ return ppf; - /*<>*/ }); - /*<>*/ /*<>*/ caml_call2 + /*<>*/ return ppf; + /*<>*/ }); + /*<>*/ /*<>*/ caml_call2 (Stdlib_Domain[10][3], std_formatter_key, std_formatter); - /*<>*/ /*<>*/ var + /*<>*/ /*<>*/ var err_formatter_key = - /*<>*/ caml_call2 + /*<>*/ caml_call2 (Stdlib_Domain[10][1], 0, function(param){ - /*<>*/ var + /*<>*/ var _S_ = Stdlib[40], - /*<>*/ ppf = + /*<>*/ ppf = pp_make_formatter (function(_$_, _aa_, _ab_){ /*<>*/ return buffered_out_string @@ -28105,513 +28218,530 @@ ppf[19] = function(_W_){ /*<>*/ return display_newline(ppf, _W_);}; ppf[20] = function(_V_){ /*<>*/ return display_blanks(ppf, _V_);}; ppf[21] = function(_U_){ /*<>*/ return display_blanks(ppf, _U_);}; - /*<>*/ /*<>*/ caml_call1 + /*<>*/ /*<>*/ caml_call1 (Stdlib_Domain[6], function(_T_){ /*<>*/ return pp_print_flush(ppf, _T_);}); - /*<>*/ return ppf; - /*<>*/ }); - /*<>*/ /*<>*/ caml_call2 + /*<>*/ return ppf; + /*<>*/ }); + /*<>*/ /*<>*/ caml_call2 (Stdlib_Domain[10][3], err_formatter_key, err_formatter); function get_std_formatter(param){ - /*<>*/ return /*<>*/ caml_call1 + /*<>*/ return /*<>*/ caml_call1 (Stdlib_Domain[10][2], std_formatter_key); - /*<>*/ } + /*<>*/ } function get_err_formatter(param){ - /*<>*/ return caml_call1 + /*<>*/ return caml_call1 (Stdlib_Domain[10][2], err_formatter_key); - /*<>*/ } + /*<>*/ } function get_str_formatter(param){ - /*<>*/ return caml_call1 + /*<>*/ return caml_call1 (Stdlib_Domain[10][2], str_formatter_key); - /*<>*/ } + /*<>*/ } function get_stdbuf(param){ - /*<>*/ return caml_call1 + /*<>*/ return caml_call1 (Stdlib_Domain[10][2], stdbuf_key); - /*<>*/ } + /*<>*/ } function flush_buffer_formatter(buf, ppf){ - /*<>*/ pp_flush_queue(ppf, 0); - /*<>*/ /*<>*/ var - s = /*<>*/ caml_call1(Stdlib_Buffer[2], buf); - /*<>*/ /*<>*/ caml_call1 + /*<>*/ pp_flush_queue(ppf, 0); + /*<>*/ /*<>*/ var + s = /*<>*/ caml_call1(Stdlib_Buffer[2], buf); + /*<>*/ /*<>*/ caml_call1 (Stdlib_Buffer[9], buf); - /*<>*/ return s; - /*<>*/ } + /*<>*/ return s; + /*<>*/ } function flush_str_formatter(param){ - /*<>*/ var - /*<>*/ stdbuf = - /*<>*/ caml_call1(Stdlib_Domain[10][2], stdbuf_key), - /*<>*/ str_formatter = - /*<>*/ caml_call1 + /*<>*/ var + /*<>*/ stdbuf = + /*<>*/ caml_call1(Stdlib_Domain[10][2], stdbuf_key), + /*<>*/ str_formatter = + /*<>*/ caml_call1 (Stdlib_Domain[10][2], str_formatter_key); - /*<>*/ return flush_buffer_formatter + /*<>*/ return flush_buffer_formatter (stdbuf, str_formatter); - /*<>*/ } + /*<>*/ } function make_synchronized_formatter(output, flush){ - /*<>*/ return /*<>*/ caml_call2 + /*<>*/ return /*<>*/ caml_call2 (Stdlib_Domain[10][1], 0, function(param){ - /*<>*/ var - /*<>*/ buf = - /*<>*/ caml_call1 + /*<>*/ var + /*<>*/ buf = + /*<>*/ caml_call1 (Stdlib_Buffer[1], pp_buffer_size), - /*<>*/ output$0 = - /*<>*/ caml_call1(Stdlib_Buffer[18], buf); + /*<>*/ output$0 = + /*<>*/ caml_call1(Stdlib_Buffer[18], buf); function flush$0(param){ - /*<>*/ /*<>*/ var + /*<>*/ /*<>*/ var _R_ = - /*<>*/ caml_call1(Stdlib_Buffer[7], buf); - /*<>*/ /*<>*/ caml_call3 + /*<>*/ caml_call1(Stdlib_Buffer[7], buf); + /*<>*/ /*<>*/ caml_call3 (output, - /*<>*/ caml_call1(Stdlib_Buffer[2], buf), + /*<>*/ caml_call1(Stdlib_Buffer[2], buf), 0, _R_); - /*<>*/ /*<>*/ caml_call1 + /*<>*/ /*<>*/ caml_call1 (Stdlib_Buffer[8], buf); - /*<>*/ return /*<>*/ caml_call1 + /*<>*/ return /*<>*/ caml_call1 (flush, 0); - /*<>*/ } - /*<>*/ return make_formatter + /*<>*/ } + /*<>*/ return make_formatter (output$0, flush$0); - /*<>*/ }); - /*<>*/ } + /*<>*/ }); + /*<>*/ } function synchronized_formatter_of_out_(oc){ - /*<>*/ return make_synchronized_formatter - ( /*<>*/ caml_call1(Stdlib[69], oc), + /*<>*/ return make_synchronized_formatter + ( /*<>*/ caml_call1(Stdlib[69], oc), function(param){ - /*<>*/ return /*<>*/ caml_call1 + /*<>*/ return /*<>*/ caml_call1 (Stdlib[63], oc); - /*<>*/ }); - /*<>*/ } - function make_symbolic_output_buffer(param){ /*<>*/ return [0, 0]; - /*<>*/ } + /*<>*/ }); + /*<>*/ } + function make_symbolic_output_buffer(param){ /*<>*/ return [0, 0]; + /*<>*/ } function clear_symbolic_output_buffer(sob){ - /*<>*/ sob[1] = 0; + /*<>*/ sob[1] = 0; return 0; - /*<>*/ } + /*<>*/ } function get_symbolic_output_buffer(sob){ - /*<>*/ return caml_call1(Stdlib_List[10], sob[1]); - /*<>*/ } + /*<>*/ return caml_call1(Stdlib_List[10], sob[1]); + /*<>*/ } function flush_symbolic_output_buffer(sob){ - /*<>*/ /*<>*/ var + /*<>*/ /*<>*/ var items = get_symbolic_output_buffer(sob); - /*<>*/ clear_symbolic_output_buffer(sob); - /*<>*/ return items; - /*<>*/ } + /*<>*/ clear_symbolic_output_buffer(sob); + /*<>*/ return items; + /*<>*/ } function add_symbolic_output_item(sob, item){ - /*<>*/ sob[1] = [0, item, sob[1]]; + /*<>*/ sob[1] = [0, item, sob[1]]; return 0; - /*<>*/ } + /*<>*/ } function formatter_of_symbolic_output_b(sob){ - /*<>*/ function f(s, i, n){ - /*<>*/ return add_symbolic_output_item + /*<>*/ function f(s, i, n){ + /*<>*/ return add_symbolic_output_item (sob, [0, - /*<>*/ caml_call3 + /*<>*/ caml_call3 (Stdlib_String[16], s, i, n)]); } - /*<>*/ function g(_Q_){ - /*<>*/ return add_symbolic_output_item(sob, 0); + /*<>*/ function g(_Q_){ + /*<>*/ return add_symbolic_output_item(sob, 0); } - /*<>*/ function h(_P_){ - /*<>*/ return add_symbolic_output_item(sob, 1); + /*<>*/ function h(_P_){ + /*<>*/ return add_symbolic_output_item(sob, 1); } - /*<>*/ function i(n){ - /*<>*/ return add_symbolic_output_item(sob, [1, n]); + /*<>*/ function i(n){ + /*<>*/ return add_symbolic_output_item(sob, [1, n]); } - /*<>*/ function j(n){ - /*<>*/ return add_symbolic_output_item(sob, [2, n]); + /*<>*/ function j(n){ + /*<>*/ return add_symbolic_output_item(sob, [2, n]); } - /*<>*/ return pp_make_formatter(f, g, h, i, j); - /*<>*/ } + /*<>*/ return pp_make_formatter(f, g, h, i, j); + /*<>*/ } function open_hbox(v){ - /*<>*/ return pp_open_hbox - ( /*<>*/ caml_call1 + /*<>*/ return pp_open_hbox + ( /*<>*/ caml_call1 (Stdlib_Domain[10][2], std_formatter_key), v); - /*<>*/ } + /*<>*/ } function open_vbox(v){ - /*<>*/ return pp_open_vbox - ( /*<>*/ caml_call1 + /*<>*/ return pp_open_vbox + ( /*<>*/ caml_call1 (Stdlib_Domain[10][2], std_formatter_key), v); - /*<>*/ } + /*<>*/ } function open_hvbox(v){ - /*<>*/ return pp_open_hvbox - ( /*<>*/ caml_call1 + /*<>*/ return pp_open_hvbox + ( /*<>*/ caml_call1 (Stdlib_Domain[10][2], std_formatter_key), v); - /*<>*/ } + /*<>*/ } function open_hovbox(v){ - /*<>*/ return pp_open_hovbox - ( /*<>*/ caml_call1 + /*<>*/ return pp_open_hovbox + ( /*<>*/ caml_call1 (Stdlib_Domain[10][2], std_formatter_key), v); - /*<>*/ } + /*<>*/ } function open_box(v){ - /*<>*/ return pp_open_box - ( /*<>*/ caml_call1 + /*<>*/ return pp_open_box + ( /*<>*/ caml_call1 (Stdlib_Domain[10][2], std_formatter_key), v); - /*<>*/ } + /*<>*/ } function close_box(v){ - /*<>*/ return pp_close_box - ( /*<>*/ caml_call1 + /*<>*/ return pp_close_box + ( /*<>*/ caml_call1 (Stdlib_Domain[10][2], std_formatter_key), v); - /*<>*/ } + /*<>*/ } function open_stag(v){ - /*<>*/ return pp_open_stag - ( /*<>*/ caml_call1 + /*<>*/ return pp_open_stag + ( /*<>*/ caml_call1 (Stdlib_Domain[10][2], std_formatter_key), v); - /*<>*/ } + /*<>*/ } function close_stag(v){ - /*<>*/ return pp_close_stag - ( /*<>*/ caml_call1 + /*<>*/ return pp_close_stag + ( /*<>*/ caml_call1 (Stdlib_Domain[10][2], std_formatter_key), v); - /*<>*/ } + /*<>*/ } function print_as(isize, w){ - /*<>*/ /*<>*/ var + /*<>*/ /*<>*/ var state = - /*<>*/ caml_call1 + /*<>*/ caml_call1 (Stdlib_Domain[10][2], std_formatter_key); - /*<>*/ return pp_print_as_size(state, isize, w); - /*<>*/ } + /*<>*/ return pp_print_as_size(state, isize, w); + /*<>*/ } function print_string(v){ - /*<>*/ return pp_print_string - ( /*<>*/ caml_call1 + /*<>*/ return pp_print_string + ( /*<>*/ caml_call1 + (Stdlib_Domain[10][2], std_formatter_key), + v); + /*<>*/ } + function print_substring(pos, len, v){ + /*<>*/ /*<>*/ var + state = + /*<>*/ caml_call1 + (Stdlib_Domain[10][2], std_formatter_key); + /*<>*/ return pp_print_substring_as + (pos, len, state, len, v); + /*<>*/ } + function print_substring_as(pos, len, as_len, v){ + /*<>*/ return pp_print_substring_as + (pos, + len, + /*<>*/ caml_call1 (Stdlib_Domain[10][2], std_formatter_key), + as_len, v); - /*<>*/ } + /*<>*/ } function print_bytes(v){ - /*<>*/ return pp_print_bytes - ( /*<>*/ caml_call1 + /*<>*/ return pp_print_bytes + ( /*<>*/ caml_call1 (Stdlib_Domain[10][2], std_formatter_key), v); - /*<>*/ } + /*<>*/ } function print_int(v){ - /*<>*/ return pp_print_int - ( /*<>*/ caml_call1 + /*<>*/ return pp_print_int + ( /*<>*/ caml_call1 (Stdlib_Domain[10][2], std_formatter_key), v); - /*<>*/ } + /*<>*/ } function print_float(v){ - /*<>*/ return pp_print_float - ( /*<>*/ caml_call1 + /*<>*/ return pp_print_float + ( /*<>*/ caml_call1 (Stdlib_Domain[10][2], std_formatter_key), v); - /*<>*/ } + /*<>*/ } function print_char(v){ - /*<>*/ return pp_print_char - ( /*<>*/ caml_call1 + /*<>*/ return pp_print_char + ( /*<>*/ caml_call1 (Stdlib_Domain[10][2], std_formatter_key), v); - /*<>*/ } + /*<>*/ } function print_bool(v){ - /*<>*/ return pp_print_bool - ( /*<>*/ caml_call1 + /*<>*/ return pp_print_bool + ( /*<>*/ caml_call1 (Stdlib_Domain[10][2], std_formatter_key), v); - /*<>*/ } + /*<>*/ } function print_break(v, w){ - /*<>*/ return pp_print_break - ( /*<>*/ caml_call1 + /*<>*/ return pp_print_break + ( /*<>*/ caml_call1 (Stdlib_Domain[10][2], std_formatter_key), v, w); - /*<>*/ } + /*<>*/ } function print_cut(v){ - /*<>*/ return pp_print_cut - ( /*<>*/ caml_call1 + /*<>*/ return pp_print_cut + ( /*<>*/ caml_call1 (Stdlib_Domain[10][2], std_formatter_key), v); - /*<>*/ } + /*<>*/ } function print_space(v){ - /*<>*/ return pp_print_space - ( /*<>*/ caml_call1 + /*<>*/ return pp_print_space + ( /*<>*/ caml_call1 (Stdlib_Domain[10][2], std_formatter_key), v); - /*<>*/ } + /*<>*/ } function force_newline(v){ - /*<>*/ return pp_force_newline - ( /*<>*/ caml_call1 + /*<>*/ return pp_force_newline + ( /*<>*/ caml_call1 (Stdlib_Domain[10][2], std_formatter_key), v); - /*<>*/ } + /*<>*/ } function print_flush(v){ - /*<>*/ return pp_print_flush - ( /*<>*/ caml_call1 + /*<>*/ return pp_print_flush + ( /*<>*/ caml_call1 (Stdlib_Domain[10][2], std_formatter_key), v); - /*<>*/ } + /*<>*/ } function print_newline(v){ - /*<>*/ return pp_print_newline - ( /*<>*/ caml_call1 + /*<>*/ return pp_print_newline + ( /*<>*/ caml_call1 (Stdlib_Domain[10][2], std_formatter_key), v); - /*<>*/ } + /*<>*/ } function print_if_newline(v){ - /*<>*/ return pp_print_if_newline - ( /*<>*/ caml_call1 + /*<>*/ return pp_print_if_newline + ( /*<>*/ caml_call1 (Stdlib_Domain[10][2], std_formatter_key), v); - /*<>*/ } + /*<>*/ } function open_tbox(v){ - /*<>*/ return pp_open_tbox - ( /*<>*/ caml_call1 + /*<>*/ return pp_open_tbox + ( /*<>*/ caml_call1 (Stdlib_Domain[10][2], std_formatter_key), v); - /*<>*/ } + /*<>*/ } function close_tbox(v){ - /*<>*/ return pp_close_tbox - ( /*<>*/ caml_call1 + /*<>*/ return pp_close_tbox + ( /*<>*/ caml_call1 (Stdlib_Domain[10][2], std_formatter_key), v); - /*<>*/ } + /*<>*/ } function print_tbreak(v, w){ - /*<>*/ return pp_print_tbreak - ( /*<>*/ caml_call1 + /*<>*/ return pp_print_tbreak + ( /*<>*/ caml_call1 (Stdlib_Domain[10][2], std_formatter_key), v, w); - /*<>*/ } + /*<>*/ } function set_tab(v){ - /*<>*/ return pp_set_tab - ( /*<>*/ caml_call1 + /*<>*/ return pp_set_tab + ( /*<>*/ caml_call1 (Stdlib_Domain[10][2], std_formatter_key), v); - /*<>*/ } + /*<>*/ } function print_tab(v){ - /*<>*/ return pp_print_tab - ( /*<>*/ caml_call1 + /*<>*/ return pp_print_tab + ( /*<>*/ caml_call1 (Stdlib_Domain[10][2], std_formatter_key), v); - /*<>*/ } + /*<>*/ } function set_margin(v){ - /*<>*/ return pp_set_margin - ( /*<>*/ caml_call1 + /*<>*/ return pp_set_margin + ( /*<>*/ caml_call1 (Stdlib_Domain[10][2], std_formatter_key), v); - /*<>*/ } + /*<>*/ } function get_margin(v){ - /*<>*/ /*<>*/ var + /*<>*/ /*<>*/ var state = - /*<>*/ caml_call1 + /*<>*/ caml_call1 (Stdlib_Domain[10][2], std_formatter_key); return state[6]; - /*<>*/ } + /*<>*/ } function set_max_indent(v){ - /*<>*/ return pp_set_max_indent - ( /*<>*/ caml_call1 + /*<>*/ return pp_set_max_indent + ( /*<>*/ caml_call1 (Stdlib_Domain[10][2], std_formatter_key), v); - /*<>*/ } + /*<>*/ } function get_max_indent(v){ - /*<>*/ /*<>*/ var + /*<>*/ /*<>*/ var state = - /*<>*/ caml_call1 + /*<>*/ caml_call1 (Stdlib_Domain[10][2], std_formatter_key); return state[8]; - /*<>*/ } + /*<>*/ } function set_geometry(max_indent, margin){ - /*<>*/ return pp_set_geometry - ( /*<>*/ caml_call1 + /*<>*/ return pp_set_geometry + ( /*<>*/ caml_call1 (Stdlib_Domain[10][2], std_formatter_key), max_indent, margin); - /*<>*/ } + /*<>*/ } function safe_set_geometry(max_indent, margin){ - /*<>*/ return pp_safe_set_geometry - ( /*<>*/ caml_call1 + /*<>*/ return pp_safe_set_geometry + ( /*<>*/ caml_call1 (Stdlib_Domain[10][2], std_formatter_key), max_indent, margin); - /*<>*/ } + /*<>*/ } function get_geometry(v){ - /*<>*/ return pp_get_geometry - ( /*<>*/ caml_call1 + /*<>*/ return pp_get_geometry + ( /*<>*/ caml_call1 (Stdlib_Domain[10][2], std_formatter_key), v); - /*<>*/ } + /*<>*/ } function update_geometry(v){ - /*<>*/ return pp_update_geometry - ( /*<>*/ caml_call1 + /*<>*/ return pp_update_geometry + ( /*<>*/ caml_call1 (Stdlib_Domain[10][2], std_formatter_key), v); - /*<>*/ } + /*<>*/ } function set_max_boxes(v){ - /*<>*/ return pp_set_max_boxes - ( /*<>*/ caml_call1 + /*<>*/ return pp_set_max_boxes + ( /*<>*/ caml_call1 (Stdlib_Domain[10][2], std_formatter_key), v); - /*<>*/ } + /*<>*/ } function get_max_boxes(v){ - /*<>*/ /*<>*/ var + /*<>*/ /*<>*/ var state = - /*<>*/ caml_call1 + /*<>*/ caml_call1 (Stdlib_Domain[10][2], std_formatter_key); return state[15]; - /*<>*/ } + /*<>*/ } function over_max_boxes(v){ - /*<>*/ return pp_over_max_boxes - ( /*<>*/ caml_call1 + /*<>*/ return pp_over_max_boxes + ( /*<>*/ caml_call1 (Stdlib_Domain[10][2], std_formatter_key), v); - /*<>*/ } + /*<>*/ } function set_ellipsis_text(v){ - /*<>*/ return pp_set_ellipsis_text - ( /*<>*/ caml_call1 + /*<>*/ return pp_set_ellipsis_text + ( /*<>*/ caml_call1 (Stdlib_Domain[10][2], std_formatter_key), v); - /*<>*/ } + /*<>*/ } function get_ellipsis_text(v){ - /*<>*/ /*<>*/ var + /*<>*/ /*<>*/ var state = - /*<>*/ caml_call1 + /*<>*/ caml_call1 (Stdlib_Domain[10][2], std_formatter_key); return state[16]; - /*<>*/ } + /*<>*/ } function set_formatter_out_channel(v){ - /*<>*/ return pp_set_formatter_out_channel - ( /*<>*/ caml_call1 + /*<>*/ return pp_set_formatter_out_channel + ( /*<>*/ caml_call1 (Stdlib_Domain[10][2], std_formatter_key), v); - /*<>*/ } + /*<>*/ } function set_formatter_out_functions(v){ - /*<>*/ return pp_set_formatter_out_functions - ( /*<>*/ caml_call1 + /*<>*/ return pp_set_formatter_out_functions + ( /*<>*/ caml_call1 (Stdlib_Domain[10][2], std_formatter_key), v); - /*<>*/ } + /*<>*/ } function get_formatter_out_functions(v){ - /*<>*/ return pp_get_formatter_out_functions - ( /*<>*/ caml_call1 + /*<>*/ return pp_get_formatter_out_functions + ( /*<>*/ caml_call1 (Stdlib_Domain[10][2], std_formatter_key), v); - /*<>*/ } + /*<>*/ } function set_formatter_output_functions(v, w){ - /*<>*/ return pp_set_formatter_output_functi - ( /*<>*/ caml_call1 + /*<>*/ return pp_set_formatter_output_functi + ( /*<>*/ caml_call1 (Stdlib_Domain[10][2], std_formatter_key), v, w); - /*<>*/ } + /*<>*/ } function get_formatter_output_functions(v){ - /*<>*/ return pp_get_formatter_output_functi - ( /*<>*/ caml_call1 + /*<>*/ return pp_get_formatter_output_functi + ( /*<>*/ caml_call1 (Stdlib_Domain[10][2], std_formatter_key), v); - /*<>*/ } + /*<>*/ } function set_formatter_stag_functions(v){ - /*<>*/ return pp_set_formatter_stag_function - ( /*<>*/ caml_call1 + /*<>*/ return pp_set_formatter_stag_function + ( /*<>*/ caml_call1 (Stdlib_Domain[10][2], std_formatter_key), v); - /*<>*/ } + /*<>*/ } function get_formatter_stag_functions(v){ - /*<>*/ return pp_get_formatter_stag_function - ( /*<>*/ caml_call1 + /*<>*/ return pp_get_formatter_stag_function + ( /*<>*/ caml_call1 (Stdlib_Domain[10][2], std_formatter_key), v); - /*<>*/ } + /*<>*/ } function set_print_tags(v){ - /*<>*/ return pp_set_print_tags - ( /*<>*/ caml_call1 + /*<>*/ return pp_set_print_tags + ( /*<>*/ caml_call1 (Stdlib_Domain[10][2], std_formatter_key), v); - /*<>*/ } + /*<>*/ } function get_print_tags(v){ - /*<>*/ /*<>*/ var + /*<>*/ /*<>*/ var state = - /*<>*/ caml_call1 + /*<>*/ caml_call1 (Stdlib_Domain[10][2], std_formatter_key); return state[22]; - /*<>*/ } + /*<>*/ } function set_mark_tags(v){ - /*<>*/ return pp_set_mark_tags - ( /*<>*/ caml_call1 + /*<>*/ return pp_set_mark_tags + ( /*<>*/ caml_call1 (Stdlib_Domain[10][2], std_formatter_key), v); - /*<>*/ } + /*<>*/ } function get_mark_tags(v){ - /*<>*/ /*<>*/ var + /*<>*/ /*<>*/ var state = - /*<>*/ caml_call1 + /*<>*/ caml_call1 (Stdlib_Domain[10][2], std_formatter_key); return state[23]; - /*<>*/ } + /*<>*/ } function set_tags(v){ - /*<>*/ return pp_set_tags - ( /*<>*/ caml_call1 + /*<>*/ return pp_set_tags + ( /*<>*/ caml_call1 (Stdlib_Domain[10][2], std_formatter_key), v); - /*<>*/ } + /*<>*/ } function pp_print_iter(opt, iter, pp_v, ppf, v){ - /*<>*/ var + /*<>*/ var pp_sep = opt ? opt[1] : pp_print_cut, - /*<>*/ is_first = [0, 1]; + /*<>*/ is_first = [0, 1]; function pp_v$0(v){ - /*<>*/ if(is_first[1]) + /*<>*/ if(is_first[1]) is_first[1] = 0; else - /*<>*/ /*<>*/ caml_call2 + /*<>*/ /*<>*/ caml_call2 (pp_sep, ppf, 0); - /*<>*/ return /*<>*/ caml_call2 + /*<>*/ return /*<>*/ caml_call2 (pp_v, ppf, v); - /*<>*/ } - /*<>*/ return /*<>*/ caml_call2 + /*<>*/ } + /*<>*/ return /*<>*/ caml_call2 (iter, pp_v$0, v); } function pp_print_list(opt, pp_v, ppf, v){ var pp_sep = opt ? opt[1] : pp_print_cut; - /*<>*/ return pp_print_iter + /*<>*/ return pp_print_iter ([0, pp_sep], Stdlib_List[18], pp_v, ppf, v); } function pp_print_array(opt, pp_v, ppf, v){ var pp_sep = opt ? opt[1] : pp_print_cut; - /*<>*/ return pp_print_iter + /*<>*/ return pp_print_iter ([0, pp_sep], Stdlib_Array[12], pp_v, ppf, v); } function pp_print_seq(opt, pp_v, ppf, seq){ var pp_sep = opt ? opt[1] : pp_print_cut; - /*<>*/ return pp_print_iter + /*<>*/ return pp_print_iter ([0, pp_sep], Stdlib_Seq[4], pp_v, ppf, seq); } - function pp_print_text(ppf, s){ - /*<>*/ var + function pp_print_text(state, s){ + /*<>*/ var len = caml_ml_string_length(s), - /*<>*/ left = [0, 0], - /*<>*/ right = [0, 0]; + /*<>*/ left = [0, 0], + /*<>*/ right = [0, 0]; function flush(param){ - /*<>*/ pp_print_string - (ppf, - /*<>*/ caml_call3 - (Stdlib_String[16], s, left[1], right[1] - left[1] | 0)); + /*<>*/ var + len = right[1] - left[1] | 0, + pos = left[1]; + /*<>*/ pp_print_substring_as(pos, len, state, len, s); right[1]++; left[1] = right[1]; return 0; - /*<>*/ } + /*<>*/ } for(;;){ if(right[1] === len){ var _O_ = left[1] !== len ? 1 : 0; return _O_ ? flush(0) : _O_; } - /*<>*/ /*<>*/ var - match = /*<>*/ runtime.caml_string_get(s, right[1]); + /*<>*/ /*<>*/ var + match = /*<>*/ runtime.caml_string_get(s, right[1]); if(10 === match){ - /*<>*/ flush(0); - /*<>*/ pp_force_newline(ppf, 0); + /*<>*/ flush(0); + /*<>*/ pp_force_newline(state, 0); } else if(32 === match){ - /*<>*/ flush(0); - /*<>*/ pp_print_space(ppf, 0); + /*<>*/ flush(0); + /*<>*/ pp_print_space(state, 0); } else right[1]++; } - /*<>*/ } + /*<>*/ } function pp_print_option(opt, pp_v, ppf, param){ var none = @@ -28619,82 +28749,82 @@ ? opt[1] : function (_N_, param){ - /*<>*/ return 0; - /*<>*/ }; + /*<>*/ return 0; + /*<>*/ }; if(! param) - /*<>*/ return /*<>*/ caml_call2 + /*<>*/ return /*<>*/ caml_call2 (none, ppf, 0); var v = param[1]; - /*<>*/ return /*<>*/ caml_call2 + /*<>*/ return /*<>*/ caml_call2 (pp_v, ppf, v); } function pp_print_result(ok, error, ppf, param){ /*<>*/ if(0 === param[0]){ var v = param[1]; - /*<>*/ return /*<>*/ caml_call2 + /*<>*/ return /*<>*/ caml_call2 (ok, ppf, v); } var e = param[1]; - /*<>*/ return /*<>*/ caml_call2 + /*<>*/ return /*<>*/ caml_call2 (error, ppf, e); } function pp_print_either(left, right, ppf, param){ /*<>*/ if(0 === param[0]){ var l = param[1]; - /*<>*/ return /*<>*/ caml_call2 + /*<>*/ return /*<>*/ caml_call2 (left, ppf, l); } var r = param[1]; - /*<>*/ return /*<>*/ caml_call2 + /*<>*/ return /*<>*/ caml_call2 (right, ppf, r); } function compute_tag(output, tag_acc){ - /*<>*/ var - /*<>*/ buf = - /*<>*/ caml_call1(Stdlib_Buffer[1], 16), - /*<>*/ ppf = formatter_of_buffer(buf); - /*<>*/ /*<>*/ caml_call2 + /*<>*/ var + /*<>*/ buf = + /*<>*/ caml_call1(Stdlib_Buffer[1], 16), + /*<>*/ ppf = formatter_of_buffer(buf); + /*<>*/ /*<>*/ caml_call2 (output, ppf, tag_acc); - /*<>*/ pp_print_flush(ppf, 0); - /*<>*/ /*<>*/ var - len = /*<>*/ caml_call1(Stdlib_Buffer[7], buf); - /*<>*/ return 2 <= len - ? /*<>*/ caml_call3 + /*<>*/ pp_print_flush(ppf, 0); + /*<>*/ /*<>*/ var + len = /*<>*/ caml_call1(Stdlib_Buffer[7], buf); + /*<>*/ return 2 <= len + ? /*<>*/ caml_call3 (Stdlib_Buffer[4], buf, 1, len - 2 | 0) - : /*<>*/ caml_call1(Stdlib_Buffer[2], buf); - /*<>*/ } + : /*<>*/ caml_call1(Stdlib_Buffer[2], buf); + /*<>*/ } function output_formatting_lit(ppf, fmting_lit){ - /*<>*/ if(typeof fmting_lit === "number") + /*<>*/ if(typeof fmting_lit === "number") switch(fmting_lit){ case 0: - /*<>*/ return pp_close_box(ppf, 0); + /*<>*/ return pp_close_box(ppf, 0); case 1: - /*<>*/ return pp_close_stag(ppf, 0); + /*<>*/ return pp_close_stag(ppf, 0); case 2: - /*<>*/ return pp_print_flush(ppf, 0); + /*<>*/ return pp_print_flush(ppf, 0); case 3: - /*<>*/ return pp_force_newline(ppf, 0); + /*<>*/ return pp_force_newline(ppf, 0); case 4: - /*<>*/ return pp_print_newline(ppf, 0); + /*<>*/ return pp_print_newline(ppf, 0); case 5: - /*<>*/ return pp_print_char(ppf, 64); - default: /*<>*/ return pp_print_char(ppf, 37); + /*<>*/ return pp_print_char(ppf, 64); + default: /*<>*/ return pp_print_char(ppf, 37); } switch(fmting_lit[0]){ case 0: var offset = fmting_lit[3], width = fmting_lit[2]; - /*<>*/ return pp_print_break(ppf, width, offset); + /*<>*/ return pp_print_break(ppf, width, offset); case 1: - /*<>*/ return 0; + /*<>*/ return 0; default: var c = fmting_lit[1]; - /*<>*/ pp_print_char(ppf, 64); - /*<>*/ return pp_print_char(ppf, c); + /*<>*/ pp_print_char(ppf, 64); + /*<>*/ return pp_print_char(ppf, c); } - /*<>*/ } + /*<>*/ } function output_acc(ppf, acc){ - /*<>*/ if(typeof acc === "number") - /*<>*/ return 0; + /*<>*/ if(typeof acc === "number") + /*<>*/ return 0; a: { b: @@ -28704,26 +28834,26 @@ switch(acc[0]){ case 0: var f = acc[2], p = acc[1]; - /*<>*/ output_acc(ppf, p); - /*<>*/ return output_formatting_lit(ppf, f); + /*<>*/ output_acc(ppf, p); + /*<>*/ return output_formatting_lit(ppf, f); case 1: var match = acc[2], p$0 = acc[1]; if(0 === match[0]){ var acc$0 = match[1]; - /*<>*/ output_acc(ppf, p$0); - /*<>*/ return pp_open_stag + /*<>*/ output_acc(ppf, p$0); + /*<>*/ return pp_open_stag (ppf, [0, String_tag, compute_tag(output_acc, acc$0)]); } var acc$1 = match[1]; - /*<>*/ output_acc(ppf, p$0); - /*<>*/ var - /*<>*/ _E_ = compute_tag(output_acc, acc$1), - /*<>*/ match$0 = - /*<>*/ caml_call1 + /*<>*/ output_acc(ppf, p$0); + /*<>*/ var + /*<>*/ _E_ = compute_tag(output_acc, acc$1), + /*<>*/ match$0 = + /*<>*/ caml_call1 (CamlinternalFormat[20], _E_), bty = match$0[2], indent = match$0[1]; - /*<>*/ return pp_open_box_gen(ppf, indent, bty); + /*<>*/ return pp_open_box_gen(ppf, indent, bty); case 2: var _F_ = acc[1]; if(typeof _F_ !== "number" && 0 === _F_[0]){ @@ -28770,38 +28900,38 @@ break c; case 6: var f$0 = acc[2], p$5 = acc[1]; - /*<>*/ output_acc(ppf, p$5); - /*<>*/ return /*<>*/ caml_call1 + /*<>*/ output_acc(ppf, p$5); + /*<>*/ return /*<>*/ caml_call1 (f$0, ppf); case 7: var p$6 = acc[1]; - /*<>*/ output_acc(ppf, p$6); - /*<>*/ return pp_print_flush(ppf, 0); + /*<>*/ output_acc(ppf, p$6); + /*<>*/ return pp_print_flush(ppf, 0); default: var msg = acc[2], p$7 = acc[1]; - /*<>*/ output_acc(ppf, p$7); - /*<>*/ return /*<>*/ caml_call1 + /*<>*/ output_acc(ppf, p$7); + /*<>*/ return /*<>*/ caml_call1 (Stdlib[1], msg); } - /*<>*/ output_acc(ppf, p$4); - /*<>*/ return pp_print_as_size + /*<>*/ output_acc(ppf, p$4); + /*<>*/ return pp_print_as_size (ppf, size$0, - /*<>*/ caml_call2 + /*<>*/ caml_call2 (Stdlib_String[1], 1, c$0)); } - /*<>*/ output_acc(ppf, p$3); - /*<>*/ return pp_print_char(ppf, c); + /*<>*/ output_acc(ppf, p$3); + /*<>*/ return pp_print_char(ppf, c); } - /*<>*/ output_acc(ppf, p$2); - /*<>*/ return pp_print_as_size(ppf, size, s$0); + /*<>*/ output_acc(ppf, p$2); + /*<>*/ return pp_print_as_size(ppf, size, s$0); } - /*<>*/ output_acc(ppf, p$1); - /*<>*/ return pp_print_string(ppf, s); - /*<>*/ } + /*<>*/ output_acc(ppf, p$1); + /*<>*/ return pp_print_string(ppf, s); + /*<>*/ } function strput_acc(ppf, acc){ - /*<>*/ if(typeof acc === "number") - /*<>*/ return 0; + /*<>*/ if(typeof acc === "number") + /*<>*/ return 0; a: { b: @@ -28811,26 +28941,26 @@ switch(acc[0]){ case 0: var f = acc[2], p = acc[1]; - /*<>*/ strput_acc(ppf, p); - /*<>*/ return output_formatting_lit(ppf, f); + /*<>*/ strput_acc(ppf, p); + /*<>*/ return output_formatting_lit(ppf, f); case 1: var match = acc[2], p$0 = acc[1]; if(0 === match[0]){ var acc$0 = match[1]; - /*<>*/ strput_acc(ppf, p$0); - /*<>*/ return pp_open_stag + /*<>*/ strput_acc(ppf, p$0); + /*<>*/ return pp_open_stag (ppf, [0, String_tag, compute_tag(strput_acc, acc$0)]); } var acc$1 = match[1]; - /*<>*/ strput_acc(ppf, p$0); - /*<>*/ var - /*<>*/ _v_ = compute_tag(strput_acc, acc$1), - /*<>*/ match$0 = - /*<>*/ caml_call1 + /*<>*/ strput_acc(ppf, p$0); + /*<>*/ var + /*<>*/ _v_ = compute_tag(strput_acc, acc$1), + /*<>*/ match$0 = + /*<>*/ caml_call1 (CamlinternalFormat[20], _v_), bty = match$0[2], indent = match$0[1]; - /*<>*/ return pp_open_box_gen(ppf, indent, bty); + /*<>*/ return pp_open_box_gen(ppf, indent, bty); case 2: var _w_ = acc[1]; if(typeof _w_ !== "number" && 0 === _w_[0]){ @@ -28881,60 +29011,60 @@ var match$1 = p$5[2]; if(typeof match$1 !== "number" && 1 === match$1[0]){ var f$1 = acc[2], size$1 = match$1[2], p$6 = p$5[1]; - /*<>*/ strput_acc(ppf, p$6); - /*<>*/ return pp_print_as_size - (ppf, size$1, /*<>*/ caml_call1(f$1, 0)); + /*<>*/ strput_acc(ppf, p$6); + /*<>*/ return pp_print_as_size + (ppf, size$1, /*<>*/ caml_call1(f$1, 0)); } } var f$0 = acc[2]; - /*<>*/ strput_acc(ppf, p$5); - /*<>*/ return pp_print_string - (ppf, /*<>*/ caml_call1(f$0, 0)); + /*<>*/ strput_acc(ppf, p$5); + /*<>*/ return pp_print_string + (ppf, /*<>*/ caml_call1(f$0, 0)); case 7: var p$7 = acc[1]; - /*<>*/ strput_acc(ppf, p$7); - /*<>*/ return pp_print_flush(ppf, 0); + /*<>*/ strput_acc(ppf, p$7); + /*<>*/ return pp_print_flush(ppf, 0); default: var msg = acc[2], p$8 = acc[1]; - /*<>*/ strput_acc(ppf, p$8); - /*<>*/ return /*<>*/ caml_call1 + /*<>*/ strput_acc(ppf, p$8); + /*<>*/ return /*<>*/ caml_call1 (Stdlib[1], msg); } - /*<>*/ strput_acc(ppf, p$4); - /*<>*/ return pp_print_as_size + /*<>*/ strput_acc(ppf, p$4); + /*<>*/ return pp_print_as_size (ppf, size$0, - /*<>*/ caml_call2 + /*<>*/ caml_call2 (Stdlib_String[1], 1, c$0)); } - /*<>*/ strput_acc(ppf, p$3); - /*<>*/ return pp_print_char(ppf, c); + /*<>*/ strput_acc(ppf, p$3); + /*<>*/ return pp_print_char(ppf, c); } - /*<>*/ strput_acc(ppf, p$2); - /*<>*/ return pp_print_as_size(ppf, size, s$0); + /*<>*/ strput_acc(ppf, p$2); + /*<>*/ return pp_print_as_size(ppf, size, s$0); } - /*<>*/ strput_acc(ppf, p$1); - /*<>*/ return pp_print_string(ppf, s); - /*<>*/ } + /*<>*/ strput_acc(ppf, p$1); + /*<>*/ return pp_print_string(ppf, s); + /*<>*/ } function kfprintf(k, ppf, param){ var fmt = param[1]; - /*<>*/ return /*<>*/ caml_call3 + /*<>*/ return /*<>*/ caml_call3 (CamlinternalFormat[7], function(acc){ - /*<>*/ output_acc(ppf, acc); + /*<>*/ output_acc(ppf, acc); return caml_call1(k, ppf); - /*<>*/ }, + /*<>*/ }, 0, fmt); } function ikfprintf(k, ppf, param){ var fmt = param[1]; - /*<>*/ return /*<>*/ caml_call3 + /*<>*/ return /*<>*/ caml_call3 (CamlinternalFormat[8], k, ppf, fmt); } function ifprintf(ppf, param){ var fmt = param[1]; - /*<>*/ return /*<>*/ caml_call3 + /*<>*/ return /*<>*/ caml_call3 (CamlinternalFormat[8], function(_u_){ /*<>*/ return 0;}, 0, @@ -28942,109 +29072,109 @@ } function fprintf(ppf){ function _r_(_t_){ /*<>*/ return 0;} - /*<>*/ return function(_s_){ + /*<>*/ return function(_s_){ /*<>*/ return kfprintf(_r_, ppf, _s_);}; - /*<>*/ } + /*<>*/ } function printf(param){ var fmt = param[1]; - /*<>*/ return /*<>*/ caml_call3 + /*<>*/ return /*<>*/ caml_call3 (CamlinternalFormat[7], function(acc){ - /*<>*/ return output_acc - ( /*<>*/ caml_call1 + /*<>*/ return output_acc + ( /*<>*/ caml_call1 (Stdlib_Domain[10][2], std_formatter_key), acc); - /*<>*/ }, + /*<>*/ }, 0, fmt); } function eprintf(param){ var fmt = param[1]; - /*<>*/ return /*<>*/ caml_call3 + /*<>*/ return /*<>*/ caml_call3 (CamlinternalFormat[7], function(acc){ - /*<>*/ return output_acc - ( /*<>*/ caml_call1 + /*<>*/ return output_acc + ( /*<>*/ caml_call1 (Stdlib_Domain[10][2], err_formatter_key), acc); - /*<>*/ }, + /*<>*/ }, 0, fmt); } function kdprintf(k, param){ var fmt = param[1]; - /*<>*/ return /*<>*/ caml_call3 + /*<>*/ return /*<>*/ caml_call3 (CamlinternalFormat[7], function(acc){ - /*<>*/ return /*<>*/ caml_call1 + /*<>*/ return /*<>*/ caml_call1 (k, function(ppf){ - /*<>*/ return output_acc(ppf, acc); - /*<>*/ }); - /*<>*/ }, + /*<>*/ return output_acc(ppf, acc); + /*<>*/ }); + /*<>*/ }, 0, fmt); } function dprintf(fmt){ - /*<>*/ return kdprintf + /*<>*/ return kdprintf (function(i){ - /*<>*/ return i; - /*<>*/ }, + /*<>*/ return i; + /*<>*/ }, fmt); - /*<>*/ } + /*<>*/ } function ksprintf(k, param){ - /*<>*/ var + /*<>*/ var fmt = param[1], - /*<>*/ b = pp_make_buffer(0), - /*<>*/ ppf = formatter_of_buffer(b); + /*<>*/ b = pp_make_buffer(0), + /*<>*/ ppf = formatter_of_buffer(b); function k$0(acc){ - /*<>*/ strput_acc(ppf, acc); - /*<>*/ return /*<>*/ caml_call1 + /*<>*/ strput_acc(ppf, acc); + /*<>*/ return /*<>*/ caml_call1 (k, flush_buffer_formatter(b, ppf)); - /*<>*/ } - /*<>*/ return /*<>*/ caml_call3 + /*<>*/ } + /*<>*/ return /*<>*/ caml_call3 (CamlinternalFormat[7], k$0, 0, fmt); } function sprintf(fmt){ - /*<>*/ return ksprintf(id, fmt); - /*<>*/ } + /*<>*/ return ksprintf(id, fmt); + /*<>*/ } function kasprintf(k, param){ - /*<>*/ var + /*<>*/ var fmt = param[1], - /*<>*/ b = pp_make_buffer(0), - /*<>*/ ppf = formatter_of_buffer(b); + /*<>*/ b = pp_make_buffer(0), + /*<>*/ ppf = formatter_of_buffer(b); function k$0(acc){ - /*<>*/ output_acc(ppf, acc); - /*<>*/ return /*<>*/ caml_call1 + /*<>*/ output_acc(ppf, acc); + /*<>*/ return /*<>*/ caml_call1 (k, flush_buffer_formatter(b, ppf)); - /*<>*/ } - /*<>*/ return /*<>*/ caml_call3 + /*<>*/ } + /*<>*/ return /*<>*/ caml_call3 (CamlinternalFormat[7], k$0, 0, fmt); } function asprintf(fmt){ - /*<>*/ return kasprintf(id, fmt); - /*<>*/ } + /*<>*/ return kasprintf(id, fmt); + /*<>*/ } function flush_standard_formatters(param){ - /*<>*/ pp_print_flush - ( /*<>*/ caml_call1 + /*<>*/ pp_print_flush + ( /*<>*/ caml_call1 (Stdlib_Domain[10][2], std_formatter_key), 0); - /*<>*/ return pp_print_flush - ( /*<>*/ caml_call1 + /*<>*/ return pp_print_flush + ( /*<>*/ caml_call1 (Stdlib_Domain[10][2], err_formatter_key), 0); - /*<>*/ } - /*<>*/ /*<>*/ caml_call1 + /*<>*/ } + /*<>*/ /*<>*/ caml_call1 (Stdlib[100], flush_standard_formatters); - /*<>*/ /*<>*/ caml_call1 + /*<>*/ /*<>*/ caml_call1 (Stdlib_Domain[5], function(param){ - /*<>*/ flush_standard_formatters(0); - /*<>*/ var - /*<>*/ fs = + /*<>*/ flush_standard_formatters(0); + /*<>*/ var + /*<>*/ fs = pp_get_formatter_out_functions(std_formatter, 0), _h_ = Stdlib[39]; - /*<>*/ pp_set_formatter_out_functions + /*<>*/ pp_set_formatter_out_functions (std_formatter, [0, function(_o_, _p_, _q_){ @@ -29056,11 +29186,11 @@ fs[3], fs[4], fs[5]]); - /*<>*/ var - /*<>*/ fs$0 = + /*<>*/ var + /*<>*/ fs$0 = pp_get_formatter_out_functions(err_formatter, 0), _i_ = Stdlib[40]; - /*<>*/ return pp_set_formatter_out_functions + /*<>*/ return pp_set_formatter_out_functions (err_formatter, [0, function(_k_, _l_, _m_){ @@ -29073,7 +29203,7 @@ fs$0[3], fs$0[4], fs$0[5]]); - /*<>*/ }); + /*<>*/ }); var Stdlib_Format = [0, @@ -29091,10 +29221,14 @@ open_hovbox, pp_print_string, print_string, + pp_print_substring, + print_substring, pp_print_bytes, print_bytes, pp_print_as, print_as, + pp_print_substring_as, + print_substring_as, pp_print_int, print_int, pp_print_float, @@ -31665,7 +31799,7 @@ /*<>*/ /*<>*/ var _X_ = /*<>*/ caml_call2 - (Stdlib_List[49], label, table[6]); + (Stdlib_List[53], label, table[6]); /*<>*/ return _X_; } catch(_Y_){ @@ -35330,25 +35464,29 @@ filter = Stdlib_List[44], find_all = Stdlib_List[45], filteri = Stdlib_List[46], - partition = Stdlib_List[47], - partition_map = Stdlib_List[48], - assoc = Stdlib_List[49], - assoc_opt = Stdlib_List[50], - assq = Stdlib_List[51], - assq_opt = Stdlib_List[52], - mem_assoc = Stdlib_List[53], - mem_assq = Stdlib_List[54], - remove_assoc = Stdlib_List[55], - remove_assq = Stdlib_List[56], - split = Stdlib_List[57], - combine = Stdlib_List[58], - sort = Stdlib_List[59], - stable_sort = Stdlib_List[60], - fast_sort = Stdlib_List[61], - sort_uniq = Stdlib_List[62], - merge = Stdlib_List[63], - to_seq = Stdlib_List[64], - of_seq = Stdlib_List[65], + take = Stdlib_List[47], + drop = Stdlib_List[48], + take_while = Stdlib_List[49], + drop_while = Stdlib_List[50], + partition = Stdlib_List[51], + partition_map = Stdlib_List[52], + assoc = Stdlib_List[53], + assoc_opt = Stdlib_List[54], + assq = Stdlib_List[55], + assq_opt = Stdlib_List[56], + mem_assoc = Stdlib_List[57], + mem_assq = Stdlib_List[58], + remove_assoc = Stdlib_List[59], + remove_assq = Stdlib_List[60], + split = Stdlib_List[61], + combine = Stdlib_List[62], + sort = Stdlib_List[63], + stable_sort = Stdlib_List[64], + fast_sort = Stdlib_List[65], + sort_uniq = Stdlib_List[66], + merge = Stdlib_List[67], + to_seq = Stdlib_List[68], + of_seq = Stdlib_List[69], Stdlib_ListLabels = [0, length, @@ -35397,6 +35535,10 @@ filter, find_all, filteri, + take, + drop, + take_while, + drop_while, partition, partition_map, assoc, diff --git a/dune-project b/dune-project index ef7f1d9be4..154208ad4f 100644 --- a/dune-project +++ b/dune-project @@ -18,7 +18,7 @@ (description "Js_of_ocaml is a compiler from OCaml bytecode to JavaScript. It makes it possible to run pure OCaml programs in JavaScript environment like browsers and Node.js") (depends - (ocaml (and (>= 4.08) (< 5.3))) + (ocaml (and (>= 4.08) (< 5.4))) (num :with-test) (ppx_expect (and (>= v0.14.2) :with-test)) (ppxlib (>= 0.15.0)) diff --git a/js_of_ocaml-compiler.opam b/js_of_ocaml-compiler.opam index 217878193f..6c9ba412f2 100644 --- a/js_of_ocaml-compiler.opam +++ b/js_of_ocaml-compiler.opam @@ -13,7 +13,7 @@ doc: "https://ocsigen.org/js_of_ocaml/latest/manual/overview" bug-reports: "https://github.com/ocsigen/js_of_ocaml/issues" depends: [ "dune" {>= "3.7"} - "ocaml" {>= "4.08" & < "5.3"} + "ocaml" {>= "4.08" & < "5.4"} "num" {with-test} "ppx_expect" {>= "v0.14.2" & with-test} "ppxlib" {>= "0.15.0"} diff --git a/ppx/ppx_deriving_json/tests/gen.mlt b/ppx/ppx_deriving_json/tests/gen.mlt index 3994e69fa3..4c324e596d 100644 --- a/ppx/ppx_deriving_json/tests/gen.mlt +++ b/ppx/ppx_deriving_json/tests/gen.mlt @@ -170,7 +170,6 @@ type variant1 = [%%expect {| - type variant1 = | A | B @@ -219,7 +218,6 @@ type variant2 = [%%expect {| - type variant2 = | D of string | E of variant1 [@@deriving json] @@ -436,7 +434,6 @@ type inline_record = [%%expect {| - type inline_record = | I of { name: string ; @@ -580,7 +577,6 @@ val json : type t = A | B [@@deriving json] [%%expect {| - type t = | A | B [@@deriving json] diff --git a/tools/toplevel_expect/dune b/tools/toplevel_expect/dune index 372664e168..f08ae362fa 100644 --- a/tools/toplevel_expect/dune +++ b/tools/toplevel_expect/dune @@ -9,6 +9,7 @@ toplevel_expect_test.ml-4.08 toplevel_expect_test.ml-4.09 toplevel_expect_test.ml-4.10 + toplevel_expect_test.ml-5.3 toplevel_expect_test.ml-default) (action (with-stdout-to diff --git a/tools/toplevel_expect/toplevel_expect_test.ml-5.3 b/tools/toplevel_expect/toplevel_expect_test.ml-5.3 new file mode 100644 index 0000000000..36e38c3b9e --- /dev/null +++ b/tools/toplevel_expect/toplevel_expect_test.ml-5.3 @@ -0,0 +1,388 @@ +(**************************************************************************) +(* *) +(* OCaml *) +(* *) +(* Jeremie Dimino, Jane Street Europe *) +(* *) +(* Copyright 2016 Jane Street Group LLC *) +(* *) +(* All rights reserved. This file is distributed under the terms of *) +(* the GNU Lesser General Public License version 2.1, with the *) +(* special exception on linking described in the file LICENSE. *) +(* *) +(**************************************************************************) + +(* Execute a list of phrases from a .ml file and compare the result to the + expected output, written inside [%%expect ...] nodes. At the end, create + a .corrected file containing the corrected expectations. The test is + successful if there is no differences between the two files. + + An [%%expect] node always contains both the expected outcome with and + without -principal. When the two differ the expectation is written as + follows: + + {[ + [%%expect {| + output without -principal + |}, Principal{| + output with -principal + |}] + ]} +*) + +[@@@ocaml.warning "-40"] + +open StdLabels + +(* representation of: {tag|str|tag} *) +type string_constant = + { str : string + ; tag : string + } + +type expectation = + { extid_loc : Location.t (* Location of "expect" in "[%%expect ...]" *) + ; payload_loc : Location.t (* Location of the whole payload *) + ; normal : string_constant (* expectation without -principal *) + ; principal : string_constant (* expectation with -principal *) + } + +(* A list of phrases with the expected toplevel output *) +type chunk = + { phrases : Parsetree.toplevel_phrase list + ; expectation : expectation + } + +type correction = + { corrected_expectations : expectation list + ; trailing_output : string + } + +let match_expect_extension (ext : Parsetree.extension) = + match ext with + | ({Asttypes.txt="expect"|"ocaml.expect"; loc = extid_loc}, payload) -> + let invalid_payload () = + Location.raise_errorf ~loc:extid_loc + "invalid [%%%%expect payload]" + in + let string_constant (e : Parsetree.expression) = + match e.pexp_desc with + | Pexp_constant ({ pconst_desc =Pconst_string (str, _, Some tag); _}) -> + { str; tag } + | _ -> invalid_payload () + in + let expectation = + match payload with + | PStr [{ pstr_desc = Pstr_eval (e, []); _ }] -> + let normal, principal = + match e.pexp_desc with + | Pexp_tuple + [ a + ; { pexp_desc = Pexp_construct + ({ txt = Lident "Principal"; _ }, Some b); _ } + ] -> + (string_constant a, string_constant b) + | _ -> let s = string_constant e in (s, s) + in + { extid_loc + ; payload_loc = e.pexp_loc + ; normal + ; principal + } + | PStr [] -> + let s = { tag = ""; str = "" } in + { extid_loc + ; payload_loc = { extid_loc with loc_start = extid_loc.loc_end } + ; normal = s + ; principal = s + } + | _ -> invalid_payload () + in + Some expectation + | _ -> + None + +(* Split a list of phrases from a .ml file *) +let split_chunks phrases = + let rec loop (phrases : Parsetree.toplevel_phrase list) code_acc acc = + match phrases with + | [] -> + if code_acc = [] then + (List.rev acc, None) + else + (List.rev acc, Some (List.rev code_acc)) + | phrase :: phrases -> + match phrase with + | Ptop_def [] -> loop phrases code_acc acc + | Ptop_def [{pstr_desc = Pstr_extension(ext, []); _}] -> begin + match match_expect_extension ext with + | None -> loop phrases (phrase :: code_acc) acc + | Some expectation -> + let chunk = + { phrases = List.rev code_acc + ; expectation + } + in + loop phrases [] (chunk :: acc) + end + | _ -> loop phrases (phrase :: code_acc) acc + in + loop phrases [] [] + +module Compiler_messages = struct + let print_loc ppf (loc : Location.t) = + let startchar = loc.loc_start.pos_cnum - loc.loc_start.pos_bol in + let endchar = loc.loc_end.pos_cnum - loc.loc_start.pos_cnum + startchar in + Format.fprintf ppf "Line _"; + if startchar >= 0 then + Format.fprintf ppf ", characters %d-%d" startchar endchar; + Format.fprintf ppf ":@." + + let () = + let default = !Location.report_printer () in + Location.report_printer := (fun _ -> + { default with + Location.pp_main_loc = (fun _ _ fmt loc -> print_loc fmt loc); + Location.pp_submsg_loc = (fun _ _ fmt loc -> print_loc fmt loc); + }) + + let capture ppf ~f = + Misc.protect_refs + [ R (Location.formatter_for_warnings , ppf ) + ] + f +end + +let collect_formatters buf pps ~f = + List.iter ~f:(fun pp -> Format.pp_print_flush pp ()) pps; + let save = + List.map ~f:(fun pp -> Format.pp_get_formatter_out_functions pp ()) pps + in + let restore () = + List.iter2 + ~f:(fun pp out_functions -> + Format.pp_print_flush pp (); + Format.pp_set_formatter_out_functions pp out_functions) + pps save + in + let out_string str ofs len = Buffer.add_substring buf str ofs len + and out_flush = ignore + and out_newline () = Buffer.add_char buf '\n' + and out_spaces n = for _i = 1 to n do Buffer.add_char buf ' ' done + and out_indent n = for _i = 1 to n do Buffer.add_char buf ' ' done in + let out_functions = + { Format.out_string; out_flush; out_newline; out_spaces; out_indent } + in + List.iter + ~f:(fun pp -> Format.pp_set_formatter_out_functions pp out_functions) + pps; + match f () with + | x -> restore (); x + | exception exn -> restore (); raise exn + +(* Invariant: ppf = Format.formatter_of_buffer buf *) +let capture_everything buf ppf ~f = + collect_formatters buf [Format.std_formatter; Format.err_formatter] + ~f:(fun () -> Compiler_messages.capture ppf ~f) + +let exec_phrase ppf phrase = + if !Clflags.dump_parsetree then Printast. top_phrase ppf phrase; + if !Clflags.dump_source then Pprintast.top_phrase ppf phrase; + Toploop.execute_phrase true ppf phrase + +let parse_contents ~fname contents = + let lexbuf = Lexing.from_string contents in + Location.init lexbuf fname; + Location.input_name := fname; + Parse.use_file lexbuf + +let eval_expectation expectation ~output = + let s = + if !Clflags.principal then + expectation.principal + else + expectation.normal + in + if s.str = output then + None + else + let trimmed = String.trim output in + let normalized = if String.exists ~f:(function '\n' -> true | _ -> false) output + then "\n" ^ trimmed ^ "\n" + else trimmed + in + let s = { s with str = normalized } in + Some ( + if !Clflags.principal then + { expectation with principal = s } + else + { expectation with normal = s } + ) + +let preprocess_structure mappers str = + let open Ast_mapper in + List.fold_right + ~f:(fun ppx_rewriter str -> + let mapper : Ast_mapper.mapper = ppx_rewriter [] in + mapper.structure mapper str) + mappers + ~init:str + +let preprocess_phrase mappers phrase = + let open Parsetree in + match phrase with + | Ptop_def str -> Ptop_def (preprocess_structure mappers str) + | Ptop_dir _ as x -> x + + +let shift_lines delta = + let position (pos : Lexing.position) = + { pos with pos_lnum = pos.pos_lnum + delta } + in + let location _this (loc : Location.t) = + { loc with + loc_start = position loc.loc_start + ; loc_end = position loc.loc_end + } + in + fun _ -> { Ast_mapper.default_mapper with location } + +let rec min_line_number : Parsetree.toplevel_phrase list -> int option = +function + | [] -> None + | (Ptop_dir _ | Ptop_def []) :: l -> min_line_number l + | Ptop_def (st :: _) :: _ -> Some st.pstr_loc.loc_start.pos_lnum + +let eval_expect_file mapper fname ~file_contents = + Warnings.reset_fatal (); + let chunks, trailing_code = + parse_contents ~fname:fname file_contents |> split_chunks + in + let buf = Buffer.create 1024 in + let ppf = Format.formatter_of_buffer buf in + let out_fun = Format.pp_get_formatter_out_functions ppf () in + Format.pp_set_formatter_out_functions Format.std_formatter out_fun; + + let exec_phrases phrases = + + let mappers = + match min_line_number phrases with + | None -> [] + | Some lnum -> [shift_lines (1 - lnum)] + in + let mappers = mapper :: mappers in + let phrases = List.map ~f:(preprocess_phrase mappers) phrases in + + (* For formatting purposes *) + Buffer.add_char buf '\n'; + let _ : bool = + List.fold_left phrases ~init:true ~f:(fun acc phrase -> + acc && + try + Location.reset (); + exec_phrase ppf phrase + with exn -> + Location.report_exception ppf exn; + false) + in + Format.pp_print_flush ppf (); + let len = Buffer.length buf in + if len > 0 && Buffer.nth buf (len - 1) <> '\n' then + (* For formatting purposes *) + Buffer.add_char buf '\n'; + let s = Buffer.contents buf in + Buffer.clear buf; + Misc.delete_eol_spaces s + in + let corrected_expectations = + capture_everything buf ppf ~f:(fun () -> + List.fold_left chunks ~init:[] ~f:(fun acc chunk -> + let output = exec_phrases chunk.phrases in + match eval_expectation chunk.expectation ~output with + | None -> acc + | Some correction -> correction :: acc) + |> List.rev) + in + let trailing_output = + match trailing_code with + | None -> "" + | Some phrases -> + capture_everything buf ppf ~f:(fun () -> exec_phrases phrases) + in + { corrected_expectations; trailing_output } + +let output_slice oc s a b = + output_string oc (String.sub s ~pos:a ~len:(b - a)) + +let output_corrected oc ~file_contents correction = + let output_body oc { str; tag } = + Printf.fprintf oc "{%s|%s|%s}" tag str tag + in + let ofs = + List.fold_left correction.corrected_expectations ~init:0 + ~f:(fun ofs c -> + output_slice oc file_contents ofs c.payload_loc.loc_start.pos_cnum; + output_body oc c.normal; + if !Clflags.principal && c.normal.str <> c.principal.str then begin + output_string oc ", Principal"; + output_body oc c.principal + end; + c.payload_loc.loc_end.pos_cnum) + in + output_slice oc file_contents ofs (String.length file_contents); + match correction.trailing_output with + | "" -> () + | s -> Printf.fprintf oc "\n[%%%%expect{|%s|}]\n" s + +let write_corrected ~file ~file_contents correction = + let oc = open_out file in + output_corrected oc ~file_contents correction; + close_out oc + +let process_expect_file mapper fname = + let corrected_fname = fname ^ ".corrected" in + let file_contents = + let ic = open_in_bin fname in + match really_input_string ic (in_channel_length ic) with + | s -> close_in ic; Misc.normalise_eol s + | exception e -> close_in ic; raise e + in + let correction = eval_expect_file mapper fname ~file_contents in + write_corrected ~file:corrected_fname ~file_contents correction + +let repo_root = ref "" + +let main mapper fname = + Toploop.override_sys_argv + (Array.sub Sys.argv ~pos:!Arg.current + ~len:(Array.length Sys.argv - !Arg.current)); + (* Ignore OCAMLRUNPARAM=b to be reproducible *) + Printexc.record_backtrace false; + List.iter [ "stdlib" ] ~f:(fun s -> + Topdirs.dir_directory (Filename.concat !repo_root s)); + Toploop.initialize_toplevel_env (); + Sys.interactive := false; + process_expect_file mapper fname; + exit 0 + +let args = + Arg.align + [ "-repo-root", Set_string repo_root, + " root of the OCaml repository" + ; "-principal", Set Clflags.principal, + " Evaluate the file with -principal set" + ] + +let usage = "Usage: expect_test [script-file [arguments]]\n\ + options are:" + +let run mapper = + Toploop.set_paths (); + Clflags.error_style := Some Misc.Error_style.Short; + try + Arg.parse args (main mapper) usage; + Printf.eprintf "expect_test: no input file\n"; + exit 2 + with exn -> + Location.report_exception Format.err_formatter exn; + exit 2