Skip to content

Commit 3664cb2

Browse files
committed
Add missing runtime_events primitives
1 parent 86e74cb commit 3664cb2

File tree

1 file changed

+69
-0
lines changed

1 file changed

+69
-0
lines changed

runtime/wasm/runtime_events.wat

Lines changed: 69 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,69 @@
1+
;; Wasm_of_ocaml runtime support
2+
;; http://www.ocsigen.org/js_of_ocaml/
3+
;;
4+
;; This program is free software; you can redistribute it and/or modify
5+
;; it under the terms of the GNU Lesser General Public License as published by
6+
;; the Free Software Foundation, with linking exception;
7+
;; either version 2.1 of the License, or (at your option) any later version.
8+
;;
9+
;; This program is distributed in the hope that it will be useful,
10+
;; but WITHOUT ANY WARRANTY; without even the implied warranty of
11+
;; MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
12+
;; GNU Lesser General Public License for more details.
13+
;;
14+
;; You should have received a copy of the GNU Lesser General Public License
15+
;; along with this program; if not, write to the Free Software
16+
;; Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
17+
18+
(module
19+
20+
(type $block (array (mut (ref eq))))
21+
22+
(global $caml_custom_event_index (mut i32) (i32.const 0))
23+
24+
(func (export "caml_runtime_events_user_register")
25+
(param $evname (ref eq)) (param $evtag (ref eq)) (param $evtype (ref eq))
26+
(result (ref eq))
27+
(global.set $caml_custom_event_index
28+
(i32.add (global.get $caml_custom_event_index) (i32.const 1)))
29+
(array.new_fixed $block 5
30+
(ref.i31 (i32.const 0))
31+
(ref.i31 (global.get $caml_custom_event_index))
32+
(local.get $evname)
33+
(local.get $evtag)
34+
(local.get $evtype)))
35+
36+
(func (export "caml_runtime_events_user_write")
37+
(param (ref eq)) (param (ref eq)) (param (ref eq)) (result (ref eq))
38+
(ref.i31 (i32.const 0)))
39+
40+
(func (export "caml_runtime_events_user_resolve")
41+
(param (ref eq)) (param (ref eq)) (param (ref eq)) (result (ref eq))
42+
(ref.i31 (i32.const 0)))
43+
44+
(func (export "caml_runtime_events_start") (param (ref eq)) (result (ref eq))
45+
(ref.i31 (i32.const 0)))
46+
47+
(func (export "caml_runtime_events_pause") (param (ref eq)) (result (ref eq))
48+
(ref.i31 (i32.const 0)))
49+
50+
(func (export "caml_runtime_events_resume") (param (ref eq)) (result (ref eq))
51+
(ref.i31 (i32.const 0)))
52+
53+
(func (export "caml_ml_runtime_events_are_active")
54+
(param (ref eq)) (result (ref eq))
55+
(ref.i31 (i32.const 0)))
56+
57+
;; TODO: use Javascript function
58+
;;(func (export "caml_runtime_events_create_cursor")
59+
;; (param (ref eq)) (result (ref eq))
60+
;; (ref.i31 (i32.const 0)))
61+
62+
(func (export "caml_runtime_events_free_cursor")
63+
(param (ref eq)) (result (ref eq))
64+
(ref.i31 (i32.const 0)))
65+
66+
(func (export "caml_runtime_events_read_poll")
67+
(param (ref eq)) (param (ref eq)) (param (ref eq)) (result (ref eq))
68+
(ref.i31 (i32.const 0)))
69+
)

0 commit comments

Comments
 (0)