Skip to content

Commit 17c0158

Browse files
committed
Declare ext/intl constants in stubs - part 14
1 parent f743cb0 commit 17c0158

File tree

7 files changed

+183
-85
lines changed

7 files changed

+183
-85
lines changed

ext/intl/grapheme/grapheme.h

Lines changed: 6 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -18,7 +18,12 @@
1818
#include <php.h>
1919
#include <unicode/utypes.h>
2020

21-
void grapheme_register_constants( INIT_FUNC_ARGS );
2221
void grapheme_close_global_iterator( void );
2322

23+
#define GRAPHEME_EXTRACT_TYPE_COUNT 0
24+
#define GRAPHEME_EXTRACT_TYPE_MAXBYTES 1
25+
#define GRAPHEME_EXTRACT_TYPE_MAXCHARS 2
26+
#define GRAPHEME_EXTRACT_TYPE_MIN GRAPHEME_EXTRACT_TYPE_COUNT
27+
#define GRAPHEME_EXTRACT_TYPE_MAX GRAPHEME_EXTRACT_TYPE_MAXCHARS
28+
2429
#endif // GRAPHEME_GRAPHEME_H

ext/intl/grapheme/grapheme_string.c

Lines changed: 0 additions & 18 deletions
Original file line numberDiff line numberDiff line change
@@ -29,24 +29,6 @@
2929

3030
/* }}} */
3131

