helly           Sat Aug 13 06:16:05 2005 EDT

  Modified files:              
    /php-src/ext/standard       type.c php_type.h basic_functions.c 
  Log:
  Add is_unicode(), is_binary() and is_buffer()
  
http://cvs.php.net/diff.php/php-src/ext/standard/type.c?r1=1.31&r2=1.32&ty=u
Index: php-src/ext/standard/type.c
diff -u php-src/ext/standard/type.c:1.31 php-src/ext/standard/type.c:1.32
--- php-src/ext/standard/type.c:1.31    Thu Aug 11 19:36:00 2005
+++ php-src/ext/standard/type.c Sat Aug 13 06:16:04 2005
@@ -16,7 +16,7 @@
    +----------------------------------------------------------------------+
 */
 
-/* $Id: type.c,v 1.31 2005/08/11 23:36:00 andrei Exp $ */
+/* $Id: type.c,v 1.32 2005/08/13 10:16:04 helly Exp $ */
 
 #include "php.h"
 #include "php_incomplete_class.h"
@@ -285,13 +285,47 @@
 /* }}} */
 
 /* {{{ proto bool is_string(mixed var)
-   Returns true if variable is a string */
+   Returns true if variable is a standard string */
 PHP_FUNCTION(is_string)
 {
        php_is_type(INTERNAL_FUNCTION_PARAM_PASSTHRU, IS_STRING);
 }
 /* }}} */
 
+/* {{{ proto bool is_unicode(mixed var)
+   Returns true if variable is a unicode string */
+PHP_FUNCTION(is_unicode)
+{
+       php_is_type(INTERNAL_FUNCTION_PARAM_PASSTHRU, IS_UNICODE);
+}
+/* }}} */
+
+/* {{{ proto bool is_binary(mixed var)
+   Returns true if variable is a binary string */
+PHP_FUNCTION(is_binary)
+{
+       php_is_type(INTERNAL_FUNCTION_PARAM_PASSTHRU, IS_BINARY);
+}
+/* }}} */
+
+/* {{{ proto bool is_buffer(mixed var)
+   Returns true if variable is a ascii, unicode or binary string */
+PHP_FUNCTION(is_buffer)
+{
+       pval **arg;
+
+       if (ZEND_NUM_ARGS() != 1 || zend_get_parameters_ex(1, &arg) == FAILURE) 
{
+               php_error_docref(NULL TSRMLS_CC, E_WARNING, "Only one argument 
expected");
+               RETURN_FALSE;
+       }
+
+       if (Z_TYPE_PP(arg) == IS_STRING || Z_TYPE_PP(arg) == IS_UNICODE || 
Z_TYPE_PP(arg) == IS_BINARY) {
+               RETURN_TRUE;
+       }
+       RETURN_FALSE;
+}
+/* }}} */
+
 /* {{{ proto bool is_array(mixed var)
    Returns true if variable is an array */
 PHP_FUNCTION(is_array)
http://cvs.php.net/diff.php/php-src/ext/standard/php_type.h?r1=1.6&r2=1.7&ty=u
Index: php-src/ext/standard/php_type.h
diff -u php-src/ext/standard/php_type.h:1.6 php-src/ext/standard/php_type.h:1.7
--- php-src/ext/standard/php_type.h:1.6 Wed Aug  3 10:08:11 2005
+++ php-src/ext/standard/php_type.h     Sat Aug 13 06:16:04 2005
@@ -16,7 +16,7 @@
    +----------------------------------------------------------------------+
 */
 
-/* $Id: php_type.h,v 1.6 2005/08/03 14:08:11 sniper Exp $ */
+/* $Id: php_type.h,v 1.7 2005/08/13 10:16:04 helly Exp $ */
 
 #ifndef PHP_TYPE_H
 #define PHP_TYPE_H
@@ -33,6 +33,9 @@
 PHP_FUNCTION(is_float);
 PHP_FUNCTION(is_numeric);
 PHP_FUNCTION(is_string);
+PHP_FUNCTION(is_unicode);
+PHP_FUNCTION(is_binary);
+PHP_FUNCTION(is_buffer);
 PHP_FUNCTION(is_array);
 PHP_FUNCTION(is_object);
 PHP_FUNCTION(is_scalar);
http://cvs.php.net/diff.php/php-src/ext/standard/basic_functions.c?r1=1.728&r2=1.729&ty=u
Index: php-src/ext/standard/basic_functions.c
diff -u php-src/ext/standard/basic_functions.c:1.728 
php-src/ext/standard/basic_functions.c:1.729
--- php-src/ext/standard/basic_functions.c:1.728        Thu Aug 11 19:35:57 2005
+++ php-src/ext/standard/basic_functions.c      Sat Aug 13 06:16:04 2005
@@ -17,7 +17,7 @@
    +----------------------------------------------------------------------+
  */
 
-/* $Id: basic_functions.c,v 1.728 2005/08/11 23:35:57 andrei Exp $ */
+/* $Id: basic_functions.c,v 1.729 2005/08/13 10:16:04 helly Exp $ */
 
 #include "php.h"
 #include "php_streams.h"
@@ -531,6 +531,9 @@
        PHP_FALIAS(is_real,                             is_float,               
                                                NULL)
        PHP_FE(is_numeric,                                                      
                                                        NULL)
        PHP_FE(is_string,                                                       
                                                        NULL)
+       PHP_FE(is_unicode,                                                      
                                                NULL)
+       PHP_FE(is_binary,                                                       
                                                        NULL)
+       PHP_FE(is_buffer,                                                       
                                                        NULL)
        PHP_FE(is_array,                                                        
                                                        NULL)
        PHP_FE(is_object,                                                       
                                                        NULL)
        PHP_FE(is_scalar,                                                       
                                                        NULL)

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

Reply via email to