Rework jerry_debugger_wait_for_client_source to use a callback.

The jerry_debugger_wait_and_run_client_source function is renamed to
jerry_debugger_wait_for_client_source and a callback is added which
is called when the source is received. Inside the callback the
application is free to do anything with the received source code.

JerryScript-DCO-1.0-Signed-off-by: Zoltan Herczeg zherczeg.u-szeged@partner.samsung.com
This commit is contained in:
Zoltan Herczeg
2017-09-21 00:15:09 -07:00
committed by yichoi
parent 9c3f814357
commit 7713d30702
4 changed files with 174 additions and 56 deletions
+16 -2
View File
@@ -36,7 +36,19 @@ typedef enum
JERRY_DEBUGGER_SOURCE_RECEIVED = 1, /**< a source has been received */
JERRY_DEBUGGER_SOURCE_END = 2, /**< the end of the sources signal received */
JERRY_DEBUGGER_CONTEXT_RESET_RECEIVED, /**< the context reset request has been received */
} jerry_debugger_wait_and_run_type_t;
} jerry_debugger_wait_for_source_status_t;
/**
* Callback for jerry_debugger_wait_and_run_client_source
*
* The callback receives the resource name, source code and a user pointer.
*
* @return this value is passed back by jerry_debugger_wait_and_run_client_source
*/
typedef jerry_value_t (*jerry_debugger_wait_for_source_callback_t) (const jerry_char_t *resource_name_p,
size_t resource_name_size,
const jerry_char_t *source_p,
size_t source_size, void *user_p);
/**
* Engine debugger functions.
@@ -46,7 +58,9 @@ bool jerry_debugger_is_connected (void);
void jerry_debugger_stop (void);
void jerry_debugger_continue (void);
void jerry_debugger_stop_at_breakpoint (bool enable_stop_at_breakpoint);
jerry_debugger_wait_and_run_type_t jerry_debugger_wait_and_run_client_source (jerry_value_t *return_value);
jerry_debugger_wait_for_source_status_t
jerry_debugger_wait_for_client_source (jerry_debugger_wait_for_source_callback_t callback_p,
void *user_p, jerry_value_t *return_value);
void jerry_debugger_send_output (jerry_char_t buffer[], jerry_size_t str_size, uint8_t type);
/**