Update the webpage (jerryscript.net) (#5203)

JerryScript-DCO-1.0-Signed-off-by: Laszlo Lango laszlo.lango@h-lab.eu
This commit is contained in:
László Langó
2024-12-18 13:45:27 +01:00
committed by GitHub
parent 9192b862c9
commit 493994dd0d
10 changed files with 1201 additions and 384 deletions
+52
View File
@@ -301,6 +301,58 @@ This option is disabled by default.
| CMake: | `-DJERRY_MEM_GC_BEFORE_EACH_ALLOC=ON/OFF` | | CMake: | `-DJERRY_MEM_GC_BEFORE_EACH_ALLOC=ON/OFF` |
| Python: | `--mem-stress-test=ON/OFF` | | Python: | `--mem-stress-test=ON/OFF` |
### MSVC CRT
This option enables the use of the MSVC CRT library and is disabled by default.
| Options | |
|---------|----------------------------------------------|
| C: | `<none>` |
| CMake: | `-DENABLE_STATIC_CRT=ON/OFF` |
| Python: | `--static-crt=ON/OFF` |
### Architecture
Specify the platform name if it is supported by the generator.
| Options | |
|---------|----------------------------------------------|
| C: | `<none>` |
| CMake: | `-A (string)` |
| Python: | `--arch=(string)` |
### Tostring function
Enable function toString.
| Options | |
|---------|----------------------------------------------|
| C: | `-DJERRY_FUNCTION_TO_STRING=0/1` |
| CMake: | `-DJERRY_FUNCTION_TO_STRING=ON/OFF` |
| Python: | `--function-to-string=ON/OFF` |
### VM throw
Enable VM throw.
| Options | |
|---------|----------------------------------------------|
| C: | `-DJERRY_VM_THROW=0/1` |
| CMake: | `-DJERRY_VM_THROW=ON/OFF` |
| Python: | `--vm-throw=ON/OFF` |
### Promise callback
Enable Promise callback.
| Options | |
|---------|----------------------------------------------|
| C: | `-DJERRY_PROMISE_CALLBACK=0/1` |
| CMake: | `-DJERRY_PROMISE_CALLBACK=ON/OFF` |
| Python: | `--promise-callback=ON/OFF` |
# Amalgamated sources # Amalgamated sources
+1063 -303
View File
File diff suppressed because it is too large Load Diff
+7 -12
View File
@@ -14,6 +14,13 @@ permalink: /port-api/
It is questionable whether a library should be able to terminate an application. Any API function can signal an error (ex.: cannot allocate memory), so the engine use the termination approach with this port function. It is questionable whether a library should be able to terminate an application. Any API function can signal an error (ex.: cannot allocate memory), so the engine use the termination approach with this port function.
```c
/**
* Init the program
*/
void jerry_port_init (void);
```
```c ```c
/** /**
* Signal the port that jerry experienced a fatal failure from which it cannot * Signal the port that jerry experienced a fatal failure from which it cannot
@@ -126,18 +133,6 @@ void jerry_port_context_free (void);
void jerry_port_log (const char *message_p); void jerry_port_log (const char *message_p);
``` ```
```c
/**
* Print a single character to standard output.
*
* This port function is never called from jerry-core directly, it is only used by jerry-ext components to print
* information.
*
* @param byte: the byte to print.
*/
void jerry_port_print_byte (jerry_char_t byte);
```
```c ```c
/** /**
* Print a buffer to standard output * Print a buffer to standard output
+5 -3
View File
@@ -110,7 +110,8 @@ typedef jerry_value_t
(*jerry_debugger_wait_for_source_callback_t) (const jerry_char_t *source_name_p, (*jerry_debugger_wait_for_source_callback_t) (const jerry_char_t *source_name_p,
size_t source_name_size, size_t source_name_size,
const jerry_char_t *source_p, const jerry_char_t *source_p,
size_t source_size, void *user_p); size_t source_size,
void *user_p);
``` ```
- `source_name_p` - source (usually a file) name of the source code - `source_name_p` - source (usually a file) name of the source code
@@ -303,7 +304,8 @@ return value of the function.
```c ```c
jerry_debugger_wait_for_source_status_t jerry_debugger_wait_for_source_status_t
jerry_debugger_wait_for_client_source (jerry_debugger_wait_for_source_callback_t callback_p, jerry_debugger_wait_for_client_source (jerry_debugger_wait_for_source_callback_t callback_p,
void *user_p, jerry_value_t *return_value) void *user_p,
jerry_value_t *return_value)
``` ```
**Example** **Example**
@@ -395,7 +397,7 @@ Sends the program's output to the debugger client.
```c ```c
void void
jerry_debugger_send_output (const jerry_char_t *buffer, jerry_size_t string_size) jerry_debugger_send_output (const jerry_char_t *buffer, jerry_size_t str_size)
``` ```
**Example** **Example**
+41 -2
View File
@@ -371,6 +371,28 @@ jerryx_arg_transform_array (const jerry_value_t array_val,
- [jerryx_arg_array](#jerryx_arg_array) - [jerryx_arg_array](#jerryx_arg_array)
## jerryx_arg_transform_optional
**Summary**
The common function to deal with optional arguments. The core transform function is provided by argument `func`.
**Prototype**
```c
jerry_value_t jerryx_arg_transform_optional (jerryx_arg_js_iterator_t *js_arg_iter_p,
const jerryx_arg_t *c_arg_p,
jerryx_arg_transform_func_t func);
```
- `js_arg_iter_p` - the JS arg iterator.
- `c_arg_p` - the native arg.
- `func` - the core transform function.
- return value - a `jerry_value_t` representing `undefined` if all validators passed or an `Error` if a validator failed.
**See also**
- [jerryx_arg_transform_func_t](#jerryx_arg_transform_func_t)
# Helpers for commonly used validations # Helpers for commonly used validations
@@ -587,11 +609,11 @@ User should prepare the `jerryx_arg_object_props_t` instance, and pass it to thi
```c ```c
static inline jerryx_arg_t static inline jerryx_arg_t
jerryx_arg_object_properties (const jerryx_arg_object_props_t *object_props_p, jerryx_arg_object_properties (const jerryx_arg_object_props_t *obj_prop_p,
jerryx_arg_optional_t opt_flag); jerryx_arg_optional_t opt_flag);
``` ```
- return value - the created `jerryx_arg_t` instance. - return value - the created `jerryx_arg_t` instance.
- `object_props_p` - provides information for properties transform. - `obj_prop_p` - provides information for properties transform.
- `opt_flag` - whether the argument is optional. - `opt_flag` - whether the argument is optional.
**Example** **Example**
@@ -764,6 +786,23 @@ my_external_handler (const jerry_value_t function_obj,
# Functions to create custom validations # Functions to create custom validations
## jerryx_arg_ignore
**Summary**
Create a jerryx_arg_t instance for ignored argument.
**Prototype**
```c
static inline jerryx_arg_t jerryx_arg_ignore (void);
```
- return value - the created `jerryx_arg_t` instance.
**See also**
- [jerryx_arg_t](#jerryx_arg_t)
## jerryx_arg_custom ## jerryx_arg_custom
**Summary** **Summary**
+22 -57
View File
@@ -34,7 +34,7 @@ The engine must be initialized before specifying the `jerry_value_t` in the stru
typedef struct { typedef struct {
const char *name; const char *name;
jerry_value_t value; jerry_value_t value;
} jerryx_function_list_entry; } jerryx_property_entry;
``` ```
**See also** **See also**
@@ -262,7 +262,7 @@ For example usage see [jerryx_set_properties](#jerryx_set_properties).
# Common external function handlers # Common external function handlers
## jerryx_handler_assert_fatal ## jerryx_handler_assert
**Summary** **Summary**
@@ -275,12 +275,13 @@ a backtrace is also printed out.
```c ```c
jerry_value_t jerry_value_t
jerryx_handler_assert_fatal (const jerry_value_t func_obj_val, const jerry_value_t this_p, jerryx_handler_assert (const jerry_call_info_t *call_info_p,
const jerry_value_t args_p[], const jerry_length_t args_cnt); const jerry_value_t args_p[],
const jerry_length_t args_cnt);
``` ```
- `func_obj_val` - the function object that was called (unused). - `call_info_p` - pointer to a [jerry_call_info_t](#jerry_call_info_t)
- `this_p` - the `this` value of the call (unused). structure which holds call related information (unused).
- `args_p` - the array of function arguments. - `args_p` - the array of function arguments.
- `args_cnt` - the number of function arguments. - `args_cnt` - the number of function arguments.
- return value - `jerry_value_t` representing boolean true, if only one argument - return value - `jerry_value_t` representing boolean true, if only one argument
@@ -292,43 +293,6 @@ jerryx_handler_assert_fatal (const jerry_value_t func_obj_val, const jerry_value
- [jerryx_register_global](#jerryx_register_global) - [jerryx_register_global](#jerryx_register_global)
## jerryx_handler_assert_throw
**Summary**
Soft assert for scripts. The routine throws an error on assertion failure.
**Prototype**
```c
jerry_value_t
jerryx_handler_assert_throw (const jerry_value_t func_obj_val, const jerry_value_t this_p,
const jerry_value_t args_p[], const jerry_length_t args_cnt);
```
- `func_obj_val` - the function object that was called (unused).
- `this_p` - the `this` value of the call (unused).
- `args_p` - the array of function arguments.
- `args_cnt` - the number of function arguments.
- return value - `jerry_value_t` representing boolean true, if only one argument
was passed and that argument was a boolean true, an error otherwise.
**See also**
- [jerryx_register_global](#jerryx_register_global)
## jerryx_handler_assert
**Summary**
An alias to `jerryx_handler_assert_fatal`.
**See also**
- [jerryx_handler_assert_fatal](#jerryx_handler_assert_fatal)
## jerryx_handler_gc ## jerryx_handler_gc
**Summary** **Summary**
@@ -341,12 +305,13 @@ gc is performed, which is also the default if no parameters passed.
```c ```c
jerry_value_t jerry_value_t
jerryx_handler_gc (const jerry_value_t func_obj_val, const jerry_value_t this_p, jerryx_handler_gc (const jerry_call_info_t *call_info_p,
const jerry_value_t args_p[], const jerry_length_t args_cnt); const jerry_value_t args_p[],
const jerry_length_t args_cnt);
``` ```
- `func_obj_val` - the function object that was called (unused). - `call_info_p` - pointer to a [jerry_call_info_t](#jerry_call_info_t)
- `this_p` - the `this` value of the call (unused). structure which holds call related information (unused).
- `args_p` - the array of function arguments (unused). - `args_p` - the array of function arguments (unused).
- `args_cnt` - the number of function arguments (unused). - `args_cnt` - the number of function arguments (unused).
- return value - `jerry_value_t` representing `undefined`. - return value - `jerry_value_t` representing `undefined`.
@@ -361,26 +326,26 @@ jerryx_handler_gc (const jerry_value_t func_obj_val, const jerry_value_t this_p,
**Summary** **Summary**
Provide a `print` implementation for scripts. The routine converts all of its Provide a `print` implementation for scripts. The routine converts all of its
arguments to strings and outputs them char-by-char using arguments to strings and outputs them by using `jerry_port_print_buffer`.
`jerry_port_print_byte`. The NULL character is output as "\u0000", The NULL character is output as "\u0000", other characters are output bytewise.
other characters are output bytewise.
*Note*: This implementation does not use standard C `printf` to print its *Note*: This implementation does not use standard C `printf` to print its
output. This allows more flexibility but also extends the core JerryScript output. This allows more flexibility but also extends the core JerryScript
engine port API. Applications that want to use `jerryx_handler_print` must engine port API. Applications that want to use `jerryx_handler_print` must
ensure that their port implementation also provides ensure that their port implementation also provides
`jerry_port_print_byte`. `jerry_port_print_buffer`.
**Prototype** **Prototype**
```c ```c
jerry_value_t jerry_value_t
jerryx_handler_print (const jerry_value_t func_obj_val, const jerry_value_t this_p, jerryx_handler_print (const jerry_call_info_t *call_info_p,
const jerry_value_t args_p[], const jerry_length_t args_cnt); const jerry_value_t args_p[],
const jerry_length_t args_cnt);
``` ```
- `func_obj_val` - the function object that was called (unused). - `call_info_p` - pointer to a [jerry_call_info_t](#jerry_call_info_t)
- `this_p` - the `this` value of the call (unused). structure which holds call related information (unused).
- `args_p` - the array of function arguments. - `args_p` - the array of function arguments.
- `args_cnt` - the number of function arguments. - `args_cnt` - the number of function arguments.
- return value - `jerry_value_t` representing `undefined` if all arguments could - return value - `jerry_value_t` representing `undefined` if all arguments could
@@ -389,7 +354,7 @@ jerryx_handler_print (const jerry_value_t func_obj_val, const jerry_value_t this
**See also** **See also**
- [jerryx_register_global](#jerryx_register_global) - [jerryx_register_global](#jerryx_register_global)
- [jerry_port_print_byte](05.PORT-API.md#jerry_port_print_char) - [jerry_port_print_buffer](05.PORT-API.md#jerry_port_print_buffer)
# Handler registration helper # Handler registration helper
@@ -408,7 +373,7 @@ longer needed.
```c ```c
jerry_value_t jerry_value_t
jerryx_register_global (const char *name_p, jerryx_register_global (const char *name_p,
jerry_external_handler_t handler_p); jerry_external_handler_t handler_p);
``` ```
- `name_p` - the name of the function to be registered. - `name_p` - the name of the function to be registered.
+2 -2
View File
@@ -73,7 +73,7 @@ to `jerryx_module_resolve` with a module name whose canonical name matches an al
```c ```c
jerry_value_t jerry_value_t
jerryx_module_resolve (const jerry_value_t name, jerryx_module_resolve (const jerry_value_t name,
const jerryx_module_resolver_t *resolvers_p, const jerryx_module_resolver_t **resolvers_p,
size_t resolver_count); size_t resolver_count);
``` ```
@@ -94,7 +94,7 @@ Remove a module from the current context's cache, or clear the cache entirely.
```c ```c
void void
jerryx_module_clear_cache (const jerry_value_t name, jerryx_module_clear_cache (const jerry_value_t name,
const jerryx_module_resolver_t *resolvers_p, const jerryx_module_resolver_t **resolvers_p,
size_t resolver_count); size_t resolver_count);
``` ```
+6 -3
View File
@@ -87,7 +87,8 @@ the `header_p->next_p->send()` method.
```c ```c
typedef bool (*jerry_debugger_transport_send_t) (struct jerry_debugger_transport_interface_t *header_p, typedef bool (*jerry_debugger_transport_send_t) (struct jerry_debugger_transport_interface_t *header_p,
uint8_t *message_p, size_t message_length); uint8_t *message_p,
size_t message_length);
``` ```
## jerry_debugger_transport_receive_t ## jerry_debugger_transport_receive_t
@@ -117,8 +118,10 @@ will be the first item of the interface chain.
```c ```c
void jerry_debugger_transport_add (jerry_debugger_transport_header_t *header_p, void jerry_debugger_transport_add (jerry_debugger_transport_header_t *header_p,
size_t send_message_header_size, size_t max_send_message_size, size_t send_message_header_size,
size_t receive_message_header_size, size_t max_receive_message_size); size_t max_send_message_size,
size_t receive_message_header_size,
size_t max_receive_message_size);
``` ```
- `header_p`: header of a transportation interface. - `header_p`: header of a transportation interface.
+2 -2
View File
@@ -21,7 +21,7 @@ JerryScript only supports a single nested hierarchy of scopes. There is only one
**Example** **Example**
[doctest]: # (test="compile") [doctest]: # ()
```c ```c
#include "jerryscript.h" #include "jerryscript.h"
@@ -65,7 +65,7 @@ It is necessary in common cases that a handle has to be promote to outer scope a
**Example** **Example**
[doctest]: # (test="compile") [doctest]: # ()
```c ```c
#include "jerryscript.h" #include "jerryscript.h"
+1
View File
@@ -780,3 +780,4 @@ In this section the new API functions are listed.
- [`jerry_port_get_current_context`](05.PORT-API.md#jerry_port_get_current_context) - [`jerry_port_get_current_context`](05.PORT-API.md#jerry_port_get_current_context)
- [`jerry_port_fatal`](05.PORT-API.md#jerry_port_fatal) - [`jerry_port_fatal`](05.PORT-API.md#jerry_port_fatal)
- [`jerry_port_sleep`](05.PORT-API.md#jerry_port_sleep) - [`jerry_port_sleep`](05.PORT-API.md#jerry_port_sleep)
- [`jerry_port_print_byte`](05.PORT-API.md#jerry_port_print_byte)