/src/php-src/Zend/zend_attributes.h
Line | Count | Source (jump to first uncovered line) |
1 | | /* |
2 | | +----------------------------------------------------------------------+ |
3 | | | Zend Engine | |
4 | | +----------------------------------------------------------------------+ |
5 | | | Copyright (c) Zend Technologies Ltd. (http://www.zend.com) | |
6 | | +----------------------------------------------------------------------+ |
7 | | | This source file is subject to version 2.00 of the Zend license, | |
8 | | | that is bundled with this package in the file LICENSE, and is | |
9 | | | available through the world-wide-web at the following url: | |
10 | | | http://www.zend.com/license/2_00.txt. | |
11 | | | If you did not receive a copy of the Zend license and are unable to | |
12 | | | obtain it through the world-wide-web, please send a note to | |
13 | | | license@zend.com so we can mail you a copy immediately. | |
14 | | +----------------------------------------------------------------------+ |
15 | | | Authors: Benjamin Eberlei <kontakt@beberlei.de> | |
16 | | | Martin Schröder <m.schroeder2007@gmail.com> | |
17 | | +----------------------------------------------------------------------+ |
18 | | */ |
19 | | |
20 | | #ifndef ZEND_ATTRIBUTES_H |
21 | | #define ZEND_ATTRIBUTES_H |
22 | | |
23 | 11.8k | #define ZEND_ATTRIBUTE_TARGET_CLASS (1<<0) |
24 | 7.05k | #define ZEND_ATTRIBUTE_TARGET_FUNCTION (1<<1) |
25 | 4.17k | #define ZEND_ATTRIBUTE_TARGET_METHOD (1<<2) |
26 | 5.62k | #define ZEND_ATTRIBUTE_TARGET_PROPERTY (1<<3) |
27 | 3.80k | #define ZEND_ATTRIBUTE_TARGET_CLASS_CONST (1<<4) |
28 | 4.07k | #define ZEND_ATTRIBUTE_TARGET_PARAMETER (1<<5) |
29 | 5.26k | #define ZEND_ATTRIBUTE_TARGET_ALL ((1<<6) - 1) |
30 | 5.22k | #define ZEND_ATTRIBUTE_IS_REPEATABLE (1<<6) |
31 | 1.05k | #define ZEND_ATTRIBUTE_FLAGS ((1<<7) - 1) |
32 | | |
33 | | #define ZEND_ATTRIBUTE_SIZE(argc) (sizeof(zend_attribute) + sizeof(zval) * (argc) - sizeof(zval)) |
34 | | |
35 | | BEGIN_EXTERN_C() |
36 | | |
37 | | extern ZEND_API zend_class_entry *zend_ce_attribute; |
38 | | |
39 | | typedef struct _zend_attribute { |
40 | | zend_string *name; |
41 | | zend_string *lcname; |
42 | | /* Parameter offsets start at 1, everything else uses 0. */ |
43 | | uint32_t offset; |
44 | | uint32_t argc; |
45 | | zval argv[1]; |
46 | | } zend_attribute; |
47 | | |
48 | | typedef struct _zend_internal_attribute { |
49 | | zend_class_entry *ce; |
50 | | uint32_t flags; |
51 | | void (*validator)(zend_attribute *attr, uint32_t target, zend_class_entry *scope); |
52 | | } zend_internal_attribute; |
53 | | |
54 | | ZEND_API zend_attribute *zend_get_attribute(HashTable *attributes, zend_string *lcname); |
55 | | ZEND_API zend_attribute *zend_get_attribute_str(HashTable *attributes, const char *str, size_t len); |
56 | | |
57 | | ZEND_API zend_attribute *zend_get_parameter_attribute(HashTable *attributes, zend_string *lcname, uint32_t offset); |
58 | | ZEND_API zend_attribute *zend_get_parameter_attribute_str(HashTable *attributes, const char *str, size_t len, uint32_t offset); |
59 | | |
60 | | ZEND_API int zend_get_attribute_value(zval *ret, zend_attribute *attr, uint32_t i, zend_class_entry *scope); |
61 | | |
62 | | ZEND_API zend_string *zend_get_attribute_target_names(uint32_t targets); |
63 | | ZEND_API zend_bool zend_is_attribute_repeated(HashTable *attributes, zend_attribute *attr); |
64 | | |
65 | | ZEND_API zend_internal_attribute *zend_internal_attribute_register(zend_class_entry *ce, uint32_t flags); |
66 | | ZEND_API zend_internal_attribute *zend_internal_attribute_get(zend_string *lcname); |
67 | | |
68 | | ZEND_API zend_attribute *zend_add_attribute(HashTable **attributes, zend_bool persistent, uint32_t offset, zend_string *name, uint32_t argc); |
69 | | |
70 | | END_EXTERN_C() |
71 | | |
72 | | static zend_always_inline zend_attribute *zend_add_class_attribute(zend_class_entry *ce, zend_string *name, uint32_t argc) |
73 | 3.54k | { |
74 | 3.54k | return zend_add_attribute(&ce->attributes, ce->type != ZEND_USER_CLASS, 0, name, argc); |
75 | 3.54k | } Unexecuted instantiation: php_reflection.c:zend_add_class_attribute Unexecuted instantiation: zend_compile.c:zend_add_class_attribute Unexecuted instantiation: zend.c:zend_add_class_attribute zend_attributes.c:zend_add_class_attribute Line | Count | Source | 73 | 3.54k | { | 74 | 3.54k | return zend_add_attribute(&ce->attributes, ce->type != ZEND_USER_CLASS, 0, name, argc); | 75 | 3.54k | } |
Unexecuted instantiation: zend_default_classes.c:zend_add_class_attribute |
76 | | |
77 | | static zend_always_inline zend_attribute *zend_add_function_attribute(zend_function *func, zend_string *name, uint32_t argc) |
78 | 0 | { |
79 | 0 | return zend_add_attribute(&func->common.attributes, func->common.type != ZEND_USER_FUNCTION, 0, name, argc); |
80 | 0 | } Unexecuted instantiation: php_reflection.c:zend_add_function_attribute Unexecuted instantiation: zend_compile.c:zend_add_function_attribute Unexecuted instantiation: zend.c:zend_add_function_attribute Unexecuted instantiation: zend_attributes.c:zend_add_function_attribute Unexecuted instantiation: zend_default_classes.c:zend_add_function_attribute |
81 | | |
82 | | static zend_always_inline zend_attribute *zend_add_parameter_attribute(zend_function *func, uint32_t offset, zend_string *name, uint32_t argc) |
83 | 0 | { |
84 | 0 | return zend_add_attribute(&func->common.attributes, func->common.type != ZEND_USER_FUNCTION, offset + 1, name, argc); |
85 | 0 | } Unexecuted instantiation: php_reflection.c:zend_add_parameter_attribute Unexecuted instantiation: zend_compile.c:zend_add_parameter_attribute Unexecuted instantiation: zend.c:zend_add_parameter_attribute Unexecuted instantiation: zend_attributes.c:zend_add_parameter_attribute Unexecuted instantiation: zend_default_classes.c:zend_add_parameter_attribute |
86 | | |
87 | | static zend_always_inline zend_attribute *zend_add_property_attribute(zend_class_entry *ce, zend_property_info *info, zend_string *name, uint32_t argc) |
88 | 0 | { |
89 | 0 | return zend_add_attribute(&info->attributes, ce->type != ZEND_USER_CLASS, 0, name, argc); |
90 | 0 | } Unexecuted instantiation: php_reflection.c:zend_add_property_attribute Unexecuted instantiation: zend_compile.c:zend_add_property_attribute Unexecuted instantiation: zend.c:zend_add_property_attribute Unexecuted instantiation: zend_attributes.c:zend_add_property_attribute Unexecuted instantiation: zend_default_classes.c:zend_add_property_attribute |
91 | | |
92 | | static zend_always_inline zend_attribute *zend_add_class_constant_attribute(zend_class_entry *ce, zend_class_constant *c, zend_string *name, uint32_t argc) |
93 | 0 | { |
94 | 0 | return zend_add_attribute(&c->attributes, ce->type != ZEND_USER_CLASS, 0, name, argc); |
95 | 0 | } Unexecuted instantiation: php_reflection.c:zend_add_class_constant_attribute Unexecuted instantiation: zend_compile.c:zend_add_class_constant_attribute Unexecuted instantiation: zend.c:zend_add_class_constant_attribute Unexecuted instantiation: zend_attributes.c:zend_add_class_constant_attribute Unexecuted instantiation: zend_default_classes.c:zend_add_class_constant_attribute |
96 | | |
97 | | void zend_register_attribute_ce(void); |
98 | | void zend_attributes_shutdown(void); |
99 | | |
100 | | #endif |