1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22 #ifndef ZEND_MULTIBYTE_H
23 #define ZEND_MULTIBYTE_H
24
25 typedef struct _zend_encoding zend_encoding;
26
27 typedef size_t (*zend_encoding_filter)(unsigned char **str, size_t *str_length, const unsigned char *buf, size_t length);
28
29 typedef const zend_encoding* (*zend_encoding_fetcher)(const char *encoding_name);
30 typedef const char* (*zend_encoding_name_getter)(const zend_encoding *encoding);
31 typedef int (*zend_encoding_lexer_compatibility_checker)(const zend_encoding *encoding);
32 typedef const zend_encoding *(*zend_encoding_detector)(const unsigned char *string, size_t length, const zend_encoding **list, size_t list_size);
33 typedef size_t (*zend_encoding_converter)(unsigned char **to, size_t *to_length, const unsigned char *from, size_t from_length, const zend_encoding *encoding_to, const zend_encoding *encoding_from);
34 typedef int (*zend_encoding_list_parser)(const char *encoding_list, size_t encoding_list_len, const zend_encoding ***return_list, size_t *return_size, int persistent);
35 typedef const zend_encoding *(*zend_encoding_internal_encoding_getter)(void);
36 typedef int (*zend_encoding_internal_encoding_setter)(const zend_encoding *encoding);
37
38 typedef struct _zend_multibyte_functions {
39 const char *provider_name;
40 zend_encoding_fetcher encoding_fetcher;
41 zend_encoding_name_getter encoding_name_getter;
42 zend_encoding_lexer_compatibility_checker lexer_compatibility_checker;
43 zend_encoding_detector encoding_detector;
44 zend_encoding_converter encoding_converter;
45 zend_encoding_list_parser encoding_list_parser;
46 zend_encoding_internal_encoding_getter internal_encoding_getter;
47 zend_encoding_internal_encoding_setter internal_encoding_setter;
48 } zend_multibyte_functions;
49
50
51
52
53 BEGIN_EXTERN_C()
54
55 ZEND_API extern const zend_encoding *zend_multibyte_encoding_utf32be;
56 ZEND_API extern const zend_encoding *zend_multibyte_encoding_utf32le;
57 ZEND_API extern const zend_encoding *zend_multibyte_encoding_utf16be;
58 ZEND_API extern const zend_encoding *zend_multibyte_encoding_utf16le;
59 ZEND_API extern const zend_encoding *zend_multibyte_encoding_utf8;
60
61
62 ZEND_API int zend_multibyte_set_functions(const zend_multibyte_functions *functions);
63 ZEND_API const zend_multibyte_functions *zend_multibyte_get_functions(void);
64
65 ZEND_API const zend_encoding *zend_multibyte_fetch_encoding(const char *name);
66 ZEND_API const char *zend_multibyte_get_encoding_name(const zend_encoding *encoding);
67 ZEND_API int zend_multibyte_check_lexer_compatibility(const zend_encoding *encoding);
68 ZEND_API const zend_encoding *zend_multibyte_encoding_detector(const unsigned char *string, size_t length, const zend_encoding **list, size_t list_size);
69 ZEND_API size_t zend_multibyte_encoding_converter(unsigned char **to, size_t *to_length, const unsigned char *from, size_t from_length, const zend_encoding *encoding_to, const zend_encoding *encoding_from);
70 ZEND_API int zend_multibyte_parse_encoding_list(const char *encoding_list, size_t encoding_list_len, const zend_encoding ***return_list, size_t *return_size, int persistent);
71
72 ZEND_API const zend_encoding *zend_multibyte_get_internal_encoding(void);
73 ZEND_API const zend_encoding *zend_multibyte_get_script_encoding(void);
74 ZEND_API int zend_multibyte_set_script_encoding(const zend_encoding **encoding_list, size_t encoding_list_size);
75 ZEND_API int zend_multibyte_set_internal_encoding(const zend_encoding *encoding);
76 ZEND_API int zend_multibyte_set_script_encoding_by_string(const char *new_value, size_t new_value_length);
77
78 END_EXTERN_C()
79
80 #endif
81
82
83
84
85
86
87
88
89