-
Notifications
You must be signed in to change notification settings - Fork 1
/
php_chardet_class.h
107 lines (93 loc) · 3.26 KB
/
php_chardet_class.h
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
/*
* Copyright 2022. JoungKyun.Kim All rights reserved
*
* This file is part of mod_chardet
*
* This program is free software; you can redistribute it and/or modify
* it under the terms of the GNU LESSER GENERAL PUBLIC LICENSE as published
* by the Free Software Foundation; either version 2 of the License.
*
* This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU LESSER GENERAL PUBLIC LICENSE for more details.
*
* You should have received a copy of the GNU LESSER GENERAL PUBLIC LICENSE
* along with this program; if not, write to the Free Software Foundation, Inc.,
* 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA.
*/
#ifndef PHP_CHARDET_CLASS_H
#define PHP_CHARDET_CLASS_H
/* {{{ Exception entry */
const zend_function_entry chardet_methods_exception[] = {
{NULL, NULL, NULL}
};
/* }}} */
/* Exception declear {{{
*/
#if defined(HAVE_SPL)
extern PHPAPI zend_class_entry *spl_ce_RuntimeException;
extern PHPAPI zend_class_entry *spl_ce_Countable;
#endif
#define CHARDET_REPLACE_ERROR_HANDLING \
zend_replace_error_handling ( \
EH_THROW, \
chardet_ce_exception, \
&error_handling \
)
#define CHARDET_RESTORE_ERROR_HANDLING zend_restore_error_handling (&error_handling)
/* }}} */
/* {{{ chardet_deps[]
*
* CHARDET dependancies
*/
const zend_module_dep chardet_deps[] = {
#if defined(HAVE_SPL)
ZEND_MOD_REQUIRED("spl")
#endif
{NULL, NULL, NULL}
};
/* }}} */
/* {{{ For Class declears */
const zend_function_entry chardet_methods[] = {
ZEND_ME_MAPPING (__construct, chardet_open, arginfo_class_CHARDET___construct, ZEND_ACC_PUBLIC)
ZEND_ME_MAPPING (close, chardet_close, arginfo_class_CHARDET_close, ZEND_ACC_PUBLIC)
ZEND_ME_MAPPING (detect, chardet_detect, arginfo_class_CHARDET_detect, ZEND_ACC_PUBLIC)
ZEND_FE_END
};
#define REGISTER_CHARDET_CLASS(parent) { \
zend_class_entry ce; \
INIT_CLASS_ENTRY (ce, "CHARDET", chardet_methods); \
ce.create_object = chardet_object_new_main; \
chardet_ce = zend_register_internal_class_ex (&ce, parent); \
memcpy(&chardet_object_handlers, zend_get_std_object_handlers(), sizeof(zend_object_handlers)); \
chardet_object_handlers.clone_obj = NULL; \
chardet_ce->ce_flags |= ZEND_ACC_FINAL; \
}
#define REGISTER_CHARDET_PER_CLASS(name, c_name, parent) { \
zend_class_entry ce; \
INIT_CLASS_ENTRY(ce, "CHARDET" # name, chardet_methods_ ## c_name); \
ce.create_object = chardet_object_new_ ## c_name; \
chardet_ce_ ## c_name = zend_register_internal_class_ex(&ce, parent); \
memcpy(&chardet_object_handlers_ ## c_name, zend_get_std_object_handlers(), sizeof(zend_object_handlers)); \
chardet_object_handlers_ ## c_name.clone_obj = NULL; \
chardet_ce_ ## c_name->ce_flags |= ZEND_ACC_FINAL; \
}
zend_class_entry * chardet_ce;
zend_class_entry * chardet_ce_exception;
static zend_object_handlers chardet_object_handlers;
static zend_object_handlers chardet_object_handlers_exception;
typedef struct _chardet_object {
CharDetFP * fp;
zend_object std;
} chardet_obj;
/* For Class declears }}} */
#endif /* PHP_CHARDET_CLASS_H */
/*
* Local variables:
* tab-width: 4
* c-basic-offset: 4
* End:
* vim600: noet sw=4 ts=4 fdm=marker
* vim<600: noet sw=4 ts=4
*/