1425bb815Sopenharmony_ci/* Copyright JS Foundation and other contributors, http://js.foundation
2425bb815Sopenharmony_ci *
3425bb815Sopenharmony_ci * Licensed under the Apache License, Version 2.0 (the "License");
4425bb815Sopenharmony_ci * you may not use this file except in compliance with the License.
5425bb815Sopenharmony_ci * You may obtain a copy of the License at
6425bb815Sopenharmony_ci *
7425bb815Sopenharmony_ci *     http://www.apache.org/licenses/LICENSE-2.0
8425bb815Sopenharmony_ci *
9425bb815Sopenharmony_ci * Unless required by applicable law or agreed to in writing, software
10425bb815Sopenharmony_ci * distributed under the License is distributed on an "AS IS" BASIS
11425bb815Sopenharmony_ci * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
12425bb815Sopenharmony_ci * See the License for the specific language governing permissions and
13425bb815Sopenharmony_ci * limitations under the License.
14425bb815Sopenharmony_ci */
15425bb815Sopenharmony_ci
16425bb815Sopenharmony_ci#ifndef JERRYSCRIPT_CORE_H
17425bb815Sopenharmony_ci#define JERRYSCRIPT_CORE_H
18425bb815Sopenharmony_ci
19425bb815Sopenharmony_ci#include <stdbool.h>
20425bb815Sopenharmony_ci#include <stddef.h>
21425bb815Sopenharmony_ci#include <stdint.h>
22425bb815Sopenharmony_ci
23425bb815Sopenharmony_ci#include "jerryscript-compiler.h"
24425bb815Sopenharmony_ci
25425bb815Sopenharmony_ci#ifdef __cplusplus
26425bb815Sopenharmony_ciextern "C"
27425bb815Sopenharmony_ci{
28425bb815Sopenharmony_ci#endif /* __cplusplus */
29425bb815Sopenharmony_ci
30425bb815Sopenharmony_ci/** \addtogroup jerry Jerry engine interface
31425bb815Sopenharmony_ci * @{
32425bb815Sopenharmony_ci */
33425bb815Sopenharmony_ci
34425bb815Sopenharmony_ci/**
35425bb815Sopenharmony_ci * Major version of JerryScript API.
36425bb815Sopenharmony_ci */
37425bb815Sopenharmony_ci#define JERRY_API_MAJOR_VERSION 2
38425bb815Sopenharmony_ci
39425bb815Sopenharmony_ci/**
40425bb815Sopenharmony_ci * Minor version of JerryScript API.
41425bb815Sopenharmony_ci */
42425bb815Sopenharmony_ci#define JERRY_API_MINOR_VERSION 3
43425bb815Sopenharmony_ci
44425bb815Sopenharmony_ci/**
45425bb815Sopenharmony_ci * Patch version of JerryScript API.
46425bb815Sopenharmony_ci */
47425bb815Sopenharmony_ci#define JERRY_API_PATCH_VERSION 0
48425bb815Sopenharmony_ci
49425bb815Sopenharmony_ci/**
50425bb815Sopenharmony_ci * JerryScript init flags.
51425bb815Sopenharmony_ci */
52425bb815Sopenharmony_citypedef enum
53425bb815Sopenharmony_ci{
54425bb815Sopenharmony_ci  JERRY_INIT_EMPTY               = (0u),      /**< empty flag set */
55425bb815Sopenharmony_ci  JERRY_INIT_SHOW_OPCODES        = (1u << 0), /**< dump byte-code to log after parse */
56425bb815Sopenharmony_ci  JERRY_INIT_SHOW_REGEXP_OPCODES = (1u << 1), /**< dump regexp byte-code to log after compilation */
57425bb815Sopenharmony_ci  JERRY_INIT_MEM_STATS           = (1u << 2), /**< dump memory statistics */
58425bb815Sopenharmony_ci  JERRY_INIT_MEM_STATS_SEPARATE  = (1u << 3), /**< deprecated, an unused placeholder now */
59425bb815Sopenharmony_ci  JERRY_INIT_DEBUGGER            = (1u << 4), /**< deprecated, an unused placeholder now */
60425bb815Sopenharmony_ci} jerry_init_flag_t;
61425bb815Sopenharmony_ci
62425bb815Sopenharmony_ci/**
63425bb815Sopenharmony_ci * JerryScript API Error object types.
64425bb815Sopenharmony_ci */
65425bb815Sopenharmony_citypedef enum
66425bb815Sopenharmony_ci{
67425bb815Sopenharmony_ci  JERRY_ERROR_NONE = 0,  /**< No Error */
68425bb815Sopenharmony_ci
69425bb815Sopenharmony_ci  JERRY_ERROR_COMMON,    /**< Error */
70425bb815Sopenharmony_ci  JERRY_ERROR_EVAL,      /**< EvalError */
71425bb815Sopenharmony_ci  JERRY_ERROR_RANGE,     /**< RangeError */
72425bb815Sopenharmony_ci  JERRY_ERROR_REFERENCE, /**< ReferenceError */
73425bb815Sopenharmony_ci  JERRY_ERROR_SYNTAX,    /**< SyntaxError */
74425bb815Sopenharmony_ci  JERRY_ERROR_TYPE,      /**< TypeError */
75425bb815Sopenharmony_ci  JERRY_ERROR_URI        /**< URIError */
76425bb815Sopenharmony_ci} jerry_error_t;
77425bb815Sopenharmony_ci
78425bb815Sopenharmony_ci/**
79425bb815Sopenharmony_ci * JerryScript feature types.
80425bb815Sopenharmony_ci */
81425bb815Sopenharmony_citypedef enum
82425bb815Sopenharmony_ci{
83425bb815Sopenharmony_ci  JERRY_FEATURE_CPOINTER_32_BIT, /**< 32 bit compressed pointers */
84425bb815Sopenharmony_ci  JERRY_FEATURE_ERROR_MESSAGES, /**< error messages */
85425bb815Sopenharmony_ci  JERRY_FEATURE_JS_PARSER, /**< js-parser */
86425bb815Sopenharmony_ci  JERRY_FEATURE_MEM_STATS, /**< memory statistics */
87425bb815Sopenharmony_ci  JERRY_FEATURE_PARSER_DUMP, /**< parser byte-code dumps */
88425bb815Sopenharmony_ci  JERRY_FEATURE_REGEXP_DUMP, /**< regexp byte-code dumps */
89425bb815Sopenharmony_ci  JERRY_FEATURE_SNAPSHOT_SAVE, /**< saving snapshot files */
90425bb815Sopenharmony_ci  JERRY_FEATURE_SNAPSHOT_EXEC, /**< executing snapshot files */
91425bb815Sopenharmony_ci  JERRY_FEATURE_DEBUGGER, /**< debugging */
92425bb815Sopenharmony_ci  JERRY_FEATURE_VM_EXEC_STOP, /**< stopping ECMAScript execution */
93425bb815Sopenharmony_ci  JERRY_FEATURE_JSON, /**< JSON support */
94425bb815Sopenharmony_ci  JERRY_FEATURE_PROMISE, /**< promise support */
95425bb815Sopenharmony_ci  JERRY_FEATURE_TYPEDARRAY, /**< Typedarray support */
96425bb815Sopenharmony_ci  JERRY_FEATURE_DATE, /**< Date support */
97425bb815Sopenharmony_ci  JERRY_FEATURE_REGEXP, /**< Regexp support */
98425bb815Sopenharmony_ci  JERRY_FEATURE_LINE_INFO, /**< line info available */
99425bb815Sopenharmony_ci  JERRY_FEATURE_LOGGING, /**< logging */
100425bb815Sopenharmony_ci  JERRY_FEATURE_SYMBOL, /**< symbol support */
101425bb815Sopenharmony_ci  JERRY_FEATURE_DATAVIEW, /**< DataView support */
102425bb815Sopenharmony_ci  JERRY_FEATURE_PROXY, /**< Proxy support */
103425bb815Sopenharmony_ci  JERRY_FEATURE_MAP, /**< Map support */
104425bb815Sopenharmony_ci  JERRY_FEATURE_SET, /**< Set support */
105425bb815Sopenharmony_ci  JERRY_FEATURE_WEAKMAP, /**< WeakMap support */
106425bb815Sopenharmony_ci  JERRY_FEATURE_WEAKSET, /**< WeakSet support */
107425bb815Sopenharmony_ci  JERRY_FEATURE__COUNT /**< number of features. NOTE: must be at the end of the list */
108425bb815Sopenharmony_ci} jerry_feature_t;
109425bb815Sopenharmony_ci
110425bb815Sopenharmony_ci/**
111425bb815Sopenharmony_ci * Option flags for jerry_parse and jerry_parse_function functions.
112425bb815Sopenharmony_ci */
113425bb815Sopenharmony_citypedef enum
114425bb815Sopenharmony_ci{
115425bb815Sopenharmony_ci  JERRY_PARSE_NO_OPTS = 0, /**< no options passed */
116425bb815Sopenharmony_ci  JERRY_PARSE_STRICT_MODE = (1 << 0) /**< enable strict mode */
117425bb815Sopenharmony_ci} jerry_parse_opts_t;
118425bb815Sopenharmony_ci
119425bb815Sopenharmony_ci/**
120425bb815Sopenharmony_ci * GC operational modes.
121425bb815Sopenharmony_ci */
122425bb815Sopenharmony_citypedef enum
123425bb815Sopenharmony_ci{
124425bb815Sopenharmony_ci  JERRY_GC_PRESSURE_LOW, /**< free unused objects, but keep memory
125425bb815Sopenharmony_ci                          *   allocated for performance improvements
126425bb815Sopenharmony_ci                          *   such as property hash tables for large objects */
127425bb815Sopenharmony_ci  JERRY_GC_PRESSURE_HIGH /**< free as much memory as possible */
128425bb815Sopenharmony_ci} jerry_gc_mode_t;
129425bb815Sopenharmony_ci
130425bb815Sopenharmony_ci/**
131425bb815Sopenharmony_ci * Jerry regexp flags.
132425bb815Sopenharmony_ci */
133425bb815Sopenharmony_citypedef enum
134425bb815Sopenharmony_ci{
135425bb815Sopenharmony_ci  JERRY_REGEXP_FLAG_GLOBAL = (1u << 1),      /**< Globally scan string */
136425bb815Sopenharmony_ci  JERRY_REGEXP_FLAG_IGNORE_CASE = (1u << 2), /**< Ignore case */
137425bb815Sopenharmony_ci  JERRY_REGEXP_FLAG_MULTILINE = (1u << 3)    /**< Multiline string scan */
138425bb815Sopenharmony_ci} jerry_regexp_flags_t;
139425bb815Sopenharmony_ci
140425bb815Sopenharmony_ci/**
141425bb815Sopenharmony_ci * Character type of JerryScript.
142425bb815Sopenharmony_ci */
143425bb815Sopenharmony_citypedef uint8_t jerry_char_t;
144425bb815Sopenharmony_ci
145425bb815Sopenharmony_ci/**
146425bb815Sopenharmony_ci * Size type of JerryScript.
147425bb815Sopenharmony_ci */
148425bb815Sopenharmony_citypedef uint32_t jerry_size_t;
149425bb815Sopenharmony_ci
150425bb815Sopenharmony_ci/**
151425bb815Sopenharmony_ci * Length type of JerryScript.
152425bb815Sopenharmony_ci */
153425bb815Sopenharmony_citypedef uint32_t jerry_length_t;
154425bb815Sopenharmony_ci
155425bb815Sopenharmony_ci/**
156425bb815Sopenharmony_ci * Description of a JerryScript value.
157425bb815Sopenharmony_ci */
158425bb815Sopenharmony_citypedef uint32_t jerry_value_t;
159425bb815Sopenharmony_ci
160425bb815Sopenharmony_ci/**
161425bb815Sopenharmony_ci * Description of ECMA property descriptor.
162425bb815Sopenharmony_ci */
163425bb815Sopenharmony_citypedef struct
164425bb815Sopenharmony_ci{
165425bb815Sopenharmony_ci  /** Is [[Value]] defined? */
166425bb815Sopenharmony_ci  bool is_value_defined;
167425bb815Sopenharmony_ci
168425bb815Sopenharmony_ci  /** Is [[Get]] defined? */
169425bb815Sopenharmony_ci  bool is_get_defined;
170425bb815Sopenharmony_ci
171425bb815Sopenharmony_ci  /** Is [[Set]] defined? */
172425bb815Sopenharmony_ci  bool is_set_defined;
173425bb815Sopenharmony_ci
174425bb815Sopenharmony_ci  /** Is [[Writable]] defined? */
175425bb815Sopenharmony_ci  bool is_writable_defined;
176425bb815Sopenharmony_ci
177425bb815Sopenharmony_ci  /** [[Writable]] */
178425bb815Sopenharmony_ci  bool is_writable;
179425bb815Sopenharmony_ci
180425bb815Sopenharmony_ci  /** Is [[Enumerable]] defined? */
181425bb815Sopenharmony_ci  bool is_enumerable_defined;
182425bb815Sopenharmony_ci
183425bb815Sopenharmony_ci  /** [[Enumerable]] */
184425bb815Sopenharmony_ci  bool is_enumerable;
185425bb815Sopenharmony_ci
186425bb815Sopenharmony_ci  /** Is [[Configurable]] defined? */
187425bb815Sopenharmony_ci  bool is_configurable_defined;
188425bb815Sopenharmony_ci
189425bb815Sopenharmony_ci  /** [[Configurable]] */
190425bb815Sopenharmony_ci  bool is_configurable;
191425bb815Sopenharmony_ci
192425bb815Sopenharmony_ci  /** [[Value]] */
193425bb815Sopenharmony_ci  jerry_value_t value;
194425bb815Sopenharmony_ci
195425bb815Sopenharmony_ci  /** [[Get]] */
196425bb815Sopenharmony_ci  jerry_value_t getter;
197425bb815Sopenharmony_ci
198425bb815Sopenharmony_ci  /** [[Set]] */
199425bb815Sopenharmony_ci  jerry_value_t setter;
200425bb815Sopenharmony_ci} jerry_property_descriptor_t;
201425bb815Sopenharmony_ci
202425bb815Sopenharmony_ci/**
203425bb815Sopenharmony_ci * Description of JerryScript heap memory stats.
204425bb815Sopenharmony_ci * It is for memory profiling.
205425bb815Sopenharmony_ci */
206425bb815Sopenharmony_citypedef struct
207425bb815Sopenharmony_ci{
208425bb815Sopenharmony_ci  size_t version; /**< the version of the stats struct */
209425bb815Sopenharmony_ci  size_t size; /**< heap total size */
210425bb815Sopenharmony_ci  size_t allocated_bytes; /**< currently allocated bytes */
211425bb815Sopenharmony_ci  size_t peak_allocated_bytes; /**< peak allocated bytes */
212425bb815Sopenharmony_ci  size_t reserved[4]; /**< padding for future extensions */
213425bb815Sopenharmony_ci} jerry_heap_stats_t;
214425bb815Sopenharmony_ci
215425bb815Sopenharmony_ci/**
216425bb815Sopenharmony_ci * Type of an external function handler.
217425bb815Sopenharmony_ci */
218425bb815Sopenharmony_citypedef jerry_value_t (*jerry_external_handler_t) (const jerry_value_t function_obj,
219425bb815Sopenharmony_ci                                                   const jerry_value_t this_val,
220425bb815Sopenharmony_ci                                                   const jerry_value_t args_p[],
221425bb815Sopenharmony_ci                                                   const jerry_length_t args_count);
222425bb815Sopenharmony_ci
223425bb815Sopenharmony_ci/**
224425bb815Sopenharmony_ci * Native free callback of an object.
225425bb815Sopenharmony_ci */
226425bb815Sopenharmony_citypedef void (*jerry_object_native_free_callback_t) (void *native_p);
227425bb815Sopenharmony_ci
228425bb815Sopenharmony_ci/**
229425bb815Sopenharmony_ci * Callback which tells whether the ECMAScript execution should be stopped.
230425bb815Sopenharmony_ci *
231425bb815Sopenharmony_ci * As long as the function returns with undefined the execution continues.
232425bb815Sopenharmony_ci * When a non-undefined value is returned the execution stops and the value
233425bb815Sopenharmony_ci * is thrown by the engine (if the error flag is not set for the returned
234425bb815Sopenharmony_ci * value the engine automatically sets it).
235425bb815Sopenharmony_ci *
236425bb815Sopenharmony_ci * Note: if the function returns with a non-undefined value it
237425bb815Sopenharmony_ci *       must return with the same value for future calls.
238425bb815Sopenharmony_ci */
239425bb815Sopenharmony_citypedef jerry_value_t (*jerry_vm_exec_stop_callback_t) (void *user_p);
240425bb815Sopenharmony_ci
241425bb815Sopenharmony_ci/**
242425bb815Sopenharmony_ci * Function type applied for each data property of an object.
243425bb815Sopenharmony_ci */
244425bb815Sopenharmony_citypedef bool (*jerry_object_property_foreach_t) (const jerry_value_t property_name,
245425bb815Sopenharmony_ci                                                 const jerry_value_t property_value,
246425bb815Sopenharmony_ci                                                 void *user_data_p);
247425bb815Sopenharmony_ci/**
248425bb815Sopenharmony_ci * Function type applied for each object in the engine.
249425bb815Sopenharmony_ci */
250425bb815Sopenharmony_citypedef bool (*jerry_objects_foreach_t) (const jerry_value_t object,
251425bb815Sopenharmony_ci                                         void *user_data_p);
252425bb815Sopenharmony_ci
253425bb815Sopenharmony_ci/**
254425bb815Sopenharmony_ci * Function type applied for each matching object in the engine.
255425bb815Sopenharmony_ci */
256425bb815Sopenharmony_citypedef bool (*jerry_objects_foreach_by_native_info_t) (const jerry_value_t object,
257425bb815Sopenharmony_ci                                                        void *object_data_p,
258425bb815Sopenharmony_ci                                                        void *user_data_p);
259425bb815Sopenharmony_ci
260425bb815Sopenharmony_ci/**
261425bb815Sopenharmony_ci * User context item manager
262425bb815Sopenharmony_ci */
263425bb815Sopenharmony_citypedef struct
264425bb815Sopenharmony_ci{
265425bb815Sopenharmony_ci  /**
266425bb815Sopenharmony_ci   * Callback responsible for initializing a context item, or NULL to zero out the memory. This is called lazily, the
267425bb815Sopenharmony_ci   * first time jerry_get_context_data () is called with this manager.
268425bb815Sopenharmony_ci   *
269425bb815Sopenharmony_ci   * @param [in] data The buffer that JerryScript allocated for the manager. The buffer is zeroed out. The size is
270425bb815Sopenharmony_ci   * determined by the bytes_needed field. The buffer is kept alive until jerry_cleanup () is called.
271425bb815Sopenharmony_ci   */
272425bb815Sopenharmony_ci  void (*init_cb) (void *data);
273425bb815Sopenharmony_ci
274425bb815Sopenharmony_ci  /**
275425bb815Sopenharmony_ci   * Callback responsible for deinitializing a context item, or NULL. This is called as part of jerry_cleanup (),
276425bb815Sopenharmony_ci   * right *before* the VM has been cleaned up. This is a good place to release strong references to jerry_value_t's
277425bb815Sopenharmony_ci   * that the manager may be holding.
278425bb815Sopenharmony_ci   * Note: because the VM has not been fully cleaned up yet, jerry_object_native_info_t free_cb's can still get called
279425bb815Sopenharmony_ci   * *after* all deinit_cb's have been run. See finalize_cb for a callback that is guaranteed to run *after* all
280425bb815Sopenharmony_ci   * free_cb's have been run.
281425bb815Sopenharmony_ci   *
282425bb815Sopenharmony_ci   * @param [in] data The buffer that JerryScript allocated for the manager.
283425bb815Sopenharmony_ci   */
284425bb815Sopenharmony_ci  void (*deinit_cb) (void *data);
285425bb815Sopenharmony_ci
286425bb815Sopenharmony_ci  /**
287425bb815Sopenharmony_ci   * Callback responsible for finalizing a context item, or NULL. This is called as part of jerry_cleanup (),
288425bb815Sopenharmony_ci   * right *after* the VM has been cleaned up and destroyed and jerry_... APIs cannot be called any more. At this point,
289425bb815Sopenharmony_ci   * all values in the VM have been cleaned up. This is a good place to clean up native state that can only be cleaned
290425bb815Sopenharmony_ci   * up at the very end when there are no more VM values around that may need to access that state.
291425bb815Sopenharmony_ci   *
292425bb815Sopenharmony_ci   * @param [in] data The buffer that JerryScript allocated for the manager. After returning from this callback,
293425bb815Sopenharmony_ci   * the data pointer may no longer be used.
294425bb815Sopenharmony_ci   */
295425bb815Sopenharmony_ci  void (*finalize_cb) (void *data);
296425bb815Sopenharmony_ci
297425bb815Sopenharmony_ci  /**
298425bb815Sopenharmony_ci   * Number of bytes to allocate for this manager. This is the size of the buffer that JerryScript will allocate on
299425bb815Sopenharmony_ci   * behalf of the manager. The pointer to this buffer is passed into init_cb, deinit_cb and finalize_cb. It is also
300425bb815Sopenharmony_ci   * returned from the jerry_get_context_data () API.
301425bb815Sopenharmony_ci   */
302425bb815Sopenharmony_ci  size_t bytes_needed;
303425bb815Sopenharmony_ci} jerry_context_data_manager_t;
304425bb815Sopenharmony_ci
305425bb815Sopenharmony_ci/**
306425bb815Sopenharmony_ci * Function type for allocating buffer for JerryScript context.
307425bb815Sopenharmony_ci */
308425bb815Sopenharmony_citypedef void *(*jerry_context_alloc_t) (size_t size, void *cb_data_p);
309425bb815Sopenharmony_ci
310425bb815Sopenharmony_ci/**
311425bb815Sopenharmony_ci * Type information of a native pointer.
312425bb815Sopenharmony_ci */
313425bb815Sopenharmony_citypedef struct
314425bb815Sopenharmony_ci{
315425bb815Sopenharmony_ci  jerry_object_native_free_callback_t free_cb; /**< the free callback of the native pointer */
316425bb815Sopenharmony_ci} jerry_object_native_info_t;
317425bb815Sopenharmony_ci
318425bb815Sopenharmony_ci/**
319425bb815Sopenharmony_ci * An opaque declaration of the JerryScript context structure.
320425bb815Sopenharmony_ci */
321425bb815Sopenharmony_citypedef struct jerry_context_t jerry_context_t;
322425bb815Sopenharmony_ci
323425bb815Sopenharmony_ci/**
324425bb815Sopenharmony_ci * Enum that contains the supported binary operation types
325425bb815Sopenharmony_ci */
326425bb815Sopenharmony_citypedef enum
327425bb815Sopenharmony_ci{
328425bb815Sopenharmony_ci  JERRY_BIN_OP_EQUAL = 0u,    /**< equal comparison (==) */
329425bb815Sopenharmony_ci  JERRY_BIN_OP_STRICT_EQUAL,  /**< strict equal comparison (===) */
330425bb815Sopenharmony_ci  JERRY_BIN_OP_LESS,          /**< less relation (<) */
331425bb815Sopenharmony_ci  JERRY_BIN_OP_LESS_EQUAL,    /**< less or equal relation (<=) */
332425bb815Sopenharmony_ci  JERRY_BIN_OP_GREATER,       /**< greater relation (>) */
333425bb815Sopenharmony_ci  JERRY_BIN_OP_GREATER_EQUAL, /**< greater or equal relation (>=)*/
334425bb815Sopenharmony_ci  JERRY_BIN_OP_INSTANCEOF,    /**< instanceof operation */
335425bb815Sopenharmony_ci  JERRY_BIN_OP_ADD,           /**< addition operator (+) */
336425bb815Sopenharmony_ci  JERRY_BIN_OP_SUB,           /**< subtraction operator (-) */
337425bb815Sopenharmony_ci  JERRY_BIN_OP_MUL,           /**< multiplication operator (*) */
338425bb815Sopenharmony_ci  JERRY_BIN_OP_DIV,           /**< division operator (/) */
339425bb815Sopenharmony_ci  JERRY_BIN_OP_REM,           /**< remainder operator (%) */
340425bb815Sopenharmony_ci} jerry_binary_operation_t;
341425bb815Sopenharmony_ci
342425bb815Sopenharmony_ci/**
343425bb815Sopenharmony_ci * General engine functions.
344425bb815Sopenharmony_ci */
345425bb815Sopenharmony_ci
346425bb815Sopenharmony_ci#ifdef JERRY_FOR_IAR_CONFIG
347425bb815Sopenharmony_cichar* jerry_vla_malloc (uint32_t size);
348425bb815Sopenharmony_civoid jerry_vla_free (char* p);
349425bb815Sopenharmony_ci#endif
350425bb815Sopenharmony_ci
351425bb815Sopenharmony_civoid jerry_init (jerry_init_flag_t flags);
352425bb815Sopenharmony_civoid jerry_cleanup (void);
353425bb815Sopenharmony_civoid jerry_register_magic_strings (const jerry_char_t * const *ex_str_items_p,
354425bb815Sopenharmony_ci                                   uint32_t count,
355425bb815Sopenharmony_ci                                   const jerry_length_t *str_lengths_p);
356425bb815Sopenharmony_civoid jerry_gc (jerry_gc_mode_t mode);
357425bb815Sopenharmony_civoid *jerry_get_context_data (const jerry_context_data_manager_t *manager_p);
358425bb815Sopenharmony_ci
359425bb815Sopenharmony_cibool jerry_get_memory_stats (jerry_heap_stats_t *out_stats_p);
360425bb815Sopenharmony_ci
361425bb815Sopenharmony_ci/**
362425bb815Sopenharmony_ci * Parser and executor functions.
363425bb815Sopenharmony_ci */
364425bb815Sopenharmony_cibool jerry_run_simple (const jerry_char_t *script_source_p, size_t script_source_size, jerry_init_flag_t flags);
365425bb815Sopenharmony_cijerry_value_t jerry_parse (const jerry_char_t *resource_name_p, size_t resource_name_length,
366425bb815Sopenharmony_ci                           const jerry_char_t *source_p, size_t source_size, uint32_t parse_opts);
367425bb815Sopenharmony_cijerry_value_t jerry_parse_function (const jerry_char_t *resource_name_p, size_t resource_name_length,
368425bb815Sopenharmony_ci                                    const jerry_char_t *arg_list_p, size_t arg_list_size,
369425bb815Sopenharmony_ci                                    const jerry_char_t *source_p, size_t source_size, uint32_t parse_opts);
370425bb815Sopenharmony_cijerry_value_t jerry_run (const jerry_value_t func_val);
371425bb815Sopenharmony_cijerry_value_t jerry_eval (const jerry_char_t *source_p, size_t source_size, uint32_t parse_opts);
372425bb815Sopenharmony_ci
373425bb815Sopenharmony_cijerry_value_t jerry_run_all_enqueued_jobs (void);
374425bb815Sopenharmony_ci
375425bb815Sopenharmony_ci/**
376425bb815Sopenharmony_ci * Get the global context.
377425bb815Sopenharmony_ci */
378425bb815Sopenharmony_cijerry_value_t jerry_get_global_object (void);
379425bb815Sopenharmony_ci
380425bb815Sopenharmony_ci/**
381425bb815Sopenharmony_ci * Checker functions of 'jerry_value_t'.
382425bb815Sopenharmony_ci */
383425bb815Sopenharmony_cibool jerry_value_is_abort (const jerry_value_t value);
384425bb815Sopenharmony_cibool jerry_value_is_array (const jerry_value_t value);
385425bb815Sopenharmony_cibool jerry_value_is_boolean (const jerry_value_t value);
386425bb815Sopenharmony_cibool jerry_value_is_constructor (const jerry_value_t value);
387425bb815Sopenharmony_cibool jerry_value_is_error (const jerry_value_t value);
388425bb815Sopenharmony_cibool jerry_value_is_function (const jerry_value_t value);
389425bb815Sopenharmony_cibool jerry_value_is_number (const jerry_value_t value);
390425bb815Sopenharmony_cibool jerry_value_is_null (const jerry_value_t value);
391425bb815Sopenharmony_cibool jerry_value_is_object (const jerry_value_t value);
392425bb815Sopenharmony_cibool jerry_value_is_promise (const jerry_value_t value);
393425bb815Sopenharmony_cibool jerry_value_is_proxy (const jerry_value_t value);
394425bb815Sopenharmony_cibool jerry_value_is_string (const jerry_value_t value);
395425bb815Sopenharmony_cibool jerry_value_is_symbol (const jerry_value_t value);
396425bb815Sopenharmony_cibool jerry_value_is_undefined (const jerry_value_t value);
397425bb815Sopenharmony_ci
398425bb815Sopenharmony_ci/**
399425bb815Sopenharmony_ci * JerryScript API value type information.
400425bb815Sopenharmony_ci */
401425bb815Sopenharmony_citypedef enum
402425bb815Sopenharmony_ci{
403425bb815Sopenharmony_ci  JERRY_TYPE_NONE = 0u, /**< no type information */
404425bb815Sopenharmony_ci  JERRY_TYPE_UNDEFINED, /**< undefined type */
405425bb815Sopenharmony_ci  JERRY_TYPE_NULL,      /**< null type */
406425bb815Sopenharmony_ci  JERRY_TYPE_BOOLEAN,   /**< boolean type */
407425bb815Sopenharmony_ci  JERRY_TYPE_NUMBER,    /**< number type */
408425bb815Sopenharmony_ci  JERRY_TYPE_STRING,    /**< string type */
409425bb815Sopenharmony_ci  JERRY_TYPE_OBJECT,    /**< object type */
410425bb815Sopenharmony_ci  JERRY_TYPE_FUNCTION,  /**< function type */
411425bb815Sopenharmony_ci  JERRY_TYPE_ERROR,     /**< error/abort type */
412425bb815Sopenharmony_ci  JERRY_TYPE_SYMBOL,    /**< symbol type */
413425bb815Sopenharmony_ci} jerry_type_t;
414425bb815Sopenharmony_ci
415425bb815Sopenharmony_cijerry_type_t jerry_value_get_type (const jerry_value_t value);
416425bb815Sopenharmony_ci
417425bb815Sopenharmony_ci/**
418425bb815Sopenharmony_ci * Checker function of whether the specified compile feature is enabled.
419425bb815Sopenharmony_ci */
420425bb815Sopenharmony_cibool jerry_is_feature_enabled (const jerry_feature_t feature);
421425bb815Sopenharmony_ci
422425bb815Sopenharmony_ci/**
423425bb815Sopenharmony_ci * Binary operations
424425bb815Sopenharmony_ci */
425425bb815Sopenharmony_cijerry_value_t jerry_binary_operation (jerry_binary_operation_t op,
426425bb815Sopenharmony_ci                                      const jerry_value_t lhs,
427425bb815Sopenharmony_ci                                      const jerry_value_t rhs);
428425bb815Sopenharmony_ci
429425bb815Sopenharmony_ci/**
430425bb815Sopenharmony_ci * Error manipulation functions.
431425bb815Sopenharmony_ci */
432425bb815Sopenharmony_cijerry_value_t jerry_create_abort_from_value (jerry_value_t value, bool release);
433425bb815Sopenharmony_cijerry_value_t jerry_create_error_from_value (jerry_value_t value, bool release);
434425bb815Sopenharmony_cijerry_value_t jerry_get_value_from_error (jerry_value_t value, bool release);
435425bb815Sopenharmony_ci
436425bb815Sopenharmony_ci/**
437425bb815Sopenharmony_ci * Error object function(s).
438425bb815Sopenharmony_ci */
439425bb815Sopenharmony_cijerry_error_t jerry_get_error_type (jerry_value_t value);
440425bb815Sopenharmony_ci
441425bb815Sopenharmony_ci/**
442425bb815Sopenharmony_ci * Getter functions of 'jerry_value_t'.
443425bb815Sopenharmony_ci */
444425bb815Sopenharmony_cibool jerry_get_boolean_value (const jerry_value_t value);
445425bb815Sopenharmony_cidouble jerry_get_number_value (const jerry_value_t value);
446425bb815Sopenharmony_ci
447425bb815Sopenharmony_ci/**
448425bb815Sopenharmony_ci * Functions for string values.
449425bb815Sopenharmony_ci */
450425bb815Sopenharmony_cijerry_size_t jerry_get_string_size (const jerry_value_t value);
451425bb815Sopenharmony_cijerry_size_t jerry_get_utf8_string_size (const jerry_value_t value);
452425bb815Sopenharmony_cijerry_length_t jerry_get_string_length (const jerry_value_t value);
453425bb815Sopenharmony_cijerry_length_t jerry_get_utf8_string_length (const jerry_value_t value);
454425bb815Sopenharmony_cijerry_size_t jerry_string_to_char_buffer (const jerry_value_t value, jerry_char_t *buffer_p, jerry_size_t buffer_size);
455425bb815Sopenharmony_cijerry_size_t jerry_string_to_utf8_char_buffer (const jerry_value_t value,
456425bb815Sopenharmony_ci                                               jerry_char_t *buffer_p,
457425bb815Sopenharmony_ci                                               jerry_size_t buffer_size);
458425bb815Sopenharmony_cijerry_size_t jerry_substring_to_char_buffer (const jerry_value_t value,
459425bb815Sopenharmony_ci                                             jerry_length_t start_pos,
460425bb815Sopenharmony_ci                                             jerry_length_t end_pos,
461425bb815Sopenharmony_ci                                             jerry_char_t *buffer_p,
462425bb815Sopenharmony_ci                                             jerry_size_t buffer_size);
463425bb815Sopenharmony_cijerry_size_t jerry_substring_to_utf8_char_buffer (const jerry_value_t value,
464425bb815Sopenharmony_ci                                                  jerry_length_t start_pos,
465425bb815Sopenharmony_ci                                                  jerry_length_t end_pos,
466425bb815Sopenharmony_ci                                                  jerry_char_t *buffer_p,
467425bb815Sopenharmony_ci                                                  jerry_size_t buffer_size);
468425bb815Sopenharmony_ci
469425bb815Sopenharmony_ci/**
470425bb815Sopenharmony_ci * Functions for array object values.
471425bb815Sopenharmony_ci */
472425bb815Sopenharmony_ciuint32_t jerry_get_array_length (const jerry_value_t value);
473425bb815Sopenharmony_ci
474425bb815Sopenharmony_ci/**
475425bb815Sopenharmony_ci * Converters of 'jerry_value_t'.
476425bb815Sopenharmony_ci */
477425bb815Sopenharmony_cibool jerry_value_to_boolean (const jerry_value_t value);
478425bb815Sopenharmony_cijerry_value_t jerry_value_to_number (const jerry_value_t value);
479425bb815Sopenharmony_cijerry_value_t jerry_value_to_object (const jerry_value_t value);
480425bb815Sopenharmony_cijerry_value_t jerry_value_to_primitive (const jerry_value_t value);
481425bb815Sopenharmony_cijerry_value_t jerry_value_to_string (const jerry_value_t value);
482425bb815Sopenharmony_ci
483425bb815Sopenharmony_ci/**
484425bb815Sopenharmony_ci * Acquire types with reference counter (increase the references).
485425bb815Sopenharmony_ci */
486425bb815Sopenharmony_cijerry_value_t jerry_acquire_value (jerry_value_t value);
487425bb815Sopenharmony_ci
488425bb815Sopenharmony_ci/**
489425bb815Sopenharmony_ci * Release the referenced values.
490425bb815Sopenharmony_ci */
491425bb815Sopenharmony_civoid jerry_release_value (jerry_value_t value);
492425bb815Sopenharmony_ci
493425bb815Sopenharmony_ci/**
494425bb815Sopenharmony_ci * Create functions of API values.
495425bb815Sopenharmony_ci */
496425bb815Sopenharmony_cijerry_value_t jerry_create_array (uint32_t size);
497425bb815Sopenharmony_cijerry_value_t jerry_create_boolean (bool value);
498425bb815Sopenharmony_cijerry_value_t jerry_create_error (jerry_error_t error_type, const jerry_char_t *message_p);
499425bb815Sopenharmony_cijerry_value_t jerry_create_error_sz (jerry_error_t error_type, const jerry_char_t *message_p,
500425bb815Sopenharmony_ci                                     jerry_size_t message_size);
501425bb815Sopenharmony_cijerry_value_t jerry_create_external_function (jerry_external_handler_t handler_p);
502425bb815Sopenharmony_cijerry_value_t jerry_create_number (double value);
503425bb815Sopenharmony_cijerry_value_t jerry_create_number_infinity (bool sign);
504425bb815Sopenharmony_cijerry_value_t jerry_create_number_nan (void);
505425bb815Sopenharmony_cijerry_value_t jerry_create_null (void);
506425bb815Sopenharmony_cijerry_value_t jerry_create_object (void);
507425bb815Sopenharmony_cijerry_value_t jerry_create_promise (void);
508425bb815Sopenharmony_cijerry_value_t jerry_create_proxy (const jerry_value_t target, const jerry_value_t handler);
509425bb815Sopenharmony_cijerry_value_t jerry_create_regexp (const jerry_char_t *pattern, uint16_t flags);
510425bb815Sopenharmony_cijerry_value_t jerry_create_regexp_sz (const jerry_char_t *pattern, jerry_size_t pattern_size, uint16_t flags);
511425bb815Sopenharmony_cijerry_value_t jerry_create_string_from_utf8 (const jerry_char_t *str_p);
512425bb815Sopenharmony_cijerry_value_t jerry_create_string_sz_from_utf8 (const jerry_char_t *str_p, jerry_size_t str_size);
513425bb815Sopenharmony_cijerry_value_t jerry_create_string (const jerry_char_t *str_p);
514425bb815Sopenharmony_cijerry_value_t jerry_create_string_sz (const jerry_char_t *str_p, jerry_size_t str_size);
515425bb815Sopenharmony_cijerry_value_t jerry_create_symbol (const jerry_value_t value);
516425bb815Sopenharmony_cijerry_value_t jerry_create_undefined (void);
517425bb815Sopenharmony_ci
518425bb815Sopenharmony_ci/**
519425bb815Sopenharmony_ci * General API functions of JS objects.
520425bb815Sopenharmony_ci */
521425bb815Sopenharmony_cijerry_value_t jerry_has_property (const jerry_value_t obj_val, const jerry_value_t prop_name_val);
522425bb815Sopenharmony_cijerry_value_t jerry_has_own_property (const jerry_value_t obj_val, const jerry_value_t prop_name_val);
523425bb815Sopenharmony_cibool jerry_has_internal_property (const jerry_value_t obj_val, const jerry_value_t prop_name_val);
524425bb815Sopenharmony_cibool jerry_delete_property (const jerry_value_t obj_val, const jerry_value_t prop_name_val);
525425bb815Sopenharmony_cibool jerry_delete_property_by_index (const jerry_value_t obj_val, uint32_t index);
526425bb815Sopenharmony_cibool jerry_delete_internal_property (const jerry_value_t obj_val, const jerry_value_t prop_name_val);
527425bb815Sopenharmony_ci
528425bb815Sopenharmony_cijerry_value_t jerry_get_property (const jerry_value_t obj_val, const jerry_value_t prop_name_val);
529425bb815Sopenharmony_cijerry_value_t jerry_get_property_by_index (const jerry_value_t obj_val, uint32_t index);
530425bb815Sopenharmony_cijerry_value_t jerry_get_internal_property (const jerry_value_t obj_val, const jerry_value_t prop_name_val);
531425bb815Sopenharmony_cijerry_value_t jerry_set_property (const jerry_value_t obj_val, const jerry_value_t prop_name_val,
532425bb815Sopenharmony_ci                                  const jerry_value_t value_to_set);
533425bb815Sopenharmony_cijerry_value_t jerry_set_property_by_index (const jerry_value_t obj_val, uint32_t index,
534425bb815Sopenharmony_ci                                           const jerry_value_t value_to_set);
535425bb815Sopenharmony_cibool jerry_set_internal_property (const jerry_value_t obj_val, const jerry_value_t prop_name_val,
536425bb815Sopenharmony_ci                                  const jerry_value_t value_to_set);
537425bb815Sopenharmony_ci
538425bb815Sopenharmony_civoid jerry_init_property_descriptor_fields (jerry_property_descriptor_t *prop_desc_p);
539425bb815Sopenharmony_cijerry_value_t jerry_define_own_property (const jerry_value_t obj_val,
540425bb815Sopenharmony_ci                                         const jerry_value_t prop_name_val,
541425bb815Sopenharmony_ci                                         const jerry_property_descriptor_t *prop_desc_p);
542425bb815Sopenharmony_ci
543425bb815Sopenharmony_cibool jerry_get_own_property_descriptor (const jerry_value_t obj_val,
544425bb815Sopenharmony_ci                                        const jerry_value_t prop_name_val,
545425bb815Sopenharmony_ci                                        jerry_property_descriptor_t *prop_desc_p);
546425bb815Sopenharmony_civoid jerry_free_property_descriptor_fields (const jerry_property_descriptor_t *prop_desc_p);
547425bb815Sopenharmony_ci
548425bb815Sopenharmony_cijerry_value_t jerry_call_function (const jerry_value_t func_obj_val, const jerry_value_t this_val,
549425bb815Sopenharmony_ci                                   const jerry_value_t args_p[], jerry_size_t args_count);
550425bb815Sopenharmony_cijerry_value_t jerry_construct_object (const jerry_value_t func_obj_val, const jerry_value_t args_p[],
551425bb815Sopenharmony_ci                                      jerry_size_t args_count);
552425bb815Sopenharmony_ci
553425bb815Sopenharmony_cijerry_value_t jerry_get_object_keys (const jerry_value_t obj_val);
554425bb815Sopenharmony_cijerry_value_t jerry_get_prototype (const jerry_value_t obj_val);
555425bb815Sopenharmony_cijerry_value_t jerry_set_prototype (const jerry_value_t obj_val, const jerry_value_t proto_obj_val);
556425bb815Sopenharmony_ci
557425bb815Sopenharmony_cibool jerry_get_object_native_pointer (const jerry_value_t obj_val,
558425bb815Sopenharmony_ci                                      void **out_native_pointer_p,
559425bb815Sopenharmony_ci                                      const jerry_object_native_info_t *native_pointer_info_p);
560425bb815Sopenharmony_civoid jerry_set_object_native_pointer (const jerry_value_t obj_val,
561425bb815Sopenharmony_ci                                      void *native_pointer_p,
562425bb815Sopenharmony_ci                                      const jerry_object_native_info_t *native_info_p);
563425bb815Sopenharmony_cibool jerry_delete_object_native_pointer (const jerry_value_t obj_val,
564425bb815Sopenharmony_ci                                         const jerry_object_native_info_t *native_info_p);
565425bb815Sopenharmony_ci
566425bb815Sopenharmony_cibool jerry_objects_foreach (jerry_objects_foreach_t foreach_p,
567425bb815Sopenharmony_ci                            void *user_data);
568425bb815Sopenharmony_cibool jerry_objects_foreach_by_native_info (const jerry_object_native_info_t *native_info_p,
569425bb815Sopenharmony_ci                                           jerry_objects_foreach_by_native_info_t foreach_p,
570425bb815Sopenharmony_ci                                           void *user_data_p);
571425bb815Sopenharmony_ci
572425bb815Sopenharmony_cibool jerry_foreach_object_property (const jerry_value_t obj_val, jerry_object_property_foreach_t foreach_p,
573425bb815Sopenharmony_ci                                    void *user_data_p);
574425bb815Sopenharmony_ci
575425bb815Sopenharmony_ci/**
576425bb815Sopenharmony_ci * Promise functions.
577425bb815Sopenharmony_ci */
578425bb815Sopenharmony_cijerry_value_t jerry_resolve_or_reject_promise (jerry_value_t promise, jerry_value_t argument, bool is_resolve);
579425bb815Sopenharmony_ci
580425bb815Sopenharmony_ci/**
581425bb815Sopenharmony_ci * Enum values representing various Promise states.
582425bb815Sopenharmony_ci */
583425bb815Sopenharmony_citypedef enum
584425bb815Sopenharmony_ci{
585425bb815Sopenharmony_ci  JERRY_PROMISE_STATE_NONE = 0u, /**< Invalid/Unknown state (possibly called on a non-promise object). */
586425bb815Sopenharmony_ci  JERRY_PROMISE_STATE_PENDING,   /**< Promise is in "Pending" state. */
587425bb815Sopenharmony_ci  JERRY_PROMISE_STATE_FULFILLED, /**< Promise is in "Fulfilled" state. */
588425bb815Sopenharmony_ci  JERRY_PROMISE_STATE_REJECTED,  /**< Promise is in "Rejected" state. */
589425bb815Sopenharmony_ci} jerry_promise_state_t;
590425bb815Sopenharmony_ci
591425bb815Sopenharmony_cijerry_value_t jerry_get_promise_result (const jerry_value_t promise);
592425bb815Sopenharmony_cijerry_promise_state_t jerry_get_promise_state (const jerry_value_t promise);
593425bb815Sopenharmony_ci
594425bb815Sopenharmony_ci/**
595425bb815Sopenharmony_ci * Symbol functions.
596425bb815Sopenharmony_ci */
597425bb815Sopenharmony_cijerry_value_t jerry_get_symbol_descriptive_string (const jerry_value_t symbol);
598425bb815Sopenharmony_ci
599425bb815Sopenharmony_ci/**
600425bb815Sopenharmony_ci * Input validator functions.
601425bb815Sopenharmony_ci */
602425bb815Sopenharmony_cibool jerry_is_valid_utf8_string (const jerry_char_t *utf8_buf_p, jerry_size_t buf_size);
603425bb815Sopenharmony_cibool jerry_is_valid_cesu8_string (const jerry_char_t *cesu8_buf_p, jerry_size_t buf_size);
604425bb815Sopenharmony_ci
605425bb815Sopenharmony_ci/*
606425bb815Sopenharmony_ci * Dynamic memory management functions.
607425bb815Sopenharmony_ci */
608425bb815Sopenharmony_civoid *jerry_heap_alloc (size_t size);
609425bb815Sopenharmony_civoid jerry_heap_free (void *mem_p, size_t size);
610425bb815Sopenharmony_ci
611425bb815Sopenharmony_ci/*
612425bb815Sopenharmony_ci * External context functions.
613425bb815Sopenharmony_ci */
614425bb815Sopenharmony_cijerry_context_t *jerry_create_context (uint32_t heap_size, jerry_context_alloc_t alloc, void *cb_data_p);
615425bb815Sopenharmony_ci
616425bb815Sopenharmony_ci/**
617425bb815Sopenharmony_ci * Miscellaneous functions.
618425bb815Sopenharmony_ci */
619425bb815Sopenharmony_civoid jerry_set_vm_exec_stop_callback (jerry_vm_exec_stop_callback_t stop_cb, void *user_p, uint32_t frequency);
620425bb815Sopenharmony_cijerry_value_t jerry_get_backtrace (uint32_t max_depth);
621425bb815Sopenharmony_cijerry_value_t jerry_get_resource_name (const jerry_value_t value);
622425bb815Sopenharmony_cijerry_value_t jerry_get_new_target (void);
623425bb815Sopenharmony_ci
624425bb815Sopenharmony_ci/**
625425bb815Sopenharmony_ci * Array buffer components.
626425bb815Sopenharmony_ci */
627425bb815Sopenharmony_cibool jerry_value_is_arraybuffer (const jerry_value_t value);
628425bb815Sopenharmony_cijerry_value_t jerry_create_arraybuffer (const jerry_length_t size);
629425bb815Sopenharmony_cijerry_value_t jerry_create_arraybuffer_external (const jerry_length_t size,
630425bb815Sopenharmony_ci                                                 uint8_t *buffer_p,
631425bb815Sopenharmony_ci                                                 jerry_object_native_free_callback_t free_cb);
632425bb815Sopenharmony_cijerry_length_t jerry_arraybuffer_write (const jerry_value_t value,
633425bb815Sopenharmony_ci                                        jerry_length_t offset,
634425bb815Sopenharmony_ci                                        const uint8_t *buf_p,
635425bb815Sopenharmony_ci                                        jerry_length_t buf_size);
636425bb815Sopenharmony_cijerry_length_t jerry_arraybuffer_read (const jerry_value_t value,
637425bb815Sopenharmony_ci                                       jerry_length_t offset,
638425bb815Sopenharmony_ci                                       uint8_t *buf_p,
639425bb815Sopenharmony_ci                                       jerry_length_t buf_size);
640425bb815Sopenharmony_cijerry_length_t jerry_get_arraybuffer_byte_length (const jerry_value_t value);
641425bb815Sopenharmony_ciuint8_t *jerry_get_arraybuffer_pointer (const jerry_value_t value);
642425bb815Sopenharmony_cijerry_value_t jerry_is_arraybuffer_detachable (const jerry_value_t value);
643425bb815Sopenharmony_cijerry_value_t jerry_detach_arraybuffer (const jerry_value_t value);
644425bb815Sopenharmony_ci
645425bb815Sopenharmony_ci/**
646425bb815Sopenharmony_ci * DataView functions.
647425bb815Sopenharmony_ci */
648425bb815Sopenharmony_cijerry_value_t
649425bb815Sopenharmony_cijerry_create_dataview (const jerry_value_t value,
650425bb815Sopenharmony_ci                       const jerry_length_t byte_offset,
651425bb815Sopenharmony_ci                       const jerry_length_t byte_length);
652425bb815Sopenharmony_ci
653425bb815Sopenharmony_cibool
654425bb815Sopenharmony_cijerry_value_is_dataview (const jerry_value_t value);
655425bb815Sopenharmony_ci
656425bb815Sopenharmony_cijerry_value_t
657425bb815Sopenharmony_cijerry_get_dataview_buffer (const jerry_value_t dataview,
658425bb815Sopenharmony_ci                           jerry_length_t *byte_offset,
659425bb815Sopenharmony_ci                           jerry_length_t *byte_length);
660425bb815Sopenharmony_ci
661425bb815Sopenharmony_ci/**
662425bb815Sopenharmony_ci * TypedArray functions.
663425bb815Sopenharmony_ci */
664425bb815Sopenharmony_ci
665425bb815Sopenharmony_ci/**
666425bb815Sopenharmony_ci * TypedArray types.
667425bb815Sopenharmony_ci */
668425bb815Sopenharmony_citypedef enum
669425bb815Sopenharmony_ci{
670425bb815Sopenharmony_ci  JERRY_TYPEDARRAY_INVALID = 0,
671425bb815Sopenharmony_ci  JERRY_TYPEDARRAY_UINT8,
672425bb815Sopenharmony_ci  JERRY_TYPEDARRAY_UINT8CLAMPED,
673425bb815Sopenharmony_ci  JERRY_TYPEDARRAY_INT8,
674425bb815Sopenharmony_ci  JERRY_TYPEDARRAY_UINT16,
675425bb815Sopenharmony_ci  JERRY_TYPEDARRAY_INT16,
676425bb815Sopenharmony_ci  JERRY_TYPEDARRAY_UINT32,
677425bb815Sopenharmony_ci  JERRY_TYPEDARRAY_INT32,
678425bb815Sopenharmony_ci  JERRY_TYPEDARRAY_FLOAT32,
679425bb815Sopenharmony_ci  JERRY_TYPEDARRAY_FLOAT64,
680425bb815Sopenharmony_ci} jerry_typedarray_type_t;
681425bb815Sopenharmony_ci
682425bb815Sopenharmony_ci/**
683425bb815Sopenharmony_ci * Container types.
684425bb815Sopenharmony_ci */
685425bb815Sopenharmony_citypedef enum
686425bb815Sopenharmony_ci{
687425bb815Sopenharmony_ci  JERRY_CONTAINER_TYPE_INVALID = 0, /**< Invalid container */
688425bb815Sopenharmony_ci  JERRY_CONTAINER_TYPE_MAP, /**< Map type */
689425bb815Sopenharmony_ci  JERRY_CONTAINER_TYPE_SET, /**< Set type */
690425bb815Sopenharmony_ci  JERRY_CONTAINER_TYPE_WEAKMAP, /**< WeakMap type */
691425bb815Sopenharmony_ci  JERRY_CONTAINER_TYPE_WEAKSET, /**< WeakSet type */
692425bb815Sopenharmony_ci} jerry_container_type_t;
693425bb815Sopenharmony_ci
694425bb815Sopenharmony_cibool jerry_value_is_typedarray (jerry_value_t value);
695425bb815Sopenharmony_cijerry_value_t jerry_create_typedarray (jerry_typedarray_type_t type_name, jerry_length_t length);
696425bb815Sopenharmony_cijerry_value_t jerry_create_typedarray_for_arraybuffer_sz (jerry_typedarray_type_t type_name,
697425bb815Sopenharmony_ci                                                          const jerry_value_t arraybuffer,
698425bb815Sopenharmony_ci                                                          jerry_length_t byte_offset,
699425bb815Sopenharmony_ci                                                          jerry_length_t length);
700425bb815Sopenharmony_cijerry_value_t jerry_create_typedarray_for_arraybuffer (jerry_typedarray_type_t type_name,
701425bb815Sopenharmony_ci                                                       const jerry_value_t arraybuffer);
702425bb815Sopenharmony_cijerry_typedarray_type_t jerry_get_typedarray_type (jerry_value_t value);
703425bb815Sopenharmony_cijerry_length_t jerry_get_typedarray_length (jerry_value_t value);
704425bb815Sopenharmony_cijerry_value_t jerry_get_typedarray_buffer (jerry_value_t value,
705425bb815Sopenharmony_ci                                           jerry_length_t *byte_offset,
706425bb815Sopenharmony_ci                                           jerry_length_t *byte_length);
707425bb815Sopenharmony_cijerry_value_t jerry_json_parse (const jerry_char_t *string_p, jerry_size_t string_size);
708425bb815Sopenharmony_cijerry_value_t jerry_json_stringify (const jerry_value_t object_to_stringify);
709425bb815Sopenharmony_cijerry_value_t jerry_create_container (jerry_container_type_t container_type,
710425bb815Sopenharmony_ci                                      const jerry_value_t *arguments_list_p,
711425bb815Sopenharmony_ci                                      jerry_length_t arguments_list_len);
712425bb815Sopenharmony_cijerry_container_type_t jerry_get_container_type (const jerry_value_t value);
713425bb815Sopenharmony_ci
714425bb815Sopenharmony_ci#if defined(JERRY_HEAPDUMP)
715425bb815Sopenharmony_civoid JerryHeapdumpRun(const char* filepath);
716425bb815Sopenharmony_ci#endif
717425bb815Sopenharmony_ci
718425bb815Sopenharmony_ci#if defined(JERRY_REF_TRACKER)
719425bb815Sopenharmony_civoid JerryRefTrackerStart(const char* filepath);
720425bb815Sopenharmony_civoid JerryRefTrackerStop(void);
721425bb815Sopenharmony_ci#endif
722425bb815Sopenharmony_ci
723425bb815Sopenharmony_ci/**
724425bb815Sopenharmony_ci * @}
725425bb815Sopenharmony_ci */
726425bb815Sopenharmony_ci
727425bb815Sopenharmony_ci#ifdef __cplusplus
728425bb815Sopenharmony_ci}
729425bb815Sopenharmony_ci#endif /* __cplusplus */
730425bb815Sopenharmony_ci#endif /* !JERRYSCRIPT_CORE_H */
731