1
0
mirror of https://github.com/php/php-src.git synced 2026-03-24 00:02:20 +01:00
Files
archived-php-src/ext/zend_test/test_decl.h
Arnaud Le Blanc d16e6f52a4 Generate C enums from internal enums, introduce Z_PARAM_ENUM() (#20917)
Update gen_stubs.php to generate C enums from internal enums, when the stub is annotated with @generate-c-enums. Enum values can be compared to the result of zend_enum_fetch_case_id(zend_object*).

The generated enums are added to separate files named {$extensionName}_decl.h, so that it's possible to include these from anywhere. _arginfo.h files would generate warnings if we tried to include them in a compilation unit that doesn't call the register_{$class} functions, for instance.

Introduce Z_PARAM_ENUM().

* Make ZEND_AST_CONST_ENUM_INIT a 4-children node

* Store enum case id in ZEND_AST_CONST_ENUM_INIT

* Store enum case id in instance

* Expose enum case_id internally

* Generate C enum for internal enums

* Introduce Z_PARAM_ENUM()

* Port extensions
2026-02-03 12:38:04 +01:00

31 lines
1.0 KiB
C
Generated

/* This is a generated file, edit test.stub.php instead.
* Stub hash: 0dc403dd439157aa09ae0692b295092bdc59c1d0 */
#ifndef ZEND_TEST_DECL_0dc403dd439157aa09ae0692b295092bdc59c1d0_H
#define ZEND_TEST_DECL_0dc403dd439157aa09ae0692b295092bdc59c1d0_H
typedef enum zend_enum_ZendTestUnitEnum {
ZEND_ENUM_ZendTestUnitEnum_Foo = 1,
ZEND_ENUM_ZendTestUnitEnum_Bar = 2,
} zend_enum_ZendTestUnitEnum;
typedef enum zend_enum_ZendTestStringEnum {
ZEND_ENUM_ZendTestStringEnum_Foo = 1,
ZEND_ENUM_ZendTestStringEnum_Bar = 2,
ZEND_ENUM_ZendTestStringEnum_Baz = 3,
ZEND_ENUM_ZendTestStringEnum_FortyTwo = 4,
} zend_enum_ZendTestStringEnum;
typedef enum zend_enum_ZendTestIntEnum {
ZEND_ENUM_ZendTestIntEnum_Foo = 1,
ZEND_ENUM_ZendTestIntEnum_Bar = 2,
ZEND_ENUM_ZendTestIntEnum_Baz = 3,
} zend_enum_ZendTestIntEnum;
typedef enum zend_enum_ZendTestEnumWithInterface {
ZEND_ENUM_ZendTestEnumWithInterface_Foo = 1,
ZEND_ENUM_ZendTestEnumWithInterface_Bar = 2,
} zend_enum_ZendTestEnumWithInterface;
#endif /* ZEND_TEST_DECL_0dc403dd439157aa09ae0692b295092bdc59c1d0_H */