diff --git a/Makefile b/Makefile index 94aa386..cbd3538 100644 --- a/Makefile +++ b/Makefile @@ -84,6 +84,10 @@ SYNTAX_LIB=$(foreach s,$(SYNTAX),`ocamlfind query -predicates syntax,toploop,pre SYNTAX_INC=$(foreach s,$(SYNTAX),`ocamlfind query -i-format $(s)`) endif +# enable threads +ifneq ($(THREAD),) +LINK_THREAD=-thread +endif KEEP_COMPILER=\ Arg Array ArrayLabels Buffer Callback CamlinternalLazy CamlinternalMod CamlinternalOO \ @@ -137,6 +141,16 @@ min: core: make all EXT=".core" OPT=1 PACKAGES="core_kernel" PRIMJS="core_runtime.js" MODULES="Core_kernel" +spoc: + make all \ + OPT=1 \ + THREAD=1 EXT=".spoc" \ + CAMLP4=1 LWT=1 JSOO=1 \ + SYNTAX="js_of_ocaml.syntax lwt.syntax.options lwt.syntax sarek_syntax spoc_external_kernels" \ + PACKAGES="bigarray spoc_external_kernels spoc sarek sarek_syntax" \ + MODULES="Spoc Kirc Bigarray" \ + PRIMJS="$(shell ocamlfind query spoc)/spoc_lib.js" + ####################################################################### # build @@ -164,7 +178,7 @@ iocaml_main.cmo: iocaml_main.ml iocaml.cmi ocamlfind ocamlc -c iocaml_main.ml iocaml_full.byte: exec.cmo iocaml.cmo iocaml_main.cmo - ocamlfind ocamlc -linkall -linkpkg -o $@ \ + ocamlfind ocamlc $(LINK_THREAD) -linkall -linkpkg -o $@ \ $(STD_PACKAGES) \ $(USER_PACKAGES) \ $(COMPILER_LIBS_INC) $(COMPILER_LIBS) \ diff --git a/iocaml.ml b/iocaml.ml index e33dbee..7143854 100644 --- a/iocaml.ml +++ b/iocaml.ml @@ -209,7 +209,7 @@ let execute execution_count str = v##compilerStatus <- bool true; v -let load_from_server path = +let load_from_server (_,path) = try let xml = XmlHttpRequest.create () in let () = xml##_open(Js.string "GET", Js.string ("file/" ^ path), Js._false) in diff --git a/iocaml.mli b/iocaml.mli index 57f8b2d..21ecccd 100644 --- a/iocaml.mli +++ b/iocaml.mli @@ -19,7 +19,7 @@ val display : ?base64:bool -> string -> string -> unit val send_clear : ?wait:bool -> ?stdout:bool -> ?stderr:bool -> ?other:bool -> unit -> unit (* load a (binary) file from the server *) -val load_from_server : string -> string option +val load_from_server : (string*string) -> string option val output_cell_max_height : string ref