Rework usages/naming of configuration macros [part 3] (#2927)

Reworked the JERRY_DEBUGGER macro to be a 0/1 switch.

JerryScript-DCO-1.0-Signed-off-by: Peter Gal pgal.u-szeged@partner.samsung.com
This commit is contained in:
Péter Gál
2019-07-01 13:12:19 +02:00
committed by Dániel Bátyai
parent 1ea77cc490
commit eef1efa394
29 changed files with 175 additions and 160 deletions
+2 -2
View File
@@ -17,7 +17,7 @@
#include "jcontext.h"
#include "jerryscript.h"
#ifdef JERRY_DEBUGGER
#if ENABLED (JERRY_DEBUGGER)
/**
* Minimum number of bytes transmitted or received.
@@ -247,4 +247,4 @@ jerry_debugger_transport_sleep (void)
jerry_port_sleep (JERRY_DEBUGGER_TRANSPORT_TIMEOUT);
} /* jerry_debugger_transport_sleep */
#endif /* JERRY_DEBUGGER */
#endif /* ENABLED (JERRY_DEBUGGER) */
+19 -19
View File
@@ -26,11 +26,11 @@
bool
jerry_debugger_is_connected (void)
{
#ifdef JERRY_DEBUGGER
#if ENABLED (JERRY_DEBUGGER)
return JERRY_CONTEXT (debugger_flags) & JERRY_DEBUGGER_CONNECTED;
#else /* !JERRY_DEBUGGER */
#else /* !ENABLED (JERRY_DEBUGGER) */
return false;
#endif /* JERRY_DEBUGGER */
#endif /* ENABLED (JERRY_DEBUGGER) */
} /* jerry_debugger_is_connected */
/**
@@ -39,14 +39,14 @@ jerry_debugger_is_connected (void)
void
jerry_debugger_stop (void)
{
#ifdef JERRY_DEBUGGER
#if ENABLED (JERRY_DEBUGGER)
if ((JERRY_CONTEXT (debugger_flags) & JERRY_DEBUGGER_CONNECTED)
&& !(JERRY_CONTEXT (debugger_flags) & JERRY_DEBUGGER_BREAKPOINT_MODE))
{
JERRY_DEBUGGER_SET_FLAGS (JERRY_DEBUGGER_VM_STOP);
JERRY_CONTEXT (debugger_stop_context) = NULL;
}
#endif /* JERRY_DEBUGGER */
#endif /* ENABLED (JERRY_DEBUGGER) */
} /* jerry_debugger_stop */
/**
@@ -55,14 +55,14 @@ jerry_debugger_stop (void)
void
jerry_debugger_continue (void)
{
#ifdef JERRY_DEBUGGER
#if ENABLED (JERRY_DEBUGGER)
if ((JERRY_CONTEXT (debugger_flags) & JERRY_DEBUGGER_CONNECTED)
&& !(JERRY_CONTEXT (debugger_flags) & JERRY_DEBUGGER_BREAKPOINT_MODE))
{
JERRY_DEBUGGER_CLEAR_FLAGS (JERRY_DEBUGGER_VM_STOP);
JERRY_CONTEXT (debugger_stop_context) = NULL;
}
#endif /* JERRY_DEBUGGER */
#endif /* ENABLED (JERRY_DEBUGGER) */
} /* jerry_debugger_continue */
/**
@@ -71,7 +71,7 @@ jerry_debugger_continue (void)
void
jerry_debugger_stop_at_breakpoint (bool enable_stop_at_breakpoint) /**< enable/disable stop at breakpoint */
{
#ifdef JERRY_DEBUGGER
#if ENABLED (JERRY_DEBUGGER)
if (JERRY_CONTEXT (debugger_flags) & JERRY_DEBUGGER_CONNECTED
&& !(JERRY_CONTEXT (debugger_flags) & JERRY_DEBUGGER_BREAKPOINT_MODE))
{
@@ -84,9 +84,9 @@ jerry_debugger_stop_at_breakpoint (bool enable_stop_at_breakpoint) /**< enable/d
JERRY_DEBUGGER_CLEAR_FLAGS (JERRY_DEBUGGER_VM_IGNORE);
}
}
#else /* !JERRY_DEBUGGER */
#else /* !ENABLED (JERRY_DEBUGGER) */
JERRY_UNUSED (enable_stop_at_breakpoint);
#endif /* JERRY_DEBUGGER */
#endif /* ENABLED (JERRY_DEBUGGER) */
} /* jerry_debugger_stop_at_breakpoint */
/**
@@ -104,7 +104,7 @@ jerry_debugger_wait_for_client_source (jerry_debugger_wait_for_source_callback_t
{
*return_value = jerry_create_undefined ();
#ifdef JERRY_DEBUGGER
#if ENABLED (JERRY_DEBUGGER)
if ((JERRY_CONTEXT (debugger_flags) & JERRY_DEBUGGER_CONNECTED)
&& !(JERRY_CONTEXT (debugger_flags) & JERRY_DEBUGGER_BREAKPOINT_MODE))
{
@@ -176,12 +176,12 @@ jerry_debugger_wait_for_client_source (jerry_debugger_wait_for_source_callback_t
}
return JERRY_DEBUGGER_SOURCE_RECEIVE_FAILED;
#else /* !JERRY_DEBUGGER */
#else /* !ENABLED (JERRY_DEBUGGER) */
JERRY_UNUSED (callback_p);
JERRY_UNUSED (user_p);
return JERRY_DEBUGGER_SOURCE_RECEIVE_FAILED;
#endif /* JERRY_DEBUGGER */
#endif /* ENABLED (JERRY_DEBUGGER) */
} /* jerry_debugger_wait_for_client_source */
/**
@@ -192,7 +192,7 @@ void
jerry_debugger_send_output (const jerry_char_t *buffer, /**< buffer */
jerry_size_t str_size) /**< string size */
{
#ifdef JERRY_DEBUGGER
#if ENABLED (JERRY_DEBUGGER)
if (JERRY_CONTEXT (debugger_flags) & JERRY_DEBUGGER_CONNECTED)
{
jerry_debugger_send_string (JERRY_DEBUGGER_OUTPUT_RESULT,
@@ -200,10 +200,10 @@ jerry_debugger_send_output (const jerry_char_t *buffer, /**< buffer */
(const uint8_t *) buffer,
sizeof (uint8_t) * str_size);
}
#else /* !JERRY_DEBUGGER */
#else /* !ENABLED (JERRY_DEBUGGER) */
JERRY_UNUSED (buffer);
JERRY_UNUSED (str_size);
#endif /* JERRY_DEBUGGER */
#endif /* ENABLED (JERRY_DEBUGGER) */
} /* jerry_debugger_send_output */
/**
@@ -214,7 +214,7 @@ jerry_debugger_send_log (jerry_log_level_t level, /**< level of the diagnostics
const jerry_char_t *buffer, /**< buffer */
jerry_size_t str_size) /**< string size */
{
#ifdef JERRY_DEBUGGER
#if ENABLED (JERRY_DEBUGGER)
if (JERRY_CONTEXT (debugger_flags) & JERRY_DEBUGGER_CONNECTED)
{
jerry_debugger_send_string (JERRY_DEBUGGER_OUTPUT_RESULT,
@@ -222,9 +222,9 @@ jerry_debugger_send_log (jerry_log_level_t level, /**< level of the diagnostics
(const uint8_t *) buffer,
sizeof (uint8_t) * str_size);
}
#else /* !JERRY_DEBUGGER */
#else /* !ENABLED (JERRY_DEBUGGER) */
JERRY_UNUSED (level);
JERRY_UNUSED (buffer);
JERRY_UNUSED (str_size);
#endif /* JERRY_DEBUGGER */
#endif /* ENABLED (JERRY_DEBUGGER) */
} /* jerry_debugger_send_log */
+2 -2
View File
@@ -658,9 +658,9 @@ snapshot_load_compiled_code (const uint8_t *base_addr_p, /**< base address of th
JERRY_ASSERT (bytecode_p->refs == 1);
#ifdef JERRY_DEBUGGER
#if ENABLED (JERRY_DEBUGGER)
bytecode_p->status_flags = (uint16_t) (bytecode_p->status_flags | CBC_CODE_FLAGS_DEBUGGER_IGNORE);
#endif /* JERRY_DEBUGGER */
#endif /* ENABLED (JERRY_DEBUGGER) */
ecma_value_t *literal_start_p = (ecma_value_t *) (((uint8_t *) bytecode_p) + header_size);
+10 -10
View File
@@ -191,14 +191,14 @@ jerry_cleanup (void)
{
jerry_assert_api_available ();
#ifdef JERRY_DEBUGGER
#if ENABLED (JERRY_DEBUGGER)
if (JERRY_CONTEXT (debugger_flags) & JERRY_DEBUGGER_CONNECTED)
{
jerry_debugger_send_type (JERRY_DEBUGGER_CLOSE_CONNECTION);
jerry_debugger_transport_close ();
}
#endif /* JERRY_DEBUGGER */
#endif /* ENABLED (JERRY_DEBUGGER) */
for (jerry_context_data_header_t *this_p = JERRY_CONTEXT (context_data_p);
this_p != NULL;
@@ -379,7 +379,7 @@ jerry_parse (const jerry_char_t *resource_name_p, /**< resource name (usually a
size_t source_size, /**< script source size */
uint32_t parse_opts) /**< jerry_parse_opts_t option bits */
{
#if defined JERRY_DEBUGGER && ENABLED (JERRY_PARSER)
#if ENABLED (JERRY_DEBUGGER) && ENABLED (JERRY_PARSER)
if ((JERRY_CONTEXT (debugger_flags) & JERRY_DEBUGGER_CONNECTED)
&& resource_name_length > 0)
{
@@ -388,10 +388,10 @@ jerry_parse (const jerry_char_t *resource_name_p, /**< resource name (usually a
resource_name_p,
resource_name_length);
}
#else /* !(JERRY_DEBUGGER && ENABLED (JERRY_PARSER)) */
#else /* !(ENABLED (JERRY_DEBUGGER) && ENABLED (JERRY_PARSER)) */
JERRY_UNUSED (resource_name_p);
JERRY_UNUSED (resource_name_length);
#endif /* JERRY_DEBUGGER && ENABLED (JERRY_PARSER) */
#endif /* ENABLED (JERRY_DEBUGGER) && ENABLED (JERRY_PARSER) */
#if ENABLED (JERRY_PARSER)
jerry_assert_api_available ();
@@ -449,7 +449,7 @@ jerry_parse_function (const jerry_char_t *resource_name_p, /**< resource name (u
size_t source_size, /**< script source size */
uint32_t parse_opts) /**< jerry_parse_opts_t option bits */
{
#if defined JERRY_DEBUGGER && ENABLED (JERRY_PARSER)
#if ENABLED (JERRY_DEBUGGER) && ENABLED (JERRY_PARSER)
if (JERRY_CONTEXT (debugger_flags) & JERRY_DEBUGGER_CONNECTED)
{
jerry_debugger_send_string (JERRY_DEBUGGER_SOURCE_CODE_NAME,
@@ -457,10 +457,10 @@ jerry_parse_function (const jerry_char_t *resource_name_p, /**< resource name (u
resource_name_p,
resource_name_length);
}
#else /* !(JERRY_DEBUGGER && ENABLED (JERRY_PARSER)) */
#else /* !(ENABLED (JERRY_DEBUGGER) && ENABLED (JERRY_PARSER)) */
JERRY_UNUSED (resource_name_p);
JERRY_UNUSED (resource_name_length);
#endif /* JERRY_DEBUGGER && ENABLED (JERRY_PARSER) */
#endif /* ENABLED (JERRY_DEBUGGER) && ENABLED (JERRY_PARSER) */
#if ENABLED (JERRY_PARSER)
jerry_assert_api_available ();
@@ -902,9 +902,9 @@ jerry_is_feature_enabled (const jerry_feature_t feature) /**< feature to check *
#if ENABLED (JERRY_SNAPSHOT_EXEC)
|| feature == JERRY_FEATURE_SNAPSHOT_EXEC
#endif /* ENABLED (JERRY_SNAPSHOT_EXEC) */
#ifdef JERRY_DEBUGGER
#if ENABLED (JERRY_DEBUGGER)
|| feature == JERRY_FEATURE_DEBUGGER
#endif /* JERRY_DEBUGGER */
#endif /* ENABLED (JERRY_DEBUGGER) */
#if ENABLED (JERRY_VM_EXEC_STOP)
|| feature == JERRY_FEATURE_VM_EXEC_STOP
#endif /* ENABLED (JERRY_VM_EXEC_STOP) */