@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,294 +0,0 @@
1
- /*
2
- * Copyright (c) 2016-2017 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
- #define _GNU_SOURCE
39
- #include "xsAll.h"
40
- #if mxMacOSX || mxLinux
41
- #include <dlfcn.h>
42
- #endif
43
-
44
- static void fxBufferFunctionNameAddress(txMachine* the, txString buffer, txSize size, txID id, txCallback address, txID profileID);
45
-
46
- txString fxAdornStringC(txMachine* the, txString prefix, txSlot* string, txString suffix)
47
- {
48
- txSize stringSize = mxStringLength(string->value.string);
49
- txSize prefixSize = prefix ? mxStringLength(prefix) : 0;
50
- txSize suffixSize = suffix ? mxStringLength(suffix) : 0;
51
- txSize resultSize = fxAddChunkSizes(the, fxAddChunkSizes(the, fxAddChunkSizes(the, stringSize, prefixSize), suffixSize), 1);
52
- txString result = (txString)fxNewChunk(the, resultSize);
53
- if (prefix && prefixSize)
54
- c_memcpy(result, prefix, prefixSize);
55
- if (stringSize)
56
- c_memcpy(result + prefixSize, string->value.string, stringSize);
57
- if (suffix && suffixSize)
58
- c_memcpy(result + prefixSize + stringSize, suffix, suffixSize);
59
- result[prefixSize + stringSize + suffixSize] = 0;
60
- string->kind = XS_STRING_KIND;
61
- string->value.string = result;
62
- return result;
63
- }
64
-
65
- txSlot* fxArgToCallback(txMachine* the, txInteger argi)
66
- {
67
- if (mxArgc > argi) {
68
- txSlot* slot = mxArgv(argi);
69
- if (slot->kind == XS_REFERENCE_KIND) {
70
- txSlot* instance = slot->value.reference;
71
- again:
72
- if (instance) {
73
- txSlot* exotic = instance->next;
74
- if (exotic && (exotic->flag & XS_INTERNAL_FLAG)) {
75
- if (((exotic->kind == XS_CALLBACK_KIND) || (exotic->kind == XS_CALLBACK_X_KIND) || (exotic->kind == XS_CODE_KIND) || (exotic->kind == XS_CODE_X_KIND)))
76
- return slot;
77
- if (exotic->kind == XS_PROXY_KIND) {
78
- instance = exotic->value.proxy.target;
79
- goto again;
80
- }
81
- }
82
- }
83
- }
84
- #ifdef mxHostFunctionPrimitive
85
- if (slot->kind == XS_HOST_FUNCTION_KIND)
86
- return slot;
87
- #endif
88
- }
89
- mxTypeError("callback is no function");
90
- return C_NULL;
91
- }
92
-
93
- void fxBufferFrameName(txMachine* the, txString buffer, txSize size, txSlot* frame, txString suffix)
94
- {
95
- txSlot* target = frame + 2;
96
- txSlot* function = frame + 3;
97
- txSlot* _this = frame + 4;
98
- if (function->kind == XS_REFERENCE_KIND) {
99
- function = function->value.reference;
100
- if (mxIsFunction(function)) {
101
- if (target->kind == XS_UNDEFINED_KIND) {
102
- txSlot* home = mxFunctionInstanceHome(function)->value.home.object;
103
- if (home) {
104
- if (mxIsFunction(home)) {
105
- fxBufferFunctionName(the, buffer, size, home, ".");
106
- }
107
- else {
108
- txSlot* constructor = mxBehaviorGetProperty(the, home, mxID(_constructor), 0, XS_OWN);
109
- if (constructor) {
110
- if (constructor->kind == XS_REFERENCE_KIND) {
111
- constructor = constructor->value.reference;
112
- if (mxIsFunction(constructor))
113
- fxBufferFunctionName(the, buffer, size, constructor, ".prototype.");
114
- }
115
- }
116
- else if (_this->kind == XS_REFERENCE_KIND) {
117
- fxBufferObjectName(the, buffer, size, _this->value.reference, ".");
118
- }
119
- }
120
- }
121
- }
122
- fxBufferFunctionName(the, buffer, size, function, "");
123
- }
124
- }
125
- #ifdef mxHostFunctionPrimitive
126
- else if (function->kind == XS_HOST_FUNCTION_KIND) {
127
- fxBufferFunctionNameAddress(the, buffer, size, function->value.hostFunction.builder->id, function->value.hostFunction.builder->callback, function->value.hostFunction.profileID);
128
- }
129
- #endif
130
- else
131
- c_strncat(buffer, "(host)", size - mxStringLength(buffer) - 1);
132
- c_strncat(buffer, suffix, size - mxStringLength(buffer) - 1);
133
- }
134
-
135
- void fxBufferFunctionName(txMachine* the, txString buffer, txSize size, txSlot* function, txString suffix)
136
- {
137
- txSlot* slot = mxFunctionInstanceCode(function);
138
- txSlot* home = mxFunctionInstanceHome(function);
139
- if ((slot->kind == XS_CODE_KIND) || (slot->kind == XS_CODE_X_KIND))
140
- fxBufferFunctionNameAddress(the, buffer, size, slot->ID, C_NULL, home->ID);
141
- else
142
- fxBufferFunctionNameAddress(the, buffer, size, slot->ID, slot->value.callback.address, home->ID);
143
- c_strncat(buffer, suffix, size - mxStringLength(buffer) - 1);
144
- }
145
-
146
- void fxBufferFunctionNameAddress(txMachine* the, txString buffer, txSize size, txID id, txCallback address, txID profileID)
147
- {
148
- txInteger length;
149
- if (id != XS_NO_ID) {
150
- txSlot* key = fxGetKey(the, id);
151
- if (key) {
152
- if ((key->kind == XS_KEY_KIND) || (key->kind == XS_KEY_X_KIND)) {
153
- c_strncat(buffer, key->value.key.string, size - mxStringLength(buffer) - 1);
154
- return;
155
- }
156
- if ((key->kind == XS_STRING_KIND) || (key->kind == XS_STRING_X_KIND)) {
157
- c_strncat(buffer, "[", size - mxStringLength(buffer) - 1);
158
- c_strncat(buffer, key->value.string, size - mxStringLength(buffer) - 1);
159
- c_strncat(buffer, "]", size - mxStringLength(buffer) - 1);
160
- return;
161
- }
162
- }
163
- }
164
- if (address) {
165
- c_strncat(buffer, "@", size - mxStringLength(buffer) - 1);
166
- #if mxMacOSX || mxLinux
167
- Dl_info info;
168
- if (dladdr(address, &info) && info.dli_sname)
169
- c_strncat(buffer, info.dli_sname, size - mxStringLength(buffer) - 1);
170
- else
171
- #endif
172
- {
173
- c_strncat(buffer, "anonymous-", size - mxStringLength(buffer) - 1);
174
- length = mxStringLength(buffer);
175
- fxIntegerToString(the->dtoa, profileID, buffer + length, size - length - 1);
176
- }
177
- }
178
- else {
179
- c_strncat(buffer, "(anonymous-", size - mxStringLength(buffer) - 1);
180
- length = mxStringLength(buffer);
181
- fxIntegerToString(the->dtoa, profileID, buffer + length, size - length - 1);
182
- c_strncat(buffer, ")", size - mxStringLength(buffer) - 1);
183
- }
184
- }
185
-
186
- void fxBufferObjectName(txMachine* the, txString buffer, txSize size, txSlot* object, txString suffix)
187
- {
188
- txSlot* slot = mxBehaviorGetProperty(the, object, mxID(_Symbol_toStringTag), 0, XS_ANY);
189
- if (slot && ((slot->kind == XS_STRING_KIND) || (slot->kind == XS_STRING_X_KIND)) && !c_isEmpty(slot->value.string)) {
190
- c_strncat(buffer, slot->value.string, size - mxStringLength(buffer) - 1);
191
- c_strncat(buffer, suffix, size - mxStringLength(buffer) - 1);
192
- }
193
- }
194
-
195
- txString fxConcatString(txMachine* the, txSlot* a, txSlot* b)
196
- {
197
- txSize aSize = mxStringLength(a->value.string);
198
- txSize bSize = mxStringLength(b->value.string);
199
- txSize resultSize = fxAddChunkSizes(the, fxAddChunkSizes(the, aSize, bSize), 1);
200
- txString result = (txString)fxNewChunk(the, resultSize);
201
- c_memcpy(result, a->value.string, aSize);
202
- c_memcpy(result + aSize, b->value.string, bSize + 1);
203
- a->value.string = result;
204
- a->kind = XS_STRING_KIND;
205
- return result;
206
- }
207
-
208
- txString fxConcatStringC(txMachine* the, txSlot* a, txString b)
209
- {
210
- txSize aSize = mxStringLength(a->value.string);
211
- txSize bSize = mxStringLength(b);
212
- txSize resultSize = fxAddChunkSizes(the, fxAddChunkSizes(the, aSize, bSize), 1);
213
- txString result = C_NULL;
214
- if (a->kind == XS_STRING_KIND)
215
- result = (txString)fxRenewChunk(the, a->value.string, resultSize);
216
- if (!result) {
217
- result = (txString)fxNewChunk(the, resultSize);
218
- c_memcpy(result, a->value.string, aSize);
219
- a->value.string = result;
220
- a->kind = XS_STRING_KIND;
221
- }
222
- c_memcpy(result + aSize, b, bSize + 1);
223
- return result;
224
- }
225
-
226
- txString fxCopyString(txMachine* the, txSlot* a, txSlot* b)
227
- {
228
- txString result = b->value.string;
229
- a->value.string = result;
230
- a->kind = b->kind;
231
- return result;
232
- }
233
-
234
- txString fxCopyStringC(txMachine* the, txSlot* a, txString b)
235
- {
236
- txSize bSize = mxStringLength(b);
237
- txSize resultSize = fxAddChunkSizes(the, bSize, 1);
238
- txString result = (txString)fxNewChunk(the, resultSize);
239
- c_memcpy(result, b, resultSize);
240
- a->value.string = result;
241
- a->kind = XS_STRING_KIND;
242
- return result;
243
- }
244
-
245
- txBoolean fxIsCanonicalIndex(txMachine* the, txID id)
246
- {
247
- txSlot* key = fxGetKey(the, id);
248
- if (key && (key->flag & XS_DONT_ENUM_FLAG)) {
249
- txString string = key->value.key.string;
250
- char buffer[256], c;
251
- txNumber number;
252
- c = c_read8(string);
253
- if (('+' != c) && ('-' != c) && ('.' != c) && ('I' != c) && ('N' != c) && !(('0' <= c) && ('9' >= c)))
254
- return 0;
255
- number = fxStringToNumber(the->dtoa, string, 1);
256
- if (number == -0)
257
- return 1;
258
- fxNumberToString(the->dtoa, number, buffer, sizeof(buffer), 0, 0);
259
- if (!c_strcmp(string, buffer)) {
260
- return 1;
261
- }
262
- }
263
- return 0;
264
- }
265
-
266
- int fxStringGetter(void* theStream)
267
- {
268
- txStringStream* aStream = (txStringStream*)theStream;
269
- int result = C_EOF;
270
-
271
- if (aStream->offset < aStream->size) {
272
- result = *(aStream->slot->value.string + aStream->offset);
273
- aStream->offset++;
274
- }
275
- return result;
276
- }
277
-
278
- int fxStringCGetter(void* theStream)
279
- {
280
- txStringCStream* aStream = (txStringCStream*)theStream;
281
- int result = C_EOF;
282
-
283
- if (aStream->offset < aStream->size) {
284
- result = *(aStream->buffer + aStream->offset);
285
- aStream->offset++;
286
- }
287
- return result;
288
- }
289
-
290
- void fxJump(txMachine* the)
291
- {
292
- txJump* aJump = the->firstJump;
293
- c_longjmp(aJump->buffer, 1);
294
- }