-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathresource.c
50 lines (40 loc) · 1.64 KB
/
resource.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
/*
+----------------------------------------------------------------------+
| XlsWriter Extension |
+----------------------------------------------------------------------+
| Copyright (c) 2017-2018 The Viest |
+----------------------------------------------------------------------+
| http://www.viest.me |
+----------------------------------------------------------------------+
| Author: viest <[email protected]> |
+----------------------------------------------------------------------+
*/
#include "xlswriter.h"
/* {{{ */
xls_resource_t * zval_get_resource(zval *handle)
{
xls_resource_t *res;
if((res = (xls_resource_t *)zend_fetch_resource(Z_RES_P(handle), VTIFUL_RESOURCE_NAME, le_xls_writer)) == NULL) {
zend_throw_exception(vtiful_exception_ce, "XLS resources resolution fail", 210);
}
return res;
}
/* }}} */
/* {{{ */
lxw_format * zval_get_format(zval *handle)
{
lxw_format *res;
if((res = (lxw_format *)zend_fetch_resource(Z_RES_P(handle), VTIFUL_RESOURCE_NAME, le_xls_writer)) == NULL) {
zend_throw_exception(vtiful_exception_ce, "format resources resolution fail", 210);
}
return res;
}
/* }}} */
xls_resource_chart_t *zval_get_chart(zval *resource)
{
xls_resource_chart_t *res;
if((res = (xls_resource_chart_t *)zend_fetch_resource(Z_RES_P(resource), VTIFUL_RESOURCE_NAME, le_xls_writer)) == NULL) {
zend_throw_exception(vtiful_exception_ce, "chart resources resolution fail", 210);
}
return res;
}