Skip to content

Commit 7c30787

Browse files
committed
Generate function entries from stubs for a couple of extensions
Closes GH-5347
1 parent a43bc33 commit 7c30787

38 files changed

+484
-470
lines changed

ext/bcmath/bcmath.c

Lines changed: 1 addition & 15 deletions
Original file line numberDiff line numberDiff line change
@@ -33,24 +33,10 @@ ZEND_DECLARE_MODULE_GLOBALS(bcmath)
3333
static PHP_GINIT_FUNCTION(bcmath);
3434
static PHP_GSHUTDOWN_FUNCTION(bcmath);
3535

36-
static const zend_function_entry bcmath_functions[] = {
37-
PHP_FE(bcadd, arginfo_bcadd)
38-
PHP_FE(bcsub, arginfo_bcsub)
39-
PHP_FE(bcmul, arginfo_bcmul)
40-
PHP_FE(bcdiv, arginfo_bcdiv)
41-
PHP_FE(bcmod, arginfo_bcmod)
42-
PHP_FE(bcpow, arginfo_bcpow)
43-
PHP_FE(bcsqrt, arginfo_bcsqrt)
44-
PHP_FE(bcscale, arginfo_bcscale)
45-
PHP_FE(bccomp, arginfo_bccomp)
46-
PHP_FE(bcpowmod, arginfo_bcpowmod)
47-
PHP_FE_END
48-
};
49-
5036
zend_module_entry bcmath_module_entry = {
5137
STANDARD_MODULE_HEADER,
5238
"bcmath",
53-
bcmath_functions,
39+
ext_functions,
5440
PHP_MINIT(bcmath),
5541
PHP_MSHUTDOWN(bcmath),
5642
NULL,

ext/bcmath/bcmath.stub.php

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,7 @@
11
<?php
22

3+
/** @generate-function-entries */
4+
35
function bcadd(string $left_operand, string $right_operand, int $scale = UNKNOWN): string {}
46

57
function bcsub(string $left_operand, string $right_operand, int $scale = UNKNOWN): string {}

ext/bcmath/bcmath_arginfo.h

Lines changed: 27 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -45,3 +45,30 @@ ZEND_END_ARG_INFO()
4545
ZEND_BEGIN_ARG_WITH_RETURN_TYPE_INFO_EX(arginfo_bcscale, 0, 0, IS_LONG, 0)
4646
ZEND_ARG_TYPE_INFO(0, scale, IS_LONG, 0)
4747
ZEND_END_ARG_INFO()
48+
49+
50+
ZEND_FUNCTION(bcadd);
51+
ZEND_FUNCTION(bcsub);
52+
ZEND_FUNCTION(bcmul);
53+
ZEND_FUNCTION(bcdiv);
54+
ZEND_FUNCTION(bcmod);
55+
ZEND_FUNCTION(bcpowmod);
56+
ZEND_FUNCTION(bcpow);
57+
ZEND_FUNCTION(bcsqrt);
58+
ZEND_FUNCTION(bccomp);
59+
ZEND_FUNCTION(bcscale);
60+
61+
62+
static const zend_function_entry ext_functions[] = {
63+
ZEND_FE(bcadd, arginfo_bcadd)
64+
ZEND_FE(bcsub, arginfo_bcsub)
65+
ZEND_FE(bcmul, arginfo_bcmul)
66+
ZEND_FE(bcdiv, arginfo_bcdiv)
67+
ZEND_FE(bcmod, arginfo_bcmod)
68+
ZEND_FE(bcpowmod, arginfo_bcpowmod)
69+
ZEND_FE(bcpow, arginfo_bcpow)
70+
ZEND_FE(bcsqrt, arginfo_bcsqrt)
71+
ZEND_FE(bccomp, arginfo_bccomp)
72+
ZEND_FE(bcscale, arginfo_bcscale)
73+
ZEND_FE_END
74+
};

ext/bcmath/php_bcmath.h

Lines changed: 0 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -29,17 +29,6 @@ PHP_MINIT_FUNCTION(bcmath);
2929
PHP_MSHUTDOWN_FUNCTION(bcmath);
3030
PHP_MINFO_FUNCTION(bcmath);
3131

32-
PHP_FUNCTION(bcadd);
33-
PHP_FUNCTION(bcsub);
34-
PHP_FUNCTION(bcmul);
35-
PHP_FUNCTION(bcdiv);
36-
PHP_FUNCTION(bcmod);
37-
PHP_FUNCTION(bcpow);
38-
PHP_FUNCTION(bcsqrt);
39-
PHP_FUNCTION(bccomp);
40-
PHP_FUNCTION(bcscale);
41-
PHP_FUNCTION(bcpowmod);
42-
4332
ZEND_BEGIN_MODULE_GLOBALS(bcmath)
4433
bc_num _zero_;
4534
bc_num _one_;

ext/calendar/calendar.c

Lines changed: 1 addition & 24 deletions
Original file line numberDiff line numberDiff line change
@@ -35,33 +35,10 @@
3535
#undef CAL_GREGORIAN
3636
#endif
3737

38-
static const zend_function_entry calendar_functions[] = {
39-
PHP_FE(jdtogregorian, arginfo_jdtogregorian)
40-
PHP_FE(gregoriantojd, arginfo_gregoriantojd)
41-
PHP_FE(jdtojulian, arginfo_jdtojulian)
42-
PHP_FE(juliantojd, arginfo_juliantojd)
43-
PHP_FE(jdtojewish, arginfo_jdtojewish)
44-
PHP_FE(jewishtojd, arginfo_jewishtojd)
45-
PHP_FE(jdtofrench, arginfo_jdtofrench)
46-
PHP_FE(frenchtojd, arginfo_frenchtojd)
47-
PHP_FE(jddayofweek, arginfo_jddayofweek)
48-
PHP_FE(jdmonthname, arginfo_jdmonthname)
49-
PHP_FE(easter_date, arginfo_easter_date)
50-
PHP_FE(easter_days, arginfo_easter_days)
51-
PHP_FE(unixtojd, arginfo_unixtojd)
52-
PHP_FE(jdtounix, arginfo_jdtounix)
53-
PHP_FE(cal_to_jd, arginfo_cal_to_jd)
54-
PHP_FE(cal_from_jd, arginfo_cal_from_jd)
55-
PHP_FE(cal_days_in_month, arginfo_cal_days_in_month)
56-
PHP_FE(cal_info, arginfo_cal_info)
57-
PHP_FE_END
58-
};
59-
60-
6138
zend_module_entry calendar_module_entry = {
6239
STANDARD_MODULE_HEADER,
6340
"calendar",
64-
calendar_functions,
41+
ext_functions,
6542
PHP_MINIT(calendar),
6643
NULL,
6744
NULL,

ext/calendar/calendar.stub.php

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,7 @@
11
<?php
22

3+
/** @generate-function-entries */
4+
35
function cal_days_in_month(int $calendar, int $month, int $year): int {}
46

57
function cal_from_jd(int $jd, int $calendar): array {}

ext/calendar/calendar_arginfo.h

Lines changed: 43 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -72,3 +72,46 @@ ZEND_END_ARG_INFO()
7272
ZEND_BEGIN_ARG_WITH_RETURN_TYPE_MASK_EX(arginfo_unixtojd, 0, 0, MAY_BE_LONG|MAY_BE_FALSE)
7373
ZEND_ARG_TYPE_INFO(0, timestamp, IS_LONG, 0)
7474
ZEND_END_ARG_INFO()
75+
76+
77+
ZEND_FUNCTION(cal_days_in_month);
78+
ZEND_FUNCTION(cal_from_jd);
79+
ZEND_FUNCTION(cal_info);
80+
ZEND_FUNCTION(cal_to_jd);
81+
ZEND_FUNCTION(easter_date);
82+
ZEND_FUNCTION(easter_days);
83+
ZEND_FUNCTION(frenchtojd);
84+
ZEND_FUNCTION(gregoriantojd);
85+
ZEND_FUNCTION(jddayofweek);
86+
ZEND_FUNCTION(jdmonthname);
87+
ZEND_FUNCTION(jdtofrench);
88+
ZEND_FUNCTION(jdtogregorian);
89+
ZEND_FUNCTION(jdtojewish);
90+
ZEND_FUNCTION(jdtojulian);
91+
ZEND_FUNCTION(jdtounix);
92+
ZEND_FUNCTION(jewishtojd);
93+
ZEND_FUNCTION(juliantojd);
94+
ZEND_FUNCTION(unixtojd);
95+
96+
97+
static const zend_function_entry ext_functions[] = {
98+
ZEND_FE(cal_days_in_month, arginfo_cal_days_in_month)
99+
ZEND_FE(cal_from_jd, arginfo_cal_from_jd)
100+
ZEND_FE(cal_info, arginfo_cal_info)
101+
ZEND_FE(cal_to_jd, arginfo_cal_to_jd)
102+
ZEND_FE(easter_date, arginfo_easter_date)
103+
ZEND_FE(easter_days, arginfo_easter_days)
104+
ZEND_FE(frenchtojd, arginfo_frenchtojd)
105+
ZEND_FE(gregoriantojd, arginfo_gregoriantojd)
106+
ZEND_FE(jddayofweek, arginfo_jddayofweek)
107+
ZEND_FE(jdmonthname, arginfo_jdmonthname)
108+
ZEND_FE(jdtofrench, arginfo_jdtofrench)
109+
ZEND_FE(jdtogregorian, arginfo_jdtogregorian)
110+
ZEND_FE(jdtojewish, arginfo_jdtojewish)
111+
ZEND_FE(jdtojulian, arginfo_jdtojulian)
112+
ZEND_FE(jdtounix, arginfo_jdtounix)
113+
ZEND_FE(jewishtojd, arginfo_jewishtojd)
114+
ZEND_FE(juliantojd, arginfo_juliantojd)
115+
ZEND_FE(unixtojd, arginfo_unixtojd)
116+
ZEND_FE_END
117+
};

ext/calendar/php_calendar.h

Lines changed: 0 additions & 19 deletions
Original file line numberDiff line numberDiff line change
@@ -12,25 +12,6 @@ extern zend_module_entry calendar_module_entry;
1212
PHP_MINIT_FUNCTION(calendar);
1313
PHP_MINFO_FUNCTION(calendar);
1414

15-
PHP_FUNCTION(jdtogregorian);
16-
PHP_FUNCTION(gregoriantojd);
17-
PHP_FUNCTION(jdtojulian);
18-
PHP_FUNCTION(juliantojd);
19-
PHP_FUNCTION(jdtojewish);
20-
PHP_FUNCTION(jewishtojd);
21-
PHP_FUNCTION(jdtofrench);
22-
PHP_FUNCTION(frenchtojd);
23-
PHP_FUNCTION(jddayofweek);
24-
PHP_FUNCTION(jdmonthname);
25-
PHP_FUNCTION(easter_days);
26-
PHP_FUNCTION(easter_date);
27-
PHP_FUNCTION(unixtojd);
28-
PHP_FUNCTION(jdtounix);
29-
PHP_FUNCTION(cal_from_jd);
30-
PHP_FUNCTION(cal_to_jd);
31-
PHP_FUNCTION(cal_days_in_month);
32-
PHP_FUNCTION(cal_info);
33-
3415
#define phpext_calendar_ptr calendar_module_ptr
3516

3617
/*

ext/ctype/ctype.c

Lines changed: 12 additions & 42 deletions
Original file line numberDiff line numberDiff line change
@@ -31,44 +31,14 @@
3131

3232
static PHP_MINFO_FUNCTION(ctype);
3333

34-
static PHP_FUNCTION(ctype_alnum);
35-
static PHP_FUNCTION(ctype_alpha);
36-
static PHP_FUNCTION(ctype_cntrl);
37-
static PHP_FUNCTION(ctype_digit);
38-
static PHP_FUNCTION(ctype_lower);
39-
static PHP_FUNCTION(ctype_graph);
40-
static PHP_FUNCTION(ctype_print);
41-
static PHP_FUNCTION(ctype_punct);
42-
static PHP_FUNCTION(ctype_space);
43-
static PHP_FUNCTION(ctype_upper);
44-
static PHP_FUNCTION(ctype_xdigit);
45-
/* }}} */
46-
47-
/* {{{ ctype_functions[]
48-
* Every user visible function must have an entry in ctype_functions[].
49-
*/
50-
static const zend_function_entry ctype_functions[] = {
51-
PHP_FE(ctype_alnum, arginfo_ctype_alnum)
52-
PHP_FE(ctype_alpha, arginfo_ctype_alpha)
53-
PHP_FE(ctype_cntrl, arginfo_ctype_cntrl)
54-
PHP_FE(ctype_digit, arginfo_ctype_digit)
55-
PHP_FE(ctype_lower, arginfo_ctype_lower)
56-
PHP_FE(ctype_graph, arginfo_ctype_graph)
57-
PHP_FE(ctype_print, arginfo_ctype_print)
58-
PHP_FE(ctype_punct, arginfo_ctype_punct)
59-
PHP_FE(ctype_space, arginfo_ctype_space)
60-
PHP_FE(ctype_upper, arginfo_ctype_upper)
61-
PHP_FE(ctype_xdigit, arginfo_ctype_xdigit)
62-
PHP_FE_END
63-
};
6434
/* }}} */
6535

6636
/* {{{ ctype_module_entry
6737
*/
6838
zend_module_entry ctype_module_entry = {
6939
STANDARD_MODULE_HEADER,
7040
"ctype",
71-
ctype_functions,
41+
ext_functions,
7242
NULL,
7343
NULL,
7444
NULL,
@@ -129,87 +99,87 @@ static PHP_MINFO_FUNCTION(ctype)
12999

130100
/* {{{ proto bool ctype_alnum(mixed c)
131101
Checks for alphanumeric character(s) */
132-
static PHP_FUNCTION(ctype_alnum)
102+
PHP_FUNCTION(ctype_alnum)
133103
{
134104
CTYPE(isalnum, 1, 0);
135105
}
136106
/* }}} */
137107

138108
/* {{{ proto bool ctype_alpha(mixed c)
139109
Checks for alphabetic character(s) */
140-
static PHP_FUNCTION(ctype_alpha)
110+
PHP_FUNCTION(ctype_alpha)
141111
{
142112
CTYPE(isalpha, 0, 0);
143113
}
144114
/* }}} */
145115

146116
/* {{{ proto bool ctype_cntrl(mixed c)
147117
Checks for control character(s) */
148-
static PHP_FUNCTION(ctype_cntrl)
118+
PHP_FUNCTION(ctype_cntrl)
149119
{
150120
CTYPE(iscntrl, 0, 0);
151121
}
152122
/* }}} */
153123

154124
/* {{{ proto bool ctype_digit(mixed c)
155125
Checks for numeric character(s) */
156-
static PHP_FUNCTION(ctype_digit)
126+
PHP_FUNCTION(ctype_digit)
157127
{
158128
CTYPE(isdigit, 1, 0);
159129
}
160130
/* }}} */
161131

162132
/* {{{ proto bool ctype_lower(mixed c)
163133
Checks for lowercase character(s) */
164-
static PHP_FUNCTION(ctype_lower)
134+
PHP_FUNCTION(ctype_lower)
165135
{
166136
CTYPE(islower, 0, 0);
167137
}
168138
/* }}} */
169139

170140
/* {{{ proto bool ctype_graph(mixed c)
171141
Checks for any printable character(s) except space */
172-
static PHP_FUNCTION(ctype_graph)
142+
PHP_FUNCTION(ctype_graph)
173143
{
174144
CTYPE(isgraph, 1, 1);
175145
}
176146
/* }}} */
177147

178148
/* {{{ proto bool ctype_print(mixed c)
179149
Checks for printable character(s) */
180-
static PHP_FUNCTION(ctype_print)
150+
PHP_FUNCTION(ctype_print)
181151
{
182152
CTYPE(isprint, 1, 1);
183153
}
184154
/* }}} */
185155

186156
/* {{{ proto bool ctype_punct(mixed c)
187157
Checks for any printable character which is not whitespace or an alphanumeric character */
188-
static PHP_FUNCTION(ctype_punct)
158+
PHP_FUNCTION(ctype_punct)
189159
{
190160
CTYPE(ispunct, 0, 0);
191161
}
192162
/* }}} */
193163

194164
/* {{{ proto bool ctype_space(mixed c)
195165
Checks for whitespace character(s)*/
196-
static PHP_FUNCTION(ctype_space)
166+
PHP_FUNCTION(ctype_space)
197167
{
198168
CTYPE(isspace, 0, 0);
199169
}
200170
/* }}} */
201171

202172
/* {{{ proto bool ctype_upper(mixed c)
203173
Checks for uppercase character(s) */
204-
static PHP_FUNCTION(ctype_upper)
174+
PHP_FUNCTION(ctype_upper)
205175
{
206176
CTYPE(isupper, 0, 0);
207177
}
208178
/* }}} */
209179

210180
/* {{{ proto bool ctype_xdigit(mixed c)
211181
Checks for character(s) representing a hexadecimal digit */
212-
static PHP_FUNCTION(ctype_xdigit)
182+
PHP_FUNCTION(ctype_xdigit)
213183
{
214184
CTYPE(isxdigit, 1, 0);
215185
}

ext/ctype/ctype.stub.php

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,7 @@
11
<?php
22

3+
/** @generate-function-entries */
4+
35
function ctype_alnum($text): bool {}
46

57
function ctype_alpha($text): bool {}

ext/ctype/ctype_arginfo.h

Lines changed: 29 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -23,3 +23,32 @@ ZEND_END_ARG_INFO()
2323
#define arginfo_ctype_upper arginfo_ctype_alnum
2424

2525
#define arginfo_ctype_xdigit arginfo_ctype_alnum
26+
27+
28+
ZEND_FUNCTION(ctype_alnum);
29+
ZEND_FUNCTION(ctype_alpha);
30+
ZEND_FUNCTION(ctype_cntrl);
31+
ZEND_FUNCTION(ctype_digit);
32+
ZEND_FUNCTION(ctype_lower);
33+
ZEND_FUNCTION(ctype_graph);
34+
ZEND_FUNCTION(ctype_print);
35+
ZEND_FUNCTION(ctype_punct);
36+
ZEND_FUNCTION(ctype_space);
37+
ZEND_FUNCTION(ctype_upper);
38+
ZEND_FUNCTION(ctype_xdigit);
39+
40+
41+
static const zend_function_entry ext_functions[] = {
42+
ZEND_FE(ctype_alnum, arginfo_ctype_alnum)
43+
ZEND_FE(ctype_alpha, arginfo_ctype_alpha)
44+
ZEND_FE(ctype_cntrl, arginfo_ctype_cntrl)
45+
ZEND_FE(ctype_digit, arginfo_ctype_digit)
46+
ZEND_FE(ctype_lower, arginfo_ctype_lower)
47+
ZEND_FE(ctype_graph, arginfo_ctype_graph)
48+
ZEND_FE(ctype_print, arginfo_ctype_print)
49+
ZEND_FE(ctype_punct, arginfo_ctype_punct)
50+
ZEND_FE(ctype_space, arginfo_ctype_space)
51+
ZEND_FE(ctype_upper, arginfo_ctype_upper)
52+
ZEND_FE(ctype_xdigit, arginfo_ctype_xdigit)
53+
ZEND_FE_END
54+
};

0 commit comments

Comments
 (0)