From 759eff69ae9e6a97960b4b8f8de00ce4cf049f63 Mon Sep 17 00:00:00 2001 From: fengjingyan Date: Sat, 30 Oct 2021 16:04:46 +0800 Subject: [PATCH] test code Signed-off-by: fengjingyan --- BUILD.gn | 2 ++ config.h | 30 ++++++++++++++++++++++++++++++ qjs.c | 1 + quickjs.c | 16 ++++++++++++++++ quickjs.h | 3 +++ 5 files changed, 52 insertions(+) mode change 100644 => 100755 BUILD.gn create mode 100755 config.h mode change 100644 => 100755 qjs.c mode change 100644 => 100755 quickjs.c mode change 100644 => 100755 quickjs.h diff --git a/BUILD.gn b/BUILD.gn old mode 100644 new mode 100755 index c798dd5..4899046 --- a/BUILD.gn +++ b/BUILD.gn @@ -43,6 +43,7 @@ config("qjs_debug_config") { qjs_sources = [ "cutils.c", + "libbf.c", "libregexp.c", "libunicode.c", "quickjs-libc.c", @@ -76,6 +77,7 @@ ohos_static_library("qjs") { ohos_executable("qjsc") { sources = [ "cutils.c", + "libbf.c", "libregexp.c", "libunicode.c", "qjsc.c", diff --git a/config.h b/config.h new file mode 100755 index 0000000..86c10ad --- /dev/null +++ b/config.h @@ -0,0 +1,30 @@ +/* + * QuickJS Javascript Engine + * + * Copyright (c) 2017-2020 Fabrice Bellard + * Copyright (c) 2017-2020 Charlie Gordon + * + * Permission is hereby granted, free of charge, to any person obtaining a copy + * of this software and associated documentation files (the "Software"), to deal + * in the Software without restriction, including without limitation the rights + * to use, copy, modify, merge, publish, distribute, sublicense, and/or sell + * copies of the Software, and to permit persons to whom the Software is + * furnished to do so, subject to the following conditions: + * + * The above copyright notice and this permission notice shall be included in + * all copies or substantial portions of the Software. + * + * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR + * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, + * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL + * THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER + * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, + * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN + * THE SOFTWARE. + */ +#ifndef CONFIG_H +#define CONFIG_H + +#define CONFIG_BIGNUM 1 + +#endif /* CONFIG_H */ diff --git a/qjs.c b/qjs.c old mode 100644 new mode 100755 index 4dd11f8..2cf2a2c --- a/qjs.c +++ b/qjs.c @@ -38,6 +38,7 @@ #include #endif +#include "config.h" #include "cutils.h" #include "quickjs-libc.h" diff --git a/quickjs.c b/quickjs.c old mode 100644 new mode 100755 index b9f0db3..6d37611 --- a/quickjs.c +++ b/quickjs.c @@ -38,6 +38,7 @@ #include #endif +#include "config.h" #include "cutils.h" #include "list.h" #include "quickjs.h" @@ -54541,3 +54542,18 @@ JSValue JS_AceNewInstance(JSContext *ctx, int classId, int argc, JSValueConst *a JS_FreeValue(ctx, obj); return newInst; } + +JS_BOOL JS_IsDetachedArrayBuffer(JSContext *ctx, JSValueConst obj) +{ + JSObject *p = get_typed_array(ctx, obj, 0); + if (!p) + { + return -1; + } + return typed_array_is_detached(ctx, p); +} + +JSValue JS_NewString16(JSContext *ctx, const uint16_t *buf, int len) +{ + return js_new_string16(ctx, buf, len); +} \ No newline at end of file diff --git a/quickjs.h b/quickjs.h old mode 100644 new mode 100755 index 540aa43..f151e1e --- a/quickjs.h +++ b/quickjs.h @@ -1069,6 +1069,9 @@ void JS_AceSetConstructor(JSContext *ctx, JSValueConst func_obj, JSValueConst pr JSValue JS_GetNameSpace(JSContext *ctx, JSValueConst moduleVal); JSValue JS_AceNewInstance(JSContext *ctx, int classId, int argc, JSValueConst *argv); +JS_BOOL JS_IsDetachedArrayBuffer(JSContext *ctx, JSValueConst obj); +JSValue JS_NewString16(JSContext *ctx, const uint16_t *buf, int len); + #undef js_unlikely #undef js_force_inline -- Gitee