php-internal-docs 8.4.8
Unofficial docs for php/php-src
Loading...
Searching...
No Matches
zend_attributes.h
Go to the documentation of this file.
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#include "zend_compile.h"
24
25#define ZEND_ATTRIBUTE_TARGET_CLASS (1<<0)
26#define ZEND_ATTRIBUTE_TARGET_FUNCTION (1<<1)
27#define ZEND_ATTRIBUTE_TARGET_METHOD (1<<2)
28#define ZEND_ATTRIBUTE_TARGET_PROPERTY (1<<3)
29#define ZEND_ATTRIBUTE_TARGET_CLASS_CONST (1<<4)
30#define ZEND_ATTRIBUTE_TARGET_PARAMETER (1<<5)
31#define ZEND_ATTRIBUTE_TARGET_ALL ((1<<6) - 1)
32#define ZEND_ATTRIBUTE_IS_REPEATABLE (1<<6)
33#define ZEND_ATTRIBUTE_FLAGS ((1<<7) - 1)
34
35/* Flags for zend_attribute.flags */
36#define ZEND_ATTRIBUTE_PERSISTENT (1<<0)
37#define ZEND_ATTRIBUTE_STRICT_TYPES (1<<1)
38
39#define ZEND_ATTRIBUTE_SIZE(argc) \
40 (sizeof(zend_attribute) + sizeof(zend_attribute_arg) * (argc) - sizeof(zend_attribute_arg))
41
43
50
55
56typedef struct _zend_attribute {
59 uint32_t flags;
60 uint32_t lineno;
61 /* Parameter offsets start at 1, everything else uses 0. */
62 uint32_t offset;
63 uint32_t argc;
66
72
74ZEND_API zend_attribute *zend_get_attribute_str(HashTable *attributes, const char *str, size_t len);
75
77ZEND_API zend_attribute *zend_get_parameter_attribute_str(HashTable *attributes, const char *str, size_t len, uint32_t offset);
78
81
84
88
90 HashTable **attributes, zend_string *name, uint32_t argc,
91 uint32_t flags, uint32_t offset, uint32_t lineno);
92
94
96
97static zend_always_inline zend_attribute *zend_add_class_attribute(zend_class_entry *ce, zend_string *name, uint32_t argc)
98{
99 uint32_t flags = ce->type != ZEND_USER_CLASS ? ZEND_ATTRIBUTE_PERSISTENT : 0;
100 return zend_add_attribute(&ce->attributes, name, argc, flags, 0, 0);
101}
102
103static zend_always_inline zend_attribute *zend_add_function_attribute(zend_function *func, zend_string *name, uint32_t argc)
104{
105 uint32_t flags = func->common.type != ZEND_USER_FUNCTION ? ZEND_ATTRIBUTE_PERSISTENT : 0;
106 return zend_add_attribute(&func->common.attributes, name, argc, flags, 0, 0);
107}
108
109static zend_always_inline zend_attribute *zend_add_parameter_attribute(zend_function *func, uint32_t offset, zend_string *name, uint32_t argc)
110{
111 uint32_t flags = func->common.type != ZEND_USER_FUNCTION ? ZEND_ATTRIBUTE_PERSISTENT : 0;
112 return zend_add_attribute(&func->common.attributes, name, argc, flags, offset + 1, 0);
113}
114
115static zend_always_inline zend_attribute *zend_add_property_attribute(zend_class_entry *ce, zend_property_info *info, zend_string *name, uint32_t argc)
116{
117 uint32_t flags = ce->type != ZEND_USER_CLASS ? ZEND_ATTRIBUTE_PERSISTENT : 0;
118 return zend_add_attribute(&info->attributes, name, argc, flags, 0, 0);
119}
120
121static zend_always_inline zend_attribute *zend_add_class_constant_attribute(zend_class_entry *ce, zend_class_constant *c, zend_string *name, uint32_t argc)
122{
123 uint32_t flags = ce->type != ZEND_USER_CLASS ? ZEND_ATTRIBUTE_PERSISTENT : 0;
124 return zend_add_attribute(&c->attributes, name, argc, flags, 0, 0);
125}
126
128void zend_attributes_shutdown(void);
129
130#endif
size_t len
Definition apprentice.c:174
new_type attr
Definition ffi.c:4364
zend_long offset
zend_string * lcname
zend_string * name
zend_attribute_arg args[1]
zend_string * lcname
char type
Definition zend.h:148
zend_class_entry * ce
void(* validator)(zend_attribute *attr, uint32_t target, zend_class_entry *scope)
HashTable * attributes
ZEND_API zend_class_entry * zend_ce_override
ZEND_API zend_class_entry * zend_ce_sensitive_parameter_value
ZEND_API zend_class_entry * zend_ce_sensitive_parameter
ZEND_API zend_class_entry * zend_ce_allow_dynamic_properties
ZEND_API zend_class_entry * zend_ce_attribute
ZEND_API zend_class_entry * zend_ce_deprecated
ZEND_API zend_internal_attribute * zend_internal_attribute_get(zend_string *lcname)
ZEND_API zend_internal_attribute * zend_internal_attribute_register(zend_class_entry *ce, uint32_t flags)
ZEND_API zend_attribute * zend_add_attribute(HashTable **attributes, zend_string *name, uint32_t argc, uint32_t flags, uint32_t offset, uint32_t lineno)
ZEND_API zend_result zend_get_attribute_value(zval *ret, zend_attribute *attr, uint32_t i, zend_class_entry *scope)
ZEND_API bool zend_is_attribute_repeated(HashTable *attributes, zend_attribute *attr)
void zend_attributes_shutdown(void)
struct _zend_attribute zend_attribute
ZEND_API zend_attribute * zend_get_attribute(HashTable *attributes, zend_string *lcname)
struct _zend_internal_attribute zend_internal_attribute
uint32_t zend_attribute_attribute_get_flags(zend_attribute *attr, zend_class_entry *scope)
#define ZEND_ATTRIBUTE_PERSISTENT
ZEND_API zend_attribute * zend_get_parameter_attribute_str(HashTable *attributes, const char *str, size_t len, uint32_t offset)
ZEND_API zend_result zend_get_attribute_object(zval *out, zend_class_entry *attribute_ce, zend_attribute *attribute_data, zend_class_entry *scope, zend_string *filename)
ZEND_API zend_attribute * zend_get_attribute_str(HashTable *attributes, const char *str, size_t len)
void zend_register_attribute_ce(void)
ZEND_API zend_attribute * zend_get_parameter_attribute(HashTable *attributes, zend_string *lcname, uint32_t offset)
ZEND_API zend_string * zend_get_attribute_target_names(uint32_t targets)
ZEND_API zend_internal_attribute * zend_mark_internal_attribute(zend_class_entry *ce)
struct _zval_struct zval
execute_data func
#define ZEND_USER_FUNCTION
struct _zend_class_constant zend_class_constant
struct _zend_property_info zend_property_info
#define ZEND_USER_CLASS
#define ZEND_API
ZEND_API void(ZEND_FASTCALL *zend_touch_vm_stack_data)(void *vm_stack_data)
union _zend_function zend_function
struct _zend_string zend_string
#define END_EXTERN_C()
#define zend_always_inline
#define BEGIN_EXTERN_C()
struct _zend_class_entry zend_class_entry
struct _zend_array HashTable
Definition zend_types.h:386
ZEND_RESULT_CODE zend_result
Definition zend_types.h:64
zend_string * name
zval * ret
new_op_array scope
out($f, $s)