Skip to content

Commit 82ca949

Browse files
authored
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 [email protected]
1 parent f54f2d3 commit 82ca949

File tree

4 files changed

+21
-55
lines changed

4 files changed

+21
-55
lines changed

docs/10.EXT-REFERENCE-HANDLER.md

Lines changed: 17 additions & 51 deletions
Original file line numberDiff line numberDiff line change
@@ -252,7 +252,7 @@ For example usage see [jerryx_set_properties](#jerryx_set_properties).
252252
253253
# Common external function handlers
254254
255-
## jerryx_handler_assert_fatal
255+
## jerryx_handler_assert
256256
257257
**Summary**
258258
@@ -265,12 +265,13 @@ a backtrace is also printed out.
265265
266266
```c
267267
jerry_value_t
268-
jerryx_handler_assert_fatal (const jerry_value_t func_obj_val, const jerry_value_t this_p,
269-
const jerry_value_t args_p[], const jerry_length_t args_cnt);
268+
jerryx_handler_assert (const jerry_call_info_t *call_info_p,
269+
const jerry_value_t args_p[],
270+
const jerry_length_t args_cnt);
270271
```
271272

272-
- `func_obj_val` - the function object that was called (unused).
273-
- `this_p` - the `this` value of the call (unused).
273+
- `call_info_p` - pointer to a [jerry_call_info_t](#jerry_call_info_t)
274+
structure which holds call related information (unused).
274275
- `args_p` - the array of function arguments.
275276
- `args_cnt` - the number of function arguments.
276277
- 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
282283
- [jerryx_register_global](#jerryx_register_global)
283284

284285

285-
## jerryx_handler_assert_throw
286-
287-
**Summary**
288-
289-
Soft assert for scripts. The routine throws an error on assertion failure.
290-
291-
**Prototype**
292-
293-
```c
294-
jerry_value_t
295-
jerryx_handler_assert_throw (const jerry_value_t func_obj_val, const jerry_value_t this_p,
296-
const jerry_value_t args_p[], const jerry_length_t args_cnt);
297-
```
298-
299-
- `func_obj_val` - the function object that was called (unused).
300-
- `this_p` - the `this` value of the call (unused).
301-
- `args_p` - the array of function arguments.
302-
- `args_cnt` - the number of function arguments.
303-
- return value - `jerry_value_t` representing boolean true, if only one argument
304-
was passed and that argument was a boolean true, an error otherwise.
305-
306-
**See also**
307-
308-
- [jerryx_register_global](#jerryx_register_global)
309-
310-
311-
## jerryx_handler_assert
312-
313-
**Summary**
314-
315-
An alias to `jerryx_handler_assert_fatal`.
316-
317-
**See also**
318-
319-
- [jerryx_handler_assert_fatal](#jerryx_handler_assert_fatal)
320-
321-
322286
## jerryx_handler_gc
323287

324288
**Summary**
@@ -331,12 +295,13 @@ gc is performed, which is also the default if no parameters passed.
331295

332296
```c
333297
jerry_value_t
334-
jerryx_handler_gc (const jerry_value_t func_obj_val, const jerry_value_t this_p,
335-
const jerry_value_t args_p[], const jerry_length_t args_cnt);
298+
jerryx_handler_gc (const jerry_call_info_t *call_info_p,
299+
const jerry_value_t args_p[],
300+
const jerry_length_t args_cnt);
336301
```
337302
338-
- `func_obj_val` - the function object that was called (unused).
339-
- `this_p` - the `this` value of the call (unused).
303+
- `call_info_p` - pointer to a [jerry_call_info_t](#jerry_call_info_t)
304+
structure which holds call related information (unused).
340305
- `args_p` - the array of function arguments (unused).
341306
- `args_cnt` - the number of function arguments (unused).
342307
- return value - `jerry_value_t` representing `undefined`.
@@ -365,12 +330,13 @@ ensure that their port implementation also provides
365330
366331
```c
367332
jerry_value_t
368-
jerryx_handler_print (const jerry_value_t func_obj_val, const jerry_value_t this_p,
369-
const jerry_value_t args_p[], const jerry_length_t args_cnt);
333+
jerryx_handler_print (const jerry_call_info_t *call_info_p,
334+
const jerry_value_t args_p[],
335+
const jerry_length_t args_cnt);
370336
```
371337

372-
- `func_obj_val` - the function object that was called (unused).
373-
- `this_p` - the `this` value of the call (unused).
338+
- `call_info_p` - pointer to a [jerry_call_info_t](#jerry_call_info_t)
339+
structure which holds call related information (unused).
374340
- `args_p` - the array of function arguments.
375341
- `args_cnt` - the number of function arguments.
376342
- return value - `jerry_value_t` representing `undefined` if all arguments could
@@ -398,7 +364,7 @@ longer needed.
398364
```c
399365
jerry_value_t
400366
jerryx_register_global (const char *name_p,
401-
jerry_external_handler_t handler_p);
367+
jerry_external_handler_t handler_p);
402368
```
403369
404370
- `name_p` - the name of the function to be registered.

jerry-ext/util/handlers.c

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -93,7 +93,7 @@ jerryx_handler_assert (const jerry_call_info_t *call_info_p, /**< call informati
9393
jerryx_print_backtrace (5);
9494

9595
jerry_port_fatal (JERRY_FATAL_FAILED_ASSERTION);
96-
} /* jerryx_handler_assert_fatal */
96+
} /* jerryx_handler_assert */
9797

9898
/**
9999
* Expose garbage collector to scripts.

jerry-ext/util/print.c

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -190,7 +190,7 @@ jerryx_print_backtrace (unsigned depth)
190190
}
191191

192192
jerry_value_free (backtrace_array);
193-
} /* jerryx_handler_assert_fatal */
193+
} /* jerryx_print_backtrace */
194194

195195
/**
196196
* Print an unhandled exception value

jerry-port/common/jerry-port-fs.c

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -128,7 +128,7 @@ jerry_port_path_normalize (const jerry_char_t *path_p, /**< input path */
128128
memcpy (buffer_p, path_p, path_size + 1);
129129

130130
return buffer_p;
131-
} /* jerry_port_normalize_path */
131+
} /* jerry_port_path_normalize */
132132

133133
/**
134134
* Free a path buffer returned by jerry_port_path_normalize.
@@ -139,7 +139,7 @@ void JERRY_ATTR_WEAK
139139
jerry_port_path_free (jerry_char_t *path_p)
140140
{
141141
free (path_p);
142-
} /* jerry_port_normalize_path */
142+
} /* jerry_port_path_free */
143143

144144
/**
145145
* Computes the end of the directory part of a path.

0 commit comments

Comments
 (0)