Skip to content

Commit

Permalink
split MINIT for Category
Browse files Browse the repository at this point in the history
  • Loading branch information
remicollet committed Aug 29, 2023
1 parent e3cd5b8 commit 7022d22
Show file tree
Hide file tree
Showing 8 changed files with 87 additions and 64 deletions.
2 changes: 2 additions & 0 deletions package.xml
Original file line number Diff line number Diff line change
Expand Up @@ -77,6 +77,8 @@ Fix: ensure build directories are created for each source directory, fixing an i
<dir name="classes">
<file name="category.c" role="src"/>
<file name="category.h" role="src"/>
<file name="category_arginfo.h" role="src"/>
<file name="category.stub.php" role="src"/>
<file name="intl.c" role="src"/>
<file name="intl.h" role="src"/>
<file name="locale.c" role="src"/>
Expand Down
4 changes: 3 additions & 1 deletion src/php/classes/category.c
Original file line number Diff line number Diff line change
Expand Up @@ -12,8 +12,10 @@

#include "php/classes/category.h"

#include "php/classes/category_arginfo.h"

zend_class_entry *ecma_ce_IntlCategory = NULL;

void registerEcmaIntlCategory() {
PHP_MINIT_FUNCTION(ecma_intl_category) {
ecma_ce_IntlCategory = register_class_Ecma_Intl_Category();
}
2 changes: 1 addition & 1 deletion src/php/classes/category.h
Original file line number Diff line number Diff line change
Expand Up @@ -17,6 +17,6 @@

extern zend_class_entry *ecma_ce_IntlCategory;

void registerEcmaIntlCategory(void);
PHP_MINIT_FUNCTION(ecma_intl_category);

#endif /* ECMA_INTL_PHP_CLASSES_CATEGORY_H */
33 changes: 33 additions & 0 deletions src/php/classes/category.stub.php
Original file line number Diff line number Diff line change
@@ -0,0 +1,33 @@
<?php

/**
* Copyright (c) php-ecma-intl contributors.
*
* This source file is subject to the BSD-3-Clause license that is bundled with
* this package in the file LICENSE and is available at the following web
* address: https://opensource.org/license/bsd-3-clause/
*
* This source file may utilize copyrighted material from third-party open
* source projects, the use of which is acknowledged in the NOTICE file bundled
* with this package.
*
* @generate-class-entries
*/

namespace Ecma\Intl
{
/**
* Categories of values supported by this implementation.
*
* @link https://tc39.es/ecma402/#sec-intl.supportedvaluesof ECMA-402, section 8.3.2, Intl.supportedValuesOf
*/
enum Category: string
{
case Calendar = 'calendar';
case Collation = 'collation';
case Currency = 'currency';
case NumberingSystem = 'numberingSystem';
case TimeZone = 'timeZone';
case Unit = 'unit';
}
}
46 changes: 46 additions & 0 deletions src/php/classes/category_arginfo.h
Original file line number Diff line number Diff line change
@@ -0,0 +1,46 @@
/* This is a generated file, edit the .stub.php file instead.
* Stub hash: 430525d27dcfa691b8f1e7204cbc53adb2db059f */




static const zend_function_entry class_Ecma_Intl_Category_methods[] = {
ZEND_FE_END
};

static zend_class_entry *register_class_Ecma_Intl_Category(void)
{
zend_class_entry *class_entry = zend_register_internal_enum("Ecma\\Intl\\Category", IS_STRING, class_Ecma_Intl_Category_methods);

zval enum_case_Calendar_value;
zend_string *enum_case_Calendar_value_str = zend_string_init("calendar", strlen("calendar"), 1);
ZVAL_STR(&enum_case_Calendar_value, enum_case_Calendar_value_str);
zend_enum_add_case_cstr(class_entry, "Calendar", &enum_case_Calendar_value);

zval enum_case_Collation_value;
zend_string *enum_case_Collation_value_str = zend_string_init("collation", strlen("collation"), 1);
ZVAL_STR(&enum_case_Collation_value, enum_case_Collation_value_str);
zend_enum_add_case_cstr(class_entry, "Collation", &enum_case_Collation_value);

zval enum_case_Currency_value;
zend_string *enum_case_Currency_value_str = zend_string_init("currency", strlen("currency"), 1);
ZVAL_STR(&enum_case_Currency_value, enum_case_Currency_value_str);
zend_enum_add_case_cstr(class_entry, "Currency", &enum_case_Currency_value);

zval enum_case_NumberingSystem_value;
zend_string *enum_case_NumberingSystem_value_str = zend_string_init("numberingSystem", strlen("numberingSystem"), 1);
ZVAL_STR(&enum_case_NumberingSystem_value, enum_case_NumberingSystem_value_str);
zend_enum_add_case_cstr(class_entry, "NumberingSystem", &enum_case_NumberingSystem_value);

zval enum_case_TimeZone_value;
zend_string *enum_case_TimeZone_value_str = zend_string_init("timeZone", strlen("timeZone"), 1);
ZVAL_STR(&enum_case_TimeZone_value, enum_case_TimeZone_value_str);
zend_enum_add_case_cstr(class_entry, "TimeZone", &enum_case_TimeZone_value);

zval enum_case_Unit_value;
zend_string *enum_case_Unit_value_str = zend_string_init("unit", strlen("unit"), 1);
ZVAL_STR(&enum_case_Unit_value, enum_case_Unit_value_str);
zend_enum_add_case_cstr(class_entry, "Unit", &enum_case_Unit_value);

return class_entry;
}
2 changes: 1 addition & 1 deletion src/php/ecma_intl.c
Original file line number Diff line number Diff line change
Expand Up @@ -48,7 +48,7 @@ ZEND_GET_MODULE(ecma_intl)

PHP_MINIT_FUNCTION(ecma_intl) {
registerEcmaIntl();
registerEcmaIntlCategory();
PHP_MINIT(ecma_intl_category)(INIT_FUNC_ARGS_PASSTHRU);
PHP_MINIT(ecma_intl_locale)(INIT_FUNC_ARGS_PASSTHRU);
PHP_MINIT(ecma_intl_locale_characterdirection)(INIT_FUNC_ARGS_PASSTHRU);
PHP_MINIT(ecma_intl_locale_options)(INIT_FUNC_ARGS_PASSTHRU);
Expand Down
18 changes: 0 additions & 18 deletions src/php/ecma_intl.stub.php
Original file line number Diff line number Diff line change
Expand Up @@ -70,21 +70,3 @@ private function __construct()
}
}
}

