com php-src: exec last command automatically on enter: phpdbg.c phpdbg.h phpdbg_prompt.c phpdbg_prompt.h

From: Date: Sun, 10 Nov 2013 21:49:37 +0000
Subject: com php-src: exec last command automatically on enter: phpdbg.c phpdbg.h phpdbg_prompt.c phpdbg_prompt.h
Groups: php.cvs 
Request: Send a blank email to php-cvs+get-75161@lists.php.net to get a copy of this message
Commit: 587003ee488189e78585047149c751c2e815d7be Author: krakjoe <joe.watkins@live.co.uk> Sun, 10 Nov 2013 21:49:37 +0000 Parents: 493e81e4c70e28e440544df372536c5171089fff Branches: PHP-5.6 Link: http://git.php.net/?p=php-src.git;a=commitdiff;h=587003ee488189e78585047149c751c2e815d7be Log: exec last command automatically on enter Changed paths: M phpdbg.c M phpdbg.h M phpdbg_prompt.c M phpdbg_prompt.h Diff: diff --git a/phpdbg.c b/phpdbg.c index 997c273..744565f 100644 --- a/phpdbg.c +++ b/phpdbg.c @@ -34,6 +34,9 @@ static inline void php_phpdbg_globals_ctor(zend_phpdbg_globals *pg) /* {{{ */ pg->quitting = 0; pg->bp_count = 0; pg->quiet = 0; + pg->last = NULL; + pg->last_params = NULL; + pg->last_params_len = 0; } /* }}} */ static PHP_MINIT_FUNCTION(phpdbg) /* {{{ */ diff --git a/phpdbg.h b/phpdbg.h index c9f3e5e..0ac807d 100644 --- a/phpdbg.h +++ b/phpdbg.h @@ -44,6 +44,8 @@ #define PHPDBG_NEXT 2 +typedef struct _phpdbg_command_t phpdbg_command_t; + ZEND_BEGIN_MODULE_GLOBALS(phpdbg) HashTable bp_files; HashTable bp_symbols; @@ -58,6 +60,9 @@ ZEND_BEGIN_MODULE_GLOBALS(phpdbg) zend_bool has_sym_bp; /* symbol-based breakpoint has been set */ zend_bool quitting; /* quitting flag */ int quiet; /* quiet */ + phpdbg_command_t *last; /* last command */ + const char *last_params;/* last expression */ + size_t last_params_len; /* last expression length */ ZEND_END_MODULE_GLOBALS(phpdbg) #endif /* PHPDBG_H */ diff --git a/phpdbg_prompt.c b/phpdbg_prompt.c index 684e88c..4c5b517 100644 --- a/phpdbg_prompt.c +++ b/phpdbg_prompt.c @@ -58,7 +58,7 @@ static inline int phpdbg_compile(TSRMLS_D) /* {{{ */ if (!EG(in_execution)) { printf("Attempting compilation of %s\n", PHPDBG_G(exec)); - + if (php_stream_open_for_zend_ex(PHPDBG_G(exec), &fh, USE_PATH|STREAM_OPEN_FOR_INCLUDE TSRMLS_CC) == SUCCESS) { PHPDBG_G(ops) = zend_compile_file( @@ -310,7 +310,10 @@ int phpdbg_do_cmd(const phpdbg_command_t *command, char *cmd_line, size_t cmd_le while (command && command->name) { if (command->name_len == expr_len - && memcmp(cmd, command->name, expr_len) == 0) { + && memcmp(cmd, command->name, expr_len) == 0) { + PHPDBG_G(last) = command; + PHPDBG_G(last_params) = params; + PHPDBG_G(last_params_len) = cmd_len - expr_len; return command->handler(params, cmd_len - expr_len TSRMLS_CC); } ++command; @@ -346,11 +349,15 @@ int phpdbg_interactive(int argc, char **argv TSRMLS_DC) /* {{{ */ return PHPDBG_NEXT; } + } else if (PHPDBG_G(last)) { + PHPDBG_G(last)->handler( + PHPDBG_G(last_params), PHPDBG_G(last_params_len) TSRMLS_CC); } if (!PHPDBG_G(quitting)) { printf("phpdbg> "); } + } return SUCCESS; diff --git a/phpdbg_prompt.h b/phpdbg_prompt.h index b6921d6..c0590e2 100644 --- a/phpdbg_prompt.h +++ b/phpdbg_prompt.h @@ -35,13 +35,13 @@ typedef int (*phpdbg_command_handler_t)(const char* expr, size_t expr_len TSRMLS /** * Command representation */ -typedef struct _phpdbg_command_t { +struct _phpdbg_command_t { const char *name; /* Command name */ size_t name_len; /* Command name length */ const char *tip; /* Menu tip */ size_t tip_len; /* Menu tip length */ phpdbg_command_handler_t handler; /* Command handler */ -} phpdbg_command_t; +} ; /** * Command Executor

« previous php.cvs (#75161) next »