Skip to content

Commit

Permalink
Update and fix some issues in EXT-REFERENCE documentation
Browse files Browse the repository at this point in the history
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]
  • Loading branch information
gergocs committed Nov 28, 2024
1 parent 5f467a6 commit 9e7fca7
Show file tree
Hide file tree
Showing 5 changed files with 48 additions and 8 deletions.
39 changes: 39 additions & 0 deletions docs/09.EXT-REFERENCE-ARG.md
Original file line number Diff line number Diff line change
Expand Up @@ -361,6 +361,28 @@ jerryx_arg_transform_array (const jerry_value_t array_val,

- [jerryx_arg_array](#jerryx_arg_array)

## jerryx_arg_transform_optional

**Summary**

The common function to deal with optional arguments. The core transform function is provided by argument `func`.

**Prototype**

```c
jerry_value_t jerryx_arg_transform_optional (jerryx_arg_js_iterator_t *js_arg_iter_p,
const jerryx_arg_t *c_arg_p,
jerryx_arg_transform_func_t func);
```
- `js_arg_iter_p` - the JS arg iterator.
- `c_arg_p` - the native arg.
- `func` - the core transform function.
- return value - a `jerry_value_t` representing `undefined` if all validators passed or an `Error` if a validator failed.
**See also**
- [jerryx_arg_transform_func_t](#jerryx_arg_transform_func_t)
# Helpers for commonly used validations
Expand Down Expand Up @@ -754,6 +776,23 @@ my_external_handler (const jerry_value_t function_obj,

# Functions to create custom validations

## jerryx_arg_ignore

**Summary**

Create a jerryx_arg_t instance for ignored argument.

**Prototype**

```c
static inline jerryx_arg_t jerryx_arg_ignore (void);
```
- return value - the created `jerryx_arg_t` instance.
**See also**
- [jerryx_arg_t](#jerryx_arg_t)
## jerryx_arg_custom
**Summary**
Expand Down
2 changes: 1 addition & 1 deletion docs/10.EXT-REFERENCE-HANDLER.md
Original file line number Diff line number Diff line change
Expand Up @@ -24,7 +24,7 @@ The engine must be initialized before specifying the `jerry_value_t` in the stru
typedef struct {
const char *name;
jerry_value_t value;
} jerryx_function_list_entry;
} jerryx_property_entry;
```

**See also**
Expand Down
4 changes: 2 additions & 2 deletions docs/12.EXT-REFERENCE-MODULE.md
Original file line number Diff line number Diff line change
Expand Up @@ -63,7 +63,7 @@ to `jerryx_module_resolve` with a module name whose canonical name matches an al
```c
jerry_value_t
jerryx_module_resolve (const jerry_value_t name,
const jerryx_module_resolver_t *resolvers_p,
const jerryx_module_resolver_t **resolvers_p,
size_t resolver_count);
```
Expand All @@ -84,7 +84,7 @@ Remove a module from the current context's cache, or clear the cache entirely.
```c
void
jerryx_module_clear_cache (const jerry_value_t name,
const jerryx_module_resolver_t *resolvers_p,
const jerryx_module_resolver_t **resolvers_p,
size_t resolver_count);
```

Expand Down
7 changes: 4 additions & 3 deletions jerry-ext/include/jerryscript-ext/arg.impl.h
Original file line number Diff line number Diff line change
Expand Up @@ -347,8 +347,9 @@ jerryx_arg_custom (void *dest, /**< pointer to the native argument where the res
* @return a jerryx_arg_t instance.
*/
static inline jerryx_arg_t
jerryx_arg_object_properties (const jerryx_arg_object_props_t *object_props, /**< pointer to object property mapping */
jerryx_arg_optional_t opt_flag) /**< whether the argument is optional */
jerryx_arg_object_properties (
const jerryx_arg_object_props_t *object_props_p, /**< pointer to object property mapping */
jerryx_arg_optional_t opt_flag) /**< whether the argument is optional */
{
jerryx_arg_transform_func_t func;

Expand All @@ -361,7 +362,7 @@ jerryx_arg_object_properties (const jerryx_arg_object_props_t *object_props, /**
func = jerryx_arg_transform_object_props;
}

return (jerryx_arg_t){ .func = func, .dest = NULL, .extra_info = (uintptr_t) object_props };
return (jerryx_arg_t){ .func = func, .dest = NULL, .extra_info = (uintptr_t) object_props_p };
} /* jerryx_arg_object_properties */

/**
Expand Down
4 changes: 2 additions & 2 deletions jerry-ext/include/jerryscript-ext/module.h
Original file line number Diff line number Diff line change
Expand Up @@ -161,12 +161,12 @@ extern jerryx_module_resolver_t jerryx_module_native_resolver;
* loaded if it is found.
*/
jerry_value_t
jerryx_module_resolve (const jerry_value_t name, const jerryx_module_resolver_t **resolvers, size_t count);
jerryx_module_resolve (const jerry_value_t name, const jerryx_module_resolver_t **resolvers_p, size_t count);

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

JERRY_C_API_END

Expand Down

0 comments on commit 9e7fca7

Please sign in to comment.