@treatjs/ant-sdk-linux-x64-gnu 0.1.0-ant-sdk.33ae7017faf9

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.
Files changed (33) hide show
  1. package/package.json +18 -0
  2. package/sdk/LICENSES/ant-LICENSE.txt +21 -0
  3. package/sdk/LICENSES/argtable3-LICENSE.txt +167 -0
  4. package/sdk/LICENSES/base64-LICENSE.txt +28 -0
  5. package/sdk/LICENSES/boringssl-LICENSE.txt +238 -0
  6. package/sdk/LICENSES/brotli-LICENSE.txt +19 -0
  7. package/sdk/LICENSES/crprintf-LICENSE.txt +21 -0
  8. package/sdk/LICENSES/double-conversion-LICENSE.txt +26 -0
  9. package/sdk/LICENSES/libffi-LICENSE.txt +21 -0
  10. package/sdk/LICENSES/libuv-LICENSE.txt +19 -0
  11. package/sdk/LICENSES/llhttp-LICENSE.txt +22 -0
  12. package/sdk/LICENSES/lmdb-LICENSE.txt +47 -0
  13. package/sdk/LICENSES/minicoro-LICENSE.txt +47 -0
  14. package/sdk/LICENSES/mir-LICENSE.txt +21 -0
  15. package/sdk/LICENSES/nghttp2-LICENSE.txt +21 -0
  16. package/sdk/LICENSES/pcre2-LICENSE.txt +5 -0
  17. package/sdk/LICENSES/skim-LICENSE.txt +21 -0
  18. package/sdk/LICENSES/tlsuv-LICENSE.txt +21 -0
  19. package/sdk/LICENSES/uriparser-LICENSE.txt +202 -0
  20. package/sdk/LICENSES/utf8proc-LICENSE.txt +93 -0
  21. package/sdk/LICENSES/uthash-LICENSE.txt +21 -0
  22. package/sdk/LICENSES/wamr-LICENSE.txt +219 -0
  23. package/sdk/LICENSES/wirecall-LICENSE.txt +21 -0
  24. package/sdk/LICENSES/yyjson-LICENSE.txt +21 -0
  25. package/sdk/LICENSES/zlib-ng-LICENSE.txt +19 -0
  26. package/sdk/include/ant.h +233 -0
  27. package/sdk/include/pkg.h +385 -0
  28. package/sdk/include/treat_ant_bridge.h +74 -0
  29. package/sdk/lib/libtreat_ant_bridge_helpers.a +0 -0
  30. package/sdk/lib/libtreat_ant_native.a +0 -0
  31. package/sdk/metadata/sdk.json +18 -0
  32. package/sdk/rust/bindings.rs +4847 -0
  33. package/sdk/rust/tag_constants.rs +13 -0
