| 86 | }; |
| 87 | |
| 88 | void *fxArrayBuffer(txMachine* the, txSlot* slot, void* data, txInteger byteLength, txInteger maxByteLength) |
| 89 | { |
| 90 | txSlot* instance; |
| 91 | txSlot* arrayBuffer; |
| 92 | txSlot* bufferInfo; |
| 93 | if (byteLength < 0) |
| 94 | mxRangeError("invalid byteLength %ld", byteLength); |
| 95 | mxPush(mxArrayBufferPrototype); |
| 96 | instance = fxNewArrayBufferInstance(the); |
| 97 | arrayBuffer = instance->next; |
| 98 | arrayBuffer->value.arrayBuffer.address = fxNewChunk(the, byteLength); |
| 99 | bufferInfo = arrayBuffer->next; |
| 100 | bufferInfo->value.bufferInfo.length = byteLength; |
| 101 | bufferInfo->value.bufferInfo.maxLength = maxByteLength; |
| 102 | if (data != NULL) |
| 103 | c_memcpy(arrayBuffer->value.arrayBuffer.address, data, byteLength); |
| 104 | else |
| 105 | c_memset(arrayBuffer->value.arrayBuffer.address, 0, byteLength); |
| 106 | mxPullSlot(slot); |
| 107 | return arrayBuffer->value.arrayBuffer.address; |
| 108 | } |
| 109 | |
| 110 | void fxGetArrayBufferData(txMachine* the, txSlot* slot, txInteger byteOffset, void* data, txInteger byteLength) |
| 111 | { |
no test coverage detected