Legend:
Page
Library
Module
Module type
Parameter
Class
Class type
Source
Source file jsoo_runtime.ml
123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287(* Js_of_ocaml library
* http://www.ocsigen.org/js_of_ocaml/
*
* This program is free software; you can redistribute it and/or modify
* it under the terms of the GNU Lesser General Public License as published by
* the Free Software Foundation, with linking exception;
* either version 2.1 of the License, or (at your option) any later version.
*
* This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU Lesser General Public License for more details.
*
* You should have received a copy of the GNU Lesser General Public License
* along with this program; if not, write to the Free Software
* Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
*)moduleJs=structtypettype'ajs_array=ttype('a,'b)meth_callback=texternalstring:string->t="caml_jsstring_of_string"externalto_string:t->string="caml_string_of_jsstring"externalbytestring:string->t="caml_jsbytes_of_string"externalto_bytestring:t->string="caml_string_of_jsbytes"externalbool:bool->t="caml_js_from_bool"externalto_bool:t->bool="caml_js_to_bool"externalarray:'aarray->t="caml_js_from_array"externalto_array:t->'aarray="caml_js_to_array"externalnumber_of_float:float->t="caml_js_from_float"externalfloat_of_number:t->float="caml_js_to_float"externalnumber_of_int32:int32->t="caml_js_from_int32"externalint32_of_number:t->int32="caml_js_to_int32"externalnumber_of_nativeint:nativeint->t="caml_js_from_nativeint"externalnativeint_of_number:t->nativeint="caml_js_to_nativeint"externaltypeof:t->t="caml_js_typeof"externalinstanceof:t->t->bool="caml_js_instanceof"externaldebugger:unit->unit="debugger"externalget:t->t->t="caml_js_get"externalset:t->t->t->unit="caml_js_set"externaldelete:t->t->unit="caml_js_delete"externalcall:t->t->tarray->t="caml_js_call"externalfun_call:t->tarray->t="caml_js_fun_call"externalmeth_call:t->string->tarray->t="caml_js_meth_call"externalnew_obj:t->tarray->t="caml_js_new"externalnew_obj_arr:t->tjs_array->t="caml_ojs_new_arr"externalobj:(string*t)array->t="caml_js_object"externalequals:t->t->bool="caml_js_equals"externalstrict_equals:t->t->bool="caml_js_strict_equals"externalpure_expr:(unit->'a)->'a="caml_js_pure_expr"externaleval_string:string->'a="caml_js_eval_string"externaljs_expr:string->'a="caml_js_expr"externalpure_js_expr:string->'a="caml_pure_js_expr"externalcallback:('b->'a)->('b,'a)meth_callback="caml_js_wrap_callback_unsafe"externalcallback_with_arguments:(tjs_array->'b)->('c,tjs_array->'b)meth_callback="caml_js_wrap_callback_arguments"externalcallback_with_arity:int->('a->'b)->('c,'a->'b)meth_callback="caml_js_wrap_callback_strict"externalmeth_callback:('b->'a)->('b,'a)meth_callback="caml_js_wrap_meth_callback_unsafe"externalmeth_callback_with_arity:int->('b->'a)->('b,'a)meth_callback="caml_js_wrap_meth_callback_strict"externalmeth_callback_with_arguments:('b->tjs_array->'a)->('b,tjs_array->'a)meth_callback="caml_js_wrap_meth_callback_arguments"externalwrap_callback:('a->'b)->('c,'a->'b)meth_callback="caml_js_wrap_callback"externalwrap_meth_callback:('a->'b)->('a,'b)meth_callback="caml_js_wrap_meth_callback"externalruntime_value:string->'a="caml_jsoo_runtime_value"(** [runtime_value "FOO"] returns the JavaScript value FOO provided by the JavaScript runtime (with '//Provides: FOO'). The string argument must be a string literal. *)externalcustom_identifier:Obj.t->string="caml_custom_identifier"endmoduleSys=structtype'acallback='aexternalcreate_file:name:string->content:string->unit="caml_create_file"externalread_file:name:string->string="caml_read_file_content"externalset_channel_output':out_channel->(js_string:Js.t->unit)callback->unit="caml_ml_set_channel_output"externalset_channel_input':in_channel->(unit->string)callback->unit="caml_ml_set_channel_refill"externalmount_point:unit->stringlist="caml_list_mount_point"externalmount_autoload:string->(string->string->stringoption)callback->unit="caml_mount_autoload"externalunmount:string->unit="caml_unmount"typeredirectionexternalredirect_channel:out_channel->into:out_channel->redirection="caml_ml_channel_redirect"externalrestore_channel:out_channel->redirection->unit="caml_ml_channel_restore"moduleConfig=structexternaluse_js_string:unit->bool="caml_jsoo_flags_use_js_string"typeeffects_backend=[`Disabled|`Cps|`Double_translation]externaleffects_:unit->string="caml_jsoo_flags_effects"leteffects()=matcheffects_()with|"disabled"->`Disabled|"cps"->`Cps|"double-translation"->`Double_translation|_->assertfalseendletversion=Runtime_version.sletgit_version=Runtime_version.git_versionendmoduleError:sigtypetvalraise_:t->'avalattach_js_backtrace:exn->force:bool->exn(** Attach a JavaScript error to an OCaml exception. if [force = false] and a
JavaScript error is already attached, it will do nothing. This function is useful to
store and retrieve information about JavaScript stack traces.
Attaching JavaScript errors will happen automatically when compiling with
[--enable with-js-error]. *)valof_exn:exn->toption(** Extract a JavaScript error attached to an OCaml exception, if any. This is useful to
inspect an eventual stack trace, especially when sourcemap is enabled. *)exceptionExnoft(** The [Error] exception wrap javascript exceptions when caught by OCaml code.
In case the javascript exception is not an instance of javascript [Error],
it will be serialized and wrapped into a [Failure] exception.
*)end=structtypetexceptionExnoftlet_=Callback.register_exception"jsError"(Exn(Obj.magic[||]))externalraise_:t->'a="caml_throw_js_exception"externalof_exn:exn->toption="caml_js_error_option_of_exception"externalattach_js_backtrace:exn->force:bool->exn="caml_exn_with_js_backtrace"end[@@@ocaml.warning"-32-60"]moduleFor_compatibility_only=struct(* Add primitives for compatibility reasons. Existing users might
depend on it (e.g. gen_js_api), we don't want the ocaml compiler
to complain about these missing primitives. *)externalcaml_js_from_string:string->Js.t="caml_js_from_string"externalcaml_js_to_byte_string:Js.t->string="caml_js_to_byte_string"externalcaml_js_to_string:Js.t->string="caml_js_to_string"externalcaml_list_of_js_array:'aJs.js_array->'alist="caml_list_of_js_array"externalcaml_list_to_js_array:'alist->'aJs.js_array="caml_list_to_js_array"externalvariable:string->'a="caml_js_var"externalcaml_string_of_array:'aarray->string="caml_string_of_array"endmoduleTyped_array=structtype('a,'b)typedArray=Js.ttypearrayBuffer=Js.ttypeuint8Array=Js.texternalkind:('a,'b)typedArray->('a,'b)Bigarray.kind="caml_ba_kind_of_typed_array"externalfrom_genarray:('a,'b,Bigarray.c_layout)Bigarray.Genarray.t->('a,'b)typedArray="caml_ba_to_typed_array"externalto_genarray:('a,'b)typedArray->('a,'b,Bigarray.c_layout)Bigarray.Genarray.t="caml_ba_from_typed_array"moduleBigstring=structtypet=(char,Bigarray.int8_unsigned_elt,Bigarray.c_layout)Bigarray.Array1.texternalto_arrayBuffer:t->arrayBuffer="bigstring_to_array_buffer"externalto_uint8Array:t->uint8Array="bigstring_to_typed_array"externalof_arrayBuffer:arrayBuffer->t="bigstring_of_array_buffer"externalof_uint8Array:uint8Array->t="bigstring_of_typed_array"endexternalstring_of_uint8Array:uint8Array->string="caml_string_of_uint8_array"externalbytes_of_uint8Array:uint8Array->bytes="caml_bytes_of_uint8_array"externaluint8Array_of_bytes:bytes->uint8Array="caml_uint8_array_of_bytes"endmoduleInt64=structexternalcreate_int64_lo_mi_hi:int->int->int->Int64.t="caml_int64_create_lo_mi_hi"endmoduleEffect:sigexternalassume_no_perform:(unit->'a)->'a="caml_assume_no_perform"(** Passing a function [f] as argument of `assume_no_perform` guarantees that,
when compiling with `--effects=double-translation`, the direct-style
version of [f] is called, which is faster than the CPS version. As a
consequence, performing an effect in a transitive callee of [f] will
raise `Effect.Unhandled`, regardless of any effect handlers installed
before the call to `assume_no_perform`, unless a new effect handler was
installed in the meantime.
This behaviour is the same when double translation is disabled. *)end=structexternalassume_no_perform:(unit->'a)->'a="caml_assume_no_perform"end