|
2 | 2 | #define RUBY_WASM_JS_TYPES_H
|
3 | 3 |
|
4 | 4 | #ifdef JS_ENABLE_COMPONENT_MODEL
|
5 |
| -# include "bindgen/ext.h" |
| 5 | +# include "bindgen/ext.h" |
6 | 6 |
|
7 |
| -typedef exports_ruby_js_ruby_runtime_borrow_rb_abi_value_t rb_abi_guest_rb_abi_value_t; |
8 |
| -typedef exports_ruby_js_ruby_runtime_own_rb_abi_value_t rb_abi_guest_own_rb_abi_value_t; |
9 |
| -typedef exports_ruby_js_ruby_runtime_list_borrow_rb_abi_value_t rb_abi_guest_list_rb_abi_value_t; |
10 |
| -typedef exports_ruby_js_ruby_runtime_own_rb_iseq_t rb_abi_guest_rb_iseq_t; |
11 |
| -typedef exports_ruby_js_ruby_runtime_rb_id_t rb_abi_guest_rb_id_t; |
12 |
| -typedef exports_ruby_js_ruby_runtime_tuple2_own_rb_abi_value_s32_t rb_abi_guest_tuple2_rb_abi_value_s32_t; |
| 7 | +typedef exports_ruby_js_ruby_runtime_borrow_rb_abi_value_t |
| 8 | + rb_abi_guest_rb_abi_value_t; |
| 9 | +typedef exports_ruby_js_ruby_runtime_own_rb_abi_value_t |
| 10 | + rb_abi_guest_own_rb_abi_value_t; |
| 11 | +typedef exports_ruby_js_ruby_runtime_list_borrow_rb_abi_value_t |
| 12 | + rb_abi_guest_list_rb_abi_value_t; |
| 13 | +typedef exports_ruby_js_ruby_runtime_own_rb_iseq_t rb_abi_guest_rb_iseq_t; |
| 14 | +typedef exports_ruby_js_ruby_runtime_rb_id_t rb_abi_guest_rb_id_t; |
| 15 | +typedef exports_ruby_js_ruby_runtime_tuple2_own_rb_abi_value_s32_t |
| 16 | + rb_abi_guest_tuple2_rb_abi_value_s32_t; |
13 | 17 |
|
14 |
| -typedef ruby_js_js_runtime_borrow_js_abi_value_t rb_js_abi_host_js_abi_value_t; |
15 |
| -typedef ruby_js_js_runtime_own_js_abi_value_t rb_js_abi_host_own_js_abi_value_t; |
16 |
| -typedef ruby_js_js_runtime_js_abi_result_t rb_js_abi_host_js_abi_result_t; |
17 |
| -typedef ruby_js_js_runtime_list_borrow_js_abi_value_t rb_js_abi_host_list_js_abi_value_t; |
18 |
| -typedef ruby_js_js_runtime_raw_integer_t rb_js_abi_host_raw_integer_t; |
| 18 | +typedef ruby_js_js_runtime_borrow_js_abi_value_t rb_js_abi_host_js_abi_value_t; |
| 19 | +typedef ruby_js_js_runtime_own_js_abi_value_t rb_js_abi_host_own_js_abi_value_t; |
| 20 | +typedef ruby_js_js_runtime_js_abi_result_t rb_js_abi_host_js_abi_result_t; |
| 21 | +typedef ruby_js_js_runtime_list_borrow_js_abi_value_t |
| 22 | + rb_js_abi_host_list_js_abi_value_t; |
| 23 | +typedef ruby_js_js_runtime_raw_integer_t rb_js_abi_host_raw_integer_t; |
19 | 24 |
|
20 | 25 | typedef ext_string_t rb_abi_guest_string_t;
|
21 | 26 | typedef ext_string_t rb_js_abi_host_string_t;
|
22 | 27 | typedef ext_list_string_t rb_abi_guest_list_string_t;
|
23 | 28 |
|
24 |
| -# define borrow_js_value(v) ruby_js_js_runtime_borrow_js_abi_value(v) |
| 29 | +# define borrow_js_value(v) ruby_js_js_runtime_borrow_js_abi_value(v) |
25 | 30 |
|
26 |
| -# define rb_abi_guest_rb_abi_value_new(val) exports_ruby_js_ruby_runtime_rb_abi_value_new(val) |
27 |
| -# define rb_abi_guest_rb_abi_value_get(val) (*(val)) |
28 |
| -# define rb_abi_guest_rb_iseq_new(val) exports_ruby_js_ruby_runtime_rb_iseq_new(val) |
29 |
| -# define rb_js_abi_host_js_value_equal(lhs, rhs) ruby_js_js_runtime_js_value_equal(borrow_js_value(lhs), borrow_js_value(rhs)) |
30 |
| -# define rb_js_abi_host_reflect_apply(target, this, args, ret) ruby_js_js_runtime_reflect_apply(borrow_js_value(target), borrow_js_value(this), args, ret) |
31 |
| -# define rb_js_abi_host_js_value_to_integer(value, ret) ruby_js_js_runtime_js_value_to_integer(borrow_js_value(value), ret) |
32 |
| -# define rb_js_abi_host_export_js_value_to_host(value) ruby_js_js_runtime_export_js_value_to_host(borrow_js_value(value)) |
33 |
| -# define rb_js_abi_host_raw_integer_free(ptr) ruby_js_js_runtime_raw_integer_free(ptr) |
34 |
| -# define rb_js_abi_host_rb_object_to_js_rb_value(val) ruby_js_js_runtime_rb_object_to_js_rb_value(val) |
35 |
| -# define rb_js_abi_host_int_to_js_number(val) ruby_js_js_runtime_int_to_js_number(val) |
36 |
| -# define rb_js_abi_host_float_to_js_number(val) ruby_js_js_runtime_float_to_js_number(val) |
37 |
| -# define rb_js_abi_host_string_to_js_string(val) ruby_js_js_runtime_string_to_js_string(val) |
38 |
| -# define rb_js_abi_host_bool_to_js_bool(val) ruby_js_js_runtime_bool_to_js_bool(val) |
39 |
| -# define rb_js_abi_host_proc_to_js_function(val) ruby_js_js_runtime_proc_to_js_function(val) |
40 |
| -# define rb_js_abi_host_import_js_value_from_host() ruby_js_js_runtime_import_js_value_from_host() |
41 |
| -# define rb_js_abi_host_js_value_to_string(value, ret) ruby_js_js_runtime_js_value_to_string(borrow_js_value(value), ret) |
42 |
| -# define rb_js_abi_host_js_value_typeof(value, ret) ruby_js_js_runtime_js_value_typeof(borrow_js_value(value), ret) |
43 |
| -# define rb_js_abi_host_js_value_strictly_equal(lhs, rhs) ruby_js_js_runtime_js_value_strictly_equal(borrow_js_value(lhs), borrow_js_value(rhs)) |
44 |
| -# define rb_js_abi_host_reflect_get(target, key, ret) ruby_js_js_runtime_reflect_get(borrow_js_value(target), key, ret) |
45 |
| -# define rb_js_abi_host_reflect_set(target, key, value, ret) ruby_js_js_runtime_reflect_set(borrow_js_value(target), key, borrow_js_value(value), ret) |
46 |
| -# define rb_js_abi_host_global_this() ruby_js_js_runtime_global_this() |
47 |
| -# define rb_js_abi_host_instance_of(value, klass) ruby_js_js_runtime_instance_of(borrow_js_value(value), borrow_js_value(klass)) |
48 |
| -# define rb_js_abi_host_is_js(value) ruby_js_js_runtime_is_js(borrow_js_value(value)) |
49 |
| -# define rb_js_abi_host_eval_js(code, ret) ruby_js_js_runtime_eval_js(code, ret) |
| 31 | +# define rb_abi_guest_rb_abi_value_new(val) \ |
| 32 | + exports_ruby_js_ruby_runtime_rb_abi_value_new(val) |
| 33 | +# define rb_abi_guest_rb_abi_value_get(val) (*(val)) |
| 34 | +# define rb_abi_guest_rb_iseq_new(val) \ |
| 35 | + exports_ruby_js_ruby_runtime_rb_iseq_new(val) |
| 36 | +# define rb_js_abi_host_js_value_equal(lhs, rhs) \ |
| 37 | + ruby_js_js_runtime_js_value_equal(borrow_js_value(lhs), \ |
| 38 | + borrow_js_value(rhs)) |
| 39 | +# define rb_js_abi_host_reflect_apply(target, this, args, ret) \ |
| 40 | + ruby_js_js_runtime_reflect_apply(borrow_js_value(target), \ |
| 41 | + borrow_js_value(this), args, ret) |
| 42 | +# define rb_js_abi_host_js_value_to_integer(value, ret) \ |
| 43 | + ruby_js_js_runtime_js_value_to_integer(borrow_js_value(value), ret) |
| 44 | +# define rb_js_abi_host_export_js_value_to_host(value) \ |
| 45 | + ruby_js_js_runtime_export_js_value_to_host(borrow_js_value(value)) |
| 46 | +# define rb_js_abi_host_raw_integer_free(ptr) \ |
| 47 | + ruby_js_js_runtime_raw_integer_free(ptr) |
| 48 | +# define rb_js_abi_host_rb_object_to_js_rb_value(val) \ |
| 49 | + ruby_js_js_runtime_rb_object_to_js_rb_value(val) |
| 50 | +# define rb_js_abi_host_int_to_js_number(val) \ |
| 51 | + ruby_js_js_runtime_int_to_js_number(val) |
| 52 | +# define rb_js_abi_host_float_to_js_number(val) \ |
| 53 | + ruby_js_js_runtime_float_to_js_number(val) |
| 54 | +# define rb_js_abi_host_string_to_js_string(val) \ |
| 55 | + ruby_js_js_runtime_string_to_js_string(val) |
| 56 | +# define rb_js_abi_host_bool_to_js_bool(val) \ |
| 57 | + ruby_js_js_runtime_bool_to_js_bool(val) |
| 58 | +# define rb_js_abi_host_proc_to_js_function(val) \ |
| 59 | + ruby_js_js_runtime_proc_to_js_function(val) |
| 60 | +# define rb_js_abi_host_import_js_value_from_host() \ |
| 61 | + ruby_js_js_runtime_import_js_value_from_host() |
| 62 | +# define rb_js_abi_host_js_value_to_string(value, ret) \ |
| 63 | + ruby_js_js_runtime_js_value_to_string(borrow_js_value(value), ret) |
| 64 | +# define rb_js_abi_host_js_value_typeof(value, ret) \ |
| 65 | + ruby_js_js_runtime_js_value_typeof(borrow_js_value(value), ret) |
| 66 | +# define rb_js_abi_host_js_value_strictly_equal(lhs, rhs) \ |
| 67 | + ruby_js_js_runtime_js_value_strictly_equal(borrow_js_value(lhs), \ |
| 68 | + borrow_js_value(rhs)) |
| 69 | +# define rb_js_abi_host_reflect_get(target, key, ret) \ |
| 70 | + ruby_js_js_runtime_reflect_get(borrow_js_value(target), key, ret) |
| 71 | +# define rb_js_abi_host_reflect_set(target, key, value, ret) \ |
| 72 | + ruby_js_js_runtime_reflect_set(borrow_js_value(target), key, \ |
| 73 | + borrow_js_value(value), ret) |
| 74 | +# define rb_js_abi_host_global_this() ruby_js_js_runtime_global_this() |
| 75 | +# define rb_js_abi_host_instance_of(value, klass) \ |
| 76 | + ruby_js_js_runtime_instance_of(borrow_js_value(value), \ |
| 77 | + borrow_js_value(klass)) |
| 78 | +# define rb_js_abi_host_is_js(value) \ |
| 79 | + ruby_js_js_runtime_is_js(borrow_js_value(value)) |
| 80 | +# define rb_js_abi_host_eval_js(code, ret) \ |
| 81 | + ruby_js_js_runtime_eval_js(code, ret) |
50 | 82 |
|
51 |
| -# define rb_js_abi_host_js_abi_value_free(ptr) ruby_js_js_runtime_js_abi_value_drop_own(*ptr) |
| 83 | +# define rb_js_abi_host_js_abi_value_free(ptr) \ |
| 84 | + ruby_js_js_runtime_js_abi_value_drop_own(*ptr) |
52 | 85 |
|
53 |
| -# define RB_JS_ABI_HOST_RAW_INTEGER_AS_FLOAT RUBY_JS_JS_RUNTIME_RAW_INTEGER_AS_FLOAT |
54 |
| -# define RB_JS_ABI_HOST_JS_ABI_RESULT_FAILURE RUBY_JS_JS_RUNTIME_JS_ABI_RESULT_FAILURE |
| 86 | +# define RB_JS_ABI_HOST_RAW_INTEGER_AS_FLOAT \ |
| 87 | + RUBY_JS_JS_RUNTIME_RAW_INTEGER_AS_FLOAT |
| 88 | +# define RB_JS_ABI_HOST_JS_ABI_RESULT_FAILURE \ |
| 89 | + RUBY_JS_JS_RUNTIME_JS_ABI_RESULT_FAILURE |
55 | 90 |
|
56 | 91 | #else
|
57 |
| -# include "bindgen/legacy/rb-abi-guest.h" |
58 |
| -# include "bindgen/legacy/rb-js-abi-host.h" |
59 |
| -typedef rb_abi_guest_rb_abi_value_t rb_abi_guest_own_rb_abi_value_t; |
60 |
| -typedef rb_js_abi_host_js_abi_value_t rb_js_abi_host_own_js_abi_value_t; |
| 92 | +# include "bindgen/legacy/rb-abi-guest.h" |
| 93 | +# include "bindgen/legacy/rb-js-abi-host.h" |
| 94 | +typedef rb_abi_guest_rb_abi_value_t rb_abi_guest_own_rb_abi_value_t; |
| 95 | +typedef rb_js_abi_host_js_abi_value_t rb_js_abi_host_own_js_abi_value_t; |
61 | 96 |
|
62 |
| -# define borrow_js_value(v) v |
| 97 | +# define borrow_js_value(v) v |
63 | 98 |
|
64 |
| -# define rb_js_abi_host_js_abi_value_free(ptr) rb_js_abi_host_js_abi_value_free(ptr) |
| 99 | +# define rb_js_abi_host_js_abi_value_free(ptr) \ |
| 100 | + rb_js_abi_host_js_abi_value_free(ptr) |
65 | 101 | #endif
|
66 | 102 |
|
67 | 103 | #endif // RUBY_WASM_JS_TYPES_H
|
0 commit comments