logo       

cvs: ZendEngine2(PHP_5_2) / zend.c zend.h: msg#00044

Subject: cvs: ZendEngine2(PHP_5_2) / zend.c zend.h
iliaa           Sun Jun 11 16:28:24 2006 UTC

  Modified files:              (Branch: PHP_5_2)
    /ZendEngine2        zend.c zend.h 
  Log:
  Make zend_print_zval_r_ex() use the write callback function.
  
  
http://cvs.php.net/viewcvs.cgi/ZendEngine2/zend.c?r1=1.308.2.12.2.10&r2=1.308.2.12.2.11&diff_format=u
Index: ZendEngine2/zend.c
diff -u ZendEngine2/zend.c:1.308.2.12.2.10 ZendEngine2/zend.c:1.308.2.12.2.11
--- ZendEngine2/zend.c:1.308.2.12.2.10  Mon Jun  5 13:58:51 2006
+++ ZendEngine2/zend.c  Sun Jun 11 16:28:24 2006
@@ -17,7 +17,7 @@
    +----------------------------------------------------------------------+
 */
 
-/* $Id: zend.c,v 1.308.2.12.2.10 2006/06/05 13:58:51 zeev Exp $ */
+/* $Id: zend.c,v 1.308.2.12.2.11 2006/06/11 16:28:24 iliaa Exp $ */
 
 #include "zend.h"
 #include "zend_extensions.h"
@@ -107,7 +107,7 @@
 
 #define PRINT_ZVAL_INDENT 4
 
-static void print_hash(HashTable *ht, int indent, zend_bool is_object 
TSRMLS_DC)
+static void print_hash(zend_write_func_t write_func, HashTable *ht, int 
indent, zend_bool is_object TSRMLS_DC)
 {
        zval **tmp;
        char *string_key;
@@ -117,48 +117,52 @@
        int i;
 
        for (i=0; i<indent; i++) {
-               ZEND_PUTS(" ");
+               ZEND_PUTS_EX(" ");
        }
-       ZEND_PUTS("(\n");
+       ZEND_PUTS_EX("(\n");
        indent += PRINT_ZVAL_INDENT;
        zend_hash_internal_pointer_reset_ex(ht, &iterator);
        while (zend_hash_get_current_data_ex(ht, (void **) &tmp, &iterator) == 
SUCCESS) {
                for (i=0; i<indent; i++) {
-                       ZEND_PUTS(" ");
+                       ZEND_PUTS_EX(" ");
                }
-               ZEND_PUTS("[");
+               ZEND_PUTS_EX("[");
                switch (zend_hash_get_current_key_ex(ht, &string_key, &str_len, 
&num_key, 0, &iterator)) {
                        case HASH_KEY_IS_STRING:
                                if (is_object) {
                                        char *prop_name, *class_name;
 
                                        
zend_unmangle_property_name_ex(string_key, str_len, &class_name, &prop_name);
-                                       ZEND_PUTS(prop_name);
+                                       ZEND_PUTS_EX(prop_name);
                                        if (class_name) {
                                                if (class_name[0]=='*') {
-                                                       ZEND_PUTS(":protected");
+                                                       
ZEND_PUTS_EX(":protected");
                                                } else {
-                                                       ZEND_PUTS(":private");
+                                                       
ZEND_PUTS_EX(":private");
                                                }
                                        }
                                } else {
-                                       ZEND_WRITE(string_key, str_len-1);
+                                       ZEND_WRITE_EX(string_key, str_len-1);
                                }
                                break;
                        case HASH_KEY_IS_LONG:
-                               zend_printf("%ld", num_key);
+                               {
+                                       char key[25];
+                                       sprintf(key, "%ld", num_key);
+                                       ZEND_PUTS_EX(key);
+                               }
                                break;
                }
-               ZEND_PUTS("] => ");
-               zend_print_zval_r(*tmp, indent+PRINT_ZVAL_INDENT TSRMLS_CC);
-               ZEND_PUTS("\n");
+               ZEND_PUTS_EX("] => ");
+               zend_print_zval_r_ex(zend_write, *tmp, indent+PRINT_ZVAL_INDENT 
TSRMLS_CC);
+               ZEND_PUTS_EX("\n");
                zend_hash_move_forward_ex(ht, &iterator);
        }
        indent -= PRINT_ZVAL_INDENT;
        for (i=0; i<indent; i++) {
-               ZEND_PUTS(" ");
+               ZEND_PUTS_EX(" ");
        }
-       ZEND_PUTS(")\n");
+       ZEND_PUTS_EX(")\n");
 }
 
 static void print_flat_hash(HashTable *ht TSRMLS_DC)
