@agoric/xsnap 0.14.3-dev-b047af2.0 → 0.14.3-dev-2a16ddd.0

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 (125) hide show
  1. package/package.json +8 -15
  2. package/src/build.js +4 -61
  3. package/moddable/modules/data/base64/base64.js +0 -28
  4. package/moddable/modules/data/base64/manifest.json +0 -11
  5. package/moddable/modules/data/base64/modBase64.c +0 -188
  6. package/moddable/modules/data/binaryMessage/BinaryMessage.js +0 -106
  7. package/moddable/modules/data/crc/crc.c +0 -205
  8. package/moddable/modules/data/crc/crc.js +0 -36
  9. package/moddable/modules/data/crc/manifest.json +0 -8
  10. package/moddable/modules/data/hex/hex.js +0 -28
  11. package/moddable/modules/data/hex/manifest.json +0 -11
  12. package/moddable/modules/data/hex/modHex.c +0 -139
  13. package/moddable/modules/data/logical/logical.js +0 -32
  14. package/moddable/modules/data/logical/modLogical.c +0 -98
  15. package/moddable/modules/data/qrcode/manifest.json +0 -9
  16. package/moddable/modules/data/qrcode/qrcode.c +0 -93
  17. package/moddable/modules/data/qrcode/qrcode.js +0 -23
  18. package/moddable/modules/data/qrcode/qrcodegen.c +0 -1025
  19. package/moddable/modules/data/qrcode/qrcodegen.h +0 -267
  20. package/moddable/modules/data/text/decoder/manifest.json +0 -8
  21. package/moddable/modules/data/text/decoder/textdecoder.c +0 -480
  22. package/moddable/modules/data/text/decoder/textdecoder.js +0 -27
  23. package/moddable/modules/data/text/encoder/manifest.json +0 -8
  24. package/moddable/modules/data/text/encoder/textencoder.c +0 -232
  25. package/moddable/modules/data/text/encoder/textencoder.js +0 -24
  26. package/moddable/modules/data/tinyint/tinyint.c +0 -150
  27. package/moddable/modules/data/tinyint/tinyint.js +0 -53
  28. package/moddable/modules/data/url/manifest.json +0 -17
  29. package/moddable/modules/data/url/url.c +0 -1959
  30. package/moddable/modules/data/url/url.js +0 -210
  31. package/moddable/modules/data/wavreader/manifest.json +0 -8
  32. package/moddable/modules/data/wavreader/wavreader.js +0 -128
  33. package/moddable/modules/data/zlib/deflate.c +0 -161
  34. package/moddable/modules/data/zlib/deflate.js +0 -63
  35. package/moddable/modules/data/zlib/inflate.c +0 -145
  36. package/moddable/modules/data/zlib/inflate.js +0 -66
  37. package/moddable/modules/data/zlib/manifest_deflate.json +0 -9
  38. package/moddable/modules/data/zlib/manifest_inflate.json +0 -9
  39. package/moddable/modules/data/zlib/miniz.c +0 -4924
  40. package/moddable/xs/includes/xs.d.ts +0 -73
  41. package/moddable/xs/includes/xs.h +0 -1533
  42. package/moddable/xs/includes/xsmc.h +0 -206
  43. package/moddable/xs/makefiles/lin/makefile +0 -33
  44. package/moddable/xs/makefiles/lin/xsc.mk +0 -118
  45. package/moddable/xs/makefiles/lin/xsid.mk +0 -90
  46. package/moddable/xs/makefiles/lin/xsl.mk +0 -168
  47. package/moddable/xs/makefiles/lin/xst.mk +0 -201
  48. package/moddable/xs/makefiles/mac/makefile +0 -33
  49. package/moddable/xs/makefiles/mac/xsc.mk +0 -130
  50. package/moddable/xs/makefiles/mac/xsid.mk +0 -102
  51. package/moddable/xs/makefiles/mac/xsl.mk +0 -177
  52. package/moddable/xs/makefiles/mac/xst.mk +0 -203
  53. package/moddable/xs/makefiles/mac/xst_no_asan.txt +0 -52
  54. package/moddable/xs/makefiles/win/build.bat +0 -26
  55. package/moddable/xs/makefiles/win/xsc.mak +0 -142
  56. package/moddable/xs/makefiles/win/xsid.mak +0 -113
  57. package/moddable/xs/makefiles/win/xsl.mak +0 -186
  58. package/moddable/xs/makefiles/win/xst.mak +0 -195
  59. package/moddable/xs/platforms/lin_xs.h +0 -99
  60. package/moddable/xs/platforms/mac_xs.h +0 -97
  61. package/moddable/xs/platforms/wasm_xs.h +0 -79
  62. package/moddable/xs/platforms/win_xs.h +0 -104
  63. package/moddable/xs/platforms/xsHost.h +0 -63
  64. package/moddable/xs/platforms/xsPlatform.h +0 -618
  65. package/moddable/xs/sources/xsAPI.c +0 -2555
  66. package/moddable/xs/sources/xsAll.c +0 -294
  67. package/moddable/xs/sources/xsAll.h +0 -2741
  68. package/moddable/xs/sources/xsArguments.c +0 -222
  69. package/moddable/xs/sources/xsArray.c +0 -2657
  70. package/moddable/xs/sources/xsAtomics.c +0 -844
  71. package/moddable/xs/sources/xsBigInt.c +0 -1859
  72. package/moddable/xs/sources/xsBoolean.c +0 -109
  73. package/moddable/xs/sources/xsCode.c +0 -4493
  74. package/moddable/xs/sources/xsCommon.c +0 -1710
  75. package/moddable/xs/sources/xsCommon.h +0 -1142
  76. package/moddable/xs/sources/xsDataView.c +0 -2890
  77. package/moddable/xs/sources/xsDate.c +0 -1541
  78. package/moddable/xs/sources/xsDebug.c +0 -2710
  79. package/moddable/xs/sources/xsDefaults.c +0 -134
  80. package/moddable/xs/sources/xsError.c +0 -353
  81. package/moddable/xs/sources/xsFunction.c +0 -776
  82. package/moddable/xs/sources/xsGenerator.c +0 -865
  83. package/moddable/xs/sources/xsGlobal.c +0 -839
  84. package/moddable/xs/sources/xsJSON.c +0 -1091
  85. package/moddable/xs/sources/xsLexical.c +0 -1969
  86. package/moddable/xs/sources/xsLockdown.c +0 -933
  87. package/moddable/xs/sources/xsMapSet.c +0 -1649
  88. package/moddable/xs/sources/xsMarshall.c +0 -1020
  89. package/moddable/xs/sources/xsMath.c +0 -624
  90. package/moddable/xs/sources/xsMemory.c +0 -1941
  91. package/moddable/xs/sources/xsModule.c +0 -3101
  92. package/moddable/xs/sources/xsNumber.c +0 -560
  93. package/moddable/xs/sources/xsObject.c +0 -1102
  94. package/moddable/xs/sources/xsPlatforms.c +0 -480
  95. package/moddable/xs/sources/xsProfile.c +0 -577
  96. package/moddable/xs/sources/xsPromise.c +0 -1199
  97. package/moddable/xs/sources/xsProperty.c +0 -636
  98. package/moddable/xs/sources/xsProxy.c +0 -1014
  99. package/moddable/xs/sources/xsRegExp.c +0 -1168
  100. package/moddable/xs/sources/xsRun.c +0 -4889
  101. package/moddable/xs/sources/xsScope.c +0 -1293
  102. package/moddable/xs/sources/xsScript.c +0 -288
  103. package/moddable/xs/sources/xsScript.h +0 -1186
  104. package/moddable/xs/sources/xsSnapshot.c +0 -2161
  105. package/moddable/xs/sources/xsSnapshot.h +0 -51
  106. package/moddable/xs/sources/xsSourceMap.c +0 -218
  107. package/moddable/xs/sources/xsString.c +0 -3332
  108. package/moddable/xs/sources/xsSymbol.c +0 -503
  109. package/moddable/xs/sources/xsSyntaxical.c +0 -4193
  110. package/moddable/xs/sources/xsTree.c +0 -1893
  111. package/moddable/xs/sources/xsType.c +0 -1488
  112. package/moddable/xs/sources/xsdtoa.c +0 -6672
  113. package/moddable/xs/sources/xsmc.c +0 -340
  114. package/moddable/xs/sources/xsre.c +0 -7578
  115. package/xsnap-native/xsnap/makefiles/lin/makefile +0 -10
  116. package/xsnap-native/xsnap/makefiles/lin/xsnap-worker.mk +0 -153
  117. package/xsnap-native/xsnap/makefiles/lin/xsnap.mk +0 -144
  118. package/xsnap-native/xsnap/makefiles/mac/makefile +0 -10
  119. package/xsnap-native/xsnap/makefiles/mac/xsnap-worker.mk +0 -162
  120. package/xsnap-native/xsnap/makefiles/mac/xsnap.mk +0 -153
  121. package/xsnap-native/xsnap/sources/xsnap-worker.c +0 -996
  122. package/xsnap-native/xsnap/sources/xsnap.c +0 -716
  123. package/xsnap-native/xsnap/sources/xsnap.h +0 -142
  124. package/xsnap-native/xsnap/sources/xsnapPlatform.c +0 -1496
  125. package/xsnap-native/xsnap/sources/xsnapPlatform.h +0 -105
