@agoric/xsnap 0.14.3-u14.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 +37 -20
- 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 -654
|
@@ -0,0 +1,1533 @@
|
|
|
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
|
+
#ifndef __XS__
|
|
39
|
+
#define __XS__
|
|
40
|
+
|
|
41
|
+
#ifdef INCLUDE_XSPLATFORM
|
|
42
|
+
#include "xsPlatform.h"
|
|
43
|
+
#define xsMachinePlatform mxMachinePlatform
|
|
44
|
+
|
|
45
|
+
#include <stdint.h>
|
|
46
|
+
#else
|
|
47
|
+
#define xsMachinePlatform
|
|
48
|
+
#ifndef __XSPLATFORM__
|
|
49
|
+
|
|
50
|
+
#include <setjmp.h>
|
|
51
|
+
#include <stdint.h>
|
|
52
|
+
|
|
53
|
+
#define mxBigEndian 0
|
|
54
|
+
#define mxLittleEndian 0
|
|
55
|
+
|
|
56
|
+
#define mxiOS 0
|
|
57
|
+
#define mxLinux 0
|
|
58
|
+
#define mxMacOSX 0
|
|
59
|
+
#define mxWindows 0
|
|
60
|
+
|
|
61
|
+
#if defined(_MSC_VER)
|
|
62
|
+
#if defined(_M_IX86) || defined(_M_X64)
|
|
63
|
+
#undef mxLittleEndian
|
|
64
|
+
#define mxLittleEndian 1
|
|
65
|
+
#undef mxWindows
|
|
66
|
+
#define mxWindows 1
|
|
67
|
+
#ifdef mxDynamicLink
|
|
68
|
+
#define mxExport extern __declspec( dllexport )
|
|
69
|
+
#define mxImport extern __declspec( dllimport )
|
|
70
|
+
#else
|
|
71
|
+
#define mxExport extern
|
|
72
|
+
#define mxImport extern
|
|
73
|
+
#endif
|
|
74
|
+
#else
|
|
75
|
+
#error unknown Microsoft compiler
|
|
76
|
+
#endif
|
|
77
|
+
#elif defined(__GNUC__)
|
|
78
|
+
|
|
79
|
+
#define _setjmp(buffer) setjmp(buffer)
|
|
80
|
+
|
|
81
|
+
#if defined(__i386__) || defined(i386) || defined(intel) || defined(arm) || defined(__arm__) || defined(__k8__) || defined(__x86_64__)
|
|
82
|
+
#undef mxLittleEndian
|
|
83
|
+
#define mxLittleEndian 1
|
|
84
|
+
#if defined(__linux__)
|
|
85
|
+
#undef mxLinux
|
|
86
|
+
#define mxLinux 1
|
|
87
|
+
#define mxExport extern
|
|
88
|
+
#define mxImport extern
|
|
89
|
+
#else
|
|
90
|
+
#if defined(__APPLE__)
|
|
91
|
+
#if defined(iphone)
|
|
92
|
+
#undef mxiOS
|
|
93
|
+
#define mxiOS 1
|
|
94
|
+
#else
|
|
95
|
+
#undef mxMacOSX
|
|
96
|
+
#define mxMacOSX 1
|
|
97
|
+
#endif
|
|
98
|
+
#endif
|
|
99
|
+
#ifdef mxDynamicLink
|
|
100
|
+
#define mxExport extern __attribute__ ((visibility("default")))
|
|
101
|
+
#define mxImport extern __attribute__ ((visibility("default")))
|
|
102
|
+
#else
|
|
103
|
+
#define mxExport extern
|
|
104
|
+
#define mxImport extern
|
|
105
|
+
#endif
|
|
106
|
+
#endif
|
|
107
|
+
#else
|
|
108
|
+
#define mxExport extern
|
|
109
|
+
#define mxImport extern
|
|
110
|
+
#endif
|
|
111
|
+
|
|
112
|
+
#if defined(__ets__) && !ESP32
|
|
113
|
+
typedef uint32_t size_t;
|
|
114
|
+
#endif
|
|
115
|
+
#else
|
|
116
|
+
#error unknown compiler
|
|
117
|
+
#endif
|
|
118
|
+
|
|
119
|
+
typedef int8_t txS1;
|
|
120
|
+
typedef uint8_t txU1;
|
|
121
|
+
typedef int16_t txS2;
|
|
122
|
+
typedef uint16_t txU2;
|
|
123
|
+
typedef int32_t txS4;
|
|
124
|
+
typedef uint32_t txU4;
|
|
125
|
+
|
|
126
|
+
#if mxWindows
|
|
127
|
+
#undef _setjmp
|
|
128
|
+
#define _setjmp setjmp
|
|
129
|
+
#else
|
|
130
|
+
#include <errno.h>
|
|
131
|
+
#endif
|
|
132
|
+
|
|
133
|
+
#ifdef __GNUC__
|
|
134
|
+
#define XS_FUNCTION_NORETURN __attribute__((noreturn))
|
|
135
|
+
#define XS_FUNCTION_ANALYZER_NORETURN
|
|
136
|
+
#if defined(__clang__)
|
|
137
|
+
#if __has_feature(attribute_analyzer_noreturn)
|
|
138
|
+
#undef XS_FUNCTION_ANALYZER_NORETURN
|
|
139
|
+
#define XS_FUNCTION_ANALYZER_NORETURN __attribute__((analyzer_noreturn))
|
|
140
|
+
#endif
|
|
141
|
+
#endif
|
|
142
|
+
#endif
|
|
143
|
+
#ifndef XS_FUNCTION_NORETURN
|
|
144
|
+
#define XS_FUNCTION_NORETURN
|
|
145
|
+
#endif
|
|
146
|
+
#ifndef XS_FUNCTION_ANALYZER_NORETURN
|
|
147
|
+
#define XS_FUNCTION_ANALYZER_NORETURN
|
|
148
|
+
#endif
|
|
149
|
+
|
|
150
|
+
#endif /* !__XSPLATFORM__ */
|
|
151
|
+
#endif /* !INCLUDE_XSPLATFORM */
|
|
152
|
+
|
|
153
|
+
#ifndef mxBoundsCheck
|
|
154
|
+
#ifdef mxDebug
|
|
155
|
+
#define mxBoundsCheck 1
|
|
156
|
+
#else
|
|
157
|
+
#define mxBoundsCheck 0
|
|
158
|
+
#endif
|
|
159
|
+
#endif
|
|
160
|
+
#ifndef NULL
|
|
161
|
+
#define NULL 0
|
|
162
|
+
#endif
|
|
163
|
+
|
|
164
|
+
#define fxPop() (*(the->stack++))
|
|
165
|
+
#define fxPush(_SLOT) (*(--the->stack) = (_SLOT))
|
|
166
|
+
|
|
167
|
+
#if mxBoundsCheck
|
|
168
|
+
#ifdef mxDebug
|
|
169
|
+
#define xsOverflow(_COUNT) \
|
|
170
|
+
(fxOverflow(the,_COUNT,(char *)__FILE__,__LINE__))
|
|
171
|
+
#else
|
|
172
|
+
#define xsOverflow(_COUNT) \
|
|
173
|
+
(fxOverflow(the,_COUNT,NULL,0))
|
|
174
|
+
#endif
|
|
175
|
+
#else
|
|
176
|
+
#define xsOverflow(_COUNT) \
|
|
177
|
+
((void)0)
|
|
178
|
+
#endif
|
|
179
|
+
|
|
180
|
+
#ifndef __XSALL__
|
|
181
|
+
typedef struct xsCreationRecord xsCreation;
|
|
182
|
+
typedef struct xsJumpRecord xsJump;
|
|
183
|
+
typedef struct xsMachineRecord xsMachine;
|
|
184
|
+
typedef struct xsSlotRecord xsSlot;
|
|
185
|
+
typedef struct xsHostBuilderRecord xsHostBuilder;
|
|
186
|
+
typedef struct xsHostHooksStruct xsHostHooks;
|
|
187
|
+
#else
|
|
188
|
+
typedef struct sxCreation xsCreation;
|
|
189
|
+
typedef struct sxJump xsJump;
|
|
190
|
+
typedef struct sxMachine xsMachine;
|
|
191
|
+
typedef struct sxSlot xsSlot;
|
|
192
|
+
typedef struct sxHostFunctionBuilder xsHostBuilder;
|
|
193
|
+
typedef struct sxHostHooks xsHostHooks;
|
|
194
|
+
#endif
|
|
195
|
+
|
|
196
|
+
/* Slot */
|
|
197
|
+
|
|
198
|
+
struct xsSlotRecord {
|
|
199
|
+
void* data[4];
|
|
200
|
+
};
|
|
201
|
+
|
|
202
|
+
enum {
|
|
203
|
+
xsUndefinedType,
|
|
204
|
+
xsNullType,
|
|
205
|
+
xsBooleanType,
|
|
206
|
+
xsIntegerType,
|
|
207
|
+
xsNumberType,
|
|
208
|
+
xsStringType,
|
|
209
|
+
xsStringXType,
|
|
210
|
+
xsSymbolType,
|
|
211
|
+
xsBigIntType,
|
|
212
|
+
xsBigIntXType,
|
|
213
|
+
xsReferenceType
|
|
214
|
+
};
|
|
215
|
+
typedef char xsType;
|
|
216
|
+
|
|
217
|
+
#define xsTypeOf(_SLOT) \
|
|
218
|
+
(the->scratch = (_SLOT), \
|
|
219
|
+
fxTypeOf(the, &(the->scratch)))
|
|
220
|
+
#define xsIsCallable(_SLOT) \
|
|
221
|
+
(the->scratch = (_SLOT), \
|
|
222
|
+
fxIsCallable(the, &(the->scratch)))
|
|
223
|
+
|
|
224
|
+
/* Primitives */
|
|
225
|
+
|
|
226
|
+
typedef txS4 xsBooleanValue;
|
|
227
|
+
typedef txS4 xsIntegerValue;
|
|
228
|
+
typedef double xsNumberValue;
|
|
229
|
+
typedef char* xsStringValue;
|
|
230
|
+
typedef txU4 xsUnsignedValue;
|
|
231
|
+
|
|
232
|
+
#define xsUndefined \
|
|
233
|
+
(fxUndefined(the, &the->scratch), \
|
|
234
|
+
the->scratch)
|
|
235
|
+
#define xsNull \
|
|
236
|
+
(fxNull(the, &the->scratch), \
|
|
237
|
+
the->scratch)
|
|
238
|
+
#define xsFalse \
|
|
239
|
+
(fxBoolean(the, &the->scratch, 0), \
|
|
240
|
+
the->scratch)
|
|
241
|
+
#define xsTrue \
|
|
242
|
+
(fxBoolean(the, &the->scratch, 1), \
|
|
243
|
+
the->scratch)
|
|
244
|
+
|
|
245
|
+
#define xsBoolean(_VALUE) \
|
|
246
|
+
(fxBoolean(the, &the->scratch, _VALUE), \
|
|
247
|
+
the->scratch)
|
|
248
|
+
#define xsToBoolean(_SLOT) \
|
|
249
|
+
(the->scratch = (_SLOT), \
|
|
250
|
+
fxToBoolean(the, &(the->scratch)))
|
|
251
|
+
|
|
252
|
+
#define xsInteger(_VALUE) \
|
|
253
|
+
(fxInteger(the, &the->scratch, _VALUE), \
|
|
254
|
+
the->scratch)
|
|
255
|
+
#define xsToInteger(_SLOT) \
|
|
256
|
+
(the->scratch = (_SLOT), \
|
|
257
|
+
fxToInteger(the, &(the->scratch)))
|
|
258
|
+
|
|
259
|
+
#define xsNumber(_VALUE) \
|
|
260
|
+
(fxNumber(the, &the->scratch, _VALUE), \
|
|
261
|
+
the->scratch)
|
|
262
|
+
#define xsToNumber(_SLOT) \
|
|
263
|
+
(the->scratch = (_SLOT), \
|
|
264
|
+
fxToNumber(the, &(the->scratch)))
|
|
265
|
+
|
|
266
|
+
#define xsString(_VALUE) \
|
|
267
|
+
(fxString(the, &the->scratch, (xsStringValue)(_VALUE)), \
|
|
268
|
+
the->scratch)
|
|
269
|
+
#define xsStringBuffer(_BUFFER,_SIZE) \
|
|
270
|
+
(fxStringBuffer(the, &the->scratch, _BUFFER ,_SIZE), \
|
|
271
|
+
the->scratch)
|
|
272
|
+
#define xsToString(_SLOT) \
|
|
273
|
+
(the->scratch = (_SLOT), \
|
|
274
|
+
fxToString(the, &(the->scratch)))
|
|
275
|
+
#define xsToStringBuffer(_SLOT,_BUFFER,_SIZE) \
|
|
276
|
+
(the->scratch = (_SLOT), \
|
|
277
|
+
fxToStringBuffer(the, &(the->scratch), _BUFFER ,_SIZE))
|
|
278
|
+
|
|
279
|
+
#define xsArrayBuffer(_BUFFER,_SIZE) \
|
|
280
|
+
(fxArrayBuffer(the, &the->scratch, _BUFFER, _SIZE, -1), \
|
|
281
|
+
the->scratch)
|
|
282
|
+
#define xsArrayBufferResizable(_BUFFER,_SIZE,_MAX_SIZE) \
|
|
283
|
+
(fxArrayBuffer(the, &the->scratch, _BUFFER, _SIZE,_MAX_SIZE), \
|
|
284
|
+
the->scratch)
|
|
285
|
+
#define xsGetArrayBufferData(_SLOT,_OFFSET,_BUFFER,_SIZE) \
|
|
286
|
+
(the->scratch = (_SLOT), \
|
|
287
|
+
fxGetArrayBufferData(the, &(the->scratch), _OFFSET, _BUFFER, _SIZE))
|
|
288
|
+
#define xsGetArrayBufferLength(_SLOT) \
|
|
289
|
+
(the->scratch = (_SLOT), \
|
|
290
|
+
fxGetArrayBufferLength(the, &(the->scratch)))
|
|
291
|
+
#define xsGetArrayBufferMaxLength(_SLOT) \
|
|
292
|
+
(the->scratch = (_SLOT), \
|
|
293
|
+
fxGetArrayBufferMaxLength(the, &(the->scratch)))
|
|
294
|
+
#define xsSetArrayBufferData(_SLOT,_OFFSET,_BUFFER,_SIZE) \
|
|
295
|
+
(the->scratch = (_SLOT), \
|
|
296
|
+
fxSetArrayBufferData(the, &(the->scratch), _OFFSET, _BUFFER, _SIZE))
|
|
297
|
+
#define xsSetArrayBufferLength(_SLOT,_LENGTH) \
|
|
298
|
+
(the->scratch = (_SLOT), \
|
|
299
|
+
fxSetArrayBufferLength(the, &(the->scratch), _LENGTH))
|
|
300
|
+
#define xsToArrayBuffer(_SLOT) \
|
|
301
|
+
(the->scratch = (_SLOT), \
|
|
302
|
+
fxToArrayBuffer(the, &(the->scratch)))
|
|
303
|
+
|
|
304
|
+
/* Closures and References */
|
|
305
|
+
|
|
306
|
+
#define xsClosure(_VALUE) \
|
|
307
|
+
(fxClosure(the, &the->scratch, _VALUE), \
|
|
308
|
+
the->scratch)
|
|
309
|
+
#define xsToClosure(_SLOT) \
|
|
310
|
+
(the->scratch = (_SLOT), \
|
|
311
|
+
fxToClosure(the, &(the->scratch)))
|
|
312
|
+
|
|
313
|
+
#define xsReference(_VALUE) \
|
|
314
|
+
(fxReference(the, &the->scratch, _VALUE), \
|
|
315
|
+
the->scratch)
|
|
316
|
+
#define xsToReference(_SLOT) \
|
|
317
|
+
(the->scratch = (_SLOT), \
|
|
318
|
+
fxToReference(the, &(the->scratch)))
|
|
319
|
+
|
|
320
|
+
/* Instances and Prototypes */
|
|
321
|
+
|
|
322
|
+
#define prototypesStackIndex -76
|
|
323
|
+
#define xsObjectPrototype (the->stackPrototypes[prototypesStackIndex - 1])
|
|
324
|
+
#define xsFunctionPrototype (the->stackPrototypes[prototypesStackIndex - 2])
|
|
325
|
+
#define xsArrayPrototype (the->stackPrototypes[prototypesStackIndex - 3])
|
|
326
|
+
#define xsStringPrototype (the->stackPrototypes[prototypesStackIndex - 4])
|
|
327
|
+
#define xsBooleanPrototype (the->stackPrototypes[prototypesStackIndex - 5])
|
|
328
|
+
#define xsNumberPrototype (the->stackPrototypes[prototypesStackIndex - 6])
|
|
329
|
+
#define xsDatePrototype (the->stackPrototypes[prototypesStackIndex - 7])
|
|
330
|
+
#define xsRegExpPrototype (the->stackPrototypes[prototypesStackIndex - 8])
|
|
331
|
+
#define xsHostPrototype (the->stackPrototypes[prototypesStackIndex - 9])
|
|
332
|
+
#define xsErrorPrototype (the->stackPrototypes[prototypesStackIndex - 10])
|
|
333
|
+
#define xsEvalErrorPrototype (the->stackPrototypes[prototypesStackIndex - 11])
|
|
334
|
+
#define xsRangeErrorPrototype (the->stackPrototypes[prototypesStackIndex - 12])
|
|
335
|
+
#define xsReferenceErrorPrototype (the->stackPrototypes[prototypesStackIndex - 13])
|
|
336
|
+
#define xsSyntaxErrorPrototype (the->stackPrototypes[prototypesStackIndex - 14])
|
|
337
|
+
#define xsTypeErrorPrototype (the->stackPrototypes[prototypesStackIndex - 15])
|
|
338
|
+
#define xsURIErrorPrototype (the->stackPrototypes[prototypesStackIndex - 16])
|
|
339
|
+
#define xsAggregateErrorPrototype (the->stackPrototypes[prototypesStackIndex - 17])
|
|
340
|
+
#define xsSymbolPrototype (the->stackPrototypes[prototypesStackIndex - 18])
|
|
341
|
+
#define xsArrayBufferPrototype (the->stackPrototypes[prototypesStackIndex - 19])
|
|
342
|
+
#define xsDataViewPrototype (the->stackPrototypes[prototypesStackIndex - 20])
|
|
343
|
+
#define xsTypedArrayPrototype (the->stackPrototypes[prototypesStackIndex - 21])
|
|
344
|
+
#define xsMapPrototype (the->stackPrototypes[prototypesStackIndex - 22])
|
|
345
|
+
#define xsSetPrototype (the->stackPrototypes[prototypesStackIndex - 23])
|
|
346
|
+
#define xsWeakMapPrototype (the->stackPrototypes[prototypesStackIndex - 24])
|
|
347
|
+
#define xsWeakSetPrototype (the->stackPrototypes[prototypesStackIndex - 25])
|
|
348
|
+
#define xsPromisePrototype (the->stackPrototypes[prototypesStackIndex - 26])
|
|
349
|
+
#define xsProxyPrototype (the->stackPrototypes[prototypesStackIndex - 27])
|
|
350
|
+
|
|
351
|
+
#define xsNewArray(_LENGTH) \
|
|
352
|
+
(fxNewArray(the,_LENGTH), \
|
|
353
|
+
fxPop())
|
|
354
|
+
|
|
355
|
+
#define xsNewObject() \
|
|
356
|
+
(fxNewObject(the), \
|
|
357
|
+
fxPop())
|
|
358
|
+
|
|
359
|
+
#define xsIsInstanceOf(_SLOT,_PROTOTYPE) \
|
|
360
|
+
(xsOverflow(-2), \
|
|
361
|
+
fxPush(_PROTOTYPE), \
|
|
362
|
+
fxPush(_SLOT), \
|
|
363
|
+
fxIsInstanceOf(the))
|
|
364
|
+
|
|
365
|
+
/* Identifiers */
|
|
366
|
+
|
|
367
|
+
typedef txS1 xsByte;
|
|
368
|
+
typedef unsigned char xsFlag;
|
|
369
|
+
#ifdef mx32bitID
|
|
370
|
+
typedef txU4 xsIdentifier;
|
|
371
|
+
#else
|
|
372
|
+
typedef txU2 xsIdentifier;
|
|
373
|
+
#endif
|
|
374
|
+
typedef txU4 xsIndex;
|
|
375
|
+
|
|
376
|
+
#define XS_NO_ID 0
|
|
377
|
+
|
|
378
|
+
#define xsID(_NAME) \
|
|
379
|
+
fxID(the, _NAME)
|
|
380
|
+
#define xsFindID(_NAME) \
|
|
381
|
+
fxFindID(the, _NAME)
|
|
382
|
+
#define xsIsID(_NAME) \
|
|
383
|
+
fxIsID(the, _NAME)
|
|
384
|
+
#define xsToID(_SLOT) \
|
|
385
|
+
(the->scratch = (_SLOT), \
|
|
386
|
+
fxToID(the, &(the->scratch)))
|
|
387
|
+
#define xsName(_ID) \
|
|
388
|
+
fxName(the, _ID)
|
|
389
|
+
|
|
390
|
+
/* Properties */
|
|
391
|
+
|
|
392
|
+
#define xsEnumerate(_THIS) \
|
|
393
|
+
(xsOverflow(-1), \
|
|
394
|
+
fxPush(_THIS), \
|
|
395
|
+
fxEnumerate(the), \
|
|
396
|
+
fxPop())
|
|
397
|
+
|
|
398
|
+
#define xsHas(_THIS,_ID) \
|
|
399
|
+
(xsOverflow(-1), \
|
|
400
|
+
fxPush(_THIS), \
|
|
401
|
+
fxHasID(the, _ID))
|
|
402
|
+
|
|
403
|
+
#define xsHasAt(_THIS,_AT) \
|
|
404
|
+
(xsOverflow(-2), \
|
|
405
|
+
fxPush(_THIS), \
|
|
406
|
+
fxPush(_AT), \
|
|
407
|
+
fxHasAt(the))
|
|
408
|
+
|
|
409
|
+
#define xsHasIndex(_THIS,_INDEX) \
|
|
410
|
+
(xsOverflow(-1), \
|
|
411
|
+
fxPush(_THIS), \
|
|
412
|
+
fxHasIndex(the, _INDEX))
|
|
413
|
+
|
|
414
|
+
#define xsGet(_THIS,_ID) \
|
|
415
|
+
(xsOverflow(-1), \
|
|
416
|
+
fxPush(_THIS), \
|
|
417
|
+
fxGetID(the, _ID), \
|
|
418
|
+
fxPop())
|
|
419
|
+
|
|
420
|
+
#define xsGetAt(_THIS,_AT) \
|
|
421
|
+
(xsOverflow(-2), \
|
|
422
|
+
fxPush(_THIS), \
|
|
423
|
+
fxPush(_AT), \
|
|
424
|
+
fxGetAt(the), \
|
|
425
|
+
fxPop())
|
|
426
|
+
|
|
427
|
+
#define xsGetIndex(_THIS,_INDEX) \
|
|
428
|
+
(xsOverflow(-1), \
|
|
429
|
+
fxPush(_THIS), \
|
|
430
|
+
fxGetIndex(the, _INDEX), \
|
|
431
|
+
fxPop())
|
|
432
|
+
|
|
433
|
+
#define xsSet(_THIS,_ID,_SLOT) \
|
|
434
|
+
(xsOverflow(-2), \
|
|
435
|
+
fxPush(_SLOT), \
|
|
436
|
+
fxPush(_THIS), \
|
|
437
|
+
fxSetID(the, _ID), \
|
|
438
|
+
the->stack++)
|
|
439
|
+
|
|
440
|
+
#define xsSetAt(_THIS,_AT,_SLOT) \
|
|
441
|
+
(xsOverflow(-3), \
|
|
442
|
+
fxPush(_SLOT), \
|
|
443
|
+
fxPush(_THIS), \
|
|
444
|
+
fxPush(_AT), \
|
|
445
|
+
fxSetAt(the), \
|
|
446
|
+
the->stack++)
|
|
447
|
+
|
|
448
|
+
#define xsSetIndex(_THIS,_INDEX,_SLOT) \
|
|
449
|
+
(xsOverflow(-2), \
|
|
450
|
+
fxPush(_SLOT), \
|
|
451
|
+
fxPush(_THIS), \
|
|
452
|
+
fxSetIndex(the, _INDEX), \
|
|
453
|
+
the->stack++)
|
|
454
|
+
|
|
455
|
+
#define xsDefine(_THIS,_ID,_SLOT,_ATTRIBUTES) \
|
|
456
|
+
(xsOverflow(-2), \
|
|
457
|
+
fxPush(_SLOT), \
|
|
458
|
+
fxPush(_THIS), \
|
|
459
|
+
fxDefineID(the, _ID, _ATTRIBUTES, _ATTRIBUTES | xsDontDelete | xsDontEnum | xsDontSet), \
|
|
460
|
+
the->stack++)
|
|
461
|
+
|
|
462
|
+
#define xsDefineAt(_THIS,_AT,_SLOT,_ATTRIBUTES) \
|
|
463
|
+
(xsOverflow(-3), \
|
|
464
|
+
fxPush(_SLOT), \
|
|
465
|
+
fxPush(_THIS), \
|
|
466
|
+
fxPush(_AT), \
|
|
467
|
+
fxDefineAt(the, _ATTRIBUTES, _ATTRIBUTES | xsDontDelete | xsDontEnum | xsDontSet), \
|
|
468
|
+
the->stack++)
|
|
469
|
+
|
|
470
|
+
#define xsDelete(_THIS,_ID) \
|
|
471
|
+
(xsOverflow(-1), \
|
|
472
|
+
fxPush(_THIS), \
|
|
473
|
+
fxDeleteID(the, _ID), \
|
|
474
|
+
the->stack++)
|
|
475
|
+
|
|
476
|
+
#define xsDeleteAt(_THIS,_AT) \
|
|
477
|
+
(xsOverflow(-2), \
|
|
478
|
+
fxPush(_THIS), \
|
|
479
|
+
fxPush(_AT), \
|
|
480
|
+
fxDeleteAt(the), \
|
|
481
|
+
the->stack++)
|
|
482
|
+
|
|
483
|
+
#define XS_FRAME_COUNT 6
|
|
484
|
+
|
|
485
|
+
#define xsCall0(_THIS,_ID) \
|
|
486
|
+
(xsOverflow(-XS_FRAME_COUNT-0), \
|
|
487
|
+
fxPush(_THIS), \
|
|
488
|
+
fxCallID(the, _ID), \
|
|
489
|
+
fxRunCount(the, 0), \
|
|
490
|
+
fxPop())
|
|
491
|
+
|
|
492
|
+
#define xsCall0_noResult(_THIS,_ID) \
|
|
493
|
+
(xsOverflow(-XS_FRAME_COUNT-0), \
|
|
494
|
+
fxPush(_THIS), \
|
|
495
|
+
fxCallID(the, _ID), \
|
|
496
|
+
fxRunCount(the, 0), \
|
|
497
|
+
the->stack++)
|
|
498
|
+
|
|
499
|
+
#define xsCall1(_THIS,_ID,_SLOT0) \
|
|
500
|
+
(xsOverflow(-XS_FRAME_COUNT-1), \
|
|
501
|
+
fxPush(_THIS), \
|
|
502
|
+
fxCallID(the, _ID), \
|
|
503
|
+
fxPush(_SLOT0), \
|
|
504
|
+
fxRunCount(the, 1), \
|
|
505
|
+
fxPop())
|
|
506
|
+
|
|
507
|
+
#define xsCall1_noResult(_THIS,_ID,_SLOT0) \
|
|
508
|
+
(xsOverflow(-XS_FRAME_COUNT-1), \
|
|
509
|
+
fxPush(_THIS), \
|
|
510
|
+
fxCallID(the, _ID), \
|
|
511
|
+
fxPush(_SLOT0), \
|
|
512
|
+
fxRunCount(the, 1), \
|
|
513
|
+
the->stack++)
|
|
514
|
+
|
|
515
|
+
#define xsCall2(_THIS,_ID,_SLOT0,_SLOT1) \
|
|
516
|
+
(xsOverflow(-XS_FRAME_COUNT-2), \
|
|
517
|
+
fxPush(_THIS), \
|
|
518
|
+
fxCallID(the, _ID), \
|
|
519
|
+
fxPush(_SLOT0), \
|
|
520
|
+
fxPush(_SLOT1), \
|
|
521
|
+
fxRunCount(the, 2), \
|
|
522
|
+
fxPop())
|
|
523
|
+
|
|
524
|
+
#define xsCall2_noResult(_THIS,_ID,_SLOT0,_SLOT1) \
|
|
525
|
+
(xsOverflow(-XS_FRAME_COUNT-2), \
|
|
526
|
+
fxPush(_THIS), \
|
|
527
|
+
fxCallID(the, _ID), \
|
|
528
|
+
fxPush(_SLOT0), \
|
|
529
|
+
fxPush(_SLOT1), \
|
|
530
|
+
fxRunCount(the, 2), \
|
|
531
|
+
the->stack++)
|
|
532
|
+
|
|
533
|
+
#define xsCall3(_THIS,_ID,_SLOT0,_SLOT1,_SLOT2) \
|
|
534
|
+
(xsOverflow(-XS_FRAME_COUNT-3), \
|
|
535
|
+
fxPush(_THIS), \
|
|
536
|
+
fxCallID(the, _ID), \
|
|
537
|
+
fxPush(_SLOT0), \
|
|
538
|
+
fxPush(_SLOT1), \
|
|
539
|
+
fxPush(_SLOT2), \
|
|
540
|
+
fxRunCount(the, 3), \
|
|
541
|
+
fxPop())
|
|
542
|
+
|
|
543
|
+
#define xsCall3_noResult(_THIS,_ID,_SLOT0,_SLOT1,_SLOT2) \
|
|
544
|
+
(xsOverflow(-XS_FRAME_COUNT-3), \
|
|
545
|
+
fxPush(_THIS), \
|
|
546
|
+
fxCallID(the, _ID), \
|
|
547
|
+
fxPush(_SLOT0), \
|
|
548
|
+
fxPush(_SLOT1), \
|
|
549
|
+
fxPush(_SLOT2), \
|
|
550
|
+
fxRunCount(the, 3), \
|
|
551
|
+
the->stack++)
|
|
552
|
+
|
|
553
|
+
#define xsCall4(_THIS,_ID,_SLOT0,_SLOT1,_SLOT2,_SLOT3) \
|
|
554
|
+
(xsOverflow(-XS_FRAME_COUNT-4), \
|
|
555
|
+
fxPush(_THIS), \
|
|
556
|
+
fxCallID(the, _ID), \
|
|
557
|
+
fxPush(_SLOT0), \
|
|
558
|
+
fxPush(_SLOT1), \
|
|
559
|
+
fxPush(_SLOT2), \
|
|
560
|
+
fxPush(_SLOT3), \
|
|
561
|
+
fxRunCount(the, 4), \
|
|
562
|
+
fxPop())
|
|
563
|
+
|
|
564
|
+
#define xsCall4_noResult(_THIS,_ID,_SLOT0,_SLOT1,_SLOT2,_SLOT3) \
|
|
565
|
+
(xsOverflow(-XS_FRAME_COUNT-4), \
|
|
566
|
+
fxPush(_THIS), \
|
|
567
|
+
fxCallID(the, _ID), \
|
|
568
|
+
fxPush(_SLOT0), \
|
|
569
|
+
fxPush(_SLOT1), \
|
|
570
|
+
fxPush(_SLOT2), \
|
|
571
|
+
fxPush(_SLOT3), \
|
|
572
|
+
fxRunCount(the, 4), \
|
|
573
|
+
the->stack++)
|
|
574
|
+
|
|
575
|
+
#define xsCall5(_THIS,_ID,_SLOT0,_SLOT1,_SLOT2,_SLOT3,_SLOT4) \
|
|
576
|
+
(xsOverflow(-XS_FRAME_COUNT-5), \
|
|
577
|
+
fxPush(_THIS), \
|
|
578
|
+
fxCallID(the, _ID), \
|
|
579
|
+
fxPush(_SLOT0), \
|
|
580
|
+
fxPush(_SLOT1), \
|
|
581
|
+
fxPush(_SLOT2), \
|
|
582
|
+
fxPush(_SLOT3), \
|
|
583
|
+
fxPush(_SLOT4), \
|
|
584
|
+
fxRunCount(the, 5), \
|
|
585
|
+
fxPop())
|
|
586
|
+
|
|
587
|
+
#define xsCall5_noResult(_THIS,_ID,_SLOT0,_SLOT1,_SLOT2,_SLOT3,_SLOT4) \
|
|
588
|
+
(xsOverflow(-XS_FRAME_COUNT-5), \
|
|
589
|
+
fxPush(_THIS), \
|
|
590
|
+
fxCallID(the, _ID), \
|
|
591
|
+
fxPush(_SLOT0), \
|
|
592
|
+
fxPush(_SLOT1), \
|
|
593
|
+
fxPush(_SLOT2), \
|
|
594
|
+
fxPush(_SLOT3), \
|
|
595
|
+
fxPush(_SLOT4), \
|
|
596
|
+
fxRunCount(the, 5), \
|
|
597
|
+
the->stack++)
|
|
598
|
+
|
|
599
|
+
#define xsCall6(_THIS,_ID,_SLOT0,_SLOT1,_SLOT2,_SLOT3,_SLOT4,_SLOT5) \
|
|
600
|
+
(xsOverflow(-XS_FRAME_COUNT-6), \
|
|
601
|
+
fxPush(_THIS), \
|
|
602
|
+
fxCallID(the, _ID), \
|
|
603
|
+
fxPush(_SLOT0), \
|
|
604
|
+
fxPush(_SLOT1), \
|
|
605
|
+
fxPush(_SLOT2), \
|
|
606
|
+
fxPush(_SLOT3), \
|
|
607
|
+
fxPush(_SLOT4), \
|
|
608
|
+
fxPush(_SLOT5), \
|
|
609
|
+
fxRunCount(the, 6), \
|
|
610
|
+
fxPop())
|
|
611
|
+
|
|
612
|
+
#define xsCall6_noResult(_THIS,_ID,_SLOT0,_SLOT1,_SLOT2,_SLOT3,_SLOT4,_SLOT5) \
|
|
613
|
+
(xsOverflow(-XS_FRAME_COUNT-6), \
|
|
614
|
+
fxPush(_THIS), \
|
|
615
|
+
fxCallID(the, _ID), \
|
|
616
|
+
fxPush(_SLOT0), \
|
|
617
|
+
fxPush(_SLOT1), \
|
|
618
|
+
fxPush(_SLOT2), \
|
|
619
|
+
fxPush(_SLOT3), \
|
|
620
|
+
fxPush(_SLOT4), \
|
|
621
|
+
fxPush(_SLOT5), \
|
|
622
|
+
fxRunCount(the, 6), \
|
|
623
|
+
the->stack++)
|
|
624
|
+
|
|
625
|
+
#define xsCall7(_THIS,_ID,_SLOT0,_SLOT1,_SLOT2,_SLOT3,_SLOT4,_SLOT5,_SLOT6) \
|
|
626
|
+
(xsOverflow(-XS_FRAME_COUNT-7), \
|
|
627
|
+
fxPush(_THIS), \
|
|
628
|
+
fxCallID(the, _ID), \
|
|
629
|
+
fxPush(_SLOT0), \
|
|
630
|
+
fxPush(_SLOT1), \
|
|
631
|
+
fxPush(_SLOT2), \
|
|
632
|
+
fxPush(_SLOT3), \
|
|
633
|
+
fxPush(_SLOT4), \
|
|
634
|
+
fxPush(_SLOT5), \
|
|
635
|
+
fxPush(_SLOT6), \
|
|
636
|
+
fxRunCount(the, 7), \
|
|
637
|
+
fxPop())
|
|
638
|
+
|
|
639
|
+
#define xsCall7_noResult(_THIS,_ID,_SLOT0,_SLOT1,_SLOT2,_SLOT3,_SLOT4,_SLOT5,_SLOT6) \
|
|
640
|
+
(xsOverflow(-XS_FRAME_COUNT-7), \
|
|
641
|
+
fxPush(_THIS), \
|
|
642
|
+
fxCallID(the, _ID), \
|
|
643
|
+
fxPush(_SLOT0), \
|
|
644
|
+
fxPush(_SLOT1), \
|
|
645
|
+
fxPush(_SLOT2), \
|
|
646
|
+
fxPush(_SLOT3), \
|
|
647
|
+
fxPush(_SLOT4), \
|
|
648
|
+
fxPush(_SLOT5), \
|
|
649
|
+
fxPush(_SLOT6), \
|
|
650
|
+
fxRunCount(the, 7), \
|
|
651
|
+
the->stack++)
|
|
652
|
+
|
|
653
|
+
#define xsCall8(_THIS,_ID,_SLOT0,_SLOT1,_SLOT2,_SLOT3,_SLOT4,_SLOT5,_SLOT6,_SLOT7) \
|
|
654
|
+
(xsOverflow(-XS_FRAME_COUNT-8), \
|
|
655
|
+
fxPush(_THIS), \
|
|
656
|
+
fxCallID(the, _ID), \
|
|
657
|
+
fxPush(_SLOT0), \
|
|
658
|
+
fxPush(_SLOT1), \
|
|
659
|
+
fxPush(_SLOT2), \
|
|
660
|
+
fxPush(_SLOT3), \
|
|
661
|
+
fxPush(_SLOT4), \
|
|
662
|
+
fxPush(_SLOT5), \
|
|
663
|
+
fxPush(_SLOT6), \
|
|
664
|
+
fxPush(_SLOT7), \
|
|
665
|
+
fxRunCount(the, 8), \
|
|
666
|
+
fxPop())
|
|
667
|
+
|
|
668
|
+
#define xsCall8_noResult(_THIS,_ID,_SLOT0,_SLOT1,_SLOT2,_SLOT3,_SLOT4,_SLOT5,_SLOT6,_SLOT7) \
|
|
669
|
+
(xsOverflow(-XS_FRAME_COUNT-8), \
|
|
670
|
+
fxPush(_THIS), \
|
|
671
|
+
fxCallID(the, _ID), \
|
|
672
|
+
fxPush(_SLOT0), \
|
|
673
|
+
fxPush(_SLOT1), \
|
|
674
|
+
fxPush(_SLOT2), \
|
|
675
|
+
fxPush(_SLOT3), \
|
|
676
|
+
fxPush(_SLOT4), \
|
|
677
|
+
fxPush(_SLOT5), \
|
|
678
|
+
fxPush(_SLOT6), \
|
|
679
|
+
fxPush(_SLOT7), \
|
|
680
|
+
fxRunCount(the, 8), \
|
|
681
|
+
the->stack++)
|
|
682
|
+
|
|
683
|
+
#define xsCallFunction0(_FUNCTION,_THIS) \
|
|
684
|
+
(xsOverflow(-XS_FRAME_COUNT-0), \
|
|
685
|
+
fxPush(_THIS), \
|
|
686
|
+
fxPush(_FUNCTION), \
|
|
687
|
+
fxCall(the), \
|
|
688
|
+
fxRunCount(the, 0), \
|
|
689
|
+
fxPop())
|
|
690
|
+
|
|
691
|
+
#define xsCallFunction1(_FUNCTION,_THIS,_SLOT0) \
|
|
692
|
+
(xsOverflow(-XS_FRAME_COUNT-1), \
|
|
693
|
+
fxPush(_THIS), \
|
|
694
|
+
fxPush(_FUNCTION), \
|
|
695
|
+
fxCall(the), \
|
|
696
|
+
fxPush(_SLOT0), \
|
|
697
|
+
fxRunCount(the, 1), \
|
|
698
|
+
fxPop())
|
|
699
|
+
|
|
700
|
+
#define xsCallFunction2(_FUNCTION,_THIS,_SLOT0,_SLOT1) \
|
|
701
|
+
(xsOverflow(-XS_FRAME_COUNT-2), \
|
|
702
|
+
fxPush(_THIS), \
|
|
703
|
+
fxPush(_FUNCTION), \
|
|
704
|
+
fxCall(the), \
|
|
705
|
+
fxPush(_SLOT0), \
|
|
706
|
+
fxPush(_SLOT1), \
|
|
707
|
+
fxRunCount(the, 2), \
|
|
708
|
+
fxPop())
|
|
709
|
+
|
|
710
|
+
#define xsCallFunction3(_FUNCTION,_THIS,_SLOT0,_SLOT1,_SLOT2) \
|
|
711
|
+
(xsOverflow(-XS_FRAME_COUNT-3), \
|
|
712
|
+
fxPush(_THIS), \
|
|
713
|
+
fxPush(_FUNCTION), \
|
|
714
|
+
fxCall(the), \
|
|
715
|
+
fxPush(_SLOT0), \
|
|
716
|
+
fxPush(_SLOT1), \
|
|
717
|
+
fxPush(_SLOT2), \
|
|
718
|
+
fxRunCount(the, 3), \
|
|
719
|
+
fxPop())
|
|
720
|
+
|
|
721
|
+
#define xsCallFunction4(_FUNCTION,_THIS,_SLOT0,_SLOT1,_SLOT2,_SLOT3) \
|
|
722
|
+
(xsOverflow(-XS_FRAME_COUNT-4), \
|
|
723
|
+
fxPush(_THIS), \
|
|
724
|
+
fxPush(_FUNCTION), \
|
|
725
|
+
fxCall(the), \
|
|
726
|
+
fxPush(_SLOT0), \
|
|
727
|
+
fxPush(_SLOT1), \
|
|
728
|
+
fxPush(_SLOT2), \
|
|
729
|
+
fxPush(_SLOT3), \
|
|
730
|
+
fxRunCount(the, 4), \
|
|
731
|
+
fxPop())
|
|
732
|
+
|
|
733
|
+
#define xsCallFunction5(_FUNCTION,_THIS,_SLOT0,_SLOT1,_SLOT2,_SLOT3,_SLOT4) \
|
|
734
|
+
(xsOverflow(-XS_FRAME_COUNT-5), \
|
|
735
|
+
fxPush(_THIS), \
|
|
736
|
+
fxPush(_FUNCTION), \
|
|
737
|
+
fxCall(the), \
|
|
738
|
+
fxPush(_SLOT0), \
|
|
739
|
+
fxPush(_SLOT1), \
|
|
740
|
+
fxPush(_SLOT2), \
|
|
741
|
+
fxPush(_SLOT3), \
|
|
742
|
+
fxPush(_SLOT4), \
|
|
743
|
+
fxRunCount(the, 5), \
|
|
744
|
+
fxPop())
|
|
745
|
+
|
|
746
|
+
#define xsCallFunction6(_FUNCTION,_THIS,_SLOT0,_SLOT1,_SLOT2,_SLOT3,_SLOT4,_SLOT5) \
|
|
747
|
+
(xsOverflow(-XS_FRAME_COUNT-6), \
|
|
748
|
+
fxPush(_THIS), \
|
|
749
|
+
fxPush(_FUNCTION), \
|
|
750
|
+
fxCall(the), \
|
|
751
|
+
fxPush(_SLOT0), \
|
|
752
|
+
fxPush(_SLOT1), \
|
|
753
|
+
fxPush(_SLOT2), \
|
|
754
|
+
fxPush(_SLOT3), \
|
|
755
|
+
fxPush(_SLOT4), \
|
|
756
|
+
fxPush(_SLOT5), \
|
|
757
|
+
fxRunCount(the, 6), \
|
|
758
|
+
fxPop())
|
|
759
|
+
|
|
760
|
+
#define xsCallFunction7(_FUNCTION,_THIS,_SLOT0,_SLOT1,_SLOT2,_SLOT3,_SLOT4,_SLOT5,_SLOT6) \
|
|
761
|
+
(xsOverflow(-XS_FRAME_COUNT-7), \
|
|
762
|
+
fxPush(_THIS), \
|
|
763
|
+
fxPush(_FUNCTION), \
|
|
764
|
+
fxCall(the), \
|
|
765
|
+
fxPush(_SLOT0), \
|
|
766
|
+
fxPush(_SLOT1), \
|
|
767
|
+
fxPush(_SLOT2), \
|
|
768
|
+
fxPush(_SLOT3), \
|
|
769
|
+
fxPush(_SLOT4), \
|
|
770
|
+
fxPush(_SLOT5), \
|
|
771
|
+
fxPush(_SLOT6), \
|
|
772
|
+
fxRunCount(the, 7), \
|
|
773
|
+
fxPop())
|
|
774
|
+
|
|
775
|
+
#define xsCallFunction8(_FUNCTION,_THIS,_SLOT0,_SLOT1,_SLOT2,_SLOT3,_SLOT4,_SLOT5,_SLOT6,_SLOT7) \
|
|
776
|
+
(xsOverflow(-XS_FRAME_COUNT-8), \
|
|
777
|
+
fxPush(_THIS), \
|
|
778
|
+
fxPush(_FUNCTION), \
|
|
779
|
+
fxCall(the), \
|
|
780
|
+
fxPush(_SLOT0), \
|
|
781
|
+
fxPush(_SLOT1), \
|
|
782
|
+
fxPush(_SLOT2), \
|
|
783
|
+
fxPush(_SLOT3), \
|
|
784
|
+
fxPush(_SLOT4), \
|
|
785
|
+
fxPush(_SLOT5), \
|
|
786
|
+
fxPush(_SLOT6), \
|
|
787
|
+
fxPush(_SLOT7), \
|
|
788
|
+
fxRunCount(the, 8), \
|
|
789
|
+
fxPop())
|
|
790
|
+
|
|
791
|
+
#define xsNew0(_THIS,_ID) \
|
|
792
|
+
(xsOverflow(-XS_FRAME_COUNT-0), \
|
|
793
|
+
fxPush(_THIS), \
|
|
794
|
+
fxNewID(the, _ID), \
|
|
795
|
+
fxRunCount(the, 0), \
|
|
796
|
+
fxPop())
|
|
797
|
+
|
|
798
|
+
#define xsNew1(_THIS,_ID,_SLOT0) \
|
|
799
|
+
(xsOverflow(-XS_FRAME_COUNT-1), \
|
|
800
|
+
fxPush(_THIS), \
|
|
801
|
+
fxNewID(the, _ID), \
|
|
802
|
+
fxPush(_SLOT0), \
|
|
803
|
+
fxRunCount(the, 1), \
|
|
804
|
+
fxPop())
|
|
805
|
+
|
|
806
|
+
#define xsNew2(_THIS,_ID,_SLOT0,_SLOT1) \
|
|
807
|
+
(xsOverflow(-XS_FRAME_COUNT-2), \
|
|
808
|
+
fxPush(_THIS), \
|
|
809
|
+
fxNewID(the, _ID), \
|
|
810
|
+
fxPush(_SLOT0), \
|
|
811
|
+
fxPush(_SLOT1), \
|
|
812
|
+
fxRunCount(the, 2), \
|
|
813
|
+
fxPop())
|
|
814
|
+
|
|
815
|
+
#define xsNew3(_THIS,_ID,_SLOT0,_SLOT1,_SLOT2) \
|
|
816
|
+
(xsOverflow(-XS_FRAME_COUNT-3), \
|
|
817
|
+
fxPush(_THIS), \
|
|
818
|
+
fxNewID(the, _ID), \
|
|
819
|
+
fxPush(_SLOT0), \
|
|
820
|
+
fxPush(_SLOT1), \
|
|
821
|
+
fxPush(_SLOT2), \
|
|
822
|
+
fxRunCount(the, 3), \
|
|
823
|
+
fxPop())
|
|
824
|
+
|
|
825
|
+
#define xsNew4(_THIS,_ID,_SLOT0,_SLOT1,_SLOT2,_SLOT3) \
|
|
826
|
+
(xsOverflow(-XS_FRAME_COUNT-4), \
|
|
827
|
+
fxPush(_THIS), \
|
|
828
|
+
fxNewID(the, _ID), \
|
|
829
|
+
fxPush(_SLOT0), \
|
|
830
|
+
fxPush(_SLOT1), \
|
|
831
|
+
fxPush(_SLOT2), \
|
|
832
|
+
fxPush(_SLOT3), \
|
|
833
|
+
fxRunCount(the, 4), \
|
|
834
|
+
fxPop())
|
|
835
|
+
|
|
836
|
+
#define xsNew5(_THIS,_ID,_SLOT0,_SLOT1,_SLOT2,_SLOT3,_SLOT4) \
|
|
837
|
+
(xsOverflow(-XS_FRAME_COUNT-5), \
|
|
838
|
+
fxPush(_THIS), \
|
|
839
|
+
fxNewID(the, _ID), \
|
|
840
|
+
fxPush(_SLOT0), \
|
|
841
|
+
fxPush(_SLOT1), \
|
|
842
|
+
fxPush(_SLOT2), \
|
|
843
|
+
fxPush(_SLOT3), \
|
|
844
|
+
fxPush(_SLOT4), \
|
|
845
|
+
fxRunCount(the, 5), \
|
|
846
|
+
fxPop())
|
|
847
|
+
|
|
848
|
+
#define xsNew6(_THIS,_ID,_SLOT0,_SLOT1,_SLOT2,_SLOT3,_SLOT4,_SLOT5) \
|
|
849
|
+
(xsOverflow(-XS_FRAME_COUNT-6), \
|
|
850
|
+
fxPush(_THIS), \
|
|
851
|
+
fxNewID(the, _ID), \
|
|
852
|
+
fxPush(_SLOT0), \
|
|
853
|
+
fxPush(_SLOT1), \
|
|
854
|
+
fxPush(_SLOT2), \
|
|
855
|
+
fxPush(_SLOT3), \
|
|
856
|
+
fxPush(_SLOT4), \
|
|
857
|
+
fxPush(_SLOT5), \
|
|
858
|
+
fxRunCount(the, 6), \
|
|
859
|
+
fxPop())
|
|
860
|
+
|
|
861
|
+
#define xsNew7(_THIS,_ID,_SLOT0,_SLOT1,_SLOT2,_SLOT3,_SLOT4,_SLOT5,_SLOT6) \
|
|
862
|
+
(xsOverflow(-XS_FRAME_COUNT-7), \
|
|
863
|
+
fxPush(_THIS), \
|
|
864
|
+
fxNewID(the, _ID), \
|
|
865
|
+
fxPush(_SLOT0), \
|
|
866
|
+
fxPush(_SLOT1), \
|
|
867
|
+
fxPush(_SLOT2), \
|
|
868
|
+
fxPush(_SLOT3), \
|
|
869
|
+
fxPush(_SLOT4), \
|
|
870
|
+
fxPush(_SLOT5), \
|
|
871
|
+
fxPush(_SLOT6), \
|
|
872
|
+
fxRunCount(the, 7), \
|
|
873
|
+
fxPop())
|
|
874
|
+
|
|
875
|
+
#define xsNew8(_THIS,_ID,_SLOT0,_SLOT1,_SLOT2,_SLOT3,_SLOT4,_SLOT5,_SLOT6,_SLOT7) \
|
|
876
|
+
(xsOverflow(-XS_FRAME_COUNT-8), \
|
|
877
|
+
fxPush(_THIS), \
|
|
878
|
+
fxNewID(the, _ID), \
|
|
879
|
+
fxPush(_SLOT0), \
|
|
880
|
+
fxPush(_SLOT1), \
|
|
881
|
+
fxPush(_SLOT2), \
|
|
882
|
+
fxPush(_SLOT3), \
|
|
883
|
+
fxPush(_SLOT4), \
|
|
884
|
+
fxPush(_SLOT5), \
|
|
885
|
+
fxPush(_SLOT6), \
|
|
886
|
+
fxPush(_SLOT7), \
|
|
887
|
+
fxRunCount(the, 8), \
|
|
888
|
+
fxPop())
|
|
889
|
+
|
|
890
|
+
#define xsTest(_SLOT) \
|
|
891
|
+
(xsOverflow(-1), \
|
|
892
|
+
fxPush(_SLOT), \
|
|
893
|
+
fxRunTest(the))
|
|
894
|
+
|
|
895
|
+
/* Globals */
|
|
896
|
+
|
|
897
|
+
#define xsGlobal (the->stackTop[-1])
|
|
898
|
+
|
|
899
|
+
/* Host Constructors, Functions and Objects */
|
|
900
|
+
|
|
901
|
+
typedef void (*xsCallback)(xsMachine*);
|
|
902
|
+
|
|
903
|
+
struct xsHostBuilderRecord {
|
|
904
|
+
xsCallback callback;
|
|
905
|
+
xsIntegerValue length;
|
|
906
|
+
xsIdentifier id;
|
|
907
|
+
};
|
|
908
|
+
|
|
909
|
+
#define xsNewHostConstructor(_CALLBACK,_LENGTH,_PROTOTYPE) \
|
|
910
|
+
(xsOverflow(-1), \
|
|
911
|
+
fxPush(_PROTOTYPE), \
|
|
912
|
+
fxNewHostConstructor(the, _CALLBACK, _LENGTH, xsNoID), \
|
|
913
|
+
fxPop())
|
|
914
|
+
|
|
915
|
+
#define xsNewHostConstructorObject(_CALLBACK,_LENGTH,_PROTOTYPE, _NAME) \
|
|
916
|
+
(xsOverflow(-1), \
|
|
917
|
+
fxPush(_PROTOTYPE), \
|
|
918
|
+
fxNewHostConstructor(the, _CALLBACK, _LENGTH, _NAME), \
|
|
919
|
+
fxPop())
|
|
920
|
+
|
|
921
|
+
#define xsNewHostFunction(_CALLBACK,_LENGTH) \
|
|
922
|
+
(fxNewHostFunction(the, _CALLBACK, _LENGTH, xsNoID, xsNoID), \
|
|
923
|
+
fxPop())
|
|
924
|
+
|
|
925
|
+
#define xsNewHostFunctionObject(_CALLBACK,_LENGTH, _NAME) \
|
|
926
|
+
(fxNewHostFunction(the, _CALLBACK, _LENGTH, _NAME, xsNoID), \
|
|
927
|
+
fxPop())
|
|
928
|
+
|
|
929
|
+
#define xsNewHostInstance(_PROTOTYPE) \
|
|
930
|
+
(xsOverflow(-1), \
|
|
931
|
+
fxPush(_PROTOTYPE), \
|
|
932
|
+
fxNewHostInstance(the), \
|
|
933
|
+
fxPop())
|
|
934
|
+
|
|
935
|
+
typedef void (*xsDestructor)(void*);
|
|
936
|
+
|
|
937
|
+
#define xsNewHostObject(_DESTRUCTOR) \
|
|
938
|
+
(fxNewHostObject(the, _DESTRUCTOR), \
|
|
939
|
+
fxPop())
|
|
940
|
+
|
|
941
|
+
#define xsGetHostBufferLength(_SLOT) \
|
|
942
|
+
(the->scratch = (_SLOT), \
|
|
943
|
+
fxGetHostBufferLength(the, &(the->scratch)))
|
|
944
|
+
#define xsPetrifyHostBuffer(_SLOT) \
|
|
945
|
+
(the->scratch = (_SLOT), \
|
|
946
|
+
fxPetrifyHostBuffer(the, &(the->scratch)))
|
|
947
|
+
#define xsSetHostBuffer(_SLOT,_DATA,_SIZE) \
|
|
948
|
+
(the->scratch = (_SLOT), \
|
|
949
|
+
fxSetHostBuffer(the, &(the->scratch), _DATA, _SIZE))
|
|
950
|
+
|
|
951
|
+
#define xsGetHostChunk(_SLOT) \
|
|
952
|
+
(the->scratch = (_SLOT), \
|
|
953
|
+
fxGetHostChunk(the, &(the->scratch)))
|
|
954
|
+
#define xsSetHostChunk(_SLOT,_DATA,_SIZE) \
|
|
955
|
+
(the->scratch = (_SLOT), \
|
|
956
|
+
fxSetHostChunk(the, &(the->scratch), _DATA, _SIZE))
|
|
957
|
+
|
|
958
|
+
#define xsGetHostData(_SLOT) \
|
|
959
|
+
(the->scratch = (_SLOT), \
|
|
960
|
+
fxGetHostData(the, &(the->scratch)))
|
|
961
|
+
#define xsSetHostData(_SLOT,_DATA) \
|
|
962
|
+
(the->scratch = (_SLOT), \
|
|
963
|
+
fxSetHostData(the, &(the->scratch), _DATA))
|
|
964
|
+
|
|
965
|
+
#define xsGetHostDataValidate(_SLOT, validator) \
|
|
966
|
+
(the->scratch = (_SLOT), \
|
|
967
|
+
fxGetHostDataValidate(the, &(the->scratch), validator))
|
|
968
|
+
|
|
969
|
+
#define xsGetHostDestructor(_SLOT) \
|
|
970
|
+
(the->scratch = (_SLOT), \
|
|
971
|
+
fxGetHostDestructor(the, &(the->scratch)))
|
|
972
|
+
#define xsSetHostDestructor(_SLOT,_DESTRUCTOR) \
|
|
973
|
+
(the->scratch = (_SLOT), \
|
|
974
|
+
fxSetHostDestructor(the, &(the->scratch), _DESTRUCTOR))
|
|
975
|
+
|
|
976
|
+
#define xsGetHostHandle(_SLOT) \
|
|
977
|
+
(the->scratch = (_SLOT), \
|
|
978
|
+
fxGetHostHandle(the, &(the->scratch)))
|
|
979
|
+
|
|
980
|
+
typedef void (*xsMarkRoot)(xsMachine*, xsSlot*);
|
|
981
|
+
typedef void (*xsMarker)(xsMachine*, void*, xsMarkRoot);
|
|
982
|
+
typedef void (*xsSweepRoot)(xsMachine*, xsSlot*);
|
|
983
|
+
typedef void (*xsSweeper)(xsMachine*, void*, xsMarkRoot);
|
|
984
|
+
struct xsHostHooksStruct {
|
|
985
|
+
xsDestructor destructor;
|
|
986
|
+
xsMarker marker;
|
|
987
|
+
xsSweeper sweeper;
|
|
988
|
+
};
|
|
989
|
+
|
|
990
|
+
#define xsGetHostHooks(_SLOT) \
|
|
991
|
+
(the->scratch = (_SLOT), \
|
|
992
|
+
fxGetHostHooks(the, &(the->scratch)))
|
|
993
|
+
#define xsSetHostHooks(_SLOT,_HOOKS) \
|
|
994
|
+
(the->scratch = (_SLOT), \
|
|
995
|
+
fxSetHostHooks(the, &(the->scratch), _HOOKS))
|
|
996
|
+
|
|
997
|
+
#define xsBuildHosts(_COUNT, _BUILDERS) \
|
|
998
|
+
(fxBuildHosts(the, _COUNT, _BUILDERS), \
|
|
999
|
+
fxPop())
|
|
1000
|
+
|
|
1001
|
+
/* Arguments and Variables */
|
|
1002
|
+
|
|
1003
|
+
#define xsVars(_COUNT) fxVars(the, _COUNT)
|
|
1004
|
+
|
|
1005
|
+
#define xsThis (the->frame[4])
|
|
1006
|
+
#define xsFunction (the->frame[3])
|
|
1007
|
+
#define xsTarget (the->frame[2])
|
|
1008
|
+
#define xsResult (the->frame[1])
|
|
1009
|
+
#define xsArgc (the->frame[-1])
|
|
1010
|
+
#if mxBoundsCheck
|
|
1011
|
+
#define xsArg(_INDEX) (the->frame[-2 - fxCheckArg(the, _INDEX)])
|
|
1012
|
+
#else
|
|
1013
|
+
#define xsArg(_INDEX) (the->frame[-2 - (_INDEX)])
|
|
1014
|
+
#endif
|
|
1015
|
+
#define xsVarc (the->scope[0])
|
|
1016
|
+
#if mxBoundsCheck
|
|
1017
|
+
#define xsVar(_INDEX) (the->scope[-1 - fxCheckVar(the, _INDEX)])
|
|
1018
|
+
#else
|
|
1019
|
+
#define xsVar(_INDEX) (the->scope[-1 - (_INDEX)])
|
|
1020
|
+
#endif
|
|
1021
|
+
|
|
1022
|
+
/* Garbage Collector */
|
|
1023
|
+
|
|
1024
|
+
#define xsCollectGarbage() \
|
|
1025
|
+
fxCollectGarbage(the)
|
|
1026
|
+
#define xsEnableGarbageCollection(_ENABLE) \
|
|
1027
|
+
fxEnableGarbageCollection(the, _ENABLE)
|
|
1028
|
+
#define xsRemember(_SLOT) \
|
|
1029
|
+
fxRemember(the, &(_SLOT))
|
|
1030
|
+
#define xsForget(_SLOT) \
|
|
1031
|
+
fxForget(the, &(_SLOT))
|
|
1032
|
+
#define xsAccess(_SLOT) \
|
|
1033
|
+
(fxAccess(the, &(_SLOT)), the->scratch)
|
|
1034
|
+
|
|
1035
|
+
/* Exceptions */
|
|
1036
|
+
|
|
1037
|
+
struct xsJumpRecord {
|
|
1038
|
+
jmp_buf buffer;
|
|
1039
|
+
xsJump* nextJump;
|
|
1040
|
+
xsSlot* stack;
|
|
1041
|
+
xsSlot* scope;
|
|
1042
|
+
xsSlot* frame;
|
|
1043
|
+
xsSlot* environment;
|
|
1044
|
+
xsByte* code;
|
|
1045
|
+
xsBooleanValue flag;
|
|
1046
|
+
};
|
|
1047
|
+
|
|
1048
|
+
#define xsException (the->stackTop[-2])
|
|
1049
|
+
|
|
1050
|
+
#ifdef mxDebug
|
|
1051
|
+
#define xsThrow(_SLOT) \
|
|
1052
|
+
(the->stackTop[-2] = (_SLOT), \
|
|
1053
|
+
fxThrow(the,(char *)__FILE__,__LINE__))
|
|
1054
|
+
#else
|
|
1055
|
+
#define xsThrow(_SLOT) \
|
|
1056
|
+
(the->stackTop[-2] = (_SLOT), \
|
|
1057
|
+
fxThrow(the,NULL,0))
|
|
1058
|
+
#endif
|
|
1059
|
+
|
|
1060
|
+
#define xsTry \
|
|
1061
|
+
xsJump __JUMP__; \
|
|
1062
|
+
__JUMP__.nextJump = the->firstJump; \
|
|
1063
|
+
__JUMP__.stack = the->stack; \
|
|
1064
|
+
__JUMP__.scope = the->scope; \
|
|
1065
|
+
__JUMP__.frame = the->frame; \
|
|
1066
|
+
__JUMP__.environment = NULL; \
|
|
1067
|
+
__JUMP__.code = the->code; \
|
|
1068
|
+
__JUMP__.flag = 0; \
|
|
1069
|
+
the->firstJump = &__JUMP__; \
|
|
1070
|
+
if (setjmp(__JUMP__.buffer) == 0) {
|
|
1071
|
+
|
|
1072
|
+
#define xsCatch \
|
|
1073
|
+
the->firstJump = __JUMP__.nextJump; \
|
|
1074
|
+
} \
|
|
1075
|
+
else for ( \
|
|
1076
|
+
the->stack = __JUMP__.stack, \
|
|
1077
|
+
the->scope = __JUMP__.scope, \
|
|
1078
|
+
the->frame = __JUMP__.frame, \
|
|
1079
|
+
the->code = __JUMP__.code, \
|
|
1080
|
+
the->firstJump = __JUMP__.nextJump; \
|
|
1081
|
+
(__JUMP__.stack); \
|
|
1082
|
+
__JUMP__.stack = NULL)
|
|
1083
|
+
|
|
1084
|
+
/* Errors */
|
|
1085
|
+
|
|
1086
|
+
#ifndef __XSALL__
|
|
1087
|
+
enum {
|
|
1088
|
+
XS_NO_ERROR = 0,
|
|
1089
|
+
XS_UNKNOWN_ERROR,
|
|
1090
|
+
XS_EVAL_ERROR,
|
|
1091
|
+
XS_RANGE_ERROR,
|
|
1092
|
+
XS_REFERENCE_ERROR,
|
|
1093
|
+
XS_SYNTAX_ERROR,
|
|
1094
|
+
XS_TYPE_ERROR,
|
|
1095
|
+
XS_URI_ERROR,
|
|
1096
|
+
XS_ERROR_COUNT
|
|
1097
|
+
};
|
|
1098
|
+
#endif
|
|
1099
|
+
|
|
1100
|
+
#ifdef mxDebug
|
|
1101
|
+
#define xsUnknownError(...) fxThrowMessage(the, (char *)__FILE__, __LINE__, XS_UNKNOWN_ERROR, __VA_ARGS__)
|
|
1102
|
+
#define xsEvalError(...) fxThrowMessage(the, (char *)__FILE__, __LINE__, XS_EVAL_ERROR, __VA_ARGS__)
|
|
1103
|
+
#define xsRangeError(...) fxThrowMessage(the, (char *)__FILE__, __LINE__, XS_RANGE_ERROR, __VA_ARGS__)
|
|
1104
|
+
#define xsReferenceError(...) fxThrowMessage(the, (char *)__FILE__, __LINE__, XS_REFERENCE_ERROR, __VA_ARGS__)
|
|
1105
|
+
#define xsSyntaxError(...) fxThrowMessage(the, (char *)__FILE__, __LINE__, XS_SYNTAX_ERROR, __VA_ARGS__)
|
|
1106
|
+
#define xsTypeError(...) fxThrowMessage(the, (char *)__FILE__, __LINE__, XS_TYPE_ERROR, __VA_ARGS__)
|
|
1107
|
+
#define xsURIError(...) fxThrowMessage(the, (char *)__FILE__, __LINE__, XS_URI_ERROR, __VA_ARGS__)
|
|
1108
|
+
#else
|
|
1109
|
+
#define xsUnknownError(...) fxThrowMessage(the, NULL, 0, XS_UNKNOWN_ERROR, __VA_ARGS__)
|
|
1110
|
+
#define xsEvalError(...) fxThrowMessage(the, NULL, 0, XS_EVAL_ERROR, __VA_ARGS__)
|
|
1111
|
+
#define xsRangeError(...) fxThrowMessage(the, NULL, 0, XS_RANGE_ERROR, __VA_ARGS__)
|
|
1112
|
+
#define xsReferenceError(...) fxThrowMessage(the, NULL, 0, XS_REFERENCE_ERROR, __VA_ARGS__)
|
|
1113
|
+
#define xsSyntaxError(...) fxThrowMessage(the, NULL, 0, XS_SYNTAX_ERROR, __VA_ARGS__)
|
|
1114
|
+
#define xsTypeError(...) fxThrowMessage(the, NULL, 0, XS_TYPE_ERROR, __VA_ARGS__)
|
|
1115
|
+
#define xsURIError(...) fxThrowMessage(the, NULL, 0, XS_URI_ERROR, __VA_ARGS__)
|
|
1116
|
+
#endif
|
|
1117
|
+
|
|
1118
|
+
/* Platform */
|
|
1119
|
+
|
|
1120
|
+
#ifdef mxDebug
|
|
1121
|
+
#define xsAssert(it)\
|
|
1122
|
+
if (!(it)) fxThrowMessage(the, (char *)__FILE__, __LINE__, XS_UNKNOWN_ERROR, "%s", #it)
|
|
1123
|
+
#define xsErrorPrintf(_MESSAGE) \
|
|
1124
|
+
fxThrowMessage(the, (char *)__FILE__, __LINE__, XS_UNKNOWN_ERROR, "%s", _MESSAGE)
|
|
1125
|
+
#else
|
|
1126
|
+
#define xsAssert(it)\
|
|
1127
|
+
if (!(it)) fxThrowMessage(the, NULL, 0, XS_UNKNOWN_ERROR, "%s", #it)
|
|
1128
|
+
#define xsErrorPrintf(_MESSAGE) \
|
|
1129
|
+
fxThrowMessage(the, NULL, 0, XS_UNKNOWN_ERROR, "%s", _MESSAGE)
|
|
1130
|
+
#endif
|
|
1131
|
+
|
|
1132
|
+
/* Debugger */
|
|
1133
|
+
|
|
1134
|
+
#ifdef mxDebug
|
|
1135
|
+
#define xsDebugger() \
|
|
1136
|
+
fxDebugger(the,(char *)__FILE__,__LINE__)
|
|
1137
|
+
#else
|
|
1138
|
+
#define xsDebugger() \
|
|
1139
|
+
fxDebugger(the,NULL,0)
|
|
1140
|
+
#endif
|
|
1141
|
+
|
|
1142
|
+
#define xsTrace(_STRING) \
|
|
1143
|
+
fxReport(the, "%s", _STRING)
|
|
1144
|
+
#define xsTraceCenter(_STRING,_ID) \
|
|
1145
|
+
fxBubble(the, 0, _STRING, 0, _ID)
|
|
1146
|
+
#define xsTraceLeft(_STRING,_ID) \
|
|
1147
|
+
fxBubble(the, 1, _STRING, 0, _ID)
|
|
1148
|
+
#define xsTraceRight(_STRING,_ID) \
|
|
1149
|
+
fxBubble(the, 2, _STRING, 0, _ID)
|
|
1150
|
+
#define xsTraceCenterBytes(_BUFFER,_LENGTH,_ID) \
|
|
1151
|
+
fxBubble(the, 4, _BUFFER, _LENGTH, _ID)
|
|
1152
|
+
#define xsTraceLeftBytes(_BUFFER,_LENGTH,_ID) \
|
|
1153
|
+
fxBubble(the, 5, _BUFFER, _LENGTH, _ID)
|
|
1154
|
+
#define xsTraceRightBytes(_BUFFER,_LENGTH,_ID) \
|
|
1155
|
+
fxBubble(the, 6, _BUFFER, _LENGTH, _ID)
|
|
1156
|
+
|
|
1157
|
+
#define xsLog(...) \
|
|
1158
|
+
fxReport(the, __VA_ARGS__)
|
|
1159
|
+
|
|
1160
|
+
#if defined(mxDebug) || 1
|
|
1161
|
+
#define xsLogDebug(...) \
|
|
1162
|
+
fxReport(__VA_ARGS__)
|
|
1163
|
+
#else
|
|
1164
|
+
#define xsLogDebug(...)
|
|
1165
|
+
#endif
|
|
1166
|
+
|
|
1167
|
+
typedef xsCallback (*xsCallbackAt)(xsIndex);
|
|
1168
|
+
|
|
1169
|
+
/* Machine */
|
|
1170
|
+
|
|
1171
|
+
struct xsMachineRecord {
|
|
1172
|
+
xsSlot* stack;
|
|
1173
|
+
xsSlot* scope;
|
|
1174
|
+
xsSlot* frame;
|
|
1175
|
+
xsByte* code;
|
|
1176
|
+
xsSlot* stackBottom;
|
|
1177
|
+
xsSlot* stackTop;
|
|
1178
|
+
xsSlot* stackPrototypes;
|
|
1179
|
+
xsJump* firstJump;
|
|
1180
|
+
void* context;
|
|
1181
|
+
void* archive;
|
|
1182
|
+
xsSlot scratch;
|
|
1183
|
+
#ifndef __XSALL__
|
|
1184
|
+
xsMachinePlatform
|
|
1185
|
+
#endif
|
|
1186
|
+
};
|
|
1187
|
+
|
|
1188
|
+
struct xsCreationRecord {
|
|
1189
|
+
xsIntegerValue initialChunkSize;
|
|
1190
|
+
xsIntegerValue incrementalChunkSize;
|
|
1191
|
+
xsIntegerValue initialHeapCount;
|
|
1192
|
+
xsIntegerValue incrementalHeapCount;
|
|
1193
|
+
xsIntegerValue stackCount;
|
|
1194
|
+
xsIntegerValue initialKeyCount;
|
|
1195
|
+
xsIntegerValue incrementalKeyCount;
|
|
1196
|
+
xsIntegerValue nameModulo;
|
|
1197
|
+
xsIntegerValue symbolModulo;
|
|
1198
|
+
xsIntegerValue parserBufferSize;
|
|
1199
|
+
xsIntegerValue parserTableModulo;
|
|
1200
|
+
xsIntegerValue staticSize;
|
|
1201
|
+
};
|
|
1202
|
+
|
|
1203
|
+
#define xsCreateMachine(_CREATION,_NAME,_CONTEXT) \
|
|
1204
|
+
fxCreateMachine(_CREATION, _NAME, _CONTEXT, xsNoID)
|
|
1205
|
+
|
|
1206
|
+
#define xsDeleteMachine(_THE) \
|
|
1207
|
+
fxDeleteMachine(_THE)
|
|
1208
|
+
|
|
1209
|
+
#define xsCloneMachine(_CREATION,_MACHINE,_NAME,_CONTEXT) \
|
|
1210
|
+
fxCloneMachine(_CREATION, _MACHINE, _NAME, _CONTEXT)
|
|
1211
|
+
|
|
1212
|
+
#define xsPrepareMachine(_CREATION,_PREPARATION,_NAME, _CONTEXT, _ARCHIVE) \
|
|
1213
|
+
fxPrepareMachine(_CREATION, _PREPARATION, _NAME, _CONTEXT, _ARCHIVE)
|
|
1214
|
+
|
|
1215
|
+
#define xsShareMachine(_THE) \
|
|
1216
|
+
fxShareMachine(_THE)
|
|
1217
|
+
|
|
1218
|
+
/* Context */
|
|
1219
|
+
|
|
1220
|
+
#define xsGetContext(_THE) \
|
|
1221
|
+
((_THE)->context)
|
|
1222
|
+
|
|
1223
|
+
#define xsSetContext(_THE,_CONTEXT) \
|
|
1224
|
+
((_THE)->context = (_CONTEXT))
|
|
1225
|
+
|
|
1226
|
+
/* Host */
|
|
1227
|
+
|
|
1228
|
+
#define xsBeginHost(_THE) \
|
|
1229
|
+
do { \
|
|
1230
|
+
xsMachine* __HOST_THE__ = _THE; \
|
|
1231
|
+
xsJump __HOST_JUMP__; \
|
|
1232
|
+
__HOST_JUMP__.nextJump = (__HOST_THE__)->firstJump; \
|
|
1233
|
+
__HOST_JUMP__.stack = (__HOST_THE__)->stack; \
|
|
1234
|
+
__HOST_JUMP__.scope = (__HOST_THE__)->scope; \
|
|
1235
|
+
__HOST_JUMP__.frame = (__HOST_THE__)->frame; \
|
|
1236
|
+
__HOST_JUMP__.environment = NULL; \
|
|
1237
|
+
__HOST_JUMP__.code = (__HOST_THE__)->code; \
|
|
1238
|
+
__HOST_JUMP__.flag = 0; \
|
|
1239
|
+
(__HOST_THE__)->firstJump = &__HOST_JUMP__; \
|
|
1240
|
+
if (setjmp(__HOST_JUMP__.buffer) == 0) { \
|
|
1241
|
+
xsMachine* the = fxBeginHost(__HOST_THE__)
|
|
1242
|
+
|
|
1243
|
+
#define xsEndHost(_THE) \
|
|
1244
|
+
fxEndHost(the); \
|
|
1245
|
+
the = NULL; \
|
|
1246
|
+
} \
|
|
1247
|
+
else \
|
|
1248
|
+
fxAbort(__HOST_THE__, xsUnhandledExceptionExit); \
|
|
1249
|
+
(__HOST_THE__)->stack = __HOST_JUMP__.stack, \
|
|
1250
|
+
(__HOST_THE__)->scope = __HOST_JUMP__.scope, \
|
|
1251
|
+
(__HOST_THE__)->frame = __HOST_JUMP__.frame, \
|
|
1252
|
+
(__HOST_THE__)->code = __HOST_JUMP__.code, \
|
|
1253
|
+
(__HOST_THE__)->firstJump = __HOST_JUMP__.nextJump; \
|
|
1254
|
+
break; \
|
|
1255
|
+
} while(1)
|
|
1256
|
+
|
|
1257
|
+
#ifdef mxMetering
|
|
1258
|
+
|
|
1259
|
+
#define xsBeginMetering(_THE, _CALLBACK, _STEP) \
|
|
1260
|
+
do { \
|
|
1261
|
+
xsJump __HOST_JUMP__; \
|
|
1262
|
+
__HOST_JUMP__.nextJump = (_THE)->firstJump; \
|
|
1263
|
+
__HOST_JUMP__.stack = (_THE)->stack; \
|
|
1264
|
+
__HOST_JUMP__.scope = (_THE)->scope; \
|
|
1265
|
+
__HOST_JUMP__.frame = (_THE)->frame; \
|
|
1266
|
+
__HOST_JUMP__.environment = NULL; \
|
|
1267
|
+
__HOST_JUMP__.code = (_THE)->code; \
|
|
1268
|
+
__HOST_JUMP__.flag = 0; \
|
|
1269
|
+
(_THE)->firstJump = &__HOST_JUMP__; \
|
|
1270
|
+
if (setjmp(__HOST_JUMP__.buffer) == 0) { \
|
|
1271
|
+
fxBeginMetering(_THE, _CALLBACK, _STEP)
|
|
1272
|
+
|
|
1273
|
+
#define xsEndMetering(_THE) \
|
|
1274
|
+
fxEndMetering(_THE); \
|
|
1275
|
+
} \
|
|
1276
|
+
(_THE)->stack = __HOST_JUMP__.stack, \
|
|
1277
|
+
(_THE)->scope = __HOST_JUMP__.scope, \
|
|
1278
|
+
(_THE)->frame = __HOST_JUMP__.frame, \
|
|
1279
|
+
(_THE)->code = __HOST_JUMP__.code, \
|
|
1280
|
+
(_THE)->firstJump = __HOST_JUMP__.nextJump; \
|
|
1281
|
+
break; \
|
|
1282
|
+
} while(1)
|
|
1283
|
+
|
|
1284
|
+
#else
|
|
1285
|
+
#define xsBeginMetering(_THE, _CALLBACK, _STEP)
|
|
1286
|
+
#define xsEndMetering(_THE)
|
|
1287
|
+
#endif
|
|
1288
|
+
|
|
1289
|
+
enum {
|
|
1290
|
+
xsNoID = 0,
|
|
1291
|
+
xsDefault = 0,
|
|
1292
|
+
xsDontDelete = 2,
|
|
1293
|
+
xsDontEnum = 4,
|
|
1294
|
+
xsDontSet = 8,
|
|
1295
|
+
xsStatic = 16,
|
|
1296
|
+
xsIsGetter = 32,
|
|
1297
|
+
xsIsSetter = 64,
|
|
1298
|
+
xsChangeAll = 30
|
|
1299
|
+
};
|
|
1300
|
+
typedef unsigned char xsAttribute;
|
|
1301
|
+
|
|
1302
|
+
#define xsArrayCacheBegin(_ARRAY) \
|
|
1303
|
+
(fxPush(_ARRAY), \
|
|
1304
|
+
fxArrayCacheBegin(the, the->stack), \
|
|
1305
|
+
the->stack++)
|
|
1306
|
+
#define xsArrayCacheEnd(_ARRAY) \
|
|
1307
|
+
(fxPush(_ARRAY), \
|
|
1308
|
+
fxArrayCacheEnd(the, the->stack), \
|
|
1309
|
+
the->stack++)
|
|
1310
|
+
#define xsArrayCacheItem(_ARRAY,_ITEM) \
|
|
1311
|
+
(fxPush(_ARRAY), \
|
|
1312
|
+
fxPush(_ITEM), \
|
|
1313
|
+
fxArrayCacheItem(the, the->stack + 1, the->stack), \
|
|
1314
|
+
the->stack += 2)
|
|
1315
|
+
|
|
1316
|
+
#define xsDemarshall(_DATA) \
|
|
1317
|
+
(fxDemarshall(the, (_DATA), 0), \
|
|
1318
|
+
fxPop())
|
|
1319
|
+
#define xsDemarshallAlien(_DATA) \
|
|
1320
|
+
(fxDemarshall(the, (_DATA), 1), \
|
|
1321
|
+
fxPop())
|
|
1322
|
+
#define xsMarshall(_SLOT) \
|
|
1323
|
+
(xsOverflow(-1), \
|
|
1324
|
+
fxPush(_SLOT), \
|
|
1325
|
+
fxMarshall(the, 0))
|
|
1326
|
+
#define xsMarshallAlien(_SLOT) \
|
|
1327
|
+
(xsOverflow(-1), \
|
|
1328
|
+
fxPush(_SLOT), \
|
|
1329
|
+
fxMarshall(the, 1))
|
|
1330
|
+
|
|
1331
|
+
#define xsIsProfiling() \
|
|
1332
|
+
fxIsProfiling(the)
|
|
1333
|
+
#define xsStartProfiling() \
|
|
1334
|
+
fxStartProfiling(the)
|
|
1335
|
+
#define xsStopProfiling() \
|
|
1336
|
+
fxStopProfiling(the, C_NULL)
|
|
1337
|
+
|
|
1338
|
+
#ifndef __XSALL__
|
|
1339
|
+
enum {
|
|
1340
|
+
XS_IMPORT_NAMESPACE = 0,
|
|
1341
|
+
XS_IMPORT_DEFAULT = 1,
|
|
1342
|
+
XS_IMPORT_PREFLIGHT = 2,
|
|
1343
|
+
XS_IMPORT_ASYNC = 4,
|
|
1344
|
+
};
|
|
1345
|
+
#endif
|
|
1346
|
+
|
|
1347
|
+
#define xsAwaitImport(_NAME,_FLAG) \
|
|
1348
|
+
(xsOverflow(-1), \
|
|
1349
|
+
fxStringX(the, --the->stack, (xsStringValue)_NAME), \
|
|
1350
|
+
fxAwaitImport(the, _FLAG), \
|
|
1351
|
+
fxPop())
|
|
1352
|
+
|
|
1353
|
+
enum {
|
|
1354
|
+
xsDebuggerExit = 0,
|
|
1355
|
+
xsNotEnoughMemoryExit,
|
|
1356
|
+
xsStackOverflowExit,
|
|
1357
|
+
xsFatalCheckExit,
|
|
1358
|
+
xsDeadStripExit,
|
|
1359
|
+
xsUnhandledExceptionExit,
|
|
1360
|
+
xsNoMoreKeysExit,
|
|
1361
|
+
xsTooMuchComputationExit,
|
|
1362
|
+
xsUnhandledRejectionExit,
|
|
1363
|
+
};
|
|
1364
|
+
|
|
1365
|
+
#ifndef __XSALL__
|
|
1366
|
+
|
|
1367
|
+
#ifdef __cplusplus
|
|
1368
|
+
extern "C" {
|
|
1369
|
+
#endif
|
|
1370
|
+
|
|
1371
|
+
mxImport xsType fxTypeOf(xsMachine*, xsSlot*);
|
|
1372
|
+
mxImport xsBooleanValue fxIsCallable(xsMachine*, xsSlot*);
|
|
1373
|
+
|
|
1374
|
+
mxImport void fxUndefined(xsMachine*, xsSlot*);
|
|
1375
|
+
mxImport void fxNull(xsMachine*, xsSlot*);
|
|
1376
|
+
mxImport void fxBoolean(xsMachine*, xsSlot*, xsBooleanValue);
|
|
1377
|
+
mxImport xsBooleanValue fxToBoolean(xsMachine*, xsSlot*);
|
|
1378
|
+
mxImport void fxInteger(xsMachine*, xsSlot*, xsIntegerValue);
|
|
1379
|
+
mxImport xsIntegerValue fxToInteger(xsMachine*, xsSlot*);
|
|
1380
|
+
mxImport void fxNumber(xsMachine*, xsSlot*, xsNumberValue);
|
|
1381
|
+
mxImport xsNumberValue fxToNumber(xsMachine*, xsSlot*);
|
|
1382
|
+
mxImport void fxString(xsMachine*, xsSlot*, xsStringValue);
|
|
1383
|
+
mxImport void fxStringBuffer(xsMachine*, xsSlot*, xsStringValue, xsIntegerValue);
|
|
1384
|
+
mxImport void fxStringX(xsMachine*, xsSlot*, xsStringValue);
|
|
1385
|
+
mxImport xsStringValue fxToString(xsMachine*, xsSlot*);
|
|
1386
|
+
mxImport xsStringValue fxToStringBuffer(xsMachine*, xsSlot*, xsStringValue, xsIntegerValue);
|
|
1387
|
+
mxImport xsStringValue fxToStringX(xsMachine*, xsSlot*);
|
|
1388
|
+
mxImport void fxUnsigned(xsMachine*, xsSlot*, xsUnsignedValue);
|
|
1389
|
+
mxImport xsUnsignedValue fxToUnsigned(xsMachine*, xsSlot*);
|
|
1390
|
+
|
|
1391
|
+
mxImport void *fxArrayBuffer(xsMachine*, xsSlot*, void*, xsIntegerValue, xsIntegerValue);
|
|
1392
|
+
mxImport void fxGetArrayBufferData(xsMachine*, xsSlot*, xsIntegerValue, void*, xsIntegerValue);
|
|
1393
|
+
mxImport xsIntegerValue fxGetArrayBufferLength(xsMachine*, xsSlot*);
|
|
1394
|
+
mxImport xsIntegerValue fxGetArrayBufferMaxLength(xsMachine*, xsSlot*);
|
|
1395
|
+
mxImport void fxSetArrayBufferData(xsMachine*, xsSlot*, xsIntegerValue, void*, xsIntegerValue);
|
|
1396
|
+
mxImport void fxSetArrayBufferLength(xsMachine*, xsSlot*, xsIntegerValue);
|
|
1397
|
+
mxImport void* fxToArrayBuffer(xsMachine*, xsSlot*);
|
|
1398
|
+
|
|
1399
|
+
mxImport void fxClosure(xsMachine*, xsSlot*, xsSlot*);
|
|
1400
|
+
mxImport xsSlot* fxToClosure(xsMachine*, xsSlot*);
|
|
1401
|
+
mxImport void fxReference(xsMachine*, xsSlot*, xsSlot*);
|
|
1402
|
+
mxImport xsSlot* fxToReference(xsMachine*, xsSlot*);
|
|
1403
|
+
|
|
1404
|
+
mxImport xsSlot* fxNewArray(xsMachine*, xsIntegerValue);
|
|
1405
|
+
mxImport xsSlot* fxNewObject(xsMachine*);
|
|
1406
|
+
mxImport xsBooleanValue fxIsInstanceOf(xsMachine*);
|
|
1407
|
+
mxImport void fxArrayCacheBegin(xsMachine*, xsSlot*);
|
|
1408
|
+
mxImport void fxArrayCacheEnd(xsMachine*, xsSlot*);
|
|
1409
|
+
mxImport void fxArrayCacheItem(xsMachine*, xsSlot*, xsSlot*);
|
|
1410
|
+
|
|
1411
|
+
mxImport void fxBuildHosts(xsMachine*, xsIntegerValue, xsHostBuilder*);
|
|
1412
|
+
mxImport void fxNewHostConstructor(xsMachine*, xsCallback, xsIntegerValue, xsIntegerValue);
|
|
1413
|
+
mxImport void fxNewHostFunction(xsMachine*, xsCallback, xsIntegerValue, xsIntegerValue, xsIntegerValue);
|
|
1414
|
+
mxImport void fxNewHostInstance(xsMachine*);
|
|
1415
|
+
mxImport xsSlot* fxNewHostObject(xsMachine*, xsDestructor);
|
|
1416
|
+
mxImport xsIntegerValue fxGetHostBufferLength(xsMachine*, xsSlot*);
|
|
1417
|
+
mxImport void* fxGetHostChunk(xsMachine*, xsSlot*);
|
|
1418
|
+
mxImport void* fxGetHostChunkValidate(xsMachine*, xsSlot*, void*);
|
|
1419
|
+
mxImport void *fxSetHostChunk(xsMachine*, xsSlot*, void*, xsIntegerValue);
|
|
1420
|
+
mxImport void* fxGetHostData(xsMachine*, xsSlot*);
|
|
1421
|
+
mxImport void* fxGetHostDataValidate(xsMachine* the, xsSlot* slot, void*);
|
|
1422
|
+
mxImport void fxPetrifyHostBuffer(xsMachine* the, xsSlot* slot);
|
|
1423
|
+
mxImport void fxSetHostBuffer(xsMachine*, xsSlot*, void*, xsIntegerValue);
|
|
1424
|
+
mxImport void fxSetHostData(xsMachine*, xsSlot*, void*);
|
|
1425
|
+
mxImport xsDestructor fxGetHostDestructor(xsMachine*, xsSlot*);
|
|
1426
|
+
mxImport void fxSetHostDestructor(xsMachine*, xsSlot*, xsDestructor);
|
|
1427
|
+
mxImport void* fxGetHostHandle(xsMachine*, xsSlot*);
|
|
1428
|
+
mxImport xsHostHooks* fxGetHostHooks(xsMachine*, xsSlot*);
|
|
1429
|
+
mxImport void fxSetHostHooks(xsMachine*, xsSlot*, const xsHostHooks*);
|
|
1430
|
+
|
|
1431
|
+
mxImport xsIdentifier fxID(xsMachine*, const char*);
|
|
1432
|
+
mxImport xsIdentifier fxFindID(xsMachine*, char*);
|
|
1433
|
+
mxImport xsBooleanValue fxIsID(xsMachine*, char*);
|
|
1434
|
+
mxImport xsIdentifier fxToID(xsMachine*, xsSlot*);
|
|
1435
|
+
mxImport char* fxName(xsMachine*, xsIdentifier);
|
|
1436
|
+
|
|
1437
|
+
mxImport void fxEnumerate(xsMachine* the);
|
|
1438
|
+
mxImport void fxGetAt(xsMachine*);
|
|
1439
|
+
mxImport void fxGetID(xsMachine*, xsIdentifier);
|
|
1440
|
+
mxImport void fxGetIndex(xsMachine*, xsIndex);
|
|
1441
|
+
mxImport xsBooleanValue fxHasAt(xsMachine*);
|
|
1442
|
+
mxImport xsBooleanValue fxHasID(xsMachine*, xsIdentifier);
|
|
1443
|
+
mxImport xsBooleanValue fxHasIndex(xsMachine*, xsIndex);
|
|
1444
|
+
mxImport void fxSetAt(xsMachine*);
|
|
1445
|
+
mxImport void fxSetID(xsMachine*, xsIdentifier);
|
|
1446
|
+
mxImport void fxSetIndex(xsMachine*, xsIndex);
|
|
1447
|
+
mxImport void fxDefineAt(xsMachine*, xsAttribute, xsAttribute);
|
|
1448
|
+
mxImport void fxDefineID(xsMachine*, xsIdentifier, xsAttribute, xsAttribute);
|
|
1449
|
+
mxImport void fxDeleteAt(xsMachine*);
|
|
1450
|
+
mxImport void fxDeleteID(xsMachine*, xsIdentifier);
|
|
1451
|
+
mxImport void fxCall(xsMachine*);
|
|
1452
|
+
mxImport void fxCallID(xsMachine*, xsIdentifier);
|
|
1453
|
+
mxImport void fxNew(xsMachine*);
|
|
1454
|
+
mxImport void fxNewID(xsMachine*, xsIdentifier);
|
|
1455
|
+
mxImport void fxRunCount(xsMachine*, xsIntegerValue);
|
|
1456
|
+
mxImport xsBooleanValue fxRunTest(xsMachine* the);
|
|
1457
|
+
|
|
1458
|
+
mxImport void fxVars(xsMachine*, xsIntegerValue);
|
|
1459
|
+
mxImport xsIntegerValue fxCheckArg(xsMachine*, xsIntegerValue);
|
|
1460
|
+
mxImport xsIntegerValue fxCheckVar(xsMachine*, xsIntegerValue);
|
|
1461
|
+
mxImport void fxOverflow(xsMachine*, xsIntegerValue, xsStringValue, xsIntegerValue);
|
|
1462
|
+
|
|
1463
|
+
mxImport void fxThrow(xsMachine*, xsStringValue, xsIntegerValue) XS_FUNCTION_NORETURN;
|
|
1464
|
+
mxImport void fxThrowMessage(xsMachine* the, xsStringValue thePath, xsIntegerValue theLine, xsIntegerValue theError, xsStringValue theMessage, ...) XS_FUNCTION_NORETURN;
|
|
1465
|
+
|
|
1466
|
+
mxImport void fxBubble(xsMachine*, xsIntegerValue, void*, xsIntegerValue, xsStringValue);
|
|
1467
|
+
mxImport void fxDebugger(xsMachine*, xsStringValue, xsIntegerValue);
|
|
1468
|
+
mxImport void fxReport(xsMachine*, xsStringValue, ...);
|
|
1469
|
+
|
|
1470
|
+
mxImport xsMachine* fxCreateMachine(xsCreation*, xsStringValue, void*, xsIdentifier);
|
|
1471
|
+
mxImport void fxDeleteMachine(xsMachine*);
|
|
1472
|
+
mxImport xsMachine* fxCloneMachine(xsCreation*, xsMachine*, xsStringValue, void*);
|
|
1473
|
+
mxImport xsMachine* fxPrepareMachine(xsCreation*, void*, xsStringValue, void*, void*);
|
|
1474
|
+
mxImport void fxShareMachine(xsMachine*);
|
|
1475
|
+
|
|
1476
|
+
mxImport xsMachine* fxBeginHost(xsMachine*);
|
|
1477
|
+
mxImport void fxEndHost(xsMachine*);
|
|
1478
|
+
|
|
1479
|
+
mxImport void fxCollectGarbage(xsMachine*);
|
|
1480
|
+
mxImport void fxEnableGarbageCollection(xsMachine* the, xsBooleanValue enableIt);
|
|
1481
|
+
|
|
1482
|
+
mxImport xsSlot* fxDuplicateSlot(xsMachine*, xsSlot*);
|
|
1483
|
+
mxImport void* fxNewChunk(xsMachine*, xsIntegerValue);
|
|
1484
|
+
mxImport void* fxRenewChunk(xsMachine*, void*, xsIntegerValue);
|
|
1485
|
+
|
|
1486
|
+
mxImport void fxRemember(xsMachine*, xsSlot*);
|
|
1487
|
+
mxImport void fxForget(xsMachine*, xsSlot*);
|
|
1488
|
+
mxImport void fxAccess(xsMachine*, xsSlot*);
|
|
1489
|
+
|
|
1490
|
+
mxImport void fxDecodeURI(xsMachine*, xsStringValue);
|
|
1491
|
+
mxImport void fxEncodeURI(xsMachine*, xsStringValue);
|
|
1492
|
+
|
|
1493
|
+
mxImport xsStringValue fxUTF8Decode(xsStringValue string, xsIntegerValue* character);
|
|
1494
|
+
mxImport xsStringValue fxUTF8Encode(xsStringValue string, xsIntegerValue character);
|
|
1495
|
+
mxImport xsIntegerValue fxUTF8Length(xsIntegerValue character);
|
|
1496
|
+
mxImport xsIntegerValue fxUTF8ToUnicodeOffset(xsStringValue theString, xsIntegerValue theOffset);
|
|
1497
|
+
mxImport xsIntegerValue fxUnicodeLength(xsStringValue theString);
|
|
1498
|
+
mxImport xsIntegerValue fxUnicodeToUTF8Offset(xsStringValue theString, xsIntegerValue theOffset);
|
|
1499
|
+
|
|
1500
|
+
mxImport xsStringValue fxIntegerToString(xsMachine*, xsIntegerValue, xsStringValue, xsIntegerValue);
|
|
1501
|
+
mxImport xsStringValue fxNumberToString(xsMachine*, xsNumberValue, xsStringValue, xsIntegerValue, char theMode, xsIntegerValue thePrecision);
|
|
1502
|
+
mxImport xsNumberValue fxStringToNumber(xsMachine*, xsStringValue theString, unsigned char whole);
|
|
1503
|
+
|
|
1504
|
+
mxImport void fxDemarshall(xsMachine*, void*, xsBooleanValue);
|
|
1505
|
+
mxImport void* fxMarshall(xsMachine*, xsBooleanValue);
|
|
1506
|
+
|
|
1507
|
+
mxImport xsBooleanValue fxIsProfiling(xsMachine*);
|
|
1508
|
+
mxImport void fxStartProfiling(xsMachine*);
|
|
1509
|
+
mxImport void fxStopProfiling(xsMachine*, void*);
|
|
1510
|
+
|
|
1511
|
+
mxImport void* fxGetArchiveCode(xsMachine*, void*, xsStringValue, size_t*);
|
|
1512
|
+
mxImport xsIntegerValue fxGetArchiveCodeCount(xsMachine*, void*);
|
|
1513
|
+
mxImport void* fxGetArchiveCodeName(xsMachine*, void*, xsIntegerValue);
|
|
1514
|
+
mxImport void* fxGetArchiveData(xsMachine*, void*, xsStringValue, size_t*);
|
|
1515
|
+
mxImport xsIntegerValue fxGetArchiveDataCount(xsMachine*, void*);
|
|
1516
|
+
mxImport void* fxGetArchiveDataName(xsMachine*, void*, xsIntegerValue);
|
|
1517
|
+
|
|
1518
|
+
mxImport void fxAwaitImport(xsMachine*, xsBooleanValue);
|
|
1519
|
+
|
|
1520
|
+
mxImport xsBooleanValue fxCompileRegExp(xsMachine* the, xsStringValue pattern, xsStringValue modifier, xsIntegerValue** code, xsIntegerValue** data, xsStringValue errorBuffer, xsIntegerValue errorSize);
|
|
1521
|
+
mxImport void fxDeleteRegExp(xsMachine* the, xsIntegerValue* code, xsIntegerValue* data);
|
|
1522
|
+
mxImport xsBooleanValue fxMatchRegExp(xsMachine* the, xsIntegerValue* code, xsIntegerValue* data, xsStringValue subject, xsIntegerValue offset);
|
|
1523
|
+
|
|
1524
|
+
mxImport void fxAbort(xsMachine* the, int status);
|
|
1525
|
+
|
|
1526
|
+
#ifdef __cplusplus
|
|
1527
|
+
}
|
|
1528
|
+
#endif
|
|
1529
|
+
|
|
1530
|
+
#endif /* !__XSALL__ */
|
|
1531
|
+
|
|
1532
|
+
#endif /* __XS__ */
|
|
1533
|
+
|