more on functions

This commit is contained in:
krakjoe 2013-11-19 21:54:58 +00:00
parent 5af371409c
commit b65cef950a
2 changed files with 61 additions and 31 deletions

View file

@ -331,17 +331,33 @@ int phpdbg_do_cmd_ex(const phpdbg_command_t *command, phpdbg_input_t *input TSRM
(command->alias &&
(input->argv[0]->length == 1) &&
(command->alias == *input->argv[0]->string))) {
if (command->subs && input->argc > 1) {
phpdbg_input_t sub;
phpdbg_param_t param;
param.type = EMPTY_PARAM;
if (input->argc > 1) {
if (command->subs) {
phpdbg_input_t sub;
sub.argc = input->argc-1;
sub.argv = &input->argv[1];
phpdbg_debug(
"trying sub commands in \"%s\" for \"%s\" with %d arguments",
command->name, sub.argv[0]->string, sub.argc-1);
sub.argc = input->argc-1;
sub.argv = &input->argv[1];
return phpdbg_do_cmd_ex(command->subs, &sub TSRMLS_CC);
return phpdbg_do_cmd_ex(command->subs, &sub TSRMLS_CC);
} else {
phpdbg_parse_param(
input->argv[1]->string,
input->argv[1]->length,
&param TSRMLS_CC);
}
}
phpdbg_debug(
"found command %s for %s with %d arguments",
"found command \"%s\" for \"%s\" have %d arguments",
command->name, input->argv[0]->string, input->argc-1);
{
int arg;
@ -353,6 +369,14 @@ int phpdbg_do_cmd_ex(const phpdbg_command_t *command, phpdbg_input_t *input TSRM
input->argv[arg]->length);
}
}
PHPDBG_G(lcmd) = (phpdbg_command_t*) command;
phpdbg_clear_param(
&PHPDBG_G(lparam) TSRMLS_CC);
PHPDBG_G(lparam) = param;
rc = command->handler(&param TSRMLS_CC);
break;
}
command++;