com php-src: added compat.h: compat/PECL_PORTING compat/com pat.h

From: Date: Sun, 12 Jan 2014 14:48:47 +0000
Subject: com php-src: added compat.h: compat/PECL_PORTING compat/com pat.h
Groups: php.cvs 
Request: Send a blank email to php-cvs+get-75575@lists.php.net to get a copy of this message
Commit: 2487493f83cb71b0684a70799c5c907f8b4158ca Author: Anatol Belski <ab@php.net> Sun, 12 Jan 2014 15:48:47 +0100 Parents: 3957288cf7f3221236cf2c8b51e32bb405fcd732 Branches: str_size_and_int64 Link: http://git.php.net/?p=php-src.git;a=commitdiff;h=2487493f83cb71b0684a70799c5c907f8b4158ca Log: added compat.h Changed paths: M compat/PECL_PORTING A compat/compat.h Diff: diff --git a/compat/PECL_PORTING b/compat/PECL_PORTING index e2bb07e..d1086d7 100644 --- a/compat/PECL_PORTING +++ b/compat/PECL_PORTING @@ -43,6 +43,9 @@ II. Porting steps i. Automatic replacements ii. Explicit compilation enablement + + #define PHP_CONSISTENT_x64 1 + iii. Compatibility header iv. zend_parse_parameters() v. Manual code fixes diff --git a/compat/compat.h b/compat/compat.h new file mode 100644 index 0000000..66b45f1 --- /dev/null +++ b/compat/compat.h @@ -0,0 +1,151 @@ +/* + +----------------------------------------------------------------------+ + | PHP Version 5 | + +----------------------------------------------------------------------+ + | Copyright (c) 1997-2014 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 | + | license@php.net so we can mail you a copy immediately. | + +----------------------------------------------------------------------+ + | Author: Anatol Belski <ab@php.net> | + +----------------------------------------------------------------------+ +*/ + +/* $Id$ */ + +#ifndef PHP_SIZE_INT_COMPAT_H +#define PHP_SIZE_INT_COMPAT_H + +/* XXX change the check accordingly to the vote results */ +#define PHP_NEED_COMPAT (PHP_MAJOR_VERSION < 5) || (PHP_MAJOR_VERSION == 5 && PHP_MINOR_VERSION < 6) + +#if PHP_NEED_COMPAT || PHP_FORCE_COMPAT + +typedef long zend_int_t; +typedef unsigned long zend_uint_t; +typedef long zend_off_t; +typedef size_t zend_size_t; +typedef struct stat zend_stat_t; +# define ZEND_INT_MAX LONG_MAX +# define ZEND_INT_MIN LONG_MIN +# define ZEND_UINT_MAX ULONG_MAX +# define ZEND_SIZE_MAX SIZE_MAX +# define Z_I(i) i +# define Z_UI(i) i +# define SIZEOF_ZEND_INT SIZEOF_LONG +# define ZEND_STRTOL(s0, s1, base) strtol((s0), (s1), (base)) +# define ZEND_STRTOUL(s0, s1, base) strtoul((s0), (s1), (base)) +# ifdef PHP_WIN32 +# define ZEND_ITOA(i, s, len) _ltoa_s((i), (s), (len), 10) +# define ZEND_ATOI(i, s) i = atol((s)) +# else +# define ZEND_ITOA(i, s, len) \ + do { \ + int st = snprintf((s), (len), "%ld", (i)); \ + (s)[st] = '\0'; \ + } while (0) +# define ZEND_ATOI(i, s) (i) = atol((s)) +# endif +# define ZEND_INT_FMT "%ld" +# define ZEND_UINT_FMT "%lu" +# define ZEND_INT_FMT_SPEC "ld" +# define ZEND_UINT_FMT_SPEC "lu" +# define ZEND_STRTOL_PTR strtol +# define ZEND_STRTOUL_PTR strtoul +# define ZEND_ABS abs +# define zend_fseek fseek +# define zend_ftell ftell +# define zend_lseek lseek +# define zend_fstat fstat +# define zend_stat stat +# define php_fstat fstat +# define php_stat_fn stat + +#define php_size_t zend_size_t +#define php_int_t zend_int_t +#define php_uint_t zend_uint_t +#define php_stat_t zend_stat_t +#define PHP_INT_MAX ZEND_INT_MAX +#define PHP_INT_MIN ZEND_INT_MIN +#define PHP_UINT_MAX ZEND_UINT_MAX +#define PHP_SIZE_MAX ZEND_SIZE_MAX + +# define ZEND_SIZE_MAX ZEND_SIZE_MAX_LONG +# define ZEND_SIZE_MAX ZEND_SIZE_MAX_INT +# define MAX_LENGTH_OF_ZEND_INT MAX_LENGTH_OF_LONG +# define Z_STRSIZE Z_STRLEN +# define Z_IVAL Z_LVAL +# define IS_INT IS_LONG +# define ZVAL_INT ZVAL_LONG +# define RETVAL_INT RETVAL_LONG +# define RETURN_INT RETURN_LONG +# define LITERAL_INT LITERAL_LONG +# define REGISTER_INT_CONSTANT REGISTER_LONG_CONSTANT +# define REGISTER_NS_INT_CONSTANT REGISTER_NS_LONG_CONSTANT +# define REGISTER_MAIN_INT_CONSTANT REGISTER_MAIN_LONG_CONSTANT +# define HASH_KEY_IS_INT HASH_KEY_IS_LONG +# define convert_to_int convert_to_long +# define add_assoc_int add_assoc_long +# define add_property_int add_property_long +# define zendi_convert_to_int zendi_convert_to_long +# define zend_ini_int zend_ini_long +# define ZEND_SIGNED_MULTIPLY_INT ZEND_SIGNED_MULTIPLY_LONG +# define zend_update_property_int zend_update_property_long +# define SET_VAR_INT SET_VAR_LONG +# define zend_declare_class_constant_int zend_declare_class_constant_long +# define add_get_index_int add_get_index_long +# define add_next_index_int add_next_index_long +# define zend_update_static_property_int zend_update_static_property_long +# define zend_register_int_constant zend_register_long_constant +# define add_index_int add_index_long +# define zend_declare_property_int zend_declare_property_long +# define ZEND_MM_INT_CONST ZEND_MM_LONG_CONST +# define REGISTER_PDO_CLASS_CONST_INT REGISTER_PDO_CLASS_CONST_LONG +# define PDO_INT_PARAM_CHECK PDO_LONG_PARAM_CHECK +# define REGISTER_XMLREADER_CLASS_CONST_INT REGISTER_XMLREADER_CLASS_CONST_LONG +# define CALENDAR_DECL_INT_CONST CALENDAR_DECL_LONG_CONST +# define TIMEZONE_DECL_INT_CONST TIMEZONE_DECL_LONG_CONST +# define BREAKITER_DECL_INT_CONST BREAKITER_DECL_LONG_CONST +# define REGISTER_SPL_CLASS_CONST_INT REGISTER_SPL_CLASS_CONST_LONG +# define REGISTER_REFLECTION_CLASS_CONST_INT REGISTER_REFLECTION_CLASS_CONST_LONG +# define REGISTER_PHAR_CLASS_CONST_INT REGISTER_PHAR_CLASS_CONST_LONG +# define MAKE_INT_ZVAL_INCREF MAKE_LONG_ZVAL_INCREF +# define MYSQLI_RETURN_INT_INT MYSQLI_RETURN_INT_LONG +# define MYSQLI_MAP_PROPERTY_FUNC_INT MYSQLI_MAP_PROPERTY_FUNC_LONG +# define REGISTER_ZIP_CLASS_CONST_INT REGISTER_ZIP_CLASS_CONST_LONG +# define REGISTER_SNMP_CLASS_CONST_INT REGISTER_SNMP_CLASS_CONST_LONG +# define PHP_SNMP_INT_PROPERTY_READER_FUNCTION PHP_SNMP_LONG_PROPERTY_READER_FUNCTION +# define ISC_INT_MIN ISC_LONG_MIN +# define ISC_INT_MAX ISC_LONG_MAX +# define int_min_digits long_min_digits +# define zend_dval_to_ival zend_dval_to_lval +# define ZEND_DVAL_TO_IVAL_CAST_OK ZEND_DVAL_TO_LVAL_CAST_OK +# define smart_str_append_int smart_str_append_long +# define cfg_get_int cfg_get_long +# define pdo_attr_ival pdo_attr_lval + + +# define zend_parse_parameters_comp zend_parse_parameters +# define zend_parse_method_parameters_comp zend_parse_method_parameters + +#else + +# define zend_parse_parameters_comp zend_parse_parameters +# define zend_parse_method_parameters_comp zend_parse_method_parameters + +#endif + +#endif /* PHP_SIZE_INT_COMPAT_H */ + +/* + * Local variables: + * tab-width: 4 + * c-basic-offset: 4 + * indent-tabs-mode: t + * End: + */

« previous php.cvs (#75575) next »