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:
Akos Kiss
2018-08-14 09:29:06 +02:00
committed by yichoi
parent b9aa0da402
commit a3112ab901
8 changed files with 75 additions and 18 deletions
+25 -4
View File
@@ -190,20 +190,41 @@ jerry_debugger_wait_for_client_source (jerry_debugger_wait_for_source_callback_t
*/
void
jerry_debugger_send_output (jerry_char_t buffer[], /**< buffer */
jerry_size_t str_size, /**< string size */
uint8_t type) /**< type of output */
jerry_size_t str_size) /**< string size */
{
#ifdef JERRY_DEBUGGER
if (JERRY_CONTEXT (debugger_flags) & JERRY_DEBUGGER_CONNECTED)
{
jerry_debugger_send_string (JERRY_DEBUGGER_OUTPUT_RESULT,
type,
JERRY_DEBUGGER_OUTPUT_OK,
(const uint8_t *) buffer,
sizeof (uint8_t) * str_size);
}
#else /* !JERRY_DEBUGGER */
JERRY_UNUSED (buffer);
JERRY_UNUSED (str_size);
JERRY_UNUSED (type);
#endif /* JERRY_DEBUGGER */
} /* jerry_debugger_send_output */
/**
* Send the log of the program to the debugger client.
*/
void
jerry_debugger_send_log (jerry_log_level_t level, /**< level of the diagnostics message */
jerry_char_t buffer[], /**< buffer */
jerry_size_t str_size) /**< string size */
{
#ifdef JERRY_DEBUGGER
if (JERRY_CONTEXT (debugger_flags) & JERRY_DEBUGGER_CONNECTED)
{
jerry_debugger_send_string (JERRY_DEBUGGER_OUTPUT_RESULT,
(uint8_t) (level + 2),
(const uint8_t *) buffer,
sizeof (uint8_t) * str_size);
}
#else /* !JERRY_DEBUGGER */
JERRY_UNUSED (level);
JERRY_UNUSED (buffer);
JERRY_UNUSED (str_size);
#endif /* JERRY_DEBUGGER */
} /* jerry_debugger_send_log */