@@ -1,340 +0,0 @@
1
- /*
2
- * Copyright (c) 2016-2021 Moddable Tech, Inc.
3
- *
4
- * This file is part of the Moddable SDK Runtime.
5
- *
6
- * The Moddable SDK Runtime is free software: you can redistribute it and/or modify
7
- * it under the terms of the GNU Lesser General Public License as published by
8
- * the Free Software Foundation, either version 3 of the License, or
9
- * (at your option) any later version.
10
- *
11
- * The Moddable SDK Runtime is distributed in the hope that it will be useful,
12
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
13
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
14
- * GNU Lesser General Public License for more details.
15
- *
16
- * You should have received a copy of the GNU Lesser General Public License
17
- * along with the Moddable SDK Runtime. If not, see <http://www.gnu.org/licenses/>.
18
- *
19
- * This file incorporates work covered by the following copyright and
20
- * permission notice:
21
- *
22
- * Copyright (C) 2010-2016 Marvell International Ltd.
23
- * Copyright (C) 2002-2010 Kinoma, Inc.
24
- *
25
- * Licensed under the Apache License, Version 2.0 (the "License");
26
- * you may not use this file except in compliance with the License.
27
- * You may obtain a copy of the License at
28
- *
29
- * http://www.apache.org/licenses/LICENSE-2.0
30
- *
31
- * Unless required by applicable law or agreed to in writing, software
32
- * distributed under the License is distributed on an "AS IS" BASIS,
33
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
34
- * See the License for the specific language governing permissions and
35
- * limitations under the License.
36
- */
37
-
38
- #include "xsAll.h"
39
- #include <stdio.h>
40
-
41
- #ifndef ICACHE_XS6STRING_ATTR
42
- #define ICACHE_XS6STRING_ATTR
43
- #endif
44
-
45
- #define fxPop() (*(the->stack++))
46
- #define fxPush(_SLOT) (*(--the->stack) = (_SLOT))
47
-
48
- void _xsNewArray(txMachine *the, txSlot *res, txInteger length)
49
- {
50
- fxNewArray(the, length);
51
- *res = fxPop();
52
- }
53
-
54
- void _xsNewObject(txMachine *the, txSlot *res)
55
- {
56
- fxNewObject(the);
57
- *res = fxPop();
58
- }
59
-
60
- void _xsNewHostInstance(txMachine *the, txSlot *res, txSlot *proto)
61
- {
62
- mxOverflow(-1);
63
- fxPush(*proto);
64
- fxNewHostInstance(the);
65
- *res = fxPop();
66
- }
67
-
68
- txBoolean _xsIsInstanceOf(txMachine *the, txSlot *v, txSlot *proto)
69
- {
70
- mxOverflow(-2);
71
- fxPush(*proto);
72
- fxPush(*v);
73
- return fxIsInstanceOf(the);
74
- }
75
-
76
- txBoolean _xsHas(txMachine *the, txSlot *self, txID id)
77
- {
78
- mxOverflow(-1);
79
- fxPush(*self);
80
- return mxHasID(id);
81
- }
82
-
83
- txBoolean _xsHasIndex(txMachine *the, txSlot *self, txIndex index)
84
- {
85
- mxOverflow(-1);
86
- fxPush(*self);
87
- return fxHasIndex(the, index);
88
- }
89
-
90
- void _xsGet(txMachine *the, txSlot *res, txSlot *self, txID id)
91
- {
92
- mxOverflow(-1);
93
- fxPush(*self);
94
- mxGetID(id);
95
- *res = fxPop();
96
- }
97
-
98
- void _xsGetAt(txMachine *the, txSlot *res, txSlot *self, txSlot *at)
99
- {
100
- mxOverflow(-2);
101
- fxPush(*self);
102
- fxPush(*at);
103
- fxGetAt(the);
104
- *res = fxPop();
105
- }
106
-
107
- void _xsGetIndex(txMachine *the, txSlot *res, txSlot *self, txIndex index)
108
- {
109
- mxOverflow(-1);
110
- fxPush(*self);
111
- mxGetIndex(index);
112
- *res = fxPop();
113
- }
114
-
115
- void _xsSet(txMachine *the, txSlot *self, txID id, txSlot *v)
116
- {
117
- mxOverflow(-2);
118
- fxPush(*v);
119
- fxPush(*self);
120
- mxSetID(id);
121
- mxPop();
122
- }
123
-
124
- void _xsSetAt(txMachine *the, txSlot *self, txSlot *at , txSlot *v)
125
- {
126
- mxOverflow(-3);
127
- fxPush(*v);
128
- fxPush(*self);
129
- fxPush(*at);
130
- fxSetAt(the);
131
- mxPop();
132
- }
133
-
134
- void _xsSetIndex(txMachine *the, txSlot *self, txIndex index, txSlot *v)
135
- {
136
- mxOverflow(-2);
137
- fxPush(*v);
138
- fxPush(*self);
139
- mxSetIndex(index);
140
- mxPop();
141
- }
142
-
143
- void _xsDefine(txMachine *the, txSlot *self, txID id, txSlot *v, txFlag attributes)
144
- {
145
- mxOverflow(-2);
146
- fxPush(*v);
147
- fxPush(*self);
148
- fxDefineID(the, id, attributes, attributes | XS_DONT_DELETE_FLAG | XS_DONT_ENUM_FLAG | XS_DONT_SET_FLAG);
149
- mxPop();
150
- }
151
-
152
- void _xsDelete(txMachine *the, txSlot *self, txID id)
153
- {
154
- mxOverflow(-1);
155
- fxPush(*self);
156
- mxDeleteID(id);
157
- }
158
-
159
- void _xsDeleteAt(txMachine *the, txSlot *self, txSlot *at)
160
- {
161
- mxOverflow(-2);
162
- fxPush(*self);
163
- fxPush(*at);
164
- fxDeleteAt(the);
165
- }
166
-
167
- void _xsCall(txMachine *the, txSlot *res, txSlot *self, txUnsigned id, ...)
168
- {
169
- va_list ap;
170
- int n;
171
- txSlot *v;
172
-
173
- va_start(ap, id);
174
- for (n = 0; va_arg(ap, txSlot *) != NULL; n++)
175
- ;
176
- va_end(ap);
177
- mxOverflow(-(n+6));
178
- fxPush(*self);
179
- fxCallID(the, (txID)id);
180
- va_start(ap, id);
181
- while ((v = va_arg(ap, txSlot *)) != NULL)
182
- fxPush(*v);
183
- va_end(ap);
184
- fxRunCount(the, n);
185
- if (res != NULL)
186
- *res = fxPop();
187
- else
188
- mxPop();
189
- }
190
-
191
- void _xsNew(txMachine *the, txSlot *res, txSlot *self, txUnsigned id, ...)
192
- {
193
- va_list ap;
194
- int n;
195
- txSlot *v;
196
-
197
- va_start(ap, id);
198
- for (n = 0; va_arg(ap, txSlot *) != NULL; n++)
199
- ;
200
- va_end(ap);
201
- mxOverflow(-(n+6));
202
- fxPush(*self);
203
- fxNewID(the, (txID)id);
204
- va_start(ap, id);
205
- while ((v = va_arg(ap, txSlot *)) != NULL)
206
- fxPush(*v);
207
- va_end(ap);
208
- fxRunCount(the, n);
209
- *res = fxPop();
210
- }
211
-
212
- txBoolean _xsTest(txMachine *the, txSlot *v)
213
- {
214
- mxOverflow(-1);
215
- fxPush(*v);
216
- return fxRunTest(the);
217
- }
218
-
219
- txInteger fxIncrementalVars(txMachine* the, txInteger theCount)
220
- {
221
- txSlot* aStack = the->scope;
222
- txInteger aVar;
223
-
224
- if (aStack - aStack->value.integer != the->stack) {
225
- static const char msg[] ICACHE_XS6STRING_ATTR = "C: xsVars: too late";
226
- mxSyntaxError((char *)msg);
227
- }
228
- mxOverflow(theCount);
229
- aVar = aStack->value.integer;
230
- aStack->value.integer += theCount;
231
- if (theCount > 0) {
232
- while (theCount) {
233
- mxPushUndefined();
234
- theCount--;
235
- }
236
- }
237
- else
238
- the->stack -= theCount;
239
- return aVar;
240
- }
241
-
242
- txInteger _xsArgc(txMachine *the)
243
- {
244
- return mxArgc;
245
- }
246
-
247
- #ifndef __XSMC_H__
248
- enum {
249
- xsBufferNonrelocatable,
250
- xsBufferRelocatable
251
- };
252
- #endif
253
-
254
- static txInteger _xsmcGetViewBuffer(txMachine *the, txSlot* view, txSlot* buffer, void **data, txUnsigned *count, txBoolean writable)
255
- {
256
- txInteger offset = view->value.dataView.offset;
257
- txInteger size = view->value.dataView.size;
258
- txSlot* arrayBuffer = buffer->value.reference->next;
259
- txSlot* bufferInfo = arrayBuffer->next;
260
- if (arrayBuffer->value.arrayBuffer.address == C_NULL)
261
- mxTypeError("detached buffer");
262
- if (writable && (arrayBuffer->flag & XS_DONT_SET_FLAG))
263
- mxTypeError("read-only buffer");
264
- if (bufferInfo->value.bufferInfo.maxLength >= 0) {
265
- txInteger byteLength = bufferInfo->value.bufferInfo.length;
266
- if (offset > byteLength)
267
- mxTypeError("out of bounds view");
268
- if (size < 0)
269
- size = byteLength - offset;
270
- else if (offset + size > byteLength)
271
- mxTypeError("out of bounds view");
272
- }
273
- *data = arrayBuffer->value.arrayBuffer.address + offset;
274
- *count = size;
275
-
276
- return (XS_ARRAY_BUFFER_KIND == arrayBuffer->kind) ? xsBufferRelocatable : xsBufferNonrelocatable;
277
- }
278
-
279
- txInteger _xsmcGetBuffer(txMachine *the, txSlot *slot, void **data, txUnsigned *count, txBoolean writable)
280
- {
281
- txSlot* instance;
282
-
283
- if (slot->kind != XS_REFERENCE_KIND)
284
- goto bail;
285
-
286
- instance = slot->value.reference;
287
- if (!(((slot = instance->next)) && (slot->flag & XS_INTERNAL_FLAG)))
288
- goto bail;
289
-
290
- if (slot->kind == XS_ARRAY_BUFFER_KIND) {
291
- txSlot* bufferInfo = slot->next;
292
- if (slot->value.arrayBuffer.address == C_NULL)
293
- mxTypeError("detached buffer");
294
- if (writable && (slot->flag & XS_DONT_SET_FLAG))
295
- mxTypeError("read-only buffer");
296
- *data = slot->value.arrayBuffer.address;
297
- *count = bufferInfo->value.bufferInfo.length;
298
- return xsBufferRelocatable;
299
- }
300
-
301
- if (slot->kind == XS_TYPED_ARRAY_KIND) {
302
- txSlot* view = slot->next;
303
- txSlot* buffer = view->next;
304
- if (1 != slot->value.typedArray.dispatch->size)
305
- goto bail;
306
- return _xsmcGetViewBuffer(the, view, buffer, data, count, writable);
307
- }
308
-
309
- if (slot->kind == XS_HOST_KIND) {
310
- txSlot* bufferInfo = slot->next;
311
- if (slot->flag & XS_HOST_CHUNK_FLAG)
312
- goto bail;
313
- if (writable && (slot->flag & XS_DONT_SET_FLAG))
314
- mxTypeError("read-only buffer");
315
- if (bufferInfo && (bufferInfo->kind == XS_BUFFER_INFO_KIND)) {
316
- *data = (uint8_t *)slot->value.host.data;
317
- *count = bufferInfo->value.bufferInfo.length;
318
- }
319
- else {
320
- // for compatibility. should throw eventually.
321
- txSlot tmp, ref;
322
- fxReport(the, "# Use xsmcSetHostBuffer instead of xsmcSetHostData\n");
323
- fxReference(the, &ref, instance);
324
- _xsGet(the, &tmp, &ref, _byteLength);
325
- *data = (uint8_t *)slot->value.host.data;
326
- *count = (txUnsigned)fxToInteger(the, &tmp);
327
- }
328
- return xsBufferNonrelocatable;
329
- }
330
-
331
- if (slot->kind == XS_DATA_VIEW_KIND) {
332
- txSlot* view = slot;
333
- txSlot* buffer = view->next;
334
- return _xsmcGetViewBuffer(the, view, buffer, data, count, writable);
335
- }
336
-
337
- bail:
338
- mxTypeError("this is no buffer");
339
- return xsBufferNonrelocatable;
340
- }