Split string-sending debugger API into output- and log-sending functions (#2461)
This helps to avoid the use of non-public headers and protocol-internal constants in external code (e.g., in jerry-port and jerry-ext). The patch also cleans up the necessary includes in jerry-core public headers, and the include order in jerry-port/default public headers. JerryScript-DCO-1.0-Signed-off-by: Akos Kiss akiss@inf.u-szeged.hu
This commit is contained in:
+34
-3
@@ -359,20 +359,51 @@ Sends the program's output to the debugger client.
|
||||
**Prototype**
|
||||
|
||||
```c
|
||||
void
|
||||
jerry_debugger_send_output (jerry_char_t buffer[], jerry_size_t string_size, uint8_t type)
|
||||
void
|
||||
jerry_debugger_send_output (jerry_char_t buffer[], jerry_size_t string_size)
|
||||
```
|
||||
|
||||
**Example**
|
||||
|
||||
```c
|
||||
{
|
||||
jerry_init (JERRY_INIT_EMPTY);
|
||||
jerry_debugger_init (5001);
|
||||
|
||||
jerry_char_t my_output = "Hey, this should be sent too!";
|
||||
jerry_size_t my_output_size = sizeof (my_output);
|
||||
|
||||
jerry_debugger_send_output (my_output, my_output_size, JERRY_DEBUGGER_OUTPUT_OK);
|
||||
jerry_debugger_send_output (my_output, my_output_size);
|
||||
|
||||
jerry_cleanup ();
|
||||
}
|
||||
```
|
||||
|
||||
### jerry_debugger_send_log
|
||||
|
||||
**Summary**
|
||||
|
||||
Sends the program's log to the debugger client.
|
||||
|
||||
**Prototype**
|
||||
|
||||
```c
|
||||
void
|
||||
jerry_debugger_send_log (jerry_log_level_t level, jerry_char_t buffer[], jerry_size_t string_size)
|
||||
```
|
||||
|
||||
**Example**
|
||||
|
||||
```c
|
||||
{
|
||||
jerry_init (JERRY_INIT_EMPTY);
|
||||
jerry_debugger_init (5001);
|
||||
|
||||
jerry_char_t my_log = "Custom diagnostics";
|
||||
jerry_size_t my_log_size = sizeof (my_log);
|
||||
|
||||
jerry_debugger_send_log (JERRY_LOG_LEVEL_DEBUG, my_log, my_log_size);
|
||||
|
||||
jerry_cleanup ();
|
||||
}
|
||||
```
|
||||
|
||||
Reference in New Issue
Block a user