Diol can save your theme preference in this browser using local storage.
const void *EsBufferRead(EsBuffer *buffer, size_t readBytes);
Returns a pointer to readBytes in the buffer and advances the position. Returns null on error. The pointer is only valid while the buffer is unchanged.
bool EsBufferReadInto(EsBuffer *buffer, void *destination, size_t readBytes);
Copies readBytes from the buffer to destination. Returns false on error.
const void *EsBufferReadMany(EsBuffer *buffer, size_t a, size_t b);
Like EsBufferRead, but for a * b bytes. Returns null if the multiplication overflows.
int32_t EsBufferReadInt32Endian(EsBuffer *buffer, int32_t errorValue);
Reads an int32, converting byte order if big endian. Returns errorValue if there is not enough data.
void *EsBufferWrite(EsBuffer *buffer, const void *source, size_t writeBytes);
Writes writeBytes to the buffer. For a memory-backed buffer, returns a pointer to the written data, or null on error; source may be null to zero the space. For a file-store-backed buffer, returns null and source must not be null; check buffer->error for errors.
bool EsBufferWriteInt8(EsBuffer *buffer, int8_t value);
Writes an int8 to the buffer. Returns true on error.
bool EsBufferWriteInt32Endian(EsBuffer *buffer, int32_t value);
Changes byte order if big endian.
void EsBufferFormat(EsBuffer *buffer, EsCString format, ...);
Appends.
void EsBufferFormatV(EsBuffer *buffer, EsCString format, va_list arguments);
Appends.
void EsBufferFlushToFileStore(EsBuffer *buffer);
Appends the buffered data to the buffer's file store and resets the position. The buffer must have a file store.
EsHandle EsConstantBufferCreate(const void *data, size_t dataBytes, EsHandle targetProcess);
Creates a constant buffer containing a copy of data. Returns a handle valid in targetProcess; use ES_CURRENT_PROCESS for the current process.
void EsConstantBufferRead(EsHandle constantBuffer, void *output);
Copies the contents of the constant buffer to output.
EsHandle EsConstantBufferShare(EsHandle constantBuffer, EsHandle targetProcess);
Creates a handle to the constant buffer in targetProcess.
size_t EsConstantBufferGetSize(EsHandle constantBuffer);
Returns the size of the constant buffer.
void *EsHeapAllocate(size_t size, bool zeroMemory, EsHeap *heap = ES_NULL);
Allocates size bytes from the heap, zeroed if zeroMemory is true. Returns null on failure. Free with EsHeapFree.
void EsHeapFree(void *address, size_t expectedSize = 0, EsHeap *heap = ES_NULL);
Frees memory allocated with EsHeapAllocate. expectedSize may be 0.
void *EsHeapReallocate(void *oldAddress, size_t newAllocationSize, bool zeroNewSpace, EsHeap *heap = ES_NULL);
Changes the size of an allocation. Returns the new address, or null on failure. Free with EsHeapFree.
void EsHeapValidate();
Validates the heap. Panics if the heap is corrupt.
EsHandle EsMemoryCreateShareableRegion(size_t bytes);
Creates a shareable memory region of bytes bytes. Returns a handle to the region.
bool EsMemoryCommit(void *pointer, size_t bytes);
Commits pages in a reserved region. pointer and bytes must be page-aligned. Returns true on success.
int EsMemoryCompare(const void *a, const void *b, size_t bytes);
Compares the two buffers. Returns a negative, zero, or positive value.
void EsMemoryCopy(void *destination, const void *source, size_t bytes);
Copies bytes from source to destination. Does not handle overlapping regions; use EsMemoryMove for overlaps.
void EsMemoryCopyReverse(void *_destination, const void *_source, size_t bytes);
Copies bytes from the end of source to the end of destination.
bool EsMemoryDecommit(void *pointer, size_t bytes);
May fail in low-memory conditions when the commit ranges on the region are fragmented. (Cannot fail if you decommit the entire region.)
void EsMemoryFaultRange(const void *pointer, size_t bytes, uint32_t flags = ES_FLAGS_DEFAULT);
Simulate a page fault in each page in the range.
void EsMemoryFill(void *from, void *to, uint8_t byte);
Fills the range from from (inclusive) to to (exclusive) with byte.
void EsMemoryMove(void *_start, void *_end, intptr_t amount, bool zeroEmptySpace);
Moves the range from start to end by amount bytes. If zeroEmptySpace, the vacated bytes are zeroed.
void *EsMemoryReserve(size_t size, EsMemoryProtection protection = ES_MEMORY_PROTECTION_READ_WRITE, EsMemoryReserveFlags flags = ES_MEMORY_RESERVE_COMMIT_ALL);
Reserves memory. Returns the address, or null on failure. Free with EsMemoryUnreserve.
EsHandle EsMemoryShare(EsHandle sharedMemoryRegion, EsHandle targetProcess, bool readOnly);
Creates a handle to the shared memory region in targetProcess, read-only if readOnly is true.
uint8_t EsMemorySumBytes(uint8_t *data, size_t bytes);
Returns the sum of all the bytes in data.
void EsMemoryUnreserve(void *pointer, size_t size = 0);
Must cover the entire reserved region. Leave size 0 if you don't know the size.
void EsMemoryZero(void *destination, size_t bytes);
Zeros bytes bytes at destination.
void *EsMemoryMapObject(EsHandle object, uintptr_t offset, size_t size, EsMemoryMapFlags flags);
Maps a shared memory region or file into the address space. Returns a pointer, or null on failure. Unmap with EsMemoryUnreserve.