Update document 10.EXT-REFERENCE-HANDLER.md (#5163)
The handler prototype did not match it's implementation JerryScript-DCO-1.0-Signed-off-by: Yonggang Luo luoyonggang@gmail.com
This commit is contained in:
@@ -252,7 +252,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**
|
||||||
|
|
||||||
@@ -265,12 +265,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
|
||||||
@@ -282,43 +283,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**
|
||||||
@@ -331,12 +295,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`.
|
||||||
@@ -365,12 +330,13 @@ ensure that their port implementation also provides
|
|||||||
|
|
||||||
```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
|
||||||
|
|||||||
@@ -93,7 +93,7 @@ jerryx_handler_assert (const jerry_call_info_t *call_info_p, /**< call informati
|
|||||||
jerryx_print_backtrace (5);
|
jerryx_print_backtrace (5);
|
||||||
|
|
||||||
jerry_port_fatal (JERRY_FATAL_FAILED_ASSERTION);
|
jerry_port_fatal (JERRY_FATAL_FAILED_ASSERTION);
|
||||||
} /* jerryx_handler_assert_fatal */
|
} /* jerryx_handler_assert */
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Expose garbage collector to scripts.
|
* Expose garbage collector to scripts.
|
||||||
|
|||||||
@@ -190,7 +190,7 @@ jerryx_print_backtrace (unsigned depth)
|
|||||||
}
|
}
|
||||||
|
|
||||||
jerry_value_free (backtrace_array);
|
jerry_value_free (backtrace_array);
|
||||||
} /* jerryx_handler_assert_fatal */
|
} /* jerryx_print_backtrace */
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Print an unhandled exception value
|
* Print an unhandled exception value
|
||||||
|
|||||||
@@ -128,7 +128,7 @@ jerry_port_path_normalize (const jerry_char_t *path_p, /**< input path */
|
|||||||
memcpy (buffer_p, path_p, path_size + 1);
|
memcpy (buffer_p, path_p, path_size + 1);
|
||||||
|
|
||||||
return buffer_p;
|
return buffer_p;
|
||||||
} /* jerry_port_normalize_path */
|
} /* jerry_port_path_normalize */
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Free a path buffer returned by jerry_port_path_normalize.
|
* Free a path buffer returned by jerry_port_path_normalize.
|
||||||
@@ -139,7 +139,7 @@ void JERRY_ATTR_WEAK
|
|||||||
jerry_port_path_free (jerry_char_t *path_p)
|
jerry_port_path_free (jerry_char_t *path_p)
|
||||||
{
|
{
|
||||||
free (path_p);
|
free (path_p);
|
||||||
} /* jerry_port_normalize_path */
|
} /* jerry_port_path_free */
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Computes the end of the directory part of a path.
|
* Computes the end of the directory part of a path.
|
||||||
|
|||||||
Reference in New Issue
Block a user