Introduce JERRY_ZSTR_ARG macro to avoid jerryx_print_string, jerryx_print_byte, jerry_port_print_byte, strlen (#4982)
Replace usage of jerryx_print_byte, jerryx_print_string with jerryx_print_buffer. As we now have JERRY_ZSTR_ARG, so we can take advantage of it With this, the jerry_port_print_byte port api won't need any more this reduced the port api surface JerryScript-DCO-1.0-Signed-off-by: Yonggang Luo luoyonggang@gmail.com
This commit is contained in:
@@ -316,15 +316,14 @@ jerryx_handler_gc (const jerry_call_info_t *call_info_p,
|
||||
**Summary**
|
||||
|
||||
Provide a `print` implementation for scripts. The routine converts all of its
|
||||
arguments to strings and outputs them char-by-char using
|
||||
`jerry_port_print_byte`. The NULL character is output as "\u0000",
|
||||
other characters are output bytewise.
|
||||
arguments to strings and outputs them by using `jerry_port_print_buffer`.
|
||||
The NULL character is output as "\u0000", other characters are output bytewise.
|
||||
|
||||
*Note*: This implementation does not use standard C `printf` to print its
|
||||
output. This allows more flexibility but also extends the core JerryScript
|
||||
engine port API. Applications that want to use `jerryx_handler_print` must
|
||||
ensure that their port implementation also provides
|
||||
`jerry_port_print_byte`.
|
||||
`jerry_port_print_buffer`.
|
||||
|
||||
**Prototype**
|
||||
|
||||
@@ -345,7 +344,7 @@ jerryx_handler_print (const jerry_call_info_t *call_info_p,
|
||||
**See also**
|
||||
|
||||
- [jerryx_register_global](#jerryx_register_global)
|
||||
- [jerry_port_print_byte](05.PORT-API.md#jerry_port_print_char)
|
||||
- [jerry_port_print_buffer](05.PORT-API.md#jerry_port_print_buffer)
|
||||
|
||||
|
||||
# Handler registration helper
|
||||
|
||||
Reference in New Issue
Block a user