xbintsc 0.6.10 → 0.6.13
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/src/ast/expressions.d.ts +6 -0
- package/dist/src/checker/globals.js +2 -1
- package/dist/src/checker/globals.js.map +1 -1
- package/dist/src/checker/type-infer.js +1 -1
- package/dist/src/checker/type-infer.js.map +1 -1
- package/dist/src/cli/help.d.ts +1 -1
- package/dist/src/codegen/generator/calls/literals.js +4 -1
- package/dist/src/codegen/generator/calls/literals.js.map +1 -1
- package/dist/src/codegen/generator/expressions/assignment.js +3 -1
- package/dist/src/codegen/generator/expressions/assignment.js.map +1 -1
- package/dist/src/codegen/generator/expressions/operators.js +2 -6
- package/dist/src/codegen/generator/expressions/operators.js.map +1 -1
- package/dist/src/codegen/generator/expressions/primary.d.ts +9 -0
- package/dist/src/codegen/generator/expressions/primary.js +44 -7
- package/dist/src/codegen/generator/expressions/primary.js.map +1 -1
- package/dist/src/codegen/generator/state.js +3 -0
- package/dist/src/codegen/generator/state.js.map +1 -1
- package/dist/src/codegen/generator/tables.js +3 -0
- package/dist/src/codegen/generator/tables.js.map +1 -1
- package/dist/src/driver/bundler/commonjs.js +1 -1
- package/dist/src/driver/bundler/commonjs.js.map +1 -1
- package/dist/src/driver/bundler/symbols.js +6 -0
- package/dist/src/driver/bundler/symbols.js.map +1 -1
- package/dist/src/driver/compiler.js +1 -1
- package/dist/src/driver/compiler.js.map +1 -1
- package/dist/src/driver/runtime-objects.d.ts +1 -1
- package/dist/src/driver/runtime-objects.js +2 -0
- package/dist/src/driver/runtime-objects.js.map +1 -1
- package/dist/src/driver/version.d.ts +1 -1
- package/dist/src/driver/version.js +1 -1
- package/dist/src/extensions/node/crypto/index.js +12 -1
- package/dist/src/extensions/node/crypto/index.js.map +1 -1
- package/dist/src/extensions/node/index.js +2 -0
- package/dist/src/extensions/node/index.js.map +1 -1
- package/dist/src/extensions/node/readline/index.d.ts +12 -0
- package/dist/src/extensions/node/readline/index.js +27 -0
- package/dist/src/extensions/node/readline/index.js.map +1 -0
- package/dist/src/parser/declarations/functions.js +6 -0
- package/dist/src/parser/declarations/functions.js.map +1 -1
- package/dist/src/parser/literals.js +1 -1
- package/dist/src/parser/literals.js.map +1 -1
- package/dist/tests/e2e/compile-builtins.test.js +26 -0
- package/dist/tests/e2e/compile-builtins.test.js.map +1 -1
- package/dist/tests/e2e/compile-modules.test.js +22 -0
- package/dist/tests/e2e/compile-modules.test.js.map +1 -1
- package/dist/tests/e2e/compile-node.test.js +37 -1
- package/dist/tests/e2e/compile-node.test.js.map +1 -1
- package/dist/tests/e2e/crypto-random.test.d.ts +9 -0
- package/dist/tests/e2e/crypto-random.test.js +63 -0
- package/dist/tests/e2e/crypto-random.test.js.map +1 -0
- package/dist/tests/e2e/date-parse.test.js +44 -1
- package/dist/tests/e2e/date-parse.test.js.map +1 -1
- package/dist/tests/e2e/gui-browser.test.js +61 -0
- package/dist/tests/e2e/gui-browser.test.js.map +1 -1
- package/dist/tests/e2e/gui-css-coverage.test.js +40 -1
- package/dist/tests/e2e/gui-css-coverage.test.js.map +1 -1
- package/dist/tests/e2e/gui-css-features.test.js +100 -0
- package/dist/tests/e2e/gui-css-features.test.js.map +1 -1
- package/dist/tests/e2e/gui-dom.test.js +63 -0
- package/dist/tests/e2e/gui-dom.test.js.map +1 -1
- package/dist/tests/e2e/gui-errors.test.d.ts +11 -0
- package/dist/tests/e2e/gui-errors.test.js +68 -0
- package/dist/tests/e2e/gui-errors.test.js.map +1 -0
- package/dist/tests/e2e/gui-form.test.d.ts +9 -0
- package/dist/tests/e2e/gui-form.test.js +359 -0
- package/dist/tests/e2e/gui-form.test.js.map +1 -0
- package/dist/tests/e2e/gui-script-import-order.test.js +6 -1
- package/dist/tests/e2e/gui-script-import-order.test.js.map +1 -1
- package/dist/tests/e2e/gui-style.test.js +82 -0
- package/dist/tests/e2e/gui-style.test.js.map +1 -1
- package/dist/tests/e2e/gui-unsupported.test.js +4 -3
- package/dist/tests/e2e/gui-unsupported.test.js.map +1 -1
- package/dist/tests/e2e/gui-webgl2-shadow-sampler.test.js +7 -1
- package/dist/tests/e2e/gui-webgl2-shadow-sampler.test.js.map +1 -1
- package/dist/tests/e2e/harness.d.ts +4 -0
- package/dist/tests/e2e/harness.js +2 -0
- package/dist/tests/e2e/harness.js.map +1 -1
- package/dist/tests/e2e/json-parse-errors.test.d.ts +9 -0
- package/dist/tests/e2e/json-parse-errors.test.js +48 -0
- package/dist/tests/e2e/json-parse-errors.test.js.map +1 -0
- package/dist/tests/e2e/readline.test.d.ts +7 -0
- package/dist/tests/e2e/readline.test.js +73 -0
- package/dist/tests/e2e/readline.test.js.map +1 -0
- package/doc/ai/language-support.md +2 -1
- package/doc/ai/zh-CN/language-support.md +2 -1
- package/doc/gui/api.md +24 -3
- package/doc/gui/dom.md +28 -14
- package/doc/gui/input.md +74 -3
- package/doc/gui/known-issues.md +2 -1
- package/doc/gui/layout.md +5 -1
- package/doc/implemented/node/crypto.md +8 -0
- package/doc/implemented/node/fs.md +1 -1
- package/doc/implemented/node/readline.md +34 -0
- package/doc/implemented/node.md +1 -0
- package/doc/implemented/stdlib.md +10 -2
- package/doc/unimplemented/node/modules.md +2 -3
- package/doc/unimplemented/node.md +2 -2
- package/doc/zh-CN/gui/api.md +20 -3
- package/doc/zh-CN/gui/dom.md +23 -13
- package/doc/zh-CN/gui/input.md +65 -4
- package/doc/zh-CN/gui/known-issues.md +2 -1
- package/doc/zh-CN/gui/layout.md +4 -1
- package/doc/zh-CN/implemented/node/crypto.md +6 -0
- package/doc/zh-CN/implemented/node/fs.md +1 -1
- package/doc/zh-CN/implemented/node/readline.md +33 -0
- package/doc/zh-CN/implemented/node.md +1 -0
- package/doc/zh-CN/implemented/stdlib.md +10 -2
- package/doc/zh-CN/unimplemented/node/modules.md +1 -2
- package/doc/zh-CN/unimplemented/node.md +2 -2
- package/package.json +7 -7
- package/runtime/ext_gui/browser_abort.cpp +2 -2
- package/runtime/ext_gui/browser_loop.cpp +1 -0
- package/runtime/ext_gui/browser_media.cpp +1 -1
- package/runtime/ext_gui/css_match.cpp +21 -1
- package/runtime/ext_gui/css_selector.cpp +2 -2
- package/runtime/ext_gui/document.cpp +12 -0
- package/runtime/ext_gui/dom.h +41 -2
- package/runtime/ext_gui/dom_api_canvas_image.cpp +2 -1
- package/runtime/ext_gui/dom_api_document.cpp +28 -0
- package/runtime/ext_gui/dom_api_events.cpp +18 -15
- package/runtime/ext_gui/dom_api_form.cpp +567 -0
- package/runtime/ext_gui/dom_api_internal.h +48 -214
- package/runtime/ext_gui/dom_api_mutation.cpp +1 -1
- package/runtime/ext_gui/dom_api_node.cpp +28 -15
- package/runtime/ext_gui/dom_api_node_read.cpp +28 -1
- package/runtime/ext_gui/dom_api_proto.cpp +47 -0
- package/runtime/ext_gui/dom_api_webgl_methods.h +217 -0
- package/runtime/ext_gui/dom_parse.cpp +114 -1
- package/runtime/ext_gui/error_report.cpp +166 -0
- package/runtime/ext_gui/form_focus.cpp +293 -0
- package/runtime/ext_gui/form_input.cpp +448 -0
- package/runtime/ext_gui/form_internal.h +30 -0
- package/runtime/ext_gui/form_shared.cpp +126 -0
- package/runtime/ext_gui/form_state.cpp +536 -0
- package/runtime/ext_gui/form_state.h +97 -0
- package/runtime/ext_gui/gui.cpp +16 -0
- package/runtime/ext_gui/gui_engine.h +53 -4
- package/runtime/ext_gui/gui_events.cpp +67 -49
- package/runtime/ext_gui/layout.cpp +6 -0
- package/runtime/ext_gui/layout.h +4 -0
- package/runtime/ext_gui/layout_flow.cpp +23 -1
- package/runtime/ext_gui/layout_inline.cpp +46 -14
- package/runtime/ext_gui/paint.cpp +26 -1
- package/runtime/ext_gui/paint_form.cpp +389 -0
- package/runtime/ext_gui/paint_internal.h +6 -0
- package/runtime/ext_gui/script.cpp +1 -1
- package/runtime/ext_gui/style.cpp +1 -0
- package/runtime/ext_gui/style.h +13 -0
- package/runtime/ext_gui/style_print.cpp +129 -0
- package/runtime/ext_gui/style_text.cpp +79 -0
- package/runtime/ext_gui/style_ua.cpp +42 -0
- package/runtime/ext_gui/warnings.cpp +5 -7
- package/runtime/ext_gui/webgl_texture.cpp +0 -8
- package/runtime/ext_gui/window.cpp +52 -62
- package/runtime/ext_gui/window_diagnostics.cpp +58 -0
- package/runtime/ext_gui/window_emit.cpp +51 -0
- package/runtime/ext_node/crypto/crypto.c +3 -2
- package/runtime/ext_node/crypto/crypto_hash.h +13 -0
- package/runtime/ext_node/crypto/crypto_random.c +339 -0
- package/runtime/ext_node/fs/async_worker.c +1 -1
- package/runtime/ext_node/fs/fs_ops.c +1 -1
- package/runtime/ext_node/fs/parts/platform.inc +67 -0
- package/runtime/ext_node/readline/readline.c +572 -0
- package/runtime/rt.h +42 -0
- package/runtime/rt_internal.h +3 -2
- package/runtime/xt_crypto.c +132 -0
- package/runtime/xt_io/exception.inc +29 -6
- package/runtime/xt_loop.c +36 -1
- package/runtime/xt_promise.c +26 -2
- package/runtime/xt_random.c +143 -0
- package/runtime/xt_regex/matcher.inc +9 -28
- package/runtime/xt_regex/parser.inc +65 -2
- package/runtime/xt_regex/types.inc +11 -1
- package/runtime/xt_regex.h +6 -2
- package/runtime/xt_stdlib/dispatch.inc +2 -0
- package/runtime/xt_stdlib/math.inc +1 -1
- package/runtime/xt_stdlib2/date.inc +206 -6
- package/runtime/xt_stdlib2/json.inc +4 -546
- package/runtime/xt_stdlib2/json_parse.inc +347 -0
- package/runtime/xt_stdlib2/json_stringify.inc +368 -0
- package/runtime/xt_stdlib2/regexp-match.inc +6 -11
- package/runtime/xt_stdlib2.c +0 -4
- package/runtime/xt_typed_array/elements.inc +2 -6
- package/runtime/xt_url.c +0 -6
- package/runtime/xt_url_object.c +1 -1
- package/src/ast/expressions.ts +6 -0
- package/src/checker/globals.ts +2 -0
- package/src/checker/type-infer.ts +1 -1
- package/src/codegen/generator/calls/literals.ts +4 -1
- package/src/codegen/generator/expressions/assignment.ts +3 -1
- package/src/codegen/generator/expressions/operators.ts +2 -6
- package/src/codegen/generator/expressions/primary.ts +58 -6
- package/src/codegen/generator/state.ts +3 -0
- package/src/codegen/generator/tables.ts +3 -0
- package/src/driver/bundler/commonjs.ts +1 -1
- package/src/driver/bundler/symbols.ts +6 -0
- package/src/driver/compiler.ts +1 -1
- package/src/driver/runtime-objects.ts +2 -0
- package/src/driver/version.ts +1 -1
- package/src/extensions/node/crypto/index.ts +12 -1
- package/src/extensions/node/index.ts +2 -0
- package/src/extensions/node/readline/index.ts +31 -0
- package/src/parser/declarations/functions.ts +6 -0
- package/src/parser/literals.ts +1 -1
|
@@ -0,0 +1,217 @@
|
|
|
1
|
+
/* WebGL method declarations for `dom_api_internal.h`. Included inside the
|
|
2
|
+
* `domapi` namespace, after the `METHOD` macro is defined. */
|
|
3
|
+
|
|
4
|
+
/* WebGL context: state and queries */
|
|
5
|
+
METHOD(webgl_canvas_get);
|
|
6
|
+
METHOD(webgl_drawing_buffer_width_get);
|
|
7
|
+
METHOD(webgl_drawing_buffer_height_get);
|
|
8
|
+
METHOD(webgl_enable);
|
|
9
|
+
METHOD(webgl_disable);
|
|
10
|
+
METHOD(webgl_is_enabled);
|
|
11
|
+
METHOD(webgl_clear);
|
|
12
|
+
METHOD(webgl_clear_color);
|
|
13
|
+
METHOD(webgl_clear_depth);
|
|
14
|
+
METHOD(webgl_clear_stencil);
|
|
15
|
+
METHOD(webgl_color_mask);
|
|
16
|
+
METHOD(webgl_depth_func);
|
|
17
|
+
METHOD(webgl_depth_mask);
|
|
18
|
+
METHOD(webgl_depth_range);
|
|
19
|
+
METHOD(webgl_blend_color);
|
|
20
|
+
METHOD(webgl_blend_equation);
|
|
21
|
+
METHOD(webgl_blend_equation_separate);
|
|
22
|
+
METHOD(webgl_blend_func);
|
|
23
|
+
METHOD(webgl_blend_func_separate);
|
|
24
|
+
METHOD(webgl_cull_face);
|
|
25
|
+
METHOD(webgl_front_face);
|
|
26
|
+
METHOD(webgl_viewport);
|
|
27
|
+
METHOD(webgl_scissor);
|
|
28
|
+
METHOD(webgl_finish);
|
|
29
|
+
METHOD(webgl_flush);
|
|
30
|
+
METHOD(webgl_hint);
|
|
31
|
+
METHOD(webgl_line_width);
|
|
32
|
+
METHOD(webgl_polygon_offset);
|
|
33
|
+
METHOD(webgl_sample_coverage);
|
|
34
|
+
METHOD(webgl_pixel_storei);
|
|
35
|
+
METHOD(webgl_get_error);
|
|
36
|
+
METHOD(webgl_get_parameter);
|
|
37
|
+
METHOD(webgl_get_supported_extensions);
|
|
38
|
+
METHOD(webgl_get_extension);
|
|
39
|
+
METHOD(webgl_get_context_attributes);
|
|
40
|
+
METHOD(webgl_is_context_lost);
|
|
41
|
+
METHOD(webgl_stencil_func);
|
|
42
|
+
METHOD(webgl_stencil_func_separate);
|
|
43
|
+
METHOD(webgl_stencil_op);
|
|
44
|
+
METHOD(webgl_stencil_op_separate);
|
|
45
|
+
METHOD(webgl_stencil_mask);
|
|
46
|
+
METHOD(webgl_stencil_mask_separate);
|
|
47
|
+
METHOD(webgl_get_shader_precision_format);
|
|
48
|
+
|
|
49
|
+
/* WebGL shaders, programs and uniforms */
|
|
50
|
+
METHOD(webgl_create_shader);
|
|
51
|
+
METHOD(webgl_delete_shader);
|
|
52
|
+
METHOD(webgl_shader_source);
|
|
53
|
+
METHOD(webgl_compile_shader);
|
|
54
|
+
METHOD(webgl_get_shader_parameter);
|
|
55
|
+
METHOD(webgl_get_shader_info_log);
|
|
56
|
+
METHOD(webgl_get_shader_source);
|
|
57
|
+
METHOD(webgl_create_program);
|
|
58
|
+
METHOD(webgl_delete_program);
|
|
59
|
+
METHOD(webgl_attach_shader);
|
|
60
|
+
METHOD(webgl_detach_shader);
|
|
61
|
+
METHOD(webgl_link_program);
|
|
62
|
+
METHOD(webgl_use_program);
|
|
63
|
+
METHOD(webgl_get_program_parameter);
|
|
64
|
+
METHOD(webgl_get_program_info_log);
|
|
65
|
+
METHOD(webgl_get_attached_shaders);
|
|
66
|
+
METHOD(webgl_validate_program);
|
|
67
|
+
METHOD(webgl_get_active_uniform);
|
|
68
|
+
METHOD(webgl_get_active_attrib);
|
|
69
|
+
METHOD(webgl_get_uniform_location);
|
|
70
|
+
METHOD(webgl_get_attrib_location);
|
|
71
|
+
METHOD(webgl_bind_attrib_location);
|
|
72
|
+
METHOD(webgl_get_uniform);
|
|
73
|
+
METHOD(webgl_uniform1f);
|
|
74
|
+
METHOD(webgl_uniform2f);
|
|
75
|
+
METHOD(webgl_uniform3f);
|
|
76
|
+
METHOD(webgl_uniform4f);
|
|
77
|
+
METHOD(webgl_uniform1i);
|
|
78
|
+
METHOD(webgl_uniform2i);
|
|
79
|
+
METHOD(webgl_uniform3i);
|
|
80
|
+
METHOD(webgl_uniform4i);
|
|
81
|
+
METHOD(webgl_uniform1fv);
|
|
82
|
+
METHOD(webgl_uniform2fv);
|
|
83
|
+
METHOD(webgl_uniform3fv);
|
|
84
|
+
METHOD(webgl_uniform4fv);
|
|
85
|
+
METHOD(webgl_uniform1iv);
|
|
86
|
+
METHOD(webgl_uniform2iv);
|
|
87
|
+
METHOD(webgl_uniform3iv);
|
|
88
|
+
METHOD(webgl_uniform4iv);
|
|
89
|
+
METHOD(webgl_uniform_matrix2fv);
|
|
90
|
+
METHOD(webgl_uniform_matrix3fv);
|
|
91
|
+
METHOD(webgl_uniform_matrix4fv);
|
|
92
|
+
|
|
93
|
+
/* WebGL buffers, vertex attributes and draws */
|
|
94
|
+
METHOD(webgl_create_buffer);
|
|
95
|
+
METHOD(webgl_delete_buffer);
|
|
96
|
+
METHOD(webgl_bind_buffer);
|
|
97
|
+
METHOD(webgl_buffer_data);
|
|
98
|
+
METHOD(webgl_buffer_sub_data);
|
|
99
|
+
METHOD(webgl_get_buffer_parameter);
|
|
100
|
+
METHOD(webgl_enable_vertex_attrib_array);
|
|
101
|
+
METHOD(webgl_disable_vertex_attrib_array);
|
|
102
|
+
METHOD(webgl_vertex_attrib_pointer);
|
|
103
|
+
METHOD(webgl_vertex_attrib1f);
|
|
104
|
+
METHOD(webgl_vertex_attrib2f);
|
|
105
|
+
METHOD(webgl_vertex_attrib3f);
|
|
106
|
+
METHOD(webgl_vertex_attrib4f);
|
|
107
|
+
METHOD(webgl_vertex_attrib1fv);
|
|
108
|
+
METHOD(webgl_vertex_attrib2fv);
|
|
109
|
+
METHOD(webgl_vertex_attrib3fv);
|
|
110
|
+
METHOD(webgl_vertex_attrib4fv);
|
|
111
|
+
METHOD(webgl_get_vertex_attrib);
|
|
112
|
+
METHOD(webgl_draw_arrays);
|
|
113
|
+
METHOD(webgl_draw_elements);
|
|
114
|
+
|
|
115
|
+
/* WebGL textures, framebuffers and readback */
|
|
116
|
+
METHOD(webgl_create_texture);
|
|
117
|
+
METHOD(webgl_delete_texture);
|
|
118
|
+
METHOD(webgl_bind_texture);
|
|
119
|
+
METHOD(webgl_active_texture);
|
|
120
|
+
METHOD(webgl_tex_parameteri);
|
|
121
|
+
METHOD(webgl_tex_parameterf);
|
|
122
|
+
METHOD(webgl_get_tex_parameter);
|
|
123
|
+
METHOD(webgl_tex_image_2d);
|
|
124
|
+
METHOD(webgl_tex_sub_image_2d);
|
|
125
|
+
METHOD(webgl_compressed_tex_image_2d);
|
|
126
|
+
METHOD(webgl_compressed_tex_sub_image_2d);
|
|
127
|
+
METHOD(webgl_generate_mipmap);
|
|
128
|
+
METHOD(webgl_create_framebuffer);
|
|
129
|
+
METHOD(webgl_delete_framebuffer);
|
|
130
|
+
METHOD(webgl_bind_framebuffer);
|
|
131
|
+
METHOD(webgl_framebuffer_texture_2d);
|
|
132
|
+
METHOD(webgl_check_framebuffer_status);
|
|
133
|
+
METHOD(webgl_create_renderbuffer);
|
|
134
|
+
METHOD(webgl_delete_renderbuffer);
|
|
135
|
+
METHOD(webgl_bind_renderbuffer);
|
|
136
|
+
METHOD(webgl_renderbuffer_storage);
|
|
137
|
+
METHOD(webgl_framebuffer_renderbuffer);
|
|
138
|
+
METHOD(webgl_get_renderbuffer_parameter);
|
|
139
|
+
METHOD(webgl_read_pixels);
|
|
140
|
+
|
|
141
|
+
/* WebGL 2 context extensions */
|
|
142
|
+
METHOD(webgl2_create_vertex_array);
|
|
143
|
+
METHOD(webgl2_delete_vertex_array);
|
|
144
|
+
METHOD(webgl2_bind_vertex_array);
|
|
145
|
+
METHOD(webgl2_is_vertex_array);
|
|
146
|
+
METHOD(webgl2_vertex_attrib_ipointer);
|
|
147
|
+
METHOD(webgl2_vertex_attrib_i4i);
|
|
148
|
+
METHOD(webgl2_vertex_attrib_i4iv);
|
|
149
|
+
METHOD(webgl2_vertex_attrib_i4ui);
|
|
150
|
+
METHOD(webgl2_vertex_attrib_i4uiv);
|
|
151
|
+
METHOD(webgl2_vertex_attrib_divisor);
|
|
152
|
+
METHOD(webgl2_draw_arrays_instanced);
|
|
153
|
+
METHOD(webgl2_draw_elements_instanced);
|
|
154
|
+
METHOD(webgl2_draw_range_elements);
|
|
155
|
+
METHOD(webgl2_uniform1ui);
|
|
156
|
+
METHOD(webgl2_uniform2ui);
|
|
157
|
+
METHOD(webgl2_uniform3ui);
|
|
158
|
+
METHOD(webgl2_uniform4ui);
|
|
159
|
+
METHOD(webgl2_create_sampler);
|
|
160
|
+
METHOD(webgl2_delete_sampler);
|
|
161
|
+
METHOD(webgl2_bind_sampler);
|
|
162
|
+
METHOD(webgl2_sampler_parameteri);
|
|
163
|
+
METHOD(webgl2_sampler_parameterf);
|
|
164
|
+
METHOD(webgl2_get_sampler_parameter);
|
|
165
|
+
METHOD(webgl2_create_query);
|
|
166
|
+
METHOD(webgl2_delete_query);
|
|
167
|
+
METHOD(webgl2_begin_query);
|
|
168
|
+
METHOD(webgl2_end_query);
|
|
169
|
+
METHOD(webgl2_get_query);
|
|
170
|
+
METHOD(webgl2_get_query_parameter);
|
|
171
|
+
METHOD(webgl2_create_transform_feedback);
|
|
172
|
+
METHOD(webgl2_delete_transform_feedback);
|
|
173
|
+
METHOD(webgl2_bind_transform_feedback);
|
|
174
|
+
METHOD(webgl2_begin_transform_feedback);
|
|
175
|
+
METHOD(webgl2_end_transform_feedback);
|
|
176
|
+
METHOD(webgl2_pause_transform_feedback);
|
|
177
|
+
METHOD(webgl2_resume_transform_feedback);
|
|
178
|
+
METHOD(webgl2_transform_feedback_varyings);
|
|
179
|
+
METHOD(webgl2_get_transform_feedback_varying);
|
|
180
|
+
METHOD(webgl2_fence_sync);
|
|
181
|
+
METHOD(webgl2_delete_sync);
|
|
182
|
+
METHOD(webgl2_client_wait_sync);
|
|
183
|
+
METHOD(webgl2_wait_sync);
|
|
184
|
+
METHOD(webgl2_get_sync_parameter);
|
|
185
|
+
METHOD(webgl2_bind_buffer_base);
|
|
186
|
+
METHOD(webgl2_bind_buffer_range);
|
|
187
|
+
METHOD(webgl2_get_indexed_parameter);
|
|
188
|
+
METHOD(webgl2_copy_buffer_sub_data);
|
|
189
|
+
METHOD(webgl2_get_buffer_sub_data);
|
|
190
|
+
METHOD(webgl2_get_uniform_indices);
|
|
191
|
+
METHOD(webgl2_get_active_uniforms);
|
|
192
|
+
METHOD(webgl2_get_uniform_block_index);
|
|
193
|
+
METHOD(webgl2_get_active_uniform_block_parameter);
|
|
194
|
+
METHOD(webgl2_get_active_uniform_block_name);
|
|
195
|
+
METHOD(webgl2_uniform_block_binding);
|
|
196
|
+
METHOD(webgl2_drawing_buffer_storage);
|
|
197
|
+
METHOD(webgl2_tex_storage_2d);
|
|
198
|
+
METHOD(webgl2_tex_storage_3d);
|
|
199
|
+
METHOD(webgl2_tex_image_3d);
|
|
200
|
+
METHOD(webgl2_tex_sub_image_3d);
|
|
201
|
+
METHOD(webgl2_compressed_tex_image2d);
|
|
202
|
+
METHOD(webgl2_compressed_tex_sub_image2d);
|
|
203
|
+
METHOD(webgl2_compressed_tex_image3d);
|
|
204
|
+
METHOD(webgl2_compressed_tex_sub_image3d);
|
|
205
|
+
METHOD(webgl2_clear_buffer_fi);
|
|
206
|
+
METHOD(webgl2_clear_buffer_fv);
|
|
207
|
+
METHOD(webgl2_clear_buffer_iv);
|
|
208
|
+
METHOD(webgl2_clear_buffer_uiv);
|
|
209
|
+
METHOD(webgl2_draw_buffers);
|
|
210
|
+
METHOD(webgl2_read_buffer);
|
|
211
|
+
METHOD(webgl2_blit_framebuffer);
|
|
212
|
+
METHOD(webgl2_framebuffer_texture_layer);
|
|
213
|
+
METHOD(webgl2_invalidate_framebuffer);
|
|
214
|
+
METHOD(webgl2_invalidate_sub_framebuffer);
|
|
215
|
+
METHOD(webgl2_get_internalformat_parameter);
|
|
216
|
+
METHOD(webgl2_get_frag_data_location);
|
|
217
|
+
|
|
@@ -308,7 +308,119 @@ bool closesOpenElement(const std::string &open, const std::string &next) {
|
|
|
308
308
|
|
|
309
309
|
} // namespace
|
|
310
310
|
|
|
311
|
-
|
|
311
|
+
namespace {
|
|
312
|
+
|
|
313
|
+
/** Elements the HTML tree builder puts in `<head>` when the source omits it. */
|
|
314
|
+
bool isHeadElement(const Node *node) {
|
|
315
|
+
if (node == nullptr || !node->isElement()) return false;
|
|
316
|
+
return node->tag == "title" || node->tag == "meta" || node->tag == "link" ||
|
|
317
|
+
node->tag == "base" || node->tag == "style";
|
|
318
|
+
}
|
|
319
|
+
|
|
320
|
+
/** A parsed fragment (`<div>…</div>`, no `<html>`) still needs `document.body`
|
|
321
|
+
* and the HTML structure the UA stylesheet assumes (`body { margin: 8px }`,
|
|
322
|
+
* `:root`, `html`/`body` block boxes). Browsers synthesise the missing elements
|
|
323
|
+
* during tree construction; the engine does the same after parsing, moving
|
|
324
|
+
* head-like top-level nodes into `<head>` and everything else into `<body>`. */
|
|
325
|
+
void synthesizeDocumentStructure(Node *document) {
|
|
326
|
+
Node *html = nullptr;
|
|
327
|
+
for (const std::unique_ptr<Node> &child : document->children) {
|
|
328
|
+
if (child->isElement() && child->tag == "html") {
|
|
329
|
+
html = child.get();
|
|
330
|
+
break;
|
|
331
|
+
}
|
|
332
|
+
}
|
|
333
|
+
if (html == nullptr) {
|
|
334
|
+
auto html_node = std::make_unique<Node>(NodeType::Element);
|
|
335
|
+
html_node->tag = "html";
|
|
336
|
+
auto head_node = std::make_unique<Node>(NodeType::Element);
|
|
337
|
+
head_node->tag = "head";
|
|
338
|
+
auto body_node = std::make_unique<Node>(NodeType::Element);
|
|
339
|
+
body_node->tag = "body";
|
|
340
|
+
std::vector<std::unique_ptr<Node>> top_level;
|
|
341
|
+
top_level.swap(document->children);
|
|
342
|
+
for (std::unique_ptr<Node> &child : top_level) {
|
|
343
|
+
if (child->isElement() && isHeadElement(child.get())) {
|
|
344
|
+
head_node->append(std::move(child));
|
|
345
|
+
} else if (child->isText() && xt_dom_trim(child->text).empty()) {
|
|
346
|
+
/* Inter-element whitespace outside <body> is dropped, like the HTML
|
|
347
|
+
* parser's "before head/body" insertion modes. */
|
|
348
|
+
} else {
|
|
349
|
+
body_node->append(std::move(child));
|
|
350
|
+
}
|
|
351
|
+
}
|
|
352
|
+
html_node->append(std::move(head_node));
|
|
353
|
+
html_node->append(std::move(body_node));
|
|
354
|
+
document->append(std::move(html_node));
|
|
355
|
+
return;
|
|
356
|
+
}
|
|
357
|
+
|
|
358
|
+
Node *head = nullptr;
|
|
359
|
+
Node *body = nullptr;
|
|
360
|
+
for (const std::unique_ptr<Node> &child : html->children) {
|
|
361
|
+
if (child->isElement() && child->tag == "head") head = child.get();
|
|
362
|
+
if (child->isElement() && child->tag == "body") body = child.get();
|
|
363
|
+
}
|
|
364
|
+
if (head == nullptr) {
|
|
365
|
+
auto head_node = std::make_unique<Node>(NodeType::Element);
|
|
366
|
+
head_node->tag = "head";
|
|
367
|
+
Node *reference = html->children.empty() ? nullptr : html->children.front().get();
|
|
368
|
+
html->insertChild(std::move(head_node), reference);
|
|
369
|
+
head = html->firstElementChild();
|
|
370
|
+
/* `insertChild` may append when the reference is not a child. */
|
|
371
|
+
for (const std::unique_ptr<Node> &child : html->children) {
|
|
372
|
+
if (child->isElement() && child->tag == "head") head = child.get();
|
|
373
|
+
}
|
|
374
|
+
}
|
|
375
|
+
/* Move stray head elements (a `<style>` after `</head>`, a fragment's style)
|
|
376
|
+
* into the head so the cascade sees them in the usual place. */
|
|
377
|
+
{
|
|
378
|
+
std::vector<std::unique_ptr<Node>> moved;
|
|
379
|
+
for (auto it = html->children.begin(); it != html->children.end();) {
|
|
380
|
+
if (it->get() != head && it->get() != body && isHeadElement(it->get())) {
|
|
381
|
+
moved.push_back(std::move(*it));
|
|
382
|
+
it = html->children.erase(it);
|
|
383
|
+
} else {
|
|
384
|
+
++it;
|
|
385
|
+
}
|
|
386
|
+
}
|
|
387
|
+
for (std::unique_ptr<Node> &child : moved) head->append(std::move(child));
|
|
388
|
+
}
|
|
389
|
+
if (body == nullptr) {
|
|
390
|
+
auto body_node = std::make_unique<Node>(NodeType::Element);
|
|
391
|
+
body_node->tag = "body";
|
|
392
|
+
std::vector<std::unique_ptr<Node>> moved;
|
|
393
|
+
for (auto it = html->children.begin(); it != html->children.end();) {
|
|
394
|
+
if (it->get() == head || it->get() == body) {
|
|
395
|
+
++it;
|
|
396
|
+
continue;
|
|
397
|
+
}
|
|
398
|
+
moved.push_back(std::move(*it));
|
|
399
|
+
it = html->children.erase(it);
|
|
400
|
+
}
|
|
401
|
+
html->append(std::move(body_node));
|
|
402
|
+
body = html->children.back().get();
|
|
403
|
+
for (std::unique_ptr<Node> &child : moved) body->append(std::move(child));
|
|
404
|
+
}
|
|
405
|
+
/* Stray body content directly under <html> (a `<div>` after `</body>`, a
|
|
406
|
+
* fragment mixed with an authored body) belongs in the body. */
|
|
407
|
+
{
|
|
408
|
+
std::vector<std::unique_ptr<Node>> moved;
|
|
409
|
+
for (auto it = html->children.begin(); it != html->children.end();) {
|
|
410
|
+
if (it->get() == head || it->get() == body) {
|
|
411
|
+
++it;
|
|
412
|
+
continue;
|
|
413
|
+
}
|
|
414
|
+
moved.push_back(std::move(*it));
|
|
415
|
+
it = html->children.erase(it);
|
|
416
|
+
}
|
|
417
|
+
for (std::unique_ptr<Node> &child : moved) body->append(std::move(child));
|
|
418
|
+
}
|
|
419
|
+
}
|
|
420
|
+
|
|
421
|
+
} // namespace
|
|
422
|
+
|
|
423
|
+
std::unique_ptr<Node> xt_html_parse(const std::string &html, bool synthesize_structure) {
|
|
312
424
|
Tokenizer tokenizer(html);
|
|
313
425
|
std::vector<Token> tokens = tokenizer.run();
|
|
314
426
|
|
|
@@ -346,6 +458,7 @@ std::unique_ptr<Node> xt_html_parse(const std::string &html) {
|
|
|
346
458
|
}
|
|
347
459
|
}
|
|
348
460
|
|
|
461
|
+
if (synthesize_structure) synthesizeDocumentStructure(document.get());
|
|
349
462
|
return document;
|
|
350
463
|
}
|
|
351
464
|
|
|
@@ -0,0 +1,166 @@
|
|
|
1
|
+
/*
|
|
2
|
+
* xbintsc GUI engine — page-level error reporting.
|
|
3
|
+
*
|
|
4
|
+
* A callback the engine invokes (an element listener, a window listener, a
|
|
5
|
+
* timer, an animation frame, a media event) can throw. Without a boundary that
|
|
6
|
+
* exception reaches `xt_throw` with no `try` frame, prints to stderr and calls
|
|
7
|
+
* `exit(1)`; in a GUI program the only visible effect is the window vanishing.
|
|
8
|
+
* `xt_gui_invoke` runs such callbacks under a `try` frame and hands the value
|
|
9
|
+
* to `xt_gui_report_uncaught`, which mirrors the browser surfaces:
|
|
10
|
+
*
|
|
11
|
+
* - `window.onerror(message, source, line, column, error)`
|
|
12
|
+
* - `window.addEventListener("error", handler)` (an ErrorEvent-like object)
|
|
13
|
+
* - `window.onunhandledrejection` / the `unhandledrejection` event
|
|
14
|
+
*
|
|
15
|
+
* Reporting never terminates the program, so one bad handler cannot take the
|
|
16
|
+
* page (or the other listeners) down. A throw inside the reporter itself is
|
|
17
|
+
* only logged, which also breaks the recursion an error listener could cause.
|
|
18
|
+
*/
|
|
19
|
+
|
|
20
|
+
#include "dom_api_internal.h"
|
|
21
|
+
#include "gui_engine.h"
|
|
22
|
+
|
|
23
|
+
#include <setjmp.h>
|
|
24
|
+
#include <cstdio>
|
|
25
|
+
#include <string>
|
|
26
|
+
|
|
27
|
+
namespace {
|
|
28
|
+
|
|
29
|
+
/** Set while a report (and the handlers it runs) is in progress. */
|
|
30
|
+
bool g_reporting = false;
|
|
31
|
+
|
|
32
|
+
std::string to_std_string(xt_value value) {
|
|
33
|
+
const char *data = xt_string_data(xt_to_string(value));
|
|
34
|
+
return data != nullptr ? std::string(data) : std::string();
|
|
35
|
+
}
|
|
36
|
+
|
|
37
|
+
std::string error_message(xt_value error) {
|
|
38
|
+
if (XT_IS_OBJECT(error)) {
|
|
39
|
+
xt_value message = xt_object_get_cstr(error, "message");
|
|
40
|
+
if (XT_IS_STRING(message)) {
|
|
41
|
+
const char *data = xt_string_data(message);
|
|
42
|
+
if (data != nullptr) return std::string(data);
|
|
43
|
+
}
|
|
44
|
+
}
|
|
45
|
+
return to_std_string(error);
|
|
46
|
+
}
|
|
47
|
+
|
|
48
|
+
xt_value set_field(xt_value object, const char *key, xt_value value) {
|
|
49
|
+
xt_object_set(object, xt_string_from_cstr(key), value);
|
|
50
|
+
return object;
|
|
51
|
+
}
|
|
52
|
+
|
|
53
|
+
/** Common Event fields; `event_proto` supplies `preventDefault()`. */
|
|
54
|
+
xt_value make_event(const char *type, XtGuiWindow *win) {
|
|
55
|
+
xt_value event = xt_object_new_with_proto(domapi::event_proto());
|
|
56
|
+
set_field(event, "type", xt_string_from_cstr(type));
|
|
57
|
+
set_field(event, "target", win->object);
|
|
58
|
+
set_field(event, "currentTarget", win->object);
|
|
59
|
+
set_field(event, "defaultPrevented", XT_FALSE);
|
|
60
|
+
set_field(event, "bubbles", XT_FALSE);
|
|
61
|
+
set_field(event, "cancelable", XT_TRUE);
|
|
62
|
+
set_field(event, "isTrusted", XT_TRUE);
|
|
63
|
+
set_field(event, "eventPhase", xt_number(2));
|
|
64
|
+
set_field(event, "timeStamp", xt_number(0));
|
|
65
|
+
return event;
|
|
66
|
+
}
|
|
67
|
+
|
|
68
|
+
void log_uncaught(const std::string &message) {
|
|
69
|
+
std::fprintf(stderr, "Uncaught %s\n", message.c_str());
|
|
70
|
+
}
|
|
71
|
+
|
|
72
|
+
} // namespace
|
|
73
|
+
|
|
74
|
+
extern "C" void xt_gui_install_error_handlers(void) {
|
|
75
|
+
xt_set_uncaught_exception_handler(xt_gui_report_uncaught);
|
|
76
|
+
xt_set_unhandled_rejection_handler(xt_gui_unhandled_rejection);
|
|
77
|
+
}
|
|
78
|
+
|
|
79
|
+
extern "C" void xt_gui_report_uncaught(xt_value error) {
|
|
80
|
+
std::string message = error_message(error);
|
|
81
|
+
if (g_reporting) {
|
|
82
|
+
log_uncaught(message);
|
|
83
|
+
return;
|
|
84
|
+
}
|
|
85
|
+
XtGuiWindow *win = xt_gui_primary_window();
|
|
86
|
+
if (win == nullptr) {
|
|
87
|
+
log_uncaught(message);
|
|
88
|
+
return;
|
|
89
|
+
}
|
|
90
|
+
g_reporting = true;
|
|
91
|
+
|
|
92
|
+
xt_value event = make_event("error", win);
|
|
93
|
+
set_field(event, "message", xt_string_from_cstr(message.c_str()));
|
|
94
|
+
set_field(event, "filename", xt_string_from_cstr(""));
|
|
95
|
+
set_field(event, "lineno", xt_number(0));
|
|
96
|
+
set_field(event, "colno", xt_number(0));
|
|
97
|
+
set_field(event, "error", error);
|
|
98
|
+
|
|
99
|
+
/* The classic `onerror` signature, then every `error` listener. Either can
|
|
100
|
+
* call the event's `preventDefault()` (or `onerror` can return true) to
|
|
101
|
+
* suppress the default log line. */
|
|
102
|
+
int prevented = 0;
|
|
103
|
+
xt_value handler = xt_object_get_cstr(win->object, "onerror");
|
|
104
|
+
if (XT_IS_FUNCTION(handler)) {
|
|
105
|
+
xt_value args[5] = {
|
|
106
|
+
xt_string_from_cstr(message.c_str()),
|
|
107
|
+
xt_string_from_cstr(""),
|
|
108
|
+
xt_number(0),
|
|
109
|
+
xt_number(0),
|
|
110
|
+
error,
|
|
111
|
+
};
|
|
112
|
+
prevented = xt_truthy(xt_call_with_this(handler, win->object, 5, args));
|
|
113
|
+
}
|
|
114
|
+
xt_gui_emit_payload(win, "error", event);
|
|
115
|
+
if (xt_truthy(xt_object_get_cstr(event, "defaultPrevented"))) prevented = 1;
|
|
116
|
+
if (!prevented) log_uncaught(message);
|
|
117
|
+
|
|
118
|
+
g_reporting = false;
|
|
119
|
+
}
|
|
120
|
+
|
|
121
|
+
extern "C" int xt_gui_unhandled_rejection(xt_value reason, xt_value promise) {
|
|
122
|
+
XtGuiWindow *win = xt_gui_primary_window();
|
|
123
|
+
if (win == nullptr) return 0;
|
|
124
|
+
std::string message = error_message(reason);
|
|
125
|
+
if (g_reporting) {
|
|
126
|
+
std::fprintf(stderr, "Unhandled promise rejection\n%s\n", message.c_str());
|
|
127
|
+
return 1;
|
|
128
|
+
}
|
|
129
|
+
g_reporting = true;
|
|
130
|
+
|
|
131
|
+
xt_value event = make_event("unhandledrejection", win);
|
|
132
|
+
set_field(event, "reason", reason);
|
|
133
|
+
set_field(event, "promise", promise);
|
|
134
|
+
set_field(event, "message", xt_string_from_cstr(message.c_str()));
|
|
135
|
+
|
|
136
|
+
xt_value handler = xt_object_get_cstr(win->object, "onunhandledrejection");
|
|
137
|
+
if (XT_IS_FUNCTION(handler)) {
|
|
138
|
+
xt_value args[1] = {event};
|
|
139
|
+
xt_call_with_this(handler, win->object, 1, args);
|
|
140
|
+
}
|
|
141
|
+
xt_gui_emit_payload(win, "unhandledrejection", event);
|
|
142
|
+
if (!xt_truthy(xt_object_get_cstr(event, "defaultPrevented"))) {
|
|
143
|
+
std::fprintf(stderr, "Unhandled promise rejection\n%s\n", message.c_str());
|
|
144
|
+
}
|
|
145
|
+
|
|
146
|
+
g_reporting = false;
|
|
147
|
+
/* The page owns the rejection now; never turn it into a fatal process exit. */
|
|
148
|
+
return 1;
|
|
149
|
+
}
|
|
150
|
+
|
|
151
|
+
extern "C" int xt_gui_invoke(xt_value fn, xt_value thisValue, int32_t argc, xt_value *argv) {
|
|
152
|
+
if (!XT_IS_FUNCTION(fn)) return 1;
|
|
153
|
+
void *frame = xt_try_enter();
|
|
154
|
+
/* `xt_try_frame` starts with the setjmp buffer; the longjmp in `xt_throw`
|
|
155
|
+
* returns here and the C++ frames between the callback and this boundary
|
|
156
|
+
* hold no destructible state. */
|
|
157
|
+
if (_setjmp(*(jmp_buf *)frame) == 0) {
|
|
158
|
+
xt_call_with_this(fn, thisValue, argc, argv);
|
|
159
|
+
xt_try_leave(frame);
|
|
160
|
+
return 1;
|
|
161
|
+
}
|
|
162
|
+
xt_value error = xt_try_exception(frame);
|
|
163
|
+
xt_try_leave(frame);
|
|
164
|
+
xt_gui_report_uncaught(error);
|
|
165
|
+
return 0;
|
|
166
|
+
}
|