namespace Ecma\Intl
{
/**
* Categories of values supported by this implementation.
*
* @link https://tc39.es/ecma402/#sec-intl.supportedvaluesof ECMA-402, section 8.3.2, Intl.supportedValuesOf
*/
enum Category: string
{
case Calendar = 'calendar';
case Collation = 'collation';
case Currency = 'currency';
case NumberingSystem = 'numberingSystem';
case TimeZone = 'timeZone';
case Unit = 'unit';
}
}
44 changes: 1 addition & 43 deletions src/php/ecma_intl_arginfo.h
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
/* This is a generated file, edit the .stub.php file instead.
* Stub hash: b5787fc1c5f1ab90a93a5172c5ff4a3b05cf0361 */
* Stub hash: 868093634998e28b498ffe100b93c61ad2000765 */

ZEND_BEGIN_ARG_WITH_RETURN_TYPE_INFO_EX(arginfo_class_Ecma_Intl_getCanonicalLocales, 0, 1, IS_ARRAY, 0)
ZEND_ARG_OBJ_TYPE_MASK(0, locales, Traversable|Stringable, MAY_BE_ARRAY|MAY_BE_STRING|MAY_BE_NULL, NULL)
Expand All @@ -25,11 +25,6 @@ static const zend_function_entry class_Ecma_Intl_methods[] = {
ZEND_FE_END
};


static const zend_function_entry class_Ecma_Intl_Category_methods[] = {
ZEND_FE_END
};

static zend_class_entry *register_class_Ecma_Intl(void)
{
zend_class_entry ce, *class_entry;
Expand All @@ -54,40 +49,3 @@ static zend_class_entry *register_class_Ecma_Intl(void)

return class_entry;
}

static zend_class_entry *register_class_Ecma_Intl_Category(void)
{
zend_class_entry *class_entry = zend_register_internal_enum("Ecma\\Intl\\Category", IS_STRING, class_Ecma_Intl_Category_methods);

zval enum_case_Calendar_value;
zend_string *enum_case_Calendar_value_str = zend_string_init("calendar", strlen("calendar"), 1);
ZVAL_STR(&enum_case_Calendar_value, enum_case_Calendar_value_str);
zend_enum_add_case_cstr(class_entry, "Calendar", &enum_case_Calendar_value);

zval enum_case_Collation_value;
zend_string *enum_case_Collation_value_str = zend_string_init("collation", strlen("collation"), 1);
ZVAL_STR(&enum_case_Collation_value, enum_case_Collation_value_str);
zend_enum_add_case_cstr(class_entry, "Collation", &enum_case_Collation_value);

zval enum_case_Currency_value;
zend_string *enum_case_Currency_value_str = zend_string_init("currency", strlen("currency"), 1);
ZVAL_STR(&enum_case_Currency_value, enum_case_Currency_value_str);
zend_enum_add_case_cstr(class_entry, "Currency", &enum_case_Currency_value);

zval enum_case_NumberingSystem_value;
zend_string *enum_case_NumberingSystem_value_str = zend_string_init("numberingSystem", strlen("numberingSystem"), 1);
ZVAL_STR(&enum_case_NumberingSystem_value, enum_case_NumberingSystem_value_str);
zend_enum_add_case_cstr(class_entry, "NumberingSystem", &enum_case_NumberingSystem_value);

zval enum_case_TimeZone_value;
zend_string *enum_case_TimeZone_value_str = zend_string_init("timeZone", strlen("timeZone"), 1);
ZVAL_STR(&enum_case_TimeZone_value, enum_case_TimeZone_value_str);
zend_enum_add_case_cstr(class_entry, "TimeZone", &enum_case_TimeZone_value);

zval enum_case_Unit_value;
zend_string *enum_case_Unit_value_str = zend_string_init("unit", strlen("unit"), 1);
ZVAL_STR(&enum_case_Unit_value, enum_case_Unit_value_str);
zend_enum_add_case_cstr(class_entry, "Unit", &enum_case_Unit_value);

return class_entry;
}

0 comments on commit 7022d22

Please sign in to comment.