diff options
author | krakjoe <joe.watkins@live.co.uk> | 2014-02-19 08:33:54 +0000 |
---|---|---|
committer | krakjoe <joe.watkins@live.co.uk> | 2014-02-19 08:33:54 +0000 |
commit | 996182993da1c35e8c35a3188b4c1adb764320f8 (patch) | |
tree | e276290e0d74f0075eb076378b9b3248baa92828 /phpdbg_prompt.c | |
parent | e2e93ac259150fde9e3660838a2e836daa939acb (diff) | |
download | php-git-996182993da1c35e8c35a3188b4c1adb764320f8.tar.gz |
remove input_t
support single char aliases
...
Diffstat (limited to 'phpdbg_prompt.c')
-rw-r--r-- | phpdbg_prompt.c | 121 |
1 files changed, 68 insertions, 53 deletions
diff --git a/phpdbg_prompt.c b/phpdbg_prompt.c index 1e1f048ebf..aed1f4a015 100644 --- a/phpdbg_prompt.c +++ b/phpdbg_prompt.c @@ -73,66 +73,81 @@ const phpdbg_command_t phpdbg_prompt_commands[] = { ZEND_EXTERN_MODULE_GLOBALS(phpdbg); -static inline int phpdbg_call_register(phpdbg_input_t *input TSRMLS_DC) /* {{{ */ +static inline int phpdbg_call_register(phpdbg_param_t *stack TSRMLS_DC) /* {{{ */ { - phpdbg_input_t *function = input->argv[0]; - - if (zend_hash_exists( - &PHPDBG_G(registered), function->string, function->length+1)) { - - zval fname, *fretval; - zend_fcall_info fci; - - ZVAL_STRINGL(&fname, function->string, function->length, 1); - - memset(&fci, 0, sizeof(zend_fcall_info)); - - fci.size = sizeof(zend_fcall_info); - fci.function_table = &PHPDBG_G(registered); - fci.function_name = &fname; - fci.symbol_table = EG(active_symbol_table); - fci.object_ptr = NULL; - fci.retval_ptr_ptr = &fretval; - fci.no_separation = 1; - - if (input->argc > 1) { - int param; - zval params; - - array_init(¶ms); - - for (param = 0; param < (input->argc-1); param++) { - add_next_index_stringl( - ¶ms, - input->argv[param+1]->string, - input->argv[param+1]->length, 1); + phpdbg_param_t *name = stack; + + if (name->type == STR_PARAM) { + if (zend_hash_exists( + &PHPDBG_G(registered), name->str, name->len+1)) { + + zval fname, *fretval; + zend_fcall_info fci; + + ZVAL_STRINGL(&fname, name->str, name->len, 1); + + memset(&fci, 0, sizeof(zend_fcall_info)); + + fci.size = sizeof(zend_fcall_info); + fci.function_table = &PHPDBG_G(registered); + fci.function_name = &fname; + fci.symbol_table = EG(active_symbol_table); + fci.object_ptr = NULL; + fci.retval_ptr_ptr = &fretval; + fci.no_separation = 1; + + if (stack->next) { + zval params; + phpdbg_param_t *next = stack->next; + + array_init(¶ms); + + while (next) { + switch (next->type) { + case STR_PARAM: + add_next_index_stringl( + ¶ms, + next->str, + next->len, 1); + break; + + case NUMERIC_PARAM: + add_next_index_long(¶ms, next->num); + break; + + default: { + /* not yet */ + } + } + + phpdbg_debug( + "created param[%d] from argv[%d]: %s", + param, param+1, next->str); + next = next->next; + } - phpdbg_debug( - "created param[%d] from argv[%d]: %s", - param, param+1, input->argv[param+1]->string); + zend_fcall_info_args(&fci, ¶ms TSRMLS_CC); + } else { + fci.params = NULL; + fci.param_count = 0; } - zend_fcall_info_args(&fci, ¶ms TSRMLS_CC); - } else { - fci.params = NULL; - fci.param_count = 0; - } - - phpdbg_debug( - "created %d params from %d arguments", - fci.param_count, input->argc); + phpdbg_debug( + "created %d params from arguments", + fci.param_count); - zend_call_function(&fci, NULL TSRMLS_CC); + zend_call_function(&fci, NULL TSRMLS_CC); - if (fretval) { - zend_print_zval_r( - fretval, 0 TSRMLS_CC); - phpdbg_writeln(EMPTY); - } + if (fretval) { + zend_print_zval_r( + fretval, 0 TSRMLS_CC); + phpdbg_writeln(EMPTY); + } - zval_dtor(&fname); + zval_dtor(&fname); - return SUCCESS; + return SUCCESS; + } } return FAILURE; @@ -1027,7 +1042,7 @@ int phpdbg_interactive(TSRMLS_D) /* {{{ */ last: if (PHPDBG_G(lcmd)) { ret = PHPDBG_G(lcmd)->handler( - &PHPDBG_G(lparam), input TSRMLS_CC); + &PHPDBG_G(lparam) TSRMLS_CC); goto out; } } |