@@ -354,13 +358,13 @@
 {
        switch (expr->type) {
                case IS_ARRAY:
-                       ZEND_PUTS("Array\n");
+                       ZEND_PUTS_EX("Array\n");
                        if (++expr->value.ht->nApplyCount>1) {
-                               ZEND_PUTS(" *RECURSION*");
+                               ZEND_PUTS_EX(" *RECURSION*");
                                expr->value.ht->nApplyCount--;
                                return;
                        }
-                       print_hash(expr->value.ht, indent, 0 TSRMLS_CC);
+                       print_hash(write_func, expr->value.ht, indent, 0 
TSRMLS_CC);
                        expr->value.ht->nApplyCount--;
                        break;
                case IS_OBJECT:
@@ -372,7 +376,12 @@
                                if (Z_OBJ_HANDLER_P(expr, get_class_name)) {
                                        Z_OBJ_HANDLER_P(expr, 
get_class_name)(expr, &class_name, &clen, 0 TSRMLS_CC);
                                }
-                               zend_printf("%s Object\n", 
class_name?class_name:"Unknown Class");
+                               if (class_name) {
+                                       ZEND_PUTS_EX(class_name);
+                               } else {
+                                       ZEND_PUTS_EX("Unknown Class");
+                               }
+                               ZEND_PUTS_EX(" Object\n");
                                if (class_name) {
                                        efree(class_name);
                                }
@@ -381,17 +390,17 @@
                                }
                                if (properties) {
                                        if (++properties->nApplyCount>1) {
-                                               ZEND_PUTS(" *RECURSION*");
+                                               ZEND_PUTS_EX(" *RECURSION*");
                                                properties->nApplyCount--;
                                                return;
                                        }
-                                       print_hash(properties, indent, 1 
TSRMLS_CC);
+                                       print_hash(write_func, properties, 
indent, 1 TSRMLS_CC);
                                        properties->nApplyCount--;
                                }
                                break;
                        }
                default:
-                       zend_print_variable(expr);
+                       zend_print_zval_ex(write_func, expr, indent);
                        break;
        }
 }
http://cvs.php.net/viewcvs.cgi/ZendEngine2/zend.h?r1=1.293.2.11.2.3&r2=1.293.2.11.2.4&diff_format=u
Index: ZendEngine2/zend.h
diff -u ZendEngine2/zend.h:1.293.2.11.2.3 ZendEngine2/zend.h:1.293.2.11.2.4
--- ZendEngine2/zend.h:1.293.2.11.2.3   Fri May 19 06:09:14 2006
+++ ZendEngine2/zend.h  Sun Jun 11 16:28:24 2006
@@ -17,7 +17,7 @@
    +----------------------------------------------------------------------+
 */
 
-/* $Id: zend.h,v 1.293.2.11.2.3 2006/05/19 06:09:14 dmitry Exp $ */
+/* $Id: zend.h,v 1.293.2.11.2.4 2006/06/11 16:28:24 iliaa Exp $ */
 
 #ifndef ZEND_H
 #define ZEND_H
@@ -502,7 +502,9 @@
 
 /* output support */
 #define ZEND_WRITE(str, str_len)               zend_write((str), (str_len))
+#define ZEND_WRITE_EX(str, str_len)            write_func((str), (str_len))
 #define ZEND_PUTS(str)                                 zend_write((str), 
strlen((str)))
+#define ZEND_PUTS_EX(str)                              write_func((str), 
strlen((str)))
 #define ZEND_PUTC(c)                                   zend_write(&(c), 1), (c)
 
 

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




<Prev in Thread] Current Thread [Next in Thread>
Google Custom Search

Recently Viewed:
science.linguis...    culture.sf.lite...    video.mplayer.c...    yellowdog.gener...    ietf.rfc822/199...    emacs.help/2002...    redhat.release....    kernel.speakup/...    java.openejb.de...    debian.devel.gt...    xfree86.newbie/...    bug-tracking.ma...    pam/2003-05/msg...    games.devel.ope...    user-groups.lin...    music.pancham/2...    network.mq.deve...    web.html.genera...    arklinux.bugs/2...    linux.ecasound/...    qnx.openqnx.dev...    org.user-groups...    file-systems.sf...    trustix.contrib...   
Home | blog view | USPTO Patent Archive | advertise | OSDir is an inevitable website. super tiny logo

Free Magazines

Cisco News
Receive a free quarterly e-newsletter with exclusive articles on how Cisco IT uses its own products and solutions to enable the business.
subscribe

Systems Management News, the newspaper for IT systems administration and data center managers! Each issue of Systems Management News is chock-full of news and analysis to help you understand what's happening in your field.
subscribe

The Enterprise Newsweekly eWeek is the essential technology information source for builders of e-business.
subscribe

Oracle Magazine Oracle Magazine contains technology strategy articles, sample code, tips, Oracle and partner news, how to articles for developers and DBAs, and more. Oracle (NASDAQ: ORCL) is the world's largest enterprise software company.
subscribe

Total Telecom Total Telecom is "The Economist of the communications industry".
subscribe