tildefriends/src/util.js.h

15 lines
749 B
C
Raw Normal View History

#pragma once
#include "quickjs.h"
#include <stdbool.h>
void tf_util_register(JSContext* context);
JSValue tf_util_utf8_decode(JSContext* context, JSValue value);
uint8_t* tf_util_try_get_array_buffer(JSContext* context, size_t* psize, JSValueConst obj);
JSValue tf_util_try_get_typed_array_buffer(JSContext* context, JSValueConst obj, size_t* pbyte_offset, size_t* pbyte_length, size_t* pbytes_per_element);
bool tf_util_report_error(JSContext* context, JSValue value);
int tf_util_get_length(JSContext* context, JSValue value);
int tf_util_insert_index(const void* key, const void* base, size_t count, size_t size, int (*compare)(const void*, const void*));
JSValue tf_util_new_uint8_array(JSContext* context, const uint8_t* data, size_t size);