Skip to content

Commit 0b1d75a

Browse files
authored
Update and fix some issues in EXT-REFERENCE documentation (#5180)
There was some issues and typos in the EXT-REFERENCE documentation. This patch fixes these issues and typos. JerryScript-DCO-1.0-Signed-off-by: Gergo Csizi [email protected]
1 parent 5f467a6 commit 0b1d75a

File tree

6 files changed

+49
-10
lines changed

6 files changed

+49
-10
lines changed

docs/09.EXT-REFERENCE-ARG.md

Lines changed: 41 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -361,6 +361,28 @@ jerryx_arg_transform_array (const jerry_value_t array_val,
361361

362362
- [jerryx_arg_array](#jerryx_arg_array)
363363

364+
## jerryx_arg_transform_optional
365+
366+
**Summary**
367+
368+
The common function to deal with optional arguments. The core transform function is provided by argument `func`.
369+
370+
**Prototype**
371+
372+
```c
373+
jerry_value_t jerryx_arg_transform_optional (jerryx_arg_js_iterator_t *js_arg_iter_p,
374+
const jerryx_arg_t *c_arg_p,
375+
jerryx_arg_transform_func_t func);
376+
```
377+
378+
- `js_arg_iter_p` - the JS arg iterator.
379+
- `c_arg_p` - the native arg.
380+
- `func` - the core transform function.
381+
- return value - a `jerry_value_t` representing `undefined` if all validators passed or an `Error` if a validator failed.
382+
383+
**See also**
384+
385+
- [jerryx_arg_transform_func_t](#jerryx_arg_transform_func_t)
364386
365387
# Helpers for commonly used validations
366388
@@ -577,11 +599,11 @@ User should prepare the `jerryx_arg_object_props_t` instance, and pass it to thi
577599

578600
```c
579601
static inline jerryx_arg_t
580-
jerryx_arg_object_properties (const jerryx_arg_object_props_t *object_props_p,
602+
jerryx_arg_object_properties (const jerryx_arg_object_props_t *obj_prop_p,
581603
jerryx_arg_optional_t opt_flag);
582604
```
583605
- return value - the created `jerryx_arg_t` instance.
584-
- `object_props_p` - provides information for properties transform.
606+
- `obj_prop_p` - provides information for properties transform.
585607
- `opt_flag` - whether the argument is optional.
586608
587609
**Example**
@@ -754,6 +776,23 @@ my_external_handler (const jerry_value_t function_obj,
754776

755777
# Functions to create custom validations
756778

779+
## jerryx_arg_ignore
780+
781+
**Summary**
782+
783+
Create a jerryx_arg_t instance for ignored argument.
784+
785+
**Prototype**
786+
787+
```c
788+
static inline jerryx_arg_t jerryx_arg_ignore (void);
789+
```
790+
- return value - the created `jerryx_arg_t` instance.
791+
792+
**See also**
793+
794+
- [jerryx_arg_t](#jerryx_arg_t)
795+
757796
## jerryx_arg_custom
758797
759798
**Summary**

docs/10.EXT-REFERENCE-HANDLER.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -24,7 +24,7 @@ The engine must be initialized before specifying the `jerry_value_t` in the stru
2424
typedef struct {
2525
const char *name;
2626
jerry_value_t value;
27-
} jerryx_function_list_entry;
27+
} jerryx_property_entry;
2828
```
2929

3030
**See also**

docs/12.EXT-REFERENCE-MODULE.md

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -63,7 +63,7 @@ to `jerryx_module_resolve` with a module name whose canonical name matches an al
6363
```c
6464
jerry_value_t
6565
jerryx_module_resolve (const jerry_value_t name,
66-
const jerryx_module_resolver_t *resolvers_p,
66+
const jerryx_module_resolver_t **resolvers_p,
6767
size_t resolver_count);
6868
```
6969
@@ -84,7 +84,7 @@ Remove a module from the current context's cache, or clear the cache entirely.
8484
```c
8585
void
8686
jerryx_module_clear_cache (const jerry_value_t name,
87-
const jerryx_module_resolver_t *resolvers_p,
87+
const jerryx_module_resolver_t **resolvers_p,
8888
size_t resolver_count);
8989
```
9090

jerry-ext/include/jerryscript-ext/arg.h

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -167,7 +167,7 @@ static inline jerryx_arg_t
167167
jerryx_arg_native_pointer (void **dest, const jerry_object_native_info_t *info_p, jerryx_arg_optional_t opt_flag);
168168
static inline jerryx_arg_t jerryx_arg_ignore (void);
169169
static inline jerryx_arg_t jerryx_arg_custom (void *dest, uintptr_t extra_info, jerryx_arg_transform_func_t func);
170-
static inline jerryx_arg_t jerryx_arg_object_properties (const jerryx_arg_object_props_t *object_props_p,
170+
static inline jerryx_arg_t jerryx_arg_object_properties (const jerryx_arg_object_props_t *obj_prop_p,
171171
jerryx_arg_optional_t opt_flag);
172172
static inline jerryx_arg_t jerryx_arg_array (const jerryx_arg_array_items_t *array_items_p,
173173
jerryx_arg_optional_t opt_flag);

jerry-ext/include/jerryscript-ext/arg.impl.h

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -347,7 +347,7 @@ jerryx_arg_custom (void *dest, /**< pointer to the native argument where the res
347347
* @return a jerryx_arg_t instance.
348348
*/
349349
static inline jerryx_arg_t
350-
jerryx_arg_object_properties (const jerryx_arg_object_props_t *object_props, /**< pointer to object property mapping */
350+
jerryx_arg_object_properties (const jerryx_arg_object_props_t *obj_prop_p, /**< pointer to object property mapping */
351351
jerryx_arg_optional_t opt_flag) /**< whether the argument is optional */
352352
{
353353
jerryx_arg_transform_func_t func;
@@ -361,7 +361,7 @@ jerryx_arg_object_properties (const jerryx_arg_object_props_t *object_props, /**
361361
func = jerryx_arg_transform_object_props;
362362
}
363363

364-
return (jerryx_arg_t){ .func = func, .dest = NULL, .extra_info = (uintptr_t) object_props };
364+
return (jerryx_arg_t){ .func = func, .dest = NULL, .extra_info = (uintptr_t) obj_prop_p };
365365
} /* jerryx_arg_object_properties */
366366

367367
/**

jerry-ext/include/jerryscript-ext/module.h

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -161,12 +161,12 @@ extern jerryx_module_resolver_t jerryx_module_native_resolver;
161161
* loaded if it is found.
162162
*/
163163
jerry_value_t
164-
jerryx_module_resolve (const jerry_value_t name, const jerryx_module_resolver_t **resolvers, size_t count);
164+
jerryx_module_resolve (const jerry_value_t name, const jerryx_module_resolver_t **resolvers_p, size_t count);
165165

166166
/**
167167
* Delete a module from the cache or, if name has the JavaScript value of undefined, clear the entire cache.
168168
*/
169-
void jerryx_module_clear_cache (const jerry_value_t name, const jerryx_module_resolver_t **resolvers, size_t count);
169+
void jerryx_module_clear_cache (const jerry_value_t name, const jerryx_module_resolver_t **resolvers_p, size_t count);
170170

171171
JERRY_C_API_END
172172

0 commit comments

Comments
 (0)