Create a util.js.{h,c} from some common things.

git-svn-id: https://www.unprompted.com/svn/projects/tildefriends/trunk@3681 ed5197a5-7fde-0310-b194-c3ffbd925b24
This commit is contained in:
2021-11-03 22:15:46 +00:00
parent 03a2367532
commit fde7fb4270
9 changed files with 129 additions and 155 deletions

8
src/util.js.h Normal file
View File

@ -0,0 +1,8 @@
#pragma once
#include "quickjs.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 *ctx, size_t *psize, JSValueConst obj);
JSValue tf_util_try_get_typed_array_buffer(JSContext *ctx, JSValueConst obj, size_t *pbyte_offset, size_t *pbyte_length, size_t *pbytes_per_element);