@agoric/xsnap 0.14.3-u13.0 → 0.14.3-u16.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.
- package/README.md +3 -3
- package/api.js +4 -2
- package/build.env +1 -1
- package/moddable/modules/data/base64/base64.js +28 -0
- package/moddable/modules/data/base64/manifest.json +11 -0
- package/moddable/modules/data/base64/modBase64.c +188 -0
- package/moddable/modules/data/binaryMessage/BinaryMessage.js +106 -0
- package/moddable/modules/data/crc/crc.c +205 -0
- package/moddable/modules/data/crc/crc.js +36 -0
- package/moddable/modules/data/crc/manifest.json +8 -0
- package/moddable/modules/data/hex/hex.js +28 -0
- package/moddable/modules/data/hex/manifest.json +11 -0
- package/moddable/modules/data/hex/modHex.c +139 -0
- package/moddable/modules/data/logical/logical.js +32 -0
- package/moddable/modules/data/logical/modLogical.c +98 -0
- package/moddable/modules/data/qrcode/manifest.json +9 -0
- package/moddable/modules/data/qrcode/qrcode.c +93 -0
- package/moddable/modules/data/qrcode/qrcode.js +23 -0
- package/moddable/modules/data/qrcode/qrcodegen.c +1025 -0
- package/moddable/modules/data/qrcode/qrcodegen.h +267 -0
- package/moddable/modules/data/text/decoder/manifest.json +8 -0
- package/moddable/modules/data/text/decoder/textdecoder.c +480 -0
- package/moddable/modules/data/text/decoder/textdecoder.js +27 -0
- package/moddable/modules/data/text/encoder/manifest.json +8 -0
- package/moddable/modules/data/text/encoder/textencoder.c +232 -0
- package/moddable/modules/data/text/encoder/textencoder.js +24 -0
- package/moddable/modules/data/tinyint/tinyint.c +150 -0
- package/moddable/modules/data/tinyint/tinyint.js +53 -0
- package/moddable/modules/data/url/manifest.json +17 -0
- package/moddable/modules/data/url/url.c +1959 -0
- package/moddable/modules/data/url/url.js +210 -0
- package/moddable/modules/data/wavreader/manifest.json +8 -0
- package/moddable/modules/data/wavreader/wavreader.js +128 -0
- package/moddable/modules/data/zlib/deflate.c +161 -0
- package/moddable/modules/data/zlib/deflate.js +63 -0
- package/moddable/modules/data/zlib/inflate.c +145 -0
- package/moddable/modules/data/zlib/inflate.js +66 -0
- package/moddable/modules/data/zlib/manifest_deflate.json +9 -0
- package/moddable/modules/data/zlib/manifest_inflate.json +9 -0
- package/moddable/modules/data/zlib/miniz.c +4924 -0
- package/moddable/xs/includes/xs.d.ts +73 -0
- package/moddable/xs/includes/xs.h +1533 -0
- package/moddable/xs/includes/xsmc.h +206 -0
- package/moddable/xs/makefiles/lin/makefile +33 -0
- package/moddable/xs/makefiles/lin/xsc.mk +118 -0
- package/moddable/xs/makefiles/lin/xsid.mk +90 -0
- package/moddable/xs/makefiles/lin/xsl.mk +168 -0
- package/moddable/xs/makefiles/lin/xst.mk +201 -0
- package/moddable/xs/makefiles/mac/makefile +33 -0
- package/moddable/xs/makefiles/mac/xsc.mk +130 -0
- package/moddable/xs/makefiles/mac/xsid.mk +102 -0
- package/moddable/xs/makefiles/mac/xsl.mk +177 -0
- package/moddable/xs/makefiles/mac/xst.mk +203 -0
- package/moddable/xs/makefiles/mac/xst_no_asan.txt +52 -0
- package/moddable/xs/makefiles/win/build.bat +26 -0
- package/moddable/xs/makefiles/win/xsc.mak +142 -0
- package/moddable/xs/makefiles/win/xsid.mak +113 -0
- package/moddable/xs/makefiles/win/xsl.mak +186 -0
- package/moddable/xs/makefiles/win/xst.mak +195 -0
- package/moddable/xs/platforms/lin_xs.h +99 -0
- package/moddable/xs/platforms/mac_xs.h +97 -0
- package/moddable/xs/platforms/wasm_xs.h +79 -0
- package/moddable/xs/platforms/win_xs.h +104 -0
- package/moddable/xs/platforms/xsHost.h +63 -0
- package/moddable/xs/platforms/xsPlatform.h +618 -0
- package/moddable/xs/sources/xsAPI.c +2555 -0
- package/moddable/xs/sources/xsAll.c +294 -0
- package/moddable/xs/sources/xsAll.h +2741 -0
- package/moddable/xs/sources/xsArguments.c +222 -0
- package/moddable/xs/sources/xsArray.c +2657 -0
- package/moddable/xs/sources/xsAtomics.c +844 -0
- package/moddable/xs/sources/xsBigInt.c +1859 -0
- package/moddable/xs/sources/xsBoolean.c +109 -0
- package/moddable/xs/sources/xsCode.c +4493 -0
- package/moddable/xs/sources/xsCommon.c +1710 -0
- package/moddable/xs/sources/xsCommon.h +1142 -0
- package/moddable/xs/sources/xsDataView.c +2890 -0
- package/moddable/xs/sources/xsDate.c +1541 -0
- package/moddable/xs/sources/xsDebug.c +2710 -0
- package/moddable/xs/sources/xsDefaults.c +134 -0
- package/moddable/xs/sources/xsError.c +353 -0
- package/moddable/xs/sources/xsFunction.c +776 -0
- package/moddable/xs/sources/xsGenerator.c +865 -0
- package/moddable/xs/sources/xsGlobal.c +839 -0
- package/moddable/xs/sources/xsJSON.c +1091 -0
- package/moddable/xs/sources/xsLexical.c +1969 -0
- package/moddable/xs/sources/xsLockdown.c +933 -0
- package/moddable/xs/sources/xsMapSet.c +1649 -0
- package/moddable/xs/sources/xsMarshall.c +1020 -0
- package/moddable/xs/sources/xsMath.c +624 -0
- package/moddable/xs/sources/xsMemory.c +1941 -0
- package/moddable/xs/sources/xsModule.c +3101 -0
- package/moddable/xs/sources/xsNumber.c +560 -0
- package/moddable/xs/sources/xsObject.c +1102 -0
- package/moddable/xs/sources/xsPlatforms.c +480 -0
- package/moddable/xs/sources/xsProfile.c +577 -0
- package/moddable/xs/sources/xsPromise.c +1199 -0
- package/moddable/xs/sources/xsProperty.c +636 -0
- package/moddable/xs/sources/xsProxy.c +1014 -0
- package/moddable/xs/sources/xsRegExp.c +1168 -0
- package/moddable/xs/sources/xsRun.c +4889 -0
- package/moddable/xs/sources/xsScope.c +1293 -0
- package/moddable/xs/sources/xsScript.c +288 -0
- package/moddable/xs/sources/xsScript.h +1186 -0
- package/moddable/xs/sources/xsSnapshot.c +2161 -0
- package/moddable/xs/sources/xsSnapshot.h +51 -0
- package/moddable/xs/sources/xsSourceMap.c +218 -0
- package/moddable/xs/sources/xsString.c +3332 -0
- package/moddable/xs/sources/xsSymbol.c +503 -0
- package/moddable/xs/sources/xsSyntaxical.c +4193 -0
- package/moddable/xs/sources/xsTree.c +1893 -0
- package/moddable/xs/sources/xsType.c +1488 -0
- package/moddable/xs/sources/xsdtoa.c +6672 -0
- package/moddable/xs/sources/xsmc.c +340 -0
- package/moddable/xs/sources/xsre.c +7578 -0
- package/package.json +39 -22
- package/scripts/get_xsnap_version.sh +14 -0
- package/scripts/test-package.sh +21 -0
- package/src/avaAssertXS.js +6 -2
- package/src/avaHandler.cjs +2 -5
- package/src/avaXS.js +7 -8
- package/src/build.js +161 -28
- package/src/replay.js +0 -3
- package/src/xsnap.js +105 -91
- package/src/xsrepl.js +2 -3
- package/xsnap-native/xsnap/makefiles/lin/makefile +10 -0
- package/xsnap-native/xsnap/makefiles/lin/xsnap-worker.mk +156 -0
- package/xsnap-native/xsnap/makefiles/lin/xsnap.mk +144 -0
- package/xsnap-native/xsnap/makefiles/mac/makefile +10 -0
- package/xsnap-native/xsnap/makefiles/mac/xsnap-worker.mk +165 -0
- package/xsnap-native/xsnap/makefiles/mac/xsnap.mk +153 -0
- package/xsnap-native/xsnap/sources/xsnap-worker.c +1008 -0
- package/xsnap-native/xsnap/sources/xsnap.c +717 -0
- package/xsnap-native/xsnap/sources/xsnap.h +142 -0
- package/xsnap-native/xsnap/sources/xsnapPlatform.c +1501 -0
- package/xsnap-native/xsnap/sources/xsnapPlatform.h +105 -0
- package/CHANGELOG.md +0 -646
|
@@ -0,0 +1,294 @@
|
|
|
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
|
+
}
|