32-
#define GRAPHEME_EXTRACT_TYPE_COUNT 0
33-
#define GRAPHEME_EXTRACT_TYPE_MAXBYTES 1
34-
#define GRAPHEME_EXTRACT_TYPE_MAXCHARS 2
35-
#define GRAPHEME_EXTRACT_TYPE_MIN GRAPHEME_EXTRACT_TYPE_COUNT
36-
#define GRAPHEME_EXTRACT_TYPE_MAX GRAPHEME_EXTRACT_TYPE_MAXCHARS
37-
38-
39-
/* {{{ grapheme_register_constants
40-
* Register API constants
41-
*/
42-
void grapheme_register_constants( INIT_FUNC_ARGS )
43-
{
44-
REGISTER_LONG_CONSTANT("GRAPHEME_EXTR_COUNT", GRAPHEME_EXTRACT_TYPE_COUNT, CONST_CS | CONST_PERSISTENT);
45-
REGISTER_LONG_CONSTANT("GRAPHEME_EXTR_MAXBYTES", GRAPHEME_EXTRACT_TYPE_MAXBYTES, CONST_CS | CONST_PERSISTENT);
46-
REGISTER_LONG_CONSTANT("GRAPHEME_EXTR_MAXCHARS", GRAPHEME_EXTRACT_TYPE_MAXCHARS, CONST_CS | CONST_PERSISTENT);
47-
}
48-
/* }}} */
49-
5032
/* {{{ Get number of graphemes in a string */
5133
PHP_FUNCTION(grapheme_strlen)
5234
{

ext/intl/idn/idn.c

Lines changed: 1 addition & 59 deletions
Original file line numberDiff line numberDiff line change
@@ -26,69 +26,11 @@
2626
#include <unicode/ustring.h>
2727
#include "ext/standard/php_string.h"
2828

29+
#include "idn.h"
2930
#include "intl_error.h"
3031
#include "intl_convert.h"
3132
/* }}} */
3233

33-
enum {
34-
INTL_IDN_VARIANT_UTS46 = 1
35-
};
36-
37-
/* {{{ grapheme_register_constants
38-
* Register API constants
39-
*/
40-
void idn_register_constants( INIT_FUNC_ARGS )
41-
{
42-
/* OPTIONS */
43-
44-
/* Option to prohibit processing of unassigned codepoints in the input and
45-
do not check if the input conforms to STD-3 ASCII rules. */
46-
REGISTER_LONG_CONSTANT("IDNA_DEFAULT", UIDNA_DEFAULT, CONST_CS | CONST_PERSISTENT);
47-
48-
/* Option to allow processing of unassigned codepoints in the input */
49-
REGISTER_LONG_CONSTANT("IDNA_ALLOW_UNASSIGNED", UIDNA_ALLOW_UNASSIGNED, CONST_CS | CONST_PERSISTENT);
50-
51-
/* Option to check if input conforms to STD-3 ASCII rules */
52-
REGISTER_LONG_CONSTANT("IDNA_USE_STD3_RULES", UIDNA_USE_STD3_RULES, CONST_CS | CONST_PERSISTENT);
53-
54-
/* Option to check for whether the input conforms to the BiDi rules.
55-
* Ignored by the IDNA2003 implementation. (IDNA2003 always performs a BiDi check.) */
56-
REGISTER_LONG_CONSTANT("IDNA_CHECK_BIDI", UIDNA_CHECK_BIDI, CONST_CS | CONST_PERSISTENT);
57-
58-
/* Option to check for whether the input conforms to the CONTEXTJ rules.
59-
* Ignored by the IDNA2003 implementation. (The CONTEXTJ check is new in IDNA2008.) */
60-
REGISTER_LONG_CONSTANT("IDNA_CHECK_CONTEXTJ", UIDNA_CHECK_CONTEXTJ, CONST_CS | CONST_PERSISTENT);
61-
62-
/* Option for nontransitional processing in ToASCII().
63-
* By default, ToASCII() uses transitional processing.
64-
* Ignored by the IDNA2003 implementation. */
65-
REGISTER_LONG_CONSTANT("IDNA_NONTRANSITIONAL_TO_ASCII", UIDNA_NONTRANSITIONAL_TO_ASCII, CONST_CS | CONST_PERSISTENT);
66-
67-
/* Option for nontransitional processing in ToUnicode().
68-
* By default, ToUnicode() uses transitional processing.
69-
* Ignored by the IDNA2003 implementation. */
70-
REGISTER_LONG_CONSTANT("IDNA_NONTRANSITIONAL_TO_UNICODE", UIDNA_NONTRANSITIONAL_TO_UNICODE, CONST_CS | CONST_PERSISTENT);
71-
72-
/* VARIANTS */
73-
REGISTER_LONG_CONSTANT("INTL_IDNA_VARIANT_UTS46", INTL_IDN_VARIANT_UTS46, CONST_CS | CONST_PERSISTENT);
74-
75-
/* PINFO ERROR CODES */
76-
REGISTER_LONG_CONSTANT("IDNA_ERROR_EMPTY_LABEL", UIDNA_ERROR_EMPTY_LABEL, CONST_CS | CONST_PERSISTENT);
77-
REGISTER_LONG_CONSTANT("IDNA_ERROR_LABEL_TOO_LONG", UIDNA_ERROR_LABEL_TOO_LONG, CONST_CS | CONST_PERSISTENT);
78-
REGISTER_LONG_CONSTANT("IDNA_ERROR_DOMAIN_NAME_TOO_LONG", UIDNA_ERROR_DOMAIN_NAME_TOO_LONG, CONST_CS | CONST_PERSISTENT);
79-
REGISTER_LONG_CONSTANT("IDNA_ERROR_LEADING_HYPHEN", UIDNA_ERROR_LEADING_HYPHEN, CONST_CS | CONST_PERSISTENT);
80-
REGISTER_LONG_CONSTANT("IDNA_ERROR_TRAILING_HYPHEN", UIDNA_ERROR_TRAILING_HYPHEN, CONST_CS | CONST_PERSISTENT);
81-
REGISTER_LONG_CONSTANT("IDNA_ERROR_HYPHEN_3_4", UIDNA_ERROR_HYPHEN_3_4, CONST_CS | CONST_PERSISTENT);
82-
REGISTER_LONG_CONSTANT("IDNA_ERROR_LEADING_COMBINING_MARK", UIDNA_ERROR_LEADING_COMBINING_MARK, CONST_CS | CONST_PERSISTENT);
83-
REGISTER_LONG_CONSTANT("IDNA_ERROR_DISALLOWED", UIDNA_ERROR_DISALLOWED, CONST_CS | CONST_PERSISTENT);
84-
REGISTER_LONG_CONSTANT("IDNA_ERROR_PUNYCODE", UIDNA_ERROR_PUNYCODE, CONST_CS | CONST_PERSISTENT);
85-
REGISTER_LONG_CONSTANT("IDNA_ERROR_LABEL_HAS_DOT", UIDNA_ERROR_LABEL_HAS_DOT, CONST_CS | CONST_PERSISTENT);
86-
REGISTER_LONG_CONSTANT("IDNA_ERROR_INVALID_ACE_LABEL", UIDNA_ERROR_INVALID_ACE_LABEL, CONST_CS | CONST_PERSISTENT);
87-
REGISTER_LONG_CONSTANT("IDNA_ERROR_BIDI", UIDNA_ERROR_BIDI, CONST_CS | CONST_PERSISTENT);
88-
REGISTER_LONG_CONSTANT("IDNA_ERROR_CONTEXTJ", UIDNA_ERROR_CONTEXTJ, CONST_CS | CONST_PERSISTENT);
89-
}
90-
/* }}} */
91-
9234
enum {
9335
INTL_IDN_TO_ASCII = 0,
9436
INTL_IDN_TO_UTF8

ext/intl/idn/idn.h

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -19,6 +19,8 @@
1919

2020
#include <php.h>
2121

22-
void idn_register_constants(INIT_FUNC_ARGS);
22+
enum {
23+
INTL_IDN_VARIANT_UTS46 = 1
24+
};
2325

2426
#endif /* IDN_IDN_H */

ext/intl/php_intl.c

Lines changed: 1 addition & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -58,6 +58,7 @@
5858
#include "breakiterator/breakiterator_class.h"
5959
#include "breakiterator/breakiterator_iterators.h"
6060

61+
#include <unicode/uidna.h>
6162
#include "idn/idn.h"
6263
#include "uchar/uchar.h"
6364

@@ -161,8 +162,6 @@ PHP_MINIT_FUNCTION( intl )
161162

162163
msgformat_register_class();
163164

164-
grapheme_register_constants( INIT_FUNC_ARGS_PASSTHRU );
165-
166165
/* Register 'DateFormat' PHP class */
167166
dateformat_register_IntlDateFormatter_class( );
168167

@@ -181,9 +180,6 @@ PHP_MINIT_FUNCTION( intl )
181180
/* Register 'IntlCalendar' PHP class */
182181
calendar_register_IntlCalendar_class( );
183182

184-
/* Expose IDN constants to PHP scripts. */
185-
idn_register_constants(INIT_FUNC_ARGS_PASSTHRU);
186-
187183
/* Register 'Spoofchecker' PHP class */
188184
spoofchecker_register_Spoofchecker_class( );
189185

ext/intl/php_intl.stub.php

Lines changed: 147 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -20,6 +20,153 @@
2020
const INTL_ICU_DATA_VERSION = UNKNOWN;
2121
#endif
2222

23+
/**
24+
* @var int
25+
* @cvalue GRAPHEME_EXTRACT_TYPE_COUNT
26+
*/
27+
const GRAPHEME_EXTR_COUNT = UNKNOWN;
28+
/**
29+
* @var int
30+
* @cvalue GRAPHEME_EXTRACT_TYPE_MAXBYTES
31+
*/
32+
const GRAPHEME_EXTR_MAXBYTES = UNKNOWN;
33+
/**
34+
* @var int
35+
* @cvalue GRAPHEME_EXTRACT_TYPE_MAXCHARS
36+
*/
37+
const GRAPHEME_EXTR_MAXCHARS = UNKNOWN;
38+
39+
/**
40+
* Option to prohibit processing of unassigned codepoints in the input and
41+
* do not check if the input conforms to STD-3 ASCII rules.
42+
* @var int
43+
* @cvalue UIDNA_DEFAULT
44+
*/
45+
const IDNA_DEFAULT = UNKNOWN;
46+
47+
/**
48+
* Option to allow processing of unassigned codepoints in the input
49+
* @var int
50+
* @cvalue UIDNA_ALLOW_UNASSIGNED
51+
*/
52+
const IDNA_ALLOW_UNASSIGNED = UNKNOWN;
53+
54+
/**
55+
* Option to check if input conforms to STD-3 ASCII rules
56+
* @var int
57+
* @cvalue UIDNA_USE_STD3_RULES
58+
*/
59+
const IDNA_USE_STD3_RULES = UNKNOWN;
60+
61+
/**
62+
* Option to check for whether the input conforms to the BiDi rules.
63+
* Ignored by the IDNA2003 implementation. (IDNA2003 always performs a BiDi check.)
64+
* @var int
65+
* @cvalue UIDNA_CHECK_BIDI
66+
*/
67+
const IDNA_CHECK_BIDI = UNKNOWN;
68+
69+
/**
70+
* Option to check for whether the input conforms to the CONTEXTJ rules.
71+
* Ignored by the IDNA2003 implementation. (The CONTEXTJ check is new in IDNA2008.)
72+
* @var int
73+
* @cvalue UIDNA_CHECK_CONTEXTJ
74+
*/
75+
const IDNA_CHECK_CONTEXTJ = UNKNOWN;
76+
77+
/**
78+
* Option for nontransitional processing in ToASCII().
79+
* By default, ToASCII() uses transitional processing.
80+
* Ignored by the IDNA2003 implementation.
81+
* @var int
82+
* @cvalue UIDNA_NONTRANSITIONAL_TO_ASCII
83+
*/
84+
const IDNA_NONTRANSITIONAL_TO_ASCII = UNKNOWN;
85+
86+
/**
87+
* Option for nontransitional processing in ToUnicode().
88+
* By default, ToUnicode() uses transitional processing.
89+
* Ignored by the IDNA2003 implementation.
90+
* @var int
91+
* @cvalue UIDNA_NONTRANSITIONAL_TO_UNICODE
92+
*/
93+
const IDNA_NONTRANSITIONAL_TO_UNICODE = UNKNOWN;
94+
95+
/* VARIANTS */
96+
97+
/**
98+
* @var int
99+
* @cvalue INTL_IDN_VARIANT_UTS46
100+
*/
101+
const INTL_IDNA_VARIANT_UTS46 = UNKNOWN;
102+
103+
/* PINFO ERROR CODES */
104+
/**
105+
* @var int
106+
* @cvalue UIDNA_ERROR_EMPTY_LABEL
107+
*/
108+
const IDNA_ERROR_EMPTY_LABEL = UNKNOWN;
109+
/**
110+
* @var int
111+
* @cvalue UIDNA_ERROR_LABEL_TOO_LONG
112+
*/
113+
const IDNA_ERROR_LABEL_TOO_LONG = UNKNOWN;
114+
/**
115+
* @var int
116+
* @cvalue UIDNA_ERROR_DOMAIN_NAME_TOO_LONG
117+
*/
118+
const IDNA_ERROR_DOMAIN_NAME_TOO_LONG = UNKNOWN;
119+
/**
120+
* @var int
121+
* @cvalue UIDNA_ERROR_LEADING_HYPHEN
122+
*/
123+
const IDNA_ERROR_LEADING_HYPHEN = UNKNOWN;
124+
/**
125+
* @var int
126+
* @cvalue UIDNA_ERROR_TRAILING_HYPHEN
127+
*/
128+
const IDNA_ERROR_TRAILING_HYPHEN = UNKNOWN;
129+
/**
130+
* @var int
131+
* @cvalue UIDNA_ERROR_HYPHEN_3_4
132+
*/
133+
const IDNA_ERROR_HYPHEN_3_4 = UNKNOWN;
134+
/**
135+
* @var int
136+
* @cvalue UIDNA_ERROR_LEADING_COMBINING_MARK
137+
*/
138+
const IDNA_ERROR_LEADING_COMBINING_MARK = UNKNOWN;
139+
/**
140+
* @var int
141+
* @cvalue UIDNA_ERROR_DISALLOWED
142+
*/
143+
const IDNA_ERROR_DISALLOWED = UNKNOWN;
144+
/**
145+
* @var int
146+
* @cvalue UIDNA_ERROR_PUNYCODE
147+
*/
148+
const IDNA_ERROR_PUNYCODE = UNKNOWN;
149+
/**
150+
* @var int
151+
* @cvalue UIDNA_ERROR_LABEL_HAS_DOT
152+
*/
153+
const IDNA_ERROR_LABEL_HAS_DOT = UNKNOWN;
154+
/**
155+
* @var int
156+
* @cvalue UIDNA_ERROR_INVALID_ACE_LABEL
157+
*/
158+
const IDNA_ERROR_INVALID_ACE_LABEL = UNKNOWN;
159+
/**
160+
* @var int
161+
* @cvalue UIDNA_ERROR_BIDI
162+
*/
163+
const IDNA_ERROR_BIDI = UNKNOWN;
164+
/**
165+
* @var int
166+
* @cvalue UIDNA_ERROR_CONTEXTJ
167+
*/
168+
const IDNA_ERROR_CONTEXTJ = UNKNOWN;
169+
23170
class IntlException extends Exception
24171
{
25172
}

ext/intl/php_intl_arginfo.h

Lines changed: 25 additions & 1 deletion
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

0 commit comments

Comments
 (0)