Commit:    c00abb0e75628d2284f76098e43626266a440d3e
Author:    krakjoe <joe.watk...@live.co.uk>         Tue, 12 Nov 2013 08:26:11 
+0000
Parents:   ff4c0c9397d7435ab8462fedd3e89fe2c9e3c4d4
Branches:  PHP-5.6

Link:       
http://git.php.net/?p=php-src.git;a=commitdiff;h=c00abb0e75628d2284f76098e43626266a440d3e

Log:
printer commands

Changed paths:
  M  config.m4
  A  phpdbg_print.c
  A  phpdbg_print.h
  M  phpdbg_prompt.c


Diff:
diff --git a/config.m4 b/config.m4
index df12708..92f626e 100644
--- a/config.m4
+++ b/config.m4
@@ -9,7 +9,7 @@ if test "$PHP_PHPDBG" != "no"; then
   AC_DEFINE(HAVE_PHPDBG, 1, [ ])
 
   PHP_PHPDBG_CFLAGS="-I$abc_srcdir"
-  PHP_PHPDBG_FILES="phpdbg.c phpdbg_prompt.c phpdbg_help.c phpdbg_bp.c 
phpdbg_opcode.c phpdbg_list.c phpdbg_utils.c"
+  PHP_PHPDBG_FILES="phpdbg.c phpdbg_prompt.c phpdbg_help.c phpdbg_print.c 
phpdbg_bp.c phpdbg_opcode.c phpdbg_list.c phpdbg_utils.c"
 
   PHP_SUBST(PHP_PHPDBG_CFLAGS)
   PHP_SUBST(PHP_PHPDBG_FILES)
diff --git a/phpdbg_print.c b/phpdbg_print.c
new file mode 100644
index 0000000..c167482
--- /dev/null
+++ b/phpdbg_print.c
@@ -0,0 +1,29 @@
+/*
+   +----------------------------------------------------------------------+
+   | PHP Version 5                                                        |
+   +----------------------------------------------------------------------+
+   | Copyright (c) 1997-2013 The PHP Group                                |
+   +----------------------------------------------------------------------+
+   | This source file is subject to version 3.01 of the PHP license,      |
+   | that is bundled with this package in the file LICENSE, and is        |
+   | available through the world-wide-web at the following url:           |
+   | http://www.php.net/license/3_01.txt                                  |
+   | If you did not receive a copy of the PHP license and are unable to   |
+   | obtain it through the world-wide-web, please send a note to          |
+   | lice...@php.net so we can mail you a copy immediately.               |
+   +----------------------------------------------------------------------+
+   | Authors: Felipe Pena <fel...@php.net>                                |
+   | Authors: Joe Watkins <joe.watk...@live.co.uk>                        |
+   +----------------------------------------------------------------------+
+*/
+
+#include <stdio.h>
+#include "zend.h"
+#include "phpdbg.h"
+#include "phpdbg_print.h"
+
+PHPDBG_PRINT(default) /* {{{ */
+{
+       printf("in default printer\n");
+       return SUCCESS;
+} /* }}} */
diff --git a/phpdbg_print.h b/phpdbg_print.h
new file mode 100644
index 0000000..825316a
--- /dev/null
+++ b/phpdbg_print.h
@@ -0,0 +1,47 @@
+/*
+   +----------------------------------------------------------------------+
+   | PHP Version 5                                                        |
+   +----------------------------------------------------------------------+
+   | Copyright (c) 1997-2013 The PHP Group                                |
+   +----------------------------------------------------------------------+
+   | This source file is subject to version 3.01 of the PHP license,      |
+   | that is bundled with this package in the file LICENSE, and is        |
+   | available through the world-wide-web at the following url:           |
+   | http://www.php.net/license/3_01.txt                                  |
+   | If you did not receive a copy of the PHP license and are unable to   |
+   | obtain it through the world-wide-web, please send a note to          |
+   | lice...@php.net so we can mail you a copy immediately.               |
+   +----------------------------------------------------------------------+
+   | Authors: Felipe Pena <fel...@php.net>                                |
+   | Authors: Joe Watkins <joe.watk...@live.co.uk>                        |
+   +----------------------------------------------------------------------+
+*/
+
+#ifndef PHPDBG_PRINT_H
+#define PHPDBG_PRINT_H
+
+#include "TSRM.h"
+#include "phpdbg_prompt.h"
+
+/**
+ * Command Declarators
+ */
+#define PHPDBG_PRINT_D(name, tip) \
+       {PHPDBG_STRL(#name), tip, sizeof(tip)-1, phpdbg_do_print_##name}
+#define PHPDBG_PRINT(name) \
+       int phpdbg_do_print_##name(const char *expr, size_t expr_len TSRMLS_DC)
+
+/**
+ * Printer Forward Declarations
+ */
+PHPDBG_PRINT(default);
+
+/**
+ * Commands
+ */
+static const phpdbg_command_t phpdbg_print_commands[] = {
+       PHPDBG_PRINT_D(default,     "the default print command"),
+       {NULL, 0, 0}
+};
+
+#endif /* PHPDBG_PRINT_H */
diff --git a/phpdbg_prompt.c b/phpdbg_prompt.c
index d42e638..dd225d6 100644
--- a/phpdbg_prompt.c
+++ b/phpdbg_prompt.c
@@ -23,6 +23,7 @@
 #include "zend_compile.h"
 #include "phpdbg.h"
 #include "phpdbg_help.h"
+#include "phpdbg_print.h"
 #include "phpdbg_bp.h"
 #include "phpdbg_opcode.h"
 #include "phpdbg_list.h"
@@ -228,16 +229,22 @@ static PHPDBG_COMMAND(back) /* {{{ */
 
 static PHPDBG_COMMAND(print) /* {{{ */
 {
-       if (expr_len) {
-               printf("%s\n", expr);
+       if (expr_len > 0L) {
+               if (phpdbg_do_cmd(phpdbg_print_commands, (char*)expr, expr_len 
TSRMLS_CC) == FAILURE) {
+                       printf(
+                           "%sFailed to find print command: %s/%lu%s\n", 
+                           PHPDBG_RED_LINE(TSRMLS_C), expr, expr_len, 
PHPDBG_END_LINE(TSRMLS_C));
+               }
                return SUCCESS;
        }
-#ifdef HAVE_READLINE_H
-    printf("HAVE READLINE\n");
-#endif
 
     printf("--------------------------------------\n");
        printf("Execution Context Information:\n");
+#ifdef HAVE_LIBREADLINE
+    printf("Readline\tyes\n");
+#else
+    printf("Readline\tno\n");
+#endif
        printf("Exec\t\t%s\n", PHPDBG_G(exec) ? PHPDBG_G(exec) : "none");
        printf("Compiled\t%s\n", PHPDBG_G(ops) ? "yes" : "no");
        printf("Stepping\t%s\n", (PHPDBG_G(flags) & PHPDBG_IS_STEPPING) ? "on" 
: "off");


--
PHP CVS Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php

Reply via email to