@ohos-ports/nbind 0.0.0-stage → 0.3.15-beta.1
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/.editorconfig +7 -0
- package/LICENSE +22 -0
- package/README.md +1393 -2
- package/autogypi.json +11 -0
- package/bin/ci-trigger +40 -0
- package/bin/copyasm.js +77 -0
- package/bin/emcc +21 -0
- package/bin/emcc-path.js +7 -0
- package/bin/ndts.js +22 -0
- package/config.js +7 -0
- package/dist/Type.d.ts +92 -0
- package/dist/Type.js +180 -0
- package/dist/common.d.ts +9 -0
- package/dist/common.js +10 -0
- package/dist/em-api.js +2353 -0
- package/dist/int64.d.ts +9 -0
- package/dist/int64.js +64 -0
- package/dist/nbind.d.ts +49 -0
- package/dist/nbind.js +154 -0
- package/dist/reflect.d.ts +69 -0
- package/dist/reflect.js +261 -0
- package/dist/shim.d.ts +1 -0
- package/dist/shim.js +2 -0
- package/dist/todts.d.ts +5 -0
- package/dist/todts.js +146 -0
- package/include/nbind/ArgStorage.h +67 -0
- package/include/nbind/BindClass.h +290 -0
- package/include/nbind/BindDefiner.h +295 -0
- package/include/nbind/Buffer.h +50 -0
- package/include/nbind/FunctionDefiner.h +51 -0
- package/include/nbind/MethodDef.h +50 -0
- package/include/nbind/Policy.h +255 -0
- package/include/nbind/TypeID.h +84 -0
- package/include/nbind/TypeStd.h +66 -0
- package/include/nbind/TypeTransformer.h +38 -0
- package/include/nbind/api.h +100 -0
- package/include/nbind/common.h +22 -0
- package/include/nbind/em/ArgFromWire.h +31 -0
- package/include/nbind/em/BindingStd.h +221 -0
- package/include/nbind/em/BindingType.h +204 -0
- package/include/nbind/em/Buffer.h +37 -0
- package/include/nbind/em/Callback.h +186 -0
- package/include/nbind/em/Caller.h +61 -0
- package/include/nbind/em/Creator.h +30 -0
- package/include/nbind/em/External.h +63 -0
- package/include/nbind/em/Int64.h +131 -0
- package/include/nbind/em/NBind.h +63 -0
- package/include/nbind/em/Pool.h +34 -0
- package/include/nbind/em/StdFunction.h +40 -0
- package/include/nbind/em/ValueObj.h +54 -0
- package/include/nbind/nbind.h +19 -0
- package/include/nbind/noconflict.h +91 -0
- package/include/nbind/signature/BaseSignature.h +238 -0
- package/include/nbind/signature/CallbackSignature.h +59 -0
- package/include/nbind/signature/ConstructorSignature.h +76 -0
- package/include/nbind/signature/FunctionSignature.h +63 -0
- package/include/nbind/signature/GetterSignature.h +62 -0
- package/include/nbind/signature/MethodSignature.h +61 -0
- package/include/nbind/signature/SetterSignature.h +63 -0
- package/include/nbind/signature/SignatureParam.h +39 -0
- package/include/nbind/v8/ArgFromWire.h +69 -0
- package/include/nbind/v8/BindWrapper.h +295 -0
- package/include/nbind/v8/BindingStd.h +180 -0
- package/include/nbind/v8/BindingType.h +241 -0
- package/include/nbind/v8/Buffer.h +59 -0
- package/include/nbind/v8/Callback.h +165 -0
- package/include/nbind/v8/Caller.h +140 -0
- package/include/nbind/v8/Convert.h +80 -0
- package/include/nbind/v8/Creator.h +26 -0
- package/include/nbind/v8/External.h +119 -0
- package/include/nbind/v8/Int64.h +195 -0
- package/include/nbind/v8/NBind.h +63 -0
- package/include/nbind/v8/Output.h +36 -0
- package/include/nbind/v8/Overloader.h +215 -0
- package/include/nbind/v8/StdFunction.h +44 -0
- package/include/nbind/v8/ValueObj.h +137 -0
- package/include/nbind/wire.h +79 -0
- package/package.json +69 -4
- package/src/checkver.js +31 -0
- package/src/common.cc +129 -0
- package/src/em/Binding.cc +313 -0
- package/src/em/tsconfig.json +22 -0
- package/src/nbind-common.gypi +14 -0
- package/src/nbind.gypi +98 -0
- package/src/post.js +2 -0
- package/src/pre.js +48 -0
- package/src/reflect.cc +170 -0
- package/src/symbols.txt +1 -0
- package/src/tsconfig.json +23 -0
- package/src/tslint.json +86 -0
- package/src/v8/Binding.cc +391 -0
- package/src/v8/Buffer.cc +73 -0
package/dist/em-api.js
ADDED
|
@@ -0,0 +1,2353 @@
|
|
|
1
|
+
!function(e){function t(e){Object.defineProperty(this,e,{enumerable:!0,get:function(){return this[v][e]}})}function r(e){if("undefined"!=typeof System&&System.isModule?System.isModule(e):"[object Module]"===Object.prototype.toString.call(e))return e;var t={default:e,__useDefault:e};if(e&&e.__esModule)for(var r in e)Object.hasOwnProperty.call(e,r)&&(t[r]=e[r]);return new o(t)}function o(e){Object.defineProperty(this,v,{value:e}),Object.keys(e).forEach(t,this)}function n(e){return"@node/"===e.substr(0,6)?c(e,r(m(e.substr(6))),{}):p[e]}function u(e){var t=n(e);if(!t)throw new Error('Module "'+e+'" expected, but not contained in build.');if(t.module)return t.module;var r=t.linkRecord;return i(t,r),a(t,r,[]),t.module}function i(e,t){if(!t.depLoads){t.declare&&d(e,t),t.depLoads=[];for(var r=0;r<t.deps.length;r++){var o=n(t.deps[r]);t.depLoads.push(o),o.linkRecord&&i(o,o.linkRecord);var u=t.setters&&t.setters[r];u&&(u(o.module||o.linkRecord.moduleObj),o.importerSetters.push(u))}return e}}function d(t,r){var o=r.moduleObj,n=t.importerSetters,u=!1,i=r.declare.call(e,function(e,t){if(!u){if("object"==typeof e)for(var r in e)"__useDefault"!==r&&(o[r]=e[r]);else o[e]=t;u=!0;for(var i=0;i<n.length;i++)n[i](o);return u=!1,t}},{id:t.key});"function"!=typeof i?(r.setters=i.setters,r.execute=i.execute):(r.setters=[],r.execute=i)}function l(e,t,r){return p[e]={key:e,module:void 0,importerSetters:[],linkRecord:{deps:t,depLoads:void 0,declare:r,setters:void 0,execute:void 0,moduleObj:{}}}}function f(e,t,r,o){var n={};return p[e]={key:e,module:void 0,importerSetters:[],linkRecord:{deps:t,depLoads:void 0,declare:void 0,execute:o,executingRequire:r,moduleObj:{default:n,__useDefault:n},setters:void 0}}}function s(e,t,r){return function(o){for(var n=0;n<e.length;n++)if(e[n]===o){var u,i=t[n],d=i.linkRecord;return u=d?-1===r.indexOf(i)?a(i,d,r):d.moduleObj:i.module,"__useDefault"in u?u.__useDefault:u}}}function a(t,r,n){if(n.push(t),t.module)return t.module;var u;if(r.setters){for(var i=0;i<r.deps.length;i++){var d=r.depLoads[i],l=d.linkRecord;l&&-1===n.indexOf(d)&&(u=a(d,l,l.setters?n:[]))}r.execute.call(y)}else{var f={id:t.key},c=r.moduleObj;Object.defineProperty(f,"exports",{configurable:!0,set:function(e){c.default=c.__useDefault=e},get:function(){return c.__useDefault}});var p=s(r.deps,r.depLoads,n);if(!r.executingRequire)for(var i=0;i<r.deps.length;i++)p(r.deps[i]);var v=r.execute.call(e,p,c.__useDefault,f);void 0!==v?c.default=c.__useDefault=v:f.exports!==c.__useDefault&&(c.default=c.__useDefault=f.exports);var m=c.__useDefault;if(m&&m.__esModule)for(var b in m)Object.hasOwnProperty.call(m,b)&&(c[b]=m[b])}var f=t.module=new o(r.moduleObj);if(!r.setters)for(var i=0;i<t.importerSetters.length;i++)t.importerSetters[i](f);return f}function c(e,t){return p[e]={key:e,module:t,importerSetters:[],linkRecord:void 0}}var p={},v="undefined"!=typeof Symbol?Symbol():"@@baseObject";o.prototype=Object.create(null),"undefined"!=typeof Symbol&&Symbol.toStringTag&&(o.prototype[Symbol.toStringTag]="Module");var m="undefined"!=typeof System&&System._nodeRequire||"undefined"!=typeof require&&"undefined"!=typeof require.resolve&&"undefined"!=typeof process&&process.platform&&require,y={};return Object.freeze&&Object.freeze(y),function(e,t,n,i){return function(d){d(function(d){var s={_nodeRequire:m,register:l,registerDynamic:f,registry:{get:function(e){return p[e].module},set:c},newModule:function(e){return new o(e)}};c("@empty",new o({}));for(var a=0;a<t.length;a++)c(t[a],r(arguments[a],{}));i(s);var v=u(e[0]);if(e.length>1)for(var a=1;a<e.length;a++)u(e[a]);return n?v.__useDefault:(v instanceof o&&Object.defineProperty(v,"__esModule",{value:!0}),v)})}}}("undefined"!=typeof self?self:"undefined"!=typeof global?global:this)
|
|
2
|
+
|
|
3
|
+
(["a"], [], true, function($__System) {
|
|
4
|
+
var require = this.require, exports = this.exports, module = this.module;
|
|
5
|
+
$__System.registerDynamic("b", ["e", "c", "d"], true, function ($__require, exports, module) {
|
|
6
|
+
var global = this || self,
|
|
7
|
+
GLOBAL = global;
|
|
8
|
+
// This file is part of nbind, copyright (C) 2014-2016 BusFaster Ltd.
|
|
9
|
+
// Released under the MIT license, see LICENSE.
|
|
10
|
+
var __extends = exports && exports.__extends || function () {
|
|
11
|
+
var extendStatics = Object.setPrototypeOf || { __proto__: [] } instanceof Array && function (d, b) {
|
|
12
|
+
d.__proto__ = b;
|
|
13
|
+
} || function (d, b) {
|
|
14
|
+
for (var p in b) if (b.hasOwnProperty(p)) d[p] = b[p];
|
|
15
|
+
};
|
|
16
|
+
return function (d, b) {
|
|
17
|
+
extendStatics(d, b);
|
|
18
|
+
function __() {
|
|
19
|
+
this.constructor = d;
|
|
20
|
+
}
|
|
21
|
+
d.prototype = b === null ? Object.create(b) : (__.prototype = b.prototype, new __());
|
|
22
|
+
};
|
|
23
|
+
}();
|
|
24
|
+
var __decorate = exports && exports.__decorate || function (decorators, target, key, desc) {
|
|
25
|
+
var c = arguments.length,
|
|
26
|
+
r = c < 3 ? target : desc === null ? desc = Object.getOwnPropertyDescriptor(target, key) : desc,
|
|
27
|
+
d;
|
|
28
|
+
if (typeof Reflect === "object" && typeof Reflect.decorate === "function") r = Reflect.decorate(decorators, target, key, desc);else for (var i = decorators.length - 1; i >= 0; i--) if (d = decorators[i]) r = (c < 3 ? d(r) : c > 3 ? d(target, key, r) : d(target, key)) || r;
|
|
29
|
+
return c > 3 && r && Object.defineProperty(target, key, r), r;
|
|
30
|
+
};
|
|
31
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
32
|
+
var emscripten_library_decorator_1 = $__require("e");
|
|
33
|
+
var BindingType_1 = $__require("c");
|
|
34
|
+
var Wrapper_1 = $__require("d");
|
|
35
|
+
// Let decorators run eval in current scope to read function source code.
|
|
36
|
+
emscripten_library_decorator_1.setEvil(function (code) {
|
|
37
|
+
return eval(code);
|
|
38
|
+
});
|
|
39
|
+
var _nbind;
|
|
40
|
+
(function (_nbind) {
|
|
41
|
+
_nbind.BindType = BindingType_1._nbind.BindType;
|
|
42
|
+
_nbind.Wrapper = Wrapper_1._nbind.Wrapper;
|
|
43
|
+
})(_nbind = exports._nbind || (exports._nbind = {}));
|
|
44
|
+
(function (_nbind) {
|
|
45
|
+
_nbind.ptrMarker = {};
|
|
46
|
+
// Base class for all bound C++ classes (not their instances),
|
|
47
|
+
// also inheriting from a generic type definition.
|
|
48
|
+
var BindClass = function (_super) {
|
|
49
|
+
__extends(BindClass, _super);
|
|
50
|
+
function BindClass(spec) {
|
|
51
|
+
var _this = _super.call(this, spec) || this;
|
|
52
|
+
_this.wireRead = function (arg) {
|
|
53
|
+
return _nbind.popValue(arg, _this.ptrType);
|
|
54
|
+
};
|
|
55
|
+
_this.wireWrite = function (arg) {
|
|
56
|
+
return pushPointer(arg, _this.ptrType, true);
|
|
57
|
+
};
|
|
58
|
+
/** Number of super classes left to initialize. */
|
|
59
|
+
_this.pendingSuperCount = 0;
|
|
60
|
+
_this.ready = false;
|
|
61
|
+
_this.methodTbl = {};
|
|
62
|
+
if (spec.paramList) {
|
|
63
|
+
_this.classType = spec.paramList[0].classType;
|
|
64
|
+
_this.proto = _this.classType.proto;
|
|
65
|
+
} else _this.classType = _this;
|
|
66
|
+
return _this;
|
|
67
|
+
}
|
|
68
|
+
BindClass.prototype.makeBound = function (policyTbl) {
|
|
69
|
+
var Bound = _nbind.makeBound(policyTbl, this);
|
|
70
|
+
this.proto = Bound;
|
|
71
|
+
this.ptrType.proto = Bound;
|
|
72
|
+
return Bound;
|
|
73
|
+
};
|
|
74
|
+
BindClass.prototype.addMethod = function (spec) {
|
|
75
|
+
var overloadList = this.methodTbl[spec.name] || [];
|
|
76
|
+
overloadList.push(spec);
|
|
77
|
+
this.methodTbl[spec.name] = overloadList;
|
|
78
|
+
};
|
|
79
|
+
BindClass.prototype.registerMethods = function (src, staticOnly) {
|
|
80
|
+
var setter;
|
|
81
|
+
for (var _i = 0, _a = Object.keys(src.methodTbl); _i < _a.length; _i++) {
|
|
82
|
+
var name = _a[_i];
|
|
83
|
+
var overloadList = src.methodTbl[name];
|
|
84
|
+
for (var _b = 0, overloadList_1 = overloadList; _b < overloadList_1.length; _b++) {
|
|
85
|
+
var spec = overloadList_1[_b];
|
|
86
|
+
var target = void 0;
|
|
87
|
+
var caller = void 0;
|
|
88
|
+
target = this.proto.prototype;
|
|
89
|
+
if (staticOnly && spec.signatureType != 1 /* func */) continue;
|
|
90
|
+
switch (spec.signatureType) {
|
|
91
|
+
case 1 /* func */:
|
|
92
|
+
target = this.proto;
|
|
93
|
+
// tslint:disable-next-line:no-switch-case-fall-through
|
|
94
|
+
case 5 /* construct */:
|
|
95
|
+
caller = _nbind.makeCaller(spec);
|
|
96
|
+
_nbind.addMethod(target, spec.name, caller, spec.typeList.length - 1);
|
|
97
|
+
break;
|
|
98
|
+
case 4 /* setter */:
|
|
99
|
+
setter = _nbind.makeMethodCaller(src.ptrType, spec);
|
|
100
|
+
break;
|
|
101
|
+
case 3 /* getter */:
|
|
102
|
+
Object.defineProperty(target, spec.name, {
|
|
103
|
+
configurable: true,
|
|
104
|
+
enumerable: false,
|
|
105
|
+
get: _nbind.makeMethodCaller(src.ptrType, spec),
|
|
106
|
+
set: setter
|
|
107
|
+
});
|
|
108
|
+
break;
|
|
109
|
+
case 2 /* method */:
|
|
110
|
+
caller = _nbind.makeMethodCaller(src.ptrType, spec);
|
|
111
|
+
_nbind.addMethod(target, spec.name, caller, spec.typeList.length - 1);
|
|
112
|
+
break;
|
|
113
|
+
default:
|
|
114
|
+
break;
|
|
115
|
+
}
|
|
116
|
+
}
|
|
117
|
+
}
|
|
118
|
+
};
|
|
119
|
+
BindClass.prototype.registerSuperMethods = function (src, firstSuper, visitTbl) {
|
|
120
|
+
if (visitTbl[src.name]) return;
|
|
121
|
+
visitTbl[src.name] = true;
|
|
122
|
+
var superNum = 0;
|
|
123
|
+
var nextFirst;
|
|
124
|
+
for (var _i = 0, _a = src.superIdList || []; _i < _a.length; _i++) {
|
|
125
|
+
var superId = _a[_i];
|
|
126
|
+
var superClass = _nbind.getType(superId);
|
|
127
|
+
if (superNum++ < firstSuper || firstSuper < 0) {
|
|
128
|
+
nextFirst = -1;
|
|
129
|
+
} else {
|
|
130
|
+
nextFirst = 0;
|
|
131
|
+
}
|
|
132
|
+
this.registerSuperMethods(superClass, nextFirst, visitTbl);
|
|
133
|
+
}
|
|
134
|
+
this.registerMethods(src, firstSuper < 0);
|
|
135
|
+
};
|
|
136
|
+
BindClass.prototype.finish = function () {
|
|
137
|
+
if (this.ready) return this;
|
|
138
|
+
this.ready = true;
|
|
139
|
+
this.superList = (this.superIdList || []).map(function (superId) {
|
|
140
|
+
return _nbind.getType(superId).finish();
|
|
141
|
+
});
|
|
142
|
+
var Bound = this.proto;
|
|
143
|
+
if (this.superList.length) {
|
|
144
|
+
var Proto = function () {
|
|
145
|
+
this.constructor = Bound;
|
|
146
|
+
};
|
|
147
|
+
Proto.prototype = this.superList[0].proto.prototype;
|
|
148
|
+
Bound.prototype = new Proto();
|
|
149
|
+
}
|
|
150
|
+
if (Bound != Module) Bound.prototype.__nbindType = this;
|
|
151
|
+
this.registerSuperMethods(this, 1, {});
|
|
152
|
+
return this;
|
|
153
|
+
};
|
|
154
|
+
BindClass.prototype.upcastStep = function (dst, ptr) {
|
|
155
|
+
if (dst == this) return ptr;
|
|
156
|
+
for (var i = 0; i < this.superList.length; ++i) {
|
|
157
|
+
var superPtr = this.superList[i].upcastStep(dst, _nbind.callUpcast(this.upcastList[i], ptr));
|
|
158
|
+
if (superPtr) return superPtr;
|
|
159
|
+
}
|
|
160
|
+
return 0;
|
|
161
|
+
};
|
|
162
|
+
return BindClass;
|
|
163
|
+
}(_nbind.BindType);
|
|
164
|
+
BindClass.list = [];
|
|
165
|
+
_nbind.BindClass = BindClass;
|
|
166
|
+
function popPointer(ptr, type) {
|
|
167
|
+
return ptr ? new type.proto(_nbind.ptrMarker, type.flags, ptr) : null;
|
|
168
|
+
}
|
|
169
|
+
_nbind.popPointer = popPointer;
|
|
170
|
+
function pushPointer(obj, type, tryValue) {
|
|
171
|
+
if (!(obj instanceof _nbind.Wrapper)) {
|
|
172
|
+
if (tryValue) {
|
|
173
|
+
return _nbind.pushValue(obj);
|
|
174
|
+
} else throw new Error('Type mismatch');
|
|
175
|
+
}
|
|
176
|
+
var ptr = obj.__nbindPtr;
|
|
177
|
+
var objType = obj.__nbindType.classType;
|
|
178
|
+
var classType = type.classType;
|
|
179
|
+
if (obj instanceof type.proto) {
|
|
180
|
+
// Fast path, requested type is in object's prototype chain.
|
|
181
|
+
while (objType != classType) {
|
|
182
|
+
ptr = _nbind.callUpcast(objType.upcastList[0], ptr);
|
|
183
|
+
objType = objType.superList[0];
|
|
184
|
+
}
|
|
185
|
+
} else {
|
|
186
|
+
ptr = objType.upcastStep(classType, ptr);
|
|
187
|
+
if (!ptr) throw new Error('Type mismatch');
|
|
188
|
+
}
|
|
189
|
+
return ptr;
|
|
190
|
+
}
|
|
191
|
+
_nbind.pushPointer = pushPointer;
|
|
192
|
+
function pushMutablePointer(obj, type) {
|
|
193
|
+
var ptr = pushPointer(obj, type);
|
|
194
|
+
if (obj.__nbindFlags & 1 /* isConst */) {
|
|
195
|
+
throw new Error('Passing a const value as a non-const argument');
|
|
196
|
+
}
|
|
197
|
+
return ptr;
|
|
198
|
+
}
|
|
199
|
+
var BindClassPtr = function (_super) {
|
|
200
|
+
__extends(BindClassPtr, _super);
|
|
201
|
+
function BindClassPtr(spec) {
|
|
202
|
+
var _this = _super.call(this, spec) || this;
|
|
203
|
+
_this.classType = spec.paramList[0].classType;
|
|
204
|
+
_this.proto = _this.classType.proto;
|
|
205
|
+
var isConst = spec.flags & 1 /* isConst */;
|
|
206
|
+
var isValue = (_this.flags & 896 /* refMask */) == 256 /* isReference */ && spec.flags & 2 /* isValueObject */;
|
|
207
|
+
var push = isConst ? pushPointer : pushMutablePointer;
|
|
208
|
+
var pop = isValue ? _nbind.popValue : popPointer;
|
|
209
|
+
_this.makeWireWrite = function (expr, policyTbl) {
|
|
210
|
+
return policyTbl['Nullable'] ?
|
|
211
|
+
// Handle null pointers.
|
|
212
|
+
function (arg) {
|
|
213
|
+
return arg ? push(arg, _this) : 0;
|
|
214
|
+
} : function (arg) {
|
|
215
|
+
return push(arg, _this);
|
|
216
|
+
};
|
|
217
|
+
};
|
|
218
|
+
_this.wireRead = function (arg) {
|
|
219
|
+
return pop(arg, _this);
|
|
220
|
+
};
|
|
221
|
+
_this.wireWrite = function (arg) {
|
|
222
|
+
return push(arg, _this);
|
|
223
|
+
};
|
|
224
|
+
return _this;
|
|
225
|
+
}
|
|
226
|
+
return BindClassPtr;
|
|
227
|
+
}(_nbind.BindType);
|
|
228
|
+
_nbind.BindClassPtr = BindClassPtr;
|
|
229
|
+
function popShared(ptr, type) {
|
|
230
|
+
var shared = HEAPU32[ptr / 4];
|
|
231
|
+
var unsafe = HEAPU32[ptr / 4 + 1];
|
|
232
|
+
return unsafe ? new type.proto(_nbind.ptrMarker, type.flags, unsafe, shared) : null;
|
|
233
|
+
}
|
|
234
|
+
_nbind.popShared = popShared;
|
|
235
|
+
function pushShared(obj, type) {
|
|
236
|
+
if (!(obj instanceof type.proto)) throw new Error('Type mismatch');
|
|
237
|
+
return obj.__nbindShared;
|
|
238
|
+
}
|
|
239
|
+
function pushMutableShared(obj, type) {
|
|
240
|
+
if (!(obj instanceof type.proto)) throw new Error('Type mismatch');
|
|
241
|
+
if (obj.__nbindFlags & 1 /* isConst */) {
|
|
242
|
+
throw new Error('Passing a const value as a non-const argument');
|
|
243
|
+
}
|
|
244
|
+
return obj.__nbindShared;
|
|
245
|
+
}
|
|
246
|
+
var SharedClassPtr = function (_super) {
|
|
247
|
+
__extends(SharedClassPtr, _super);
|
|
248
|
+
function SharedClassPtr(spec) {
|
|
249
|
+
var _this = _super.call(this, spec) || this;
|
|
250
|
+
_this.readResources = [_nbind.resources.pool];
|
|
251
|
+
_this.classType = spec.paramList[0].classType;
|
|
252
|
+
_this.proto = _this.classType.proto;
|
|
253
|
+
var isConst = spec.flags & 1 /* isConst */;
|
|
254
|
+
var push = isConst ? pushShared : pushMutableShared;
|
|
255
|
+
_this.wireRead = function (arg) {
|
|
256
|
+
return popShared(arg, _this);
|
|
257
|
+
};
|
|
258
|
+
_this.wireWrite = function (arg) {
|
|
259
|
+
return push(arg, _this);
|
|
260
|
+
};
|
|
261
|
+
return _this;
|
|
262
|
+
}
|
|
263
|
+
return SharedClassPtr;
|
|
264
|
+
}(_nbind.BindType);
|
|
265
|
+
_nbind.SharedClassPtr = SharedClassPtr;
|
|
266
|
+
var _ = function () {
|
|
267
|
+
function _() {}
|
|
268
|
+
return _;
|
|
269
|
+
}(); // tslint:disable-line:class-name
|
|
270
|
+
_ = __decorate([emscripten_library_decorator_1.prepareNamespace('_nbind')], _);
|
|
271
|
+
_nbind._ = _;
|
|
272
|
+
})(_nbind = exports._nbind || (exports._nbind = {}));
|
|
273
|
+
});
|
|
274
|
+
$__System.registerDynamic("f", ["e", "c", "10"], true, function ($__require, exports, module) {
|
|
275
|
+
var global = this || self,
|
|
276
|
+
GLOBAL = global;
|
|
277
|
+
// This file is part of nbind, copyright (C) 2014-2016 BusFaster Ltd.
|
|
278
|
+
// Released under the MIT license, see LICENSE.
|
|
279
|
+
var __extends = exports && exports.__extends || function () {
|
|
280
|
+
var extendStatics = Object.setPrototypeOf || { __proto__: [] } instanceof Array && function (d, b) {
|
|
281
|
+
d.__proto__ = b;
|
|
282
|
+
} || function (d, b) {
|
|
283
|
+
for (var p in b) if (b.hasOwnProperty(p)) d[p] = b[p];
|
|
284
|
+
};
|
|
285
|
+
return function (d, b) {
|
|
286
|
+
extendStatics(d, b);
|
|
287
|
+
function __() {
|
|
288
|
+
this.constructor = d;
|
|
289
|
+
}
|
|
290
|
+
d.prototype = b === null ? Object.create(b) : (__.prototype = b.prototype, new __());
|
|
291
|
+
};
|
|
292
|
+
}();
|
|
293
|
+
var __decorate = exports && exports.__decorate || function (decorators, target, key, desc) {
|
|
294
|
+
var c = arguments.length,
|
|
295
|
+
r = c < 3 ? target : desc === null ? desc = Object.getOwnPropertyDescriptor(target, key) : desc,
|
|
296
|
+
d;
|
|
297
|
+
if (typeof Reflect === "object" && typeof Reflect.decorate === "function") r = Reflect.decorate(decorators, target, key, desc);else for (var i = decorators.length - 1; i >= 0; i--) if (d = decorators[i]) r = (c < 3 ? d(r) : c > 3 ? d(target, key, r) : d(target, key)) || r;
|
|
298
|
+
return c > 3 && r && Object.defineProperty(target, key, r), r;
|
|
299
|
+
};
|
|
300
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
301
|
+
// This file handles type conversion of JavaScript callback functions
|
|
302
|
+
// accessible from C++. See also Caller.ts
|
|
303
|
+
var emscripten_library_decorator_1 = $__require("e");
|
|
304
|
+
var BindingType_1 = $__require("c");
|
|
305
|
+
var External_1 = $__require("10");
|
|
306
|
+
// Let decorators run eval in current scope to read function source code.
|
|
307
|
+
emscripten_library_decorator_1.setEvil(function (code) {
|
|
308
|
+
return eval(code);
|
|
309
|
+
});
|
|
310
|
+
var _nbind;
|
|
311
|
+
(function (_nbind) {
|
|
312
|
+
_nbind.BindType = BindingType_1._nbind.BindType;
|
|
313
|
+
_nbind.External = External_1._nbind.External;
|
|
314
|
+
})(_nbind = exports._nbind || (exports._nbind = {}));
|
|
315
|
+
(function (_nbind) {
|
|
316
|
+
// List of invoker functions for all argument and return value combinations
|
|
317
|
+
// seen so far.
|
|
318
|
+
_nbind.callbackSignatureList = [];
|
|
319
|
+
var CallbackType = function (_super) {
|
|
320
|
+
__extends(CallbackType, _super);
|
|
321
|
+
function CallbackType() {
|
|
322
|
+
var _this = _super !== null && _super.apply(this, arguments) || this;
|
|
323
|
+
_this.wireWrite = function (func) {
|
|
324
|
+
if (typeof func != 'function') _nbind.throwError('Type mismatch');
|
|
325
|
+
return new _nbind.External(func).register();
|
|
326
|
+
};
|
|
327
|
+
return _this;
|
|
328
|
+
// Optional type conversion code
|
|
329
|
+
// makeWireWrite = (expr: string) => '_nbind.registerCallback(' + expr + ')';
|
|
330
|
+
}
|
|
331
|
+
return CallbackType;
|
|
332
|
+
}(_nbind.BindType);
|
|
333
|
+
_nbind.CallbackType = CallbackType;
|
|
334
|
+
var _ = function () {
|
|
335
|
+
function _() {}
|
|
336
|
+
return _;
|
|
337
|
+
}(); // tslint:disable-line:class-name
|
|
338
|
+
_ = __decorate([emscripten_library_decorator_1.prepareNamespace('_nbind')], _);
|
|
339
|
+
_nbind._ = _;
|
|
340
|
+
})(_nbind = exports._nbind || (exports._nbind = {}));
|
|
341
|
+
var nbind = function () {
|
|
342
|
+
function nbind() {}
|
|
343
|
+
nbind._nbind_register_callback_signature = function (typeListPtr, typeCount) {
|
|
344
|
+
var typeList = _nbind.readTypeIdList(typeListPtr, typeCount);
|
|
345
|
+
var num = _nbind.callbackSignatureList.length;
|
|
346
|
+
_nbind.callbackSignatureList[num] = _nbind.makeJSCaller(typeList);
|
|
347
|
+
return num;
|
|
348
|
+
};
|
|
349
|
+
return nbind;
|
|
350
|
+
}();
|
|
351
|
+
__decorate([emscripten_library_decorator_1.dep('_nbind')], nbind, "_nbind_register_callback_signature", null);
|
|
352
|
+
nbind = __decorate([emscripten_library_decorator_1.exportLibrary], nbind);
|
|
353
|
+
});
|
|
354
|
+
$__System.registerDynamic("11", ["e", "c"], true, function ($__require, exports, module) {
|
|
355
|
+
var global = this || self,
|
|
356
|
+
GLOBAL = global;
|
|
357
|
+
// This file is part of nbind, copyright (C) 2014-2016 BusFaster Ltd.
|
|
358
|
+
// Released under the MIT license, see LICENSE.
|
|
359
|
+
var __extends = exports && exports.__extends || function () {
|
|
360
|
+
var extendStatics = Object.setPrototypeOf || { __proto__: [] } instanceof Array && function (d, b) {
|
|
361
|
+
d.__proto__ = b;
|
|
362
|
+
} || function (d, b) {
|
|
363
|
+
for (var p in b) if (b.hasOwnProperty(p)) d[p] = b[p];
|
|
364
|
+
};
|
|
365
|
+
return function (d, b) {
|
|
366
|
+
extendStatics(d, b);
|
|
367
|
+
function __() {
|
|
368
|
+
this.constructor = d;
|
|
369
|
+
}
|
|
370
|
+
d.prototype = b === null ? Object.create(b) : (__.prototype = b.prototype, new __());
|
|
371
|
+
};
|
|
372
|
+
}();
|
|
373
|
+
var __decorate = exports && exports.__decorate || function (decorators, target, key, desc) {
|
|
374
|
+
var c = arguments.length,
|
|
375
|
+
r = c < 3 ? target : desc === null ? desc = Object.getOwnPropertyDescriptor(target, key) : desc,
|
|
376
|
+
d;
|
|
377
|
+
if (typeof Reflect === "object" && typeof Reflect.decorate === "function") r = Reflect.decorate(decorators, target, key, desc);else for (var i = decorators.length - 1; i >= 0; i--) if (d = decorators[i]) r = (c < 3 ? d(r) : c > 3 ? d(target, key, r) : d(target, key)) || r;
|
|
378
|
+
return c > 3 && r && Object.defineProperty(target, key, r), r;
|
|
379
|
+
};
|
|
380
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
381
|
+
// This file handles value objects, which are represented by equivalent C++ and
|
|
382
|
+
// JavaScript classes, with toJS and fromJS methods calling each others'
|
|
383
|
+
// constructors to marshal the class between languages and providing a similar
|
|
384
|
+
// API in both.
|
|
385
|
+
var emscripten_library_decorator_1 = $__require("e");
|
|
386
|
+
var BindingType_1 = $__require("c");
|
|
387
|
+
// Let decorators run eval in current scope to read function source code.
|
|
388
|
+
emscripten_library_decorator_1.setEvil(function (code) {
|
|
389
|
+
return eval(code);
|
|
390
|
+
});
|
|
391
|
+
var _defineHidden = emscripten_library_decorator_1.defineHidden;
|
|
392
|
+
var _nbind;
|
|
393
|
+
(function (_nbind) {
|
|
394
|
+
_nbind.BindType = BindingType_1._nbind.BindType;
|
|
395
|
+
})(_nbind = exports._nbind || (exports._nbind = {}));
|
|
396
|
+
(function (_nbind) {
|
|
397
|
+
/** Storage for value objects. Slot 0 is reserved to represent errors. */
|
|
398
|
+
_nbind.valueList = [0];
|
|
399
|
+
/** Value object storage slot free list head. */
|
|
400
|
+
var firstFreeValue = 0;
|
|
401
|
+
function pushValue(value) {
|
|
402
|
+
var num = firstFreeValue;
|
|
403
|
+
if (num) {
|
|
404
|
+
firstFreeValue = _nbind.valueList[num];
|
|
405
|
+
} else num = _nbind.valueList.length;
|
|
406
|
+
_nbind.valueList[num] = value;
|
|
407
|
+
return num * 2 + 1;
|
|
408
|
+
}
|
|
409
|
+
_nbind.pushValue = pushValue;
|
|
410
|
+
function popValue(num, type) {
|
|
411
|
+
if (!num) _nbind.throwError('Value type JavaScript class is missing or not registered');
|
|
412
|
+
if (num & 1) {
|
|
413
|
+
num >>= 1;
|
|
414
|
+
var obj = _nbind.valueList[num];
|
|
415
|
+
_nbind.valueList[num] = firstFreeValue;
|
|
416
|
+
firstFreeValue = num;
|
|
417
|
+
return obj;
|
|
418
|
+
} else if (type) {
|
|
419
|
+
return _nbind.popShared(num, type);
|
|
420
|
+
} else throw new Error('Invalid value slot ' + num);
|
|
421
|
+
}
|
|
422
|
+
_nbind.popValue = popValue;
|
|
423
|
+
// 2^64, first integer not representable with uint64_t.
|
|
424
|
+
// Start of range used for other flags.
|
|
425
|
+
var valueBase = 18446744073709551616.0;
|
|
426
|
+
function push64(num) {
|
|
427
|
+
if (typeof num == 'number') return num;
|
|
428
|
+
return pushValue(num) * 4096 + valueBase;
|
|
429
|
+
}
|
|
430
|
+
function pop64(num) {
|
|
431
|
+
if (num < valueBase) return num;
|
|
432
|
+
return popValue((num - valueBase) / 4096);
|
|
433
|
+
}
|
|
434
|
+
// Special type that constructs a new object.
|
|
435
|
+
var CreateValueType = function (_super) {
|
|
436
|
+
__extends(CreateValueType, _super);
|
|
437
|
+
function CreateValueType() {
|
|
438
|
+
return _super !== null && _super.apply(this, arguments) || this;
|
|
439
|
+
}
|
|
440
|
+
CreateValueType.prototype.makeWireWrite = function (expr) {
|
|
441
|
+
return '(_nbind.pushValue(new ' + expr + '))';
|
|
442
|
+
};
|
|
443
|
+
return CreateValueType;
|
|
444
|
+
}(_nbind.BindType);
|
|
445
|
+
_nbind.CreateValueType = CreateValueType;
|
|
446
|
+
var Int64Type = function (_super) {
|
|
447
|
+
__extends(Int64Type, _super);
|
|
448
|
+
function Int64Type() {
|
|
449
|
+
var _this = _super !== null && _super.apply(this, arguments) || this;
|
|
450
|
+
_this.wireWrite = push64;
|
|
451
|
+
_this.wireRead = pop64;
|
|
452
|
+
return _this;
|
|
453
|
+
}
|
|
454
|
+
return Int64Type;
|
|
455
|
+
}(_nbind.BindType);
|
|
456
|
+
_nbind.Int64Type = Int64Type;
|
|
457
|
+
var _ = function () {
|
|
458
|
+
function _() {}
|
|
459
|
+
return _;
|
|
460
|
+
}(); // tslint:disable-line:class-name
|
|
461
|
+
_ = __decorate([emscripten_library_decorator_1.prepareNamespace('_nbind')], _);
|
|
462
|
+
_nbind._ = _;
|
|
463
|
+
})(_nbind = exports._nbind || (exports._nbind = {}));
|
|
464
|
+
var nbind = function () {
|
|
465
|
+
function nbind() {}
|
|
466
|
+
// Initialize a C++ object based on a JavaScript object's contents.
|
|
467
|
+
nbind._nbind_get_value_object = function (num, ptr) {
|
|
468
|
+
var obj = _nbind.popValue(num);
|
|
469
|
+
if (!obj.fromJS) {
|
|
470
|
+
throw new Error('Object ' + obj + ' has no fromJS function');
|
|
471
|
+
}
|
|
472
|
+
obj.fromJS(function () {
|
|
473
|
+
obj.__nbindValueConstructor.apply(this, Array.prototype.concat.apply([ptr], arguments));
|
|
474
|
+
});
|
|
475
|
+
};
|
|
476
|
+
nbind._nbind_get_int_64 = function (num, ptr) {
|
|
477
|
+
var obj = _nbind.popValue(num);
|
|
478
|
+
obj.fromJS(function (lo, hi, sign) {
|
|
479
|
+
if (sign) {
|
|
480
|
+
lo = ~lo;
|
|
481
|
+
hi = ~hi;
|
|
482
|
+
if (!++lo) ++hi;
|
|
483
|
+
}
|
|
484
|
+
ptr >>= 2;
|
|
485
|
+
if (_nbind.bigEndian) {
|
|
486
|
+
// Emscripten itself might not work on big endian,
|
|
487
|
+
// but we support it here anyway.
|
|
488
|
+
HEAP32[ptr] = hi;
|
|
489
|
+
HEAP32[ptr + 1] = lo;
|
|
490
|
+
} else {
|
|
491
|
+
HEAP32[ptr] = lo;
|
|
492
|
+
HEAP32[ptr + 1] = hi;
|
|
493
|
+
}
|
|
494
|
+
});
|
|
495
|
+
};
|
|
496
|
+
nbind.nbind_value = function (name, proto) {
|
|
497
|
+
if (!_nbind.typeNameTbl[name]) _nbind.throwError('Unknown value type ' + name);
|
|
498
|
+
Module['NBind'].bind_value(name, proto);
|
|
499
|
+
// Copy value constructor reference from C++ wrapper prototype
|
|
500
|
+
// to equivalent JS prototype.
|
|
501
|
+
_defineHidden(_nbind.typeNameTbl[name].proto.prototype.__nbindValueConstructor)(proto.prototype, '__nbindValueConstructor');
|
|
502
|
+
};
|
|
503
|
+
return nbind;
|
|
504
|
+
}();
|
|
505
|
+
__decorate([emscripten_library_decorator_1.dep('_nbind')], nbind, "_nbind_get_value_object", null);
|
|
506
|
+
__decorate([emscripten_library_decorator_1.dep('_nbind')], nbind, "_nbind_get_int_64", null);
|
|
507
|
+
__decorate([emscripten_library_decorator_1.dep('_nbind')], nbind, "nbind_value", null);
|
|
508
|
+
nbind = __decorate([emscripten_library_decorator_1.exportLibrary], nbind);
|
|
509
|
+
});
|
|
510
|
+
$__System.registerDynamic("12", ["e", "13", "c"], true, function ($__require, exports, module) {
|
|
511
|
+
var global = this || self,
|
|
512
|
+
GLOBAL = global;
|
|
513
|
+
// This file is part of nbind, copyright (C) 2014-2016 BusFaster Ltd.
|
|
514
|
+
// Released under the MIT license, see LICENSE.
|
|
515
|
+
var __extends = exports && exports.__extends || function () {
|
|
516
|
+
var extendStatics = Object.setPrototypeOf || { __proto__: [] } instanceof Array && function (d, b) {
|
|
517
|
+
d.__proto__ = b;
|
|
518
|
+
} || function (d, b) {
|
|
519
|
+
for (var p in b) if (b.hasOwnProperty(p)) d[p] = b[p];
|
|
520
|
+
};
|
|
521
|
+
return function (d, b) {
|
|
522
|
+
extendStatics(d, b);
|
|
523
|
+
function __() {
|
|
524
|
+
this.constructor = d;
|
|
525
|
+
}
|
|
526
|
+
d.prototype = b === null ? Object.create(b) : (__.prototype = b.prototype, new __());
|
|
527
|
+
};
|
|
528
|
+
}();
|
|
529
|
+
var __decorate = exports && exports.__decorate || function (decorators, target, key, desc) {
|
|
530
|
+
var c = arguments.length,
|
|
531
|
+
r = c < 3 ? target : desc === null ? desc = Object.getOwnPropertyDescriptor(target, key) : desc,
|
|
532
|
+
d;
|
|
533
|
+
if (typeof Reflect === "object" && typeof Reflect.decorate === "function") r = Reflect.decorate(decorators, target, key, desc);else for (var i = decorators.length - 1; i >= 0; i--) if (d = decorators[i]) r = (c < 3 ? d(r) : c > 3 ? d(target, key, r) : d(target, key)) || r;
|
|
534
|
+
return c > 3 && r && Object.defineProperty(target, key, r), r;
|
|
535
|
+
};
|
|
536
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
537
|
+
// This file handles type conversion of C++ standard library types
|
|
538
|
+
// to / from JavaScript.
|
|
539
|
+
var emscripten_library_decorator_1 = $__require("e");
|
|
540
|
+
var Globals_1 = $__require("13");
|
|
541
|
+
var BindingType_1 = $__require("c");
|
|
542
|
+
// Let decorators run eval in current scope to read function source code.
|
|
543
|
+
emscripten_library_decorator_1.setEvil(function (code) {
|
|
544
|
+
return eval(code);
|
|
545
|
+
});
|
|
546
|
+
var _nbind;
|
|
547
|
+
(function (_nbind) {
|
|
548
|
+
_nbind.Pool = Globals_1._nbind.Pool;
|
|
549
|
+
_nbind.BindType = BindingType_1._nbind.BindType;
|
|
550
|
+
})(_nbind = exports._nbind || (exports._nbind = {}));
|
|
551
|
+
(function (_nbind) {
|
|
552
|
+
function pushArray(arr, type) {
|
|
553
|
+
if (!arr) return 0;
|
|
554
|
+
var length = arr.length;
|
|
555
|
+
if ((type.size || type.size === 0) && length < type.size) {
|
|
556
|
+
throw new Error('Type mismatch');
|
|
557
|
+
}
|
|
558
|
+
var ptrSize = type.memberType.ptrSize;
|
|
559
|
+
var result = _nbind.Pool.lalloc(4 + length * ptrSize);
|
|
560
|
+
HEAPU32[result / 4] = length;
|
|
561
|
+
var heap = type.memberType.heap;
|
|
562
|
+
var ptr = (result + 4) / ptrSize;
|
|
563
|
+
var wireWrite = type.memberType.wireWrite;
|
|
564
|
+
var num = 0;
|
|
565
|
+
if (wireWrite) {
|
|
566
|
+
while (num < length) {
|
|
567
|
+
heap[ptr++] = wireWrite(arr[num++]);
|
|
568
|
+
}
|
|
569
|
+
} else {
|
|
570
|
+
while (num < length) {
|
|
571
|
+
heap[ptr++] = arr[num++];
|
|
572
|
+
}
|
|
573
|
+
}
|
|
574
|
+
return result;
|
|
575
|
+
}
|
|
576
|
+
_nbind.pushArray = pushArray;
|
|
577
|
+
function popArray(ptr, type) {
|
|
578
|
+
if (ptr === 0) return null;
|
|
579
|
+
var length = HEAPU32[ptr / 4];
|
|
580
|
+
var arr = new Array(length);
|
|
581
|
+
var heap = type.memberType.heap;
|
|
582
|
+
ptr = (ptr + 4) / type.memberType.ptrSize;
|
|
583
|
+
var wireRead = type.memberType.wireRead;
|
|
584
|
+
var num = 0;
|
|
585
|
+
if (wireRead) {
|
|
586
|
+
while (num < length) {
|
|
587
|
+
arr[num++] = wireRead(heap[ptr++]);
|
|
588
|
+
}
|
|
589
|
+
} else {
|
|
590
|
+
while (num < length) {
|
|
591
|
+
arr[num++] = heap[ptr++];
|
|
592
|
+
}
|
|
593
|
+
}
|
|
594
|
+
return arr;
|
|
595
|
+
}
|
|
596
|
+
_nbind.popArray = popArray;
|
|
597
|
+
var ArrayType = function (_super) {
|
|
598
|
+
__extends(ArrayType, _super);
|
|
599
|
+
function ArrayType(spec) {
|
|
600
|
+
var _this = _super.call(this, spec) || this;
|
|
601
|
+
_this.wireRead = function (arg) {
|
|
602
|
+
return popArray(arg, _this);
|
|
603
|
+
};
|
|
604
|
+
_this.wireWrite = function (arg) {
|
|
605
|
+
return pushArray(arg, _this);
|
|
606
|
+
};
|
|
607
|
+
// Optional type conversion code
|
|
608
|
+
/*
|
|
609
|
+
makeWireRead = (expr: string, convertParamList: any[], num: number) => {
|
|
610
|
+
convertParamList[num] = this;
|
|
611
|
+
return('_nbind.popArray(' + expr + ',convertParamList[' + num + '])');
|
|
612
|
+
};
|
|
613
|
+
makeWireWrite = (expr: string, convertParamList: any[], num: number) => {
|
|
614
|
+
convertParamList[num] = this;
|
|
615
|
+
return('_nbind.pushArray(' + expr + ',convertParamList[' + num + '])');
|
|
616
|
+
};
|
|
617
|
+
*/
|
|
618
|
+
_this.readResources = [_nbind.resources.pool];
|
|
619
|
+
_this.writeResources = [_nbind.resources.pool];
|
|
620
|
+
_this.memberType = spec.paramList[0];
|
|
621
|
+
if (spec.paramList[1]) _this.size = spec.paramList[1];
|
|
622
|
+
return _this;
|
|
623
|
+
}
|
|
624
|
+
return ArrayType;
|
|
625
|
+
}(_nbind.BindType);
|
|
626
|
+
_nbind.ArrayType = ArrayType;
|
|
627
|
+
function pushString(str, policyTbl) {
|
|
628
|
+
if (str === null || str === undefined) {
|
|
629
|
+
if (policyTbl && policyTbl['Nullable']) {
|
|
630
|
+
str = '';
|
|
631
|
+
} else throw new Error('Type mismatch');
|
|
632
|
+
}
|
|
633
|
+
if (policyTbl && policyTbl['Strict']) {
|
|
634
|
+
if (typeof str != 'string') throw new Error('Type mismatch');
|
|
635
|
+
} else str = str.toString();
|
|
636
|
+
var length = Module.lengthBytesUTF8(str);
|
|
637
|
+
// 32-bit length, string and a zero terminator
|
|
638
|
+
// (stringToUTF8Array insists on adding it)
|
|
639
|
+
var result = _nbind.Pool.lalloc(4 + length + 1);
|
|
640
|
+
HEAPU32[result / 4] = length;
|
|
641
|
+
Module.stringToUTF8Array(str, HEAPU8, result + 4, length + 1);
|
|
642
|
+
return result;
|
|
643
|
+
}
|
|
644
|
+
_nbind.pushString = pushString;
|
|
645
|
+
function popString(ptr) {
|
|
646
|
+
if (ptr === 0) return null;
|
|
647
|
+
var length = HEAPU32[ptr / 4];
|
|
648
|
+
return Module.Pointer_stringify(ptr + 4, length);
|
|
649
|
+
}
|
|
650
|
+
_nbind.popString = popString;
|
|
651
|
+
var StringType = function (_super) {
|
|
652
|
+
__extends(StringType, _super);
|
|
653
|
+
function StringType() {
|
|
654
|
+
var _this = _super !== null && _super.apply(this, arguments) || this;
|
|
655
|
+
_this.wireRead = popString;
|
|
656
|
+
_this.wireWrite = pushString;
|
|
657
|
+
_this.readResources = [_nbind.resources.pool];
|
|
658
|
+
_this.writeResources = [_nbind.resources.pool];
|
|
659
|
+
return _this;
|
|
660
|
+
}
|
|
661
|
+
StringType.prototype.makeWireWrite = function (expr, policyTbl) {
|
|
662
|
+
return function (arg) {
|
|
663
|
+
return pushString(arg, policyTbl);
|
|
664
|
+
};
|
|
665
|
+
};
|
|
666
|
+
return StringType;
|
|
667
|
+
}(_nbind.BindType);
|
|
668
|
+
_nbind.StringType = StringType;
|
|
669
|
+
var _ = function () {
|
|
670
|
+
function _() {}
|
|
671
|
+
return _;
|
|
672
|
+
}(); // tslint:disable-line:class-name
|
|
673
|
+
_ = __decorate([emscripten_library_decorator_1.prepareNamespace('_nbind')], _);
|
|
674
|
+
_nbind._ = _;
|
|
675
|
+
})(_nbind = exports._nbind || (exports._nbind = {}));
|
|
676
|
+
});
|
|
677
|
+
$__System.registerDynamic("14", ["e"], true, function ($__require, exports, module) {
|
|
678
|
+
var global = this || self,
|
|
679
|
+
GLOBAL = global;
|
|
680
|
+
// This file is part of nbind, copyright (C) 2014-2016 BusFaster Ltd.
|
|
681
|
+
// Released under the MIT license, see LICENSE.
|
|
682
|
+
var __decorate = exports && exports.__decorate || function (decorators, target, key, desc) {
|
|
683
|
+
var c = arguments.length,
|
|
684
|
+
r = c < 3 ? target : desc === null ? desc = Object.getOwnPropertyDescriptor(target, key) : desc,
|
|
685
|
+
d;
|
|
686
|
+
if (typeof Reflect === "object" && typeof Reflect.decorate === "function") r = Reflect.decorate(decorators, target, key, desc);else for (var i = decorators.length - 1; i >= 0; i--) if (d = decorators[i]) r = (c < 3 ? d(r) : c > 3 ? d(target, key, r) : d(target, key)) || r;
|
|
687
|
+
return c > 3 && r && Object.defineProperty(target, key, r), r;
|
|
688
|
+
};
|
|
689
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
690
|
+
// This file handles creating invoker functions for Emscripten dyncalls
|
|
691
|
+
// wrapped in type conversions for arguments and return values.
|
|
692
|
+
var emscripten_library_decorator_1 = $__require("e");
|
|
693
|
+
// Let decorators run eval in current scope to read function source code.
|
|
694
|
+
emscripten_library_decorator_1.setEvil(function (code) {
|
|
695
|
+
return eval(code);
|
|
696
|
+
});
|
|
697
|
+
var _nbind;
|
|
698
|
+
(function (_nbind) {
|
|
699
|
+
/** Make a list of argument names a1, a2, a3...
|
|
700
|
+
* for dynamically generating function source code. */
|
|
701
|
+
function makeArgList(argCount) {
|
|
702
|
+
return Array.apply(null, Array(argCount)).map(function (dummy, num) {
|
|
703
|
+
return 'a' + (num + 1);
|
|
704
|
+
});
|
|
705
|
+
}
|
|
706
|
+
/** Check if any type on the list requires conversion writing to C++.
|
|
707
|
+
* Mainly numbers can be passed as-is between Asm.js and JavaScript. */
|
|
708
|
+
function anyNeedsWireWrite(typeList, policyTbl) {
|
|
709
|
+
return typeList.reduce(function (result, type) {
|
|
710
|
+
return result || type.needsWireWrite(policyTbl);
|
|
711
|
+
}, false);
|
|
712
|
+
}
|
|
713
|
+
/** Check if any type on the list requires conversion reading from C++.
|
|
714
|
+
* Mainly numbers can be passed as-is between Asm.js and JavaScript. */
|
|
715
|
+
function anyNeedsWireRead(typeList, policyTbl) {
|
|
716
|
+
return typeList.reduce(function (result, type) {
|
|
717
|
+
return result || !!type.needsWireRead(policyTbl);
|
|
718
|
+
}, false);
|
|
719
|
+
}
|
|
720
|
+
function makeWireRead(convertParamList, policyTbl, type, expr) {
|
|
721
|
+
/** Next free slot number in type converter data list. */
|
|
722
|
+
var paramNum = convertParamList.length;
|
|
723
|
+
if (type.makeWireRead) {
|
|
724
|
+
return type.makeWireRead(expr, convertParamList, paramNum);
|
|
725
|
+
} else if (type.wireRead) {
|
|
726
|
+
convertParamList[paramNum] = type.wireRead;
|
|
727
|
+
return '(convertParamList[' + paramNum + '](' + expr + '))';
|
|
728
|
+
} else return expr;
|
|
729
|
+
}
|
|
730
|
+
function makeWireWrite(convertParamList, policyTbl, type, expr) {
|
|
731
|
+
var wireWrite;
|
|
732
|
+
/** Next free slot number in type converter data list. */
|
|
733
|
+
var paramNum = convertParamList.length;
|
|
734
|
+
if (type.makeWireWrite) {
|
|
735
|
+
wireWrite = type.makeWireWrite(expr, policyTbl, convertParamList, paramNum);
|
|
736
|
+
} else wireWrite = type.wireWrite;
|
|
737
|
+
if (wireWrite) {
|
|
738
|
+
if (typeof wireWrite == 'string') {
|
|
739
|
+
return wireWrite;
|
|
740
|
+
} else {
|
|
741
|
+
convertParamList[paramNum] = wireWrite;
|
|
742
|
+
return '(convertParamList[' + paramNum + '](' + expr + '))';
|
|
743
|
+
}
|
|
744
|
+
} else return expr;
|
|
745
|
+
}
|
|
746
|
+
/** Dynamically build a function that calls an Asm.js invoker
|
|
747
|
+
* with appropriate type conversion for complicated types:
|
|
748
|
+
* - Push arguments to stack.
|
|
749
|
+
* - Read return value.
|
|
750
|
+
* - Restore stack pointer if necessary. */
|
|
751
|
+
function buildCallerFunction(dynCall, ptrType, ptr, num, policyTbl, needsWireWrite, prefix, returnType, argTypeList, mask, err) {
|
|
752
|
+
var argList = makeArgList(argTypeList.length);
|
|
753
|
+
/** List of arbitrary data for type converters.
|
|
754
|
+
* Each one may read and write its own slot. */
|
|
755
|
+
var convertParamList = [];
|
|
756
|
+
// Build code for function call and type conversion.
|
|
757
|
+
var callExpression = makeWireRead(convertParamList, policyTbl, returnType, 'dynCall(' + [prefix].concat(argList.map(
|
|
758
|
+
// TODO: if one wireWrite throws,
|
|
759
|
+
// resources allocated by others may leak!
|
|
760
|
+
function (name, index) {
|
|
761
|
+
return makeWireWrite(convertParamList, policyTbl, argTypeList[index], name);
|
|
762
|
+
})).join(',') + ')');
|
|
763
|
+
// Build code to allocate and free the stack etc. if necessary.
|
|
764
|
+
var resourceSet = _nbind.listResources([returnType], argTypeList);
|
|
765
|
+
var sourceCode = 'function(' + argList.join(',') + '){' + (mask ? 'this.__nbindFlags&mask&&err();' : '') + resourceSet.makeOpen() + 'var r=' + callExpression + ';' + resourceSet.makeClose() + 'return r;' + '}';
|
|
766
|
+
// Use eval to allow JIT compiling the function.
|
|
767
|
+
return eval('(' + sourceCode + ')');
|
|
768
|
+
}
|
|
769
|
+
/** Dynamically build a function that calls a JavaScript callback invoker
|
|
770
|
+
* with appropriate type conversion for complicated types:
|
|
771
|
+
* - Read arguments from stack.
|
|
772
|
+
* - Push return value.
|
|
773
|
+
* - Restore stack pointer if necessary. */
|
|
774
|
+
function buildJSCallerFunction(returnType, argTypeList) {
|
|
775
|
+
var argList = makeArgList(argTypeList.length);
|
|
776
|
+
/** List of arbitrary data for type converters.
|
|
777
|
+
* Each one may read and write its own slot. */
|
|
778
|
+
var convertParamList = [];
|
|
779
|
+
var callExpression = makeWireWrite(convertParamList, null, returnType, '_nbind.externalList[num].data(' + argList.map(
|
|
780
|
+
// TODO: if one wireRead throws,
|
|
781
|
+
// resources held by others may leak!
|
|
782
|
+
function (name, index) {
|
|
783
|
+
return makeWireRead(convertParamList, null, argTypeList[index], name);
|
|
784
|
+
}).join(',') + ')');
|
|
785
|
+
var resourceSet = _nbind.listResources(argTypeList, [returnType]);
|
|
786
|
+
// Let the calling C++ side handle resetting the pool (using the
|
|
787
|
+
// PoolRestore class) after parsing the callback return value passed
|
|
788
|
+
// through the pool.
|
|
789
|
+
resourceSet.remove(_nbind.resources.pool);
|
|
790
|
+
var sourceCode = 'function(' + ['dummy', 'num'].concat(argList).join(',') + '){' + resourceSet.makeOpen() + 'var r=' + callExpression + ';' + resourceSet.makeClose() + 'return r;' + '}';
|
|
791
|
+
// Use eval to allow JIT compiling the function.
|
|
792
|
+
return eval('(' + sourceCode + ')');
|
|
793
|
+
}
|
|
794
|
+
_nbind.buildJSCallerFunction = buildJSCallerFunction;
|
|
795
|
+
/* tslint:disable:indent */
|
|
796
|
+
/** Dynamically create an invoker for a JavaScript callback. */
|
|
797
|
+
function makeJSCaller(idList) {
|
|
798
|
+
var argCount = idList.length - 1;
|
|
799
|
+
var typeList = _nbind.getTypes(idList, 'callback');
|
|
800
|
+
var returnType = typeList[0];
|
|
801
|
+
var argTypeList = typeList.slice(1);
|
|
802
|
+
var needsWireRead = anyNeedsWireRead(argTypeList, null);
|
|
803
|
+
var needsWireWrite = returnType.needsWireWrite(null);
|
|
804
|
+
if (!needsWireWrite && !needsWireRead) {
|
|
805
|
+
switch (argCount) {
|
|
806
|
+
case 0:
|
|
807
|
+
return function (dummy, num) {
|
|
808
|
+
return _nbind.externalList[num].data();
|
|
809
|
+
};
|
|
810
|
+
case 1:
|
|
811
|
+
return function (dummy, num, a1) {
|
|
812
|
+
return _nbind.externalList[num].data(a1);
|
|
813
|
+
};
|
|
814
|
+
case 2:
|
|
815
|
+
return function (dummy, num, a1, a2) {
|
|
816
|
+
return _nbind.externalList[num].data(a1, a2);
|
|
817
|
+
};
|
|
818
|
+
case 3:
|
|
819
|
+
return function (dummy, num, a1, a2, a3) {
|
|
820
|
+
return _nbind.externalList[num].data(a1, a2, a3);
|
|
821
|
+
};
|
|
822
|
+
default:
|
|
823
|
+
// Function takes over 3 arguments.
|
|
824
|
+
// Let's create the invoker dynamically then.
|
|
825
|
+
break;
|
|
826
|
+
}
|
|
827
|
+
}
|
|
828
|
+
return buildJSCallerFunction(returnType, argTypeList);
|
|
829
|
+
}
|
|
830
|
+
_nbind.makeJSCaller = makeJSCaller;
|
|
831
|
+
/** Dynamically create an invoker function for calling a C++ class method. */
|
|
832
|
+
function makeMethodCaller(ptrType, spec) {
|
|
833
|
+
var argCount = spec.typeList.length - 1;
|
|
834
|
+
// The method invoker function adds two arguments to those of the method:
|
|
835
|
+
// - Number of the method in a list of methods with identical signatures.
|
|
836
|
+
// - Target object
|
|
837
|
+
var typeIdList = spec.typeList.slice(0);
|
|
838
|
+
typeIdList.splice(1, 0, 'uint32_t', spec.boundID);
|
|
839
|
+
var typeList = _nbind.getTypes(typeIdList, spec.title);
|
|
840
|
+
var returnType = typeList[0];
|
|
841
|
+
var argTypeList = typeList.slice(3);
|
|
842
|
+
var needsWireRead = returnType.needsWireRead(spec.policyTbl);
|
|
843
|
+
var needsWireWrite = anyNeedsWireWrite(argTypeList, spec.policyTbl);
|
|
844
|
+
var ptr = spec.ptr;
|
|
845
|
+
var num = spec.num;
|
|
846
|
+
var dynCall = _nbind.getDynCall(typeList, spec.title);
|
|
847
|
+
var mask = ~spec.flags & 1 /* isConst */;
|
|
848
|
+
function err() {
|
|
849
|
+
throw new Error('Calling a non-const method on a const object');
|
|
850
|
+
}
|
|
851
|
+
if (!needsWireRead && !needsWireWrite) {
|
|
852
|
+
// If there are only a few arguments not requiring type conversion,
|
|
853
|
+
// build a simple invoker function without using eval.
|
|
854
|
+
switch (argCount) {
|
|
855
|
+
case 0:
|
|
856
|
+
return function () {
|
|
857
|
+
return this.__nbindFlags & mask ? err() : dynCall(ptr, num, _nbind.pushPointer(this, ptrType));
|
|
858
|
+
};
|
|
859
|
+
case 1:
|
|
860
|
+
return function (a1) {
|
|
861
|
+
return this.__nbindFlags & mask ? err() : dynCall(ptr, num, _nbind.pushPointer(this, ptrType), a1);
|
|
862
|
+
};
|
|
863
|
+
case 2:
|
|
864
|
+
return function (a1, a2) {
|
|
865
|
+
return this.__nbindFlags & mask ? err() : dynCall(ptr, num, _nbind.pushPointer(this, ptrType), a1, a2);
|
|
866
|
+
};
|
|
867
|
+
case 3:
|
|
868
|
+
return function (a1, a2, a3) {
|
|
869
|
+
return this.__nbindFlags & mask ? err() : dynCall(ptr, num, _nbind.pushPointer(this, ptrType), a1, a2, a3);
|
|
870
|
+
};
|
|
871
|
+
default:
|
|
872
|
+
// Function takes over 3 arguments or needs type conversion.
|
|
873
|
+
// Let's create the invoker dynamically then.
|
|
874
|
+
break;
|
|
875
|
+
}
|
|
876
|
+
}
|
|
877
|
+
return buildCallerFunction(dynCall, ptrType, ptr, num, spec.policyTbl, needsWireWrite, 'ptr,num,pushPointer(this,ptrType)', returnType, argTypeList, mask, err);
|
|
878
|
+
}
|
|
879
|
+
_nbind.makeMethodCaller = makeMethodCaller;
|
|
880
|
+
/** Dynamically create an invoker function for calling a C++ function. */
|
|
881
|
+
function makeCaller(spec) {
|
|
882
|
+
var argCount = spec.typeList.length - 1;
|
|
883
|
+
var typeList = _nbind.getTypes(spec.typeList, spec.title);
|
|
884
|
+
var returnType = typeList[0];
|
|
885
|
+
var argTypeList = typeList.slice(1);
|
|
886
|
+
var needsWireRead = returnType.needsWireRead(spec.policyTbl);
|
|
887
|
+
var needsWireWrite = anyNeedsWireWrite(argTypeList, spec.policyTbl);
|
|
888
|
+
var direct = spec.direct;
|
|
889
|
+
var dynCall;
|
|
890
|
+
var ptr = spec.ptr;
|
|
891
|
+
if (spec.direct && !needsWireRead && !needsWireWrite) {
|
|
892
|
+
// If there are only a few arguments not requiring type conversion,
|
|
893
|
+
// build a simple invoker function without using eval.
|
|
894
|
+
dynCall = _nbind.getDynCall(typeList, spec.title);
|
|
895
|
+
switch (argCount) {
|
|
896
|
+
case 0:
|
|
897
|
+
return function () {
|
|
898
|
+
return dynCall(direct);
|
|
899
|
+
};
|
|
900
|
+
case 1:
|
|
901
|
+
return function (a1) {
|
|
902
|
+
return dynCall(direct, a1);
|
|
903
|
+
};
|
|
904
|
+
case 2:
|
|
905
|
+
return function (a1, a2) {
|
|
906
|
+
return dynCall(direct, a1, a2);
|
|
907
|
+
};
|
|
908
|
+
case 3:
|
|
909
|
+
return function (a1, a2, a3) {
|
|
910
|
+
return dynCall(direct, a1, a2, a3);
|
|
911
|
+
};
|
|
912
|
+
default:
|
|
913
|
+
// Function takes over 3 arguments.
|
|
914
|
+
// Let's create the invoker dynamically then.
|
|
915
|
+
break;
|
|
916
|
+
}
|
|
917
|
+
// Input and output types don't need conversion so omit dispatcher.
|
|
918
|
+
ptr = 0;
|
|
919
|
+
}
|
|
920
|
+
var prefix;
|
|
921
|
+
if (ptr) {
|
|
922
|
+
// The function invoker adds an argument to those of the function:
|
|
923
|
+
// - Number of the function in a list of functions with identical signatures.
|
|
924
|
+
var typeIdList = spec.typeList.slice(0);
|
|
925
|
+
typeIdList.splice(1, 0, 'uint32_t');
|
|
926
|
+
typeList = _nbind.getTypes(typeIdList, spec.title);
|
|
927
|
+
prefix = 'ptr,num';
|
|
928
|
+
} else {
|
|
929
|
+
ptr = direct;
|
|
930
|
+
prefix = 'ptr';
|
|
931
|
+
}
|
|
932
|
+
// Type ID list was changed.
|
|
933
|
+
dynCall = _nbind.getDynCall(typeList, spec.title);
|
|
934
|
+
return buildCallerFunction(dynCall, null, ptr, spec.num, spec.policyTbl, needsWireWrite, prefix, returnType, argTypeList);
|
|
935
|
+
}
|
|
936
|
+
_nbind.makeCaller = makeCaller;
|
|
937
|
+
/* tslint:enable:indent */
|
|
938
|
+
/** Create an overloader that can call several methods with the same name,
|
|
939
|
+
* depending on the number of arguments passed in the call. */
|
|
940
|
+
function makeOverloader(func, arity) {
|
|
941
|
+
var callerList = [];
|
|
942
|
+
function call() {
|
|
943
|
+
return callerList[arguments.length].apply(this, arguments);
|
|
944
|
+
}
|
|
945
|
+
call.addMethod = function (_func, _arity) {
|
|
946
|
+
callerList[_arity] = _func;
|
|
947
|
+
};
|
|
948
|
+
call.addMethod(func, arity);
|
|
949
|
+
return call;
|
|
950
|
+
}
|
|
951
|
+
_nbind.makeOverloader = makeOverloader;
|
|
952
|
+
var _ = function () {
|
|
953
|
+
function _() {}
|
|
954
|
+
return _;
|
|
955
|
+
}(); // tslint:disable-line:class-name
|
|
956
|
+
_ = __decorate([emscripten_library_decorator_1.prepareNamespace('_nbind')], _);
|
|
957
|
+
_nbind._ = _;
|
|
958
|
+
})(_nbind = exports._nbind || (exports._nbind = {}));
|
|
959
|
+
});
|
|
960
|
+
$__System.registerDynamic("d", ["e"], true, function ($__require, exports, module) {
|
|
961
|
+
var global = this || self,
|
|
962
|
+
GLOBAL = global;
|
|
963
|
+
// This file is part of nbind, copyright (C) 2014-2016 BusFaster Ltd.
|
|
964
|
+
// Released under the MIT license, see LICENSE.
|
|
965
|
+
var __extends = exports && exports.__extends || function () {
|
|
966
|
+
var extendStatics = Object.setPrototypeOf || { __proto__: [] } instanceof Array && function (d, b) {
|
|
967
|
+
d.__proto__ = b;
|
|
968
|
+
} || function (d, b) {
|
|
969
|
+
for (var p in b) if (b.hasOwnProperty(p)) d[p] = b[p];
|
|
970
|
+
};
|
|
971
|
+
return function (d, b) {
|
|
972
|
+
extendStatics(d, b);
|
|
973
|
+
function __() {
|
|
974
|
+
this.constructor = d;
|
|
975
|
+
}
|
|
976
|
+
d.prototype = b === null ? Object.create(b) : (__.prototype = b.prototype, new __());
|
|
977
|
+
};
|
|
978
|
+
}();
|
|
979
|
+
var __decorate = exports && exports.__decorate || function (decorators, target, key, desc) {
|
|
980
|
+
var c = arguments.length,
|
|
981
|
+
r = c < 3 ? target : desc === null ? desc = Object.getOwnPropertyDescriptor(target, key) : desc,
|
|
982
|
+
d;
|
|
983
|
+
if (typeof Reflect === "object" && typeof Reflect.decorate === "function") r = Reflect.decorate(decorators, target, key, desc);else for (var i = decorators.length - 1; i >= 0; i--) if (d = decorators[i]) r = (c < 3 ? d(r) : c > 3 ? d(target, key, r) : d(target, key)) || r;
|
|
984
|
+
return c > 3 && r && Object.defineProperty(target, key, r), r;
|
|
985
|
+
};
|
|
986
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
987
|
+
var emscripten_library_decorator_1 = $__require("e");
|
|
988
|
+
// Let decorators run eval in current scope to read function source code.
|
|
989
|
+
emscripten_library_decorator_1.setEvil(function (code) {
|
|
990
|
+
return eval(code);
|
|
991
|
+
});
|
|
992
|
+
var _defineHidden = emscripten_library_decorator_1.defineHidden;
|
|
993
|
+
var _nbind;
|
|
994
|
+
(function (_nbind) {
|
|
995
|
+
/** Base class for wrapped instances of bound C++ classes.
|
|
996
|
+
* Note that some hacks avoid ever constructing this,
|
|
997
|
+
* so initializing values inside its definition won't work. */
|
|
998
|
+
var Wrapper = function () {
|
|
999
|
+
function Wrapper() {}
|
|
1000
|
+
Wrapper.prototype.persist = function () {
|
|
1001
|
+
this.__nbindState |= 1 /* isPersistent */;
|
|
1002
|
+
};
|
|
1003
|
+
return Wrapper;
|
|
1004
|
+
}();
|
|
1005
|
+
_nbind.Wrapper = Wrapper;
|
|
1006
|
+
function makeBound(policyTbl, bindClass) {
|
|
1007
|
+
var Bound = function (_super) {
|
|
1008
|
+
__extends(Bound, _super);
|
|
1009
|
+
function Bound(marker, flags, ptr, shared) {
|
|
1010
|
+
var _this = _super.call(this) || this;
|
|
1011
|
+
if (!(_this instanceof Bound)) {
|
|
1012
|
+
// Constructor called without new operator.
|
|
1013
|
+
// Make correct call with given arguments.
|
|
1014
|
+
// Few ways to do this work. This one should. See:
|
|
1015
|
+
// http://stackoverflow.com/questions/1606797
|
|
1016
|
+
// /use-of-apply-with-new-operator-is-this-possible
|
|
1017
|
+
return new (Function.prototype.bind.apply(Bound, // arguments.callee
|
|
1018
|
+
Array.prototype.concat.apply([null], arguments)))();
|
|
1019
|
+
}
|
|
1020
|
+
var nbindFlags = flags;
|
|
1021
|
+
var nbindPtr = ptr;
|
|
1022
|
+
var nbindShared = shared;
|
|
1023
|
+
if (marker !== _nbind.ptrMarker) {
|
|
1024
|
+
var wirePtr = _this.__nbindConstructor.apply(_this, arguments);
|
|
1025
|
+
nbindFlags = 4096 /* isSharedClassPtr */ | 512 /* isSharedPtr */;
|
|
1026
|
+
nbindShared = HEAPU32[wirePtr / 4];
|
|
1027
|
+
nbindPtr = HEAPU32[wirePtr / 4 + 1];
|
|
1028
|
+
}
|
|
1029
|
+
var spec = {
|
|
1030
|
+
configurable: true,
|
|
1031
|
+
enumerable: false,
|
|
1032
|
+
value: null,
|
|
1033
|
+
writable: false
|
|
1034
|
+
};
|
|
1035
|
+
var propTbl = {
|
|
1036
|
+
'__nbindFlags': nbindFlags,
|
|
1037
|
+
'__nbindPtr': nbindPtr
|
|
1038
|
+
};
|
|
1039
|
+
if (nbindShared) {
|
|
1040
|
+
propTbl['__nbindShared'] = nbindShared;
|
|
1041
|
+
_nbind.mark(_this);
|
|
1042
|
+
}
|
|
1043
|
+
for (var _i = 0, _a = Object.keys(propTbl); _i < _a.length; _i++) {
|
|
1044
|
+
var key = _a[_i];
|
|
1045
|
+
spec.value = propTbl[key];
|
|
1046
|
+
Object.defineProperty(_this, key, spec);
|
|
1047
|
+
}
|
|
1048
|
+
_defineHidden(0 /* none */)(_this, '__nbindState');
|
|
1049
|
+
return _this;
|
|
1050
|
+
}
|
|
1051
|
+
Bound.prototype.free = function () {
|
|
1052
|
+
bindClass.destroy.call(this, this.__nbindShared, this.__nbindFlags);
|
|
1053
|
+
this.__nbindState |= 2 /* isDeleted */;
|
|
1054
|
+
disableMember(this, '__nbindShared');
|
|
1055
|
+
disableMember(this, '__nbindPtr');
|
|
1056
|
+
};
|
|
1057
|
+
return Bound;
|
|
1058
|
+
}(Wrapper);
|
|
1059
|
+
__decorate([_defineHidden()
|
|
1060
|
+
// tslint:disable-next-line:variable-name
|
|
1061
|
+
], Bound.prototype, "__nbindConstructor", void 0);
|
|
1062
|
+
__decorate([_defineHidden()
|
|
1063
|
+
// tslint:disable-next-line:variable-name
|
|
1064
|
+
], Bound.prototype, "__nbindValueConstructor", void 0);
|
|
1065
|
+
__decorate([_defineHidden(policyTbl)
|
|
1066
|
+
// tslint:disable-next-line:variable-name
|
|
1067
|
+
], Bound.prototype, "__nbindPolicies", void 0);
|
|
1068
|
+
return Bound;
|
|
1069
|
+
}
|
|
1070
|
+
_nbind.makeBound = makeBound;
|
|
1071
|
+
function disableMember(obj, name) {
|
|
1072
|
+
function die() {
|
|
1073
|
+
throw new Error('Accessing deleted object');
|
|
1074
|
+
}
|
|
1075
|
+
Object.defineProperty(obj, name, {
|
|
1076
|
+
configurable: false,
|
|
1077
|
+
enumerable: false,
|
|
1078
|
+
get: die,
|
|
1079
|
+
set: die
|
|
1080
|
+
});
|
|
1081
|
+
}
|
|
1082
|
+
var _ = function () {
|
|
1083
|
+
function _() {}
|
|
1084
|
+
return _;
|
|
1085
|
+
}(); // tslint:disable-line:class-name
|
|
1086
|
+
_ = __decorate([emscripten_library_decorator_1.prepareNamespace('_nbind')], _);
|
|
1087
|
+
_nbind._ = _;
|
|
1088
|
+
})(_nbind = exports._nbind || (exports._nbind = {}));
|
|
1089
|
+
});
|
|
1090
|
+
$__System.registerDynamic("15", ["e"], true, function ($__require, exports, module) {
|
|
1091
|
+
var global = this || self,
|
|
1092
|
+
GLOBAL = global;
|
|
1093
|
+
// This file is part of nbind, copyright (C) 2014-2016 BusFaster Ltd.
|
|
1094
|
+
// Released under the MIT license, see LICENSE.
|
|
1095
|
+
var __decorate = exports && exports.__decorate || function (decorators, target, key, desc) {
|
|
1096
|
+
var c = arguments.length,
|
|
1097
|
+
r = c < 3 ? target : desc === null ? desc = Object.getOwnPropertyDescriptor(target, key) : desc,
|
|
1098
|
+
d;
|
|
1099
|
+
if (typeof Reflect === "object" && typeof Reflect.decorate === "function") r = Reflect.decorate(decorators, target, key, desc);else for (var i = decorators.length - 1; i >= 0; i--) if (d = decorators[i]) r = (c < 3 ? d(r) : c > 3 ? d(target, key, r) : d(target, key)) || r;
|
|
1100
|
+
return c > 3 && r && Object.defineProperty(target, key, r), r;
|
|
1101
|
+
};
|
|
1102
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
1103
|
+
// This file handles resource allocation and freeing for invoker functions.
|
|
1104
|
+
// For example if any type conversion requires space in the C++ stack,
|
|
1105
|
+
// at the end of the invoker it must be reset as it was before.
|
|
1106
|
+
var emscripten_library_decorator_1 = $__require("e");
|
|
1107
|
+
// Let decorators run eval in current scope to read function source code.
|
|
1108
|
+
emscripten_library_decorator_1.setEvil(function (code) {
|
|
1109
|
+
return eval(code);
|
|
1110
|
+
});
|
|
1111
|
+
var _nbind;
|
|
1112
|
+
(function (_nbind) {
|
|
1113
|
+
var Resource = function () {
|
|
1114
|
+
function Resource(open, close) {
|
|
1115
|
+
var _this = this;
|
|
1116
|
+
this.makeOpen = function () {
|
|
1117
|
+
return Object.keys(_this.openTbl).join('');
|
|
1118
|
+
};
|
|
1119
|
+
this.makeClose = function () {
|
|
1120
|
+
return Object.keys(_this.closeTbl).join('');
|
|
1121
|
+
};
|
|
1122
|
+
this.openTbl = {};
|
|
1123
|
+
this.closeTbl = {};
|
|
1124
|
+
if (open) this.openTbl[open] = true;
|
|
1125
|
+
if (close) this.closeTbl[close] = true;
|
|
1126
|
+
}
|
|
1127
|
+
Resource.prototype.add = function (other) {
|
|
1128
|
+
for (var _i = 0, _a = Object.keys(other.openTbl); _i < _a.length; _i++) {
|
|
1129
|
+
var key = _a[_i];
|
|
1130
|
+
this.openTbl[key] = true;
|
|
1131
|
+
}
|
|
1132
|
+
for (var _b = 0, _c = Object.keys(other.closeTbl); _b < _c.length; _b++) {
|
|
1133
|
+
var key = _c[_b];
|
|
1134
|
+
this.closeTbl[key] = true;
|
|
1135
|
+
}
|
|
1136
|
+
};
|
|
1137
|
+
Resource.prototype.remove = function (other) {
|
|
1138
|
+
for (var _i = 0, _a = Object.keys(other.openTbl); _i < _a.length; _i++) {
|
|
1139
|
+
var key = _a[_i];
|
|
1140
|
+
delete this.openTbl[key];
|
|
1141
|
+
}
|
|
1142
|
+
for (var _b = 0, _c = Object.keys(other.closeTbl); _b < _c.length; _b++) {
|
|
1143
|
+
var key = _c[_b];
|
|
1144
|
+
delete this.closeTbl[key];
|
|
1145
|
+
}
|
|
1146
|
+
};
|
|
1147
|
+
return Resource;
|
|
1148
|
+
}();
|
|
1149
|
+
_nbind.Resource = Resource;
|
|
1150
|
+
/** Create a single resource with open and close code included
|
|
1151
|
+
* once from each type of resource needed by a list of types. */
|
|
1152
|
+
function listResources(readList, writeList) {
|
|
1153
|
+
var result = new Resource();
|
|
1154
|
+
for (var _i = 0, readList_1 = readList; _i < readList_1.length; _i++) {
|
|
1155
|
+
var bindType = readList_1[_i];
|
|
1156
|
+
for (var _a = 0, _b = bindType.readResources || []; _a < _b.length; _a++) {
|
|
1157
|
+
var resource = _b[_a];
|
|
1158
|
+
result.add(resource);
|
|
1159
|
+
}
|
|
1160
|
+
}
|
|
1161
|
+
for (var _c = 0, writeList_1 = writeList; _c < writeList_1.length; _c++) {
|
|
1162
|
+
var bindType = writeList_1[_c];
|
|
1163
|
+
for (var _d = 0, _e = bindType.writeResources || []; _d < _e.length; _d++) {
|
|
1164
|
+
var resource = _e[_d];
|
|
1165
|
+
result.add(resource);
|
|
1166
|
+
}
|
|
1167
|
+
}
|
|
1168
|
+
return result;
|
|
1169
|
+
}
|
|
1170
|
+
_nbind.listResources = listResources;
|
|
1171
|
+
_nbind.resources = {
|
|
1172
|
+
pool: new Resource('var used=HEAPU32[_nbind.Pool.usedPtr],page=HEAPU32[_nbind.Pool.pagePtr];', '_nbind.Pool.lreset(used,page);')
|
|
1173
|
+
/*
|
|
1174
|
+
stack: new Resource(
|
|
1175
|
+
'var sp=Runtime.stackSave();',
|
|
1176
|
+
'Runtime.stackRestore(sp);'
|
|
1177
|
+
)
|
|
1178
|
+
*/
|
|
1179
|
+
};
|
|
1180
|
+
var _ = function () {
|
|
1181
|
+
function _() {}
|
|
1182
|
+
return _;
|
|
1183
|
+
}(); // tslint:disable-line:class-name
|
|
1184
|
+
_ = __decorate([emscripten_library_decorator_1.prepareNamespace('_nbind')], _);
|
|
1185
|
+
_nbind._ = _;
|
|
1186
|
+
})(_nbind = exports._nbind || (exports._nbind = {}));
|
|
1187
|
+
});
|
|
1188
|
+
$__System.registerDynamic("13", ["e"], true, function ($__require, exports, module) {
|
|
1189
|
+
var global = this || self,
|
|
1190
|
+
GLOBAL = global;
|
|
1191
|
+
// This file is part of nbind, copyright (C) 2014-2016 BusFaster Ltd.
|
|
1192
|
+
// Released under the MIT license, see LICENSE.
|
|
1193
|
+
var __decorate = exports && exports.__decorate || function (decorators, target, key, desc) {
|
|
1194
|
+
var c = arguments.length,
|
|
1195
|
+
r = c < 3 ? target : desc === null ? desc = Object.getOwnPropertyDescriptor(target, key) : desc,
|
|
1196
|
+
d;
|
|
1197
|
+
if (typeof Reflect === "object" && typeof Reflect.decorate === "function") r = Reflect.decorate(decorators, target, key, desc);else for (var i = decorators.length - 1; i >= 0; i--) if (d = decorators[i]) r = (c < 3 ? d(r) : c > 3 ? d(target, key, r) : d(target, key)) || r;
|
|
1198
|
+
return c > 3 && r && Object.defineProperty(target, key, r), r;
|
|
1199
|
+
};
|
|
1200
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
1201
|
+
// This file contains some assorted functions.
|
|
1202
|
+
var emscripten_library_decorator_1 = $__require("e");
|
|
1203
|
+
// Let decorators run eval in current scope to read function source code.
|
|
1204
|
+
emscripten_library_decorator_1.setEvil(function (code) {
|
|
1205
|
+
return eval(code);
|
|
1206
|
+
});
|
|
1207
|
+
// Namespace that will be made available inside Emscripten compiled module.
|
|
1208
|
+
var _nbind;
|
|
1209
|
+
(function (_nbind) {
|
|
1210
|
+
// Generic table and list of functions.
|
|
1211
|
+
// Mapping from numeric typeIDs and type names to objects with type information.
|
|
1212
|
+
var typeIdTbl = {};
|
|
1213
|
+
_nbind.typeNameTbl = {};
|
|
1214
|
+
var Pool = function () {
|
|
1215
|
+
function Pool() {}
|
|
1216
|
+
Pool.lalloc = function (size) {
|
|
1217
|
+
// Round size up to a multiple of 8 bytes (size of a double)
|
|
1218
|
+
// to align pointers allocated later.
|
|
1219
|
+
size = size + 7 & ~7;
|
|
1220
|
+
var used = HEAPU32[Pool.usedPtr];
|
|
1221
|
+
if (size > Pool.pageSize / 2 || size > Pool.pageSize - used) {
|
|
1222
|
+
var NBind = _nbind.typeNameTbl['NBind'].proto;
|
|
1223
|
+
return NBind.lalloc(size);
|
|
1224
|
+
} else {
|
|
1225
|
+
HEAPU32[Pool.usedPtr] = used + size;
|
|
1226
|
+
return Pool.rootPtr + used;
|
|
1227
|
+
}
|
|
1228
|
+
};
|
|
1229
|
+
/** Reset linear allocator to a previous state, effectively to free
|
|
1230
|
+
* a stack frame. */
|
|
1231
|
+
Pool.lreset = function (used, page) {
|
|
1232
|
+
var topPage = HEAPU32[Pool.pagePtr];
|
|
1233
|
+
if (topPage) {
|
|
1234
|
+
var NBind = _nbind.typeNameTbl['NBind'].proto;
|
|
1235
|
+
NBind.lreset(used, page);
|
|
1236
|
+
} else {
|
|
1237
|
+
HEAPU32[Pool.usedPtr] = used;
|
|
1238
|
+
}
|
|
1239
|
+
};
|
|
1240
|
+
return Pool;
|
|
1241
|
+
}();
|
|
1242
|
+
_nbind.Pool = Pool;
|
|
1243
|
+
function constructType(kind, spec) {
|
|
1244
|
+
var construct = kind == 10240 /* isOther */ ? _nbind.makeTypeNameTbl[spec.name] || _nbind.BindType : _nbind.makeTypeKindTbl[kind];
|
|
1245
|
+
// console.error(spec.id + ' ' + spec.name + ' ' + kind); // tslint:disable-line
|
|
1246
|
+
// console.error(construct.toString()); // tslint:disable-line
|
|
1247
|
+
var bindType = new construct(spec);
|
|
1248
|
+
typeIdTbl[spec.id] = bindType;
|
|
1249
|
+
_nbind.typeNameTbl[spec.name] = bindType;
|
|
1250
|
+
return bindType;
|
|
1251
|
+
}
|
|
1252
|
+
_nbind.constructType = constructType;
|
|
1253
|
+
function getType(id) {
|
|
1254
|
+
return typeIdTbl[id];
|
|
1255
|
+
}
|
|
1256
|
+
_nbind.getType = getType;
|
|
1257
|
+
function queryType(id) {
|
|
1258
|
+
var placeholderFlag = HEAPU8[id];
|
|
1259
|
+
var paramCount = _nbind.structureList[placeholderFlag][1];
|
|
1260
|
+
id /= 4;
|
|
1261
|
+
if (paramCount < 0) {
|
|
1262
|
+
++id;
|
|
1263
|
+
paramCount = HEAPU32[id] + 1;
|
|
1264
|
+
}
|
|
1265
|
+
var paramList = Array.prototype.slice.call(HEAPU32.subarray(id + 1, id + 1 + paramCount));
|
|
1266
|
+
if (placeholderFlag == 9 /* callback */) {
|
|
1267
|
+
paramList = [paramList[0], paramList.slice(1)];
|
|
1268
|
+
}
|
|
1269
|
+
return {
|
|
1270
|
+
paramList: paramList,
|
|
1271
|
+
placeholderFlag: placeholderFlag
|
|
1272
|
+
};
|
|
1273
|
+
}
|
|
1274
|
+
_nbind.queryType = queryType;
|
|
1275
|
+
// Look up a list of type objects based on their numeric typeID or name.
|
|
1276
|
+
function getTypes(idList, place) {
|
|
1277
|
+
return idList.map(function (id) {
|
|
1278
|
+
return typeof id == 'number' ? _nbind.getComplexType(id, constructType, getType, queryType, place) : _nbind.typeNameTbl[id];
|
|
1279
|
+
});
|
|
1280
|
+
}
|
|
1281
|
+
_nbind.getTypes = getTypes;
|
|
1282
|
+
function readTypeIdList(typeListPtr, typeCount) {
|
|
1283
|
+
return Array.prototype.slice.call(HEAPU32, typeListPtr / 4, typeListPtr / 4 + typeCount);
|
|
1284
|
+
}
|
|
1285
|
+
_nbind.readTypeIdList = readTypeIdList;
|
|
1286
|
+
function readAsciiString(ptr) {
|
|
1287
|
+
var endPtr = ptr;
|
|
1288
|
+
while (HEAPU8[endPtr++]);
|
|
1289
|
+
return String.fromCharCode.apply('', HEAPU8.subarray(ptr, endPtr - 1));
|
|
1290
|
+
}
|
|
1291
|
+
_nbind.readAsciiString = readAsciiString;
|
|
1292
|
+
function readPolicyList(policyListPtr) {
|
|
1293
|
+
var policyTbl = {};
|
|
1294
|
+
if (policyListPtr) {
|
|
1295
|
+
while (1) {
|
|
1296
|
+
var namePtr = HEAPU32[policyListPtr / 4];
|
|
1297
|
+
if (!namePtr) break;
|
|
1298
|
+
policyTbl[readAsciiString(namePtr)] = true;
|
|
1299
|
+
policyListPtr += 4;
|
|
1300
|
+
}
|
|
1301
|
+
}
|
|
1302
|
+
return policyTbl;
|
|
1303
|
+
}
|
|
1304
|
+
_nbind.readPolicyList = readPolicyList;
|
|
1305
|
+
// Generate a mangled signature from argument types.
|
|
1306
|
+
// Asm.js functions can only be called though Emscripten-generated invoker functions,
|
|
1307
|
+
// with slightly mangled type signatures appended to their names.
|
|
1308
|
+
// tslint:disable-next-line:no-shadowed-variable
|
|
1309
|
+
function getDynCall(typeList, name) {
|
|
1310
|
+
var mangleMap = {
|
|
1311
|
+
float32_t: 'd',
|
|
1312
|
+
float64_t: 'd',
|
|
1313
|
+
int64_t: 'd',
|
|
1314
|
+
uint64_t: 'd',
|
|
1315
|
+
void: 'v'
|
|
1316
|
+
};
|
|
1317
|
+
var signature = typeList.map(function (type) {
|
|
1318
|
+
return mangleMap[type.name] || 'i';
|
|
1319
|
+
}).join('');
|
|
1320
|
+
var dynCall = Module['dynCall_' + signature];
|
|
1321
|
+
if (!dynCall) {
|
|
1322
|
+
throw new Error('dynCall_' + signature + ' not found for ' + name + '(' + typeList.map(function (type) {
|
|
1323
|
+
return type.name;
|
|
1324
|
+
}).join(', ') + ')');
|
|
1325
|
+
}
|
|
1326
|
+
return dynCall;
|
|
1327
|
+
}
|
|
1328
|
+
_nbind.getDynCall = getDynCall;
|
|
1329
|
+
// Add a method to a C++ class constructor (for static methods) or prototype,
|
|
1330
|
+
// or overload an existing method.
|
|
1331
|
+
function addMethod(obj, name, func, arity) {
|
|
1332
|
+
var overload = obj[name];
|
|
1333
|
+
// Check if the function has been overloaded.
|
|
1334
|
+
if (obj.hasOwnProperty(name) && overload) {
|
|
1335
|
+
if (overload.arity || overload.arity === 0) {
|
|
1336
|
+
// Found an existing function, but it's not an overloader.
|
|
1337
|
+
// Make a new overloader and add the existing function to it.
|
|
1338
|
+
overload = _nbind.makeOverloader(overload, overload.arity);
|
|
1339
|
+
obj[name] = overload;
|
|
1340
|
+
}
|
|
1341
|
+
// Add this function as an overload.
|
|
1342
|
+
overload.addMethod(func, arity);
|
|
1343
|
+
} else {
|
|
1344
|
+
// Add a new function and store its arity in case it gets overloaded.
|
|
1345
|
+
func.arity = arity;
|
|
1346
|
+
obj[name] = func;
|
|
1347
|
+
}
|
|
1348
|
+
}
|
|
1349
|
+
_nbind.addMethod = addMethod;
|
|
1350
|
+
function throwError(message) {
|
|
1351
|
+
throw new Error(message);
|
|
1352
|
+
}
|
|
1353
|
+
_nbind.throwError = throwError;
|
|
1354
|
+
_nbind.bigEndian = false;
|
|
1355
|
+
// Export the namespace to Emscripten compiled output.
|
|
1356
|
+
// This must be at the end of the namespace!
|
|
1357
|
+
// The dummy class is needed because unfortunately namespaces can't have decorators.
|
|
1358
|
+
// Everything after it inside the namespace will be discarded.
|
|
1359
|
+
var _ = function () {
|
|
1360
|
+
function _() {}
|
|
1361
|
+
return _;
|
|
1362
|
+
}(); // tslint:disable-line:class-name
|
|
1363
|
+
_ = __decorate([emscripten_library_decorator_1.prepareNamespace('_nbind')], _);
|
|
1364
|
+
_nbind._ = _;
|
|
1365
|
+
})(_nbind = exports._nbind || (exports._nbind = {}));
|
|
1366
|
+
});
|
|
1367
|
+
$__System.registerDynamic("c", ["e", "16"], true, function ($__require, exports, module) {
|
|
1368
|
+
var global = this || self,
|
|
1369
|
+
GLOBAL = global;
|
|
1370
|
+
// This file is part of nbind, copyright (C) 2014-2016 BusFaster Ltd.
|
|
1371
|
+
// Released under the MIT license, see LICENSE.
|
|
1372
|
+
var __extends = exports && exports.__extends || function () {
|
|
1373
|
+
var extendStatics = Object.setPrototypeOf || { __proto__: [] } instanceof Array && function (d, b) {
|
|
1374
|
+
d.__proto__ = b;
|
|
1375
|
+
} || function (d, b) {
|
|
1376
|
+
for (var p in b) if (b.hasOwnProperty(p)) d[p] = b[p];
|
|
1377
|
+
};
|
|
1378
|
+
return function (d, b) {
|
|
1379
|
+
extendStatics(d, b);
|
|
1380
|
+
function __() {
|
|
1381
|
+
this.constructor = d;
|
|
1382
|
+
}
|
|
1383
|
+
d.prototype = b === null ? Object.create(b) : (__.prototype = b.prototype, new __());
|
|
1384
|
+
};
|
|
1385
|
+
}();
|
|
1386
|
+
var __decorate = exports && exports.__decorate || function (decorators, target, key, desc) {
|
|
1387
|
+
var c = arguments.length,
|
|
1388
|
+
r = c < 3 ? target : desc === null ? desc = Object.getOwnPropertyDescriptor(target, key) : desc,
|
|
1389
|
+
d;
|
|
1390
|
+
if (typeof Reflect === "object" && typeof Reflect.decorate === "function") r = Reflect.decorate(decorators, target, key, desc);else for (var i = decorators.length - 1; i >= 0; i--) if (d = decorators[i]) r = (c < 3 ? d(r) : c > 3 ? d(target, key, r) : d(target, key)) || r;
|
|
1391
|
+
return c > 3 && r && Object.defineProperty(target, key, r), r;
|
|
1392
|
+
};
|
|
1393
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
1394
|
+
// This file contains the type conversion base class and handles conversion of
|
|
1395
|
+
// C++ primitive types to / from JavaScript. Following emscripten conventions,
|
|
1396
|
+
// the type passed between the two is called WireType.
|
|
1397
|
+
// Anything from the standard library is instead in BindingStd.ts
|
|
1398
|
+
var emscripten_library_decorator_1 = $__require("e");
|
|
1399
|
+
var Type_1 = $__require("16");
|
|
1400
|
+
var _typeModule = Type_1.typeModule;
|
|
1401
|
+
// Let decorators run eval in current scope to read function source code.
|
|
1402
|
+
emscripten_library_decorator_1.setEvil(function (code) {
|
|
1403
|
+
return eval(code);
|
|
1404
|
+
});
|
|
1405
|
+
var _nbind;
|
|
1406
|
+
(function (_nbind) {
|
|
1407
|
+
_a = _typeModule(_typeModule), _nbind.Type = _a.Type, _nbind.makeType = _a.makeType, _nbind.getComplexType = _a.getComplexType, _nbind.structureList = _a.structureList;
|
|
1408
|
+
// A type definition, which registers itself upon construction.
|
|
1409
|
+
var BindType = function (_super) {
|
|
1410
|
+
__extends(BindType, _super);
|
|
1411
|
+
function BindType() {
|
|
1412
|
+
var _this = _super !== null && _super.apply(this, arguments) || this;
|
|
1413
|
+
_this.heap = HEAPU32;
|
|
1414
|
+
_this.ptrSize = 4;
|
|
1415
|
+
return _this;
|
|
1416
|
+
}
|
|
1417
|
+
BindType.prototype.needsWireRead = function (policyTbl) {
|
|
1418
|
+
return !!this.wireRead || !!this.makeWireRead;
|
|
1419
|
+
};
|
|
1420
|
+
BindType.prototype.needsWireWrite = function (policyTbl) {
|
|
1421
|
+
return !!this.wireWrite || !!this.makeWireWrite;
|
|
1422
|
+
};
|
|
1423
|
+
return BindType;
|
|
1424
|
+
}(_nbind.Type);
|
|
1425
|
+
_nbind.BindType = BindType;
|
|
1426
|
+
var PrimitiveType = function (_super) {
|
|
1427
|
+
__extends(PrimitiveType, _super);
|
|
1428
|
+
function PrimitiveType(spec) {
|
|
1429
|
+
var _this = _super.call(this, spec) || this;
|
|
1430
|
+
var heapTbl = spec.flags & 32 /* isFloat */ ? {
|
|
1431
|
+
32: HEAPF32,
|
|
1432
|
+
64: HEAPF64
|
|
1433
|
+
} : spec.flags & 8 /* isUnsigned */ ? {
|
|
1434
|
+
8: HEAPU8,
|
|
1435
|
+
16: HEAPU16,
|
|
1436
|
+
32: HEAPU32
|
|
1437
|
+
} : {
|
|
1438
|
+
8: HEAP8,
|
|
1439
|
+
16: HEAP16,
|
|
1440
|
+
32: HEAP32
|
|
1441
|
+
};
|
|
1442
|
+
_this.heap = heapTbl[spec.ptrSize * 8];
|
|
1443
|
+
_this.ptrSize = spec.ptrSize;
|
|
1444
|
+
return _this;
|
|
1445
|
+
}
|
|
1446
|
+
PrimitiveType.prototype.needsWireWrite = function (policyTbl) {
|
|
1447
|
+
return !!policyTbl && !!policyTbl['Strict'];
|
|
1448
|
+
};
|
|
1449
|
+
PrimitiveType.prototype.makeWireWrite = function (expr, policyTbl) {
|
|
1450
|
+
return policyTbl && policyTbl['Strict'] && function (arg) {
|
|
1451
|
+
if (typeof arg == 'number') return arg;
|
|
1452
|
+
throw new Error('Type mismatch');
|
|
1453
|
+
};
|
|
1454
|
+
};
|
|
1455
|
+
return PrimitiveType;
|
|
1456
|
+
}(BindType);
|
|
1457
|
+
_nbind.PrimitiveType = PrimitiveType;
|
|
1458
|
+
// Push a string to the C++ stack, zero-terminated and UTF-8 encoded.
|
|
1459
|
+
function pushCString(str, policyTbl) {
|
|
1460
|
+
if (str === null || str === undefined) {
|
|
1461
|
+
if (policyTbl && policyTbl['Nullable']) {
|
|
1462
|
+
return 0;
|
|
1463
|
+
} else throw new Error('Type mismatch');
|
|
1464
|
+
}
|
|
1465
|
+
if (policyTbl && policyTbl['Strict']) {
|
|
1466
|
+
if (typeof str != 'string') throw new Error('Type mismatch');
|
|
1467
|
+
} else str = str.toString();
|
|
1468
|
+
var length = Module.lengthBytesUTF8(str) + 1;
|
|
1469
|
+
var result = _nbind.Pool.lalloc(length);
|
|
1470
|
+
// Convert the string and append a zero byte.
|
|
1471
|
+
Module.stringToUTF8Array(str, HEAPU8, result, length);
|
|
1472
|
+
return result;
|
|
1473
|
+
}
|
|
1474
|
+
_nbind.pushCString = pushCString;
|
|
1475
|
+
// Read a zero-terminated, UTF-8 encoded string from the C++ stack.
|
|
1476
|
+
function popCString(ptr) {
|
|
1477
|
+
if (ptr === 0) return null;
|
|
1478
|
+
return Module.Pointer_stringify(ptr);
|
|
1479
|
+
}
|
|
1480
|
+
_nbind.popCString = popCString;
|
|
1481
|
+
// Zero-terminated 'const char *' style string, passed through the C++ stack.
|
|
1482
|
+
var CStringType = function (_super) {
|
|
1483
|
+
__extends(CStringType, _super);
|
|
1484
|
+
function CStringType() {
|
|
1485
|
+
var _this = _super !== null && _super.apply(this, arguments) || this;
|
|
1486
|
+
_this.wireRead = popCString;
|
|
1487
|
+
_this.wireWrite = pushCString;
|
|
1488
|
+
_this.readResources = [_nbind.resources.pool];
|
|
1489
|
+
_this.writeResources = [_nbind.resources.pool];
|
|
1490
|
+
return _this;
|
|
1491
|
+
}
|
|
1492
|
+
CStringType.prototype.makeWireWrite = function (expr, policyTbl) {
|
|
1493
|
+
return function (arg) {
|
|
1494
|
+
return pushCString(arg, policyTbl);
|
|
1495
|
+
};
|
|
1496
|
+
};
|
|
1497
|
+
return CStringType;
|
|
1498
|
+
}(BindType);
|
|
1499
|
+
_nbind.CStringType = CStringType;
|
|
1500
|
+
// Booleans are returned as numbers from Asm.js.
|
|
1501
|
+
// Prefixing with !! converts them to JavaScript booleans.
|
|
1502
|
+
var BooleanType = function (_super) {
|
|
1503
|
+
__extends(BooleanType, _super);
|
|
1504
|
+
function BooleanType() {
|
|
1505
|
+
var _this = _super !== null && _super.apply(this, arguments) || this;
|
|
1506
|
+
_this.wireRead = function (arg) {
|
|
1507
|
+
return !!arg;
|
|
1508
|
+
};
|
|
1509
|
+
return _this;
|
|
1510
|
+
}
|
|
1511
|
+
BooleanType.prototype.needsWireWrite = function (policyTbl) {
|
|
1512
|
+
return !!policyTbl && !!policyTbl['Strict'];
|
|
1513
|
+
};
|
|
1514
|
+
BooleanType.prototype.makeWireRead = function (expr) {
|
|
1515
|
+
return '!!(' + expr + ')';
|
|
1516
|
+
};
|
|
1517
|
+
BooleanType.prototype.makeWireWrite = function (expr, policyTbl) {
|
|
1518
|
+
return policyTbl && policyTbl['Strict'] && function (arg) {
|
|
1519
|
+
if (typeof arg == 'boolean') return arg;
|
|
1520
|
+
throw new Error('Type mismatch');
|
|
1521
|
+
} || expr;
|
|
1522
|
+
};
|
|
1523
|
+
return BooleanType;
|
|
1524
|
+
}(BindType);
|
|
1525
|
+
_nbind.BooleanType = BooleanType;
|
|
1526
|
+
var _ = function () {
|
|
1527
|
+
function _() {}
|
|
1528
|
+
return _;
|
|
1529
|
+
}(); // tslint:disable-line:class-name
|
|
1530
|
+
_ = __decorate([emscripten_library_decorator_1.prepareNamespace('_nbind')], _);
|
|
1531
|
+
_nbind._ = _;
|
|
1532
|
+
var _a;
|
|
1533
|
+
})(_nbind = exports._nbind || (exports._nbind = {}));
|
|
1534
|
+
});
|
|
1535
|
+
$__System.registerDynamic("10", ["e", "c"], true, function ($__require, exports, module) {
|
|
1536
|
+
var global = this || self,
|
|
1537
|
+
GLOBAL = global;
|
|
1538
|
+
// This file is part of nbind, copyright (C) 2014-2016 BusFaster Ltd.
|
|
1539
|
+
// Released under the MIT license, see LICENSE.
|
|
1540
|
+
var __extends = exports && exports.__extends || function () {
|
|
1541
|
+
var extendStatics = Object.setPrototypeOf || { __proto__: [] } instanceof Array && function (d, b) {
|
|
1542
|
+
d.__proto__ = b;
|
|
1543
|
+
} || function (d, b) {
|
|
1544
|
+
for (var p in b) if (b.hasOwnProperty(p)) d[p] = b[p];
|
|
1545
|
+
};
|
|
1546
|
+
return function (d, b) {
|
|
1547
|
+
extendStatics(d, b);
|
|
1548
|
+
function __() {
|
|
1549
|
+
this.constructor = d;
|
|
1550
|
+
}
|
|
1551
|
+
d.prototype = b === null ? Object.create(b) : (__.prototype = b.prototype, new __());
|
|
1552
|
+
};
|
|
1553
|
+
}();
|
|
1554
|
+
var __decorate = exports && exports.__decorate || function (decorators, target, key, desc) {
|
|
1555
|
+
var c = arguments.length,
|
|
1556
|
+
r = c < 3 ? target : desc === null ? desc = Object.getOwnPropertyDescriptor(target, key) : desc,
|
|
1557
|
+
d;
|
|
1558
|
+
if (typeof Reflect === "object" && typeof Reflect.decorate === "function") r = Reflect.decorate(decorators, target, key, desc);else for (var i = decorators.length - 1; i >= 0; i--) if (d = decorators[i]) r = (c < 3 ? d(r) : c > 3 ? d(target, key, r) : d(target, key)) || r;
|
|
1559
|
+
return c > 3 && r && Object.defineProperty(target, key, r), r;
|
|
1560
|
+
};
|
|
1561
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
1562
|
+
// This file allows C++ to hold references to arbitrary JavaScript objects.
|
|
1563
|
+
// Each object is stored in a JavaScript array, and C++ receives its index.
|
|
1564
|
+
// C++ can then call JavaScript methods and refer to the object by index.
|
|
1565
|
+
var emscripten_library_decorator_1 = $__require("e");
|
|
1566
|
+
var BindingType_1 = $__require("c");
|
|
1567
|
+
// Let decorators run eval in current scope to read function source code.
|
|
1568
|
+
emscripten_library_decorator_1.setEvil(function (code) {
|
|
1569
|
+
return eval(code);
|
|
1570
|
+
});
|
|
1571
|
+
var _nbind;
|
|
1572
|
+
(function (_nbind) {
|
|
1573
|
+
_nbind.BindType = BindingType_1._nbind.BindType;
|
|
1574
|
+
})(_nbind = exports._nbind || (exports._nbind = {}));
|
|
1575
|
+
(function (_nbind) {
|
|
1576
|
+
// External JavaScript types are stored in a list,
|
|
1577
|
+
// so C++ code can find them by number.
|
|
1578
|
+
// A reference count allows storing them in C++ without leaking memory.
|
|
1579
|
+
// The first element is a dummy value just so that a valid index to
|
|
1580
|
+
// the list always tests as true (useful for the free list implementation).
|
|
1581
|
+
_nbind.externalList = [0];
|
|
1582
|
+
// Head of free list for recycling available slots in the externals list.
|
|
1583
|
+
var firstFreeExternal = 0;
|
|
1584
|
+
var External = function () {
|
|
1585
|
+
function External(data) {
|
|
1586
|
+
this.refCount = 1;
|
|
1587
|
+
this.data = data;
|
|
1588
|
+
}
|
|
1589
|
+
// Store this external in a JavaScript array and return its index
|
|
1590
|
+
// creating a reference that can be passed to C++.
|
|
1591
|
+
External.prototype.register = function () {
|
|
1592
|
+
var num = firstFreeExternal;
|
|
1593
|
+
if (num) {
|
|
1594
|
+
firstFreeExternal = _nbind.externalList[num];
|
|
1595
|
+
} else num = _nbind.externalList.length;
|
|
1596
|
+
_nbind.externalList[num] = this;
|
|
1597
|
+
return num;
|
|
1598
|
+
};
|
|
1599
|
+
External.prototype.reference = function () {
|
|
1600
|
+
++this.refCount;
|
|
1601
|
+
};
|
|
1602
|
+
External.prototype.dereference = function (num) {
|
|
1603
|
+
if (--this.refCount == 0) {
|
|
1604
|
+
if (this.free) this.free();
|
|
1605
|
+
_nbind.externalList[num] = firstFreeExternal;
|
|
1606
|
+
firstFreeExternal = num;
|
|
1607
|
+
}
|
|
1608
|
+
};
|
|
1609
|
+
return External;
|
|
1610
|
+
}();
|
|
1611
|
+
_nbind.External = External;
|
|
1612
|
+
function popExternal(num) {
|
|
1613
|
+
var obj = _nbind.externalList[num];
|
|
1614
|
+
obj.dereference(num);
|
|
1615
|
+
return obj.data;
|
|
1616
|
+
}
|
|
1617
|
+
function pushExternal(obj) {
|
|
1618
|
+
var external = new External(obj);
|
|
1619
|
+
external.reference();
|
|
1620
|
+
return external.register();
|
|
1621
|
+
}
|
|
1622
|
+
var ExternalType = function (_super) {
|
|
1623
|
+
__extends(ExternalType, _super);
|
|
1624
|
+
function ExternalType() {
|
|
1625
|
+
var _this = _super !== null && _super.apply(this, arguments) || this;
|
|
1626
|
+
_this.wireRead = popExternal;
|
|
1627
|
+
_this.wireWrite = pushExternal;
|
|
1628
|
+
return _this;
|
|
1629
|
+
}
|
|
1630
|
+
return ExternalType;
|
|
1631
|
+
}(_nbind.BindType);
|
|
1632
|
+
_nbind.ExternalType = ExternalType;
|
|
1633
|
+
var _ = function () {
|
|
1634
|
+
function _() {}
|
|
1635
|
+
return _;
|
|
1636
|
+
}(); // tslint:disable-line:class-name
|
|
1637
|
+
_ = __decorate([emscripten_library_decorator_1.prepareNamespace('_nbind')], _);
|
|
1638
|
+
_nbind._ = _;
|
|
1639
|
+
})(_nbind = exports._nbind || (exports._nbind = {}));
|
|
1640
|
+
var nbind = function () {
|
|
1641
|
+
function nbind() {}
|
|
1642
|
+
nbind._nbind_reference_external = function (num) {
|
|
1643
|
+
_nbind.externalList[num].reference();
|
|
1644
|
+
};
|
|
1645
|
+
nbind._nbind_free_external = function (num) {
|
|
1646
|
+
_nbind.externalList[num].dereference(num);
|
|
1647
|
+
};
|
|
1648
|
+
return nbind;
|
|
1649
|
+
}();
|
|
1650
|
+
__decorate([emscripten_library_decorator_1.dep('_nbind')], nbind, "_nbind_reference_external", null);
|
|
1651
|
+
__decorate([emscripten_library_decorator_1.dep('_nbind')], nbind, "_nbind_free_external", null);
|
|
1652
|
+
nbind = __decorate([emscripten_library_decorator_1.exportLibrary], nbind);
|
|
1653
|
+
});
|
|
1654
|
+
$__System.registerDynamic("17", ["e", "13", "c", "10"], true, function ($__require, exports, module) {
|
|
1655
|
+
var global = this || self,
|
|
1656
|
+
GLOBAL = global;
|
|
1657
|
+
// This file is part of nbind, copyright (C) 2014-2016 BusFaster Ltd.
|
|
1658
|
+
// Released under the MIT license, see LICENSE.
|
|
1659
|
+
var __extends = exports && exports.__extends || function () {
|
|
1660
|
+
var extendStatics = Object.setPrototypeOf || { __proto__: [] } instanceof Array && function (d, b) {
|
|
1661
|
+
d.__proto__ = b;
|
|
1662
|
+
} || function (d, b) {
|
|
1663
|
+
for (var p in b) if (b.hasOwnProperty(p)) d[p] = b[p];
|
|
1664
|
+
};
|
|
1665
|
+
return function (d, b) {
|
|
1666
|
+
extendStatics(d, b);
|
|
1667
|
+
function __() {
|
|
1668
|
+
this.constructor = d;
|
|
1669
|
+
}
|
|
1670
|
+
d.prototype = b === null ? Object.create(b) : (__.prototype = b.prototype, new __());
|
|
1671
|
+
};
|
|
1672
|
+
}();
|
|
1673
|
+
var __decorate = exports && exports.__decorate || function (decorators, target, key, desc) {
|
|
1674
|
+
var c = arguments.length,
|
|
1675
|
+
r = c < 3 ? target : desc === null ? desc = Object.getOwnPropertyDescriptor(target, key) : desc,
|
|
1676
|
+
d;
|
|
1677
|
+
if (typeof Reflect === "object" && typeof Reflect.decorate === "function") r = Reflect.decorate(decorators, target, key, desc);else for (var i = decorators.length - 1; i >= 0; i--) if (d = decorators[i]) r = (c < 3 ? d(r) : c > 3 ? d(target, key, r) : d(target, key)) || r;
|
|
1678
|
+
return c > 3 && r && Object.defineProperty(target, key, r), r;
|
|
1679
|
+
};
|
|
1680
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
1681
|
+
var emscripten_library_decorator_1 = $__require("e");
|
|
1682
|
+
var Globals_1 = $__require("13");
|
|
1683
|
+
var BindingType_1 = $__require("c");
|
|
1684
|
+
var External_1 = $__require("10");
|
|
1685
|
+
// Let decorators run eval in current scope to read function source code.
|
|
1686
|
+
emscripten_library_decorator_1.setEvil(function (code) {
|
|
1687
|
+
return eval(code);
|
|
1688
|
+
});
|
|
1689
|
+
var _nbind;
|
|
1690
|
+
(function (_nbind) {
|
|
1691
|
+
_nbind.Pool = Globals_1._nbind.Pool;
|
|
1692
|
+
_nbind.BindType = BindingType_1._nbind.BindType;
|
|
1693
|
+
_nbind.External = External_1._nbind.External;
|
|
1694
|
+
})(_nbind = exports._nbind || (exports._nbind = {}));
|
|
1695
|
+
(function (_nbind) {
|
|
1696
|
+
var ExternalBuffer = function (_super) {
|
|
1697
|
+
__extends(ExternalBuffer, _super);
|
|
1698
|
+
function ExternalBuffer(buf, ptr) {
|
|
1699
|
+
var _this = _super.call(this, buf) || this;
|
|
1700
|
+
_this.ptr = ptr;
|
|
1701
|
+
return _this;
|
|
1702
|
+
}
|
|
1703
|
+
ExternalBuffer.prototype.free = function () {
|
|
1704
|
+
_free(this.ptr);
|
|
1705
|
+
};
|
|
1706
|
+
return ExternalBuffer;
|
|
1707
|
+
}(_nbind.External);
|
|
1708
|
+
function getBuffer(buf) {
|
|
1709
|
+
if (buf instanceof ArrayBuffer) {
|
|
1710
|
+
return new Uint8Array(buf);
|
|
1711
|
+
} else if (buf instanceof DataView) {
|
|
1712
|
+
return new Uint8Array(buf.buffer, buf.byteOffset, buf.byteLength);
|
|
1713
|
+
} else return buf;
|
|
1714
|
+
}
|
|
1715
|
+
function pushBuffer(buf, policyTbl) {
|
|
1716
|
+
if (buf === null || buf === undefined) {
|
|
1717
|
+
if (policyTbl && policyTbl['Nullable']) buf = [];
|
|
1718
|
+
}
|
|
1719
|
+
if (typeof buf != 'object') throw new Error('Type mismatch');
|
|
1720
|
+
var b = buf;
|
|
1721
|
+
var length = b.byteLength || b.length;
|
|
1722
|
+
if (!length && length !== 0 && b.byteLength !== 0) throw new Error('Type mismatch');
|
|
1723
|
+
var result = _nbind.Pool.lalloc(8);
|
|
1724
|
+
var data = _malloc(length);
|
|
1725
|
+
var ptr = result / 4;
|
|
1726
|
+
HEAPU32[ptr++] = length;
|
|
1727
|
+
HEAPU32[ptr++] = data;
|
|
1728
|
+
HEAPU32[ptr++] = new ExternalBuffer(buf, data).register();
|
|
1729
|
+
HEAPU8.set(getBuffer(buf), data);
|
|
1730
|
+
return result;
|
|
1731
|
+
}
|
|
1732
|
+
var BufferType = function (_super) {
|
|
1733
|
+
__extends(BufferType, _super);
|
|
1734
|
+
function BufferType() {
|
|
1735
|
+
var _this = _super !== null && _super.apply(this, arguments) || this;
|
|
1736
|
+
_this.wireWrite = pushBuffer;
|
|
1737
|
+
_this.readResources = [_nbind.resources.pool];
|
|
1738
|
+
_this.writeResources = [_nbind.resources.pool];
|
|
1739
|
+
return _this;
|
|
1740
|
+
}
|
|
1741
|
+
BufferType.prototype.makeWireWrite = function (expr, policyTbl) {
|
|
1742
|
+
return function (arg) {
|
|
1743
|
+
return pushBuffer(arg, policyTbl);
|
|
1744
|
+
};
|
|
1745
|
+
};
|
|
1746
|
+
return BufferType;
|
|
1747
|
+
}(_nbind.BindType);
|
|
1748
|
+
_nbind.BufferType = BufferType;
|
|
1749
|
+
// Called from EM_ASM block in Buffer.h
|
|
1750
|
+
function commitBuffer(num, data, length) {
|
|
1751
|
+
var buf = _nbind.externalList[num].data;
|
|
1752
|
+
var NodeBuffer = Buffer;
|
|
1753
|
+
// tslint:disable-next-line:no-empty
|
|
1754
|
+
if (typeof Buffer != 'function') NodeBuffer = function () {};
|
|
1755
|
+
if (buf instanceof Array) {
|
|
1756
|
+
// TODO if needed
|
|
1757
|
+
} else {
|
|
1758
|
+
var src = HEAPU8.subarray(data, data + length);
|
|
1759
|
+
if (buf instanceof NodeBuffer) {
|
|
1760
|
+
var srcBuf = void 0;
|
|
1761
|
+
if (typeof Buffer.from == 'function' && Buffer.from.length >= 3) {
|
|
1762
|
+
srcBuf = Buffer.from(src);
|
|
1763
|
+
} else srcBuf = new Buffer(src);
|
|
1764
|
+
srcBuf.copy(buf);
|
|
1765
|
+
} else getBuffer(buf).set(src);
|
|
1766
|
+
}
|
|
1767
|
+
}
|
|
1768
|
+
_nbind.commitBuffer = commitBuffer;
|
|
1769
|
+
var _ = function () {
|
|
1770
|
+
function _() {}
|
|
1771
|
+
return _;
|
|
1772
|
+
}(); // tslint:disable-line:class-name
|
|
1773
|
+
_ = __decorate([emscripten_library_decorator_1.prepareNamespace('_nbind')], _);
|
|
1774
|
+
_nbind._ = _;
|
|
1775
|
+
})(_nbind = exports._nbind || (exports._nbind = {}));
|
|
1776
|
+
});
|
|
1777
|
+
$__System.registerDynamic('e', [], true, function ($__require, exports, module) {
|
|
1778
|
+
var global = this || self,
|
|
1779
|
+
GLOBAL = global;
|
|
1780
|
+
// This file is part of emscripten-library-decorator,
|
|
1781
|
+
// copyright (c) 2015-2017 BusFaster Ltd.
|
|
1782
|
+
// Released under the MIT license, see LICENSE.
|
|
1783
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
1784
|
+
var evil;
|
|
1785
|
+
/** Allow decorators to call eval() in the context that called them.
|
|
1786
|
+
* This is needed for various transformations.
|
|
1787
|
+
* @param otherEval must be this function: (code: string) => eval(code) */
|
|
1788
|
+
function setEvil(otherEval) {
|
|
1789
|
+
evil = otherEval;
|
|
1790
|
+
}
|
|
1791
|
+
exports.setEvil = setEvil;
|
|
1792
|
+
function __extends(Class, Parent) {
|
|
1793
|
+
for (var key in Parent) if (Parent.hasOwnProperty(key)) Class[key] = Parent[key];
|
|
1794
|
+
// tslint:disable-next-line:no-invalid-this
|
|
1795
|
+
function Base() {
|
|
1796
|
+
this.constructor = Class;
|
|
1797
|
+
}
|
|
1798
|
+
Base.prototype = Parent.prototype;
|
|
1799
|
+
Class.prototype = new Base();
|
|
1800
|
+
}
|
|
1801
|
+
exports.__extends = __extends;
|
|
1802
|
+
/** @dep decorator.
|
|
1803
|
+
* Apply to a function, to list other required variables needing protection
|
|
1804
|
+
* from dead code removal.
|
|
1805
|
+
* Arguments can be functions or names of global variables. */
|
|
1806
|
+
function dep() {
|
|
1807
|
+
var depList = [];
|
|
1808
|
+
for (var _i = 0; _i < arguments.length; _i++) {
|
|
1809
|
+
depList[_i] = arguments[_i];
|
|
1810
|
+
}
|
|
1811
|
+
return function (target, functionName) {
|
|
1812
|
+
// Export names of other functions required by <functionName>
|
|
1813
|
+
// as an array named <functionName>__deps.
|
|
1814
|
+
var key = functionName + '__deps';
|
|
1815
|
+
var lib = target;
|
|
1816
|
+
lib[key] = (lib[key] || []).concat(depList.map(function (dep) {
|
|
1817
|
+
var name;
|
|
1818
|
+
if (typeof dep == 'function') {
|
|
1819
|
+
// Get name of required function and remove underscore prefix.
|
|
1820
|
+
name = dep.name.substr(1);
|
|
1821
|
+
// Export required function with prefix removed from its name.
|
|
1822
|
+
lib[name] = dep;
|
|
1823
|
+
} else {
|
|
1824
|
+
name = dep.substr(1);
|
|
1825
|
+
// Export any required global variable,
|
|
1826
|
+
// looking it up by name in current scope.
|
|
1827
|
+
if (name != 'initNamespaces') lib[name] = evil('(' + dep + ')');
|
|
1828
|
+
}
|
|
1829
|
+
// Send name without prefix to __deps list.
|
|
1830
|
+
return name;
|
|
1831
|
+
}));
|
|
1832
|
+
};
|
|
1833
|
+
}
|
|
1834
|
+
exports.dep = dep;
|
|
1835
|
+
/** @exportLibrary decorator.
|
|
1836
|
+
* Apply to a class with static methods, to export them as functions. */
|
|
1837
|
+
function exportLibrary(target) {
|
|
1838
|
+
mergeInto(LibraryManager.library, target);
|
|
1839
|
+
}
|
|
1840
|
+
exports.exportLibrary = exportLibrary;
|
|
1841
|
+
var namespaceBodyTbl = {};
|
|
1842
|
+
var namespaceDepTbl = {};
|
|
1843
|
+
/** @prepareNamespace decorator.
|
|
1844
|
+
* Apply to an empty, named dummy class defined at the end of the namespace
|
|
1845
|
+
* block, to prepare its contents for export in an Emscripten library.
|
|
1846
|
+
* Namespaces with matching names in different files are merged together.
|
|
1847
|
+
* All code in the block is separated because Emscripten only outputs global
|
|
1848
|
+
* functions, not methods. */
|
|
1849
|
+
function prepareNamespace(name) {
|
|
1850
|
+
var depList = [];
|
|
1851
|
+
for (var _i = 1; _i < arguments.length; _i++) {
|
|
1852
|
+
depList[_i - 1] = arguments[_i];
|
|
1853
|
+
}
|
|
1854
|
+
return function (target) {
|
|
1855
|
+
var body = evil('__decorate').caller.toString();
|
|
1856
|
+
var prefix = new RegExp('^[ (]*function *\\( *' + name + ' *\\) *\\{');
|
|
1857
|
+
var suffix = new RegExp('var +' + target.name + ' *= *[^]*$');
|
|
1858
|
+
body = (namespaceBodyTbl[name] || '') + body.replace(prefix, '').replace(suffix, '');
|
|
1859
|
+
namespaceBodyTbl[name] = body;
|
|
1860
|
+
if (!namespaceDepTbl[name]) namespaceDepTbl[name] = {};
|
|
1861
|
+
for (var _i = 0, depList_1 = depList; _i < depList_1.length; _i++) {
|
|
1862
|
+
var dep_1 = depList_1[_i];
|
|
1863
|
+
namespaceDepTbl[name][dep_1.substr(1)] = evil('(' + dep_1 + ')');
|
|
1864
|
+
}
|
|
1865
|
+
};
|
|
1866
|
+
}
|
|
1867
|
+
exports.prepareNamespace = prepareNamespace;
|
|
1868
|
+
/** Call once per namespace at the global level, after all files with contents
|
|
1869
|
+
* in that namespace have been imported. Clears the namespace and exports a
|
|
1870
|
+
* "postset" function to populate it using its original code. */
|
|
1871
|
+
function publishNamespace(name) {
|
|
1872
|
+
var exportName = name.substr(1);
|
|
1873
|
+
var body = namespaceBodyTbl[name];
|
|
1874
|
+
var bodyWrapped = '(function(' + name + '){' + body + '})' + '(' + name + ')';
|
|
1875
|
+
evil(name + '={};');
|
|
1876
|
+
evil('__extends=' + __extends.toString() + ';');
|
|
1877
|
+
var lib = {
|
|
1878
|
+
_decorate: evil('__decorate'),
|
|
1879
|
+
defineHidden: defineHidden
|
|
1880
|
+
};
|
|
1881
|
+
for (var _i = 0, _a = Object.keys(namespaceDepTbl[name]); _i < _a.length; _i++) {
|
|
1882
|
+
var depName = _a[_i];
|
|
1883
|
+
lib[depName] = namespaceDepTbl[name][depName];
|
|
1884
|
+
}
|
|
1885
|
+
lib[exportName + '__deps'] = Object.keys(lib);
|
|
1886
|
+
lib[exportName + '__postset'] = bodyWrapped;
|
|
1887
|
+
mergeInto(LibraryManager.library, lib);
|
|
1888
|
+
}
|
|
1889
|
+
exports.publishNamespace = publishNamespace;
|
|
1890
|
+
/** @_defineHidden decorator.
|
|
1891
|
+
* Assign to a local variable called _defineHidden before using.
|
|
1892
|
+
* Apply to a property to protect it from modifications and hide it. */
|
|
1893
|
+
function defineHidden(value) {
|
|
1894
|
+
return function (target, key) {
|
|
1895
|
+
Object.defineProperty(target, key, {
|
|
1896
|
+
configurable: false,
|
|
1897
|
+
enumerable: false,
|
|
1898
|
+
value: value,
|
|
1899
|
+
writable: true
|
|
1900
|
+
});
|
|
1901
|
+
};
|
|
1902
|
+
}
|
|
1903
|
+
exports.defineHidden = defineHidden;
|
|
1904
|
+
});
|
|
1905
|
+
$__System.registerDynamic("18", ["e"], true, function ($__require, exports, module) {
|
|
1906
|
+
var global = this || self,
|
|
1907
|
+
GLOBAL = global;
|
|
1908
|
+
// This file is part of nbind, copyright (C) 2014-2016 BusFaster Ltd.
|
|
1909
|
+
// Released under the MIT license, see LICENSE.
|
|
1910
|
+
var __decorate = exports && exports.__decorate || function (decorators, target, key, desc) {
|
|
1911
|
+
var c = arguments.length,
|
|
1912
|
+
r = c < 3 ? target : desc === null ? desc = Object.getOwnPropertyDescriptor(target, key) : desc,
|
|
1913
|
+
d;
|
|
1914
|
+
if (typeof Reflect === "object" && typeof Reflect.decorate === "function") r = Reflect.decorate(decorators, target, key, desc);else for (var i = decorators.length - 1; i >= 0; i--) if (d = decorators[i]) r = (c < 3 ? d(r) : c > 3 ? d(target, key, r) : d(target, key)) || r;
|
|
1915
|
+
return c > 3 && r && Object.defineProperty(target, key, r), r;
|
|
1916
|
+
};
|
|
1917
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
1918
|
+
// This file handles creating invoker functions for Emscripten dyncalls
|
|
1919
|
+
// wrapped in type conversions for arguments and return values.
|
|
1920
|
+
var emscripten_library_decorator_1 = $__require("e");
|
|
1921
|
+
// Let decorators run eval in current scope to read function source code.
|
|
1922
|
+
emscripten_library_decorator_1.setEvil(function (code) {
|
|
1923
|
+
return eval(code);
|
|
1924
|
+
});
|
|
1925
|
+
var _nbind;
|
|
1926
|
+
(function (_nbind) {
|
|
1927
|
+
var dirtyList = [];
|
|
1928
|
+
var gcTimer = 0;
|
|
1929
|
+
function sweep() {
|
|
1930
|
+
for (var _i = 0, dirtyList_1 = dirtyList; _i < dirtyList_1.length; _i++) {
|
|
1931
|
+
var obj = dirtyList_1[_i];
|
|
1932
|
+
if (!(obj.__nbindState & (1 /* isPersistent */ | 2 /* isDeleted */))) {
|
|
1933
|
+
obj.free();
|
|
1934
|
+
}
|
|
1935
|
+
}
|
|
1936
|
+
dirtyList = [];
|
|
1937
|
+
gcTimer = 0;
|
|
1938
|
+
}
|
|
1939
|
+
// tslint:disable-next-line:no-empty
|
|
1940
|
+
_nbind.mark = function (obj) {};
|
|
1941
|
+
function toggleLightGC(enable) {
|
|
1942
|
+
if (enable) {
|
|
1943
|
+
_nbind.mark = function (obj) {
|
|
1944
|
+
dirtyList.push(obj);
|
|
1945
|
+
if (!gcTimer) gcTimer = setTimeout(sweep, 0);
|
|
1946
|
+
};
|
|
1947
|
+
} else {
|
|
1948
|
+
// tslint:disable-next-line:no-empty
|
|
1949
|
+
_nbind.mark = function (obj) {};
|
|
1950
|
+
}
|
|
1951
|
+
}
|
|
1952
|
+
_nbind.toggleLightGC = toggleLightGC;
|
|
1953
|
+
var _ = function () {
|
|
1954
|
+
function _() {}
|
|
1955
|
+
return _;
|
|
1956
|
+
}(); // tslint:disable-line:class-name
|
|
1957
|
+
_ = __decorate([emscripten_library_decorator_1.prepareNamespace('_nbind')], _);
|
|
1958
|
+
_nbind._ = _;
|
|
1959
|
+
})(_nbind = exports._nbind || (exports._nbind = {}));
|
|
1960
|
+
});
|
|
1961
|
+
$__System.registerDynamic("19", [], true, function ($__require, exports, module) {
|
|
1962
|
+
var global = this || self,
|
|
1963
|
+
GLOBAL = global;
|
|
1964
|
+
// This file is part of nbind, copyright (C) 2014-2016 BusFaster Ltd.
|
|
1965
|
+
// Released under the MIT license, see LICENSE.
|
|
1966
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
1967
|
+
function removeAccessorPrefix(name) {
|
|
1968
|
+
// The C++ side gives the same name to getters and setters.
|
|
1969
|
+
var prefixMatcher = /^[Gg]et_?([A-Z]?([A-Z]?))/;
|
|
1970
|
+
return name.replace(prefixMatcher, function (match, initial, second) {
|
|
1971
|
+
return second ? initial : initial.toLowerCase();
|
|
1972
|
+
});
|
|
1973
|
+
}
|
|
1974
|
+
exports.removeAccessorPrefix = removeAccessorPrefix;
|
|
1975
|
+
});
|
|
1976
|
+
$__System.registerDynamic('16', [], true, function ($__require, exports, module) {
|
|
1977
|
+
var global = this || self,
|
|
1978
|
+
GLOBAL = global;
|
|
1979
|
+
// This file is part of nbind, copyright (C) 2014-2016 BusFaster Ltd.
|
|
1980
|
+
// Released under the MIT license, see LICENSE.
|
|
1981
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
1982
|
+
exports.Type = (_a = typeModule(typeModule), _a.Type), exports.makeType = _a.makeType, exports.structureList = _a.structureList;
|
|
1983
|
+
/* tslint:disable:no-shadowed-variable */
|
|
1984
|
+
function typeModule(self) {
|
|
1985
|
+
// Parameter count and printable name of each StructureType.
|
|
1986
|
+
var structureList = [[0, 1, 'X'], [1 /* isConst */, 1, 'const X'], [128 /* isPointer */, 1, 'X *'], [256 /* isReference */, 1, 'X &'], [384 /* isRvalueRef */, 1, 'X &&'], [512 /* isSharedPtr */, 1, 'std::shared_ptr<X>'], [640 /* isUniquePtr */, 1, 'std::unique_ptr<X>'], [5120 /* isVector */, 1, 'std::vector<X>'], [6144 /* isArray */, 2, 'std::array<X, Y>'], [9216 /* isCallback */, -1, 'std::function<X (Y)>']];
|
|
1987
|
+
function applyStructure(outerName, outerFlags, innerName, innerFlags, param, flip) {
|
|
1988
|
+
if (outerFlags == 1 /* isConst */) {
|
|
1989
|
+
var ref = innerFlags & 896 /* refMask */;
|
|
1990
|
+
if (ref == 128 /* isPointer */ || ref == 256 /* isReference */ || ref == 384 /* isRvalueRef */) outerName = 'X const';
|
|
1991
|
+
}
|
|
1992
|
+
var name;
|
|
1993
|
+
if (flip) {
|
|
1994
|
+
name = innerName.replace('X', outerName).replace('Y', param);
|
|
1995
|
+
} else {
|
|
1996
|
+
name = outerName.replace('X', innerName).replace('Y', param);
|
|
1997
|
+
}
|
|
1998
|
+
// Remove spaces between consecutive * and & characters.
|
|
1999
|
+
return name.replace(/([*&]) (?=[*&])/g, '$1');
|
|
2000
|
+
}
|
|
2001
|
+
function reportProblem(problem, id, kind, structureType, place) {
|
|
2002
|
+
throw new Error(problem + ' type ' + kind.replace('X', id + '?') + (structureType ? ' with flag ' + structureType : '') + ' in ' + place);
|
|
2003
|
+
}
|
|
2004
|
+
function getComplexType(id, constructType, getType, queryType, place,
|
|
2005
|
+
// C++ type name string built top-down, for printing helpful errors.
|
|
2006
|
+
kind, // tslint:disable-line
|
|
2007
|
+
// Outer type, used only for updating kind.
|
|
2008
|
+
prevStructure, // tslint:disable-line
|
|
2009
|
+
depth // tslint:disable-line
|
|
2010
|
+
) {
|
|
2011
|
+
// C++ type name string built top-down, for printing helpful errors.
|
|
2012
|
+
if (kind === void 0) {
|
|
2013
|
+
kind = 'X';
|
|
2014
|
+
}
|
|
2015
|
+
if (depth === void 0) {
|
|
2016
|
+
depth = 1;
|
|
2017
|
+
} // tslint:disable-line
|
|
2018
|
+
var result = getType(id);
|
|
2019
|
+
if (result) return result;
|
|
2020
|
+
var query = queryType(id);
|
|
2021
|
+
var structureType = query.placeholderFlag;
|
|
2022
|
+
var structure = structureList[structureType];
|
|
2023
|
+
if (prevStructure && structure) {
|
|
2024
|
+
kind = applyStructure(prevStructure[2], prevStructure[0], kind, structure[0], '?', true);
|
|
2025
|
+
}
|
|
2026
|
+
var problem;
|
|
2027
|
+
if (structureType == 0) problem = 'Unbound';
|
|
2028
|
+
if (structureType >= 10 /* max */) problem = 'Corrupt';
|
|
2029
|
+
if (depth > 20) problem = 'Deeply nested';
|
|
2030
|
+
if (problem) reportProblem(problem, id, kind, structureType, place || '?');
|
|
2031
|
+
var subId = query.paramList[0];
|
|
2032
|
+
var subType = getComplexType(subId, constructType, getType, queryType, place, kind, structure, depth + 1);
|
|
2033
|
+
var srcSpec;
|
|
2034
|
+
var spec = {
|
|
2035
|
+
flags: structure[0],
|
|
2036
|
+
id: id,
|
|
2037
|
+
name: '',
|
|
2038
|
+
paramList: [subType]
|
|
2039
|
+
};
|
|
2040
|
+
var argList = [];
|
|
2041
|
+
var structureParam = '?';
|
|
2042
|
+
switch (query.placeholderFlag) {
|
|
2043
|
+
case 1 /* constant */:
|
|
2044
|
+
srcSpec = subType.spec;
|
|
2045
|
+
break;
|
|
2046
|
+
case 2 /* pointer */:
|
|
2047
|
+
if ((subType.flags & 15360 /* kindMask */) == 1024 /* isArithmetic */ && subType.spec.ptrSize == 1) {
|
|
2048
|
+
spec.flags = 7168 /* isCString */;
|
|
2049
|
+
break;
|
|
2050
|
+
}
|
|
2051
|
+
// tslint:disable-next-line:no-switch-case-fall-through
|
|
2052
|
+
case 3 /* reference */:
|
|
2053
|
+
// tslint:disable-next-line:no-switch-case-fall-through
|
|
2054
|
+
case 6 /* unique */:
|
|
2055
|
+
// tslint:disable-next-line:no-switch-case-fall-through
|
|
2056
|
+
case 5 /* shared */:
|
|
2057
|
+
srcSpec = subType.spec;
|
|
2058
|
+
if ((subType.flags & 15360 /* kindMask */) != 2048 /* isClass */) {
|
|
2059
|
+
// reportProblem('Unsupported', id, kind, structureType, place);
|
|
2060
|
+
}
|
|
2061
|
+
break;
|
|
2062
|
+
case 8 /* array */:
|
|
2063
|
+
structureParam = '' + query.paramList[1];
|
|
2064
|
+
spec.paramList.push(query.paramList[1]);
|
|
2065
|
+
break;
|
|
2066
|
+
case 9 /* callback */:
|
|
2067
|
+
for (var _i = 0, _a = query.paramList[1]; _i < _a.length; _i++) {
|
|
2068
|
+
var paramId = _a[_i];
|
|
2069
|
+
var paramType = getComplexType(paramId, constructType, getType, queryType, place, kind, structure, depth + 1);
|
|
2070
|
+
argList.push(paramType.name);
|
|
2071
|
+
spec.paramList.push(paramType);
|
|
2072
|
+
}
|
|
2073
|
+
structureParam = argList.join(', ');
|
|
2074
|
+
break;
|
|
2075
|
+
default:
|
|
2076
|
+
break;
|
|
2077
|
+
}
|
|
2078
|
+
spec.name = applyStructure(structure[2], structure[0], subType.name, subType.flags, structureParam);
|
|
2079
|
+
if (srcSpec) {
|
|
2080
|
+
for (var _b = 0, _c = Object.keys(srcSpec); _b < _c.length; _b++) {
|
|
2081
|
+
var key = _c[_b];
|
|
2082
|
+
spec[key] = spec[key] || srcSpec[key];
|
|
2083
|
+
}
|
|
2084
|
+
spec.flags |= srcSpec.flags;
|
|
2085
|
+
}
|
|
2086
|
+
return makeType(constructType, spec);
|
|
2087
|
+
}
|
|
2088
|
+
function makeType(constructType, spec) {
|
|
2089
|
+
var flags = spec.flags;
|
|
2090
|
+
var refKind = flags & 896 /* refMask */;
|
|
2091
|
+
var kind = flags & 15360 /* kindMask */;
|
|
2092
|
+
if (!spec.name && kind == 1024 /* isArithmetic */) {
|
|
2093
|
+
if (spec.ptrSize == 1) {
|
|
2094
|
+
spec.name = (flags & 16 /* isSignless */ ? '' : (flags & 8 /* isUnsigned */ ? 'un' : '') + 'signed ') + 'char';
|
|
2095
|
+
} else {
|
|
2096
|
+
spec.name = (flags & 8 /* isUnsigned */ ? 'u' : '') + (flags & 32 /* isFloat */ ? 'float' : 'int') + (spec.ptrSize * 8 + '_t');
|
|
2097
|
+
}
|
|
2098
|
+
}
|
|
2099
|
+
if (spec.ptrSize == 8 && !(flags & 32 /* isFloat */)) kind = 64 /* isBig */;
|
|
2100
|
+
if (kind == 2048 /* isClass */) {
|
|
2101
|
+
if (refKind == 512 /* isSharedPtr */ || refKind == 640 /* isUniquePtr */) {
|
|
2102
|
+
kind = 4096 /* isSharedClassPtr */;
|
|
2103
|
+
} else if (refKind) kind = 3072 /* isClassPtr */;
|
|
2104
|
+
}
|
|
2105
|
+
return constructType(kind, spec);
|
|
2106
|
+
}
|
|
2107
|
+
var Type = function () {
|
|
2108
|
+
function Type(spec) {
|
|
2109
|
+
this.id = spec.id;
|
|
2110
|
+
this.name = spec.name;
|
|
2111
|
+
this.flags = spec.flags;
|
|
2112
|
+
this.spec = spec;
|
|
2113
|
+
}
|
|
2114
|
+
Type.prototype.toString = function () {
|
|
2115
|
+
return this.name;
|
|
2116
|
+
};
|
|
2117
|
+
return Type;
|
|
2118
|
+
}();
|
|
2119
|
+
var output = {
|
|
2120
|
+
Type: Type,
|
|
2121
|
+
getComplexType: getComplexType,
|
|
2122
|
+
makeType: makeType,
|
|
2123
|
+
structureList: structureList
|
|
2124
|
+
};
|
|
2125
|
+
self.output = output;
|
|
2126
|
+
return self.output || output;
|
|
2127
|
+
}
|
|
2128
|
+
exports.typeModule = typeModule;
|
|
2129
|
+
var _a;
|
|
2130
|
+
});
|
|
2131
|
+
$__System.registerDynamic("a", ["e", "13", "c", "b", "10", "f", "11", "12", "14", "d", "15", "17", "18", "19", "16"], true, function ($__require, exports, module) {
|
|
2132
|
+
var global = this || self,
|
|
2133
|
+
GLOBAL = global;
|
|
2134
|
+
// This file is part of nbind, copyright (C) 2014-2016 BusFaster Ltd.
|
|
2135
|
+
// Released under the MIT license, see LICENSE.
|
|
2136
|
+
var __extends = exports && exports.__extends || function () {
|
|
2137
|
+
var extendStatics = Object.setPrototypeOf || { __proto__: [] } instanceof Array && function (d, b) {
|
|
2138
|
+
d.__proto__ = b;
|
|
2139
|
+
} || function (d, b) {
|
|
2140
|
+
for (var p in b) if (b.hasOwnProperty(p)) d[p] = b[p];
|
|
2141
|
+
};
|
|
2142
|
+
return function (d, b) {
|
|
2143
|
+
extendStatics(d, b);
|
|
2144
|
+
function __() {
|
|
2145
|
+
this.constructor = d;
|
|
2146
|
+
}
|
|
2147
|
+
d.prototype = b === null ? Object.create(b) : (__.prototype = b.prototype, new __());
|
|
2148
|
+
};
|
|
2149
|
+
}();
|
|
2150
|
+
var __decorate = exports && exports.__decorate || function (decorators, target, key, desc) {
|
|
2151
|
+
var c = arguments.length,
|
|
2152
|
+
r = c < 3 ? target : desc === null ? desc = Object.getOwnPropertyDescriptor(target, key) : desc,
|
|
2153
|
+
d;
|
|
2154
|
+
if (typeof Reflect === "object" && typeof Reflect.decorate === "function") r = Reflect.decorate(decorators, target, key, desc);else for (var i = decorators.length - 1; i >= 0; i--) if (d = decorators[i]) r = (c < 3 ? d(r) : c > 3 ? d(target, key, r) : d(target, key)) || r;
|
|
2155
|
+
return c > 3 && r && Object.defineProperty(target, key, r), r;
|
|
2156
|
+
};
|
|
2157
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
2158
|
+
// This file contains JavaScript functions directly exposed to C++ through
|
|
2159
|
+
// Emscripten library exports.
|
|
2160
|
+
var emscripten_library_decorator_1 = $__require("e");
|
|
2161
|
+
var Globals_1 = $__require("13");
|
|
2162
|
+
exports._globals = Globals_1._nbind;
|
|
2163
|
+
var BindingType_1 = $__require("c");
|
|
2164
|
+
exports._type = BindingType_1._nbind;
|
|
2165
|
+
var BindClass_1 = $__require("b");
|
|
2166
|
+
exports._class = BindClass_1._nbind;
|
|
2167
|
+
var External_1 = $__require("10");
|
|
2168
|
+
exports._external = External_1._nbind;
|
|
2169
|
+
var Callback_1 = $__require("f");
|
|
2170
|
+
exports._callback = Callback_1._nbind;
|
|
2171
|
+
var ValueObj_1 = $__require("11");
|
|
2172
|
+
exports._value = ValueObj_1._nbind;
|
|
2173
|
+
var BindingStd_1 = $__require("12");
|
|
2174
|
+
exports._std = BindingStd_1._nbind;
|
|
2175
|
+
var Caller_1 = $__require("14");
|
|
2176
|
+
exports._caller = Caller_1._nbind;
|
|
2177
|
+
var Wrapper_1 = $__require("d");
|
|
2178
|
+
exports._wrapper = Wrapper_1._nbind;
|
|
2179
|
+
var Resource_1 = $__require("15");
|
|
2180
|
+
exports._resource = Resource_1._nbind;
|
|
2181
|
+
var Buffer_1 = $__require("17");
|
|
2182
|
+
exports._buffer = Buffer_1._nbind;
|
|
2183
|
+
var GC_1 = $__require("18");
|
|
2184
|
+
exports._gc = GC_1._nbind;
|
|
2185
|
+
var common_1 = $__require("19");
|
|
2186
|
+
var Type_1 = $__require("16");
|
|
2187
|
+
// Let decorators run eval in current scope to read function source code.
|
|
2188
|
+
emscripten_library_decorator_1.setEvil(function (code) {
|
|
2189
|
+
return eval(code);
|
|
2190
|
+
});
|
|
2191
|
+
var _removeAccessorPrefix = common_1.removeAccessorPrefix;
|
|
2192
|
+
var _typeModule = Type_1.typeModule;
|
|
2193
|
+
var _nbind;
|
|
2194
|
+
(function (_nbind) {})(_nbind = exports._nbind || (exports._nbind = {}));
|
|
2195
|
+
emscripten_library_decorator_1.publishNamespace('_nbind');
|
|
2196
|
+
// Ensure the __extends function gets defined.
|
|
2197
|
+
var Dummy = function (_super) {
|
|
2198
|
+
__extends(Dummy, _super);
|
|
2199
|
+
function Dummy() {
|
|
2200
|
+
return _super !== null && _super.apply(this, arguments) || this;
|
|
2201
|
+
}
|
|
2202
|
+
return Dummy;
|
|
2203
|
+
}(Boolean);
|
|
2204
|
+
var nbind = function () {
|
|
2205
|
+
function nbind() {}
|
|
2206
|
+
nbind._nbind_register_pool = function (pageSize, usedPtr, rootPtr, pagePtr) {
|
|
2207
|
+
_nbind.Pool.pageSize = pageSize;
|
|
2208
|
+
_nbind.Pool.usedPtr = usedPtr / 4;
|
|
2209
|
+
_nbind.Pool.rootPtr = rootPtr;
|
|
2210
|
+
_nbind.Pool.pagePtr = pagePtr / 4;
|
|
2211
|
+
HEAP32[usedPtr / 4] = 0x01020304;
|
|
2212
|
+
if (HEAP8[usedPtr] == 1) _nbind.bigEndian = true;
|
|
2213
|
+
HEAP32[usedPtr / 4] = 0;
|
|
2214
|
+
_nbind.makeTypeKindTbl = (_a = {}, _a[1024 /* isArithmetic */] = _nbind.PrimitiveType, _a[64 /* isBig */] = _nbind.Int64Type, _a[2048 /* isClass */] = _nbind.BindClass, _a[3072 /* isClassPtr */] = _nbind.BindClassPtr, _a[4096 /* isSharedClassPtr */] = _nbind.SharedClassPtr, _a[5120 /* isVector */] = _nbind.ArrayType, _a[6144 /* isArray */] = _nbind.ArrayType, _a[7168 /* isCString */] = _nbind.CStringType, _a[9216 /* isCallback */] = _nbind.CallbackType, _a[10240 /* isOther */] = _nbind.BindType, _a);
|
|
2215
|
+
_nbind.makeTypeNameTbl = {
|
|
2216
|
+
'Buffer': _nbind.BufferType,
|
|
2217
|
+
'External': _nbind.ExternalType,
|
|
2218
|
+
'Int64': _nbind.Int64Type,
|
|
2219
|
+
'_nbind_new': _nbind.CreateValueType,
|
|
2220
|
+
'bool': _nbind.BooleanType,
|
|
2221
|
+
// 'cbFunction': _nbind.CallbackType,
|
|
2222
|
+
'cbFunction &': _nbind.CallbackType,
|
|
2223
|
+
'const cbFunction &': _nbind.CallbackType,
|
|
2224
|
+
'const std::string &': _nbind.StringType,
|
|
2225
|
+
'std::string': _nbind.StringType
|
|
2226
|
+
};
|
|
2227
|
+
Module['toggleLightGC'] = _nbind.toggleLightGC;
|
|
2228
|
+
_nbind.callUpcast = Module['dynCall_ii'];
|
|
2229
|
+
var globalScope = _nbind.makeType(_nbind.constructType, {
|
|
2230
|
+
flags: 2048 /* isClass */
|
|
2231
|
+
, id: 0,
|
|
2232
|
+
name: ''
|
|
2233
|
+
});
|
|
2234
|
+
globalScope.proto = Module;
|
|
2235
|
+
_nbind.BindClass.list.push(globalScope);
|
|
2236
|
+
var _a;
|
|
2237
|
+
};
|
|
2238
|
+
nbind._nbind_register_type = function (id, namePtr) {
|
|
2239
|
+
var name = _nbind.readAsciiString(namePtr);
|
|
2240
|
+
var spec = {
|
|
2241
|
+
flags: 10240 /* isOther */
|
|
2242
|
+
, id: id,
|
|
2243
|
+
name: name
|
|
2244
|
+
};
|
|
2245
|
+
_nbind.makeType(_nbind.constructType, spec);
|
|
2246
|
+
};
|
|
2247
|
+
nbind._nbind_register_primitive = function (id, size, flags) {
|
|
2248
|
+
var spec = {
|
|
2249
|
+
flags: 1024 /* isArithmetic */ | flags,
|
|
2250
|
+
id: id,
|
|
2251
|
+
ptrSize: size
|
|
2252
|
+
};
|
|
2253
|
+
_nbind.makeType(_nbind.constructType, spec);
|
|
2254
|
+
};
|
|
2255
|
+
nbind._nbind_register_class = function (idListPtr, policyListPtr, superListPtr, upcastListPtr, superCount, destructorPtr, namePtr) {
|
|
2256
|
+
var name = _nbind.readAsciiString(namePtr);
|
|
2257
|
+
var policyTbl = _nbind.readPolicyList(policyListPtr);
|
|
2258
|
+
var idList = HEAPU32.subarray(idListPtr / 4, idListPtr / 4 + 2);
|
|
2259
|
+
var spec = {
|
|
2260
|
+
flags: 2048 /* isClass */ | (policyTbl['Value'] ? 2 /* isValueObject */ : 0),
|
|
2261
|
+
id: idList[0],
|
|
2262
|
+
name: name
|
|
2263
|
+
};
|
|
2264
|
+
var bindClass = _nbind.makeType(_nbind.constructType, spec);
|
|
2265
|
+
bindClass.ptrType = _nbind.getComplexType(idList[1], _nbind.constructType, _nbind.getType, _nbind.queryType);
|
|
2266
|
+
bindClass.destroy = _nbind.makeMethodCaller(bindClass.ptrType, {
|
|
2267
|
+
boundID: spec.id,
|
|
2268
|
+
flags: 0 /* none */
|
|
2269
|
+
, name: 'destroy',
|
|
2270
|
+
num: 0,
|
|
2271
|
+
ptr: destructorPtr,
|
|
2272
|
+
title: bindClass.name + '.free',
|
|
2273
|
+
typeList: ['void', 'uint32_t', 'uint32_t']
|
|
2274
|
+
});
|
|
2275
|
+
if (superCount) {
|
|
2276
|
+
bindClass.superIdList = Array.prototype.slice.call(HEAPU32.subarray(superListPtr / 4, superListPtr / 4 + superCount));
|
|
2277
|
+
bindClass.upcastList = Array.prototype.slice.call(HEAPU32.subarray(upcastListPtr / 4, upcastListPtr / 4 + superCount));
|
|
2278
|
+
}
|
|
2279
|
+
Module[bindClass.name] = bindClass.makeBound(policyTbl);
|
|
2280
|
+
_nbind.BindClass.list.push(bindClass);
|
|
2281
|
+
};
|
|
2282
|
+
nbind._nbind_register_function = function (boundID, policyListPtr, typeListPtr, typeCount, ptr, direct, signatureType, namePtr, num, flags) {
|
|
2283
|
+
var bindClass = _nbind.getType(boundID);
|
|
2284
|
+
var policyTbl = _nbind.readPolicyList(policyListPtr);
|
|
2285
|
+
var typeList = _nbind.readTypeIdList(typeListPtr, typeCount);
|
|
2286
|
+
var specList;
|
|
2287
|
+
if (signatureType == 5 /* construct */) {
|
|
2288
|
+
specList = [{
|
|
2289
|
+
direct: ptr,
|
|
2290
|
+
name: '__nbindConstructor',
|
|
2291
|
+
ptr: 0,
|
|
2292
|
+
title: bindClass.name + ' constructor',
|
|
2293
|
+
typeList: ['uint32_t'].concat(typeList.slice(1))
|
|
2294
|
+
}, {
|
|
2295
|
+
direct: direct,
|
|
2296
|
+
name: '__nbindValueConstructor',
|
|
2297
|
+
ptr: 0,
|
|
2298
|
+
title: bindClass.name + ' value constructor',
|
|
2299
|
+
typeList: ['void', 'uint32_t'].concat(typeList.slice(1))
|
|
2300
|
+
}];
|
|
2301
|
+
} else {
|
|
2302
|
+
var name = _nbind.readAsciiString(namePtr);
|
|
2303
|
+
var title = (bindClass.name && bindClass.name + '.') + name;
|
|
2304
|
+
if (signatureType == 3 /* getter */ || signatureType == 4 /* setter */) {
|
|
2305
|
+
name = _removeAccessorPrefix(name);
|
|
2306
|
+
}
|
|
2307
|
+
specList = [{
|
|
2308
|
+
boundID: boundID,
|
|
2309
|
+
direct: direct,
|
|
2310
|
+
name: name,
|
|
2311
|
+
ptr: ptr,
|
|
2312
|
+
title: title,
|
|
2313
|
+
typeList: typeList
|
|
2314
|
+
}];
|
|
2315
|
+
}
|
|
2316
|
+
for (var _i = 0, specList_1 = specList; _i < specList_1.length; _i++) {
|
|
2317
|
+
var spec = specList_1[_i];
|
|
2318
|
+
spec.signatureType = signatureType;
|
|
2319
|
+
spec.policyTbl = policyTbl;
|
|
2320
|
+
spec.num = num;
|
|
2321
|
+
spec.flags = flags;
|
|
2322
|
+
bindClass.addMethod(spec);
|
|
2323
|
+
}
|
|
2324
|
+
};
|
|
2325
|
+
nbind._nbind_finish = function () {
|
|
2326
|
+
for (var _i = 0, _a = _nbind.BindClass.list; _i < _a.length; _i++) {
|
|
2327
|
+
var bindClass = _a[_i];
|
|
2328
|
+
bindClass.finish();
|
|
2329
|
+
}
|
|
2330
|
+
};
|
|
2331
|
+
nbind.nbind_debug = function () {
|
|
2332
|
+
debugger;
|
|
2333
|
+
};
|
|
2334
|
+
return nbind;
|
|
2335
|
+
}();
|
|
2336
|
+
__decorate([emscripten_library_decorator_1.dep('_nbind')], nbind, "_nbind_register_pool", null);
|
|
2337
|
+
__decorate([emscripten_library_decorator_1.dep('_nbind', '_typeModule')], nbind, "_nbind_register_type", null);
|
|
2338
|
+
__decorate([emscripten_library_decorator_1.dep('_nbind')], nbind, "_nbind_register_primitive", null);
|
|
2339
|
+
__decorate([emscripten_library_decorator_1.dep('_nbind', '__extends')], nbind, "_nbind_register_class", null);
|
|
2340
|
+
__decorate([emscripten_library_decorator_1.dep('_nbind', '_removeAccessorPrefix')], nbind, "_nbind_register_function", null);
|
|
2341
|
+
__decorate([emscripten_library_decorator_1.dep('_nbind')], nbind, "_nbind_finish", null);
|
|
2342
|
+
__decorate([emscripten_library_decorator_1.dep('_nbind')], nbind, "nbind_debug", null);
|
|
2343
|
+
nbind = __decorate([emscripten_library_decorator_1.exportLibrary], nbind);
|
|
2344
|
+
});
|
|
2345
|
+
})
|
|
2346
|
+
(function(factory) {
|
|
2347
|
+
if (typeof define == 'function' && define.amd)
|
|
2348
|
+
define([], factory);
|
|
2349
|
+
else if (typeof module == 'object' && module.exports && typeof require == 'function')
|
|
2350
|
+
module.exports = factory();
|
|
2351
|
+
else
|
|
2352
|
+
factory();
|
|
2353
|
+
});
|