Skip to content

Commit 96f7110

Browse files
committed
split MINIT for CharacterDirection
1 parent 5cae91f commit 96f7110

File tree

8 files changed

+64
-41
lines changed

8 files changed

+64
-41
lines changed

package.xml

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -83,6 +83,8 @@ Fix: remove package.xml from manifest to avoid md5 checksum errors when installi
8383
<file name="locale.h" role="src"/>
8484
<file name="locale_character_direction.c" role="src"/>
8585
<file name="locale_character_direction.h" role="src"/>
86+
<file name="locale_character_direction_arginfo.h" role="src"/>
87+
<file name="locale_character_direction.stub.php" role="src"/>
8688
<file name="locale_options.c" role="src"/>
8789
<file name="locale_options.h" role="src"/>
8890
<file name="locale_options_arginfo.h" role="src"/>

src/php/classes/locale_character_direction.c

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -12,9 +12,11 @@
1212

1313
#include "php/classes/locale_character_direction.h"
1414

15+
#include "php/classes/locale_character_direction_arginfo.h"
16+
1517
zend_class_entry *ecma_ce_IntlLocaleCharacterDirection = NULL;
1618

17-
void registerEcmaIntlLocaleCharacterDirection() {
19+
PHP_MINIT_FUNCTION(ecma_intl_locale_characterdirection) {
1820
ecma_ce_IntlLocaleCharacterDirection =
1921
register_class_Ecma_Intl_Locale_CharacterDirection();
2022
}

src/php/classes/locale_character_direction.h

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -17,6 +17,6 @@
1717

1818
extern zend_class_entry *ecma_ce_IntlLocaleCharacterDirection;
1919

20-
void registerEcmaIntlLocaleCharacterDirection(void);
20+
PHP_MINIT_FUNCTION(ecma_intl_locale_characterdirection);
2121

2222
#endif /* ECMA_INTL_PHP_CLASSES_LOCALE_CHARACTER_DIRECTION_H */
Lines changed: 30 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,30 @@
1+
<?php
2+
3+
/**
4+
* Copyright (c) php-ecma-intl contributors.
5+
*
6+
* This source file is subject to the BSD-3-Clause license that is bundled with
7+
* this package in the file LICENSE and is available at the following web
8+
* address: https://opensource.org/license/bsd-3-clause/
9+
*
10+
* This source file may utilize copyrighted material from third-party open
11+
* source projects, the use of which is acknowledged in the NOTICE file bundled
12+
* with this package.
13+
*
14+
* @generate-class-entries
15+
*/
16+
17+
namespace Ecma\Intl\Locale
18+
{
19+
/**
20+
* The character direction of a locale
21+
*
22+
* @link https://tc39.es/proposal-intl-locale-info/#sec-character-direction-of-locale Intl Locale Info Proposal: CharacterDirectionOfLocale
23+
* @link https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Intl/Locale/getTextInfo MDN: Intl.Locale.prototype.getTextInfo()
24+
*/
25+
enum CharacterDirection: string
26+
{
27+
case LeftToRight = 'ltr';
28+
case RightToLeft = 'rtl';
29+
}
30+
}
Lines changed: 26 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,26 @@
1+
/* This is a generated file, edit the .stub.php file instead.
2+
* Stub hash: b724e4f4feafd36532cb91b7639d6efb8257563e */
3+
4+
5+
6+
7+
static const zend_function_entry class_Ecma_Intl_Locale_CharacterDirection_methods[] = {
8+
ZEND_FE_END
9+
};
10+
11+
static zend_class_entry *register_class_Ecma_Intl_Locale_CharacterDirection(void)
12+
{
13+
zend_class_entry *class_entry = zend_register_internal_enum("Ecma\\Intl\\Locale\\CharacterDirection", IS_STRING, class_Ecma_Intl_Locale_CharacterDirection_methods);
14+
15+
zval enum_case_LeftToRight_value;
16+
zend_string *enum_case_LeftToRight_value_str = zend_string_init("ltr", strlen("ltr"), 1);
17+
ZVAL_STR(&enum_case_LeftToRight_value, enum_case_LeftToRight_value_str);
18+
zend_enum_add_case_cstr(class_entry, "LeftToRight", &enum_case_LeftToRight_value);
19+
20+
zval enum_case_RightToLeft_value;
21+
zend_string *enum_case_RightToLeft_value_str = zend_string_init("rtl", strlen("rtl"), 1);
22+
ZVAL_STR(&enum_case_RightToLeft_value, enum_case_RightToLeft_value_str);
23+
zend_enum_add_case_cstr(class_entry, "RightToLeft", &enum_case_RightToLeft_value);
24+
25+
return class_entry;
26+
}

src/php/ecma_intl.c

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -50,7 +50,7 @@ PHP_MINIT_FUNCTION(ecma_intl) {
5050
registerEcmaIntl();
5151
registerEcmaIntlCategory();
5252
registerEcmaIntlLocale();
53-
registerEcmaIntlLocaleCharacterDirection();
53+
PHP_MINIT(ecma_intl_locale_characterdirection)(INIT_FUNC_ARGS_PASSTHRU);
5454
PHP_MINIT(ecma_intl_locale_options)(INIT_FUNC_ARGS_PASSTHRU);
5555
PHP_MINIT(ecma_intl_locale_textinfo)(INIT_FUNC_ARGS_PASSTHRU);
5656
PHP_MINIT(ecma_intl_locale_weekday)(INIT_FUNC_ARGS_PASSTHRU);

src/php/ecma_intl.stub.php

Lines changed: 0 additions & 15 deletions
Original file line numberDiff line numberDiff line change
@@ -519,18 +519,3 @@ public function toString(): string
519519
}
520520
}
521521
}
522-
523-
namespace Ecma\Intl\Locale
524-
{
525-
/**
526-
* The character direction of a locale
527-
*
528-
* @link https://tc39.es/proposal-intl-locale-info/#sec-character-direction-of-locale Intl Locale Info Proposal: CharacterDirectionOfLocale
529-
* @link https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Intl/Locale/getTextInfo MDN: Intl.Locale.prototype.getTextInfo()
530-
*/
531-
enum CharacterDirection: string
532-
{
533-
case LeftToRight = 'ltr';
534-
case RightToLeft = 'rtl';
535-
}
536-
}