@@ -0,0 +1,219 @@
1
+ Apache License
2
+ Version 2.0, January 2004
3
+ http://www.apache.org/licenses/
4
+
5
+ TERMS AND CONDITIONS FOR USE, REPRODUCTION, AND DISTRIBUTION
6
+
7
+ 1. Definitions.
8
+
9
+ "License" shall mean the terms and conditions for use, reproduction,
10
+ and distribution as defined by Sections 1 through 9 of this document.
11
+
12
+ "Licensor" shall mean the copyright owner or entity authorized by
13
+ the copyright owner that is granting the License.
14
+
15
+ "Legal Entity" shall mean the union of the acting entity and all
16
+ other entities that control, are controlled by, or are under common
17
+ control with that entity. For the purposes of this definition,
18
+ "control" means (i) the power, direct or indirect, to cause the
19
+ direction or management of such entity, whether by contract or
20
+ otherwise, or (ii) ownership of fifty percent (50%) or more of the
21
+ outstanding shares, or (iii) beneficial ownership of such entity.
22
+
23
+ "You" (or "Your") shall mean an individual or Legal Entity
24
+ exercising permissions granted by this License.
25
+
26
+ "Source" form shall mean the preferred form for making modifications,
27
+ including but not limited to software source code, documentation
28
+ source, and configuration files.
29
+
30
+ "Object" form shall mean any form resulting from mechanical
31
+ transformation or translation of a Source form, including but
32
+ not limited to compiled object code, generated documentation,
33
+ and conversions to other media types.
34
+
35
+ "Work" shall mean the work of authorship, whether in Source or
36
+ Object form, made available under the License, as indicated by a
37
+ copyright notice that is included in or attached to the work
38
+ (an example is provided in the Appendix below).
39
+
40
+ "Derivative Works" shall mean any work, whether in Source or Object
41
+ form, that is based on (or derived from) the Work and for which the
42
+ editorial revisions, annotations, elaborations, or other modifications
43
+ represent, as a whole, an original work of authorship. For the purposes
44
+ of this License, Derivative Works shall not include works that remain
45
+ separable from, or merely link (or bind by name) to the interfaces of,
46
+ the Work and Derivative Works thereof.
47
+
48
+ "Contribution" shall mean any work of authorship, including
49
+ the original version of the Work and any modifications or additions
50
+ to that Work or Derivative Works thereof, that is intentionally
51
+ submitted to Licensor for inclusion in the Work by the copyright owner
52
+ or by an individual or Legal Entity authorized to submit on behalf of
53
+ the copyright owner. For the purposes of this definition, "submitted"
54
+ means any form of electronic, verbal, or written communication sent
55
+ to the Licensor or its representatives, including but not limited to
56
+ communication on electronic mailing lists, source code control systems,
57
+ and issue tracking systems that are managed by, or on behalf of, the
58
+ Licensor for the purpose of discussing and improving the Work, but
59
+ excluding communication that is conspicuously marked or otherwise
60
+ designated in writing by the copyright owner as "Not a Contribution."
61
+
62
+ "Contributor" shall mean Licensor and any individual or Legal Entity
63
+ on behalf of whom a Contribution has been received by Licensor and
64
+ subsequently incorporated within the Work.
65
+
66
+ 2. Grant of Copyright License. Subject to the terms and conditions of
67
+ this License, each Contributor hereby grants to You a perpetual,
68
+ worldwide, non-exclusive, no-charge, royalty-free, irrevocable
69
+ copyright license to reproduce, prepare Derivative Works of,
70
+ publicly display, publicly perform, sublicense, and distribute the
71
+ Work and such Derivative Works in Source or Object form.
72
+
73
+ 3. Grant of Patent License. Subject to the terms and conditions of
74
+ this License, each Contributor hereby grants to You a perpetual,
75
+ worldwide, non-exclusive, no-charge, royalty-free, irrevocable
76
+ (except as stated in this section) patent license to make, have made,
77
+ use, offer to sell, sell, import, and otherwise transfer the Work,
78
+ where such license applies only to those patent claims licensable
79
+ by such Contributor that are necessarily infringed by their
80
+ Contribution(s) alone or by combination of their Contribution(s)
81
+ with the Work to which such Contribution(s) was submitted. If You
82
+ institute patent litigation against any entity (including a
83
+ cross-claim or counterclaim in a lawsuit) alleging that the Work
84
+ or a Contribution incorporated within the Work constitutes direct
85
+ or contributory patent infringement, then any patent licenses
86
+ granted to You under this License for that Work shall terminate
87
+ as of the date such litigation is filed.
88
+
89
+ 4. Redistribution. You may reproduce and distribute copies of the
90
+ Work or Derivative Works thereof in any medium, with or without
91
+ modifications, and in Source or Object form, provided that You
92
+ meet the following conditions:
93
+
94
+ (a) You must give any other recipients of the Work or
95
+ Derivative Works a copy of this License; and
96
+
97
+ (b) You must cause any modified files to carry prominent notices
98
+ stating that You changed the files; and
99
+
100
+ (c) You must retain, in the Source form of any Derivative Works
101
+ that You distribute, all copyright, patent, trademark, and
102
+ attribution notices from the Source form of the Work,
103
+ excluding those notices that do not pertain to any part of
104
+ the Derivative Works; and
105
+
106
+ (d) If the Work includes a "NOTICE" text file as part of its
107
+ distribution, then any Derivative Works that You distribute must
108
+ include a readable copy of the attribution notices contained
109
+ within such NOTICE file, excluding those notices that do not
110
+ pertain to any part of the Derivative Works, in at least one
111
+ of the following places: within a NOTICE text file distributed
112
+ as part of the Derivative Works; within the Source form or
113
+ documentation, if provided along with the Derivative Works; or,
114
+ within a display generated by the Derivative Works, if and
115
+ wherever such third-party notices normally appear. The contents
116
+ of the NOTICE file are for informational purposes only and
117
+ do not modify the License. You may add Your own attribution
118
+ notices within Derivative Works that You distribute, alongside
119
+ or as an addendum to the NOTICE text from the Work, provided
120
+ that such additional attribution notices cannot be construed
121
+ as modifying the License.
122
+
123
+ You may add Your own copyright statement to Your modifications and
124
+ may provide additional or different license terms and conditions
125
+ for use, reproduction, or distribution of Your modifications, or
126
+ for any such Derivative Works as a whole, provided Your use,
127
+ reproduction, and distribution of the Work otherwise complies with
128
+ the conditions stated in this License.
129
+
130
+ 5. Submission of Contributions. Unless You explicitly state otherwise,
131
+ any Contribution intentionally submitted for inclusion in the Work
132
+ by You to the Licensor shall be under the terms and conditions of
133
+ this License, without any additional terms or conditions.
134
+ Notwithstanding the above, nothing herein shall supersede or modify
135
+ the terms of any separate license agreement you may have executed
136
+ with Licensor regarding such Contributions.
137
+
138
+ 6. Trademarks. This License does not grant permission to use the trade
139
+ names, trademarks, service marks, or product names of the Licensor,
140
+ except as required for reasonable and customary use in describing the
141
+ origin of the Work and reproducing the content of the NOTICE file.
142
+
143
+ 7. Disclaimer of Warranty. Unless required by applicable law or
144
+ agreed to in writing, Licensor provides the Work (and each
145
+ Contributor provides its Contributions) on an "AS IS" BASIS,
146
+ WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or
147
+ implied, including, without limitation, any warranties or conditions
148
+ of TITLE, NON-INFRINGEMENT, MERCHANTABILITY, or FITNESS FOR A
149
+ PARTICULAR PURPOSE. You are solely responsible for determining the
150
+ appropriateness of using or redistributing the Work and assume any
151
+ risks associated with Your exercise of permissions under this License.
152
+
153
+ 8. Limitation of Liability. In no event and under no legal theory,
154
+ whether in tort (including negligence), contract, or otherwise,
155
+ unless required by applicable law (such as deliberate and grossly
156
+ negligent acts) or agreed to in writing, shall any Contributor be
157
+ liable to You for damages, including any direct, indirect, special,
158
+ incidental, or consequential damages of any character arising as a
159
+ result of this License or out of the use or inability to use the
160
+ Work (including but not limited to damages for loss of goodwill,
161
+ work stoppage, computer failure or malfunction, or any and all
162
+ other commercial damages or losses), even if such Contributor
163
+ has been advised of the possibility of such damages.
164
+
165
+ 9. Accepting Warranty or Additional Liability. While redistributing
166
+ the Work or Derivative Works thereof, You may choose to offer,
167
+ and charge a fee for, acceptance of support, warranty, indemnity,
168
+ or other liability obligations and/or rights consistent with this
169
+ License. However, in accepting such obligations, You may act only
170
+ on Your own behalf and on Your sole responsibility, not on behalf
171
+ of any other Contributor, and only if You agree to indemnify,
172
+ defend, and hold each Contributor harmless for any liability
173
+ incurred by, or claims asserted against, such Contributor by reason
174
+ of your accepting any such warranty or additional liability.
175
+
176
+ END OF TERMS AND CONDITIONS
177
+
178
+ APPENDIX: How to apply the Apache License to your work.
179
+
180
+ To apply the Apache License to your work, attach the following
181
+ boilerplate notice, with the fields enclosed by brackets "[]"
182
+ replaced with your own identifying information. (Don't include
183
+ the brackets!) The text should be enclosed in the appropriate
184
+ comment syntax for the file format. We also recommend that a
185
+ file or class name and description of purpose be included on the
186
+ same "printed page" as the copyright notice for easier
187
+ identification within third-party archives.
188
+
189
+ Copyright [yyyy] [name of copyright owner]
190
+
191
+ Licensed under the Apache License, Version 2.0 (the "License");
192
+ you may not use this file except in compliance with the License.
193
+ You may obtain a copy of the License at
194
+
195
+ http://www.apache.org/licenses/LICENSE-2.0
196
+
197
+ Unless required by applicable law or agreed to in writing, software
198
+ distributed under the License is distributed on an "AS IS" BASIS,
199
+ WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
200
+ See the License for the specific language governing permissions and
201
+ limitations under the License.
202
+
203
+
204
+ --- LLVM Exceptions to the Apache 2.0 License ----
205
+
206
+ As an exception, if, as a result of your compiling your source code, portions
207
+ of this Software are embedded into an Object form of such source code, you
208
+ may redistribute such embedded portions in such Object form without complying
209
+ with the conditions of Sections 4(a), 4(b) and 4(d) of the License.
210
+
211
+ In addition, if you combine or link compiled forms of this Software with
212
+ software that is licensed under the GPLv2 ("Combined Software") and if a
213
+ court of competent jurisdiction determines that the patent provision (Section
214
+ 3), the indemnity provision (Section 9) or other Section of the License
215
+ conflicts with the conditions of the GPLv2, you may retroactively and
216
+ prospectively choose to deem waived or otherwise exclude such Section(s) of
217
+ the License, but only in their entirety and only with respect to the Combined
218
+ Software.
219
+
@@ -0,0 +1,21 @@
1
+ The MIT License (MIT)
2
+
3
+ Copyright (c) 2026 theMackabu (me@themackabu.dev)
4
+
5
+ Permission is hereby granted, free of charge, to any person obtaining a copy
6
+ of this software and associated documentation files (the "Software"), to deal
7
+ in the Software without restriction, including without limitation the rights
8
+ to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
9
+ copies of the Software, and to permit persons to whom the Software is
10
+ furnished to do so, subject to the following conditions:
11
+
12
+ The above copyright notice and this permission notice shall be included in all
13
+ copies or substantial portions of the Software.
14
+
15
+ THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
16
+ IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
17
+ FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
18
+ AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
19
+ LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
20
+ OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
21
+ SOFTWARE.
@@ -0,0 +1,21 @@
1
+ MIT License
2
+
3
+ Copyright (c) 2020 YaoYuan <ibireme@gmail.com>
4
+
5
+ Permission is hereby granted, free of charge, to any person obtaining a copy
6
+ of this software and associated documentation files (the "Software"), to deal
7
+ in the Software without restriction, including without limitation the rights
8
+ to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
9
+ copies of the Software, and to permit persons to whom the Software is
10
+ furnished to do so, subject to the following conditions:
11
+
12
+ The above copyright notice and this permission notice shall be included in all
13
+ copies or substantial portions of the Software.
14
+
15
+ THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
16
+ IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
17
+ FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
18
+ AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
19
+ LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
20
+ OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
21
+ SOFTWARE.
@@ -0,0 +1,19 @@
1
+ (C) 1995-2024 Jean-loup Gailly and Mark Adler
2
+
3
+ This software is provided 'as-is', without any express or implied
4
+ warranty. In no event will the authors be held liable for any damages
5
+ arising from the use of this software.
6
+
7
+ Permission is granted to anyone to use this software for any purpose,
8
+ including commercial applications, and to alter it and redistribute it
9
+ freely, subject to the following restrictions:
10
+
11
+ 1. The origin of this software must not be misrepresented; you must not
12
+ claim that you wrote the original software. If you use this software
13
+ in a product, an acknowledgment in the product documentation would be
14
+ appreciated but is not required.
15
+
16
+ 2. Altered source versions must be plainly marked as such, and must not be
17
+ misrepresented as being the original software.
18
+
19
+ 3. This notice may not be removed or altered from any source distribution.
@@ -0,0 +1,233 @@
1
+ #ifndef ANT_H
2
+ #define ANT_H
3
+
4
+ #pragma once
5
+ #define PCRE2_CODE_UNIT_WIDTH 8
6
+
7
+ #include "types.h"
8
+ #include "common.h"
9
+
10
+ #include <math.h>
11
+ #include <stdbool.h>
12
+ #include <stddef.h>
13
+ #include <stdint.h>
14
+ #include <stdio.h>
15
+ #include <inttypes.h>
16
+
17
+ #define STR_PROTO "__proto__"
18
+ #define STR_PROTO_LEN 9
19
+ #define CFUNC_HAS_PROTOTYPE 0x01u
20
+
21
+ #define ANT_ASSERT(cond, msg) ({ \
22
+ if (!(cond)) { \
23
+ fprintf(stderr, "ANT FATAL: %s\n %s:%d\n", msg, __FILE__, __LINE__); \
24
+ abort(); \
25
+ }})
26
+
27
+ #define ANT_STRING(s) js_mkstr(js, s, sizeof(s) - 1)
28
+ #define ANT_COPY(buf, len, s) cpy(buf, len, s, sizeof(s) - 1)
29
+ #define REMAIN(n, len) ((n) >= (len) ? 0 : (len) - (n))
30
+
31
+ #define JS_NAN ((double)NAN)
32
+ #define JS_NEG_NAN ((double)(-NAN))
33
+ #define JS_INF ((double)INFINITY)
34
+ #define JS_NEG_INF ((double)(-INFINITY))
35
+
36
+ #define js_true (NANBOX_PREFIX | ((ant_value_t)T_BOOL << NANBOX_TYPE_SHIFT) | 1)
37
+ #define js_false (NANBOX_PREFIX | ((ant_value_t)T_BOOL << NANBOX_TYPE_SHIFT))
38
+ #define js_bool(x) (js_false | (ant_value_t)!!(x))
39
+
40
+ ant_t *js_create(void *buf, size_t len);
41
+ ant_t *js_create_dynamic();
42
+
43
+ ant_value_t js_glob(ant_t *);
44
+ void js_mark_constructor(ant_value_t value, bool is_constructor);
45
+
46
+ // TODO: improve naming
47
+ ant_value_t js_eval_bytecode(ant_t *, const char *, size_t);
48
+ ant_value_t js_eval_bytecode_module(ant_t *, const char *, size_t);
49
+ ant_value_t js_eval_bytecode_eval(ant_t *, const char *, size_t);
50
+ ant_value_t js_eval_bytecode_eval_with_strict(ant_t *, const char *, size_t, bool);
51
+ ant_value_t js_eval_bytecode_repl(ant_t *, const char *, size_t);
52
+
53
+ void js_destroy(ant_t *);
54
+ bool js_truthy(ant_t *, ant_value_t);
55
+ void js_setstackbase(ant_t *, void *);
56
+ void js_setstacklimit(ant_t *, size_t);
57
+
58
+ uint32_t js_to_uint32(double d);
59
+ int32_t js_to_int32(double d);
60
+
61
+ bool js_chkargs(ant_value_t *, int, const char *);
62
+ void js_set_filename(ant_t *, const char *);
63
+ void js_stats(ant_t *, size_t *total, size_t *min, size_t *cstacksize);
64
+
65
+ ant_value_t js_mkundef(void);
66
+ ant_value_t js_mknull(void);
67
+ ant_value_t js_mknum(double);
68
+ ant_value_t js_mkpromise(ant_t *js);
69
+ ant_value_t js_mkgenerator(ant_t *js);
70
+
71
+ ant_value_t js_getthis(ant_t *);
72
+ void js_setthis(ant_t *, ant_value_t);
73
+
74
+ ant_value_t js_getcurrentfunc(ant_t *);
75
+ ant_value_t js_get(ant_t *, ant_value_t, const char *);
76
+ ant_value_t js_getprop_proto(ant_t *, ant_value_t, const char *);
77
+ ant_value_t js_getprop_fallback(ant_t *js, ant_value_t obj, const char *name);
78
+ ant_value_t js_getprop_super(ant_t *js, ant_value_t super_obj, ant_value_t receiver, const char *name);
79
+
80
+ ant_offset_t js_arr_len(ant_t *js, ant_value_t arr);
81
+ ant_value_t js_arr_get(ant_t *js, ant_value_t arr, ant_offset_t idx);
82
+
83
+ bool js_iter(
84
+ ant_t *js,
85
+ ant_value_t iterable,
86
+ bool (*callback)(
87
+ ant_t *js,
88
+ ant_value_t value,
89
+ void *udata
90
+ ),
91
+ void *udata
92
+ );
93
+
94
+ const char *js_sym_desc(ant_value_t sym);
95
+ const char *js_sym_key(ant_value_t sym);
96
+
97
+ ant_value_t js_mksym_for(ant_t *, const char *key);
98
+ ant_value_t js_symbol_to_string(ant_t *js, ant_value_t sym);
99
+ ant_value_t js_get_sym(ant_t *, ant_value_t obj, ant_value_t sym);
100
+ ant_value_t js_get_symbol(ant_t *, ant_value_t obj, const char *key);
101
+ ant_value_t js_get_sym_with_receiver(ant_t *, ant_value_t obj, ant_value_t sym, ant_value_t receiver);
102
+
103
+ ant_value_t js_mkobj(ant_t *);
104
+ ant_value_t js_mkobj_with_inobj_limit(ant_t *, uint8_t inobj_limit);
105
+
106
+ ant_value_t js_newobj(ant_t *);
107
+ ant_value_t js_mkarr(ant_t *);
108
+ ant_value_t js_mkstr(ant_t *, const void *, size_t);
109
+ ant_value_t js_mkstr_permanent(ant_t *, const void *, size_t);
110
+ ant_value_t js_mkbigint(ant_t *, const char *digits, size_t len, bool negative);
111
+
112
+ ant_value_t js_mksym(ant_t *, const char *desc);
113
+ ant_value_t js_mksym_well_known(ant_t *, const char *desc);
114
+ ant_value_t js_mkfun_meta(const ant_cfunc_meta_t *meta);
115
+ ant_value_t js_mkfun_dyn(ant_cfunc_t fn);
116
+
117
+ ant_value_t js_heavy_mkfun(ant_t *js, ant_value_t (*fn)(ant_params_t), ant_value_t data);
118
+ ant_value_t js_heavy_mkfun_native(ant_t *js, ant_value_t (*fn)(ant_params_t), void *ptr, uint32_t tag);
119
+ ant_value_t js_mkprop_fast(ant_t *js, ant_value_t obj, const char *key, size_t len, ant_value_t v);
120
+
121
+ // TODO: deprecate
122
+ ant_offset_t js_mkprop_fast_off(ant_t *js, ant_value_t obj, const char *key, size_t len, ant_value_t v);
123
+
124
+ #define js_mkfun(fn) ({ \
125
+ static const ant_cfunc_meta_t _ant_cfunc_meta = { (fn), NULL, 0, 0 }; \
126
+ js_mkfun_meta(&_ant_cfunc_meta); \
127
+ })
128
+
129
+ #define js_mkfun_arity(fn, arity) ({ \
130
+ static const ant_cfunc_meta_t _ant_cfunc_meta = { (fn), NULL, (arity), 0 }; \
131
+ js_mkfun_meta(&_ant_cfunc_meta); \
132
+ })
133
+
134
+ #define js_mkfun_flags(fn, flags) ({ \
135
+ static const ant_cfunc_meta_t _ant_cfunc_meta = { (fn), NULL, 0, (flags) }; \
136
+ js_mkfun_meta(&_ant_cfunc_meta); \
137
+ })
138
+
139
+ #define js_mkfun_arity_flags(fn, arity, flags) ({ \
140
+ static const ant_cfunc_meta_t _ant_cfunc_meta = { (fn), NULL, (arity), (flags) }; \
141
+ js_mkfun_meta(&_ant_cfunc_meta); \
142
+ })
143
+
144
+ void js_set(ant_t *, ant_value_t, const char *, ant_value_t);
145
+ void js_set_exact(ant_t *, ant_value_t, const char *, ant_value_t);
146
+ void js_set_sym(ant_t *, ant_value_t obj, ant_value_t sym, ant_value_t val);
147
+ void js_set_symbol(ant_t *, ant_value_t obj, const char *key, ant_value_t val);
148
+ void js_saveval(ant_t *js, ant_offset_t off, ant_value_t v);
149
+ void js_merge_obj(ant_t *, ant_value_t dst, ant_value_t src);
150
+ void js_arr_push(ant_t *, ant_value_t arr, ant_value_t val);
151
+ void js_set_proto(ant_value_t obj, ant_value_t proto);
152
+ void js_set_proto_wb(ant_t *js, ant_value_t obj, ant_value_t proto);
153
+ void js_set_proto_init(ant_value_t obj, ant_value_t proto);
154
+
155
+ ant_value_t js_propref_load(ant_t *js, ant_offset_t handle);
156
+ ant_value_t js_setprop(ant_t *, ant_value_t obj, ant_value_t key, ant_value_t val);
157
+ ant_value_t js_setprop_nonconfigurable(ant_t *, ant_value_t obj, const char *key, size_t keylen, ant_value_t val);
158
+
159
+ ant_value_t js_get_proto(ant_t *, ant_value_t obj);
160
+ ant_value_t js_get_ctor_proto(ant_t *, const char *name, size_t len);
161
+ ant_value_t js_tostring_val(ant_t *js, ant_value_t value);
162
+
163
+ uint8_t vtype(ant_value_t val);
164
+ size_t vdata(ant_value_t val);
165
+ bool js_is_constructor(ant_value_t value);
166
+
167
+ ant_object_t *js_obj_ptr(ant_value_t val);
168
+ ant_value_t js_obj_from_ptr(ant_object_t *obj);
169
+
170
+ double js_getnum(ant_value_t val);
171
+ char *js_getstr(ant_t *js, ant_value_t val, size_t *len);
172
+
173
+ const char *js_str(ant_t *, ant_value_t val);
174
+ const char *get_str_prop(ant_t *js, ant_value_t obj, const char *key, ant_offset_t klen, ant_offset_t *out_len);
175
+
176
+ typedef struct {
177
+ void *ctx;
178
+ ant_offset_t off;
179
+ } ant_iter_t;
180
+
181
+ typedef struct {
182
+ uint32_t slot;
183
+ bool is_symbol;
184
+ const char *str;
185
+ size_t key_len;
186
+ ant_offset_t sym_off;
187
+ } ant_iter_key_t;
188
+
189
+ ant_iter_t js_prop_iter_begin(ant_t *js, ant_value_t obj);
190
+ void js_prop_iter_end(ant_iter_t *iter);
191
+
192
+ bool js_prop_iter_next_key(ant_iter_t *iter, ant_iter_key_t *key_out, ant_value_t *value);
193
+ bool js_prop_iter_next(ant_iter_t *iter, const char **key, size_t *key_len, ant_value_t *value);
194
+ bool js_prop_iter_next_val(ant_iter_t *iter, ant_value_t *key_out, ant_value_t *value);
195
+ bool js_is_own_enumerable_prop(ant_t *js, ant_value_t source, ant_object_t *source_ptr, const ant_iter_key_t *key);
196
+ bool js_copy_exotic_own_props(ant_t *js, ant_value_t dst, ant_value_t src);
197
+
198
+ ant_value_t js_obj_to_func(ant_value_t obj);
199
+ ant_value_t js_obj_to_func_ex(ant_value_t obj, uint8_t flags);
200
+
201
+ ant_value_t js_mktypedarray(void *data);
202
+ void *js_gettypedarray(ant_value_t val);
203
+
204
+ void js_check_unhandled_rejections(ant_t *js);
205
+ void js_setup_import_meta(ant_t *js, const char *filename);
206
+ void js_process_promise_handlers(ant_t *js, ant_value_t promise);
207
+ void js_mark_promise_trigger_dequeued(ant_t *js, ant_value_t promise);
208
+ bool js_mark_promise_trigger_queued(ant_t *js, ant_value_t promise);
209
+ bool js_try_get_own_data_prop(ant_t *js, ant_value_t obj, const char *key, size_t key_len, ant_value_t *out);
210
+ void js_reject_promise(ant_t *js, ant_value_t promise, ant_value_t value);
211
+ void js_resolve_promise(ant_t *js, ant_value_t promise, ant_value_t value);
212
+
213
+ typedef ant_value_t (*js_getter_fn)(ant_t *js, ant_value_t obj, const char *key, size_t key_len);
214
+ typedef ant_value_t (*js_keys_fn)(ant_t *js, ant_value_t obj);
215
+
216
+ typedef bool (*js_setter_fn)(ant_t *js, ant_value_t obj, const char *key, size_t key_len, ant_value_t value);
217
+ typedef bool (*js_deleter_fn)(ant_t *js, ant_value_t obj, const char *key, size_t key_len);
218
+ typedef void (*js_finalizer_fn)(ant_t *js, ant_object_t *obj);
219
+
220
+ void js_set_getter(ant_value_t obj, js_getter_fn getter);
221
+ void js_set_setter(ant_value_t obj, js_setter_fn setter);
222
+ void js_set_deleter(ant_value_t obj, js_deleter_fn deleter);
223
+ void js_set_keys(ant_value_t obj, js_keys_fn keys);
224
+ void js_set_finalizer(ant_value_t obj, js_finalizer_fn fn);
225
+
226
+ ant_value_t js_get_slot(ant_value_t obj, internal_slot_t slot);
227
+ ant_value_t js_promise_assimilate_awaitable(ant_t *js, ant_value_t value);
228
+ ant_value_t js_promise_then(ant_t *js, ant_value_t promise, ant_value_t on_fulfilled, ant_value_t on_rejected);
229
+
230
+ void js_set_slot(ant_value_t obj, internal_slot_t slot, ant_value_t value);
231
+ void js_set_slot_wb(ant_t *, ant_value_t obj, internal_slot_t slot, ant_value_t value);
232
+
233
+ #endif