diff --git a/Zend/zend.h b/Zend/zend.h index 3eaf62ace11..a0c0fc2126d 100644 --- a/Zend/zend.h +++ b/Zend/zend.h @@ -39,6 +39,7 @@ #include "zend_smart_str_public.h" #include "zend_smart_string_public.h" #include "zend_signal.h" +#include "zend_type_code.h" #define zend_sprintf sprintf diff --git a/Zend/zend_API.h b/Zend/zend_API.h index ca33e96656b..ab58f7db72d 100644 --- a/Zend/zend_API.h +++ b/Zend/zend_API.h @@ -28,7 +28,7 @@ #include "zend_variables.h" #include "zend_execute.h" #include "zend_type_info.h" - +#include "zend_type_code.h" BEGIN_EXTERN_C() diff --git a/Zend/zend_execute.h b/Zend/zend_execute.h index 2370c3045fc..db6bdaff86f 100644 --- a/Zend/zend_execute.h +++ b/Zend/zend_execute.h @@ -24,6 +24,7 @@ #include "zend_compile.h" #include "zend_hash.h" #include "zend_operators.h" +#include "zend_type_code.h" #include "zend_variables.h" #include diff --git a/Zend/zend_hash.h b/Zend/zend_hash.h index d9210d07318..dfcf9c0c8b5 100644 --- a/Zend/zend_hash.h +++ b/Zend/zend_hash.h @@ -23,6 +23,7 @@ #include "zend.h" #include "zend_sort.h" +#include "zend_type_code.h" #define HASH_KEY_IS_STRING 1 #define HASH_KEY_IS_LONG 2 diff --git a/Zend/zend_type_code.h b/Zend/zend_type_code.h new file mode 100644 index 00000000000..d0a14fc821b --- /dev/null +++ b/Zend/zend_type_code.h @@ -0,0 +1,58 @@ +/* + +----------------------------------------------------------------------+ + | Zend Engine | + +----------------------------------------------------------------------+ + | Copyright (c) Zend Technologies Ltd. (http://www.zend.com) | + +----------------------------------------------------------------------+ + | This source file is subject to version 2.00 of the Zend 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.zend.com/license/2_00.txt. | + | If you did not receive a copy of the Zend license and are unable to | + | obtain it through the world-wide-web, please send a note to | + | license@zend.com so we can mail you a copy immediately. | + +----------------------------------------------------------------------+ +*/ + +#ifndef ZEND_TYPE_CODE_H +#define ZEND_TYPE_CODE_H + +/* Regular data types: Must be in sync with zend_variables.c. */ +#define IS_UNDEF 0 +#define IS_NULL 1 +#define IS_FALSE 2 +#define IS_TRUE 3 +#define IS_LONG 4 +#define IS_DOUBLE 5 +#define IS_STRING 6 +#define IS_ARRAY 7 +#define IS_OBJECT 8 +#define IS_RESOURCE 9 +#define IS_REFERENCE 10 +#define IS_CONSTANT_AST 11 /* Constant expressions */ + +/* Fake types used only for type hinting. + * These are allowed to overlap with the types below. */ +#define IS_CALLABLE 12 +#define IS_ITERABLE 13 +#define IS_VOID 14 +#define IS_STATIC 15 +#define IS_MIXED 16 +#define IS_NEVER 17 + +/* internal types */ +#define IS_INDIRECT 12 +#define IS_PTR 13 +#define IS_ALIAS_PTR 14 +#define _IS_ERROR 15 + +/* used for casts */ +#define _IS_BOOL 18 +#define _IS_NUMBER 19 + +#define ZEND_SAME_FAKE_TYPE(faketype, realtype) ( \ + (faketype) == (realtype) \ + || ((faketype) == _IS_BOOL && ((realtype) == IS_TRUE || (realtype) == IS_FALSE)) \ +) + +#endif /* ZEND_TYPE_CODE_H */ diff --git a/Zend/zend_types.h b/Zend/zend_types.h index 034ea96f0c0..d8a3fc0edf0 100644 --- a/Zend/zend_types.h +++ b/Zend/zend_types.h @@ -26,6 +26,7 @@ #include "zend_long.h" #include "zend_rc_debug.h" #include "zend_result.h" +#include "zend_type_code.h" #include #include @@ -538,48 +539,10 @@ struct _zend_ast_ref { /*zend_ast ast; zend_ast follows the zend_ast_ref structure */ }; -/* Regular data types: Must be in sync with zend_variables.c. */ -#define IS_UNDEF 0 -#define IS_NULL 1 -#define IS_FALSE 2 -#define IS_TRUE 3 -#define IS_LONG 4 -#define IS_DOUBLE 5 -#define IS_STRING 6 -#define IS_ARRAY 7 -#define IS_OBJECT 8 -#define IS_RESOURCE 9 -#define IS_REFERENCE 10 -#define IS_CONSTANT_AST 11 /* Constant expressions */ - -/* Fake types used only for type hinting. - * These are allowed to overlap with the types below. */ -#define IS_CALLABLE 12 -#define IS_ITERABLE 13 -#define IS_VOID 14 -#define IS_STATIC 15 -#define IS_MIXED 16 -#define IS_NEVER 17 - -/* internal types */ -#define IS_INDIRECT 12 -#define IS_PTR 13 -#define IS_ALIAS_PTR 14 -#define _IS_ERROR 15 - -/* used for casts */ -#define _IS_BOOL 18 -#define _IS_NUMBER 19 - static zend_always_inline uint8_t zval_get_type(const zval* pz) { return pz->u1.v.type; } -#define ZEND_SAME_FAKE_TYPE(faketype, realtype) ( \ - (faketype) == (realtype) \ - || ((faketype) == _IS_BOOL && ((realtype) == IS_TRUE || (realtype) == IS_FALSE)) \ -) - /* we should never set just Z_TYPE, we should set Z_TYPE_INFO */ #define Z_TYPE(zval) zval_get_type(&(zval)) #define Z_TYPE_P(zval_p) Z_TYPE(*(zval_p))