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:
Yonggang Luo
2024-11-21 00:46:10 +08:00
committed by GitHub
parent f54f2d3a7b
commit 82ca949850
4 changed files with 21 additions and 55 deletions
+16 -50
View File
@@ -252,7 +252,7 @@ For example usage see [jerryx_set_properties](#jerryx_set_properties).
# Common external function handlers
## jerryx_handler_assert_fatal
## jerryx_handler_assert
**Summary**
@@ -265,12 +265,13 @@ a backtrace is also printed out.
```c
jerry_value_t
jerryx_handler_assert_fatal (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);
jerryx_handler_assert (const jerry_call_info_t *call_info_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).
- `call_info_p` - pointer to a [jerry_call_info_t](#jerry_call_info_t)
structure which holds call related information (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
@@ -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_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
**Summary**
@@ -331,12 +295,13 @@ gc is performed, which is also the default if no parameters passed.
```c
jerry_value_t
jerryx_handler_gc (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);
jerryx_handler_gc (const jerry_call_info_t *call_info_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).
- `call_info_p` - pointer to a [jerry_call_info_t](#jerry_call_info_t)
structure which holds call related information (unused).
- `args_p` - the array of function arguments (unused).
- `args_cnt` - the number of function arguments (unused).
- return value - `jerry_value_t` representing `undefined`.
@@ -365,12 +330,13 @@ ensure that their port implementation also provides
```c
jerry_value_t
jerryx_handler_print (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);
jerryx_handler_print (const jerry_call_info_t *call_info_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).
- `call_info_p` - pointer to a [jerry_call_info_t](#jerry_call_info_t)
structure which holds call related information (unused).
- `args_p` - the array of function arguments.
- `args_cnt` - the number of function arguments.
- return value - `jerry_value_t` representing `undefined` if all arguments could
+1 -1
View File
@@ -93,7 +93,7 @@ jerryx_handler_assert (const jerry_call_info_t *call_info_p, /**< call informati
jerryx_print_backtrace (5);
jerry_port_fatal (JERRY_FATAL_FAILED_ASSERTION);
} /* jerryx_handler_assert_fatal */
} /* jerryx_handler_assert */
/**
* Expose garbage collector to scripts.
+1 -1
View File
@@ -190,7 +190,7 @@ jerryx_print_backtrace (unsigned depth)
}
jerry_value_free (backtrace_array);
} /* jerryx_handler_assert_fatal */
} /* jerryx_print_backtrace */
/**
* Print an unhandled exception value
+2 -2
View File
@@ -128,7 +128,7 @@ jerry_port_path_normalize (const jerry_char_t *path_p, /**< input path */
memcpy (buffer_p, path_p, path_size + 1);
return buffer_p;
} /* jerry_port_normalize_path */
} /* 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)
{
free (path_p);
} /* jerry_port_normalize_path */
} /* jerry_port_path_free */
/**
* Computes the end of the directory part of a path.