@agoric/xsnap 0.14.3-dev-b047af2.0 → 0.14.3-dev-3eb4230.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 (126) hide show
  1. package/api.js +1 -1
  2. package/package.json +16 -23
  3. package/src/build.js +4 -61
  4. package/moddable/modules/data/base64/base64.js +0 -28
  5. package/moddable/modules/data/base64/manifest.json +0 -11
  6. package/moddable/modules/data/base64/modBase64.c +0 -188
  7. package/moddable/modules/data/binaryMessage/BinaryMessage.js +0 -106
  8. package/moddable/modules/data/crc/crc.c +0 -205
  9. package/moddable/modules/data/crc/crc.js +0 -36
  10. package/moddable/modules/data/crc/manifest.json +0 -8
  11. package/moddable/modules/data/hex/hex.js +0 -28
  12. package/moddable/modules/data/hex/manifest.json +0 -11
  13. package/moddable/modules/data/hex/modHex.c +0 -139
  14. package/moddable/modules/data/logical/logical.js +0 -32
  15. package/moddable/modules/data/logical/modLogical.c +0 -98
  16. package/moddable/modules/data/qrcode/manifest.json +0 -9
  17. package/moddable/modules/data/qrcode/qrcode.c +0 -93
  18. package/moddable/modules/data/qrcode/qrcode.js +0 -23
  19. package/moddable/modules/data/qrcode/qrcodegen.c +0 -1025
  20. package/moddable/modules/data/qrcode/qrcodegen.h +0 -267
  21. package/moddable/modules/data/text/decoder/manifest.json +0 -8
  22. package/moddable/modules/data/text/decoder/textdecoder.c +0 -480
  23. package/moddable/modules/data/text/decoder/textdecoder.js +0 -27
  24. package/moddable/modules/data/text/encoder/manifest.json +0 -8
  25. package/moddable/modules/data/text/encoder/textencoder.c +0 -232
  26. package/moddable/modules/data/text/encoder/textencoder.js +0 -24
  27. package/moddable/modules/data/tinyint/tinyint.c +0 -150
  28. package/moddable/modules/data/tinyint/tinyint.js +0 -53
  29. package/moddable/modules/data/url/manifest.json +0 -17
  30. package/moddable/modules/data/url/url.c +0 -1959
  31. package/moddable/modules/data/url/url.js +0 -210
  32. package/moddable/modules/data/wavreader/manifest.json +0 -8
  33. package/moddable/modules/data/wavreader/wavreader.js +0 -128
  34. package/moddable/modules/data/zlib/deflate.c +0 -161
  35. package/moddable/modules/data/zlib/deflate.js +0 -63
  36. package/moddable/modules/data/zlib/inflate.c +0 -145
  37. package/moddable/modules/data/zlib/inflate.js +0 -66
  38. package/moddable/modules/data/zlib/manifest_deflate.json +0 -9
  39. package/moddable/modules/data/zlib/manifest_inflate.json +0 -9
  40. package/moddable/modules/data/zlib/miniz.c +0 -4924
  41. package/moddable/xs/includes/xs.d.ts +0 -73
  42. package/moddable/xs/includes/xs.h +0 -1533
  43. package/moddable/xs/includes/xsmc.h +0 -206
  44. package/moddable/xs/makefiles/lin/makefile +0 -33
  45. package/moddable/xs/makefiles/lin/xsc.mk +0 -118
  46. package/moddable/xs/makefiles/lin/xsid.mk +0 -90
  47. package/moddable/xs/makefiles/lin/xsl.mk +0 -168
  48. package/moddable/xs/makefiles/lin/xst.mk +0 -201
  49. package/moddable/xs/makefiles/mac/makefile +0 -33
  50. package/moddable/xs/makefiles/mac/xsc.mk +0 -130
  51. package/moddable/xs/makefiles/mac/xsid.mk +0 -102
  52. package/moddable/xs/makefiles/mac/xsl.mk +0 -177
  53. package/moddable/xs/makefiles/mac/xst.mk +0 -203
  54. package/moddable/xs/makefiles/mac/xst_no_asan.txt +0 -52
  55. package/moddable/xs/makefiles/win/build.bat +0 -26
  56. package/moddable/xs/makefiles/win/xsc.mak +0 -142
  57. package/moddable/xs/makefiles/win/xsid.mak +0 -113
  58. package/moddable/xs/makefiles/win/xsl.mak +0 -186
  59. package/moddable/xs/makefiles/win/xst.mak +0 -195
  60. package/moddable/xs/platforms/lin_xs.h +0 -99
  61. package/moddable/xs/platforms/mac_xs.h +0 -97
  62. package/moddable/xs/platforms/wasm_xs.h +0 -79
  63. package/moddable/xs/platforms/win_xs.h +0 -104
  64. package/moddable/xs/platforms/xsHost.h +0 -63
  65. package/moddable/xs/platforms/xsPlatform.h +0 -618
  66. package/moddable/xs/sources/xsAPI.c +0 -2555
  67. package/moddable/xs/sources/xsAll.c +0 -294
  68. package/moddable/xs/sources/xsAll.h +0 -2741
  69. package/moddable/xs/sources/xsArguments.c +0 -222
  70. package/moddable/xs/sources/xsArray.c +0 -2657
  71. package/moddable/xs/sources/xsAtomics.c +0 -844
  72. package/moddable/xs/sources/xsBigInt.c +0 -1859
  73. package/moddable/xs/sources/xsBoolean.c +0 -109
  74. package/moddable/xs/sources/xsCode.c +0 -4493
  75. package/moddable/xs/sources/xsCommon.c +0 -1710
  76. package/moddable/xs/sources/xsCommon.h +0 -1142
  77. package/moddable/xs/sources/xsDataView.c +0 -2890
  78. package/moddable/xs/sources/xsDate.c +0 -1541
  79. package/moddable/xs/sources/xsDebug.c +0 -2710
  80. package/moddable/xs/sources/xsDefaults.c +0 -134
  81. package/moddable/xs/sources/xsError.c +0 -353
  82. package/moddable/xs/sources/xsFunction.c +0 -776
  83. package/moddable/xs/sources/xsGenerator.c +0 -865
  84. package/moddable/xs/sources/xsGlobal.c +0 -839
  85. package/moddable/xs/sources/xsJSON.c +0 -1091
  86. package/moddable/xs/sources/xsLexical.c +0 -1969
  87. package/moddable/xs/sources/xsLockdown.c +0 -933
  88. package/moddable/xs/sources/xsMapSet.c +0 -1649
  89. package/moddable/xs/sources/xsMarshall.c +0 -1020
  90. package/moddable/xs/sources/xsMath.c +0 -624
  91. package/moddable/xs/sources/xsMemory.c +0 -1941
  92. package/moddable/xs/sources/xsModule.c +0 -3101
  93. package/moddable/xs/sources/xsNumber.c +0 -560
  94. package/moddable/xs/sources/xsObject.c +0 -1102
  95. package/moddable/xs/sources/xsPlatforms.c +0 -480
  96. package/moddable/xs/sources/xsProfile.c +0 -577
  97. package/moddable/xs/sources/xsPromise.c +0 -1199
  98. package/moddable/xs/sources/xsProperty.c +0 -636
  99. package/moddable/xs/sources/xsProxy.c +0 -1014
  100. package/moddable/xs/sources/xsRegExp.c +0 -1168
  101. package/moddable/xs/sources/xsRun.c +0 -4889
  102. package/moddable/xs/sources/xsScope.c +0 -1293
  103. package/moddable/xs/sources/xsScript.c +0 -288
  104. package/moddable/xs/sources/xsScript.h +0 -1186
  105. package/moddable/xs/sources/xsSnapshot.c +0 -2161
  106. package/moddable/xs/sources/xsSnapshot.h +0 -51
  107. package/moddable/xs/sources/xsSourceMap.c +0 -218
  108. package/moddable/xs/sources/xsString.c +0 -3332
  109. package/moddable/xs/sources/xsSymbol.c +0 -503
  110. package/moddable/xs/sources/xsSyntaxical.c +0 -4193
  111. package/moddable/xs/sources/xsTree.c +0 -1893
  112. package/moddable/xs/sources/xsType.c +0 -1488
  113. package/moddable/xs/sources/xsdtoa.c +0 -6672
  114. package/moddable/xs/sources/xsmc.c +0 -340
  115. package/moddable/xs/sources/xsre.c +0 -7578
  116. package/xsnap-native/xsnap/makefiles/lin/makefile +0 -10
  117. package/xsnap-native/xsnap/makefiles/lin/xsnap-worker.mk +0 -153
  118. package/xsnap-native/xsnap/makefiles/lin/xsnap.mk +0 -144
  119. package/xsnap-native/xsnap/makefiles/mac/makefile +0 -10
  120. package/xsnap-native/xsnap/makefiles/mac/xsnap-worker.mk +0 -162
  121. package/xsnap-native/xsnap/makefiles/mac/xsnap.mk +0 -153
  122. package/xsnap-native/xsnap/sources/xsnap-worker.c +0 -996
  123. package/xsnap-native/xsnap/sources/xsnap.c +0 -716
  124. package/xsnap-native/xsnap/sources/xsnap.h +0 -142
  125. package/xsnap-native/xsnap/sources/xsnapPlatform.c +0 -1496
  126. package/xsnap-native/xsnap/sources/xsnapPlatform.h +0 -105
