Update the webpage (#1593)
JerryScript-DCO-1.0-Signed-off-by: Zsolt Borbély zsborbely.u-szeged@partner.samsung.com
This commit is contained in:
+169
-6
@@ -18,6 +18,7 @@ Enum that contains the following elements:
|
||||
- JERRY_INIT_SHOW_REGEXP_OPCODES - dump regexp byte-code to log after compilation
|
||||
- JERRY_INIT_MEM_STATS - dump memory statistics
|
||||
- JERRY_INIT_MEM_STATS_SEPARATE - dump memory statistics and reset peak values after parse
|
||||
- JERRY_INIT_DEBUGGER - enable all features required by debugging
|
||||
|
||||
## jerry_error_t
|
||||
|
||||
@@ -220,6 +221,7 @@ jerry_init (jerry_init_flag_t flags)
|
||||
- `JERRY_INIT_SHOW_REGEXP_OPCODES` - print compiled regexp byte-code.
|
||||
- `JERRY_INIT_MEM_STATS` - dump memory statistics.
|
||||
- `JERRY_INIT_MEM_STATS_SEPARATE` - dump memory statistics and reset peak values after parse.
|
||||
- `JERRY_INIT_DEBUGGER` - enable all features required by debugging.
|
||||
|
||||
**Example**
|
||||
|
||||
@@ -460,6 +462,40 @@ jerry_parse (const jerry_char_t *source_p,
|
||||
|
||||
- [jerry_run](#jerryrun)
|
||||
|
||||
## jerry_parse_named_resource
|
||||
|
||||
**Summary**
|
||||
|
||||
Parse script and construct an ECMAScript function. The lexical
|
||||
environment is set to the global lexical environment. The name
|
||||
(usually a file name) is also passed to this function which is
|
||||
used by the debugger to find the source code.
|
||||
|
||||
*Note*: The returned value must be freed with [jerry_release_value](#jerryreleasevalue) when it
|
||||
is no longer needed.
|
||||
|
||||
**Prototype**
|
||||
|
||||
```c
|
||||
jerry_value_t
|
||||
jerry_parse_named_resource (const jerry_char_t *name_p, /**< name (usually a file name) */
|
||||
size_t name_length, /**< length of name */
|
||||
const jerry_char_t *source_p, /**< script source */
|
||||
size_t source_size, /**< script source size */
|
||||
bool is_strict) /**< strict mode */
|
||||
{
|
||||
```
|
||||
|
||||
- `name_p` - name, usually a file name
|
||||
- `name_length` - size of the file name, in bytes
|
||||
- `source_p` - string, containing source code to parse. It must be a valid UTF8 string
|
||||
- `source_size` - size of the string, in bytes
|
||||
- `is_strict` - defines strict mode
|
||||
- return value
|
||||
- function object value, if script was parsed successfully,
|
||||
- thrown error, otherwise
|
||||
|
||||
This function is identical to [jerry_parse](#jerryparse), except that an additional filename parameter has been added.
|
||||
|
||||
## jerry_run
|
||||
|
||||
@@ -1206,6 +1242,7 @@ jerry_get_string_size (const jerry_value_t value);
|
||||
|
||||
- [jerry_create_string](#jerrycreatestring)
|
||||
- [jerry_get_string_length](#jerrygetstringlength)
|
||||
- [jerry_is_valid_cesu8_string](#jerryisvalidcesu8string)
|
||||
|
||||
|
||||
## jerry_get_utf8_string_size
|
||||
@@ -1245,6 +1282,8 @@ jerry_get_utf8_string_size (const jerry_value_t value);
|
||||
|
||||
- [jerry_create_string_from_utf8](#jerrycreatestringfromutf8)
|
||||
- [jerry_get_utf8_string_length](#jerrygetutf8stringlength)
|
||||
- [jerry_is_valid_utf8_string](#jerryisvalidutf8string)
|
||||
|
||||
|
||||
## jerry_get_string_length
|
||||
|
||||
@@ -1281,6 +1320,8 @@ jerry_get_string_length (const jerry_value_t value);
|
||||
|
||||
- [jerry_create_string](#jerrycreatestring)
|
||||
- [jerry_get_string_size](#jerrygetstringsize)
|
||||
- [jerry_is_valid_cesu8_string](#jerryisvalidcesu8string)
|
||||
|
||||
|
||||
## jerry_get_utf8_string_length
|
||||
|
||||
@@ -1320,15 +1361,20 @@ jerry_get_utf8_string_length (const jerry_value_t value);
|
||||
|
||||
- [jerry_create_string_from_utf8](#jerrycreatestringfromutf8)
|
||||
- [jerry_get_utf8_string_size](#jerrygetutf8stringsize)
|
||||
- [jerry_is_valid_utf8_string](#jerryisvalidutf8string)
|
||||
|
||||
|
||||
## jerry_string_to_char_buffer
|
||||
|
||||
**Summary**
|
||||
|
||||
Copy the characters of a string into a specified buffer. The
|
||||
'\0' character could occur in character buffer. Returns 0,
|
||||
if the value parameter is not a string or the buffer is
|
||||
not large enough for the whole string.
|
||||
Copy the characters of a string into a specified cesu-8 buffer.
|
||||
The '\0' character could occur in the character buffer. Returns 0,
|
||||
if the value parameter is not a string or the buffer is not large
|
||||
enough for the whole string.
|
||||
|
||||
*Note*: Does not put '\0' to the end of string, the return value identifies
|
||||
the number of valid bytes in the output buffer.
|
||||
|
||||
**Prototype**
|
||||
|
||||
@@ -1364,6 +1410,8 @@ jerry_string_to_char_buffer (const jerry_value_t value,
|
||||
|
||||
- [jerry_create_string](#jerrycreatestring)
|
||||
- [jerry_get_string_size](#jerrygetstringsize)
|
||||
- [jerry_is_valid_cesu8_string](#jerryisvalidcesu8string)
|
||||
|
||||
|
||||
## jerry_string_to_utf8_char_buffer
|
||||
|
||||
@@ -1371,9 +1419,12 @@ jerry_string_to_char_buffer (const jerry_value_t value,
|
||||
|
||||
Copy the characters of a string into a specified utf-8 buffer.
|
||||
The '\0' character could occur in character buffer. Returns 0,
|
||||
if the value parameter is not a string or the buffer isn't
|
||||
if the value parameter is not a string or the buffer is not
|
||||
large enough for the whole string.
|
||||
|
||||
*Note*: Does not put '\0' to the end of string, the return value identifies
|
||||
the number of valid bytes in the output buffer.
|
||||
|
||||
**Prototype**
|
||||
|
||||
```c
|
||||
@@ -1408,6 +1459,8 @@ jerry_string_to_utf8_char_buffer (const jerry_value_t value,
|
||||
|
||||
- [jerry_create_string_from_utf8](#jerrycreatestringfromutf8)
|
||||
- [jerry_get_utf8_string_size](#jerrygetutf8stringsize)
|
||||
- [jerry_is_valid_utf8_string](#jerryisvalidutf8string)
|
||||
|
||||
|
||||
## jerry_substring_to_char_buffer
|
||||
|
||||
@@ -1419,6 +1472,9 @@ parameter is not a string. It will extract the substring between the
|
||||
specified start position and the end position (or the end of the string,
|
||||
whichever comes first).
|
||||
|
||||
*Note*: Does not put '\0' to the end of string, the return value identifies
|
||||
the number of valid bytes in the output buffer.
|
||||
|
||||
**Prototype**
|
||||
|
||||
```c
|
||||
@@ -1460,6 +1516,8 @@ jerry_substring_to_char_buffer (const jerry_value_t value,
|
||||
- [jerry_create_string](#jerrycreatestring)
|
||||
- [jerry_get_string_size](#jerrygetstringsize)
|
||||
- [jerry_get_string_length](#jerrygetstringlength)
|
||||
- [jerry_is_valid_cesu8_string](#jerryisvalidcesu8string)
|
||||
|
||||
|
||||
## jerry_substring_to_utf8_char_buffer
|
||||
|
||||
@@ -1471,6 +1529,9 @@ parameter is not a string. It will extract the substring between the specified
|
||||
start position and the end position (or the end of the string, whichever
|
||||
comes first).
|
||||
|
||||
*Note*: Does not put '\0' to the end of string, the return value identifies
|
||||
the number of valid bytes in the output buffer.
|
||||
|
||||
**Prototype**
|
||||
|
||||
```c
|
||||
@@ -1509,9 +1570,12 @@ jerry_substring_to_utf8_char_buffer (const jerry_value_t value,
|
||||
|
||||
**See also**
|
||||
|
||||
- [jerry_create_string_from_utf8](#jerrycreatestring)
|
||||
- [jerry_create_string_from_utf8](#jerrycreatestringfromutf8)
|
||||
- [jerry_get_utf8_string_size](#jerrygetutf8stringsize)
|
||||
- [jerry_get_utf8_string_length](#jerrygetutf8stringlength)
|
||||
- [jerry_is_valid_utf8_string](#jerryisvalidutf8string)
|
||||
|
||||
|
||||
# Functions for array object values
|
||||
|
||||
## jerry_get_array_length
|
||||
@@ -2221,6 +2285,7 @@ jerry_create_string (const jerry_char_t *str_p);
|
||||
|
||||
**See also**
|
||||
|
||||
- [jerry_is_valid_cesu8_string](#jerryisvalidcesu8string)
|
||||
- [jerry_create_string_sz](#jerrycreatestringsz)
|
||||
|
||||
|
||||
@@ -2259,8 +2324,10 @@ jerry_create_string_sz (const jerry_char_t *str_p,
|
||||
|
||||
**See also**
|
||||
|
||||
- [jerry_is_valid_cesu8_string](#jerryisvalidcesu8string)
|
||||
- [jerry_create_string](#jerrycreatestring)
|
||||
|
||||
|
||||
## jerry_create_string_from_utf8
|
||||
|
||||
**Summary**
|
||||
@@ -2294,6 +2361,7 @@ jerry_create_string_from_utf8 (const jerry_char_t *str_p);
|
||||
|
||||
**See also**
|
||||
|
||||
- [jerry_is_valid_utf8_string](#jerryisvalidutf8string)
|
||||
- [jerry_create_string_sz_from_utf8](#jerrycreatestringszfromutf8)
|
||||
|
||||
|
||||
@@ -2334,8 +2402,10 @@ jerry_create_string_sz (const jerry_char_t *str_p,
|
||||
|
||||
**See also**
|
||||
|
||||
- [jerry_is_valid_utf8_string](#jerryisvalidutf8string)
|
||||
- [jerry_create_string_from_utf8](#jerrycreatestringfromutf8)
|
||||
|
||||
|
||||
## jerry_create_undefined
|
||||
|
||||
**Summary**
|
||||
@@ -3248,6 +3318,99 @@ bool foreach_function (const jerry_value_t prop_name,
|
||||
- [jerry_object_property_foreach_t](#jerryobjectpropertyforeacht)
|
||||
|
||||
|
||||
# Input validator functions
|
||||
|
||||
## jerry_is_valid_utf8_string
|
||||
|
||||
**Summary**
|
||||
|
||||
Validate UTF-8 string.
|
||||
|
||||
**Prototype**
|
||||
|
||||
```c
|
||||
bool
|
||||
jerry_is_valid_utf8_string (const jerry_char_t *utf8_buf_p, /**< UTF-8 string */
|
||||
jerry_size_t buf_size) /**< string size */
|
||||
```
|
||||
|
||||
- `utf8_buf_p` - UTF-8 input string
|
||||
- `buf_size` - input string size
|
||||
|
||||
**Example**
|
||||
|
||||
```c
|
||||
{
|
||||
const jerry_char_t script[] = "print ('Hello, World!');";
|
||||
size_t script_size = strlen ((const char *) script);
|
||||
|
||||
if (jerry_is_valid_utf8_string (script, (jerry_size_t) script_size))
|
||||
{
|
||||
jerry_run_simple (script, script_size, JERRY_INIT_EMPTY);
|
||||
}
|
||||
}
|
||||
```
|
||||
|
||||
**See also**
|
||||
|
||||
- [jerry_run_simple](#jerryrunsimple)
|
||||
- [jerry_create_string_from_utf8](#jerrycreatestringfromutf8)
|
||||
- [jerry_create_string_sz_from_utf8](#jerrycreatestringszfromutf8)
|
||||
- [jerry_get_utf8_string_size](#jerrygetutf8stringsize)
|
||||
- [jerry_get_utf8_string_length](#jerrygetutf8stringlength)
|
||||
- [jerry_string_to_utf8_char_buffer](#jerrystringtoutf8charbuffer)
|
||||
- [jerry_substring_to_utf8_char_buffer](#jerrysubstringtoutf8charbuffer)
|
||||
|
||||
## jerry_is_valid_cesu8_string
|
||||
|
||||
**Summary**
|
||||
|
||||
Validate CESU-8 string.
|
||||
|
||||
**Prototype**
|
||||
|
||||
```c
|
||||
bool
|
||||
jerry_is_valid_cesu8_string (const jerry_char_t *cesu8_buf_p, /**< CESU-8 string */
|
||||
jerry_size_t buf_size) /**< string size */
|
||||
```
|
||||
|
||||
- `cesu8_buf_p` - CESU-8 input string
|
||||
- `buf_size` - input string size
|
||||
|
||||
**Example**
|
||||
|
||||
```c
|
||||
{
|
||||
jerry_init (JERRY_INIT_EMPTY);
|
||||
|
||||
const jerry_char_t script[] = "Hello, World!";
|
||||
size_t script_size = strlen ((const char *) script);
|
||||
|
||||
if (jerry_is_valid_cesu8_string (script, (jerry_size_t) script_size))
|
||||
{
|
||||
jerry_value_t string_value = jerry_create_string_sz (script,
|
||||
(jerry_size_t) script_size));
|
||||
|
||||
... // usage of string_value
|
||||
|
||||
jerry_release_value (string_value);
|
||||
}
|
||||
|
||||
jerry_cleanup ();
|
||||
}
|
||||
```
|
||||
|
||||
**See also**
|
||||
|
||||
- [jerry_create_string](#jerrycreatestring)
|
||||
- [jerry_create_string_sz](#jerrycreatestringsz)
|
||||
- [jerry_get_string_size](#jerrygetstringsize)
|
||||
- [jerry_get_string_length](#jerrygetstringlength)
|
||||
- [jerry_string_to_char_buffer](#jerrystringtocharbuffer)
|
||||
- [jerry_substring_to_char_buffer](#jerrysubstringtocharbuffer)
|
||||
|
||||
|
||||
# Snapshot functions
|
||||
|
||||
## jerry_parse_and_save_snapshot
|
||||
|
||||
Reference in New Issue
Block a user