com php-src: add highlight param to file listing: phpdbg_list .c phpdbg_list.h phpdbg_prompt.c
| From: | Bob Weinand | Date: | Sun, 17 Nov 2013 11:11:09 +0000 |
| Subject: | com php-src: add highlight param to file listing: phpdbg_list .c phpdbg_list.h phpdbg_prompt.c | ||
| Groups: | php.cvs | ||
| Request: | Send a blank email to php-cvs+get-74898@lists.php.net to get a copy of this message | ||
Commit: dcead8ea90537dea6b06306ebb4767b2ff57d5ba
Author: krakjoe <joe.watkins@live.co.uk> Sun, 17 Nov 2013 11:11:09 +0000
Parents: 5768e98cb03a72716c685f7ab90067289d1db67f
Branches: PHP-5.6
Link: http://git.php.net/?p=php-src.git;a=commitdiff;h=dcead8ea90537dea6b06306ebb4767b2ff57d5ba
Log:
add highlight param to file listing
Changed paths:
M phpdbg_list.c
M phpdbg_list.h
M phpdbg_prompt.c
Diff:
diff --git a/phpdbg_list.c b/phpdbg_list.c
index a778f64..ba1e31e 100644
--- a/phpdbg_list.c
+++ b/phpdbg_list.c
@@ -38,8 +38,8 @@ PHPDBG_LIST(lines) /* {{{ */
case EMPTY_PARAM: {
if (PHPDBG_G(exec) || zend_is_executing(TSRMLS_C)) {
if (param->type == EMPTY_PARAM) {
- phpdbg_list_file(phpdbg_current_file(TSRMLS_C), 0, 0 TSRMLS_CC);
- } else phpdbg_list_file(phpdbg_current_file(TSRMLS_C), param->num, 0 TSRMLS_CC);
+ phpdbg_list_file(phpdbg_current_file(TSRMLS_C), 0, 0, 0 TSRMLS_CC);
+ } else phpdbg_list_file(phpdbg_current_file(TSRMLS_C), param->num, 0, 0 TSRMLS_CC);
} else phpdbg_error("Not executing, and execution context not set");
} break;
@@ -106,7 +106,7 @@ PHPDBG_LIST(class) /* {{{ */
phpdbg_list_file(
(*ce)->info.user.filename,
(*ce)->info.user.line_end - (*ce)->info.user.line_start + 1,
- (*ce)->info.user.line_start TSRMLS_CC
+ (*ce)->info.user.line_start, 0 TSRMLS_CC
);
} else {
phpdbg_error("The source of the requested class (%s) cannot be
found", (*ce)->name);
@@ -125,7 +125,7 @@ PHPDBG_LIST(class) /* {{{ */
return SUCCESS;
} /* }}} */
-void phpdbg_list_file(const char *filename, long count, long offset TSRMLS_DC) /* {{{ */
+void phpdbg_list_file(const char *filename, long count, long offset, int highlight TSRMLS_DC) /*
{{{ */
{
unsigned char *mem, *pos, *last_pos, *end_pos;
struct stat st;
@@ -185,7 +185,13 @@ void phpdbg_list_file(const char *filename, long count, long offset TSRMLS_DC)
/
if (!offset || offset <= line) {
/* Without offset, or offset reached */
- phpdbg_writeln("%05u: %.*s", line, (int)(pos - last_pos), last_pos);
+ if (!highlight) {
+ phpdbg_writeln("%05u: %.*s", line, (int)(pos - last_pos), last_pos);
+ } else {
+ if (highlight != line) {
+ phpdbg_writeln(" %05u: %.*s", line, (int)(pos - last_pos), last_pos);
+ } else phpdbg_writeln(">%05u: %.*s", line, (int)(pos - last_pos), last_pos);
+ }
++displayed;
}
@@ -220,7 +226,7 @@ void phpdbg_list_function(const zend_function *fbc TSRMLS_DC) /* {{{ */
ops = (zend_op_array*)fbc;
phpdbg_list_file(ops->filename,
- ops->line_end - ops->line_start + 1, ops->line_start TSRMLS_CC);
+ ops->line_end - ops->line_start + 1, ops->line_start, 0 TSRMLS_CC);
} /* }}} */
void phpdbg_list_function_byname(const char *str, size_t len TSRMLS_DC)
diff --git a/phpdbg_list.h b/phpdbg_list.h
index 5c7e988..0d869a9 100644
--- a/phpdbg_list.h
+++ b/phpdbg_list.h
@@ -41,7 +41,7 @@ PHPDBG_LIST(func);
void phpdbg_list_function_byname(const char *, size_t TSRMLS_DC);
void phpdbg_list_function(const zend_function* TSRMLS_DC);
-void phpdbg_list_file(const char*, long, long TSRMLS_DC);
+void phpdbg_list_file(const char*, long, long, int TSRMLS_DC);
static const phpdbg_command_t phpdbg_list_commands[] = {
PHPDBG_LIST_EX_D(lines, "lists the specified lines", 'l'),
diff --git a/phpdbg_prompt.c b/phpdbg_prompt.c
index 0281fd7..d68933b 100644
--- a/phpdbg_prompt.c
+++ b/phpdbg_prompt.c
@@ -698,13 +698,13 @@ static PHPDBG_COMMAND(list) /* {{{ */
case EMPTY_PARAM: {
if (PHPDBG_G(exec) || zend_is_executing(TSRMLS_C)) {
if (param->type == EMPTY_PARAM) {
- phpdbg_list_file(phpdbg_current_file(TSRMLS_C), 0, 0 TSRMLS_CC);
- } else phpdbg_list_file(phpdbg_current_file(TSRMLS_C), param->num, 0 TSRMLS_CC);
+ phpdbg_list_file(phpdbg_current_file(TSRMLS_C), 0, 0, 0 TSRMLS_CC);
+ } else phpdbg_list_file(phpdbg_current_file(TSRMLS_C), param->num, 0, 0 TSRMLS_CC);
} else phpdbg_error("Not executing, and execution context not set");
} break;
case FILE_PARAM:
- phpdbg_list_file(param->file.name, param->file.line, 0 TSRMLS_CC);
+ phpdbg_list_file(param->file.name, param->file.line, 0, 0 TSRMLS_CC);
break;
case STR_PARAM: {
@@ -1013,7 +1013,8 @@ zend_vm_enter:
#define DO_INTERACTIVE() do {\
phpdbg_list_file(\
zend_get_executed_filename(TSRMLS_C), \
- 2, \
+ 3, \
+ zend_get_executed_lineno(TSRMLS_C)-1, \
zend_get_executed_lineno(TSRMLS_C) \
TSRMLS_CC\
);\