src/php/ecma_intl_arginfo.h

Lines changed: 1 addition & 23 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
/* This is a generated file, edit the .stub.php file instead.
2-
* Stub hash: 7db65d48e4bb68ee221392b522852c6b5ca82917 */
2+
* Stub hash: 75747aeb884d19afbe885ea7e384cf087cb3878f */
33

44
ZEND_BEGIN_ARG_WITH_RETURN_TYPE_INFO_EX(arginfo_class_Ecma_Intl_getCanonicalLocales, 0, 1, IS_ARRAY, 0)
55
ZEND_ARG_OBJ_TYPE_MASK(0, locales, Traversable|Stringable, MAY_BE_ARRAY|MAY_BE_STRING|MAY_BE_NULL, NULL)
@@ -100,11 +100,6 @@ static const zend_function_entry class_Ecma_Intl_Locale_methods[] = {
100100
ZEND_FE_END
101101
};
102102

103-
104-
static const zend_function_entry class_Ecma_Intl_Locale_CharacterDirection_methods[] = {
105-
ZEND_FE_END
106-
};
107-
108103
static zend_class_entry *register_class_Ecma_Intl(void)
109104
{
110105
zend_class_entry ce, *class_entry;
@@ -288,20 +283,3 @@ static zend_class_entry *register_class_Ecma_Intl_Locale(zend_class_entry *class
288283

289284
return class_entry;
290285
}
291-
292-
static zend_class_entry *register_class_Ecma_Intl_Locale_CharacterDirection(void)
293-
{
294-
zend_class_entry *class_entry = zend_register_internal_enum("Ecma\\Intl\\Locale\\CharacterDirection", IS_STRING, class_Ecma_Intl_Locale_CharacterDirection_methods);
295-
296-
zval enum_case_LeftToRight_value;
297-
zend_string *enum_case_LeftToRight_value_str = zend_string_init("ltr", strlen("ltr"), 1);
298-
ZVAL_STR(&enum_case_LeftToRight_value, enum_case_LeftToRight_value_str);
299-
zend_enum_add_case_cstr(class_entry, "LeftToRight", &enum_case_LeftToRight_value);
300-
301-
zval enum_case_RightToLeft_value;
302-
zend_string *enum_case_RightToLeft_value_str = zend_string_init("rtl", strlen("rtl"), 1);
303-
ZVAL_STR(&enum_case_RightToLeft_value, enum_case_RightToLeft_value_str);
304-
zend_enum_add_case_cstr(class_entry, "RightToLeft", &enum_case_RightToLeft_value);
305-
306-
return class_entry;
307-
}

0 commit comments

Comments
 (0)