Skip to content

Commit 3a3a8b8

Browse files
committed
Fix input format in the JS example
1 parent f6b986e commit 3a3a8b8

File tree

3 files changed

+12
-5
lines changed

3 files changed

+12
-5
lines changed

src/bin/js/main_text_js.ml

+5-1
Original file line numberDiff line numberDiff line change
@@ -38,7 +38,11 @@ let parse_cmdline () =
3838
with Parse_command.Exit_parse_command i -> exit i
3939

4040
let () =
41-
Options.set_exit_on_error false;
41+
(* Currently, the main function of [Solving_loop] calls the [exit] function in
42+
case of recoverable error, which is not supported in Javascript. We
43+
turn off this feature as we do not support it correctly. See issue
44+
https://github.com/OCamlPro/alt-ergo/issues/1250 *)
45+
AltErgoLib.Options.set_exit_on_error false;
4246
register_input ();
4347
parse_cmdline ();
4448
AltErgoLib.Printer.init_colors ();

src/bin/js/worker_example.ml

+5-2
Original file line numberDiff line numberDiff line change
@@ -64,7 +64,7 @@ let exec worker file options =
6464
let solve () =
6565
let options =
6666
{(Worker_interface.init_options ()) with
67-
input_format=Some Native;
67+
input_format = None;
6868
file = Some "try-alt-ergo";
6969
debug = Some true;
7070
verbose = Some true;
@@ -82,7 +82,10 @@ let solve () =
8282
diagnostic = Some ["Timeout"]});
8383
(
8484
let file = String.split_on_char '\n' !file in
85-
let json_file = Worker_interface.file_to_json None (Some 42) file in
85+
let json_file =
86+
Worker_interface.file_to_json
87+
(Some ("dummy" ^ !extension)) (Some 42) file
88+
in
8689
Firebug.console##log json_file;
8790
let json_options = Worker_interface.options_to_json options in
8891
Firebug.console##log json_options;

src/bin/js/worker_js.ml

+2-2
Original file line numberDiff line numberDiff line change
@@ -54,7 +54,6 @@ let create_buffer () =
5454
buf, output
5555

5656
let main worker_id filename filecontent =
57-
let filename = match filename with | Some f -> f | None -> "<worker>" in
5857
try
5958
(* Create buffer for each formatter
6059
The content of this buffers are then retrieved and send as results *)
@@ -163,7 +162,7 @@ let () =
163162
at_exit Options.Output.close_all;
164163
Worker.set_onmessage (fun (json_file, json_options) ->
165164
Lwt_js_events.async (fun () ->
166-
let filename, worker_id, filecontent =
165+
let filename_opt, worker_id, filecontent =
167166
Worker_interface.file_from_json json_file
168167
in
169168
let filecontent = String.concat "\n" filecontent in
@@ -174,6 +173,7 @@ let () =
174173
Options.set_exit_on_error false;
175174

176175
(* Run the worker on the input file (filecontent) *)
176+
let filename = Option.get filename_opt in
177177
let results = main worker_id filename filecontent in
178178

179179
(* Convert results and returns them *)

0 commit comments

Comments
 (0)