mirror of
https://gitee.com/openharmony/interface_sdk_c
synced 2024-11-24 07:09:59 +00:00
commit
fc8ac453ec
@ -2651,6 +2651,114 @@ JSVM_EXTERN JSVM_Status OH_JSVM_IsObject(JSVM_Env env,
|
||||
JSVM_EXTERN JSVM_Status OH_JSVM_IsBigInt(JSVM_Env env,
|
||||
JSVM_Value value,
|
||||
bool* isBigInt);
|
||||
|
||||
/**
|
||||
* @brief This API returns a JSVM-API value corresponding to a JavaScript Map type.
|
||||
*
|
||||
* @param env: The environment that the API is invoked under.
|
||||
* @param result: A JSVM_Value representing a JavaScript Map.
|
||||
* @return Only returns JSVM function's result code.
|
||||
* {@link JSVM_OK } If the API succeeded.\n
|
||||
* {@link JSVM_INVALID_ARG } If the input parameter is invalid.\n
|
||||
* @since 12
|
||||
*/
|
||||
JSVM_Status JSVM_CDECL OH_JSVM_CreateMap(JSVM_Env env, JSVM_Value* result);
|
||||
|
||||
/**
|
||||
* @brief This API checks if the value passed in is a Map.
|
||||
*
|
||||
* @param env: The environment that the API is invoked under.
|
||||
* @param value: The JavaScript value to check.
|
||||
* @param isMap: Whether the given value is Map.
|
||||
* @return Only returns JSVM function's result code.
|
||||
* {@link JSVM_OK } If the API succeeded.\n
|
||||
* {@link JSVM_INVALID_ARG } If the input parameter is invalid.\n
|
||||
* @since 12
|
||||
*/
|
||||
JSVM_Status JSVM_CDECL OH_JSVM_IsMap(JSVM_Env env,
|
||||
JSVM_Value value,
|
||||
bool* isMap);
|
||||
|
||||
/**
|
||||
* @brief This API returns a JSVM-API value corresponding to a JavaScript Set type.
|
||||
*
|
||||
* @param env: The environment that the API is invoked under.
|
||||
* @param result: A JSVM_Value representing a JavaScript Set.
|
||||
* @return Returns JSVM function's result code.
|
||||
* {@link JSVM_OK } If the API succeeded.\n
|
||||
* {@link JSVM_INVALID_ARG } If the input parameter is invalid.\n
|
||||
* @since 12
|
||||
*/
|
||||
JSVM_EXTERN JSVM_Status OH_JSVM_CreateSet(JSVM_Env env,
|
||||
JSVM_Value* result);
|
||||
|
||||
/**
|
||||
* @brief This API checks if the value passed in is a Set.
|
||||
*
|
||||
* @param env: The environment that the API is invoked under.
|
||||
* @param value: The JavaScript value to check.
|
||||
* @param isSet: Whether the given value is Set.
|
||||
* @return Returns JSVM function's result code.
|
||||
* {@link JSVM_OK } If the API succeeded.\n
|
||||
* {@link JSVM_INVALID_ARG } If the input parameter is invalid.\n
|
||||
* @since 12
|
||||
*/
|
||||
JSVM_EXTERN JSVM_Status OH_JSVM_IsSet(JSVM_Env env,
|
||||
JSVM_Value value,
|
||||
bool* isSet);
|
||||
|
||||
/**
|
||||
* @brief This function compiles a string of JavaScript code with the compile options
|
||||
* and returns the compiled script.
|
||||
*
|
||||
* @param env: The environment that the JSVM-API call is invoked under.
|
||||
* @param script: A JavaScript string containing the script to be compiled.
|
||||
* @param optionCount: length of option array.
|
||||
* @param options: Compile options to be passed.
|
||||
* @param result: The compiled script.
|
||||
* @return Returns JSVM functions result code
|
||||
* {@link JSVM_OK } if the API succeeded. \n
|
||||
* {@link JSVM_INVALID_ARG } If the input parameter is invalid.\n
|
||||
* @since 12
|
||||
*/
|
||||
JSVM_EXTERN JSVM_Status OH_JSVM_CompileScriptWithOptions(JSVM_Env env,
|
||||
JSVM_Value script,
|
||||
size_t optionCount,
|
||||
JSVM_CompileOptions options[],
|
||||
JSVM_Value* result);
|
||||
|
||||
/**
|
||||
* @brief This API implements the abstract operation ToBigInt().
|
||||
*
|
||||
* @param env: The environment that the API is invoked under.
|
||||
* @param value: The JavaScript value to coerce.
|
||||
* @param result: JSVM_Value representing the coerced JavaScript BigInt.
|
||||
* @return Returns JSVM function's result code.
|
||||
* {@link JSVM_OK } If the API succeeded.
|
||||
* {@link JSVM_INVALID_ARG } If the input parameter is invalid.\n
|
||||
* {@link JSVM_BIGINT_EXPECTED} If the JavaScript value fails to coerce.\n
|
||||
* @since 12
|
||||
*/
|
||||
JSVM_EXTERN JSVM_Status OH_JSVM_CoerceToBigInt(JSVM_Env env,
|
||||
JSVM_Value value,
|
||||
JSVM_Value* result);
|
||||
|
||||
/**
|
||||
* @brief This API checks if the value passed in is a regExp.
|
||||
* This equals to `value instanceof RegExp` in JS.
|
||||
*
|
||||
* @param env: The environment that the API is invoked under.
|
||||
* @param value: The JavaScript value to check.
|
||||
* @param result: Whether the given value is RegExp.
|
||||
* @return Returns JSVM function's result code.
|
||||
* {@link JSVM_OK } If the API succeeded.\n
|
||||
* {@link JSVM_INVALID_ARG } If the input parameter is invalid.\n
|
||||
* @since 12
|
||||
*/
|
||||
JSVM_EXTERN JSVM_Status OH_JSVM_IsRegExp(JSVM_Env env,
|
||||
JSVM_Value value,
|
||||
bool* result);
|
||||
|
||||
EXTERN_C_END
|
||||
|
||||
/** @} */
|
||||
|
@ -44,6 +44,7 @@
|
||||
|
||||
#include <stddef.h> // NOLINT(modernize-deprecated-headers)
|
||||
#include <stdint.h> // NOLINT(modernize-deprecated-headers)
|
||||
#include <stdbool.h> // NOLINT(modernize-deprecated-headers)
|
||||
|
||||
#if !defined __cplusplus || (defined(_MSC_VER) && _MSC_VER < 1900)
|
||||
typedef uint16_t char16_t;
|
||||
@ -376,6 +377,43 @@ typedef enum {
|
||||
JSVM_MEMORY_PRESSURE_LEVEL_CRITICAL,
|
||||
} JSVM_MemoryPressureLevel;
|
||||
|
||||
/**
|
||||
*
|
||||
* @brief Compile mode
|
||||
*
|
||||
* @since 12
|
||||
*/
|
||||
typedef enum {
|
||||
/** default mode. */
|
||||
JSVM_COMPILE_MODE_DEFAULT,
|
||||
/** consume code cache. */
|
||||
JSVM_COMPILE_MODE_CONSUME_CODE_CACHE,
|
||||
/** apply eager compile. */
|
||||
JSVM_COMPILE_MODE_EAGER_COMPILE,
|
||||
/** preset for compile profile. */
|
||||
JSVM_COMPILE_MODE_PRODUCE_COMPILE_PROFILE,
|
||||
/** consume compile profile. */
|
||||
JSVM_COMPILE_MODE_CONSUME_COMPILE_PROFILE,
|
||||
} JSVM_CompileMode;
|
||||
|
||||
/**
|
||||
* @brief Compile option id
|
||||
*
|
||||
* @since 12
|
||||
*/
|
||||
typedef enum {
|
||||
/** compile mode. */
|
||||
JSVM_COMPILE_MODE,
|
||||
/** code cache content. */
|
||||
JSVM_COMPILE_CODE_CACHE,
|
||||
/** script origin. */
|
||||
JSVM_COMPILE_SCRIPT_ORIGIN,
|
||||
/** compile profile content. */
|
||||
JSVM_COMPILE_COMPILE_PROFILE,
|
||||
/** switch for source map support. */
|
||||
JSVM_COMPILE_ENABLE_SOURCE_MAP,
|
||||
} JSVM_CompileOptionId;
|
||||
|
||||
/**
|
||||
* @brief Heap statisics.
|
||||
*
|
||||
@ -615,5 +653,38 @@ typedef struct {
|
||||
/** Resource column offset. */
|
||||
size_t resourceColumnOffset;
|
||||
} JSVM_ScriptOrigin;
|
||||
|
||||
/**
|
||||
* @brief Compile Options
|
||||
*
|
||||
* @since 12
|
||||
*/
|
||||
typedef struct {
|
||||
/** compile option id. */
|
||||
JSVM_CompileOptionId id;
|
||||
/** option content. */
|
||||
union {
|
||||
/** ptr type. */
|
||||
void *ptr;
|
||||
/** int type. */
|
||||
int num;
|
||||
/** bool type. */
|
||||
_Bool boolean;
|
||||
} content;
|
||||
} JSVM_CompileOptions;
|
||||
|
||||
/**
|
||||
* @brief code cache passed with JSVM_COMPILE_CODE_CACHE
|
||||
*
|
||||
* @since 12
|
||||
*/
|
||||
typedef const uint8_t* JSVM_CodeCache;
|
||||
|
||||
/**
|
||||
* @brief compile profile passed with JSVM_COMPILE_COMPILE_PROFILE
|
||||
*
|
||||
* @since 12
|
||||
*/
|
||||
typedef const int* JSVM_CompileProfile;
|
||||
/** @} */
|
||||
#endif /* ARK_RUNTIME_JSVM_JSVM_TYPE_H */
|
||||
|
@ -642,5 +642,33 @@
|
||||
{
|
||||
"first_introduced": "12",
|
||||
"name": "OH_JSVM_Equals"
|
||||
},
|
||||
{
|
||||
"first_introduced": "12",
|
||||
"name": "OH_JSVM_CreateMap"
|
||||
},
|
||||
{
|
||||
"first_introduced": "12",
|
||||
"name": "OH_JSVM_IsMap"
|
||||
},
|
||||
{
|
||||
"first_introduced": "12",
|
||||
"name": "OH_JSVM_CreateSet"
|
||||
},
|
||||
{
|
||||
"first_introduced": "12",
|
||||
"name": "OH_JSVM_IsSet"
|
||||
},
|
||||
{
|
||||
"first_introduced": "12",
|
||||
"name": "OH_JSVM_CompileScriptWithOptions"
|
||||
},
|
||||
{
|
||||
"first_introduced": "12",
|
||||
"name": "OH_JSVM_CoerceToBigInt"
|
||||
},
|
||||
{
|
||||
"first_introduced": "12",
|
||||
"name": "OH_JSVM_IsRegExp"
|
||||
}
|
||||
]
|
||||
|
Loading…
Reference in New Issue
Block a user