forked from viest/php-ext-xlswriter
-
Notifications
You must be signed in to change notification settings - Fork 0
/
xlswriter.c
170 lines (149 loc) · 4.14 KB
/
xlswriter.c
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
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
/*
+----------------------------------------------------------------------+
| XlsWriter Extension |
+----------------------------------------------------------------------+
| Copyright (c) 2017-2018 The Viest |
+----------------------------------------------------------------------+
| http://www.viest.me |
+----------------------------------------------------------------------+
| Author: viest <[email protected]> |
+----------------------------------------------------------------------+
*/
#ifdef HAVE_CONFIG_H
#include "config.h"
#endif
#include "php.h"
#include "ext/standard/info.h"
#include "xlswriter.h"
#if ENABLE_READER
#include <xlsxio_version.h>
#include <xlsxio_read.h>
#endif
int le_xls_writer;
ZEND_BEGIN_ARG_INFO_EX(xlswriter_get_version_arginfo, 0, 0, 0)
ZEND_END_ARG_INFO()
ZEND_BEGIN_ARG_INFO_EX(xlswriter_get_auther_arginfo, 0, 0, 0)
ZEND_END_ARG_INFO()
/* {{{ xlswriter_get_version
*/
PHP_FUNCTION(xlswriter_get_version)
{
RETURN_STRINGL(PHP_XLSWRITER_VERSION, strlen(PHP_XLSWRITER_VERSION));
}
/* }}} */
/* {{{ xlswriter_get_author
*/
PHP_FUNCTION(xlswriter_get_author)
{
RETURN_STRINGL(PHP_XLSWRITER_AUTHOR, strlen(PHP_XLSWRITER_AUTHOR));
}
/* }}} */
/* {{{ PHP_MINIT_FUNCTION
*/
PHP_MINIT_FUNCTION(xlswriter)
{
VTIFUL_STARTUP_MODULE(exception);
VTIFUL_STARTUP_MODULE(excel);
VTIFUL_STARTUP_MODULE(format);
VTIFUL_STARTUP_MODULE(chart);
VTIFUL_STARTUP_MODULE(validation);
VTIFUL_STARTUP_MODULE(rich_string);
le_xls_writer = zend_register_list_destructors_ex(_php_vtiful_xls_close, NULL, VTIFUL_RESOURCE_NAME, module_number);
return SUCCESS;
}
/* }}} */
/* {{{ PHP_MSHUTDOWN_FUNCTION
*/
PHP_MSHUTDOWN_FUNCTION(xlswriter)
{
return SUCCESS;
}
/* }}} */
/* {{{ PHP_RINIT_FUNCTION
*/
PHP_RINIT_FUNCTION(xlswriter)
{
#if defined(COMPILE_DL_VTIFUL) && defined(ZTS)
ZEND_TSRMLS_CACHE_UPDATE();
#endif
return SUCCESS;
}
/* }}} */
/* {{{ PHP_RSHUTDOWN_FUNCTION
*/
PHP_RSHUTDOWN_FUNCTION(xlswriter)
{
return SUCCESS;
}
/* }}} */
/* {{{ PHP_MINFO_FUNCTION
*/
PHP_MINFO_FUNCTION(xlswriter)
{
php_info_print_table_start();
php_info_print_table_header(2, "xlswriter support", "enabled");
#if defined(PHP_XLSWRITER_VERSION)
php_info_print_table_row(2, "Version", PHP_XLSWRITER_VERSION);
#endif
#ifdef LXW_VERSION
#ifdef HAVE_LIBXLSXWRITER
/* Build time */
php_info_print_table_row(2, "libxlsxwriter headers version", LXW_VERSION);
/* Run time, available since 0.7.9 */
php_info_print_table_row(2, "libxlsxwriter library version", lxw_version());
#else
php_info_print_table_row(2, "bundled libxlsxwriter version", LXW_VERSION);
#endif
#endif
#if ENABLE_READER
#if HAVE_LIBXLSXIO
/* Build time */
php_info_print_table_row(2, "libxlsxio headers version", XLSXIO_VERSION_STRING);
/* Run time */
php_info_print_table_row(2, "libxlsxio library version", xlsxioread_get_version_string());
#else
php_info_print_table_row(2, "bundled libxlsxio version", XLSXIO_VERSION_STRING);
#endif
#endif
php_info_print_table_end();
}
/* }}} */
/* {{{ xlswriter_functions[]
*
* Every user visible function must have an entry in xlswriter_functions[].
*/
const zend_function_entry xlswriter_functions[] = {
PHP_FE(xlswriter_get_version, xlswriter_get_version_arginfo)
PHP_FE(xlswriter_get_author, xlswriter_get_auther_arginfo)
PHP_FE_END
};
/* }}} */
/* {{{ vtiful_module_entry
*/
zend_module_entry xlswriter_module_entry = {
STANDARD_MODULE_HEADER,
"xlswriter",
xlswriter_functions,
PHP_MINIT(xlswriter),
PHP_MSHUTDOWN(xlswriter),
PHP_RINIT(xlswriter), /* Replace with NULL if there's nothing to do at request start */
PHP_RSHUTDOWN(xlswriter), /* Replace with NULL if there's nothing to do at request end */
PHP_MINFO(xlswriter),
PHP_XLSWRITER_VERSION,
STANDARD_MODULE_PROPERTIES
};
/* }}} */
#ifdef COMPILE_DL_XLSWRITER
#ifdef ZTS
ZEND_TSRMLS_CACHE_DEFINE();
#endif
ZEND_GET_MODULE(xlswriter)
#endif
/*
* 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
*/