@@ -1,232 +0,0 @@
1
- /*
2
- * Copyright (c) 2021-2022 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
- */
20
-
21
- #include "xsmc.h"
22
- #include "xsHost.h"
23
- #ifdef kPocoRotation
24
- // Moddable SDK
25
- #include "mc.xs.h" // for xsID_ values
26
-
27
- #define VALIDATE 1
28
- #else
29
- // xst, xsnap, etc
30
- #include <stdbool.h>
31
-
32
- #define xsID_read (xsID("read"))
33
- #define xsID_String (xsID("String"))
34
- #define xsID_Uint8Array (xsID("Uint8Array"))
35
- #define xsID_written (xsID("written"))
36
- #endif
37
-
38
- #if !VALIDATE
39
- void xs_textencoder(xsMachine *the)
40
- {
41
- xsmcGet(xsResult, xsTarget, xsID("prototype"));
42
- xsResult = xsNewHostInstance(xsResult);
43
- }
44
- #endif
45
-
46
- /*
47
- null character maps to 0xC0, 0x80
48
- surrogate pair pattern: ED Ax xx ED Bx xx
49
- */
50
-
51
- void xs_textencoder_encode(xsMachine *the)
52
- {
53
- uint8_t *src, *dst;
54
- int length = 0;
55
- uint8_t remap = false;
56
-
57
- xsArg(0) = xsCall1(xsGlobal, xsID_String, xsArg(0));
58
- src = (uint8_t *)xsmcToString(xsArg(0));
59
-
60
- while (true) {
61
- uint8_t c = c_read8(src++);
62
- if (!c) break;
63
-
64
- if ((0xED == c) &&
65
- (0xA0 == (0xF0 & c_read8(src))) &&
66
- (0xED == c_read8(src + 2)) &&
67
- (0xB0 == (0xF0 & c_read8(src + 3)))) {
68
- src += 5;
69
- length += 4;
70
- remap = true;
71
- continue;
72
- }
73
-
74
- length += 1;
75
- if ((0xC0 == c) && (0x80 == c_read8(src))) {
76
- src += 1;
77
- remap = true;
78
- }
79
- }
80
-
81
- xsmcSetArrayBuffer(xsResult, NULL, length);
82
- src = (uint8_t *)xsmcToString(xsArg(0));
83
- dst = xsmcToArrayBuffer(xsResult);
84
- if (remap) {
85
- while (true) {
86
- uint8_t c = c_read8(src++);
87
- if (!c) break;
88
-
89
- if ((0xED == c) &&
90
- (0xA0 == (0xF0 & c_read8(src))) &&
91
- (0xED == c_read8(src + 2)) &&
92
- (0xB0 == (0xF0 & c_read8(src + 3)))) {
93
- xsIntegerValue high, low;
94
-
95
- fxUTF8Decode((xsStringValue)(src - 1), &high);
96
- fxUTF8Decode((xsStringValue)(src + 2), &low);
97
- fxUTF8Encode((xsStringValue)dst, 0x10000 + ((high & 0x3FF) << 10) + (low & 0x3FF));
98
- src += 5;
99
- dst += 4;
100
- continue;
101
- }
102
-
103
- if ((0xC0 == c) && (0x80 == c_read8(src))) {
104
- *dst++ = 0;
105
- src += 1;
106
- }
107
- else
108
- *dst++ = c;
109
- }
110
- }
111
- else
112
- c_memcpy(dst, src, length);
113
-
114
- xsResult = xsNew1(xsGlobal, xsID_Uint8Array, xsResult);
115
- }
116
-
117
- void xs_textencoder_encodeInto(xsMachine *the)
118
- {
119
- uint8_t *src, *dst;
120
- xsUnsignedValue dstTotal, dstRemaining;
121
- int read = 0;
122
-
123
- if (!xsmcIsInstanceOf(xsArg(1), xsTypedArrayPrototype)) //@@ limit to Uint8Array
124
- xsUnknownError("Uint8Array only");
125
-
126
- xsArg(0) = xsCall1(xsGlobal, xsID_String, xsArg(0));
127
- xsmcGetBufferWritable(xsArg(1), (void **)&dst, &dstTotal);
128
- dstRemaining = dstTotal;
129
- src = (uint8_t *)xsmcToString(xsArg(0));
130
-
131
- while (dstRemaining) {
132
- uint8_t first = c_read8(src++);
133
- if (!first) break;
134
-
135
- if (first < 0x80) {
136
- *dst++ = first;
137
- dstRemaining -= 1;
138
- }
139
- else if (0xC0 == (first & 0xE0)) {
140
- if ((0xC0 == first) && (0x80 == c_read8(src))) {
141
- *dst++ = 0;
142
- dstRemaining -= 1;
143
- src += 1;
144
- read += 1;
145
- continue;
146
- }
147
-
148
- if (dstRemaining < 2)
149
- break;
150
-
151
- *dst++ = first;
152
- *dst++ = c_read8(src++);
153
-
154
- dstRemaining -= 2;
155
- }
156
- else if (0xE0 == (first & 0xF0)) {
157
- if ((0xED == first) &&
158
- (0xA0 == (0xF0 & c_read8(src))) &&
159
- (0xED == c_read8(src + 2)) &&
160
- (0xB0 == (0xF0 & c_read8(src + 3)))) {
161
- xsIntegerValue high, low;
162
-
163
- if (dstRemaining < 4)
164
- break;
165
-
166
- fxUTF8Decode((xsStringValue)(src - 1), &high);
167
- fxUTF8Decode((xsStringValue)(src + 2), &low);
168
- fxUTF8Encode((xsStringValue)dst, 0x10000 + ((high & 0x3FF) << 10) + (low & 0x3FF));
169
- src += 5;
170
- dst += 4;
171
- dstRemaining -= 4;
172
- read += 2;
173
- continue;
174
- }
175
-
176
- if (dstRemaining < 3)
177
- break;
178
-
179
- *dst++ = first;
180
- *dst++ = c_read8(src++);
181
- *dst++ = c_read8(src++);
182
-
183
- dstRemaining -= 3;
184
- }
185
- else if (0xF0 == (first & 0xF0)) {
186
- if (dstRemaining < 4)
187
- break;
188
-
189
- *dst++ = first;
190
- *dst++ = c_read8(src++);
191
- *dst++ = c_read8(src++);
192
- *dst++ = c_read8(src++);
193
-
194
- dstRemaining -= 4;
195
- }
196
- else
197
- fxAbort(the, xsFatalCheckExit);
198
-
199
- read += 1;
200
- }
201
-
202
- xsmcSetNewObject(xsResult);
203
-
204
- xsmcVars(1);
205
- xsmcSetInteger(xsVar(0), read);
206
- xsmcSet(xsResult, xsID_read, xsVar(0));
207
-
208
- xsmcSetInteger(xsVar(0), dstTotal - dstRemaining);
209
- xsmcSet(xsResult, xsID_written, xsVar(0));
210
- }
211
-
212
- #if !VALIDATE
213
- void modInstallTextEncoder(xsMachine *the)
214
- {
215
- #define kPrototype (0)
216
- #define kConstructor (1)
217
- #define kScratch (2)
218
-
219
- xsBeginHost(the);
220
- xsmcVars(3);
221
-
222
- xsmcSetNewObject(xsVar(kPrototype));
223
- xsVar(kConstructor) = xsNewHostConstructor(xs_textencoder, 1, xsVar(kPrototype));
224
- xsmcSet(xsGlobal, xsID("TextEncoder"), xsVar(kConstructor));
225
- xsVar(kScratch) = xsNewHostFunction(xs_textencoder_encode, 1);
226
- xsmcSet(xsVar(kPrototype), xsID("encode"), xsVar(kScratch));
227
- xsVar(kScratch) = xsNewHostFunction(xs_textencoder_encodeInto, 2);
228
- xsmcSet(xsVar(kPrototype), xsID("encodeInto"), xsVar(kScratch));
229
-
230
- xsEndHost(the);
231
- }
232
- #endif
@@ -1,24 +0,0 @@
1
- /*
2
- * Copyright (c) 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
- */
20
-
21
- export default class {
22
- encode(value) @ "xs_textencoder_encode";
23
- encodeInto(value, buffer) @ "xs_textencoder_encodeInto";
24
- }
@@ -1,150 +0,0 @@
1
- /*
2
- * Copyright (c) 2018 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
- */
20
-
21
- #include "xsmc.h"
22
- #include "mc.xs.h" // for xsID_ values
23
-
24
- void BitsView_prototype_getIntBits(xsMachine *the)
25
- {
26
- xsUnknownError("unimplemented");
27
- }
28
-
29
- void BitsView_prototype_getUintBits(xsMachine *the)
30
- {
31
- int bitsOffset = xsmcToInteger(xsArg(0));
32
- int bitsSize = xsmcToInteger(xsArg(1));
33
- uint32_t bitsValue = 0;
34
- int byteLength;
35
- uint8_t *bytes;
36
- uint8_t littleEndian = true;
37
- uint8_t shift = 0;
38
- static const uint8_t masks[] = {0, 0x01, 0x03, 0x07, 0x0F, 0x1F, 0x3F, 0x7F, 0xFF};
39
-
40
- if ((bitsSize < 1) || (bitsSize > 32))
41
- xsRangeError("invalid number of bits");
42
-
43
- if (xsmcArgc > 3) {
44
- if (xsmcTest(xsArg(3)))
45
- littleEndian = false;
46
- }
47
-
48
- xsmcVars(1);
49
-
50
- xsmcGet(xsVar(0), xsThis, xsID_byteLength);
51
- byteLength = xsmcToInteger(xsVar(0));
52
-
53
- if ((bitsOffset < 0) || ((bitsOffset + bitsSize) > (byteLength << 3)))
54
- xsRangeError("invalid offset");
55
-
56
- xsmcGet(xsVar(0), xsThis, xsID_buffer);
57
- bytes = xsmcToArrayBuffer(xsVar(0));
58
-
59
- xsmcGet(xsVar(0), xsThis, xsID_byteOffset);
60
- bytes += xsmcToInteger(xsVar(0));
61
- bytes += bitsOffset >> 3;
62
- while (bitsSize) {
63
- uint8_t mask;
64
- uint8_t part = (uint8_t)bitsSize;
65
- uint8_t available = 8 - (bitsOffset & 7);
66
- if (part > available)
67
- part = available;
68
-
69
- mask = masks[part] << (available - part);
70
- if (littleEndian) {
71
- bitsValue |= ((*bytes & mask) >> (available - part)) << shift;
72
- shift += part;
73
- }
74
- else {
75
- bitsValue <<= part;
76
- bitsValue |= (*bytes & mask) >> (available - part);
77
- }
78
- bytes++;
79
-
80
- bitsSize -= part;
81
- bitsOffset += part;
82
- }
83
-
84
- if (bitsValue & 0x80000000)
85
- xsmcSetNumber(xsResult, bitsValue);
86
- else
87
- xsmcSetInteger(xsResult, bitsValue);
88
- }
89
-
90
- void BitsView_prototype_setIntBits(xsMachine *the)
91
- {
92
- xsUnknownError("unimplemented");
93
- }
94
-
95
- void BitsView_prototype_setUintBits(xsMachine *the)
96
- {
97
- int bitsOffset = xsmcToInteger(xsArg(0));
98
- int bitsSize = xsmcToInteger(xsArg(1));
99
- uint32_t bitsValue = (uint32_t)xsmcToInteger(xsArg(2));
100
- int byteLength;
101
- uint8_t *bytes;
102
- uint8_t littleEndian = true;
103
- static const uint8_t masks[] = {0, 0x01, 0x03, 0x07, 0x0F, 0x1F, 0x3F, 0x7F, 0xFF};
104
-
105
- if ((bitsSize < 1) || (bitsSize > 32))
106
- xsRangeError("invalid number of bits");
107
-
108
- if (xsmcArgc > 3) {
109
- if (xsmcTest(xsArg(3))) {
110
- littleEndian = false;
111
- bitsValue <<= (32 - bitsSize);
112
- }
113
- }
114
-
115
- xsmcVars(1);
116
-
117
- xsmcGet(xsVar(0), xsThis, xsID_byteLength);
118
- byteLength = xsmcToInteger(xsVar(0));
119
-
120
- if ((bitsOffset < 0) || ((bitsOffset + bitsSize) > (byteLength << 3)))
121
- xsRangeError("invalid offset");
122
-
123
- xsmcGet(xsVar(0), xsThis, xsID_buffer);
124
- bytes = xsmcToArrayBuffer(xsVar(0));
125
-
126
- xsmcGet(xsVar(0), xsThis, xsID_byteOffset);
127
- bytes += xsmcToInteger(xsVar(0));
128
- bytes += bitsOffset >> 3;
129
- while (bitsSize) {
130
- uint8_t mask;
131
- uint8_t part = (uint8_t)bitsSize;
132
- uint8_t available = 8 - (bitsOffset & 7);
133
- if (part > available)
134
- part = available;
135
-
136
- mask = masks[part] << (available - part);
137
- if (littleEndian) {
138
- *bytes = (*bytes & ~mask) | ((bitsValue << (available - part)) & mask);
139
- bitsValue >>= part;
140
- }
141
- else {
142
- *bytes = (*bytes & ~mask) | ((bitsValue >> (24 + (bitsOffset & 7))) & mask);
143
- bitsValue <<= part;
144
- }
145
- bytes++;
146
-
147
- bitsSize -= part;
148
- bitsOffset += part;
149
- }
150
- }
@@ -1,53 +0,0 @@
1
- /*
2
- * Copyright (c) 2018 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
- */
20
-
21
- export class BitsView extends DataView {
22
- // getIntBits(bitsOffset, bitsSize, endian) @ "BitsView_prototype_getIntBits"
23
- getUintBits(bitsOffset, bitsSize, endian) @ "BitsView_prototype_getUintBits"
24
- // setIntBits(bitsOffset, bitsSize, value, endian) @ "BitsView_prototype_setIntBits"
25
- setUintBits(bitsOffset, bitsSize, value, endian) @ "BitsView_prototype_setUintBits"
26
- }
27
-
28
- export class UintBitsArray {
29
- constructor(buffer, bitsSize) {
30
- if ("number" === typeof buffer) {
31
- this.length = buffer;
32
- buffer = new ArrayBuffer(((bitsSize * buffer) + 7) >> 3);
33
- }
34
- else if (buffer instanceof ArrayBuffer)
35
- this.length = (buffer.byteLength / bitsSize) | 0;
36
- else
37
- throw new Error("invalid buffer");
38
- this.bitsSize = bitsSize;
39
- return new Proxy(new BitsView(buffer), this);
40
- }
41
- get(target, key) {
42
- if ("length" === key)
43
- return this.length;
44
- if ("buffer" === key)
45
- return target.buffer;
46
- const bitsSize = this.bitsSize;
47
- return target.getUintBits(key * bitsSize, bitsSize);
48
- }
49
- set(target, key, value) {
50
- const bitsSize = this.bitsSize;
51
- return target.setUintBits(key * bitsSize, bitsSize, value);
52
- }
53
- }
@@ -1,17 +0,0 @@
1
- {
2
- "modules": {
3
- "url": "./url"
4
- },
5
- "preload": [
6
- "url"
7
- ],
8
- "platforms": {
9
- "esp": {
10
- "recipes": {
11
- "strings-in-flash-force-l32": [
12
- "url*"
13
- ]
14
- }
15
- }
16
- }
17
- }