autumnplot-gl 3.0.0 → 3.2.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/README.md +6 -11
- package/dist/110.autumnplot-gl.js +1 -1
- package/dist/110.autumnplot-gl.js.map +1 -1
- package/dist/autumnplot-gl.js +1 -1
- package/dist/autumnplot-gl.js.map +1 -1
- package/dist/marchingsquares.wasm +0 -0
- package/lib/Barbs.d.ts +18 -2
- package/lib/Barbs.js +25 -19
- package/lib/BillboardCollection.d.ts +9 -2
- package/lib/BillboardCollection.js +46 -9
- package/lib/Color.d.ts +56 -0
- package/lib/Color.js +160 -0
- package/lib/ColorBar.d.ts +2 -1
- package/lib/ColorBar.js +5 -5
- package/lib/Colormap.d.ts +19 -18
- package/lib/Colormap.js +81 -20
- package/lib/Contour.d.ts +25 -6
- package/lib/Contour.js +61 -12
- package/lib/ContourCreator.js +4 -40
- package/lib/Fill.d.ts +2 -4
- package/lib/Fill.js +29 -45
- package/lib/Grid.d.ts +1 -0
- package/lib/Grid.js +6 -1
- package/lib/Hodographs.d.ts +19 -3
- package/lib/Hodographs.js +23 -20
- package/lib/Paintball.d.ts +2 -2
- package/lib/Paintball.js +9 -6
- package/lib/PlotComponent.js +9 -4
- package/lib/PlotLayer.d.ts +1 -1
- package/lib/PlotLayer.worker.js +10 -7
- package/lib/PolylineCollection.d.ts +13 -6
- package/lib/PolylineCollection.js +76 -64
- package/lib/StationPlot.d.ts +34 -0
- package/lib/StationPlot.js +73 -0
- package/lib/TextCollection.d.ts +3 -2
- package/lib/TextCollection.js +21 -11
- package/lib/cpp/marchingsquares.js +558 -1261
- package/lib/cpp/marchingsquares.wasm +0 -0
- package/lib/cpp/marchingsquares_embind.d.ts +4 -45
- package/lib/index.d.ts +4 -2
- package/lib/index.js +2 -1
- package/lib/utils.d.ts +2 -8
- package/lib/utils.js +1 -83
- package/package.json +2 -2
|
@@ -1386,348 +1386,293 @@ function dbg(text) {
|
|
|
1386
1386
|
});
|
|
1387
1387
|
};
|
|
1388
1388
|
|
|
1389
|
-
|
|
1390
|
-
|
|
1391
|
-
|
|
1392
|
-
|
|
1393
|
-
|
|
1394
|
-
|
|
1395
|
-
|
|
1396
|
-
|
|
1397
|
-
|
|
1398
|
-
|
|
1399
|
-
|
|
1400
|
-
|
|
1401
|
-
|
|
1402
|
-
|
|
1403
|
-
|
|
1404
|
-
|
|
1405
|
-
|
|
1389
|
+
function handleAllocatorInit() {
|
|
1390
|
+
Object.assign(HandleAllocator.prototype, /** @lends {HandleAllocator.prototype} */ {
|
|
1391
|
+
get(id) {
|
|
1392
|
+
assert(this.allocated[id] !== undefined, `invalid handle: ${id}`);
|
|
1393
|
+
return this.allocated[id];
|
|
1394
|
+
},
|
|
1395
|
+
has(id) {
|
|
1396
|
+
return this.allocated[id] !== undefined;
|
|
1397
|
+
},
|
|
1398
|
+
allocate(handle) {
|
|
1399
|
+
var id = this.freelist.pop() || this.allocated.length;
|
|
1400
|
+
this.allocated[id] = handle;
|
|
1401
|
+
return id;
|
|
1402
|
+
},
|
|
1403
|
+
free(id) {
|
|
1404
|
+
assert(this.allocated[id] !== undefined);
|
|
1405
|
+
// Set the slot to `undefined` rather than using `delete` here since
|
|
1406
|
+
// apparently arrays with holes in them can be less efficient.
|
|
1407
|
+
this.allocated[id] = undefined;
|
|
1408
|
+
this.freelist.push(id);
|
|
1409
|
+
}
|
|
1410
|
+
});
|
|
1411
|
+
}
|
|
1412
|
+
/** @constructor */
|
|
1413
|
+
function HandleAllocator() {
|
|
1414
|
+
// Reserve slot 0 so that 0 is always an invalid handle
|
|
1415
|
+
this.allocated = [undefined];
|
|
1416
|
+
this.freelist = [];
|
|
1417
|
+
}
|
|
1418
|
+
var emval_handles = new HandleAllocator();;
|
|
1419
|
+
var __emval_decref = (handle) => {
|
|
1420
|
+
if (handle >= emval_handles.reserved && 0 === --emval_handles.get(handle).refcount) {
|
|
1421
|
+
emval_handles.free(handle);
|
|
1406
1422
|
}
|
|
1407
|
-
throwBindingError(getInstanceTypeName(obj) + ' instance already deleted');
|
|
1408
1423
|
};
|
|
1409
1424
|
|
|
1410
|
-
var finalizationRegistry = false;
|
|
1411
1425
|
|
|
1412
|
-
var detachFinalizer = (handle) => {};
|
|
1413
1426
|
|
|
1414
|
-
var
|
|
1415
|
-
|
|
1416
|
-
|
|
1417
|
-
|
|
1418
|
-
|
|
1419
|
-
|
|
1420
|
-
};
|
|
1421
|
-
var releaseClassHandle = ($$) => {
|
|
1422
|
-
$$.count.value -= 1;
|
|
1423
|
-
var toDelete = 0 === $$.count.value;
|
|
1424
|
-
if (toDelete) {
|
|
1425
|
-
runDestructor($$);
|
|
1427
|
+
var count_emval_handles = () => {
|
|
1428
|
+
var count = 0;
|
|
1429
|
+
for (var i = emval_handles.reserved; i < emval_handles.allocated.length; ++i) {
|
|
1430
|
+
if (emval_handles.allocated[i] !== undefined) {
|
|
1431
|
+
++count;
|
|
1432
|
+
}
|
|
1426
1433
|
}
|
|
1434
|
+
return count;
|
|
1427
1435
|
};
|
|
1428
1436
|
|
|
1429
|
-
var
|
|
1430
|
-
|
|
1431
|
-
|
|
1432
|
-
|
|
1433
|
-
|
|
1434
|
-
|
|
1435
|
-
|
|
1436
|
-
|
|
1437
|
-
|
|
1438
|
-
|
|
1439
|
-
|
|
1440
|
-
}
|
|
1441
|
-
return desiredClass.downcast(rv);
|
|
1437
|
+
var init_emval = () => {
|
|
1438
|
+
// reserve some special values. These never get de-allocated.
|
|
1439
|
+
// The HandleAllocator takes care of reserving zero.
|
|
1440
|
+
emval_handles.allocated.push(
|
|
1441
|
+
{value: undefined},
|
|
1442
|
+
{value: null},
|
|
1443
|
+
{value: true},
|
|
1444
|
+
{value: false},
|
|
1445
|
+
);
|
|
1446
|
+
emval_handles.reserved = emval_handles.allocated.length
|
|
1447
|
+
Module['count_emval_handles'] = count_emval_handles;
|
|
1442
1448
|
};
|
|
1443
|
-
|
|
1444
|
-
|
|
1445
|
-
|
|
1446
|
-
|
|
1447
|
-
var getInheritedInstanceCount = () => Object.keys(registeredInstances).length;
|
|
1448
|
-
|
|
1449
|
-
var getLiveInheritedInstances = () => {
|
|
1450
|
-
var rv = [];
|
|
1451
|
-
for (var k in registeredInstances) {
|
|
1452
|
-
if (registeredInstances.hasOwnProperty(k)) {
|
|
1453
|
-
rv.push(registeredInstances[k]);
|
|
1449
|
+
var Emval = {
|
|
1450
|
+
toValue:(handle) => {
|
|
1451
|
+
if (!handle) {
|
|
1452
|
+
throwBindingError('Cannot use deleted val. handle = ' + handle);
|
|
1454
1453
|
}
|
|
1455
|
-
|
|
1456
|
-
|
|
1457
|
-
|
|
1454
|
+
return emval_handles.get(handle).value;
|
|
1455
|
+
},
|
|
1456
|
+
toHandle:(value) => {
|
|
1457
|
+
switch (value) {
|
|
1458
|
+
case undefined: return 1;
|
|
1459
|
+
case null: return 2;
|
|
1460
|
+
case true: return 3;
|
|
1461
|
+
case false: return 4;
|
|
1462
|
+
default:{
|
|
1463
|
+
return emval_handles.allocate({refcount: 1, value: value});
|
|
1464
|
+
}
|
|
1465
|
+
}
|
|
1466
|
+
},
|
|
1467
|
+
};
|
|
1458
1468
|
|
|
1459
|
-
var deletionQueue = [];
|
|
1460
|
-
var flushPendingDeletes = () => {
|
|
1461
|
-
while (deletionQueue.length) {
|
|
1462
|
-
var obj = deletionQueue.pop();
|
|
1463
|
-
obj.$$.deleteScheduled = false;
|
|
1464
|
-
obj['delete']();
|
|
1465
|
-
}
|
|
1466
|
-
};
|
|
1467
1469
|
|
|
1468
|
-
var delayFunction;
|
|
1469
1470
|
|
|
1471
|
+
/** @suppress {globalThis} */
|
|
1472
|
+
function simpleReadValueFromPointer(pointer) {
|
|
1473
|
+
return this['fromWireType'](HEAP32[((pointer)>>2)]);
|
|
1474
|
+
}
|
|
1475
|
+
var __embind_register_emval = (rawType, name) => {
|
|
1476
|
+
name = readLatin1String(name);
|
|
1477
|
+
registerType(rawType, {
|
|
1478
|
+
name,
|
|
1479
|
+
'fromWireType': (handle) => {
|
|
1480
|
+
var rv = Emval.toValue(handle);
|
|
1481
|
+
__emval_decref(handle);
|
|
1482
|
+
return rv;
|
|
1483
|
+
},
|
|
1484
|
+
'toWireType': (destructors, value) => Emval.toHandle(value),
|
|
1485
|
+
'argPackAdvance': GenericWireTypeSize,
|
|
1486
|
+
'readValueFromPointer': simpleReadValueFromPointer,
|
|
1487
|
+
destructorFunction: null, // This type does not need a destructor
|
|
1470
1488
|
|
|
1471
|
-
|
|
1472
|
-
|
|
1473
|
-
|
|
1474
|
-
delayFunction(flushPendingDeletes);
|
|
1475
|
-
}
|
|
1476
|
-
};
|
|
1477
|
-
var init_embind = () => {
|
|
1478
|
-
Module['getInheritedInstanceCount'] = getInheritedInstanceCount;
|
|
1479
|
-
Module['getLiveInheritedInstances'] = getLiveInheritedInstances;
|
|
1480
|
-
Module['flushPendingDeletes'] = flushPendingDeletes;
|
|
1481
|
-
Module['setDelayFunction'] = setDelayFunction;
|
|
1489
|
+
// TODO: do we need a deleteObject here? write a test where
|
|
1490
|
+
// emval is passed into JS via an interface
|
|
1491
|
+
});
|
|
1482
1492
|
};
|
|
1483
|
-
|
|
1484
|
-
|
|
1485
|
-
|
|
1486
|
-
|
|
1487
|
-
if (ptr === undefined) {
|
|
1488
|
-
throwBindingError('ptr should not be undefined');
|
|
1493
|
+
|
|
1494
|
+
var embindRepr = (v) => {
|
|
1495
|
+
if (v === null) {
|
|
1496
|
+
return 'null';
|
|
1489
1497
|
}
|
|
1490
|
-
|
|
1491
|
-
|
|
1492
|
-
|
|
1498
|
+
var t = typeof v;
|
|
1499
|
+
if (t === 'object' || t === 'array' || t === 'function') {
|
|
1500
|
+
return v.toString();
|
|
1501
|
+
} else {
|
|
1502
|
+
return '' + v;
|
|
1493
1503
|
}
|
|
1494
|
-
return ptr;
|
|
1495
1504
|
};
|
|
1496
|
-
|
|
1497
|
-
|
|
1498
|
-
|
|
1505
|
+
|
|
1506
|
+
var floatReadValueFromPointer = (name, width) => {
|
|
1507
|
+
switch (width) {
|
|
1508
|
+
case 4: return function(pointer) {
|
|
1509
|
+
return this['fromWireType'](HEAPF32[((pointer)>>2)]);
|
|
1510
|
+
};
|
|
1511
|
+
case 8: return function(pointer) {
|
|
1512
|
+
return this['fromWireType'](HEAPF64[((pointer)>>3)]);
|
|
1513
|
+
};
|
|
1514
|
+
default:
|
|
1515
|
+
throw new TypeError(`invalid float width (${width}): ${name}`);
|
|
1516
|
+
}
|
|
1499
1517
|
};
|
|
1500
1518
|
|
|
1501
1519
|
|
|
1502
|
-
var
|
|
1503
|
-
|
|
1504
|
-
|
|
1505
|
-
|
|
1506
|
-
|
|
1507
|
-
|
|
1508
|
-
|
|
1509
|
-
|
|
1510
|
-
|
|
1511
|
-
|
|
1512
|
-
|
|
1513
|
-
|
|
1514
|
-
value: record,
|
|
1520
|
+
var __embind_register_float = (rawType, name, size) => {
|
|
1521
|
+
name = readLatin1String(name);
|
|
1522
|
+
registerType(rawType, {
|
|
1523
|
+
name,
|
|
1524
|
+
'fromWireType': (value) => value,
|
|
1525
|
+
'toWireType': (destructors, value) => {
|
|
1526
|
+
if (typeof value != "number" && typeof value != "boolean") {
|
|
1527
|
+
throw new TypeError(`Cannot convert ${embindRepr(value)} to ${this.name}`);
|
|
1528
|
+
}
|
|
1529
|
+
// The VM will perform JS to Wasm value conversion, according to the spec:
|
|
1530
|
+
// https://www.w3.org/TR/wasm-js-api-1/#towebassemblyvalue
|
|
1531
|
+
return value;
|
|
1515
1532
|
},
|
|
1516
|
-
|
|
1533
|
+
'argPackAdvance': GenericWireTypeSize,
|
|
1534
|
+
'readValueFromPointer': floatReadValueFromPointer(name, size),
|
|
1535
|
+
destructorFunction: null, // This type does not need a destructor
|
|
1536
|
+
});
|
|
1517
1537
|
};
|
|
1518
|
-
|
|
1519
|
-
|
|
1520
|
-
|
|
1521
|
-
|
|
1522
|
-
// rawPointer is a maybe-null raw pointer
|
|
1523
|
-
var rawPointer = this.getPointee(ptr);
|
|
1524
|
-
if (!rawPointer) {
|
|
1525
|
-
this.destructor(ptr);
|
|
1526
|
-
return null;
|
|
1527
|
-
}
|
|
1538
|
+
|
|
1539
|
+
var createNamedFunction = (name, body) => Object.defineProperty(body, 'name', {
|
|
1540
|
+
value: name
|
|
1541
|
+
});
|
|
1528
1542
|
|
|
1529
|
-
|
|
1530
|
-
|
|
1531
|
-
|
|
1532
|
-
|
|
1533
|
-
|
|
1534
|
-
registeredInstance.$$.smartPtr = ptr;
|
|
1535
|
-
return registeredInstance['clone']();
|
|
1536
|
-
} else {
|
|
1537
|
-
// else, just increment reference count on existing object
|
|
1538
|
-
// it already has a reference to the smart pointer
|
|
1539
|
-
var rv = registeredInstance['clone']();
|
|
1540
|
-
this.destructor(ptr);
|
|
1541
|
-
return rv;
|
|
1542
|
-
}
|
|
1543
|
+
var runDestructors = (destructors) => {
|
|
1544
|
+
while (destructors.length) {
|
|
1545
|
+
var ptr = destructors.pop();
|
|
1546
|
+
var del = destructors.pop();
|
|
1547
|
+
del(ptr);
|
|
1543
1548
|
}
|
|
1549
|
+
};
|
|
1544
1550
|
|
|
1545
|
-
function makeDefaultHandle() {
|
|
1546
|
-
if (this.isSmartPointer) {
|
|
1547
|
-
return makeClassHandle(this.registeredClass.instancePrototype, {
|
|
1548
|
-
ptrType: this.pointeeType,
|
|
1549
|
-
ptr: rawPointer,
|
|
1550
|
-
smartPtrType: this,
|
|
1551
|
-
smartPtr: ptr,
|
|
1552
|
-
});
|
|
1553
|
-
} else {
|
|
1554
|
-
return makeClassHandle(this.registeredClass.instancePrototype, {
|
|
1555
|
-
ptrType: this,
|
|
1556
|
-
ptr,
|
|
1557
|
-
});
|
|
1558
|
-
}
|
|
1559
|
-
}
|
|
1560
1551
|
|
|
1561
|
-
|
|
1562
|
-
|
|
1563
|
-
|
|
1564
|
-
return makeDefaultHandle.call(this);
|
|
1552
|
+
function newFunc(constructor, argumentList) {
|
|
1553
|
+
if (!(constructor instanceof Function)) {
|
|
1554
|
+
throw new TypeError(`new_ called with constructor type ${typeof(constructor)} which is not a function`);
|
|
1565
1555
|
}
|
|
1556
|
+
/*
|
|
1557
|
+
* Previously, the following line was just:
|
|
1558
|
+
* function dummy() {};
|
|
1559
|
+
* Unfortunately, Chrome was preserving 'dummy' as the object's name, even
|
|
1560
|
+
* though at creation, the 'dummy' has the correct constructor name. Thus,
|
|
1561
|
+
* objects created with IMVU.new would show up in the debugger as 'dummy',
|
|
1562
|
+
* which isn't very helpful. Using IMVU.createNamedFunction addresses the
|
|
1563
|
+
* issue. Doublely-unfortunately, there's no way to write a test for this
|
|
1564
|
+
* behavior. -NRD 2013.02.22
|
|
1565
|
+
*/
|
|
1566
|
+
var dummy = createNamedFunction(constructor.name || 'unknownFunctionName', function(){});
|
|
1567
|
+
dummy.prototype = constructor.prototype;
|
|
1568
|
+
var obj = new dummy;
|
|
1566
1569
|
|
|
1567
|
-
var
|
|
1568
|
-
|
|
1569
|
-
toType = registeredPointerRecord.constPointerType;
|
|
1570
|
-
} else {
|
|
1571
|
-
toType = registeredPointerRecord.pointerType;
|
|
1572
|
-
}
|
|
1573
|
-
var dp = downcastPointer(
|
|
1574
|
-
rawPointer,
|
|
1575
|
-
this.registeredClass,
|
|
1576
|
-
toType.registeredClass);
|
|
1577
|
-
if (dp === null) {
|
|
1578
|
-
return makeDefaultHandle.call(this);
|
|
1579
|
-
}
|
|
1580
|
-
if (this.isSmartPointer) {
|
|
1581
|
-
return makeClassHandle(toType.registeredClass.instancePrototype, {
|
|
1582
|
-
ptrType: toType,
|
|
1583
|
-
ptr: dp,
|
|
1584
|
-
smartPtrType: this,
|
|
1585
|
-
smartPtr: ptr,
|
|
1586
|
-
});
|
|
1587
|
-
} else {
|
|
1588
|
-
return makeClassHandle(toType.registeredClass.instancePrototype, {
|
|
1589
|
-
ptrType: toType,
|
|
1590
|
-
ptr: dp,
|
|
1591
|
-
});
|
|
1592
|
-
}
|
|
1570
|
+
var r = constructor.apply(obj, argumentList);
|
|
1571
|
+
return (r instanceof Object) ? r : obj;
|
|
1593
1572
|
}
|
|
1594
|
-
|
|
1595
|
-
|
|
1596
|
-
|
|
1597
|
-
|
|
1573
|
+
function craftInvokerFunction(humanName, argTypes, classType, cppInvokerFunc, cppTargetFunc, /** boolean= */ isAsync) {
|
|
1574
|
+
// humanName: a human-readable string name for the function to be generated.
|
|
1575
|
+
// argTypes: An array that contains the embind type objects for all types in the function signature.
|
|
1576
|
+
// argTypes[0] is the type object for the function return value.
|
|
1577
|
+
// argTypes[1] is the type object for function this object/class type, or null if not crafting an invoker for a class method.
|
|
1578
|
+
// argTypes[2...] are the actual function parameters.
|
|
1579
|
+
// classType: The embind type object for the class to be bound, or null if this is not a method of a class.
|
|
1580
|
+
// cppInvokerFunc: JS Function object to the C++-side function that interops into C++ code.
|
|
1581
|
+
// cppTargetFunc: Function pointer (an integer to FUNCTION_TABLE) to the target C++ function the cppInvokerFunc will end up calling.
|
|
1582
|
+
// isAsync: Optional. If true, returns an async function. Async bindings are only supported with JSPI.
|
|
1583
|
+
var argCount = argTypes.length;
|
|
1584
|
+
|
|
1585
|
+
if (argCount < 2) {
|
|
1586
|
+
throwBindingError("argTypes array size mismatch! Must at least get return value and 'this' types!");
|
|
1598
1587
|
}
|
|
1599
|
-
// If the running environment has a FinalizationRegistry (see
|
|
1600
|
-
// https://github.com/tc39/proposal-weakrefs), then attach finalizers
|
|
1601
|
-
// for class handles. We check for the presence of FinalizationRegistry
|
|
1602
|
-
// at run-time, not build-time.
|
|
1603
|
-
finalizationRegistry = new FinalizationRegistry((info) => {
|
|
1604
|
-
console.warn(info.leakWarning.stack.replace(/^Error: /, ''));
|
|
1605
|
-
releaseClassHandle(info.$$);
|
|
1606
|
-
});
|
|
1607
|
-
attachFinalizer = (handle) => {
|
|
1608
|
-
var $$ = handle.$$;
|
|
1609
|
-
var hasSmartPtr = !!$$.smartPtr;
|
|
1610
|
-
if (hasSmartPtr) {
|
|
1611
|
-
// We should not call the destructor on raw pointers in case other code expects the pointee to live
|
|
1612
|
-
var info = { $$: $$ };
|
|
1613
|
-
// Create a warning as an Error instance in advance so that we can store
|
|
1614
|
-
// the current stacktrace and point to it when / if a leak is detected.
|
|
1615
|
-
// This is more useful than the empty stacktrace of `FinalizationRegistry`
|
|
1616
|
-
// callback.
|
|
1617
|
-
var cls = $$.ptrType.registeredClass;
|
|
1618
|
-
info.leakWarning = new Error(`Embind found a leaked C++ instance ${cls.name} <${ptrToString($$.ptr)}>.\n` +
|
|
1619
|
-
"We'll free it automatically in this case, but this functionality is not reliable across various environments.\n" +
|
|
1620
|
-
"Make sure to invoke .delete() manually once you're done with the instance instead.\n" +
|
|
1621
|
-
"Originally allocated"); // `.stack` will add "at ..." after this sentence
|
|
1622
|
-
if ('captureStackTrace' in Error) {
|
|
1623
|
-
Error.captureStackTrace(info.leakWarning, RegisteredPointer_fromWireType);
|
|
1624
|
-
}
|
|
1625
|
-
finalizationRegistry.register(handle, info, handle);
|
|
1626
|
-
}
|
|
1627
|
-
return handle;
|
|
1628
|
-
};
|
|
1629
|
-
detachFinalizer = (handle) => finalizationRegistry.unregister(handle);
|
|
1630
|
-
return attachFinalizer(handle);
|
|
1631
|
-
};
|
|
1632
1588
|
|
|
1589
|
+
assert(!isAsync, 'Async bindings are only supported with JSPI.');
|
|
1633
1590
|
|
|
1591
|
+
var isClassMethodFunc = (argTypes[1] !== null && classType !== null);
|
|
1634
1592
|
|
|
1635
|
-
|
|
1636
|
-
|
|
1637
|
-
|
|
1638
|
-
|
|
1639
|
-
|
|
1640
|
-
}
|
|
1641
|
-
if (!(other instanceof ClassHandle)) {
|
|
1642
|
-
return false;
|
|
1643
|
-
}
|
|
1593
|
+
// Free functions with signature "void function()" do not need an invoker that marshalls between wire types.
|
|
1594
|
+
// TODO: This omits argument count check - enable only at -O3 or similar.
|
|
1595
|
+
// if (ENABLE_UNSAFE_OPTS && argCount == 2 && argTypes[0].name == "void" && !isClassMethodFunc) {
|
|
1596
|
+
// return FUNCTION_TABLE[fn];
|
|
1597
|
+
// }
|
|
1644
1598
|
|
|
1645
|
-
|
|
1646
|
-
|
|
1647
|
-
|
|
1648
|
-
var rightClass = other.$$.ptrType.registeredClass;
|
|
1649
|
-
var right = other.$$.ptr;
|
|
1599
|
+
// Determine if we need to use a dynamic stack to store the destructors for the function parameters.
|
|
1600
|
+
// TODO: Remove this completely once all function invokers are being dynamically generated.
|
|
1601
|
+
var needsDestructorStack = false;
|
|
1650
1602
|
|
|
1651
|
-
|
|
1652
|
-
|
|
1653
|
-
|
|
1654
|
-
|
|
1603
|
+
for (var i = 1; i < argTypes.length; ++i) { // Skip return value at index 0 - it's not deleted here.
|
|
1604
|
+
if (argTypes[i] !== null && argTypes[i].destructorFunction === undefined) { // The type does not define a destructor function - must use dynamic stack
|
|
1605
|
+
needsDestructorStack = true;
|
|
1606
|
+
break;
|
|
1607
|
+
}
|
|
1608
|
+
}
|
|
1655
1609
|
|
|
1656
|
-
|
|
1657
|
-
right = rightClass.upcast(right);
|
|
1658
|
-
rightClass = rightClass.baseClass;
|
|
1659
|
-
}
|
|
1610
|
+
var returns = (argTypes[0].name !== "void");
|
|
1660
1611
|
|
|
1661
|
-
|
|
1662
|
-
|
|
1612
|
+
var argsList = "";
|
|
1613
|
+
var argsListWired = "";
|
|
1614
|
+
for (var i = 0; i < argCount - 2; ++i) {
|
|
1615
|
+
argsList += (i!==0?", ":"")+"arg"+i;
|
|
1616
|
+
argsListWired += (i!==0?", ":"")+"arg"+i+"Wired";
|
|
1617
|
+
}
|
|
1663
1618
|
|
|
1664
|
-
|
|
1665
|
-
|
|
1666
|
-
|
|
1667
|
-
}
|
|
1619
|
+
var invokerFnBody = `
|
|
1620
|
+
return function (${argsList}) {
|
|
1621
|
+
if (arguments.length !== ${argCount - 2}) {
|
|
1622
|
+
throwBindingError('function ${humanName} called with ' + arguments.length + ' arguments, expected ${argCount - 2}');
|
|
1623
|
+
}`;
|
|
1668
1624
|
|
|
1669
|
-
|
|
1670
|
-
|
|
1671
|
-
|
|
1672
|
-
} else {
|
|
1673
|
-
var clone = attachFinalizer(Object.create(Object.getPrototypeOf(this), {
|
|
1674
|
-
$$: {
|
|
1675
|
-
value: shallowCopyInternalPointer(this.$$),
|
|
1676
|
-
}
|
|
1677
|
-
}));
|
|
1625
|
+
if (needsDestructorStack) {
|
|
1626
|
+
invokerFnBody += "var destructors = [];\n";
|
|
1627
|
+
}
|
|
1678
1628
|
|
|
1679
|
-
|
|
1680
|
-
|
|
1681
|
-
|
|
1682
|
-
}
|
|
1683
|
-
},
|
|
1629
|
+
var dtorStack = needsDestructorStack ? "destructors" : "null";
|
|
1630
|
+
var args1 = ["throwBindingError", "invoker", "fn", "runDestructors", "retType", "classParam"];
|
|
1631
|
+
var args2 = [throwBindingError, cppInvokerFunc, cppTargetFunc, runDestructors, argTypes[0], argTypes[1]];
|
|
1684
1632
|
|
|
1685
|
-
|
|
1686
|
-
|
|
1687
|
-
|
|
1688
|
-
}
|
|
1633
|
+
if (isClassMethodFunc) {
|
|
1634
|
+
invokerFnBody += "var thisWired = classParam.toWireType("+dtorStack+", this);\n";
|
|
1635
|
+
}
|
|
1689
1636
|
|
|
1690
|
-
|
|
1691
|
-
|
|
1692
|
-
|
|
1637
|
+
for (var i = 0; i < argCount - 2; ++i) {
|
|
1638
|
+
invokerFnBody += "var arg"+i+"Wired = argType"+i+".toWireType("+dtorStack+", arg"+i+"); // "+argTypes[i+2].name+"\n";
|
|
1639
|
+
args1.push("argType"+i);
|
|
1640
|
+
args2.push(argTypes[i+2]);
|
|
1641
|
+
}
|
|
1642
|
+
|
|
1643
|
+
if (isClassMethodFunc) {
|
|
1644
|
+
argsListWired = "thisWired" + (argsListWired.length > 0 ? ", " : "") + argsListWired;
|
|
1645
|
+
}
|
|
1693
1646
|
|
|
1694
|
-
|
|
1695
|
-
|
|
1647
|
+
invokerFnBody +=
|
|
1648
|
+
(returns || isAsync ? "var rv = ":"") + "invoker(fn"+(argsListWired.length>0?", ":"")+argsListWired+");\n";
|
|
1696
1649
|
|
|
1697
|
-
|
|
1698
|
-
|
|
1699
|
-
|
|
1650
|
+
if (needsDestructorStack) {
|
|
1651
|
+
invokerFnBody += "runDestructors(destructors);\n";
|
|
1652
|
+
} else {
|
|
1653
|
+
for (var i = isClassMethodFunc?1:2; i < argTypes.length; ++i) { // Skip return value at index 0 - it's not deleted here. Also skip class type if not a method.
|
|
1654
|
+
var paramName = (i === 1 ? "thisWired" : ("arg"+(i - 2)+"Wired"));
|
|
1655
|
+
if (argTypes[i].destructorFunction !== null) {
|
|
1656
|
+
invokerFnBody += paramName+"_dtor("+paramName+"); // "+argTypes[i].name+"\n";
|
|
1657
|
+
args1.push(paramName+"_dtor");
|
|
1658
|
+
args2.push(argTypes[i].destructorFunction);
|
|
1700
1659
|
}
|
|
1701
|
-
}
|
|
1660
|
+
}
|
|
1661
|
+
}
|
|
1702
1662
|
|
|
1703
|
-
|
|
1704
|
-
|
|
1705
|
-
|
|
1663
|
+
if (returns) {
|
|
1664
|
+
invokerFnBody += "var ret = retType.fromWireType(rv);\n" +
|
|
1665
|
+
"return ret;\n";
|
|
1666
|
+
} else {
|
|
1667
|
+
}
|
|
1706
1668
|
|
|
1707
|
-
|
|
1708
|
-
if (!this.$$.ptr) {
|
|
1709
|
-
throwInstanceAlreadyDeleted(this);
|
|
1710
|
-
}
|
|
1711
|
-
if (this.$$.deleteScheduled && !this.$$.preservePointerOnDelete) {
|
|
1712
|
-
throwBindingError('Object already scheduled for deletion');
|
|
1713
|
-
}
|
|
1714
|
-
deletionQueue.push(this);
|
|
1715
|
-
if (deletionQueue.length === 1 && delayFunction) {
|
|
1716
|
-
delayFunction(flushPendingDeletes);
|
|
1717
|
-
}
|
|
1718
|
-
this.$$.deleteScheduled = true;
|
|
1719
|
-
return this;
|
|
1720
|
-
},
|
|
1721
|
-
});
|
|
1722
|
-
};
|
|
1723
|
-
/** @constructor */
|
|
1724
|
-
function ClassHandle() {
|
|
1725
|
-
}
|
|
1669
|
+
invokerFnBody += "}\n";
|
|
1726
1670
|
|
|
1727
|
-
|
|
1728
|
-
value: name
|
|
1729
|
-
});
|
|
1671
|
+
args1.push(invokerFnBody);
|
|
1730
1672
|
|
|
1673
|
+
var invokerFn = newFunc(Function, args1).apply(null, args2);
|
|
1674
|
+
return createNamedFunction(humanName, invokerFn);
|
|
1675
|
+
}
|
|
1731
1676
|
|
|
1732
1677
|
var ensureOverloadTable = (proto, methodName, humanName) => {
|
|
1733
1678
|
if (undefined === proto[methodName].overloadTable) {
|
|
@@ -1770,256 +1715,16 @@ function dbg(text) {
|
|
|
1770
1715
|
}
|
|
1771
1716
|
};
|
|
1772
1717
|
|
|
1773
|
-
var
|
|
1774
|
-
|
|
1775
|
-
|
|
1776
|
-
|
|
1777
|
-
|
|
1778
|
-
|
|
1779
|
-
}
|
|
1780
|
-
name = name.replace(/[^a-zA-Z0-9_]/g, '$');
|
|
1781
|
-
var f = name.charCodeAt(0);
|
|
1782
|
-
if (f >= char_0 && f <= char_9) {
|
|
1783
|
-
return `_${name}`;
|
|
1784
|
-
}
|
|
1785
|
-
return name;
|
|
1786
|
-
};
|
|
1787
|
-
|
|
1788
|
-
|
|
1789
|
-
/** @constructor */
|
|
1790
|
-
function RegisteredClass(name,
|
|
1791
|
-
constructor,
|
|
1792
|
-
instancePrototype,
|
|
1793
|
-
rawDestructor,
|
|
1794
|
-
baseClass,
|
|
1795
|
-
getActualType,
|
|
1796
|
-
upcast,
|
|
1797
|
-
downcast) {
|
|
1798
|
-
this.name = name;
|
|
1799
|
-
this.constructor = constructor;
|
|
1800
|
-
this.instancePrototype = instancePrototype;
|
|
1801
|
-
this.rawDestructor = rawDestructor;
|
|
1802
|
-
this.baseClass = baseClass;
|
|
1803
|
-
this.getActualType = getActualType;
|
|
1804
|
-
this.upcast = upcast;
|
|
1805
|
-
this.downcast = downcast;
|
|
1806
|
-
this.pureVirtualFunctions = [];
|
|
1807
|
-
}
|
|
1808
|
-
|
|
1809
|
-
|
|
1810
|
-
var upcastPointer = (ptr, ptrClass, desiredClass) => {
|
|
1811
|
-
while (ptrClass !== desiredClass) {
|
|
1812
|
-
if (!ptrClass.upcast) {
|
|
1813
|
-
throwBindingError(`Expected null or instance of ${desiredClass.name}, got an instance of ${ptrClass.name}`);
|
|
1814
|
-
}
|
|
1815
|
-
ptr = ptrClass.upcast(ptr);
|
|
1816
|
-
ptrClass = ptrClass.baseClass;
|
|
1718
|
+
var heap32VectorToArray = (count, firstElement) => {
|
|
1719
|
+
var array = [];
|
|
1720
|
+
for (var i = 0; i < count; i++) {
|
|
1721
|
+
// TODO(https://github.com/emscripten-core/emscripten/issues/17310):
|
|
1722
|
+
// Find a way to hoist the `>> 2` or `>> 3` out of this loop.
|
|
1723
|
+
array.push(HEAPU32[(((firstElement)+(i * 4))>>2)]);
|
|
1817
1724
|
}
|
|
1818
|
-
return
|
|
1725
|
+
return array;
|
|
1819
1726
|
};
|
|
1820
|
-
/** @suppress {globalThis} */
|
|
1821
|
-
function constNoSmartPtrRawPointerToWireType(destructors, handle) {
|
|
1822
|
-
if (handle === null) {
|
|
1823
|
-
if (this.isReference) {
|
|
1824
|
-
throwBindingError(`null is not a valid ${this.name}`);
|
|
1825
|
-
}
|
|
1826
|
-
return 0;
|
|
1827
|
-
}
|
|
1828
|
-
|
|
1829
|
-
if (!handle.$$) {
|
|
1830
|
-
throwBindingError(`Cannot pass "${embindRepr(handle)}" as a ${this.name}`);
|
|
1831
|
-
}
|
|
1832
|
-
if (!handle.$$.ptr) {
|
|
1833
|
-
throwBindingError(`Cannot pass deleted object as a pointer of type ${this.name}`);
|
|
1834
|
-
}
|
|
1835
|
-
var handleClass = handle.$$.ptrType.registeredClass;
|
|
1836
|
-
var ptr = upcastPointer(handle.$$.ptr, handleClass, this.registeredClass);
|
|
1837
|
-
return ptr;
|
|
1838
|
-
}
|
|
1839
|
-
|
|
1840
|
-
|
|
1841
|
-
/** @suppress {globalThis} */
|
|
1842
|
-
function genericPointerToWireType(destructors, handle) {
|
|
1843
|
-
var ptr;
|
|
1844
|
-
if (handle === null) {
|
|
1845
|
-
if (this.isReference) {
|
|
1846
|
-
throwBindingError(`null is not a valid ${this.name}`);
|
|
1847
|
-
}
|
|
1848
|
-
|
|
1849
|
-
if (this.isSmartPointer) {
|
|
1850
|
-
ptr = this.rawConstructor();
|
|
1851
|
-
if (destructors !== null) {
|
|
1852
|
-
destructors.push(this.rawDestructor, ptr);
|
|
1853
|
-
}
|
|
1854
|
-
return ptr;
|
|
1855
|
-
} else {
|
|
1856
|
-
return 0;
|
|
1857
|
-
}
|
|
1858
|
-
}
|
|
1859
|
-
|
|
1860
|
-
if (!handle.$$) {
|
|
1861
|
-
throwBindingError(`Cannot pass "${embindRepr(handle)}" as a ${this.name}`);
|
|
1862
|
-
}
|
|
1863
|
-
if (!handle.$$.ptr) {
|
|
1864
|
-
throwBindingError(`Cannot pass deleted object as a pointer of type ${this.name}`);
|
|
1865
|
-
}
|
|
1866
|
-
if (!this.isConst && handle.$$.ptrType.isConst) {
|
|
1867
|
-
throwBindingError(`Cannot convert argument of type ${(handle.$$.smartPtrType ? handle.$$.smartPtrType.name : handle.$$.ptrType.name)} to parameter type ${this.name}`);
|
|
1868
|
-
}
|
|
1869
|
-
var handleClass = handle.$$.ptrType.registeredClass;
|
|
1870
|
-
ptr = upcastPointer(handle.$$.ptr, handleClass, this.registeredClass);
|
|
1871
|
-
|
|
1872
|
-
if (this.isSmartPointer) {
|
|
1873
|
-
// TODO: this is not strictly true
|
|
1874
|
-
// We could support BY_EMVAL conversions from raw pointers to smart pointers
|
|
1875
|
-
// because the smart pointer can hold a reference to the handle
|
|
1876
|
-
if (undefined === handle.$$.smartPtr) {
|
|
1877
|
-
throwBindingError('Passing raw pointer to smart pointer is illegal');
|
|
1878
|
-
}
|
|
1879
|
-
|
|
1880
|
-
switch (this.sharingPolicy) {
|
|
1881
|
-
case 0: // NONE
|
|
1882
|
-
// no upcasting
|
|
1883
|
-
if (handle.$$.smartPtrType === this) {
|
|
1884
|
-
ptr = handle.$$.smartPtr;
|
|
1885
|
-
} else {
|
|
1886
|
-
throwBindingError(`Cannot convert argument of type ${(handle.$$.smartPtrType ? handle.$$.smartPtrType.name : handle.$$.ptrType.name)} to parameter type ${this.name}`);
|
|
1887
|
-
}
|
|
1888
|
-
break;
|
|
1889
|
-
|
|
1890
|
-
case 1: // INTRUSIVE
|
|
1891
|
-
ptr = handle.$$.smartPtr;
|
|
1892
|
-
break;
|
|
1893
|
-
|
|
1894
|
-
case 2: // BY_EMVAL
|
|
1895
|
-
if (handle.$$.smartPtrType === this) {
|
|
1896
|
-
ptr = handle.$$.smartPtr;
|
|
1897
|
-
} else {
|
|
1898
|
-
var clonedHandle = handle['clone']();
|
|
1899
|
-
ptr = this.rawShare(
|
|
1900
|
-
ptr,
|
|
1901
|
-
Emval.toHandle(() => clonedHandle['delete']())
|
|
1902
|
-
);
|
|
1903
|
-
if (destructors !== null) {
|
|
1904
|
-
destructors.push(this.rawDestructor, ptr);
|
|
1905
|
-
}
|
|
1906
|
-
}
|
|
1907
|
-
break;
|
|
1908
|
-
|
|
1909
|
-
default:
|
|
1910
|
-
throwBindingError('Unsupporting sharing policy');
|
|
1911
|
-
}
|
|
1912
|
-
}
|
|
1913
|
-
return ptr;
|
|
1914
|
-
}
|
|
1915
|
-
|
|
1916
|
-
|
|
1917
|
-
/** @suppress {globalThis} */
|
|
1918
|
-
function nonConstNoSmartPtrRawPointerToWireType(destructors, handle) {
|
|
1919
|
-
if (handle === null) {
|
|
1920
|
-
if (this.isReference) {
|
|
1921
|
-
throwBindingError(`null is not a valid ${this.name}`);
|
|
1922
|
-
}
|
|
1923
|
-
return 0;
|
|
1924
|
-
}
|
|
1925
|
-
|
|
1926
|
-
if (!handle.$$) {
|
|
1927
|
-
throwBindingError(`Cannot pass "${embindRepr(handle)}" as a ${this.name}`);
|
|
1928
|
-
}
|
|
1929
|
-
if (!handle.$$.ptr) {
|
|
1930
|
-
throwBindingError(`Cannot pass deleted object as a pointer of type ${this.name}`);
|
|
1931
|
-
}
|
|
1932
|
-
if (handle.$$.ptrType.isConst) {
|
|
1933
|
-
throwBindingError(`Cannot convert argument of type ${handle.$$.ptrType.name} to parameter type ${this.name}`);
|
|
1934
|
-
}
|
|
1935
|
-
var handleClass = handle.$$.ptrType.registeredClass;
|
|
1936
|
-
var ptr = upcastPointer(handle.$$.ptr, handleClass, this.registeredClass);
|
|
1937
|
-
return ptr;
|
|
1938
|
-
}
|
|
1939
|
-
|
|
1940
|
-
|
|
1941
|
-
/** @suppress {globalThis} */
|
|
1942
|
-
function readPointer(pointer) {
|
|
1943
|
-
return this['fromWireType'](HEAPU32[((pointer)>>2)]);
|
|
1944
|
-
}
|
|
1945
|
-
|
|
1946
1727
|
|
|
1947
|
-
var init_RegisteredPointer = () => {
|
|
1948
|
-
Object.assign(RegisteredPointer.prototype, {
|
|
1949
|
-
getPointee(ptr) {
|
|
1950
|
-
if (this.rawGetPointee) {
|
|
1951
|
-
ptr = this.rawGetPointee(ptr);
|
|
1952
|
-
}
|
|
1953
|
-
return ptr;
|
|
1954
|
-
},
|
|
1955
|
-
destructor(ptr) {
|
|
1956
|
-
if (this.rawDestructor) {
|
|
1957
|
-
this.rawDestructor(ptr);
|
|
1958
|
-
}
|
|
1959
|
-
},
|
|
1960
|
-
'argPackAdvance': GenericWireTypeSize,
|
|
1961
|
-
'readValueFromPointer': readPointer,
|
|
1962
|
-
'deleteObject'(handle) {
|
|
1963
|
-
if (handle !== null) {
|
|
1964
|
-
handle['delete']();
|
|
1965
|
-
}
|
|
1966
|
-
},
|
|
1967
|
-
'fromWireType': RegisteredPointer_fromWireType,
|
|
1968
|
-
});
|
|
1969
|
-
};
|
|
1970
|
-
/** @constructor
|
|
1971
|
-
@param {*=} pointeeType,
|
|
1972
|
-
@param {*=} sharingPolicy,
|
|
1973
|
-
@param {*=} rawGetPointee,
|
|
1974
|
-
@param {*=} rawConstructor,
|
|
1975
|
-
@param {*=} rawShare,
|
|
1976
|
-
@param {*=} rawDestructor,
|
|
1977
|
-
*/
|
|
1978
|
-
function RegisteredPointer(
|
|
1979
|
-
name,
|
|
1980
|
-
registeredClass,
|
|
1981
|
-
isReference,
|
|
1982
|
-
isConst,
|
|
1983
|
-
|
|
1984
|
-
// smart pointer properties
|
|
1985
|
-
isSmartPointer,
|
|
1986
|
-
pointeeType,
|
|
1987
|
-
sharingPolicy,
|
|
1988
|
-
rawGetPointee,
|
|
1989
|
-
rawConstructor,
|
|
1990
|
-
rawShare,
|
|
1991
|
-
rawDestructor
|
|
1992
|
-
) {
|
|
1993
|
-
this.name = name;
|
|
1994
|
-
this.registeredClass = registeredClass;
|
|
1995
|
-
this.isReference = isReference;
|
|
1996
|
-
this.isConst = isConst;
|
|
1997
|
-
|
|
1998
|
-
// smart pointer properties
|
|
1999
|
-
this.isSmartPointer = isSmartPointer;
|
|
2000
|
-
this.pointeeType = pointeeType;
|
|
2001
|
-
this.sharingPolicy = sharingPolicy;
|
|
2002
|
-
this.rawGetPointee = rawGetPointee;
|
|
2003
|
-
this.rawConstructor = rawConstructor;
|
|
2004
|
-
this.rawShare = rawShare;
|
|
2005
|
-
this.rawDestructor = rawDestructor;
|
|
2006
|
-
|
|
2007
|
-
if (!isSmartPointer && registeredClass.baseClass === undefined) {
|
|
2008
|
-
if (isConst) {
|
|
2009
|
-
this['toWireType'] = constNoSmartPtrRawPointerToWireType;
|
|
2010
|
-
this.destructorFunction = null;
|
|
2011
|
-
} else {
|
|
2012
|
-
this['toWireType'] = nonConstNoSmartPtrRawPointerToWireType;
|
|
2013
|
-
this.destructorFunction = null;
|
|
2014
|
-
}
|
|
2015
|
-
} else {
|
|
2016
|
-
this['toWireType'] = genericPointerToWireType;
|
|
2017
|
-
// Here we must leave this.destructorFunction undefined, since whether genericPointerToWireType returns
|
|
2018
|
-
// a pointer that needs to be freed up is runtime-dependent, and cannot be evaluated at registration time.
|
|
2019
|
-
// TODO: Create an alternative mechanism that allows removing the use of var destructors = []; array in
|
|
2020
|
-
// craftInvokerFunction altogether.
|
|
2021
|
-
}
|
|
2022
|
-
}
|
|
2023
1728
|
|
|
2024
1729
|
/** @param {number=} numArguments */
|
|
2025
1730
|
var replacePublicSymbol = (name, value, numArguments) => {
|
|
@@ -2105,684 +1810,72 @@ function dbg(text) {
|
|
|
2105
1810
|
|
|
2106
1811
|
|
|
2107
1812
|
|
|
2108
|
-
var extendError = (baseErrorType, errorName) => {
|
|
2109
|
-
var errorClass = createNamedFunction(errorName, function(message) {
|
|
2110
|
-
this.name = errorName;
|
|
2111
|
-
this.message = message;
|
|
2112
|
-
|
|
2113
|
-
var stack = (new Error(message)).stack;
|
|
2114
|
-
if (stack !== undefined) {
|
|
2115
|
-
this.stack = this.toString() + '\n' +
|
|
2116
|
-
stack.replace(/^Error(:[^\n]*)?\n/, '');
|
|
2117
|
-
}
|
|
2118
|
-
});
|
|
2119
|
-
errorClass.prototype = Object.create(baseErrorType.prototype);
|
|
2120
|
-
errorClass.prototype.constructor = errorClass;
|
|
2121
|
-
errorClass.prototype.toString = function() {
|
|
2122
|
-
if (this.message === undefined) {
|
|
2123
|
-
return this.name;
|
|
2124
|
-
} else {
|
|
2125
|
-
return `${this.name}: ${this.message}`;
|
|
2126
|
-
}
|
|
2127
|
-
};
|
|
2128
|
-
|
|
2129
|
-
return errorClass;
|
|
2130
|
-
};
|
|
2131
|
-
var UnboundTypeError;
|
|
2132
|
-
|
|
2133
|
-
|
|
2134
|
-
|
|
2135
|
-
var getTypeName = (type) => {
|
|
2136
|
-
var ptr = ___getTypeName(type);
|
|
2137
|
-
var rv = readLatin1String(ptr);
|
|
2138
|
-
_free(ptr);
|
|
2139
|
-
return rv;
|
|
2140
|
-
};
|
|
2141
|
-
var throwUnboundTypeError = (message, types) => {
|
|
2142
|
-
var unboundTypes = [];
|
|
2143
|
-
var seen = {};
|
|
2144
|
-
function visit(type) {
|
|
2145
|
-
if (seen[type]) {
|
|
2146
|
-
return;
|
|
2147
|
-
}
|
|
2148
|
-
if (registeredTypes[type]) {
|
|
2149
|
-
return;
|
|
2150
|
-
}
|
|
2151
|
-
if (typeDependencies[type]) {
|
|
2152
|
-
typeDependencies[type].forEach(visit);
|
|
2153
|
-
return;
|
|
2154
|
-
}
|
|
2155
|
-
unboundTypes.push(type);
|
|
2156
|
-
seen[type] = true;
|
|
2157
|
-
}
|
|
2158
|
-
types.forEach(visit);
|
|
2159
|
-
|
|
2160
|
-
throw new UnboundTypeError(`${message}: ` + unboundTypes.map(getTypeName).join([', ']));
|
|
2161
|
-
};
|
|
2162
|
-
|
|
2163
|
-
var __embind_register_class = (rawType,
|
|
2164
|
-
rawPointerType,
|
|
2165
|
-
rawConstPointerType,
|
|
2166
|
-
baseClassRawType,
|
|
2167
|
-
getActualTypeSignature,
|
|
2168
|
-
getActualType,
|
|
2169
|
-
upcastSignature,
|
|
2170
|
-
upcast,
|
|
2171
|
-
downcastSignature,
|
|
2172
|
-
downcast,
|
|
2173
|
-
name,
|
|
2174
|
-
destructorSignature,
|
|
2175
|
-
rawDestructor) => {
|
|
2176
|
-
name = readLatin1String(name);
|
|
2177
|
-
getActualType = embind__requireFunction(getActualTypeSignature, getActualType);
|
|
2178
|
-
if (upcast) {
|
|
2179
|
-
upcast = embind__requireFunction(upcastSignature, upcast);
|
|
2180
|
-
}
|
|
2181
|
-
if (downcast) {
|
|
2182
|
-
downcast = embind__requireFunction(downcastSignature, downcast);
|
|
2183
|
-
}
|
|
2184
|
-
rawDestructor = embind__requireFunction(destructorSignature, rawDestructor);
|
|
2185
|
-
var legalFunctionName = makeLegalFunctionName(name);
|
|
2186
|
-
|
|
2187
|
-
exposePublicSymbol(legalFunctionName, function() {
|
|
2188
|
-
// this code cannot run if baseClassRawType is zero
|
|
2189
|
-
throwUnboundTypeError(`Cannot construct ${name} due to unbound types`, [baseClassRawType]);
|
|
2190
|
-
});
|
|
2191
|
-
|
|
2192
|
-
whenDependentTypesAreResolved(
|
|
2193
|
-
[rawType, rawPointerType, rawConstPointerType],
|
|
2194
|
-
baseClassRawType ? [baseClassRawType] : [],
|
|
2195
|
-
function(base) {
|
|
2196
|
-
base = base[0];
|
|
2197
|
-
|
|
2198
|
-
var baseClass;
|
|
2199
|
-
var basePrototype;
|
|
2200
|
-
if (baseClassRawType) {
|
|
2201
|
-
baseClass = base.registeredClass;
|
|
2202
|
-
basePrototype = baseClass.instancePrototype;
|
|
2203
|
-
} else {
|
|
2204
|
-
basePrototype = ClassHandle.prototype;
|
|
2205
|
-
}
|
|
2206
|
-
|
|
2207
|
-
var constructor = createNamedFunction(name, function() {
|
|
2208
|
-
if (Object.getPrototypeOf(this) !== instancePrototype) {
|
|
2209
|
-
throw new BindingError("Use 'new' to construct " + name);
|
|
2210
|
-
}
|
|
2211
|
-
if (undefined === registeredClass.constructor_body) {
|
|
2212
|
-
throw new BindingError(name + " has no accessible constructor");
|
|
2213
|
-
}
|
|
2214
|
-
var body = registeredClass.constructor_body[arguments.length];
|
|
2215
|
-
if (undefined === body) {
|
|
2216
|
-
throw new BindingError(`Tried to invoke ctor of ${name} with invalid number of parameters (${arguments.length}) - expected (${Object.keys(registeredClass.constructor_body).toString()}) parameters instead!`);
|
|
2217
|
-
}
|
|
2218
|
-
return body.apply(this, arguments);
|
|
2219
|
-
});
|
|
2220
|
-
|
|
2221
|
-
var instancePrototype = Object.create(basePrototype, {
|
|
2222
|
-
constructor: { value: constructor },
|
|
2223
|
-
});
|
|
2224
|
-
|
|
2225
|
-
constructor.prototype = instancePrototype;
|
|
2226
|
-
|
|
2227
|
-
var registeredClass = new RegisteredClass(name,
|
|
2228
|
-
constructor,
|
|
2229
|
-
instancePrototype,
|
|
2230
|
-
rawDestructor,
|
|
2231
|
-
baseClass,
|
|
2232
|
-
getActualType,
|
|
2233
|
-
upcast,
|
|
2234
|
-
downcast);
|
|
2235
|
-
|
|
2236
|
-
if (registeredClass.baseClass) {
|
|
2237
|
-
// Keep track of class hierarchy. Used to allow sub-classes to inherit class functions.
|
|
2238
|
-
if (registeredClass.baseClass.__derivedClasses === undefined) {
|
|
2239
|
-
registeredClass.baseClass.__derivedClasses = [];
|
|
2240
|
-
}
|
|
2241
|
-
|
|
2242
|
-
registeredClass.baseClass.__derivedClasses.push(registeredClass);
|
|
2243
|
-
}
|
|
2244
|
-
|
|
2245
|
-
var referenceConverter = new RegisteredPointer(name,
|
|
2246
|
-
registeredClass,
|
|
2247
|
-
true,
|
|
2248
|
-
false,
|
|
2249
|
-
false);
|
|
2250
|
-
|
|
2251
|
-
var pointerConverter = new RegisteredPointer(name + '*',
|
|
2252
|
-
registeredClass,
|
|
2253
|
-
false,
|
|
2254
|
-
false,
|
|
2255
|
-
false);
|
|
2256
|
-
|
|
2257
|
-
var constPointerConverter = new RegisteredPointer(name + ' const*',
|
|
2258
|
-
registeredClass,
|
|
2259
|
-
false,
|
|
2260
|
-
true,
|
|
2261
|
-
false);
|
|
2262
|
-
|
|
2263
|
-
registeredPointers[rawType] = {
|
|
2264
|
-
pointerType: pointerConverter,
|
|
2265
|
-
constPointerType: constPointerConverter
|
|
2266
|
-
};
|
|
2267
|
-
|
|
2268
|
-
replacePublicSymbol(legalFunctionName, constructor);
|
|
2269
|
-
|
|
2270
|
-
return [referenceConverter, pointerConverter, constPointerConverter];
|
|
2271
|
-
}
|
|
2272
|
-
);
|
|
2273
|
-
};
|
|
2274
|
-
|
|
2275
|
-
var heap32VectorToArray = (count, firstElement) => {
|
|
2276
|
-
var array = [];
|
|
2277
|
-
for (var i = 0; i < count; i++) {
|
|
2278
|
-
// TODO(https://github.com/emscripten-core/emscripten/issues/17310):
|
|
2279
|
-
// Find a way to hoist the `>> 2` or `>> 3` out of this loop.
|
|
2280
|
-
array.push(HEAPU32[(((firstElement)+(i * 4))>>2)]);
|
|
2281
|
-
}
|
|
2282
|
-
return array;
|
|
2283
|
-
};
|
|
2284
|
-
|
|
2285
|
-
|
|
2286
|
-
var runDestructors = (destructors) => {
|
|
2287
|
-
while (destructors.length) {
|
|
2288
|
-
var ptr = destructors.pop();
|
|
2289
|
-
var del = destructors.pop();
|
|
2290
|
-
del(ptr);
|
|
2291
|
-
}
|
|
2292
|
-
};
|
|
2293
|
-
|
|
2294
|
-
|
|
2295
|
-
|
|
2296
|
-
|
|
2297
|
-
|
|
2298
|
-
|
|
2299
|
-
|
|
2300
|
-
function newFunc(constructor, argumentList) {
|
|
2301
|
-
if (!(constructor instanceof Function)) {
|
|
2302
|
-
throw new TypeError(`new_ called with constructor type ${typeof(constructor)} which is not a function`);
|
|
2303
|
-
}
|
|
2304
|
-
/*
|
|
2305
|
-
* Previously, the following line was just:
|
|
2306
|
-
* function dummy() {};
|
|
2307
|
-
* Unfortunately, Chrome was preserving 'dummy' as the object's name, even
|
|
2308
|
-
* though at creation, the 'dummy' has the correct constructor name. Thus,
|
|
2309
|
-
* objects created with IMVU.new would show up in the debugger as 'dummy',
|
|
2310
|
-
* which isn't very helpful. Using IMVU.createNamedFunction addresses the
|
|
2311
|
-
* issue. Doublely-unfortunately, there's no way to write a test for this
|
|
2312
|
-
* behavior. -NRD 2013.02.22
|
|
2313
|
-
*/
|
|
2314
|
-
var dummy = createNamedFunction(constructor.name || 'unknownFunctionName', function(){});
|
|
2315
|
-
dummy.prototype = constructor.prototype;
|
|
2316
|
-
var obj = new dummy;
|
|
2317
|
-
|
|
2318
|
-
var r = constructor.apply(obj, argumentList);
|
|
2319
|
-
return (r instanceof Object) ? r : obj;
|
|
2320
|
-
}
|
|
2321
|
-
function craftInvokerFunction(humanName, argTypes, classType, cppInvokerFunc, cppTargetFunc, /** boolean= */ isAsync) {
|
|
2322
|
-
// humanName: a human-readable string name for the function to be generated.
|
|
2323
|
-
// argTypes: An array that contains the embind type objects for all types in the function signature.
|
|
2324
|
-
// argTypes[0] is the type object for the function return value.
|
|
2325
|
-
// argTypes[1] is the type object for function this object/class type, or null if not crafting an invoker for a class method.
|
|
2326
|
-
// argTypes[2...] are the actual function parameters.
|
|
2327
|
-
// classType: The embind type object for the class to be bound, or null if this is not a method of a class.
|
|
2328
|
-
// cppInvokerFunc: JS Function object to the C++-side function that interops into C++ code.
|
|
2329
|
-
// cppTargetFunc: Function pointer (an integer to FUNCTION_TABLE) to the target C++ function the cppInvokerFunc will end up calling.
|
|
2330
|
-
// isAsync: Optional. If true, returns an async function. Async bindings are only supported with JSPI.
|
|
2331
|
-
var argCount = argTypes.length;
|
|
2332
|
-
|
|
2333
|
-
if (argCount < 2) {
|
|
2334
|
-
throwBindingError("argTypes array size mismatch! Must at least get return value and 'this' types!");
|
|
2335
|
-
}
|
|
2336
|
-
|
|
2337
|
-
assert(!isAsync, 'Async bindings are only supported with JSPI.');
|
|
2338
|
-
|
|
2339
|
-
var isClassMethodFunc = (argTypes[1] !== null && classType !== null);
|
|
2340
|
-
|
|
2341
|
-
// Free functions with signature "void function()" do not need an invoker that marshalls between wire types.
|
|
2342
|
-
// TODO: This omits argument count check - enable only at -O3 or similar.
|
|
2343
|
-
// if (ENABLE_UNSAFE_OPTS && argCount == 2 && argTypes[0].name == "void" && !isClassMethodFunc) {
|
|
2344
|
-
// return FUNCTION_TABLE[fn];
|
|
2345
|
-
// }
|
|
2346
|
-
|
|
2347
|
-
// Determine if we need to use a dynamic stack to store the destructors for the function parameters.
|
|
2348
|
-
// TODO: Remove this completely once all function invokers are being dynamically generated.
|
|
2349
|
-
var needsDestructorStack = false;
|
|
2350
|
-
|
|
2351
|
-
for (var i = 1; i < argTypes.length; ++i) { // Skip return value at index 0 - it's not deleted here.
|
|
2352
|
-
if (argTypes[i] !== null && argTypes[i].destructorFunction === undefined) { // The type does not define a destructor function - must use dynamic stack
|
|
2353
|
-
needsDestructorStack = true;
|
|
2354
|
-
break;
|
|
2355
|
-
}
|
|
2356
|
-
}
|
|
2357
|
-
|
|
2358
|
-
var returns = (argTypes[0].name !== "void");
|
|
2359
|
-
|
|
2360
|
-
var argsList = "";
|
|
2361
|
-
var argsListWired = "";
|
|
2362
|
-
for (var i = 0; i < argCount - 2; ++i) {
|
|
2363
|
-
argsList += (i!==0?", ":"")+"arg"+i;
|
|
2364
|
-
argsListWired += (i!==0?", ":"")+"arg"+i+"Wired";
|
|
2365
|
-
}
|
|
2366
|
-
|
|
2367
|
-
var invokerFnBody = `
|
|
2368
|
-
return function (${argsList}) {
|
|
2369
|
-
if (arguments.length !== ${argCount - 2}) {
|
|
2370
|
-
throwBindingError('function ${humanName} called with ' + arguments.length + ' arguments, expected ${argCount - 2}');
|
|
2371
|
-
}`;
|
|
2372
|
-
|
|
2373
|
-
if (needsDestructorStack) {
|
|
2374
|
-
invokerFnBody += "var destructors = [];\n";
|
|
2375
|
-
}
|
|
2376
|
-
|
|
2377
|
-
var dtorStack = needsDestructorStack ? "destructors" : "null";
|
|
2378
|
-
var args1 = ["throwBindingError", "invoker", "fn", "runDestructors", "retType", "classParam"];
|
|
2379
|
-
var args2 = [throwBindingError, cppInvokerFunc, cppTargetFunc, runDestructors, argTypes[0], argTypes[1]];
|
|
2380
|
-
|
|
2381
|
-
if (isClassMethodFunc) {
|
|
2382
|
-
invokerFnBody += "var thisWired = classParam.toWireType("+dtorStack+", this);\n";
|
|
2383
|
-
}
|
|
2384
|
-
|
|
2385
|
-
for (var i = 0; i < argCount - 2; ++i) {
|
|
2386
|
-
invokerFnBody += "var arg"+i+"Wired = argType"+i+".toWireType("+dtorStack+", arg"+i+"); // "+argTypes[i+2].name+"\n";
|
|
2387
|
-
args1.push("argType"+i);
|
|
2388
|
-
args2.push(argTypes[i+2]);
|
|
2389
|
-
}
|
|
2390
|
-
|
|
2391
|
-
if (isClassMethodFunc) {
|
|
2392
|
-
argsListWired = "thisWired" + (argsListWired.length > 0 ? ", " : "") + argsListWired;
|
|
2393
|
-
}
|
|
2394
|
-
|
|
2395
|
-
invokerFnBody +=
|
|
2396
|
-
(returns || isAsync ? "var rv = ":"") + "invoker(fn"+(argsListWired.length>0?", ":"")+argsListWired+");\n";
|
|
2397
|
-
|
|
2398
|
-
if (needsDestructorStack) {
|
|
2399
|
-
invokerFnBody += "runDestructors(destructors);\n";
|
|
2400
|
-
} else {
|
|
2401
|
-
for (var i = isClassMethodFunc?1:2; i < argTypes.length; ++i) { // Skip return value at index 0 - it's not deleted here. Also skip class type if not a method.
|
|
2402
|
-
var paramName = (i === 1 ? "thisWired" : ("arg"+(i - 2)+"Wired"));
|
|
2403
|
-
if (argTypes[i].destructorFunction !== null) {
|
|
2404
|
-
invokerFnBody += paramName+"_dtor("+paramName+"); // "+argTypes[i].name+"\n";
|
|
2405
|
-
args1.push(paramName+"_dtor");
|
|
2406
|
-
args2.push(argTypes[i].destructorFunction);
|
|
2407
|
-
}
|
|
2408
|
-
}
|
|
2409
|
-
}
|
|
2410
|
-
|
|
2411
|
-
if (returns) {
|
|
2412
|
-
invokerFnBody += "var ret = retType.fromWireType(rv);\n" +
|
|
2413
|
-
"return ret;\n";
|
|
2414
|
-
} else {
|
|
2415
|
-
}
|
|
2416
|
-
|
|
2417
|
-
invokerFnBody += "}\n";
|
|
2418
|
-
|
|
2419
|
-
args1.push(invokerFnBody);
|
|
2420
|
-
|
|
2421
|
-
var invokerFn = newFunc(Function, args1).apply(null, args2);
|
|
2422
|
-
return createNamedFunction(humanName, invokerFn);
|
|
2423
|
-
}
|
|
2424
|
-
var __embind_register_class_constructor = (
|
|
2425
|
-
rawClassType,
|
|
2426
|
-
argCount,
|
|
2427
|
-
rawArgTypesAddr,
|
|
2428
|
-
invokerSignature,
|
|
2429
|
-
invoker,
|
|
2430
|
-
rawConstructor
|
|
2431
|
-
) => {
|
|
2432
|
-
assert(argCount > 0);
|
|
2433
|
-
var rawArgTypes = heap32VectorToArray(argCount, rawArgTypesAddr);
|
|
2434
|
-
invoker = embind__requireFunction(invokerSignature, invoker);
|
|
2435
|
-
var args = [rawConstructor];
|
|
2436
|
-
var destructors = [];
|
|
2437
|
-
|
|
2438
|
-
whenDependentTypesAreResolved([], [rawClassType], function(classType) {
|
|
2439
|
-
classType = classType[0];
|
|
2440
|
-
var humanName = `constructor ${classType.name}`;
|
|
2441
|
-
|
|
2442
|
-
if (undefined === classType.registeredClass.constructor_body) {
|
|
2443
|
-
classType.registeredClass.constructor_body = [];
|
|
2444
|
-
}
|
|
2445
|
-
if (undefined !== classType.registeredClass.constructor_body[argCount - 1]) {
|
|
2446
|
-
throw new BindingError(`Cannot register multiple constructors with identical number of parameters (${argCount-1}) for class '${classType.name}'! Overload resolution is currently only performed using the parameter count, not actual type info!`);
|
|
2447
|
-
}
|
|
2448
|
-
classType.registeredClass.constructor_body[argCount - 1] = () => {
|
|
2449
|
-
throwUnboundTypeError(`Cannot construct ${classType.name} due to unbound types`, rawArgTypes);
|
|
2450
|
-
};
|
|
2451
|
-
|
|
2452
|
-
whenDependentTypesAreResolved([], rawArgTypes, (argTypes) => {
|
|
2453
|
-
// Insert empty slot for context type (argTypes[1]).
|
|
2454
|
-
argTypes.splice(1, 0, null);
|
|
2455
|
-
classType.registeredClass.constructor_body[argCount - 1] = craftInvokerFunction(humanName, argTypes, null, invoker, rawConstructor);
|
|
2456
|
-
return [];
|
|
2457
|
-
});
|
|
2458
|
-
return [];
|
|
2459
|
-
});
|
|
2460
|
-
};
|
|
2461
|
-
|
|
2462
|
-
|
|
2463
|
-
|
|
2464
|
-
|
|
2465
|
-
|
|
2466
|
-
|
|
2467
|
-
|
|
2468
|
-
var getFunctionName = (signature) => {
|
|
2469
|
-
signature = signature.trim();
|
|
2470
|
-
const argsIndex = signature.indexOf("(");
|
|
2471
|
-
if (argsIndex !== -1) {
|
|
2472
|
-
assert(signature[signature.length - 1] == ")", "Parentheses for argument names should match.");
|
|
2473
|
-
return signature.substr(0, argsIndex);
|
|
2474
|
-
} else {
|
|
2475
|
-
return signature;
|
|
2476
|
-
}
|
|
2477
|
-
};
|
|
2478
|
-
var __embind_register_class_function = (rawClassType,
|
|
2479
|
-
methodName,
|
|
2480
|
-
argCount,
|
|
2481
|
-
rawArgTypesAddr, // [ReturnType, ThisType, Args...]
|
|
2482
|
-
invokerSignature,
|
|
2483
|
-
rawInvoker,
|
|
2484
|
-
context,
|
|
2485
|
-
isPureVirtual,
|
|
2486
|
-
isAsync) => {
|
|
2487
|
-
var rawArgTypes = heap32VectorToArray(argCount, rawArgTypesAddr);
|
|
2488
|
-
methodName = readLatin1String(methodName);
|
|
2489
|
-
methodName = getFunctionName(methodName);
|
|
2490
|
-
rawInvoker = embind__requireFunction(invokerSignature, rawInvoker);
|
|
2491
|
-
|
|
2492
|
-
whenDependentTypesAreResolved([], [rawClassType], function(classType) {
|
|
2493
|
-
classType = classType[0];
|
|
2494
|
-
var humanName = `${classType.name}.${methodName}`;
|
|
2495
|
-
|
|
2496
|
-
if (methodName.startsWith("@@")) {
|
|
2497
|
-
methodName = Symbol[methodName.substring(2)];
|
|
2498
|
-
}
|
|
2499
|
-
|
|
2500
|
-
if (isPureVirtual) {
|
|
2501
|
-
classType.registeredClass.pureVirtualFunctions.push(methodName);
|
|
2502
|
-
}
|
|
2503
|
-
|
|
2504
|
-
function unboundTypesHandler() {
|
|
2505
|
-
throwUnboundTypeError(`Cannot call ${humanName} due to unbound types`, rawArgTypes);
|
|
2506
|
-
}
|
|
2507
|
-
|
|
2508
|
-
var proto = classType.registeredClass.instancePrototype;
|
|
2509
|
-
var method = proto[methodName];
|
|
2510
|
-
if (undefined === method || (undefined === method.overloadTable && method.className !== classType.name && method.argCount === argCount - 2)) {
|
|
2511
|
-
// This is the first overload to be registered, OR we are replacing a
|
|
2512
|
-
// function in the base class with a function in the derived class.
|
|
2513
|
-
unboundTypesHandler.argCount = argCount - 2;
|
|
2514
|
-
unboundTypesHandler.className = classType.name;
|
|
2515
|
-
proto[methodName] = unboundTypesHandler;
|
|
2516
|
-
} else {
|
|
2517
|
-
// There was an existing function with the same name registered. Set up
|
|
2518
|
-
// a function overload routing table.
|
|
2519
|
-
ensureOverloadTable(proto, methodName, humanName);
|
|
2520
|
-
proto[methodName].overloadTable[argCount - 2] = unboundTypesHandler;
|
|
2521
|
-
}
|
|
2522
|
-
|
|
2523
|
-
whenDependentTypesAreResolved([], rawArgTypes, function(argTypes) {
|
|
2524
|
-
var memberFunction = craftInvokerFunction(humanName, argTypes, classType, rawInvoker, context, isAsync);
|
|
2525
|
-
|
|
2526
|
-
// Replace the initial unbound-handler-stub function with the appropriate member function, now that all types
|
|
2527
|
-
// are resolved. If multiple overloads are registered for this function, the function goes into an overload table.
|
|
2528
|
-
if (undefined === proto[methodName].overloadTable) {
|
|
2529
|
-
// Set argCount in case an overload is registered later
|
|
2530
|
-
memberFunction.argCount = argCount - 2;
|
|
2531
|
-
proto[methodName] = memberFunction;
|
|
2532
|
-
} else {
|
|
2533
|
-
proto[methodName].overloadTable[argCount - 2] = memberFunction;
|
|
2534
|
-
}
|
|
2535
|
-
|
|
2536
|
-
return [];
|
|
2537
|
-
});
|
|
2538
|
-
return [];
|
|
2539
|
-
});
|
|
2540
|
-
};
|
|
2541
|
-
|
|
2542
|
-
|
|
2543
|
-
|
|
2544
|
-
|
|
2545
|
-
|
|
2546
|
-
|
|
2547
|
-
|
|
2548
|
-
|
|
2549
|
-
var validateThis = (this_, classType, humanName) => {
|
|
2550
|
-
if (!(this_ instanceof Object)) {
|
|
2551
|
-
throwBindingError(`${humanName} with invalid "this": ${this_}`);
|
|
2552
|
-
}
|
|
2553
|
-
if (!(this_ instanceof classType.registeredClass.constructor)) {
|
|
2554
|
-
throwBindingError(`${humanName} incompatible with "this" of type ${this_.constructor.name}`);
|
|
2555
|
-
}
|
|
2556
|
-
if (!this_.$$.ptr) {
|
|
2557
|
-
throwBindingError(`cannot call emscripten binding method ${humanName} on deleted object`);
|
|
2558
|
-
}
|
|
2559
|
-
|
|
2560
|
-
// todo: kill this
|
|
2561
|
-
return upcastPointer(this_.$$.ptr,
|
|
2562
|
-
this_.$$.ptrType.registeredClass,
|
|
2563
|
-
classType.registeredClass);
|
|
2564
|
-
};
|
|
2565
|
-
var __embind_register_class_property = (classType,
|
|
2566
|
-
fieldName,
|
|
2567
|
-
getterReturnType,
|
|
2568
|
-
getterSignature,
|
|
2569
|
-
getter,
|
|
2570
|
-
getterContext,
|
|
2571
|
-
setterArgumentType,
|
|
2572
|
-
setterSignature,
|
|
2573
|
-
setter,
|
|
2574
|
-
setterContext) => {
|
|
2575
|
-
fieldName = readLatin1String(fieldName);
|
|
2576
|
-
getter = embind__requireFunction(getterSignature, getter);
|
|
2577
|
-
|
|
2578
|
-
whenDependentTypesAreResolved([], [classType], function(classType) {
|
|
2579
|
-
classType = classType[0];
|
|
2580
|
-
var humanName = `${classType.name}.${fieldName}`;
|
|
2581
|
-
var desc = {
|
|
2582
|
-
get() {
|
|
2583
|
-
throwUnboundTypeError(`Cannot access ${humanName} due to unbound types`, [getterReturnType, setterArgumentType]);
|
|
2584
|
-
},
|
|
2585
|
-
enumerable: true,
|
|
2586
|
-
configurable: true
|
|
2587
|
-
};
|
|
2588
|
-
if (setter) {
|
|
2589
|
-
desc.set = () => throwUnboundTypeError(`Cannot access ${humanName} due to unbound types`, [getterReturnType, setterArgumentType]);
|
|
2590
|
-
} else {
|
|
2591
|
-
desc.set = (v) => throwBindingError(humanName + ' is a read-only property');
|
|
2592
|
-
}
|
|
2593
|
-
|
|
2594
|
-
Object.defineProperty(classType.registeredClass.instancePrototype, fieldName, desc);
|
|
2595
|
-
|
|
2596
|
-
whenDependentTypesAreResolved(
|
|
2597
|
-
[],
|
|
2598
|
-
(setter ? [getterReturnType, setterArgumentType] : [getterReturnType]),
|
|
2599
|
-
function(types) {
|
|
2600
|
-
var getterReturnType = types[0];
|
|
2601
|
-
var desc = {
|
|
2602
|
-
get() {
|
|
2603
|
-
var ptr = validateThis(this, classType, humanName + ' getter');
|
|
2604
|
-
return getterReturnType['fromWireType'](getter(getterContext, ptr));
|
|
2605
|
-
},
|
|
2606
|
-
enumerable: true
|
|
2607
|
-
};
|
|
2608
|
-
|
|
2609
|
-
if (setter) {
|
|
2610
|
-
setter = embind__requireFunction(setterSignature, setter);
|
|
2611
|
-
var setterArgumentType = types[1];
|
|
2612
|
-
desc.set = function(v) {
|
|
2613
|
-
var ptr = validateThis(this, classType, humanName + ' setter');
|
|
2614
|
-
var destructors = [];
|
|
2615
|
-
setter(setterContext, ptr, setterArgumentType['toWireType'](destructors, v));
|
|
2616
|
-
runDestructors(destructors);
|
|
2617
|
-
};
|
|
2618
|
-
}
|
|
2619
|
-
|
|
2620
|
-
Object.defineProperty(classType.registeredClass.instancePrototype, fieldName, desc);
|
|
2621
|
-
return [];
|
|
2622
|
-
});
|
|
2623
|
-
|
|
2624
|
-
return [];
|
|
2625
|
-
});
|
|
2626
|
-
};
|
|
2627
|
-
|
|
2628
|
-
function handleAllocatorInit() {
|
|
2629
|
-
Object.assign(HandleAllocator.prototype, /** @lends {HandleAllocator.prototype} */ {
|
|
2630
|
-
get(id) {
|
|
2631
|
-
assert(this.allocated[id] !== undefined, `invalid handle: ${id}`);
|
|
2632
|
-
return this.allocated[id];
|
|
2633
|
-
},
|
|
2634
|
-
has(id) {
|
|
2635
|
-
return this.allocated[id] !== undefined;
|
|
2636
|
-
},
|
|
2637
|
-
allocate(handle) {
|
|
2638
|
-
var id = this.freelist.pop() || this.allocated.length;
|
|
2639
|
-
this.allocated[id] = handle;
|
|
2640
|
-
return id;
|
|
2641
|
-
},
|
|
2642
|
-
free(id) {
|
|
2643
|
-
assert(this.allocated[id] !== undefined);
|
|
2644
|
-
// Set the slot to `undefined` rather than using `delete` here since
|
|
2645
|
-
// apparently arrays with holes in them can be less efficient.
|
|
2646
|
-
this.allocated[id] = undefined;
|
|
2647
|
-
this.freelist.push(id);
|
|
2648
|
-
}
|
|
2649
|
-
});
|
|
2650
|
-
}
|
|
2651
|
-
/** @constructor */
|
|
2652
|
-
function HandleAllocator() {
|
|
2653
|
-
// Reserve slot 0 so that 0 is always an invalid handle
|
|
2654
|
-
this.allocated = [undefined];
|
|
2655
|
-
this.freelist = [];
|
|
2656
|
-
}
|
|
2657
|
-
var emval_handles = new HandleAllocator();;
|
|
2658
|
-
var __emval_decref = (handle) => {
|
|
2659
|
-
if (handle >= emval_handles.reserved && 0 === --emval_handles.get(handle).refcount) {
|
|
2660
|
-
emval_handles.free(handle);
|
|
2661
|
-
}
|
|
2662
|
-
};
|
|
2663
|
-
|
|
2664
|
-
|
|
2665
|
-
|
|
2666
|
-
var count_emval_handles = () => {
|
|
2667
|
-
var count = 0;
|
|
2668
|
-
for (var i = emval_handles.reserved; i < emval_handles.allocated.length; ++i) {
|
|
2669
|
-
if (emval_handles.allocated[i] !== undefined) {
|
|
2670
|
-
++count;
|
|
2671
|
-
}
|
|
2672
|
-
}
|
|
2673
|
-
return count;
|
|
2674
|
-
};
|
|
2675
|
-
|
|
2676
|
-
var init_emval = () => {
|
|
2677
|
-
// reserve some special values. These never get de-allocated.
|
|
2678
|
-
// The HandleAllocator takes care of reserving zero.
|
|
2679
|
-
emval_handles.allocated.push(
|
|
2680
|
-
{value: undefined},
|
|
2681
|
-
{value: null},
|
|
2682
|
-
{value: true},
|
|
2683
|
-
{value: false},
|
|
2684
|
-
);
|
|
2685
|
-
emval_handles.reserved = emval_handles.allocated.length
|
|
2686
|
-
Module['count_emval_handles'] = count_emval_handles;
|
|
2687
|
-
};
|
|
2688
|
-
var Emval = {
|
|
2689
|
-
toValue:(handle) => {
|
|
2690
|
-
if (!handle) {
|
|
2691
|
-
throwBindingError('Cannot use deleted val. handle = ' + handle);
|
|
2692
|
-
}
|
|
2693
|
-
return emval_handles.get(handle).value;
|
|
2694
|
-
},
|
|
2695
|
-
toHandle:(value) => {
|
|
2696
|
-
switch (value) {
|
|
2697
|
-
case undefined: return 1;
|
|
2698
|
-
case null: return 2;
|
|
2699
|
-
case true: return 3;
|
|
2700
|
-
case false: return 4;
|
|
2701
|
-
default:{
|
|
2702
|
-
return emval_handles.allocate({refcount: 1, value: value});
|
|
2703
|
-
}
|
|
2704
|
-
}
|
|
2705
|
-
},
|
|
2706
|
-
};
|
|
2707
|
-
|
|
2708
|
-
|
|
2709
|
-
|
|
2710
|
-
/** @suppress {globalThis} */
|
|
2711
|
-
function simpleReadValueFromPointer(pointer) {
|
|
2712
|
-
return this['fromWireType'](HEAP32[((pointer)>>2)]);
|
|
2713
|
-
}
|
|
2714
|
-
var __embind_register_emval = (rawType, name) => {
|
|
2715
|
-
name = readLatin1String(name);
|
|
2716
|
-
registerType(rawType, {
|
|
2717
|
-
name,
|
|
2718
|
-
'fromWireType': (handle) => {
|
|
2719
|
-
var rv = Emval.toValue(handle);
|
|
2720
|
-
__emval_decref(handle);
|
|
2721
|
-
return rv;
|
|
2722
|
-
},
|
|
2723
|
-
'toWireType': (destructors, value) => Emval.toHandle(value),
|
|
2724
|
-
'argPackAdvance': GenericWireTypeSize,
|
|
2725
|
-
'readValueFromPointer': simpleReadValueFromPointer,
|
|
2726
|
-
destructorFunction: null, // This type does not need a destructor
|
|
2727
|
-
|
|
2728
|
-
// TODO: do we need a deleteObject here? write a test where
|
|
2729
|
-
// emval is passed into JS via an interface
|
|
2730
|
-
});
|
|
2731
|
-
};
|
|
2732
|
-
|
|
2733
|
-
var embindRepr = (v) => {
|
|
2734
|
-
if (v === null) {
|
|
2735
|
-
return 'null';
|
|
2736
|
-
}
|
|
2737
|
-
var t = typeof v;
|
|
2738
|
-
if (t === 'object' || t === 'array' || t === 'function') {
|
|
2739
|
-
return v.toString();
|
|
2740
|
-
} else {
|
|
2741
|
-
return '' + v;
|
|
2742
|
-
}
|
|
2743
|
-
};
|
|
2744
|
-
|
|
2745
|
-
var floatReadValueFromPointer = (name, width) => {
|
|
2746
|
-
switch (width) {
|
|
2747
|
-
case 4: return function(pointer) {
|
|
2748
|
-
return this['fromWireType'](HEAPF32[((pointer)>>2)]);
|
|
2749
|
-
};
|
|
2750
|
-
case 8: return function(pointer) {
|
|
2751
|
-
return this['fromWireType'](HEAPF64[((pointer)>>3)]);
|
|
2752
|
-
};
|
|
2753
|
-
default:
|
|
2754
|
-
throw new TypeError(`invalid float width (${width}): ${name}`);
|
|
2755
|
-
}
|
|
2756
|
-
};
|
|
2757
|
-
|
|
1813
|
+
var extendError = (baseErrorType, errorName) => {
|
|
1814
|
+
var errorClass = createNamedFunction(errorName, function(message) {
|
|
1815
|
+
this.name = errorName;
|
|
1816
|
+
this.message = message;
|
|
2758
1817
|
|
|
2759
|
-
|
|
2760
|
-
|
|
2761
|
-
|
|
2762
|
-
|
|
2763
|
-
|
|
2764
|
-
'toWireType': (destructors, value) => {
|
|
2765
|
-
if (typeof value != "number" && typeof value != "boolean") {
|
|
2766
|
-
throw new TypeError(`Cannot convert ${embindRepr(value)} to ${this.name}`);
|
|
2767
|
-
}
|
|
2768
|
-
// The VM will perform JS to Wasm value conversion, according to the spec:
|
|
2769
|
-
// https://www.w3.org/TR/wasm-js-api-1/#towebassemblyvalue
|
|
2770
|
-
return value;
|
|
2771
|
-
},
|
|
2772
|
-
'argPackAdvance': GenericWireTypeSize,
|
|
2773
|
-
'readValueFromPointer': floatReadValueFromPointer(name, size),
|
|
2774
|
-
destructorFunction: null, // This type does not need a destructor
|
|
1818
|
+
var stack = (new Error(message)).stack;
|
|
1819
|
+
if (stack !== undefined) {
|
|
1820
|
+
this.stack = this.toString() + '\n' +
|
|
1821
|
+
stack.replace(/^Error(:[^\n]*)?\n/, '');
|
|
1822
|
+
}
|
|
2775
1823
|
});
|
|
2776
|
-
|
|
2777
|
-
|
|
2778
|
-
|
|
1824
|
+
errorClass.prototype = Object.create(baseErrorType.prototype);
|
|
1825
|
+
errorClass.prototype.constructor = errorClass;
|
|
1826
|
+
errorClass.prototype.toString = function() {
|
|
1827
|
+
if (this.message === undefined) {
|
|
1828
|
+
return this.name;
|
|
1829
|
+
} else {
|
|
1830
|
+
return `${this.name}: ${this.message}`;
|
|
1831
|
+
}
|
|
1832
|
+
};
|
|
2779
1833
|
|
|
1834
|
+
return errorClass;
|
|
1835
|
+
};
|
|
1836
|
+
var UnboundTypeError;
|
|
2780
1837
|
|
|
2781
1838
|
|
|
2782
1839
|
|
|
1840
|
+
var getTypeName = (type) => {
|
|
1841
|
+
var ptr = ___getTypeName(type);
|
|
1842
|
+
var rv = readLatin1String(ptr);
|
|
1843
|
+
_free(ptr);
|
|
1844
|
+
return rv;
|
|
1845
|
+
};
|
|
1846
|
+
var throwUnboundTypeError = (message, types) => {
|
|
1847
|
+
var unboundTypes = [];
|
|
1848
|
+
var seen = {};
|
|
1849
|
+
function visit(type) {
|
|
1850
|
+
if (seen[type]) {
|
|
1851
|
+
return;
|
|
1852
|
+
}
|
|
1853
|
+
if (registeredTypes[type]) {
|
|
1854
|
+
return;
|
|
1855
|
+
}
|
|
1856
|
+
if (typeDependencies[type]) {
|
|
1857
|
+
typeDependencies[type].forEach(visit);
|
|
1858
|
+
return;
|
|
1859
|
+
}
|
|
1860
|
+
unboundTypes.push(type);
|
|
1861
|
+
seen[type] = true;
|
|
1862
|
+
}
|
|
1863
|
+
types.forEach(visit);
|
|
2783
1864
|
|
|
1865
|
+
throw new UnboundTypeError(`${message}: ` + unboundTypes.map(getTypeName).join([', ']));
|
|
1866
|
+
};
|
|
2784
1867
|
|
|
2785
1868
|
|
|
1869
|
+
var getFunctionName = (signature) => {
|
|
1870
|
+
signature = signature.trim();
|
|
1871
|
+
const argsIndex = signature.indexOf("(");
|
|
1872
|
+
if (argsIndex !== -1) {
|
|
1873
|
+
assert(signature[signature.length - 1] == ")", "Parentheses for argument names should match.");
|
|
1874
|
+
return signature.substr(0, argsIndex);
|
|
1875
|
+
} else {
|
|
1876
|
+
return signature;
|
|
1877
|
+
}
|
|
1878
|
+
};
|
|
2786
1879
|
var __embind_register_function = (name, argCount, rawArgTypesAddr, signature, rawInvoker, fn, isAsync) => {
|
|
2787
1880
|
var argTypes = heap32VectorToArray(argCount, rawArgTypesAddr);
|
|
2788
1881
|
name = readLatin1String(name);
|
|
@@ -2903,6 +1996,10 @@ function dbg(text) {
|
|
|
2903
1996
|
|
|
2904
1997
|
|
|
2905
1998
|
|
|
1999
|
+
/** @suppress {globalThis} */
|
|
2000
|
+
function readPointer(pointer) {
|
|
2001
|
+
return this['fromWireType'](HEAPU32[((pointer)>>2)]);
|
|
2002
|
+
}
|
|
2906
2003
|
|
|
2907
2004
|
|
|
2908
2005
|
var stringToUTF8Array = (str, heap, outIdx, maxBytesToWrite) => {
|
|
@@ -3286,12 +2383,8 @@ function dbg(text) {
|
|
|
3286
2383
|
});
|
|
3287
2384
|
};
|
|
3288
2385
|
|
|
3289
|
-
|
|
3290
|
-
var
|
|
3291
|
-
if (handle > 4) {
|
|
3292
|
-
emval_handles.get(handle).refcount += 1;
|
|
3293
|
-
}
|
|
3294
|
-
};
|
|
2386
|
+
var nowIsMonotonic = 1;
|
|
2387
|
+
var __emscripten_get_now_is_monotonic = () => nowIsMonotonic;
|
|
3295
2388
|
|
|
3296
2389
|
|
|
3297
2390
|
|
|
@@ -3303,6 +2396,157 @@ function dbg(text) {
|
|
|
3303
2396
|
}
|
|
3304
2397
|
return impl;
|
|
3305
2398
|
};
|
|
2399
|
+
|
|
2400
|
+
var emval_returnValue = (returnType, destructorsRef, handle) => {
|
|
2401
|
+
var destructors = [];
|
|
2402
|
+
var result = returnType['toWireType'](destructors, handle);
|
|
2403
|
+
if (destructors.length) {
|
|
2404
|
+
// void, primitives and any other types w/o destructors don't need to allocate a handle
|
|
2405
|
+
HEAPU32[((destructorsRef)>>2)] = Emval.toHandle(destructors);
|
|
2406
|
+
}
|
|
2407
|
+
return result;
|
|
2408
|
+
};
|
|
2409
|
+
var __emval_as = (handle, returnType, destructorsRef) => {
|
|
2410
|
+
handle = Emval.toValue(handle);
|
|
2411
|
+
returnType = requireRegisteredType(returnType, 'emval::as');
|
|
2412
|
+
return emval_returnValue(returnType, destructorsRef, handle);
|
|
2413
|
+
};
|
|
2414
|
+
|
|
2415
|
+
var emval_methodCallers = [];
|
|
2416
|
+
|
|
2417
|
+
var __emval_call = (caller, handle, destructorsRef, args) => {
|
|
2418
|
+
caller = emval_methodCallers[caller];
|
|
2419
|
+
handle = Emval.toValue(handle);
|
|
2420
|
+
return caller(null, handle, destructorsRef, args);
|
|
2421
|
+
};
|
|
2422
|
+
|
|
2423
|
+
var emval_symbols = {
|
|
2424
|
+
};
|
|
2425
|
+
|
|
2426
|
+
var getStringOrSymbol = (address) => {
|
|
2427
|
+
var symbol = emval_symbols[address];
|
|
2428
|
+
if (symbol === undefined) {
|
|
2429
|
+
return readLatin1String(address);
|
|
2430
|
+
}
|
|
2431
|
+
return symbol;
|
|
2432
|
+
};
|
|
2433
|
+
|
|
2434
|
+
|
|
2435
|
+
var __emval_call_method = (caller, objHandle, methodName, destructorsRef, args) => {
|
|
2436
|
+
caller = emval_methodCallers[caller];
|
|
2437
|
+
objHandle = Emval.toValue(objHandle);
|
|
2438
|
+
methodName = getStringOrSymbol(methodName);
|
|
2439
|
+
return caller(objHandle, objHandle[methodName], destructorsRef, args);
|
|
2440
|
+
};
|
|
2441
|
+
|
|
2442
|
+
|
|
2443
|
+
var emval_addMethodCaller = (caller) => {
|
|
2444
|
+
var id = emval_methodCallers.length;
|
|
2445
|
+
emval_methodCallers.push(caller);
|
|
2446
|
+
return id;
|
|
2447
|
+
};
|
|
2448
|
+
|
|
2449
|
+
var emval_lookupTypes = (argCount, argTypes) => {
|
|
2450
|
+
var a = new Array(argCount);
|
|
2451
|
+
for (var i = 0; i < argCount; ++i) {
|
|
2452
|
+
a[i] = requireRegisteredType(HEAPU32[(((argTypes)+(i * 4))>>2)],
|
|
2453
|
+
"parameter " + i);
|
|
2454
|
+
}
|
|
2455
|
+
return a;
|
|
2456
|
+
};
|
|
2457
|
+
|
|
2458
|
+
|
|
2459
|
+
var reflectConstruct = Reflect.construct;
|
|
2460
|
+
|
|
2461
|
+
|
|
2462
|
+
var __emval_get_method_caller = (argCount, argTypes, kind) => {
|
|
2463
|
+
var types = emval_lookupTypes(argCount, argTypes);
|
|
2464
|
+
var retType = types.shift();
|
|
2465
|
+
argCount--; // remove the shifted off return type
|
|
2466
|
+
|
|
2467
|
+
var functionBody =
|
|
2468
|
+
`return function (obj, func, destructorsRef, args) {\n`;
|
|
2469
|
+
|
|
2470
|
+
var offset = 0;
|
|
2471
|
+
var argsList = []; // 'obj?, arg0, arg1, arg2, ... , argN'
|
|
2472
|
+
if (kind === /* FUNCTION */ 0) {
|
|
2473
|
+
argsList.push("obj");
|
|
2474
|
+
}
|
|
2475
|
+
var params = ["retType"];
|
|
2476
|
+
var args = [retType];
|
|
2477
|
+
for (var i = 0; i < argCount; ++i) {
|
|
2478
|
+
argsList.push("arg" + i);
|
|
2479
|
+
params.push("argType" + i);
|
|
2480
|
+
args.push(types[i]);
|
|
2481
|
+
functionBody +=
|
|
2482
|
+
` var arg${i} = argType${i}.readValueFromPointer(args${offset ? "+" + offset : ""});\n`;
|
|
2483
|
+
offset += types[i]['argPackAdvance'];
|
|
2484
|
+
}
|
|
2485
|
+
var invoker = kind === /* CONSTRUCTOR */ 1 ? 'new func' : 'func.call';
|
|
2486
|
+
functionBody +=
|
|
2487
|
+
` var rv = ${invoker}(${argsList.join(", ")});\n`;
|
|
2488
|
+
for (var i = 0; i < argCount; ++i) {
|
|
2489
|
+
if (types[i]['deleteObject']) {
|
|
2490
|
+
functionBody +=
|
|
2491
|
+
` argType${i}.deleteObject(arg${i});\n`;
|
|
2492
|
+
}
|
|
2493
|
+
}
|
|
2494
|
+
if (!retType.isVoid) {
|
|
2495
|
+
params.push("emval_returnValue");
|
|
2496
|
+
args.push(emval_returnValue);
|
|
2497
|
+
functionBody +=
|
|
2498
|
+
" return emval_returnValue(retType, destructorsRef, rv);\n";
|
|
2499
|
+
}
|
|
2500
|
+
functionBody +=
|
|
2501
|
+
"};\n";
|
|
2502
|
+
|
|
2503
|
+
params.push(functionBody);
|
|
2504
|
+
var invokerFunction = newFunc(Function, params).apply(null, args);
|
|
2505
|
+
var functionName = `methodCaller<(${types.map(t => t.name).join(', ')}) => ${retType.name}>`;
|
|
2506
|
+
return emval_addMethodCaller(createNamedFunction(functionName, invokerFunction));
|
|
2507
|
+
};
|
|
2508
|
+
|
|
2509
|
+
|
|
2510
|
+
var __emval_get_module_property = (name) => {
|
|
2511
|
+
name = getStringOrSymbol(name);
|
|
2512
|
+
return Emval.toHandle(Module[name]);
|
|
2513
|
+
};
|
|
2514
|
+
|
|
2515
|
+
var __emval_get_property = (handle, key) => {
|
|
2516
|
+
handle = Emval.toValue(handle);
|
|
2517
|
+
key = Emval.toValue(key);
|
|
2518
|
+
return Emval.toHandle(handle[key]);
|
|
2519
|
+
};
|
|
2520
|
+
|
|
2521
|
+
var __emval_incref = (handle) => {
|
|
2522
|
+
if (handle > 4) {
|
|
2523
|
+
emval_handles.get(handle).refcount += 1;
|
|
2524
|
+
}
|
|
2525
|
+
};
|
|
2526
|
+
|
|
2527
|
+
var __emval_new_array = () => Emval.toHandle([]);
|
|
2528
|
+
|
|
2529
|
+
|
|
2530
|
+
var __emval_new_cstring = (v) => Emval.toHandle(getStringOrSymbol(v));
|
|
2531
|
+
|
|
2532
|
+
var __emval_new_object = () => Emval.toHandle({});
|
|
2533
|
+
|
|
2534
|
+
|
|
2535
|
+
|
|
2536
|
+
var __emval_run_destructors = (handle) => {
|
|
2537
|
+
var destructors = Emval.toValue(handle);
|
|
2538
|
+
runDestructors(destructors);
|
|
2539
|
+
__emval_decref(handle);
|
|
2540
|
+
};
|
|
2541
|
+
|
|
2542
|
+
var __emval_set_property = (handle, key, value) => {
|
|
2543
|
+
handle = Emval.toValue(handle);
|
|
2544
|
+
key = Emval.toValue(key);
|
|
2545
|
+
value = Emval.toValue(value);
|
|
2546
|
+
handle[key] = value;
|
|
2547
|
+
};
|
|
2548
|
+
|
|
2549
|
+
|
|
3306
2550
|
var __emval_take_value = (type, arg) => {
|
|
3307
2551
|
type = requireRegisteredType(type, '_emval_take_value');
|
|
3308
2552
|
var v = type['readValueFromPointer'](arg);
|
|
@@ -3313,6 +2557,15 @@ function dbg(text) {
|
|
|
3313
2557
|
abort('native code called abort()');
|
|
3314
2558
|
};
|
|
3315
2559
|
|
|
2560
|
+
var _emscripten_date_now = () => Date.now();
|
|
2561
|
+
|
|
2562
|
+
var _emscripten_get_now;
|
|
2563
|
+
// Modern environment where performance.now() is supported:
|
|
2564
|
+
// N.B. a shorter form "_emscripten_get_now = performance.now;" is
|
|
2565
|
+
// unfortunately not allowed even in current browsers (e.g. FF Nightly 75).
|
|
2566
|
+
_emscripten_get_now = () => performance.now();
|
|
2567
|
+
;
|
|
2568
|
+
|
|
3316
2569
|
var _emscripten_memcpy_js = (dest, src, num) => HEAPU8.copyWithin(dest, src, src + num);
|
|
3317
2570
|
|
|
3318
2571
|
var getHeapMax = () =>
|
|
@@ -3464,12 +2717,9 @@ function dbg(text) {
|
|
|
3464
2717
|
embind_init_charCodes();
|
|
3465
2718
|
BindingError = Module['BindingError'] = class BindingError extends Error { constructor(message) { super(message); this.name = 'BindingError'; }};
|
|
3466
2719
|
InternalError = Module['InternalError'] = class InternalError extends Error { constructor(message) { super(message); this.name = 'InternalError'; }};
|
|
3467
|
-
init_ClassHandle();
|
|
3468
|
-
init_embind();;
|
|
3469
|
-
init_RegisteredPointer();
|
|
3470
|
-
UnboundTypeError = Module['UnboundTypeError'] = extendError(Error, 'UnboundTypeError');;
|
|
3471
2720
|
handleAllocatorInit();
|
|
3472
2721
|
init_emval();;
|
|
2722
|
+
UnboundTypeError = Module['UnboundTypeError'] = extendError(Error, 'UnboundTypeError');;
|
|
3473
2723
|
function checkIncomingModuleAPI() {
|
|
3474
2724
|
ignoredModuleProp('fetchSettings');
|
|
3475
2725
|
}
|
|
@@ -3491,14 +2741,6 @@ var wasmImports = {
|
|
|
3491
2741
|
/** @export */
|
|
3492
2742
|
_embind_register_bool: __embind_register_bool,
|
|
3493
2743
|
/** @export */
|
|
3494
|
-
_embind_register_class: __embind_register_class,
|
|
3495
|
-
/** @export */
|
|
3496
|
-
_embind_register_class_constructor: __embind_register_class_constructor,
|
|
3497
|
-
/** @export */
|
|
3498
|
-
_embind_register_class_function: __embind_register_class_function,
|
|
3499
|
-
/** @export */
|
|
3500
|
-
_embind_register_class_property: __embind_register_class_property,
|
|
3501
|
-
/** @export */
|
|
3502
2744
|
_embind_register_emval: __embind_register_emval,
|
|
3503
2745
|
/** @export */
|
|
3504
2746
|
_embind_register_float: __embind_register_float,
|
|
@@ -3515,14 +2757,42 @@ var wasmImports = {
|
|
|
3515
2757
|
/** @export */
|
|
3516
2758
|
_embind_register_void: __embind_register_void,
|
|
3517
2759
|
/** @export */
|
|
2760
|
+
_emscripten_get_now_is_monotonic: __emscripten_get_now_is_monotonic,
|
|
2761
|
+
/** @export */
|
|
2762
|
+
_emval_as: __emval_as,
|
|
2763
|
+
/** @export */
|
|
2764
|
+
_emval_call: __emval_call,
|
|
2765
|
+
/** @export */
|
|
2766
|
+
_emval_call_method: __emval_call_method,
|
|
2767
|
+
/** @export */
|
|
3518
2768
|
_emval_decref: __emval_decref,
|
|
3519
2769
|
/** @export */
|
|
2770
|
+
_emval_get_method_caller: __emval_get_method_caller,
|
|
2771
|
+
/** @export */
|
|
2772
|
+
_emval_get_module_property: __emval_get_module_property,
|
|
2773
|
+
/** @export */
|
|
2774
|
+
_emval_get_property: __emval_get_property,
|
|
2775
|
+
/** @export */
|
|
3520
2776
|
_emval_incref: __emval_incref,
|
|
3521
2777
|
/** @export */
|
|
2778
|
+
_emval_new_array: __emval_new_array,
|
|
2779
|
+
/** @export */
|
|
2780
|
+
_emval_new_cstring: __emval_new_cstring,
|
|
2781
|
+
/** @export */
|
|
2782
|
+
_emval_new_object: __emval_new_object,
|
|
2783
|
+
/** @export */
|
|
2784
|
+
_emval_run_destructors: __emval_run_destructors,
|
|
2785
|
+
/** @export */
|
|
2786
|
+
_emval_set_property: __emval_set_property,
|
|
2787
|
+
/** @export */
|
|
3522
2788
|
_emval_take_value: __emval_take_value,
|
|
3523
2789
|
/** @export */
|
|
3524
2790
|
abort: _abort,
|
|
3525
2791
|
/** @export */
|
|
2792
|
+
emscripten_date_now: _emscripten_date_now,
|
|
2793
|
+
/** @export */
|
|
2794
|
+
emscripten_get_now: _emscripten_get_now,
|
|
2795
|
+
/** @export */
|
|
3526
2796
|
emscripten_memcpy_js: _emscripten_memcpy_js,
|
|
3527
2797
|
/** @export */
|
|
3528
2798
|
emscripten_resize_heap: _emscripten_resize_heap,
|
|
@@ -3537,6 +2807,10 @@ var wasmImports = {
|
|
|
3537
2807
|
/** @export */
|
|
3538
2808
|
invoke_iii: invoke_iii,
|
|
3539
2809
|
/** @export */
|
|
2810
|
+
invoke_iiii: invoke_iiii,
|
|
2811
|
+
/** @export */
|
|
2812
|
+
invoke_j: invoke_j,
|
|
2813
|
+
/** @export */
|
|
3540
2814
|
invoke_v: invoke_v,
|
|
3541
2815
|
/** @export */
|
|
3542
2816
|
invoke_vi: invoke_vi,
|
|
@@ -3570,8 +2844,20 @@ var ___cxa_decrement_exception_refcount = createExportWrapper('__cxa_decrement_e
|
|
|
3570
2844
|
var ___get_exception_message = Module['___get_exception_message'] = createExportWrapper('__get_exception_message');
|
|
3571
2845
|
var ___cxa_can_catch = createExportWrapper('__cxa_can_catch');
|
|
3572
2846
|
var ___cxa_is_pointer_type = createExportWrapper('__cxa_is_pointer_type');
|
|
2847
|
+
var dynCall_j = Module['dynCall_j'] = createExportWrapper('dynCall_j');
|
|
3573
2848
|
var dynCall_jiji = Module['dynCall_jiji'] = createExportWrapper('dynCall_jiji');
|
|
3574
2849
|
|
|
2850
|
+
function invoke_iiii(index,a1,a2,a3) {
|
|
2851
|
+
var sp = stackSave();
|
|
2852
|
+
try {
|
|
2853
|
+
return getWasmTableEntry(index)(a1,a2,a3);
|
|
2854
|
+
} catch(e) {
|
|
2855
|
+
stackRestore(sp);
|
|
2856
|
+
if (!(e instanceof EmscriptenEH)) throw e;
|
|
2857
|
+
_setThrew(1, 0);
|
|
2858
|
+
}
|
|
2859
|
+
}
|
|
2860
|
+
|
|
3575
2861
|
function invoke_iii(index,a1,a2) {
|
|
3576
2862
|
var sp = stackSave();
|
|
3577
2863
|
try {
|
|
@@ -3616,6 +2902,17 @@ function invoke_vi(index,a1) {
|
|
|
3616
2902
|
}
|
|
3617
2903
|
}
|
|
3618
2904
|
|
|
2905
|
+
function invoke_viii(index,a1,a2,a3) {
|
|
2906
|
+
var sp = stackSave();
|
|
2907
|
+
try {
|
|
2908
|
+
getWasmTableEntry(index)(a1,a2,a3);
|
|
2909
|
+
} catch(e) {
|
|
2910
|
+
stackRestore(sp);
|
|
2911
|
+
if (!(e instanceof EmscriptenEH)) throw e;
|
|
2912
|
+
_setThrew(1, 0);
|
|
2913
|
+
}
|
|
2914
|
+
}
|
|
2915
|
+
|
|
3619
2916
|
function invoke_viiii(index,a1,a2,a3,a4) {
|
|
3620
2917
|
var sp = stackSave();
|
|
3621
2918
|
try {
|
|
@@ -3638,10 +2935,10 @@ function invoke_vii(index,a1,a2) {
|
|
|
3638
2935
|
}
|
|
3639
2936
|
}
|
|
3640
2937
|
|
|
3641
|
-
function
|
|
2938
|
+
function invoke_j(index) {
|
|
3642
2939
|
var sp = stackSave();
|
|
3643
2940
|
try {
|
|
3644
|
-
|
|
2941
|
+
return dynCall_j(index);
|
|
3645
2942
|
} catch(e) {
|
|
3646
2943
|
stackRestore(sp);
|
|
3647
2944
|
if (!(e instanceof EmscriptenEH)) throw e;
|
|
@@ -3826,14 +3123,39 @@ var missingLibrarySymbols = [
|
|
|
3826
3123
|
'writeStringToMemory',
|
|
3827
3124
|
'writeAsciiToMemory',
|
|
3828
3125
|
'getFunctionArgsName',
|
|
3126
|
+
'init_embind',
|
|
3127
|
+
'getBasestPointer',
|
|
3829
3128
|
'registerInheritedInstance',
|
|
3830
3129
|
'unregisterInheritedInstance',
|
|
3130
|
+
'getInheritedInstance',
|
|
3131
|
+
'getInheritedInstanceCount',
|
|
3132
|
+
'getLiveInheritedInstances',
|
|
3831
3133
|
'enumReadValueFromPointer',
|
|
3832
|
-
'
|
|
3134
|
+
'genericPointerToWireType',
|
|
3135
|
+
'constNoSmartPtrRawPointerToWireType',
|
|
3136
|
+
'nonConstNoSmartPtrRawPointerToWireType',
|
|
3137
|
+
'init_RegisteredPointer',
|
|
3138
|
+
'RegisteredPointer',
|
|
3139
|
+
'RegisteredPointer_fromWireType',
|
|
3140
|
+
'runDestructor',
|
|
3141
|
+
'releaseClassHandle',
|
|
3142
|
+
'detachFinalizer',
|
|
3143
|
+
'attachFinalizer',
|
|
3144
|
+
'makeClassHandle',
|
|
3145
|
+
'init_ClassHandle',
|
|
3146
|
+
'ClassHandle',
|
|
3147
|
+
'throwInstanceAlreadyDeleted',
|
|
3148
|
+
'flushPendingDeletes',
|
|
3149
|
+
'setDelayFunction',
|
|
3150
|
+
'RegisteredClass',
|
|
3151
|
+
'shallowCopyInternalPointer',
|
|
3152
|
+
'downcastPointer',
|
|
3153
|
+
'upcastPointer',
|
|
3154
|
+
'validateThis',
|
|
3155
|
+
'char_0',
|
|
3156
|
+
'char_9',
|
|
3157
|
+
'makeLegalFunctionName',
|
|
3833
3158
|
'emval_get_global',
|
|
3834
|
-
'emval_returnValue',
|
|
3835
|
-
'emval_lookupTypes',
|
|
3836
|
-
'emval_addMethodCaller',
|
|
3837
3159
|
];
|
|
3838
3160
|
missingLibrarySymbols.forEach(missingLibrarySymbol)
|
|
3839
3161
|
|
|
@@ -3970,7 +3292,6 @@ var unexportedSymbols = [
|
|
|
3970
3292
|
'UnboundTypeError',
|
|
3971
3293
|
'PureVirtualError',
|
|
3972
3294
|
'GenericWireTypeSize',
|
|
3973
|
-
'init_embind',
|
|
3974
3295
|
'throwUnboundTypeError',
|
|
3975
3296
|
'ensureOverloadTable',
|
|
3976
3297
|
'exposePublicSymbol',
|
|
@@ -3979,10 +3300,6 @@ var unexportedSymbols = [
|
|
|
3979
3300
|
'createNamedFunction',
|
|
3980
3301
|
'embindRepr',
|
|
3981
3302
|
'registeredInstances',
|
|
3982
|
-
'getBasestPointer',
|
|
3983
|
-
'getInheritedInstance',
|
|
3984
|
-
'getInheritedInstanceCount',
|
|
3985
|
-
'getLiveInheritedInstances',
|
|
3986
3303
|
'registeredPointers',
|
|
3987
3304
|
'registerType',
|
|
3988
3305
|
'integerReadValueFromPointer',
|
|
@@ -3993,40 +3310,20 @@ var unexportedSymbols = [
|
|
|
3993
3310
|
'newFunc',
|
|
3994
3311
|
'craftInvokerFunction',
|
|
3995
3312
|
'embind__requireFunction',
|
|
3996
|
-
'genericPointerToWireType',
|
|
3997
|
-
'constNoSmartPtrRawPointerToWireType',
|
|
3998
|
-
'nonConstNoSmartPtrRawPointerToWireType',
|
|
3999
|
-
'init_RegisteredPointer',
|
|
4000
|
-
'RegisteredPointer',
|
|
4001
|
-
'RegisteredPointer_fromWireType',
|
|
4002
|
-
'runDestructor',
|
|
4003
|
-
'releaseClassHandle',
|
|
4004
3313
|
'finalizationRegistry',
|
|
4005
3314
|
'detachFinalizer_deps',
|
|
4006
|
-
'detachFinalizer',
|
|
4007
|
-
'attachFinalizer',
|
|
4008
|
-
'makeClassHandle',
|
|
4009
|
-
'init_ClassHandle',
|
|
4010
|
-
'ClassHandle',
|
|
4011
|
-
'throwInstanceAlreadyDeleted',
|
|
4012
3315
|
'deletionQueue',
|
|
4013
|
-
'flushPendingDeletes',
|
|
4014
3316
|
'delayFunction',
|
|
4015
|
-
'setDelayFunction',
|
|
4016
|
-
'RegisteredClass',
|
|
4017
|
-
'shallowCopyInternalPointer',
|
|
4018
|
-
'downcastPointer',
|
|
4019
|
-
'upcastPointer',
|
|
4020
|
-
'validateThis',
|
|
4021
|
-
'char_0',
|
|
4022
|
-
'char_9',
|
|
4023
|
-
'makeLegalFunctionName',
|
|
4024
3317
|
'emval_handles',
|
|
4025
3318
|
'emval_symbols',
|
|
4026
3319
|
'init_emval',
|
|
4027
3320
|
'count_emval_handles',
|
|
3321
|
+
'getStringOrSymbol',
|
|
4028
3322
|
'Emval',
|
|
3323
|
+
'emval_returnValue',
|
|
3324
|
+
'emval_lookupTypes',
|
|
4029
3325
|
'emval_methodCallers',
|
|
3326
|
+
'emval_addMethodCaller',
|
|
4030
3327
|
'reflectConstruct',
|
|
4031
3328
|
];
|
|
4032
3329
|
unexportedSymbols.forEach(unexportedRuntimeSymbol);
|